var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35;
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); }
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["main"], {
/***/
"./node_modules/@angular/animations/fesm2015/animations.js":
/*!*****************************************************************!*\
!*** ./node_modules/@angular/animations/fesm2015/animations.js ***!
\*****************************************************************/
/*! exports provided: AUTO_STYLE, AnimationBuilder, AnimationFactory, NoopAnimationPlayer, animate, animateChild, animation, group, keyframes, query, sequence, stagger, state, style, transition, trigger, useAnimation, ɵAnimationGroupPlayer, ɵPRE_STYLE */
/***/
function node_modulesAngularAnimationsFesm2015AnimationsJs(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "AUTO_STYLE", function () {
return AUTO_STYLE;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "AnimationBuilder", function () {
return AnimationBuilder;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "AnimationFactory", function () {
return AnimationFactory;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NoopAnimationPlayer", function () {
return NoopAnimationPlayer;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "animate", function () {
return animate;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "animateChild", function () {
return animateChild;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "animation", function () {
return animation;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "group", function () {
return group;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "keyframes", function () {
return keyframes;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "query", function () {
return query;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "sequence", function () {
return sequence;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "stagger", function () {
return stagger;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "state", function () {
return state;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "style", function () {
return style;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "transition", function () {
return transition;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "trigger", function () {
return trigger;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "useAnimation", function () {
return useAnimation;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵAnimationGroupPlayer", function () {
return AnimationGroupPlayer;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵPRE_STYLE", function () {
return ɵPRE_STYLE;
});
/**
* @license Angular v9.1.13
* (c) 2010-2020 Google LLC. https://angular.io/
* License: MIT
*/
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/src/animation_builder.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* An injectable service that produces an animation sequence programmatically within an
* Angular component or directive.
* Provided by the `BrowserAnimationsModule` or `NoopAnimationsModule`.
*
* \@usageNotes
*
* To use this service, add it to your component or directive as a dependency.
* The service is instantiated along with your component.
*
* Apps do not typically need to create their own animation players, but if you
* do need to, follow these steps:
*
* 1. Use the `build()` method to create a programmatic animation using the
* `animate()` function. The method returns an `AnimationFactory` instance.
*
* 2. Use the factory object to create an `AnimationPlayer` and attach it to a DOM element.
*
* 3. Use the player object to control the animation programmatically.
*
* For example:
*
* ```ts
* // import the service from BrowserAnimationsModule
* import {AnimationBuilder} from '\@angular/animations';
* // require the service as a dependency
* class MyCmp {
* constructor(private _builder: AnimationBuilder) {}
*
* makeAnimation(element: any) {
* // first define a reusable animation
* const myAnimation = this._builder.build([
* style({ width: 0 }),
* animate(1000, style({ width: '100px' }))
* ]);
*
* // use the returned factory object to create a player
* const player = myAnimation.create(element);
*
* player.play();
* }
* }
* ```
*
* \@publicApi
* @abstract
*/
var AnimationBuilder = function AnimationBuilder() {
_classCallCheck(this, AnimationBuilder);
};
if (false) {}
/**
* A factory object returned from the `AnimationBuilder`.`build()` method.
*
* \@publicApi
* @abstract
*/
var AnimationFactory = function AnimationFactory() {
_classCallCheck(this, AnimationFactory);
};
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/src/animation_metadata.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @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
*/
/**
* Represents a set of CSS styles for use in an animation style.
* @record
*/
function ɵStyleData() {}
/** @enum {number} */
var AnimationMetadataType = {
/**
* Associates a named animation state with a set of CSS styles.
* See `state()`
*/
State: 0,
/**
* Data for a transition from one animation state to another.
* See `transition()`
*/
Transition: 1,
/**
* Contains a set of animation steps.
* See `sequence()`
*/
Sequence: 2,
/**
* Contains a set of animation steps.
* See `{@link animations/group group()}`
*/
Group: 3,
/**
* Contains an animation step.
* See `animate()`
*/
Animate: 4,
/**
* Contains a set of animation steps.
* See `keyframes()`
*/
Keyframes: 5,
/**
* Contains a set of CSS property-value pairs into a named style.
* See `style()`
*/
Style: 6,
/**
* Associates an animation with an entry trigger that can be attached to an element.
* See `trigger()`
*/
Trigger: 7,
/**
* Contains a re-usable animation.
* See `animation()`
*/
Reference: 8,
/**
* Contains data to use in executing child animations returned by a query.
* See `animateChild()`
*/
AnimateChild: 9,
/**
* Contains animation parameters for a re-usable animation.
* See `useAnimation()`
*/
AnimateRef: 10,
/**
* Contains child-animation query data.
* See `query()`
*/
Query: 11,
/**
* Contains data for staggering an animation sequence.
* See `stagger()`
*/
Stagger: 12
};
/**
* Specifies automatic styling.
*
* \@publicApi
* @type {?}
*/
var AUTO_STYLE = '*';
/**
* Base for animation data structures.
*
* \@publicApi
* @record
*/
function AnimationMetadata() {}
if (false) {}
/**
* Contains an animation trigger. Instantiated and returned by the
* `trigger()` function.
*
* \@publicApi
* @record
*/
function AnimationTriggerMetadata() {}
if (false) {}
/**
* Encapsulates an animation state by associating a state name with a set of CSS styles.
* Instantiated and returned by the `state()` function.
*
* \@publicApi
* @record
*/
function AnimationStateMetadata() {}
if (false) {}
/**
* Encapsulates an animation transition. Instantiated and returned by the
* `transition()` function.
*
* \@publicApi
* @record
*/
function AnimationTransitionMetadata() {}
if (false) {}
/**
* Encapsulates a reusable animation, which is a collection of individual animation steps.
* Instantiated and returned by the `animation()` function, and
* passed to the `useAnimation()` function.
*
* \@publicApi
* @record
*/
function AnimationReferenceMetadata() {}
if (false) {}
/**
* Encapsulates an animation query. Instantiated and returned by
* the `query()` function.
*
* \@publicApi
* @record
*/
function AnimationQueryMetadata() {}
if (false) {}
/**
* Encapsulates a keyframes sequence. Instantiated and returned by
* the `keyframes()` function.
*
* \@publicApi
* @record
*/
function AnimationKeyframesSequenceMetadata() {}
if (false) {}
/**
* Encapsulates an animation style. Instantiated and returned by
* the `style()` function.
*
* \@publicApi
* @record
*/
function AnimationStyleMetadata() {}
if (false) {}
/**
* Encapsulates an animation step. Instantiated and returned by
* the `animate()` function.
*
* \@publicApi
* @record
*/
function AnimationAnimateMetadata() {}
if (false) {}
/**
* Encapsulates a child animation, that can be run explicitly when the parent is run.
* Instantiated and returned by the `animateChild` function.
*
* \@publicApi
* @record
*/
function AnimationAnimateChildMetadata() {}
if (false) {}
/**
* Encapsulates a reusable animation.
* Instantiated and returned by the `useAnimation()` function.
*
* \@publicApi
* @record
*/
function AnimationAnimateRefMetadata() {}
if (false) {}
/**
* Encapsulates an animation sequence.
* Instantiated and returned by the `sequence()` function.
*
* \@publicApi
* @record
*/
function AnimationSequenceMetadata() {}
if (false) {}
/**
* Encapsulates an animation group.
* Instantiated and returned by the `{\@link animations/group group()}` function.
*
* \@publicApi
* @record
*/
function AnimationGroupMetadata() {}
if (false) {}
/**
* Encapsulates parameters for staggering the start times of a set of animation steps.
* Instantiated and returned by the `stagger()` function.
*
* \@publicApi
*
* @record
*/
function AnimationStaggerMetadata() {}
if (false) {}
/**
* Creates a named animation trigger, containing a list of `state()`
* and `transition()` entries to be evaluated when the expression
* bound to the trigger changes.
*
* \@usageNotes
* Define an animation trigger in the `animations` section of `\@Component` metadata.
* In the template, reference the trigger by name and bind it to a trigger expression that
* evaluates to a defined animation state, using the following format:
*
* `[\@triggerName]="expression"`
*
* Animation trigger bindings convert all values to strings, and then match the
* previous and current values against any linked transitions.
* Booleans can be specified as `1` or `true` and `0` or `false`.
*
* ### Usage Example
*
* The following example creates an animation trigger reference based on the provided
* name value.
* The provided animation value is expected to be an array consisting of state and
* transition declarations.
*
* ```typescript
* \@Component({
* selector: "my-component",
* templateUrl: "my-component-tpl.html",
* animations: [
* trigger("myAnimationTrigger", [
* state(...),
* state(...),
* transition(...),
* transition(...)
* ])
* ]
* })
* class MyComponent {
* myStatusExp = "something";
* }
* ```
*
* The template associated with this component makes use of the defined trigger
* by binding to an element within its template code.
*
* ```html
*
*
...
* ```
*
* ### Using an inline function
* The `transition` animation method also supports reading an inline function which can decide
* if its associated animation should be run.
*
* ```typescript
* // this method is run each time the `myAnimationTrigger` trigger value changes.
* function myInlineMatcherFn(fromState: string, toState: string, element: any, params: {[key:
* string]: any}): boolean {
* // notice that `element` and `params` are also available here
* return toState == 'yes-please-animate';
* }
* /
* selector: 'my-component',
* templateUrl: 'my-component-tpl.html',
* animations: [
* trigger('myAnimationTrigger', [
* transition(myInlineMatcherFn, [
* // the animation sequence code
* ]),
* ])
* ]
* })
* class MyComponent {
* myStatusExp = "yes-please-animate";
* }
* ```
*
* ### Disabling Animations
* When true, the special animation control binding `\@.disabled` binding prevents
* all animations from rendering.
* Place the `\@.disabled` binding on an element to disable
* animations on the element itself, as well as any inner animation triggers
* within the element.
*
* The following example shows how to use this feature:
*
* ```typescript /
* selector: 'my-component',
* template: `
*
* `,
* animations: [
* trigger("childAnimation", [
* // ...
* ])
* ]
* })
* class MyComponent {
* isDisabled = true;
* exp = '...';
* }
* ```
*
* When `\@.disabled` is true, it prevents the `\@childAnimation` trigger from animating,
* along with any inner animations.
*
* ### Disable animations application-wide
* When an area of the template is set to have animations disabled,
* **all** inner components have their animations disabled as well.
* This means that you can disable all animations for an app
* by placing a host binding set on `\@.disabled` on the topmost Angular component.
*
* ```typescript
* import {Component, HostBinding} from '\@angular/core';
* /
* selector: 'app-component',
* templateUrl: 'app.component.html',
* })
* class AppComponent {
* \@HostBinding('@.disabled')
* public animationsDisabled = true;
* }
* ```
*
* ### Overriding disablement of inner animations
* Despite inner animations being disabled, a parent animation can `query()`
* for inner elements located in disabled areas of the template and still animate
* them if needed. This is also the case for when a sub animation is
* queried by a parent and then later animated using `animateChild()`.
*
* ### Detecting when an animation is disabled
* If a region of the DOM (or the entire application) has its animations disabled, the animation
* trigger callbacks still fire, but for zero seconds. When the callback fires, it provides
* an instance of an `AnimationEvent`. If animations are disabled,
* the `.disabled` flag on the event is true.
*
* \@publicApi
* @param {?} name An identifying string.
* @param {?} definitions An animation definition object, containing an array of `state()`
* and `transition()` declarations.
*
* @return {?} An object that encapsulates the trigger data.
*
*/
function trigger(name, definitions) {
return {
type: 7
/* Trigger */
,
name: name,
definitions: definitions,
options: {}
};
}
/**
* Defines an animation step that combines styling information with timing information.
*
* \@usageNotes
* Call within an animation `sequence()`, `{\@link animations/group group()}`, or
* `transition()` call to specify an animation step
* that applies given style data to the parent animation for a given amount of time.
*
* ### Syntax Examples
* **Timing examples**
*
* The following examples show various `timings` specifications.
* - `animate(500)` : Duration is 500 milliseconds.
* - `animate("1s")` : Duration is 1000 milliseconds.
* - `animate("100ms 0.5s")` : Duration is 100 milliseconds, delay is 500 milliseconds.
* - `animate("5s ease-in")` : Duration is 5000 milliseconds, easing in.
* - `animate("5s 10ms cubic-bezier(.17,.67,.88,.1)")` : Duration is 5000 milliseconds, delay is 10
* milliseconds, easing according to a bezier curve.
*
* **Style examples**
*
* The following example calls `style()` to set a single CSS style.
* ```typescript
* animate(500, style({ background: "red" }))
* ```
* The following example calls `keyframes()` to set a CSS style
* to different values for successive keyframes.
* ```typescript
* animate(500, keyframes(
* [
* style({ background: "blue" })),
* style({ background: "red" }))
* ])
* ```
*
* \@publicApi
* @param {?} timings Sets `AnimateTimings` for the parent animation.
* A string in the format "duration [delay] [easing]".
* - Duration and delay are expressed as a number and optional time unit,
* such as "1s" or "10ms" for one second and 10 milliseconds, respectively.
* The default unit is milliseconds.
* - The easing value controls how the animation accelerates and decelerates
* during its runtime. Value is one of `ease`, `ease-in`, `ease-out`,
* `ease-in-out`, or a `cubic-bezier()` function call.
* If not supplied, no easing is applied.
*
* For example, the string "1s 100ms ease-out" specifies a duration of
* 1000 milliseconds, and delay of 100 ms, and the "ease-out" easing style,
* which decelerates near the end of the duration.
* @param {?=} styles Sets AnimationStyles for the parent animation.
* A function call to either `style()` or `keyframes()`
* that returns a collection of CSS style entries to be applied to the parent animation.
* When null, uses the styles from the destination state.
* This is useful when describing an animation step that will complete an animation;
* see "Animating to the final state" in `transitions()`.
* @return {?} An object that encapsulates the animation step.
*
*/
function animate(timings) {
var styles = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
return {
type: 4
/* Animate */
,
styles: styles,
timings: timings
};
}
/**
* \@description Defines a list of animation steps to be run in parallel.
*
* \@usageNotes
* Grouped animations are useful when a series of styles must be
* animated at different starting times and closed off at different ending times.
*
* When called within a `sequence()` or a
* `transition()` call, does not continue to the next
* instruction until all of the inner animation steps have completed.
*
* \@publicApi
* @param {?} steps An array of animation step objects.
* - When steps are defined by `style()` or `animate()`
* function calls, each call within the group is executed instantly.
* - To specify offset styles to be applied at a later time, define steps with
* `keyframes()`, or use `animate()` calls with a delay value.
* For example:
*
* ```typescript
* group([
* animate("1s", style({ background: "black" })),
* animate("2s", style({ color: "white" }))
* ])
* ```
*
* @param {?=} options An options object containing a delay and
* developer-defined parameters that provide styling defaults and
* can be overridden on invocation.
*
* @return {?} An object that encapsulates the group data.
*
*/
function group(steps) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
return {
type: 3
/* Group */
,
steps: steps,
options: options
};
}
/**
* Defines a list of animation steps to be run sequentially, one by one.
*
* \@usageNotes
* When you pass an array of steps to a
* `transition()` call, the steps run sequentially by default.
* Compare this to the `{\@link animations/group group()}` call, which runs animation steps in
* parallel.
*
* When a sequence is used within a `{\@link animations/group group()}` or a `transition()` call,
* execution continues to the next instruction only after each of the inner animation
* steps have completed.
*
* \@publicApi
*
* @param {?} steps An array of animation step objects.
* - Steps defined by `style()` calls apply the styling data immediately.
* - Steps defined by `animate()` calls apply the styling data over time
* as specified by the timing data.
*
* ```typescript
* sequence([
* style({ opacity: 0 }),
* animate("1s", style({ opacity: 1 }))
* ])
* ```
*
* @param {?=} options An options object containing a delay and
* developer-defined parameters that provide styling defaults and
* can be overridden on invocation.
*
* @return {?} An object that encapsulates the sequence data.
*
*/
function sequence(steps) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
return {
type: 2
/* Sequence */
,
steps: steps,
options: options
};
}
/**
* Declares a key/value object containing CSS properties/styles that
* can then be used for an animation `state`, within an animation `sequence`,
* or as styling data for calls to `animate()` and `keyframes()`.
*
* \@usageNotes
* The following examples create animation styles that collect a set of
* CSS property values:
*
* ```typescript
* // string values for CSS properties
* style({ background: "red", color: "blue" })
*
* // numerical pixel values
* style({ width: 100, height: 0 })
* ```
*
* The following example uses auto-styling to allow a component to animate from
* a height of 0 up to the height of the parent element:
*
* ```
* style({ height: 0 }),
* animate("1s", style({ height: "*" }))
* ```
*
* \@publicApi
*
* @param {?} tokens A set of CSS styles or HTML styles associated with an animation state.
* The value can be any of the following:
* - A key-value style pair associating a CSS property with a value.
* - An array of key-value style pairs.
* - An asterisk (*), to use auto-styling, where styles are derived from the element
* being animated and applied to the animation when it starts.
*
* Auto-styling can be used to define a state that depends on layout or other
* environmental factors.
*
* @return {?} An object that encapsulates the style data.
*
*/
function style(tokens) {
return {
type: 6
/* Style */
,
styles: tokens,
offset: null
};
}
/**
* Declares an animation state within a trigger attached to an element.
*
* \@usageNotes
* Use the `trigger()` function to register states to an animation trigger.
* Use the `transition()` function to animate between states.
* When a state is active within a component, its associated styles persist on the element,
* even when the animation ends.
*
* \@publicApi
*
* @param {?} name One or more names for the defined state in a comma-separated string.
* The following reserved state names can be supplied to define a style for specific use
* cases:
*
* - `void` You can associate styles with this name to be used when
* the element is detached from the application. For example, when an `ngIf` evaluates
* to false, the state of the associated element is void.
* - `*` (asterisk) Indicates the default state. You can associate styles with this name
* to be used as the fallback when the state that is being animated is not declared
* within the trigger.
*
* @param {?} styles A set of CSS styles associated with this state, created using the
* `style()` function.
* This set of styles persists on the element once the state has been reached.
* @param {?=} options Parameters that can be passed to the state when it is invoked.
* 0 or more key-value pairs.
* @return {?} An object that encapsulates the new state data.
*
*/
function state(name, styles, options) {
return {
type: 0
/* State */
,
name: name,
styles: styles,
options: options
};
}
/**
* Defines a set of animation styles, associating each style with an optional `offset` value.
*
* \@usageNotes
* Use with the `animate()` call. Instead of applying animations
* from the current state
* to the destination state, keyframes describe how each style entry is applied and at what point
* within the animation arc.
* Compare [CSS Keyframe Animations](https://www.w3schools.com/css/css3_animations.asp).
*
* ### Usage
*
* In the following example, the offset values describe
* when each `backgroundColor` value is applied. The color is red at the start, and changes to
* blue when 20% of the total time has elapsed.
*
* ```typescript
* // the provided offset values
* animate("5s", keyframes([
* style({ backgroundColor: "red", offset: 0 }),
* style({ backgroundColor: "blue", offset: 0.2 }),
* style({ backgroundColor: "orange", offset: 0.3 }),
* style({ backgroundColor: "black", offset: 1 })
* ]))
* ```
*
* If there are no `offset` values specified in the style entries, the offsets
* are calculated automatically.
*
* ```typescript
* animate("5s", keyframes([
* style({ backgroundColor: "red" }) // offset = 0
* style({ backgroundColor: "blue" }) // offset = 0.33
* style({ backgroundColor: "orange" }) // offset = 0.66
* style({ backgroundColor: "black" }) // offset = 1
* ]))
* ```
* \@publicApi
* @param {?} steps A set of animation styles with optional offset data.
* The optional `offset` value for a style specifies a percentage of the total animation
* time at which that style is applied.
* @return {?} An object that encapsulates the keyframes data.
*
*/
function keyframes(steps) {
return {
type: 5
/* Keyframes */
,
steps: steps
};
}
/**
* Declares an animation transition as a sequence of animation steps to run when a given
* condition is satisfied. The condition is a Boolean expression or function that compares
* the previous and current animation states, and returns true if this transition should occur.
* When the state criteria of a defined transition are met, the associated animation is
* triggered.
*
* \@usageNotes
* The template associated with a component binds an animation trigger to an element.
*
* ```HTML
*
* ...
* ```
*
* All transitions are defined within an animation trigger,
* along with named states that the transitions change to and from.
*
* ```typescript
* trigger("myAnimationTrigger", [
* // define states
* state("on", style({ background: "green" })),
* state("off", style({ background: "grey" })),
* ...]
* ```
*
* Note that when you call the `sequence()` function within a `{\@link animations/group group()}`
* or a `transition()` call, execution does not continue to the next instruction
* until each of the inner animation steps have completed.
*
* ### Syntax examples
*
* The following examples define transitions between the two defined states (and default states),
* using various options:
*
* ```typescript
* // Transition occurs when the state value
* // bound to "myAnimationTrigger" changes from "on" to "off"
* transition("on => off", animate(500))
* // Run the same animation for both directions
* transition("on <=> off", animate(500))
* // Define multiple state-change pairs separated by commas
* transition("on => off, off => void", animate(500))
* ```
*
* ### Special values for state-change expressions
*
* - Catch-all state change for when an element is inserted into the page and the
* destination state is unknown:
*
* ```typescript
* transition("void => *", [
* style({ opacity: 0 }),
* animate(500)
* ])
* ```
*
* - Capture a state change between any states:
*
* `transition("* => *", animate("1s 0s"))`
*
* - Entry and exit transitions:
*
* ```typescript
* transition(":enter", [
* style({ opacity: 0 }),
* animate(500, style({ opacity: 1 }))
* ]),
* transition(":leave", [
* animate(500, style({ opacity: 0 }))
* ])
* ```
*
* - Use `:increment` and `:decrement` to initiate transitions:
*
* ```typescript
* transition(":increment", group([
* query(':enter', [
* style({ left: '100%' }),
* animate('0.5s ease-out', style('*'))
* ]),
* query(':leave', [
* animate('0.5s ease-out', style({ left: '-100%' }))
* ])
* ]))
*
* transition(":decrement", group([
* query(':enter', [
* style({ left: '100%' }),
* animate('0.5s ease-out', style('*'))
* ]),
* query(':leave', [
* animate('0.5s ease-out', style({ left: '-100%' }))
* ])
* ]))
* ```
*
* ### State-change functions
*
* Here is an example of a `fromState` specified as a state-change function that invokes an
* animation when true:
*
* ```typescript
* transition((fromState, toState) =>
* {
* return fromState == "off" && toState == "on";
* },
* animate("1s 0s"))
* ```
*
* ### Animating to the final state
*
* If the final step in a transition is a call to `animate()` that uses a timing value
* with no style data, that step is automatically considered the final animation arc,
* for the element to reach the final state. Angular automatically adds or removes
* CSS styles to ensure that the element is in the correct final state.
*
* The following example defines a transition that starts by hiding the element,
* then makes sure that it animates properly to whatever state is currently active for trigger:
*
* ```typescript
* transition("void => *", [
* style({ opacity: 0 }),
* animate(500)
* ])
* ```
* ### Boolean value matching
* If a trigger binding value is a Boolean, it can be matched using a transition expression
* that compares true and false or 1 and 0. For example:
*
* ```
* // in the template
* ...
* // in the component metadata
* trigger('openClose', [
* state('true', style({ height: '*' })),
* state('false', style({ height: '0px' })),
* transition('false <=> true', animate(500))
* ])
* ```
*
* \@publicApi
*
* @param {?} stateChangeExpr A Boolean expression or function that compares the previous and current
* animation states, and returns true if this transition should occur. Note that "true" and "false"
* match 1 and 0, respectively. An expression is evaluated each time a state change occurs in the
* animation trigger element.
* The animation steps run when the expression evaluates to true.
*
* - A state-change string takes the form "state1 => state2", where each side is a defined animation
* state, or an asterix (*) to refer to a dynamic start or end state.
* - The expression string can contain multiple comma-separated statements;
* for example "state1 => state2, state3 => state4".
* - Special values `:enter` and `:leave` initiate a transition on the entry and exit states,
* equivalent to "void => *" and "* => void".
* - Special values `:increment` and `:decrement` initiate a transition when a numeric value has
* increased or decreased in value.
* - A function is executed each time a state change occurs in the animation trigger element.
* The animation steps run when the function returns true.
*
* @param {?} steps One or more animation objects, as returned by the `animate()` or
* `sequence()` function, that form a transformation from one state to another.
* A sequence is used by default when you pass an array.
* @param {?=} options An options object that can contain a delay value for the start of the animation,
* and additional developer-defined parameters. Provided values for additional parameters are used
* as defaults, and override values can be passed to the caller on invocation.
* @return {?} An object that encapsulates the transition data.
*
*/
function transition(stateChangeExpr, steps) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
return {
type: 1
/* Transition */
,
expr: stateChangeExpr,
animation: steps,
options: options
};
}
/**
* Produces a reusable animation that can be invoked in another animation or sequence,
* by calling the `useAnimation()` function.
*
* \@usageNotes
* The following example defines a reusable animation, providing some default parameter
* values.
*
* ```typescript
* var fadeAnimation = animation([
* style({ opacity: '{{ start }}' }),
* animate('{{ time }}',
* style({ opacity: '{{ end }}'}))
* ],
* { params: { time: '1000ms', start: 0, end: 1 }});
* ```
*
* The following invokes the defined animation with a call to `useAnimation()`,
* passing in override parameter values.
*
* ```js
* useAnimation(fadeAnimation, {
* params: {
* time: '2s',
* start: 1,
* end: 0
* }
* })
* ```
*
* If any of the passed-in parameter values are missing from this call,
* the default values are used. If one or more parameter values are missing before a step is
* animated, `useAnimation()` throws an error.
*
* \@publicApi
* @param {?} steps One or more animation objects, as returned by the `animate()`
* or `sequence()` function, that form a transformation from one state to another.
* A sequence is used by default when you pass an array.
* @param {?=} options An options object that can contain a delay value for the start of the
* animation, and additional developer-defined parameters.
* Provided values for additional parameters are used as defaults,
* and override values can be passed to the caller on invocation.
* @return {?} An object that encapsulates the animation data.
*
*/
function animation(steps) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
return {
type: 8
/* Reference */
,
animation: steps,
options: options
};
}
/**
* Executes a queried inner animation element within an animation sequence.
*
* \@usageNotes
* Each time an animation is triggered in Angular, the parent animation
* has priority and any child animations are blocked. In order
* for a child animation to run, the parent animation must query each of the elements
* containing child animations, and run them using this function.
*
* Note that this feature is designed to be used with `query()` and it will only work
* with animations that are assigned using the Angular animation library. CSS keyframes
* and transitions are not handled by this API.
*
* \@publicApi
* @param {?=} options An options object that can contain a delay value for the start of the
* animation, and additional override values for developer-defined parameters.
* @return {?} An object that encapsulates the child animation data.
*
*/
function animateChild() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
return {
type: 9
/* AnimateChild */
,
options: options
};
}
/**
* Starts a reusable animation that is created using the `animation()` function.
*
* \@publicApi
* @param {?} animation The reusable animation to start.
* @param {?=} options An options object that can contain a delay value for the start of
* the animation, and additional override values for developer-defined parameters.
* @return {?} An object that contains the animation parameters.
*
*/
function useAnimation(animation) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
return {
type: 10
/* AnimateRef */
,
animation: animation,
options: options
};
}
/**
* Finds one or more inner elements within the current element that is
* being animated within a sequence. Use with `animate()`.
*
* \@usageNotes
* Tokens can be merged into a combined query selector string. For example:
*
* ```typescript
* query(':self, .record:enter, .record:leave, \@subTrigger', [...])
* ```
*
* The `query()` function collects multiple elements and works internally by using
* `element.querySelectorAll`. Use the `limit` field of an options object to limit
* the total number of items to be collected. For example:
*
* ```js
* query('div', [
* animate(...),
* animate(...)
* ], { limit: 1 })
* ```
*
* By default, throws an error when zero items are found. Set the
* `optional` flag to ignore this error. For example:
*
* ```js
* query('.some-element-that-may-not-be-there', [
* animate(...),
* animate(...)
* ], { optional: true })
* ```
*
* ### Usage Example
*
* The following example queries for inner elements and animates them
* individually using `animate()`.
*
* ```typescript
* \@Component({
* selector: 'inner',
* template: `
*
*
Title
*
* Blah blah blah
*
*
* `,
* animations: [
* trigger('queryAnimation', [
* transition('* => goAnimate', [
* // hide the inner elements
* query('h1', style({ opacity: 0 })),
* query('.content', style({ opacity: 0 })),
*
* // animate the inner elements in, one by one
* query('h1', animate(1000, style({ opacity: 1 }))),
* query('.content', animate(1000, style({ opacity: 1 }))),
* ])
* ])
* ]
* })
* class Cmp {
* exp = '';
*
* goAnimate() {
* this.exp = 'goAnimate';
* }
* }
* ```
*
* \@publicApi
* @param {?} selector The element to query, or a set of elements that contain Angular-specific
* characteristics, specified with one or more of the following tokens.
* - `query(":enter")` or `query(":leave")` : Query for newly inserted/removed elements.
* - `query(":animating")` : Query all currently animating elements.
* - `query("\@triggerName")` : Query elements that contain an animation trigger.
* - `query("\@*")` : Query all elements that contain an animation triggers.
* - `query(":self")` : Include the current element into the animation sequence.
*
* @param {?} animation One or more animation steps to apply to the queried element or elements.
* An array is treated as an animation sequence.
* @param {?=} options An options object. Use the 'limit' field to limit the total number of
* items to collect.
* @return {?} An object that encapsulates the query data.
*
*/
function query(selector, animation) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
return {
type: 11
/* Query */
,
selector: selector,
animation: animation,
options: options
};
}
/**
* Use within an animation `query()` call to issue a timing gap after
* each queried item is animated.
*
* \@usageNotes
* In the following example, a container element wraps a list of items stamped out
* by an `ngFor`. The container element contains an animation trigger that will later be set
* to query for each of the inner items.
*
* Each time items are added, the opacity fade-in animation runs,
* and each removed item is faded out.
* When either of these animations occur, the stagger effect is
* applied after each item's animation is started.
*
* ```html
*
* Show / Hide Items
*
*
* ```
*
* Here is the component code:
*
* ```typescript
* import {trigger, transition, style, animate, query, stagger} from '\@angular/animations';
* \@Component({
* templateUrl: 'list.component.html',
* animations: [
* trigger('listAnimation', [
* ...
* ])
* ]
* })
* class ListComponent {
* items = [];
*
* showItems() {
* this.items = [0,1,2,3,4];
* }
*
* hideItems() {
* this.items = [];
* }
*
* toggle() {
* this.items.length ? this.hideItems() : this.showItems();
* }
* }
* ```
*
* Here is the animation trigger code:
*
* ```typescript
* trigger('listAnimation', [
* transition('* => *', [ // each time the binding value changes
* query(':leave', [
* stagger(100, [
* animate('0.5s', style({ opacity: 0 }))
* ])
* ]),
* query(':enter', [
* style({ opacity: 0 }),
* stagger(100, [
* animate('0.5s', style({ opacity: 1 }))
* ])
* ])
* ])
* ])
* ```
*
* \@publicApi
* @param {?} timings A delay value.
* @param {?} animation One ore more animation steps.
* @return {?} An object that encapsulates the stagger data.
*
*/
function stagger(timings, animation) {
return {
type: 12
/* Stagger */
,
timings: timings,
animation: animation
};
}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/src/util.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @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 {?} cb
* @return {?}
*/
function scheduleMicroTask(cb) {
Promise.resolve(null).then(cb);
}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/src/players/animation_player.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Provides programmatic control of a reusable animation sequence,
* built using the `build()` method of `AnimationBuilder`. The `build()` method
* returns a factory, whose `create()` method instantiates and initializes this interface.
*
* @see `AnimationBuilder`
* @see `AnimationFactory`
* @see `animate()`
*
* \@publicApi
* @record
*/
function AnimationPlayer() {}
if (false) {}
/**
* An empty programmatic controller for reusable animations.
* Used internally when animations are disabled, to avoid
* checking for the null case when an animation player is expected.
*
* @see `animate()`
* @see `AnimationPlayer`
* @see `GroupPlayer`
*
* \@publicApi
*/
var NoopAnimationPlayer = /*#__PURE__*/function () {
/**
* @param {?=} duration
* @param {?=} delay
*/
function NoopAnimationPlayer() {
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
_classCallCheck(this, NoopAnimationPlayer);
this._onDoneFns = [];
this._onStartFns = [];
this._onDestroyFns = [];
this._started = false;
this._destroyed = false;
this._finished = false;
this.parentPlayer = null;
this.totalTime = duration + delay;
}
/**
* @private
* @return {?}
*/
_createClass2(NoopAnimationPlayer, [{
key: "_onFinish",
value: function _onFinish() {
if (!this._finished) {
this._finished = true;
this._onDoneFns.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
this._onDoneFns = [];
}
}
/**
* @param {?} fn
* @return {?}
*/
}, {
key: "onStart",
value: function onStart(fn) {
this._onStartFns.push(fn);
}
/**
* @param {?} fn
* @return {?}
*/
}, {
key: "onDone",
value: function onDone(fn) {
this._onDoneFns.push(fn);
}
/**
* @param {?} fn
* @return {?}
*/
}, {
key: "onDestroy",
value: function onDestroy(fn) {
this._onDestroyFns.push(fn);
}
/**
* @return {?}
*/
}, {
key: "hasStarted",
value: function hasStarted() {
return this._started;
}
/**
* @return {?}
*/
}, {
key: "init",
value: function init() {}
/**
* @return {?}
*/
}, {
key: "play",
value: function play() {
if (!this.hasStarted()) {
this._onStart();
this.triggerMicrotask();
}
this._started = true;
}
/**
* \@internal
* @return {?}
*/
}, {
key: "triggerMicrotask",
value: function triggerMicrotask() {
var _this2 = this;
scheduleMicroTask(
/**
* @return {?}
*/
function () {
return _this2._onFinish();
});
}
/**
* @private
* @return {?}
*/
}, {
key: "_onStart",
value: function _onStart() {
this._onStartFns.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
this._onStartFns = [];
}
/**
* @return {?}
*/
}, {
key: "pause",
value: function pause() {}
/**
* @return {?}
*/
}, {
key: "restart",
value: function restart() {}
/**
* @return {?}
*/
}, {
key: "finish",
value: function finish() {
this._onFinish();
}
/**
* @return {?}
*/
}, {
key: "destroy",
value: function destroy() {
if (!this._destroyed) {
this._destroyed = true;
if (!this.hasStarted()) {
this._onStart();
}
this.finish();
this._onDestroyFns.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
this._onDestroyFns = [];
}
}
/**
* @return {?}
*/
}, {
key: "reset",
value: function reset() {}
/**
* @param {?} position
* @return {?}
*/
}, {
key: "setPosition",
value: function setPosition(position) {}
/**
* @return {?}
*/
}, {
key: "getPosition",
value: function getPosition() {
return 0;
}
/**
* \@internal
* @param {?} phaseName
* @return {?}
*/
}, {
key: "triggerCallback",
value: function triggerCallback(phaseName) {
/** @type {?} */
var methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
methods.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
methods.length = 0;
}
}]);
return NoopAnimationPlayer;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/src/players/animation_group_player.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* A programmatic controller for a group of reusable animations.
* Used internally to control animations.
*
* @see `AnimationPlayer`
* @see `{\@link animations/group group()}`
*
*/
var AnimationGroupPlayer = /*#__PURE__*/function () {
/**
* @param {?} _players
*/
function AnimationGroupPlayer(_players) {
var _this3 = this;
_classCallCheck(this, AnimationGroupPlayer);
this._onDoneFns = [];
this._onStartFns = [];
this._finished = false;
this._started = false;
this._destroyed = false;
this._onDestroyFns = [];
this.parentPlayer = null;
this.totalTime = 0;
this.players = _players;
/** @type {?} */
var doneCount = 0;
/** @type {?} */
var destroyCount = 0;
/** @type {?} */
var startCount = 0;
/** @type {?} */
var total = this.players.length;
if (total == 0) {
scheduleMicroTask(
/**
* @return {?}
*/
function () {
return _this3._onFinish();
});
} else {
this.players.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
player.onDone(
/**
* @return {?}
*/
function () {
if (++doneCount == total) {
_this3._onFinish();
}
});
player.onDestroy(
/**
* @return {?}
*/
function () {
if (++destroyCount == total) {
_this3._onDestroy();
}
});
player.onStart(
/**
* @return {?}
*/
function () {
if (++startCount == total) {
_this3._onStart();
}
});
});
}
this.totalTime = this.players.reduce(
/**
* @param {?} time
* @param {?} player
* @return {?}
*/
function (time, player) {
return Math.max(time, player.totalTime);
}, 0);
}
/**
* @private
* @return {?}
*/
_createClass2(AnimationGroupPlayer, [{
key: "_onFinish",
value: function _onFinish() {
if (!this._finished) {
this._finished = true;
this._onDoneFns.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
this._onDoneFns = [];
}
}
/**
* @return {?}
*/
}, {
key: "init",
value: function init() {
this.players.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
return player.init();
});
}
/**
* @param {?} fn
* @return {?}
*/
}, {
key: "onStart",
value: function onStart(fn) {
this._onStartFns.push(fn);
}
/**
* @private
* @return {?}
*/
}, {
key: "_onStart",
value: function _onStart() {
if (!this.hasStarted()) {
this._started = true;
this._onStartFns.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
this._onStartFns = [];
}
}
/**
* @param {?} fn
* @return {?}
*/
}, {
key: "onDone",
value: function onDone(fn) {
this._onDoneFns.push(fn);
}
/**
* @param {?} fn
* @return {?}
*/
}, {
key: "onDestroy",
value: function onDestroy(fn) {
this._onDestroyFns.push(fn);
}
/**
* @return {?}
*/
}, {
key: "hasStarted",
value: function hasStarted() {
return this._started;
}
/**
* @return {?}
*/
}, {
key: "play",
value: function play() {
if (!this.parentPlayer) {
this.init();
}
this._onStart();
this.players.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
return player.play();
});
}
/**
* @return {?}
*/
}, {
key: "pause",
value: function pause() {
this.players.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
return player.pause();
});
}
/**
* @return {?}
*/
}, {
key: "restart",
value: function restart() {
this.players.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
return player.restart();
});
}
/**
* @return {?}
*/
}, {
key: "finish",
value: function finish() {
this._onFinish();
this.players.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
return player.finish();
});
}
/**
* @return {?}
*/
}, {
key: "destroy",
value: function destroy() {
this._onDestroy();
}
/**
* @private
* @return {?}
*/
}, {
key: "_onDestroy",
value: function _onDestroy() {
if (!this._destroyed) {
this._destroyed = true;
this._onFinish();
this.players.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
return player.destroy();
});
this._onDestroyFns.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
this._onDestroyFns = [];
}
}
/**
* @return {?}
*/
}, {
key: "reset",
value: function reset() {
this.players.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
return player.reset();
});
this._destroyed = false;
this._finished = false;
this._started = false;
}
/**
* @param {?} p
* @return {?}
*/
}, {
key: "setPosition",
value: function setPosition(p) {
/** @type {?} */
var timeAtPosition = p * this.totalTime;
this.players.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
/** @type {?} */
var position = player.totalTime ? Math.min(1, timeAtPosition / player.totalTime) : 1;
player.setPosition(position);
});
}
/**
* @return {?}
*/
}, {
key: "getPosition",
value: function getPosition() {
/** @type {?} */
var min = 0;
this.players.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
/** @type {?} */
var p = player.getPosition();
min = Math.min(p, min);
});
return min;
}
/**
* @return {?}
*/
}, {
key: "beforeDestroy",
value: function beforeDestroy() {
this.players.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
if (player.beforeDestroy) {
player.beforeDestroy();
}
});
}
/**
* \@internal
* @param {?} phaseName
* @return {?}
*/
}, {
key: "triggerCallback",
value: function triggerCallback(phaseName) {
/** @type {?} */
var methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
methods.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
methods.length = 0;
}
}]);
return AnimationGroupPlayer;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/src/private_export.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var ɵPRE_STYLE = '!';
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/src/animations.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/public_api.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/index.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Generated bundle index. Do not edit.
*/
//# sourceMappingURL=animations.js.map
/***/
},
/***/
"./node_modules/@angular/animations/fesm2015/browser.js":
/*!**************************************************************!*\
!*** ./node_modules/@angular/animations/fesm2015/browser.js ***!
\**************************************************************/
/*! exports provided: AnimationDriver, ɵAnimation, ɵAnimationEngine, ɵAnimationStyleNormalizer, ɵCssKeyframesDriver, ɵCssKeyframesPlayer, ɵNoopAnimationDriver, ɵNoopAnimationStyleNormalizer, ɵWebAnimationsDriver, ɵWebAnimationsPlayer, ɵWebAnimationsStyleNormalizer, ɵallowPreviousPlayerStylesMerge, ɵangular_packages_animations_browser_browser_a, ɵcontainsElement, ɵinvokeQuery, ɵmatchesElement, ɵsupportsWebAnimations, ɵvalidateStyleProperty */
/***/
function node_modulesAngularAnimationsFesm2015BrowserJs(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "AnimationDriver", function () {
return AnimationDriver;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵAnimation", function () {
return Animation;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵAnimationEngine", function () {
return AnimationEngine;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵAnimationStyleNormalizer", function () {
return AnimationStyleNormalizer;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵCssKeyframesDriver", function () {
return CssKeyframesDriver;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵCssKeyframesPlayer", function () {
return CssKeyframesPlayer;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵNoopAnimationDriver", function () {
return NoopAnimationDriver;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵNoopAnimationStyleNormalizer", function () {
return NoopAnimationStyleNormalizer;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵWebAnimationsDriver", function () {
return WebAnimationsDriver;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵWebAnimationsPlayer", function () {
return WebAnimationsPlayer;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵWebAnimationsStyleNormalizer", function () {
return WebAnimationsStyleNormalizer;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵallowPreviousPlayerStylesMerge", function () {
return allowPreviousPlayerStylesMerge;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵangular_packages_animations_browser_browser_a", function () {
return SpecialCasedStyles;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵcontainsElement", function () {
return _containsElement;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵinvokeQuery", function () {
return invokeQuery;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵmatchesElement", function () {
return _matchesElement;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵsupportsWebAnimations", function () {
return supportsWebAnimations;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵvalidateStyleProperty", function () {
return _validateStyleProperty;
});
/* harmony import */
var _angular_animations__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
/*! @angular/animations */
"./node_modules/@angular/animations/fesm2015/animations.js");
/* harmony import */
var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
/*! @angular/core */
"./node_modules/@angular/core/fesm2015/core.js");
/**
* @license Angular v9.1.13
* (c) 2010-2020 Google LLC. https://angular.io/
* License: MIT
*/
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/render/shared.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @return {?}
*/
function isBrowser() {
return typeof window !== 'undefined' && typeof window.document !== 'undefined';
}
/**
* @return {?}
*/
function isNode() {
// Checking only for `process` isn't enough to identify whether or not we're in a Node
// environment, because Webpack by default will polyfill the `process`. While we can discern
// that Webpack polyfilled it by looking at `process.browser`, it's very Webpack-specific and
// might not be future-proof. Instead we look at the stringified version of `process` which
// is `[object process]` in Node and `[object Object]` when polyfilled.
return typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';
}
/**
* @param {?} players
* @return {?}
*/
function optimizeGroupPlayer(players) {
switch (players.length) {
case 0:
return new _angular_animations__WEBPACK_IMPORTED_MODULE_0__["NoopAnimationPlayer"]();
case 1:
return players[0];
default:
return new _angular_animations__WEBPACK_IMPORTED_MODULE_0__["ɵAnimationGroupPlayer"](players);
}
}
/**
* @param {?} driver
* @param {?} normalizer
* @param {?} element
* @param {?} keyframes
* @param {?=} preStyles
* @param {?=} postStyles
* @return {?}
*/
function normalizeKeyframes(driver, normalizer, element, keyframes) {
var preStyles = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
var postStyles = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
/** @type {?} */
var errors = [];
/** @type {?} */
var normalizedKeyframes = [];
/** @type {?} */
var previousOffset = -1;
/** @type {?} */
var previousKeyframe = null;
keyframes.forEach(
/**
* @param {?} kf
* @return {?}
*/
/**
* @param {?} kf
* @return {?}
*/
function (kf) {
/** @type {?} */
var offset =
/** @type {?} */
kf['offset'];
/** @type {?} */
var isSameOffset = offset == previousOffset;
/** @type {?} */
var normalizedKeyframe = isSameOffset && previousKeyframe || {};
Object.keys(kf).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
/** @type {?} */
var normalizedProp = prop;
/** @type {?} */
var normalizedValue = kf[prop];
if (prop !== 'offset') {
normalizedProp = normalizer.normalizePropertyName(normalizedProp, errors);
switch (normalizedValue) {
case _angular_animations__WEBPACK_IMPORTED_MODULE_0__["ɵPRE_STYLE"]:
normalizedValue = preStyles[prop];
break;
case _angular_animations__WEBPACK_IMPORTED_MODULE_0__["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) {
/** @type {?} */
var LINE_START = '\n - ';
throw new Error("Unable to animate due to the following errors:".concat(LINE_START).concat(errors.join(LINE_START)));
}
return normalizedKeyframes;
}
/**
* @param {?} player
* @param {?} eventName
* @param {?} event
* @param {?} callback
* @return {?}
*/
function listenOnPlayer(player, eventName, event, callback) {
switch (eventName) {
case 'start':
player.onStart(
/**
* @return {?}
*/
function () {
return callback(event && copyAnimationEvent(event, 'start', player));
});
break;
case 'done':
player.onDone(
/**
* @return {?}
*/
function () {
return callback(event && copyAnimationEvent(event, 'done', player));
});
break;
case 'destroy':
player.onDestroy(
/**
* @return {?}
*/
function () {
return callback(event && copyAnimationEvent(event, 'destroy', player));
});
break;
}
}
/**
* @param {?} e
* @param {?} phaseName
* @param {?} player
* @return {?}
*/
function copyAnimationEvent(e, phaseName, player) {
/** @type {?} */
var totalTime = player.totalTime;
/** @type {?} */
var disabled =
/** @type {?} */
player.disabled ? true : false;
/** @type {?} */
var event = makeAnimationEvent(e.element, e.triggerName, e.fromState, e.toState, phaseName || e.phaseName, totalTime == undefined ? e.totalTime : totalTime, disabled);
/** @type {?} */
var data =
/** @type {?} */
e['_data'];
if (data != null) {
/** @type {?} */
event['_data'] = data;
}
return event;
}
/**
* @param {?} element
* @param {?} triggerName
* @param {?} fromState
* @param {?} toState
* @param {?=} phaseName
* @param {?=} totalTime
* @param {?=} disabled
* @return {?}
*/
function makeAnimationEvent(element, triggerName, fromState, toState) {
var phaseName = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : '';
var totalTime = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
var disabled = arguments.length > 6 ? arguments[6] : undefined;
return {
element: element,
triggerName: triggerName,
fromState: fromState,
toState: toState,
phaseName: phaseName,
totalTime: totalTime,
disabled: !!disabled
};
}
/**
* @param {?} map
* @param {?} key
* @param {?} defaultValue
* @return {?}
*/
function getOrSetAsInMap(map, key, defaultValue) {
/** @type {?} */
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;
}
/**
* @param {?} command
* @return {?}
*/
function parseTimelineCommand(command) {
/** @type {?} */
var separatorPos = command.indexOf(':');
/** @type {?} */
var id = command.substring(1, separatorPos);
/** @type {?} */
var action = command.substr(separatorPos + 1);
return [id, action];
}
/** @type {?} */
var _contains =
/**
* @param {?} elm1
* @param {?} elm2
* @return {?}
*/
function _contains(elm1, elm2) {
return false;
};
var ɵ0 = _contains;
/** @type {?} */
var _matches =
/**
* @param {?} element
* @param {?} selector
* @return {?}
*/
function _matches(element, selector) {
return false;
};
var ɵ1 = _matches;
/** @type {?} */
var _query =
/**
* @param {?} element
* @param {?} selector
* @param {?} multi
* @return {?}
*/
function _query(element, selector, multi) {
return [];
};
var ɵ2 = _query; // Define utility methods for browsers and platform-server(domino) where Element
// and utility methods exist.
/** @type {?} */
var _isNode = /*@__PURE__*/isNode();
if (_isNode || typeof Element !== 'undefined') {
// this is well supported in all browsers
_contains =
/**
* @param {?} elm1
* @param {?} elm2
* @return {?}
*/
function _contains(elm1, elm2) {
return (
/** @type {?} */
elm1.contains(elm2)
);
};
_matches = /*@__PURE__*/
/**
* @return {?}
*/
function () {
if (_isNode || Element.prototype.matches) {
return (
/**
* @param {?} element
* @param {?} selector
* @return {?}
*/
function (element, selector) {
return element.matches(selector);
}
);
} else {
/** @type {?} */
var proto =
/** @type {?} */
Element.prototype;
/** @type {?} */
var fn = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector;
if (fn) {
return (
/**
* @param {?} element
* @param {?} selector
* @return {?}
*/
function (element, selector) {
return fn.apply(element, [selector]);
}
);
} else {
return _matches;
}
}
}();
_query =
/**
* @param {?} element
* @param {?} selector
* @param {?} multi
* @return {?}
*/
function _query(element, selector, multi) {
/** @type {?} */
var results = [];
if (multi) {
results.push.apply(results, _toConsumableArray(element.querySelectorAll(selector)));
} else {
/** @type {?} */
var elm = element.querySelector(selector);
if (elm) {
results.push(elm);
}
}
return results;
};
}
/**
* @param {?} prop
* @return {?}
*/
function containsVendorPrefix(prop) {
// Webkit is the only real popular vendor prefix nowadays
// cc: http://shouldiprefix.com/
return prop.substring(1, 6) == 'ebkit'; // webkit or Webkit
}
/** @type {?} */
var _CACHED_BODY = null;
/** @type {?} */
var _IS_WEBKIT = false;
/**
* @param {?} prop
* @return {?}
*/
function _validateStyleProperty(prop) {
if (!_CACHED_BODY) {
_CACHED_BODY = getBodyNode() || {};
_IS_WEBKIT =
/** @type {?} */
_CACHED_BODY.style ? 'WebkitAppearance' in
/** @type {?} */
_CACHED_BODY.style : false;
}
/** @type {?} */
var result = true;
if (
/** @type {?} */
_CACHED_BODY.style && !containsVendorPrefix(prop)) {
result = prop in
/** @type {?} */
_CACHED_BODY.style;
if (!result && _IS_WEBKIT) {
/** @type {?} */
var camelProp = 'Webkit' + prop.charAt(0).toUpperCase() + prop.substr(1);
result = camelProp in
/** @type {?} */
_CACHED_BODY.style;
}
}
return result;
}
/**
* @return {?}
*/
function getBodyNode() {
if (typeof document != 'undefined') {
return document.body;
}
return null;
}
/** @type {?} */
var _matchesElement = _matches;
/** @type {?} */
var _containsElement = _contains;
/** @type {?} */
var invokeQuery = _query;
/**
* @param {?} object
* @return {?}
*/
function hypenatePropsObject(object) {
/** @type {?} */
var newObj = {};
Object.keys(object).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
/** @type {?} */
var newProp = prop.replace(/([a-z])([A-Z])/g, '$1-$2');
newObj[newProp] = object[prop];
});
return newObj;
}
var NoopAnimationDriver = /*@__PURE__*/function () {
var NoopAnimationDriver = /*#__PURE__*/function () {
function NoopAnimationDriver() {
_classCallCheck(this, NoopAnimationDriver);
}
_createClass2(NoopAnimationDriver, [{
key: "validateStyleProperty",
value:
/**
* @param {?} prop
* @return {?}
*/
function validateStyleProperty(prop) {
return _validateStyleProperty(prop);
}
/**
* @param {?} element
* @param {?} selector
* @return {?}
*/
}, {
key: "matchesElement",
value: function matchesElement(element, selector) {
return _matchesElement(element, selector);
}
/**
* @param {?} elm1
* @param {?} elm2
* @return {?}
*/
}, {
key: "containsElement",
value: function containsElement(elm1, elm2) {
return _containsElement(elm1, elm2);
}
/**
* @param {?} element
* @param {?} selector
* @param {?} multi
* @return {?}
*/
}, {
key: "query",
value: function query(element, selector, multi) {
return invokeQuery(element, selector, multi);
}
/**
* @param {?} element
* @param {?} prop
* @param {?=} defaultValue
* @return {?}
*/
}, {
key: "computeStyle",
value: function computeStyle(element, prop, defaultValue) {
return defaultValue || '';
}
/**
* @param {?} element
* @param {?} keyframes
* @param {?} duration
* @param {?} delay
* @param {?} easing
* @param {?=} previousPlayers
* @param {?=} scrubberAccessRequested
* @return {?}
*/
}, {
key: "animate",
value: function animate(element, keyframes, duration, delay, easing) {
var previousPlayers = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : [];
var scrubberAccessRequested = arguments.length > 6 ? arguments[6] : undefined;
return new _angular_animations__WEBPACK_IMPORTED_MODULE_0__["NoopAnimationPlayer"](duration, delay);
}
}]);
return NoopAnimationDriver;
}();
NoopAnimationDriver.ɵfac = function NoopAnimationDriver_Factory(t) {
return new (t || NoopAnimationDriver)();
};
NoopAnimationDriver.ɵprov = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵɵdefineInjectable"]({
token: NoopAnimationDriver,
factory: NoopAnimationDriver.ɵfac
});
return NoopAnimationDriver;
}();
var AnimationDriver = /*@__PURE__*/function () {
var AnimationDriver = function AnimationDriver() {
_classCallCheck(this, AnimationDriver);
};
AnimationDriver.NOOP = /*@__PURE__*/new NoopAnimationDriver();
return AnimationDriver;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/util.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var ONE_SECOND = 1000;
/** @type {?} */
var SUBSTITUTION_EXPR_START = '{{';
/** @type {?} */
var SUBSTITUTION_EXPR_END = '}}';
/** @type {?} */
var ENTER_CLASSNAME = 'ng-enter';
/** @type {?} */
var LEAVE_CLASSNAME = 'ng-leave';
/** @type {?} */
var ENTER_SELECTOR = '.ng-enter';
/** @type {?} */
var LEAVE_SELECTOR = '.ng-leave';
/** @type {?} */
var NG_TRIGGER_CLASSNAME = 'ng-trigger';
/** @type {?} */
var NG_TRIGGER_SELECTOR = '.ng-trigger';
/** @type {?} */
var NG_ANIMATING_CLASSNAME = 'ng-animating';
/** @type {?} */
var NG_ANIMATING_SELECTOR = '.ng-animating';
/**
* @param {?} value
* @return {?}
*/
function resolveTimingValue(value) {
if (typeof value == 'number') return value;
/** @type {?} */
var matches = value.match(/^(-?[\.\d]+)(m?s)/);
if (!matches || matches.length < 2) return 0;
return _convertTimeValueToMS(parseFloat(matches[1]), matches[2]);
}
/**
* @param {?} value
* @param {?} unit
* @return {?}
*/
function _convertTimeValueToMS(value, unit) {
switch (unit) {
case 's':
return value * ONE_SECOND;
default:
// ms or something else
return value;
}
}
/**
* @param {?} timings
* @param {?} errors
* @param {?=} allowNegativeValues
* @return {?}
*/
function resolveTiming(timings, errors, allowNegativeValues) {
return timings.hasOwnProperty('duration') ?
/** @type {?} */
timings : parseTimeExpression(
/** @type {?} */
timings, errors, allowNegativeValues);
}
/**
* @param {?} exp
* @param {?} errors
* @param {?=} allowNegativeValues
* @return {?}
*/
function parseTimeExpression(exp, errors, allowNegativeValues) {
/** @type {?} */
var regex = /^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i;
/** @type {?} */
var duration;
/** @type {?} */
var delay = 0;
/** @type {?} */
var easing = '';
if (typeof exp === 'string') {
/** @type {?} */
var matches = exp.match(regex);
if (matches === null) {
errors.push("The provided timing value \"".concat(exp, "\" is invalid."));
return {
duration: 0,
delay: 0,
easing: ''
};
}
duration = _convertTimeValueToMS(parseFloat(matches[1]), matches[2]);
/** @type {?} */
var delayMatch = matches[3];
if (delayMatch != null) {
delay = _convertTimeValueToMS(parseFloat(delayMatch), matches[4]);
}
/** @type {?} */
var easingVal = matches[5];
if (easingVal) {
easing = easingVal;
}
} else {
duration = exp;
}
if (!allowNegativeValues) {
/** @type {?} */
var containsErrors = false;
/** @type {?} */
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 \"".concat(exp, "\" is invalid."));
}
}
return {
duration: duration,
delay: delay,
easing: easing
};
}
/**
* @param {?} obj
* @param {?=} destination
* @return {?}
*/
function copyObj(obj) {
var destination = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
Object.keys(obj).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
destination[prop] = obj[prop];
});
return destination;
}
/**
* @param {?} styles
* @return {?}
*/
function normalizeStyles(styles) {
/** @type {?} */
var normalizedStyles = {};
if (Array.isArray(styles)) {
styles.forEach(
/**
* @param {?} data
* @return {?}
*/
/**
* @param {?} data
* @return {?}
*/
function (data) {
return copyStyles(data, false, normalizedStyles);
});
} else {
copyStyles(styles, false, normalizedStyles);
}
return normalizedStyles;
}
/**
* @param {?} styles
* @param {?} readPrototype
* @param {?=} destination
* @return {?}
*/
function copyStyles(styles, readPrototype) {
var destination = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
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;
}
/**
* @param {?} element
* @param {?} key
* @param {?} value
* @return {?}
*/
function getStyleAttributeString(element, key, value) {
// Return the key-value pair string to be added to the style attribute for the
// given CSS style key.
if (value) {
return key + ':' + value + ';';
} else {
return '';
}
}
/**
* @param {?} element
* @return {?}
*/
function writeStyleAttribute(element) {
// Read the style property of the element and manually reflect it to the
// style attribute. This is needed because Domino on platform-server doesn't
// understand the full set of allowed CSS properties and doesn't reflect some
// of them automatically.
/** @type {?} */
var styleAttrValue = '';
for (var i = 0; i < element.style.length; i++) {
/** @type {?} */
var key = element.style.item(i);
styleAttrValue += getStyleAttributeString(element, key, element.style.getPropertyValue(key));
}
for (var _key in element.style) {
// Skip internal Domino properties that don't need to be reflected.
if (!element.style.hasOwnProperty(_key) || _key.startsWith('_')) {
continue;
}
/** @type {?} */
var dashKey = camelCaseToDashCase(_key);
styleAttrValue += getStyleAttributeString(element, dashKey, element.style[_key]);
}
element.setAttribute('style', styleAttrValue);
}
/**
* @param {?} element
* @param {?} styles
* @param {?=} formerStyles
* @return {?}
*/
function setStyles(element, styles, formerStyles) {
if (element['style']) {
Object.keys(styles).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
/** @type {?} */
var camelProp = dashCaseToCamelCase(prop);
if (formerStyles && !formerStyles.hasOwnProperty(prop)) {
formerStyles[prop] = element.style[camelProp];
}
element.style[camelProp] = styles[prop];
}); // On the server set the 'style' attribute since it's not automatically reflected.
if (isNode()) {
writeStyleAttribute(element);
}
}
}
/**
* @param {?} element
* @param {?} styles
* @return {?}
*/
function eraseStyles(element, styles) {
if (element['style']) {
Object.keys(styles).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
/** @type {?} */
var camelProp = dashCaseToCamelCase(prop);
element.style[camelProp] = '';
}); // On the server set the 'style' attribute since it's not automatically reflected.
if (isNode()) {
writeStyleAttribute(element);
}
}
}
/**
* @param {?} steps
* @return {?}
*/
function normalizeAnimationEntry(steps) {
if (Array.isArray(steps)) {
if (steps.length == 1) return steps[0];
return Object(_angular_animations__WEBPACK_IMPORTED_MODULE_0__["sequence"])(steps);
}
return (
/** @type {?} */
steps
);
}
/**
* @param {?} value
* @param {?} options
* @param {?} errors
* @return {?}
*/
function validateStyleParams(value, options, errors) {
/** @type {?} */
var params = options.params || {};
/** @type {?} */
var matches = extractStyleParams(value);
if (matches.length) {
matches.forEach(
/**
* @param {?} varName
* @return {?}
*/
/**
* @param {?} varName
* @return {?}
*/
function (varName) {
if (!params.hasOwnProperty(varName)) {
errors.push("Unable to resolve the local animation param ".concat(varName, " in the given list of values"));
}
});
}
}
/** @type {?} */
var PARAM_REGEX = /*@__PURE__*/new RegExp("".concat(SUBSTITUTION_EXPR_START, "\\s*(.+?)\\s*").concat(SUBSTITUTION_EXPR_END), 'g');
/**
* @param {?} value
* @return {?}
*/
function extractStyleParams(value) {
/** @type {?} */
var params = [];
if (typeof value === 'string') {
/** @type {?} */
var match;
while (match = PARAM_REGEX.exec(value)) {
params.push(
/** @type {?} */
match[1]);
}
PARAM_REGEX.lastIndex = 0;
}
return params;
}
/**
* @param {?} value
* @param {?} params
* @param {?} errors
* @return {?}
*/
function interpolateParams(value, params, errors) {
/** @type {?} */
var original = value.toString();
/** @type {?} */
var str = original.replace(PARAM_REGEX,
/**
* @param {?} _
* @param {?} varName
* @return {?}
*/
function (_, varName) {
/** @type {?} */
var localVal = params[varName]; // this means that the value was never overridden by the data passed in by the user
if (!params.hasOwnProperty(varName)) {
errors.push("Please provide a value for the animation param ".concat(varName));
localVal = '';
}
return localVal.toString();
}); // we do this to assert that numeric values stay as they are
return str == original ? value : str;
}
/**
* @param {?} iterator
* @return {?}
*/
function iteratorToArray(iterator) {
/** @type {?} */
var arr = [];
/** @type {?} */
var item = iterator.next();
while (!item.done) {
arr.push(item.value);
item = iterator.next();
}
return arr;
}
/**
* @param {?} source
* @param {?} destination
* @return {?}
*/
function mergeAnimationOptions(source, destination) {
if (source.params) {
/** @type {?} */
var p0 = source.params;
if (!destination.params) {
destination.params = {};
}
/** @type {?} */
var p1 = destination.params;
Object.keys(p0).forEach(
/**
* @param {?} param
* @return {?}
*/
/**
* @param {?} param
* @return {?}
*/
function (param) {
if (!p1.hasOwnProperty(param)) {
p1[param] = p0[param];
}
});
}
return destination;
}
/** @type {?} */
var DASH_CASE_REGEXP = /-+([a-z0-9])/g;
/**
* @param {?} input
* @return {?}
*/
function dashCaseToCamelCase(input) {
return input.replace(DASH_CASE_REGEXP,
/**
* @param {...?} m
* @return {?}
*/
function () {
for (var _len = arguments.length, m = new Array(_len), _key2 = 0; _key2 < _len; _key2++) {
m[_key2] = arguments[_key2];
}
return m[1].toUpperCase();
});
}
/**
* @param {?} input
* @return {?}
*/
function camelCaseToDashCase(input) {
return input.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
}
/**
* @param {?} duration
* @param {?} delay
* @return {?}
*/
function allowPreviousPlayerStylesMerge(duration, delay) {
return duration === 0 || delay === 0;
}
/**
* @param {?} element
* @param {?} keyframes
* @param {?} previousStyles
* @return {?}
*/
function balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles) {
/** @type {?} */
var previousStyleProps = Object.keys(previousStyles);
if (previousStyleProps.length && keyframes.length) {
/** @type {?} */
var startingKeyframe = keyframes[0];
/** @type {?} */
var missingStyleProps = [];
previousStyleProps.forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
if (!startingKeyframe.hasOwnProperty(prop)) {
missingStyleProps.push(prop);
}
startingKeyframe[prop] = previousStyles[prop];
});
if (missingStyleProps.length) {
var _loop = function _loop() {
/** @type {?} */
var kf = keyframes[i];
missingStyleProps.forEach(
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
kf[prop] = computeStyle(element, prop);
});
};
// tslint:disable-next-line
for (var i = 1; i < keyframes.length; i++) {
_loop();
}
}
}
return keyframes;
}
/**
* @param {?} visitor
* @param {?} node
* @param {?} context
* @return {?}
*/
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 #".concat(node.type));
}
}
/**
* @param {?} element
* @param {?} prop
* @return {?}
*/
function computeStyle(element, prop) {
return (
/** @type {?} */
window.getComputedStyle(element)[prop]
);
}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/dsl/animation_transition_expr.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @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
* @type {?}
*/
var ANY_STATE = '*';
/**
* @param {?} transitionValue
* @param {?} errors
* @return {?}
*/
function parseTransitionExpr(transitionValue, errors) {
/** @type {?} */
var expressions = [];
if (typeof transitionValue == 'string') {
transitionValue.split(/\s*,\s*/).forEach(
/**
* @param {?} str
* @return {?}
*/
/**
* @param {?} str
* @return {?}
*/
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] == ':') {
/** @type {?} */
var result = parseAnimationAlias(eventStr, errors);
if (typeof result == 'function') {
expressions.push(result);
return;
}
eventStr = result;
}
/** @type {?} */
var match = eventStr.match(/^(\*|[-\w]+)\s*([=-]>)\s*(\*|[-\w]+)$/);
if (match == null || match.length < 4) {
errors.push("The provided transition expression \"".concat(eventStr, "\" is not supported"));
return expressions;
}
/** @type {?} */
var fromState = match[1];
/** @type {?} */
var separator = match[2];
/** @type {?} */
var toState = match[3];
expressions.push(makeLambdaFromStates(fromState, toState));
/** @type {?} */
var 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';
case ':increment':
return (
/**
* @param {?} fromState
* @param {?} toState
* @return {?}
*/
function (fromState, toState) {
return parseFloat(toState) > parseFloat(fromState);
}
);
case ':decrement':
return (
/**
* @param {?} fromState
* @param {?} toState
* @return {?}
*/
function (fromState, toState) {
return parseFloat(toState) < parseFloat(fromState);
}
);
default:
errors.push("The transition alias value \"".concat(alias, "\" is not supported"));
return '* => *';
}
} // DO NOT REFACTOR ... keep the follow set instantiations
// with the values intact (closure compiler for some reason
// removes follow-up lines that add the values outside of
// the constructor...
/** @type {?} */
var TRUE_BOOLEAN_VALUES = /*@__PURE__*/new Set(['true', '1']);
/** @type {?} */
var FALSE_BOOLEAN_VALUES = /*@__PURE__*/new Set(['false', '0']);
/**
* @param {?} lhs
* @param {?} rhs
* @return {?}
*/
function makeLambdaFromStates(lhs, rhs) {
/** @type {?} */
var LHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(lhs) || FALSE_BOOLEAN_VALUES.has(lhs);
/** @type {?} */
var RHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(rhs) || FALSE_BOOLEAN_VALUES.has(rhs);
return (
/**
* @param {?} fromState
* @param {?} toState
* @return {?}
*/
function (fromState, toState) {
/** @type {?} */
var lhsMatch = lhs == ANY_STATE || lhs == fromState;
/** @type {?} */
var 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;
}
);
}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/dsl/animation_ast_builder.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var SELF_TOKEN = ':self';
/** @type {?} */
var SELF_TOKEN_REGEX = /*@__PURE__*/new RegExp("s*".concat(SELF_TOKEN, "s*,?"), 'g');
/*
* [Validation]
* The visitor code below will traverse the animation AST generated by the animation verb functions
* (the output is a tree of objects) and attempt to perform a series of validations on the data. The
* following corner-cases will be validated:
*
* 1. Overlap of animations
* Given that a CSS property cannot be animated in more than one place at the same time, it's
* important that this behavior is detected and validated. The way in which this occurs is that
* each time a style property is examined, a string-map containing the property will be updated with
* the start and end times for when the property is used within an animation step.
*
* If there are two or more parallel animations that are currently running (these are invoked by the
* group()) on the same element then the validator will throw an error. Since the start/end timing
* values are collected for each property then if the current animation step is animating the same
* property and its timing values fall anywhere into the window of time that the property is
* currently being animated within then this is what causes an error.
*
* 2. Timing values
* The validator will validate to see if a timing value of `duration delay easing` or
* `durationNumber` is valid or not.
*
* (note that upon validation the code below will replace the timing data with an object containing
* {duration,delay,easing}.
*
* 3. Offset Validation
* Each of the style() calls are allowed to have an offset value when placed inside of keyframes().
* Offsets within keyframes() are considered valid when:
*
* - No offsets are used at all
* - Each style() entry contains an offset value
* - Each offset is between 0 and 1
* - Each offset is greater to or equal than the previous one
*
* Otherwise an error will be thrown.
*/
/**
* @param {?} driver
* @param {?} metadata
* @param {?} errors
* @return {?}
*/
function buildAnimationAst(driver, metadata, errors) {
return new AnimationAstBuilderVisitor(driver).build(metadata, errors);
}
/** @type {?} */
var ROOT_SELECTOR = '';
var AnimationAstBuilderVisitor = /*#__PURE__*/function () {
/**
* @param {?} _driver
*/
function AnimationAstBuilderVisitor(_driver) {
_classCallCheck(this, AnimationAstBuilderVisitor);
this._driver = _driver;
}
/**
* @param {?} metadata
* @param {?} errors
* @return {?}
*/
_createClass2(AnimationAstBuilderVisitor, [{
key: "build",
value: function build(metadata, errors) {
/** @type {?} */
var context = new AnimationAstBuilderContext(errors);
this._resetContextStyleTimingState(context);
return (
/** @type {?} */
visitDslNode(this, normalizeAnimationEntry(metadata), context)
);
}
/**
* @private
* @param {?} context
* @return {?}
*/
}, {
key: "_resetContextStyleTimingState",
value: function _resetContextStyleTimingState(context) {
context.currentQuerySelector = ROOT_SELECTOR;
context.collectedStyles = {};
context.collectedStyles[ROOT_SELECTOR] = {};
context.currentTime = 0;
}
/**
* @param {?} metadata
* @param {?} context
* @return {?}
*/
}, {
key: "visitTrigger",
value: function visitTrigger(metadata, context) {
var _this4 = this;
/** @type {?} */
var queryCount = context.queryCount = 0;
/** @type {?} */
var depCount = context.depCount = 0;
/** @type {?} */
var states = [];
/** @type {?} */
var transitions = [];
if (metadata.name.charAt(0) == '@') {
context.errors.push('animation triggers cannot be prefixed with an `@` sign (e.g. trigger(\'@foo\', [...]))');
}
metadata.definitions.forEach(
/**
* @param {?} def
* @return {?}
*/
/**
* @param {?} def
* @return {?}
*/
function (def) {
_this4._resetContextStyleTimingState(context);
if (def.type == 0
/* State */
) {
/** @type {?} */
var stateDef =
/** @type {?} */
def;
/** @type {?} */
var name = stateDef.name;
name.toString().split(/\s*,\s*/).forEach(
/**
* @param {?} n
* @return {?}
*/
/**
* @param {?} n
* @return {?}
*/
function (n) {
stateDef.name = n;
states.push(_this4.visitState(stateDef, context));
});
stateDef.name = name;
} else if (def.type == 1
/* Transition */
) {
/** @type {?} */
var transition = _this4.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 {?}
*/
}, {
key: "visitState",
value: function visitState(metadata, context) {
/** @type {?} */
var styleAst = this.visitStyle(metadata.styles, context);
/** @type {?} */
var astParams = metadata.options && metadata.options.params || null;
if (styleAst.containsDynamicStyles) {
/** @type {?} */
var missingSubs = new Set();
/** @type {?} */
var params = astParams || {};
styleAst.styles.forEach(
/**
* @param {?} value
* @return {?}
*/
/**
* @param {?} value
* @return {?}
*/
function (value) {
if (isObject(value)) {
/** @type {?} */
var stylesObj =
/** @type {?} */
value;
Object.keys(stylesObj).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
extractStyleParams(stylesObj[prop]).forEach(
/**
* @param {?} sub
* @return {?}
*/
/**
* @param {?} sub
* @return {?}
*/
function (sub) {
if (!params.hasOwnProperty(sub)) {
missingSubs.add(sub);
}
});
});
}
});
if (missingSubs.size) {
/** @type {?} */
var missingSubsArr = iteratorToArray(missingSubs.values());
context.errors.push("state(\"".concat(metadata.name, "\", ...) must define default values for all the following style substitutions: ").concat(missingSubsArr.join(', ')));
}
}
return {
type: 0
/* State */
,
name: metadata.name,
style: styleAst,
options: astParams ? {
params: astParams
} : null
};
}
/**
* @param {?} metadata
* @param {?} context
* @return {?}
*/
}, {
key: "visitTransition",
value: function visitTransition(metadata, context) {
context.queryCount = 0;
context.depCount = 0;
/** @type {?} */
var animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context);
/** @type {?} */
var 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 {?}
*/
}, {
key: "visitSequence",
value: function visitSequence(metadata, context) {
var _this5 = this;
return {
type: 2
/* Sequence */
,
steps: metadata.steps.map(
/**
* @param {?} s
* @return {?}
*/
/**
* @param {?} s
* @return {?}
*/
function (s) {
return visitDslNode(_this5, s, context);
}),
options: normalizeAnimationOptions(metadata.options)
};
}
/**
* @param {?} metadata
* @param {?} context
* @return {?}
*/
}, {
key: "visitGroup",
value: function visitGroup(metadata, context) {
var _this6 = this;
/** @type {?} */
var currentTime = context.currentTime;
/** @type {?} */
var furthestTime = 0;
/** @type {?} */
var steps = metadata.steps.map(
/**
* @param {?} step
* @return {?}
*/
/**
* @param {?} step
* @return {?}
*/
function (step) {
context.currentTime = currentTime;
/** @type {?} */
var innerAst = visitDslNode(_this6, 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 {?}
*/
}, {
key: "visitAnimate",
value: function visitAnimate(metadata, context) {
/** @type {?} */
var timingAst = constructTimingAst(metadata.timings, context.errors);
context.currentAnimateTimings = timingAst;
/** @type {?} */
var styleAst;
/** @type {?} */
var styleMetadata = metadata.styles ? metadata.styles : Object(_angular_animations__WEBPACK_IMPORTED_MODULE_0__["style"])({});
if (styleMetadata.type == 5
/* Keyframes */
) {
styleAst = this.visitKeyframes(
/** @type {?} */
styleMetadata, context);
} else {
/** @type {?} */
var _styleMetadata =
/** @type {?} */
metadata.styles;
/** @type {?} */
var isEmpty = false;
if (!_styleMetadata) {
isEmpty = true;
/** @type {?} */
var newStyleData = {};
if (timingAst.easing) {
newStyleData['easing'] = timingAst.easing;
}
_styleMetadata = Object(_angular_animations__WEBPACK_IMPORTED_MODULE_0__["style"])(newStyleData);
}
context.currentTime += timingAst.duration + timingAst.delay;
/** @type {?} */
var _styleAst = this.visitStyle(_styleMetadata, context);
_styleAst.isEmptyStep = isEmpty;
styleAst = _styleAst;
}
context.currentAnimateTimings = null;
return {
type: 4
/* Animate */
,
timings: timingAst,
style: styleAst,
options: null
};
}
/**
* @param {?} metadata
* @param {?} context
* @return {?}
*/
}, {
key: "visitStyle",
value: function visitStyle(metadata, context) {
/** @type {?} */
var ast = this._makeStyleAst(metadata, context);
this._validateStyleAst(ast, context);
return ast;
}
/**
* @private
* @param {?} metadata
* @param {?} context
* @return {?}
*/
}, {
key: "_makeStyleAst",
value: function _makeStyleAst(metadata, context) {
/** @type {?} */
var styles = [];
if (Array.isArray(metadata.styles)) {
/** @type {?} */
metadata.styles.forEach(
/**
* @param {?} styleTuple
* @return {?}
*/
/**
* @param {?} styleTuple
* @return {?}
*/
function (styleTuple) {
if (typeof styleTuple == 'string') {
if (styleTuple == _angular_animations__WEBPACK_IMPORTED_MODULE_0__["AUTO_STYLE"]) {
styles.push(styleTuple);
} else {
context.errors.push("The provided style string value ".concat(styleTuple, " is not allowed."));
}
} else {
styles.push(styleTuple);
}
});
} else {
styles.push(metadata.styles);
}
/** @type {?} */
var containsDynamicStyles = false;
/** @type {?} */
var collectedEasing = null;
styles.forEach(
/**
* @param {?} styleData
* @return {?}
*/
/**
* @param {?} styleData
* @return {?}
*/
function (styleData) {
if (isObject(styleData)) {
/** @type {?} */
var styleMap =
/** @type {?} */
styleData;
/** @type {?} */
var easing = styleMap['easing'];
if (easing) {
collectedEasing =
/** @type {?} */
easing;
delete styleMap['easing'];
}
if (!containsDynamicStyles) {
for (var prop in styleMap) {
/** @type {?} */
var 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
};
}
/**
* @private
* @param {?} ast
* @param {?} context
* @return {?}
*/
}, {
key: "_validateStyleAst",
value: function _validateStyleAst(ast, context) {
var _this7 = this;
/** @type {?} */
var timings = context.currentAnimateTimings;
/** @type {?} */
var endTime = context.currentTime;
/** @type {?} */
var startTime = context.currentTime;
if (timings && startTime > 0) {
startTime -= timings.duration + timings.delay;
}
ast.styles.forEach(
/**
* @param {?} tuple
* @return {?}
*/
/**
* @param {?} tuple
* @return {?}
*/
function (tuple) {
if (typeof tuple == 'string') return;
Object.keys(tuple).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
if (!_this7._driver.validateStyleProperty(prop)) {
context.errors.push("The provided animation property \"".concat(prop, "\" is not a supported CSS property for animations"));
return;
}
/** @type {?} */
var collectedStyles = context.collectedStyles[
/** @type {?} */
context.currentQuerySelector];
/** @type {?} */
var collectedEntry = collectedStyles[prop];
/** @type {?} */
var updateCollectedStyle = true;
if (collectedEntry) {
if (startTime != endTime && startTime >= collectedEntry.startTime && endTime <= collectedEntry.endTime) {
context.errors.push("The CSS property \"".concat(prop, "\" that exists between the times of \"").concat(collectedEntry.startTime, "ms\" and \"").concat(collectedEntry.endTime, "ms\" is also being animated in a parallel animation between the times of \"").concat(startTime, "ms\" and \"").concat(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 {?}
*/
}, {
key: "visitKeyframes",
value: function visitKeyframes(metadata, context) {
var _this8 = this;
/** @type {?} */
var 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;
}
/** @type {?} */
var MAX_KEYFRAME_OFFSET = 1;
/** @type {?} */
var totalKeyframesWithOffsets = 0;
/** @type {?} */
var offsets = [];
/** @type {?} */
var offsetsOutOfOrder = false;
/** @type {?} */
var keyframesOutOfRange = false;
/** @type {?} */
var previousOffset = 0;
/** @type {?} */
var keyframes = metadata.steps.map(
/**
* @param {?} styles
* @return {?}
*/
/**
* @param {?} styles
* @return {?}
*/
function (styles) {
/** @type {?} */
var style = _this8._makeStyleAst(styles, context);
/** @type {?} */
var offsetVal = style.offset != null ? style.offset : consumeOffset(style.styles);
/** @type {?} */
var offset = 0;
if (offsetVal != null) {
totalKeyframesWithOffsets++;
offset = style.offset = offsetVal;
}
keyframesOutOfRange = keyframesOutOfRange || offset < 0 || offset > 1;
offsetsOutOfOrder = offsetsOutOfOrder || offset < previousOffset;
previousOffset = offset;
offsets.push(offset);
return style;
});
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");
}
/** @type {?} */
var length = metadata.steps.length;
/** @type {?} */
var 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);
}
/** @type {?} */
var limit = length - 1;
/** @type {?} */
var currentTime = context.currentTime;
/** @type {?} */
var currentAnimateTimings =
/** @type {?} */
context.currentAnimateTimings;
/** @type {?} */
var animateDuration = currentAnimateTimings.duration;
keyframes.forEach(
/**
* @param {?} kf
* @param {?} i
* @return {?}
*/
function (kf, i) {
/** @type {?} */
var offset = generatedOffset > 0 ? i == limit ? 1 : generatedOffset * i : offsets[i];
/** @type {?} */
var durationUpToThisFrame = offset * animateDuration;
context.currentTime = currentTime + currentAnimateTimings.delay + durationUpToThisFrame;
currentAnimateTimings.duration = durationUpToThisFrame;
_this8._validateStyleAst(kf, context);
kf.offset = offset;
ast.styles.push(kf);
});
return ast;
}
/**
* @param {?} metadata
* @param {?} context
* @return {?}
*/
}, {
key: "visitReference",
value: function visitReference(metadata, context) {
return {
type: 8
/* Reference */
,
animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context),
options: normalizeAnimationOptions(metadata.options)
};
}
/**
* @param {?} metadata
* @param {?} context
* @return {?}
*/
}, {
key: "visitAnimateChild",
value: function visitAnimateChild(metadata, context) {
context.depCount++;
return {
type: 9
/* AnimateChild */
,
options: normalizeAnimationOptions(metadata.options)
};
}
/**
* @param {?} metadata
* @param {?} context
* @return {?}
*/
}, {
key: "visitAnimateRef",
value: function visitAnimateRef(metadata, context) {
return {
type: 10
/* AnimateRef */
,
animation: this.visitReference(metadata.animation, context),
options: normalizeAnimationOptions(metadata.options)
};
}
/**
* @param {?} metadata
* @param {?} context
* @return {?}
*/
}, {
key: "visitQuery",
value: function visitQuery(metadata, context) {
/** @type {?} */
var parentSelector =
/** @type {?} */
context.currentQuerySelector;
/** @type {?} */
var options =
/** @type {?} */
metadata.options || {};
context.queryCount++;
context.currentQuery = metadata;
var _normalizeSelector = normalizeSelector(metadata.selector),
_normalizeSelector2 = _slicedToArray(_normalizeSelector, 2),
selector = _normalizeSelector2[0],
includeSelf = _normalizeSelector2[1];
context.currentQuerySelector = parentSelector.length ? parentSelector + ' ' + selector : selector;
getOrSetAsInMap(context.collectedStyles, context.currentQuerySelector, {});
/** @type {?} */
var 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 {?}
*/
}, {
key: "visitStagger",
value: function visitStagger(metadata, context) {
if (!context.currentQuery) {
context.errors.push("stagger() can only be used inside of query()");
}
/** @type {?} */
var 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;
}();
if (false) {}
/**
* @param {?} selector
* @return {?}
*/
function normalizeSelector(selector) {
/** @type {?} */
var hasAmpersand = selector.split(/\s*,\s*/).find(
/**
* @param {?} token
* @return {?}
*/
/**
* @param {?} token
* @return {?}
*/
function (token) {
return token == SELF_TOKEN;
}) ? true : false;
if (hasAmpersand) {
selector = selector.replace(SELF_TOKEN_REGEX, '');
} // the :enter and :leave selectors are filled in at runtime during timeline building
selector = selector.replace(/@\*/g, NG_TRIGGER_SELECTOR).replace(/@\w+/g,
/**
* @param {?} match
* @return {?}
*/
/**
* @param {?} match
* @return {?}
*/
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 =
/**
* @param {?} errors
*/
function AnimationAstBuilderContext(errors) {
_classCallCheck(this, AnimationAstBuilderContext);
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;
};
if (false) {}
/**
* @param {?} styles
* @return {?}
*/
function consumeOffset(styles) {
if (typeof styles == 'string') return null;
/** @type {?} */
var offset = null;
if (Array.isArray(styles)) {
styles.forEach(
/**
* @param {?} styleTuple
* @return {?}
*/
/**
* @param {?} styleTuple
* @return {?}
*/
function (styleTuple) {
if (isObject(styleTuple) && styleTuple.hasOwnProperty('offset')) {
/** @type {?} */
var obj =
/** @type {?} */
styleTuple;
offset = parseFloat(
/** @type {?} */
obj['offset']);
delete obj['offset'];
}
});
} else if (isObject(styles) && styles.hasOwnProperty('offset')) {
/** @type {?} */
var 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) {
/** @type {?} */
var timings = null;
if (value.hasOwnProperty('duration')) {
timings =
/** @type {?} */
value;
} else if (typeof value == 'number') {
/** @type {?} */
var duration = resolveTiming(value, errors).duration;
return makeTimingAst(duration, 0, '');
}
/** @type {?} */
var strValue =
/** @type {?} */
value;
/** @type {?} */
var isDynamic = strValue.split(/\s+/).some(
/**
* @param {?} v
* @return {?}
*/
/**
* @param {?} v
* @return {?}
*/
function (v) {
return v.charAt(0) == '{' && v.charAt(1) == '{';
});
if (isDynamic) {
/** @type {?} */
var ast =
/** @type {?} */
makeTimingAst(0, 0, '');
ast.dynamic = true;
ast.strValue = strValue;
return (
/** @type {?} */
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'] =
/** @type {?} */
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
};
}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/dsl/animation_timeline_instruction.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @record
*/
function AnimationTimelineInstruction() {}
if (false) {}
/**
* @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) {
var easing = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
var subTimeline = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
return {
type: 1
/* TimelineAnimation */
,
element: element,
keyframes: keyframes,
preStyleProps: preStyleProps,
postStyleProps: postStyleProps,
duration: duration,
delay: delay,
totalTime: duration + delay,
easing: easing,
subTimeline: subTimeline
};
}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/dsl/element_instruction_map.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var ElementInstructionMap = /*#__PURE__*/function () {
function ElementInstructionMap() {
_classCallCheck(this, ElementInstructionMap);
this._map = new Map();
}
/**
* @param {?} element
* @return {?}
*/
_createClass2(ElementInstructionMap, [{
key: "consume",
value: function consume(element) {
/** @type {?} */
var instructions = this._map.get(element);
if (instructions) {
this._map["delete"](element);
} else {
instructions = [];
}
return instructions;
}
/**
* @param {?} element
* @param {?} instructions
* @return {?}
*/
}, {
key: "append",
value: function append(element, instructions) {
var _existingInstructions;
/** @type {?} */
var existingInstructions = this._map.get(element);
if (!existingInstructions) {
this._map.set(element, existingInstructions = []);
}
(_existingInstructions = existingInstructions).push.apply(_existingInstructions, _toConsumableArray(instructions));
}
/**
* @param {?} element
* @return {?}
*/
}, {
key: "has",
value: function has(element) {
return this._map.has(element);
}
/**
* @return {?}
*/
}, {
key: "clear",
value: function clear() {
this._map.clear();
}
}]);
return ElementInstructionMap;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/dsl/animation_timeline_builder.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var ONE_FRAME_IN_MILLISECONDS = 1;
/** @type {?} */
var ENTER_TOKEN = ':enter';
/** @type {?} */
var ENTER_TOKEN_REGEX = /*@__PURE__*/new RegExp(ENTER_TOKEN, 'g');
/** @type {?} */
var LEAVE_TOKEN = ':leave';
/** @type {?} */
var LEAVE_TOKEN_REGEX = /*@__PURE__*/new RegExp(LEAVE_TOKEN, 'g');
/*
* The code within this file aims to generate web-animations-compatible keyframes from Angular's
* animation DSL code.
*
* The code below will be converted from:
*
* ```
* sequence([
* style({ opacity: 0 }),
* animate(1000, style({ opacity: 0 }))
* ])
* ```
*
* To:
* ```
* keyframes = [{ opacity: 0, offset: 0 }, { opacity: 1, offset: 1 }]
* duration = 1000
* delay = 0
* easing = ''
* ```
*
* For this operation to cover the combination of animation verbs (style, animate, group, etc...) a
* combination of prototypical inheritance, AST traversal and merge-sort-like algorithms are used.
*
* [AST Traversal]
* Each of the animation verbs, when executed, will return an string-map object representing what
* type of action it is (style, animate, group, etc...) and the data associated with it. This means
* that when functional composition mix of these functions is evaluated (like in the example above)
* then it will end up producing a tree of objects representing the animation itself.
*
* When this animation object tree is processed by the visitor code below it will visit each of the
* verb statements within the visitor. And during each visit it will build the context of the
* animation keyframes by interacting with the `TimelineBuilder`.
*
* [TimelineBuilder]
* This class is responsible for tracking the styles and building a series of keyframe objects for a
* timeline between a start and end time. The builder starts off with an initial timeline and each
* time the AST comes across a `group()`, `keyframes()` or a combination of the two wihtin a
* `sequence()` then it will generate a sub timeline for each step as well as a new one after
* they are complete.
*
* As the AST is traversed, the timing state on each of the timelines will be incremented. If a sub
* timeline was created (based on one of the cases above) then the parent timeline will attempt to
* merge the styles used within the sub timelines into itself (only with group() this will happen).
* This happens with a merge operation (much like how the merge works in mergesort) and it will only
* copy the most recently used styles from the sub timelines into the parent timeline. This ensures
* that if the styles are used later on in another phase of the animation then they will be the most
* up-to-date values.
*
* [How Missing Styles Are Updated]
* Each timeline has a `backFill` property which is responsible for filling in new styles into
* already processed keyframes if a new style shows up later within the animation sequence.
*
* ```
* sequence([
* style({ width: 0 }),
* animate(1000, style({ width: 100 })),
* animate(1000, style({ width: 200 })),
* animate(1000, style({ width: 300 }))
* animate(1000, style({ width: 400, height: 400 })) // notice how `height` doesn't exist anywhere
* else
* ])
* ```
*
* What is happening here is that the `height` value is added later in the sequence, but is missing
* from all previous animation steps. Therefore when a keyframe is created it would also be missing
* from all previous keyframes up until where it is first used. For the timeline keyframe generation
* to properly fill in the style it will place the previous value (the value from the parent
* timeline) or a default value of `*` into the backFill object. Given that each of the keyframe
* styles are objects that prototypically inhert from the backFill object, this means that if a
* value is added into the backFill then it will automatically propagate any missing values to all
* keyframes. Therefore the missing `height` value will be properly filled into the already
* processed keyframes.
*
* When a sub-timeline is created it will have its own backFill property. This is done so that
* styles present within the sub-timeline do not accidentally seep into the previous/future timeline
* keyframes
*
* (For prototypically-inherited contents to be detected a `for(i in obj)` loop must be used.)
*
* [Validation]
* The code in this file is not responsible for validation. That functionality happens with within
* the `AnimationValidatorVisitor` code.
*/
/**
* @param {?} driver
* @param {?} rootElement
* @param {?} ast
* @param {?} enterClassName
* @param {?} leaveClassName
* @param {?=} startingStyles
* @param {?=} finalStyles
* @param {?=} options
* @param {?=} subInstructions
* @param {?=} errors
* @return {?}
*/
function buildAnimationTimelines(driver, rootElement, ast, enterClassName, leaveClassName) {
var startingStyles = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
var finalStyles = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : {};
var options = arguments.length > 7 ? arguments[7] : undefined;
var subInstructions = arguments.length > 8 ? arguments[8] : undefined;
var errors = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : [];
return new AnimationTimelineBuilderVisitor().buildKeyframes(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors);
}
var AnimationTimelineBuilderVisitor = /*#__PURE__*/function () {
function AnimationTimelineBuilderVisitor() {
_classCallCheck(this, AnimationTimelineBuilderVisitor);
}
_createClass2(AnimationTimelineBuilderVisitor, [{
key: "buildKeyframes",
value:
/**
* @param {?} driver
* @param {?} rootElement
* @param {?} ast
* @param {?} enterClassName
* @param {?} leaveClassName
* @param {?} startingStyles
* @param {?} finalStyles
* @param {?} options
* @param {?=} subInstructions
* @param {?=} errors
* @return {?}
*/
function buildKeyframes(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions) {
var errors = arguments.length > 9 && arguments[9] !== undefined ? arguments[9] : [];
subInstructions = subInstructions || new ElementInstructionMap();
/** @type {?} */
var context = new AnimationTimelineContext(driver, rootElement, subInstructions, enterClassName, leaveClassName, 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
/** @type {?} */
var timelines = context.timelines.filter(
/**
* @param {?} timeline
* @return {?}
*/
/**
* @param {?} timeline
* @return {?}
*/
function (timeline) {
return timeline.containsAnimation();
});
if (timelines.length && Object.keys(finalStyles).length) {
/** @type {?} */
var tl = timelines[timelines.length - 1];
if (!tl.allowOnlyTimelineStyles()) {
tl.setStyles([finalStyles], null, context.errors, options);
}
}
return timelines.length ? timelines.map(
/**
* @param {?} timeline
* @return {?}
*/
/**
* @param {?} timeline
* @return {?}
*/
function (timeline) {
return timeline.buildKeyframes();
}) : [createTimelineInstruction(rootElement, [], [], [], 0, 0, '', false)];
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
}, {
key: "visitTrigger",
value: function visitTrigger(ast, context) {// these values are not visited in this AST
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
}, {
key: "visitState",
value: function visitState(ast, context) {// these values are not visited in this AST
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
}, {
key: "visitTransition",
value: function visitTransition(ast, context) {// these values are not visited in this AST
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
}, {
key: "visitAnimateChild",
value: function visitAnimateChild(ast, context) {
/** @type {?} */
var elementInstructions = context.subInstructions.consume(context.element);
if (elementInstructions) {
/** @type {?} */
var innerContext = context.createSubContext(ast.options);
/** @type {?} */
var startTime = context.currentTimeline.currentTime;
/** @type {?} */
var 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 {?}
*/
}, {
key: "visitAnimateRef",
value: function visitAnimateRef(ast, context) {
/** @type {?} */
var innerContext = context.createSubContext(ast.options);
innerContext.transformIntoNewTimeline();
this.visitReference(ast.animation, innerContext);
context.transformIntoNewTimeline(innerContext.currentTimeline.currentTime);
context.previousNode = ast;
}
/**
* @private
* @param {?} instructions
* @param {?} context
* @param {?} options
* @return {?}
*/
}, {
key: "_visitSubInstructions",
value: function _visitSubInstructions(instructions, context, options) {
/** @type {?} */
var startTime = context.currentTimeline.currentTime;
/** @type {?} */
var furthestTime = startTime; // this is a special-case for when a user wants to skip a sub
// animation from being fired entirely.
/** @type {?} */
var duration = options.duration != null ? resolveTimingValue(options.duration) : null;
/** @type {?} */
var delay = options.delay != null ? resolveTimingValue(options.delay) : null;
if (duration !== 0) {
instructions.forEach(
/**
* @param {?} instruction
* @return {?}
*/
/**
* @param {?} instruction
* @return {?}
*/
function (instruction) {
/** @type {?} */
var instructionTimings = context.appendInstructionToTimeline(instruction, duration, delay);
furthestTime = Math.max(furthestTime, instructionTimings.duration + instructionTimings.delay);
});
}
return furthestTime;
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
}, {
key: "visitReference",
value: function visitReference(ast, context) {
context.updateOptions(ast.options, true);
visitDslNode(this, ast.animation, context);
context.previousNode = ast;
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
}, {
key: "visitSequence",
value: function visitSequence(ast, context) {
var _this9 = this;
/** @type {?} */
var subContextCount = context.subContextCount;
/** @type {?} */
var ctx = context;
/** @type {?} */
var 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;
}
/** @type {?} */
var delay = resolveTimingValue(options.delay);
ctx.delayNextStep(delay);
}
}
if (ast.steps.length) {
ast.steps.forEach(
/**
* @param {?} s
* @return {?}
*/
/**
* @param {?} s
* @return {?}
*/
function (s) {
return visitDslNode(_this9, 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 {?}
*/
}, {
key: "visitGroup",
value: function visitGroup(ast, context) {
var _this10 = this;
/** @type {?} */
var innerTimelines = [];
/** @type {?} */
var furthestTime = context.currentTimeline.currentTime;
/** @type {?} */
var delay = ast.options && ast.options.delay ? resolveTimingValue(ast.options.delay) : 0;
ast.steps.forEach(
/**
* @param {?} s
* @return {?}
*/
/**
* @param {?} s
* @return {?}
*/
function (s) {
/** @type {?} */
var innerContext = context.createSubContext(ast.options);
if (delay) {
innerContext.delayNextStep(delay);
}
visitDslNode(_this10, 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(
/**
* @param {?} timeline
* @return {?}
*/
/**
* @param {?} timeline
* @return {?}
*/
function (timeline) {
return context.currentTimeline.mergeTimelineCollectedStyles(timeline);
});
context.transformIntoNewTimeline(furthestTime);
context.previousNode = ast;
}
/**
* @private
* @param {?} ast
* @param {?} context
* @return {?}
*/
}, {
key: "_visitTiming",
value: function _visitTiming(ast, context) {
if (
/** @type {?} */
ast.dynamic) {
/** @type {?} */
var strValue =
/** @type {?} */
ast.strValue;
/** @type {?} */
var 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 {?}
*/
}, {
key: "visitAnimate",
value: function visitAnimate(ast, context) {
/** @type {?} */
var timings = context.currentAnimateTimings = this._visitTiming(ast.timings, context);
/** @type {?} */
var timeline = context.currentTimeline;
if (timings.delay) {
context.incrementTime(timings.delay);
timeline.snapshotCurrentStyles();
}
/** @type {?} */
var style = ast.style;
if (style.type == 5
/* Keyframes */
) {
this.visitKeyframes(style, context);
} else {
context.incrementTime(timings.duration);
this.visitStyle(
/** @type {?} */
style, context);
timeline.applyStylesToKeyframe();
}
context.currentAnimateTimings = null;
context.previousNode = ast;
}
/**
* @param {?} ast
* @param {?} context
* @return {?}
*/
}, {
key: "visitStyle",
value: function visitStyle(ast, context) {
/** @type {?} */
var timeline = context.currentTimeline;
/** @type {?} */
var timings =
/** @type {?} */
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();
}
/** @type {?} */
var 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 {?}
*/
}, {
key: "visitKeyframes",
value: function visitKeyframes(ast, context) {
/** @type {?} */
var currentAnimateTimings =
/** @type {?} */
context.currentAnimateTimings;
/** @type {?} */
var startTime =
/** @type {?} */
context.currentTimeline.duration;
/** @type {?} */
var duration = currentAnimateTimings.duration;
/** @type {?} */
var innerContext = context.createSubContext();
/** @type {?} */
var innerTimeline = innerContext.currentTimeline;
innerTimeline.easing = currentAnimateTimings.easing;
ast.styles.forEach(
/**
* @param {?} step
* @return {?}
*/
/**
* @param {?} step
* @return {?}
*/
function (step) {
/** @type {?} */
var 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 {?}
*/
}, {
key: "visitQuery",
value: function visitQuery(ast, context) {
var _this11 = 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
/** @type {?} */
var startTime = context.currentTimeline.currentTime;
/** @type {?} */
var options =
/** @type {?} */
ast.options || {};
/** @type {?} */
var 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;
}
/** @type {?} */
var furthestTime = startTime;
/** @type {?} */
var elms = context.invokeQuery(ast.selector, ast.originalSelector, ast.limit, ast.includeSelf, options.optional ? true : false, context.errors);
context.currentQueryTotal = elms.length;
/** @type {?} */
var sameElementTimeline = null;
elms.forEach(
/**
* @param {?} element
* @param {?} i
* @return {?}
*/
function (element, i) {
context.currentQueryIndex = i;
/** @type {?} */
var innerContext = context.createSubContext(ast.options, element);
if (delay) {
innerContext.delayNextStep(delay);
}
if (element === context.element) {
sameElementTimeline = innerContext.currentTimeline;
}
visitDslNode(_this11, 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();
/** @type {?} */
var 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 {?}
*/
}, {
key: "visitStagger",
value: function visitStagger(ast, context) {
/** @type {?} */
var parentContext =
/** @type {?} */
context.parentContext;
/** @type {?} */
var tl = context.currentTimeline;
/** @type {?} */
var timings = ast.timings;
/** @type {?} */
var duration = Math.abs(timings.duration);
/** @type {?} */
var maxTime = duration * (context.currentQueryTotal - 1);
/** @type {?} */
var delay = duration * context.currentQueryIndex;
/** @type {?} */
var staggerTransformer = timings.duration < 0 ? 'reverse' : timings.easing;
switch (staggerTransformer) {
case 'reverse':
delay = maxTime - delay;
break;
case 'full':
delay = parentContext.currentStaggerTime;
break;
}
/** @type {?} */
var timeline = context.currentTimeline;
if (delay) {
timeline.delayNextStep(delay);
}
/** @type {?} */
var 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;
}();
/** @type {?} */
var DEFAULT_NOOP_PREVIOUS_NODE =
/** @type {?} */
{};
var AnimationTimelineContext = /*#__PURE__*/function () {
/**
* @param {?} _driver
* @param {?} element
* @param {?} subInstructions
* @param {?} _enterClassName
* @param {?} _leaveClassName
* @param {?} errors
* @param {?} timelines
* @param {?=} initialTimeline
*/
function AnimationTimelineContext(_driver, element, subInstructions, _enterClassName, _leaveClassName, errors, timelines, initialTimeline) {
_classCallCheck(this, AnimationTimelineContext);
this._driver = _driver;
this.element = element;
this.subInstructions = subInstructions;
this._enterClassName = _enterClassName;
this._leaveClassName = _leaveClassName;
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(this._driver, element, 0);
timelines.push(this.currentTimeline);
}
/**
* @return {?}
*/
_createClass2(AnimationTimelineContext, [{
key: "params",
get: function get() {
return this.options.params;
}
/**
* @param {?} options
* @param {?=} skipIfExists
* @return {?}
*/
}, {
key: "updateOptions",
value: function updateOptions(options, skipIfExists) {
var _this12 = this;
if (!options) return;
/** @type {?} */
var newOptions =
/** @type {?} */
options;
/** @type {?} */
var optionsToUpdate = this.options; // NOTE: this will get patched up when other animation methods support duration overrides
if (newOptions.duration != null) {
/** @type {?} */
optionsToUpdate.duration = resolveTimingValue(newOptions.duration);
}
if (newOptions.delay != null) {
optionsToUpdate.delay = resolveTimingValue(newOptions.delay);
}
/** @type {?} */
var newParams = newOptions.params;
if (newParams) {
/** @type {?} */
var paramsToUpdate =
/** @type {?} */
optionsToUpdate.params;
if (!paramsToUpdate) {
paramsToUpdate = this.options.params = {};
}
Object.keys(newParams).forEach(
/**
* @param {?} name
* @return {?}
*/
/**
* @param {?} name
* @return {?}
*/
function (name) {
if (!skipIfExists || !paramsToUpdate.hasOwnProperty(name)) {
paramsToUpdate[name] = interpolateParams(newParams[name], paramsToUpdate, _this12.errors);
}
});
}
}
/**
* @private
* @return {?}
*/
}, {
key: "_copyOptions",
value: function _copyOptions() {
/** @type {?} */
var options = {};
if (this.options) {
/** @type {?} */
var oldParams = this.options.params;
if (oldParams) {
/** @type {?} */
var params = options['params'] = {};
Object.keys(oldParams).forEach(
/**
* @param {?} name
* @return {?}
*/
/**
* @param {?} name
* @return {?}
*/
function (name) {
params[name] = oldParams[name];
});
}
}
return options;
}
/**
* @param {?=} options
* @param {?=} element
* @param {?=} newTime
* @return {?}
*/
}, {
key: "createSubContext",
value: function createSubContext() {
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
var element = arguments.length > 1 ? arguments[1] : undefined;
var newTime = arguments.length > 2 ? arguments[2] : undefined;
/** @type {?} */
var target = element || this.element;
/** @type {?} */
var context = new AnimationTimelineContext(this._driver, target, this.subInstructions, this._enterClassName, this._leaveClassName, 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 {?}
*/
}, {
key: "transformIntoNewTimeline",
value: function transformIntoNewTimeline(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 {?}
*/
}, {
key: "appendInstructionToTimeline",
value: function appendInstructionToTimeline(instruction, duration, delay) {
/** @type {?} */
var updatedTimings = {
duration: duration != null ? duration : instruction.duration,
delay: this.currentTimeline.currentTime + (delay != null ? delay : 0) + instruction.delay,
easing: ''
};
/** @type {?} */
var builder = new SubTimelineBuilder(this._driver, instruction.element, instruction.keyframes, instruction.preStyleProps, instruction.postStyleProps, updatedTimings, instruction.stretchStartingKeyframe);
this.timelines.push(builder);
return updatedTimings;
}
/**
* @param {?} time
* @return {?}
*/
}, {
key: "incrementTime",
value: function incrementTime(time) {
this.currentTimeline.forwardTime(this.currentTimeline.duration + time);
}
/**
* @param {?} delay
* @return {?}
*/
}, {
key: "delayNextStep",
value: function delayNextStep(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 {?}
*/
}, {
key: "invokeQuery",
value: function invokeQuery(selector, originalSelector, limit, includeSelf, optional, errors) {
/** @type {?} */
var results = [];
if (includeSelf) {
results.push(this.element);
}
if (selector.length > 0) {
// if :self is only used then the selector is empty
selector = selector.replace(ENTER_TOKEN_REGEX, '.' + this._enterClassName);
selector = selector.replace(LEAVE_TOKEN_REGEX, '.' + this._leaveClassName);
/** @type {?} */
var multi = limit != 1;
/** @type {?} */
var elements = this._driver.query(this.element, selector, multi);
if (limit !== 0) {
elements = limit < 0 ? elements.slice(elements.length + limit, elements.length) : elements.slice(0, limit);
}
results.push.apply(results, _toConsumableArray(elements));
}
if (!optional && results.length == 0) {
errors.push("`query(\"".concat(originalSelector, "\")` returned zero elements. (Use `query(\"").concat(originalSelector, "\", { optional: true })` if you wish to allow this.)"));
}
return results;
}
}]);
return AnimationTimelineContext;
}();
if (false) {}
var TimelineBuilder = /*#__PURE__*/function () {
/**
* @param {?} _driver
* @param {?} element
* @param {?} startTime
* @param {?=} _elementTimelineStylesLookup
*/
function TimelineBuilder(_driver, element, startTime, _elementTimelineStylesLookup) {
_classCallCheck(this, TimelineBuilder);
this._driver = _driver;
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 =
/** @type {?} */
this._elementTimelineStylesLookup.get(element);
if (!this._globalTimelineStyles) {
this._globalTimelineStyles = this._localTimelineStyles;
this._elementTimelineStylesLookup.set(element, this._localTimelineStyles);
}
this._loadKeyframe();
}
/**
* @return {?}
*/
_createClass2(TimelineBuilder, [{
key: "containsAnimation",
value: function containsAnimation() {
switch (this._keyframes.size) {
case 0:
return false;
case 1:
return this.getCurrentStyleProperties().length > 0;
default:
return true;
}
}
/**
* @return {?}
*/
}, {
key: "getCurrentStyleProperties",
value: function getCurrentStyleProperties() {
return Object.keys(this._currentKeyframe);
}
/**
* @return {?}
*/
}, {
key: "currentTime",
get: function get() {
return this.startTime + this.duration;
}
/**
* @param {?} delay
* @return {?}
*/
}, {
key: "delayNextStep",
value: function delayNextStep(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...
/** @type {?} */
var 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 {?}
*/
}, {
key: "fork",
value: function fork(element, currentTime) {
this.applyStylesToKeyframe();
return new TimelineBuilder(this._driver, element, currentTime || this.currentTime, this._elementTimelineStylesLookup);
}
/**
* @private
* @return {?}
*/
}, {
key: "_loadKeyframe",
value: function _loadKeyframe() {
if (this._currentKeyframe) {
this._previousKeyframe = this._currentKeyframe;
}
this._currentKeyframe =
/** @type {?} */
this._keyframes.get(this.duration);
if (!this._currentKeyframe) {
this._currentKeyframe = Object.create(this._backFill, {});
this._keyframes.set(this.duration, this._currentKeyframe);
}
}
/**
* @return {?}
*/
}, {
key: "forwardFrame",
value: function forwardFrame() {
this.duration += ONE_FRAME_IN_MILLISECONDS;
this._loadKeyframe();
}
/**
* @param {?} time
* @return {?}
*/
}, {
key: "forwardTime",
value: function forwardTime(time) {
this.applyStylesToKeyframe();
this.duration = time;
this._loadKeyframe();
}
/**
* @private
* @param {?} prop
* @param {?} value
* @return {?}
*/
}, {
key: "_updateStyle",
value: function _updateStyle(prop, value) {
this._localTimelineStyles[prop] = value;
this._globalTimelineStyles[prop] = value;
this._styleSummary[prop] = {
time: this.currentTime,
value: value
};
}
/**
* @return {?}
*/
}, {
key: "allowOnlyTimelineStyles",
value: function allowOnlyTimelineStyles() {
return this._currentEmptyStepKeyframe !== this._currentKeyframe;
}
/**
* @param {?} easing
* @return {?}
*/
}, {
key: "applyEmptyStep",
value: function applyEmptyStep(easing) {
var _this13 = 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(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
_this13._backFill[prop] = _this13._globalTimelineStyles[prop] || _angular_animations__WEBPACK_IMPORTED_MODULE_0__["AUTO_STYLE"];
_this13._currentKeyframe[prop] = _angular_animations__WEBPACK_IMPORTED_MODULE_0__["AUTO_STYLE"];
});
this._currentEmptyStepKeyframe = this._currentKeyframe;
}
/**
* @param {?} input
* @param {?} easing
* @param {?} errors
* @param {?=} options
* @return {?}
*/
}, {
key: "setStyles",
value: function setStyles(input, easing, errors, options) {
var _this14 = this;
if (easing) {
this._previousKeyframe['easing'] = easing;
}
/** @type {?} */
var params = options && options.params || {};
/** @type {?} */
var styles = flattenStyles(input, this._globalTimelineStyles);
Object.keys(styles).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
/** @type {?} */
var val = interpolateParams(styles[prop], params, errors);
_this14._pendingStyles[prop] = val;
if (!_this14._localTimelineStyles.hasOwnProperty(prop)) {
_this14._backFill[prop] = _this14._globalTimelineStyles.hasOwnProperty(prop) ? _this14._globalTimelineStyles[prop] : _angular_animations__WEBPACK_IMPORTED_MODULE_0__["AUTO_STYLE"];
}
_this14._updateStyle(prop, val);
});
}
/**
* @return {?}
*/
}, {
key: "applyStylesToKeyframe",
value: function applyStylesToKeyframe() {
var _this15 = this;
/** @type {?} */
var styles = this._pendingStyles;
/** @type {?} */
var props = Object.keys(styles);
if (props.length == 0) return;
this._pendingStyles = {};
props.forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
/** @type {?} */
var val = styles[prop];
_this15._currentKeyframe[prop] = val;
});
Object.keys(this._localTimelineStyles).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
if (!_this15._currentKeyframe.hasOwnProperty(prop)) {
_this15._currentKeyframe[prop] = _this15._localTimelineStyles[prop];
}
});
}
/**
* @return {?}
*/
}, {
key: "snapshotCurrentStyles",
value: function snapshotCurrentStyles() {
var _this16 = this;
Object.keys(this._localTimelineStyles).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
/** @type {?} */
var val = _this16._localTimelineStyles[prop];
_this16._pendingStyles[prop] = val;
_this16._updateStyle(prop, val);
});
}
/**
* @return {?}
*/
}, {
key: "getFinalKeyframe",
value: function getFinalKeyframe() {
return this._keyframes.get(this.duration);
}
/**
* @return {?}
*/
}, {
key: "properties",
get: function get() {
/** @type {?} */
var properties = [];
for (var prop in this._currentKeyframe) {
properties.push(prop);
}
return properties;
}
/**
* @param {?} timeline
* @return {?}
*/
}, {
key: "mergeTimelineCollectedStyles",
value: function mergeTimelineCollectedStyles(timeline) {
var _this17 = this;
Object.keys(timeline._styleSummary).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
/** @type {?} */
var details0 = _this17._styleSummary[prop];
/** @type {?} */
var details1 = timeline._styleSummary[prop];
if (!details0 || details1.time > details0.time) {
_this17._updateStyle(prop, details1.value);
}
});
}
/**
* @return {?}
*/
}, {
key: "buildKeyframes",
value: function buildKeyframes() {
var _this18 = this;
this.applyStylesToKeyframe();
/** @type {?} */
var preStyleProps = new Set();
/** @type {?} */
var postStyleProps = new Set();
/** @type {?} */
var isEmpty = this._keyframes.size === 1 && this.duration === 0;
/** @type {?} */
var finalKeyframes = [];
this._keyframes.forEach(
/**
* @param {?} keyframe
* @param {?} time
* @return {?}
*/
function (keyframe, time) {
/** @type {?} */
var finalKeyframe = copyStyles(keyframe, true);
Object.keys(finalKeyframe).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
/** @type {?} */
var value = finalKeyframe[prop];
if (value == _angular_animations__WEBPACK_IMPORTED_MODULE_0__["ɵPRE_STYLE"]) {
preStyleProps.add(prop);
} else if (value == _angular_animations__WEBPACK_IMPORTED_MODULE_0__["AUTO_STYLE"]) {
postStyleProps.add(prop);
}
});
if (!isEmpty) {
finalKeyframe['offset'] = time / _this18.duration;
}
finalKeyframes.push(finalKeyframe);
});
/** @type {?} */
var preProps = preStyleProps.size ? iteratorToArray(preStyleProps.values()) : [];
/** @type {?} */
var postProps = postStyleProps.size ? iteratorToArray(postStyleProps.values()) : []; // special case for a 0-second animation (which is designed just to place styles onscreen)
if (isEmpty) {
/** @type {?} */
var kf0 = finalKeyframes[0];
/** @type {?} */
var 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;
}();
if (false) {}
var SubTimelineBuilder = /*#__PURE__*/function (_TimelineBuilder) {
_inherits(SubTimelineBuilder, _TimelineBuilder);
var _super2 = _createSuper(SubTimelineBuilder);
/**
* @param {?} driver
* @param {?} element
* @param {?} keyframes
* @param {?} preStyleProps
* @param {?} postStyleProps
* @param {?} timings
* @param {?=} _stretchStartingKeyframe
*/
function SubTimelineBuilder(driver, element, keyframes, preStyleProps, postStyleProps, timings) {
var _this19;
var _stretchStartingKeyframe = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
_classCallCheck(this, SubTimelineBuilder);
_this19 = _super2.call(this, driver, element, timings.delay);
_this19.element = element;
_this19.keyframes = keyframes;
_this19.preStyleProps = preStyleProps;
_this19.postStyleProps = postStyleProps;
_this19._stretchStartingKeyframe = _stretchStartingKeyframe;
_this19.timings = {
duration: timings.duration,
delay: timings.delay,
easing: timings.easing
};
return _this19;
}
/**
* @return {?}
*/
_createClass2(SubTimelineBuilder, [{
key: "containsAnimation",
value: function containsAnimation() {
return this.keyframes.length > 1;
}
/**
* @return {?}
*/
}, {
key: "buildKeyframes",
value: function buildKeyframes() {
/** @type {?} */
var keyframes = this.keyframes;
var _this$timings = this.timings,
delay = _this$timings.delay,
duration = _this$timings.duration,
easing = _this$timings.easing;
if (this._stretchStartingKeyframe && delay) {
/** @type {?} */
var newKeyframes = [];
/** @type {?} */
var totalTime = duration + delay;
/** @type {?} */
var startingGap = delay / totalTime; // the original starting keyframe now starts once the delay is done
/** @type {?} */
var newFirstKeyframe = copyStyles(keyframes[0], false);
newFirstKeyframe['offset'] = 0;
newKeyframes.push(newFirstKeyframe);
/** @type {?} */
var 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
/** @type {?} */
var limit = keyframes.length - 1;
for (var i = 1; i <= limit; i++) {
/** @type {?} */
var kf = copyStyles(keyframes[i], false);
/** @type {?} */
var oldOffset =
/** @type {?} */
kf['offset'];
/** @type {?} */
var 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);
if (false) {}
/**
* @param {?} offset
* @param {?=} decimalPoints
* @return {?}
*/
function roundOffset(offset) {
var decimalPoints = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 3;
/** @type {?} */
var mult = Math.pow(10, decimalPoints - 1);
return Math.round(offset * mult) / mult;
}
/**
* @param {?} input
* @param {?} allStyles
* @return {?}
*/
function flattenStyles(input, allStyles) {
/** @type {?} */
var styles = {};
/** @type {?} */
var allProperties;
input.forEach(
/**
* @param {?} token
* @return {?}
*/
/**
* @param {?} token
* @return {?}
*/
function (token) {
if (token === '*') {
allProperties = allProperties || Object.keys(allStyles);
allProperties.forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
styles[prop] = _angular_animations__WEBPACK_IMPORTED_MODULE_0__["AUTO_STYLE"];
});
} else {
copyStyles(
/** @type {?} */
token, false, styles);
}
});
return styles;
}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/dsl/animation.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var Animation = /*#__PURE__*/function () {
/**
* @param {?} _driver
* @param {?} input
*/
function Animation(_driver, input) {
_classCallCheck(this, Animation);
this._driver = _driver;
/** @type {?} */
var errors = [];
/** @type {?} */
var ast = buildAnimationAst(_driver, input, errors);
if (errors.length) {
/** @type {?} */
var errorMessage = "animation validation failed:\n".concat(errors.join('\n'));
throw new Error(errorMessage);
}
this._animationAst = ast;
}
/**
* @param {?} element
* @param {?} startingStyles
* @param {?} destinationStyles
* @param {?} options
* @param {?=} subInstructions
* @return {?}
*/
_createClass2(Animation, [{
key: "buildTimelines",
value: function buildTimelines(element, startingStyles, destinationStyles, options, subInstructions) {
/** @type {?} */
var start = Array.isArray(startingStyles) ? normalizeStyles(startingStyles) :
/** @type {?} */
startingStyles;
/** @type {?} */
var dest = Array.isArray(destinationStyles) ? normalizeStyles(destinationStyles) :
/** @type {?} */
destinationStyles;
/** @type {?} */
var errors = [];
subInstructions = subInstructions || new ElementInstructionMap();
/** @type {?} */
var result = buildAnimationTimelines(this._driver, element, this._animationAst, ENTER_CLASSNAME, LEAVE_CLASSNAME, start, dest, options, subInstructions, errors);
if (errors.length) {
/** @type {?} */
var errorMessage = "animation building failed:\n".concat(errors.join('\n'));
throw new Error(errorMessage);
}
return result;
}
}]);
return Animation;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/dsl/style_normalization/animation_style_normalizer.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @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
*/
/**
* \@publicApi
* @abstract
*/
var AnimationStyleNormalizer = function AnimationStyleNormalizer() {
_classCallCheck(this, AnimationStyleNormalizer);
};
if (false) {}
/**
* \@publicApi
*/
var NoopAnimationStyleNormalizer = /*#__PURE__*/function () {
function NoopAnimationStyleNormalizer() {
_classCallCheck(this, NoopAnimationStyleNormalizer);
}
_createClass2(NoopAnimationStyleNormalizer, [{
key: "normalizePropertyName",
value:
/**
* @param {?} propertyName
* @param {?} errors
* @return {?}
*/
function normalizePropertyName(propertyName, errors) {
return propertyName;
}
/**
* @param {?} userProvidedProperty
* @param {?} normalizedProperty
* @param {?} value
* @param {?} errors
* @return {?}
*/
}, {
key: "normalizeStyleValue",
value: function normalizeStyleValue(userProvidedProperty, normalizedProperty, value, errors) {
return (
/** @type {?} */
value
);
}
}]);
return NoopAnimationStyleNormalizer;
}();
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/dsl/style_normalization/web_animations_style_normalizer.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var WebAnimationsStyleNormalizer = /*#__PURE__*/function (_AnimationStyleNormal) {
_inherits(WebAnimationsStyleNormalizer, _AnimationStyleNormal);
var _super3 = _createSuper(WebAnimationsStyleNormalizer);
function WebAnimationsStyleNormalizer() {
_classCallCheck(this, WebAnimationsStyleNormalizer);
return _super3.apply(this, arguments);
}
_createClass2(WebAnimationsStyleNormalizer, [{
key: "normalizePropertyName",
value:
/**
* @param {?} propertyName
* @param {?} errors
* @return {?}
*/
function normalizePropertyName(propertyName, errors) {
return dashCaseToCamelCase(propertyName);
}
/**
* @param {?} userProvidedProperty
* @param {?} normalizedProperty
* @param {?} value
* @param {?} errors
* @return {?}
*/
}, {
key: "normalizeStyleValue",
value: function normalizeStyleValue(userProvidedProperty, normalizedProperty, value, errors) {
/** @type {?} */
var unit = '';
/** @type {?} */
var strVal = value.toString().trim();
if (DIMENSIONAL_PROP_MAP[normalizedProperty] && value !== 0 && value !== '0') {
if (typeof value === 'number') {
unit = 'px';
} else {
/** @type {?} */
var valAndSuffixMatch = value.match(/^[+-]?[\d\.]+([a-z]*)$/);
if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) {
errors.push("Please provide a CSS unit value for ".concat(userProvidedProperty, ":").concat(value));
}
}
}
return strVal + unit;
}
}]);
return WebAnimationsStyleNormalizer;
}(AnimationStyleNormalizer);
var ɵ0$1 =
/**
* @return {?}
*/
function ɵ0$1() {
return 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(','));
};
/** @type {?} */
var DIMENSIONAL_PROP_MAP = /*@__PURE__*/ɵ0$1();
/**
* @param {?} keys
* @return {?}
*/
function makeBooleanMap(keys) {
/** @type {?} */
var map = {};
keys.forEach(
/**
* @param {?} key
* @return {?}
*/
/**
* @param {?} key
* @return {?}
*/
function (key) {
return map[key] = true;
});
return map;
}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/dsl/animation_transition_instruction.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @record
*/
function AnimationTransitionInstruction() {}
if (false) {}
/**
* @param {?} element
* @param {?} triggerName
* @param {?} fromState
* @param {?} toState
* @param {?} isRemovalTransition
* @param {?} fromStyles
* @param {?} toStyles
* @param {?} timelines
* @param {?} queriedElements
* @param {?} preStyleProps
* @param {?} postStyleProps
* @param {?} totalTime
* @param {?=} errors
* @return {?}
*/
function createTransitionInstruction(element, triggerName, fromState, toState, isRemovalTransition, fromStyles, toStyles, timelines, queriedElements, preStyleProps, postStyleProps, totalTime, errors) {
return {
type: 0
/* TransitionAnimation */
,
element: element,
triggerName: triggerName,
isRemovalTransition: isRemovalTransition,
fromState: fromState,
fromStyles: fromStyles,
toState: toState,
toStyles: toStyles,
timelines: timelines,
queriedElements: queriedElements,
preStyleProps: preStyleProps,
postStyleProps: postStyleProps,
totalTime: totalTime,
errors: errors
};
}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/dsl/animation_transition_factory.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var EMPTY_OBJECT = {};
var AnimationTransitionFactory = /*#__PURE__*/function () {
/**
* @param {?} _triggerName
* @param {?} ast
* @param {?} _stateStyles
*/
function AnimationTransitionFactory(_triggerName, ast, _stateStyles) {
_classCallCheck(this, AnimationTransitionFactory);
this._triggerName = _triggerName;
this.ast = ast;
this._stateStyles = _stateStyles;
}
/**
* @param {?} currentState
* @param {?} nextState
* @param {?} element
* @param {?} params
* @return {?}
*/
_createClass2(AnimationTransitionFactory, [{
key: "match",
value: function match(currentState, nextState, element, params) {
return oneOrMoreTransitionsMatch(this.ast.matchers, currentState, nextState, element, params);
}
/**
* @param {?} stateName
* @param {?} params
* @param {?} errors
* @return {?}
*/
}, {
key: "buildStyles",
value: function buildStyles(stateName, params, errors) {
/** @type {?} */
var backupStateStyler = this._stateStyles['*'];
/** @type {?} */
var stateStyler = this._stateStyles[stateName];
/** @type {?} */
var backupStyles = backupStateStyler ? backupStateStyler.buildStyles(params, errors) : {};
return stateStyler ? stateStyler.buildStyles(params, errors) : backupStyles;
}
/**
* @param {?} driver
* @param {?} element
* @param {?} currentState
* @param {?} nextState
* @param {?} enterClassName
* @param {?} leaveClassName
* @param {?=} currentOptions
* @param {?=} nextOptions
* @param {?=} subInstructions
* @param {?=} skipAstBuild
* @return {?}
*/
}, {
key: "build",
value: function build(driver, element, currentState, nextState, enterClassName, leaveClassName, currentOptions, nextOptions, subInstructions, skipAstBuild) {
/** @type {?} */
var errors = [];
/** @type {?} */
var transitionAnimationParams = this.ast.options && this.ast.options.params || EMPTY_OBJECT;
/** @type {?} */
var currentAnimationParams = currentOptions && currentOptions.params || EMPTY_OBJECT;
/** @type {?} */
var currentStateStyles = this.buildStyles(currentState, currentAnimationParams, errors);
/** @type {?} */
var nextAnimationParams = nextOptions && nextOptions.params || EMPTY_OBJECT;
/** @type {?} */
var nextStateStyles = this.buildStyles(nextState, nextAnimationParams, errors);
/** @type {?} */
var queriedElements = new Set();
/** @type {?} */
var preStyleMap = new Map();
/** @type {?} */
var postStyleMap = new Map();
/** @type {?} */
var isRemoval = nextState === 'void';
/** @type {?} */
var animationOptions = {
params: Object.assign(Object.assign({}, transitionAnimationParams), nextAnimationParams)
};
/** @type {?} */
var timelines = skipAstBuild ? [] : buildAnimationTimelines(driver, element, this.ast.animation, enterClassName, leaveClassName, currentStateStyles, nextStateStyles, animationOptions, subInstructions, errors);
/** @type {?} */
var totalTime = 0;
timelines.forEach(
/**
* @param {?} tl
* @return {?}
*/
/**
* @param {?} tl
* @return {?}
*/
function (tl) {
totalTime = Math.max(tl.duration + tl.delay, totalTime);
});
if (errors.length) {
return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, [], [], preStyleMap, postStyleMap, totalTime, errors);
}
timelines.forEach(
/**
* @param {?} tl
* @return {?}
*/
/**
* @param {?} tl
* @return {?}
*/
function (tl) {
/** @type {?} */
var elm = tl.element;
/** @type {?} */
var preProps = getOrSetAsInMap(preStyleMap, elm, {});
tl.preStyleProps.forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
return preProps[prop] = true;
});
/** @type {?} */
var postProps = getOrSetAsInMap(postStyleMap, elm, {});
tl.postStyleProps.forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
return postProps[prop] = true;
});
if (elm !== element) {
queriedElements.add(elm);
}
});
/** @type {?} */
var queriedElementsList = iteratorToArray(queriedElements.values());
return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, timelines, queriedElementsList, preStyleMap, postStyleMap, totalTime);
}
}]);
return AnimationTransitionFactory;
}();
if (false) {}
/**
* @param {?} matchFns
* @param {?} currentState
* @param {?} nextState
* @param {?} element
* @param {?} params
* @return {?}
*/
function oneOrMoreTransitionsMatch(matchFns, currentState, nextState, element, params) {
return matchFns.some(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn(currentState, nextState, element, params);
});
}
var AnimationStateStyles = /*#__PURE__*/function () {
/**
* @param {?} styles
* @param {?} defaultParams
*/
function AnimationStateStyles(styles, defaultParams) {
_classCallCheck(this, AnimationStateStyles);
this.styles = styles;
this.defaultParams = defaultParams;
}
/**
* @param {?} params
* @param {?} errors
* @return {?}
*/
_createClass2(AnimationStateStyles, [{
key: "buildStyles",
value: function buildStyles(params, errors) {
/** @type {?} */
var finalStyles = {};
/** @type {?} */
var combinedParams = copyObj(this.defaultParams);
Object.keys(params).forEach(
/**
* @param {?} key
* @return {?}
*/
/**
* @param {?} key
* @return {?}
*/
function (key) {
/** @type {?} */
var value = params[key];
if (value != null) {
combinedParams[key] = value;
}
});
this.styles.styles.forEach(
/**
* @param {?} value
* @return {?}
*/
/**
* @param {?} value
* @return {?}
*/
function (value) {
if (typeof value !== 'string') {
/** @type {?} */
var styleObj =
/** @type {?} */
value;
Object.keys(styleObj).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
/** @type {?} */
var val = styleObj[prop];
if (val.length > 1) {
val = interpolateParams(val, combinedParams, errors);
}
finalStyles[prop] = val;
});
}
});
return finalStyles;
}
}]);
return AnimationStateStyles;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/dsl/animation_trigger.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* \@publicApi
* @param {?} name
* @param {?} ast
* @return {?}
*/
function buildTrigger(name, ast) {
return new AnimationTrigger(name, ast);
}
/**
* \@publicApi
*/
var AnimationTrigger = /*#__PURE__*/function () {
/**
* @param {?} name
* @param {?} ast
*/
function AnimationTrigger(name, ast) {
var _this20 = this;
_classCallCheck(this, AnimationTrigger);
this.name = name;
this.ast = ast;
this.transitionFactories = [];
this.states = {};
ast.states.forEach(
/**
* @param {?} ast
* @return {?}
*/
/**
* @param {?} ast
* @return {?}
*/
function (ast) {
/** @type {?} */
var defaultParams = ast.options && ast.options.params || {};
_this20.states[ast.name] = new AnimationStateStyles(ast.style, defaultParams);
});
balanceProperties(this.states, 'true', '1');
balanceProperties(this.states, 'false', '0');
ast.transitions.forEach(
/**
* @param {?} ast
* @return {?}
*/
/**
* @param {?} ast
* @return {?}
*/
function (ast) {
_this20.transitionFactories.push(new AnimationTransitionFactory(name, ast, _this20.states));
});
this.fallbackTransition = createFallbackTransition(name, this.states);
}
/**
* @return {?}
*/
_createClass2(AnimationTrigger, [{
key: "containsQueries",
get: function get() {
return this.ast.queryCount > 0;
}
/**
* @param {?} currentState
* @param {?} nextState
* @param {?} element
* @param {?} params
* @return {?}
*/
}, {
key: "matchTransition",
value: function matchTransition(currentState, nextState, element, params) {
/** @type {?} */
var entry = this.transitionFactories.find(
/**
* @param {?} f
* @return {?}
*/
/**
* @param {?} f
* @return {?}
*/
function (f) {
return f.match(currentState, nextState, element, params);
});
return entry || null;
}
/**
* @param {?} currentState
* @param {?} params
* @param {?} errors
* @return {?}
*/
}, {
key: "matchStyles",
value: function matchStyles(currentState, params, errors) {
return this.fallbackTransition.buildStyles(currentState, params, errors);
}
}]);
return AnimationTrigger;
}();
if (false) {}
/**
* @param {?} triggerName
* @param {?} states
* @return {?}
*/
function createFallbackTransition(triggerName, states) {
/** @type {?} */
var matchers = [
/**
* @param {?} fromState
* @param {?} toState
* @return {?}
*/
function (fromState, toState) {
return true;
}];
/** @type {?} */
var animation = {
type: 2
/* Sequence */
,
steps: [],
options: null
};
/** @type {?} */
var transition = {
type: 1
/* Transition */
,
animation: animation,
matchers: matchers,
options: null,
queryCount: 0,
depCount: 0
};
return new AnimationTransitionFactory(triggerName, transition, states);
}
/**
* @param {?} obj
* @param {?} key1
* @param {?} key2
* @return {?}
*/
function balanceProperties(obj, key1, key2) {
if (obj.hasOwnProperty(key1)) {
if (!obj.hasOwnProperty(key2)) {
obj[key2] = obj[key1];
}
} else if (obj.hasOwnProperty(key2)) {
obj[key1] = obj[key2];
}
}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/render/timeline_animation_engine.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var EMPTY_INSTRUCTION_MAP = /*@__PURE__*/new ElementInstructionMap();
var TimelineAnimationEngine = /*#__PURE__*/function () {
/**
* @param {?} bodyNode
* @param {?} _driver
* @param {?} _normalizer
*/
function TimelineAnimationEngine(bodyNode, _driver, _normalizer) {
_classCallCheck(this, TimelineAnimationEngine);
this.bodyNode = bodyNode;
this._driver = _driver;
this._normalizer = _normalizer;
this._animations = {};
this._playersById = {};
this.players = [];
}
/**
* @param {?} id
* @param {?} metadata
* @return {?}
*/
_createClass2(TimelineAnimationEngine, [{
key: "register",
value: function register(id, metadata) {
/** @type {?} */
var errors = [];
/** @type {?} */
var ast = buildAnimationAst(this._driver, metadata, errors);
if (errors.length) {
throw new Error("Unable to build the animation due to the following errors: ".concat(errors.join('\n')));
} else {
this._animations[id] = ast;
}
}
/**
* @private
* @param {?} i
* @param {?} preStyles
* @param {?=} postStyles
* @return {?}
*/
}, {
key: "_buildPlayer",
value: function _buildPlayer(i, preStyles, postStyles) {
/** @type {?} */
var element = i.element;
/** @type {?} */
var keyframes = normalizeKeyframes(this._driver, this._normalizer, element, i.keyframes, preStyles, postStyles);
return this._driver.animate(element, keyframes, i.duration, i.delay, i.easing, [], true);
}
/**
* @param {?} id
* @param {?} element
* @param {?=} options
* @return {?}
*/
}, {
key: "create",
value: function create(id, element) {
var _this21 = this;
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
/** @type {?} */
var errors = [];
/** @type {?} */
var ast = this._animations[id];
/** @type {?} */
var instructions;
/** @type {?} */
var autoStylesMap = new Map();
if (ast) {
instructions = buildAnimationTimelines(this._driver, element, ast, ENTER_CLASSNAME, LEAVE_CLASSNAME, {}, {}, options, EMPTY_INSTRUCTION_MAP, errors);
instructions.forEach(
/**
* @param {?} inst
* @return {?}
*/
/**
* @param {?} inst
* @return {?}
*/
function (inst) {
/** @type {?} */
var styles = getOrSetAsInMap(autoStylesMap, inst.element, {});
inst.postStyleProps.forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
return styles[prop] = null;
});
});
} else {
errors.push('The requested animation doesn\'t exist or has already been destroyed');
instructions = [];
}
if (errors.length) {
throw new Error("Unable to create the animation due to the following errors: ".concat(errors.join('\n')));
}
autoStylesMap.forEach(
/**
* @param {?} styles
* @param {?} element
* @return {?}
*/
function (styles, element) {
Object.keys(styles).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
styles[prop] = _this21._driver.computeStyle(element, prop, _angular_animations__WEBPACK_IMPORTED_MODULE_0__["AUTO_STYLE"]);
});
});
/** @type {?} */
var players = instructions.map(
/**
* @param {?} i
* @return {?}
*/
/**
* @param {?} i
* @return {?}
*/
function (i) {
/** @type {?} */
var styles = autoStylesMap.get(i.element);
return _this21._buildPlayer(i, {}, styles);
});
/** @type {?} */
var player = optimizeGroupPlayer(players);
this._playersById[id] = player;
player.onDestroy(
/**
* @return {?}
*/
function () {
return _this21.destroy(id);
});
this.players.push(player);
return player;
}
/**
* @param {?} id
* @return {?}
*/
}, {
key: "destroy",
value: function destroy(id) {
/** @type {?} */
var player = this._getPlayer(id);
player.destroy();
delete this._playersById[id];
/** @type {?} */
var index = this.players.indexOf(player);
if (index >= 0) {
this.players.splice(index, 1);
}
}
/**
* @private
* @param {?} id
* @return {?}
*/
}, {
key: "_getPlayer",
value: function _getPlayer(id) {
/** @type {?} */
var player = this._playersById[id];
if (!player) {
throw new Error("Unable to find the timeline player referenced by ".concat(id));
}
return player;
}
/**
* @param {?} id
* @param {?} element
* @param {?} eventName
* @param {?} callback
* @return {?}
*/
}, {
key: "listen",
value: function listen(id, element, eventName, callback) {
// triggerName, fromState, toState are all ignored for timeline animations
/** @type {?} */
var baseEvent = makeAnimationEvent(element, '', '', '');
listenOnPlayer(this._getPlayer(id), eventName, baseEvent, callback);
return (
/**
* @return {?}
*/
function () {}
);
}
/**
* @param {?} id
* @param {?} element
* @param {?} command
* @param {?} args
* @return {?}
*/
}, {
key: "command",
value: function command(id, element, _command, args) {
if (_command == 'register') {
this.register(id,
/** @type {?} */
args[0]);
return;
}
if (_command == 'create') {
/** @type {?} */
var options =
/** @type {?} */
args[0] || {};
this.create(id, element, options);
return;
}
/** @type {?} */
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(
/** @type {?} */
args[0]));
break;
case 'destroy':
this.destroy(id);
break;
}
}
}]);
return TimelineAnimationEngine;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/render/transition_animation_engine.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var QUEUED_CLASSNAME = 'ng-animate-queued';
/** @type {?} */
var QUEUED_SELECTOR = '.ng-animate-queued';
/** @type {?} */
var DISABLED_CLASSNAME = 'ng-animate-disabled';
/** @type {?} */
var DISABLED_SELECTOR = '.ng-animate-disabled';
/** @type {?} */
var STAR_CLASSNAME = 'ng-star-inserted';
/** @type {?} */
var STAR_SELECTOR = '.ng-star-inserted';
/** @type {?} */
var EMPTY_PLAYER_ARRAY = [];
/** @type {?} */
var NULL_REMOVAL_STATE = {
namespaceId: '',
setForRemoval: false,
setForMove: false,
hasAnimation: false,
removedBeforeQueried: false
};
/** @type {?} */
var NULL_REMOVED_QUERIED_STATE = {
namespaceId: '',
setForMove: false,
setForRemoval: false,
hasAnimation: false,
removedBeforeQueried: true
};
/**
* @record
*/
function TriggerListener() {}
if (false) {}
/**
* @record
*/
function QueueInstruction() {}
if (false) {}
/** @type {?} */
var REMOVAL_FLAG = '__ng_removed';
/**
* @record
*/
function ElementAnimationState() {}
if (false) {}
var StateValue = /*#__PURE__*/function () {
/**
* @param {?} input
* @param {?=} namespaceId
*/
function StateValue(input) {
var namespaceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
_classCallCheck(this, StateValue);
this.namespaceId = namespaceId;
/** @type {?} */
var isObj = input && input.hasOwnProperty('value');
/** @type {?} */
var value = isObj ? input['value'] : input;
this.value = normalizeTriggerValue(value);
if (isObj) {
/** @type {?} */
var options = copyObj(
/** @type {?} */
input);
delete options['value'];
this.options =
/** @type {?} */
options;
} else {
this.options = {};
}
if (!this.options.params) {
this.options.params = {};
}
}
/**
* @return {?}
*/
_createClass2(StateValue, [{
key: "params",
get: function get() {
return (
/** @type {?} */
this.options.params
);
}
/**
* @param {?} options
* @return {?}
*/
}, {
key: "absorbOptions",
value: function absorbOptions(options) {
/** @type {?} */
var newParams = options.params;
if (newParams) {
/** @type {?} */
var oldParams =
/** @type {?} */
this.options.params;
Object.keys(newParams).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
if (oldParams[prop] == null) {
oldParams[prop] = newParams[prop];
}
});
}
}
}]);
return StateValue;
}();
if (false) {}
/** @type {?} */
var VOID_VALUE = 'void';
/** @type {?} */
var DEFAULT_STATE_VALUE = /*@__PURE__*/new StateValue(VOID_VALUE);
var AnimationTransitionNamespace = /*#__PURE__*/function () {
/**
* @param {?} id
* @param {?} hostElement
* @param {?} _engine
*/
function AnimationTransitionNamespace(id, hostElement, _engine) {
_classCallCheck(this, AnimationTransitionNamespace);
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);
}
/**
* @param {?} element
* @param {?} name
* @param {?} phase
* @param {?} callback
* @return {?}
*/
_createClass2(AnimationTransitionNamespace, [{
key: "listen",
value: function listen(element, name, phase, callback) {
var _this22 = this;
if (!this._triggers.hasOwnProperty(name)) {
throw new Error("Unable to listen on the animation trigger event \"".concat(phase, "\" because the animation trigger \"").concat(name, "\" doesn't exist!"));
}
if (phase == null || phase.length == 0) {
throw new Error("Unable to listen on the animation trigger \"".concat(name, "\" because the provided event is undefined!"));
}
if (!isTriggerEventValid(phase)) {
throw new Error("The provided animation trigger event \"".concat(phase, "\" for the animation trigger \"").concat(name, "\" is not supported!"));
}
/** @type {?} */
var listeners = getOrSetAsInMap(this._elementListeners, element, []);
/** @type {?} */
var data = {
name: name,
phase: phase,
callback: callback
};
listeners.push(data);
/** @type {?} */
var triggersWithStates = getOrSetAsInMap(this._engine.statesByElement, element, {});
if (!triggersWithStates.hasOwnProperty(name)) {
addClass(element, NG_TRIGGER_CLASSNAME);
addClass(element, NG_TRIGGER_CLASSNAME + '-' + name);
triggersWithStates[name] = DEFAULT_STATE_VALUE;
}
return (
/**
* @return {?}
*/
function () {
// the event listener is removed AFTER the flush has occurred such
// that leave animations callbacks can fire (otherwise if the node
// is removed in between then the listeners would be deregistered)
_this22._engine.afterFlush(
/**
* @return {?}
*/
function () {
/** @type {?} */
var index = listeners.indexOf(data);
if (index >= 0) {
listeners.splice(index, 1);
}
if (!_this22._triggers[name]) {
delete triggersWithStates[name];
}
});
}
);
}
/**
* @param {?} name
* @param {?} ast
* @return {?}
*/
}, {
key: "register",
value: function register(name, ast) {
if (this._triggers[name]) {
// throw
return false;
} else {
this._triggers[name] = ast;
return true;
}
}
/**
* @private
* @param {?} name
* @return {?}
*/
}, {
key: "_getTrigger",
value: function _getTrigger(name) {
/** @type {?} */
var trigger = this._triggers[name];
if (!trigger) {
throw new Error("The provided animation trigger \"".concat(name, "\" has not been registered!"));
}
return trigger;
}
/**
* @param {?} element
* @param {?} triggerName
* @param {?} value
* @param {?=} defaultToFallback
* @return {?}
*/
}, {
key: "trigger",
value: function trigger(element, triggerName, value) {
var _this23 = this;
var defaultToFallback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
/** @type {?} */
var trigger = this._getTrigger(triggerName);
/** @type {?} */
var player = new TransitionAnimationPlayer(this.id, triggerName, element);
/** @type {?} */
var triggersWithStates = this._engine.statesByElement.get(element);
if (!triggersWithStates) {
addClass(element, NG_TRIGGER_CLASSNAME);
addClass(element, NG_TRIGGER_CLASSNAME + '-' + triggerName);
this._engine.statesByElement.set(element, triggersWithStates = {});
}
/** @type {?} */
var fromState = triggersWithStates[triggerName];
/** @type {?} */
var toState = new StateValue(value, this.id);
/** @type {?} */
var isObj = value && value.hasOwnProperty('value');
if (!isObj && fromState) {
toState.absorbOptions(fromState.options);
}
triggersWithStates[triggerName] = toState;
if (!fromState) {
fromState = DEFAULT_STATE_VALUE;
}
/** @type {?} */
var isRemoval = toState.value === VOID_VALUE; // normally this isn't reached by here, however, if an object expression
// is passed in then it may be a new object each time. Comparing the value
// is important since that will stay the same despite there being a new object.
// The removal arc here is special cased because the same element is triggered
// twice in the event that it contains animations on the outer/inner portions
// of the host container
if (!isRemoval && fromState.value === toState.value) {
// this means that despite the value not changing, some inner params
// have changed which means that the animation final styles need to be applied
if (!objEquals(fromState.params, toState.params)) {
/** @type {?} */
var errors = [];
/** @type {?} */
var fromStyles = trigger.matchStyles(fromState.value, fromState.params, errors);
/** @type {?} */
var toStyles = trigger.matchStyles(toState.value, toState.params, errors);
if (errors.length) {
this._engine.reportError(errors);
} else {
this._engine.afterFlush(
/**
* @return {?}
*/
function () {
eraseStyles(element, fromStyles);
setStyles(element, toStyles);
});
}
}
return;
}
/** @type {?} */
var playersOnElement = getOrSetAsInMap(this._engine.playersByElement, element, []);
playersOnElement.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
// only remove the player if it is queued on the EXACT same trigger/namespace
// we only also deal with queued players here because if the animation has
// started then we want to keep the player alive until the flush happens
// (which is where the previousPlayers are passed into the new palyer)
if (player.namespaceId == _this23.id && player.triggerName == triggerName && player.queued) {
player.destroy();
}
});
/** @type {?} */
var transition = trigger.matchTransition(fromState.value, toState.value, element, toState.params);
/** @type {?} */
var isFallbackTransition = false;
if (!transition) {
if (!defaultToFallback) return;
transition = trigger.fallbackTransition;
isFallbackTransition = true;
}
this._engine.totalQueuedPlayers++;
this._queue.push({
element: element,
triggerName: triggerName,
transition: transition,
fromState: fromState,
toState: toState,
player: player,
isFallbackTransition: isFallbackTransition
});
if (!isFallbackTransition) {
addClass(element, QUEUED_CLASSNAME);
player.onStart(
/**
* @return {?}
*/
function () {
removeClass(element, QUEUED_CLASSNAME);
});
}
player.onDone(
/**
* @return {?}
*/
function () {
/** @type {?} */
var index = _this23.players.indexOf(player);
if (index >= 0) {
_this23.players.splice(index, 1);
}
/** @type {?} */
var players = _this23._engine.playersByElement.get(element);
if (players) {
/** @type {?} */
var _index = players.indexOf(player);
if (_index >= 0) {
players.splice(_index, 1);
}
}
});
this.players.push(player);
playersOnElement.push(player);
return player;
}
/**
* @param {?} name
* @return {?}
*/
}, {
key: "deregister",
value: function deregister(name) {
var _this24 = this;
delete this._triggers[name];
this._engine.statesByElement.forEach(
/**
* @param {?} stateMap
* @param {?} element
* @return {?}
*/
function (stateMap, element) {
delete stateMap[name];
});
this._elementListeners.forEach(
/**
* @param {?} listeners
* @param {?} element
* @return {?}
*/
function (listeners, element) {
_this24._elementListeners.set(element, listeners.filter(
/**
* @param {?} entry
* @return {?}
*/
/**
* @param {?} entry
* @return {?}
*/
function (entry) {
return entry.name != name;
}));
});
}
/**
* @param {?} element
* @return {?}
*/
}, {
key: "clearElementCache",
value: function clearElementCache(element) {
this._engine.statesByElement["delete"](element);
this._elementListeners["delete"](element);
/** @type {?} */
var elementPlayers = this._engine.playersByElement.get(element);
if (elementPlayers) {
elementPlayers.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
return player.destroy();
});
this._engine.playersByElement["delete"](element);
}
}
/**
* @private
* @param {?} rootElement
* @param {?} context
* @return {?}
*/
}, {
key: "_signalRemovalForInnerTriggers",
value: function _signalRemovalForInnerTriggers(rootElement, context) {
var _this25 = this;
/** @type {?} */
var elements = this._engine.driver.query(rootElement, NG_TRIGGER_SELECTOR, true); // emulate a leave animation for all inner nodes within this node.
// If there are no animations found for any of the nodes then clear the cache
// for the element.
elements.forEach(
/**
* @param {?} elm
* @return {?}
*/
/**
* @param {?} elm
* @return {?}
*/
function (elm) {
// this means that an inner remove() operation has already kicked off
// the animation on this element...
if (elm[REMOVAL_FLAG]) return;
/** @type {?} */
var namespaces = _this25._engine.fetchNamespacesByElement(elm);
if (namespaces.size) {
namespaces.forEach(
/**
* @param {?} ns
* @return {?}
*/
/**
* @param {?} ns
* @return {?}
*/
function (ns) {
return ns.triggerLeaveAnimation(elm, context, false, true);
});
} else {
_this25.clearElementCache(elm);
}
}); // If the child elements were removed along with the parent, their animations might not
// have completed. Clear all the elements from the cache so we don't end up with a memory leak.
this._engine.afterFlushAnimationsDone(
/**
* @return {?}
*/
function () {
return elements.forEach(
/**
* @param {?} elm
* @return {?}
*/
/**
* @param {?} elm
* @return {?}
*/
function (elm) {
return _this25.clearElementCache(elm);
});
});
}
/**
* @param {?} element
* @param {?} context
* @param {?=} destroyAfterComplete
* @param {?=} defaultToFallback
* @return {?}
*/
}, {
key: "triggerLeaveAnimation",
value: function triggerLeaveAnimation(element, context, destroyAfterComplete, defaultToFallback) {
var _this26 = this;
/** @type {?} */
var triggerStates = this._engine.statesByElement.get(element);
if (triggerStates) {
/** @type {?} */
var players = [];
Object.keys(triggerStates).forEach(
/**
* @param {?} triggerName
* @return {?}
*/
/**
* @param {?} triggerName
* @return {?}
*/
function (triggerName) {
// this check is here in the event that an element is removed
// twice (both on the host level and the component level)
if (_this26._triggers[triggerName]) {
/** @type {?} */
var player = _this26.trigger(element, triggerName, VOID_VALUE, defaultToFallback);
if (player) {
players.push(player);
}
}
});
if (players.length) {
this._engine.markElementAsRemoved(this.id, element, true, context);
if (destroyAfterComplete) {
optimizeGroupPlayer(players).onDone(
/**
* @return {?}
*/
function () {
return _this26._engine.processLeaveNode(element);
});
}
return true;
}
}
return false;
}
/**
* @param {?} element
* @return {?}
*/
}, {
key: "prepareLeaveAnimationListeners",
value: function prepareLeaveAnimationListeners(element) {
var _this27 = this;
/** @type {?} */
var listeners = this._elementListeners.get(element);
if (listeners) {
/** @type {?} */
var visitedTriggers = new Set();
listeners.forEach(
/**
* @param {?} listener
* @return {?}
*/
/**
* @param {?} listener
* @return {?}
*/
function (listener) {
/** @type {?} */
var triggerName = listener.name;
if (visitedTriggers.has(triggerName)) return;
visitedTriggers.add(triggerName);
/** @type {?} */
var trigger = _this27._triggers[triggerName];
/** @type {?} */
var transition = trigger.fallbackTransition;
/** @type {?} */
var elementStates =
/** @type {?} */
_this27._engine.statesByElement.get(element);
/** @type {?} */
var fromState = elementStates[triggerName] || DEFAULT_STATE_VALUE;
/** @type {?} */
var toState = new StateValue(VOID_VALUE);
/** @type {?} */
var player = new TransitionAnimationPlayer(_this27.id, triggerName, element);
_this27._engine.totalQueuedPlayers++;
_this27._queue.push({
element: element,
triggerName: triggerName,
transition: transition,
fromState: fromState,
toState: toState,
player: player,
isFallbackTransition: true
});
});
}
}
/**
* @param {?} element
* @param {?} context
* @return {?}
*/
}, {
key: "removeNode",
value: function removeNode(element, context) {
var _this28 = this;
/** @type {?} */
var engine = this._engine;
if (element.childElementCount) {
this._signalRemovalForInnerTriggers(element, context);
} // this means that a * => VOID animation was detected and kicked off
if (this.triggerLeaveAnimation(element, context, true)) return; // find the player that is animating and make sure that the
// removal is delayed until that player has completed
/** @type {?} */
var containsPotentialParentTransition = false;
if (engine.totalAnimations) {
/** @type {?} */
var currentPlayers = engine.players.length ? engine.playersByQueriedElement.get(element) : []; // when this `if statement` does not continue forward it means that
// a previous animation query has selected the current element and
// is animating it. In this situation want to continue forwards and
// allow the element to be queued up for animation later.
if (currentPlayers && currentPlayers.length) {
containsPotentialParentTransition = true;
} else {
/** @type {?} */
var parent = element;
while (parent = parent.parentNode) {
/** @type {?} */
var triggers = engine.statesByElement.get(parent);
if (triggers) {
containsPotentialParentTransition = true;
break;
}
}
}
} // at this stage we know that the element will either get removed
// during flush or will be picked up by a parent query. Either way
// we need to fire the listeners for this element when it DOES get
// removed (once the query parent animation is done or after flush)
this.prepareLeaveAnimationListeners(element); // whether or not a parent has an animation we need to delay the deferral of the leave
// operation until we have more information (which we do after flush() has been called)
if (containsPotentialParentTransition) {
engine.markElementAsRemoved(this.id, element, false, context);
} else {
/** @type {?} */
var removalFlag = element[REMOVAL_FLAG];
if (!removalFlag || removalFlag === NULL_REMOVAL_STATE) {
// we do this after the flush has occurred such
// that the callbacks can be fired
engine.afterFlush(
/**
* @return {?}
*/
function () {
return _this28.clearElementCache(element);
});
engine.destroyInnerAnimations(element);
engine._onRemovalComplete(element, context);
}
}
}
/**
* @param {?} element
* @param {?} parent
* @return {?}
*/
}, {
key: "insertNode",
value: function insertNode(element, parent) {
addClass(element, this._hostClassName);
}
/**
* @param {?} microtaskId
* @return {?}
*/
}, {
key: "drainQueuedTransitions",
value: function drainQueuedTransitions(microtaskId) {
var _this29 = this;
/** @type {?} */
var instructions = [];
this._queue.forEach(
/**
* @param {?} entry
* @return {?}
*/
/**
* @param {?} entry
* @return {?}
*/
function (entry) {
/** @type {?} */
var player = entry.player;
if (player.destroyed) return;
/** @type {?} */
var element = entry.element;
/** @type {?} */
var listeners = _this29._elementListeners.get(element);
if (listeners) {
listeners.forEach(
/**
* @param {?} listener
* @return {?}
*/
function (listener) {
if (listener.name == entry.triggerName) {
/** @type {?} */
var baseEvent = makeAnimationEvent(element, entry.triggerName, entry.fromState.value, entry.toState.value);
/** @type {?} */
baseEvent['_data'] = microtaskId;
listenOnPlayer(entry.player, listener.phase, baseEvent, listener.callback);
}
});
}
if (player.markedForDestroy) {
_this29._engine.afterFlush(
/**
* @return {?}
*/
function () {
// now we can destroy the element properly since the event listeners have
// been bound to the player
player.destroy();
});
} else {
instructions.push(entry);
}
});
this._queue = [];
return instructions.sort(
/**
* @param {?} a
* @param {?} b
* @return {?}
*/
function (a, b) {
// if depCount == 0 them move to front
// otherwise if a contains b then move back
/** @type {?} */
var d0 = a.transition.ast.depCount;
/** @type {?} */
var d1 = b.transition.ast.depCount;
if (d0 == 0 || d1 == 0) {
return d0 - d1;
}
return _this29._engine.driver.containsElement(a.element, b.element) ? 1 : -1;
});
}
/**
* @param {?} context
* @return {?}
*/
}, {
key: "destroy",
value: function destroy(context) {
this.players.forEach(
/**
* @param {?} p
* @return {?}
*/
/**
* @param {?} p
* @return {?}
*/
function (p) {
return p.destroy();
});
this._signalRemovalForInnerTriggers(this.hostElement, context);
}
/**
* @param {?} element
* @return {?}
*/
}, {
key: "elementContainsData",
value: function elementContainsData(element) {
/** @type {?} */
var containsData = false;
if (this._elementListeners.has(element)) containsData = true;
containsData = (this._queue.find(
/**
* @param {?} entry
* @return {?}
*/
/**
* @param {?} entry
* @return {?}
*/
function (entry) {
return entry.element === element;
}) ? true : false) || containsData;
return containsData;
}
}]);
return AnimationTransitionNamespace;
}();
if (false) {}
/**
* @record
*/
function QueuedTransition() {}
if (false) {}
var TransitionAnimationEngine = /*#__PURE__*/function () {
/**
* @param {?} bodyNode
* @param {?} driver
* @param {?} _normalizer
*/
function TransitionAnimationEngine(bodyNode, driver, _normalizer) {
_classCallCheck(this, TransitionAnimationEngine);
this.bodyNode = bodyNode;
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 method is designed to be overridden by the code that uses this engine
this.onRemovalComplete =
/**
* @param {?} element
* @param {?} context
* @return {?}
*/
function (element, context) {};
}
/**
* \@internal
* @param {?} element
* @param {?} context
* @return {?}
*/
_createClass2(TransitionAnimationEngine, [{
key: "_onRemovalComplete",
value: function _onRemovalComplete(element, context) {
this.onRemovalComplete(element, context);
}
/**
* @return {?}
*/
}, {
key: "queuedPlayers",
get: function get() {
/** @type {?} */
var players = [];
this._namespaceList.forEach(
/**
* @param {?} ns
* @return {?}
*/
/**
* @param {?} ns
* @return {?}
*/
function (ns) {
ns.players.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
if (player.queued) {
players.push(player);
}
});
});
return players;
}
/**
* @param {?} namespaceId
* @param {?} hostElement
* @return {?}
*/
}, {
key: "createNamespace",
value: function createNamespace(namespaceId, hostElement) {
/** @type {?} */
var ns = new AnimationTransitionNamespace(namespaceId, hostElement, this);
if (hostElement.parentNode) {
this._balanceNamespaceList(ns, hostElement);
} else {
// defer this later until flush during when the host element has
// been inserted so that we know exactly where to place it in
// the namespace list
this.newHostElements.set(hostElement, ns); // given that this host element is apart of the animation code, it
// may or may not be inserted by a parent node that is an of an
// animation renderer type. If this happens then we can still have
// access to this item when we query for :enter nodes. If the parent
// is a renderer then the set data-structure will normalize the entry
this.collectEnterElement(hostElement);
}
return this._namespaceLookup[namespaceId] = ns;
}
/**
* @private
* @param {?} ns
* @param {?} hostElement
* @return {?}
*/
}, {
key: "_balanceNamespaceList",
value: function _balanceNamespaceList(ns, hostElement) {
/** @type {?} */
var limit = this._namespaceList.length - 1;
if (limit >= 0) {
/** @type {?} */
var found = false;
for (var i = limit; i >= 0; i--) {
/** @type {?} */
var nextNamespace = this._namespaceList[i];
if (this.driver.containsElement(nextNamespace.hostElement, hostElement)) {
this._namespaceList.splice(i + 1, 0, ns);
found = true;
break;
}
}
if (!found) {
this._namespaceList.splice(0, 0, ns);
}
} else {
this._namespaceList.push(ns);
}
this.namespacesByHostElement.set(hostElement, ns);
return ns;
}
/**
* @param {?} namespaceId
* @param {?} hostElement
* @return {?}
*/
}, {
key: "register",
value: function register(namespaceId, hostElement) {
/** @type {?} */
var ns = this._namespaceLookup[namespaceId];
if (!ns) {
ns = this.createNamespace(namespaceId, hostElement);
}
return ns;
}
/**
* @param {?} namespaceId
* @param {?} name
* @param {?} trigger
* @return {?}
*/
}, {
key: "registerTrigger",
value: function registerTrigger(namespaceId, name, trigger) {
/** @type {?} */
var ns = this._namespaceLookup[namespaceId];
if (ns && ns.register(name, trigger)) {
this.totalAnimations++;
}
}
/**
* @param {?} namespaceId
* @param {?} context
* @return {?}
*/
}, {
key: "destroy",
value: function destroy(namespaceId, context) {
var _this30 = this;
if (!namespaceId) return;
/** @type {?} */
var ns = this._fetchNamespace(namespaceId);
this.afterFlush(
/**
* @return {?}
*/
function () {
_this30.namespacesByHostElement["delete"](ns.hostElement);
delete _this30._namespaceLookup[namespaceId];
/** @type {?} */
var index = _this30._namespaceList.indexOf(ns);
if (index >= 0) {
_this30._namespaceList.splice(index, 1);
}
});
this.afterFlushAnimationsDone(
/**
* @return {?}
*/
function () {
return ns.destroy(context);
});
}
/**
* @private
* @param {?} id
* @return {?}
*/
}, {
key: "_fetchNamespace",
value: function _fetchNamespace(id) {
return this._namespaceLookup[id];
}
/**
* @param {?} element
* @return {?}
*/
}, {
key: "fetchNamespacesByElement",
value: function fetchNamespacesByElement(element) {
// normally there should only be one namespace per element, however
// if @triggers are placed on both the component element and then
// its host element (within the component code) then there will be
// two namespaces returned. We use a set here to simply the dedupe
// of namespaces incase there are multiple triggers both the elm and host
/** @type {?} */
var namespaces = new Set();
/** @type {?} */
var elementStates = this.statesByElement.get(element);
if (elementStates) {
/** @type {?} */
var keys = Object.keys(elementStates);
for (var i = 0; i < keys.length; i++) {
/** @type {?} */
var nsId = elementStates[keys[i]].namespaceId;
if (nsId) {
/** @type {?} */
var ns = this._fetchNamespace(nsId);
if (ns) {
namespaces.add(ns);
}
}
}
}
return namespaces;
}
/**
* @param {?} namespaceId
* @param {?} element
* @param {?} name
* @param {?} value
* @return {?}
*/
}, {
key: "trigger",
value: function trigger(namespaceId, element, name, value) {
if (isElementNode(element)) {
/** @type {?} */
var ns = this._fetchNamespace(namespaceId);
if (ns) {
ns.trigger(element, name, value);
return true;
}
}
return false;
}
/**
* @param {?} namespaceId
* @param {?} element
* @param {?} parent
* @param {?} insertBefore
* @return {?}
*/
}, {
key: "insertNode",
value: function insertNode(namespaceId, element, parent, insertBefore) {
if (!isElementNode(element)) return; // special case for when an element is removed and reinserted (move operation)
// when this occurs we do not want to use the element for deletion later
/** @type {?} */
var details =
/** @type {?} */
element[REMOVAL_FLAG];
if (details && details.setForRemoval) {
details.setForRemoval = false;
details.setForMove = true;
/** @type {?} */
var index = this.collectedLeaveElements.indexOf(element);
if (index >= 0) {
this.collectedLeaveElements.splice(index, 1);
}
} // in the event that the namespaceId is blank then the caller
// code does not contain any animation code in it, but it is
// just being called so that the node is marked as being inserted
if (namespaceId) {
/** @type {?} */
var ns = this._fetchNamespace(namespaceId); // This if-statement is a workaround for router issue #21947.
// The router sometimes hits a race condition where while a route
// is being instantiated a new navigation arrives, triggering leave
// animation of DOM that has not been fully initialized, until this
// is resolved, we need to handle the scenario when DOM is not in a
// consistent state during the animation.
if (ns) {
ns.insertNode(element, parent);
}
} // only *directives and host elements are inserted before
if (insertBefore) {
this.collectEnterElement(element);
}
}
/**
* @param {?} element
* @return {?}
*/
}, {
key: "collectEnterElement",
value: function collectEnterElement(element) {
this.collectedEnterElements.push(element);
}
/**
* @param {?} element
* @param {?} value
* @return {?}
*/
}, {
key: "markElementAsDisabled",
value: function markElementAsDisabled(element, value) {
if (value) {
if (!this.disabledNodes.has(element)) {
this.disabledNodes.add(element);
addClass(element, DISABLED_CLASSNAME);
}
} else if (this.disabledNodes.has(element)) {
this.disabledNodes["delete"](element);
removeClass(element, DISABLED_CLASSNAME);
}
}
/**
* @param {?} namespaceId
* @param {?} element
* @param {?} isHostElement
* @param {?} context
* @return {?}
*/
}, {
key: "removeNode",
value: function removeNode(namespaceId, element, isHostElement, context) {
if (isElementNode(element)) {
/** @type {?} */
var ns = namespaceId ? this._fetchNamespace(namespaceId) : null;
if (ns) {
ns.removeNode(element, context);
} else {
this.markElementAsRemoved(namespaceId, element, false, context);
}
if (isHostElement) {
/** @type {?} */
var hostNS = this.namespacesByHostElement.get(element);
if (hostNS && hostNS.id !== namespaceId) {
hostNS.removeNode(element, context);
}
}
} else {
this._onRemovalComplete(element, context);
}
}
/**
* @param {?} namespaceId
* @param {?} element
* @param {?=} hasAnimation
* @param {?=} context
* @return {?}
*/
}, {
key: "markElementAsRemoved",
value: function markElementAsRemoved(namespaceId, element, hasAnimation, context) {
this.collectedLeaveElements.push(element);
element[REMOVAL_FLAG] = {
namespaceId: namespaceId,
setForRemoval: context,
hasAnimation: hasAnimation,
removedBeforeQueried: false
};
}
/**
* @param {?} namespaceId
* @param {?} element
* @param {?} name
* @param {?} phase
* @param {?} callback
* @return {?}
*/
}, {
key: "listen",
value: function listen(namespaceId, element, name, phase, callback) {
if (isElementNode(element)) {
return this._fetchNamespace(namespaceId).listen(element, name, phase, callback);
}
return (
/**
* @return {?}
*/
function () {}
);
}
/**
* @private
* @param {?} entry
* @param {?} subTimelines
* @param {?} enterClassName
* @param {?} leaveClassName
* @param {?=} skipBuildAst
* @return {?}
*/
}, {
key: "_buildInstruction",
value: function _buildInstruction(entry, subTimelines, enterClassName, leaveClassName, skipBuildAst) {
return entry.transition.build(this.driver, entry.element, entry.fromState.value, entry.toState.value, enterClassName, leaveClassName, entry.fromState.options, entry.toState.options, subTimelines, skipBuildAst);
}
/**
* @param {?} containerElement
* @return {?}
*/
}, {
key: "destroyInnerAnimations",
value: function destroyInnerAnimations(containerElement) {
var _this31 = this;
/** @type {?} */
var elements = this.driver.query(containerElement, NG_TRIGGER_SELECTOR, true);
elements.forEach(
/**
* @param {?} element
* @return {?}
*/
/**
* @param {?} element
* @return {?}
*/
function (element) {
return _this31.destroyActiveAnimationsForElement(element);
});
if (this.playersByQueriedElement.size == 0) return;
elements = this.driver.query(containerElement, NG_ANIMATING_SELECTOR, true);
elements.forEach(
/**
* @param {?} element
* @return {?}
*/
/**
* @param {?} element
* @return {?}
*/
function (element) {
return _this31.finishActiveQueriedAnimationOnElement(element);
});
}
/**
* @param {?} element
* @return {?}
*/
}, {
key: "destroyActiveAnimationsForElement",
value: function destroyActiveAnimationsForElement(element) {
/** @type {?} */
var players = this.playersByElement.get(element);
if (players) {
players.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
// special case for when an element is set for destruction, but hasn't started.
// in this situation we want to delay the destruction until the flush occurs
// so that any event listeners attached to the player are triggered.
if (player.queued) {
player.markedForDestroy = true;
} else {
player.destroy();
}
});
}
}
/**
* @param {?} element
* @return {?}
*/
}, {
key: "finishActiveQueriedAnimationOnElement",
value: function finishActiveQueriedAnimationOnElement(element) {
/** @type {?} */
var players = this.playersByQueriedElement.get(element);
if (players) {
players.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
return player.finish();
});
}
}
/**
* @return {?}
*/
}, {
key: "whenRenderingDone",
value: function whenRenderingDone() {
var _this32 = this;
return new Promise(
/**
* @param {?} resolve
* @return {?}
*/
/**
* @param {?} resolve
* @return {?}
*/
function (resolve) {
if (_this32.players.length) {
return optimizeGroupPlayer(_this32.players).onDone(
/**
* @return {?}
*/
function () {
return resolve();
});
} else {
resolve();
}
});
}
/**
* @param {?} element
* @return {?}
*/
}, {
key: "processLeaveNode",
value: function processLeaveNode(element) {
var _this33 = this;
/** @type {?} */
var details =
/** @type {?} */
element[REMOVAL_FLAG];
if (details && details.setForRemoval) {
// this will prevent it from removing it twice
element[REMOVAL_FLAG] = NULL_REMOVAL_STATE;
if (details.namespaceId) {
this.destroyInnerAnimations(element);
/** @type {?} */
var ns = this._fetchNamespace(details.namespaceId);
if (ns) {
ns.clearElementCache(element);
}
}
this._onRemovalComplete(element, details.setForRemoval);
}
if (this.driver.matchesElement(element, DISABLED_SELECTOR)) {
this.markElementAsDisabled(element, false);
}
this.driver.query(element, DISABLED_SELECTOR, true).forEach(
/**
* @param {?} node
* @return {?}
*/
/**
* @param {?} node
* @return {?}
*/
function (node) {
_this33.markElementAsDisabled(node, false);
});
}
/**
* @param {?=} microtaskId
* @return {?}
*/
}, {
key: "flush",
value: function flush() {
var _this34 = this;
var microtaskId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
/** @type {?} */
var players = [];
if (this.newHostElements.size) {
this.newHostElements.forEach(
/**
* @param {?} ns
* @param {?} element
* @return {?}
*/
function (ns, element) {
return _this34._balanceNamespaceList(ns, element);
});
this.newHostElements.clear();
}
if (this.totalAnimations && this.collectedEnterElements.length) {
for (var i = 0; i < this.collectedEnterElements.length; i++) {
/** @type {?} */
var elm = this.collectedEnterElements[i];
addClass(elm, STAR_CLASSNAME);
}
}
if (this._namespaceList.length && (this.totalQueuedPlayers || this.collectedLeaveElements.length)) {
/** @type {?} */
var cleanupFns = [];
try {
players = this._flushAnimations(cleanupFns, microtaskId);
} finally {
for (var _i2 = 0; _i2 < cleanupFns.length; _i2++) {
cleanupFns[_i2]();
}
}
} else {
for (var _i3 = 0; _i3 < this.collectedLeaveElements.length; _i3++) {
/** @type {?} */
var element = this.collectedLeaveElements[_i3];
this.processLeaveNode(element);
}
}
this.totalQueuedPlayers = 0;
this.collectedEnterElements.length = 0;
this.collectedLeaveElements.length = 0;
this._flushFns.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
this._flushFns = [];
if (this._whenQuietFns.length) {
// we move these over to a variable so that
// if any new callbacks are registered in another
// flush they do not populate the existing set
/** @type {?} */
var quietFns = this._whenQuietFns;
this._whenQuietFns = [];
if (players.length) {
optimizeGroupPlayer(players).onDone(
/**
* @return {?}
*/
function () {
quietFns.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
});
} else {
quietFns.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
}
}
}
/**
* @param {?} errors
* @return {?}
*/
}, {
key: "reportError",
value: function reportError(errors) {
throw new Error("Unable to process animations due to the following failed trigger transitions\n ".concat(errors.join('\n')));
}
/**
* @private
* @param {?} cleanupFns
* @param {?} microtaskId
* @return {?}
*/
}, {
key: "_flushAnimations",
value: function _flushAnimations(cleanupFns, microtaskId) {
var _this35 = this;
/** @type {?} */
var subTimelines = new ElementInstructionMap();
/** @type {?} */
var skippedPlayers = [];
/** @type {?} */
var skippedPlayersMap = new Map();
/** @type {?} */
var queuedInstructions = [];
/** @type {?} */
var queriedElements = new Map();
/** @type {?} */
var allPreStyleElements = new Map();
/** @type {?} */
var allPostStyleElements = new Map();
/** @type {?} */
var disabledElementsSet = new Set();
this.disabledNodes.forEach(
/**
* @param {?} node
* @return {?}
*/
/**
* @param {?} node
* @return {?}
*/
function (node) {
disabledElementsSet.add(node);
/** @type {?} */
var nodesThatAreDisabled = _this35.driver.query(node, QUEUED_SELECTOR, true);
for (var _i4 = 0; _i4 < nodesThatAreDisabled.length; _i4++) {
disabledElementsSet.add(nodesThatAreDisabled[_i4]);
}
});
/** @type {?} */
var bodyNode = this.bodyNode;
/** @type {?} */
var allTriggerElements = Array.from(this.statesByElement.keys());
/** @type {?} */
var enterNodeMap = buildRootMap(allTriggerElements, this.collectedEnterElements); // this must occur before the instructions are built below such that
// the :enter queries match the elements (since the timeline queries
// are fired during instruction building).
/** @type {?} */
var enterNodeMapIds = new Map();
/** @type {?} */
var i = 0;
enterNodeMap.forEach(
/**
* @param {?} nodes
* @param {?} root
* @return {?}
*/
function (nodes, root) {
/** @type {?} */
var className = ENTER_CLASSNAME + i++;
enterNodeMapIds.set(root, className);
nodes.forEach(
/**
* @param {?} node
* @return {?}
*/
/**
* @param {?} node
* @return {?}
*/
function (node) {
return addClass(node, className);
});
});
/** @type {?} */
var allLeaveNodes = [];
/** @type {?} */
var mergedLeaveNodes = new Set();
/** @type {?} */
var leaveNodesWithoutAnimations = new Set();
for (var _i5 = 0; _i5 < this.collectedLeaveElements.length; _i5++) {
/** @type {?} */
var element = this.collectedLeaveElements[_i5];
/** @type {?} */
var details =
/** @type {?} */
element[REMOVAL_FLAG];
if (details && details.setForRemoval) {
allLeaveNodes.push(element);
mergedLeaveNodes.add(element);
if (details.hasAnimation) {
this.driver.query(element, STAR_SELECTOR, true).forEach(
/**
* @param {?} elm
* @return {?}
*/
/**
* @param {?} elm
* @return {?}
*/
function (elm) {
return mergedLeaveNodes.add(elm);
});
} else {
leaveNodesWithoutAnimations.add(element);
}
}
}
/** @type {?} */
var leaveNodeMapIds = new Map();
/** @type {?} */
var leaveNodeMap = buildRootMap(allTriggerElements, Array.from(mergedLeaveNodes));
leaveNodeMap.forEach(
/**
* @param {?} nodes
* @param {?} root
* @return {?}
*/
function (nodes, root) {
/** @type {?} */
var className = LEAVE_CLASSNAME + i++;
leaveNodeMapIds.set(root, className);
nodes.forEach(
/**
* @param {?} node
* @return {?}
*/
/**
* @param {?} node
* @return {?}
*/
function (node) {
return addClass(node, className);
});
});
cleanupFns.push(
/**
* @return {?}
*/
function () {
enterNodeMap.forEach(
/**
* @param {?} nodes
* @param {?} root
* @return {?}
*/
function (nodes, root) {
/** @type {?} */
var className =
/** @type {?} */
enterNodeMapIds.get(root);
nodes.forEach(
/**
* @param {?} node
* @return {?}
*/
/**
* @param {?} node
* @return {?}
*/
function (node) {
return removeClass(node, className);
});
});
leaveNodeMap.forEach(
/**
* @param {?} nodes
* @param {?} root
* @return {?}
*/
function (nodes, root) {
/** @type {?} */
var className =
/** @type {?} */
leaveNodeMapIds.get(root);
nodes.forEach(
/**
* @param {?} node
* @return {?}
*/
/**
* @param {?} node
* @return {?}
*/
function (node) {
return removeClass(node, className);
});
});
allLeaveNodes.forEach(
/**
* @param {?} element
* @return {?}
*/
/**
* @param {?} element
* @return {?}
*/
function (element) {
_this35.processLeaveNode(element);
});
});
/** @type {?} */
var allPlayers = [];
/** @type {?} */
var erroneousTransitions = [];
for (var _i6 = this._namespaceList.length - 1; _i6 >= 0; _i6--) {
/** @type {?} */
var ns = this._namespaceList[_i6];
ns.drainQueuedTransitions(microtaskId).forEach(
/**
* @param {?} entry
* @return {?}
*/
/**
* @param {?} entry
* @return {?}
*/
function (entry) {
/** @type {?} */
var player = entry.player;
/** @type {?} */
var element = entry.element;
allPlayers.push(player);
if (_this35.collectedEnterElements.length) {
/** @type {?} */
var _details =
/** @type {?} */
element[REMOVAL_FLAG]; // move animations are currently not supported...
if (_details && _details.setForMove) {
player.destroy();
return;
}
}
/** @type {?} */
var nodeIsOrphaned = !bodyNode || !_this35.driver.containsElement(bodyNode, element);
/** @type {?} */
var leaveClassName =
/** @type {?} */
leaveNodeMapIds.get(element);
/** @type {?} */
var enterClassName =
/** @type {?} */
enterNodeMapIds.get(element);
/** @type {?} */
var instruction =
/** @type {?} */
_this35._buildInstruction(entry, subTimelines, enterClassName, leaveClassName, nodeIsOrphaned);
if (instruction.errors && instruction.errors.length) {
erroneousTransitions.push(instruction);
return;
} // even though the element may not be apart of the DOM, it may
// still be added at a later point (due to the mechanics of content
// projection and/or dynamic component insertion) therefore it's
// important we still style the element.
if (nodeIsOrphaned) {
player.onStart(
/**
* @return {?}
*/
function () {
return eraseStyles(element, instruction.fromStyles);
});
player.onDestroy(
/**
* @return {?}
*/
function () {
return setStyles(element, instruction.toStyles);
});
skippedPlayers.push(player);
return;
} // if a unmatched transition is queued to go then it SHOULD NOT render
// an animation and cancel the previously running animations.
if (entry.isFallbackTransition) {
player.onStart(
/**
* @return {?}
*/
function () {
return eraseStyles(element, instruction.fromStyles);
});
player.onDestroy(
/**
* @return {?}
*/
function () {
return setStyles(element, instruction.toStyles);
});
skippedPlayers.push(player);
return;
} // this means that if a parent animation uses this animation as a sub trigger
// then it will instruct the timeline builder to not add a player delay, but
// instead stretch the first keyframe gap up until the animation starts. The
// reason this is important is to prevent extra initialization styles from being
// required by the user in the animation.
instruction.timelines.forEach(
/**
* @param {?} tl
* @return {?}
*/
/**
* @param {?} tl
* @return {?}
*/
function (tl) {
return tl.stretchStartingKeyframe = true;
});
subTimelines.append(element, instruction.timelines);
/** @type {?} */
var tuple = {
instruction: instruction,
player: player,
element: element
};
queuedInstructions.push(tuple);
instruction.queriedElements.forEach(
/**
* @param {?} element
* @return {?}
*/
/**
* @param {?} element
* @return {?}
*/
function (element) {
return getOrSetAsInMap(queriedElements, element, []).push(player);
});
instruction.preStyleProps.forEach(
/**
* @param {?} stringMap
* @param {?} element
* @return {?}
*/
function (stringMap, element) {
/** @type {?} */
var props = Object.keys(stringMap);
if (props.length) {
/** @type {?} */
var setVal =
/** @type {?} */
allPreStyleElements.get(element);
if (!setVal) {
allPreStyleElements.set(element, setVal = new Set());
}
props.forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
return setVal.add(prop);
});
}
});
instruction.postStyleProps.forEach(
/**
* @param {?} stringMap
* @param {?} element
* @return {?}
*/
function (stringMap, element) {
/** @type {?} */
var props = Object.keys(stringMap);
/** @type {?} */
var setVal =
/** @type {?} */
allPostStyleElements.get(element);
if (!setVal) {
allPostStyleElements.set(element, setVal = new Set());
}
props.forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
return setVal.add(prop);
});
});
});
}
if (erroneousTransitions.length) {
/** @type {?} */
var errors = [];
erroneousTransitions.forEach(
/**
* @param {?} instruction
* @return {?}
*/
/**
* @param {?} instruction
* @return {?}
*/
function (instruction) {
errors.push("@".concat(instruction.triggerName, " has failed due to:\n"));
/** @type {?} */
instruction.errors.forEach(
/**
* @param {?} error
* @return {?}
*/
/**
* @param {?} error
* @return {?}
*/
function (error) {
return errors.push("- ".concat(error, "\n"));
});
});
allPlayers.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
return player.destroy();
});
this.reportError(errors);
}
/** @type {?} */
var allPreviousPlayersMap = new Map(); // this map works to tell which element in the DOM tree is contained by
// which animation. Further down below this map will get populated once
// the players are built and in doing so it can efficiently figure out
// if a sub player is skipped due to a parent player having priority.
/** @type {?} */
var animationElementMap = new Map();
queuedInstructions.forEach(
/**
* @param {?} entry
* @return {?}
*/
/**
* @param {?} entry
* @return {?}
*/
function (entry) {
/** @type {?} */
var element = entry.element;
if (subTimelines.has(element)) {
animationElementMap.set(element, element);
_this35._beforeAnimationBuild(entry.player.namespaceId, entry.instruction, allPreviousPlayersMap);
}
});
skippedPlayers.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
/** @type {?} */
var element = player.element;
/** @type {?} */
var previousPlayers = _this35._getPreviousPlayers(element, false, player.namespaceId, player.triggerName, null);
previousPlayers.forEach(
/**
* @param {?} prevPlayer
* @return {?}
*/
/**
* @param {?} prevPlayer
* @return {?}
*/
function (prevPlayer) {
getOrSetAsInMap(allPreviousPlayersMap, element, []).push(prevPlayer);
prevPlayer.destroy();
});
}); // this is a special case for nodes that will be removed (either by)
// having their own leave animations or by being queried in a container
// that will be removed once a parent animation is complete. The idea
// here is that * styles must be identical to ! styles because of
// backwards compatibility (* is also filled in by default in many places).
// Otherwise * styles will return an empty value or auto since the element
// that is being getComputedStyle'd will not be visible (since * = destination)
/** @type {?} */
var replaceNodes = allLeaveNodes.filter(
/**
* @param {?} node
* @return {?}
*/
/**
* @param {?} node
* @return {?}
*/
function (node) {
return replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements);
}); // POST STAGE: fill the * styles
/** @type {?} */
var postStylesMap = new Map();
/** @type {?} */
var allLeaveQueriedNodes = cloakAndComputeStyles(postStylesMap, this.driver, leaveNodesWithoutAnimations, allPostStyleElements, _angular_animations__WEBPACK_IMPORTED_MODULE_0__["AUTO_STYLE"]);
allLeaveQueriedNodes.forEach(
/**
* @param {?} node
* @return {?}
*/
/**
* @param {?} node
* @return {?}
*/
function (node) {
if (replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements)) {
replaceNodes.push(node);
}
}); // PRE STAGE: fill the ! styles
/** @type {?} */
var preStylesMap = new Map();
enterNodeMap.forEach(
/**
* @param {?} nodes
* @param {?} root
* @return {?}
*/
function (nodes, root) {
cloakAndComputeStyles(preStylesMap, _this35.driver, new Set(nodes), allPreStyleElements, _angular_animations__WEBPACK_IMPORTED_MODULE_0__["ɵPRE_STYLE"]);
});
replaceNodes.forEach(
/**
* @param {?} node
* @return {?}
*/
/**
* @param {?} node
* @return {?}
*/
function (node) {
/** @type {?} */
var post = postStylesMap.get(node);
/** @type {?} */
var pre = preStylesMap.get(node);
postStylesMap.set(node,
/** @type {?} */
Object.assign(Object.assign({}, post), pre));
});
/** @type {?} */
var rootPlayers = [];
/** @type {?} */
var subPlayers = [];
/** @type {?} */
var NO_PARENT_ANIMATION_ELEMENT_DETECTED = {};
queuedInstructions.forEach(
/**
* @param {?} entry
* @return {?}
*/
/**
* @param {?} entry
* @return {?}
*/
function (entry) {
var element = entry.element,
player = entry.player,
instruction = entry.instruction; // this means that it was never consumed by a parent animation which
// means that it is independent and therefore should be set for animation
if (subTimelines.has(element)) {
if (disabledElementsSet.has(element)) {
player.onDestroy(
/**
* @return {?}
*/
function () {
return setStyles(element, instruction.toStyles);
});
player.disabled = true;
player.overrideTotalTime(instruction.totalTime);
skippedPlayers.push(player);
return;
} // this will flow up the DOM and query the map to figure out
// if a parent animation has priority over it. In the situation
// that a parent is detected then it will cancel the loop. If
// nothing is detected, or it takes a few hops to find a parent,
// then it will fill in the missing nodes and signal them as having
// a detected parent (or a NO_PARENT value via a special constant).
/** @type {?} */
var parentWithAnimation = NO_PARENT_ANIMATION_ELEMENT_DETECTED;
if (animationElementMap.size > 1) {
/** @type {?} */
var elm = element;
/** @type {?} */
var parentsToAdd = [];
while (elm = elm.parentNode) {
/** @type {?} */
var detectedParent = animationElementMap.get(elm);
if (detectedParent) {
parentWithAnimation = detectedParent;
break;
}
parentsToAdd.push(elm);
}
parentsToAdd.forEach(
/**
* @param {?} parent
* @return {?}
*/
/**
* @param {?} parent
* @return {?}
*/
function (parent) {
return animationElementMap.set(parent, parentWithAnimation);
});
}
/** @type {?} */
var innerPlayer = _this35._buildAnimation(player.namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap);
player.setRealPlayer(innerPlayer);
if (parentWithAnimation === NO_PARENT_ANIMATION_ELEMENT_DETECTED) {
rootPlayers.push(player);
} else {
/** @type {?} */
var parentPlayers = _this35.playersByElement.get(parentWithAnimation);
if (parentPlayers && parentPlayers.length) {
player.parentPlayer = optimizeGroupPlayer(parentPlayers);
}
skippedPlayers.push(player);
}
} else {
eraseStyles(element, instruction.fromStyles);
player.onDestroy(
/**
* @return {?}
*/
function () {
return setStyles(element, instruction.toStyles);
}); // there still might be a ancestor player animating this
// element therefore we will still add it as a sub player
// even if its animation may be disabled
subPlayers.push(player);
if (disabledElementsSet.has(element)) {
skippedPlayers.push(player);
}
}
}); // find all of the sub players' corresponding inner animation player
subPlayers.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
// even if any players are not found for a sub animation then it
// will still complete itself after the next tick since it's Noop
/** @type {?} */
var playersForElement = skippedPlayersMap.get(player.element);
if (playersForElement && playersForElement.length) {
/** @type {?} */
var innerPlayer = optimizeGroupPlayer(playersForElement);
player.setRealPlayer(innerPlayer);
}
}); // the reason why we don't actually play the animation is
// because all that a skipped player is designed to do is to
// fire the start/done transition callback events
skippedPlayers.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
if (player.parentPlayer) {
player.syncPlayerEvents(player.parentPlayer);
} else {
player.destroy();
}
}); // run through all of the queued removals and see if they
// were picked up by a query. If not then perform the removal
// operation right away unless a parent animation is ongoing.
for (var _i7 = 0; _i7 < allLeaveNodes.length; _i7++) {
/** @type {?} */
var _element2 = allLeaveNodes[_i7];
/** @type {?} */
var _details2 =
/** @type {?} */
_element2[REMOVAL_FLAG];
removeClass(_element2, LEAVE_CLASSNAME); // this means the element has a removal animation that is being
// taken care of and therefore the inner elements will hang around
// until that animation is over (or the parent queried animation)
if (_details2 && _details2.hasAnimation) continue;
/** @type {?} */
var players = []; // if this element is queried or if it contains queried children
// then we want for the element not to be removed from the page
// until the queried animations have finished
if (queriedElements.size) {
/** @type {?} */
var queriedPlayerResults = queriedElements.get(_element2);
if (queriedPlayerResults && queriedPlayerResults.length) {
players.push.apply(players, _toConsumableArray(queriedPlayerResults));
}
/** @type {?} */
var queriedInnerElements = this.driver.query(_element2, NG_ANIMATING_SELECTOR, true);
for (var j = 0; j < queriedInnerElements.length; j++) {
/** @type {?} */
var queriedPlayers = queriedElements.get(queriedInnerElements[j]);
if (queriedPlayers && queriedPlayers.length) {
players.push.apply(players, _toConsumableArray(queriedPlayers));
}
}
}
/** @type {?} */
var activePlayers = players.filter(
/**
* @param {?} p
* @return {?}
*/
/**
* @param {?} p
* @return {?}
*/
function (p) {
return !p.destroyed;
});
if (activePlayers.length) {
removeNodesAfterAnimationDone(this, _element2, activePlayers);
} else {
this.processLeaveNode(_element2);
}
} // this is required so the cleanup method doesn't remove them
allLeaveNodes.length = 0;
rootPlayers.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
_this35.players.push(player);
player.onDone(
/**
* @return {?}
*/
function () {
player.destroy();
/** @type {?} */
var index = _this35.players.indexOf(player);
_this35.players.splice(index, 1);
});
player.play();
});
return rootPlayers;
}
/**
* @param {?} namespaceId
* @param {?} element
* @return {?}
*/
}, {
key: "elementContainsData",
value: function elementContainsData(namespaceId, element) {
/** @type {?} */
var containsData = false;
/** @type {?} */
var details =
/** @type {?} */
element[REMOVAL_FLAG];
if (details && details.setForRemoval) containsData = true;
if (this.playersByElement.has(element)) containsData = true;
if (this.playersByQueriedElement.has(element)) containsData = true;
if (this.statesByElement.has(element)) containsData = true;
return this._fetchNamespace(namespaceId).elementContainsData(element) || containsData;
}
/**
* @param {?} callback
* @return {?}
*/
}, {
key: "afterFlush",
value: function afterFlush(callback) {
this._flushFns.push(callback);
}
/**
* @param {?} callback
* @return {?}
*/
}, {
key: "afterFlushAnimationsDone",
value: function afterFlushAnimationsDone(callback) {
this._whenQuietFns.push(callback);
}
/**
* @private
* @param {?} element
* @param {?} isQueriedElement
* @param {?=} namespaceId
* @param {?=} triggerName
* @param {?=} toStateValue
* @return {?}
*/
}, {
key: "_getPreviousPlayers",
value: function _getPreviousPlayers(element, isQueriedElement, namespaceId, triggerName, toStateValue) {
/** @type {?} */
var players = [];
if (isQueriedElement) {
/** @type {?} */
var queriedElementPlayers = this.playersByQueriedElement.get(element);
if (queriedElementPlayers) {
players = queriedElementPlayers;
}
} else {
/** @type {?} */
var elementPlayers = this.playersByElement.get(element);
if (elementPlayers) {
/** @type {?} */
var isRemovalAnimation = !toStateValue || toStateValue == VOID_VALUE;
elementPlayers.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
if (player.queued) return;
if (!isRemovalAnimation && player.triggerName != triggerName) return;
players.push(player);
});
}
}
if (namespaceId || triggerName) {
players = players.filter(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
if (namespaceId && namespaceId != player.namespaceId) return false;
if (triggerName && triggerName != player.triggerName) return false;
return true;
});
}
return players;
}
/**
* @private
* @param {?} namespaceId
* @param {?} instruction
* @param {?} allPreviousPlayersMap
* @return {?}
*/
}, {
key: "_beforeAnimationBuild",
value: function _beforeAnimationBuild(namespaceId, instruction, allPreviousPlayersMap) {
var _this36 = this;
/** @type {?} */
var triggerName = instruction.triggerName;
/** @type {?} */
var rootElement = instruction.element; // when a removal animation occurs, ALL previous players are collected
// and destroyed (even if they are outside of the current namespace)
/** @type {?} */
var targetNameSpaceId = instruction.isRemovalTransition ? undefined : namespaceId;
/** @type {?} */
var targetTriggerName = instruction.isRemovalTransition ? undefined : triggerName;
var _iterator = _createForOfIteratorHelper(instruction.timelines),
_step;
try {
var _loop2 = function _loop2() {
var timelineInstruction = _step.value;
/** @type {?} */
var element = timelineInstruction.element;
/** @type {?} */
var isQueriedElement = element !== rootElement;
/** @type {?} */
var players = getOrSetAsInMap(allPreviousPlayersMap, element, []);
/** @type {?} */
var previousPlayers = _this36._getPreviousPlayers(element, isQueriedElement, targetNameSpaceId, targetTriggerName, instruction.toState);
previousPlayers.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
/** @type {?} */
var realPlayer =
/** @type {?} */
/** @type {?} */
player.getRealPlayer();
if (realPlayer.beforeDestroy) {
realPlayer.beforeDestroy();
}
player.destroy();
players.push(player);
});
};
for (_iterator.s(); !(_step = _iterator.n()).done;) {
_loop2();
} // this needs to be done so that the PRE/POST styles can be
// computed properly without interfering with the previous animation
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
eraseStyles(rootElement, instruction.fromStyles);
}
/**
* @private
* @param {?} namespaceId
* @param {?} instruction
* @param {?} allPreviousPlayersMap
* @param {?} skippedPlayersMap
* @param {?} preStylesMap
* @param {?} postStylesMap
* @return {?}
*/
}, {
key: "_buildAnimation",
value: function _buildAnimation(namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap) {
var _this37 = this;
/** @type {?} */
var triggerName = instruction.triggerName;
/** @type {?} */
var rootElement = instruction.element; // we first run this so that the previous animation player
// data can be passed into the successive animation players
/** @type {?} */
var allQueriedPlayers = [];
/** @type {?} */
var allConsumedElements = new Set();
/** @type {?} */
var allSubElements = new Set();
/** @type {?} */
var allNewPlayers = instruction.timelines.map(
/**
* @param {?} timelineInstruction
* @return {?}
*/
/**
* @param {?} timelineInstruction
* @return {?}
*/
function (timelineInstruction) {
/** @type {?} */
var element = timelineInstruction.element;
allConsumedElements.add(element); // FIXME (matsko): make sure to-be-removed animations are removed properly
/** @type {?} */
var details = element[REMOVAL_FLAG];
if (details && details.removedBeforeQueried) return new _angular_animations__WEBPACK_IMPORTED_MODULE_0__["NoopAnimationPlayer"](timelineInstruction.duration, timelineInstruction.delay);
/** @type {?} */
var isQueriedElement = element !== rootElement;
/** @type {?} */
var previousPlayers = flattenGroupPlayers((allPreviousPlayersMap.get(element) || EMPTY_PLAYER_ARRAY).map(
/**
* @param {?} p
* @return {?}
*/
/**
* @param {?} p
* @return {?}
*/
function (p) {
return p.getRealPlayer();
})).filter(
/**
* @param {?} p
* @return {?}
*/
/**
* @param {?} p
* @return {?}
*/
function (p) {
// the `element` is not apart of the AnimationPlayer definition, but
// Mock/WebAnimations
// use the element within their implementation. This will be added in Angular5 to
// AnimationPlayer
/** @type {?} */
var pp =
/** @type {?} */
p;
return pp.element ? pp.element === element : false;
});
/** @type {?} */
var preStyles = preStylesMap.get(element);
/** @type {?} */
var postStyles = postStylesMap.get(element);
/** @type {?} */
var keyframes = normalizeKeyframes(_this37.driver, _this37._normalizer, element, timelineInstruction.keyframes, preStyles, postStyles);
/** @type {?} */
var player = _this37._buildPlayer(timelineInstruction, keyframes, previousPlayers); // this means that this particular player belongs to a sub trigger. It is
// important that we match this player up with the corresponding (@trigger.listener)
if (timelineInstruction.subTimeline && skippedPlayersMap) {
allSubElements.add(element);
}
if (isQueriedElement) {
/** @type {?} */
var wrappedPlayer = new TransitionAnimationPlayer(namespaceId, triggerName, element);
wrappedPlayer.setRealPlayer(player);
allQueriedPlayers.push(wrappedPlayer);
}
return player;
});
allQueriedPlayers.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
getOrSetAsInMap(_this37.playersByQueriedElement, player.element, []).push(player);
player.onDone(
/**
* @return {?}
*/
function () {
return deleteOrUnsetInMap(_this37.playersByQueriedElement, player.element, player);
});
});
allConsumedElements.forEach(
/**
* @param {?} element
* @return {?}
*/
/**
* @param {?} element
* @return {?}
*/
function (element) {
return addClass(element, NG_ANIMATING_CLASSNAME);
});
/** @type {?} */
var player = optimizeGroupPlayer(allNewPlayers);
player.onDestroy(
/**
* @return {?}
*/
function () {
allConsumedElements.forEach(
/**
* @param {?} element
* @return {?}
*/
/**
* @param {?} element
* @return {?}
*/
function (element) {
return removeClass(element, NG_ANIMATING_CLASSNAME);
});
setStyles(rootElement, instruction.toStyles);
}); // this basically makes all of the callbacks for sub element animations
// be dependent on the upper players for when they finish
allSubElements.forEach(
/**
* @param {?} element
* @return {?}
*/
/**
* @param {?} element
* @return {?}
*/
function (element) {
getOrSetAsInMap(skippedPlayersMap, element, []).push(player);
});
return player;
}
/**
* @private
* @param {?} instruction
* @param {?} keyframes
* @param {?} previousPlayers
* @return {?}
*/
}, {
key: "_buildPlayer",
value: function _buildPlayer(instruction, keyframes, previousPlayers) {
if (keyframes.length > 0) {
return this.driver.animate(instruction.element, keyframes, instruction.duration, instruction.delay, instruction.easing, previousPlayers);
} // special case for when an empty transition|definition is provided
// ... there is no point in rendering an empty animation
return new _angular_animations__WEBPACK_IMPORTED_MODULE_0__["NoopAnimationPlayer"](instruction.duration, instruction.delay);
}
}]);
return TransitionAnimationEngine;
}();
if (false) {}
var TransitionAnimationPlayer = /*#__PURE__*/function () {
/**
* @param {?} namespaceId
* @param {?} triggerName
* @param {?} element
*/
function TransitionAnimationPlayer(namespaceId, triggerName, element) {
_classCallCheck(this, TransitionAnimationPlayer);
this.namespaceId = namespaceId;
this.triggerName = triggerName;
this.element = element;
this._player = new _angular_animations__WEBPACK_IMPORTED_MODULE_0__["NoopAnimationPlayer"]();
this._containsRealPlayer = false;
this._queuedCallbacks = {};
this.destroyed = false;
this.markedForDestroy = false;
this.disabled = false;
this.queued = true;
this.totalTime = 0;
}
/**
* @param {?} player
* @return {?}
*/
_createClass2(TransitionAnimationPlayer, [{
key: "setRealPlayer",
value: function setRealPlayer(player) {
var _this38 = this;
if (this._containsRealPlayer) return;
this._player = player;
Object.keys(this._queuedCallbacks).forEach(
/**
* @param {?} phase
* @return {?}
*/
/**
* @param {?} phase
* @return {?}
*/
function (phase) {
_this38._queuedCallbacks[phase].forEach(
/**
* @param {?} callback
* @return {?}
*/
/**
* @param {?} callback
* @return {?}
*/
function (callback) {
return listenOnPlayer(player, phase, undefined, callback);
});
});
this._queuedCallbacks = {};
this._containsRealPlayer = true;
this.overrideTotalTime(player.totalTime);
/** @type {?} */
this.queued = false;
}
/**
* @return {?}
*/
}, {
key: "getRealPlayer",
value: function getRealPlayer() {
return this._player;
}
/**
* @param {?} totalTime
* @return {?}
*/
}, {
key: "overrideTotalTime",
value: function overrideTotalTime(totalTime) {
/** @type {?} */
this.totalTime = totalTime;
}
/**
* @param {?} player
* @return {?}
*/
}, {
key: "syncPlayerEvents",
value: function syncPlayerEvents(player) {
var _this39 = this;
/** @type {?} */
var p =
/** @type {?} */
this._player;
if (p.triggerCallback) {
player.onStart(
/**
* @return {?}
*/
function () {
return (
/** @type {?} */
p.triggerCallback('start')
);
});
}
player.onDone(
/**
* @return {?}
*/
function () {
return _this39.finish();
});
player.onDestroy(
/**
* @return {?}
*/
function () {
return _this39.destroy();
});
}
/**
* @private
* @param {?} name
* @param {?} callback
* @return {?}
*/
}, {
key: "_queueEvent",
value: function _queueEvent(name, callback) {
getOrSetAsInMap(this._queuedCallbacks, name, []).push(callback);
}
/**
* @param {?} fn
* @return {?}
*/
}, {
key: "onDone",
value: function onDone(fn) {
if (this.queued) {
this._queueEvent('done', fn);
}
this._player.onDone(fn);
}
/**
* @param {?} fn
* @return {?}
*/
}, {
key: "onStart",
value: function onStart(fn) {
if (this.queued) {
this._queueEvent('start', fn);
}
this._player.onStart(fn);
}
/**
* @param {?} fn
* @return {?}
*/
}, {
key: "onDestroy",
value: function onDestroy(fn) {
if (this.queued) {
this._queueEvent('destroy', fn);
}
this._player.onDestroy(fn);
}
/**
* @return {?}
*/
}, {
key: "init",
value: function init() {
this._player.init();
}
/**
* @return {?}
*/
}, {
key: "hasStarted",
value: function hasStarted() {
return this.queued ? false : this._player.hasStarted();
}
/**
* @return {?}
*/
}, {
key: "play",
value: function play() {
!this.queued && this._player.play();
}
/**
* @return {?}
*/
}, {
key: "pause",
value: function pause() {
!this.queued && this._player.pause();
}
/**
* @return {?}
*/
}, {
key: "restart",
value: function restart() {
!this.queued && this._player.restart();
}
/**
* @return {?}
*/
}, {
key: "finish",
value: function finish() {
this._player.finish();
}
/**
* @return {?}
*/
}, {
key: "destroy",
value: function destroy() {
/** @type {?} */
this.destroyed = true;
this._player.destroy();
}
/**
* @return {?}
*/
}, {
key: "reset",
value: function reset() {
!this.queued && this._player.reset();
}
/**
* @param {?} p
* @return {?}
*/
}, {
key: "setPosition",
value: function setPosition(p) {
if (!this.queued) {
this._player.setPosition(p);
}
}
/**
* @return {?}
*/
}, {
key: "getPosition",
value: function getPosition() {
return this.queued ? 0 : this._player.getPosition();
}
/**
* \@internal
* @param {?} phaseName
* @return {?}
*/
}, {
key: "triggerCallback",
value: function triggerCallback(phaseName) {
/** @type {?} */
var p =
/** @type {?} */
this._player;
if (p.triggerCallback) {
p.triggerCallback(phaseName);
}
}
}]);
return TransitionAnimationPlayer;
}();
if (false) {}
/**
* @param {?} map
* @param {?} key
* @param {?} value
* @return {?}
*/
function deleteOrUnsetInMap(map, key, value) {
/** @type {?} */
var currentValues;
if (map instanceof Map) {
currentValues = map.get(key);
if (currentValues) {
if (currentValues.length) {
/** @type {?} */
var index = currentValues.indexOf(value);
currentValues.splice(index, 1);
}
if (currentValues.length == 0) {
map["delete"](key);
}
}
} else {
currentValues = map[key];
if (currentValues) {
if (currentValues.length) {
/** @type {?} */
var _index2 = currentValues.indexOf(value);
currentValues.splice(_index2, 1);
}
if (currentValues.length == 0) {
delete map[key];
}
}
}
return currentValues;
}
/**
* @param {?} value
* @return {?}
*/
function normalizeTriggerValue(value) {
// we use `!= null` here because it's the most simple
// way to test against a "falsy" value without mixing
// in empty strings or a zero value. DO NOT OPTIMIZE.
return value != null ? value : null;
}
/**
* @param {?} node
* @return {?}
*/
function isElementNode(node) {
return node && node['nodeType'] === 1;
}
/**
* @param {?} eventName
* @return {?}
*/
function isTriggerEventValid(eventName) {
return eventName == 'start' || eventName == 'done';
}
/**
* @param {?} element
* @param {?=} value
* @return {?}
*/
function cloakElement(element, value) {
/** @type {?} */
var oldValue = element.style.display;
element.style.display = value != null ? value : 'none';
return oldValue;
}
/**
* @param {?} valuesMap
* @param {?} driver
* @param {?} elements
* @param {?} elementPropsMap
* @param {?} defaultStyle
* @return {?}
*/
function cloakAndComputeStyles(valuesMap, driver, elements, elementPropsMap, defaultStyle) {
/** @type {?} */
var cloakVals = [];
elements.forEach(
/**
* @param {?} element
* @return {?}
*/
/**
* @param {?} element
* @return {?}
*/
function (element) {
return cloakVals.push(cloakElement(element));
});
/** @type {?} */
var failedElements = [];
elementPropsMap.forEach(
/**
* @param {?} props
* @param {?} element
* @return {?}
*/
function (props, element) {
/** @type {?} */
var styles = {};
props.forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
/** @type {?} */
var value = styles[prop] = driver.computeStyle(element, prop, defaultStyle); // there is no easy way to detect this because a sub element could be removed
// by a parent animation element being detached.
if (!value || value.length == 0) {
element[REMOVAL_FLAG] = NULL_REMOVED_QUERIED_STATE;
failedElements.push(element);
}
});
valuesMap.set(element, styles);
}); // we use a index variable here since Set.forEach(a, i) does not return
// an index value for the closure (but instead just the value)
/** @type {?} */
var i = 0;
elements.forEach(
/**
* @param {?} element
* @return {?}
*/
/**
* @param {?} element
* @return {?}
*/
function (element) {
return cloakElement(element, cloakVals[i++]);
});
return failedElements;
}
/*
Since the Angular renderer code will return a collection of inserted
nodes in all areas of a DOM tree, it's up to this algorithm to figure
out which nodes are roots for each animation @trigger.
By placing each inserted node into a Set and traversing upwards, it
is possible to find the @trigger elements and well any direct *star
insertion nodes, if a @trigger root is found then the enter element
is placed into the Map[@trigger] spot.
*/
/**
* @param {?} roots
* @param {?} nodes
* @return {?}
*/
function buildRootMap(roots, nodes) {
/** @type {?} */
var rootMap = new Map();
roots.forEach(
/**
* @param {?} root
* @return {?}
*/
/**
* @param {?} root
* @return {?}
*/
function (root) {
return rootMap.set(root, []);
});
if (nodes.length == 0) return rootMap;
/** @type {?} */
var NULL_NODE = 1;
/** @type {?} */
var nodeSet = new Set(nodes);
/** @type {?} */
var localRootMap = new Map();
/**
* @param {?} node
* @return {?}
*/
function getRoot(node) {
if (!node) return NULL_NODE;
/** @type {?} */
var root = localRootMap.get(node);
if (root) return root;
/** @type {?} */
var parent = node.parentNode;
if (rootMap.has(parent)) {
// ngIf inside @trigger
root = parent;
} else if (nodeSet.has(parent)) {
// ngIf inside ngIf
root = NULL_NODE;
} else {
// recurse upwards
root = getRoot(parent);
}
localRootMap.set(node, root);
return root;
}
nodes.forEach(
/**
* @param {?} node
* @return {?}
*/
/**
* @param {?} node
* @return {?}
*/
function (node) {
/** @type {?} */
var root = getRoot(node);
if (root !== NULL_NODE) {
/** @type {?} */
rootMap.get(root).push(node);
}
});
return rootMap;
}
/** @type {?} */
var CLASSES_CACHE_KEY = '$$classes';
/**
* @param {?} element
* @param {?} className
* @return {?}
*/
function containsClass(element, className) {
if (element.classList) {
return element.classList.contains(className);
} else {
/** @type {?} */
var classes = element[CLASSES_CACHE_KEY];
return classes && classes[className];
}
}
/**
* @param {?} element
* @param {?} className
* @return {?}
*/
function addClass(element, className) {
if (element.classList) {
element.classList.add(className);
} else {
/** @type {?} */
var classes = element[CLASSES_CACHE_KEY];
if (!classes) {
classes = element[CLASSES_CACHE_KEY] = {};
}
classes[className] = true;
}
}
/**
* @param {?} element
* @param {?} className
* @return {?}
*/
function removeClass(element, className) {
if (element.classList) {
element.classList.remove(className);
} else {
/** @type {?} */
var classes = element[CLASSES_CACHE_KEY];
if (classes) {
delete classes[className];
}
}
}
/**
* @param {?} engine
* @param {?} element
* @param {?} players
* @return {?}
*/
function removeNodesAfterAnimationDone(engine, element, players) {
optimizeGroupPlayer(players).onDone(
/**
* @return {?}
*/
function () {
return engine.processLeaveNode(element);
});
}
/**
* @param {?} players
* @return {?}
*/
function flattenGroupPlayers(players) {
/** @type {?} */
var finalPlayers = [];
_flattenGroupPlayersRecur(players, finalPlayers);
return finalPlayers;
}
/**
* @param {?} players
* @param {?} finalPlayers
* @return {?}
*/
function _flattenGroupPlayersRecur(players, finalPlayers) {
for (var i = 0; i < players.length; i++) {
/** @type {?} */
var player = players[i];
if (player instanceof _angular_animations__WEBPACK_IMPORTED_MODULE_0__["ɵAnimationGroupPlayer"]) {
_flattenGroupPlayersRecur(player.players, finalPlayers);
} else {
finalPlayers.push(player);
}
}
}
/**
* @param {?} a
* @param {?} b
* @return {?}
*/
function objEquals(a, b) {
/** @type {?} */
var k1 = Object.keys(a);
/** @type {?} */
var k2 = Object.keys(b);
if (k1.length != k2.length) return false;
for (var i = 0; i < k1.length; i++) {
/** @type {?} */
var prop = k1[i];
if (!b.hasOwnProperty(prop) || a[prop] !== b[prop]) return false;
}
return true;
}
/**
* @param {?} element
* @param {?} allPreStyleElements
* @param {?} allPostStyleElements
* @return {?}
*/
function replacePostStylesAsPre(element, allPreStyleElements, allPostStyleElements) {
/** @type {?} */
var postEntry = allPostStyleElements.get(element);
if (!postEntry) return false;
/** @type {?} */
var preEntry = allPreStyleElements.get(element);
if (preEntry) {
postEntry.forEach(
/**
* @param {?} data
* @return {?}
*/
/**
* @param {?} data
* @return {?}
*/
function (data) {
return (
/** @type {?} */
preEntry.add(data)
);
});
} else {
allPreStyleElements.set(element, postEntry);
}
allPostStyleElements["delete"](element);
return true;
}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/render/animation_engine_next.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var AnimationEngine = /*#__PURE__*/function () {
/**
* @param {?} bodyNode
* @param {?} _driver
* @param {?} normalizer
*/
function AnimationEngine(bodyNode, _driver, normalizer) {
var _this40 = this;
_classCallCheck(this, AnimationEngine);
this.bodyNode = bodyNode;
this._driver = _driver;
this._triggerCache = {}; // this method is designed to be overridden by the code that uses this engine
this.onRemovalComplete =
/**
* @param {?} element
* @param {?} context
* @return {?}
*/
function (element, context) {};
this._transitionEngine = new TransitionAnimationEngine(bodyNode, _driver, normalizer);
this._timelineEngine = new TimelineAnimationEngine(bodyNode, _driver, normalizer);
this._transitionEngine.onRemovalComplete =
/**
* @param {?} element
* @param {?} context
* @return {?}
*/
function (element, context) {
return _this40.onRemovalComplete(element, context);
};
}
/**
* @param {?} componentId
* @param {?} namespaceId
* @param {?} hostElement
* @param {?} name
* @param {?} metadata
* @return {?}
*/
_createClass2(AnimationEngine, [{
key: "registerTrigger",
value: function registerTrigger(componentId, namespaceId, hostElement, name, metadata) {
/** @type {?} */
var cacheKey = componentId + '-' + name;
/** @type {?} */
var trigger = this._triggerCache[cacheKey];
if (!trigger) {
/** @type {?} */
var errors = [];
/** @type {?} */
var ast =
/** @type {?} */
buildAnimationAst(this._driver,
/** @type {?} */
metadata, errors);
if (errors.length) {
throw new Error("The animation trigger \"".concat(name, "\" has failed to build due to the following errors:\n - ").concat(errors.join('\n - ')));
}
trigger = buildTrigger(name, ast);
this._triggerCache[cacheKey] = trigger;
}
this._transitionEngine.registerTrigger(namespaceId, name, trigger);
}
/**
* @param {?} namespaceId
* @param {?} hostElement
* @return {?}
*/
}, {
key: "register",
value: function register(namespaceId, hostElement) {
this._transitionEngine.register(namespaceId, hostElement);
}
/**
* @param {?} namespaceId
* @param {?} context
* @return {?}
*/
}, {
key: "destroy",
value: function destroy(namespaceId, context) {
this._transitionEngine.destroy(namespaceId, context);
}
/**
* @param {?} namespaceId
* @param {?} element
* @param {?} parent
* @param {?} insertBefore
* @return {?}
*/
}, {
key: "onInsert",
value: function onInsert(namespaceId, element, parent, insertBefore) {
this._transitionEngine.insertNode(namespaceId, element, parent, insertBefore);
}
/**
* @param {?} namespaceId
* @param {?} element
* @param {?} context
* @param {?=} isHostElement
* @return {?}
*/
}, {
key: "onRemove",
value: function onRemove(namespaceId, element, context, isHostElement) {
this._transitionEngine.removeNode(namespaceId, element, isHostElement || false, context);
}
/**
* @param {?} element
* @param {?} disable
* @return {?}
*/
}, {
key: "disableAnimations",
value: function disableAnimations(element, disable) {
this._transitionEngine.markElementAsDisabled(element, disable);
}
/**
* @param {?} namespaceId
* @param {?} element
* @param {?} property
* @param {?} value
* @return {?}
*/
}, {
key: "process",
value: function process(namespaceId, element, property, value) {
if (property.charAt(0) == '@') {
var _parseTimelineCommand = parseTimelineCommand(property),
_parseTimelineCommand2 = _slicedToArray(_parseTimelineCommand, 2),
id = _parseTimelineCommand2[0],
action = _parseTimelineCommand2[1];
/** @type {?} */
var args =
/** @type {?} */
value;
this._timelineEngine.command(id, element, action, args);
} else {
this._transitionEngine.trigger(namespaceId, element, property, value);
}
}
/**
* @param {?} namespaceId
* @param {?} element
* @param {?} eventName
* @param {?} eventPhase
* @param {?} callback
* @return {?}
*/
}, {
key: "listen",
value: function listen(namespaceId, element, eventName, eventPhase, callback) {
// @@listen
if (eventName.charAt(0) == '@') {
var _parseTimelineCommand3 = parseTimelineCommand(eventName),
_parseTimelineCommand4 = _slicedToArray(_parseTimelineCommand3, 2),
id = _parseTimelineCommand4[0],
action = _parseTimelineCommand4[1];
return this._timelineEngine.listen(id, element, action, callback);
}
return this._transitionEngine.listen(namespaceId, element, eventName, eventPhase, callback);
}
/**
* @param {?=} microtaskId
* @return {?}
*/
}, {
key: "flush",
value: function flush() {
var microtaskId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
this._transitionEngine.flush(microtaskId);
}
/**
* @return {?}
*/
}, {
key: "players",
get: function get() {
return (
/** @type {?} */
this._transitionEngine.players.concat(
/** @type {?} */
this._timelineEngine.players)
);
}
/**
* @return {?}
*/
}, {
key: "whenRenderingDone",
value: function whenRenderingDone() {
return this._transitionEngine.whenRenderingDone();
}
}]);
return AnimationEngine;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/render/special_cased_styles.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Returns an instance of `SpecialCasedStyles` if and when any special (non animateable) styles are
* detected.
*
* In CSS there exist properties that cannot be animated within a keyframe animation
* (whether it be via CSS keyframes or web-animations) and the animation implementation
* will ignore them. This function is designed to detect those special cased styles and
* return a container that will be executed at the start and end of the animation.
*
* @param {?} element
* @param {?} styles
* @return {?} an instance of `SpecialCasedStyles` if any special styles are detected otherwise `null`
*/
function packageNonAnimatableStyles(element, styles) {
/** @type {?} */
var startStyles = null;
/** @type {?} */
var endStyles = null;
if (Array.isArray(styles) && styles.length) {
startStyles = filterNonAnimatableStyles(styles[0]);
if (styles.length > 1) {
endStyles = filterNonAnimatableStyles(styles[styles.length - 1]);
}
} else if (styles) {
startStyles = filterNonAnimatableStyles(styles);
}
return startStyles || endStyles ? new SpecialCasedStyles(element, startStyles, endStyles) : null;
}
var SpecialCasedStyles = /*@__PURE__*/function () {
var SpecialCasedStyles = /*#__PURE__*/function () {
/**
* @param {?} _element
* @param {?} _startStyles
* @param {?} _endStyles
*/
function SpecialCasedStyles(_element, _startStyles, _endStyles) {
_classCallCheck(this, SpecialCasedStyles);
this._element = _element;
this._startStyles = _startStyles;
this._endStyles = _endStyles;
this._state = 0
/* Pending */
;
/** @type {?} */
var initialStyles = SpecialCasedStyles.initialStylesByElement.get(_element);
if (!initialStyles) {
SpecialCasedStyles.initialStylesByElement.set(_element, initialStyles = {});
}
this._initialStyles = initialStyles;
}
/**
* @return {?}
*/
_createClass2(SpecialCasedStyles, [{
key: "start",
value: function start() {
if (this._state < 1
/* Started */
) {
if (this._startStyles) {
setStyles(this._element, this._startStyles, this._initialStyles);
}
this._state = 1
/* Started */
;
}
}
/**
* @return {?}
*/
}, {
key: "finish",
value: function finish() {
this.start();
if (this._state < 2
/* Finished */
) {
setStyles(this._element, this._initialStyles);
if (this._endStyles) {
setStyles(this._element, this._endStyles);
this._endStyles = null;
}
this._state = 1
/* Started */
;
}
}
/**
* @return {?}
*/
}, {
key: "destroy",
value: function destroy() {
this.finish();
if (this._state < 3
/* Destroyed */
) {
SpecialCasedStyles.initialStylesByElement["delete"](this._element);
if (this._startStyles) {
eraseStyles(this._element, this._startStyles);
this._endStyles = null;
}
if (this._endStyles) {
eraseStyles(this._element, this._endStyles);
this._endStyles = null;
}
setStyles(this._element, this._initialStyles);
this._state = 3
/* Destroyed */
;
}
}
}]);
return SpecialCasedStyles;
}();
SpecialCasedStyles.initialStylesByElement = /*@__PURE__*/new WeakMap();
return SpecialCasedStyles;
}();
if (false) {}
/** @enum {number} */
var SpecialCasedStylesState = {
Pending: 0,
Started: 1,
Finished: 2,
Destroyed: 3
};
/**
* @param {?} styles
* @return {?}
*/
function filterNonAnimatableStyles(styles) {
/** @type {?} */
var result = null;
/** @type {?} */
var props = Object.keys(styles);
for (var i = 0; i < props.length; i++) {
/** @type {?} */
var prop = props[i];
if (isNonAnimatableStyle(prop)) {
result = result || {};
result[prop] = styles[prop];
}
}
return result;
}
/**
* @param {?} prop
* @return {?}
*/
function isNonAnimatableStyle(prop) {
return prop === 'display' || prop === 'position';
}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/render/css_keyframes/element_animation_style_handler.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @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
* @type {?}
*/
var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3;
/** @type {?} */
var ANIMATION_PROP = 'animation';
/** @type {?} */
var ANIMATIONEND_EVENT = 'animationend';
/** @type {?} */
var ONE_SECOND$1 = 1000;
var ElementAnimationStyleHandler = /*#__PURE__*/function () {
/**
* @param {?} _element
* @param {?} _name
* @param {?} _duration
* @param {?} _delay
* @param {?} _easing
* @param {?} _fillMode
* @param {?} _onDoneFn
*/
function ElementAnimationStyleHandler(_element, _name, _duration, _delay, _easing, _fillMode, _onDoneFn) {
var _this41 = this;
_classCallCheck(this, ElementAnimationStyleHandler);
this._element = _element;
this._name = _name;
this._duration = _duration;
this._delay = _delay;
this._easing = _easing;
this._fillMode = _fillMode;
this._onDoneFn = _onDoneFn;
this._finished = false;
this._destroyed = false;
this._startTime = 0;
this._position = 0;
this._eventFn =
/**
* @param {?} e
* @return {?}
*/
function (e) {
return _this41._handleCallback(e);
};
}
/**
* @return {?}
*/
_createClass2(ElementAnimationStyleHandler, [{
key: "apply",
value: function apply() {
applyKeyframeAnimation(this._element, "".concat(this._duration, "ms ").concat(this._easing, " ").concat(this._delay, "ms 1 normal ").concat(this._fillMode, " ").concat(this._name));
addRemoveAnimationEvent(this._element, this._eventFn, false);
this._startTime = Date.now();
}
/**
* @return {?}
*/
}, {
key: "pause",
value: function pause() {
playPauseAnimation(this._element, this._name, 'paused');
}
/**
* @return {?}
*/
}, {
key: "resume",
value: function resume() {
playPauseAnimation(this._element, this._name, 'running');
}
/**
* @param {?} position
* @return {?}
*/
}, {
key: "setPosition",
value: function setPosition(position) {
/** @type {?} */
var index = findIndexForAnimation(this._element, this._name);
this._position = position * this._duration;
setAnimationStyle(this._element, 'Delay', "-".concat(this._position, "ms"), index);
}
/**
* @return {?}
*/
}, {
key: "getPosition",
value: function getPosition() {
return this._position;
}
/**
* @private
* @param {?} event
* @return {?}
*/
}, {
key: "_handleCallback",
value: function _handleCallback(event) {
/** @type {?} */
var timestamp = event._ngTestManualTimestamp || Date.now();
/** @type {?} */
var elapsedTime = parseFloat(event.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES)) * ONE_SECOND$1;
if (event.animationName == this._name && Math.max(timestamp - this._startTime, 0) >= this._delay && elapsedTime >= this._duration) {
this.finish();
}
}
/**
* @return {?}
*/
}, {
key: "finish",
value: function finish() {
if (this._finished) return;
this._finished = true;
this._onDoneFn();
addRemoveAnimationEvent(this._element, this._eventFn, true);
}
/**
* @return {?}
*/
}, {
key: "destroy",
value: function destroy() {
if (this._destroyed) return;
this._destroyed = true;
this.finish();
removeKeyframeAnimation(this._element, this._name);
}
}]);
return ElementAnimationStyleHandler;
}();
if (false) {}
/**
* @param {?} element
* @param {?} name
* @param {?} status
* @return {?}
*/
function playPauseAnimation(element, name, status) {
/** @type {?} */
var index = findIndexForAnimation(element, name);
setAnimationStyle(element, 'PlayState', status, index);
}
/**
* @param {?} element
* @param {?} value
* @return {?}
*/
function applyKeyframeAnimation(element, value) {
/** @type {?} */
var anim = getAnimationStyle(element, '').trim();
/** @type {?} */
var index = 0;
if (anim.length) {
index = countChars(anim, ',') + 1;
value = "".concat(anim, ", ").concat(value);
}
setAnimationStyle(element, '', value);
return index;
}
/**
* @param {?} element
* @param {?} name
* @return {?}
*/
function removeKeyframeAnimation(element, name) {
/** @type {?} */
var anim = getAnimationStyle(element, '');
/** @type {?} */
var tokens = anim.split(',');
/** @type {?} */
var index = findMatchingTokenIndex(tokens, name);
if (index >= 0) {
tokens.splice(index, 1);
/** @type {?} */
var newValue = tokens.join(',');
setAnimationStyle(element, '', newValue);
}
}
/**
* @param {?} element
* @param {?} value
* @return {?}
*/
function findIndexForAnimation(element, value) {
/** @type {?} */
var anim = getAnimationStyle(element, '');
if (anim.indexOf(',') > 0) {
/** @type {?} */
var tokens = anim.split(',');
return findMatchingTokenIndex(tokens, value);
}
return findMatchingTokenIndex([anim], value);
}
/**
* @param {?} tokens
* @param {?} searchToken
* @return {?}
*/
function findMatchingTokenIndex(tokens, searchToken) {
for (var i = 0; i < tokens.length; i++) {
if (tokens[i].indexOf(searchToken) >= 0) {
return i;
}
}
return -1;
}
/**
* @param {?} element
* @param {?} fn
* @param {?} doRemove
* @return {?}
*/
function addRemoveAnimationEvent(element, fn, doRemove) {
doRemove ? element.removeEventListener(ANIMATIONEND_EVENT, fn) : element.addEventListener(ANIMATIONEND_EVENT, fn);
}
/**
* @param {?} element
* @param {?} name
* @param {?} value
* @param {?=} index
* @return {?}
*/
function setAnimationStyle(element, name, value, index) {
/** @type {?} */
var prop = ANIMATION_PROP + name;
if (index != null) {
/** @type {?} */
var oldValue = element.style[prop];
if (oldValue.length) {
/** @type {?} */
var tokens = oldValue.split(',');
tokens[index] = value;
value = tokens.join(',');
}
}
element.style[prop] = value;
}
/**
* @param {?} element
* @param {?} name
* @return {?}
*/
function getAnimationStyle(element, name) {
return element.style[ANIMATION_PROP + name];
}
/**
* @param {?} value
* @param {?} char
* @return {?}
*/
function countChars(value, _char) {
/** @type {?} */
var count = 0;
for (var i = 0; i < value.length; i++) {
/** @type {?} */
var c = value.charAt(i);
if (c === _char) count++;
}
return count;
}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/render/css_keyframes/css_keyframes_player.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var DEFAULT_FILL_MODE = 'forwards';
/** @type {?} */
var DEFAULT_EASING = 'linear';
/** @enum {number} */
var AnimatorControlState = {
INITIALIZED: 1,
STARTED: 2,
FINISHED: 3,
DESTROYED: 4
};
var CssKeyframesPlayer = /*#__PURE__*/function () {
/**
* @param {?} element
* @param {?} keyframes
* @param {?} animationName
* @param {?} _duration
* @param {?} _delay
* @param {?} easing
* @param {?} _finalStyles
* @param {?=} _specialStyles
*/
function CssKeyframesPlayer(element, keyframes, animationName, _duration, _delay, easing, _finalStyles, _specialStyles) {
_classCallCheck(this, CssKeyframesPlayer);
this.element = element;
this.keyframes = keyframes;
this.animationName = animationName;
this._duration = _duration;
this._delay = _delay;
this._finalStyles = _finalStyles;
this._specialStyles = _specialStyles;
this._onDoneFns = [];
this._onStartFns = [];
this._onDestroyFns = [];
this._started = false;
this.currentSnapshot = {};
this._state = 0;
this.easing = easing || DEFAULT_EASING;
this.totalTime = _duration + _delay;
this._buildStyler();
}
/**
* @param {?} fn
* @return {?}
*/
_createClass2(CssKeyframesPlayer, [{
key: "onStart",
value: function onStart(fn) {
this._onStartFns.push(fn);
}
/**
* @param {?} fn
* @return {?}
*/
}, {
key: "onDone",
value: function onDone(fn) {
this._onDoneFns.push(fn);
}
/**
* @param {?} fn
* @return {?}
*/
}, {
key: "onDestroy",
value: function onDestroy(fn) {
this._onDestroyFns.push(fn);
}
/**
* @return {?}
*/
}, {
key: "destroy",
value: function destroy() {
this.init();
if (this._state >= 4
/* DESTROYED */
) return;
this._state = 4
/* DESTROYED */
;
this._styler.destroy();
this._flushStartFns();
this._flushDoneFns();
if (this._specialStyles) {
this._specialStyles.destroy();
}
this._onDestroyFns.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
this._onDestroyFns = [];
}
/**
* @private
* @return {?}
*/
}, {
key: "_flushDoneFns",
value: function _flushDoneFns() {
this._onDoneFns.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
this._onDoneFns = [];
}
/**
* @private
* @return {?}
*/
}, {
key: "_flushStartFns",
value: function _flushStartFns() {
this._onStartFns.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
this._onStartFns = [];
}
/**
* @return {?}
*/
}, {
key: "finish",
value: function finish() {
this.init();
if (this._state >= 3
/* FINISHED */
) return;
this._state = 3
/* FINISHED */
;
this._styler.finish();
this._flushStartFns();
if (this._specialStyles) {
this._specialStyles.finish();
}
this._flushDoneFns();
}
/**
* @param {?} value
* @return {?}
*/
}, {
key: "setPosition",
value: function setPosition(value) {
this._styler.setPosition(value);
}
/**
* @return {?}
*/
}, {
key: "getPosition",
value: function getPosition() {
return this._styler.getPosition();
}
/**
* @return {?}
*/
}, {
key: "hasStarted",
value: function hasStarted() {
return this._state >= 2
/* STARTED */
;
}
/**
* @return {?}
*/
}, {
key: "init",
value: function init() {
if (this._state >= 1
/* INITIALIZED */
) return;
this._state = 1
/* INITIALIZED */
;
/** @type {?} */
var elm = this.element;
this._styler.apply();
if (this._delay) {
this._styler.pause();
}
}
/**
* @return {?}
*/
}, {
key: "play",
value: function play() {
this.init();
if (!this.hasStarted()) {
this._flushStartFns();
this._state = 2
/* STARTED */
;
if (this._specialStyles) {
this._specialStyles.start();
}
}
this._styler.resume();
}
/**
* @return {?}
*/
}, {
key: "pause",
value: function pause() {
this.init();
this._styler.pause();
}
/**
* @return {?}
*/
}, {
key: "restart",
value: function restart() {
this.reset();
this.play();
}
/**
* @return {?}
*/
}, {
key: "reset",
value: function reset() {
this._styler.destroy();
this._buildStyler();
this._styler.apply();
}
/**
* @private
* @return {?}
*/
}, {
key: "_buildStyler",
value: function _buildStyler() {
var _this42 = this;
this._styler = new ElementAnimationStyleHandler(this.element, this.animationName, this._duration, this._delay, this.easing, DEFAULT_FILL_MODE,
/**
* @return {?}
*/
function () {
return _this42.finish();
});
}
/**
* \@internal
* @param {?} phaseName
* @return {?}
*/
}, {
key: "triggerCallback",
value: function triggerCallback(phaseName) {
/** @type {?} */
var methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
methods.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
methods.length = 0;
}
/**
* @return {?}
*/
}, {
key: "beforeDestroy",
value: function beforeDestroy() {
var _this43 = this;
this.init();
/** @type {?} */
var styles = {};
if (this.hasStarted()) {
/** @type {?} */
var finished = this._state >= 3
/* FINISHED */
;
Object.keys(this._finalStyles).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
if (prop != 'offset') {
styles[prop] = finished ? _this43._finalStyles[prop] : computeStyle(_this43.element, prop);
}
});
}
this.currentSnapshot = styles;
}
}]);
return CssKeyframesPlayer;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/render/css_keyframes/direct_style_player.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var DirectStylePlayer = /*#__PURE__*/function (_angular_animations__) {
_inherits(DirectStylePlayer, _angular_animations__);
var _super4 = _createSuper(DirectStylePlayer);
/**
* @param {?} element
* @param {?} styles
*/
function DirectStylePlayer(element, styles) {
var _this44;
_classCallCheck(this, DirectStylePlayer);
_this44 = _super4.call(this);
_this44.element = element;
_this44._startingStyles = {};
_this44.__initialized = false;
_this44._styles = hypenatePropsObject(styles);
return _this44;
}
/**
* @return {?}
*/
_createClass2(DirectStylePlayer, [{
key: "init",
value: function init() {
var _this45 = this;
if (this.__initialized || !this._startingStyles) return;
this.__initialized = true;
Object.keys(this._styles).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
/** @type {?} */
_this45._startingStyles[prop] = _this45.element.style[prop];
});
_get(_getPrototypeOf(DirectStylePlayer.prototype), "init", this).call(this);
}
/**
* @return {?}
*/
}, {
key: "play",
value: function play() {
var _this46 = this;
if (!this._startingStyles) return;
this.init();
Object.keys(this._styles).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
return _this46.element.style.setProperty(prop, _this46._styles[prop]);
});
_get(_getPrototypeOf(DirectStylePlayer.prototype), "play", this).call(this);
}
/**
* @return {?}
*/
}, {
key: "destroy",
value: function destroy() {
var _this47 = this;
if (!this._startingStyles) return;
Object.keys(this._startingStyles).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
/** @type {?} */
var value =
/** @type {?} */
_this47._startingStyles[prop];
if (value) {
_this47.element.style.setProperty(prop, value);
} else {
_this47.element.style.removeProperty(prop);
}
});
this._startingStyles = null;
_get(_getPrototypeOf(DirectStylePlayer.prototype), "destroy", this).call(this);
}
}]);
return DirectStylePlayer;
}(_angular_animations__WEBPACK_IMPORTED_MODULE_0__["NoopAnimationPlayer"]);
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/render/css_keyframes/css_keyframes_driver.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var KEYFRAMES_NAME_PREFIX = 'gen_css_kf_';
/** @type {?} */
var TAB_SPACE = ' ';
var CssKeyframesDriver = /*#__PURE__*/function () {
function CssKeyframesDriver() {
_classCallCheck(this, CssKeyframesDriver);
this._count = 0;
this._head = document.querySelector('head');
this._warningIssued = false;
}
/**
* @param {?} prop
* @return {?}
*/
_createClass2(CssKeyframesDriver, [{
key: "validateStyleProperty",
value: function validateStyleProperty(prop) {
return _validateStyleProperty(prop);
}
/**
* @param {?} element
* @param {?} selector
* @return {?}
*/
}, {
key: "matchesElement",
value: function matchesElement(element, selector) {
return _matchesElement(element, selector);
}
/**
* @param {?} elm1
* @param {?} elm2
* @return {?}
*/
}, {
key: "containsElement",
value: function containsElement(elm1, elm2) {
return _containsElement(elm1, elm2);
}
/**
* @param {?} element
* @param {?} selector
* @param {?} multi
* @return {?}
*/
}, {
key: "query",
value: function query(element, selector, multi) {
return invokeQuery(element, selector, multi);
}
/**
* @param {?} element
* @param {?} prop
* @param {?=} defaultValue
* @return {?}
*/
}, {
key: "computeStyle",
value: function computeStyle(element, prop, defaultValue) {
return (
/** @type {?} */
/** @type {?} */
window.getComputedStyle(element)[prop]
);
}
/**
* @param {?} element
* @param {?} name
* @param {?} keyframes
* @return {?}
*/
}, {
key: "buildKeyframeElement",
value: function buildKeyframeElement(element, name, keyframes) {
keyframes = keyframes.map(
/**
* @param {?} kf
* @return {?}
*/
/**
* @param {?} kf
* @return {?}
*/
function (kf) {
return hypenatePropsObject(kf);
});
/** @type {?} */
var keyframeStr = "@keyframes ".concat(name, " {\n");
/** @type {?} */
var tab = '';
keyframes.forEach(
/**
* @param {?} kf
* @return {?}
*/
/**
* @param {?} kf
* @return {?}
*/
function (kf) {
tab = TAB_SPACE;
/** @type {?} */
var offset = parseFloat(kf['offset']);
keyframeStr += "".concat(tab).concat(offset * 100, "% {\n");
tab += TAB_SPACE;
Object.keys(kf).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
/** @type {?} */
var value = kf[prop];
switch (prop) {
case 'offset':
return;
case 'easing':
if (value) {
keyframeStr += "".concat(tab, "animation-timing-function: ").concat(value, ";\n");
}
return;
default:
keyframeStr += "".concat(tab).concat(prop, ": ").concat(value, ";\n");
return;
}
});
keyframeStr += "".concat(tab, "}\n");
});
keyframeStr += "}\n";
/** @type {?} */
var kfElm = document.createElement('style');
kfElm.innerHTML = keyframeStr;
return kfElm;
}
/**
* @param {?} element
* @param {?} keyframes
* @param {?} duration
* @param {?} delay
* @param {?} easing
* @param {?=} previousPlayers
* @param {?=} scrubberAccessRequested
* @return {?}
*/
}, {
key: "animate",
value: function animate(element, keyframes, duration, delay, easing) {
var previousPlayers = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : [];
var scrubberAccessRequested = arguments.length > 6 ? arguments[6] : undefined;
if (scrubberAccessRequested) {
this._notifyFaultyScrubber();
}
/** @type {?} */
var previousCssKeyframePlayers =
/** @type {?} */
previousPlayers.filter(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
return player instanceof CssKeyframesPlayer;
});
/** @type {?} */
var previousStyles = {};
if (allowPreviousPlayerStylesMerge(duration, delay)) {
previousCssKeyframePlayers.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
/** @type {?} */
var styles = player.currentSnapshot;
Object.keys(styles).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
return previousStyles[prop] = styles[prop];
});
});
}
keyframes = balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles);
/** @type {?} */
var finalStyles = flattenKeyframesIntoStyles(keyframes); // if there is no animation then there is no point in applying
// styles and waiting for an event to get fired. This causes lag.
// It's better to just directly apply the styles to the element
// via the direct styling animation player.
if (duration == 0) {
return new DirectStylePlayer(element, finalStyles);
}
/** @type {?} */
var animationName = "".concat(KEYFRAMES_NAME_PREFIX).concat(this._count++);
/** @type {?} */
var kfElm = this.buildKeyframeElement(element, animationName, keyframes);
/** @type {?} */
document.querySelector('head').appendChild(kfElm);
/** @type {?} */
var specialStyles = packageNonAnimatableStyles(element, keyframes);
/** @type {?} */
var player = new CssKeyframesPlayer(element, keyframes, animationName, duration, delay, easing, finalStyles, specialStyles);
player.onDestroy(
/**
* @return {?}
*/
function () {
return removeElement(kfElm);
});
return player;
}
/**
* @private
* @return {?}
*/
}, {
key: "_notifyFaultyScrubber",
value: function _notifyFaultyScrubber() {
if (!this._warningIssued) {
console.warn('@angular/animations: please load the web-animations.js polyfill to allow programmatic access...\n', ' visit http://bit.ly/IWukam to learn more about using the web-animation-js polyfill.');
this._warningIssued = true;
}
}
}]);
return CssKeyframesDriver;
}();
if (false) {}
/**
* @param {?} keyframes
* @return {?}
*/
function flattenKeyframesIntoStyles(keyframes) {
/** @type {?} */
var flatKeyframes = {};
if (keyframes) {
/** @type {?} */
var kfs = Array.isArray(keyframes) ? keyframes : [keyframes];
kfs.forEach(
/**
* @param {?} kf
* @return {?}
*/
/**
* @param {?} kf
* @return {?}
*/
function (kf) {
Object.keys(kf).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
if (prop == 'offset' || prop == 'easing') return;
flatKeyframes[prop] = kf[prop];
});
});
}
return flatKeyframes;
}
/**
* @param {?} node
* @return {?}
*/
function removeElement(node) {
node.parentNode.removeChild(node);
}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/render/web_animations/web_animations_player.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var WebAnimationsPlayer = /*#__PURE__*/function () {
/**
* @param {?} element
* @param {?} keyframes
* @param {?} options
* @param {?=} _specialStyles
*/
function WebAnimationsPlayer(element, keyframes, options, _specialStyles) {
_classCallCheck(this, WebAnimationsPlayer);
this.element = element;
this.keyframes = keyframes;
this.options = options;
this._specialStyles = _specialStyles;
this._onDoneFns = [];
this._onStartFns = [];
this._onDestroyFns = [];
this._initialized = false;
this._finished = false;
this._started = false;
this._destroyed = false;
this.time = 0;
this.parentPlayer = null;
this.currentSnapshot = {};
this._duration =
/** @type {?} */
options['duration'];
this._delay =
/** @type {?} */
options['delay'] || 0;
this.time = this._duration + this._delay;
}
/**
* @private
* @return {?}
*/
_createClass2(WebAnimationsPlayer, [{
key: "_onFinish",
value: function _onFinish() {
if (!this._finished) {
this._finished = true;
this._onDoneFns.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
this._onDoneFns = [];
}
}
/**
* @return {?}
*/
}, {
key: "init",
value: function init() {
this._buildPlayer();
this._preparePlayerBeforeStart();
}
/**
* @private
* @return {?}
*/
}, {
key: "_buildPlayer",
value: function _buildPlayer() {
var _this48 = this;
if (this._initialized) return;
this._initialized = true;
/** @type {?} */
var keyframes = this.keyframes;
/** @type {?} */
this.domPlayer = this._triggerWebAnimation(this.element, keyframes, this.options);
this._finalKeyframe = keyframes.length ? keyframes[keyframes.length - 1] : {};
this.domPlayer.addEventListener('finish',
/**
* @return {?}
*/
function () {
return _this48._onFinish();
});
}
/**
* @private
* @return {?}
*/
}, {
key: "_preparePlayerBeforeStart",
value: function _preparePlayerBeforeStart() {
// this is required so that the player doesn't start to animate right away
if (this._delay) {
this._resetDomPlayerState();
} else {
this.domPlayer.pause();
}
}
/**
* \@internal
* @param {?} element
* @param {?} keyframes
* @param {?} options
* @return {?}
*/
}, {
key: "_triggerWebAnimation",
value: function _triggerWebAnimation(element, keyframes, options) {
// jscompiler doesn't seem to know animate is a native property because it's not fully
// supported yet across common browsers (we polyfill it for Edge/Safari) [CL #143630929]
return (
/** @type {?} */
element['animate'](keyframes, options)
);
}
/**
* @param {?} fn
* @return {?}
*/
}, {
key: "onStart",
value: function onStart(fn) {
this._onStartFns.push(fn);
}
/**
* @param {?} fn
* @return {?}
*/
}, {
key: "onDone",
value: function onDone(fn) {
this._onDoneFns.push(fn);
}
/**
* @param {?} fn
* @return {?}
*/
}, {
key: "onDestroy",
value: function onDestroy(fn) {
this._onDestroyFns.push(fn);
}
/**
* @return {?}
*/
}, {
key: "play",
value: function play() {
this._buildPlayer();
if (!this.hasStarted()) {
this._onStartFns.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
this._onStartFns = [];
this._started = true;
if (this._specialStyles) {
this._specialStyles.start();
}
}
this.domPlayer.play();
}
/**
* @return {?}
*/
}, {
key: "pause",
value: function pause() {
this.init();
this.domPlayer.pause();
}
/**
* @return {?}
*/
}, {
key: "finish",
value: function finish() {
this.init();
if (this._specialStyles) {
this._specialStyles.finish();
}
this._onFinish();
this.domPlayer.finish();
}
/**
* @return {?}
*/
}, {
key: "reset",
value: function reset() {
this._resetDomPlayerState();
this._destroyed = false;
this._finished = false;
this._started = false;
}
/**
* @private
* @return {?}
*/
}, {
key: "_resetDomPlayerState",
value: function _resetDomPlayerState() {
if (this.domPlayer) {
this.domPlayer.cancel();
}
}
/**
* @return {?}
*/
}, {
key: "restart",
value: function restart() {
this.reset();
this.play();
}
/**
* @return {?}
*/
}, {
key: "hasStarted",
value: function hasStarted() {
return this._started;
}
/**
* @return {?}
*/
}, {
key: "destroy",
value: function destroy() {
if (!this._destroyed) {
this._destroyed = true;
this._resetDomPlayerState();
this._onFinish();
if (this._specialStyles) {
this._specialStyles.destroy();
}
this._onDestroyFns.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
this._onDestroyFns = [];
}
}
/**
* @param {?} p
* @return {?}
*/
}, {
key: "setPosition",
value: function setPosition(p) {
this.domPlayer.currentTime = p * this.time;
}
/**
* @return {?}
*/
}, {
key: "getPosition",
value: function getPosition() {
return this.domPlayer.currentTime / this.time;
}
/**
* @return {?}
*/
}, {
key: "totalTime",
get: function get() {
return this._delay + this._duration;
}
/**
* @return {?}
*/
}, {
key: "beforeDestroy",
value: function beforeDestroy() {
var _this49 = this;
/** @type {?} */
var styles = {};
if (this.hasStarted()) {
Object.keys(this._finalKeyframe).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
if (prop != 'offset') {
styles[prop] = _this49._finished ? _this49._finalKeyframe[prop] : computeStyle(_this49.element, prop);
}
});
}
this.currentSnapshot = styles;
}
/**
* \@internal
* @param {?} phaseName
* @return {?}
*/
}, {
key: "triggerCallback",
value: function triggerCallback(phaseName) {
/** @type {?} */
var methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
methods.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn();
});
methods.length = 0;
}
}]);
return WebAnimationsPlayer;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/render/web_animations/web_animations_driver.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var WebAnimationsDriver = /*#__PURE__*/function () {
function WebAnimationsDriver() {
_classCallCheck(this, WebAnimationsDriver);
this._isNativeImpl = /\{\s*\[native\s+code\]\s*\}/.test(getElementAnimateFn().toString());
this._cssKeyframesDriver = new CssKeyframesDriver();
}
/**
* @param {?} prop
* @return {?}
*/
_createClass2(WebAnimationsDriver, [{
key: "validateStyleProperty",
value: function validateStyleProperty(prop) {
return _validateStyleProperty(prop);
}
/**
* @param {?} element
* @param {?} selector
* @return {?}
*/
}, {
key: "matchesElement",
value: function matchesElement(element, selector) {
return _matchesElement(element, selector);
}
/**
* @param {?} elm1
* @param {?} elm2
* @return {?}
*/
}, {
key: "containsElement",
value: function containsElement(elm1, elm2) {
return _containsElement(elm1, elm2);
}
/**
* @param {?} element
* @param {?} selector
* @param {?} multi
* @return {?}
*/
}, {
key: "query",
value: function query(element, selector, multi) {
return invokeQuery(element, selector, multi);
}
/**
* @param {?} element
* @param {?} prop
* @param {?=} defaultValue
* @return {?}
*/
}, {
key: "computeStyle",
value: function computeStyle(element, prop, defaultValue) {
return (
/** @type {?} */
/** @type {?} */
window.getComputedStyle(element)[prop]
);
}
/**
* @param {?} supported
* @return {?}
*/
}, {
key: "overrideWebAnimationsSupport",
value: function overrideWebAnimationsSupport(supported) {
this._isNativeImpl = supported;
}
/**
* @param {?} element
* @param {?} keyframes
* @param {?} duration
* @param {?} delay
* @param {?} easing
* @param {?=} previousPlayers
* @param {?=} scrubberAccessRequested
* @return {?}
*/
}, {
key: "animate",
value: function animate(element, keyframes, duration, delay, easing) {
var previousPlayers = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : [];
var scrubberAccessRequested = arguments.length > 6 ? arguments[6] : undefined;
/** @type {?} */
var useKeyframes = !scrubberAccessRequested && !this._isNativeImpl;
if (useKeyframes) {
return this._cssKeyframesDriver.animate(element, keyframes, duration, delay, easing, previousPlayers);
}
/** @type {?} */
var fill = delay == 0 ? 'both' : 'forwards';
/** @type {?} */
var playerOptions = {
duration: duration,
delay: delay,
fill: fill
}; // we check for this to avoid having a null|undefined value be present
// for the easing (which results in an error for certain browsers #9752)
if (easing) {
playerOptions['easing'] = easing;
}
/** @type {?} */
var previousStyles = {};
/** @type {?} */
var previousWebAnimationPlayers =
/** @type {?} */
previousPlayers.filter(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
return player instanceof WebAnimationsPlayer;
});
if (allowPreviousPlayerStylesMerge(duration, delay)) {
previousWebAnimationPlayers.forEach(
/**
* @param {?} player
* @return {?}
*/
/**
* @param {?} player
* @return {?}
*/
function (player) {
/** @type {?} */
var styles = player.currentSnapshot;
Object.keys(styles).forEach(
/**
* @param {?} prop
* @return {?}
*/
/**
* @param {?} prop
* @return {?}
*/
function (prop) {
return previousStyles[prop] = styles[prop];
});
});
}
keyframes = keyframes.map(
/**
* @param {?} styles
* @return {?}
*/
/**
* @param {?} styles
* @return {?}
*/
function (styles) {
return copyStyles(styles, false);
});
keyframes = balancePreviousStylesIntoKeyframes(element, keyframes, previousStyles);
/** @type {?} */
var specialStyles = packageNonAnimatableStyles(element, keyframes);
return new WebAnimationsPlayer(element, keyframes, playerOptions, specialStyles);
}
}]);
return WebAnimationsDriver;
}();
if (false) {}
/**
* @return {?}
*/
function supportsWebAnimations() {
return typeof getElementAnimateFn() === 'function';
}
/**
* @return {?}
*/
function getElementAnimateFn() {
return isBrowser() &&
/** @type {?} */
Element.prototype['animate'] || {};
}
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/private_export.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/src/browser.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/public_api.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* Generated from: packages/animations/browser/index.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Generated bundle index. Do not edit.
*/
//# sourceMappingURL=browser.js.map
/***/
},
/***/
"./node_modules/@angular/common/fesm2015/common.js":
/*!*********************************************************!*\
!*** ./node_modules/@angular/common/fesm2015/common.js ***!
\*********************************************************/
/*! exports provided: APP_BASE_HREF, AsyncPipe, CommonModule, CurrencyPipe, DOCUMENT, DatePipe, DecimalPipe, FormStyle, FormatWidth, HashLocationStrategy, I18nPluralPipe, I18nSelectPipe, JsonPipe, KeyValuePipe, LOCATION_INITIALIZED, Location, LocationStrategy, LowerCasePipe, NgClass, NgComponentOutlet, NgForOf, NgForOfContext, NgIf, NgIfContext, NgLocaleLocalization, NgLocalization, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet, NumberFormatStyle, NumberSymbol, PathLocationStrategy, PercentPipe, PlatformLocation, Plural, SlicePipe, TitleCasePipe, TranslationWidth, UpperCasePipe, VERSION, ViewportScroller, WeekDay, formatCurrency, formatDate, formatNumber, formatPercent, getCurrencySymbol, getLocaleCurrencyCode, getLocaleCurrencyName, getLocaleCurrencySymbol, getLocaleDateFormat, getLocaleDateTimeFormat, getLocaleDayNames, getLocaleDayPeriods, getLocaleDirection, getLocaleEraNames, getLocaleExtraDayPeriodRules, getLocaleExtraDayPeriods, getLocaleFirstDayOfWeek, getLocaleId, getLocaleMonthNames, getLocaleNumberFormat, getLocaleNumberSymbol, getLocalePluralCase, getLocaleTimeFormat, getLocaleWeekEndRange, getNumberOfCurrencyDigits, isPlatformBrowser, isPlatformServer, isPlatformWorkerApp, isPlatformWorkerUi, registerLocaleData, ɵBrowserPlatformLocation, ɵDomAdapter, ɵNullViewportScroller, ɵPLATFORM_BROWSER_ID, ɵPLATFORM_SERVER_ID, ɵPLATFORM_WORKER_APP_ID, ɵPLATFORM_WORKER_UI_ID, ɵangular_packages_common_common_a, ɵangular_packages_common_common_b, ɵangular_packages_common_common_c, ɵangular_packages_common_common_d, ɵangular_packages_common_common_e, ɵangular_packages_common_common_f, ɵgetDOM, ɵparseCookieValue, ɵsetRootDomAdapter */
/***/
function node_modulesAngularCommonFesm2015CommonJs(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "APP_BASE_HREF", function () {
return APP_BASE_HREF;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "AsyncPipe", function () {
return AsyncPipe;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "CommonModule", function () {
return CommonModule;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "CurrencyPipe", function () {
return CurrencyPipe;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "DOCUMENT", function () {
return DOCUMENT;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "DatePipe", function () {
return DatePipe;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "DecimalPipe", function () {
return DecimalPipe;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "FormStyle", function () {
return FormStyle;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "FormatWidth", function () {
return FormatWidth;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HashLocationStrategy", function () {
return HashLocationStrategy;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "I18nPluralPipe", function () {
return I18nPluralPipe;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "I18nSelectPipe", function () {
return I18nSelectPipe;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "JsonPipe", function () {
return JsonPipe;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "KeyValuePipe", function () {
return KeyValuePipe;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "LOCATION_INITIALIZED", function () {
return LOCATION_INITIALIZED;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "Location", function () {
return Location;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "LocationStrategy", function () {
return LocationStrategy;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "LowerCasePipe", function () {
return LowerCasePipe;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NgClass", function () {
return NgClass;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NgComponentOutlet", function () {
return NgComponentOutlet;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NgForOf", function () {
return NgForOf;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NgForOfContext", function () {
return NgForOfContext;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NgIf", function () {
return NgIf;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NgIfContext", function () {
return NgIfContext;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NgLocaleLocalization", function () {
return NgLocaleLocalization;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NgLocalization", function () {
return NgLocalization;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NgPlural", function () {
return NgPlural;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NgPluralCase", function () {
return NgPluralCase;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NgStyle", function () {
return NgStyle;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NgSwitch", function () {
return NgSwitch;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NgSwitchCase", function () {
return NgSwitchCase;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NgSwitchDefault", function () {
return NgSwitchDefault;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NgTemplateOutlet", function () {
return NgTemplateOutlet;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NumberFormatStyle", function () {
return NumberFormatStyle;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "NumberSymbol", function () {
return NumberSymbol;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "PathLocationStrategy", function () {
return PathLocationStrategy;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "PercentPipe", function () {
return PercentPipe;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "PlatformLocation", function () {
return PlatformLocation;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "Plural", function () {
return Plural;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "SlicePipe", function () {
return SlicePipe;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "TitleCasePipe", function () {
return TitleCasePipe;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "TranslationWidth", function () {
return TranslationWidth;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "UpperCasePipe", function () {
return UpperCasePipe;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "VERSION", function () {
return VERSION;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ViewportScroller", function () {
return ViewportScroller;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "WeekDay", function () {
return WeekDay;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "formatCurrency", function () {
return formatCurrency;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "formatDate", function () {
return formatDate;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "formatNumber", function () {
return formatNumber;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "formatPercent", function () {
return formatPercent;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getCurrencySymbol", function () {
return getCurrencySymbol;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleCurrencyCode", function () {
return getLocaleCurrencyCode;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleCurrencyName", function () {
return getLocaleCurrencyName;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleCurrencySymbol", function () {
return getLocaleCurrencySymbol;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleDateFormat", function () {
return getLocaleDateFormat;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleDateTimeFormat", function () {
return getLocaleDateTimeFormat;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleDayNames", function () {
return getLocaleDayNames;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleDayPeriods", function () {
return getLocaleDayPeriods;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleDirection", function () {
return getLocaleDirection;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleEraNames", function () {
return getLocaleEraNames;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleExtraDayPeriodRules", function () {
return getLocaleExtraDayPeriodRules;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleExtraDayPeriods", function () {
return getLocaleExtraDayPeriods;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleFirstDayOfWeek", function () {
return getLocaleFirstDayOfWeek;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleId", function () {
return getLocaleId;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleMonthNames", function () {
return getLocaleMonthNames;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleNumberFormat", function () {
return getLocaleNumberFormat;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleNumberSymbol", function () {
return getLocaleNumberSymbol;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocalePluralCase", function () {
return getLocalePluralCase;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleTimeFormat", function () {
return getLocaleTimeFormat;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getLocaleWeekEndRange", function () {
return getLocaleWeekEndRange;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "getNumberOfCurrencyDigits", function () {
return getNumberOfCurrencyDigits;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "isPlatformBrowser", function () {
return isPlatformBrowser;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "isPlatformServer", function () {
return isPlatformServer;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "isPlatformWorkerApp", function () {
return isPlatformWorkerApp;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "isPlatformWorkerUi", function () {
return isPlatformWorkerUi;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "registerLocaleData", function () {
return registerLocaleData;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵBrowserPlatformLocation", function () {
return BrowserPlatformLocation;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵDomAdapter", function () {
return DomAdapter;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵNullViewportScroller", function () {
return NullViewportScroller;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵPLATFORM_BROWSER_ID", function () {
return PLATFORM_BROWSER_ID;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵPLATFORM_SERVER_ID", function () {
return PLATFORM_SERVER_ID;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵPLATFORM_WORKER_APP_ID", function () {
return PLATFORM_WORKER_APP_ID;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵPLATFORM_WORKER_UI_ID", function () {
return PLATFORM_WORKER_UI_ID;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_a", function () {
return useBrowserPlatformLocation;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_b", function () {
return createBrowserPlatformLocation;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_c", function () {
return createLocation;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_d", function () {
return provideLocationStrategy;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_e", function () {
return COMMON_DIRECTIVES;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_f", function () {
return COMMON_PIPES;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵgetDOM", function () {
return getDOM;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵparseCookieValue", function () {
return parseCookieValue;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵsetRootDomAdapter", function () {
return setRootDomAdapter;
});
/* harmony import */
var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
/*! @angular/core */
"./node_modules/@angular/core/fesm2015/core.js");
/**
* @license Angular v9.1.13
* (c) 2010-2020 Google LLC. https://angular.io/
* License: MIT
*/
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/dom_adapter.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @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
*/
/** @type {?} */
var _DOM =
/** @type {?} */
null;
/**
* @return {?}
*/
function getDOM() {
return _DOM;
}
/**
* @param {?} adapter
* @return {?}
*/
function setDOM(adapter) {
_DOM = adapter;
}
/**
* @param {?} adapter
* @return {?}
*/
function setRootDomAdapter(adapter) {
if (!_DOM) {
_DOM = adapter;
}
}
/* tslint:disable:requireParameterType */
/**
* Provides DOM operations in an environment-agnostic way.
*
* \@security Tread carefully! Interacting with the DOM directly is dangerous and
* can introduce XSS risks.
* @abstract
*/
var DomAdapter = function DomAdapter() {
_classCallCheck(this, DomAdapter);
};
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/dom_tokens.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* A DI Token representing the main rendering context. In a browser this is the DOM Document.
*
* Note: Document might not be available in the Application Context when Application and Rendering
* Contexts are not the same (e.g. when running the application in a Web Worker).
*
* \@publicApi
* @type {?}
*/
var DOCUMENT = /*@__PURE__*/new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('DocumentToken');
var PlatformLocation = /*@__PURE__*/function () {
var PlatformLocation = function PlatformLocation() {
_classCallCheck(this, PlatformLocation);
};
PlatformLocation.ɵfac = function PlatformLocation_Factory(t) {
return new (t || PlatformLocation)();
};
/** @nocollapse */
PlatformLocation.ɵprov = /*@__PURE__*/Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineInjectable"])({
factory: useBrowserPlatformLocation,
token: PlatformLocation,
providedIn: "platform"
});
return PlatformLocation;
}();
if (false) {}
/**
* @return {?}
*/
function useBrowserPlatformLocation() {
return Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"])(BrowserPlatformLocation);
}
/**
* \@description
* Indicates when a location is initialized.
*
* \@publicApi
* @type {?}
*/
var LOCATION_INITIALIZED = /*@__PURE__*/new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('Location Initialized');
/**
* \@description
* A serializable version of the event from `onPopState` or `onHashChange`
*
* \@publicApi
* @record
*/
function LocationChangeEvent() {}
if (false) {}
/**
* \@publicApi
* @record
*/
function LocationChangeListener() {}
var BrowserPlatformLocation = /*@__PURE__*/function () {
var BrowserPlatformLocation = /*#__PURE__*/function (_PlatformLocation) {
_inherits(BrowserPlatformLocation, _PlatformLocation);
var _super5 = _createSuper(BrowserPlatformLocation);
/**
* @param {?} _doc
*/
function BrowserPlatformLocation(_doc) {
var _this50;
_classCallCheck(this, BrowserPlatformLocation);
_this50 = _super5.call(this);
_this50._doc = _doc;
_this50._init();
return _this50;
} // This is moved to its own method so that `MockPlatformLocationStrategy` can overwrite it
/**
* \@internal
* @return {?}
*/
_createClass2(BrowserPlatformLocation, [{
key: "_init",
value: function _init() {
/** @type {?} */
this.location = getDOM().getLocation();
this._history = getDOM().getHistory();
}
/**
* @return {?}
*/
}, {
key: "getBaseHrefFromDOM",
value: function getBaseHrefFromDOM() {
return (
/** @type {?} */
getDOM().getBaseHref(this._doc)
);
}
/**
* @param {?} fn
* @return {?}
*/
}, {
key: "onPopState",
value: function onPopState(fn) {
getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('popstate', fn, false);
}
/**
* @param {?} fn
* @return {?}
*/
}, {
key: "onHashChange",
value: function onHashChange(fn) {
getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('hashchange', fn, false);
}
/**
* @return {?}
*/
}, {
key: "href",
get: function get() {
return this.location.href;
}
/**
* @return {?}
*/
}, {
key: "protocol",
get: function get() {
return this.location.protocol;
}
/**
* @return {?}
*/
}, {
key: "hostname",
get: function get() {
return this.location.hostname;
}
/**
* @return {?}
*/
}, {
key: "port",
get: function get() {
return this.location.port;
}
/**
* @return {?}
*/
}, {
key: "pathname",
get: function get() {
return this.location.pathname;
}
/**
* @return {?}
*/
,
set:
/**
* @param {?} newPath
* @return {?}
*/
function set(newPath) {
this.location.pathname = newPath;
}
/**
* @param {?} state
* @param {?} title
* @param {?} url
* @return {?}
*/
}, {
key: "search",
get: function get() {
return this.location.search;
}
/**
* @return {?}
*/
}, {
key: "hash",
get: function get() {
return this.location.hash;
}
}, {
key: "pushState",
value: function pushState(state, title, url) {
if (supportsState()) {
this._history.pushState(state, title, url);
} else {
this.location.hash = url;
}
}
/**
* @param {?} state
* @param {?} title
* @param {?} url
* @return {?}
*/
}, {
key: "replaceState",
value: function replaceState(state, title, url) {
if (supportsState()) {
this._history.replaceState(state, title, url);
} else {
this.location.hash = url;
}
}
/**
* @return {?}
*/
}, {
key: "forward",
value: function forward() {
this._history.forward();
}
/**
* @return {?}
*/
}, {
key: "back",
value: function back() {
this._history.back();
}
/**
* @return {?}
*/
}, {
key: "getState",
value: function getState() {
return this._history.state;
}
}]);
return BrowserPlatformLocation;
}(PlatformLocation);
BrowserPlatformLocation.ɵfac = function BrowserPlatformLocation_Factory(t) {
return new (t || BrowserPlatformLocation)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"](DOCUMENT));
};
/** @nocollapse */
BrowserPlatformLocation.ɵprov = /*@__PURE__*/Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineInjectable"])({
factory: createBrowserPlatformLocation,
token: BrowserPlatformLocation,
providedIn: "platform"
});
return BrowserPlatformLocation;
}();
if (false) {}
/**
* @return {?}
*/
function supportsState() {
return !!window.history.pushState;
}
/**
* @return {?}
*/
function createBrowserPlatformLocation() {
return new BrowserPlatformLocation(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"])(DOCUMENT));
}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/private_export.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/location/util.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @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
*/
/**
* Joins two parts of a URL with a slash if needed.
*
* @param {?} start URL string
* @param {?} end URL string
*
*
* @return {?} The joined URL string.
*/
function joinWithSlash(start, end) {
if (start.length == 0) {
return end;
}
if (end.length == 0) {
return start;
}
/** @type {?} */
var slashes = 0;
if (start.endsWith('/')) {
slashes++;
}
if (end.startsWith('/')) {
slashes++;
}
if (slashes == 2) {
return start + end.substring(1);
}
if (slashes == 1) {
return start + end;
}
return start + '/' + end;
}
/**
* Removes a trailing slash from a URL string if needed.
* Looks for the first occurrence of either `#`, `?`, or the end of the
* line as `/` characters and removes the trailing slash if one exists.
*
* @param {?} url URL string.
*
* @return {?} The URL string, modified if needed.
*/
function stripTrailingSlash(url) {
/** @type {?} */
var match = url.match(/#|\?|$/);
/** @type {?} */
var pathEndIdx = match && match.index || url.length;
/** @type {?} */
var droppedSlashIdx = pathEndIdx - (url[pathEndIdx - 1] === '/' ? 1 : 0);
return url.slice(0, droppedSlashIdx) + url.slice(pathEndIdx);
}
/**
* Normalizes URL parameters by prepending with `?` if needed.
*
* @param {?} params String of URL parameters.
*
* @return {?} The normalized URL parameters string.
*/
function normalizeQueryParams(params) {
return params && params[0] !== '?' ? '?' + params : params;
}
var LocationStrategy = /*@__PURE__*/function () {
var LocationStrategy = function LocationStrategy() {
_classCallCheck(this, LocationStrategy);
};
LocationStrategy.ɵfac = function LocationStrategy_Factory(t) {
return new (t || LocationStrategy)();
};
/** @nocollapse */
LocationStrategy.ɵprov = /*@__PURE__*/Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineInjectable"])({
factory: provideLocationStrategy,
token: LocationStrategy,
providedIn: "root"
});
return LocationStrategy;
}();
if (false) {}
/**
* @param {?} platformLocation
* @return {?}
*/
function provideLocationStrategy(platformLocation) {
// See #23917
/** @type {?} */
var location = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"])(DOCUMENT).location;
return new PathLocationStrategy(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"])(
/** @type {?} */
PlatformLocation), location && location.origin || '');
}
/**
* A predefined [DI token](guide/glossary#di-token) for the base href
* to be used with the `PathLocationStrategy`.
* The base href is the URL prefix that should be preserved when generating
* and recognizing URLs.
*
* \@usageNotes
*
* The following example shows how to use this token to configure the root app injector
* with a base href value, so that the DI framework can supply the dependency anywhere in the app.
*
* ```typescript
* import {Component, NgModule} from '\@angular/core';
* import {APP_BASE_HREF} from '\@angular/common';
*
* \@NgModule({
* providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]
* })
* class AppModule {}
* ```
*
* \@publicApi
* @type {?}
*/
var APP_BASE_HREF = /*@__PURE__*/new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('appBaseHref');
var PathLocationStrategy = /*@__PURE__*/function () {
var PathLocationStrategy = /*#__PURE__*/function (_LocationStrategy) {
_inherits(PathLocationStrategy, _LocationStrategy);
var _super6 = _createSuper(PathLocationStrategy);
/**
* @param {?} _platformLocation
* @param {?=} href
*/
function PathLocationStrategy(_platformLocation, href) {
var _this51;
_classCallCheck(this, PathLocationStrategy);
_this51 = _super6.call(this);
_this51._platformLocation = _platformLocation;
if (href == null) {
href = _this51._platformLocation.getBaseHrefFromDOM();
}
if (href == null) {
throw new Error("No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document.");
}
_this51._baseHref = href;
return _this51;
}
/**
* @param {?} fn
* @return {?}
*/
_createClass2(PathLocationStrategy, [{
key: "onPopState",
value: function onPopState(fn) {
this._platformLocation.onPopState(fn);
this._platformLocation.onHashChange(fn);
}
/**
* @return {?}
*/
}, {
key: "getBaseHref",
value: function getBaseHref() {
return this._baseHref;
}
/**
* @param {?} internal
* @return {?}
*/
}, {
key: "prepareExternalUrl",
value: function prepareExternalUrl(internal) {
return joinWithSlash(this._baseHref, internal);
}
/**
* @param {?=} includeHash
* @return {?}
*/
}, {
key: "path",
value: function path() {
var includeHash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
/** @type {?} */
var pathname = this._platformLocation.pathname + normalizeQueryParams(this._platformLocation.search);
/** @type {?} */
var hash = this._platformLocation.hash;
return hash && includeHash ? "".concat(pathname).concat(hash) : pathname;
}
/**
* @param {?} state
* @param {?} title
* @param {?} url
* @param {?} queryParams
* @return {?}
*/
}, {
key: "pushState",
value: function pushState(state, title, url, queryParams) {
/** @type {?} */
var externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));
this._platformLocation.pushState(state, title, externalUrl);
}
/**
* @param {?} state
* @param {?} title
* @param {?} url
* @param {?} queryParams
* @return {?}
*/
}, {
key: "replaceState",
value: function replaceState(state, title, url, queryParams) {
/** @type {?} */
var externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));
this._platformLocation.replaceState(state, title, externalUrl);
}
/**
* @return {?}
*/
}, {
key: "forward",
value: function forward() {
this._platformLocation.forward();
}
/**
* @return {?}
*/
}, {
key: "back",
value: function back() {
this._platformLocation.back();
}
}]);
return PathLocationStrategy;
}(LocationStrategy);
PathLocationStrategy.ɵfac = function PathLocationStrategy_Factory(t) {
return new (t || PathLocationStrategy)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"](PlatformLocation), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"](APP_BASE_HREF, 8));
};
PathLocationStrategy.ɵprov = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineInjectable"]({
token: PathLocationStrategy,
factory: PathLocationStrategy.ɵfac
});
return PathLocationStrategy;
}();
if (false) {}
var HashLocationStrategy = /*@__PURE__*/function () {
var HashLocationStrategy = /*#__PURE__*/function (_LocationStrategy2) {
_inherits(HashLocationStrategy, _LocationStrategy2);
var _super7 = _createSuper(HashLocationStrategy);
/**
* @param {?} _platformLocation
* @param {?=} _baseHref
*/
function HashLocationStrategy(_platformLocation, _baseHref) {
var _this52;
_classCallCheck(this, HashLocationStrategy);
_this52 = _super7.call(this);
_this52._platformLocation = _platformLocation;
_this52._baseHref = '';
if (_baseHref != null) {
_this52._baseHref = _baseHref;
}
return _this52;
}
/**
* @param {?} fn
* @return {?}
*/
_createClass2(HashLocationStrategy, [{
key: "onPopState",
value: function onPopState(fn) {
this._platformLocation.onPopState(fn);
this._platformLocation.onHashChange(fn);
}
/**
* @return {?}
*/
}, {
key: "getBaseHref",
value: function getBaseHref() {
return this._baseHref;
}
/**
* @param {?=} includeHash
* @return {?}
*/
}, {
key: "path",
value: function path() {
var includeHash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
// the hash value is always prefixed with a `#`
// and if it is empty then it will stay empty
/** @type {?} */
var path = this._platformLocation.hash;
if (path == null) path = '#';
return path.length > 0 ? path.substring(1) : path;
}
/**
* @param {?} internal
* @return {?}
*/
}, {
key: "prepareExternalUrl",
value: function prepareExternalUrl(internal) {
/** @type {?} */
var url = joinWithSlash(this._baseHref, internal);
return url.length > 0 ? '#' + url : url;
}
/**
* @param {?} state
* @param {?} title
* @param {?} path
* @param {?} queryParams
* @return {?}
*/
}, {
key: "pushState",
value: function pushState(state, title, path, queryParams) {
/** @type {?} */
var url = this.prepareExternalUrl(path + normalizeQueryParams(queryParams));
if (url.length == 0) {
url = this._platformLocation.pathname;
}
this._platformLocation.pushState(state, title, url);
}
/**
* @param {?} state
* @param {?} title
* @param {?} path
* @param {?} queryParams
* @return {?}
*/
}, {
key: "replaceState",
value: function replaceState(state, title, path, queryParams) {
/** @type {?} */
var url = this.prepareExternalUrl(path + normalizeQueryParams(queryParams));
if (url.length == 0) {
url = this._platformLocation.pathname;
}
this._platformLocation.replaceState(state, title, url);
}
/**
* @return {?}
*/
}, {
key: "forward",
value: function forward() {
this._platformLocation.forward();
}
/**
* @return {?}
*/
}, {
key: "back",
value: function back() {
this._platformLocation.back();
}
}]);
return HashLocationStrategy;
}(LocationStrategy);
HashLocationStrategy.ɵfac = function HashLocationStrategy_Factory(t) {
return new (t || HashLocationStrategy)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"](PlatformLocation), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"](APP_BASE_HREF, 8));
};
HashLocationStrategy.ɵprov = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineInjectable"]({
token: HashLocationStrategy,
factory: HashLocationStrategy.ɵfac
});
return HashLocationStrategy;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/location/location.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* \@publicApi
* @record
*/
function PopStateEvent() {}
if (false) {}
var Location = /*@__PURE__*/function () {
var Location = /*#__PURE__*/function () {
/**
* @param {?} platformStrategy
* @param {?} platformLocation
*/
function Location(platformStrategy, platformLocation) {
var _this53 = this;
_classCallCheck(this, Location);
/**
* \@internal
*/
this._subject = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
/**
* \@internal
*/
this._urlChangeListeners = [];
this._platformStrategy = platformStrategy;
/** @type {?} */
var browserBaseHref = this._platformStrategy.getBaseHref();
this._platformLocation = platformLocation;
this._baseHref = stripTrailingSlash(_stripIndexHtml(browserBaseHref));
this._platformStrategy.onPopState(
/**
* @param {?} ev
* @return {?}
*/
function (ev) {
_this53._subject.emit({
'url': _this53.path(true),
'pop': true,
'state': ev.state,
'type': ev.type
});
});
}
/**
* Normalizes the URL path for this location.
*
* @param {?=} includeHash True to include an anchor fragment in the path.
*
* @return {?} The normalized URL path.
*/
// TODO: vsavkin. Remove the boolean flag and always include hash once the deprecated router is
// removed.
_createClass2(Location, [{
key: "path",
value: function path() {
var includeHash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
return this.normalize(this._platformStrategy.path(includeHash));
}
/**
* Reports the current state of the location history.
* @return {?} The current value of the `history.state` object.
*/
}, {
key: "getState",
value: function getState() {
return this._platformLocation.getState();
}
/**
* Normalizes the given path and compares to the current normalized path.
*
* @param {?} path The given URL path.
* @param {?=} query Query parameters.
*
* @return {?} True if the given URL path is equal to the current normalized path, false
* otherwise.
*/
}, {
key: "isCurrentPathEqualTo",
value: function isCurrentPathEqualTo(path) {
var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
return this.path() == this.normalize(path + normalizeQueryParams(query));
}
/**
* Normalizes a URL path by stripping any trailing slashes.
*
* @param {?} url String representing a URL.
*
* @return {?} The normalized URL string.
*/
}, {
key: "normalize",
value: function normalize(url) {
return Location.stripTrailingSlash(_stripBaseHref(this._baseHref, _stripIndexHtml(url)));
}
/**
* Normalizes an external URL path.
* If the given URL doesn't begin with a leading slash (`'/'`), adds one
* before normalizing. Adds a hash if `HashLocationStrategy` is
* in use, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
*
* @param {?} url String representing a URL.
*
* @return {?} A normalized platform-specific URL.
*/
}, {
key: "prepareExternalUrl",
value: function prepareExternalUrl(url) {
if (url && url[0] !== '/') {
url = '/' + url;
}
return this._platformStrategy.prepareExternalUrl(url);
} // TODO: rename this method to pushState
/**
* Changes the browser's URL to a normalized version of a given URL, and pushes a
* new item onto the platform's history.
*
* @param {?} path URL path to normalize.
* @param {?=} query Query parameters.
* @param {?=} state Location history state.
*
* @return {?}
*/
}, {
key: "go",
value: function go(path) {
var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var state = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
this._platformStrategy.pushState(state, '', path, query);
this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);
}
/**
* Changes the browser's URL to a normalized version of the given URL, and replaces
* the top item on the platform's history stack.
*
* @param {?} path URL path to normalize.
* @param {?=} query Query parameters.
* @param {?=} state Location history state.
* @return {?}
*/
}, {
key: "replaceState",
value: function replaceState(path) {
var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var state = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
this._platformStrategy.replaceState(state, '', path, query);
this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);
}
/**
* Navigates forward in the platform's history.
* @return {?}
*/
}, {
key: "forward",
value: function forward() {
this._platformStrategy.forward();
}
/**
* Navigates back in the platform's history.
* @return {?}
*/
}, {
key: "back",
value: function back() {
this._platformStrategy.back();
}
/**
* Registers a URL change listener. Use to catch updates performed by the Angular
* framework that are not detectible through "popstate" or "hashchange" events.
*
* @param {?} fn The change handler function, which take a URL and a location history state.
* @return {?}
*/
}, {
key: "onUrlChange",
value: function onUrlChange(fn) {
var _this54 = this;
this._urlChangeListeners.push(fn);
this.subscribe(
/**
* @param {?} v
* @return {?}
*/
/**
* @param {?} v
* @return {?}
*/
function (v) {
_this54._notifyUrlChangeListeners(v.url, v.state);
});
}
/**
* \@internal
* @param {?=} url
* @param {?=} state
* @return {?}
*/
}, {
key: "_notifyUrlChangeListeners",
value: function _notifyUrlChangeListeners() {
var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var state = arguments.length > 1 ? arguments[1] : undefined;
this._urlChangeListeners.forEach(
/**
* @param {?} fn
* @return {?}
*/
/**
* @param {?} fn
* @return {?}
*/
function (fn) {
return fn(url, state);
});
}
/**
* Subscribes to the platform's `popState` events.
*
* @param {?} onNext
* @param {?=} onThrow
* @param {?=} onReturn
* @return {?} Subscribed events.
*/
}, {
key: "subscribe",
value: function subscribe(onNext, onThrow, onReturn) {
return this._subject.subscribe({
next: onNext,
error: onThrow,
complete: onReturn
});
}
}]);
return Location;
}();
Location.ɵfac = function Location_Factory(t) {
return new (t || Location)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"](LocationStrategy), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"](PlatformLocation));
};
/**
* Normalizes URL parameters by prepending with `?` if needed.
*
* @param params String of URL parameters.
*
* @return The normalized URL parameters string.
*/
Location.normalizeQueryParams = normalizeQueryParams;
/**
* Joins two parts of a URL with a slash if needed.
*
* @param start URL string
* @param end URL string
*
*
* @return The joined URL string.
*/
Location.joinWithSlash = joinWithSlash;
/**
* Removes a trailing slash from a URL string if needed.
* Looks for the first occurrence of either `#`, `?`, or the end of the
* line as `/` characters and removes the trailing slash if one exists.
*
* @param url URL string.
*
* @return The URL string, modified if needed.
*/
Location.stripTrailingSlash = stripTrailingSlash;
/** @nocollapse */
Location.ɵprov = /*@__PURE__*/Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineInjectable"])({
factory: createLocation,
token: Location,
providedIn: "root"
});
return Location;
}();
if (false) {}
/**
* @return {?}
*/
function createLocation() {
return new Location(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"])(
/** @type {?} */
LocationStrategy), Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"])(
/** @type {?} */
PlatformLocation));
}
/**
* @param {?} baseHref
* @param {?} url
* @return {?}
*/
function _stripBaseHref(baseHref, url) {
return baseHref && url.startsWith(baseHref) ? url.substring(baseHref.length) : url;
}
/**
* @param {?} url
* @return {?}
*/
function _stripIndexHtml(url) {
return url.replace(/\/index.html$/, '');
}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/location/index.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/i18n/currencies.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @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
*/
// THIS CODE IS GENERATED - DO NOT MODIFY
// See angular/tools/gulp-tasks/cldr/extract.js
/**
* \@internal
* @type {?}
*/
var CURRENCIES_EN = {
'ADP': [undefined, undefined, 0],
'AFN': [undefined, undefined, 0],
'ALL': [undefined, undefined, 0],
'AMD': [undefined, undefined, 2],
'AOA': [undefined, 'Kz'],
'ARS': [undefined, '$'],
'AUD': ['A$', '$'],
'BAM': [undefined, 'KM'],
'BBD': [undefined, '$'],
'BDT': [undefined, 'à§³'],
'BHD': [undefined, undefined, 3],
'BIF': [undefined, undefined, 0],
'BMD': [undefined, '$'],
'BND': [undefined, '$'],
'BOB': [undefined, 'Bs'],
'BRL': ['R$'],
'BSD': [undefined, '$'],
'BWP': [undefined, 'P'],
'BYN': [undefined, 'Ñ€.', 2],
'BYR': [undefined, undefined, 0],
'BZD': [undefined, '$'],
'CAD': ['CA$', '$', 2],
'CHF': [undefined, undefined, 2],
'CLF': [undefined, undefined, 4],
'CLP': [undefined, '$', 0],
'CNY': ['CNÂ¥', 'Â¥'],
'COP': [undefined, '$', 2],
'CRC': [undefined, 'â‚¡', 2],
'CUC': [undefined, '$'],
'CUP': [undefined, '$'],
'CZK': [undefined, 'K�', 2],
'DJF': [undefined, undefined, 0],
'DKK': [undefined, 'kr', 2],
'DOP': [undefined, '$'],
'EGP': [undefined, 'E£'],
'ESP': [undefined, 'â‚§', 0],
'EUR': ['€'],
'FJD': [undefined, '$'],
'FKP': [undefined, '£'],
'GBP': ['£'],
'GEL': [undefined, '₾'],
'GIP': [undefined, '£'],
'GNF': [undefined, 'FG', 0],
'GTQ': [undefined, 'Q'],
'GYD': [undefined, '$', 2],
'HKD': ['HK$', '$'],
'HNL': [undefined, 'L'],
'HRK': [undefined, 'kn'],
'HUF': [undefined, 'Ft', 2],
'IDR': [undefined, 'Rp', 2],
'ILS': ['₪'],
'INR': ['₹'],
'IQD': [undefined, undefined, 0],
'IRR': [undefined, undefined, 0],
'ISK': [undefined, 'kr', 0],
'ITL': [undefined, undefined, 0],
'JMD': [undefined, '$'],
'JOD': [undefined, undefined, 3],
'JPY': ['Â¥', undefined, 0],
'KHR': [undefined, '៛'],
'KMF': [undefined, 'CF', 0],
'KPW': [undefined, 'â‚©', 0],
'KRW': ['â‚©', undefined, 0],
'KWD': [undefined, undefined, 3],
'KYD': [undefined, '$'],
'KZT': [undefined, '₸'],
'LAK': [undefined, 'â‚', 0],
'LBP': [undefined, 'L£', 0],
'LKR': [undefined, 'Rs'],
'LRD': [undefined, '$'],
'LTL': [undefined, 'Lt'],
'LUF': [undefined, undefined, 0],
'LVL': [undefined, 'Ls'],
'LYD': [undefined, undefined, 3],
'MGA': [undefined, 'Ar', 0],
'MGF': [undefined, undefined, 0],
'MMK': [undefined, 'K', 0],
'MNT': [undefined, 'â‚®', 2],
'MRO': [undefined, undefined, 0],
'MUR': [undefined, 'Rs', 2],
'MXN': ['MX$', '$'],
'MYR': [undefined, 'RM'],
'NAD': [undefined, '$'],
'NGN': [undefined, '₦'],
'NIO': [undefined, 'C$'],
'NOK': [undefined, 'kr', 2],
'NPR': [undefined, 'Rs'],
'NZD': ['NZ$', '$'],
'OMR': [undefined, undefined, 3],
'PHP': [undefined, '₱'],
'PKR': [undefined, 'Rs', 2],
'PLN': [undefined, 'zł'],
'PYG': [undefined, '₲', 0],
'RON': [undefined, 'lei'],
'RSD': [undefined, undefined, 0],
'RUB': [undefined, '₽'],
'RUR': [undefined, 'Ñ€.'],
'RWF': [undefined, 'RF', 0],
'SBD': [undefined, '$'],
'SEK': [undefined, 'kr', 2],
'SGD': [undefined, '$'],
'SHP': [undefined, '£'],
'SLL': [undefined, undefined, 0],
'SOS': [undefined, undefined, 0],
'SRD': [undefined, '$'],
'SSP': [undefined, '£'],
'STD': [undefined, undefined, 0],
'STN': [undefined, 'Db'],
'SYP': [undefined, '£', 0],
'THB': [undefined, '฿'],
'TMM': [undefined, undefined, 0],
'TND': [undefined, undefined, 3],
'TOP': [undefined, 'T$'],
'TRL': [undefined, undefined, 0],
'TRY': [undefined, '₺'],
'TTD': [undefined, '$'],
'TWD': ['NT$', '$', 2],
'TZS': [undefined, undefined, 2],
'UAH': [undefined, 'â‚´'],
'UGX': [undefined, undefined, 0],
'USD': ['$'],
'UYI': [undefined, undefined, 0],
'UYU': [undefined, '$'],
'UYW': [undefined, undefined, 4],
'UZS': [undefined, undefined, 2],
'VEF': [undefined, 'Bs', 2],
'VND': ['â‚«', undefined, 0],
'VUV': [undefined, undefined, 0],
'XAF': ['FCFA', undefined, 0],
'XCD': ['EC$', '$'],
'XOF': ['CFA', undefined, 0],
'XPF': ['CFPF', undefined, 0],
'XXX': ['¤'],
'YER': [undefined, undefined, 0],
'ZAR': [undefined, 'R'],
'ZMK': [undefined, undefined, 0],
'ZMW': [undefined, 'ZK'],
'ZWD': [undefined, undefined, 0]
};
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/i18n/locale_data_api.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @enum {number} */
var NumberFormatStyle = /*@__PURE__*/function () {
var NumberFormatStyle = {
Decimal: 0,
Percent: 1,
Currency: 2,
Scientific: 3
};
NumberFormatStyle[NumberFormatStyle.Decimal] = 'Decimal';
NumberFormatStyle[NumberFormatStyle.Percent] = 'Percent';
NumberFormatStyle[NumberFormatStyle.Currency] = 'Currency';
NumberFormatStyle[NumberFormatStyle.Scientific] = 'Scientific';
return NumberFormatStyle;
}();
/** @enum {number} */
var Plural = /*@__PURE__*/function () {
var Plural = {
Zero: 0,
One: 1,
Two: 2,
Few: 3,
Many: 4,
Other: 5
};
Plural[Plural.Zero] = 'Zero';
Plural[Plural.One] = 'One';
Plural[Plural.Two] = 'Two';
Plural[Plural.Few] = 'Few';
Plural[Plural.Many] = 'Many';
Plural[Plural.Other] = 'Other';
return Plural;
}();
/** @enum {number} */
var FormStyle = /*@__PURE__*/function () {
var FormStyle = {
Format: 0,
Standalone: 1
};
FormStyle[FormStyle.Format] = 'Format';
FormStyle[FormStyle.Standalone] = 'Standalone';
return FormStyle;
}();
/** @enum {number} */
var TranslationWidth = /*@__PURE__*/function () {
var TranslationWidth = {
/** 1 character for `en-US`. For example: 'S' */
Narrow: 0,
/** 3 characters for `en-US`. For example: 'Sun' */
Abbreviated: 1,
/** Full length for `en-US`. For example: "Sunday" */
Wide: 2,
/** 2 characters for `en-US`, For example: "Su" */
Short: 3
};
TranslationWidth[TranslationWidth.Narrow] = 'Narrow';
TranslationWidth[TranslationWidth.Abbreviated] = 'Abbreviated';
TranslationWidth[TranslationWidth.Wide] = 'Wide';
TranslationWidth[TranslationWidth.Short] = 'Short';
return TranslationWidth;
}();
/** @enum {number} */
var FormatWidth = /*@__PURE__*/function () {
var FormatWidth = {
/**
* For `en-US`, 'M/d/yy, h:mm a'`
* (Example: `6/15/15, 9:03 AM`)
*/
Short: 0,
/**
* For `en-US`, `'MMM d, y, h:mm:ss a'`
* (Example: `Jun 15, 2015, 9:03:01 AM`)
*/
Medium: 1,
/**
* For `en-US`, `'MMMM d, y, h:mm:ss a z'`
* (Example: `June 15, 2015 at 9:03:01 AM GMT+1`)
*/
Long: 2,
/**
* For `en-US`, `'EEEE, MMMM d, y, h:mm:ss a zzzz'`
* (Example: `Monday, June 15, 2015 at 9:03:01 AM GMT+01:00`)
*/
Full: 3
};
FormatWidth[FormatWidth.Short] = 'Short';
FormatWidth[FormatWidth.Medium] = 'Medium';
FormatWidth[FormatWidth.Long] = 'Long';
FormatWidth[FormatWidth.Full] = 'Full';
return FormatWidth;
}();
/** @enum {number} */
var NumberSymbol = /*@__PURE__*/function () {
var NumberSymbol = {
/**
* Decimal separator.
* For `en-US`, the dot character.
* Example : 2,345`.`67
*/
Decimal: 0,
/**
* Grouping separator, typically for thousands.
* For `en-US`, the comma character.
* Example: 2`,`345.67
*/
Group: 1,
/**
* List-item separator.
* Example: "one, two, and three"
*/
List: 2,
/**
* Sign for percentage (out of 100).
* Example: 23.4%
*/
PercentSign: 3,
/**
* Sign for positive numbers.
* Example: +23
*/
PlusSign: 4,
/**
* Sign for negative numbers.
* Example: -23
*/
MinusSign: 5,
/**
* Computer notation for exponential value (n times a power of 10).
* Example: 1.2E3
*/
Exponential: 6,
/**
* Human-readable format of exponential.
* Example: 1.2x103
*/
SuperscriptingExponent: 7,
/**
* Sign for permille (out of 1000).
* Example: 23.4‰
*/
PerMille: 8,
/**
* Infinity, can be used with plus and minus.
* Example: ∞, +∞, -∞
*/
Infinity: 9,
/**
* Not a number.
* Example: NaN
*/
NaN: 10,
/**
* Symbol used between time units.
* Example: 10:52
*/
TimeSeparator: 11,
/**
* Decimal separator for currency values (fallback to `Decimal`).
* Example: $2,345.67
*/
CurrencyDecimal: 12,
/**
* Group separator for currency values (fallback to `Group`).
* Example: $2,345.67
*/
CurrencyGroup: 13
};
NumberSymbol[NumberSymbol.Decimal] = 'Decimal';
NumberSymbol[NumberSymbol.Group] = 'Group';
NumberSymbol[NumberSymbol.List] = 'List';
NumberSymbol[NumberSymbol.PercentSign] = 'PercentSign';
NumberSymbol[NumberSymbol.PlusSign] = 'PlusSign';
NumberSymbol[NumberSymbol.MinusSign] = 'MinusSign';
NumberSymbol[NumberSymbol.Exponential] = 'Exponential';
NumberSymbol[NumberSymbol.SuperscriptingExponent] = 'SuperscriptingExponent';
NumberSymbol[NumberSymbol.PerMille] = 'PerMille';
NumberSymbol[NumberSymbol.Infinity] = 'Infinity';
NumberSymbol[NumberSymbol.NaN] = 'NaN';
NumberSymbol[NumberSymbol.TimeSeparator] = 'TimeSeparator';
NumberSymbol[NumberSymbol.CurrencyDecimal] = 'CurrencyDecimal';
NumberSymbol[NumberSymbol.CurrencyGroup] = 'CurrencyGroup';
return NumberSymbol;
}();
/** @enum {number} */
var WeekDay = /*@__PURE__*/function () {
var WeekDay = {
Sunday: 0,
Monday: 1,
Tuesday: 2,
Wednesday: 3,
Thursday: 4,
Friday: 5,
Saturday: 6
};
WeekDay[WeekDay.Sunday] = 'Sunday';
WeekDay[WeekDay.Monday] = 'Monday';
WeekDay[WeekDay.Tuesday] = 'Tuesday';
WeekDay[WeekDay.Wednesday] = 'Wednesday';
WeekDay[WeekDay.Thursday] = 'Thursday';
WeekDay[WeekDay.Friday] = 'Friday';
WeekDay[WeekDay.Saturday] = 'Saturday';
return WeekDay;
}();
/**
* Retrieves the locale ID from the currently loaded locale.
* The loaded locale could be, for example, a global one rather than a regional one.
* @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} locale A locale code, such as `fr-FR`.
* @return {?} The locale code. For example, `fr`.
*/
function getLocaleId(locale) {
return Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale)[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].LocaleId];
}
/**
* Retrieves day period strings for the given locale.
*
* @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} locale A locale code for the locale format rules to use.
* @param {?} formStyle The required grammatical form.
* @param {?} width The required character width.
* @return {?} An array of localized period strings. For example, `[AM, PM]` for `en-US`.
*/
function getLocaleDayPeriods(locale, formStyle, width) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
/** @type {?} */
var amPmData =
/** @type {?} */
[data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].DayPeriodsFormat], data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].DayPeriodsStandalone]];
/** @type {?} */
var amPm = getLastDefinedValue(amPmData, formStyle);
return getLastDefinedValue(amPm, width);
}
/**
* Retrieves days of the week for the given locale, using the Gregorian calendar.
*
* @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} locale A locale code for the locale format rules to use.
* @param {?} formStyle The required grammatical form.
* @param {?} width The required character width.
* @return {?} An array of localized name strings.
* For example,`[Sunday, Monday, ... Saturday]` for `en-US`.
*/
function getLocaleDayNames(locale, formStyle, width) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
/** @type {?} */
var daysData =
/** @type {?} */
[data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].DaysFormat], data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].DaysStandalone]];
/** @type {?} */
var days = getLastDefinedValue(daysData, formStyle);
return getLastDefinedValue(days, width);
}
/**
* Retrieves months of the year for the given locale, using the Gregorian calendar.
*
* @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} locale A locale code for the locale format rules to use.
* @param {?} formStyle The required grammatical form.
* @param {?} width The required character width.
* @return {?} An array of localized name strings.
* For example, `[January, February, ...]` for `en-US`.
*/
function getLocaleMonthNames(locale, formStyle, width) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
/** @type {?} */
var monthsData =
/** @type {?} */
[data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].MonthsFormat], data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].MonthsStandalone]];
/** @type {?} */
var months = getLastDefinedValue(monthsData, formStyle);
return getLastDefinedValue(months, width);
}
/**
* Retrieves Gregorian-calendar eras for the given locale.
* @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} locale A locale code for the locale format rules to use.
* @param {?} width The required character width.
* @return {?} An array of localized era strings.
* For example, `[AD, BC]` for `en-US`.
*/
function getLocaleEraNames(locale, width) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
/** @type {?} */
var erasData =
/** @type {?} */
data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].Eras];
return getLastDefinedValue(erasData, width);
}
/**
* Retrieves the first day of the week for the given locale.
*
* @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} locale A locale code for the locale format rules to use.
* @return {?} A day index number, using the 0-based week-day index for `en-US`
* (Sunday = 0, Monday = 1, ...).
* For example, for `fr-FR`, returns 1 to indicate that the first day is Monday.
*/
function getLocaleFirstDayOfWeek(locale) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].FirstDayOfWeek];
}
/**
* Range of week days that are considered the week-end for the given locale.
*
* @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} locale A locale code for the locale format rules to use.
* @return {?} The range of day values, `[startDay, endDay]`.
*/
function getLocaleWeekEndRange(locale) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].WeekendRange];
}
/**
* Retrieves a localized date-value formating string.
*
* @see `FormatWidth` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} locale A locale code for the locale format rules to use.
* @param {?} width The format type.
* @return {?} The localized formating string.
*/
function getLocaleDateFormat(locale, width) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
return getLastDefinedValue(data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].DateFormat], width);
}
/**
* Retrieves a localized time-value formatting string.
*
* @see `FormatWidth` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
* \@publicApi
* @param {?} locale A locale code for the locale format rules to use.
* @param {?} width The format type.
* @return {?} The localized formatting string.
*/
function getLocaleTimeFormat(locale, width) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
return getLastDefinedValue(data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].TimeFormat], width);
}
/**
* Retrieves a localized date-time formatting string.
*
* @see `FormatWidth` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} locale A locale code for the locale format rules to use.
* @param {?} width The format type.
* @return {?} The localized formatting string.
*/
function getLocaleDateTimeFormat(locale, width) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
/** @type {?} */
var dateTimeFormatData =
/** @type {?} */
data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].DateTimeFormat];
return getLastDefinedValue(dateTimeFormatData, width);
}
/**
* Retrieves a localized number symbol that can be used to replace placeholders in number formats.
* @see `NumberSymbol` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} locale The locale code.
* @param {?} symbol The symbol to localize.
* @return {?} The character for the localized symbol.
*/
function getLocaleNumberSymbol(locale, symbol) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
/** @type {?} */
var res = data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].NumberSymbols][symbol];
if (typeof res === 'undefined') {
if (symbol === NumberSymbol.CurrencyDecimal) {
return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].NumberSymbols][NumberSymbol.Decimal];
} else if (symbol === NumberSymbol.CurrencyGroup) {
return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].NumberSymbols][NumberSymbol.Group];
}
}
return res;
}
/**
* Retrieves a number format for a given locale.
*
* Numbers are formatted using patterns, like `#,###.00`. For example, the pattern `#,###.00`
* when used to format the number 12345.678 could result in "12'345,678". That would happen if the
* grouping separator for your language is an apostrophe, and the decimal separator is a comma.
*
* Important: The characters `.` `,` `0` `#` (and others below) are special placeholders
* that stand for the decimal separator, and so on, and are NOT real characters.
* You must NOT "translate" the placeholders. For example, don't change `.` to `,` even though in
* your language the decimal point is written with a comma. The symbols should be replaced by the
* local equivalents, using the appropriate `NumberSymbol` for your language.
*
* Here are the special characters used in number patterns:
*
* | Symbol | Meaning |
* |--------|---------|
* | . | Replaced automatically by the character used for the decimal point. |
* | , | Replaced by the "grouping" (thousands) separator. |
* | 0 | Replaced by a digit (or zero if there aren't enough digits). |
* | # | Replaced by a digit (or nothing if there aren't enough). |
* | ¤ | Replaced by a currency symbol, such as $ or USD. |
* | % | Marks a percent format. The % symbol may change position, but must be retained. |
* | E | Marks a scientific format. The E symbol may change position, but must be retained. |
* | ' | Special characters used as literal characters are quoted with ASCII single quotes. |
*
* @see `NumberFormatStyle` / [CLDR website](http://cldr.unicode.org/translation/number-patterns) / [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} locale A locale code for the locale format rules to use.
* @param {?} type The type of numeric value to be formatted (such as `Decimal` or `Currency`.)
* @return {?} The localized format string.
*/
function getLocaleNumberFormat(locale, type) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].NumberFormats][type];
}
/**
* Retrieves the symbol used to represent the currency for the main country
* corresponding to a given locale. For example, '$' for `en-US`.
*
* @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} locale A locale code for the locale format rules to use.
* @return {?} The localized symbol character,
* or `null` if the main country cannot be determined.
*/
function getLocaleCurrencySymbol(locale) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].CurrencySymbol] || null;
}
/**
* Retrieves the name of the currency for the main country corresponding
* to a given locale. For example, 'US Dollar' for `en-US`.
* @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} locale A locale code for the locale format rules to use.
* @return {?} The currency name,
* or `null` if the main country cannot be determined.
*/
function getLocaleCurrencyName(locale) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].CurrencyName] || null;
}
/**
* Retrieves the default currency code for the given locale.
*
* The default is defined as the first currency which is still in use.
*
* \@publicApi
* @param {?} locale The code of the locale whose currency code we want.
* @return {?} The code of the default currency for the given locale.
*
*/
function getLocaleCurrencyCode(locale) {
return Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵgetLocaleCurrencyCode"])(locale);
}
/**
* Retrieves the currency values for a given locale.
* @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
* @param {?} locale A locale code for the locale format rules to use.
* @return {?} The currency values.
*/
function getLocaleCurrencies(locale) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].Currencies];
}
/**
* \@alias core/ɵgetLocalePluralCase
* \@publicApi
* @type {?}
*/
var getLocalePluralCase = _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵgetLocalePluralCase"];
/**
* @param {?} data
* @return {?}
*/
function checkFullData(data) {
if (!data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].ExtraData]) {
throw new Error("Missing extra locale data for the locale \"".concat(data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].LocaleId], "\". Use \"registerLocaleData\" to load new data. See the \"I18n guide\" on angular.io to know more."));
}
}
/**
* Retrieves locale-specific rules used to determine which day period to use
* when more than one period is defined for a locale.
*
* There is a rule for each defined day period. The
* first rule is applied to the first day period and so on.
* Fall back to AM/PM when no rules are available.
*
* A rule can specify a period as time range, or as a single time value.
*
* This functionality is only available when you have loaded the full locale data.
* See the ["I18n guide"](guide/i18n#i18n-pipes).
*
* @see `getLocaleExtraDayPeriods()` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} locale A locale code for the locale format rules to use.
* @return {?} The rules for the locale, a single time value or array of *from-time, to-time*,
* or null if no periods are available.
*
*/
function getLocaleExtraDayPeriodRules(locale) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
checkFullData(data);
/** @type {?} */
var rules = data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].ExtraData][2
/* ExtraDayPeriodsRules */
] || [];
return rules.map(
/**
* @param {?} rule
* @return {?}
*/
function (rule) {
if (typeof rule === 'string') {
return extractTime(rule);
}
return [extractTime(rule[0]), extractTime(rule[1])];
});
}
/**
* Retrieves locale-specific day periods, which indicate roughly how a day is broken up
* in different languages.
* For example, for `en-US`, periods are morning, noon, afternoon, evening, and midnight.
*
* This functionality is only available when you have loaded the full locale data.
* See the ["I18n guide"](guide/i18n#i18n-pipes).
*
* @see `getLocaleExtraDayPeriodRules()` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} locale A locale code for the locale format rules to use.
* @param {?} formStyle The required grammatical form.
* @param {?} width The required character width.
* @return {?} The translated day-period strings.
*/
function getLocaleExtraDayPeriods(locale, formStyle, width) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
checkFullData(data);
/** @type {?} */
var dayPeriodsData =
/** @type {?} */
[data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].ExtraData][0
/* ExtraDayPeriodFormats */
], data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].ExtraData][1
/* ExtraDayPeriodStandalone */
]];
/** @type {?} */
var dayPeriods = getLastDefinedValue(dayPeriodsData, formStyle) || [];
return getLastDefinedValue(dayPeriods, width) || [];
}
/**
* Retrieves the writing direction of a specified locale
* \@publicApi
* @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
* @param {?} locale A locale code for the locale format rules to use.
* @return {?} 'rtl' or 'ltr'
*/
function getLocaleDirection(locale) {
/** @type {?} */
var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale);
return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].Directionality];
}
/**
* Retrieves the first value that is defined in an array, going backwards from an index position.
*
* To avoid repeating the same data (as when the "format" and "standalone" forms are the same)
* add the first value to the locale data arrays, and add other values only if they are different.
*
* @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @template T
* @param {?} data The data array to retrieve from.
* @param {?} index A 0-based index into the array to start from.
* @return {?} The value immediately before the given index position.
*/
function getLastDefinedValue(data, index) {
for (var i = index; i > -1; i--) {
if (typeof data[i] !== 'undefined') {
return data[i];
}
}
throw new Error('Locale data API: locale data undefined');
}
/**
* Extracts the hours and minutes from a string like "15:45"
* @param {?} time
* @return {?}
*/
function extractTime(time) {
var _time$split = time.split(':'),
_time$split2 = _slicedToArray(_time$split, 2),
h = _time$split2[0],
m = _time$split2[1];
return {
hours: +h,
minutes: +m
};
}
/**
* Retrieves the currency symbol for a given currency code.
*
* For example, for the default `en-US` locale, the code `USD` can
* be represented by the narrow symbol `$` or the wide symbol `US$`.
*
* @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} code The currency code.
* @param {?} format The format, `wide` or `narrow`.
* @param {?=} locale A locale code for the locale format rules to use.
*
* @return {?} The symbol, or the currency code if no symbol is available.
*/
function getCurrencySymbol(code, format) {
var locale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'en';
/** @type {?} */
var currency = getLocaleCurrencies(locale)[code] || CURRENCIES_EN[code] || [];
/** @type {?} */
var symbolNarrow = currency[1
/* SymbolNarrow */
];
if (format === 'narrow' && typeof symbolNarrow === 'string') {
return symbolNarrow;
}
return currency[0
/* Symbol */
] || code;
} // Most currencies have cents, that's why the default is 2
/** @type {?} */
var DEFAULT_NB_OF_CURRENCY_DIGITS = 2;
/**
* Reports the number of decimal digits for a given currency.
* The value depends upon the presence of cents in that particular currency.
*
* @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} code The currency code.
* @return {?} The number of decimal digits, typically 0 or 2.
*/
function getNumberOfCurrencyDigits(code) {
/** @type {?} */
var digits;
/** @type {?} */
var currency = CURRENCIES_EN[code];
if (currency) {
digits = currency[2
/* NbOfDigits */
];
}
return typeof digits === 'number' ? digits : DEFAULT_NB_OF_CURRENCY_DIGITS;
}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/i18n/format_date.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var ISO8601_DATE_REGEX = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; // 1 2 3 4 5 6 7 8 9 10 11
/** @type {?} */
var NAMED_FORMATS = {};
/** @type {?} */
var DATE_FORMATS_SPLIT = /((?:[^GyMLwWdEabBhHmsSzZO']+)|(?:'(?:[^']|'')*')|(?:G{1,5}|y{1,4}|M{1,5}|L{1,5}|w{1,2}|W{1}|d{1,2}|E{1,6}|a{1,5}|b{1,5}|B{1,5}|h{1,2}|H{1,2}|m{1,2}|s{1,2}|S{1,3}|z{1,4}|Z{1,5}|O{1,4}))([\s\S]*)/;
/** @enum {number} */
var ZoneWidth = /*@__PURE__*/function () {
var ZoneWidth = {
Short: 0,
ShortGMT: 1,
Long: 2,
Extended: 3
};
ZoneWidth[ZoneWidth.Short] = 'Short';
ZoneWidth[ZoneWidth.ShortGMT] = 'ShortGMT';
ZoneWidth[ZoneWidth.Long] = 'Long';
ZoneWidth[ZoneWidth.Extended] = 'Extended';
return ZoneWidth;
}();
/** @enum {number} */
var DateType = /*@__PURE__*/function () {
var DateType = {
FullYear: 0,
Month: 1,
Date: 2,
Hours: 3,
Minutes: 4,
Seconds: 5,
FractionalSeconds: 6,
Day: 7
};
DateType[DateType.FullYear] = 'FullYear';
DateType[DateType.Month] = 'Month';
DateType[DateType.Date] = 'Date';
DateType[DateType.Hours] = 'Hours';
DateType[DateType.Minutes] = 'Minutes';
DateType[DateType.Seconds] = 'Seconds';
DateType[DateType.FractionalSeconds] = 'FractionalSeconds';
DateType[DateType.Day] = 'Day';
return DateType;
}();
/** @enum {number} */
var TranslationType = /*@__PURE__*/function () {
var TranslationType = {
DayPeriods: 0,
Days: 1,
Months: 2,
Eras: 3
};
TranslationType[TranslationType.DayPeriods] = 'DayPeriods';
TranslationType[TranslationType.Days] = 'Days';
TranslationType[TranslationType.Months] = 'Months';
TranslationType[TranslationType.Eras] = 'Eras';
return TranslationType;
}();
/**
* \@ngModule CommonModule
* \@description
*
* Formats a date according to locale rules.
*
* @see `DatePipe` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} value The date to format, as a Date, or a number (milliseconds since UTC epoch)
* or an [ISO date-time string](https://www.w3.org/TR/NOTE-datetime).
* @param {?} format The date-time components to include. See `DatePipe` for details.
* @param {?} locale A locale code for the locale format rules to use.
* @param {?=} timezone The time zone. A time zone offset from GMT (such as `'+0430'`),
* or a standard UTC/GMT or continental US time zone abbreviation.
* If not specified, uses host system settings.
*
* @return {?} The formatted date string.
*
*/
function formatDate(value, format, locale, timezone) {
/** @type {?} */
var date = toDate(value);
/** @type {?} */
var namedFormat = getNamedFormat(locale, format);
format = namedFormat || format;
/** @type {?} */
var parts = [];
/** @type {?} */
var match;
while (format) {
match = DATE_FORMATS_SPLIT.exec(format);
if (match) {
parts = parts.concat(match.slice(1));
/** @type {?} */
var part = parts.pop();
if (!part) {
break;
}
format = part;
} else {
parts.push(format);
break;
}
}
/** @type {?} */
var dateTimezoneOffset = date.getTimezoneOffset();
if (timezone) {
dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
date = convertTimezoneToLocal(date, timezone, true);
}
/** @type {?} */
var text = '';
parts.forEach(
/**
* @param {?} value
* @return {?}
*/
/**
* @param {?} value
* @return {?}
*/
function (value) {
/** @type {?} */
var dateFormatter = getDateFormatter(value);
text += dateFormatter ? dateFormatter(date, locale, dateTimezoneOffset) : value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
});
return text;
}
/**
* @param {?} locale
* @param {?} format
* @return {?}
*/
function getNamedFormat(locale, format) {
/** @type {?} */
var localeId = getLocaleId(locale);
NAMED_FORMATS[localeId] = NAMED_FORMATS[localeId] || {};
if (NAMED_FORMATS[localeId][format]) {
return NAMED_FORMATS[localeId][format];
}
/** @type {?} */
var formatValue = '';
switch (format) {
case 'shortDate':
formatValue = getLocaleDateFormat(locale, FormatWidth.Short);
break;
case 'mediumDate':
formatValue = getLocaleDateFormat(locale, FormatWidth.Medium);
break;
case 'longDate':
formatValue = getLocaleDateFormat(locale, FormatWidth.Long);
break;
case 'fullDate':
formatValue = getLocaleDateFormat(locale, FormatWidth.Full);
break;
case 'shortTime':
formatValue = getLocaleTimeFormat(locale, FormatWidth.Short);
break;
case 'mediumTime':
formatValue = getLocaleTimeFormat(locale, FormatWidth.Medium);
break;
case 'longTime':
formatValue = getLocaleTimeFormat(locale, FormatWidth.Long);
break;
case 'fullTime':
formatValue = getLocaleTimeFormat(locale, FormatWidth.Full);
break;
case 'short':
/** @type {?} */
var shortTime = getNamedFormat(locale, 'shortTime');
/** @type {?} */
var shortDate = getNamedFormat(locale, 'shortDate');
formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Short), [shortTime, shortDate]);
break;
case 'medium':
/** @type {?} */
var mediumTime = getNamedFormat(locale, 'mediumTime');
/** @type {?} */
var mediumDate = getNamedFormat(locale, 'mediumDate');
formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Medium), [mediumTime, mediumDate]);
break;
case 'long':
/** @type {?} */
var longTime = getNamedFormat(locale, 'longTime');
/** @type {?} */
var longDate = getNamedFormat(locale, 'longDate');
formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Long), [longTime, longDate]);
break;
case 'full':
/** @type {?} */
var fullTime = getNamedFormat(locale, 'fullTime');
/** @type {?} */
var fullDate = getNamedFormat(locale, 'fullDate');
formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Full), [fullTime, fullDate]);
break;
}
if (formatValue) {
NAMED_FORMATS[localeId][format] = formatValue;
}
return formatValue;
}
/**
* @param {?} str
* @param {?} opt_values
* @return {?}
*/
function formatDateTime(str, opt_values) {
if (opt_values) {
str = str.replace(/\{([^}]+)}/g,
/**
* @param {?} match
* @param {?} key
* @return {?}
*/
function (match, key) {
return opt_values != null && key in opt_values ? opt_values[key] : match;
});
}
return str;
}
/**
* @param {?} num
* @param {?} digits
* @param {?=} minusSign
* @param {?=} trim
* @param {?=} negWrap
* @return {?}
*/
function padNumber(num, digits) {
var minusSign = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '-';
var trim = arguments.length > 3 ? arguments[3] : undefined;
var negWrap = arguments.length > 4 ? arguments[4] : undefined;
/** @type {?} */
var neg = '';
if (num < 0 || negWrap && num <= 0) {
if (negWrap) {
num = -num + 1;
} else {
num = -num;
neg = minusSign;
}
}
/** @type {?} */
var strNum = String(num);
while (strNum.length < digits) {
strNum = '0' + strNum;
}
if (trim) {
strNum = strNum.substr(strNum.length - digits);
}
return neg + strNum;
}
/**
* @param {?} milliseconds
* @param {?} digits
* @return {?}
*/
function formatFractionalSeconds(milliseconds, digits) {
/** @type {?} */
var strMs = padNumber(milliseconds, 3);
return strMs.substr(0, digits);
}
/**
* Returns a date formatter that transforms a date into its locale digit representation
* @param {?} name
* @param {?} size
* @param {?=} offset
* @param {?=} trim
* @param {?=} negWrap
* @return {?}
*/
function dateGetter(name, size) {
var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
var trim = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var negWrap = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
return (
/**
* @param {?} date
* @param {?} locale
* @return {?}
*/
function (date, locale) {
/** @type {?} */
var part = getDatePart(name, date);
if (offset > 0 || part > -offset) {
part += offset;
}
if (name === DateType.Hours) {
if (part === 0 && offset === -12) {
part = 12;
}
} else if (name === DateType.FractionalSeconds) {
return formatFractionalSeconds(part, size);
}
/** @type {?} */
var localeMinus = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
return padNumber(part, size, localeMinus, trim, negWrap);
}
);
}
/**
* @param {?} part
* @param {?} date
* @return {?}
*/
function getDatePart(part, date) {
switch (part) {
case DateType.FullYear:
return date.getFullYear();
case DateType.Month:
return date.getMonth();
case DateType.Date:
return date.getDate();
case DateType.Hours:
return date.getHours();
case DateType.Minutes:
return date.getMinutes();
case DateType.Seconds:
return date.getSeconds();
case DateType.FractionalSeconds:
return date.getMilliseconds();
case DateType.Day:
return date.getDay();
default:
throw new Error("Unknown DateType value \"".concat(part, "\"."));
}
}
/**
* Returns a date formatter that transforms a date into its locale string representation
* @param {?} name
* @param {?} width
* @param {?=} form
* @param {?=} extended
* @return {?}
*/
function dateStrGetter(name, width) {
var form = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : FormStyle.Format;
var extended = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
return (
/**
* @param {?} date
* @param {?} locale
* @return {?}
*/
function (date, locale) {
return getDateTranslation(date, locale, name, width, form, extended);
}
);
}
/**
* Returns the locale translation of a date for a given form, type and width
* @param {?} date
* @param {?} locale
* @param {?} name
* @param {?} width
* @param {?} form
* @param {?} extended
* @return {?}
*/
function getDateTranslation(date, locale, name, width, form, extended) {
switch (name) {
case TranslationType.Months:
return getLocaleMonthNames(locale, form, width)[date.getMonth()];
case TranslationType.Days:
return getLocaleDayNames(locale, form, width)[date.getDay()];
case TranslationType.DayPeriods:
/** @type {?} */
var currentHours = date.getHours();
/** @type {?} */
var currentMinutes = date.getMinutes();
if (extended) {
/** @type {?} */
var rules = getLocaleExtraDayPeriodRules(locale);
/** @type {?} */
var dayPeriods = getLocaleExtraDayPeriods(locale, form, width);
/** @type {?} */
var result;
rules.forEach(
/**
* @param {?} rule
* @param {?} index
* @return {?}
*/
function (rule, index) {
if (Array.isArray(rule)) {
// morning, afternoon, evening, night
var _rule$ = rule[0],
hoursFrom = _rule$.hours,
minutesFrom = _rule$.minutes;
var _rule$2 = rule[1],
hoursTo = _rule$2.hours,
minutesTo = _rule$2.minutes;
if (currentHours >= hoursFrom && currentMinutes >= minutesFrom && (currentHours < hoursTo || currentHours === hoursTo && currentMinutes < minutesTo)) {
result = dayPeriods[index];
}
} else {
// noon or midnight
// noon or midnight
var hours = rule.hours,
minutes = rule.minutes;
if (hours === currentHours && minutes === currentMinutes) {
result = dayPeriods[index];
}
}
});
if (result) {
return result;
}
} // if no rules for the day periods, we use am/pm by default
return getLocaleDayPeriods(locale, form,
/** @type {?} */
width)[currentHours < 12 ? 0 : 1];
case TranslationType.Eras:
return getLocaleEraNames(locale,
/** @type {?} */
width)[date.getFullYear() <= 0 ? 0 : 1];
default:
// This default case is not needed by TypeScript compiler, as the switch is exhaustive.
// However Closure Compiler does not understand that and reports an error in typed mode.
// The `throw new Error` below works around the problem, and the unexpected: never variable
// makes sure tsc still checks this code is unreachable.
/** @type {?} */
var unexpected = name;
throw new Error("unexpected translation type ".concat(unexpected));
}
}
/**
* Returns a date formatter that transforms a date and an offset into a timezone with ISO8601 or
* GMT format depending on the width (eg: short = +0430, short:GMT = GMT+4, long = GMT+04:30,
* extended = +04:30)
* @param {?} width
* @return {?}
*/
function timeZoneGetter(width) {
return (
/**
* @param {?} date
* @param {?} locale
* @param {?} offset
* @return {?}
*/
function (date, locale, offset) {
/** @type {?} */
var zone = -1 * offset;
/** @type {?} */
var minusSign = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
/** @type {?} */
var hours = zone > 0 ? Math.floor(zone / 60) : Math.ceil(zone / 60);
switch (width) {
case ZoneWidth.Short:
return (zone >= 0 ? '+' : '') + padNumber(hours, 2, minusSign) + padNumber(Math.abs(zone % 60), 2, minusSign);
case ZoneWidth.ShortGMT:
return 'GMT' + (zone >= 0 ? '+' : '') + padNumber(hours, 1, minusSign);
case ZoneWidth.Long:
return 'GMT' + (zone >= 0 ? '+' : '') + padNumber(hours, 2, minusSign) + ':' + padNumber(Math.abs(zone % 60), 2, minusSign);
case ZoneWidth.Extended:
if (offset === 0) {
return 'Z';
} else {
return (zone >= 0 ? '+' : '') + padNumber(hours, 2, minusSign) + ':' + padNumber(Math.abs(zone % 60), 2, minusSign);
}
default:
throw new Error("Unknown zone width \"".concat(width, "\""));
}
}
);
}
/** @type {?} */
var JANUARY = 0;
/** @type {?} */
var THURSDAY = 4;
/**
* @param {?} year
* @return {?}
*/
function getFirstThursdayOfYear(year) {
/** @type {?} */
var firstDayOfYear = new Date(year, JANUARY, 1).getDay();
return new Date(year, 0, 1 + (firstDayOfYear <= THURSDAY ? THURSDAY : THURSDAY + 7) - firstDayOfYear);
}
/**
* @param {?} datetime
* @return {?}
*/
function getThursdayThisWeek(datetime) {
return new Date(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + (THURSDAY - datetime.getDay()));
}
/**
* @param {?} size
* @param {?=} monthBased
* @return {?}
*/
function weekGetter(size) {
var monthBased = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
return (
/**
* @param {?} date
* @param {?} locale
* @return {?}
*/
function (date, locale) {
/** @type {?} */
var result;
if (monthBased) {
/** @type {?} */
var nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1;
/** @type {?} */
var today = date.getDate();
result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7);
} else {
/** @type {?} */
var firstThurs = getFirstThursdayOfYear(date.getFullYear());
/** @type {?} */
var thisThurs = getThursdayThisWeek(date);
/** @type {?} */
var diff = thisThurs.getTime() - firstThurs.getTime();
result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week
}
return padNumber(result, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
}
);
}
/** @type {?} */
var DATE_FORMATS = {}; // Based on CLDR formats:
// See complete list: http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
// See also explanations: http://cldr.unicode.org/translation/date-time
// TODO(ocombe): support all missing cldr formats: Y, U, Q, D, F, e, c, j, J, C, A, v, V, X, x
/**
* @param {?} format
* @return {?}
*/
function getDateFormatter(format) {
if (DATE_FORMATS[format]) {
return DATE_FORMATS[format];
}
/** @type {?} */
var formatter;
switch (format) {
// Era name (AD/BC)
case 'G':
case 'GG':
case 'GGG':
formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Abbreviated);
break;
case 'GGGG':
formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Wide);
break;
case 'GGGGG':
formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Narrow);
break;
// 1 digit representation of the year, e.g. (AD 1 => 1, AD 199 => 199)
case 'y':
formatter = dateGetter(DateType.FullYear, 1, 0, false, true);
break;
// 2 digit representation of the year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
case 'yy':
formatter = dateGetter(DateType.FullYear, 2, 0, true, true);
break;
// 3 digit representation of the year, padded (000-999). (e.g. AD 2001 => 01, AD 2010 => 10)
case 'yyy':
formatter = dateGetter(DateType.FullYear, 3, 0, false, true);
break;
// 4 digit representation of the year (e.g. AD 1 => 0001, AD 2010 => 2010)
case 'yyyy':
formatter = dateGetter(DateType.FullYear, 4, 0, false, true);
break;
// Month of the year (1-12), numeric
case 'M':
case 'L':
formatter = dateGetter(DateType.Month, 1, 1);
break;
case 'MM':
case 'LL':
formatter = dateGetter(DateType.Month, 2, 1);
break;
// Month of the year (January, ...), string, format
case 'MMM':
formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated);
break;
case 'MMMM':
formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Wide);
break;
case 'MMMMM':
formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Narrow);
break;
// Month of the year (January, ...), string, standalone
case 'LLL':
formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated, FormStyle.Standalone);
break;
case 'LLLL':
formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Wide, FormStyle.Standalone);
break;
case 'LLLLL':
formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Narrow, FormStyle.Standalone);
break;
// Week of the year (1, ... 52)
case 'w':
formatter = weekGetter(1);
break;
case 'ww':
formatter = weekGetter(2);
break;
// Week of the month (1, ...)
case 'W':
formatter = weekGetter(1, true);
break;
// Day of the month (1-31)
case 'd':
formatter = dateGetter(DateType.Date, 1);
break;
case 'dd':
formatter = dateGetter(DateType.Date, 2);
break;
// Day of the Week
case 'E':
case 'EE':
case 'EEE':
formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Abbreviated);
break;
case 'EEEE':
formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Wide);
break;
case 'EEEEE':
formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Narrow);
break;
case 'EEEEEE':
formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Short);
break;
// Generic period of the day (am-pm)
case 'a':
case 'aa':
case 'aaa':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated);
break;
case 'aaaa':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide);
break;
case 'aaaaa':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow);
break;
// Extended period of the day (midnight, at night, ...), standalone
case 'b':
case 'bb':
case 'bbb':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Standalone, true);
break;
case 'bbbb':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Standalone, true);
break;
case 'bbbbb':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Standalone, true);
break;
// Extended period of the day (midnight, night, ...), standalone
case 'B':
case 'BB':
case 'BBB':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Format, true);
break;
case 'BBBB':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Format, true);
break;
case 'BBBBB':
formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Format, true);
break;
// Hour in AM/PM, (1-12)
case 'h':
formatter = dateGetter(DateType.Hours, 1, -12);
break;
case 'hh':
formatter = dateGetter(DateType.Hours, 2, -12);
break;
// Hour of the day (0-23)
case 'H':
formatter = dateGetter(DateType.Hours, 1);
break;
// Hour in day, padded (00-23)
case 'HH':
formatter = dateGetter(DateType.Hours, 2);
break;
// Minute of the hour (0-59)
case 'm':
formatter = dateGetter(DateType.Minutes, 1);
break;
case 'mm':
formatter = dateGetter(DateType.Minutes, 2);
break;
// Second of the minute (0-59)
case 's':
formatter = dateGetter(DateType.Seconds, 1);
break;
case 'ss':
formatter = dateGetter(DateType.Seconds, 2);
break;
// Fractional second
case 'S':
formatter = dateGetter(DateType.FractionalSeconds, 1);
break;
case 'SS':
formatter = dateGetter(DateType.FractionalSeconds, 2);
break;
case 'SSS':
formatter = dateGetter(DateType.FractionalSeconds, 3);
break;
// Timezone ISO8601 short format (-0430)
case 'Z':
case 'ZZ':
case 'ZZZ':
formatter = timeZoneGetter(ZoneWidth.Short);
break;
// Timezone ISO8601 extended format (-04:30)
case 'ZZZZZ':
formatter = timeZoneGetter(ZoneWidth.Extended);
break;
// Timezone GMT short format (GMT+4)
case 'O':
case 'OO':
case 'OOO': // Should be location, but fallback to format O instead because we don't have the data yet
case 'z':
case 'zz':
case 'zzz':
formatter = timeZoneGetter(ZoneWidth.ShortGMT);
break;
// Timezone GMT long format (GMT+0430)
case 'OOOO':
case 'ZZZZ': // Should be location, but fallback to format O instead because we don't have the data yet
case 'zzzz':
formatter = timeZoneGetter(ZoneWidth.Long);
break;
default:
return null;
}
DATE_FORMATS[format] = formatter;
return formatter;
}
/**
* @param {?} timezone
* @param {?} fallback
* @return {?}
*/
function timezoneToOffset(timezone, fallback) {
// Support: IE 9-11 only, Edge 13-15+
// IE/Edge do not "understand" colon (`:`) in timezone
timezone = timezone.replace(/:/g, '');
/** @type {?} */
var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
}
/**
* @param {?} date
* @param {?} minutes
* @return {?}
*/
function addDateMinutes(date, minutes) {
date = new Date(date.getTime());
date.setMinutes(date.getMinutes() + minutes);
return date;
}
/**
* @param {?} date
* @param {?} timezone
* @param {?} reverse
* @return {?}
*/
function convertTimezoneToLocal(date, timezone, reverse) {
/** @type {?} */
var reverseValue = reverse ? -1 : 1;
/** @type {?} */
var dateTimezoneOffset = date.getTimezoneOffset();
/** @type {?} */
var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset));
}
/**
* Converts a value to date.
*
* Supported input formats:
* - `Date`
* - number: timestamp
* - string: numeric (e.g. "1234"), ISO and date strings in a format supported by
* [Date.parse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).
* Note: ISO strings without time return a date without timeoffset.
*
* Throws if unable to convert to a date.
* @param {?} value
* @return {?}
*/
function toDate(value) {
if (isDate(value)) {
return value;
}
if (typeof value === 'number' && !isNaN(value)) {
return new Date(value);
}
if (typeof value === 'string') {
value = value.trim();
/** @type {?} */
var parsedNb = parseFloat(value); // any string that only contains numbers, like "1234" but not like "1234hello"
if (!isNaN(
/** @type {?} */
value - parsedNb)) {
return new Date(parsedNb);
}
if (/^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) {
/* For ISO Strings without time the day, month and year must be extracted from the ISO String
before Date creation to avoid time offset and errors in the new Date.
If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new
date, some browsers (e.g. IE 9) will throw an invalid Date error.
If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the timeoffset
is applied.
Note: ISO months are 0 for January, 1 for February, ... */
var _value$split$map = value.split('-').map(
/**
* @param {?} val
* @return {?}
*/
function (val) {
return +val;
}),
_value$split$map2 = _slicedToArray(_value$split$map, 3),
y = _value$split$map2[0],
m = _value$split$map2[1],
d = _value$split$map2[2];
return new Date(y, m - 1, d);
}
/** @type {?} */
var match;
if (match = value.match(ISO8601_DATE_REGEX)) {
return isoStringToDate(match);
}
}
/** @type {?} */
var date = new Date(
/** @type {?} */
value);
if (!isDate(date)) {
throw new Error("Unable to convert \"".concat(value, "\" into a date"));
}
return date;
}
/**
* Converts a date in ISO8601 to a Date.
* Used instead of `Date.parse` because of browser discrepancies.
* @param {?} match
* @return {?}
*/
function isoStringToDate(match) {
/** @type {?} */
var date = new Date(0);
/** @type {?} */
var tzHour = 0;
/** @type {?} */
var tzMin = 0; // match[8] means that the string contains "Z" (UTC) or a timezone like "+01:00" or "+0100"
/** @type {?} */
var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;
/** @type {?} */
var timeSetter = match[8] ? date.setUTCHours : date.setHours; // if there is a timezone defined like "+01:00" or "+0100"
if (match[9]) {
tzHour = Number(match[9] + match[10]);
tzMin = Number(match[9] + match[11]);
}
dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));
/** @type {?} */
var h = Number(match[4] || 0) - tzHour;
/** @type {?} */
var m = Number(match[5] || 0) - tzMin;
/** @type {?} */
var s = Number(match[6] || 0);
/** @type {?} */
var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);
timeSetter.call(date, h, m, s, ms);
return date;
}
/**
* @param {?} value
* @return {?}
*/
function isDate(value) {
return value instanceof Date && !isNaN(value.valueOf());
}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/i18n/format_number.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/;
/** @type {?} */
var MAX_DIGITS = 22;
/** @type {?} */
var DECIMAL_SEP = '.';
/** @type {?} */
var ZERO_CHAR = '0';
/** @type {?} */
var PATTERN_SEP = ';';
/** @type {?} */
var GROUP_SEP = ',';
/** @type {?} */
var DIGIT_CHAR = '#';
/** @type {?} */
var CURRENCY_CHAR = '¤';
/** @type {?} */
var PERCENT_CHAR = '%';
/**
* Transforms a number to a locale string based on a style and a format.
* @param {?} value
* @param {?} pattern
* @param {?} locale
* @param {?} groupSymbol
* @param {?} decimalSymbol
* @param {?=} digitsInfo
* @param {?=} isPercent
* @return {?}
*/
function formatNumberToLocaleString(value, pattern, locale, groupSymbol, decimalSymbol, digitsInfo) {
var isPercent = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
/** @type {?} */
var formattedText = '';
/** @type {?} */
var isZero = false;
if (!isFinite(value)) {
formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity);
} else {
/** @type {?} */
var parsedNumber = parseNumber(value);
if (isPercent) {
parsedNumber = toPercent(parsedNumber);
}
/** @type {?} */
var minInt = pattern.minInt;
/** @type {?} */
var minFraction = pattern.minFrac;
/** @type {?} */
var maxFraction = pattern.maxFrac;
if (digitsInfo) {
/** @type {?} */
var parts = digitsInfo.match(NUMBER_FORMAT_REGEXP);
if (parts === null) {
throw new Error("".concat(digitsInfo, " is not a valid digit info"));
}
/** @type {?} */
var minIntPart = parts[1];
/** @type {?} */
var minFractionPart = parts[3];
/** @type {?} */
var maxFractionPart = parts[5];
if (minIntPart != null) {
minInt = parseIntAutoRadix(minIntPart);
}
if (minFractionPart != null) {
minFraction = parseIntAutoRadix(minFractionPart);
}
if (maxFractionPart != null) {
maxFraction = parseIntAutoRadix(maxFractionPart);
} else if (minFractionPart != null && minFraction > maxFraction) {
maxFraction = minFraction;
}
}
roundNumber(parsedNumber, minFraction, maxFraction);
/** @type {?} */
var digits = parsedNumber.digits;
/** @type {?} */
var integerLen = parsedNumber.integerLen;
/** @type {?} */
var exponent = parsedNumber.exponent;
/** @type {?} */
var decimals = [];
isZero = digits.every(
/**
* @param {?} d
* @return {?}
*/
/**
* @param {?} d
* @return {?}
*/
function (d) {
return !d;
}); // pad zeros for small numbers
for (; integerLen < minInt; integerLen++) {
digits.unshift(0);
} // pad zeros for small numbers
for (; integerLen < 0; integerLen++) {
digits.unshift(0);
} // extract decimals digits
if (integerLen > 0) {
decimals = digits.splice(integerLen, digits.length);
} else {
decimals = digits;
digits = [0];
} // format the integer digits with grouping separators
/** @type {?} */
var groups = [];
if (digits.length >= pattern.lgSize) {
groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(''));
}
while (digits.length > pattern.gSize) {
groups.unshift(digits.splice(-pattern.gSize, digits.length).join(''));
}
if (digits.length) {
groups.unshift(digits.join(''));
}
formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol)); // append the decimal digits
if (decimals.length) {
formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join('');
}
if (exponent) {
formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + '+' + exponent;
}
}
if (value < 0 && !isZero) {
formattedText = pattern.negPre + formattedText + pattern.negSuf;
} else {
formattedText = pattern.posPre + formattedText + pattern.posSuf;
}
return formattedText;
}
/**
* \@ngModule CommonModule
* \@description
*
* Formats a number as currency using locale rules.
*
* @see `formatNumber()` / `DecimalPipe` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} value The number to format.
* @param {?} locale A locale code for the locale format rules to use.
* @param {?} currency A string containing the currency symbol or its name,
* such as "$" or "Canadian Dollar". Used in output string, but does not affect the operation
* of the function.
* @param {?=} currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)
* currency code, such as `USD` for the US dollar and `EUR` for the euro.
* Used to determine the number of digits in the decimal part.
* @param {?=} digitsInfo
* @return {?} The formatted currency value.
*
*/
function formatCurrency(value, locale, currency, currencyCode, digitsInfo) {
/** @type {?} */
var format = getLocaleNumberFormat(locale, NumberFormatStyle.Currency);
/** @type {?} */
var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
pattern.minFrac = getNumberOfCurrencyDigits(
/** @type {?} */
currencyCode);
pattern.maxFrac = pattern.minFrac;
/** @type {?} */
var res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.CurrencyGroup, NumberSymbol.CurrencyDecimal, digitsInfo);
return res.replace(CURRENCY_CHAR, currency) // if we have 2 time the currency character, the second one is ignored
.replace(CURRENCY_CHAR, '') // If there is a spacing between currency character and the value and
// the currency character is supressed by passing an empty string, the
// spacing character would remain as part of the string. Then we
// should remove it.
.trim();
}
/**
* \@ngModule CommonModule
* \@description
*
* Formats a number as a percentage according to locale rules.
*
* @see `formatNumber()` / `DecimalPipe` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
* \@publicApi
*
* @param {?} value The number to format.
* @param {?} locale A locale code for the locale format rules to use.
* @param {?=} digitsInfo
* @return {?} The formatted percentage value.
*
*/
function formatPercent(value, locale, digitsInfo) {
/** @type {?} */
var format = getLocaleNumberFormat(locale, NumberFormatStyle.Percent);
/** @type {?} */
var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
/** @type {?} */
var res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo, true);
return res.replace(new RegExp(PERCENT_CHAR, 'g'), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign));
}
/**
* \@ngModule CommonModule
* \@description
*
* Formats a number as text, with group sizing, separator, and other
* parameters based on the locale.
*
* @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
*
* \@publicApi
* @param {?} value The number to format.
* @param {?} locale A locale code for the locale format rules to use.
* @param {?=} digitsInfo
* @return {?} The formatted text string.
*/
function formatNumber(value, locale, digitsInfo) {
/** @type {?} */
var format = getLocaleNumberFormat(locale, NumberFormatStyle.Decimal);
/** @type {?} */
var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
return formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo);
}
/**
* @record
*/
function ParsedNumberFormat() {}
if (false) {}
/**
* @param {?} format
* @param {?=} minusSign
* @return {?}
*/
function parseNumberFormat(format) {
var minusSign = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '-';
/** @type {?} */
var p = {
minInt: 1,
minFrac: 0,
maxFrac: 0,
posPre: '',
posSuf: '',
negPre: '',
negSuf: '',
gSize: 0,
lgSize: 0
};
/** @type {?} */
var patternParts = format.split(PATTERN_SEP);
/** @type {?} */
var positive = patternParts[0];
/** @type {?} */
var negative = patternParts[1];
/** @type {?} */
var positiveParts = positive.indexOf(DECIMAL_SEP) !== -1 ? positive.split(DECIMAL_SEP) : [positive.substring(0, positive.lastIndexOf(ZERO_CHAR) + 1), positive.substring(positive.lastIndexOf(ZERO_CHAR) + 1)];
/** @type {?} */
var integer = positiveParts[0];
/** @type {?} */
var fraction = positiveParts[1] || '';
p.posPre = integer.substr(0, integer.indexOf(DIGIT_CHAR));
for (var i = 0; i < fraction.length; i++) {
/** @type {?} */
var ch = fraction.charAt(i);
if (ch === ZERO_CHAR) {
p.minFrac = p.maxFrac = i + 1;
} else if (ch === DIGIT_CHAR) {
p.maxFrac = i + 1;
} else {
p.posSuf += ch;
}
}
/** @type {?} */
var groups = integer.split(GROUP_SEP);
p.gSize = groups[1] ? groups[1].length : 0;
p.lgSize = groups[2] || groups[1] ? (groups[2] || groups[1]).length : 0;
if (negative) {
/** @type {?} */
var trunkLen = positive.length - p.posPre.length - p.posSuf.length;
/** @type {?} */
var pos = negative.indexOf(DIGIT_CHAR);
p.negPre = negative.substr(0, pos).replace(/'/g, '');
p.negSuf = negative.substr(pos + trunkLen).replace(/'/g, '');
} else {
p.negPre = minusSign + p.posPre;
p.negSuf = p.posSuf;
}
return p;
}
/**
* @record
*/
function ParsedNumber() {}
if (false) {} // Transforms a parsed number into a percentage by multiplying it by 100
/**
* @param {?} parsedNumber
* @return {?}
*/
function toPercent(parsedNumber) {
// if the number is 0, don't do anything
if (parsedNumber.digits[0] === 0) {
return parsedNumber;
} // Getting the current number of decimals
/** @type {?} */
var fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;
if (parsedNumber.exponent) {
parsedNumber.exponent += 2;
} else {
if (fractionLen === 0) {
parsedNumber.digits.push(0, 0);
} else if (fractionLen === 1) {
parsedNumber.digits.push(0);
}
parsedNumber.integerLen += 2;
}
return parsedNumber;
}
/**
* Parses a number.
* Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/
* @param {?} num
* @return {?}
*/
function parseNumber(num) {
/** @type {?} */
var numStr = Math.abs(num) + '';
/** @type {?} */
var exponent = 0;
/** @type {?} */
var digits;
/** @type {?} */
var integerLen;
/** @type {?} */
var i;
/** @type {?} */
var j;
/** @type {?} */
var zeros; // Decimal point?
if ((integerLen = numStr.indexOf(DECIMAL_SEP)) > -1) {
numStr = numStr.replace(DECIMAL_SEP, '');
} // Exponential form?
if ((i = numStr.search(/e/i)) > 0) {
// Work out the exponent.
if (integerLen < 0) integerLen = i;
integerLen += +numStr.slice(i + 1);
numStr = numStr.substring(0, i);
} else if (integerLen < 0) {
// There was no decimal point or exponent so it is an integer.
integerLen = numStr.length;
} // Count the number of leading zeros.
for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) {
/* empty */
}
if (i === (zeros = numStr.length)) {
// The digits are all zero.
digits = [0];
integerLen = 1;
} else {
// Count the number of trailing zeros
zeros--;
while (numStr.charAt(zeros) === ZERO_CHAR) {
zeros--;
} // Trailing zeros are insignificant so ignore them
integerLen -= i;
digits = []; // Convert string to array of digits without leading/trailing zeros.
for (j = 0; i <= zeros; i++, j++) {
digits[j] = Number(numStr.charAt(i));
}
} // If the number overflows the maximum allowed digits then use an exponent.
if (integerLen > MAX_DIGITS) {
digits = digits.splice(0, MAX_DIGITS - 1);
exponent = integerLen - 1;
integerLen = 1;
}
return {
digits: digits,
exponent: exponent,
integerLen: integerLen
};
}
/**
* Round the parsed number to the specified number of decimal places
* This function changes the parsedNumber in-place
* @param {?} parsedNumber
* @param {?} minFrac
* @param {?} maxFrac
* @return {?}
*/
function roundNumber(parsedNumber, minFrac, maxFrac) {
if (minFrac > maxFrac) {
throw new Error("The minimum number of digits after fraction (".concat(minFrac, ") is higher than the maximum (").concat(maxFrac, ")."));
}
/** @type {?} */
var digits = parsedNumber.digits;
/** @type {?} */
var fractionLen = digits.length - parsedNumber.integerLen;
/** @type {?} */
var fractionSize = Math.min(Math.max(minFrac, fractionLen), maxFrac); // The index of the digit to where rounding is to occur
/** @type {?} */
var roundAt = fractionSize + parsedNumber.integerLen;
/** @type {?} */
var digit = digits[roundAt];
if (roundAt > 0) {
// Drop fractional digits beyond `roundAt`
digits.splice(Math.max(parsedNumber.integerLen, roundAt)); // Set non-fractional digits beyond `roundAt` to 0
for (var j = roundAt; j < digits.length; j++) {
digits[j] = 0;
}
} else {
// We rounded to zero so reset the parsedNumber
fractionLen = Math.max(0, fractionLen);
parsedNumber.integerLen = 1;
digits.length = Math.max(1, roundAt = fractionSize + 1);
digits[0] = 0;
for (var i = 1; i < roundAt; i++) {
digits[i] = 0;
}
}
if (digit >= 5) {
if (roundAt - 1 < 0) {
for (var k = 0; k > roundAt; k--) {
digits.unshift(0);
parsedNumber.integerLen++;
}
digits.unshift(1);
parsedNumber.integerLen++;
} else {
digits[roundAt - 1]++;
}
} // Pad out with zeros to get the required fraction length
for (; fractionLen < Math.max(0, fractionSize); fractionLen++) {
digits.push(0);
}
/** @type {?} */
var dropTrailingZeros = fractionSize !== 0; // Minimal length = nb of decimals required + current nb of integers
// Any number besides that is optional and can be removed if it's a trailing 0
/** @type {?} */
var minLen = minFrac + parsedNumber.integerLen; // Do any carrying, e.g. a digit was rounded up to 10
/** @type {?} */
var carry = digits.reduceRight(
/**
* @param {?} carry
* @param {?} d
* @param {?} i
* @param {?} digits
* @return {?}
*/
function (carry, d, i, digits) {
d = d + carry;
digits[i] = d < 10 ? d : d - 10; // d % 10
if (dropTrailingZeros) {
// Do not keep meaningless fractional trailing zeros (e.g. 15.52000 --> 15.52)
if (digits[i] === 0 && i >= minLen) {
digits.pop();
} else {
dropTrailingZeros = false;
}
}
return d >= 10 ? 1 : 0; // Math.floor(d / 10);
}, 0);
if (carry) {
digits.unshift(carry);
parsedNumber.integerLen++;
}
}
/**
* @param {?} text
* @return {?}
*/
function parseIntAutoRadix(text) {
/** @type {?} */
var result = parseInt(text);
if (isNaN(result)) {
throw new Error('Invalid integer literal when parsing ' + text);
}
return result;
}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/i18n/localization.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* \@publicApi
* @abstract
*/
var NgLocalization = function NgLocalization() {
_classCallCheck(this, NgLocalization);
};
if (false) {}
/**
* Returns the plural category for a given value.
* - "=value" when the case exists,
* - the plural category otherwise
* @param {?} value
* @param {?} cases
* @param {?} ngLocalization
* @param {?=} locale
* @return {?}
*/
function getPluralCategory(value, cases, ngLocalization, locale) {
/** @type {?} */
var key = "=".concat(value);
if (cases.indexOf(key) > -1) {
return key;
}
key = ngLocalization.getPluralCategory(value, locale);
if (cases.indexOf(key) > -1) {
return key;
}
if (cases.indexOf('other') > -1) {
return 'other';
}
throw new Error("No plural message found for value \"".concat(value, "\""));
}
var NgLocaleLocalization = /*@__PURE__*/function () {
var NgLocaleLocalization = /*#__PURE__*/function (_NgLocalization) {
_inherits(NgLocaleLocalization, _NgLocalization);
var _super8 = _createSuper(NgLocaleLocalization);
/**
* @param {?} locale
*/
function NgLocaleLocalization(locale) {
var _this55;
_classCallCheck(this, NgLocaleLocalization);
_this55 = _super8.call(this);
_this55.locale = locale;
return _this55;
}
/**
* @param {?} value
* @param {?=} locale
* @return {?}
*/
_createClass2(NgLocaleLocalization, [{
key: "getPluralCategory",
value: function getPluralCategory(value, locale) {
/** @type {?} */
var plural = getLocalePluralCase(locale || this.locale)(value);
switch (plural) {
case Plural.Zero:
return 'zero';
case Plural.One:
return 'one';
case Plural.Two:
return 'two';
case Plural.Few:
return 'few';
case Plural.Many:
return 'many';
default:
return 'other';
}
}
}]);
return NgLocaleLocalization;
}(NgLocalization);
NgLocaleLocalization.ɵfac = function NgLocaleLocalization_Factory(t) {
return new (t || NgLocaleLocalization)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"]));
};
NgLocaleLocalization.ɵprov = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineInjectable"]({
token: NgLocaleLocalization,
factory: NgLocaleLocalization.ɵfac
});
return NgLocaleLocalization;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/i18n/locale_data.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Register global data to be used internally by Angular. See the
* ["I18n guide"](guide/i18n#i18n-pipes) to know how to import additional locale data.
*
* The signature registerLocaleData(data: any, extraData?: any) is deprecated since v5.1
*
* \@publicApi
* @param {?} data
* @param {?=} localeId
* @param {?=} extraData
* @return {?}
*/
function registerLocaleData(data, localeId, extraData) {
return Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵregisterLocaleData"])(data, localeId, extraData);
}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/cookie.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @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 {?} cookieStr
* @param {?} name
* @return {?}
*/
function parseCookieValue(cookieStr, name) {
name = encodeURIComponent(name);
var _iterator2 = _createForOfIteratorHelper(cookieStr.split(';')),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var cookie = _step2.value;
/** @type {?} */
var eqIndex = cookie.indexOf('=');
var _ref2 = eqIndex == -1 ? [cookie, ''] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)],
_ref3 = _slicedToArray(_ref2, 2),
cookieName = _ref3[0],
cookieValue = _ref3[1];
if (cookieName.trim() === name) {
return decodeURIComponent(cookieValue);
}
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
return null;
}
var NgClass = /*@__PURE__*/function () {
var NgClass = /*#__PURE__*/function () {
/**
* @param {?} _iterableDiffers
* @param {?} _keyValueDiffers
* @param {?} _ngEl
* @param {?} _renderer
*/
function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) {
_classCallCheck(this, NgClass);
this._iterableDiffers = _iterableDiffers;
this._keyValueDiffers = _keyValueDiffers;
this._ngEl = _ngEl;
this._renderer = _renderer;
this._iterableDiffer = null;
this._keyValueDiffer = null;
this._initialClasses = [];
this._rawClass = null;
}
/**
* @param {?} value
* @return {?}
*/
_createClass2(NgClass, [{
key: "klass",
set: function set(value) {
this._removeClasses(this._initialClasses);
this._initialClasses = typeof value === 'string' ? value.split(/\s+/) : [];
this._applyClasses(this._initialClasses);
this._applyClasses(this._rawClass);
}
/**
* @param {?} value
* @return {?}
*/
}, {
key: "ngClass",
set: function set(value) {
this._removeClasses(this._rawClass);
this._applyClasses(this._initialClasses);
this._iterableDiffer = null;
this._keyValueDiffer = null;
this._rawClass = typeof value === 'string' ? value.split(/\s+/) : value;
if (this._rawClass) {
if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵisListLikeIterable"])(this._rawClass)) {
this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create();
} else {
this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create();
}
}
}
/**
* @return {?}
*/
}, {
key: "ngDoCheck",
value: function ngDoCheck() {
if (this._iterableDiffer) {
/** @type {?} */
var iterableChanges = this._iterableDiffer.diff(
/** @type {?} */
this._rawClass);
if (iterableChanges) {
this._applyIterableChanges(iterableChanges);
}
} else if (this._keyValueDiffer) {
/** @type {?} */
var keyValueChanges = this._keyValueDiffer.diff(
/** @type {?} */
this._rawClass);
if (keyValueChanges) {
this._applyKeyValueChanges(keyValueChanges);
}
}
}
/**
* @private
* @param {?} changes
* @return {?}
*/
}, {
key: "_applyKeyValueChanges",
value: function _applyKeyValueChanges(changes) {
var _this56 = this;
changes.forEachAddedItem(
/**
* @param {?} record
* @return {?}
*/
function (record) {
return _this56._toggleClass(record.key, record.currentValue);
});
changes.forEachChangedItem(
/**
* @param {?} record
* @return {?}
*/
function (record) {
return _this56._toggleClass(record.key, record.currentValue);
});
changes.forEachRemovedItem(
/**
* @param {?} record
* @return {?}
*/
function (record) {
if (record.previousValue) {
_this56._toggleClass(record.key, false);
}
});
}
/**
* @private
* @param {?} changes
* @return {?}
*/
}, {
key: "_applyIterableChanges",
value: function _applyIterableChanges(changes) {
var _this57 = this;
changes.forEachAddedItem(
/**
* @param {?} record
* @return {?}
*/
function (record) {
if (typeof record.item === 'string') {
_this57._toggleClass(record.item, true);
} else {
throw new Error("NgClass can only toggle CSS classes expressed as strings, got ".concat(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵstringify"])(record.item)));
}
});
changes.forEachRemovedItem(
/**
* @param {?} record
* @return {?}
*/
function (record) {
return _this57._toggleClass(record.item, false);
});
}
/**
* Applies a collection of CSS classes to the DOM element.
*
* For argument of type Set and Array CSS class names contained in those collections are always
* added.
* For argument of type Map CSS class name in the map's key is toggled based on the value (added
* for truthy and removed for falsy).
* @private
* @param {?} rawClassVal
* @return {?}
*/
}, {
key: "_applyClasses",
value: function _applyClasses(rawClassVal) {
var _this58 = this;
if (rawClassVal) {
if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) {
/** @type {?} */
rawClassVal.forEach(
/**
* @param {?} klass
* @return {?}
*/
function (klass) {
return _this58._toggleClass(klass, true);
});
} else {
Object.keys(rawClassVal).forEach(
/**
* @param {?} klass
* @return {?}
*/
/**
* @param {?} klass
* @return {?}
*/
function (klass) {
return _this58._toggleClass(klass, !!rawClassVal[klass]);
});
}
}
}
/**
* Removes a collection of CSS classes from the DOM element. This is mostly useful for cleanup
* purposes.
* @private
* @param {?} rawClassVal
* @return {?}
*/
}, {
key: "_removeClasses",
value: function _removeClasses(rawClassVal) {
var _this59 = this;
if (rawClassVal) {
if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) {
/** @type {?} */
rawClassVal.forEach(
/**
* @param {?} klass
* @return {?}
*/
function (klass) {
return _this59._toggleClass(klass, false);
});
} else {
Object.keys(rawClassVal).forEach(
/**
* @param {?} klass
* @return {?}
*/
/**
* @param {?} klass
* @return {?}
*/
function (klass) {
return _this59._toggleClass(klass, false);
});
}
}
}
/**
* @private
* @param {?} klass
* @param {?} enabled
* @return {?}
*/
}, {
key: "_toggleClass",
value: function _toggleClass(klass, enabled) {
var _this60 = this;
klass = klass.trim();
if (klass) {
klass.split(/\s+/g).forEach(
/**
* @param {?} klass
* @return {?}
*/
/**
* @param {?} klass
* @return {?}
*/
function (klass) {
if (enabled) {
_this60._renderer.addClass(_this60._ngEl.nativeElement, klass);
} else {
_this60._renderer.removeClass(_this60._ngEl.nativeElement, klass);
}
});
}
}
}]);
return NgClass;
}();
NgClass.ɵfac = function NgClass_Factory(t) {
return new (t || NgClass)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["IterableDiffers"]), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["KeyValueDiffers"]), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"]), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"]));
};
NgClass.ɵdir = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineDirective"]({
type: NgClass,
selectors: [["", "ngClass", ""]],
inputs: {
klass: ["class", "klass"],
ngClass: "ngClass"
}
});
return NgClass;
}();
if (false) {}
var NgComponentOutlet = /*@__PURE__*/function () {
var NgComponentOutlet = /*#__PURE__*/function () {
/**
* @param {?} _viewContainerRef
*/
function NgComponentOutlet(_viewContainerRef) {
_classCallCheck(this, NgComponentOutlet);
this._viewContainerRef = _viewContainerRef;
this._componentRef = null;
this._moduleRef = null;
}
/**
* @param {?} changes
* @return {?}
*/
_createClass2(NgComponentOutlet, [{
key: "ngOnChanges",
value: function ngOnChanges(changes) {
this._viewContainerRef.clear();
this._componentRef = null;
if (this.ngComponentOutlet) {
/** @type {?} */
var elInjector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector;
if (changes['ngComponentOutletNgModuleFactory']) {
if (this._moduleRef) this._moduleRef.destroy();
if (this.ngComponentOutletNgModuleFactory) {
/** @type {?} */
var parentModule = elInjector.get(_angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModuleRef"]);
this._moduleRef = this.ngComponentOutletNgModuleFactory.create(parentModule.injector);
} else {
this._moduleRef = null;
}
}
/** @type {?} */
var componentFactoryResolver = this._moduleRef ? this._moduleRef.componentFactoryResolver : elInjector.get(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ComponentFactoryResolver"]);
/** @type {?} */
var componentFactory = componentFactoryResolver.resolveComponentFactory(this.ngComponentOutlet);
this._componentRef = this._viewContainerRef.createComponent(componentFactory, this._viewContainerRef.length, elInjector, this.ngComponentOutletContent);
}
}
/**
* @return {?}
*/
}, {
key: "ngOnDestroy",
value: function ngOnDestroy() {
if (this._moduleRef) this._moduleRef.destroy();
}
}]);
return NgComponentOutlet;
}();
NgComponentOutlet.ɵfac = function NgComponentOutlet_Factory(t) {
return new (t || NgComponentOutlet)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"]));
};
NgComponentOutlet.ɵdir = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineDirective"]({
type: NgComponentOutlet,
selectors: [["", "ngComponentOutlet", ""]],
inputs: {
ngComponentOutlet: "ngComponentOutlet",
ngComponentOutletInjector: "ngComponentOutletInjector",
ngComponentOutletContent: "ngComponentOutletContent",
ngComponentOutletNgModuleFactory: "ngComponentOutletNgModuleFactory"
},
features: [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵNgOnChangesFeature"]]
});
return NgComponentOutlet;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/directives/ng_for_of.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* \@publicApi
* @template T, U
*/
var NgForOfContext = /*#__PURE__*/function () {
/**
* @param {?} $implicit
* @param {?} ngForOf
* @param {?} index
* @param {?} count
*/
function NgForOfContext($implicit, ngForOf, index, count) {
_classCallCheck(this, NgForOfContext);
this.$implicit = $implicit;
this.ngForOf = ngForOf;
this.index = index;
this.count = count;
}
/**
* @return {?}
*/
_createClass2(NgForOfContext, [{
key: "first",
get: function get() {
return this.index === 0;
}
/**
* @return {?}
*/
}, {
key: "last",
get: function get() {
return this.index === this.count - 1;
}
/**
* @return {?}
*/
}, {
key: "even",
get: function get() {
return this.index % 2 === 0;
}
/**
* @return {?}
*/
}, {
key: "odd",
get: function get() {
return !this.even;
}
}]);
return NgForOfContext;
}();
if (false) {}
var NgForOf = /*@__PURE__*/function () {
var NgForOf = /*#__PURE__*/function () {
/**
* @param {?} _viewContainer
* @param {?} _template
* @param {?} _differs
*/
function NgForOf(_viewContainer, _template, _differs) {
_classCallCheck(this, NgForOf);
this._viewContainer = _viewContainer;
this._template = _template;
this._differs = _differs;
this._ngForOf = null;
this._ngForOfDirty = true;
this._differ = null;
}
/**
* The value of the iterable expression, which can be used as a
* [template input variable](guide/structural-directives#template-input-variable).
* @param {?} ngForOf
* @return {?}
*/
_createClass2(NgForOf, [{
key: "ngForOf",
set: function set(ngForOf) {
this._ngForOf = ngForOf;
this._ngForOfDirty = true;
}
/**
* A function that defines how to track changes for items in the iterable.
*
* When items are added, moved, or removed in the iterable,
* the directive must re-render the appropriate DOM nodes.
* To minimize churn in the DOM, only nodes that have changed
* are re-rendered.
*
* By default, the change detector assumes that
* the object instance identifies the node in the iterable.
* When this function is supplied, the directive uses
* the result of calling this function to identify the item node,
* rather than the identity of the object itself.
*
* The function receives two inputs,
* the iteration index and the node object ID.
* @param {?} fn
* @return {?}
*/
}, {
key: "ngForTrackBy",
get:
/**
* @return {?}
*/
function get() {
return this._trackByFn;
}
/**
* A reference to the template that is stamped out for each item in the iterable.
* @see [template reference variable](guide/template-syntax#template-reference-variables--var-)
* @param {?} value
* @return {?}
*/
,
set: function set(fn) {
if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["isDevMode"])() && fn != null && typeof fn !== 'function') {
// TODO(vicb): use a log service once there is a public one available
if (
/** @type {?} */
console &&
/** @type {?} */
console.warn) {
console.warn("trackBy must be a function, but received ".concat(JSON.stringify(fn), ". ") + "See https://angular.io/api/common/NgForOf#change-propagation for more information.");
}
}
this._trackByFn = fn;
}
}, {
key: "ngForTemplate",
set: function set(value) {
// TODO(TS2.1): make TemplateRef>> once we move to TS v2.1
// The current type is too restrictive; a template that just uses index, for example,
// should be acceptable.
if (value) {
this._template = value;
}
}
/**
* Applies the changes when needed.
* @return {?}
*/
}, {
key: "ngDoCheck",
value: function ngDoCheck() {
if (this._ngForOfDirty) {
this._ngForOfDirty = false; // React on ngForOf changes only once all inputs have been initialized
/** @type {?} */
var value = this._ngForOf;
if (!this._differ && value) {
try {
this._differ = this._differs.find(value).create(this.ngForTrackBy);
} catch (_a) {
throw new Error("Cannot find a differ supporting object '".concat(value, "' of type '").concat(getTypeName(value), "'. NgFor only supports binding to Iterables such as Arrays."));
}
}
}
if (this._differ) {
/** @type {?} */
var changes = this._differ.diff(this._ngForOf);
if (changes) this._applyChanges(changes);
}
}
/**
* @private
* @param {?} changes
* @return {?}
*/
}, {
key: "_applyChanges",
value: function _applyChanges(changes) {
var _this61 = this;
/** @type {?} */
var insertTuples = [];
changes.forEachOperation(
/**
* @param {?} item
* @param {?} adjustedPreviousIndex
* @param {?} currentIndex
* @return {?}
*/
function (item, adjustedPreviousIndex, currentIndex) {
if (item.previousIndex == null) {
// NgForOf is never "null" or "undefined" here because the differ detected
// that a new item needs to be inserted from the iterable. This implies that
// there is an iterable value for "_ngForOf".
/** @type {?} */
var view = _this61._viewContainer.createEmbeddedView(_this61._template, new NgForOfContext(
/** @type {?} */
null,
/** @type {?} */
_this61._ngForOf, -1, -1), currentIndex === null ? undefined : currentIndex);
/** @type {?} */
var tuple = new RecordViewTuple(item, view);
insertTuples.push(tuple);
} else if (currentIndex == null) {
_this61._viewContainer.remove(adjustedPreviousIndex === null ? undefined : adjustedPreviousIndex);
} else if (adjustedPreviousIndex !== null) {
/** @type {?} */
var _view2 =
/** @type {?} */
_this61._viewContainer.get(adjustedPreviousIndex);
_this61._viewContainer.move(_view2, currentIndex);
/** @type {?} */
var _tuple = new RecordViewTuple(item,
/** @type {?} */
_view2);
insertTuples.push(_tuple);
}
});
for (var i = 0; i < insertTuples.length; i++) {
this._perViewChange(insertTuples[i].view, insertTuples[i].record);
}
for (var _i8 = 0, ilen = this._viewContainer.length; _i8 < ilen; _i8++) {
/** @type {?} */
var viewRef =
/** @type {?} */
this._viewContainer.get(_i8);
viewRef.context.index = _i8;
viewRef.context.count = ilen;
viewRef.context.ngForOf =
/** @type {?} */
this._ngForOf;
}
changes.forEachIdentityChange(
/**
* @param {?} record
* @return {?}
*/
function (record) {
/** @type {?} */
var viewRef =
/** @type {?} */
_this61._viewContainer.get(record.currentIndex);
viewRef.context.$implicit = record.item;
});
}
/**
* @private
* @param {?} view
* @param {?} record
* @return {?}
*/
}, {
key: "_perViewChange",
value: function _perViewChange(view, record) {
view.context.$implicit = record.item;
}
/**
* Asserts the correct type of the context for the template that `NgForOf` will render.
*
* The presence of this method is a signal to the Ivy template type-check compiler that the
* `NgForOf` structural directive renders its template with a specific context type.
* @template T, U
* @param {?} dir
* @param {?} ctx
* @return {?}
*/
}], [{
key: "ngTemplateContextGuard",
value: function ngTemplateContextGuard(dir, ctx) {
return true;
}
}]);
return NgForOf;
}();
NgForOf.ɵfac = function NgForOf_Factory(t) {
return new (t || NgForOf)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"]), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"]), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["IterableDiffers"]));
};
NgForOf.ɵdir = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineDirective"]({
type: NgForOf,
selectors: [["", "ngFor", "", "ngForOf", ""]],
inputs: {
ngForOf: "ngForOf",
ngForTrackBy: "ngForTrackBy",
ngForTemplate: "ngForTemplate"
}
});
return NgForOf;
}();
if (false) {}
/**
* @template T, U
*/
var RecordViewTuple =
/**
* @param {?} record
* @param {?} view
*/
function RecordViewTuple(record, view) {
_classCallCheck(this, RecordViewTuple);
this.record = record;
this.view = view;
};
if (false) {}
/**
* @param {?} type
* @return {?}
*/
function getTypeName(type) {
return type['name'] || typeof type;
}
var NgIf = /*@__PURE__*/function () {
var NgIf = /*#__PURE__*/function () {
/**
* @param {?} _viewContainer
* @param {?} templateRef
*/
function NgIf(_viewContainer, templateRef) {
_classCallCheck(this, NgIf);
this._viewContainer = _viewContainer;
this._context = new NgIfContext();
this._thenTemplateRef = null;
this._elseTemplateRef = null;
this._thenViewRef = null;
this._elseViewRef = null;
this._thenTemplateRef = templateRef;
}
/**
* The Boolean expression to evaluate as the condition for showing a template.
* @param {?} condition
* @return {?}
*/
_createClass2(NgIf, [{
key: "ngIf",
set: function set(condition) {
this._context.$implicit = this._context.ngIf = condition;
this._updateView();
}
/**
* A template to show if the condition expression evaluates to true.
* @param {?} templateRef
* @return {?}
*/
}, {
key: "ngIfThen",
set: function set(templateRef) {
assertTemplate('ngIfThen', templateRef);
this._thenTemplateRef = templateRef;
this._thenViewRef = null; // clear previous view if any.
this._updateView();
}
/**
* A template to show if the condition expression evaluates to false.
* @param {?} templateRef
* @return {?}
*/
}, {
key: "ngIfElse",
set: function set(templateRef) {
assertTemplate('ngIfElse', templateRef);
this._elseTemplateRef = templateRef;
this._elseViewRef = null; // clear previous view if any.
this._updateView();
}
/**
* @private
* @return {?}
*/
}, {
key: "_updateView",
value: function _updateView() {
if (this._context.$implicit) {
if (!this._thenViewRef) {
this._viewContainer.clear();
this._elseViewRef = null;
if (this._thenTemplateRef) {
this._thenViewRef = this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context);
}
}
} else {
if (!this._elseViewRef) {
this._viewContainer.clear();
this._thenViewRef = null;
if (this._elseTemplateRef) {
this._elseViewRef = this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context);
}
}
}
}
/**
* Asserts the correct type of the context for the template that `NgIf` will render.
*
* The presence of this method is a signal to the Ivy template type-check compiler that the
* `NgIf` structural directive renders its template with a specific context type.
* @template T
* @param {?} dir
* @param {?} ctx
* @return {?}
*/
}], [{
key: "ngTemplateContextGuard",
value: function ngTemplateContextGuard(dir, ctx) {
return true;
}
}]);
return NgIf;
}();
NgIf.ɵfac = function NgIf_Factory(t) {
return new (t || NgIf)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"]), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"]));
};
NgIf.ɵdir = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineDirective"]({
type: NgIf,
selectors: [["", "ngIf", ""]],
inputs: {
ngIf: "ngIf",
ngIfThen: "ngIfThen",
ngIfElse: "ngIfElse"
}
});
return NgIf;
}();
if (false) {}
/**
* \@publicApi
* @template T
*/
var NgIfContext = function NgIfContext() {
_classCallCheck(this, NgIfContext);
this.$implicit =
/** @type {?} */
null;
this.ngIf =
/** @type {?} */
null;
};
if (false) {}
/**
* @param {?} property
* @param {?} templateRef
* @return {?}
*/
function assertTemplate(property, templateRef) {
/** @type {?} */
var isTemplateRefOrNull = !!(!templateRef || templateRef.createEmbeddedView);
if (!isTemplateRefOrNull) {
throw new Error("".concat(property, " must be a TemplateRef, but received '").concat(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵstringify"])(templateRef), "'."));
}
}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/directives/ng_switch.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
var SwitchView = /*#__PURE__*/function () {
/**
* @param {?} _viewContainerRef
* @param {?} _templateRef
*/
function SwitchView(_viewContainerRef, _templateRef) {
_classCallCheck(this, SwitchView);
this._viewContainerRef = _viewContainerRef;
this._templateRef = _templateRef;
this._created = false;
}
/**
* @return {?}
*/
_createClass2(SwitchView, [{
key: "create",
value: function create() {
this._created = true;
this._viewContainerRef.createEmbeddedView(this._templateRef);
}
/**
* @return {?}
*/
}, {
key: "destroy",
value: function destroy() {
this._created = false;
this._viewContainerRef.clear();
}
/**
* @param {?} created
* @return {?}
*/
}, {
key: "enforceState",
value: function enforceState(created) {
if (created && !this._created) {
this.create();
} else if (!created && this._created) {
this.destroy();
}
}
}]);
return SwitchView;
}();
if (false) {}
var NgSwitch = /*@__PURE__*/function () {
var NgSwitch = /*#__PURE__*/function () {
function NgSwitch() {
_classCallCheck(this, NgSwitch);
this._defaultUsed = false;
this._caseCount = 0;
this._lastCaseCheckIndex = 0;
this._lastCasesMatched = false;
}
/**
* @param {?} newValue
* @return {?}
*/
_createClass2(NgSwitch, [{
key: "ngSwitch",
set: function set(newValue) {
this._ngSwitch = newValue;
if (this._caseCount === 0) {
this._updateDefaultCases(true);
}
}
/**
* \@internal
* @return {?}
*/
}, {
key: "_addCase",
value: function _addCase() {
return this._caseCount++;
}
/**
* \@internal
* @param {?} view
* @return {?}
*/
}, {
key: "_addDefault",
value: function _addDefault(view) {
if (!this._defaultViews) {
this._defaultViews = [];
}
this._defaultViews.push(view);
}
/**
* \@internal
* @param {?} value
* @return {?}
*/
}, {
key: "_matchCase",
value: function _matchCase(value) {
/** @type {?} */
var matched = value == this._ngSwitch;
this._lastCasesMatched = this._lastCasesMatched || matched;
this._lastCaseCheckIndex++;
if (this._lastCaseCheckIndex === this._caseCount) {
this._updateDefaultCases(!this._lastCasesMatched);
this._lastCaseCheckIndex = 0;
this._lastCasesMatched = false;
}
return matched;
}
/**
* @private
* @param {?} useDefault
* @return {?}
*/
}, {
key: "_updateDefaultCases",
value: function _updateDefaultCases(useDefault) {
if (this._defaultViews && useDefault !== this._defaultUsed) {
this._defaultUsed = useDefault;
for (var i = 0; i < this._defaultViews.length; i++) {
/** @type {?} */
var defaultView = this._defaultViews[i];
defaultView.enforceState(useDefault);
}
}
}
}]);
return NgSwitch;
}();
NgSwitch.ɵfac = function NgSwitch_Factory(t) {
return new (t || NgSwitch)();
};
NgSwitch.ɵdir = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineDirective"]({
type: NgSwitch,
selectors: [["", "ngSwitch", ""]],
inputs: {
ngSwitch: "ngSwitch"
}
});
return NgSwitch;
}();
if (false) {}
var NgSwitchCase = /*@__PURE__*/function () {
var NgSwitchCase = /*#__PURE__*/function () {
/**
* @param {?} viewContainer
* @param {?} templateRef
* @param {?} ngSwitch
*/
function NgSwitchCase(viewContainer, templateRef, ngSwitch) {
_classCallCheck(this, NgSwitchCase);
this.ngSwitch = ngSwitch;
ngSwitch._addCase();
this._view = new SwitchView(viewContainer, templateRef);
}
/**
* Performs case matching. For internal use only.
* @return {?}
*/
_createClass2(NgSwitchCase, [{
key: "ngDoCheck",
value: function ngDoCheck() {
this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase));
}
}]);
return NgSwitchCase;
}();
NgSwitchCase.ɵfac = function NgSwitchCase_Factory(t) {
return new (t || NgSwitchCase)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"]), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"]), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](NgSwitch, 1));
};
NgSwitchCase.ɵdir = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineDirective"]({
type: NgSwitchCase,
selectors: [["", "ngSwitchCase", ""]],
inputs: {
ngSwitchCase: "ngSwitchCase"
}
});
return NgSwitchCase;
}();
if (false) {}
var NgSwitchDefault = /*@__PURE__*/function () {
var NgSwitchDefault =
/**
* @param {?} viewContainer
* @param {?} templateRef
* @param {?} ngSwitch
*/
function NgSwitchDefault(viewContainer, templateRef, ngSwitch) {
_classCallCheck(this, NgSwitchDefault);
ngSwitch._addDefault(new SwitchView(viewContainer, templateRef));
};
NgSwitchDefault.ɵfac = function NgSwitchDefault_Factory(t) {
return new (t || NgSwitchDefault)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"]), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"]), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](NgSwitch, 1));
};
NgSwitchDefault.ɵdir = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineDirective"]({
type: NgSwitchDefault,
selectors: [["", "ngSwitchDefault", ""]]
});
return NgSwitchDefault;
}();
var NgPlural = /*@__PURE__*/function () {
var NgPlural = /*#__PURE__*/function () {
/**
* @param {?} _localization
*/
function NgPlural(_localization) {
_classCallCheck(this, NgPlural);
this._localization = _localization;
this._caseViews = {};
}
/**
* @param {?} value
* @return {?}
*/
_createClass2(NgPlural, [{
key: "ngPlural",
set: function set(value) {
this._switchValue = value;
this._updateView();
}
/**
* @param {?} value
* @param {?} switchView
* @return {?}
*/
}, {
key: "addCase",
value: function addCase(value, switchView) {
this._caseViews[value] = switchView;
}
/**
* @private
* @return {?}
*/
}, {
key: "_updateView",
value: function _updateView() {
this._clearViews();
/** @type {?} */
var cases = Object.keys(this._caseViews);
/** @type {?} */
var key = getPluralCategory(this._switchValue, cases, this._localization);
this._activateView(this._caseViews[key]);
}
/**
* @private
* @return {?}
*/
}, {
key: "_clearViews",
value: function _clearViews() {
if (this._activeView) this._activeView.destroy();
}
/**
* @private
* @param {?} view
* @return {?}
*/
}, {
key: "_activateView",
value: function _activateView(view) {
if (view) {
this._activeView = view;
this._activeView.create();
}
}
}]);
return NgPlural;
}();
NgPlural.ɵfac = function NgPlural_Factory(t) {
return new (t || NgPlural)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](NgLocalization));
};
NgPlural.ɵdir = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineDirective"]({
type: NgPlural,
selectors: [["", "ngPlural", ""]],
inputs: {
ngPlural: "ngPlural"
}
});
return NgPlural;
}();
if (false) {}
var NgPluralCase = /*@__PURE__*/function () {
var NgPluralCase =
/**
* @param {?} value
* @param {?} template
* @param {?} viewContainer
* @param {?} ngPlural
*/
function NgPluralCase(value, template, viewContainer, ngPlural) {
_classCallCheck(this, NgPluralCase);
this.value = value;
/** @type {?} */
var isANumber = !isNaN(Number(value));
ngPlural.addCase(isANumber ? "=".concat(value) : value, new SwitchView(viewContainer, template));
};
NgPluralCase.ɵfac = function NgPluralCase_Factory(t) {
return new (t || NgPluralCase)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinjectAttribute"]('ngPluralCase'), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"]), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"]), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](NgPlural, 1));
};
NgPluralCase.ɵdir = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineDirective"]({
type: NgPluralCase,
selectors: [["", "ngPluralCase", ""]]
});
return NgPluralCase;
}();
if (false) {}
var NgStyle = /*@__PURE__*/function () {
var NgStyle = /*#__PURE__*/function () {
/**
* @param {?} _ngEl
* @param {?} _differs
* @param {?} _renderer
*/
function NgStyle(_ngEl, _differs, _renderer) {
_classCallCheck(this, NgStyle);
this._ngEl = _ngEl;
this._differs = _differs;
this._renderer = _renderer;
this._ngStyle = null;
this._differ = null;
}
/**
* @param {?} values
* @return {?}
*/
_createClass2(NgStyle, [{
key: "ngStyle",
set: function set(values) {
this._ngStyle = values;
if (!this._differ && values) {
this._differ = this._differs.find(values).create();
}
}
/**
* @return {?}
*/
}, {
key: "ngDoCheck",
value: function ngDoCheck() {
if (this._differ) {
/** @type {?} */
var changes = this._differ.diff(
/** @type {?} */
this._ngStyle);
if (changes) {
this._applyChanges(changes);
}
}
}
/**
* @private
* @param {?} nameAndUnit
* @param {?} value
* @return {?}
*/
}, {
key: "_setStyle",
value: function _setStyle(nameAndUnit, value) {
var _nameAndUnit$split = nameAndUnit.split('.'),
_nameAndUnit$split2 = _slicedToArray(_nameAndUnit$split, 2),
name = _nameAndUnit$split2[0],
unit = _nameAndUnit$split2[1];
value = value != null && unit ? "".concat(value).concat(unit) : value;
if (value != null) {
this._renderer.setStyle(this._ngEl.nativeElement, name,
/** @type {?} */
value);
} else {
this._renderer.removeStyle(this._ngEl.nativeElement, name);
}
}
/**
* @private
* @param {?} changes
* @return {?}
*/
}, {
key: "_applyChanges",
value: function _applyChanges(changes) {
var _this62 = this;
changes.forEachRemovedItem(
/**
* @param {?} record
* @return {?}
*/
function (record) {
return _this62._setStyle(record.key, null);
});
changes.forEachAddedItem(
/**
* @param {?} record
* @return {?}
*/
function (record) {
return _this62._setStyle(record.key, record.currentValue);
});
changes.forEachChangedItem(
/**
* @param {?} record
* @return {?}
*/
function (record) {
return _this62._setStyle(record.key, record.currentValue);
});
}
}]);
return NgStyle;
}();
NgStyle.ɵfac = function NgStyle_Factory(t) {
return new (t || NgStyle)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"]), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["KeyValueDiffers"]), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"]));
};
NgStyle.ɵdir = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineDirective"]({
type: NgStyle,
selectors: [["", "ngStyle", ""]],
inputs: {
ngStyle: "ngStyle"
}
});
return NgStyle;
}();
if (false) {}
var NgTemplateOutlet = /*@__PURE__*/function () {
var NgTemplateOutlet = /*#__PURE__*/function () {
/**
* @param {?} _viewContainerRef
*/
function NgTemplateOutlet(_viewContainerRef) {
_classCallCheck(this, NgTemplateOutlet);
this._viewContainerRef = _viewContainerRef;
this._viewRef = null;
/**
* A context object to attach to the {\@link EmbeddedViewRef}. This should be an
* object, the object's keys will be available for binding by the local template `let`
* declarations.
* Using the key `$implicit` in the context object will set its value as default.
*/
this.ngTemplateOutletContext = null;
/**
* A string defining the template reference and optionally the context object for the template.
*/
this.ngTemplateOutlet = null;
}
/**
* @param {?} changes
* @return {?}
*/
_createClass2(NgTemplateOutlet, [{
key: "ngOnChanges",
value: function ngOnChanges(changes) {
/** @type {?} */
var recreateView = this._shouldRecreateView(changes);
if (recreateView) {
/** @type {?} */
var viewContainerRef = this._viewContainerRef;
if (this._viewRef) {
viewContainerRef.remove(viewContainerRef.indexOf(this._viewRef));
}
this._viewRef = this.ngTemplateOutlet ? viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, this.ngTemplateOutletContext) : null;
} else if (this._viewRef && this.ngTemplateOutletContext) {
this._updateExistingContext(this.ngTemplateOutletContext);
}
}
/**
* We need to re-create existing embedded view if:
* - templateRef has changed
* - context has changes
*
* We mark context object as changed when the corresponding object
* shape changes (new properties are added or existing properties are removed).
* In other words we consider context with the same properties as "the same" even
* if object reference changes (see https://github.com/angular/angular/issues/13407).
* @private
* @param {?} changes
* @return {?}
*/
}, {
key: "_shouldRecreateView",
value: function _shouldRecreateView(changes) {
/** @type {?} */
var ctxChange = changes['ngTemplateOutletContext'];
return !!changes['ngTemplateOutlet'] || ctxChange && this._hasContextShapeChanged(ctxChange);
}
/**
* @private
* @param {?} ctxChange
* @return {?}
*/
}, {
key: "_hasContextShapeChanged",
value: function _hasContextShapeChanged(ctxChange) {
/** @type {?} */
var prevCtxKeys = Object.keys(ctxChange.previousValue || {});
/** @type {?} */
var currCtxKeys = Object.keys(ctxChange.currentValue || {});
if (prevCtxKeys.length === currCtxKeys.length) {
var _iterator3 = _createForOfIteratorHelper(currCtxKeys),
_step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var propName = _step3.value;
if (prevCtxKeys.indexOf(propName) === -1) {
return true;
}
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
return false;
}
return true;
}
/**
* @private
* @param {?} ctx
* @return {?}
*/
}, {
key: "_updateExistingContext",
value: function _updateExistingContext(ctx) {
for (var _i9 = 0, _Object$keys = Object.keys(ctx); _i9 < _Object$keys.length; _i9++) {
var propName = _Object$keys[_i9];
/** @type {?} */
/** @type {?} */
this._viewRef.context[propName] =
/** @type {?} */
this.ngTemplateOutletContext[propName];
}
}
}]);
return NgTemplateOutlet;
}();
NgTemplateOutlet.ɵfac = function NgTemplateOutlet_Factory(t) {
return new (t || NgTemplateOutlet)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"]));
};
NgTemplateOutlet.ɵdir = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineDirective"]({
type: NgTemplateOutlet,
selectors: [["", "ngTemplateOutlet", ""]],
inputs: {
ngTemplateOutletContext: "ngTemplateOutletContext",
ngTemplateOutlet: "ngTemplateOutlet"
},
features: [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵNgOnChangesFeature"]]
});
return NgTemplateOutlet;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/directives/index.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* A collection of Angular directives that are likely to be used in each and every Angular
* application.
* @type {?}
*/
var COMMON_DIRECTIVES = [NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase];
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/pipes/invalid_pipe_argument_error.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @param {?} type
* @param {?} value
* @return {?}
*/
function invalidPipeArgumentError(type, value) {
return Error("InvalidPipeArgument: '".concat(value, "' for pipe '").concat(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵstringify"])(type), "'"));
}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/pipes/async_pipe.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @record
*/
function SubscriptionStrategy() {}
if (false) {}
var ObservableStrategy = /*#__PURE__*/function () {
function ObservableStrategy() {
_classCallCheck(this, ObservableStrategy);
}
_createClass2(ObservableStrategy, [{
key: "createSubscription",
value:
/**
* @param {?} async
* @param {?} updateLatestValue
* @return {?}
*/
function createSubscription(async, updateLatestValue) {
return async.subscribe({
next: updateLatestValue,
error:
/**
* @param {?} e
* @return {?}
*/
function error(e) {
throw e;
}
});
}
/**
* @param {?} subscription
* @return {?}
*/
}, {
key: "dispose",
value: function dispose(subscription) {
subscription.unsubscribe();
}
/**
* @param {?} subscription
* @return {?}
*/
}, {
key: "onDestroy",
value: function onDestroy(subscription) {
subscription.unsubscribe();
}
}]);
return ObservableStrategy;
}();
var PromiseStrategy = /*#__PURE__*/function () {
function PromiseStrategy() {
_classCallCheck(this, PromiseStrategy);
}
_createClass2(PromiseStrategy, [{
key: "createSubscription",
value:
/**
* @param {?} async
* @param {?} updateLatestValue
* @return {?}
*/
function createSubscription(async, updateLatestValue) {
return async.then(updateLatestValue,
/**
* @param {?} e
* @return {?}
*/
/**
* @param {?} e
* @return {?}
*/
function (e) {
throw e;
});
}
/**
* @param {?} subscription
* @return {?}
*/
}, {
key: "dispose",
value: function dispose(subscription) {}
/**
* @param {?} subscription
* @return {?}
*/
}, {
key: "onDestroy",
value: function onDestroy(subscription) {}
}]);
return PromiseStrategy;
}();
/** @type {?} */
var _promiseStrategy = /*@__PURE__*/new PromiseStrategy();
/** @type {?} */
var _observableStrategy = /*@__PURE__*/new ObservableStrategy();
var AsyncPipe = /*@__PURE__*/function () {
var AsyncPipe = /*#__PURE__*/function () {
/**
* @param {?} _ref
*/
function AsyncPipe(_ref) {
_classCallCheck(this, AsyncPipe);
this._ref = _ref;
this._latestValue = null;
this._latestReturnedValue = null;
this._subscription = null;
this._obj = null;
this._strategy =
/** @type {?} */
null;
}
/**
* @return {?}
*/
_createClass2(AsyncPipe, [{
key: "ngOnDestroy",
value: function ngOnDestroy() {
if (this._subscription) {
this._dispose();
}
}
/**
* @param {?} obj
* @return {?}
*/
}, {
key: "transform",
value: function transform(obj) {
if (!this._obj) {
if (obj) {
this._subscribe(obj);
}
this._latestReturnedValue = this._latestValue;
return this._latestValue;
}
if (obj !== this._obj) {
this._dispose();
return this.transform(
/** @type {?} */
obj);
}
if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵlooseIdentical"])(this._latestValue, this._latestReturnedValue)) {
return this._latestReturnedValue;
}
this._latestReturnedValue = this._latestValue;
return _angular_core__WEBPACK_IMPORTED_MODULE_0__["WrappedValue"].wrap(this._latestValue);
}
/**
* @private
* @param {?} obj
* @return {?}
*/
}, {
key: "_subscribe",
value: function _subscribe(obj) {
var _this63 = this;
this._obj = obj;
this._strategy = this._selectStrategy(obj);
this._subscription = this._strategy.createSubscription(obj,
/**
* @param {?} value
* @return {?}
*/
function (value) {
return _this63._updateLatestValue(obj, value);
});
}
/**
* @private
* @param {?} obj
* @return {?}
*/
}, {
key: "_selectStrategy",
value: function _selectStrategy(obj) {
if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵisPromise"])(obj)) {
return _promiseStrategy;
}
if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵisObservable"])(obj)) {
return _observableStrategy;
}
throw invalidPipeArgumentError(AsyncPipe, obj);
}
/**
* @private
* @return {?}
*/
}, {
key: "_dispose",
value: function _dispose() {
this._strategy.dispose(
/** @type {?} */
this._subscription);
this._latestValue = null;
this._latestReturnedValue = null;
this._subscription = null;
this._obj = null;
}
/**
* @private
* @param {?} async
* @param {?} value
* @return {?}
*/
}, {
key: "_updateLatestValue",
value: function _updateLatestValue(async, value) {
if (async === this._obj) {
this._latestValue = value;
this._ref.markForCheck();
}
}
}]);
return AsyncPipe;
}();
AsyncPipe.ɵfac = function AsyncPipe_Factory(t) {
return new (t || AsyncPipe)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinjectPipeChangeDetectorRef"]());
};
AsyncPipe.ɵpipe = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefinePipe"]({
name: "async",
type: AsyncPipe,
pure: false
});
return AsyncPipe;
}();
if (false) {}
var LowerCasePipe = /*@__PURE__*/function () {
var LowerCasePipe = /*#__PURE__*/function () {
function LowerCasePipe() {
_classCallCheck(this, LowerCasePipe);
}
_createClass2(LowerCasePipe, [{
key: "transform",
value:
/**
* @param {?} value The string to transform to lower case.
* @return {?}
*/
function transform(value) {
if (!value) return value;
if (typeof value !== 'string') {
throw invalidPipeArgumentError(LowerCasePipe, value);
}
return value.toLowerCase();
}
}]);
return LowerCasePipe;
}();
LowerCasePipe.ɵfac = function LowerCasePipe_Factory(t) {
return new (t || LowerCasePipe)();
};
LowerCasePipe.ɵpipe = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefinePipe"]({
name: "lowercase",
type: LowerCasePipe,
pure: true
});
return LowerCasePipe;
}(); //
// Regex below matches any Unicode word and compatible with ES5. In ES2018 the same result
// can be achieved by using /\p{L}\S*/gu and also known as Unicode Property Escapes
// (http://2ality.com/2017/07/regexp-unicode-property-escapes.html). Since there is no
// transpilation of this functionality down to ES5 without external tool, the only solution is
// to use already transpiled form. Example can be found here -
// https://mothereff.in/regexpu#input=var+regex+%3D+/%5Cp%7BL%7D/u%3B&unicodePropertyEscape=1
//
/** @type {?} */
var unicodeWordMatch = /(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D])\S*/g;
var TitleCasePipe = /*@__PURE__*/function () {
var TitleCasePipe = /*#__PURE__*/function () {
function TitleCasePipe() {
_classCallCheck(this, TitleCasePipe);
}
_createClass2(TitleCasePipe, [{
key: "transform",
value:
/**
* @param {?} value The string to transform to title case.
* @return {?}
*/
function transform(value) {
if (!value) return value;
if (typeof value !== 'string') {
throw invalidPipeArgumentError(TitleCasePipe, value);
}
return value.replace(unicodeWordMatch,
/**
* @param {?} txt
* @return {?}
*/
/**
* @param {?} txt
* @return {?}
*/
function (txt) {
return txt[0].toUpperCase() + txt.substr(1).toLowerCase();
});
}
}]);
return TitleCasePipe;
}();
TitleCasePipe.ɵfac = function TitleCasePipe_Factory(t) {
return new (t || TitleCasePipe)();
};
TitleCasePipe.ɵpipe = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefinePipe"]({
name: "titlecase",
type: TitleCasePipe,
pure: true
});
return TitleCasePipe;
}();
var UpperCasePipe = /*@__PURE__*/function () {
var UpperCasePipe = /*#__PURE__*/function () {
function UpperCasePipe() {
_classCallCheck(this, UpperCasePipe);
}
_createClass2(UpperCasePipe, [{
key: "transform",
value:
/**
* @param {?} value The string to transform to upper case.
* @return {?}
*/
function transform(value) {
if (!value) return value;
if (typeof value !== 'string') {
throw invalidPipeArgumentError(UpperCasePipe, value);
}
return value.toUpperCase();
}
}]);
return UpperCasePipe;
}();
UpperCasePipe.ɵfac = function UpperCasePipe_Factory(t) {
return new (t || UpperCasePipe)();
};
UpperCasePipe.ɵpipe = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefinePipe"]({
name: "uppercase",
type: UpperCasePipe,
pure: true
});
return UpperCasePipe;
}();
var DatePipe = /*@__PURE__*/function () {
var DatePipe = /*#__PURE__*/function () {
/**
* @param {?} locale
*/
function DatePipe(locale) {
_classCallCheck(this, DatePipe);
this.locale = locale;
}
/**
* @param {?} value The date expression: a `Date` object, a number
* (milliseconds since UTC epoch), or an ISO string (https://www.w3.org/TR/NOTE-datetime).
* @param {?=} format The date/time components to include, using predefined options or a
* custom format string.
* @param {?=} timezone A timezone offset (such as `'+0430'`), or a standard
* UTC/GMT or continental US timezone abbreviation.
* When not supplied, uses the end-user's local system timezone.
* @param {?=} locale A locale code for the locale format rules to use.
* When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
* See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app).
* @return {?} A date string in the desired format.
*/
_createClass2(DatePipe, [{
key: "transform",
value: function transform(value) {
var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'mediumDate';
var timezone = arguments.length > 2 ? arguments[2] : undefined;
var locale = arguments.length > 3 ? arguments[3] : undefined;
if (value == null || value === '' || value !== value) return null;
try {
return formatDate(value, format, locale || this.locale, timezone);
} catch (error) {
throw invalidPipeArgumentError(DatePipe, error.message);
}
}
}]);
return DatePipe;
}();
DatePipe.ɵfac = function DatePipe_Factory(t) {
return new (t || DatePipe)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"]));
};
DatePipe.ɵpipe = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefinePipe"]({
name: "date",
type: DatePipe,
pure: true
});
return DatePipe;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/pipes/i18n_plural_pipe.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @type {?} */
var _INTERPOLATION_REGEXP = /#/g;
var I18nPluralPipe = /*@__PURE__*/function () {
var I18nPluralPipe = /*#__PURE__*/function () {
/**
* @param {?} _localization
*/
function I18nPluralPipe(_localization) {
_classCallCheck(this, I18nPluralPipe);
this._localization = _localization;
}
/**
* @param {?} value the number to be formatted
* @param {?} pluralMap an object that mimics the ICU format, see
* http://userguide.icu-project.org/formatparse/messages.
* @param {?=} locale a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by
* default).
* @return {?}
*/
_createClass2(I18nPluralPipe, [{
key: "transform",
value: function transform(value, pluralMap, locale) {
if (value == null) return '';
if (typeof pluralMap !== 'object' || pluralMap === null) {
throw invalidPipeArgumentError(I18nPluralPipe, pluralMap);
}
/** @type {?} */
var key = getPluralCategory(value, Object.keys(pluralMap), this._localization, locale);
return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString());
}
}]);
return I18nPluralPipe;
}();
I18nPluralPipe.ɵfac = function I18nPluralPipe_Factory(t) {
return new (t || I18nPluralPipe)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](NgLocalization));
};
I18nPluralPipe.ɵpipe = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefinePipe"]({
name: "i18nPlural",
type: I18nPluralPipe,
pure: true
});
return I18nPluralPipe;
}();
if (false) {}
var I18nSelectPipe = /*@__PURE__*/function () {
var I18nSelectPipe = /*#__PURE__*/function () {
function I18nSelectPipe() {
_classCallCheck(this, I18nSelectPipe);
}
_createClass2(I18nSelectPipe, [{
key: "transform",
value:
/**
* @param {?} value a string to be internationalized.
* @param {?} mapping an object that indicates the text that should be displayed
* for different values of the provided `value`.
* @return {?}
*/
function transform(value, mapping) {
if (value == null) return '';
if (typeof mapping !== 'object' || typeof value !== 'string') {
throw invalidPipeArgumentError(I18nSelectPipe, mapping);
}
if (mapping.hasOwnProperty(value)) {
return mapping[value];
}
if (mapping.hasOwnProperty('other')) {
return mapping['other'];
}
return '';
}
}]);
return I18nSelectPipe;
}();
I18nSelectPipe.ɵfac = function I18nSelectPipe_Factory(t) {
return new (t || I18nSelectPipe)();
};
I18nSelectPipe.ɵpipe = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefinePipe"]({
name: "i18nSelect",
type: I18nSelectPipe,
pure: true
});
return I18nSelectPipe;
}();
var JsonPipe = /*@__PURE__*/function () {
var JsonPipe = /*#__PURE__*/function () {
function JsonPipe() {
_classCallCheck(this, JsonPipe);
}
_createClass2(JsonPipe, [{
key: "transform",
value:
/**
* @param {?} value A value of any type to convert into a JSON-format string.
* @return {?}
*/
function transform(value) {
return JSON.stringify(value, null, 2);
}
}]);
return JsonPipe;
}();
JsonPipe.ɵfac = function JsonPipe_Factory(t) {
return new (t || JsonPipe)();
};
JsonPipe.ɵpipe = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefinePipe"]({
name: "json",
type: JsonPipe,
pure: false
});
return JsonPipe;
}();
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/pipes/keyvalue_pipe.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @template K, V
* @param {?} key
* @param {?} value
* @return {?}
*/
function makeKeyValuePair(key, value) {
return {
key: key,
value: value
};
}
/**
* A key value pair.
* Usually used to represent the key value pairs from a Map or Object.
*
* \@publicApi
* @record
* @template K, V
*/
function KeyValue() {}
if (false) {}
var KeyValuePipe = /*@__PURE__*/function () {
var KeyValuePipe = /*#__PURE__*/function () {
/**
* @param {?} differs
*/
function KeyValuePipe(differs) {
_classCallCheck(this, KeyValuePipe);
this.differs = differs;
this.keyValues = [];
}
/**
* @template K, V
* @param {?} input
* @param {?=} compareFn
* @return {?}
*/
_createClass2(KeyValuePipe, [{
key: "transform",
value: function transform(input) {
var _this64 = this;
var compareFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultComparator;
if (!input || !(input instanceof Map) && typeof input !== 'object') {
return null;
}
if (!this.differ) {
// make a differ for whatever type we've been passed in
this.differ = this.differs.find(input).create();
}
/** @type {?} */
var differChanges = this.differ.diff(
/** @type {?} */
input);
if (differChanges) {
this.keyValues = [];
differChanges.forEachItem(
/**
* @param {?} r
* @return {?}
*/
function (r) {
_this64.keyValues.push(makeKeyValuePair(r.key,
/** @type {?} */
r.currentValue));
});
this.keyValues.sort(compareFn);
}
return this.keyValues;
}
}]);
return KeyValuePipe;
}();
KeyValuePipe.ɵfac = function KeyValuePipe_Factory(t) {
return new (t || KeyValuePipe)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["KeyValueDiffers"]));
};
KeyValuePipe.ɵpipe = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefinePipe"]({
name: "keyvalue",
type: KeyValuePipe,
pure: false
});
return KeyValuePipe;
}();
if (false) {}
/**
* @template K, V
* @param {?} keyValueA
* @param {?} keyValueB
* @return {?}
*/
function defaultComparator(keyValueA, keyValueB) {
/** @type {?} */
var a = keyValueA.key;
/** @type {?} */
var b = keyValueB.key; // if same exit with 0;
if (a === b) return 0; // make sure that undefined are at the end of the sort.
if (a === undefined) return 1;
if (b === undefined) return -1; // make sure that nulls are at the end of the sort.
if (a === null) return 1;
if (b === null) return -1;
if (typeof a == 'string' && typeof b == 'string') {
return a < b ? -1 : 1;
}
if (typeof a == 'number' && typeof b == 'number') {
return a - b;
}
if (typeof a == 'boolean' && typeof b == 'boolean') {
return a < b ? -1 : 1;
} // `a` and `b` are of different types. Compare their string values.
/** @type {?} */
var aString = String(a);
/** @type {?} */
var bString = String(b);
return aString == bString ? 0 : aString < bString ? -1 : 1;
}
var DecimalPipe = /*@__PURE__*/function () {
var DecimalPipe = /*#__PURE__*/function () {
/**
* @param {?} _locale
*/
function DecimalPipe(_locale) {
_classCallCheck(this, DecimalPipe);
this._locale = _locale;
}
/**
* @param {?} value The number to be formatted.
* @param {?=} digitsInfo Decimal representation options, specified by a string
* in the following format:
* {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}.
* - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
* Default is `1`.
* - `minFractionDigits`: The minimum number of digits after the decimal point.
* Default is `0`.
* - `maxFractionDigits`: The maximum number of digits after the decimal point.
* Default is `3`.
* @param {?=} locale A locale code for the locale format rules to use.
* When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
* See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app).
* @return {?}
*/
_createClass2(DecimalPipe, [{
key: "transform",
value: function transform(value, digitsInfo, locale) {
if (isEmpty(value)) return null;
locale = locale || this._locale;
try {
/** @type {?} */
var num = strToNumber(value);
return formatNumber(num, locale, digitsInfo);
} catch (error) {
throw invalidPipeArgumentError(DecimalPipe, error.message);
}
}
}]);
return DecimalPipe;
}();
DecimalPipe.ɵfac = function DecimalPipe_Factory(t) {
return new (t || DecimalPipe)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"]));
};
DecimalPipe.ɵpipe = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefinePipe"]({
name: "number",
type: DecimalPipe,
pure: true
});
return DecimalPipe;
}();
if (false) {}
var PercentPipe = /*@__PURE__*/function () {
var PercentPipe = /*#__PURE__*/function () {
/**
* @param {?} _locale
*/
function PercentPipe(_locale) {
_classCallCheck(this, PercentPipe);
this._locale = _locale;
}
/**
*
* @param {?} value The number to be formatted as a percentage.
* @param {?=} digitsInfo Decimal representation options, specified by a string
* in the following format:
* {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}.
* - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
* Default is `1`.
* - `minFractionDigits`: The minimum number of digits after the decimal point.
* Default is `0`.
* - `maxFractionDigits`: The maximum number of digits after the decimal point.
* Default is `0`.
* @param {?=} locale A locale code for the locale format rules to use.
* When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
* See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app).
* @return {?}
*/
_createClass2(PercentPipe, [{
key: "transform",
value: function transform(value, digitsInfo, locale) {
if (isEmpty(value)) return null;
locale = locale || this._locale;
try {
/** @type {?} */
var num = strToNumber(value);
return formatPercent(num, locale, digitsInfo);
} catch (error) {
throw invalidPipeArgumentError(PercentPipe, error.message);
}
}
}]);
return PercentPipe;
}();
PercentPipe.ɵfac = function PercentPipe_Factory(t) {
return new (t || PercentPipe)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"]));
};
PercentPipe.ɵpipe = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefinePipe"]({
name: "percent",
type: PercentPipe,
pure: true
});
return PercentPipe;
}();
if (false) {}
var CurrencyPipe = /*@__PURE__*/function () {
var CurrencyPipe = /*#__PURE__*/function () {
/**
* @param {?} _locale
* @param {?=} _defaultCurrencyCode
*/
function CurrencyPipe(_locale) {
var _defaultCurrencyCode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'USD';
_classCallCheck(this, CurrencyPipe);
this._locale = _locale;
this._defaultCurrencyCode = _defaultCurrencyCode;
}
/**
*
* @param {?} value The number to be formatted as currency.
* @param {?=} currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code,
* such as `USD` for the US dollar and `EUR` for the euro. The default currency code can be
* configured using the `DEFAULT_CURRENCY_CODE` injection token.
* @param {?=} display The format for the currency indicator. One of the following:
* - `code`: Show the code (such as `USD`).
* - `symbol`(default): Show the symbol (such as `$`).
* - `symbol-narrow`: Use the narrow symbol for locales that have two symbols for their
* currency.
* For example, the Canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`. If the
* locale has no narrow symbol, uses the standard symbol for the locale.
* - String: Use the given string value instead of a code or a symbol.
* For example, an empty string will suppress the currency & symbol.
* - Boolean (marked deprecated in v5): `true` for symbol and false for `code`.
*
* @param {?=} digitsInfo Decimal representation options, specified by a string
* in the following format:
* {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}.
* - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
* Default is `1`.
* - `minFractionDigits`: The minimum number of digits after the decimal point.
* Default is `2`.
* - `maxFractionDigits`: The maximum number of digits after the decimal point.
* Default is `2`.
* If not provided, the number will be formatted with the proper amount of digits,
* depending on what the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) specifies.
* For example, the Canadian dollar has 2 digits, whereas the Chilean peso has none.
* @param {?=} locale A locale code for the locale format rules to use.
* When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
* See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app).
* @return {?}
*/
_createClass2(CurrencyPipe, [{
key: "transform",
value: function transform(value, currencyCode) {
var display = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'symbol';
var digitsInfo = arguments.length > 3 ? arguments[3] : undefined;
var locale = arguments.length > 4 ? arguments[4] : undefined;
if (isEmpty(value)) return null;
locale = locale || this._locale;
if (typeof display === 'boolean') {
if (
/** @type {?} */
console &&
/** @type {?} */
console.warn) {
console.warn("Warning: the currency pipe has been changed in Angular v5. The symbolDisplay option (third parameter) is now a string instead of a boolean. The accepted values are \"code\", \"symbol\" or \"symbol-narrow\".");
}
display = display ? 'symbol' : 'code';
}
/** @type {?} */
var currency = currencyCode || this._defaultCurrencyCode;
if (display !== 'code') {
if (display === 'symbol' || display === 'symbol-narrow') {
currency = getCurrencySymbol(currency, display === 'symbol' ? 'wide' : 'narrow', locale);
} else {
currency = display;
}
}
try {
/** @type {?} */
var num = strToNumber(value);
return formatCurrency(num, locale, currency, currencyCode, digitsInfo);
} catch (error) {
throw invalidPipeArgumentError(CurrencyPipe, error.message);
}
}
}]);
return CurrencyPipe;
}();
CurrencyPipe.ɵfac = function CurrencyPipe_Factory(t) {
return new (t || CurrencyPipe)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"]), _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdirectiveInject"](_angular_core__WEBPACK_IMPORTED_MODULE_0__["DEFAULT_CURRENCY_CODE"]));
};
CurrencyPipe.ɵpipe = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefinePipe"]({
name: "currency",
type: CurrencyPipe,
pure: true
});
return CurrencyPipe;
}();
if (false) {}
/**
* @param {?} value
* @return {?}
*/
function isEmpty(value) {
return value == null || value === '' || value !== value;
}
/**
* Transforms a string into a number (if needed).
* @param {?} value
* @return {?}
*/
function strToNumber(value) {
// Convert strings to numbers
if (typeof value === 'string' && !isNaN(Number(value) - parseFloat(value))) {
return Number(value);
}
if (typeof value !== 'number') {
throw new Error("".concat(value, " is not a number"));
}
return value;
}
var SlicePipe = /*@__PURE__*/function () {
var SlicePipe = /*#__PURE__*/function () {
function SlicePipe() {
_classCallCheck(this, SlicePipe);
}
_createClass2(SlicePipe, [{
key: "transform",
value:
/**
* @param {?} value
* @param {?} start
* @param {?=} end
* @return {?}
*/
function transform(value, start, end) {
if (value == null) return value;
if (!this.supports(value)) {
throw invalidPipeArgumentError(SlicePipe, value);
}
return value.slice(start, end);
}
/**
* @private
* @param {?} obj
* @return {?}
*/
}, {
key: "supports",
value: function supports(obj) {
return typeof obj === 'string' || Array.isArray(obj);
}
}]);
return SlicePipe;
}();
SlicePipe.ɵfac = function SlicePipe_Factory(t) {
return new (t || SlicePipe)();
};
SlicePipe.ɵpipe = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefinePipe"]({
name: "slice",
type: SlicePipe,
pure: false
});
return SlicePipe;
}();
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/pipes/index.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* A collection of Angular pipes that are likely to be used in each and every application.
* @type {?}
*/
var COMMON_PIPES = [AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, KeyValuePipe];
var CommonModule = /*@__PURE__*/function () {
var CommonModule = function CommonModule() {
_classCallCheck(this, CommonModule);
};
CommonModule.ɵmod = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineNgModule"]({
type: CommonModule
});
CommonModule.ɵinj = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineInjector"]({
factory: function CommonModule_Factory(t) {
return new (t || CommonModule)();
},
providers: [{
provide: NgLocalization,
useClass: NgLocaleLocalization
}]
});
return CommonModule;
}();
/*@__PURE__*/
(function () {
(typeof ngJitMode === "undefined" || ngJitMode) && _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵsetNgModuleScope"](CommonModule, {
declarations: [NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase, AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, KeyValuePipe],
exports: [NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase, AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, KeyValuePipe]
});
})();
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/platform_id.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @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
*/
/** @type {?} */
var PLATFORM_BROWSER_ID = 'browser';
/** @type {?} */
var PLATFORM_SERVER_ID = 'server';
/** @type {?} */
var PLATFORM_WORKER_APP_ID = 'browserWorkerApp';
/** @type {?} */
var PLATFORM_WORKER_UI_ID = 'browserWorkerUi';
/**
* Returns whether a platform id represents a browser platform.
* \@publicApi
* @param {?} platformId
* @return {?}
*/
function isPlatformBrowser(platformId) {
return platformId === PLATFORM_BROWSER_ID;
}
/**
* Returns whether a platform id represents a server platform.
* \@publicApi
* @param {?} platformId
* @return {?}
*/
function isPlatformServer(platformId) {
return platformId === PLATFORM_SERVER_ID;
}
/**
* Returns whether a platform id represents a web worker app platform.
* \@publicApi
* @param {?} platformId
* @return {?}
*/
function isPlatformWorkerApp(platformId) {
return platformId === PLATFORM_WORKER_APP_ID;
}
/**
* Returns whether a platform id represents a web worker UI platform.
* \@publicApi
* @param {?} platformId
* @return {?}
*/
function isPlatformWorkerUi(platformId) {
return platformId === PLATFORM_WORKER_UI_ID;
}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/version.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* \@publicApi
* @type {?}
*/
var VERSION = /*@__PURE__*/new _angular_core__WEBPACK_IMPORTED_MODULE_0__["Version"]('9.1.13');
var ViewportScroller = /*@__PURE__*/function () {
var ViewportScroller = function ViewportScroller() {
_classCallCheck(this, ViewportScroller);
}; // De-sugared tree-shakable injection
// See #23917
/** @nocollapse */
ViewportScroller.ɵprov = /*@__PURE__*/Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineInjectable"])({
token: ViewportScroller,
providedIn: 'root',
factory:
/**
* @return {?}
*/
function factory() {
return new BrowserViewportScroller(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"])(DOCUMENT), window, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ErrorHandler"]));
}
});
return ViewportScroller;
}();
if (false) {}
/**
* Manages the scroll position for a browser window.
*/
var BrowserViewportScroller = /*#__PURE__*/function () {
/**
* @param {?} document
* @param {?} window
* @param {?} errorHandler
*/
function BrowserViewportScroller(document, window, errorHandler) {
_classCallCheck(this, BrowserViewportScroller);
this.document = document;
this.window = window;
this.errorHandler = errorHandler;
this.offset =
/**
* @return {?}
*/
function () {
return [0, 0];
};
}
/**
* Configures the top offset used when scrolling to an anchor.
* @param {?} offset A position in screen coordinates (a tuple with x and y values)
* or a function that returns the top offset position.
*
* @return {?}
*/
_createClass2(BrowserViewportScroller, [{
key: "setOffset",
value: function setOffset(offset) {
if (Array.isArray(offset)) {
this.offset =
/**
* @return {?}
*/
function () {
return offset;
};
} else {
this.offset = offset;
}
}
/**
* Retrieves the current scroll position.
* @return {?} The position in screen coordinates.
*/
}, {
key: "getScrollPosition",
value: function getScrollPosition() {
if (this.supportScrollRestoration()) {
return [this.window.scrollX, this.window.scrollY];
} else {
return [0, 0];
}
}
/**
* Sets the scroll position.
* @param {?} position The new position in screen coordinates.
* @return {?}
*/
}, {
key: "scrollToPosition",
value: function scrollToPosition(position) {
if (this.supportScrollRestoration()) {
this.window.scrollTo(position[0], position[1]);
}
}
/**
* Scrolls to an anchor element.
* @param {?} anchor The ID of the anchor element.
* @return {?}
*/
}, {
key: "scrollToAnchor",
value: function scrollToAnchor(anchor) {
if (this.supportScrollRestoration()) {
// Escape anything passed to `querySelector` as it can throw errors and stop the application
// from working if invalid values are passed.
if (this.window.CSS && this.window.CSS.escape) {
anchor = this.window.CSS.escape(anchor);
} else {
anchor = anchor.replace(/(\"|\'\ |:|\.|\[|\]|,|=)/g, '\\$1');
}
try {
/** @type {?} */
var elSelectedById = this.document.querySelector("#".concat(anchor));
if (elSelectedById) {
this.scrollToElement(elSelectedById);
return;
}
/** @type {?} */
var elSelectedByName = this.document.querySelector("[name='".concat(anchor, "']"));
if (elSelectedByName) {
this.scrollToElement(elSelectedByName);
return;
}
} catch (e) {
this.errorHandler.handleError(e);
}
}
}
/**
* Disables automatic scroll restoration provided by the browser.
* @param {?} scrollRestoration
* @return {?}
*/
}, {
key: "setHistoryScrollRestoration",
value: function setHistoryScrollRestoration(scrollRestoration) {
if (this.supportScrollRestoration()) {
/** @type {?} */
var history = this.window.history;
if (history && history.scrollRestoration) {
history.scrollRestoration = scrollRestoration;
}
}
}
/**
* @private
* @param {?} el
* @return {?}
*/
}, {
key: "scrollToElement",
value: function scrollToElement(el) {
/** @type {?} */
var rect = el.getBoundingClientRect();
/** @type {?} */
var left = rect.left + this.window.pageXOffset;
/** @type {?} */
var top = rect.top + this.window.pageYOffset;
/** @type {?} */
var offset = this.offset();
this.window.scrollTo(left - offset[0], top - offset[1]);
}
/**
* We only support scroll restoration when we can get a hold of window.
* This means that we do not support this behavior when running in a web worker.
*
* Lifting this restriction right now would require more changes in the dom adapter.
* Since webworkers aren't widely used, we will lift it once RouterScroller is
* battle-tested.
* @private
* @return {?}
*/
}, {
key: "supportScrollRestoration",
value: function supportScrollRestoration() {
try {
return !!this.window && !!this.window.scrollTo;
} catch (_a) {
return false;
}
}
}]);
return BrowserViewportScroller;
}();
if (false) {}
/**
* Provides an empty implementation of the viewport scroller. This will
* live in \@angular/common as it will be used by both platform-server and platform-webworker.
*/
var NullViewportScroller = /*#__PURE__*/function () {
function NullViewportScroller() {
_classCallCheck(this, NullViewportScroller);
}
_createClass2(NullViewportScroller, [{
key: "setOffset",
value:
/**
* Empty implementation
* @param {?} offset
* @return {?}
*/
function setOffset(offset) {}
/**
* Empty implementation
* @return {?}
*/
}, {
key: "getScrollPosition",
value: function getScrollPosition() {
return [0, 0];
}
/**
* Empty implementation
* @param {?} position
* @return {?}
*/
}, {
key: "scrollToPosition",
value: function scrollToPosition(position) {}
/**
* Empty implementation
* @param {?} anchor
* @return {?}
*/
}, {
key: "scrollToAnchor",
value: function scrollToAnchor(anchor) {}
/**
* Empty implementation
* @param {?} scrollRestoration
* @return {?}
*/
}, {
key: "setHistoryScrollRestoration",
value: function setHistoryScrollRestoration(scrollRestoration) {}
}]);
return NullViewportScroller;
}();
/**
* @fileoverview added by tsickle
* Generated from: packages/common/src/common.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* Generated from: packages/common/public_api.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @fileoverview added by tsickle
* Generated from: packages/common/index.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Generated bundle index. Do not edit.
*/
//# sourceMappingURL=common.js.map
/***/
},
/***/
"./node_modules/@angular/common/fesm2015/http.js":
/*!*******************************************************!*\
!*** ./node_modules/@angular/common/fesm2015/http.js ***!
\*******************************************************/
/*! exports provided: HTTP_INTERCEPTORS, HttpBackend, HttpClient, HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule, HttpErrorResponse, HttpEventType, HttpHandler, HttpHeaderResponse, HttpHeaders, HttpParams, HttpRequest, HttpResponse, HttpResponseBase, HttpUrlEncodingCodec, HttpXhrBackend, HttpXsrfTokenExtractor, JsonpClientBackend, JsonpInterceptor, XhrFactory, ɵHttpInterceptingHandler, ɵangular_packages_common_http_http_a, ɵangular_packages_common_http_http_b, ɵangular_packages_common_http_http_c, ɵangular_packages_common_http_http_d, ɵangular_packages_common_http_http_e, ɵangular_packages_common_http_http_f, ɵangular_packages_common_http_http_g, ɵangular_packages_common_http_http_h */
/***/
function node_modulesAngularCommonFesm2015HttpJs(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HTTP_INTERCEPTORS", function () {
return HTTP_INTERCEPTORS;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpBackend", function () {
return HttpBackend;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpClient", function () {
return HttpClient;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpClientJsonpModule", function () {
return HttpClientJsonpModule;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpClientModule", function () {
return HttpClientModule;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpClientXsrfModule", function () {
return HttpClientXsrfModule;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpErrorResponse", function () {
return HttpErrorResponse;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpEventType", function () {
return HttpEventType;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpHandler", function () {
return HttpHandler;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpHeaderResponse", function () {
return HttpHeaderResponse;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpHeaders", function () {
return HttpHeaders;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpParams", function () {
return HttpParams;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpRequest", function () {
return HttpRequest;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpResponse", function () {
return HttpResponse;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpResponseBase", function () {
return HttpResponseBase;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpUrlEncodingCodec", function () {
return HttpUrlEncodingCodec;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpXhrBackend", function () {
return HttpXhrBackend;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "HttpXsrfTokenExtractor", function () {
return HttpXsrfTokenExtractor;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "JsonpClientBackend", function () {
return JsonpClientBackend;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "JsonpInterceptor", function () {
return JsonpInterceptor;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "XhrFactory", function () {
return XhrFactory;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵHttpInterceptingHandler", function () {
return HttpInterceptingHandler;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_a", function () {
return NoopInterceptor;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_b", function () {
return JsonpCallbackContext;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_c", function () {
return jsonpCallbackContext;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_d", function () {
return BrowserXhr;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_e", function () {
return XSRF_COOKIE_NAME;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_f", function () {
return XSRF_HEADER_NAME;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_g", function () {
return HttpXsrfCookieExtractor;
});
/* harmony export (binding) */
__webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_h", function () {
return HttpXsrfInterceptor;
});
/* harmony import */
var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
/*! @angular/core */
"./node_modules/@angular/core/fesm2015/core.js");
/* harmony import */
var rxjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(
/*! rxjs */
"./node_modules/rxjs/_esm2015/index.js");
/* harmony import */
var rxjs_operators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
/*! rxjs/operators */
"./node_modules/rxjs/_esm2015/operators/index.js");
/* harmony import */
var _angular_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(
/*! @angular/common */
"./node_modules/@angular/common/fesm2015/common.js");
/**
* @license Angular v9.1.13
* (c) 2010-2020 Google LLC. https://angular.io/
* License: MIT
*/
/**
* @fileoverview added by tsickle
* Generated from: packages/common/http/src/backend.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @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
*/
/**
* Transforms an `HttpRequest` into a stream of `HttpEvent`s, one of which will likely be a
* `HttpResponse`.
*
* `HttpHandler` is injectable. When injected, the handler instance dispatches requests to the
* first interceptor in the chain, which dispatches to the second, etc, eventually reaching the
* `HttpBackend`.
*
* In an `HttpInterceptor`, the `HttpHandler` parameter is the next interceptor in the chain.
*
* \@publicApi
* @abstract
*/
var HttpHandler = function HttpHandler() {
_classCallCheck(this, HttpHandler);
};
if (false) {}
/**
* A final `HttpHandler` which will dispatch the request via browser HTTP APIs to a backend.
*
* Interceptors sit between the `HttpClient` interface and the `HttpBackend`.
*
* When injected, `HttpBackend` dispatches requests directly to the backend, without going
* through the interceptor chain.
*
* \@publicApi
* @abstract
*/
var HttpBackend = function HttpBackend() {
_classCallCheck(this, HttpBackend);
};
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/http/src/headers.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @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
*/
/**
* @record
*/
function Update() {}
if (false) {}
/**
* Represents the header configuration options for an HTTP request.
* Instances are immutable. Modifying methods return a cloned
* instance with the change. The original object is never changed.
*
* \@publicApi
*/
var HttpHeaders = /*#__PURE__*/function () {
/**
* Constructs a new HTTP header object with the given values.
* @param {?=} headers
*/
function HttpHeaders(headers) {
var _this65 = this;
_classCallCheck(this, HttpHeaders);
/**
* Internal map of lowercased header names to the normalized
* form of the name (the form seen first).
*/
this.normalizedNames = new Map();
/**
* Queued updates to be materialized the next initialization.
*/
this.lazyUpdate = null;
if (!headers) {
this.headers = new Map();
} else if (typeof headers === 'string') {
this.lazyInit =
/**
* @return {?}
*/
function () {
_this65.headers = new Map();
headers.split('\n').forEach(
/**
* @param {?} line
* @return {?}
*/
/**
* @param {?} line
* @return {?}
*/
function (line) {
/** @type {?} */
var index = line.indexOf(':');
if (index > 0) {
/** @type {?} */
var name = line.slice(0, index);
/** @type {?} */
var key = name.toLowerCase();
/** @type {?} */
var value = line.slice(index + 1).trim();
_this65.maybeSetNormalizedName(name, key);
if (_this65.headers.has(key)) {
/** @type {?} */
_this65.headers.get(key).push(value);
} else {
_this65.headers.set(key, [value]);
}
}
});
};
} else {
this.lazyInit =
/**
* @return {?}
*/
function () {
_this65.headers = new Map();
Object.keys(headers).forEach(
/**
* @param {?} name
* @return {?}
*/
/**
* @param {?} name
* @return {?}
*/
function (name) {
/** @type {?} */
var values = headers[name];
/** @type {?} */
var key = name.toLowerCase();
if (typeof values === 'string') {
values = [values];
}
if (values.length > 0) {
_this65.headers.set(key, values);
_this65.maybeSetNormalizedName(name, key);
}
});
};
}
}
/**
* Checks for existence of a given header.
*
* @param {?} name The header name to check for existence.
*
* @return {?} True if the header exists, false otherwise.
*/
_createClass2(HttpHeaders, [{
key: "has",
value: function has(name) {
this.init();
return this.headers.has(name.toLowerCase());
}
/**
* Retrieves the first value of a given header.
*
* @param {?} name The header name.
*
* @return {?} The value string if the header exists, null otherwise
*/
}, {
key: "get",
value: function get(name) {
this.init();
/** @type {?} */
var values = this.headers.get(name.toLowerCase());
return values && values.length > 0 ? values[0] : null;
}
/**
* Retrieves the names of the headers.
*
* @return {?} A list of header names.
*/
}, {
key: "keys",
value: function keys() {
this.init();
return Array.from(this.normalizedNames.values());
}
/**
* Retrieves a list of values for a given header.
*
* @param {?} name The header name from which to retrieve values.
*
* @return {?} A string of values if the header exists, null otherwise.
*/
}, {
key: "getAll",
value: function getAll(name) {
this.init();
return this.headers.get(name.toLowerCase()) || null;
}
/**
* Appends a new value to the existing set of values for a header
* and returns them in a clone of the original instance.
*
* @param {?} name The header name for which to append the values.
* @param {?} value The value to append.
*
* @return {?} A clone of the HTTP headers object with the value appended to the given header.
*/
}, {
key: "append",
value: function append(name, value) {
return this.clone({
name: name,
value: value,
op: 'a'
});
}
/**
* Sets or modifies a value for a given header in a clone of the original instance.
* If the header already exists, its value is replaced with the given value
* in the returned object.
*
* @param {?} name The header name.
* @param {?} value The value or values to set or overide for the given header.
*
* @return {?} A clone of the HTTP headers object with the newly set header value.
*/
}, {
key: "set",
value: function set(name, value) {
return this.clone({
name: name,
value: value,
op: 's'
});
}
/**
* Deletes values for a given header in a clone of the original instance.
*
* @param {?} name The header name.
* @param {?=} value The value or values to delete for the given header.
*
* @return {?} A clone of the HTTP headers object with the given value deleted.
*/
}, {
key: "delete",
value: function _delete(name, value) {
return this.clone({
name: name,
value: value,
op: 'd'
});
}
/**
* @private
* @param {?} name
* @param {?} lcName
* @return {?}
*/
}, {
key: "maybeSetNormalizedName",
value: function maybeSetNormalizedName(name, lcName) {
if (!this.normalizedNames.has(lcName)) {
this.normalizedNames.set(lcName, name);
}
}
/**
* @private
* @return {?}
*/
}, {
key: "init",
value: function init() {
var _this66 = this;
if (!!this.lazyInit) {
if (this.lazyInit instanceof HttpHeaders) {
this.copyFrom(this.lazyInit);
} else {
this.lazyInit();
}
this.lazyInit = null;
if (!!this.lazyUpdate) {
this.lazyUpdate.forEach(
/**
* @param {?} update
* @return {?}
*/
/**
* @param {?} update
* @return {?}
*/
function (update) {
return _this66.applyUpdate(update);
});
this.lazyUpdate = null;
}
}
}
/**
* @private
* @param {?} other
* @return {?}
*/
}, {
key: "copyFrom",
value: function copyFrom(other) {
var _this67 = this;
other.init();
Array.from(other.headers.keys()).forEach(
/**
* @param {?} key
* @return {?}
*/
/**
* @param {?} key
* @return {?}
*/
function (key) {
_this67.headers.set(key,
/** @type {?} */
other.headers.get(key));
_this67.normalizedNames.set(key,
/** @type {?} */
other.normalizedNames.get(key));
});
}
/**
* @private
* @param {?} update
* @return {?}
*/
}, {
key: "clone",
value: function clone(update) {
/** @type {?} */
var clone = new HttpHeaders();
clone.lazyInit = !!this.lazyInit && this.lazyInit instanceof HttpHeaders ? this.lazyInit : this;
clone.lazyUpdate = (this.lazyUpdate || []).concat([update]);
return clone;
}
/**
* @private
* @param {?} update
* @return {?}
*/
}, {
key: "applyUpdate",
value: function applyUpdate(update) {
/** @type {?} */
var key = update.name.toLowerCase();
switch (update.op) {
case 'a':
case 's':
/** @type {?} */
var value =
/** @type {?} */
update.value;
if (typeof value === 'string') {
value = [value];
}
if (value.length === 0) {
return;
}
this.maybeSetNormalizedName(update.name, key);
/** @type {?} */
var base = (update.op === 'a' ? this.headers.get(key) : undefined) || [];
base.push.apply(base, _toConsumableArray(value));
this.headers.set(key, base);
break;
case 'd':
/** @type {?} */
var toDelete =
/** @type {?} */
update.value;
if (!toDelete) {
this.headers["delete"](key);
this.normalizedNames["delete"](key);
} else {
/** @type {?} */
var existing = this.headers.get(key);
if (!existing) {
return;
}
existing = existing.filter(
/**
* @param {?} value
* @return {?}
*/
/**
* @param {?} value
* @return {?}
*/
function (value) {
return toDelete.indexOf(value) === -1;
});
if (existing.length === 0) {
this.headers["delete"](key);
this.normalizedNames["delete"](key);
} else {
this.headers.set(key, existing);
}
}
break;
}
}
/**
* \@internal
* @param {?} fn
* @return {?}
*/
}, {
key: "forEach",
value: function forEach(fn) {
var _this68 = this;
this.init();
Array.from(this.normalizedNames.keys()).forEach(
/**
* @param {?} key
* @return {?}
*/
/**
* @param {?} key
* @return {?}
*/
function (key) {
return fn(
/** @type {?} */
_this68.normalizedNames.get(key),
/** @type {?} */
_this68.headers.get(key));
});
}
}]);
return HttpHeaders;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/http/src/params.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* @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
*/
/**
* A codec for encoding and decoding parameters in URLs.
*
* Used by `HttpParams`.
*
* \@publicApi
*
* @record
*/
function HttpParameterCodec() {}
if (false) {}
/**
* Provides encoding and decoding of URL parameter and query-string values.
*
* Serializes and parses URL parameter keys and values to encode and decode them.
* If you pass URL query parameters without encoding,
* the query parameters can be misinterpreted at the receiving end.
*
*
* \@publicApi
*/
var HttpUrlEncodingCodec = /*#__PURE__*/function () {
function HttpUrlEncodingCodec() {
_classCallCheck(this, HttpUrlEncodingCodec);
}
_createClass2(HttpUrlEncodingCodec, [{
key: "encodeKey",
value:
/**
* Encodes a key name for a URL parameter or query-string.
* @param {?} key The key name.
* @return {?} The encoded key name.
*/
function encodeKey(key) {
return standardEncoding(key);
}
/**
* Encodes the value of a URL parameter or query-string.
* @param {?} value The value.
* @return {?} The encoded value.
*/
}, {
key: "encodeValue",
value: function encodeValue(value) {
return standardEncoding(value);
}
/**
* Decodes an encoded URL parameter or query-string key.
* @param {?} key The encoded key name.
* @return {?} The decoded key name.
*/
}, {
key: "decodeKey",
value: function decodeKey(key) {
return decodeURIComponent(key);
}
/**
* Decodes an encoded URL parameter or query-string value.
* @param {?} value The encoded value.
* @return {?} The decoded value.
*/
}, {
key: "decodeValue",
value: function decodeValue(value) {
return decodeURIComponent(value);
}
}]);
return HttpUrlEncodingCodec;
}();
/**
* @param {?} rawParams
* @param {?} codec
* @return {?}
*/
function paramParser(rawParams, codec) {
/** @type {?} */
var map = new Map();
if (rawParams.length > 0) {
/** @type {?} */
var params = rawParams.split('&');
params.forEach(
/**
* @param {?} param
* @return {?}
*/
function (param) {
/** @type {?} */
var eqIdx = param.indexOf('=');
var _ref4 = eqIdx == -1 ? [codec.decodeKey(param), ''] : [codec.decodeKey(param.slice(0, eqIdx)), codec.decodeValue(param.slice(eqIdx + 1))],
_ref5 = _slicedToArray(_ref4, 2),
key = _ref5[0],
val = _ref5[1];
/** @type {?} */
var list = map.get(key) || [];
list.push(val);
map.set(key, list);
});
}
return map;
}
/**
* @param {?} v
* @return {?}
*/
function standardEncoding(v) {
return encodeURIComponent(v).replace(/%40/gi, '@').replace(/%3A/gi, ':').replace(/%24/gi, '$').replace(/%2C/gi, ',').replace(/%3B/gi, ';').replace(/%2B/gi, '+').replace(/%3D/gi, '=').replace(/%3F/gi, '?').replace(/%2F/gi, '/');
}
/**
* @record
*/
function Update$1() {}
if (false) {}
/**
* Options used to construct an `HttpParams` instance.
*
* \@publicApi
* @record
*/
function HttpParamsOptions() {}
if (false) {}
/**
* An HTTP request/response body that represents serialized parameters,
* per the MIME type `application/x-www-form-urlencoded`.
*
* This class is immutable; all mutation operations return a new instance.
*
* \@publicApi
*/
var HttpParams = /*#__PURE__*/function () {
/**
* @param {?=} options
*/
function HttpParams() {
var _this69 = this;
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
/** @type {?} */
{};
_classCallCheck(this, HttpParams);
this.updates = null;
this.cloneFrom = null;
this.encoder = options.encoder || new HttpUrlEncodingCodec();
if (!!options.fromString) {
if (!!options.fromObject) {
throw new Error("Cannot specify both fromString and fromObject.");
}
this.map = paramParser(options.fromString, this.encoder);
} else if (!!options.fromObject) {
this.map = new Map();
Object.keys(options.fromObject).forEach(
/**
* @param {?} key
* @return {?}
*/
/**
* @param {?} key
* @return {?}
*/
function (key) {
/** @type {?} */
var value =
/** @type {?} */
options.fromObject[key];
/** @type {?} */
_this69.map.set(key, Array.isArray(value) ? value : [value]);
});
} else {
this.map = null;
}
}
/**
* Reports whether the body includes one or more values for a given parameter.
* @param {?} param The parameter name.
* @return {?} True if the parameter has one or more values,
* false if it has no value or is not present.
*/
_createClass2(HttpParams, [{
key: "has",
value: function has(param) {
this.init();
return (
/** @type {?} */
this.map.has(param)
);
}
/**
* Retrieves the first value for a parameter.
* @param {?} param The parameter name.
* @return {?} The first value of the given parameter,
* or `null` if the parameter is not present.
*/
}, {
key: "get",
value: function get(param) {
this.init();
/** @type {?} */
var res =
/** @type {?} */
this.map.get(param);
return !!res ? res[0] : null;
}
/**
* Retrieves all values for a parameter.
* @param {?} param The parameter name.
* @return {?} All values in a string array,
* or `null` if the parameter not present.
*/
}, {
key: "getAll",
value: function getAll(param) {
this.init();
return (
/** @type {?} */
this.map.get(param) || null
);
}
/**
* Retrieves all the parameters for this body.
* @return {?} The parameter names in a string array.
*/
}, {
key: "keys",
value: function keys() {
this.init();
return Array.from(
/** @type {?} */
this.map.keys());
}
/**
* Appends a new value to existing values for a parameter.
* @param {?} param The parameter name.
* @param {?} value The new value to add.
* @return {?} A new body with the appended value.
*/
}, {
key: "append",
value: function append(param, value) {
return this.clone({
param: param,
value: value,
op: 'a'
});
}
/**
* Replaces the value for a parameter.
* @param {?} param The parameter name.
* @param {?} value The new value.
* @return {?} A new body with the new value.
*/
}, {
key: "set",
value: function set(param, value) {
return this.clone({
param: param,
value: value,
op: 's'
});
}
/**
* Removes a given value or all values from a parameter.
* @param {?} param The parameter name.
* @param {?=} value The value to remove, if provided.
* @return {?} A new body with the given value removed, or with all values
* removed if no value is specified.
*/
}, {
key: "delete",
value: function _delete(param, value) {
return this.clone({
param: param,
value: value,
op: 'd'
});
}
/**
* Serializes the body to an encoded string, where key-value pairs (separated by `=`) are
* separated by `&`s.
* @return {?}
*/
}, {
key: "toString",
value: function toString() {
var _this70 = this;
this.init();
return this.keys().map(
/**
* @param {?} key
* @return {?}
*/
/**
* @param {?} key
* @return {?}
*/
function (key) {
/** @type {?} */
var eKey = _this70.encoder.encodeKey(key); // `a: ['1']` produces `'a=1'`
// `b: []` produces `''`
// `c: ['1', '2']` produces `'c=1&c=2'`
return (
/** @type {?} */
/** @type {?} */
_this70.map.get(key).map(
/**
* @param {?} value
* @return {?}
*/
/**
* @param {?} value
* @return {?}
*/
function (value) {
return eKey + '=' + _this70.encoder.encodeValue(value);
}).join('&')
);
}) // filter out empty values because `b: []` produces `''`
// which results in `a=1&&c=1&c=2` instead of `a=1&c=1&c=2` if we don't
.filter(
/**
* @param {?} param
* @return {?}
*/
/**
* @param {?} param
* @return {?}
*/
function (param) {
return param !== '';
}).join('&');
}
/**
* @private
* @param {?} update
* @return {?}
*/
}, {
key: "clone",
value: function clone(update) {
/** @type {?} */
var clone = new HttpParams(
/** @type {?} */
{
encoder: this.encoder
});
clone.cloneFrom = this.cloneFrom || this;
clone.updates = (this.updates || []).concat([update]);
return clone;
}
/**
* @private
* @return {?}
*/
}, {
key: "init",
value: function init() {
var _this71 = this;
if (this.map === null) {
this.map = new Map();
}
if (this.cloneFrom !== null) {
this.cloneFrom.init();
this.cloneFrom.keys().forEach(
/**
* @param {?} key
* @return {?}
*/
/**
* @param {?} key
* @return {?}
*/
function (key) {
return (
/** @type {?} */
_this71.map.set(key,
/** @type {?} */
/** @type {?} */
/** @type {?} */
_this71.cloneFrom.map.get(key))
);
});
/** @type {?} */
this.updates.forEach(
/**
* @param {?} update
* @return {?}
*/
/**
* @param {?} update
* @return {?}
*/
function (update) {
switch (update.op) {
case 'a':
case 's':
/** @type {?} */
var base = (update.op === 'a' ?
/** @type {?} */
_this71.map.get(update.param) : undefined) || [];
base.push(
/** @type {?} */
update.value);
/** @type {?} */
_this71.map.set(update.param, base);
break;
case 'd':
if (update.value !== undefined) {
/** @type {?} */
var _base =
/** @type {?} */
_this71.map.get(update.param) || [];
/** @type {?} */
var idx = _base.indexOf(update.value);
if (idx !== -1) {
_base.splice(idx, 1);
}
if (_base.length > 0) {
/** @type {?} */
_this71.map.set(update.param, _base);
} else {
/** @type {?} */
_this71.map["delete"](update.param);
}
} else {
/** @type {?} */
_this71.map["delete"](update.param);
break;
}
}
});
this.cloneFrom = this.updates = null;
}
}
}]);
return HttpParams;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/http/src/request.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Construction interface for `HttpRequest`s.
*
* All values are optional and will override default values if provided.
* @record
*/
function HttpRequestInit() {}
if (false) {}
/**
* Determine whether the given HTTP method may include a body.
* @param {?} method
* @return {?}
*/
function mightHaveBody(method) {
switch (method) {
case 'DELETE':
case 'GET':
case 'HEAD':
case 'OPTIONS':
case 'JSONP':
return false;
default:
return true;
}
}
/**
* Safely assert whether the given value is an ArrayBuffer.
*
* In some execution environments ArrayBuffer is not defined.
* @param {?} value
* @return {?}
*/
function isArrayBuffer(value) {
return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;
}
/**
* Safely assert whether the given value is a Blob.
*
* In some execution environments Blob is not defined.
* @param {?} value
* @return {?}
*/
function isBlob(value) {
return typeof Blob !== 'undefined' && value instanceof Blob;
}
/**
* Safely assert whether the given value is a FormData instance.
*
* In some execution environments FormData is not defined.
* @param {?} value
* @return {?}
*/
function isFormData(value) {
return typeof FormData !== 'undefined' && value instanceof FormData;
}
/**
* An outgoing HTTP request with an optional typed body.
*
* `HttpRequest` represents an outgoing request, including URL, method,
* headers, body, and other request configuration options. Instances should be
* assumed to be immutable. To modify a `HttpRequest`, the `clone`
* method should be used.
*
* \@publicApi
* @template T
*/
var HttpRequest = /*#__PURE__*/function () {
/**
* @param {?} method
* @param {?} url
* @param {?=} third
* @param {?=} fourth
*/
function HttpRequest(method, url, third, fourth) {
_classCallCheck(this, HttpRequest);
this.url = url;
/**
* The request body, or `null` if one isn't set.
*
* Bodies are not enforced to be immutable, as they can include a reference to any
* user-defined data type. However, interceptors should take care to preserve
* idempotence by treating them as such.
*/
this.body = null;
/**
* Whether this request should be made in a way that exposes progress events.
*
* Progress events are expensive (change detection runs on each event) and so
* they should only be requested if the consumer intends to monitor them.
*/
this.reportProgress = false;
/**
* Whether this request should be sent with outgoing credentials (cookies).
*/
this.withCredentials = false;
/**
* The expected response type of the server.
*
* This is used to parse the response appropriately before returning it to
* the requestee.
*/
this.responseType = 'json';
this.method = method.toUpperCase(); // Next, need to figure out which argument holds the HttpRequestInit
// options, if any.
/** @type {?} */
var options; // Check whether a body argument is expected. The only valid way to omit
// the body argument is to use a known no-body method like GET.
if (mightHaveBody(this.method) || !!fourth) {
// Body is the third argument, options are the fourth.
this.body = third !== undefined ?
/** @type {?} */
third : null;
options = fourth;
} else {
// No body required, options are the third argument. The body stays null.
options =
/** @type {?} */
third;
} // If options have been passed, interpret them.
if (options) {
// Normalize reportProgress and withCredentials.
this.reportProgress = !!options.reportProgress;
this.withCredentials = !!options.withCredentials; // Override default response type of 'json' if one is provided.
if (!!options.responseType) {
this.responseType = options.responseType;
} // Override headers if they're provided.
if (!!options.headers) {
this.headers = options.headers;
}
if (!!options.params) {
this.params = options.params;
}
} // If no headers have been passed in, construct a new HttpHeaders instance.
if (!this.headers) {
this.headers = new HttpHeaders();
} // If no parameters have been passed in, construct a new HttpUrlEncodedParams instance.
if (!this.params) {
this.params = new HttpParams();
this.urlWithParams = url;
} else {
// Encode the parameters to a string in preparation for inclusion in the URL.
/** @type {?} */
var params = this.params.toString();
if (params.length === 0) {
// No parameters, the visible URL is just the URL given at creation time.
this.urlWithParams = url;
} else {
// Does the URL already have query parameters? Look for '?'.
/** @type {?} */
var qIdx = url.indexOf('?'); // There are 3 cases to handle:
// 1) No existing parameters -> append '?' followed by params.
// 2) '?' exists and is followed by existing query string ->
// append '&' followed by params.
// 3) '?' exists at the end of the url -> append params directly.
// This basically amounts to determining the character, if any, with
// which to join the URL and parameters.
/** @type {?} */
var sep = qIdx === -1 ? '?' : qIdx < url.length - 1 ? '&' : '';
this.urlWithParams = url + sep + params;
}
}
}
/**
* Transform the free-form body into a serialized format suitable for
* transmission to the server.
* @return {?}
*/
_createClass2(HttpRequest, [{
key: "serializeBody",
value: function serializeBody() {
// If no body is present, no need to serialize it.
if (this.body === null) {
return null;
} // Check whether the body is already in a serialized form. If so,
// it can just be returned directly.
if (isArrayBuffer(this.body) || isBlob(this.body) || isFormData(this.body) || typeof this.body === 'string') {
return this.body;
} // Check whether the body is an instance of HttpUrlEncodedParams.
if (this.body instanceof HttpParams) {
return this.body.toString();
} // Check whether the body is an object or array, and serialize with JSON if so.
if (typeof this.body === 'object' || typeof this.body === 'boolean' || Array.isArray(this.body)) {
return JSON.stringify(this.body);
} // Fall back on toString() for everything else.
return (
/** @type {?} */
this.body.toString()
);
}
/**
* Examine the body and attempt to infer an appropriate MIME type
* for it.
*
* If no such type can be inferred, this method will return `null`.
* @return {?}
*/
}, {
key: "detectContentTypeHeader",
value: function detectContentTypeHeader() {
// An empty body has no content type.
if (this.body === null) {
return null;
} // FormData bodies rely on the browser's content type assignment.
if (isFormData(this.body)) {
return null;
} // Blobs usually have their own content type. If it doesn't, then
// no type can be inferred.
if (isBlob(this.body)) {
return this.body.type || null;
} // Array buffers have unknown contents and thus no type can be inferred.
if (isArrayBuffer(this.body)) {
return null;
} // Technically, strings could be a form of JSON data, but it's safe enough
// to assume they're plain strings.
if (typeof this.body === 'string') {
return 'text/plain';
} // `HttpUrlEncodedParams` has its own content-type.
if (this.body instanceof HttpParams) {
return 'application/x-www-form-urlencoded;charset=UTF-8';
} // Arrays, objects, and numbers will be encoded as JSON.
if (typeof this.body === 'object' || typeof this.body === 'number' || Array.isArray(this.body)) {
return 'application/json';
} // No type could be inferred.
return null;
}
/**
* @param {?=} update
* @return {?}
*/
}, {
key: "clone",
value: function clone() {
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
// For method, url, and responseType, take the current value unless
// it is overridden in the update hash.
/** @type {?} */
var method = update.method || this.method;
/** @type {?} */
var url = update.url || this.url;
/** @type {?} */
var responseType = update.responseType || this.responseType; // The body is somewhat special - a `null` value in update.body means
// whatever current body is present is being overridden with an empty
// body, whereas an `undefined` value in update.body implies no
// override.
/** @type {?} */
var body = update.body !== undefined ? update.body : this.body; // Carefully handle the boolean options to differentiate between
// `false` and `undefined` in the update args.
/** @type {?} */
var withCredentials = update.withCredentials !== undefined ? update.withCredentials : this.withCredentials;
/** @type {?} */
var reportProgress = update.reportProgress !== undefined ? update.reportProgress : this.reportProgress; // Headers and params may be appended to if `setHeaders` or
// `setParams` are used.
/** @type {?} */
var headers = update.headers || this.headers;
/** @type {?} */
var params = update.params || this.params; // Check whether the caller has asked to add headers.
if (update.setHeaders !== undefined) {
// Set every requested header.
headers = Object.keys(update.setHeaders).reduce(
/**
* @param {?} headers
* @param {?} name
* @return {?}
*/
function (headers, name) {
return headers.set(name,
/** @type {?} */
update.setHeaders[name]);
}, headers);
} // Check whether the caller has asked to set params.
if (update.setParams) {
// Set every requested param.
params = Object.keys(update.setParams).reduce(
/**
* @param {?} params
* @param {?} param
* @return {?}
*/
function (params, param) {
return params.set(param,
/** @type {?} */
update.setParams[param]);
}, params);
} // Finally, construct the new HttpRequest using the pieces from above.
return new HttpRequest(method, url, body, {
params: params,
headers: headers,
reportProgress: reportProgress,
responseType: responseType,
withCredentials: withCredentials
});
}
}]);
return HttpRequest;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/http/src/response.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/** @enum {number} */
var HttpEventType = /*@__PURE__*/function () {
var HttpEventType = {
/**
* The request was sent out over the wire.
*/
Sent: 0,
/**
* An upload progress event was received.
*/
UploadProgress: 1,
/**
* The response status code and headers were received.
*/
ResponseHeader: 2,
/**
* A download progress event was received.
*/
DownloadProgress: 3,
/**
* The full response including the body was received.
*/
Response: 4,
/**
* A custom event from an interceptor or a backend.
*/
User: 5
};
HttpEventType[HttpEventType.Sent] = 'Sent';
HttpEventType[HttpEventType.UploadProgress] = 'UploadProgress';
HttpEventType[HttpEventType.ResponseHeader] = 'ResponseHeader';
HttpEventType[HttpEventType.DownloadProgress] = 'DownloadProgress';
HttpEventType[HttpEventType.Response] = 'Response';
HttpEventType[HttpEventType.User] = 'User';
return HttpEventType;
}();
/**
* Base interface for progress events.
*
* \@publicApi
* @record
*/
function HttpProgressEvent() {}
if (false) {}
/**
* A download progress event.
*
* \@publicApi
* @record
*/
function HttpDownloadProgressEvent() {}
if (false) {}
/**
* An upload progress event.
*
* \@publicApi
* @record
*/
function HttpUploadProgressEvent() {}
if (false) {}
/**
* An event indicating that the request was sent to the server. Useful
* when a request may be retried multiple times, to distinguish between
* retries on the final event stream.
*
* \@publicApi
* @record
*/
function HttpSentEvent() {}
if (false) {}
/**
* A user-defined event.
*
* Grouping all custom events under this type ensures they will be handled
* and forwarded by all implementations of interceptors.
*
* \@publicApi
* @record
* @template T
*/
function HttpUserEvent() {}
if (false) {}
/**
* An error that represents a failed attempt to JSON.parse text coming back
* from the server.
*
* It bundles the Error object with the actual response body that failed to parse.
*
*
* @record
*/
function HttpJsonParseError() {}
if (false) {}
/**
* Base class for both `HttpResponse` and `HttpHeaderResponse`.
*
* \@publicApi
* @abstract
*/
var HttpResponseBase =
/**
* Super-constructor for all responses.
*
* The single parameter accepted is an initialization hash. Any properties
* of the response passed there will override the default values.
* @param {?} init
* @param {?=} defaultStatus
* @param {?=} defaultStatusText
*/
function HttpResponseBase(init) {
var defaultStatus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
var defaultStatusText = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'OK';
_classCallCheck(this, HttpResponseBase);
// If the hash has values passed, use them to initialize the response.
// Otherwise use the default values.
this.headers = init.headers || new HttpHeaders();
this.status = init.status !== undefined ? init.status : defaultStatus;
this.statusText = init.statusText || defaultStatusText;
this.url = init.url || null; // Cache the ok value to avoid defining a getter.
this.ok = this.status >= 200 && this.status < 300;
};
if (false) {}
/**
* A partial HTTP response which only includes the status and header data,
* but no response body.
*
* `HttpHeaderResponse` is a `HttpEvent` available on the response
* event stream, only when progress events are requested.
*
* \@publicApi
*/
var HttpHeaderResponse = /*#__PURE__*/function (_HttpResponseBase) {
_inherits(HttpHeaderResponse, _HttpResponseBase);
var _super9 = _createSuper(HttpHeaderResponse);
/**
* Create a new `HttpHeaderResponse` with the given parameters.
* @param {?=} init
*/
function HttpHeaderResponse() {
var _this72;
var init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_classCallCheck(this, HttpHeaderResponse);
_this72 = _super9.call(this, init);
_this72.type = HttpEventType.ResponseHeader;
return _this72;
}
/**
* Copy this `HttpHeaderResponse`, overriding its contents with the
* given parameter hash.
* @param {?=} update
* @return {?}
*/
_createClass2(HttpHeaderResponse, [{
key: "clone",
value: function clone() {
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
// Perform a straightforward initialization of the new HttpHeaderResponse,
// overriding the current parameters with new ones if given.
return new HttpHeaderResponse({
headers: update.headers || this.headers,
status: update.status !== undefined ? update.status : this.status,
statusText: update.statusText || this.statusText,
url: update.url || this.url || undefined
});
}
}]);
return HttpHeaderResponse;
}(HttpResponseBase);
if (false) {}
/**
* A full HTTP response, including a typed response body (which may be `null`
* if one was not returned).
*
* `HttpResponse` is a `HttpEvent` available on the response event
* stream.
*
* \@publicApi
* @template T
*/
var HttpResponse = /*#__PURE__*/function (_HttpResponseBase2) {
_inherits(HttpResponse, _HttpResponseBase2);
var _super10 = _createSuper(HttpResponse);
/**
* Construct a new `HttpResponse`.
* @param {?=} init
*/
function HttpResponse() {
var _this73;
var init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
_classCallCheck(this, HttpResponse);
_this73 = _super10.call(this, init);
_this73.type = HttpEventType.Response;
_this73.body = init.body !== undefined ? init.body : null;
return _this73;
}
/**
* @param {?=} update
* @return {?}
*/
_createClass2(HttpResponse, [{
key: "clone",
value: function clone() {
var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
return new HttpResponse({
body: update.body !== undefined ? update.body : this.body,
headers: update.headers || this.headers,
status: update.status !== undefined ? update.status : this.status,
statusText: update.statusText || this.statusText,
url: update.url || this.url || undefined
});
}
}]);
return HttpResponse;
}(HttpResponseBase);
if (false) {}
/**
* A response that represents an error or failure, either from a
* non-successful HTTP status, an error while executing the request,
* or some other failure which occurred during the parsing of the response.
*
* Any error returned on the `Observable` response stream will be
* wrapped in an `HttpErrorResponse` to provide additional context about
* the state of the HTTP layer when the error occurred. The error property
* will contain either a wrapped Error object or the error response returned
* from the server.
*
* \@publicApi
*/
var HttpErrorResponse = /*#__PURE__*/function (_HttpResponseBase3) {
_inherits(HttpErrorResponse, _HttpResponseBase3);
var _super11 = _createSuper(HttpErrorResponse);
/**
* @param {?} init
*/
function HttpErrorResponse(init) {
var _this74;
_classCallCheck(this, HttpErrorResponse);
// Initialize with a default status of 0 / Unknown Error.
_this74 = _super11.call(this, init, 0, 'Unknown Error');
_this74.name = 'HttpErrorResponse';
/**
* Errors are never okay, even when the status code is in the 2xx success range.
*/
_this74.ok = false; // If the response was successful, then this was a parse error. Otherwise, it was
// a protocol-level failure of some sort. Either the request failed in transit
// or the server returned an unsuccessful status code.
if (_this74.status >= 200 && _this74.status < 300) {
_this74.message = "Http failure during parsing for ".concat(init.url || '(unknown url)');
} else {
_this74.message = "Http failure response for ".concat(init.url || '(unknown url)', ": ").concat(init.status, " ").concat(init.statusText);
}
_this74.error = init.error || null;
return _this74;
}
return HttpErrorResponse;
}(HttpResponseBase);
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/http/src/client.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Constructs an instance of `HttpRequestOptions` from a source `HttpMethodOptions` and
* the given `body`. This function clones the object and adds the body.
*
* Note that the `responseType` *options* value is a String that identifies the
* single data type of the response.
* A single overload version of the method handles each response type.
* The value of `responseType` cannot be a union, as the combined signature could imply.
*
* @template T
* @param {?} options
* @param {?} body
* @return {?}
*/
function addBody(options, body) {
return {
body: body,
headers: options.headers,
observe: options.observe,
params: options.params,
reportProgress: options.reportProgress,
responseType: options.responseType,
withCredentials: options.withCredentials
};
}
var HttpClient = /*@__PURE__*/function () {
var HttpClient = /*#__PURE__*/function () {
/**
* @param {?} handler
*/
function HttpClient(handler) {
_classCallCheck(this, HttpClient);
this.handler = handler;
}
/**
* Constructs an observable for a generic HTTP request that, when subscribed,
* fires the request through the chain of registered interceptors and on to the
* server.
*
* You can pass an `HttpRequest` directly as the only parameter. In this case,
* the call returns an observable of the raw `HttpEvent` stream.
*
* Alternatively you can pass an HTTP method as the first parameter,
* a URL string as the second, and an options hash containing the request body as the third.
* See `addBody()`. In this case, the specified `responseType` and `observe` options determine the
* type of returned observable.
* * The `responseType` value determines how a successful response body is parsed.
* * If `responseType` is the default `json`, you can pass a type interface for the resulting
* object as a type parameter to the call.
*
* The `observe` value determines the return type, according to what you are interested in
* observing.
* * An `observe` value of events returns an observable of the raw `HttpEvent` stream, including
* progress events by default.
* * An `observe` value of response returns an observable of `HttpResponse`,
* where the `T` parameter depends on the `responseType` and any optionally provided type
* parameter.
* * An `observe` value of body returns an observable of `` with the same `T` body type.
*
* @param {?} first
* @param {?=} url
* @param {?=} options
* @return {?}
*/
_createClass2(HttpClient, [{
key: "request",
value: function request(first, url) {
var _this75 = this;
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
/** @type {?} */
var req; // First, check whether the primary argument is an instance of `HttpRequest`.
if (first instanceof HttpRequest) {
// It is. The other arguments must be undefined (per the signatures) and can be
// ignored.
req = first;
} else {
// It's a string, so it represents a URL. Construct a request based on it,
// and incorporate the remaining arguments (assuming `GET` unless a method is
// provided.
// Figure out the headers.
/** @type {?} */
var headers = undefined;
if (options.headers instanceof HttpHeaders) {
headers = options.headers;
} else {
headers = new HttpHeaders(options.headers);
} // Sort out parameters.
/** @type {?} */
var params = undefined;
if (!!options.params) {
if (options.params instanceof HttpParams) {
params = options.params;
} else {
params = new HttpParams(
/** @type {?} */
{
fromObject: options.params
});
}
} // Construct the request.
req = new HttpRequest(first,
/** @type {?} */
url, options.body !== undefined ? options.body : null, {
headers: headers,
params: params,
reportProgress: options.reportProgress,
// By default, JSON is assumed to be returned for all calls.
responseType: options.responseType || 'json',
withCredentials: options.withCredentials
});
} // Start with an Observable.of() the initial request, and run the handler (which
// includes all interceptors) inside a concatMap(). This way, the handler runs
// inside an Observable chain, which causes interceptors to be re-run on every
// subscription (this also makes retries re-run the handler, including interceptors).
/** @type {?} */
var events$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_1__["of"])(req).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__["concatMap"])(
/**
* @param {?} req
* @return {?}
*/
function (req) {
return _this75.handler.handle(req);
})); // If coming via the API signature which accepts a previously constructed HttpRequest,
// the only option is to get the event stream. Otherwise, return the event stream if
// that is what was requested.
if (first instanceof HttpRequest || options.observe === 'events') {
return events$;
} // The requested stream contains either the full response or the body. In either
// case, the first step is to filter the event stream to extract a stream of
// responses(s).
/** @type {?} */
var res$ =
/** @type {?} */
events$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__["filter"])(
/**
* @param {?} event
* @return {?}
*/
function (event) {
return event instanceof HttpResponse;
})); // Decide which stream to return.
switch (options.observe || 'body') {
case 'body':
// The requested stream is the body. Map the response stream to the response
// body. This could be done more simply, but a misbehaving interceptor might
// transform the response body into a different format and ignore the requested
// responseType. Guard against this by validating that the response is of the
// requested type.
switch (req.responseType) {
case 'arraybuffer':
return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__["map"])(
/**
* @param {?} res
* @return {?}
*/
function (res) {
// Validate that the body is an ArrayBuffer.
if (res.body !== null && !(res.body instanceof ArrayBuffer)) {
throw new Error('Response is not an ArrayBuffer.');
}
return res.body;
}));
case 'blob':
return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__["map"])(
/**
* @param {?} res
* @return {?}
*/
function (res) {
// Validate that the body is a Blob.
if (res.body !== null && !(res.body instanceof Blob)) {
throw new Error('Response is not a Blob.');
}
return res.body;
}));
case 'text':
return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__["map"])(
/**
* @param {?} res
* @return {?}
*/
function (res) {
// Validate that the body is a string.
if (res.body !== null && typeof res.body !== 'string') {
throw new Error('Response is not a string.');
}
return res.body;
}));
case 'json':
default:
// No validation needed for JSON responses, as they can be of any type.
return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__["map"])(
/**
* @param {?} res
* @return {?}
*/
function (res) {
return res.body;
}));
}
case 'response':
// The response stream was requested directly, so return it.
return res$;
default:
// Guard against new future observe types being added.
throw new Error("Unreachable: unhandled observe type ".concat(options.observe, "}"));
}
}
/**
* Constructs an observable that, when subscribed, causes the configured
* `DELETE` request to execute on the server. See the individual overloads for
* details on the return type.
*
* @param {?} url The endpoint URL.
* @param {?=} options The HTTP options to send with the request.
*
* @return {?}
*/
}, {
key: "delete",
value: function _delete(url) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return this.request('DELETE', url,
/** @type {?} */
options);
}
/**
* Constructs an observable that, when subscribed, causes the configured
* `GET` request to execute on the server. See the individual overloads for
* details on the return type.
* @param {?} url
* @param {?=} options
* @return {?}
*/
}, {
key: "get",
value: function get(url) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return this.request('GET', url,
/** @type {?} */
options);
}
/**
* Constructs an observable that, when subscribed, causes the configured
* `HEAD` request to execute on the server. The `HEAD` method returns
* meta information about the resource without transferring the
* resource itself. See the individual overloads for
* details on the return type.
* @param {?} url
* @param {?=} options
* @return {?}
*/
}, {
key: "head",
value: function head(url) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return this.request('HEAD', url,
/** @type {?} */
options);
}
/**
* Constructs an `Observable` that, when subscribed, causes a request with the special method
* `JSONP` to be dispatched via the interceptor pipeline.
* The [JSONP pattern](https://en.wikipedia.org/wiki/JSONP) works around limitations of certain
* API endpoints that don't support newer,
* and preferable [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) protocol.
* JSONP treats the endpoint API as a JavaScript file and tricks the browser to process the
* requests even if the API endpoint is not located on the same domain (origin) as the client-side
* application making the request.
* The endpoint API must support JSONP callback for JSONP requests to work.
* The resource API returns the JSON response wrapped in a callback function.
* You can pass the callback function name as one of the query parameters.
* Note that JSONP requests can only be used with `GET` requests.
*
* @template T
* @param {?} url The resource URL.
* @param {?} callbackParam The callback function name.
*
* @return {?}
*/
}, {
key: "jsonp",
value: function jsonp(url, callbackParam) {
return this.request('JSONP', url, {
params: new HttpParams().append(callbackParam, 'JSONP_CALLBACK'),
observe: 'body',
responseType: 'json'
});
}
/**
* Constructs an `Observable` that, when subscribed, causes the configured
* `OPTIONS` request to execute on the server. This method allows the client
* to determine the supported HTTP methods and other capabilites of an endpoint,
* without implying a resource action. See the individual overloads for
* details on the return type.
* @param {?} url
* @param {?=} options
* @return {?}
*/
}, {
key: "options",
value: function options(url) {
var _options2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return this.request('OPTIONS', url,
/** @type {?} */
_options2);
}
/**
* Constructs an observable that, when subscribed, causes the configured
* `PATCH` request to execute on the server. See the individual overloads for
* details on the return type.
* @param {?} url
* @param {?} body
* @param {?=} options
* @return {?}
*/
}, {
key: "patch",
value: function patch(url, body) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return this.request('PATCH', url, addBody(options, body));
}
/**
* Constructs an observable that, when subscribed, causes the configured
* `POST` request to execute on the server. The server responds with the location of
* the replaced resource. See the individual overloads for
* details on the return type.
* @param {?} url
* @param {?} body
* @param {?=} options
* @return {?}
*/
}, {
key: "post",
value: function post(url, body) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return this.request('POST', url, addBody(options, body));
}
/**
* Constructs an observable that, when subscribed, causes the configured
* `PUT` request to execute on the server. The `PUT` method replaces an existing resource
* with a new set of values.
* See the individual overloads for details on the return type.
* @param {?} url
* @param {?} body
* @param {?=} options
* @return {?}
*/
}, {
key: "put",
value: function put(url, body) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return this.request('PUT', url, addBody(options, body));
}
}]);
return HttpClient;
}();
HttpClient.ɵfac = function HttpClient_Factory(t) {
return new (t || HttpClient)(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"](HttpHandler));
};
HttpClient.ɵprov = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineInjectable"]({
token: HttpClient,
factory: HttpClient.ɵfac
});
return HttpClient;
}();
if (false) {}
/**
* @fileoverview added by tsickle
* Generated from: packages/common/http/src/interceptor.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
/**
* Intercepts and handles an `HttpRequest` or `HttpResponse`.
*
* Most interceptors transform the outgoing request before passing it to the
* next interceptor in the chain, by calling `next.handle(transformedReq)`.
* An interceptor may transform the
* response event stream as well, by applying additional RxJS operators on the stream
* returned by `next.handle()`.
*
* More rarely, an interceptor may handle the request entirely,
* and compose a new event stream instead of invoking `next.handle()`. This is an
* acceptable behavior, but keep in mind that further interceptors will be skipped entirely.
*
* It is also rare but valid for an interceptor to return multiple responses on the
* event stream for a single request.
*
* \@publicApi
*
* @see [HTTP Guide](guide/http#intercepting-requests-and-responses)
*
* \@usageNotes
*
* To use the same instance of `HttpInterceptors` for the entire app, import the `HttpClientModule`
* only in your `AppModule`, and add the interceptors to the root application injector .
* If you import `HttpClientModule` multiple times across different modules (for example, in lazy
* loading modules), each import creates a new copy of the `HttpClientModule`, which overwrites the
* interceptors provided in the root module.
*
* @record
*/
function HttpInterceptor() {}
if (false) {}
/**
* `HttpHandler` which applies an `HttpInterceptor` to an `HttpRequest`.
*
*
*/
var HttpInterceptorHandler = /*#__PURE__*/function () {
/**
* @param {?} next
* @param {?} interceptor
*/
function HttpInterceptorHandler(next, interceptor) {
_classCallCheck(this, HttpInterceptorHandler);
this.next = next;
this.interceptor = interceptor;
}
/**
* @param {?} req
* @return {?}
*/
_createClass2(HttpInterceptorHandler, [{
key: "handle",
value: function handle(req) {
return this.interceptor.intercept(req, this.next);
}
}]);
return HttpInterceptorHandler;
}();
if (false) {}
/**
* A multi-provider token that represents the array of registered
* `HttpInterceptor` objects.
*
* \@publicApi
* @type {?}
*/
var HTTP_INTERCEPTORS = /*@__PURE__*/new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('HTTP_INTERCEPTORS');
var NoopInterceptor = /*@__PURE__*/function () {
var NoopInterceptor = /*#__PURE__*/function () {
function NoopInterceptor() {
_classCallCheck(this, NoopInterceptor);
}
_createClass2(NoopInterceptor, [{
key: "intercept",
value:
/**
* @param {?} req
* @param {?} next
* @return {?}
*/
function intercept(req, next) {
return next.handle(req);
}
}]);
return NoopInterceptor;
}();
NoopInterceptor.ɵfac = function NoopInterceptor_Factory(t) {
return new (t || NoopInterceptor)();
};
NoopInterceptor.ɵprov = /*@__PURE__*/_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineInjectable"]({
token: NoopInterceptor,
factory: NoopInterceptor.ɵfac
});
return NoopInterceptor;
}();
/**
* @fileoverview added by tsickle
* Generated from: packages/common/http/src/jsonp.ts
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
*/
// Every request made through JSONP needs a callback name that's unique across the
// whole page. Each request is assigned an id and the callback name is constructed
// from that. The next id to be assigned is tracked in a global variable here that
// is shared among all applications on the page.
/** @type {?} */
var nextRequestId = 0; // Error text given when a JSONP script is injected, but doesn't invoke the callback
// passed in its URL.
/** @type {?} */
var JSONP_ERR_NO_CALLBACK = 'JSONP injected script did not invoke callback.'; // Error text given when a request is passed to the JsonpClientBackend that doesn't
// have a request method JSONP.
/** @type {?} */
var JSONP_ERR_WRONG_METHOD = 'JSONP requests must use JSONP request method.';
/** @type {?} */
var JSONP_ERR_WRONG_RESPONSE_TYPE = 'JSONP requests must use Json response type.';
/**
* DI token/abstract type representing a map of JSONP callbacks.
*
* In the browser, this should always be the `window` object.
*
*
* @abstract
*/
var JsonpCallbackContext = function JsonpCallbackContext() {
_classCallCheck(this, JsonpCallbackContext);
};
var JsonpClientBackend = /*@__PURE__*/function () {
var JsonpClientBackend = /*#__PURE__*/function () {
/**
* @param {?} callbackMap
* @param {?} document
*/
function JsonpClientBackend(callbackMap, document) {
_classCallCheck(this, JsonpClientBackend);
this.callbackMap = callbackMap;
this.document = document;
}
/**
* Get the name of the next callback method, by incrementing the global `nextRequestId`.
* @private
* @return {?}
*/
_createClass2(JsonpClientBackend, [{
key: "nextCallback",
value: function nextCallback() {
return "ng_jsonp_callback_".concat(nextRequestId++);
}
/**
* Processes a JSONP request and returns an event stream of the results.
* @param {?} req The request object.
* @return {?} An observable of the response events.
*
*/
}, {
key: "handle",
value: function handle(req) {
var _this76 = this;
// Firstly, check both the method and response type. If either doesn't match
// then the request was improperly routed here and cannot be handled.
if (req.method !== 'JSONP') {
throw new Error(JSONP_ERR_WRONG_METHOD);
} else if (req.responseType !== 'json') {
throw new Error(JSONP_ERR_WRONG_RESPONSE_TYPE);
} // Everything else happens inside the Observable boundary.
return new rxjs__WEBPACK_IMPORTED_MODULE_1__["Observable"](
/**
* @param {?} observer
* @return {?}
*/
function (observer) {
// The first step to make a request is to generate the callback name, and replace the
// callback placeholder in the URL with the name. Care has to be taken here to ensure
// a trailing &, if matched, gets inserted back into the URL in the correct place.
/** @type {?} */
var callback = _this76.nextCallback();
/** @type {?} */
var url = req.urlWithParams.replace(/=JSONP_CALLBACK(&|$)/, "=".concat(callback, "$1")); // Construct the