define(["animation/AnimationEvent","trigger/TriggerEvent","page/PageEvent","playmode/PlayModeEvent","animation/AnimationStateEvent","core/Mediator"],function(i,e,n,E,t,T){"use strict";function I(i){b[i.id]=!0,T.publish(t.DELAYED,i)}function s(i){b[i.id]=!0,T.publish(t.STARTED,i)}function A(i){b[i.id]&&delete b[i.id],T.publish(t.FINISHED,i)}function N(i){var e=!u(i);e?b[i.id]=!0:b[i.id]&&(T.publish(t.FINISHED,i),delete b[i.id]);var n=JSON.parse(JSON.stringify(i));n.isFiniteRepeats=e,T.publish(t.REPEATED,n)}function r(){b={}}function u(i){return i&&-1!==c.indexOf(i.repeats)}var b={},c=["infinite",1/0];return function(){T.subscribe(i.ENTER_ANIMATION_STARTED,s),T.subscribe(i.ENTER_ANIMATION_DELAY_STARTED,I),T.subscribe(i.ENTER_ANIMATION_FINISHED,A),T.subscribe(i.ENTER_ANIMATION_REPETITION_STARTED,N),T.subscribe(e.TRIGGER_ANIMATION_STARTED,s),T.subscribe(e.TRIGGER_ANIMATION_FINISHED,A),T.subscribe(e.TRIGGER_ANIMATION_REPETITION_STARTED,N),T.subscribe(E.SOLVE_ANIMATION_STARTED,s),T.subscribe(E.SOLVE_ANIMATION_FINISHED,A),T.subscribe(n.ENTER,r)}(),{isAnyAnimationPlaying:function(){return Object.keys(b).length>0}}});