http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/90759b86/node_modules/@angular/animations/@angular/animations/browser.es5.js ---------------------------------------------------------------------- diff --git a/node_modules/@angular/animations/@angular/animations/browser.es5.js b/node_modules/@angular/animations/@angular/animations/browser.es5.js new file mode 100644 index 0000000..4148fd1 --- /dev/null +++ b/node_modules/@angular/animations/@angular/animations/browser.es5.js @@ -0,0 +1,4911 @@ +import * as tslib_1 from "tslib"; +/** + * @license Angular v4.4.6 + * (c) 2010-2017 Google, Inc. https://angular.io/ + * License: MIT + */ +import { AUTO_STYLE, NoopAnimationPlayer, sequence, style, ɵAnimationGroupPlayer, ɵPRE_STYLE } from '@angular/animations'; +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +function optimizeGroupPlayer(players) { + switch (players.length) { + case 0: + return new NoopAnimationPlayer(); + case 1: + return players[0]; + default: + return new ɵAnimationGroupPlayer(players); + } +} +function normalizeKeyframes(driver, normalizer, element, keyframes, preStyles, postStyles) { + if (preStyles === void 0) { preStyles = {}; } + if (postStyles === void 0) { postStyles = {}; } + var errors = []; + var normalizedKeyframes = []; + var previousOffset = -1; + var previousKeyframe = null; + keyframes.forEach(function (kf) { + var offset = kf['offset']; + var isSameOffset = offset == previousOffset; + var normalizedKeyframe = (isSameOffset && previousKeyframe) || {}; + Object.keys(kf).forEach(function (prop) { + var normalizedProp = prop; + var normalizedValue = kf[prop]; + if (prop !== 'offset') { + normalizedProp = normalizer.normalizePropertyName(normalizedProp, errors); + switch (normalizedValue) { + case ɵPRE_STYLE: + normalizedValue = preStyles[prop]; + break; + case AUTO_STYLE: + normalizedValue = postStyles[prop]; + break; + default: + normalizedValue = + normalizer.normalizeStyleValue(prop, normalizedProp, normalizedValue, errors); + break; + } + } + normalizedKeyframe[normalizedProp] = normalizedValue; + }); + if (!isSameOffset) { + normalizedKeyframes.push(normalizedKeyframe); + } + previousKeyframe = normalizedKeyframe; + previousOffset = offset; + }); + if (errors.length) { + var LINE_START = '\n - '; + throw new Error("Unable to animate due to the following errors:" + LINE_START + errors.join(LINE_START)); + } + return normalizedKeyframes; +} +function listenOnPlayer(player, eventName, event, callback) { + switch (eventName) { + case 'start': + player.onStart(function () { return callback(event && copyAnimationEvent(event, 'start', player.totalTime)); }); + break; + case 'done': + player.onDone(function () { return callback(event && copyAnimationEvent(event, 'done', player.totalTime)); }); + break; + case 'destroy': + player.onDestroy(function () { return callback(event && copyAnimationEvent(event, 'destroy', player.totalTime)); }); + break; + } +} +function copyAnimationEvent(e, phaseName, totalTime) { + var event = makeAnimationEvent(e.element, e.triggerName, e.fromState, e.toState, phaseName || e.phaseName, totalTime == undefined ? e.totalTime : totalTime); + var data = e['_data']; + if (data != null) { + event['_data'] = data; + } + return event; +} +function makeAnimationEvent(element, triggerName, fromState, toState, phaseName, totalTime) { + if (phaseName === void 0) { phaseName = ''; } + if (totalTime === void 0) { totalTime = 0; } + return { element: element, triggerName: triggerName, fromState: fromState, toState: toState, phaseName: phaseName, totalTime: totalTime }; +} +function getOrSetAsInMap(map, key, defaultValue) { + var value; + if (map instanceof Map) { + value = map.get(key); + if (!value) { + map.set(key, value = defaultValue); + } + } + else { + value = map[key]; + if (!value) { + value = map[key] = defaultValue; + } + } + return value; +} +function parseTimelineCommand(command) { + var separatorPos = command.indexOf(':'); + var id = command.substring(1, separatorPos); + var action = command.substr(separatorPos + 1); + return [id, action]; +} +var _contains = function (elm1, elm2) { return false; }; +var _matches = function (element, selector) { return false; }; +var _query = function (element, selector, multi) { + return []; +}; +if (typeof Element != 'undefined') { + // this is well supported in all browsers + _contains = function (elm1, elm2) { return elm1.contains(elm2); }; + if (Element.prototype.matches) { + _matches = function (element, selector) { return element.matches(selector); }; + } + else { + var proto = Element.prototype; + var fn_1 = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || + proto.oMatchesSelector || proto.webkitMatchesSelector; + if (fn_1) { + _matches = function (element, selector) { return fn_1.apply(element, [selector]); }; + } + } + _query = function (element, selector, multi) { + var results = []; + if (multi) { + results.push.apply(results, element.querySelectorAll(selector)); + } + else { + var elm = element.querySelector(selector); + if (elm) { + results.push(elm); + } + } + return results; + }; +} +var matchesElement = _matches; +var containsElement = _contains; +var invokeQuery = _query; +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +/** + * @experimental + */ +var NoopAnimationDriver = (function () { + function NoopAnimationDriver() { + } + NoopAnimationDriver.prototype.matchesElement = function (element, selector) { + return matchesElement(element, selector); + }; + NoopAnimationDriver.prototype.containsElement = function (elm1, elm2) { return containsElement(elm1, elm2); }; + NoopAnimationDriver.prototype.query = function (element, selector, multi) { + return invokeQuery(element, selector, multi); + }; + NoopAnimationDriver.prototype.computeStyle = function (element, prop, defaultValue) { + return defaultValue || ''; + }; + NoopAnimationDriver.prototype.animate = function (element, keyframes, duration, delay, easing, previousPlayers) { + if (previousPlayers === void 0) { previousPlayers = []; } + return new NoopAnimationPlayer(); + }; + return NoopAnimationDriver; +}()); +/** + * @experimental + */ +var AnimationDriver = (function () { + function AnimationDriver() { + } + return AnimationDriver; +}()); +AnimationDriver.NOOP = new NoopAnimationDriver(); +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +var ONE_SECOND = 1000; +var SUBSTITUTION_EXPR_START = '{{'; +var SUBSTITUTION_EXPR_END = '}}'; +var ENTER_CLASSNAME = 'ng-enter'; +var LEAVE_CLASSNAME = 'ng-leave'; +var ENTER_SELECTOR = '.ng-enter'; +var LEAVE_SELECTOR = '.ng-leave'; +var NG_TRIGGER_CLASSNAME = 'ng-trigger'; +var NG_TRIGGER_SELECTOR = '.ng-trigger'; +var NG_ANIMATING_CLASSNAME = 'ng-animating'; +var NG_ANIMATING_SELECTOR = '.ng-animating'; +function resolveTimingValue(value) { + if (typeof value == 'number') + return value; + var matches = value.match(/^(-?[\.\d]+)(m?s)/); + if (!matches || matches.length < 2) + return 0; + return _convertTimeValueToMS(parseFloat(matches[1]), matches[2]); +} +function _convertTimeValueToMS(value, unit) { + switch (unit) { + case 's': + return value * ONE_SECOND; + default: + return value; + } +} +function resolveTiming(timings, errors, allowNegativeValues) { + return timings.hasOwnProperty('duration') ? + timings : + parseTimeExpression(timings, errors, allowNegativeValues); +} +function parseTimeExpression(exp, errors, allowNegativeValues) { + var regex = /^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i; + var duration; + var delay = 0; + var easing = ''; + if (typeof exp === 'string') { + var matches = exp.match(regex); + if (matches === null) { + errors.push("The provided timing value \"" + exp + "\" is invalid."); + return { duration: 0, delay: 0, easing: '' }; + } + duration = _convertTimeValueToMS(parseFloat(matches[1]), matches[2]); + var delayMatch = matches[3]; + if (delayMatch != null) { + delay = _convertTimeValueToMS(Math.floor(parseFloat(delayMatch)), matches[4]); + } + var easingVal = matches[5]; + if (easingVal) { + easing = easingVal; + } + } + else { + duration = exp; + } + if (!allowNegativeValues) { + var containsErrors = false; + var startIndex = errors.length; + if (duration < 0) { + errors.push("Duration values below 0 are not allowed for this animation step."); + containsErrors = true; + } + if (delay < 0) { + errors.push("Delay values below 0 are not allowed for this animation step."); + containsErrors = true; + } + if (containsErrors) { + errors.splice(startIndex, 0, "The provided timing value \"" + exp + "\" is invalid."); + } + } + return { duration: duration, delay: delay, easing: easing }; +} +function copyObj(obj, destination) { + if (destination === void 0) { destination = {}; } + Object.keys(obj).forEach(function (prop) { destination[prop] = obj[prop]; }); + return destination; +} +function normalizeStyles(styles) { + var normalizedStyles = {}; + if (Array.isArray(styles)) { + styles.forEach(function (data) { return copyStyles(data, false, normalizedStyles); }); + } + else { + copyStyles(styles, false, normalizedStyles); + } + return normalizedStyles; +} +function copyStyles(styles, readPrototype, destination) { + if (destination === void 0) { destination = {}; } + if (readPrototype) { + // we make use of a for-in loop so that the + // prototypically inherited properties are + // revealed from the backFill map + for (var prop in styles) { + destination[prop] = styles[prop]; + } + } + else { + copyObj(styles, destination); + } + return destination; +} +function setStyles(element, styles) { + if (element['style']) { + Object.keys(styles).forEach(function (prop) { + var camelProp = dashCaseToCamelCase(prop); + element.style[camelProp] = styles[prop]; + }); + } +} +function eraseStyles(element, styles) { + if (element['style']) { + Object.keys(styles).forEach(function (prop) { + var camelProp = dashCaseToCamelCase(prop); + element.style[camelProp] = ''; + }); + } +} +function normalizeAnimationEntry(steps) { + if (Array.isArray(steps)) { + if (steps.length == 1) + return steps[0]; + return sequence(steps); + } + return steps; +} +function validateStyleParams(value, options, errors) { + var params = options.params || {}; + var matches = extractStyleParams(value); + if (matches.length) { + matches.forEach(function (varName) { + if (!params.hasOwnProperty(varName)) { + errors.push("Unable to resolve the local animation param " + varName + " in the given list of values"); + } + }); + } +} +var PARAM_REGEX = new RegExp(SUBSTITUTION_EXPR_START + "\\s*(.+?)\\s*" + SUBSTITUTION_EXPR_END, 'g'); +function extractStyleParams(value) { + var params = []; + if (typeof value === 'string') { + var val = value.toString(); + var match = void 0; + while (match = PARAM_REGEX.exec(val)) { + params.push(match[1]); + } + PARAM_REGEX.lastIndex = 0; + } + return params; +} +function interpolateParams(value, params, errors) { + var original = value.toString(); + var str = original.replace(PARAM_REGEX, function (_, varName) { + var localVal = params[varName]; + // this means that the value was never overidden by the data passed in by the user + if (!params.hasOwnProperty(varName)) { + errors.push("Please provide a value for the animation param " + varName); + localVal = ''; + } + return localVal.toString(); + }); + // we do this to assert that numeric values stay as they are + return str == original ? value : str; +} +function iteratorToArray(iterator) { + var arr = []; + var item = iterator.next(); + while (!item.done) { + arr.push(item.value); + item = iterator.next(); + } + return arr; +} +var DASH_CASE_REGEXP = /-+([a-z0-9])/g; +function dashCaseToCamelCase(input) { + return input.replace(DASH_CASE_REGEXP, function () { + var m = []; + for (var _i = 0; _i < arguments.length; _i++) { + m[_i] = arguments[_i]; + } + return m[1].toUpperCase(); + }); +} +function allowPreviousPlayerStylesMerge(duration, delay) { + return duration === 0 || delay === 0; +} +function visitDslNode(visitor, node, context) { + switch (node.type) { + case 7 /* Trigger */: + return visitor.visitTrigger(node, context); + case 0 /* State */: + return visitor.visitState(node, context); + case 1 /* Transition */: + return visitor.visitTransition(node, context); + case 2 /* Sequence */: + return visitor.visitSequence(node, context); + case 3 /* Group */: + return visitor.visitGroup(node, context); + case 4 /* Animate */: + return visitor.visitAnimate(node, context); + case 5 /* Keyframes */: + return visitor.visitKeyframes(node, context); + case 6 /* Style */: + return visitor.visitStyle(node, context); + case 8 /* Reference */: + return visitor.visitReference(node, context); + case 9 /* AnimateChild */: + return visitor.visitAnimateChild(node, context); + case 10 /* AnimateRef */: + return visitor.visitAnimateRef(node, context); + case 11 /* Query */: + return visitor.visitQuery(node, context); + case 12 /* Stagger */: + return visitor.visitStagger(node, context); + default: + throw new Error("Unable to resolve animation metadata node #" + node.type); + } +} +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +var ANY_STATE = '*'; +/** + * @param {?} transitionValue + * @param {?} errors + * @return {?} + */ +function parseTransitionExpr(transitionValue, errors) { + var /** @type {?} */ expressions = []; + if (typeof transitionValue == 'string') { + ((transitionValue)) + .split(/\s*,\s*/) + .forEach(function (str) { return parseInnerTransitionStr(str, expressions, errors); }); + } + else { + expressions.push(/** @type {?} */ (transitionValue)); + } + return expressions; +} +/** + * @param {?} eventStr + * @param {?} expressions + * @param {?} errors + * @return {?} + */ +function parseInnerTransitionStr(eventStr, expressions, errors) { + if (eventStr[0] == ':') { + eventStr = parseAnimationAlias(eventStr, errors); + } + var /** @type {?} */ match = eventStr.match(/^(\*|[-\w]+)\s*(<?[=-]>)\s*(\*|[-\w]+)$/); + if (match == null || match.length < 4) { + errors.push("The provided transition expression \"" + eventStr + "\" is not supported"); + return expressions; + } + var /** @type {?} */ fromState = match[1]; + var /** @type {?} */ separator = match[2]; + var /** @type {?} */ toState = match[3]; + expressions.push(makeLambdaFromStates(fromState, toState)); + var /** @type {?} */ isFullAnyStateExpr = fromState == ANY_STATE && toState == ANY_STATE; + if (separator[0] == '<' && !isFullAnyStateExpr) { + expressions.push(makeLambdaFromStates(toState, fromState)); + } +} +/** + * @param {?} alias + * @param {?} errors + * @return {?} + */ +function parseAnimationAlias(alias, errors) { + switch (alias) { + case ':enter': + return 'void => *'; + case ':leave': + return '* => void'; + default: + errors.push("The transition alias value \"" + alias + "\" is not supported"); + return '* => *'; + } +} +var TRUE_BOOLEAN_VALUES = new Set(); +TRUE_BOOLEAN_VALUES.add('true'); +TRUE_BOOLEAN_VALUES.add('1'); +var FALSE_BOOLEAN_VALUES = new Set(); +FALSE_BOOLEAN_VALUES.add('false'); +FALSE_BOOLEAN_VALUES.add('0'); +/** + * @param {?} lhs + * @param {?} rhs + * @return {?} + */ +function makeLambdaFromStates(lhs, rhs) { + var /** @type {?} */ LHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(lhs) || FALSE_BOOLEAN_VALUES.has(lhs); + var /** @type {?} */ RHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(rhs) || FALSE_BOOLEAN_VALUES.has(rhs); + return function (fromState, toState) { + var /** @type {?} */ lhsMatch = lhs == ANY_STATE || lhs == fromState; + var /** @type {?} */ rhsMatch = rhs == ANY_STATE || rhs == toState; + if (!lhsMatch && LHS_MATCH_BOOLEAN && typeof fromState === 'boolean') { + lhsMatch = fromState ? TRUE_BOOLEAN_VALUES.has(lhs) : FALSE_BOOLEAN_VALUES.has(lhs); + } + if (!rhsMatch && RHS_MATCH_BOOLEAN && typeof toState === 'boolean') { + rhsMatch = toState ? TRUE_BOOLEAN_VALUES.has(rhs) : FALSE_BOOLEAN_VALUES.has(rhs); + } + return lhsMatch && rhsMatch; + }; +} +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +var SELF_TOKEN = ':self'; +var SELF_TOKEN_REGEX = new RegExp("s*" + SELF_TOKEN + "s*,?", 'g'); +/** + * @param {?} metadata + * @param {?} errors + * @return {?} + */ +function buildAnimationAst(metadata, errors) { + return new AnimationAstBuilderVisitor().build(metadata, errors); +} +var LEAVE_TOKEN = ':leave'; +var LEAVE_TOKEN_REGEX = new RegExp(LEAVE_TOKEN, 'g'); +var ENTER_TOKEN = ':enter'; +var ENTER_TOKEN_REGEX = new RegExp(ENTER_TOKEN, 'g'); +var ROOT_SELECTOR = ''; +var AnimationAstBuilderVisitor = (function () { + function AnimationAstBuilderVisitor() { + } + /** + * @param {?} metadata + * @param {?} errors + * @return {?} + */ + AnimationAstBuilderVisitor.prototype.build = function (metadata, errors) { + var /** @type {?} */ context = new AnimationAstBuilderContext(errors); + this._resetContextStyleTimingState(context); + return (visitDslNode(this, normalizeAnimationEntry(metadata), context)); + }; + /** + * @param {?} context + * @return {?} + */ + AnimationAstBuilderVisitor.prototype._resetContextStyleTimingState = function (context) { + context.currentQuerySelector = ROOT_SELECTOR; + context.collectedStyles = {}; + context.collectedStyles[ROOT_SELECTOR] = {}; + context.currentTime = 0; + }; + /** + * @param {?} metadata + * @param {?} context + * @return {?} + */ + AnimationAstBuilderVisitor.prototype.visitTrigger = function (metadata, context) { + var _this = this; + var /** @type {?} */ queryCount = context.queryCount = 0; + var /** @type {?} */ depCount = context.depCount = 0; + var /** @type {?} */ states = []; + var /** @type {?} */ transitions = []; + metadata.definitions.forEach(function (def) { + _this._resetContextStyleTimingState(context); + if (def.type == 0 /* State */) { + var /** @type {?} */ stateDef_1 = (def); + var /** @type {?} */ 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 (def.type == 1 /* Transition */) { + var /** @type {?} */ transition = _this.visitTransition(/** @type {?} */ (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()'); + } + }); + return { + type: 7 /* Trigger */, + name: metadata.name, states: states, transitions: transitions, queryCount: queryCount, depCount: depCount, + options: null + }; + }; + /** + * @param {?} metadata + * @param {?} context + * @return {?} + */ + AnimationAstBuilderVisitor.prototype.visitState = function (metadata, context) { + var /** @type {?} */ styleAst = this.visitStyle(metadata.styles, context); + var /** @type {?} */ astParams = (metadata.options && metadata.options.params) || null; + if (styleAst.containsDynamicStyles) { + var /** @type {?} */ missingSubs_1 = new Set(); + var /** @type {?} */ params_1 = astParams || {}; + styleAst.styles.forEach(function (value) { + if (isObject(value)) { + var /** @type {?} */ stylesObj_1 = (value); + Object.keys(stylesObj_1).forEach(function (prop) { + extractStyleParams(stylesObj_1[prop]).forEach(function (sub) { + if (!params_1.hasOwnProperty(sub)) { + missingSubs_1.add(sub); + } + }); + }); + } + }); + if (missingSubs_1.size) { + var /** @type {?} */ missingSubsArr = iteratorToArray(missingSubs_1.values()); + context.errors.push("state(\"" + metadata.name + "\", ...) must define default values for all the following style substitutions: " + missingSubsArr.join(', ')); + } + } + return { + type: 0 /* State */, + name: metadata.name, + style: styleAst, + options: astParams ? { params: astParams } : null + }; + }; + /** + * @param {?} metadata + * @param {?} context + * @return {?} + */ + AnimationAstBuilderVisitor.prototype.visitTransition = function (metadata, context) { + context.queryCount = 0; + context.depCount = 0; + var /** @type {?} */ animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context); + var /** @type {?} */ matchers = parseTransitionExpr(metadata.expr, context.errors); + return { + type: 1 /* Transition */, + matchers: matchers, + animation: animation, + queryCount: context.queryCount, + depCount: context.depCount, + options: normalizeAnimationOptions(metadata.options) + }; + }; + /** + * @param {?} metadata + * @param {?} context + * @return {?} + */ + AnimationAstBuilderVisitor.prototype.visitSequence = function (metadata, context) { + var _this = this; + return { + type: 2 /* Sequence */, + steps: metadata.steps.map(function (s) { return visitDslNode(_this, s, context); }), + options: normalizeAnimationOptions(metadata.options) + }; + }; + /** + * @param {?} metadata + * @param {?} context + * @return {?} + */ + AnimationAstBuilderVisitor.prototype.visitGroup = function (metadata, context) { + var _this = this; + var /** @type {?} */ currentTime = context.currentTime; + var /** @type {?} */ furthestTime = 0; + var /** @type {?} */ steps = metadata.steps.map(function (step) { + context.currentTime = currentTime; + var /** @type {?} */ innerAst = visitDslNode(_this, step, context); + furthestTime = Math.max(furthestTime, context.currentTime); + return innerAst; + }); + context.currentTime = furthestTime; + return { + type: 3 /* Group */, + steps: steps, + options: normalizeAnimationOptions(metadata.options) + }; + }; + /** + * @param {?} metadata + * @param {?} context + * @return {?} + */ + AnimationAstBuilderVisitor.prototype.visitAnimate = function (metadata, context) { + var /** @type {?} */ timingAst = constructTimingAst(metadata.timings, context.errors); + context.currentAnimateTimings = timingAst; + var /** @type {?} */ styleAst; + var /** @type {?} */ styleMetadata = metadata.styles ? metadata.styles : style({}); + if (styleMetadata.type == 5 /* Keyframes */) { + styleAst = this.visitKeyframes(/** @type {?} */ (styleMetadata), context); + } + else { + var /** @type {?} */ styleMetadata_1 = (metadata.styles); + var /** @type {?} */ isEmpty = false; + if (!styleMetadata_1) { + isEmpty = true; + var /** @type {?} */ newStyleData = {}; + if (timingAst.easing) { + newStyleData['easing'] = timingAst.easing; + } + styleMetadata_1 = style(newStyleData); + } + context.currentTime += timingAst.duration + timingAst.delay; + var /** @type {?} */ _styleAst = this.visitStyle(styleMetadata_1, context); + _styleAst.isEmptyStep = isEmpty; + styleAst = _styleAst; + } + context.currentAnimateTimings = null; + return { + type: 4 /* Animate */, + timings: timingAst, + style: styleAst, + options: null + }; + }; + /** + * @param {?} metadata + * @param {?} context + * @return {?} + */ + AnimationAstBuilderVisitor.prototype.visitStyle = function (metadata, context) { + var /** @type {?} */ ast = this._makeStyleAst(metadata, context); + this._validateStyleAst(ast, context); + return ast; + }; + /** + * @param {?} metadata + * @param {?} context + * @return {?} + */ + AnimationAstBuilderVisitor.prototype._makeStyleAst = function (metadata, context) { + var /** @type {?} */ styles = []; + if (Array.isArray(metadata.styles)) { + ((metadata.styles)).forEach(function (styleTuple) { + if (typeof styleTuple == 'string') { + if (styleTuple == AUTO_STYLE) { + styles.push(/** @type {?} */ (styleTuple)); + } + else { + context.errors.push("The provided style string value " + styleTuple + " is not allowed."); + } + } + else { + styles.push(/** @type {?} */ (styleTuple)); + } + }); + } + else { + styles.push(metadata.styles); + } + var /** @type {?} */ containsDynamicStyles = false; + var /** @type {?} */ collectedEasing = null; + styles.forEach(function (styleData) { + if (isObject(styleData)) { + var /** @type {?} */ styleMap = (styleData); + var /** @type {?} */ easing = styleMap['easing']; + if (easing) { + collectedEasing = (easing); + delete styleMap['easing']; + } + if (!containsDynamicStyles) { + for (var /** @type {?} */ prop in styleMap) { + var /** @type {?} */ value = styleMap[prop]; + if (value.toString().indexOf(SUBSTITUTION_EXPR_START) >= 0) { + containsDynamicStyles = true; + break; + } + } + } + } + }); + return { + type: 6 /* Style */, + styles: styles, + easing: collectedEasing, + offset: metadata.offset, containsDynamicStyles: containsDynamicStyles, + options: null + }; + }; + /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + AnimationAstBuilderVisitor.prototype._validateStyleAst = function (ast, context) { + var /** @type {?} */ timings = context.currentAnimateTimings; + var /** @type {?} */ endTime = context.currentTime; + var /** @type {?} */ startTime = context.currentTime; + if (timings && startTime > 0) { + startTime -= timings.duration + timings.delay; + } + ast.styles.forEach(function (tuple) { + if (typeof tuple == 'string') + return; + Object.keys(tuple).forEach(function (prop) { + var /** @type {?} */ collectedStyles = context.collectedStyles[((context.currentQuerySelector))]; + var /** @type {?} */ collectedEntry = collectedStyles[prop]; + var /** @type {?} */ updateCollectedStyle = true; + if (collectedEntry) { + if (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 = false; + } + // we always choose the smaller start time value since we + // want to have a record of the entire animation window where + // the style property is being animated in between + startTime = collectedEntry.startTime; + } + if (updateCollectedStyle) { + collectedStyles[prop] = { startTime: startTime, endTime: endTime }; + } + if (context.options) { + validateStyleParams(tuple[prop], context.options, context.errors); + } + }); + }); + }; + /** + * @param {?} metadata + * @param {?} context + * @return {?} + */ + AnimationAstBuilderVisitor.prototype.visitKeyframes = function (metadata, context) { + var _this = this; + var /** @type {?} */ ast = { type: 5 /* Keyframes */, styles: [], options: null }; + if (!context.currentAnimateTimings) { + context.errors.push("keyframes() must be placed inside of a call to animate()"); + return ast; + } + var /** @type {?} */ MAX_KEYFRAME_OFFSET = 1; + var /** @type {?} */ totalKeyframesWithOffsets = 0; + var /** @type {?} */ offsets = []; + var /** @type {?} */ offsetsOutOfOrder = false; + var /** @type {?} */ keyframesOutOfRange = false; + var /** @type {?} */ previousOffset = 0; + var /** @type {?} */ keyframes = metadata.steps.map(function (styles) { + var /** @type {?} */ style$$1 = _this._makeStyleAst(styles, context); + var /** @type {?} */ offsetVal = style$$1.offset != null ? style$$1.offset : consumeOffset(style$$1.styles); + var /** @type {?} */ offset = 0; + if (offsetVal != null) { + totalKeyframesWithOffsets++; + offset = style$$1.offset = offsetVal; + } + keyframesOutOfRange = keyframesOutOfRange || offset < 0 || offset > 1; + offsetsOutOfOrder = offsetsOutOfOrder || offset < previousOffset; + previousOffset = offset; + offsets.push(offset); + return style$$1; + }); + if (keyframesOutOfRange) { + context.errors.push("Please ensure that all keyframe offsets are between 0 and 1"); + } + if (offsetsOutOfOrder) { + context.errors.push("Please ensure that all keyframe offsets are in order"); + } + var /** @type {?} */ length = metadata.steps.length; + var /** @type {?} */ generatedOffset = 0; + if (totalKeyframesWithOffsets > 0 && totalKeyframesWithOffsets < length) { + context.errors.push("Not all style() steps within the declared keyframes() contain offsets"); + } + else if (totalKeyframesWithOffsets == 0) { + generatedOffset = MAX_KEYFRAME_OFFSET / (length - 1); + } + var /** @type {?} */ limit = length - 1; + var /** @type {?} */ currentTime = context.currentTime; + var /** @type {?} */ currentAnimateTimings = ((context.currentAnimateTimings)); + var /** @type {?} */ animateDuration = currentAnimateTimings.duration; + keyframes.forEach(function (kf, i) { + var /** @type {?} */ offset = generatedOffset > 0 ? (i == limit ? 1 : (generatedOffset * i)) : offsets[i]; + var /** @type {?} */ durationUpToThisFrame = offset * animateDuration; + context.currentTime = currentTime + currentAnimateTimings.delay + durationUpToThisFrame; + currentAnimateTimings.duration = durationUpToThisFrame; + _this._validateStyleAst(kf, context); + kf.offset = offset; + ast.styles.push(kf); + }); + return ast; + }; + /** + * @param {?} metadata + * @param {?} context + * @return {?} + */ + AnimationAstBuilderVisitor.prototype.visitReference = function (metadata, context) { + return { + type: 8 /* Reference */, + animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), + options: normalizeAnimationOptions(metadata.options) + }; + }; + /** + * @param {?} metadata + * @param {?} context + * @return {?} + */ + AnimationAstBuilderVisitor.prototype.visitAnimateChild = function (metadata, context) { + context.depCount++; + return { + type: 9 /* AnimateChild */, + options: normalizeAnimationOptions(metadata.options) + }; + }; + /** + * @param {?} metadata + * @param {?} context + * @return {?} + */ + AnimationAstBuilderVisitor.prototype.visitAnimateRef = function (metadata, context) { + return { + type: 10 /* AnimateRef */, + animation: this.visitReference(metadata.animation, context), + options: normalizeAnimationOptions(metadata.options) + }; + }; + /** + * @param {?} metadata + * @param {?} context + * @return {?} + */ + AnimationAstBuilderVisitor.prototype.visitQuery = function (metadata, context) { + var /** @type {?} */ parentSelector = ((context.currentQuerySelector)); + var /** @type {?} */ 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 /** @type {?} */ animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context); + context.currentQuery = null; + context.currentQuerySelector = parentSelector; + return { + type: 11 /* Query */, + selector: selector, + limit: options.limit || 0, + optional: !!options.optional, includeSelf: includeSelf, animation: animation, + originalSelector: metadata.selector, + options: normalizeAnimationOptions(metadata.options) + }; + }; + /** + * @param {?} metadata + * @param {?} context + * @return {?} + */ + AnimationAstBuilderVisitor.prototype.visitStagger = function (metadata, context) { + if (!context.currentQuery) { + context.errors.push("stagger() can only be used inside of query()"); + } + var /** @type {?} */ timings = metadata.timings === 'full' ? + { duration: 0, delay: 0, easing: 'full' } : + resolveTiming(metadata.timings, context.errors, true); + return { + type: 12 /* Stagger */, + animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), timings: timings, + options: null + }; + }; + return AnimationAstBuilderVisitor; +}()); +/** + * @param {?} selector + * @return {?} + */ +function normalizeSelector(selector) { + var /** @type {?} */ hasAmpersand = selector.split(/\s*,\s*/).find(function (token) { return token == SELF_TOKEN; }) ? true : false; + if (hasAmpersand) { + selector = selector.replace(SELF_TOKEN_REGEX, ''); + } + selector = selector.replace(ENTER_TOKEN_REGEX, ENTER_SELECTOR) + .replace(LEAVE_TOKEN_REGEX, LEAVE_SELECTOR) + .replace(/@\*/g, NG_TRIGGER_SELECTOR) + .replace(/@\w+/g, function (match) { return NG_TRIGGER_SELECTOR + '-' + match.substr(1); }) + .replace(/:animating/g, NG_ANIMATING_SELECTOR); + return [selector, hasAmpersand]; +} +/** + * @param {?} obj + * @return {?} + */ +function normalizeParams(obj) { + return obj ? copyObj(obj) : null; +} +var AnimationAstBuilderContext = (function () { + /** + * @param {?} errors + */ + 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; +}()); +/** + * @param {?} styles + * @return {?} + */ +function consumeOffset(styles) { + if (typeof styles == 'string') + return null; + var /** @type {?} */ offset = null; + if (Array.isArray(styles)) { + styles.forEach(function (styleTuple) { + if (isObject(styleTuple) && styleTuple.hasOwnProperty('offset')) { + var /** @type {?} */ obj = (styleTuple); + offset = parseFloat(/** @type {?} */ (obj['offset'])); + delete obj['offset']; + } + }); + } + else if (isObject(styles) && styles.hasOwnProperty('offset')) { + var /** @type {?} */ obj = (styles); + offset = parseFloat(/** @type {?} */ (obj['offset'])); + delete obj['offset']; + } + return offset; +} +/** + * @param {?} value + * @return {?} + */ +function isObject(value) { + return !Array.isArray(value) && typeof value == 'object'; +} +/** + * @param {?} value + * @param {?} errors + * @return {?} + */ +function constructTimingAst(value, errors) { + var /** @type {?} */ timings = null; + if (value.hasOwnProperty('duration')) { + timings = (value); + } + else if (typeof value == 'number') { + var /** @type {?} */ duration = resolveTiming(/** @type {?} */ (value), errors).duration; + return makeTimingAst(/** @type {?} */ (duration), 0, ''); + } + var /** @type {?} */ strValue = (value); + var /** @type {?} */ isDynamic = strValue.split(/\s+/).some(function (v) { return v.charAt(0) == '{' && v.charAt(1) == '{'; }); + if (isDynamic) { + var /** @type {?} */ ast = (makeTimingAst(0, 0, '')); + ast.dynamic = true; + ast.strValue = strValue; + return (ast); + } + timings = timings || resolveTiming(strValue, errors); + return makeTimingAst(timings.duration, timings.delay, timings.easing); +} +/** + * @param {?} options + * @return {?} + */ +function normalizeAnimationOptions(options) { + if (options) { + options = copyObj(options); + if (options['params']) { + options['params'] = ((normalizeParams(options['params']))); + } + } + else { + options = {}; + } + return options; +} +/** + * @param {?} duration + * @param {?} delay + * @param {?} easing + * @return {?} + */ +function makeTimingAst(duration, delay, easing) { + return { duration: duration, delay: delay, easing: easing }; +} +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +/** + * @param {?} element + * @param {?} keyframes + * @param {?} preStyleProps + * @param {?} postStyleProps + * @param {?} duration + * @param {?} delay + * @param {?=} easing + * @param {?=} subTimeline + * @return {?} + */ +function createTimelineInstruction(element, keyframes, preStyleProps, postStyleProps, duration, delay, easing, subTimeline) { + if (easing === void 0) { easing = null; } + if (subTimeline === void 0) { subTimeline = false; } + return { + type: 1 /* TimelineAnimation */, + element: element, + keyframes: keyframes, + preStyleProps: preStyleProps, + postStyleProps: postStyleProps, + duration: duration, + delay: delay, + totalTime: duration + delay, easing: easing, subTimeline: subTimeline + }; +} +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +var ElementInstructionMap = (function () { + function ElementInstructionMap() { + this._map = new Map(); + } + /** + * @param {?} element + * @return {?} + */ + ElementInstructionMap.prototype.consume = function (element) { + var /** @type {?} */ instructions = this._map.get(element); + if (instructions) { + this._map.delete(element); + } + else { + instructions = []; + } + return instructions; + }; + /** + * @param {?} element + * @param {?} instructions + * @return {?} + */ + ElementInstructionMap.prototype.append = function (element, instructions) { + var /** @type {?} */ existingInstructions = this._map.get(element); + if (!existingInstructions) { + this._map.set(element, existingInstructions = []); + } + existingInstructions.push.apply(existingInstructions, instructions); + }; + /** + * @param {?} element + * @return {?} + */ + ElementInstructionMap.prototype.has = function (element) { return this._map.has(element); }; + /** + * @return {?} + */ + ElementInstructionMap.prototype.clear = function () { this._map.clear(); }; + return ElementInstructionMap; +}()); +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +var ONE_FRAME_IN_MILLISECONDS = 1; +/** + * @param {?} driver + * @param {?} rootElement + * @param {?} ast + * @param {?=} startingStyles + * @param {?=} finalStyles + * @param {?=} options + * @param {?=} subInstructions + * @param {?=} errors + * @return {?} + */ +function buildAnimationTimelines(driver, rootElement, ast, startingStyles, finalStyles, options, subInstructions, errors) { + if (startingStyles === void 0) { startingStyles = {}; } + if (finalStyles === void 0) { finalStyles = {}; } + if (errors === void 0) { errors = []; } + return new AnimationTimelineBuilderVisitor().buildKeyframes(driver, rootElement, ast, startingStyles, finalStyles, options, subInstructions, errors); +} +var AnimationTimelineBuilderVisitor = (function () { + function AnimationTimelineBuilderVisitor() { + } + /** + * @param {?} driver + * @param {?} rootElement + * @param {?} ast + * @param {?} startingStyles + * @param {?} finalStyles + * @param {?} options + * @param {?=} subInstructions + * @param {?=} errors + * @return {?} + */ + AnimationTimelineBuilderVisitor.prototype.buildKeyframes = function (driver, rootElement, ast, startingStyles, finalStyles, options, subInstructions, errors) { + if (errors === void 0) { errors = []; } + subInstructions = subInstructions || new ElementInstructionMap(); + var /** @type {?} */ context = new AnimationTimelineContext(driver, rootElement, subInstructions, errors, []); + context.options = options; + context.currentTimeline.setStyles([startingStyles], null, context.errors, options); + visitDslNode(this, ast, context); + // this checks to see if an actual animation happened + var /** @type {?} */ timelines = context.timelines.filter(function (timeline) { return timeline.containsAnimation(); }); + if (timelines.length && Object.keys(finalStyles).length) { + var /** @type {?} */ tl = timelines[timelines.length - 1]; + if (!tl.allowOnlyTimelineStyles()) { + tl.setStyles([finalStyles], null, context.errors, options); + } + } + return timelines.length ? timelines.map(function (timeline) { return timeline.buildKeyframes(); }) : + [createTimelineInstruction(rootElement, [], [], [], 0, 0, '', false)]; + }; + /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + AnimationTimelineBuilderVisitor.prototype.visitTrigger = function (ast, context) { + // these values are not visited in this AST + }; + /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + AnimationTimelineBuilderVisitor.prototype.visitState = function (ast, context) { + // these values are not visited in this AST + }; + /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + AnimationTimelineBuilderVisitor.prototype.visitTransition = function (ast, context) { + // these values are not visited in this AST + }; + /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + AnimationTimelineBuilderVisitor.prototype.visitAnimateChild = function (ast, context) { + var /** @type {?} */ elementInstructions = context.subInstructions.consume(context.element); + if (elementInstructions) { + var /** @type {?} */ innerContext = context.createSubContext(ast.options); + var /** @type {?} */ startTime = context.currentTimeline.currentTime; + var /** @type {?} */ endTime = this._visitSubInstructions(elementInstructions, innerContext, /** @type {?} */ (innerContext.options)); + if (startTime != endTime) { + // we do this on the upper context because we created a sub context for + // the sub child animations + context.transformIntoNewTimeline(endTime); + } + } + context.previousNode = ast; + }; + /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + AnimationTimelineBuilderVisitor.prototype.visitAnimateRef = function (ast, context) { + var /** @type {?} */ innerContext = context.createSubContext(ast.options); + innerContext.transformIntoNewTimeline(); + this.visitReference(ast.animation, innerContext); + context.transformIntoNewTimeline(innerContext.currentTimeline.currentTime); + context.previousNode = ast; + }; + /** + * @param {?} instructions + * @param {?} context + * @param {?} options + * @return {?} + */ + AnimationTimelineBuilderVisitor.prototype._visitSubInstructions = function (instructions, context, options) { + var /** @type {?} */ startTime = context.currentTimeline.currentTime; + var /** @type {?} */ furthestTime = startTime; + // this is a special-case for when a user wants to skip a sub + // animation from being fired entirely. + var /** @type {?} */ duration = options.duration != null ? resolveTimingValue(options.duration) : null; + var /** @type {?} */ delay = options.delay != null ? resolveTimingValue(options.delay) : null; + if (duration !== 0) { + instructions.forEach(function (instruction) { + var /** @type {?} */ instructionTimings = context.appendInstructionToTimeline(instruction, duration, delay); + furthestTime = + Math.max(furthestTime, instructionTimings.duration + instructionTimings.delay); + }); + } + return furthestTime; + }; + /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + AnimationTimelineBuilderVisitor.prototype.visitReference = function (ast, context) { + context.updateOptions(ast.options, true); + visitDslNode(this, ast.animation, context); + context.previousNode = ast; + }; + /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + AnimationTimelineBuilderVisitor.prototype.visitSequence = function (ast, context) { + var _this = this; + var /** @type {?} */ subContextCount = context.subContextCount; + var /** @type {?} */ ctx = context; + var /** @type {?} */ options = ast.options; + if (options && (options.params || options.delay)) { + ctx = context.createSubContext(options); + ctx.transformIntoNewTimeline(); + if (options.delay != null) { + if (ctx.previousNode.type == 6 /* Style */) { + ctx.currentTimeline.snapshotCurrentStyles(); + ctx.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; + } + var /** @type {?} */ delay = resolveTimingValue(options.delay); + ctx.delayNextStep(delay); + } + } + if (ast.steps.length) { + ast.steps.forEach(function (s) { return visitDslNode(_this, s, ctx); }); + // this is here just incase the inner steps only contain or end with a style() call + ctx.currentTimeline.applyStylesToKeyframe(); + // this means that some animation function within the sequence + // ended up creating a sub timeline (which means the current + // timeline cannot overlap with the contents of the sequence) + if (ctx.subContextCount > subContextCount) { + ctx.transformIntoNewTimeline(); + } + } + context.previousNode = ast; + }; + /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + AnimationTimelineBuilderVisitor.prototype.visitGroup = function (ast, context) { + var _this = this; + var /** @type {?} */ innerTimelines = []; + var /** @type {?} */ furthestTime = context.currentTimeline.currentTime; + var /** @type {?} */ delay = ast.options && ast.options.delay ? resolveTimingValue(ast.options.delay) : 0; + ast.steps.forEach(function (s) { + var /** @type {?} */ innerContext = context.createSubContext(ast.options); + if (delay) { + innerContext.delayNextStep(delay); + } + visitDslNode(_this, s, innerContext); + furthestTime = Math.max(furthestTime, innerContext.currentTimeline.currentTime); + innerTimelines.push(innerContext.currentTimeline); + }); + // this operation is run after the AST loop because otherwise + // if the parent timeline's collected styles were updated then + // it would pass in invalid data into the new-to-be forked items + innerTimelines.forEach(function (timeline) { return context.currentTimeline.mergeTimelineCollectedStyles(timeline); }); + context.transformIntoNewTimeline(furthestTime); + context.previousNode = ast; + }; + /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + AnimationTimelineBuilderVisitor.prototype._visitTiming = function (ast, context) { + if (((ast)).dynamic) { + var /** @type {?} */ strValue = ((ast)).strValue; + var /** @type {?} */ timingValue = context.params ? interpolateParams(strValue, context.params, context.errors) : strValue; + return resolveTiming(timingValue, context.errors); + } + else { + return { duration: ast.duration, delay: ast.delay, easing: ast.easing }; + } + }; + /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + AnimationTimelineBuilderVisitor.prototype.visitAnimate = function (ast, context) { + var /** @type {?} */ timings = context.currentAnimateTimings = this._visitTiming(ast.timings, context); + var /** @type {?} */ timeline = context.currentTimeline; + if (timings.delay) { + context.incrementTime(timings.delay); + timeline.snapshotCurrentStyles(); + } + var /** @type {?} */ style$$1 = ast.style; + if (style$$1.type == 5 /* Keyframes */) { + this.visitKeyframes(style$$1, context); + } + else { + context.incrementTime(timings.duration); + this.visitStyle(/** @type {?} */ (style$$1), context); + timeline.applyStylesToKeyframe(); + } + context.currentAnimateTimings = null; + context.previousNode = ast; + }; + /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + AnimationTimelineBuilderVisitor.prototype.visitStyle = function (ast, context) { + var /** @type {?} */ timeline = context.currentTimeline; + var /** @type {?} */ timings = ((context.currentAnimateTimings)); + // this is a special case for when a style() call + // directly follows an animate() call (but not inside of an animate() call) + if (!timings && timeline.getCurrentStyleProperties().length) { + timeline.forwardFrame(); + } + var /** @type {?} */ easing = (timings && timings.easing) || ast.easing; + if (ast.isEmptyStep) { + timeline.applyEmptyStep(easing); + } + else { + timeline.setStyles(ast.styles, easing, context.errors, context.options); + } + context.previousNode = ast; + }; + /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + AnimationTimelineBuilderVisitor.prototype.visitKeyframes = function (ast, context) { + var /** @type {?} */ currentAnimateTimings = ((context.currentAnimateTimings)); + var /** @type {?} */ startTime = (((context.currentTimeline))).duration; + var /** @type {?} */ duration = currentAnimateTimings.duration; + var /** @type {?} */ innerContext = context.createSubContext(); + var /** @type {?} */ innerTimeline = innerContext.currentTimeline; + innerTimeline.easing = currentAnimateTimings.easing; + ast.styles.forEach(function (step) { + var /** @type {?} */ offset = step.offset || 0; + innerTimeline.forwardTime(offset * duration); + innerTimeline.setStyles(step.styles, step.easing, context.errors, context.options); + innerTimeline.applyStylesToKeyframe(); + }); + // this will ensure that the parent timeline gets all the styles from + // the child even if the new timeline below is not used + context.currentTimeline.mergeTimelineCollectedStyles(innerTimeline); + // we do this because the window between this timeline and the sub timeline + // should ensure that the styles within are exactly the same as they were before + context.transformIntoNewTimeline(startTime + duration); + context.previousNode = ast; + }; + /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + AnimationTimelineBuilderVisitor.prototype.visitQuery = function (ast, context) { + var _this = this; + // in the event that the first step before this is a style step we need + // to ensure the styles are applied before the children are animated + var /** @type {?} */ startTime = context.currentTimeline.currentTime; + var /** @type {?} */ options = ((ast.options || {})); + var /** @type {?} */ delay = options.delay ? resolveTimingValue(options.delay) : 0; + if (delay && (context.previousNode.type === 6 /* Style */ || + (startTime == 0 && context.currentTimeline.getCurrentStyleProperties().length))) { + context.currentTimeline.snapshotCurrentStyles(); + context.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; + } + var /** @type {?} */ furthestTime = startTime; + var /** @type {?} */ elms = context.invokeQuery(ast.selector, ast.originalSelector, ast.limit, ast.includeSelf, options.optional ? true : false, context.errors); + context.currentQueryTotal = elms.length; + var /** @type {?} */ sameElementTimeline = null; + elms.forEach(function (element, i) { + context.currentQueryIndex = i; + var /** @type {?} */ innerContext = context.createSubContext(ast.options, element); + if (delay) { + innerContext.delayNextStep(delay); + } + if (element === context.element) { + sameElementTimeline = innerContext.currentTimeline; + } + visitDslNode(_this, ast.animation, innerContext); + // this is here just incase the inner steps only contain or end + // with a style() call (which is here to signal that this is a preparatory + // call to style an element before it is animated again) + innerContext.currentTimeline.applyStylesToKeyframe(); + var /** @type {?} */ endTime = innerContext.currentTimeline.currentTime; + furthestTime = Math.max(furthestTime, endTime); + }); + context.currentQueryIndex = 0; + context.currentQueryTotal = 0; + context.transformIntoNewTimeline(furthestTime); + if (sameElementTimeline) { + context.currentTimeline.mergeTimelineCollectedStyles(sameElementTimeline); + context.currentTimeline.snapshotCurrentStyles(); + } + context.previousNode = ast; + }; + /** + * @param {?} ast + * @param {?} context + * @return {?} + */ + AnimationTimelineBuilderVisitor.prototype.visitStagger = function (ast, context) { + var /** @type {?} */ parentContext = ((context.parentContext)); + var /** @type {?} */ tl = context.currentTimeline; + var /** @type {?} */ timings = ast.timings; + var /** @type {?} */ duration = Math.abs(timings.duration); + var /** @type {?} */ maxTime = duration * (context.currentQueryTotal - 1); + var /** @type {?} */ delay = duration * context.currentQueryIndex; + var /** @type {?} */ staggerTransformer = timings.duration < 0 ? 'reverse' : timings.easing; + switch (staggerTransformer) { + case 'reverse': + delay = maxTime - delay; + break; + case 'full': + delay = parentContext.currentStaggerTime; + break; + } + var /** @type {?} */ timeline = context.currentTimeline; + if (delay) { + timeline.delayNextStep(delay); + } + var /** @type {?} */ startingTime = timeline.currentTime; + visitDslNode(this, ast.animation, context); + context.previousNode = ast; + // time = duration + delay + // the reason why this computation is so complex is because + // the inner timeline may either have a delay value or a stretched + // keyframe depending on if a subtimeline is not used or is used. + parentContext.currentStaggerTime = + (tl.currentTime - startingTime) + (tl.startTime - parentContext.currentTimeline.startTime); + }; + return AnimationTimelineBuilderVisitor; +}()); +var DEFAULT_NOOP_PREVIOUS_NODE = ({}); +var AnimationTimelineContext = (function () { + /** + * @param {?} _driver + * @param {?} element + * @param {?} subInstructions + * @param {?} errors + * @param {?} timelines + * @param {?=} initialTimeline + */ + 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); + } + Object.defineProperty(AnimationTimelineContext.prototype, "params", { + /** + * @return {?} + */ + get: function () { return this.options.params; }, + enumerable: true, + configurable: true + }); + /** + * @param {?} options + * @param {?=} skipIfExists + * @return {?} + */ + AnimationTimelineContext.prototype.updateOptions = function (options, skipIfExists) { + var _this = this; + if (!options) + return; + var /** @type {?} */ newOptions = (options); + var /** @type {?} */ optionsToUpdate = this.options; + // NOTE: this will get patched up when other animation methods support duration overrides + if (newOptions.duration != null) { + ((optionsToUpdate)).duration = resolveTimingValue(newOptions.duration); + } + if (newOptions.delay != null) { + optionsToUpdate.delay = resolveTimingValue(newOptions.delay); + } + var /** @type {?} */ newParams = newOptions.params; + if (newParams) { + var /** @type {?} */ paramsToUpdate_1 = ((optionsToUpdate.params)); + if (!paramsToUpdate_1) { + paramsToUpdate_1 = this.options.params = {}; + } + Object.keys(newParams).forEach(function (name) { + if (!skipIfExists || !paramsToUpdate_1.hasOwnProperty(name)) { + paramsToUpdate_1[name] = interpolateParams(newParams[name], paramsToUpdate_1, _this.errors); + } + }); + } + }; + /** + * @return {?} + */ + AnimationTimelineContext.prototype._copyOptions = function () { + var /** @type {?} */ options = {}; + if (this.options) { + var /** @type {?} */ oldParams_1 = this.options.params; + if (oldParams_1) { + var /** @type {?} */ params_2 = options['params'] = {}; + Object.keys(oldParams_1).forEach(function (name) { params_2[name] = oldParams_1[name]; }); + } + } + return options; + }; + /** + * @param {?=} options + * @param {?=} element + * @param {?=} newTime + * @return {?} + */ + AnimationTimelineContext.prototype.createSubContext = function (options, element, newTime) { + if (options === void 0) { options = null; } + var /** @type {?} */ target = element || this.element; + var /** @type {?} */ context = new AnimationTimelineContext(this._driver, target, this.subInstructions, this.errors, this.timelines, this.currentTimeline.fork(target, newTime || 0)); + 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++; + return context; + }; + /** + * @param {?=} newTime + * @return {?} + */ + AnimationTimelineContext.prototype.transformIntoNewTimeline = function (newTime) { + this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; + this.currentTimeline = this.currentTimeline.fork(this.element, newTime); + this.timelines.push(this.currentTimeline); + return this.currentTimeline; + }; + /** + * @param {?} instruction + * @param {?} duration + * @param {?} delay + * @return {?} + */ + AnimationTimelineContext.prototype.appendInstructionToTimeline = function (instruction, duration, delay) { + var /** @type {?} */ updatedTimings = { + duration: duration != null ? duration : instruction.duration, + delay: this.currentTimeline.currentTime + (delay != null ? delay : 0) + instruction.delay, + easing: '' + }; + var /** @type {?} */ builder = new SubTimelineBuilder(instruction.element, instruction.keyframes, instruction.preStyleProps, instruction.postStyleProps, updatedTimings, instruction.stretchStartingKeyframe); + this.timelines.push(builder); + return updatedTimings; + }; + /** + * @param {?} time + * @return {?} + */ + AnimationTimelineContext.prototype.incrementTime = function (time) { + this.currentTimeline.forwardTime(this.currentTimeline.duration + time); + }; + /** + * @param {?} delay + * @return {?} + */ + AnimationTimelineContext.prototype.delayNextStep = function (delay) { + // negative delays are not yet supported + if (delay > 0) { + this.currentTimeline.delayNextStep(delay); + } + }; + /** + * @param {?} selector + * @param {?} originalSelector + * @param {?} limit + * @param {?} includeSelf + * @param {?} optional + * @param {?} errors + * @return {?} + */ + AnimationTimelineContext.prototype.invokeQuery = function (selector, originalSelector, limit, includeSelf, optional, errors) { + var /** @type {?} */ results = []; + if (includeSelf) { + results.push(this.element); + } + if (selector.length > 0) { + var /** @type {?} */ multi = limit != 1; + var /** @type {?} */ elements = this._driver.query(this.element, selector, multi); + if (limit !== 0) { + elements = elements.slice(0, limit); + } + results.push.apply(results, elements); + } + if (!optional && results.length == 0) { + errors.push("`query(\"" + originalSelector + "\")` returned zero elements. (Use `query(\"" + originalSelector + "\", { optional: true })` if you wish to allow this.)"); + } + return results; + }; + return AnimationTimelineContext; +}()); +var TimelineBuilder = (function () { + /** + * @param {?} element + * @param {?} startTime + * @param {?=} _elementTimelineStylesLookup + */ + 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; + if (!this._elementTimelineStylesLookup) { + this._elementTimelineStylesLookup = new Map(); + } + this._localTimelineStyles = Object.create(this._backFill, {}); + this._globalTimelineStyles = this._elementTimelineStylesLookup.get(element); + if (!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 false; + case 1: + return this.getCurrentStyleProperties().length > 0; + default: + return true; + } + }; + /** + * @return {?} + */ + TimelineBuilder.prototype.getCurrentStyleProperties = function () { return Object.keys(this._currentKeyframe); }; + Object.defineProperty(TimelineBuilder.prototype, "currentTime", { + /** + * @return {?} + */ + get: function () { return this.startTime + this.duration; }, + enumerable: true, + configurable: true + }); + /** + * @param {?} delay + * @return {?} + */ + TimelineBuilder.prototype.delayNextStep = function (delay) { + // in the event that a style() step is placed right before a stagger() + // and that style() step is the very first style() value in the animation + // then we need to make a copy of the keyframe [0, copy, 1] so that the delay + // properly applies the style() values to work with the stagger... + var /** @type {?} */ hasPreStyleStep = this._keyframes.size == 1 && Object.keys(this._pendingStyles).length; + if (this.duration || hasPreStyleStep) { + this.forwardTime(this.currentTime + delay); + if (hasPreStyleStep) { + this.snapshotCurrentStyles(); + } + } + else { + this.startTime += delay; + } + }; + /** + * @param {?} element + * @param {?=} currentTime + * @return {?} + */ + TimelineBuilder.prototype.fork = function (element, currentTime) { + this.applyStylesToKeyframe(); + return new TimelineBuilder(element, currentTime || this.currentTime, this._elementTimelineStylesLookup); + }; + /** + * @return {?} + */ + TimelineBuilder.prototype._loadKeyframe = function () { + if (this._currentKeyframe) { + this._previousKeyframe = this._currentKeyframe; + } + this._currentKeyframe = ((this._keyframes.get(this.duration))); + if (!this._currentKeyframe) { + this._currentKeyframe = Object.create(this._backFill, {}); + this._keyframes.set(this.duration, this._currentKeyframe); + } + }; + /** + * @return {?} + */ + TimelineBuilder.prototype.forwardFrame = function () { + this.duration += ONE_FRAME_IN_MILLISECONDS; + this._loadKeyframe(); + }; + /** + * @param {?} time + * @return {?} + */ + TimelineBuilder.prototype.forwardTime = function (time) { + this.applyStylesToKeyframe(); + this.duration = time; + this._loadKeyframe(); + }; + /** + * @param {?} prop + * @param {?} value + * @return {?} + */ + TimelineBuilder.prototype._updateStyle = function (prop, value) { + this._localTimelineStyles[prop] = value; + this._globalTimelineStyles[prop] = value; + this._styleSummary[prop] = { time: this.currentTime, value: value }; + }; + /** + * @return {?} + */ + TimelineBuilder.prototype.allowOnlyTimelineStyles = function () { return this._currentEmptyStepKeyframe !== this._currentKeyframe; }; + /** + * @param {?} easing + * @return {?} + */ + TimelineBuilder.prototype.applyEmptyStep = function (easing) { + var _this = this; + if (easing) { + this._previousKeyframe['easing'] = easing; + } + // special case for animate(duration): + // all missing styles are filled with a `*` value then + // if any destination styles are filled in later on the same + // keyframe then they will override the overridden styles + // We use `_globalTimelineStyles` here because there may be + // styles in previous keyframes that are not present in this timeline + Object.keys(this._globalTimelineStyles).forEach(function (prop) { + _this._backFill[prop] = _this._globalTimelineStyles[prop] || AUTO_STYLE; + _this._currentKeyframe[prop] = AUTO_STYLE; + }); + this._currentEmptyStepKeyframe = this._currentKeyframe; + }; + /** + * @param {?} input + * @param {?} easing + * @param {?} errors + * @param {?=} options + * @return {?} + */ + TimelineBuilder.prototype.setStyles = function (input, easing, errors, options) { + var _this = this; + if (easing) { + this._previousKeyframe['easing'] = easing; + } + var /** @type {?} */ params = (options && options.params) || {}; + var /** @type {?} */ styles = flattenStyles(input, this._globalTimelineStyles); + Object.keys(styles).forEach(function (prop) { + var /** @type {?} */ val = interpolateParams(styles[prop], params, errors); + _this._pendingStyles[prop] = val; + if (!_this._localTimelineStyles.hasOwnProperty(prop)) { + _this._backFill[prop] = _this._globalTimelineStyles.hasOwnProperty(prop) ? + _this._globalTimelineStyles[prop] : + AUTO_STYLE; + } + _this._updateStyle(prop, val); + }); + }; + /** + * @return {?} + */ + TimelineBuilder.prototype.applyStylesToKeyframe = function () { + var _this = this; + var /** @type {?} */ styles = this._pendingStyles; + var /** @type {?} */ props = Object.keys(styles); + if (props.length == 0) + return; + this._pendingStyles = {}; + props.forEach(function (prop) { + var /** @type {?} */ val = styles[prop]; + _this._currentKeyframe[prop] = val; + }); + Object.keys(this._localTimelineStyles).forEach(function (prop) { + if (!_this._currentKeyframe.hasOwnProperty(prop)) { + _this._currentKeyframe[prop] = _this._localTimelineStyles[prop]; + } + }); + }; + /** + * @return {?} + */ + TimelineBuilder.prototype.snapshotCurrentStyles = function () { + var _this = this; + Object.keys(this._localTimelineStyles).forEach(function (prop) { + var /** @type {?} */ val = _this._localTimelineStyles[prop]; + _this._pendingStyles[prop] = val; + _this._updateStyle(prop, val); + }); + }; + /** + * @return {?} + */ + TimelineBuilder.prototype.getFinalKeyframe = function () { return this._keyframes.get(this.duration); }; + Object.defineProperty(TimelineBuilder.prototype, "properties", { + /** + * @return {?} + */ + get: function () { + var /** @type {?} */ properties = []; + for (var /** @type {?} */ prop in this._currentKeyframe) { + properties.push(prop); + } + return properties; + }, + enumerable: true, + configurable: true + }); + /** + * @param {?} timeline + * @return {?} + */ + TimelineBuilder.prototype.mergeTimelineCollectedStyles = function (timeline) { + var _this = this; + Object.keys(timeline._styleSummary).forEach(function (prop) { + var /** @type {?} */ details0 = _this._styleSummary[prop]; + var /** @type {?} */ details1 = timeline._styleSummary[prop]; + if (!details0 || details1.time > details0.time) { + _this._updateStyle(prop, details1.value); + } + }); + }; + /** + * @return {?} + */ + TimelineBuilder.prototype.buildKeyframes = function () { + var _this = this; + this.applyStylesToKeyframe(); + var /** @type {?} */ preStyleProps = new Set(); + var /** @type {?} */ postStyleProps = new Set(); + var /** @type {?} */ isEmpty = this._keyframes.size === 1 && this.duration === 0; + var /** @type {?} */ finalKeyframes = []; + this._keyframes.forEach(function (keyframe, time) { + var /** @type {?} */ finalKeyframe = copyStyles(keyframe, true); + Object.keys(finalKeyframe).forEach(function (prop) { + var /** @type {?} */ value = finalKeyframe[prop]; + if (value == ɵPRE_STYLE) { + preStyleProps.add(prop); + } + else if (value == AUTO_STYLE) { + postStyleProps.add(prop); + } + }); + if (!isEmpty) { + finalKeyframe['offset'] = time / _this.duration; + } + finalKeyframes.push(finalKeyframe); + }); + var /** @type {?} */ preProps = preStyleProps.size ? iteratorToArray(preStyleProps.values()) : []; + var /** @type {?} */ postProps = postStyleProps.size ? iteratorToArray(postStyleProps.values()) : []; + // special case for a 0-second animation (which is designed just to place styles onscreen) + if (isEmpty) { + var /** @type {?} */ kf0 = finalKeyframes[0]; + var /** @type {?} */ 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, false); + }; + return TimelineBuilder; +}()); +var SubTimelineBuilder = (function (_super) { + tslib_1.__extends(SubTimelineBuilder, _super); + /** + * @param {?} element + * @param {?} keyframes + * @param {?} preStyleProps + * @param {?} postStyleProps + * @param {?} timings + * @param {?=} _stretchStartingKeyframe + */ + function SubTimelineBuilder(element, keyframes, preStyleProps, postStyleProps, timings, _stretchStartingKeyframe) { + if (_stretchStartingKeyframe === void 0) { _stretchStartingKeyframe = false; } + var _this = _super.call(this, element, timings.delay) || this; + _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 }; + return _this; + } + /** + * @return {?} + */ + SubTimelineBuilder.prototype.containsAnimation = function () { return this.keyframes.length > 1; }; + /** + * @return {?} + */ + SubTimelineBuilder.prototype.buildKeyframes = function () { + var /** @type {?} */ keyframes = this.keyframes; + var _a = this.timings, delay = _a.delay, duration = _a.duration, easing = _a.easing; + if (this._stretchStartingKeyframe && delay) { + var /** @type {?} */ newKeyframes = []; + var /** @type {?} */ totalTime = duration + delay; + var /** @type {?} */ startingGap = delay / totalTime; + // the original starting keyframe now starts once the delay is done + var /** @type {?} */ newFirstKeyframe = copyStyles(keyframes[0], false); + newFirstKeyframe['offset'] = 0; + newKeyframes.push(newFirstKeyframe); + var /** @type {?} */ oldFirstKeyframe = copyStyles(keyframes[0], false); + oldFirstKeyframe['offset'] = roundOffset(startingGap); + newKeyframes.push(oldFirstKeyframe); + /* + When the keyframe is stretched then it means that the delay before the animation + starts is gone. Instead the first keyframe is placed at the start of the animation + and it is then copied to where it starts when the original delay is over. This basically + means nothing animates during that delay, but the styles are still renderered. For this + to work the original offset values that exist in the original keyframes must be "warped" + so that they can take the new keyframe + delay into account. + + delay=1000, duration=1000, keyframes = 0 .5 1 + + turns into + + delay=0, duration=2000, keyframes = 0 .33 .66 1 + */ + // offsets between 1 ... n -1 are all warped by the keyframe stretch + var /** @type {?} */ limit = keyframes.length - 1; + for (var /** @type {?} */ i = 1; i <= limit; i++) { + var /** @type {?} */ kf = copyStyles(keyframes[i], false); + var /** @type {?} */ oldOffset = (kf['offset']); + var /** @type {?} */ timeAtKeyframe = delay + oldOffset * duration; + kf['offset'] = roundOffset(timeAtKeyframe / totalTime); + newKeyframes.push(kf); + } + // the new starting keyframe should be added at the start + duration = totalTime; + delay = 0; + easing = ''; + keyframes = newKeyframes; + } + return createTimelineInstruction(this.element, keyframes, this.preStyleProps, this.postStyleProps, duration, delay, easing, true); + }; + return SubTimelineBuilder; +}(TimelineBuilder)); +/** + * @param {?} offset + * @param {?=} decimalPoints + * @return {?} + */ +function roundOffset(offset, decimalPoints) { + if (decimalPoints === void 0) { decimalPoints = 3; } + var /** @type {?} */ mult = Math.pow(10, decimalPoints - 1); + return Math.round(offset * mult) / mult; +} +/** + * @param {?} input + * @param {?} allStyles + * @return {?} + */ +function flattenStyles(input, allStyles) { + var /** @type {?} */ styles = {}; + var /** @type {?} */ allProperties; + input.forEach(function (token) { + if (token === '*') { + allProperties = allProperties || Object.keys(allStyles); + allProperties.forEach(function (prop) { styles[prop] = AUTO_STYLE; }); + } + else { + copyStyles(/** @type {?} */ (token), false, styles); + } + }); + return styles; +} +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +var Animation = (function () { + /** + * @param {?} _driver + * @param {?} input + */ + function Animation(_driver, input) { + this._driver = _driver; + var errors = []; + var ast = buildAnimationAst(input, errors); + if (errors.length) { + var errorMessage = "animation validation failed:\n" + errors.join("\n"); + throw new Error(errorMessage); + } + this._animationAst = ast; + } + /** + * @param {?} element + * @param {?} startingStyles + * @param {?} destinationStyles + * @param {?} options + * @param {?=} subInstructions + * @return {?} + */ + Animation.prototype.buildTimelines = function (element, startingStyles, destinationStyles, options, subInstructions) { + var /** @type {?} */ start = Array.isArray(startingStyles) ? normalizeStyles(startingStyles) : (startingStyles); + var /** @type {?} */ dest = Array.isArray(destinationStyles) ? normalizeStyles(destinationStyles) : (destinationStyles); + var /** @type {?} */ errors = []; + subInstructions = subInstructions || new ElementInstructionMap(); + var /** @type {?} */ result = buildAnimationTimelines(this._driver, element, this._animationAst, start, dest, options, subInstructions, errors); + if (errors.length) { + var /** @type {?} */ errorMessage = "animation building failed:\n" + errors.join("\n"); + throw new Error(errorMessage); + } + return result; + }; + return Animation; +}()); +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +/** + * @experimental Animation support is experimental. + */ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ var AnimationStyleNormalizer = (function () { + function AnimationStyleNormalizer() { + } + return AnimationStyleNormalizer; +}()); +/** + * @experimental Animation support is experimental. + */ +var NoopAnimationStyleNormalizer = (function () { + function NoopAnimationStyleNormalizer() { + } + NoopAnimationStyleNormalizer.prototype.normalizePropertyName = function (propertyName, errors) { return propertyName; }; + NoopAnimationStyleNormalizer.prototype.normalizeStyleValue = function (userProvidedProperty, normalizedProperty, value, errors) { + return value; + }; + return NoopAnimationStyleNormalizer; +}()); +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +var WebAnimationsStyleNormalizer = (function (_super) { + tslib_1.__extends(WebAnimationsStyleNormalizer, _super); + function WebAnimationsStyleNormalizer() { + return _super !== null && _super.apply(this, arguments) || this; + } + /** + * @param {?} propertyName + * @param {?} errors + * @return {?} + */ + WebAnimationsStyleNormalizer.prototype.normalizePropertyName = function (propertyName, errors) { + return dashCaseToCamelCase(propertyName); + }; + /** + * @param {?} userProvidedProperty + * @param {?} normalizedProperty + * @param {?} value + * @param {?} errors + * @return {?} + */ + WebAnimationsStyleNormalizer.prototype.normalizeStyleValue = function (userProvidedProperty, normalizedProperty, value, errors) { + var /** @type {?} */ unit = ''; + var /** @type {?} */ strVal = value.toString().trim(); + if (DIMENSIONAL_PROP_MAP[normalizedProperty] && value !== 0 && value !== '0') { + if (typeof value === 'number') { + unit = 'px'; + } + else { + var /** @type {?} */ valAndSuffixMatch = value.match(/^[+-]?[\d\.]+([a-z]*)$/); + if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) { + errors.push("Please provide a CSS unit value for " + userProvidedProperty + ":" + value); + } + } + } + return strVal + unit; + }; + return WebAnimationsStyleNormalizer; +}(AnimationStyleNormalizer)); +var 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(',')); +/** + * @param {?} keys + * @return {?} + */ +function makeBooleanMap(keys) { + var /** @type {?} */ map = {}; + keys.forEach(function (key) { return map[key] = true
<TRUNCATED>