@angular/animations 4.4.0-RC.0 → 4.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,10 @@
1
1
  /**
2
- * @license Angular v4.4.0-RC.0
2
+ * @license Angular v4.4.4
3
3
  * (c) 2010-2017 Google, Inc. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
  !function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/animations")):"function"==typeof define&&define.amd?define(["exports","@angular/animations"],factory):factory((global.ng=global.ng||{},global.ng.animations=global.ng.animations||{},global.ng.animations.browser=global.ng.animations.browser||{}),global.ng.animations)}(this,function(exports,_angular_animations){"use strict";function __extends(d,b){function __(){this.constructor=d}extendStatics(d,b),d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)}/**
7
- * @license Angular v4.4.0-RC.0
7
+ * @license Angular v4.4.4
8
8
  * (c) 2010-2017 Google, Inc. https://angular.io/
9
9
  * License: MIT
10
10
  */
@@ -50,7 +50,7 @@ function buildTrigger(name,ast){return new AnimationTrigger(name,ast)}function c
50
50
  * Use of this source code is governed by an MIT-style license that can be
51
51
  * found in the LICENSE file at https://angular.io/license
52
52
  */
53
- var ONE_SECOND=1e3,SUBSTITUTION_EXPR_START="{{",SUBSTITUTION_EXPR_END="}}",ENTER_CLASSNAME="ng-enter",LEAVE_CLASSNAME="ng-leave",ENTER_SELECTOR=".ng-enter",LEAVE_SELECTOR=".ng-leave",NG_TRIGGER_CLASSNAME="ng-trigger",NG_TRIGGER_SELECTOR=".ng-trigger",NG_ANIMATING_CLASSNAME="ng-animating",NG_ANIMATING_SELECTOR=".ng-animating",PARAM_REGEX=new RegExp(SUBSTITUTION_EXPR_START+"\\s*(.+?)\\s*"+SUBSTITUTION_EXPR_END,"g"),DASH_CASE_REGEXP=/-+([a-z0-9])/g,EMPTY_ANIMATION_OPTIONS={},Ast=function(){function Ast(){this.options=EMPTY_ANIMATION_OPTIONS}return Ast.prototype.visit=function(ast,context){},Object.defineProperty(Ast.prototype,"params",{get:function(){return this.options.params||null},enumerable:!0,configurable:!0}),Ast}(),TriggerAst=function(_super){function TriggerAst(name,states,transitions){var _this=_super.call(this)||this;return _this.name=name,_this.states=states,_this.transitions=transitions,_this.queryCount=0,_this.depCount=0,_this}return __extends(TriggerAst,_super),TriggerAst.prototype.visit=function(visitor,context){return visitor.visitTrigger(this,context)},TriggerAst}(Ast),StateAst=function(_super){function StateAst(name,style$$1){var _this=_super.call(this)||this;return _this.name=name,_this.style=style$$1,_this}return __extends(StateAst,_super),StateAst.prototype.visit=function(visitor,context){return visitor.visitState(this,context)},StateAst}(Ast),TransitionAst=function(_super){function TransitionAst(matchers,animation){var _this=_super.call(this)||this;return _this.matchers=matchers,_this.animation=animation,_this.queryCount=0,_this.depCount=0,_this}return __extends(TransitionAst,_super),TransitionAst.prototype.visit=function(visitor,context){return visitor.visitTransition(this,context)},TransitionAst}(Ast),SequenceAst=function(_super){function SequenceAst(steps){var _this=_super.call(this)||this;return _this.steps=steps,_this}return __extends(SequenceAst,_super),SequenceAst.prototype.visit=function(visitor,context){return visitor.visitSequence(this,context)},SequenceAst}(Ast),GroupAst=function(_super){function GroupAst(steps){var _this=_super.call(this)||this;return _this.steps=steps,_this}return __extends(GroupAst,_super),GroupAst.prototype.visit=function(visitor,context){return visitor.visitGroup(this,context)},GroupAst}(Ast),AnimateAst=function(_super){function AnimateAst(timings,style$$1){var _this=_super.call(this)||this;return _this.timings=timings,_this.style=style$$1,_this}return __extends(AnimateAst,_super),AnimateAst.prototype.visit=function(visitor,context){return visitor.visitAnimate(this,context)},AnimateAst}(Ast),StyleAst=function(_super){function StyleAst(styles,easing,offset){var _this=_super.call(this)||this;return _this.styles=styles,_this.easing=easing,_this.offset=offset,_this.isEmptyStep=!1,_this.containsDynamicStyles=!1,_this}return __extends(StyleAst,_super),StyleAst.prototype.visit=function(visitor,context){return visitor.visitStyle(this,context)},StyleAst}(Ast),KeyframesAst=function(_super){function KeyframesAst(styles){var _this=_super.call(this)||this;return _this.styles=styles,_this}return __extends(KeyframesAst,_super),KeyframesAst.prototype.visit=function(visitor,context){return visitor.visitKeyframes(this,context)},KeyframesAst}(Ast),ReferenceAst=function(_super){function ReferenceAst(animation){var _this=_super.call(this)||this;return _this.animation=animation,_this}return __extends(ReferenceAst,_super),ReferenceAst.prototype.visit=function(visitor,context){return visitor.visitReference(this,context)},ReferenceAst}(Ast),AnimateChildAst=function(_super){function AnimateChildAst(){return _super.call(this)||this}return __extends(AnimateChildAst,_super),AnimateChildAst.prototype.visit=function(visitor,context){return visitor.visitAnimateChild(this,context)},AnimateChildAst}(Ast),AnimateRefAst=function(_super){function AnimateRefAst(animation){var _this=_super.call(this)||this;return _this.animation=animation,_this}return __extends(AnimateRefAst,_super),AnimateRefAst.prototype.visit=function(visitor,context){return visitor.visitAnimateRef(this,context)},AnimateRefAst}(Ast),QueryAst=function(_super){function QueryAst(selector,limit,optional,includeSelf,animation){var _this=_super.call(this)||this;return _this.selector=selector,_this.limit=limit,_this.optional=optional,_this.includeSelf=includeSelf,_this.animation=animation,_this}return __extends(QueryAst,_super),QueryAst.prototype.visit=function(visitor,context){return visitor.visitQuery(this,context)},QueryAst}(Ast),StaggerAst=function(_super){function StaggerAst(timings,animation){var _this=_super.call(this)||this;return _this.timings=timings,_this.animation=animation,_this}return __extends(StaggerAst,_super),StaggerAst.prototype.visit=function(visitor,context){return visitor.visitStagger(this,context)},StaggerAst}(Ast),TimingAst=function(_super){function TimingAst(duration,delay,easing){void 0===delay&&(delay=0),void 0===easing&&(easing=null);var _this=_super.call(this)||this;return _this.duration=duration,_this.delay=delay,_this.easing=easing,_this}return __extends(TimingAst,_super),TimingAst.prototype.visit=function(visitor,context){return visitor.visitTiming(this,context)},TimingAst}(Ast),DynamicTimingAst=function(_super){function DynamicTimingAst(value){var _this=_super.call(this,0,0,"")||this;return _this.value=value,_this}return __extends(DynamicTimingAst,_super),DynamicTimingAst.prototype.visit=function(visitor,context){return visitor.visitTiming(this,context)},DynamicTimingAst}(TimingAst),ANY_STATE="*",SELF_TOKEN=":self",SELF_TOKEN_REGEX=new RegExp("s*"+SELF_TOKEN+"s*,?","g"),LEAVE_TOKEN=":leave",LEAVE_TOKEN_REGEX=new RegExp(LEAVE_TOKEN,"g"),ENTER_TOKEN=":enter",ENTER_TOKEN_REGEX=new RegExp(ENTER_TOKEN,"g"),ROOT_SELECTOR="",AnimationAstBuilderVisitor=function(){function AnimationAstBuilderVisitor(){}return AnimationAstBuilderVisitor.prototype.build=function(metadata,errors){var context=new AnimationAstBuilderContext(errors);return this._resetContextStyleTimingState(context),visitAnimationNode(this,normalizeAnimationEntry(metadata),context)},AnimationAstBuilderVisitor.prototype._resetContextStyleTimingState=function(context){context.currentQuerySelector=ROOT_SELECTOR,context.collectedStyles={},context.collectedStyles[ROOT_SELECTOR]={},context.currentTime=0},AnimationAstBuilderVisitor.prototype.visitTrigger=function(metadata,context){var _this=this,queryCount=context.queryCount=0,depCount=context.depCount=0,states=[],transitions=[];metadata.definitions.forEach(function(def){if(_this._resetContextStyleTimingState(context),0==def.type){var stateDef_1=def,name=stateDef_1.name;name.split(/\s*,\s*/).forEach(function(n){stateDef_1.name=n,states.push(_this.visitState(stateDef_1,context))}),stateDef_1.name=name}else if(1==def.type){var transition=_this.visitTransition(def,context);queryCount+=transition.queryCount,depCount+=transition.depCount,transitions.push(transition)}else context.errors.push("only state() and transition() definitions can sit inside of a trigger()")});var ast=new TriggerAst(metadata.name,states,transitions);return ast.options=normalizeAnimationOptions(metadata.options),ast.queryCount=queryCount,ast.depCount=depCount,ast},AnimationAstBuilderVisitor.prototype.visitState=function(metadata,context){var styleAst=this.visitStyle(metadata.styles,context),astParams=metadata.options&&metadata.options.params||null;if(styleAst.containsDynamicStyles){var missingSubs_1=new Set,params_1=astParams||{};if(styleAst.styles.forEach(function(value){if(isObject(value)){var stylesObj_1=value;Object.keys(stylesObj_1).forEach(function(prop){extractStyleParams(stylesObj_1[prop]).forEach(function(sub){params_1.hasOwnProperty(sub)||missingSubs_1.add(sub)})})}}),missingSubs_1.size){var missingSubsArr=iteratorToArray(missingSubs_1.values());context.errors.push('state("'+metadata.name+'", ...) must define default values for all the following style substitutions: '+missingSubsArr.join(", "))}}var stateAst=new StateAst(metadata.name,styleAst);return astParams&&(stateAst.options={params:astParams}),stateAst},AnimationAstBuilderVisitor.prototype.visitTransition=function(metadata,context){context.queryCount=0,context.depCount=0;var entry=visitAnimationNode(this,normalizeAnimationEntry(metadata.animation),context),matchers=parseTransitionExpr(metadata.expr,context.errors),ast=new TransitionAst(matchers,entry);return ast.options=normalizeAnimationOptions(metadata.options),ast.queryCount=context.queryCount,ast.depCount=context.depCount,ast},AnimationAstBuilderVisitor.prototype.visitSequence=function(metadata,context){var _this=this,ast=new SequenceAst(metadata.steps.map(function(s){return visitAnimationNode(_this,s,context)}));return ast.options=normalizeAnimationOptions(metadata.options),ast},AnimationAstBuilderVisitor.prototype.visitGroup=function(metadata,context){var _this=this,currentTime=context.currentTime,furthestTime=0,steps=metadata.steps.map(function(step){context.currentTime=currentTime;var innerAst=visitAnimationNode(_this,step,context);return furthestTime=Math.max(furthestTime,context.currentTime),innerAst});context.currentTime=furthestTime;var ast=new GroupAst(steps);return ast.options=normalizeAnimationOptions(metadata.options),ast},AnimationAstBuilderVisitor.prototype.visitAnimate=function(metadata,context){var timingAst=constructTimingAst(metadata.timings,context.errors);context.currentAnimateTimings=timingAst;var styles,styleMetadata=metadata.styles?metadata.styles:_angular_animations.style({});if(5==styleMetadata.type)styles=this.visitKeyframes(styleMetadata,context);else{var styleMetadata_1=metadata.styles,isEmpty=!1;if(!styleMetadata_1){isEmpty=!0;var newStyleData={};timingAst.easing&&(newStyleData.easing=timingAst.easing),styleMetadata_1=_angular_animations.style(newStyleData)}context.currentTime+=timingAst.duration+timingAst.delay;var styleAst=this.visitStyle(styleMetadata_1,context);styleAst.isEmptyStep=isEmpty,styles=styleAst}return context.currentAnimateTimings=null,new AnimateAst(timingAst,styles)},AnimationAstBuilderVisitor.prototype.visitStyle=function(metadata,context){var ast=this._makeStyleAst(metadata,context);return this._validateStyleAst(ast,context),ast},AnimationAstBuilderVisitor.prototype._makeStyleAst=function(metadata,context){var styles=[];Array.isArray(metadata.styles)?metadata.styles.forEach(function(styleTuple){"string"==typeof styleTuple?styleTuple==_angular_animations.AUTO_STYLE?styles.push(styleTuple):context.errors.push("The provided style string value "+styleTuple+" is not allowed."):styles.push(styleTuple)}):styles.push(metadata.styles);var containsDynamicStyles=!1,collectedEasing=null;styles.forEach(function(styleData){if(isObject(styleData)){var styleMap=styleData,easing=styleMap.easing;if(easing&&(collectedEasing=easing,delete styleMap.easing),!containsDynamicStyles)for(var prop in styleMap){var value=styleMap[prop];if(value.toString().indexOf(SUBSTITUTION_EXPR_START)>=0){containsDynamicStyles=!0;break}}}});var ast=new StyleAst(styles,collectedEasing,metadata.offset);return ast.containsDynamicStyles=containsDynamicStyles,ast},AnimationAstBuilderVisitor.prototype._validateStyleAst=function(ast,context){var timings=context.currentAnimateTimings,endTime=context.currentTime,startTime=context.currentTime;timings&&startTime>0&&(startTime-=timings.duration+timings.delay),ast.styles.forEach(function(tuple){"string"!=typeof tuple&&Object.keys(tuple).forEach(function(prop){var collectedStyles=context.collectedStyles[context.currentQuerySelector],collectedEntry=collectedStyles[prop],updateCollectedStyle=!0;collectedEntry&&(startTime!=endTime&&startTime>=collectedEntry.startTime&&endTime<=collectedEntry.endTime&&(context.errors.push('The CSS property "'+prop+'" that exists between the times of "'+collectedEntry.startTime+'ms" and "'+collectedEntry.endTime+'ms" is also being animated in a parallel animation between the times of "'+startTime+'ms" and "'+endTime+'ms"'),updateCollectedStyle=!1),startTime=collectedEntry.startTime),updateCollectedStyle&&(collectedStyles[prop]={startTime:startTime,endTime:endTime}),context.options&&validateStyleParams(tuple[prop],context.options,context.errors)})})},AnimationAstBuilderVisitor.prototype.visitKeyframes=function(metadata,context){var _this=this;if(!context.currentAnimateTimings)return context.errors.push("keyframes() must be placed inside of a call to animate()"),new KeyframesAst([]);var MAX_KEYFRAME_OFFSET=1,totalKeyframesWithOffsets=0,offsets=[],offsetsOutOfOrder=!1,keyframesOutOfRange=!1,previousOffset=0,keyframes=metadata.steps.map(function(styles){var style$$1=_this._makeStyleAst(styles,context),offsetVal=null!=style$$1.offset?style$$1.offset:consumeOffset(style$$1.styles),offset=0;return null!=offsetVal&&(totalKeyframesWithOffsets++,offset=style$$1.offset=offsetVal),keyframesOutOfRange=keyframesOutOfRange||offset<0||offset>1,offsetsOutOfOrder=offsetsOutOfOrder||offset<previousOffset,previousOffset=offset,offsets.push(offset),style$$1});keyframesOutOfRange&&context.errors.push("Please ensure that all keyframe offsets are between 0 and 1"),offsetsOutOfOrder&&context.errors.push("Please ensure that all keyframe offsets are in order");var length=metadata.steps.length,generatedOffset=0;totalKeyframesWithOffsets>0&&totalKeyframesWithOffsets<length?context.errors.push("Not all style() steps within the declared keyframes() contain offsets"):0==totalKeyframesWithOffsets&&(generatedOffset=MAX_KEYFRAME_OFFSET/(length-1));var limit=length-1,currentTime=context.currentTime,currentAnimateTimings=context.currentAnimateTimings,animateDuration=currentAnimateTimings.duration;return keyframes.forEach(function(kf,i){var offset=generatedOffset>0?i==limit?1:generatedOffset*i:offsets[i],durationUpToThisFrame=offset*animateDuration;context.currentTime=currentTime+currentAnimateTimings.delay+durationUpToThisFrame,currentAnimateTimings.duration=durationUpToThisFrame,_this._validateStyleAst(kf,context),kf.offset=offset}),new KeyframesAst(keyframes)},AnimationAstBuilderVisitor.prototype.visitReference=function(metadata,context){var entry=visitAnimationNode(this,normalizeAnimationEntry(metadata.animation),context),ast=new ReferenceAst(entry);return ast.options=normalizeAnimationOptions(metadata.options),ast},AnimationAstBuilderVisitor.prototype.visitAnimateChild=function(metadata,context){context.depCount++;var ast=new AnimateChildAst;return ast.options=normalizeAnimationOptions(metadata.options),ast},AnimationAstBuilderVisitor.prototype.visitAnimateRef=function(metadata,context){var animation=this.visitReference(metadata.animation,context),ast=new AnimateRefAst(animation);return ast.options=normalizeAnimationOptions(metadata.options),ast},AnimationAstBuilderVisitor.prototype.visitQuery=function(metadata,context){var parentSelector=context.currentQuerySelector,options=metadata.options||{};context.queryCount++,context.currentQuery=metadata;var _a=normalizeSelector(metadata.selector),selector=_a[0],includeSelf=_a[1];context.currentQuerySelector=parentSelector.length?parentSelector+" "+selector:selector,getOrSetAsInMap(context.collectedStyles,context.currentQuerySelector,{});var entry=visitAnimationNode(this,normalizeAnimationEntry(metadata.animation),context);context.currentQuery=null,context.currentQuerySelector=parentSelector;var ast=new QueryAst(selector,options.limit||0,(!!options.optional),includeSelf,entry);return ast.originalSelector=metadata.selector,ast.options=normalizeAnimationOptions(metadata.options),ast},AnimationAstBuilderVisitor.prototype.visitStagger=function(metadata,context){context.currentQuery||context.errors.push("stagger() can only be used inside of query()");var timings="full"===metadata.timings?{duration:0,delay:0,easing:"full"}:resolveTiming(metadata.timings,context.errors,!0),animation=visitAnimationNode(this,normalizeAnimationEntry(metadata.animation),context);return new StaggerAst(timings,animation)},AnimationAstBuilderVisitor}(),AnimationAstBuilderContext=function(){function AnimationAstBuilderContext(errors){this.errors=errors,this.queryCount=0,this.depCount=0,this.currentTransition=null,this.currentQuery=null,this.currentQuerySelector=null,this.currentAnimateTimings=null,this.currentTime=0,this.collectedStyles={},this.options=null}return AnimationAstBuilderContext}(),ElementInstructionMap=function(){function ElementInstructionMap(){this._map=new Map}return ElementInstructionMap.prototype.consume=function(element){var instructions=this._map.get(element);return instructions?this._map.delete(element):instructions=[],instructions},ElementInstructionMap.prototype.append=function(element,instructions){var existingInstructions=this._map.get(element);existingInstructions||this._map.set(element,existingInstructions=[]),existingInstructions.push.apply(existingInstructions,instructions)},ElementInstructionMap.prototype.has=function(element){return this._map.has(element)},ElementInstructionMap.prototype.clear=function(){this._map.clear()},ElementInstructionMap}(),ONE_FRAME_IN_MILLISECONDS=1,AnimationTimelineBuilderVisitor=function(){function AnimationTimelineBuilderVisitor(){}return AnimationTimelineBuilderVisitor.prototype.buildKeyframes=function(driver,rootElement,ast,startingStyles,finalStyles,options,subInstructions,errors){void 0===errors&&(errors=[]),subInstructions=subInstructions||new ElementInstructionMap;var context=new AnimationTimelineContext(driver,rootElement,subInstructions,errors,[]);context.options=options,context.currentTimeline.setStyles([startingStyles],null,context.errors,options),ast.visit(this,context);var timelines=context.timelines.filter(function(timeline){return timeline.containsAnimation()});if(timelines.length&&Object.keys(finalStyles).length){var tl=timelines[timelines.length-1];tl.allowOnlyTimelineStyles()||tl.setStyles([finalStyles],null,context.errors,options)}return timelines.length?timelines.map(function(timeline){return timeline.buildKeyframes()}):[createTimelineInstruction(rootElement,[],[],[],0,0,"",!1)]},AnimationTimelineBuilderVisitor.prototype.visitTrigger=function(ast,context){},AnimationTimelineBuilderVisitor.prototype.visitState=function(ast,context){},AnimationTimelineBuilderVisitor.prototype.visitTransition=function(ast,context){},AnimationTimelineBuilderVisitor.prototype.visitAnimateChild=function(ast,context){var elementInstructions=context.subInstructions.consume(context.element);if(elementInstructions){var innerContext=context.createSubContext(ast.options),startTime=context.currentTimeline.currentTime,endTime=this._visitSubInstructions(elementInstructions,innerContext,innerContext.options);startTime!=endTime&&context.transformIntoNewTimeline(endTime)}context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype.visitAnimateRef=function(ast,context){var innerContext=context.createSubContext(ast.options);innerContext.transformIntoNewTimeline(),this.visitReference(ast.animation,innerContext),context.transformIntoNewTimeline(innerContext.currentTimeline.currentTime),context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype._visitSubInstructions=function(instructions,context,options){var startTime=context.currentTimeline.currentTime,furthestTime=startTime,duration=null!=options.duration?resolveTimingValue(options.duration):null,delay=null!=options.delay?resolveTimingValue(options.delay):null;return 0!==duration&&instructions.forEach(function(instruction){var instructionTimings=context.appendInstructionToTimeline(instruction,duration,delay);furthestTime=Math.max(furthestTime,instructionTimings.duration+instructionTimings.delay)}),furthestTime},AnimationTimelineBuilderVisitor.prototype.visitReference=function(ast,context){context.updateOptions(ast.options,!0),ast.animation.visit(this,context),context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype.visitSequence=function(ast,context){var _this=this,subContextCount=context.subContextCount,ctx=context,options=ast.options;if(options&&(options.params||options.delay)&&(ctx=context.createSubContext(options),ctx.transformIntoNewTimeline(),null!=options.delay)){ctx.previousNode instanceof StyleAst&&(ctx.currentTimeline.snapshotCurrentStyles(),ctx.previousNode=DEFAULT_NOOP_PREVIOUS_NODE);var delay=resolveTimingValue(options.delay);ctx.delayNextStep(delay)}ast.steps.length&&(ast.steps.forEach(function(s){return s.visit(_this,ctx)}),ctx.currentTimeline.applyStylesToKeyframe(),ctx.subContextCount>subContextCount&&ctx.transformIntoNewTimeline()),context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype.visitGroup=function(ast,context){var _this=this,innerTimelines=[],furthestTime=context.currentTimeline.currentTime,delay=ast.options&&ast.options.delay?resolveTimingValue(ast.options.delay):0;ast.steps.forEach(function(s){var innerContext=context.createSubContext(ast.options);delay&&innerContext.delayNextStep(delay),s.visit(_this,innerContext),furthestTime=Math.max(furthestTime,innerContext.currentTimeline.currentTime),innerTimelines.push(innerContext.currentTimeline)}),innerTimelines.forEach(function(timeline){return context.currentTimeline.mergeTimelineCollectedStyles(timeline)}),context.transformIntoNewTimeline(furthestTime),context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype.visitTiming=function(ast,context){if(ast instanceof DynamicTimingAst){var strValue=context.params?interpolateParams(ast.value,context.params,context.errors):ast.value.toString();return resolveTiming(strValue,context.errors)}return{duration:ast.duration,delay:ast.delay,easing:ast.easing}},AnimationTimelineBuilderVisitor.prototype.visitAnimate=function(ast,context){var timings=context.currentAnimateTimings=this.visitTiming(ast.timings,context),timeline=context.currentTimeline;timings.delay&&(context.incrementTime(timings.delay),timeline.snapshotCurrentStyles());var style$$1=ast.style;style$$1 instanceof KeyframesAst?this.visitKeyframes(style$$1,context):(context.incrementTime(timings.duration),this.visitStyle(style$$1,context),timeline.applyStylesToKeyframe()),context.currentAnimateTimings=null,context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype.visitStyle=function(ast,context){var timeline=context.currentTimeline,timings=context.currentAnimateTimings;!timings&&timeline.getCurrentStyleProperties().length&&timeline.forwardFrame();var easing=timings&&timings.easing||ast.easing;ast.isEmptyStep?timeline.applyEmptyStep(easing):timeline.setStyles(ast.styles,easing,context.errors,context.options),context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype.visitKeyframes=function(ast,context){var currentAnimateTimings=context.currentAnimateTimings,startTime=context.currentTimeline.duration,duration=currentAnimateTimings.duration,innerContext=context.createSubContext(),innerTimeline=innerContext.currentTimeline;innerTimeline.easing=currentAnimateTimings.easing,ast.styles.forEach(function(step){var offset=step.offset||0;innerTimeline.forwardTime(offset*duration),innerTimeline.setStyles(step.styles,step.easing,context.errors,context.options),innerTimeline.applyStylesToKeyframe()}),context.currentTimeline.mergeTimelineCollectedStyles(innerTimeline),context.transformIntoNewTimeline(startTime+duration),context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype.visitQuery=function(ast,context){var _this=this,startTime=context.currentTimeline.currentTime,options=ast.options||{},delay=options.delay?resolveTimingValue(options.delay):0;delay&&(context.previousNode instanceof StyleAst||0==startTime&&context.currentTimeline.getCurrentStyleProperties().length)&&(context.currentTimeline.snapshotCurrentStyles(),context.previousNode=DEFAULT_NOOP_PREVIOUS_NODE);var furthestTime=startTime,elms=context.invokeQuery(ast.selector,ast.originalSelector,ast.limit,ast.includeSelf,!!options.optional,context.errors);context.currentQueryTotal=elms.length;var sameElementTimeline=null;elms.forEach(function(element,i){context.currentQueryIndex=i;var innerContext=context.createSubContext(ast.options,element);delay&&innerContext.delayNextStep(delay),element===context.element&&(sameElementTimeline=innerContext.currentTimeline),ast.animation.visit(_this,innerContext),innerContext.currentTimeline.applyStylesToKeyframe();var endTime=innerContext.currentTimeline.currentTime;furthestTime=Math.max(furthestTime,endTime)}),context.currentQueryIndex=0,context.currentQueryTotal=0,context.transformIntoNewTimeline(furthestTime),sameElementTimeline&&(context.currentTimeline.mergeTimelineCollectedStyles(sameElementTimeline),context.currentTimeline.snapshotCurrentStyles()),context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype.visitStagger=function(ast,context){var parentContext=context.parentContext,tl=context.currentTimeline,timings=ast.timings,duration=Math.abs(timings.duration),maxTime=duration*(context.currentQueryTotal-1),delay=duration*context.currentQueryIndex,staggerTransformer=timings.duration<0?"reverse":timings.easing;switch(staggerTransformer){case"reverse":delay=maxTime-delay;break;case"full":delay=parentContext.currentStaggerTime}var timeline=context.currentTimeline;delay&&timeline.delayNextStep(delay);var startingTime=timeline.currentTime;ast.animation.visit(this,context),context.previousNode=ast,parentContext.currentStaggerTime=tl.currentTime-startingTime+(tl.startTime-parentContext.currentTimeline.startTime)},AnimationTimelineBuilderVisitor}(),DEFAULT_NOOP_PREVIOUS_NODE={},AnimationTimelineContext=function(){function AnimationTimelineContext(_driver,element,subInstructions,errors,timelines,initialTimeline){this._driver=_driver,this.element=element,this.subInstructions=subInstructions,this.errors=errors,this.timelines=timelines,this.parentContext=null,this.currentAnimateTimings=null,this.previousNode=DEFAULT_NOOP_PREVIOUS_NODE,this.subContextCount=0,this.options={},this.currentQueryIndex=0,this.currentQueryTotal=0,this.currentStaggerTime=0,this.currentTimeline=initialTimeline||new TimelineBuilder(element,0),timelines.push(this.currentTimeline)}return Object.defineProperty(AnimationTimelineContext.prototype,"params",{get:function(){return this.options.params},enumerable:!0,configurable:!0}),AnimationTimelineContext.prototype.updateOptions=function(options,skipIfExists){var _this=this;if(options){var newOptions=options,optionsToUpdate=this.options;null!=newOptions.duration&&(optionsToUpdate.duration=resolveTimingValue(newOptions.duration)),null!=newOptions.delay&&(optionsToUpdate.delay=resolveTimingValue(newOptions.delay));var newParams=newOptions.params;if(newParams){var paramsToUpdate_1=optionsToUpdate.params;paramsToUpdate_1||(paramsToUpdate_1=this.options.params={}),Object.keys(newParams).forEach(function(name){skipIfExists&&paramsToUpdate_1.hasOwnProperty(name)||(paramsToUpdate_1[name]=interpolateParams(newParams[name],paramsToUpdate_1,_this.errors))})}}},AnimationTimelineContext.prototype._copyOptions=function(){var options={};if(this.options){var oldParams_1=this.options.params;if(oldParams_1){var params_2=options.params={};Object.keys(this.options.params).forEach(function(name){params_2[name]=oldParams_1[name]})}}return options},AnimationTimelineContext.prototype.createSubContext=function(options,element,newTime){void 0===options&&(options=null);var target=element||this.element,context=new AnimationTimelineContext(this._driver,target,this.subInstructions,this.errors,this.timelines,this.currentTimeline.fork(target,newTime||0));return context.previousNode=this.previousNode,context.currentAnimateTimings=this.currentAnimateTimings,context.options=this._copyOptions(),context.updateOptions(options),context.currentQueryIndex=this.currentQueryIndex,context.currentQueryTotal=this.currentQueryTotal,context.parentContext=this,this.subContextCount++,context},AnimationTimelineContext.prototype.transformIntoNewTimeline=function(newTime){return this.previousNode=DEFAULT_NOOP_PREVIOUS_NODE,this.currentTimeline=this.currentTimeline.fork(this.element,newTime),this.timelines.push(this.currentTimeline),this.currentTimeline},AnimationTimelineContext.prototype.appendInstructionToTimeline=function(instruction,duration,delay){var updatedTimings={duration:null!=duration?duration:instruction.duration,delay:this.currentTimeline.currentTime+(null!=delay?delay:0)+instruction.delay,easing:""},builder=new SubTimelineBuilder(instruction.element,instruction.keyframes,instruction.preStyleProps,instruction.postStyleProps,updatedTimings,instruction.stretchStartingKeyframe);return this.timelines.push(builder),updatedTimings},AnimationTimelineContext.prototype.incrementTime=function(time){this.currentTimeline.forwardTime(this.currentTimeline.duration+time)},AnimationTimelineContext.prototype.delayNextStep=function(delay){delay>0&&this.currentTimeline.delayNextStep(delay)},AnimationTimelineContext.prototype.invokeQuery=function(selector,originalSelector,limit,includeSelf,optional,errors){var results=[];if(includeSelf&&results.push(this.element),selector.length>0){var multi=1!=limit;results.push.apply(results,this._driver.query(this.element,selector,multi))}return optional||0!=results.length||errors.push('`query("'+originalSelector+'")` returned zero elements. (Use `query("'+originalSelector+'", { optional: true })` if you wish to allow this.)'),results},AnimationTimelineContext}(),TimelineBuilder=function(){function TimelineBuilder(element,startTime,_elementTimelineStylesLookup){this.element=element,this.startTime=startTime,this._elementTimelineStylesLookup=_elementTimelineStylesLookup,this.duration=0,this._previousKeyframe={},this._currentKeyframe={},this._keyframes=new Map,this._styleSummary={},this._pendingStyles={},this._backFill={},this._currentEmptyStepKeyframe=null,this._elementTimelineStylesLookup||(this._elementTimelineStylesLookup=new Map),this._localTimelineStyles=Object.create(this._backFill,{}),this._globalTimelineStyles=this._elementTimelineStylesLookup.get(element),this._globalTimelineStyles||(this._globalTimelineStyles=this._localTimelineStyles,this._elementTimelineStylesLookup.set(element,this._localTimelineStyles)),this._loadKeyframe()}return TimelineBuilder.prototype.containsAnimation=function(){switch(this._keyframes.size){case 0:return!1;case 1:return this.getCurrentStyleProperties().length>0;default:return!0}},TimelineBuilder.prototype.getCurrentStyleProperties=function(){return Object.keys(this._currentKeyframe)},Object.defineProperty(TimelineBuilder.prototype,"currentTime",{get:function(){return this.startTime+this.duration},enumerable:!0,configurable:!0}),TimelineBuilder.prototype.delayNextStep=function(delay){var hasPreStyleStep=1==this._keyframes.size&&Object.keys(this._pendingStyles).length;this.duration||hasPreStyleStep?(this.forwardTime(this.currentTime+delay),hasPreStyleStep&&this.snapshotCurrentStyles()):this.startTime+=delay},TimelineBuilder.prototype.fork=function(element,currentTime){return this.applyStylesToKeyframe(),new TimelineBuilder(element,currentTime||this.currentTime,this._elementTimelineStylesLookup)},TimelineBuilder.prototype._loadKeyframe=function(){this._currentKeyframe&&(this._previousKeyframe=this._currentKeyframe),this._currentKeyframe=this._keyframes.get(this.duration),this._currentKeyframe||(this._currentKeyframe=Object.create(this._backFill,{}),this._keyframes.set(this.duration,this._currentKeyframe))},TimelineBuilder.prototype.forwardFrame=function(){this.duration+=ONE_FRAME_IN_MILLISECONDS,this._loadKeyframe()},TimelineBuilder.prototype.forwardTime=function(time){this.applyStylesToKeyframe(),this.duration=time,this._loadKeyframe()},TimelineBuilder.prototype._updateStyle=function(prop,value){this._localTimelineStyles[prop]=value,this._globalTimelineStyles[prop]=value,this._styleSummary[prop]={time:this.currentTime,value:value}},TimelineBuilder.prototype.allowOnlyTimelineStyles=function(){return this._currentEmptyStepKeyframe!==this._currentKeyframe},TimelineBuilder.prototype.applyEmptyStep=function(easing){var _this=this;easing&&(this._previousKeyframe.easing=easing),Object.keys(this._globalTimelineStyles).forEach(function(prop){_this._backFill[prop]=_this._globalTimelineStyles[prop]||_angular_animations.AUTO_STYLE,
53
+ var ONE_SECOND=1e3,SUBSTITUTION_EXPR_START="{{",SUBSTITUTION_EXPR_END="}}",ENTER_CLASSNAME="ng-enter",LEAVE_CLASSNAME="ng-leave",ENTER_SELECTOR=".ng-enter",LEAVE_SELECTOR=".ng-leave",NG_TRIGGER_CLASSNAME="ng-trigger",NG_TRIGGER_SELECTOR=".ng-trigger",NG_ANIMATING_CLASSNAME="ng-animating",NG_ANIMATING_SELECTOR=".ng-animating",PARAM_REGEX=new RegExp(SUBSTITUTION_EXPR_START+"\\s*(.+?)\\s*"+SUBSTITUTION_EXPR_END,"g"),DASH_CASE_REGEXP=/-+([a-z0-9])/g,EMPTY_ANIMATION_OPTIONS={},Ast=function(){function Ast(){this.options=EMPTY_ANIMATION_OPTIONS}return Ast.prototype.visit=function(ast,context){},Object.defineProperty(Ast.prototype,"params",{get:function(){return this.options.params||null},enumerable:!0,configurable:!0}),Ast}(),TriggerAst=function(_super){function TriggerAst(name,states,transitions){var _this=_super.call(this)||this;return _this.name=name,_this.states=states,_this.transitions=transitions,_this.queryCount=0,_this.depCount=0,_this}return __extends(TriggerAst,_super),TriggerAst.prototype.visit=function(visitor,context){return visitor.visitTrigger(this,context)},TriggerAst}(Ast),StateAst=function(_super){function StateAst(name,style$$1){var _this=_super.call(this)||this;return _this.name=name,_this.style=style$$1,_this}return __extends(StateAst,_super),StateAst.prototype.visit=function(visitor,context){return visitor.visitState(this,context)},StateAst}(Ast),TransitionAst=function(_super){function TransitionAst(matchers,animation){var _this=_super.call(this)||this;return _this.matchers=matchers,_this.animation=animation,_this.queryCount=0,_this.depCount=0,_this}return __extends(TransitionAst,_super),TransitionAst.prototype.visit=function(visitor,context){return visitor.visitTransition(this,context)},TransitionAst}(Ast),SequenceAst=function(_super){function SequenceAst(steps){var _this=_super.call(this)||this;return _this.steps=steps,_this}return __extends(SequenceAst,_super),SequenceAst.prototype.visit=function(visitor,context){return visitor.visitSequence(this,context)},SequenceAst}(Ast),GroupAst=function(_super){function GroupAst(steps){var _this=_super.call(this)||this;return _this.steps=steps,_this}return __extends(GroupAst,_super),GroupAst.prototype.visit=function(visitor,context){return visitor.visitGroup(this,context)},GroupAst}(Ast),AnimateAst=function(_super){function AnimateAst(timings,style$$1){var _this=_super.call(this)||this;return _this.timings=timings,_this.style=style$$1,_this}return __extends(AnimateAst,_super),AnimateAst.prototype.visit=function(visitor,context){return visitor.visitAnimate(this,context)},AnimateAst}(Ast),StyleAst=function(_super){function StyleAst(styles,easing,offset){var _this=_super.call(this)||this;return _this.styles=styles,_this.easing=easing,_this.offset=offset,_this.isEmptyStep=!1,_this.containsDynamicStyles=!1,_this}return __extends(StyleAst,_super),StyleAst.prototype.visit=function(visitor,context){return visitor.visitStyle(this,context)},StyleAst}(Ast),KeyframesAst=function(_super){function KeyframesAst(styles){var _this=_super.call(this)||this;return _this.styles=styles,_this}return __extends(KeyframesAst,_super),KeyframesAst.prototype.visit=function(visitor,context){return visitor.visitKeyframes(this,context)},KeyframesAst}(Ast),ReferenceAst=function(_super){function ReferenceAst(animation){var _this=_super.call(this)||this;return _this.animation=animation,_this}return __extends(ReferenceAst,_super),ReferenceAst.prototype.visit=function(visitor,context){return visitor.visitReference(this,context)},ReferenceAst}(Ast),AnimateChildAst=function(_super){function AnimateChildAst(){return _super.call(this)||this}return __extends(AnimateChildAst,_super),AnimateChildAst.prototype.visit=function(visitor,context){return visitor.visitAnimateChild(this,context)},AnimateChildAst}(Ast),AnimateRefAst=function(_super){function AnimateRefAst(animation){var _this=_super.call(this)||this;return _this.animation=animation,_this}return __extends(AnimateRefAst,_super),AnimateRefAst.prototype.visit=function(visitor,context){return visitor.visitAnimateRef(this,context)},AnimateRefAst}(Ast),QueryAst=function(_super){function QueryAst(selector,limit,optional,includeSelf,animation){var _this=_super.call(this)||this;return _this.selector=selector,_this.limit=limit,_this.optional=optional,_this.includeSelf=includeSelf,_this.animation=animation,_this}return __extends(QueryAst,_super),QueryAst.prototype.visit=function(visitor,context){return visitor.visitQuery(this,context)},QueryAst}(Ast),StaggerAst=function(_super){function StaggerAst(timings,animation){var _this=_super.call(this)||this;return _this.timings=timings,_this.animation=animation,_this}return __extends(StaggerAst,_super),StaggerAst.prototype.visit=function(visitor,context){return visitor.visitStagger(this,context)},StaggerAst}(Ast),TimingAst=function(_super){function TimingAst(duration,delay,easing){void 0===delay&&(delay=0),void 0===easing&&(easing=null);var _this=_super.call(this)||this;return _this.duration=duration,_this.delay=delay,_this.easing=easing,_this}return __extends(TimingAst,_super),TimingAst.prototype.visit=function(visitor,context){return visitor.visitTiming(this,context)},TimingAst}(Ast),DynamicTimingAst=function(_super){function DynamicTimingAst(value){var _this=_super.call(this,0,0,"")||this;return _this.value=value,_this}return __extends(DynamicTimingAst,_super),DynamicTimingAst.prototype.visit=function(visitor,context){return visitor.visitTiming(this,context)},DynamicTimingAst}(TimingAst),ANY_STATE="*",SELF_TOKEN=":self",SELF_TOKEN_REGEX=new RegExp("s*"+SELF_TOKEN+"s*,?","g"),LEAVE_TOKEN=":leave",LEAVE_TOKEN_REGEX=new RegExp(LEAVE_TOKEN,"g"),ENTER_TOKEN=":enter",ENTER_TOKEN_REGEX=new RegExp(ENTER_TOKEN,"g"),ROOT_SELECTOR="",AnimationAstBuilderVisitor=function(){function AnimationAstBuilderVisitor(){}return AnimationAstBuilderVisitor.prototype.build=function(metadata,errors){var context=new AnimationAstBuilderContext(errors);return this._resetContextStyleTimingState(context),visitAnimationNode(this,normalizeAnimationEntry(metadata),context)},AnimationAstBuilderVisitor.prototype._resetContextStyleTimingState=function(context){context.currentQuerySelector=ROOT_SELECTOR,context.collectedStyles={},context.collectedStyles[ROOT_SELECTOR]={},context.currentTime=0},AnimationAstBuilderVisitor.prototype.visitTrigger=function(metadata,context){var _this=this,queryCount=context.queryCount=0,depCount=context.depCount=0,states=[],transitions=[];metadata.definitions.forEach(function(def){if(_this._resetContextStyleTimingState(context),0==def.type){var stateDef_1=def,name=stateDef_1.name;name.split(/\s*,\s*/).forEach(function(n){stateDef_1.name=n,states.push(_this.visitState(stateDef_1,context))}),stateDef_1.name=name}else if(1==def.type){var transition=_this.visitTransition(def,context);queryCount+=transition.queryCount,depCount+=transition.depCount,transitions.push(transition)}else context.errors.push("only state() and transition() definitions can sit inside of a trigger()")});var ast=new TriggerAst(metadata.name,states,transitions);return ast.options=normalizeAnimationOptions(metadata.options),ast.queryCount=queryCount,ast.depCount=depCount,ast},AnimationAstBuilderVisitor.prototype.visitState=function(metadata,context){var styleAst=this.visitStyle(metadata.styles,context),astParams=metadata.options&&metadata.options.params||null;if(styleAst.containsDynamicStyles){var missingSubs_1=new Set,params_1=astParams||{};if(styleAst.styles.forEach(function(value){if(isObject(value)){var stylesObj_1=value;Object.keys(stylesObj_1).forEach(function(prop){extractStyleParams(stylesObj_1[prop]).forEach(function(sub){params_1.hasOwnProperty(sub)||missingSubs_1.add(sub)})})}}),missingSubs_1.size){var missingSubsArr=iteratorToArray(missingSubs_1.values());context.errors.push('state("'+metadata.name+'", ...) must define default values for all the following style substitutions: '+missingSubsArr.join(", "))}}var stateAst=new StateAst(metadata.name,styleAst);return astParams&&(stateAst.options={params:astParams}),stateAst},AnimationAstBuilderVisitor.prototype.visitTransition=function(metadata,context){context.queryCount=0,context.depCount=0;var entry=visitAnimationNode(this,normalizeAnimationEntry(metadata.animation),context),matchers=parseTransitionExpr(metadata.expr,context.errors),ast=new TransitionAst(matchers,entry);return ast.options=normalizeAnimationOptions(metadata.options),ast.queryCount=context.queryCount,ast.depCount=context.depCount,ast},AnimationAstBuilderVisitor.prototype.visitSequence=function(metadata,context){var _this=this,ast=new SequenceAst(metadata.steps.map(function(s){return visitAnimationNode(_this,s,context)}));return ast.options=normalizeAnimationOptions(metadata.options),ast},AnimationAstBuilderVisitor.prototype.visitGroup=function(metadata,context){var _this=this,currentTime=context.currentTime,furthestTime=0,steps=metadata.steps.map(function(step){context.currentTime=currentTime;var innerAst=visitAnimationNode(_this,step,context);return furthestTime=Math.max(furthestTime,context.currentTime),innerAst});context.currentTime=furthestTime;var ast=new GroupAst(steps);return ast.options=normalizeAnimationOptions(metadata.options),ast},AnimationAstBuilderVisitor.prototype.visitAnimate=function(metadata,context){var timingAst=constructTimingAst(metadata.timings,context.errors);context.currentAnimateTimings=timingAst;var styles,styleMetadata=metadata.styles?metadata.styles:_angular_animations.style({});if(5==styleMetadata.type)styles=this.visitKeyframes(styleMetadata,context);else{var styleMetadata_1=metadata.styles,isEmpty=!1;if(!styleMetadata_1){isEmpty=!0;var newStyleData={};timingAst.easing&&(newStyleData.easing=timingAst.easing),styleMetadata_1=_angular_animations.style(newStyleData)}context.currentTime+=timingAst.duration+timingAst.delay;var styleAst=this.visitStyle(styleMetadata_1,context);styleAst.isEmptyStep=isEmpty,styles=styleAst}return context.currentAnimateTimings=null,new AnimateAst(timingAst,styles)},AnimationAstBuilderVisitor.prototype.visitStyle=function(metadata,context){var ast=this._makeStyleAst(metadata,context);return this._validateStyleAst(ast,context),ast},AnimationAstBuilderVisitor.prototype._makeStyleAst=function(metadata,context){var styles=[];Array.isArray(metadata.styles)?metadata.styles.forEach(function(styleTuple){"string"==typeof styleTuple?styleTuple==_angular_animations.AUTO_STYLE?styles.push(styleTuple):context.errors.push("The provided style string value "+styleTuple+" is not allowed."):styles.push(styleTuple)}):styles.push(metadata.styles);var containsDynamicStyles=!1,collectedEasing=null;styles.forEach(function(styleData){if(isObject(styleData)){var styleMap=styleData,easing=styleMap.easing;if(easing&&(collectedEasing=easing,delete styleMap.easing),!containsDynamicStyles)for(var prop in styleMap){var value=styleMap[prop];if(value.toString().indexOf(SUBSTITUTION_EXPR_START)>=0){containsDynamicStyles=!0;break}}}});var ast=new StyleAst(styles,collectedEasing,metadata.offset);return ast.containsDynamicStyles=containsDynamicStyles,ast},AnimationAstBuilderVisitor.prototype._validateStyleAst=function(ast,context){var timings=context.currentAnimateTimings,endTime=context.currentTime,startTime=context.currentTime;timings&&startTime>0&&(startTime-=timings.duration+timings.delay),ast.styles.forEach(function(tuple){"string"!=typeof tuple&&Object.keys(tuple).forEach(function(prop){var collectedStyles=context.collectedStyles[context.currentQuerySelector],collectedEntry=collectedStyles[prop],updateCollectedStyle=!0;collectedEntry&&(startTime!=endTime&&startTime>=collectedEntry.startTime&&endTime<=collectedEntry.endTime&&(context.errors.push('The CSS property "'+prop+'" that exists between the times of "'+collectedEntry.startTime+'ms" and "'+collectedEntry.endTime+'ms" is also being animated in a parallel animation between the times of "'+startTime+'ms" and "'+endTime+'ms"'),updateCollectedStyle=!1),startTime=collectedEntry.startTime),updateCollectedStyle&&(collectedStyles[prop]={startTime:startTime,endTime:endTime}),context.options&&validateStyleParams(tuple[prop],context.options,context.errors)})})},AnimationAstBuilderVisitor.prototype.visitKeyframes=function(metadata,context){var _this=this;if(!context.currentAnimateTimings)return context.errors.push("keyframes() must be placed inside of a call to animate()"),new KeyframesAst([]);var MAX_KEYFRAME_OFFSET=1,totalKeyframesWithOffsets=0,offsets=[],offsetsOutOfOrder=!1,keyframesOutOfRange=!1,previousOffset=0,keyframes=metadata.steps.map(function(styles){var style$$1=_this._makeStyleAst(styles,context),offsetVal=null!=style$$1.offset?style$$1.offset:consumeOffset(style$$1.styles),offset=0;return null!=offsetVal&&(totalKeyframesWithOffsets++,offset=style$$1.offset=offsetVal),keyframesOutOfRange=keyframesOutOfRange||offset<0||offset>1,offsetsOutOfOrder=offsetsOutOfOrder||offset<previousOffset,previousOffset=offset,offsets.push(offset),style$$1});keyframesOutOfRange&&context.errors.push("Please ensure that all keyframe offsets are between 0 and 1"),offsetsOutOfOrder&&context.errors.push("Please ensure that all keyframe offsets are in order");var length=metadata.steps.length,generatedOffset=0;totalKeyframesWithOffsets>0&&totalKeyframesWithOffsets<length?context.errors.push("Not all style() steps within the declared keyframes() contain offsets"):0==totalKeyframesWithOffsets&&(generatedOffset=MAX_KEYFRAME_OFFSET/(length-1));var limit=length-1,currentTime=context.currentTime,currentAnimateTimings=context.currentAnimateTimings,animateDuration=currentAnimateTimings.duration;return keyframes.forEach(function(kf,i){var offset=generatedOffset>0?i==limit?1:generatedOffset*i:offsets[i],durationUpToThisFrame=offset*animateDuration;context.currentTime=currentTime+currentAnimateTimings.delay+durationUpToThisFrame,currentAnimateTimings.duration=durationUpToThisFrame,_this._validateStyleAst(kf,context),kf.offset=offset}),new KeyframesAst(keyframes)},AnimationAstBuilderVisitor.prototype.visitReference=function(metadata,context){var entry=visitAnimationNode(this,normalizeAnimationEntry(metadata.animation),context),ast=new ReferenceAst(entry);return ast.options=normalizeAnimationOptions(metadata.options),ast},AnimationAstBuilderVisitor.prototype.visitAnimateChild=function(metadata,context){context.depCount++;var ast=new AnimateChildAst;return ast.options=normalizeAnimationOptions(metadata.options),ast},AnimationAstBuilderVisitor.prototype.visitAnimateRef=function(metadata,context){var animation=this.visitReference(metadata.animation,context),ast=new AnimateRefAst(animation);return ast.options=normalizeAnimationOptions(metadata.options),ast},AnimationAstBuilderVisitor.prototype.visitQuery=function(metadata,context){var parentSelector=context.currentQuerySelector,options=metadata.options||{};context.queryCount++,context.currentQuery=metadata;var _a=normalizeSelector(metadata.selector),selector=_a[0],includeSelf=_a[1];context.currentQuerySelector=parentSelector.length?parentSelector+" "+selector:selector,getOrSetAsInMap(context.collectedStyles,context.currentQuerySelector,{});var entry=visitAnimationNode(this,normalizeAnimationEntry(metadata.animation),context);context.currentQuery=null,context.currentQuerySelector=parentSelector;var ast=new QueryAst(selector,options.limit||0,(!!options.optional),includeSelf,entry);return ast.originalSelector=metadata.selector,ast.options=normalizeAnimationOptions(metadata.options),ast},AnimationAstBuilderVisitor.prototype.visitStagger=function(metadata,context){context.currentQuery||context.errors.push("stagger() can only be used inside of query()");var timings="full"===metadata.timings?{duration:0,delay:0,easing:"full"}:resolveTiming(metadata.timings,context.errors,!0),animation=visitAnimationNode(this,normalizeAnimationEntry(metadata.animation),context);return new StaggerAst(timings,animation)},AnimationAstBuilderVisitor}(),AnimationAstBuilderContext=function(){function AnimationAstBuilderContext(errors){this.errors=errors,this.queryCount=0,this.depCount=0,this.currentTransition=null,this.currentQuery=null,this.currentQuerySelector=null,this.currentAnimateTimings=null,this.currentTime=0,this.collectedStyles={},this.options=null}return AnimationAstBuilderContext}(),ElementInstructionMap=function(){function ElementInstructionMap(){this._map=new Map}return ElementInstructionMap.prototype.consume=function(element){var instructions=this._map.get(element);return instructions?this._map.delete(element):instructions=[],instructions},ElementInstructionMap.prototype.append=function(element,instructions){var existingInstructions=this._map.get(element);existingInstructions||this._map.set(element,existingInstructions=[]),existingInstructions.push.apply(existingInstructions,instructions)},ElementInstructionMap.prototype.has=function(element){return this._map.has(element)},ElementInstructionMap.prototype.clear=function(){this._map.clear()},ElementInstructionMap}(),ONE_FRAME_IN_MILLISECONDS=1,AnimationTimelineBuilderVisitor=function(){function AnimationTimelineBuilderVisitor(){}return AnimationTimelineBuilderVisitor.prototype.buildKeyframes=function(driver,rootElement,ast,startingStyles,finalStyles,options,subInstructions,errors){void 0===errors&&(errors=[]),subInstructions=subInstructions||new ElementInstructionMap;var context=new AnimationTimelineContext(driver,rootElement,subInstructions,errors,[]);context.options=options,context.currentTimeline.setStyles([startingStyles],null,context.errors,options),ast.visit(this,context);var timelines=context.timelines.filter(function(timeline){return timeline.containsAnimation()});if(timelines.length&&Object.keys(finalStyles).length){var tl=timelines[timelines.length-1];tl.allowOnlyTimelineStyles()||tl.setStyles([finalStyles],null,context.errors,options)}return timelines.length?timelines.map(function(timeline){return timeline.buildKeyframes()}):[createTimelineInstruction(rootElement,[],[],[],0,0,"",!1)]},AnimationTimelineBuilderVisitor.prototype.visitTrigger=function(ast,context){},AnimationTimelineBuilderVisitor.prototype.visitState=function(ast,context){},AnimationTimelineBuilderVisitor.prototype.visitTransition=function(ast,context){},AnimationTimelineBuilderVisitor.prototype.visitAnimateChild=function(ast,context){var elementInstructions=context.subInstructions.consume(context.element);if(elementInstructions){var innerContext=context.createSubContext(ast.options),startTime=context.currentTimeline.currentTime,endTime=this._visitSubInstructions(elementInstructions,innerContext,innerContext.options);startTime!=endTime&&context.transformIntoNewTimeline(endTime)}context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype.visitAnimateRef=function(ast,context){var innerContext=context.createSubContext(ast.options);innerContext.transformIntoNewTimeline(),this.visitReference(ast.animation,innerContext),context.transformIntoNewTimeline(innerContext.currentTimeline.currentTime),context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype._visitSubInstructions=function(instructions,context,options){var startTime=context.currentTimeline.currentTime,furthestTime=startTime,duration=null!=options.duration?resolveTimingValue(options.duration):null,delay=null!=options.delay?resolveTimingValue(options.delay):null;return 0!==duration&&instructions.forEach(function(instruction){var instructionTimings=context.appendInstructionToTimeline(instruction,duration,delay);furthestTime=Math.max(furthestTime,instructionTimings.duration+instructionTimings.delay)}),furthestTime},AnimationTimelineBuilderVisitor.prototype.visitReference=function(ast,context){context.updateOptions(ast.options,!0),ast.animation.visit(this,context),context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype.visitSequence=function(ast,context){var _this=this,subContextCount=context.subContextCount,ctx=context,options=ast.options;if(options&&(options.params||options.delay)&&(ctx=context.createSubContext(options),ctx.transformIntoNewTimeline(),null!=options.delay)){ctx.previousNode instanceof StyleAst&&(ctx.currentTimeline.snapshotCurrentStyles(),ctx.previousNode=DEFAULT_NOOP_PREVIOUS_NODE);var delay=resolveTimingValue(options.delay);ctx.delayNextStep(delay)}ast.steps.length&&(ast.steps.forEach(function(s){return s.visit(_this,ctx)}),ctx.currentTimeline.applyStylesToKeyframe(),ctx.subContextCount>subContextCount&&ctx.transformIntoNewTimeline()),context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype.visitGroup=function(ast,context){var _this=this,innerTimelines=[],furthestTime=context.currentTimeline.currentTime,delay=ast.options&&ast.options.delay?resolveTimingValue(ast.options.delay):0;ast.steps.forEach(function(s){var innerContext=context.createSubContext(ast.options);delay&&innerContext.delayNextStep(delay),s.visit(_this,innerContext),furthestTime=Math.max(furthestTime,innerContext.currentTimeline.currentTime),innerTimelines.push(innerContext.currentTimeline)}),innerTimelines.forEach(function(timeline){return context.currentTimeline.mergeTimelineCollectedStyles(timeline)}),context.transformIntoNewTimeline(furthestTime),context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype.visitTiming=function(ast,context){if(ast instanceof DynamicTimingAst){var strValue=context.params?interpolateParams(ast.value,context.params,context.errors):ast.value.toString();return resolveTiming(strValue,context.errors)}return{duration:ast.duration,delay:ast.delay,easing:ast.easing}},AnimationTimelineBuilderVisitor.prototype.visitAnimate=function(ast,context){var timings=context.currentAnimateTimings=this.visitTiming(ast.timings,context),timeline=context.currentTimeline;timings.delay&&(context.incrementTime(timings.delay),timeline.snapshotCurrentStyles());var style$$1=ast.style;style$$1 instanceof KeyframesAst?this.visitKeyframes(style$$1,context):(context.incrementTime(timings.duration),this.visitStyle(style$$1,context),timeline.applyStylesToKeyframe()),context.currentAnimateTimings=null,context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype.visitStyle=function(ast,context){var timeline=context.currentTimeline,timings=context.currentAnimateTimings;!timings&&timeline.getCurrentStyleProperties().length&&timeline.forwardFrame();var easing=timings&&timings.easing||ast.easing;ast.isEmptyStep?timeline.applyEmptyStep(easing):timeline.setStyles(ast.styles,easing,context.errors,context.options),context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype.visitKeyframes=function(ast,context){var currentAnimateTimings=context.currentAnimateTimings,startTime=context.currentTimeline.duration,duration=currentAnimateTimings.duration,innerContext=context.createSubContext(),innerTimeline=innerContext.currentTimeline;innerTimeline.easing=currentAnimateTimings.easing,ast.styles.forEach(function(step){var offset=step.offset||0;innerTimeline.forwardTime(offset*duration),innerTimeline.setStyles(step.styles,step.easing,context.errors,context.options),innerTimeline.applyStylesToKeyframe()}),context.currentTimeline.mergeTimelineCollectedStyles(innerTimeline),context.transformIntoNewTimeline(startTime+duration),context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype.visitQuery=function(ast,context){var _this=this,startTime=context.currentTimeline.currentTime,options=ast.options||{},delay=options.delay?resolveTimingValue(options.delay):0;delay&&(context.previousNode instanceof StyleAst||0==startTime&&context.currentTimeline.getCurrentStyleProperties().length)&&(context.currentTimeline.snapshotCurrentStyles(),context.previousNode=DEFAULT_NOOP_PREVIOUS_NODE);var furthestTime=startTime,elms=context.invokeQuery(ast.selector,ast.originalSelector,ast.limit,ast.includeSelf,!!options.optional,context.errors);context.currentQueryTotal=elms.length;var sameElementTimeline=null;elms.forEach(function(element,i){context.currentQueryIndex=i;var innerContext=context.createSubContext(ast.options,element);delay&&innerContext.delayNextStep(delay),element===context.element&&(sameElementTimeline=innerContext.currentTimeline),ast.animation.visit(_this,innerContext),innerContext.currentTimeline.applyStylesToKeyframe();var endTime=innerContext.currentTimeline.currentTime;furthestTime=Math.max(furthestTime,endTime)}),context.currentQueryIndex=0,context.currentQueryTotal=0,context.transformIntoNewTimeline(furthestTime),sameElementTimeline&&(context.currentTimeline.mergeTimelineCollectedStyles(sameElementTimeline),context.currentTimeline.snapshotCurrentStyles()),context.previousNode=ast},AnimationTimelineBuilderVisitor.prototype.visitStagger=function(ast,context){var parentContext=context.parentContext,tl=context.currentTimeline,timings=ast.timings,duration=Math.abs(timings.duration),maxTime=duration*(context.currentQueryTotal-1),delay=duration*context.currentQueryIndex,staggerTransformer=timings.duration<0?"reverse":timings.easing;switch(staggerTransformer){case"reverse":delay=maxTime-delay;break;case"full":delay=parentContext.currentStaggerTime}var timeline=context.currentTimeline;delay&&timeline.delayNextStep(delay);var startingTime=timeline.currentTime;ast.animation.visit(this,context),context.previousNode=ast,parentContext.currentStaggerTime=tl.currentTime-startingTime+(tl.startTime-parentContext.currentTimeline.startTime)},AnimationTimelineBuilderVisitor}(),DEFAULT_NOOP_PREVIOUS_NODE={},AnimationTimelineContext=function(){function AnimationTimelineContext(_driver,element,subInstructions,errors,timelines,initialTimeline){this._driver=_driver,this.element=element,this.subInstructions=subInstructions,this.errors=errors,this.timelines=timelines,this.parentContext=null,this.currentAnimateTimings=null,this.previousNode=DEFAULT_NOOP_PREVIOUS_NODE,this.subContextCount=0,this.options={},this.currentQueryIndex=0,this.currentQueryTotal=0,this.currentStaggerTime=0,this.currentTimeline=initialTimeline||new TimelineBuilder(element,0),timelines.push(this.currentTimeline)}return Object.defineProperty(AnimationTimelineContext.prototype,"params",{get:function(){return this.options.params},enumerable:!0,configurable:!0}),AnimationTimelineContext.prototype.updateOptions=function(options,skipIfExists){var _this=this;if(options){var newOptions=options,optionsToUpdate=this.options;null!=newOptions.duration&&(optionsToUpdate.duration=resolveTimingValue(newOptions.duration)),null!=newOptions.delay&&(optionsToUpdate.delay=resolveTimingValue(newOptions.delay));var newParams=newOptions.params;if(newParams){var paramsToUpdate_1=optionsToUpdate.params;paramsToUpdate_1||(paramsToUpdate_1=this.options.params={}),Object.keys(newParams).forEach(function(name){skipIfExists&&paramsToUpdate_1.hasOwnProperty(name)||(paramsToUpdate_1[name]=interpolateParams(newParams[name],paramsToUpdate_1,_this.errors))})}}},AnimationTimelineContext.prototype._copyOptions=function(){var options={};if(this.options){var oldParams_1=this.options.params;if(oldParams_1){var params_2=options.params={};Object.keys(this.options.params).forEach(function(name){params_2[name]=oldParams_1[name]})}}return options},AnimationTimelineContext.prototype.createSubContext=function(options,element,newTime){void 0===options&&(options=null);var target=element||this.element,context=new AnimationTimelineContext(this._driver,target,this.subInstructions,this.errors,this.timelines,this.currentTimeline.fork(target,newTime||0));return context.previousNode=this.previousNode,context.currentAnimateTimings=this.currentAnimateTimings,context.options=this._copyOptions(),context.updateOptions(options),context.currentQueryIndex=this.currentQueryIndex,context.currentQueryTotal=this.currentQueryTotal,context.parentContext=this,this.subContextCount++,context},AnimationTimelineContext.prototype.transformIntoNewTimeline=function(newTime){return this.previousNode=DEFAULT_NOOP_PREVIOUS_NODE,this.currentTimeline=this.currentTimeline.fork(this.element,newTime),this.timelines.push(this.currentTimeline),this.currentTimeline},AnimationTimelineContext.prototype.appendInstructionToTimeline=function(instruction,duration,delay){var updatedTimings={duration:null!=duration?duration:instruction.duration,delay:this.currentTimeline.currentTime+(null!=delay?delay:0)+instruction.delay,easing:""},builder=new SubTimelineBuilder(instruction.element,instruction.keyframes,instruction.preStyleProps,instruction.postStyleProps,updatedTimings,instruction.stretchStartingKeyframe);return this.timelines.push(builder),updatedTimings},AnimationTimelineContext.prototype.incrementTime=function(time){this.currentTimeline.forwardTime(this.currentTimeline.duration+time)},AnimationTimelineContext.prototype.delayNextStep=function(delay){delay>0&&this.currentTimeline.delayNextStep(delay)},AnimationTimelineContext.prototype.invokeQuery=function(selector,originalSelector,limit,includeSelf,optional,errors){var results=[];if(includeSelf&&results.push(this.element),selector.length>0){var multi=1!=limit,elements=this._driver.query(this.element,selector,multi);0!==limit&&(elements=elements.slice(0,limit)),results.push.apply(results,elements)}return optional||0!=results.length||errors.push('`query("'+originalSelector+'")` returned zero elements. (Use `query("'+originalSelector+'", { optional: true })` if you wish to allow this.)'),results},AnimationTimelineContext}(),TimelineBuilder=function(){function TimelineBuilder(element,startTime,_elementTimelineStylesLookup){this.element=element,this.startTime=startTime,this._elementTimelineStylesLookup=_elementTimelineStylesLookup,this.duration=0,this._previousKeyframe={},this._currentKeyframe={},this._keyframes=new Map,this._styleSummary={},this._pendingStyles={},this._backFill={},this._currentEmptyStepKeyframe=null,this._elementTimelineStylesLookup||(this._elementTimelineStylesLookup=new Map),this._localTimelineStyles=Object.create(this._backFill,{}),this._globalTimelineStyles=this._elementTimelineStylesLookup.get(element),this._globalTimelineStyles||(this._globalTimelineStyles=this._localTimelineStyles,this._elementTimelineStylesLookup.set(element,this._localTimelineStyles)),this._loadKeyframe()}return TimelineBuilder.prototype.containsAnimation=function(){switch(this._keyframes.size){case 0:return!1;case 1:return this.getCurrentStyleProperties().length>0;default:return!0}},TimelineBuilder.prototype.getCurrentStyleProperties=function(){return Object.keys(this._currentKeyframe)},Object.defineProperty(TimelineBuilder.prototype,"currentTime",{get:function(){return this.startTime+this.duration},enumerable:!0,configurable:!0}),TimelineBuilder.prototype.delayNextStep=function(delay){var hasPreStyleStep=1==this._keyframes.size&&Object.keys(this._pendingStyles).length;this.duration||hasPreStyleStep?(this.forwardTime(this.currentTime+delay),hasPreStyleStep&&this.snapshotCurrentStyles()):this.startTime+=delay},TimelineBuilder.prototype.fork=function(element,currentTime){return this.applyStylesToKeyframe(),new TimelineBuilder(element,currentTime||this.currentTime,this._elementTimelineStylesLookup)},TimelineBuilder.prototype._loadKeyframe=function(){this._currentKeyframe&&(this._previousKeyframe=this._currentKeyframe),this._currentKeyframe=this._keyframes.get(this.duration),this._currentKeyframe||(this._currentKeyframe=Object.create(this._backFill,{}),this._keyframes.set(this.duration,this._currentKeyframe))},TimelineBuilder.prototype.forwardFrame=function(){this.duration+=ONE_FRAME_IN_MILLISECONDS,this._loadKeyframe()},TimelineBuilder.prototype.forwardTime=function(time){this.applyStylesToKeyframe(),this.duration=time,this._loadKeyframe()},TimelineBuilder.prototype._updateStyle=function(prop,value){this._localTimelineStyles[prop]=value,this._globalTimelineStyles[prop]=value,this._styleSummary[prop]={time:this.currentTime,value:value}},TimelineBuilder.prototype.allowOnlyTimelineStyles=function(){return this._currentEmptyStepKeyframe!==this._currentKeyframe},TimelineBuilder.prototype.applyEmptyStep=function(easing){var _this=this;easing&&(this._previousKeyframe.easing=easing),Object.keys(this._globalTimelineStyles).forEach(function(prop){_this._backFill[prop]=_this._globalTimelineStyles[prop]||_angular_animations.AUTO_STYLE,
54
54
  _this._currentKeyframe[prop]=_angular_animations.AUTO_STYLE}),this._currentEmptyStepKeyframe=this._currentKeyframe},TimelineBuilder.prototype.setStyles=function(input,easing,errors,options){var _this=this;easing&&(this._previousKeyframe.easing=easing);var params=options&&options.params||{},styles=flattenStyles(input,this._globalTimelineStyles);Object.keys(styles).forEach(function(prop){var val=interpolateParams(styles[prop],params,errors);_this._pendingStyles[prop]=val,_this._localTimelineStyles.hasOwnProperty(prop)||(_this._backFill[prop]=_this._globalTimelineStyles.hasOwnProperty(prop)?_this._globalTimelineStyles[prop]:_angular_animations.AUTO_STYLE),_this._updateStyle(prop,val)})},TimelineBuilder.prototype.applyStylesToKeyframe=function(){var _this=this,styles=this._pendingStyles,props=Object.keys(styles);0!=props.length&&(this._pendingStyles={},props.forEach(function(prop){var val=styles[prop];_this._currentKeyframe[prop]=val}),Object.keys(this._localTimelineStyles).forEach(function(prop){_this._currentKeyframe.hasOwnProperty(prop)||(_this._currentKeyframe[prop]=_this._localTimelineStyles[prop])}))},TimelineBuilder.prototype.snapshotCurrentStyles=function(){var _this=this;Object.keys(this._localTimelineStyles).forEach(function(prop){var val=_this._localTimelineStyles[prop];_this._pendingStyles[prop]=val,_this._updateStyle(prop,val)})},TimelineBuilder.prototype.getFinalKeyframe=function(){return this._keyframes.get(this.duration)},Object.defineProperty(TimelineBuilder.prototype,"properties",{get:function(){var properties=[];for(var prop in this._currentKeyframe)properties.push(prop);return properties},enumerable:!0,configurable:!0}),TimelineBuilder.prototype.mergeTimelineCollectedStyles=function(timeline){var _this=this;Object.keys(timeline._styleSummary).forEach(function(prop){var details0=_this._styleSummary[prop],details1=timeline._styleSummary[prop];(!details0||details1.time>details0.time)&&_this._updateStyle(prop,details1.value)})},TimelineBuilder.prototype.buildKeyframes=function(){var _this=this;this.applyStylesToKeyframe();var preStyleProps=new Set,postStyleProps=new Set,isEmpty=1===this._keyframes.size&&0===this.duration,finalKeyframes=[];this._keyframes.forEach(function(keyframe,time){var finalKeyframe=copyStyles(keyframe,!0);Object.keys(finalKeyframe).forEach(function(prop){var value=finalKeyframe[prop];value==_angular_animations.ɵPRE_STYLE?preStyleProps.add(prop):value==_angular_animations.AUTO_STYLE&&postStyleProps.add(prop)}),isEmpty||(finalKeyframe.offset=time/_this.duration),finalKeyframes.push(finalKeyframe)});var preProps=preStyleProps.size?iteratorToArray(preStyleProps.values()):[],postProps=postStyleProps.size?iteratorToArray(postStyleProps.values()):[];if(isEmpty){var kf0=finalKeyframes[0],kf1=copyObj(kf0);kf0.offset=0,kf1.offset=1,finalKeyframes=[kf0,kf1]}return createTimelineInstruction(this.element,finalKeyframes,preProps,postProps,this.duration,this.startTime,this.easing,!1)},TimelineBuilder}(),SubTimelineBuilder=function(_super){function SubTimelineBuilder(element,keyframes,preStyleProps,postStyleProps,timings,_stretchStartingKeyframe){void 0===_stretchStartingKeyframe&&(_stretchStartingKeyframe=!1);var _this=_super.call(this,element,timings.delay)||this;return _this.element=element,_this.keyframes=keyframes,_this.preStyleProps=preStyleProps,_this.postStyleProps=postStyleProps,_this._stretchStartingKeyframe=_stretchStartingKeyframe,_this.timings={duration:timings.duration,delay:timings.delay,easing:timings.easing},_this}return __extends(SubTimelineBuilder,_super),SubTimelineBuilder.prototype.containsAnimation=function(){return this.keyframes.length>1},SubTimelineBuilder.prototype.buildKeyframes=function(){var keyframes=this.keyframes,_a=this.timings,delay=_a.delay,duration=_a.duration,easing=_a.easing;if(this._stretchStartingKeyframe&&delay){var newKeyframes=[],totalTime=duration+delay,startingGap=delay/totalTime,newFirstKeyframe=copyStyles(keyframes[0],!1);newFirstKeyframe.offset=0,newKeyframes.push(newFirstKeyframe);var oldFirstKeyframe=copyStyles(keyframes[0],!1);oldFirstKeyframe.offset=roundOffset(startingGap),newKeyframes.push(oldFirstKeyframe);for(var limit=keyframes.length-1,i=1;i<=limit;i++){var kf=copyStyles(keyframes[i],!1),oldOffset=kf.offset,timeAtKeyframe=delay+oldOffset*duration;kf.offset=roundOffset(timeAtKeyframe/totalTime),newKeyframes.push(kf)}duration=totalTime,delay=0,easing="",keyframes=newKeyframes}return createTimelineInstruction(this.element,keyframes,this.preStyleProps,this.postStyleProps,duration,delay,easing,!0)},SubTimelineBuilder}(TimelineBuilder),Animation=function(){function Animation(_driver,input){this._driver=_driver;var errors=[],ast=buildAnimationAst(input,errors);if(errors.length){var errorMessage="animation validation failed:\n"+errors.join("\n");throw new Error(errorMessage)}this._animationAst=ast}return Animation.prototype.buildTimelines=function(element,startingStyles,destinationStyles,options,subInstructions){var start=Array.isArray(startingStyles)?normalizeStyles(startingStyles):startingStyles,dest=Array.isArray(destinationStyles)?normalizeStyles(destinationStyles):destinationStyles,errors=[];subInstructions=subInstructions||new ElementInstructionMap;var result=buildAnimationTimelines(this._driver,element,this._animationAst,start,dest,options,subInstructions,errors);if(errors.length){var errorMessage="animation building failed:\n"+errors.join("\n");throw new Error(errorMessage)}return result},Animation}(),AnimationStyleNormalizer=function(){function AnimationStyleNormalizer(){}return AnimationStyleNormalizer}(),NoopAnimationStyleNormalizer=function(){function NoopAnimationStyleNormalizer(){}return NoopAnimationStyleNormalizer.prototype.normalizePropertyName=function(propertyName,errors){return propertyName},NoopAnimationStyleNormalizer.prototype.normalizeStyleValue=function(userProvidedProperty,normalizedProperty,value,errors){return value},NoopAnimationStyleNormalizer}(),WebAnimationsStyleNormalizer=function(_super){function WebAnimationsStyleNormalizer(){return null!==_super&&_super.apply(this,arguments)||this}return __extends(WebAnimationsStyleNormalizer,_super),WebAnimationsStyleNormalizer.prototype.normalizePropertyName=function(propertyName,errors){return dashCaseToCamelCase(propertyName)},WebAnimationsStyleNormalizer.prototype.normalizeStyleValue=function(userProvidedProperty,normalizedProperty,value,errors){var unit="",strVal=value.toString().trim();if(DIMENSIONAL_PROP_MAP[normalizedProperty]&&0!==value&&"0"!==value)if("number"==typeof value)unit="px";else{var valAndSuffixMatch=value.match(/^[+-]?[\d\.]+([a-z]*)$/);valAndSuffixMatch&&0==valAndSuffixMatch[1].length&&errors.push("Please provide a CSS unit value for "+userProvidedProperty+":"+value)}return strVal+unit},WebAnimationsStyleNormalizer}(AnimationStyleNormalizer),DIMENSIONAL_PROP_MAP=makeBooleanMap("width,height,minWidth,minHeight,maxWidth,maxHeight,left,top,bottom,right,fontSize,outlineWidth,outlineOffset,paddingTop,paddingLeft,paddingBottom,paddingRight,marginTop,marginLeft,marginBottom,marginRight,borderRadius,borderWidth,borderTopWidth,borderLeftWidth,borderRightWidth,borderBottomWidth,textIndent,perspective".split(",")),EMPTY_OBJECT={},AnimationTransitionFactory=function(){function AnimationTransitionFactory(_triggerName,ast,_stateStyles){this._triggerName=_triggerName,this.ast=ast,this._stateStyles=_stateStyles}return AnimationTransitionFactory.prototype.match=function(currentState,nextState){return oneOrMoreTransitionsMatch(this.ast.matchers,currentState,nextState)},AnimationTransitionFactory.prototype.buildStyles=function(stateName,params,errors){var backupStateStyler=this._stateStyles["*"],stateStyler=this._stateStyles[stateName],backupStyles=backupStateStyler?backupStateStyler.buildStyles(params,errors):{};return stateStyler?stateStyler.buildStyles(params,errors):backupStyles},AnimationTransitionFactory.prototype.build=function(driver,element,currentState,nextState,currentOptions,nextOptions,subInstructions){var errors=[],transitionAnimationParams=this.ast.options&&this.ast.options.params||EMPTY_OBJECT,currentAnimationParams=currentOptions&&currentOptions.params||EMPTY_OBJECT,currentStateStyles=this.buildStyles(currentState,currentAnimationParams,errors),nextAnimationParams=nextOptions&&nextOptions.params||EMPTY_OBJECT,nextStateStyles=this.buildStyles(nextState,nextAnimationParams,errors),queriedElements=new Set,preStyleMap=new Map,postStyleMap=new Map,isRemoval="void"===nextState,animationOptions={params:Object.assign({},transitionAnimationParams,nextAnimationParams)},timelines=buildAnimationTimelines(driver,element,this.ast.animation,currentStateStyles,nextStateStyles,animationOptions,subInstructions,errors);if(errors.length)return createTransitionInstruction(element,this._triggerName,currentState,nextState,isRemoval,currentStateStyles,nextStateStyles,[],[],preStyleMap,postStyleMap,errors);timelines.forEach(function(tl){var elm=tl.element,preProps=getOrSetAsInMap(preStyleMap,elm,{});tl.preStyleProps.forEach(function(prop){return preProps[prop]=!0});var postProps=getOrSetAsInMap(postStyleMap,elm,{});tl.postStyleProps.forEach(function(prop){return postProps[prop]=!0}),elm!==element&&queriedElements.add(elm)});var queriedElementsList=iteratorToArray(queriedElements.values());return createTransitionInstruction(element,this._triggerName,currentState,nextState,isRemoval,currentStateStyles,nextStateStyles,timelines,queriedElementsList,preStyleMap,postStyleMap)},AnimationTransitionFactory}(),AnimationStateStyles=function(){function AnimationStateStyles(styles,defaultParams){this.styles=styles,this.defaultParams=defaultParams}return AnimationStateStyles.prototype.buildStyles=function(params,errors){var finalStyles={},combinedParams=copyObj(this.defaultParams);return Object.keys(params).forEach(function(key){var value=params[key];null!=value&&(combinedParams[key]=value)}),this.styles.styles.forEach(function(value){if("string"!=typeof value){var styleObj_1=value;Object.keys(styleObj_1).forEach(function(prop){var val=styleObj_1[prop];val.length>1&&(val=interpolateParams(val,combinedParams,errors)),finalStyles[prop]=val})}}),finalStyles},AnimationStateStyles}(),AnimationTrigger=function(){function AnimationTrigger(name,ast){var _this=this;this.name=name,this.ast=ast,this.transitionFactories=[],this.states={},ast.states.forEach(function(ast){var defaultParams=ast.options&&ast.options.params||{};_this.states[ast.name]=new AnimationStateStyles(ast.style,defaultParams)}),balanceProperties(this.states,"true","1"),balanceProperties(this.states,"false","0"),ast.transitions.forEach(function(ast){_this.transitionFactories.push(new AnimationTransitionFactory(name,ast,_this.states))}),this.fallbackTransition=createFallbackTransition(name,this.states)}return Object.defineProperty(AnimationTrigger.prototype,"containsQueries",{get:function(){return this.ast.queryCount>0},enumerable:!0,configurable:!0}),AnimationTrigger.prototype.matchTransition=function(currentState,nextState){var entry=this.transitionFactories.find(function(f){return f.match(currentState,nextState)});return entry||null},AnimationTrigger.prototype.matchStyles=function(currentState,params,errors){return this.fallbackTransition.buildStyles(currentState,params,errors)},AnimationTrigger}(),EMPTY_INSTRUCTION_MAP=new ElementInstructionMap,TimelineAnimationEngine=function(){function TimelineAnimationEngine(_driver,_normalizer){this._driver=_driver,this._normalizer=_normalizer,this._animations={},this._playersById={},this.players=[]}return TimelineAnimationEngine.prototype.register=function(id,metadata){var errors=[],ast=buildAnimationAst(metadata,errors);if(errors.length)throw new Error("Unable to build the animation due to the following errors: "+errors.join("\n"));this._animations[id]=ast},TimelineAnimationEngine.prototype._buildPlayer=function(i,preStyles,postStyles){var element=i.element,keyframes=normalizeKeyframes(this._driver,this._normalizer,element,i.keyframes,preStyles,postStyles);return this._driver.animate(element,keyframes,i.duration,i.delay,i.easing,[])},TimelineAnimationEngine.prototype.create=function(id,element,options){var _this=this;void 0===options&&(options={});var instructions,errors=[],ast=this._animations[id],autoStylesMap=new Map;if(ast?(instructions=buildAnimationTimelines(this._driver,element,ast,{},{},options,EMPTY_INSTRUCTION_MAP,errors),instructions.forEach(function(inst){var styles=getOrSetAsInMap(autoStylesMap,inst.element,{});inst.postStyleProps.forEach(function(prop){return styles[prop]=null})})):(errors.push("The requested animation doesn't exist or has already been destroyed"),instructions=[]),errors.length)throw new Error("Unable to create the animation due to the following errors: "+errors.join("\n"));autoStylesMap.forEach(function(styles,element){Object.keys(styles).forEach(function(prop){styles[prop]=_this._driver.computeStyle(element,prop,_angular_animations.AUTO_STYLE)})});var players=instructions.map(function(i){var styles=autoStylesMap.get(i.element);return _this._buildPlayer(i,{},styles)}),player=optimizeGroupPlayer(players);return this._playersById[id]=player,player.onDestroy(function(){return _this.destroy(id)}),this.players.push(player),player},TimelineAnimationEngine.prototype.destroy=function(id){var player=this._getPlayer(id);player.destroy(),delete this._playersById[id];var index=this.players.indexOf(player);index>=0&&this.players.splice(index,1)},TimelineAnimationEngine.prototype._getPlayer=function(id){var player=this._playersById[id];if(!player)throw new Error("Unable to find the timeline player referenced by "+id);return player},TimelineAnimationEngine.prototype.listen=function(id,element,eventName,callback){var baseEvent=makeAnimationEvent(element,"","","");return listenOnPlayer(this._getPlayer(id),eventName,baseEvent,callback),function(){}},TimelineAnimationEngine.prototype.command=function(id,element,command,args){if("register"==command)return void this.register(id,args[0]);if("create"==command){var options=args[0]||{};return void this.create(id,element,options)}var player=this._getPlayer(id);switch(command){case"play":player.play();break;case"pause":player.pause();break;case"reset":player.reset();break;case"restart":player.restart();break;case"finish":player.finish();break;case"init":player.init();break;case"setPosition":player.setPosition(parseFloat(args[0]));break;case"destroy":this.destroy(id)}},TimelineAnimationEngine}(),QUEUED_CLASSNAME="ng-animate-queued",QUEUED_SELECTOR=".ng-animate-queued",DISABLED_CLASSNAME="ng-animate-disabled",DISABLED_SELECTOR=".ng-animate-disabled",EMPTY_PLAYER_ARRAY=[],NULL_REMOVAL_STATE={namespaceId:"",setForRemoval:null,hasAnimation:!1,removedBeforeQueried:!1},NULL_REMOVED_QUERIED_STATE={namespaceId:"",setForRemoval:null,hasAnimation:!1,removedBeforeQueried:!0},REMOVAL_FLAG="__ng_removed",StateValue=function(){function StateValue(input){var isObj=input&&input.hasOwnProperty("value"),value=isObj?input.value:input;if(this.value=normalizeTriggerValue(value),isObj){var options=copyObj(input);delete options.value,this.options=options}else this.options={};this.options.params||(this.options.params={})}return Object.defineProperty(StateValue.prototype,"params",{get:function(){return this.options.params},enumerable:!0,configurable:!0}),StateValue.prototype.absorbOptions=function(options){var newParams=options.params;if(newParams){var oldParams_2=this.options.params;Object.keys(newParams).forEach(function(prop){null==oldParams_2[prop]&&(oldParams_2[prop]=newParams[prop])})}},StateValue}(),VOID_VALUE="void",DEFAULT_STATE_VALUE=new StateValue(VOID_VALUE),DELETED_STATE_VALUE=new StateValue("DELETED"),AnimationTransitionNamespace=function(){function AnimationTransitionNamespace(id,hostElement,_engine){this.id=id,this.hostElement=hostElement,this._engine=_engine,this.players=[],this._triggers={},this._queue=[],this._elementListeners=new Map,this._hostClassName="ng-tns-"+id,addClass(hostElement,this._hostClassName)}return AnimationTransitionNamespace.prototype.listen=function(element,name,phase,callback){var _this=this;if(!this._triggers.hasOwnProperty(name))throw new Error('Unable to listen on the animation trigger event "'+phase+'" because the animation trigger "'+name+"\" doesn't exist!");if(null==phase||0==phase.length)throw new Error('Unable to listen on the animation trigger "'+name+'" because the provided event is undefined!');if(!isTriggerEventValid(phase))throw new Error('The provided animation trigger event "'+phase+'" for the animation trigger "'+name+'" is not supported!');var listeners=getOrSetAsInMap(this._elementListeners,element,[]),data={name:name,phase:phase,callback:callback};listeners.push(data);var triggersWithStates=getOrSetAsInMap(this._engine.statesByElement,element,{});return triggersWithStates.hasOwnProperty(name)||(addClass(element,NG_TRIGGER_CLASSNAME),addClass(element,NG_TRIGGER_CLASSNAME+"-"+name),triggersWithStates[name]=null),function(){_this._engine.afterFlush(function(){var index=listeners.indexOf(data);index>=0&&listeners.splice(index,1),_this._triggers[name]||delete triggersWithStates[name]})}},AnimationTransitionNamespace.prototype.register=function(name,ast){return!this._triggers[name]&&(this._triggers[name]=ast,!0)},AnimationTransitionNamespace.prototype._getTrigger=function(name){var trigger=this._triggers[name];if(!trigger)throw new Error('The provided animation trigger "'+name+'" has not been registered!');return trigger},AnimationTransitionNamespace.prototype.trigger=function(element,triggerName,value,defaultToFallback){var _this=this;void 0===defaultToFallback&&(defaultToFallback=!0);var trigger=this._getTrigger(triggerName),player=new TransitionAnimationPlayer(this.id,triggerName,element),triggersWithStates=this._engine.statesByElement.get(element);triggersWithStates||(addClass(element,NG_TRIGGER_CLASSNAME),addClass(element,NG_TRIGGER_CLASSNAME+"-"+triggerName),this._engine.statesByElement.set(element,triggersWithStates={}));var fromState=triggersWithStates[triggerName],toState=new StateValue(value),isObj=value&&value.hasOwnProperty("value");if(!isObj&&fromState&&toState.absorbOptions(fromState.options),triggersWithStates[triggerName]=toState,fromState){if(fromState===DELETED_STATE_VALUE)return player}else fromState=DEFAULT_STATE_VALUE;var isRemoval=toState.value===VOID_VALUE;if(isRemoval||fromState.value!==toState.value){var playersOnElement=getOrSetAsInMap(this._engine.playersByElement,element,[]);playersOnElement.forEach(function(player){player.namespaceId==_this.id&&player.triggerName==triggerName&&player.queued&&player.destroy()});var transition=trigger.matchTransition(fromState.value,toState.value),isFallbackTransition=!1;if(!transition){if(!defaultToFallback)return;transition=trigger.fallbackTransition,isFallbackTransition=!0}return this._engine.totalQueuedPlayers++,this._queue.push({element:element,triggerName:triggerName,transition:transition,fromState:fromState,toState:toState,player:player,isFallbackTransition:isFallbackTransition}),isFallbackTransition||(addClass(element,QUEUED_CLASSNAME),player.onStart(function(){removeClass(element,QUEUED_CLASSNAME)})),player.onDone(function(){var index=_this.players.indexOf(player);index>=0&&_this.players.splice(index,1);var players=_this._engine.playersByElement.get(element);if(players){var index_1=players.indexOf(player);index_1>=0&&players.splice(index_1,1)}}),this.players.push(player),playersOnElement.push(player),player}if(!objEquals(fromState.params,toState.params)){var errors=[],fromStyles_1=trigger.matchStyles(fromState.value,fromState.params,errors),toStyles_1=trigger.matchStyles(toState.value,toState.params,errors);errors.length?this._engine.reportError(errors):this._engine.afterFlush(function(){eraseStyles(element,fromStyles_1),setStyles(element,toStyles_1)})}},AnimationTransitionNamespace.prototype.deregister=function(name){var _this=this;delete this._triggers[name],this._engine.statesByElement.forEach(function(stateMap,element){delete stateMap[name]}),this._elementListeners.forEach(function(listeners,element){_this._elementListeners.set(element,listeners.filter(function(entry){return entry.name!=name}))})},AnimationTransitionNamespace.prototype.clearElementCache=function(element){this._engine.statesByElement.delete(element),this._elementListeners.delete(element);var elementPlayers=this._engine.playersByElement.get(element);elementPlayers&&(elementPlayers.forEach(function(player){return player.destroy()}),this._engine.playersByElement.delete(element))},AnimationTransitionNamespace.prototype._destroyInnerNodes=function(rootElement,context,animate){var _this=this;void 0===animate&&(animate=!1),this._engine.driver.query(rootElement,NG_TRIGGER_SELECTOR,!0).forEach(function(elm){if(animate&&containsClass(elm,_this._hostClassName)){var innerNs=_this._engine.namespacesByHostElement.get(elm);innerNs&&innerNs.removeNode(elm,context,!0),_this.removeNode(elm,context,!0)}else _this.clearElementCache(elm)})},AnimationTransitionNamespace.prototype.removeNode=function(element,context,doNotRecurse){var _this=this,engine=this._engine;!doNotRecurse&&element.childElementCount&&this._destroyInnerNodes(element,context,!0);var triggerStates=engine.statesByElement.get(element);if(triggerStates){var players_1=[];if(Object.keys(triggerStates).forEach(function(triggerName){if(_this._triggers[triggerName]){var player=_this.trigger(element,triggerName,VOID_VALUE,!1);player&&players_1.push(player)}}),players_1.length)return engine.markElementAsRemoved(this.id,element,!0,context),void optimizeGroupPlayer(players_1).onDone(function(){return engine.processLeaveNode(element)})}var containsPotentialParentTransition=!1;if(engine.totalAnimations){var currentPlayers=engine.players.length?engine.playersByQueriedElement.get(element):[];if(currentPlayers&&currentPlayers.length)containsPotentialParentTransition=!0;else for(var parent=element;parent=parent.parentNode;){var triggers=engine.statesByElement.get(parent);if(triggers){containsPotentialParentTransition=!0;break}}}var listeners=this._elementListeners.get(element);if(listeners){var visitedTriggers_1=new Set;listeners.forEach(function(listener){var triggerName=listener.name;if(!visitedTriggers_1.has(triggerName)){visitedTriggers_1.add(triggerName);var trigger=_this._triggers[triggerName],transition=trigger.fallbackTransition,elementStates=engine.statesByElement.get(element),fromState=elementStates[triggerName]||DEFAULT_STATE_VALUE,toState=new StateValue(VOID_VALUE),player=new TransitionAnimationPlayer(_this.id,triggerName,element);_this._engine.totalQueuedPlayers++,_this._queue.push({element:element,triggerName:triggerName,transition:transition,fromState:fromState,toState:toState,player:player,isFallbackTransition:!0})}})}containsPotentialParentTransition?engine.markElementAsRemoved(this.id,element,!1,context):(engine.afterFlush(function(){return _this.clearElementCache(element)}),engine.destroyInnerAnimations(element),engine._onRemovalComplete(element,context))},AnimationTransitionNamespace.prototype.insertNode=function(element,parent){addClass(element,this._hostClassName)},AnimationTransitionNamespace.prototype.drainQueuedTransitions=function(microtaskId){var _this=this,instructions=[];return this._queue.forEach(function(entry){var player=entry.player;if(!player.destroyed){var element=entry.element,listeners=_this._elementListeners.get(element);listeners&&listeners.forEach(function(listener){if(listener.name==entry.triggerName){var baseEvent=makeAnimationEvent(element,entry.triggerName,entry.fromState.value,entry.toState.value);baseEvent._data=microtaskId,listenOnPlayer(entry.player,listener.phase,baseEvent,listener.callback)}}),player.markedForDestroy?_this._engine.afterFlush(function(){player.destroy()}):instructions.push(entry)}}),this._queue=[],instructions.sort(function(a,b){var d0=a.transition.ast.depCount,d1=b.transition.ast.depCount;return 0==d0||0==d1?d0-d1:_this._engine.driver.containsElement(a.element,b.element)?1:-1})},AnimationTransitionNamespace.prototype.destroy=function(context){this.players.forEach(function(p){return p.destroy()}),this._destroyInnerNodes(this.hostElement,context)},AnimationTransitionNamespace.prototype.elementContainsData=function(element){var containsData=!1;return this._elementListeners.has(element)&&(containsData=!0),containsData=!!this._queue.find(function(entry){return entry.element===element})||containsData},AnimationTransitionNamespace}(),TransitionAnimationEngine=function(){function TransitionAnimationEngine(driver,_normalizer){this.driver=driver,this._normalizer=_normalizer,this.players=[],this.newHostElements=new Map,this.playersByElement=new Map,this.playersByQueriedElement=new Map,this.statesByElement=new Map,this.disabledNodes=new Set,this.totalAnimations=0,this.totalQueuedPlayers=0,this._namespaceLookup={},this._namespaceList=[],this._flushFns=[],this._whenQuietFns=[],this.namespacesByHostElement=new Map,this.collectedEnterElements=[],this.collectedLeaveElements=[],this.onRemovalComplete=function(element,context){}}return TransitionAnimationEngine.prototype._onRemovalComplete=function(element,context){this.onRemovalComplete(element,context)},Object.defineProperty(TransitionAnimationEngine.prototype,"queuedPlayers",{get:function(){var players=[];return this._namespaceList.forEach(function(ns){ns.players.forEach(function(player){player.queued&&players.push(player)})}),players},enumerable:!0,configurable:!0}),TransitionAnimationEngine.prototype.createNamespace=function(namespaceId,hostElement){var ns=new AnimationTransitionNamespace(namespaceId,hostElement,this);return hostElement.parentNode?this._balanceNamespaceList(ns,hostElement):(this.newHostElements.set(hostElement,ns),this.collectEnterElement(hostElement)),this._namespaceLookup[namespaceId]=ns},TransitionAnimationEngine.prototype._balanceNamespaceList=function(ns,hostElement){var limit=this._namespaceList.length-1;if(limit>=0){for(var found=!1,i=limit;i>=0;i--){var nextNamespace=this._namespaceList[i];if(this.driver.containsElement(nextNamespace.hostElement,hostElement)){this._namespaceList.splice(i+1,0,ns),found=!0;break}}found||this._namespaceList.splice(0,0,ns)}else this._namespaceList.push(ns);return this.namespacesByHostElement.set(hostElement,ns),ns},TransitionAnimationEngine.prototype.register=function(namespaceId,hostElement){var ns=this._namespaceLookup[namespaceId];return ns||(ns=this.createNamespace(namespaceId,hostElement)),ns},TransitionAnimationEngine.prototype.registerTrigger=function(namespaceId,name,trigger){var ns=this._namespaceLookup[namespaceId];ns&&ns.register(name,trigger)&&this.totalAnimations++},TransitionAnimationEngine.prototype.destroy=function(namespaceId,context){var _this=this;if(namespaceId){var ns=this._fetchNamespace(namespaceId);this.afterFlush(function(){_this.namespacesByHostElement.delete(ns.hostElement),delete _this._namespaceLookup[namespaceId];var index=_this._namespaceList.indexOf(ns);index>=0&&_this._namespaceList.splice(index,1)}),this.afterFlushAnimationsDone(function(){return ns.destroy(context)})}},TransitionAnimationEngine.prototype._fetchNamespace=function(id){return this._namespaceLookup[id]},TransitionAnimationEngine.prototype.trigger=function(namespaceId,element,name,value){return!!isElementNode(element)&&(this._fetchNamespace(namespaceId).trigger(element,name,value),!0)},TransitionAnimationEngine.prototype.insertNode=function(namespaceId,element,parent,insertBefore){if(isElementNode(element)){var details=element[REMOVAL_FLAG];details&&details.setForRemoval&&(details.setForRemoval=!1),namespaceId&&this._fetchNamespace(namespaceId).insertNode(element,parent),insertBefore&&this.collectEnterElement(element)}},TransitionAnimationEngine.prototype.collectEnterElement=function(element){this.collectedEnterElements.push(element)},TransitionAnimationEngine.prototype.markElementAsDisabled=function(element,value){value?this.disabledNodes.has(element)||(this.disabledNodes.add(element),addClass(element,DISABLED_CLASSNAME)):this.disabledNodes.has(element)&&(this.disabledNodes.delete(element),removeClass(element,DISABLED_CLASSNAME))},TransitionAnimationEngine.prototype.removeNode=function(namespaceId,element,context,doNotRecurse){if(!isElementNode(element))return void this._onRemovalComplete(element,context);var ns=namespaceId?this._fetchNamespace(namespaceId):null;ns?ns.removeNode(element,context,doNotRecurse):this.markElementAsRemoved(namespaceId,element,!1,context)},TransitionAnimationEngine.prototype.markElementAsRemoved=function(namespaceId,element,hasAnimation,context){this.collectedLeaveElements.push(element),element[REMOVAL_FLAG]={namespaceId:namespaceId,setForRemoval:context,hasAnimation:hasAnimation,removedBeforeQueried:!1}},TransitionAnimationEngine.prototype.listen=function(namespaceId,element,name,phase,callback){return isElementNode(element)?this._fetchNamespace(namespaceId).listen(element,name,phase,callback):function(){}},TransitionAnimationEngine.prototype._buildInstruction=function(entry,subTimelines){return entry.transition.build(this.driver,entry.element,entry.fromState.value,entry.toState.value,entry.fromState.options,entry.toState.options,subTimelines)},TransitionAnimationEngine.prototype.destroyInnerAnimations=function(containerElement){var _this=this,elements=this.driver.query(containerElement,NG_TRIGGER_SELECTOR,!0);elements.forEach(function(element){var players=_this.playersByElement.get(element);players&&players.forEach(function(player){player.queued?player.markedForDestroy=!0:player.destroy()});var stateMap=_this.statesByElement.get(element);stateMap&&Object.keys(stateMap).forEach(function(triggerName){return stateMap[triggerName]=DELETED_STATE_VALUE})}),0!=this.playersByQueriedElement.size&&(elements=this.driver.query(containerElement,NG_ANIMATING_SELECTOR,!0),elements.length&&elements.forEach(function(element){var players=_this.playersByQueriedElement.get(element);players&&players.forEach(function(player){return player.finish()})}))},TransitionAnimationEngine.prototype.whenRenderingDone=function(){var _this=this;return new Promise(function(resolve){return _this.players.length?optimizeGroupPlayer(_this.players).onDone(function(){return resolve()}):void resolve()})},TransitionAnimationEngine.prototype.processLeaveNode=function(element){var _this=this,details=element[REMOVAL_FLAG];if(details&&details.setForRemoval){if(element[REMOVAL_FLAG]=NULL_REMOVAL_STATE,details.namespaceId){this.destroyInnerAnimations(element);var ns=this._fetchNamespace(details.namespaceId);ns&&ns.clearElementCache(element)}this._onRemovalComplete(element,details.setForRemoval)}this.driver.matchesElement(element,DISABLED_SELECTOR)&&this.markElementAsDisabled(element,!1),this.driver.query(element,DISABLED_SELECTOR,!0).forEach(function(node){_this.markElementAsDisabled(element,!1)})},TransitionAnimationEngine.prototype.flush=function(microtaskId){var _this=this;void 0===microtaskId&&(microtaskId=-1);var players=[];if(this.newHostElements.size&&(this.newHostElements.forEach(function(ns,element){return _this._balanceNamespaceList(ns,element)}),this.newHostElements.clear()),this._namespaceList.length&&(this.totalQueuedPlayers||this.collectedLeaveElements.length)){var cleanupFns=[];try{players=this._flushAnimations(cleanupFns,microtaskId)}finally{for(var i=0;i<cleanupFns.length;i++)cleanupFns[i]()}}else for(var i=0;i<this.collectedLeaveElements.length;i++){var element=this.collectedLeaveElements[i];this.processLeaveNode(element)}if(this.totalQueuedPlayers=0,this.collectedEnterElements.length=0,this.collectedLeaveElements.length=0,this._flushFns.forEach(function(fn){return fn()}),this._flushFns=[],this._whenQuietFns.length){var quietFns_1=this._whenQuietFns;this._whenQuietFns=[],players.length?optimizeGroupPlayer(players).onDone(function(){quietFns_1.forEach(function(fn){return fn()})}):quietFns_1.forEach(function(fn){return fn()})}},TransitionAnimationEngine.prototype.reportError=function(errors){throw new Error("Unable to process animations due to the following failed trigger transitions\n "+errors.join("\n"));
55
55
  },TransitionAnimationEngine.prototype._flushAnimations=function(cleanupFns,microtaskId){var _this=this,subTimelines=new ElementInstructionMap,skippedPlayers=[],skippedPlayersMap=new Map,queuedInstructions=[],queriedElements=new Map,allPreStyleElements=new Map,allPostStyleElements=new Map,disabledElementsSet=new Set;this.disabledNodes.forEach(function(node){disabledElementsSet.add(node);for(var nodesThatAreDisabled=_this.driver.query(node,QUEUED_SELECTOR,!0),i=0;i<nodesThatAreDisabled.length;i++)disabledElementsSet.add(nodesThatAreDisabled[i])});for(var bodyNode=getBodyNode(),allEnterNodes=this.collectedEnterElements.length?this.collectedEnterElements.filter(createIsRootFilterFn(this.collectedEnterElements)):[],i=0;i<allEnterNodes.length;i++)addClass(allEnterNodes[i],ENTER_CLASSNAME);for(var allLeaveNodes=[],leaveNodesWithoutAnimations=new Set,i=0;i<this.collectedLeaveElements.length;i++){var element=this.collectedLeaveElements[i],details=element[REMOVAL_FLAG];details&&details.setForRemoval&&(addClass(element,LEAVE_CLASSNAME),allLeaveNodes.push(element),details.hasAnimation||leaveNodesWithoutAnimations.add(element))}cleanupFns.push(function(){allEnterNodes.forEach(function(element){return removeClass(element,ENTER_CLASSNAME)}),allLeaveNodes.forEach(function(element){removeClass(element,LEAVE_CLASSNAME),_this.processLeaveNode(element)})});for(var allPlayers=[],erroneousTransitions=[],i=this._namespaceList.length-1;i>=0;i--){var ns=this._namespaceList[i];ns.drainQueuedTransitions(microtaskId).forEach(function(entry){var player=entry.player;allPlayers.push(player);var element=entry.element;if(!bodyNode||!_this.driver.containsElement(bodyNode,element))return void player.destroy();var instruction=_this._buildInstruction(entry,subTimelines);if(instruction.errors&&instruction.errors.length)return void erroneousTransitions.push(instruction);if(entry.isFallbackTransition)return player.onStart(function(){return eraseStyles(element,instruction.fromStyles)}),player.onDestroy(function(){return setStyles(element,instruction.toStyles)}),void skippedPlayers.push(player);instruction.timelines.forEach(function(tl){return tl.stretchStartingKeyframe=!0}),subTimelines.append(element,instruction.timelines);var tuple={instruction:instruction,player:player,element:element};queuedInstructions.push(tuple),instruction.queriedElements.forEach(function(element){return getOrSetAsInMap(queriedElements,element,[]).push(player)}),instruction.preStyleProps.forEach(function(stringMap,element){var props=Object.keys(stringMap);if(props.length){var setVal_1=allPreStyleElements.get(element);setVal_1||allPreStyleElements.set(element,setVal_1=new Set),props.forEach(function(prop){return setVal_1.add(prop)})}}),instruction.postStyleProps.forEach(function(stringMap,element){var props=Object.keys(stringMap),setVal=allPostStyleElements.get(element);setVal||allPostStyleElements.set(element,setVal=new Set),props.forEach(function(prop){return setVal.add(prop)})})})}if(erroneousTransitions.length){var errors_1=[];erroneousTransitions.forEach(function(instruction){errors_1.push("@"+instruction.triggerName+" has failed due to:\n"),instruction.errors.forEach(function(error){return errors_1.push("- "+error+"\n")})}),allPlayers.forEach(function(player){return player.destroy()}),this.reportError(errors_1)}for(var enterNodesWithoutAnimations=new Set,i=0;i<allEnterNodes.length;i++){var element=allEnterNodes[i];subTimelines.has(element)||enterNodesWithoutAnimations.add(element)}var allPreviousPlayersMap=new Map,sortedParentElements=[];queuedInstructions.forEach(function(entry){var element=entry.element;subTimelines.has(element)&&(sortedParentElements.unshift(element),_this._beforeAnimationBuild(entry.player.namespaceId,entry.instruction,allPreviousPlayersMap))}),skippedPlayers.forEach(function(player){var element=player.element,previousPlayers=_this._getPreviousPlayers(element,!1,player.namespaceId,player.triggerName,null);previousPlayers.forEach(function(prevPlayer){getOrSetAsInMap(allPreviousPlayersMap,element,[]).push(prevPlayer),prevPlayer.destroy()})});var replaceNodes=allLeaveNodes.filter(function(node){return replacePostStylesAsPre(node,allPreStyleElements,allPostStyleElements)}),_a=cloakAndComputeStyles(this.driver,leaveNodesWithoutAnimations,allPostStyleElements,_angular_animations.AUTO_STYLE),postStylesMap=_a[0],allLeaveQueriedNodes=_a[1];allLeaveQueriedNodes.forEach(function(node){replacePostStylesAsPre(node,allPreStyleElements,allPostStyleElements)&&replaceNodes.push(node)});var preStylesMap=(allPreStyleElements.size?cloakAndComputeStyles(this.driver,enterNodesWithoutAnimations,allPreStyleElements,_angular_animations.ɵPRE_STYLE):[new Map])[0];replaceNodes.forEach(function(node){var post=postStylesMap.get(node),pre=preStylesMap.get(node);postStylesMap.set(node,Object.assign({},post,pre))});var rootPlayers=[],subPlayers=[];queuedInstructions.forEach(function(entry){var element=entry.element,player=entry.player,instruction=entry.instruction;if(subTimelines.has(element)){if(disabledElementsSet.has(element))return void skippedPlayers.push(player);var innerPlayer=_this._buildAnimation(player.namespaceId,instruction,allPreviousPlayersMap,skippedPlayersMap,preStylesMap,postStylesMap);player.setRealPlayer(innerPlayer);for(var parentHasPriority=null,i=0;i<sortedParentElements.length;i++){var parent=sortedParentElements[i];if(parent===element)break;if(_this.driver.containsElement(parent,element)){parentHasPriority=parent;break}}if(parentHasPriority){var parentPlayers=_this.playersByElement.get(parentHasPriority);parentPlayers&&parentPlayers.length&&(player.parentPlayer=optimizeGroupPlayer(parentPlayers)),skippedPlayers.push(player)}else rootPlayers.push(player)}else eraseStyles(element,instruction.fromStyles),player.onDestroy(function(){return setStyles(element,instruction.toStyles)}),subPlayers.push(player),disabledElementsSet.has(element)&&skippedPlayers.push(player)}),subPlayers.forEach(function(player){var playersForElement=skippedPlayersMap.get(player.element);if(playersForElement&&playersForElement.length){var innerPlayer=optimizeGroupPlayer(playersForElement);player.setRealPlayer(innerPlayer)}}),skippedPlayers.forEach(function(player){player.parentPlayer?player.parentPlayer.onDestroy(function(){return player.destroy()}):player.destroy()});for(var i=0;i<allLeaveNodes.length;i++){var element=allLeaveNodes[i],details=element[REMOVAL_FLAG];if(removeClass(element,LEAVE_CLASSNAME),!details||!details.hasAnimation){var players=[];if(queriedElements.size){var queriedPlayerResults=queriedElements.get(element);queriedPlayerResults&&queriedPlayerResults.length&&players.push.apply(players,queriedPlayerResults);for(var queriedInnerElements=this.driver.query(element,NG_ANIMATING_SELECTOR,!0),j=0;j<queriedInnerElements.length;j++){var queriedPlayers=queriedElements.get(queriedInnerElements[j]);queriedPlayers&&queriedPlayers.length&&players.push.apply(players,queriedPlayers)}}var activePlayers=players.filter(function(p){return!p.destroyed});activePlayers.length?removeNodesAfterAnimationDone(this,element,activePlayers):this.processLeaveNode(element)}}return allLeaveNodes.length=0,rootPlayers.forEach(function(player){_this.players.push(player),player.onDone(function(){player.destroy();var index=_this.players.indexOf(player);_this.players.splice(index,1)}),player.play()}),rootPlayers},TransitionAnimationEngine.prototype.elementContainsData=function(namespaceId,element){var containsData=!1,details=element[REMOVAL_FLAG];return details&&details.setForRemoval&&(containsData=!0),this.playersByElement.has(element)&&(containsData=!0),this.playersByQueriedElement.has(element)&&(containsData=!0),this.statesByElement.has(element)&&(containsData=!0),this._fetchNamespace(namespaceId).elementContainsData(element)||containsData},TransitionAnimationEngine.prototype.afterFlush=function(callback){this._flushFns.push(callback)},TransitionAnimationEngine.prototype.afterFlushAnimationsDone=function(callback){this._whenQuietFns.push(callback)},TransitionAnimationEngine.prototype._getPreviousPlayers=function(element,isQueriedElement,namespaceId,triggerName,toStateValue){var players=[];if(isQueriedElement){var queriedElementPlayers=this.playersByQueriedElement.get(element);queriedElementPlayers&&(players=queriedElementPlayers)}else{var elementPlayers=this.playersByElement.get(element);if(elementPlayers){var isRemovalAnimation_1=!toStateValue||toStateValue==VOID_VALUE;elementPlayers.forEach(function(player){player.queued||(isRemovalAnimation_1||player.triggerName==triggerName)&&players.push(player)})}}return(namespaceId||triggerName)&&(players=players.filter(function(player){return(!namespaceId||namespaceId==player.namespaceId)&&(!triggerName||triggerName==player.triggerName)})),players},TransitionAnimationEngine.prototype._beforeAnimationBuild=function(namespaceId,instruction,allPreviousPlayersMap){var _this=this,triggerName=instruction.triggerName,rootElement=instruction.element,targetNameSpaceId=instruction.isRemovalTransition?void 0:namespaceId,targetTriggerName=instruction.isRemovalTransition?void 0:triggerName;instruction.timelines.map(function(timelineInstruction){var element=timelineInstruction.element,isQueriedElement=element!==rootElement,players=getOrSetAsInMap(allPreviousPlayersMap,element,[]),previousPlayers=_this._getPreviousPlayers(element,isQueriedElement,targetNameSpaceId,targetTriggerName,instruction.toState);previousPlayers.forEach(function(player){var realPlayer=player.getRealPlayer();realPlayer.beforeDestroy&&realPlayer.beforeDestroy(),player.destroy(),players.push(player)})}),eraseStyles(rootElement,instruction.fromStyles)},TransitionAnimationEngine.prototype._buildAnimation=function(namespaceId,instruction,allPreviousPlayersMap,skippedPlayersMap,preStylesMap,postStylesMap){var _this=this,triggerName=instruction.triggerName,rootElement=instruction.element,allQueriedPlayers=[],allConsumedElements=new Set,allSubElements=new Set,allNewPlayers=instruction.timelines.map(function(timelineInstruction){var element=timelineInstruction.element;allConsumedElements.add(element);var details=element[REMOVAL_FLAG];if(details&&details.removedBeforeQueried)return new _angular_animations.NoopAnimationPlayer;var isQueriedElement=element!==rootElement,previousPlayers=flattenGroupPlayers((allPreviousPlayersMap.get(element)||EMPTY_PLAYER_ARRAY).map(function(p){return p.getRealPlayer()})).filter(function(p){var pp=p;return!!pp.element&&pp.element===element}),preStyles=preStylesMap.get(element),postStyles=postStylesMap.get(element),keyframes=normalizeKeyframes(_this.driver,_this._normalizer,element,timelineInstruction.keyframes,preStyles,postStyles),player=_this._buildPlayer(timelineInstruction,keyframes,previousPlayers);if(timelineInstruction.subTimeline&&skippedPlayersMap&&allSubElements.add(element),isQueriedElement){var wrappedPlayer=new TransitionAnimationPlayer(namespaceId,triggerName,element);wrappedPlayer.setRealPlayer(player),allQueriedPlayers.push(wrappedPlayer)}return player});allQueriedPlayers.forEach(function(player){getOrSetAsInMap(_this.playersByQueriedElement,player.element,[]).push(player),player.onDone(function(){return deleteOrUnsetInMap(_this.playersByQueriedElement,player.element,player)})}),allConsumedElements.forEach(function(element){return addClass(element,NG_ANIMATING_CLASSNAME)});var player=optimizeGroupPlayer(allNewPlayers);return player.onDestroy(function(){allConsumedElements.forEach(function(element){return removeClass(element,NG_ANIMATING_CLASSNAME)}),setStyles(rootElement,instruction.toStyles)}),allSubElements.forEach(function(element){getOrSetAsInMap(skippedPlayersMap,element,[]).push(player)}),player},TransitionAnimationEngine.prototype._buildPlayer=function(instruction,keyframes,previousPlayers){return keyframes.length>0?this.driver.animate(instruction.element,keyframes,instruction.duration,instruction.delay,instruction.easing,previousPlayers):new _angular_animations.NoopAnimationPlayer},TransitionAnimationEngine}(),TransitionAnimationPlayer=function(){function TransitionAnimationPlayer(namespaceId,triggerName,element){this.namespaceId=namespaceId,this.triggerName=triggerName,this.element=element,this._player=new _angular_animations.NoopAnimationPlayer,this._containsRealPlayer=!1,this._queuedCallbacks={},this._destroyed=!1,this.markedForDestroy=!1}return Object.defineProperty(TransitionAnimationPlayer.prototype,"queued",{get:function(){return 0==this._containsRealPlayer},enumerable:!0,configurable:!0}),Object.defineProperty(TransitionAnimationPlayer.prototype,"destroyed",{get:function(){return this._destroyed},enumerable:!0,configurable:!0}),TransitionAnimationPlayer.prototype.setRealPlayer=function(player){var _this=this;this._containsRealPlayer||(this._player=player,Object.keys(this._queuedCallbacks).forEach(function(phase){_this._queuedCallbacks[phase].forEach(function(callback){return listenOnPlayer(player,phase,void 0,callback)})}),this._queuedCallbacks={},this._containsRealPlayer=!0)},TransitionAnimationPlayer.prototype.getRealPlayer=function(){return this._player},TransitionAnimationPlayer.prototype._queueEvent=function(name,callback){getOrSetAsInMap(this._queuedCallbacks,name,[]).push(callback)},TransitionAnimationPlayer.prototype.onDone=function(fn){this.queued&&this._queueEvent("done",fn),this._player.onDone(fn)},TransitionAnimationPlayer.prototype.onStart=function(fn){this.queued&&this._queueEvent("start",fn),this._player.onStart(fn)},TransitionAnimationPlayer.prototype.onDestroy=function(fn){this.queued&&this._queueEvent("destroy",fn),this._player.onDestroy(fn)},TransitionAnimationPlayer.prototype.init=function(){this._player.init()},TransitionAnimationPlayer.prototype.hasStarted=function(){return!this.queued&&this._player.hasStarted()},TransitionAnimationPlayer.prototype.play=function(){!this.queued&&this._player.play()},TransitionAnimationPlayer.prototype.pause=function(){!this.queued&&this._player.pause()},TransitionAnimationPlayer.prototype.restart=function(){!this.queued&&this._player.restart()},TransitionAnimationPlayer.prototype.finish=function(){this._player.finish()},TransitionAnimationPlayer.prototype.destroy=function(){this._destroyed=!0,this._player.destroy()},TransitionAnimationPlayer.prototype.reset=function(){!this.queued&&this._player.reset()},TransitionAnimationPlayer.prototype.setPosition=function(p){this.queued||this._player.setPosition(p)},TransitionAnimationPlayer.prototype.getPosition=function(){return this.queued?0:this._player.getPosition()},Object.defineProperty(TransitionAnimationPlayer.prototype,"totalTime",{get:function(){return this._player.totalTime},enumerable:!0,configurable:!0}),TransitionAnimationPlayer}(),CLASSES_CACHE_KEY="$$classes",AnimationEngine=function(){function AnimationEngine(driver,normalizer){var _this=this;this._triggerCache={},this.onRemovalComplete=function(element,context){},this._transitionEngine=new TransitionAnimationEngine(driver,normalizer),this._timelineEngine=new TimelineAnimationEngine(driver,normalizer),this._transitionEngine.onRemovalComplete=function(element,context){return _this.onRemovalComplete(element,context)}}return AnimationEngine.prototype.registerTrigger=function(componentId,namespaceId,hostElement,name,metadata){var cacheKey=componentId+"-"+name,trigger=this._triggerCache[cacheKey];if(!trigger){var errors=[],ast=buildAnimationAst(metadata,errors);if(errors.length)throw new Error('The animation trigger "'+name+'" has failed to build due to the following errors:\n - '+errors.join("\n - "));trigger=buildTrigger(name,ast),this._triggerCache[cacheKey]=trigger}this._transitionEngine.registerTrigger(namespaceId,name,trigger)},AnimationEngine.prototype.register=function(namespaceId,hostElement){this._transitionEngine.register(namespaceId,hostElement)},AnimationEngine.prototype.destroy=function(namespaceId,context){this._transitionEngine.destroy(namespaceId,context)},AnimationEngine.prototype.onInsert=function(namespaceId,element,parent,insertBefore){this._transitionEngine.insertNode(namespaceId,element,parent,insertBefore)},AnimationEngine.prototype.onRemove=function(namespaceId,element,context){this._transitionEngine.removeNode(namespaceId,element,context)},AnimationEngine.prototype.disableAnimations=function(element,disable){this._transitionEngine.markElementAsDisabled(element,disable)},AnimationEngine.prototype.process=function(namespaceId,element,property,value){if("@"==property.charAt(0)){var _a=parseTimelineCommand(property),id=_a[0],action=_a[1],args=value;this._timelineEngine.command(id,element,action,args)}else this._transitionEngine.trigger(namespaceId,element,property,value)},AnimationEngine.prototype.listen=function(namespaceId,element,eventName,eventPhase,callback){if("@"==eventName.charAt(0)){var _a=parseTimelineCommand(eventName),id=_a[0],action=_a[1];return this._timelineEngine.listen(id,element,action,callback)}return this._transitionEngine.listen(namespaceId,element,eventName,eventPhase,callback)},AnimationEngine.prototype.flush=function(microtaskId){void 0===microtaskId&&(microtaskId=-1),this._transitionEngine.flush(microtaskId)},Object.defineProperty(AnimationEngine.prototype,"players",{get:function(){return this._transitionEngine.players.concat(this._timelineEngine.players)},enumerable:!0,configurable:!0}),AnimationEngine.prototype.whenRenderingDone=function(){return this._transitionEngine.whenRenderingDone()},AnimationEngine}(),WebAnimationsPlayer=function(){function WebAnimationsPlayer(element,keyframes,options,previousPlayers){void 0===previousPlayers&&(previousPlayers=[]);var _this=this;this.element=element,this.keyframes=keyframes,this.options=options,this.previousPlayers=previousPlayers,this._onDoneFns=[],this._onStartFns=[],this._onDestroyFns=[],this._initialized=!1,this._finished=!1,this._started=!1,this._destroyed=!1,this.time=0,this.parentPlayer=null,this.previousStyles={},this.currentSnapshot={},this._duration=options.duration,this._delay=options.delay||0,this.time=this._duration+this._delay,allowPreviousPlayerStylesMerge(this._duration,this._delay)&&previousPlayers.forEach(function(player){var styles=player.currentSnapshot;Object.keys(styles).forEach(function(prop){return _this.previousStyles[prop]=styles[prop]})})}return WebAnimationsPlayer.prototype._onFinish=function(){this._finished||(this._finished=!0,this._onDoneFns.forEach(function(fn){return fn()}),this._onDoneFns=[])},WebAnimationsPlayer.prototype.init=function(){this._buildPlayer(),this._preparePlayerBeforeStart()},WebAnimationsPlayer.prototype._buildPlayer=function(){var _this=this;if(!this._initialized){this._initialized=!0;var keyframes=this.keyframes.map(function(styles){return copyStyles(styles,!1)}),previousStyleProps=Object.keys(this.previousStyles);if(previousStyleProps.length){var startingKeyframe_1=keyframes[0],missingStyleProps_1=[];if(previousStyleProps.forEach(function(prop){startingKeyframe_1.hasOwnProperty(prop)||missingStyleProps_1.push(prop),startingKeyframe_1[prop]=_this.previousStyles[prop]}),missingStyleProps_1.length)for(var self_1=this,_loop_1=function(){var kf=keyframes[i];missingStyleProps_1.forEach(function(prop){kf[prop]=_computeStyle(self_1.element,prop)})},i=1;i<keyframes.length;i++)_loop_1()}this._player=this._triggerWebAnimation(this.element,keyframes,this.options),this._finalKeyframe=keyframes.length?keyframes[keyframes.length-1]:{},this._player.addEventListener("finish",function(){return _this._onFinish()})}},WebAnimationsPlayer.prototype._preparePlayerBeforeStart=function(){this._delay?this._resetDomPlayerState():this._player.pause()},WebAnimationsPlayer.prototype._triggerWebAnimation=function(element,keyframes,options){return element.animate(keyframes,options)},Object.defineProperty(WebAnimationsPlayer.prototype,"domPlayer",{get:function(){return this._player},enumerable:!0,configurable:!0}),WebAnimationsPlayer.prototype.onStart=function(fn){this._onStartFns.push(fn)},WebAnimationsPlayer.prototype.onDone=function(fn){this._onDoneFns.push(fn)},WebAnimationsPlayer.prototype.onDestroy=function(fn){this._onDestroyFns.push(fn)},WebAnimationsPlayer.prototype.play=function(){this._buildPlayer(),this.hasStarted()||(this._onStartFns.forEach(function(fn){return fn()}),this._onStartFns=[],this._started=!0),this._player.play()},WebAnimationsPlayer.prototype.pause=function(){this.init(),this._player.pause()},WebAnimationsPlayer.prototype.finish=function(){this.init(),this._onFinish(),this._player.finish()},WebAnimationsPlayer.prototype.reset=function(){this._resetDomPlayerState(),this._destroyed=!1,this._finished=!1,this._started=!1},WebAnimationsPlayer.prototype._resetDomPlayerState=function(){this._player&&this._player.cancel()},WebAnimationsPlayer.prototype.restart=function(){this.reset(),this.play()},WebAnimationsPlayer.prototype.hasStarted=function(){return this._started},WebAnimationsPlayer.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,this._resetDomPlayerState(),this._onFinish(),this._onDestroyFns.forEach(function(fn){return fn()}),this._onDestroyFns=[])},WebAnimationsPlayer.prototype.setPosition=function(p){this._player.currentTime=p*this.time},WebAnimationsPlayer.prototype.getPosition=function(){return this._player.currentTime/this.time},Object.defineProperty(WebAnimationsPlayer.prototype,"totalTime",{get:function(){return this._delay+this._duration},enumerable:!0,configurable:!0}),WebAnimationsPlayer.prototype.beforeDestroy=function(){var _this=this,styles={};this.hasStarted()&&Object.keys(this._finalKeyframe).forEach(function(prop){"offset"!=prop&&(styles[prop]=_this._finished?_this._finalKeyframe[prop]:_computeStyle(_this.element,prop))}),this.currentSnapshot=styles},WebAnimationsPlayer}(),WebAnimationsDriver=function(){function WebAnimationsDriver(){}return WebAnimationsDriver.prototype.matchesElement=function(element,selector){return matchesElement(element,selector)},WebAnimationsDriver.prototype.containsElement=function(elm1,elm2){return containsElement(elm1,elm2)},WebAnimationsDriver.prototype.query=function(element,selector,multi){return invokeQuery(element,selector,multi)},WebAnimationsDriver.prototype.computeStyle=function(element,prop,defaultValue){return window.getComputedStyle(element)[prop]},WebAnimationsDriver.prototype.animate=function(element,keyframes,duration,delay,easing,previousPlayers){void 0===previousPlayers&&(previousPlayers=[]);var fill=0==delay?"both":"forwards",playerOptions={duration:duration,delay:delay,fill:fill};easing&&(playerOptions.easing=easing);var previousWebAnimationPlayers=previousPlayers.filter(function(player){return player instanceof WebAnimationsPlayer});return new WebAnimationsPlayer(element,keyframes,playerOptions,previousWebAnimationPlayers)},WebAnimationsDriver}();exports.AnimationDriver=AnimationDriver,exports.ɵAnimation=Animation,exports.ɵAnimationStyleNormalizer=AnimationStyleNormalizer,exports.ɵNoopAnimationStyleNormalizer=NoopAnimationStyleNormalizer,exports.ɵWebAnimationsStyleNormalizer=WebAnimationsStyleNormalizer,exports.ɵNoopAnimationDriver=NoopAnimationDriver,exports.ɵAnimationEngine=AnimationEngine,exports.ɵWebAnimationsDriver=WebAnimationsDriver,exports.ɵsupportsWebAnimations=supportsWebAnimations,exports.ɵWebAnimationsPlayer=WebAnimationsPlayer,Object.defineProperty(exports,"__esModule",{value:!0})});
56
56
  //# sourceMappingURL=animations-browser.umd.min.js.map