webpackJsonp(["vendor"],{ /***/ "./node_modules/@angular/animations/esm5/animations.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* 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__, "AUTO_STYLE", function() { return AUTO_STYLE; }); /* 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__, "NoopAnimationPlayer", function() { return NoopAnimationPlayer; }); /* 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 v5.2.2 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * AnimationBuilder is an injectable service that is available when the {\@link * BrowserAnimationsModule BrowserAnimationsModule} or {\@link NoopAnimationsModule * NoopAnimationsModule} modules are used within an application. * * The purpose if this service is to produce an animation sequence programmatically within an * angular component or directive. * * Programmatic animations are first built and then a player is created when the build animation is * attached to an element. * * ```ts * // remember to include the BrowserAnimationsModule module for this to work... * import {AnimationBuilder} from '\@angular/animations'; * * class MyCmp { * constructor(private _builder: AnimationBuilder) {} * * makeAnimation(element: any) { * // first build the animation * const myAnimation = this._builder.build([ * style({ width: 0 }), * animate(1000, style({ width: '100px' })) * ]); * * // then create a player from it * const player = myAnimation.create(element); * * player.play(); * } * } * ``` * * When an animation is built an instance of {\@link AnimationFactory AnimationFactory} will be * returned. Using that an {\@link AnimationPlayer AnimationPlayer} can be created which can then be * used to start the animation. * * \@experimental Animation support is experimental. * @abstract */ var AnimationBuilder = /** @class */ (function () { function AnimationBuilder() { } return AnimationBuilder; }()); /** * An instance of `AnimationFactory` is returned from {\@link AnimationBuilder#build * AnimationBuilder.build}. * * \@experimental Animation support is experimental. * @abstract */ var AnimationFactory = /** @class */ (function () { function AnimationFactory() { } return AnimationFactory; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * \@experimental Animation support is experimental. */ var AUTO_STYLE = '*'; /** * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link trigger trigger animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link state state animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link transition transition animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * \@experimental Animation support is experimental. * @record */ /** * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link keyframes keyframes animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link style style animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link animate animate animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link animateChild animateChild animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link useAnimation useAnimation animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link sequence sequence animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link group group animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * Metadata representing the entry of animations. Instances of this interface are provided via the * animation DSL when the {\@link stagger stagger animation function} is called. * * \@experimental Animation support is experimental. * @record */ /** * `trigger` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the * {\@link Component#animations component animations metadata page} to gain a better * understanding of how animations in Angular are used. * * `trigger` Creates an animation trigger which will a list of {\@link state state} and * {\@link transition transition} entries that will be evaluated when the expression * bound to the trigger changes. * * Triggers are registered within the component annotation data under the * {\@link Component#animations animations section}. An animation trigger can be placed on an element * within a template by referencing the name of the trigger followed by the expression value that * the * trigger is bound to (in the form of `[\@triggerName]="expression"`. * * Animation trigger bindings strigify values and then match the previous and current values against * any linked transitions. If a boolean value is provided into the trigger binding then it will both * be represented as `1` or `true` and `0` or `false` for a true and false boolean values * respectively. * * ### Usage * * `trigger` will create an animation trigger reference based on the provided `name` value. The * provided `animation` value is expected to be an array consisting of {\@link state state} and * {\@link transition 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 will make use of the `myAnimationTrigger` animation * trigger by binding to an element within its template code. * * ```html * *
...
* ``` * * ## Disable Animations * A special animation control binding called `\@.disabled` can be placed on an element which will * then disable animations for any inner animation triggers situated within the element as well as * any animations on the element itself. * * When true, the `\@.disabled` binding will prevent all animations from rendering. The example * below shows how to use this feature: * * ```ts * \@Component({ * selector: 'my-component', * template: ` *
*
*
* `, * animations: [ * trigger("childAnimation", [ * // ... * ]) * ] * }) * class MyComponent { * isDisabled = true; * exp = '...'; * } * ``` * * The `\@childAnimation` trigger will not animate because `\@.disabled` prevents it from happening * (when true). * * Note that `\@.disbled` will only disable all animations (this means any animations running on * the same element will also be disabled). * * ### Disabling Animations Application-wide * When an area of the template is set to have animations disabled, **all** inner components will * also have their animations disabled as well. This means that all animations for an angular * application can be disabled by placing a host binding set on `\@.disabled` on the topmost Angular * component. * * ```ts * import {Component, HostBinding} from '\@angular/core'; * * \@Component({ * selector: 'app-component', * templateUrl: 'app.component.html', * }) * class AppComponent { * \@HostBinding('\@.disabled') * public animationsDisabled = true; * } * ``` * * ### What about animations that us `query()` and `animateChild()`? * Despite inner animations being disabled, a parent animation can {\@link query query} for inner * elements located in disabled areas of the template and still animate them as it sees fit. This is * also the case for when a sub animation is queried by a parent and then later animated using {\@link * animateChild animateChild}. * * \@experimental Animation support is experimental. * @param {?} name * @param {?} definitions * @return {?} */ function trigger(name, definitions) { return { type: 7 /* Trigger */, name: name, definitions: definitions, options: {} }; } /** * `animate` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `animate` specifies an animation step that will apply the provided `styles` data for a given * amount of time based on the provided `timing` expression value. Calls to `animate` are expected * to be used within {\@link sequence an animation sequence}, {\@link group group}, or {\@link * transition transition}. * * ### Usage * * The `animate` function accepts two input parameters: `timing` and `styles`: * * - `timing` is a string based value that can be a combination of a duration with optional delay * and easing values. The format for the expression breaks down to `duration delay easing` * (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000, * delay=100, easing=ease-out`. If a numeric value is provided then that will be used as the * `duration` value in millisecond form. * - `styles` is the style input data which can either be a call to {\@link style style} or {\@link * keyframes keyframes}. If left empty then the styles from the destination state will be collected * and used (this is useful when describing an animation step that will complete an animation by * {\@link transition#the-final-animate-call animating to the final state}). * * ```typescript * // various functions for specifying timing data * animate(500, style(...)) * animate("1s", style(...)) * animate("100ms 0.5s", style(...)) * animate("5s ease", style(...)) * animate("5s 10ms cubic-bezier(.17,.67,.88,.1)", style(...)) * * // either style() of keyframes() can be used * animate(500, style({ background: "red" })) * animate(500, keyframes([ * style({ background: "blue" })), * style({ background: "red" })) * ]) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} timings * @param {?=} styles * @return {?} */ function animate(timings, styles) { if (styles === void 0) { styles = null; } return { type: 4 /* Animate */, styles: styles, timings: timings }; } /** * `group` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `group` specifies a list of animation steps that are all run in parallel. Grouped animations are * useful when a series of styles must be animated/closed off at different starting/ending times. * * The `group` function can either be used within a {\@link sequence sequence} or a {\@link transition * transition} and it will only continue to the next instruction once all of the inner animation * steps have completed. * * ### Usage * * The `steps` data that is passed into the `group` animation function can either consist of {\@link * style style} or {\@link animate animate} function calls. Each call to `style()` or `animate()` * within a group will be executed instantly (use {\@link keyframes keyframes} or a {\@link * animate#usage animate() with a delay value} to offset styles to be applied at a later time). * * ```typescript * group([ * animate("1s", { background: "black" })) * animate("2s", { color: "white" })) * ]) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} steps * @param {?=} options * @return {?} */ function group(steps, options) { if (options === void 0) { options = null; } return { type: 3 /* Group */, steps: steps, options: options }; } /** * `sequence` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used by * default when an array is passed as animation data into {\@link transition transition}.) * * The `sequence` function can either be used within a {\@link group group} or a {\@link transition * transition} and it will only continue to the next instruction once each of the inner animation * steps have completed. * * To perform animation styling in parallel with other animation steps then have a look at the * {\@link group group} animation function. * * ### Usage * * The `steps` data that is passed into the `sequence` animation function can either consist of * {\@link style style} or {\@link animate animate} function calls. A call to `style()` will apply the * provided styling data immediately while a call to `animate()` will apply its styling data over a * given time depending on its timing data. * * ```typescript * sequence([ * style({ opacity: 0 })), * animate("1s", { opacity: 1 })) * ]) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} steps * @param {?=} options * @return {?} */ function sequence(steps, options) { if (options === void 0) { options = null; } return { type: 2 /* Sequence */, steps: steps, options: options }; } /** * `style` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `style` declares a key/value object containing CSS properties/styles that can then be used for * {\@link state animation states}, within an {\@link sequence animation sequence}, or as styling data * for both {\@link animate animate} and {\@link keyframes keyframes}. * * ### Usage * * `style` takes in a key/value string map as data and expects one or more CSS property/value pairs * to be defined. * * ```typescript * // string values are used for css properties * style({ background: "red", color: "blue" }) * * // numerical (pixel) values are also supported * style({ width: 100, height: 0 }) * ``` * * #### Auto-styles (using `*`) * * When an asterix (`*`) character is used as a value then it will be detected from the element * being animated and applied as animation data when the animation starts. * * This feature proves useful for a state depending on layout and/or environment factors; in such * cases the styles are calculated just before the animation starts. * * ```typescript * // the steps below will animate from 0 to the * // actual height of the element * style({ height: 0 }), * animate("1s", style({ height: "*" })) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} tokens * @return {?} */ function style(tokens) { return { type: 6 /* Style */, styles: tokens, offset: null }; } /** * `state` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `state` declares an animation state within the given trigger. When a state is active within a * component then its associated styles will persist on the element that the trigger is attached to * (even when the animation ends). * * To animate between states, have a look at the animation {\@link transition transition} DSL * function. To register states to an animation trigger please have a look at the {\@link trigger * trigger} function. * * #### The `void` state * * The `void` state value is a reserved word that angular uses to determine when the element is not * apart of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the * associated element is void). * * #### The `*` (default) state * * The `*` state (when styled) is a fallback state that will be used if the state that is being * animated is not declared within the trigger. * * ### Usage * * `state` will declare an animation state with its associated styles * within the given trigger. * * - `stateNameExpr` can be one or more state names separated by commas. * - `styles` refers to the {\@link style styling data} that will be persisted on the element once * the state has been reached. * * ```typescript * // "void" is a reserved name for a state and is used to represent * // the state in which an element is detached from from the application. * state("void", style({ height: 0 })) * * // user-defined states * state("closed", style({ height: 0 })) * state("open, visible", style({ height: "*" })) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} name * @param {?} styles * @param {?=} options * @return {?} */ function state(name, styles, options) { return { type: 0 /* State */, name: name, styles: styles, options: options }; } /** * `keyframes` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `keyframes` specifies a collection of {\@link style style} entries each optionally characterized * by an `offset` value. * * ### Usage * * The `keyframes` animation function is designed to be used alongside the {\@link animate animate} * animation function. Instead of applying animations from where they are currently to their * destination, keyframes can describe how each style entry is applied and at what point within the * animation arc (much like CSS Keyframe Animations do). * * For each `style()` entry an `offset` value can be set. Doing so allows to specifiy at what * percentage of the animate time the styles will be applied. * * ```typescript * // the provided offset values describe when each backgroundColor value is applied. * 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 }) * ])) * ``` * * Alternatively, if there are no `offset` values used within the style entries then the offsets * will be 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 * ])) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} steps * @return {?} */ function keyframes(steps) { return { type: 5 /* Keyframes */, steps: steps }; } /** * `transition` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `transition` declares the {\@link sequence sequence of animation steps} that will be run when the * provided `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 => * state2` which consists of two known states (use an asterix (`*`) to refer to a dynamic starting * and/or ending state). * * A function can also be provided as the `stateChangeExpr` argument for a transition and this * function will be executed each time a state change occurs. If the value returned within the * function is true then the associated animation will be run. * * Animation transitions are placed within an {\@link trigger animation trigger}. For an transition * to animate to a state value and persist its styles then one or more {\@link state animation * states} is expected to be defined. * * ### Usage * * An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on * what the previous state is and what the current state has become. In other words, if a transition * is defined that matches the old/current state criteria then the associated animation will be * triggered. * * ```typescript * // all transition/state changes are defined within an animation trigger * trigger("myAnimationTrigger", [ * // if a state is defined then its styles will be persisted when the * // animation has fully completed itself * state("on", style({ background: "green" })), * state("off", style({ background: "grey" })), * * // a transition animation that will be kicked off when the state value * // bound to "myAnimationTrigger" changes from "on" to "off" * transition("on => off", animate(500)), * * // it is also possible to do run the same animation for both directions * transition("on <=> off", animate(500)), * * // or to define multiple states pairs separated by commas * transition("on => off, off => void", animate(500)), * * // this is a catch-all state change for when an element is inserted into * // the page and the destination state is unknown * transition("void => *", [ * style({ opacity: 0 }), * animate(500) * ]), * * // this will capture a state change between any states * transition("* => *", animate("1s 0s")), * * // you can also go full out and include a function * transition((fromState, toState) => { * // when `true` then it will allow the animation below to be invoked * return fromState == "off" && toState == "on"; * }, animate("1s 0s")) * ]) * ``` * * The template associated with this component will make use of the `myAnimationTrigger` animation * trigger by binding to an element within its template code. * * ```html * *
...
* ``` * * #### The final `animate` call * * If the final step within the transition steps is a call to `animate()` that **only** uses a * timing value with **no style data** then it will be automatically used as the final animation arc * for the element to animate itself to the final state. This involves an automatic mix of * adding/removing CSS styles so that the element will be in the exact state it should be for the * applied state to be presented correctly. * * ``` * // start off by hiding the element, but make sure that it animates properly to whatever state * // is currently active for "myAnimationTrigger" * transition("void => *", [ * style({ opacity: 0 }), * animate(500) * ]) * ``` * * ### Using :enter and :leave * * Given that enter (insertion) and leave (removal) animations are so common, the `transition` * function accepts both `:enter` and `:leave` values which are aliases for the `void => *` and `* * => void` state changes. * * ``` * transition(":enter", [ * style({ opacity: 0 }), * animate(500, style({ opacity: 1 })) * ]), * transition(":leave", [ * animate(500, style({ opacity: 0 })) * ]) * ``` * * ### Boolean values * if a trigger binding value is a boolean value then it can be matched using a transition * expression that compares `true` and `false` or `1` and `0`. * * ``` * // in the template *
...
* * // in the component metadata * trigger('openClose', [ * state('true', style({ height: '*' })), * state('false', style({ height: '0px' })), * transition('false <=> true', animate(500)) * ]) * ``` * * ### Using :increment and :decrement * In addition to the :enter and :leave transition aliases, the :increment and :decrement aliases * can be used to kick off a transition when a numeric value has increased or decreased in value. * * ``` * import {group, animate, query, transition, style, trigger} from '\@angular/animations'; * import {Component} from '\@angular/core'; * * \@Component({ * selector: 'banner-carousel-component', * styles: [` * .banner-container { * position:relative; * height:500px; * overflow:hidden; * } * .banner-container > .banner { * position:absolute; * left:0; * top:0; * font-size:200px; * line-height:500px; * font-weight:bold; * text-align:center; * width:100%; * } * `], * template: ` * * *
* * `, * animations: [ * trigger('bannerAnimation', [ * 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%' })) * ]) * ])) * ]) * ] * }) * class BannerCarouselComponent { * allBanners: string[] = ['1', '2', '3', '4']; * selectedIndex: number = 0; * * get banners() { * return [this.allBanners[this.selectedIndex]]; * } * * previous() { * this.selectedIndex = Math.max(this.selectedIndex - 1, 0); * } * * next() { * this.selectedIndex = Math.min(this.selectedIndex + 1, this.allBanners.length - 1); * } * } * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} stateChangeExpr * @param {?} steps * @param {?=} options * @return {?} */ function transition(stateChangeExpr, steps, options) { if (options === void 0) { options = null; } return { type: 1 /* Transition */, expr: stateChangeExpr, animation: steps, options: options }; } /** * `animation` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. * * `var myAnimation = animation(...)` is designed to produce a reusable animation that can be later * invoked in another animation or sequence. Reusable animations are designed to make use of * animation parameters and the produced animation can be used via the `useAnimation` method. * * ``` * var fadeAnimation = animation([ * style({ opacity: '{{ start }}' }), * animate('{{ time }}', * style({ opacity: '{{ end }}'})) * ], { params: { time: '1000ms', start: 0, end: 1 }}); * ``` * * If parameters are attached to an animation then they act as **default parameter values**. When an * animation is invoked via `useAnimation` then parameter values are allowed to be passed in * directly. If any of the passed in parameter values are missing then the default values will be * used. * * ``` * useAnimation(fadeAnimation, { * params: { * time: '2s', * start: 1, * end: 0 * } * }) * ``` * * If one or more parameter values are missing before animated then an error will be thrown. * * \@experimental Animation support is experimental. * @param {?} steps * @param {?=} options * @return {?} */ function animation(steps, options) { if (options === void 0) { options = null; } return { type: 8 /* Reference */, animation: steps, options: options }; } /** * `animateChild` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. It works by allowing a queried element to execute its own * animation within the animation sequence. * * Each time an animation is triggered in angular, the parent animation * will always get priority and any child animations will be blocked. In order * for a child animation to run, the parent animation must query each of the elements * containing child animations and then allow the animations to run using `animateChild`. * * The example HTML code below shows both parent and child elements that have animation * triggers that will execute at the same time. * * ```html * * *
* *
*
Hello
*
* one *
*
* two *
*
* three *
*
* ``` * * Now when the `exp` value changes to true, only the `parentAnimation` animation will animate * because it has priority. However, using `query` and `animateChild` each of the inner animations * can also fire: * * ```ts * // parent-child.component.ts * import {trigger, transition, animate, style, query, animateChild} from '\@angular/animations'; * \@Component({ * selector: 'parent-child-component', * animations: [ * trigger('parentAnimation', [ * transition('false => true', [ * query('header', [ * style({ opacity: 0 }), * animate(500, style({ opacity: 1 })) * ]), * query('\@childAnimation', [ * animateChild() * ]) * ]) * ]), * trigger('childAnimation', [ * transition('false => true', [ * style({ opacity: 0 }), * animate(500, style({ opacity: 1 })) * ]) * ]) * ] * }) * class ParentChildCmp { * exp: boolean = false; * } * ``` * * In the animation code above, when the `parentAnimation` transition kicks off it first queries to * find the header element and fades it in. It then finds each of the sub elements that contain the * `\@childAnimation` trigger and then allows for their animations to fire. * * This example can be further extended by using stagger: * * ```ts * query('\@childAnimation', stagger(100, [ * animateChild() * ])) * ``` * * Now each of the sub animations start off with respect to the `100ms` staggering step. * * ## The first frame of child animations * When sub animations are executed using `animateChild` the animation engine will always apply the * first frame of every sub animation immediately at the start of the animation sequence. This way * the parent animation does not need to set any initial styling data on the sub elements before the * sub animations kick off. * * In the example above the first frame of the `childAnimation`'s `false => true` transition * consists of a style of `opacity: 0`. This is applied immediately when the `parentAnimation` * animation transition sequence starts. Only then when the `\@childAnimation` is queried and called * with `animateChild` will it then animate to its destination of `opacity: 1`. * * Note that this feature designed to be used alongside {\@link query query()} and it will only work * with animations that are assigned using the Angular animation DSL (this means that CSS keyframes * and transitions are not handled by this API). * * \@experimental Animation support is experimental. * @param {?=} options * @return {?} */ function animateChild(options) { if (options === void 0) { options = null; } return { type: 9 /* AnimateChild */, options: options }; } /** * `useAnimation` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. It is used to kick off a reusable animation that is created using {\@link * animation animation()}. * * \@experimental Animation support is experimental. * @param {?} animation * @param {?=} options * @return {?} */ function useAnimation(animation, options) { if (options === void 0) { options = null; } return { type: 10 /* AnimateRef */, animation: animation, options: options }; } /** * `query` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. * * query() is used to find one or more inner elements within the current element that is * being animated within the sequence. The provided animation steps are applied * to the queried element (by default, an array is provided, then this will be * treated as an animation sequence). * * ### Usage * * query() is designed to collect mutiple elements and works internally by using * `element.querySelectorAll`. An additional options object can be provided which * can be used to limit the total amount of items to be collected. * * ```js * query('div', [ * animate(...), * animate(...) * ], { limit: 1 }) * ``` * * query(), by default, will throw an error when zero items are found. If a query * has the `optional` flag set to true then this error will be ignored. * * ```js * query('.some-element-that-may-not-be-there', [ * animate(...), * animate(...) * ], { optional: true }) * ``` * * ### Special Selector Values * * The selector value within a query can collect elements that contain angular-specific * characteristics * using special pseudo-selectors tokens. * * These include: * * - Querying for newly inserted/removed elements using `query(":enter")`/`query(":leave")` * - Querying all currently animating elements using `query(":animating")` * - Querying elements that contain an animation trigger using `query("\@triggerName")` * - Querying all elements that contain an animation triggers using `query("\@*")` * - Including the current element into the animation sequence using `query(":self")` * * * Each of these pseudo-selector tokens can be merged together into a combined query selector * string: * * ``` * query(':self, .record:enter, .record:leave, \@subTrigger', [...]) * ``` * * ### Demo * * ``` * \@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'; * } * } * ``` * * \@experimental Animation support is experimental. * @param {?} selector * @param {?} animation * @param {?=} options * @return {?} */ function query(selector, animation, options) { if (options === void 0) { options = null; } return { type: 11 /* Query */, selector: selector, animation: animation, options: options }; } /** * `stagger` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. It is designed to be used inside of an animation {\@link query query()} * and works by issuing a timing gap between after each queried item is animated. * * ### Usage * * In the example below there is a container element that 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. * * ```html * * *
*
*
* {{ item }} *
*
* ``` * * The component code for this looks as such: * * ```ts * 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(); * } * } * ``` * * And now for the animation trigger code: * * ```ts * 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 })) * ]) * ]) * ]) * ]) * ``` * * Now each time the items are added/removed then either the opacity * fade-in animation will run or each removed item will be faded out. * When either of these animations occur then a stagger effect will be * applied after each item's animation is started. * * \@experimental Animation support is experimental. * @param {?} timings * @param {?} animation * @return {?} */ function stagger(timings, animation) { return { type: 12 /* Stagger */, timings: timings, animation: animation }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 * @suppress {checkTypes} checked by tsc */ /** * AnimationPlayer controls an animation sequence that was produced from a programmatic animation. * (see {\@link AnimationBuilder AnimationBuilder} for more information on how to create programmatic * animations.) * * \@experimental Animation support is experimental. * @record */ /** * \@experimental Animation support is experimental. */ var NoopAnimationPlayer = /** @class */ (function () { function NoopAnimationPlayer() { this._onDoneFns = []; this._onStartFns = []; this._onDestroyFns = []; this._started = false; this._destroyed = false; this._finished = false; this.parentPlayer = null; this.totalTime = 0; } /** * @return {?} */ NoopAnimationPlayer.prototype._onFinish = /** * @return {?} */ function () { if (!this._finished) { this._finished = true; this._onDoneFns.forEach(function (fn) { return fn(); }); this._onDoneFns = []; } }; /** * @param {?} fn * @return {?} */ NoopAnimationPlayer.prototype.onStart = /** * @param {?} fn * @return {?} */ function (fn) { this._onStartFns.push(fn); }; /** * @param {?} fn * @return {?} */ NoopAnimationPlayer.prototype.onDone = /** * @param {?} fn * @return {?} */ function (fn) { this._onDoneFns.push(fn); }; /** * @param {?} fn * @return {?} */ NoopAnimationPlayer.prototype.onDestroy = /** * @param {?} fn * @return {?} */ function (fn) { this._onDestroyFns.push(fn); }; /** * @return {?} */ NoopAnimationPlayer.prototype.hasStarted = /** * @return {?} */ function () { return this._started; }; /** * @return {?} */ NoopAnimationPlayer.prototype.init = /** * @return {?} */ function () { }; /** * @return {?} */ NoopAnimationPlayer.prototype.play = /** * @return {?} */ function () { if (!this.hasStarted()) { this._onStart(); this.triggerMicrotask(); } this._started = true; }; /* @internal */ /** * @return {?} */ NoopAnimationPlayer.prototype.triggerMicrotask = /** * @return {?} */ function () { var _this = this; scheduleMicroTask(function () { return _this._onFinish(); }); }; /** * @return {?} */ NoopAnimationPlayer.prototype._onStart = /** * @return {?} */ function () { this._onStartFns.forEach(function (fn) { return fn(); }); this._onStartFns = []; }; /** * @return {?} */ NoopAnimationPlayer.prototype.pause = /** * @return {?} */ function () { }; /** * @return {?} */ NoopAnimationPlayer.prototype.restart = /** * @return {?} */ function () { }; /** * @return {?} */ NoopAnimationPlayer.prototype.finish = /** * @return {?} */ function () { this._onFinish(); }; /** * @return {?} */ NoopAnimationPlayer.prototype.destroy = /** * @return {?} */ function () { if (!this._destroyed) { this._destroyed = true; if (!this.hasStarted()) { this._onStart(); } this.finish(); this._onDestroyFns.forEach(function (fn) { return fn(); }); this._onDestroyFns = []; } }; /** * @return {?} */ NoopAnimationPlayer.prototype.reset = /** * @return {?} */ function () { }; /** * @param {?} p * @return {?} */ NoopAnimationPlayer.prototype.setPosition = /** * @param {?} p * @return {?} */ function (p) { }; /** * @return {?} */ NoopAnimationPlayer.prototype.getPosition = /** * @return {?} */ function () { return 0; }; /* @internal */ /** * @param {?} phaseName * @return {?} */ NoopAnimationPlayer.prototype.triggerCallback = /** * @param {?} phaseName * @return {?} */ function (phaseName) { var /** @type {?} */ methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; methods.forEach(function (fn) { return fn(); }); methods.length = 0; }; return NoopAnimationPlayer; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ var AnimationGroupPlayer = /** @class */ (function () { function AnimationGroupPlayer(_players) { var _this = this; this._onDoneFns = []; this._onStartFns = []; this._finished = false; this._started = false; this._destroyed = false; this._onDestroyFns = []; this.parentPlayer = null; this.totalTime = 0; this.players = _players; var /** @type {?} */ doneCount = 0; var /** @type {?} */ destroyCount = 0; var /** @type {?} */ startCount = 0; var /** @type {?} */ total = this.players.length; if (total == 0) { scheduleMicroTask(function () { return _this._onFinish(); }); } else { this.players.forEach(function (player) { player.onDone(function () { if (++doneCount == total) { _this._onFinish(); } }); player.onDestroy(function () { if (++destroyCount == total) { _this._onDestroy(); } }); player.onStart(function () { if (++startCount == total) { _this._onStart(); } }); }); } this.totalTime = this.players.reduce(function (time, player) { return Math.max(time, player.totalTime); }, 0); } /** * @return {?} */ AnimationGroupPlayer.prototype._onFinish = /** * @return {?} */ function () { if (!this._finished) { this._finished = true; this._onDoneFns.forEach(function (fn) { return fn(); }); this._onDoneFns = []; } }; /** * @return {?} */ AnimationGroupPlayer.prototype.init = /** * @return {?} */ function () { this.players.forEach(function (player) { return player.init(); }); }; /** * @param {?} fn * @return {?} */ AnimationGroupPlayer.prototype.onStart = /** * @param {?} fn * @return {?} */ function (fn) { this._onStartFns.push(fn); }; /** * @return {?} */ AnimationGroupPlayer.prototype._onStart = /** * @return {?} */ function () { if (!this.hasStarted()) { this._started = true; this._onStartFns.forEach(function (fn) { return fn(); }); this._onStartFns = []; } }; /** * @param {?} fn * @return {?} */ AnimationGroupPlayer.prototype.onDone = /** * @param {?} fn * @return {?} */ function (fn) { this._onDoneFns.push(fn); }; /** * @param {?} fn * @return {?} */ AnimationGroupPlayer.prototype.onDestroy = /** * @param {?} fn * @return {?} */ function (fn) { this._onDestroyFns.push(fn); }; /** * @return {?} */ AnimationGroupPlayer.prototype.hasStarted = /** * @return {?} */ function () { return this._started; }; /** * @return {?} */ AnimationGroupPlayer.prototype.play = /** * @return {?} */ function () { if (!this.parentPlayer) { this.init(); } this._onStart(); this.players.forEach(function (player) { return player.play(); }); }; /** * @return {?} */ AnimationGroupPlayer.prototype.pause = /** * @return {?} */ function () { this.players.forEach(function (player) { return player.pause(); }); }; /** * @return {?} */ AnimationGroupPlayer.prototype.restart = /** * @return {?} */ function () { this.players.forEach(function (player) { return player.restart(); }); }; /** * @return {?} */ AnimationGroupPlayer.prototype.finish = /** * @return {?} */ function () { this._onFinish(); this.players.forEach(function (player) { return player.finish(); }); }; /** * @return {?} */ AnimationGroupPlayer.prototype.destroy = /** * @return {?} */ function () { this._onDestroy(); }; /** * @return {?} */ AnimationGroupPlayer.prototype._onDestroy = /** * @return {?} */ function () { if (!this._destroyed) { this._destroyed = true; this._onFinish(); this.players.forEach(function (player) { return player.destroy(); }); this._onDestroyFns.forEach(function (fn) { return fn(); }); this._onDestroyFns = []; } }; /** * @return {?} */ AnimationGroupPlayer.prototype.reset = /** * @return {?} */ function () { this.players.forEach(function (player) { return player.reset(); }); this._destroyed = false; this._finished = false; this._started = false; }; /** * @param {?} p * @return {?} */ AnimationGroupPlayer.prototype.setPosition = /** * @param {?} p * @return {?} */ function (p) { var /** @type {?} */ timeAtPosition = p * this.totalTime; this.players.forEach(function (player) { var /** @type {?} */ position = player.totalTime ? Math.min(1, timeAtPosition / player.totalTime) : 1; player.setPosition(position); }); }; /** * @return {?} */ AnimationGroupPlayer.prototype.getPosition = /** * @return {?} */ function () { var /** @type {?} */ min = 0; this.players.forEach(function (player) { var /** @type {?} */ p = player.getPosition(); min = Math.min(p, min); }); return min; }; /** * @return {?} */ AnimationGroupPlayer.prototype.beforeDestroy = /** * @return {?} */ function () { this.players.forEach(function (player) { if (player.beforeDestroy) { player.beforeDestroy(); } }); }; /* @internal */ /** * @param {?} phaseName * @return {?} */ AnimationGroupPlayer.prototype.triggerCallback = /** * @param {?} phaseName * @return {?} */ function (phaseName) { var /** @type {?} */ methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; methods.forEach(function (fn) { return fn(); }); methods.length = 0; }; return AnimationGroupPlayer; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var ɵPRE_STYLE = '!'; /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * @module * @description * Entry point for all public APIs of this package. */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=animations.js.map /***/ }), /***/ "./node_modules/@angular/animations/esm5/browser.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AnimationDriver; }); /* unused harmony export ɵAnimation */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return AnimationStyleNormalizer; }); /* unused harmony export ɵNoopAnimationStyleNormalizer */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return WebAnimationsStyleNormalizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return NoopAnimationDriver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return AnimationEngine; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return WebAnimationsDriver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return supportsWebAnimations; }); /* unused harmony export ɵWebAnimationsPlayer */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_animations__ = __webpack_require__("./node_modules/@angular/animations/esm5/animations.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_tslib__ = __webpack_require__("./node_modules/tslib/tslib.es6.js"); /** * @license Angular v5.2.2 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @param {?} players * @return {?} */ function optimizeGroupPlayer(players) { switch (players.length) { case 0: return new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["NoopAnimationPlayer"](); case 1: return players[0]; default: return new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["ɵAnimationGroupPlayer"](players); } } /** * @param {?} driver * @param {?} normalizer * @param {?} element * @param {?} keyframes * @param {?=} preStyles * @param {?=} postStyles * @return {?} */ function normalizeKeyframes(driver, normalizer, element, keyframes, preStyles, postStyles) { if (preStyles === void 0) { preStyles = {}; } if (postStyles === void 0) { postStyles = {}; } var /** @type {?} */ errors = []; var /** @type {?} */ normalizedKeyframes = []; var /** @type {?} */ previousOffset = -1; var /** @type {?} */ previousKeyframe = null; keyframes.forEach(function (kf) { var /** @type {?} */ offset = /** @type {?} */ (kf['offset']); var /** @type {?} */ isSameOffset = offset == previousOffset; var /** @type {?} */ normalizedKeyframe = (isSameOffset && previousKeyframe) || {}; Object.keys(kf).forEach(function (prop) { var /** @type {?} */ normalizedProp = prop; var /** @type {?} */ normalizedValue = kf[prop]; if (prop !== 'offset') { normalizedProp = normalizer.normalizePropertyName(normalizedProp, errors); switch (normalizedValue) { case __WEBPACK_IMPORTED_MODULE_0__angular_animations__["ɵPRE_STYLE"]: normalizedValue = preStyles[prop]; break; case __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]: normalizedValue = postStyles[prop]; break; default: normalizedValue = normalizer.normalizeStyleValue(prop, normalizedProp, normalizedValue, errors); break; } } normalizedKeyframe[normalizedProp] = normalizedValue; }); if (!isSameOffset) { normalizedKeyframes.push(normalizedKeyframe); } previousKeyframe = normalizedKeyframe; previousOffset = offset; }); if (errors.length) { var /** @type {?} */ LINE_START = '\n - '; throw new Error("Unable to animate due to the following errors:" + LINE_START + 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(function () { return callback(event && copyAnimationEvent(event, 'start', player.totalTime)); }); break; case 'done': player.onDone(function () { return callback(event && copyAnimationEvent(event, 'done', player.totalTime)); }); break; case 'destroy': player.onDestroy(function () { return callback(event && copyAnimationEvent(event, 'destroy', player.totalTime)); }); break; } } /** * @param {?} e * @param {?=} phaseName * @param {?=} totalTime * @return {?} */ function copyAnimationEvent(e, phaseName, totalTime) { var /** @type {?} */ event = makeAnimationEvent(e.element, e.triggerName, e.fromState, e.toState, phaseName || e.phaseName, totalTime == undefined ? e.totalTime : totalTime); var /** @type {?} */ 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 * @return {?} */ function makeAnimationEvent(element, triggerName, fromState, toState, phaseName, totalTime) { if (phaseName === void 0) { phaseName = ''; } if (totalTime === void 0) { totalTime = 0; } return { element: element, triggerName: triggerName, fromState: fromState, toState: toState, phaseName: phaseName, totalTime: totalTime }; } /** * @param {?} map * @param {?} key * @param {?} defaultValue * @return {?} */ function getOrSetAsInMap(map, key, defaultValue) { var /** @type {?} */ 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) { var /** @type {?} */ separatorPos = command.indexOf(':'); var /** @type {?} */ id = command.substring(1, separatorPos); var /** @type {?} */ action = command.substr(separatorPos + 1); return [id, action]; } var _contains = function (elm1, elm2) { return false; }; var _matches = function (element, selector) { return false; }; var _query = function (element, selector, multi) { return []; }; if (typeof Element != 'undefined') { // this is well supported in all browsers _contains = function (elm1, elm2) { return /** @type {?} */ (elm1.contains(elm2)); }; if (Element.prototype.matches) { _matches = function (element, selector) { return element.matches(selector); }; } else { var /** @type {?} */ proto = /** @type {?} */ (Element.prototype); var /** @type {?} */ fn_1 = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector; if (fn_1) { _matches = function (element, selector) { return fn_1.apply(element, [selector]); }; } } _query = function (element, selector, multi) { var /** @type {?} */ results = []; if (multi) { results.push.apply(results, element.querySelectorAll(selector)); } else { var /** @type {?} */ 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 } var _CACHED_BODY = null; 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; } var /** @type {?} */ result = true; if (/** @type {?} */ ((_CACHED_BODY)).style && !containsVendorPrefix(prop)) { result = prop in /** @type {?} */ ((_CACHED_BODY)).style; if (!result && _IS_WEBKIT) { var /** @type {?} */ 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; } var matchesElement = _matches; var containsElement = _contains; var invokeQuery = _query; /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * \@experimental */ var NoopAnimationDriver = /** @class */ (function () { function NoopAnimationDriver() { } /** * @param {?} prop * @return {?} */ NoopAnimationDriver.prototype.validateStyleProperty = /** * @param {?} prop * @return {?} */ function (prop) { return validateStyleProperty(prop); }; /** * @param {?} element * @param {?} selector * @return {?} */ NoopAnimationDriver.prototype.matchesElement = /** * @param {?} element * @param {?} selector * @return {?} */ function (element, selector) { return matchesElement(element, selector); }; /** * @param {?} elm1 * @param {?} elm2 * @return {?} */ NoopAnimationDriver.prototype.containsElement = /** * @param {?} elm1 * @param {?} elm2 * @return {?} */ function (elm1, elm2) { return containsElement(elm1, elm2); }; /** * @param {?} element * @param {?} selector * @param {?} multi * @return {?} */ NoopAnimationDriver.prototype.query = /** * @param {?} element * @param {?} selector * @param {?} multi * @return {?} */ function (element, selector, multi) { return invokeQuery(element, selector, multi); }; /** * @param {?} element * @param {?} prop * @param {?=} defaultValue * @return {?} */ NoopAnimationDriver.prototype.computeStyle = /** * @param {?} element * @param {?} prop * @param {?=} defaultValue * @return {?} */ function (element, prop, defaultValue) { return defaultValue || ''; }; /** * @param {?} element * @param {?} keyframes * @param {?} duration * @param {?} delay * @param {?} easing * @param {?=} previousPlayers * @return {?} */ NoopAnimationDriver.prototype.animate = /** * @param {?} element * @param {?} keyframes * @param {?} duration * @param {?} delay * @param {?} easing * @param {?=} previousPlayers * @return {?} */ function (element, keyframes, duration, delay, easing, previousPlayers) { if (previousPlayers === void 0) { previousPlayers = []; } return new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["NoopAnimationPlayer"](); }; return NoopAnimationDriver; }()); /** * \@experimental * @abstract */ var AnimationDriver = /** @class */ (function () { function AnimationDriver() { } AnimationDriver.NOOP = new NoopAnimationDriver(); return AnimationDriver; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var ONE_SECOND = 1000; var SUBSTITUTION_EXPR_START = '{{'; var SUBSTITUTION_EXPR_END = '}}'; var ENTER_CLASSNAME = 'ng-enter'; var LEAVE_CLASSNAME = 'ng-leave'; var NG_TRIGGER_CLASSNAME = 'ng-trigger'; var NG_TRIGGER_SELECTOR = '.ng-trigger'; var NG_ANIMATING_CLASSNAME = 'ng-animating'; var NG_ANIMATING_SELECTOR = '.ng-animating'; /** * @param {?} value * @return {?} */ function resolveTimingValue(value) { if (typeof value == 'number') return value; var /** @type {?} */ matches = (/** @type {?} */ (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) { var /** @type {?} */ regex = /^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i; var /** @type {?} */ duration; var /** @type {?} */ delay = 0; var /** @type {?} */ easing = ''; if (typeof exp === 'string') { var /** @type {?} */ matches = exp.match(regex); if (matches === null) { errors.push("The provided timing value \"" + exp + "\" is invalid."); return { duration: 0, delay: 0, easing: '' }; } duration = _convertTimeValueToMS(parseFloat(matches[1]), matches[2]); var /** @type {?} */ delayMatch = matches[3]; if (delayMatch != null) { delay = _convertTimeValueToMS(Math.floor(parseFloat(delayMatch)), matches[4]); } var /** @type {?} */ easingVal = matches[5]; if (easingVal) { easing = easingVal; } } else { duration = /** @type {?} */ (exp); } if (!allowNegativeValues) { var /** @type {?} */ containsErrors = false; var /** @type {?} */ startIndex = errors.length; if (duration < 0) { errors.push("Duration values below 0 are not allowed for this animation step."); containsErrors = true; } if (delay < 0) { errors.push("Delay values below 0 are not allowed for this animation step."); containsErrors = true; } if (containsErrors) { errors.splice(startIndex, 0, "The provided timing value \"" + exp + "\" is invalid."); } } return { duration: duration, delay: delay, easing: easing }; } /** * @param {?} obj * @param {?=} destination * @return {?} */ function copyObj(obj, destination) { if (destination === void 0) { destination = {}; } Object.keys(obj).forEach(function (prop) { destination[prop] = obj[prop]; }); return destination; } /** * @param {?} styles * @return {?} */ function normalizeStyles(styles) { var /** @type {?} */ normalizedStyles = {}; if (Array.isArray(styles)) { styles.forEach(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, destination) { if (destination === void 0) { destination = {}; } if (readPrototype) { // we make use of a for-in loop so that the // prototypically inherited properties are // revealed from the backFill map for (var /** @type {?} */ prop in styles) { destination[prop] = styles[prop]; } } else { copyObj(styles, destination); } return destination; } /** * @param {?} element * @param {?} styles * @return {?} */ function setStyles(element, styles) { if (element['style']) { Object.keys(styles).forEach(function (prop) { var /** @type {?} */ camelProp = dashCaseToCamelCase(prop); element.style[camelProp] = styles[prop]; }); } } /** * @param {?} element * @param {?} styles * @return {?} */ function eraseStyles(element, styles) { if (element['style']) { Object.keys(styles).forEach(function (prop) { var /** @type {?} */ camelProp = dashCaseToCamelCase(prop); element.style[camelProp] = ''; }); } } /** * @param {?} steps * @return {?} */ function normalizeAnimationEntry(steps) { if (Array.isArray(steps)) { if (steps.length == 1) return steps[0]; return Object(__WEBPACK_IMPORTED_MODULE_0__angular_animations__["sequence"])(steps); } return /** @type {?} */ (steps); } /** * @param {?} value * @param {?} options * @param {?} errors * @return {?} */ function validateStyleParams(value, options, errors) { var /** @type {?} */ params = options.params || {}; var /** @type {?} */ matches = extractStyleParams(value); if (matches.length) { matches.forEach(function (varName) { if (!params.hasOwnProperty(varName)) { errors.push("Unable to resolve the local animation param " + varName + " in the given list of values"); } }); } } var PARAM_REGEX = new RegExp(SUBSTITUTION_EXPR_START + "\\s*(.+?)\\s*" + SUBSTITUTION_EXPR_END, 'g'); /** * @param {?} value * @return {?} */ function extractStyleParams(value) { var /** @type {?} */ params = []; if (typeof value === 'string') { var /** @type {?} */ val = value.toString(); var /** @type {?} */ match = void 0; while (match = PARAM_REGEX.exec(val)) { params.push(/** @type {?} */ (match[1])); } PARAM_REGEX.lastIndex = 0; } return params; } /** * @param {?} value * @param {?} params * @param {?} errors * @return {?} */ function interpolateParams(value, params, errors) { var /** @type {?} */ original = value.toString(); var /** @type {?} */ str = original.replace(PARAM_REGEX, function (_, varName) { var /** @type {?} */ localVal = params[varName]; // this means that the value was never overidden by the data passed in by the user if (!params.hasOwnProperty(varName)) { errors.push("Please provide a value for the animation param " + varName); localVal = ''; } return localVal.toString(); }); // we do this to assert that numeric values stay as they are return str == original ? value : str; } /** * @param {?} iterator * @return {?} */ function iteratorToArray(iterator) { var /** @type {?} */ arr = []; var /** @type {?} */ item = iterator.next(); while (!item.done) { arr.push(item.value); item = iterator.next(); } return arr; } /** * @param {?} source * @param {?} destination * @return {?} */ var DASH_CASE_REGEXP = /-+([a-z0-9])/g; /** * @param {?} input * @return {?} */ function dashCaseToCamelCase(input) { return input.replace(DASH_CASE_REGEXP, function () { var m = []; for (var _i = 0; _i < arguments.length; _i++) { m[_i] = arguments[_i]; } return m[1].toUpperCase(); }); } /** * @param {?} duration * @param {?} delay * @return {?} */ function allowPreviousPlayerStylesMerge(duration, delay) { return duration === 0 || delay === 0; } /** * @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 #" + node.type); } } /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ var ANY_STATE = '*'; /** * @param {?} transitionValue * @param {?} errors * @return {?} */ function parseTransitionExpr(transitionValue, errors) { var /** @type {?} */ expressions = []; if (typeof transitionValue == 'string') { (/** @type {?} */ (transitionValue)) .split(/\s*,\s*/) .forEach(function (str) { return parseInnerTransitionStr(str, expressions, errors); }); } else { expressions.push(/** @type {?} */ (transitionValue)); } return expressions; } /** * @param {?} eventStr * @param {?} expressions * @param {?} errors * @return {?} */ function parseInnerTransitionStr(eventStr, expressions, errors) { if (eventStr[0] == ':') { var /** @type {?} */ result = parseAnimationAlias(eventStr, errors); if (typeof result == 'function') { expressions.push(result); return; } eventStr = /** @type {?} */ (result); } var /** @type {?} */ match = eventStr.match(/^(\*|[-\w]+)\s*()\s*(\*|[-\w]+)$/); if (match == null || match.length < 4) { errors.push("The provided transition expression \"" + eventStr + "\" is not supported"); return expressions; } var /** @type {?} */ fromState = match[1]; var /** @type {?} */ separator = match[2]; var /** @type {?} */ toState = match[3]; expressions.push(makeLambdaFromStates(fromState, toState)); var /** @type {?} */ isFullAnyStateExpr = fromState == ANY_STATE && toState == ANY_STATE; if (separator[0] == '<' && !isFullAnyStateExpr) { expressions.push(makeLambdaFromStates(toState, fromState)); } } /** * @param {?} alias * @param {?} errors * @return {?} */ function parseAnimationAlias(alias, errors) { switch (alias) { case ':enter': return 'void => *'; case ':leave': return '* => void'; case ':increment': return function (fromState, toState) { return parseFloat(toState) > parseFloat(fromState); }; case ':decrement': return function (fromState, toState) { return parseFloat(toState) < parseFloat(fromState); }; default: errors.push("The transition alias value \"" + 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... var TRUE_BOOLEAN_VALUES = new Set(['true', '1']); var FALSE_BOOLEAN_VALUES = new Set(['false', '0']); /** * @param {?} lhs * @param {?} rhs * @return {?} */ function makeLambdaFromStates(lhs, rhs) { var /** @type {?} */ LHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(lhs) || FALSE_BOOLEAN_VALUES.has(lhs); var /** @type {?} */ RHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(rhs) || FALSE_BOOLEAN_VALUES.has(rhs); return function (fromState, toState) { var /** @type {?} */ lhsMatch = lhs == ANY_STATE || lhs == fromState; var /** @type {?} */ rhsMatch = rhs == ANY_STATE || rhs == toState; if (!lhsMatch && LHS_MATCH_BOOLEAN && typeof fromState === 'boolean') { lhsMatch = fromState ? TRUE_BOOLEAN_VALUES.has(lhs) : FALSE_BOOLEAN_VALUES.has(lhs); } if (!rhsMatch && RHS_MATCH_BOOLEAN && typeof toState === 'boolean') { rhsMatch = toState ? TRUE_BOOLEAN_VALUES.has(rhs) : FALSE_BOOLEAN_VALUES.has(rhs); } return lhsMatch && rhsMatch; }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var SELF_TOKEN = ':self'; var SELF_TOKEN_REGEX = new RegExp("s*" + SELF_TOKEN + "s*,?", 'g'); /** * @param {?} driver * @param {?} metadata * @param {?} errors * @return {?} */ function buildAnimationAst(driver, metadata, errors) { return new AnimationAstBuilderVisitor(driver).build(metadata, errors); } var ROOT_SELECTOR = ''; var AnimationAstBuilderVisitor = /** @class */ (function () { function AnimationAstBuilderVisitor(_driver) { this._driver = _driver; } /** * @param {?} metadata * @param {?} errors * @return {?} */ AnimationAstBuilderVisitor.prototype.build = /** * @param {?} metadata * @param {?} errors * @return {?} */ function (metadata, errors) { var /** @type {?} */ context = new AnimationAstBuilderContext(errors); this._resetContextStyleTimingState(context); return /** @type {?} */ (visitDslNode(this, normalizeAnimationEntry(metadata), context)); }; /** * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype._resetContextStyleTimingState = /** * @param {?} context * @return {?} */ function (context) { context.currentQuerySelector = ROOT_SELECTOR; context.collectedStyles = {}; context.collectedStyles[ROOT_SELECTOR] = {}; context.currentTime = 0; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitTrigger = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var _this = this; var /** @type {?} */ queryCount = context.queryCount = 0; var /** @type {?} */ depCount = context.depCount = 0; var /** @type {?} */ states = []; var /** @type {?} */ transitions = []; if (metadata.name.charAt(0) == '@') { context.errors.push('animation triggers cannot be prefixed with an `@` sign (e.g. trigger(\'@foo\', [...]))'); } metadata.definitions.forEach(function (def) { _this._resetContextStyleTimingState(context); if (def.type == 0 /* State */) { var /** @type {?} */ stateDef_1 = /** @type {?} */ (def); var /** @type {?} */ name_1 = stateDef_1.name; name_1.split(/\s*,\s*/).forEach(function (n) { stateDef_1.name = n; states.push(_this.visitState(stateDef_1, context)); }); stateDef_1.name = name_1; } else if (def.type == 1 /* Transition */) { var /** @type {?} */ transition = _this.visitTransition(/** @type {?} */ (def), context); queryCount += transition.queryCount; depCount += transition.depCount; transitions.push(transition); } else { context.errors.push('only state() and transition() definitions can sit inside of a trigger()'); } }); return { type: 7 /* Trigger */, name: metadata.name, states: states, transitions: transitions, queryCount: queryCount, depCount: depCount, options: null }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitState = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var /** @type {?} */ styleAst = this.visitStyle(metadata.styles, context); var /** @type {?} */ astParams = (metadata.options && metadata.options.params) || null; if (styleAst.containsDynamicStyles) { var /** @type {?} */ missingSubs_1 = new Set(); var /** @type {?} */ params_1 = astParams || {}; styleAst.styles.forEach(function (value) { if (isObject(value)) { var /** @type {?} */ stylesObj_1 = /** @type {?} */ (value); Object.keys(stylesObj_1).forEach(function (prop) { extractStyleParams(stylesObj_1[prop]).forEach(function (sub) { if (!params_1.hasOwnProperty(sub)) { missingSubs_1.add(sub); } }); }); } }); if (missingSubs_1.size) { var /** @type {?} */ missingSubsArr = iteratorToArray(missingSubs_1.values()); context.errors.push("state(\"" + metadata.name + "\", ...) must define default values for all the following style substitutions: " + missingSubsArr.join(', ')); } } return { type: 0 /* State */, name: metadata.name, style: styleAst, options: astParams ? { params: astParams } : null }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitTransition = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { context.queryCount = 0; context.depCount = 0; var /** @type {?} */ animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context); var /** @type {?} */ matchers = parseTransitionExpr(metadata.expr, context.errors); return { type: 1 /* Transition */, matchers: matchers, animation: animation, queryCount: context.queryCount, depCount: context.depCount, options: normalizeAnimationOptions(metadata.options) }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitSequence = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var _this = this; return { type: 2 /* Sequence */, steps: metadata.steps.map(function (s) { return visitDslNode(_this, s, context); }), options: normalizeAnimationOptions(metadata.options) }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitGroup = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var _this = this; var /** @type {?} */ currentTime = context.currentTime; var /** @type {?} */ furthestTime = 0; var /** @type {?} */ steps = metadata.steps.map(function (step) { context.currentTime = currentTime; var /** @type {?} */ innerAst = visitDslNode(_this, step, context); furthestTime = Math.max(furthestTime, context.currentTime); return innerAst; }); context.currentTime = furthestTime; return { type: 3 /* Group */, steps: steps, options: normalizeAnimationOptions(metadata.options) }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitAnimate = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var /** @type {?} */ timingAst = constructTimingAst(metadata.timings, context.errors); context.currentAnimateTimings = timingAst; var /** @type {?} */ styleAst; var /** @type {?} */ styleMetadata = metadata.styles ? metadata.styles : Object(__WEBPACK_IMPORTED_MODULE_0__angular_animations__["style"])({}); if (styleMetadata.type == 5 /* Keyframes */) { styleAst = this.visitKeyframes(/** @type {?} */ (styleMetadata), context); } else { var /** @type {?} */ styleMetadata_1 = /** @type {?} */ (metadata.styles); var /** @type {?} */ isEmpty = false; if (!styleMetadata_1) { isEmpty = true; var /** @type {?} */ newStyleData = {}; if (timingAst.easing) { newStyleData['easing'] = timingAst.easing; } styleMetadata_1 = Object(__WEBPACK_IMPORTED_MODULE_0__angular_animations__["style"])(newStyleData); } context.currentTime += timingAst.duration + timingAst.delay; var /** @type {?} */ _styleAst = this.visitStyle(styleMetadata_1, context); _styleAst.isEmptyStep = isEmpty; styleAst = _styleAst; } context.currentAnimateTimings = null; return { type: 4 /* Animate */, timings: timingAst, style: styleAst, options: null }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitStyle = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var /** @type {?} */ ast = this._makeStyleAst(metadata, context); this._validateStyleAst(ast, context); return ast; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype._makeStyleAst = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var /** @type {?} */ styles = []; if (Array.isArray(metadata.styles)) { (/** @type {?} */ (metadata.styles)).forEach(function (styleTuple) { if (typeof styleTuple == 'string') { if (styleTuple == __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]) { styles.push(/** @type {?} */ (styleTuple)); } else { context.errors.push("The provided style string value " + styleTuple + " is not allowed."); } } else { styles.push(/** @type {?} */ (styleTuple)); } }); } else { styles.push(metadata.styles); } var /** @type {?} */ containsDynamicStyles = false; var /** @type {?} */ collectedEasing = null; styles.forEach(function (styleData) { if (isObject(styleData)) { var /** @type {?} */ styleMap = /** @type {?} */ (styleData); var /** @type {?} */ easing = styleMap['easing']; if (easing) { collectedEasing = /** @type {?} */ (easing); delete styleMap['easing']; } if (!containsDynamicStyles) { for (var /** @type {?} */ prop in styleMap) { var /** @type {?} */ value = styleMap[prop]; if (value.toString().indexOf(SUBSTITUTION_EXPR_START) >= 0) { containsDynamicStyles = true; break; } } } } }); return { type: 6 /* Style */, styles: styles, easing: collectedEasing, offset: metadata.offset, containsDynamicStyles: containsDynamicStyles, options: null }; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype._validateStyleAst = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var _this = this; var /** @type {?} */ timings = context.currentAnimateTimings; var /** @type {?} */ endTime = context.currentTime; var /** @type {?} */ startTime = context.currentTime; if (timings && startTime > 0) { startTime -= timings.duration + timings.delay; } ast.styles.forEach(function (tuple) { if (typeof tuple == 'string') return; Object.keys(tuple).forEach(function (prop) { if (!_this._driver.validateStyleProperty(prop)) { context.errors.push("The provided animation property \"" + prop + "\" is not a supported CSS property for animations"); return; } var /** @type {?} */ collectedStyles = context.collectedStyles[/** @type {?} */ ((context.currentQuerySelector))]; var /** @type {?} */ collectedEntry = collectedStyles[prop]; var /** @type {?} */ updateCollectedStyle = true; if (collectedEntry) { if (startTime != endTime && startTime >= collectedEntry.startTime && endTime <= collectedEntry.endTime) { context.errors.push("The CSS property \"" + prop + "\" that exists between the times of \"" + collectedEntry.startTime + "ms\" and \"" + collectedEntry.endTime + "ms\" is also being animated in a parallel animation between the times of \"" + startTime + "ms\" and \"" + endTime + "ms\""); updateCollectedStyle = false; } // we always choose the smaller start time value since we // want to have a record of the entire animation window where // the style property is being animated in between startTime = collectedEntry.startTime; } if (updateCollectedStyle) { collectedStyles[prop] = { startTime: startTime, endTime: endTime }; } if (context.options) { validateStyleParams(tuple[prop], context.options, context.errors); } }); }); }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitKeyframes = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var _this = this; var /** @type {?} */ ast = { type: 5 /* Keyframes */, styles: [], options: null }; if (!context.currentAnimateTimings) { context.errors.push("keyframes() must be placed inside of a call to animate()"); return ast; } var /** @type {?} */ MAX_KEYFRAME_OFFSET = 1; var /** @type {?} */ totalKeyframesWithOffsets = 0; var /** @type {?} */ offsets = []; var /** @type {?} */ offsetsOutOfOrder = false; var /** @type {?} */ keyframesOutOfRange = false; var /** @type {?} */ previousOffset = 0; var /** @type {?} */ keyframes = metadata.steps.map(function (styles) { var /** @type {?} */ style$$1 = _this._makeStyleAst(styles, context); var /** @type {?} */ offsetVal = style$$1.offset != null ? style$$1.offset : consumeOffset(style$$1.styles); var /** @type {?} */ offset = 0; if (offsetVal != null) { totalKeyframesWithOffsets++; offset = style$$1.offset = offsetVal; } keyframesOutOfRange = keyframesOutOfRange || offset < 0 || offset > 1; offsetsOutOfOrder = offsetsOutOfOrder || offset < previousOffset; previousOffset = offset; offsets.push(offset); return style$$1; }); if (keyframesOutOfRange) { context.errors.push("Please ensure that all keyframe offsets are between 0 and 1"); } if (offsetsOutOfOrder) { context.errors.push("Please ensure that all keyframe offsets are in order"); } var /** @type {?} */ length = metadata.steps.length; var /** @type {?} */ generatedOffset = 0; if (totalKeyframesWithOffsets > 0 && totalKeyframesWithOffsets < length) { context.errors.push("Not all style() steps within the declared keyframes() contain offsets"); } else if (totalKeyframesWithOffsets == 0) { generatedOffset = MAX_KEYFRAME_OFFSET / (length - 1); } var /** @type {?} */ limit = length - 1; var /** @type {?} */ currentTime = context.currentTime; var /** @type {?} */ currentAnimateTimings = /** @type {?} */ ((context.currentAnimateTimings)); var /** @type {?} */ animateDuration = currentAnimateTimings.duration; keyframes.forEach(function (kf, i) { var /** @type {?} */ offset = generatedOffset > 0 ? (i == limit ? 1 : (generatedOffset * i)) : offsets[i]; var /** @type {?} */ durationUpToThisFrame = offset * animateDuration; context.currentTime = currentTime + currentAnimateTimings.delay + durationUpToThisFrame; currentAnimateTimings.duration = durationUpToThisFrame; _this._validateStyleAst(kf, context); kf.offset = offset; ast.styles.push(kf); }); return ast; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitReference = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { return { type: 8 /* Reference */, animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), options: normalizeAnimationOptions(metadata.options) }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitAnimateChild = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { context.depCount++; return { type: 9 /* AnimateChild */, options: normalizeAnimationOptions(metadata.options) }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitAnimateRef = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { return { type: 10 /* AnimateRef */, animation: this.visitReference(metadata.animation, context), options: normalizeAnimationOptions(metadata.options) }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitQuery = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { var /** @type {?} */ parentSelector = /** @type {?} */ ((context.currentQuerySelector)); var /** @type {?} */ options = /** @type {?} */ ((metadata.options || {})); context.queryCount++; context.currentQuery = metadata; var _a = normalizeSelector(metadata.selector), selector = _a[0], includeSelf = _a[1]; context.currentQuerySelector = parentSelector.length ? (parentSelector + ' ' + selector) : selector; getOrSetAsInMap(context.collectedStyles, context.currentQuerySelector, {}); var /** @type {?} */ animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context); context.currentQuery = null; context.currentQuerySelector = parentSelector; return { type: 11 /* Query */, selector: selector, limit: options.limit || 0, optional: !!options.optional, includeSelf: includeSelf, animation: animation, originalSelector: metadata.selector, options: normalizeAnimationOptions(metadata.options) }; }; /** * @param {?} metadata * @param {?} context * @return {?} */ AnimationAstBuilderVisitor.prototype.visitStagger = /** * @param {?} metadata * @param {?} context * @return {?} */ function (metadata, context) { if (!context.currentQuery) { context.errors.push("stagger() can only be used inside of query()"); } var /** @type {?} */ timings = metadata.timings === 'full' ? { duration: 0, delay: 0, easing: 'full' } : resolveTiming(metadata.timings, context.errors, true); return { type: 12 /* Stagger */, animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), timings: timings, options: null }; }; return AnimationAstBuilderVisitor; }()); /** * @param {?} selector * @return {?} */ function normalizeSelector(selector) { var /** @type {?} */ hasAmpersand = selector.split(/\s*,\s*/).find(function (token) { return token == SELF_TOKEN; }) ? true : false; if (hasAmpersand) { selector = selector.replace(SELF_TOKEN_REGEX, ''); } // the :enter and :leave selectors are filled in at runtime during timeline building selector = selector.replace(/@\*/g, NG_TRIGGER_SELECTOR) .replace(/@\w+/g, function (match) { return NG_TRIGGER_SELECTOR + '-' + match.substr(1); }) .replace(/:animating/g, NG_ANIMATING_SELECTOR); return [selector, hasAmpersand]; } /** * @param {?} obj * @return {?} */ function normalizeParams(obj) { return obj ? copyObj(obj) : null; } var AnimationAstBuilderContext = /** @class */ (function () { function AnimationAstBuilderContext(errors) { this.errors = errors; this.queryCount = 0; this.depCount = 0; this.currentTransition = null; this.currentQuery = null; this.currentQuerySelector = null; this.currentAnimateTimings = null; this.currentTime = 0; this.collectedStyles = {}; this.options = null; } return AnimationAstBuilderContext; }()); /** * @param {?} styles * @return {?} */ function consumeOffset(styles) { if (typeof styles == 'string') return null; var /** @type {?} */ offset = null; if (Array.isArray(styles)) { styles.forEach(function (styleTuple) { if (isObject(styleTuple) && styleTuple.hasOwnProperty('offset')) { var /** @type {?} */ obj = /** @type {?} */ (styleTuple); offset = parseFloat(/** @type {?} */ (obj['offset'])); delete obj['offset']; } }); } else if (isObject(styles) && styles.hasOwnProperty('offset')) { var /** @type {?} */ obj = /** @type {?} */ (styles); offset = parseFloat(/** @type {?} */ (obj['offset'])); delete obj['offset']; } return offset; } /** * @param {?} value * @return {?} */ function isObject(value) { return !Array.isArray(value) && typeof value == 'object'; } /** * @param {?} value * @param {?} errors * @return {?} */ function constructTimingAst(value, errors) { var /** @type {?} */ timings = null; if (value.hasOwnProperty('duration')) { timings = /** @type {?} */ (value); } else if (typeof value == 'number') { var /** @type {?} */ duration = resolveTiming(/** @type {?} */ (value), errors).duration; return makeTimingAst(/** @type {?} */ (duration), 0, ''); } var /** @type {?} */ strValue = /** @type {?} */ (value); var /** @type {?} */ isDynamic = strValue.split(/\s+/).some(function (v) { return v.charAt(0) == '{' && v.charAt(1) == '{'; }); if (isDynamic) { var /** @type {?} */ 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 * @suppress {checkTypes} checked by tsc */ /** * @record */ /** * @param {?} element * @param {?} keyframes * @param {?} preStyleProps * @param {?} postStyleProps * @param {?} duration * @param {?} delay * @param {?=} easing * @param {?=} subTimeline * @return {?} */ function createTimelineInstruction(element, keyframes, preStyleProps, postStyleProps, duration, delay, easing, subTimeline) { if (easing === void 0) { easing = null; } if (subTimeline === void 0) { subTimeline = false; } return { type: 1 /* TimelineAnimation */, element: element, keyframes: keyframes, preStyleProps: preStyleProps, postStyleProps: postStyleProps, duration: duration, delay: delay, totalTime: duration + delay, easing: easing, subTimeline: subTimeline }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var ElementInstructionMap = /** @class */ (function () { function ElementInstructionMap() { this._map = new Map(); } /** * @param {?} element * @return {?} */ ElementInstructionMap.prototype.consume = /** * @param {?} element * @return {?} */ function (element) { var /** @type {?} */ instructions = this._map.get(element); if (instructions) { this._map.delete(element); } else { instructions = []; } return instructions; }; /** * @param {?} element * @param {?} instructions * @return {?} */ ElementInstructionMap.prototype.append = /** * @param {?} element * @param {?} instructions * @return {?} */ function (element, instructions) { var /** @type {?} */ existingInstructions = this._map.get(element); if (!existingInstructions) { this._map.set(element, existingInstructions = []); } existingInstructions.push.apply(existingInstructions, instructions); }; /** * @param {?} element * @return {?} */ ElementInstructionMap.prototype.has = /** * @param {?} element * @return {?} */ function (element) { return this._map.has(element); }; /** * @return {?} */ ElementInstructionMap.prototype.clear = /** * @return {?} */ function () { this._map.clear(); }; return ElementInstructionMap; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var ONE_FRAME_IN_MILLISECONDS = 1; var ENTER_TOKEN = ':enter'; var ENTER_TOKEN_REGEX = new RegExp(ENTER_TOKEN, 'g'); var LEAVE_TOKEN = ':leave'; var LEAVE_TOKEN_REGEX = new RegExp(LEAVE_TOKEN, 'g'); /** * @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, startingStyles, finalStyles, options, subInstructions, errors) { if (startingStyles === void 0) { startingStyles = {}; } if (finalStyles === void 0) { finalStyles = {}; } if (errors === void 0) { errors = []; } return new AnimationTimelineBuilderVisitor().buildKeyframes(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors); } var AnimationTimelineBuilderVisitor = /** @class */ (function () { function AnimationTimelineBuilderVisitor() { } /** * @param {?} driver * @param {?} rootElement * @param {?} ast * @param {?} enterClassName * @param {?} leaveClassName * @param {?} startingStyles * @param {?} finalStyles * @param {?} options * @param {?=} subInstructions * @param {?=} errors * @return {?} */ AnimationTimelineBuilderVisitor.prototype.buildKeyframes = /** * @param {?} driver * @param {?} rootElement * @param {?} ast * @param {?} enterClassName * @param {?} leaveClassName * @param {?} startingStyles * @param {?} finalStyles * @param {?} options * @param {?=} subInstructions * @param {?=} errors * @return {?} */ function (driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors) { if (errors === void 0) { errors = []; } subInstructions = subInstructions || new ElementInstructionMap(); var /** @type {?} */ 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 var /** @type {?} */ timelines = context.timelines.filter(function (timeline) { return timeline.containsAnimation(); }); if (timelines.length && Object.keys(finalStyles).length) { var /** @type {?} */ tl = timelines[timelines.length - 1]; if (!tl.allowOnlyTimelineStyles()) { tl.setStyles([finalStyles], null, context.errors, options); } } return timelines.length ? timelines.map(function (timeline) { return timeline.buildKeyframes(); }) : [createTimelineInstruction(rootElement, [], [], [], 0, 0, '', false)]; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitTrigger = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { // these values are not visited in this AST }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitState = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { // these values are not visited in this AST }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitTransition = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { // these values are not visited in this AST }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitAnimateChild = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var /** @type {?} */ elementInstructions = context.subInstructions.consume(context.element); if (elementInstructions) { var /** @type {?} */ innerContext = context.createSubContext(ast.options); var /** @type {?} */ startTime = context.currentTimeline.currentTime; var /** @type {?} */ endTime = this._visitSubInstructions(elementInstructions, innerContext, /** @type {?} */ (innerContext.options)); if (startTime != endTime) { // we do this on the upper context because we created a sub context for // the sub child animations context.transformIntoNewTimeline(endTime); } } context.previousNode = ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitAnimateRef = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var /** @type {?} */ innerContext = context.createSubContext(ast.options); innerContext.transformIntoNewTimeline(); this.visitReference(ast.animation, innerContext); context.transformIntoNewTimeline(innerContext.currentTimeline.currentTime); context.previousNode = ast; }; /** * @param {?} instructions * @param {?} context * @param {?} options * @return {?} */ AnimationTimelineBuilderVisitor.prototype._visitSubInstructions = /** * @param {?} instructions * @param {?} context * @param {?} options * @return {?} */ function (instructions, context, options) { var /** @type {?} */ startTime = context.currentTimeline.currentTime; var /** @type {?} */ furthestTime = startTime; // this is a special-case for when a user wants to skip a sub // animation from being fired entirely. var /** @type {?} */ duration = options.duration != null ? resolveTimingValue(options.duration) : null; var /** @type {?} */ delay = options.delay != null ? resolveTimingValue(options.delay) : null; if (duration !== 0) { instructions.forEach(function (instruction) { var /** @type {?} */ instructionTimings = context.appendInstructionToTimeline(instruction, duration, delay); furthestTime = Math.max(furthestTime, instructionTimings.duration + instructionTimings.delay); }); } return furthestTime; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitReference = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { context.updateOptions(ast.options, true); visitDslNode(this, ast.animation, context); context.previousNode = ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitSequence = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var _this = this; var /** @type {?} */ subContextCount = context.subContextCount; var /** @type {?} */ ctx = context; var /** @type {?} */ options = ast.options; if (options && (options.params || options.delay)) { ctx = context.createSubContext(options); ctx.transformIntoNewTimeline(); if (options.delay != null) { if (ctx.previousNode.type == 6 /* Style */) { ctx.currentTimeline.snapshotCurrentStyles(); ctx.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; } var /** @type {?} */ delay = resolveTimingValue(options.delay); ctx.delayNextStep(delay); } } if (ast.steps.length) { ast.steps.forEach(function (s) { return visitDslNode(_this, s, ctx); }); // this is here just incase the inner steps only contain or end with a style() call ctx.currentTimeline.applyStylesToKeyframe(); // this means that some animation function within the sequence // ended up creating a sub timeline (which means the current // timeline cannot overlap with the contents of the sequence) if (ctx.subContextCount > subContextCount) { ctx.transformIntoNewTimeline(); } } context.previousNode = ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitGroup = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var _this = this; var /** @type {?} */ innerTimelines = []; var /** @type {?} */ furthestTime = context.currentTimeline.currentTime; var /** @type {?} */ delay = ast.options && ast.options.delay ? resolveTimingValue(ast.options.delay) : 0; ast.steps.forEach(function (s) { var /** @type {?} */ innerContext = context.createSubContext(ast.options); if (delay) { innerContext.delayNextStep(delay); } visitDslNode(_this, s, innerContext); furthestTime = Math.max(furthestTime, innerContext.currentTimeline.currentTime); innerTimelines.push(innerContext.currentTimeline); }); // this operation is run after the AST loop because otherwise // if the parent timeline's collected styles were updated then // it would pass in invalid data into the new-to-be forked items innerTimelines.forEach(function (timeline) { return context.currentTimeline.mergeTimelineCollectedStyles(timeline); }); context.transformIntoNewTimeline(furthestTime); context.previousNode = ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype._visitTiming = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { if ((/** @type {?} */ (ast)).dynamic) { var /** @type {?} */ strValue = (/** @type {?} */ (ast)).strValue; var /** @type {?} */ timingValue = context.params ? interpolateParams(strValue, context.params, context.errors) : strValue; return resolveTiming(timingValue, context.errors); } else { return { duration: ast.duration, delay: ast.delay, easing: ast.easing }; } }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitAnimate = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var /** @type {?} */ timings = context.currentAnimateTimings = this._visitTiming(ast.timings, context); var /** @type {?} */ timeline = context.currentTimeline; if (timings.delay) { context.incrementTime(timings.delay); timeline.snapshotCurrentStyles(); } var /** @type {?} */ style$$1 = ast.style; if (style$$1.type == 5 /* Keyframes */) { this.visitKeyframes(style$$1, context); } else { context.incrementTime(timings.duration); this.visitStyle(/** @type {?} */ (style$$1), context); timeline.applyStylesToKeyframe(); } context.currentAnimateTimings = null; context.previousNode = ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitStyle = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var /** @type {?} */ timeline = context.currentTimeline; var /** @type {?} */ 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(); } var /** @type {?} */ easing = (timings && timings.easing) || ast.easing; if (ast.isEmptyStep) { timeline.applyEmptyStep(easing); } else { timeline.setStyles(ast.styles, easing, context.errors, context.options); } context.previousNode = ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitKeyframes = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var /** @type {?} */ currentAnimateTimings = /** @type {?} */ ((context.currentAnimateTimings)); var /** @type {?} */ startTime = (/** @type {?} */ ((context.currentTimeline))).duration; var /** @type {?} */ duration = currentAnimateTimings.duration; var /** @type {?} */ innerContext = context.createSubContext(); var /** @type {?} */ innerTimeline = innerContext.currentTimeline; innerTimeline.easing = currentAnimateTimings.easing; ast.styles.forEach(function (step) { var /** @type {?} */ offset = step.offset || 0; innerTimeline.forwardTime(offset * duration); innerTimeline.setStyles(step.styles, step.easing, context.errors, context.options); innerTimeline.applyStylesToKeyframe(); }); // this will ensure that the parent timeline gets all the styles from // the child even if the new timeline below is not used context.currentTimeline.mergeTimelineCollectedStyles(innerTimeline); // we do this because the window between this timeline and the sub timeline // should ensure that the styles within are exactly the same as they were before context.transformIntoNewTimeline(startTime + duration); context.previousNode = ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitQuery = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var _this = this; // in the event that the first step before this is a style step we need // to ensure the styles are applied before the children are animated var /** @type {?} */ startTime = context.currentTimeline.currentTime; var /** @type {?} */ options = /** @type {?} */ ((ast.options || {})); var /** @type {?} */ delay = options.delay ? resolveTimingValue(options.delay) : 0; if (delay && (context.previousNode.type === 6 /* Style */ || (startTime == 0 && context.currentTimeline.getCurrentStyleProperties().length))) { context.currentTimeline.snapshotCurrentStyles(); context.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; } var /** @type {?} */ furthestTime = startTime; var /** @type {?} */ elms = context.invokeQuery(ast.selector, ast.originalSelector, ast.limit, ast.includeSelf, options.optional ? true : false, context.errors); context.currentQueryTotal = elms.length; var /** @type {?} */ sameElementTimeline = null; elms.forEach(function (element, i) { context.currentQueryIndex = i; var /** @type {?} */ innerContext = context.createSubContext(ast.options, element); if (delay) { innerContext.delayNextStep(delay); } if (element === context.element) { sameElementTimeline = innerContext.currentTimeline; } visitDslNode(_this, ast.animation, innerContext); // this is here just incase the inner steps only contain or end // with a style() call (which is here to signal that this is a preparatory // call to style an element before it is animated again) innerContext.currentTimeline.applyStylesToKeyframe(); var /** @type {?} */ endTime = innerContext.currentTimeline.currentTime; furthestTime = Math.max(furthestTime, endTime); }); context.currentQueryIndex = 0; context.currentQueryTotal = 0; context.transformIntoNewTimeline(furthestTime); if (sameElementTimeline) { context.currentTimeline.mergeTimelineCollectedStyles(sameElementTimeline); context.currentTimeline.snapshotCurrentStyles(); } context.previousNode = ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AnimationTimelineBuilderVisitor.prototype.visitStagger = /** * @param {?} ast * @param {?} context * @return {?} */ function (ast, context) { var /** @type {?} */ parentContext = /** @type {?} */ ((context.parentContext)); var /** @type {?} */ tl = context.currentTimeline; var /** @type {?} */ timings = ast.timings; var /** @type {?} */ duration = Math.abs(timings.duration); var /** @type {?} */ maxTime = duration * (context.currentQueryTotal - 1); var /** @type {?} */ delay = duration * context.currentQueryIndex; var /** @type {?} */ staggerTransformer = timings.duration < 0 ? 'reverse' : timings.easing; switch (staggerTransformer) { case 'reverse': delay = maxTime - delay; break; case 'full': delay = parentContext.currentStaggerTime; break; } var /** @type {?} */ timeline = context.currentTimeline; if (delay) { timeline.delayNextStep(delay); } var /** @type {?} */ startingTime = timeline.currentTime; visitDslNode(this, ast.animation, context); context.previousNode = ast; // time = duration + delay // the reason why this computation is so complex is because // the inner timeline may either have a delay value or a stretched // keyframe depending on if a subtimeline is not used or is used. parentContext.currentStaggerTime = (tl.currentTime - startingTime) + (tl.startTime - parentContext.currentTimeline.startTime); }; return AnimationTimelineBuilderVisitor; }()); var DEFAULT_NOOP_PREVIOUS_NODE = /** @type {?} */ ({}); var AnimationTimelineContext = /** @class */ (function () { function AnimationTimelineContext(_driver, element, subInstructions, _enterClassName, _leaveClassName, errors, timelines, initialTimeline) { 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); } Object.defineProperty(AnimationTimelineContext.prototype, "params", { get: /** * @return {?} */ function () { return this.options.params; }, enumerable: true, configurable: true }); /** * @param {?} options * @param {?=} skipIfExists * @return {?} */ AnimationTimelineContext.prototype.updateOptions = /** * @param {?} options * @param {?=} skipIfExists * @return {?} */ function (options, skipIfExists) { var _this = this; if (!options) return; var /** @type {?} */ newOptions = /** @type {?} */ (options); var /** @type {?} */ 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); } var /** @type {?} */ newParams = newOptions.params; if (newParams) { var /** @type {?} */ paramsToUpdate_1 = /** @type {?} */ ((optionsToUpdate.params)); if (!paramsToUpdate_1) { paramsToUpdate_1 = this.options.params = {}; } Object.keys(newParams).forEach(function (name) { if (!skipIfExists || !paramsToUpdate_1.hasOwnProperty(name)) { paramsToUpdate_1[name] = interpolateParams(newParams[name], paramsToUpdate_1, _this.errors); } }); } }; /** * @return {?} */ AnimationTimelineContext.prototype._copyOptions = /** * @return {?} */ function () { var /** @type {?} */ options = {}; if (this.options) { var /** @type {?} */ oldParams_1 = this.options.params; if (oldParams_1) { var /** @type {?} */ params_1 = options['params'] = {}; Object.keys(oldParams_1).forEach(function (name) { params_1[name] = oldParams_1[name]; }); } } return options; }; /** * @param {?=} options * @param {?=} element * @param {?=} newTime * @return {?} */ AnimationTimelineContext.prototype.createSubContext = /** * @param {?=} options * @param {?=} element * @param {?=} newTime * @return {?} */ function (options, element, newTime) { if (options === void 0) { options = null; } var /** @type {?} */ target = element || this.element; var /** @type {?} */ context = new AnimationTimelineContext(this._driver, target, this.subInstructions, this._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 {?} */ AnimationTimelineContext.prototype.transformIntoNewTimeline = /** * @param {?=} newTime * @return {?} */ function (newTime) { this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE; this.currentTimeline = this.currentTimeline.fork(this.element, newTime); this.timelines.push(this.currentTimeline); return this.currentTimeline; }; /** * @param {?} instruction * @param {?} duration * @param {?} delay * @return {?} */ AnimationTimelineContext.prototype.appendInstructionToTimeline = /** * @param {?} instruction * @param {?} duration * @param {?} delay * @return {?} */ function (instruction, duration, delay) { var /** @type {?} */ updatedTimings = { duration: duration != null ? duration : instruction.duration, delay: this.currentTimeline.currentTime + (delay != null ? delay : 0) + instruction.delay, easing: '' }; var /** @type {?} */ builder = new SubTimelineBuilder(this._driver, instruction.element, instruction.keyframes, instruction.preStyleProps, instruction.postStyleProps, updatedTimings, instruction.stretchStartingKeyframe); this.timelines.push(builder); return updatedTimings; }; /** * @param {?} time * @return {?} */ AnimationTimelineContext.prototype.incrementTime = /** * @param {?} time * @return {?} */ function (time) { this.currentTimeline.forwardTime(this.currentTimeline.duration + time); }; /** * @param {?} delay * @return {?} */ AnimationTimelineContext.prototype.delayNextStep = /** * @param {?} delay * @return {?} */ function (delay) { // negative delays are not yet supported if (delay > 0) { this.currentTimeline.delayNextStep(delay); } }; /** * @param {?} selector * @param {?} originalSelector * @param {?} limit * @param {?} includeSelf * @param {?} optional * @param {?} errors * @return {?} */ AnimationTimelineContext.prototype.invokeQuery = /** * @param {?} selector * @param {?} originalSelector * @param {?} limit * @param {?} includeSelf * @param {?} optional * @param {?} errors * @return {?} */ function (selector, originalSelector, limit, includeSelf, optional, errors) { var /** @type {?} */ 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); var /** @type {?} */ multi = limit != 1; var /** @type {?} */ 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, elements); } if (!optional && results.length == 0) { errors.push("`query(\"" + originalSelector + "\")` returned zero elements. (Use `query(\"" + originalSelector + "\", { optional: true })` if you wish to allow this.)"); } return results; }; return AnimationTimelineContext; }()); var TimelineBuilder = /** @class */ (function () { function TimelineBuilder(_driver, element, startTime, _elementTimelineStylesLookup) { 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 {?} */ TimelineBuilder.prototype.containsAnimation = /** * @return {?} */ function () { switch (this._keyframes.size) { case 0: return false; case 1: return this.getCurrentStyleProperties().length > 0; default: return true; } }; /** * @return {?} */ TimelineBuilder.prototype.getCurrentStyleProperties = /** * @return {?} */ function () { return Object.keys(this._currentKeyframe); }; Object.defineProperty(TimelineBuilder.prototype, "currentTime", { get: /** * @return {?} */ function () { return this.startTime + this.duration; }, enumerable: true, configurable: true }); /** * @param {?} delay * @return {?} */ TimelineBuilder.prototype.delayNextStep = /** * @param {?} delay * @return {?} */ function (delay) { // in the event that a style() step is placed right before a stagger() // and that style() step is the very first style() value in the animation // then we need to make a copy of the keyframe [0, copy, 1] so that the delay // properly applies the style() values to work with the stagger... var /** @type {?} */ hasPreStyleStep = this._keyframes.size == 1 && Object.keys(this._pendingStyles).length; if (this.duration || hasPreStyleStep) { this.forwardTime(this.currentTime + delay); if (hasPreStyleStep) { this.snapshotCurrentStyles(); } } else { this.startTime += delay; } }; /** * @param {?} element * @param {?=} currentTime * @return {?} */ TimelineBuilder.prototype.fork = /** * @param {?} element * @param {?=} currentTime * @return {?} */ function (element, currentTime) { this.applyStylesToKeyframe(); return new TimelineBuilder(this._driver, element, currentTime || this.currentTime, this._elementTimelineStylesLookup); }; /** * @return {?} */ TimelineBuilder.prototype._loadKeyframe = /** * @return {?} */ function () { 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 {?} */ TimelineBuilder.prototype.forwardFrame = /** * @return {?} */ function () { this.duration += ONE_FRAME_IN_MILLISECONDS; this._loadKeyframe(); }; /** * @param {?} time * @return {?} */ TimelineBuilder.prototype.forwardTime = /** * @param {?} time * @return {?} */ function (time) { this.applyStylesToKeyframe(); this.duration = time; this._loadKeyframe(); }; /** * @param {?} prop * @param {?} value * @return {?} */ TimelineBuilder.prototype._updateStyle = /** * @param {?} prop * @param {?} value * @return {?} */ function (prop, value) { this._localTimelineStyles[prop] = value; this._globalTimelineStyles[prop] = value; this._styleSummary[prop] = { time: this.currentTime, value: value }; }; /** * @return {?} */ TimelineBuilder.prototype.allowOnlyTimelineStyles = /** * @return {?} */ function () { return this._currentEmptyStepKeyframe !== this._currentKeyframe; }; /** * @param {?} easing * @return {?} */ TimelineBuilder.prototype.applyEmptyStep = /** * @param {?} easing * @return {?} */ function (easing) { var _this = this; if (easing) { this._previousKeyframe['easing'] = easing; } // special case for animate(duration): // all missing styles are filled with a `*` value then // if any destination styles are filled in later on the same // keyframe then they will override the overridden styles // We use `_globalTimelineStyles` here because there may be // styles in previous keyframes that are not present in this timeline Object.keys(this._globalTimelineStyles).forEach(function (prop) { _this._backFill[prop] = _this._globalTimelineStyles[prop] || __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]; _this._currentKeyframe[prop] = __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]; }); this._currentEmptyStepKeyframe = this._currentKeyframe; }; /** * @param {?} input * @param {?} easing * @param {?} errors * @param {?=} options * @return {?} */ TimelineBuilder.prototype.setStyles = /** * @param {?} input * @param {?} easing * @param {?} errors * @param {?=} options * @return {?} */ function (input, easing, errors, options) { var _this = this; if (easing) { this._previousKeyframe['easing'] = easing; } var /** @type {?} */ params = (options && options.params) || {}; var /** @type {?} */ styles = flattenStyles(input, this._globalTimelineStyles); Object.keys(styles).forEach(function (prop) { var /** @type {?} */ val = interpolateParams(styles[prop], params, errors); _this._pendingStyles[prop] = val; if (!_this._localTimelineStyles.hasOwnProperty(prop)) { _this._backFill[prop] = _this._globalTimelineStyles.hasOwnProperty(prop) ? _this._globalTimelineStyles[prop] : __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]; } _this._updateStyle(prop, val); }); }; /** * @return {?} */ TimelineBuilder.prototype.applyStylesToKeyframe = /** * @return {?} */ function () { var _this = this; var /** @type {?} */ styles = this._pendingStyles; var /** @type {?} */ props = Object.keys(styles); if (props.length == 0) return; this._pendingStyles = {}; props.forEach(function (prop) { var /** @type {?} */ val = styles[prop]; _this._currentKeyframe[prop] = val; }); Object.keys(this._localTimelineStyles).forEach(function (prop) { if (!_this._currentKeyframe.hasOwnProperty(prop)) { _this._currentKeyframe[prop] = _this._localTimelineStyles[prop]; } }); }; /** * @return {?} */ TimelineBuilder.prototype.snapshotCurrentStyles = /** * @return {?} */ function () { var _this = this; Object.keys(this._localTimelineStyles).forEach(function (prop) { var /** @type {?} */ val = _this._localTimelineStyles[prop]; _this._pendingStyles[prop] = val; _this._updateStyle(prop, val); }); }; /** * @return {?} */ TimelineBuilder.prototype.getFinalKeyframe = /** * @return {?} */ function () { return this._keyframes.get(this.duration); }; Object.defineProperty(TimelineBuilder.prototype, "properties", { get: /** * @return {?} */ function () { var /** @type {?} */ properties = []; for (var /** @type {?} */ prop in this._currentKeyframe) { properties.push(prop); } return properties; }, enumerable: true, configurable: true }); /** * @param {?} timeline * @return {?} */ TimelineBuilder.prototype.mergeTimelineCollectedStyles = /** * @param {?} timeline * @return {?} */ function (timeline) { var _this = this; Object.keys(timeline._styleSummary).forEach(function (prop) { var /** @type {?} */ details0 = _this._styleSummary[prop]; var /** @type {?} */ details1 = timeline._styleSummary[prop]; if (!details0 || details1.time > details0.time) { _this._updateStyle(prop, details1.value); } }); }; /** * @return {?} */ TimelineBuilder.prototype.buildKeyframes = /** * @return {?} */ function () { var _this = this; this.applyStylesToKeyframe(); var /** @type {?} */ preStyleProps = new Set(); var /** @type {?} */ postStyleProps = new Set(); var /** @type {?} */ isEmpty = this._keyframes.size === 1 && this.duration === 0; var /** @type {?} */ finalKeyframes = []; this._keyframes.forEach(function (keyframe, time) { var /** @type {?} */ finalKeyframe = copyStyles(keyframe, true); Object.keys(finalKeyframe).forEach(function (prop) { var /** @type {?} */ value = finalKeyframe[prop]; if (value == __WEBPACK_IMPORTED_MODULE_0__angular_animations__["ɵPRE_STYLE"]) { preStyleProps.add(prop); } else if (value == __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]) { postStyleProps.add(prop); } }); if (!isEmpty) { finalKeyframe['offset'] = time / _this.duration; } finalKeyframes.push(finalKeyframe); }); var /** @type {?} */ preProps = preStyleProps.size ? iteratorToArray(preStyleProps.values()) : []; var /** @type {?} */ postProps = postStyleProps.size ? iteratorToArray(postStyleProps.values()) : []; // special case for a 0-second animation (which is designed just to place styles onscreen) if (isEmpty) { var /** @type {?} */ kf0 = finalKeyframes[0]; var /** @type {?} */ kf1 = copyObj(kf0); kf0['offset'] = 0; kf1['offset'] = 1; finalKeyframes = [kf0, kf1]; } return createTimelineInstruction(this.element, finalKeyframes, preProps, postProps, this.duration, this.startTime, this.easing, false); }; return TimelineBuilder; }()); var SubTimelineBuilder = /** @class */ (function (_super) { Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(SubTimelineBuilder, _super); function SubTimelineBuilder(driver, element, keyframes, preStyleProps, postStyleProps, timings, _stretchStartingKeyframe) { if (_stretchStartingKeyframe === void 0) { _stretchStartingKeyframe = false; } var _this = _super.call(this, driver, element, timings.delay) || this; _this.element = element; _this.keyframes = keyframes; _this.preStyleProps = preStyleProps; _this.postStyleProps = postStyleProps; _this._stretchStartingKeyframe = _stretchStartingKeyframe; _this.timings = { duration: timings.duration, delay: timings.delay, easing: timings.easing }; return _this; } /** * @return {?} */ SubTimelineBuilder.prototype.containsAnimation = /** * @return {?} */ function () { return this.keyframes.length > 1; }; /** * @return {?} */ SubTimelineBuilder.prototype.buildKeyframes = /** * @return {?} */ function () { var /** @type {?} */ keyframes = this.keyframes; var _a = this.timings, delay = _a.delay, duration = _a.duration, easing = _a.easing; if (this._stretchStartingKeyframe && delay) { var /** @type {?} */ newKeyframes = []; var /** @type {?} */ totalTime = duration + delay; var /** @type {?} */ startingGap = delay / totalTime; // the original starting keyframe now starts once the delay is done var /** @type {?} */ newFirstKeyframe = copyStyles(keyframes[0], false); newFirstKeyframe['offset'] = 0; newKeyframes.push(newFirstKeyframe); var /** @type {?} */ oldFirstKeyframe = copyStyles(keyframes[0], false); oldFirstKeyframe['offset'] = roundOffset(startingGap); newKeyframes.push(oldFirstKeyframe); /* When the keyframe is stretched then it means that the delay before the animation starts is gone. Instead the first keyframe is placed at the start of the animation and it is then copied to where it starts when the original delay is over. This basically means nothing animates during that delay, but the styles are still renderered. For this to work the original offset values that exist in the original keyframes must be "warped" so that they can take the new keyframe + delay into account. delay=1000, duration=1000, keyframes = 0 .5 1 turns into delay=0, duration=2000, keyframes = 0 .33 .66 1 */ // offsets between 1 ... n -1 are all warped by the keyframe stretch var /** @type {?} */ limit = keyframes.length - 1; for (var /** @type {?} */ i = 1; i <= limit; i++) { var /** @type {?} */ kf = copyStyles(keyframes[i], false); var /** @type {?} */ oldOffset = /** @type {?} */ (kf['offset']); var /** @type {?} */ timeAtKeyframe = delay + oldOffset * duration; kf['offset'] = roundOffset(timeAtKeyframe / totalTime); newKeyframes.push(kf); } // the new starting keyframe should be added at the start duration = totalTime; delay = 0; easing = ''; keyframes = newKeyframes; } return createTimelineInstruction(this.element, keyframes, this.preStyleProps, this.postStyleProps, duration, delay, easing, true); }; return SubTimelineBuilder; }(TimelineBuilder)); /** * @param {?} offset * @param {?=} decimalPoints * @return {?} */ function roundOffset(offset, decimalPoints) { if (decimalPoints === void 0) { decimalPoints = 3; } var /** @type {?} */ mult = Math.pow(10, decimalPoints - 1); return Math.round(offset * mult) / mult; } /** * @param {?} input * @param {?} allStyles * @return {?} */ function flattenStyles(input, allStyles) { var /** @type {?} */ styles = {}; var /** @type {?} */ allProperties; input.forEach(function (token) { if (token === '*') { allProperties = allProperties || Object.keys(allStyles); allProperties.forEach(function (prop) { styles[prop] = __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]; }); } else { copyStyles(/** @type {?} */ (token), false, styles); } }); return styles; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var Animation = /** @class */ (function () { function Animation(_driver, input) { this._driver = _driver; var /** @type {?} */ errors = []; var /** @type {?} */ ast = buildAnimationAst(_driver, input, errors); if (errors.length) { var /** @type {?} */ errorMessage = "animation validation failed:\n" + errors.join("\n"); throw new Error(errorMessage); } this._animationAst = ast; } /** * @param {?} element * @param {?} startingStyles * @param {?} destinationStyles * @param {?} options * @param {?=} subInstructions * @return {?} */ Animation.prototype.buildTimelines = /** * @param {?} element * @param {?} startingStyles * @param {?} destinationStyles * @param {?} options * @param {?=} subInstructions * @return {?} */ function (element, startingStyles, destinationStyles, options, subInstructions) { var /** @type {?} */ start = Array.isArray(startingStyles) ? normalizeStyles(startingStyles) : /** @type {?} */ (startingStyles); var /** @type {?} */ dest = Array.isArray(destinationStyles) ? normalizeStyles(destinationStyles) : /** @type {?} */ (destinationStyles); var /** @type {?} */ errors = []; subInstructions = subInstructions || new ElementInstructionMap(); var /** @type {?} */ result = buildAnimationTimelines(this._driver, element, this._animationAst, ENTER_CLASSNAME, LEAVE_CLASSNAME, start, dest, options, subInstructions, errors); if (errors.length) { var /** @type {?} */ errorMessage = "animation building failed:\n" + errors.join("\n"); throw new Error(errorMessage); } return result; }; return Animation; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * \@experimental Animation support is experimental. * @abstract */ var AnimationStyleNormalizer = /** @class */ (function () { function AnimationStyleNormalizer() { } return AnimationStyleNormalizer; }()); /** * \@experimental Animation support is experimental. */ var NoopAnimationStyleNormalizer = /** @class */ (function () { function NoopAnimationStyleNormalizer() { } /** * @param {?} propertyName * @param {?} errors * @return {?} */ NoopAnimationStyleNormalizer.prototype.normalizePropertyName = /** * @param {?} propertyName * @param {?} errors * @return {?} */ function (propertyName, errors) { return propertyName; }; /** * @param {?} userProvidedProperty * @param {?} normalizedProperty * @param {?} value * @param {?} errors * @return {?} */ NoopAnimationStyleNormalizer.prototype.normalizeStyleValue = /** * @param {?} userProvidedProperty * @param {?} normalizedProperty * @param {?} value * @param {?} errors * @return {?} */ function (userProvidedProperty, normalizedProperty, value, errors) { return /** @type {?} */ (value); }; return NoopAnimationStyleNormalizer; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var WebAnimationsStyleNormalizer = /** @class */ (function (_super) { Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(WebAnimationsStyleNormalizer, _super); function WebAnimationsStyleNormalizer() { return _super !== null && _super.apply(this, arguments) || this; } /** * @param {?} propertyName * @param {?} errors * @return {?} */ WebAnimationsStyleNormalizer.prototype.normalizePropertyName = /** * @param {?} propertyName * @param {?} errors * @return {?} */ function (propertyName, errors) { return dashCaseToCamelCase(propertyName); }; /** * @param {?} userProvidedProperty * @param {?} normalizedProperty * @param {?} value * @param {?} errors * @return {?} */ WebAnimationsStyleNormalizer.prototype.normalizeStyleValue = /** * @param {?} userProvidedProperty * @param {?} normalizedProperty * @param {?} value * @param {?} errors * @return {?} */ function (userProvidedProperty, normalizedProperty, value, errors) { var /** @type {?} */ unit = ''; var /** @type {?} */ strVal = value.toString().trim(); if (DIMENSIONAL_PROP_MAP[normalizedProperty] && value !== 0 && value !== '0') { if (typeof value === 'number') { unit = 'px'; } else { var /** @type {?} */ valAndSuffixMatch = value.match(/^[+-]?[\d\.]+([a-z]*)$/); if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) { errors.push("Please provide a CSS unit value for " + userProvidedProperty + ":" + value); } } } return strVal + unit; }; return WebAnimationsStyleNormalizer; }(AnimationStyleNormalizer)); var DIMENSIONAL_PROP_MAP = makeBooleanMap('width,height,minWidth,minHeight,maxWidth,maxHeight,left,top,bottom,right,fontSize,outlineWidth,outlineOffset,paddingTop,paddingLeft,paddingBottom,paddingRight,marginTop,marginLeft,marginBottom,marginRight,borderRadius,borderWidth,borderTopWidth,borderLeftWidth,borderRightWidth,borderBottomWidth,textIndent,perspective' .split(',')); /** * @param {?} keys * @return {?} */ function makeBooleanMap(keys) { var /** @type {?} */ map = {}; keys.forEach(function (key) { return map[key] = true; }); return map; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @record */ /** * @param {?} element * @param {?} triggerName * @param {?} fromState * @param {?} toState * @param {?} isRemovalTransition * @param {?} fromStyles * @param {?} toStyles * @param {?} timelines * @param {?} queriedElements * @param {?} preStyleProps * @param {?} postStyleProps * @param {?=} errors * @return {?} */ function createTransitionInstruction(element, triggerName, fromState, toState, isRemovalTransition, fromStyles, toStyles, timelines, queriedElements, preStyleProps, postStyleProps, 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, errors: errors }; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var EMPTY_OBJECT = {}; var AnimationTransitionFactory = /** @class */ (function () { function AnimationTransitionFactory(_triggerName, ast, _stateStyles) { this._triggerName = _triggerName; this.ast = ast; this._stateStyles = _stateStyles; } /** * @param {?} currentState * @param {?} nextState * @return {?} */ AnimationTransitionFactory.prototype.match = /** * @param {?} currentState * @param {?} nextState * @return {?} */ function (currentState, nextState) { return oneOrMoreTransitionsMatch(this.ast.matchers, currentState, nextState); }; /** * @param {?} stateName * @param {?} params * @param {?} errors * @return {?} */ AnimationTransitionFactory.prototype.buildStyles = /** * @param {?} stateName * @param {?} params * @param {?} errors * @return {?} */ function (stateName, params, errors) { var /** @type {?} */ backupStateStyler = this._stateStyles['*']; var /** @type {?} */ stateStyler = this._stateStyles[stateName]; var /** @type {?} */ 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 * @return {?} */ AnimationTransitionFactory.prototype.build = /** * @param {?} driver * @param {?} element * @param {?} currentState * @param {?} nextState * @param {?} enterClassName * @param {?} leaveClassName * @param {?=} currentOptions * @param {?=} nextOptions * @param {?=} subInstructions * @return {?} */ function (driver, element, currentState, nextState, enterClassName, leaveClassName, currentOptions, nextOptions, subInstructions) { var /** @type {?} */ errors = []; var /** @type {?} */ transitionAnimationParams = this.ast.options && this.ast.options.params || EMPTY_OBJECT; var /** @type {?} */ currentAnimationParams = currentOptions && currentOptions.params || EMPTY_OBJECT; var /** @type {?} */ currentStateStyles = this.buildStyles(currentState, currentAnimationParams, errors); var /** @type {?} */ nextAnimationParams = nextOptions && nextOptions.params || EMPTY_OBJECT; var /** @type {?} */ nextStateStyles = this.buildStyles(nextState, nextAnimationParams, errors); var /** @type {?} */ queriedElements = new Set(); var /** @type {?} */ preStyleMap = new Map(); var /** @type {?} */ postStyleMap = new Map(); var /** @type {?} */ isRemoval = nextState === 'void'; var /** @type {?} */ animationOptions = { params: Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __assign */])({}, transitionAnimationParams, nextAnimationParams) }; var /** @type {?} */ timelines = buildAnimationTimelines(driver, element, this.ast.animation, enterClassName, leaveClassName, currentStateStyles, nextStateStyles, animationOptions, subInstructions, errors); if (errors.length) { return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, [], [], preStyleMap, postStyleMap, errors); } timelines.forEach(function (tl) { var /** @type {?} */ elm = tl.element; var /** @type {?} */ preProps = getOrSetAsInMap(preStyleMap, elm, {}); tl.preStyleProps.forEach(function (prop) { return preProps[prop] = true; }); var /** @type {?} */ postProps = getOrSetAsInMap(postStyleMap, elm, {}); tl.postStyleProps.forEach(function (prop) { return postProps[prop] = true; }); if (elm !== element) { queriedElements.add(elm); } }); var /** @type {?} */ queriedElementsList = iteratorToArray(queriedElements.values()); return createTransitionInstruction(element, this._triggerName, currentState, nextState, isRemoval, currentStateStyles, nextStateStyles, timelines, queriedElementsList, preStyleMap, postStyleMap); }; return AnimationTransitionFactory; }()); /** * @param {?} matchFns * @param {?} currentState * @param {?} nextState * @return {?} */ function oneOrMoreTransitionsMatch(matchFns, currentState, nextState) { return matchFns.some(function (fn) { return fn(currentState, nextState); }); } var AnimationStateStyles = /** @class */ (function () { function AnimationStateStyles(styles, defaultParams) { this.styles = styles; this.defaultParams = defaultParams; } /** * @param {?} params * @param {?} errors * @return {?} */ AnimationStateStyles.prototype.buildStyles = /** * @param {?} params * @param {?} errors * @return {?} */ function (params, errors) { var /** @type {?} */ finalStyles = {}; var /** @type {?} */ combinedParams = copyObj(this.defaultParams); Object.keys(params).forEach(function (key) { var /** @type {?} */ value = params[key]; if (value != null) { combinedParams[key] = value; } }); this.styles.styles.forEach(function (value) { if (typeof value !== 'string') { var /** @type {?} */ styleObj_1 = /** @type {?} */ (value); Object.keys(styleObj_1).forEach(function (prop) { var /** @type {?} */ val = styleObj_1[prop]; if (val.length > 1) { val = interpolateParams(val, combinedParams, errors); } finalStyles[prop] = val; }); } }); return finalStyles; }; return AnimationStateStyles; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * \@experimental Animation support is experimental. * @param {?} name * @param {?} ast * @return {?} */ function buildTrigger(name, ast) { return new AnimationTrigger(name, ast); } /** * \@experimental Animation support is experimental. */ var AnimationTrigger = /** @class */ (function () { function AnimationTrigger(name, ast) { var _this = this; this.name = name; this.ast = ast; this.transitionFactories = []; this.states = {}; ast.states.forEach(function (ast) { var /** @type {?} */ defaultParams = (ast.options && ast.options.params) || {}; _this.states[ast.name] = new AnimationStateStyles(ast.style, defaultParams); }); balanceProperties(this.states, 'true', '1'); balanceProperties(this.states, 'false', '0'); ast.transitions.forEach(function (ast) { _this.transitionFactories.push(new AnimationTransitionFactory(name, ast, _this.states)); }); this.fallbackTransition = createFallbackTransition(name, this.states); } Object.defineProperty(AnimationTrigger.prototype, "containsQueries", { get: /** * @return {?} */ function () { return this.ast.queryCount > 0; }, enumerable: true, configurable: true }); /** * @param {?} currentState * @param {?} nextState * @return {?} */ AnimationTrigger.prototype.matchTransition = /** * @param {?} currentState * @param {?} nextState * @return {?} */ function (currentState, nextState) { var /** @type {?} */ entry = this.transitionFactories.find(function (f) { return f.match(currentState, nextState); }); return entry || null; }; /** * @param {?} currentState * @param {?} params * @param {?} errors * @return {?} */ AnimationTrigger.prototype.matchStyles = /** * @param {?} currentState * @param {?} params * @param {?} errors * @return {?} */ function (currentState, params, errors) { return this.fallbackTransition.buildStyles(currentState, params, errors); }; return AnimationTrigger; }()); /** * @param {?} triggerName * @param {?} states * @return {?} */ function createFallbackTransition(triggerName, states) { var /** @type {?} */ matchers = [function (fromState, toState) { return true; }]; var /** @type {?} */ animation = { type: 2 /* Sequence */, steps: [], options: null }; var /** @type {?} */ 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 * @suppress {checkTypes} checked by tsc */ var EMPTY_INSTRUCTION_MAP = new ElementInstructionMap(); var TimelineAnimationEngine = /** @class */ (function () { function TimelineAnimationEngine(_driver, _normalizer) { this._driver = _driver; this._normalizer = _normalizer; this._animations = {}; this._playersById = {}; this.players = []; } /** * @param {?} id * @param {?} metadata * @return {?} */ TimelineAnimationEngine.prototype.register = /** * @param {?} id * @param {?} metadata * @return {?} */ function (id, metadata) { var /** @type {?} */ errors = []; var /** @type {?} */ ast = buildAnimationAst(this._driver, metadata, errors); if (errors.length) { throw new Error("Unable to build the animation due to the following errors: " + errors.join("\n")); } else { this._animations[id] = ast; } }; /** * @param {?} i * @param {?} preStyles * @param {?=} postStyles * @return {?} */ TimelineAnimationEngine.prototype._buildPlayer = /** * @param {?} i * @param {?} preStyles * @param {?=} postStyles * @return {?} */ function (i, preStyles, postStyles) { var /** @type {?} */ element = i.element; var /** @type {?} */ keyframes = normalizeKeyframes(this._driver, this._normalizer, element, i.keyframes, preStyles, postStyles); return this._driver.animate(element, keyframes, i.duration, i.delay, i.easing, []); }; /** * @param {?} id * @param {?} element * @param {?=} options * @return {?} */ TimelineAnimationEngine.prototype.create = /** * @param {?} id * @param {?} element * @param {?=} options * @return {?} */ function (id, element, options) { var _this = this; if (options === void 0) { options = {}; } var /** @type {?} */ errors = []; var /** @type {?} */ ast = this._animations[id]; var /** @type {?} */ instructions; var /** @type {?} */ autoStylesMap = new Map(); if (ast) { instructions = buildAnimationTimelines(this._driver, element, ast, ENTER_CLASSNAME, LEAVE_CLASSNAME, {}, {}, options, EMPTY_INSTRUCTION_MAP, errors); instructions.forEach(function (inst) { var /** @type {?} */ styles = getOrSetAsInMap(autoStylesMap, inst.element, {}); inst.postStyleProps.forEach(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: " + errors.join("\n")); } autoStylesMap.forEach(function (styles, element) { Object.keys(styles).forEach(function (prop) { styles[prop] = _this._driver.computeStyle(element, prop, __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]); }); }); var /** @type {?} */ players = instructions.map(function (i) { var /** @type {?} */ styles = autoStylesMap.get(i.element); return _this._buildPlayer(i, {}, styles); }); var /** @type {?} */ player = optimizeGroupPlayer(players); this._playersById[id] = player; player.onDestroy(function () { return _this.destroy(id); }); this.players.push(player); return player; }; /** * @param {?} id * @return {?} */ TimelineAnimationEngine.prototype.destroy = /** * @param {?} id * @return {?} */ function (id) { var /** @type {?} */ player = this._getPlayer(id); player.destroy(); delete this._playersById[id]; var /** @type {?} */ index = this.players.indexOf(player); if (index >= 0) { this.players.splice(index, 1); } }; /** * @param {?} id * @return {?} */ TimelineAnimationEngine.prototype._getPlayer = /** * @param {?} id * @return {?} */ function (id) { var /** @type {?} */ player = this._playersById[id]; if (!player) { throw new Error("Unable to find the timeline player referenced by " + id); } return player; }; /** * @param {?} id * @param {?} element * @param {?} eventName * @param {?} callback * @return {?} */ TimelineAnimationEngine.prototype.listen = /** * @param {?} id * @param {?} element * @param {?} eventName * @param {?} callback * @return {?} */ function (id, element, eventName, callback) { // triggerName, fromState, toState are all ignored for timeline animations var /** @type {?} */ baseEvent = makeAnimationEvent(element, '', '', ''); listenOnPlayer(this._getPlayer(id), eventName, baseEvent, callback); return function () { }; }; /** * @param {?} id * @param {?} element * @param {?} command * @param {?} args * @return {?} */ TimelineAnimationEngine.prototype.command = /** * @param {?} id * @param {?} element * @param {?} command * @param {?} args * @return {?} */ function (id, element, command, args) { if (command == 'register') { this.register(id, /** @type {?} */ (args[0])); return; } if (command == 'create') { var /** @type {?} */ options = /** @type {?} */ ((args[0] || {})); this.create(id, element, options); return; } var /** @type {?} */ 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; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var QUEUED_CLASSNAME = 'ng-animate-queued'; var QUEUED_SELECTOR = '.ng-animate-queued'; var DISABLED_CLASSNAME = 'ng-animate-disabled'; var DISABLED_SELECTOR = '.ng-animate-disabled'; var STAR_CLASSNAME = 'ng-star-inserted'; var STAR_SELECTOR = '.ng-star-inserted'; var EMPTY_PLAYER_ARRAY = []; var NULL_REMOVAL_STATE = { namespaceId: '', setForRemoval: null, hasAnimation: false, removedBeforeQueried: false }; var NULL_REMOVED_QUERIED_STATE = { namespaceId: '', setForRemoval: null, hasAnimation: false, removedBeforeQueried: true }; /** * @record */ var REMOVAL_FLAG = '__ng_removed'; /** * @record */ var StateValue = /** @class */ (function () { function StateValue(input, namespaceId) { if (namespaceId === void 0) { namespaceId = ''; } this.namespaceId = namespaceId; var /** @type {?} */ isObj = input && input.hasOwnProperty('value'); var /** @type {?} */ value = isObj ? input['value'] : input; this.value = normalizeTriggerValue(value); if (isObj) { var /** @type {?} */ options = copyObj(/** @type {?} */ (input)); delete options['value']; this.options = /** @type {?} */ (options); } else { this.options = {}; } if (!this.options.params) { this.options.params = {}; } } Object.defineProperty(StateValue.prototype, "params", { get: /** * @return {?} */ function () { return /** @type {?} */ (this.options.params); }, enumerable: true, configurable: true }); /** * @param {?} options * @return {?} */ StateValue.prototype.absorbOptions = /** * @param {?} options * @return {?} */ function (options) { var /** @type {?} */ newParams = options.params; if (newParams) { var /** @type {?} */ oldParams_1 = /** @type {?} */ ((this.options.params)); Object.keys(newParams).forEach(function (prop) { if (oldParams_1[prop] == null) { oldParams_1[prop] = newParams[prop]; } }); } }; return StateValue; }()); var VOID_VALUE = 'void'; var DEFAULT_STATE_VALUE = new StateValue(VOID_VALUE); var DELETED_STATE_VALUE = new StateValue('DELETED'); var AnimationTransitionNamespace = /** @class */ (function () { function AnimationTransitionNamespace(id, hostElement, _engine) { this.id = id; this.hostElement = hostElement; this._engine = _engine; this.players = []; this._triggers = {}; this._queue = []; this._elementListeners = new Map(); this._hostClassName = 'ng-tns-' + id; addClass(hostElement, this._hostClassName); } /** * @param {?} element * @param {?} name * @param {?} phase * @param {?} callback * @return {?} */ AnimationTransitionNamespace.prototype.listen = /** * @param {?} element * @param {?} name * @param {?} phase * @param {?} callback * @return {?} */ function (element, name, phase, callback) { var _this = this; if (!this._triggers.hasOwnProperty(name)) { throw new Error("Unable to listen on the animation trigger event \"" + phase + "\" because the animation trigger \"" + name + "\" doesn't exist!"); } if (phase == null || phase.length == 0) { throw new Error("Unable to listen on the animation trigger \"" + name + "\" because the provided event is undefined!"); } if (!isTriggerEventValid(phase)) { throw new Error("The provided animation trigger event \"" + phase + "\" for the animation trigger \"" + name + "\" is not supported!"); } var /** @type {?} */ listeners = getOrSetAsInMap(this._elementListeners, element, []); var /** @type {?} */ data = { name: name, phase: phase, callback: callback }; listeners.push(data); var /** @type {?} */ 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 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) // 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) _this._engine.afterFlush(function () { var /** @type {?} */ index = listeners.indexOf(data); if (index >= 0) { listeners.splice(index, 1); } if (!_this._triggers[name]) { delete triggersWithStates[name]; } }); }; }; /** * @param {?} name * @param {?} ast * @return {?} */ AnimationTransitionNamespace.prototype.register = /** * @param {?} name * @param {?} ast * @return {?} */ function (name, ast) { if (this._triggers[name]) { // throw return false; } else { this._triggers[name] = ast; return true; } }; /** * @param {?} name * @return {?} */ AnimationTransitionNamespace.prototype._getTrigger = /** * @param {?} name * @return {?} */ function (name) { var /** @type {?} */ trigger = this._triggers[name]; if (!trigger) { throw new Error("The provided animation trigger \"" + name + "\" has not been registered!"); } return trigger; }; /** * @param {?} element * @param {?} triggerName * @param {?} value * @param {?=} defaultToFallback * @return {?} */ AnimationTransitionNamespace.prototype.trigger = /** * @param {?} element * @param {?} triggerName * @param {?} value * @param {?=} defaultToFallback * @return {?} */ function (element, triggerName, value, defaultToFallback) { var _this = this; if (defaultToFallback === void 0) { defaultToFallback = true; } var /** @type {?} */ trigger = this._getTrigger(triggerName); var /** @type {?} */ player = new TransitionAnimationPlayer(this.id, triggerName, element); var /** @type {?} */ 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 = {}); } var /** @type {?} */ fromState = triggersWithStates[triggerName]; var /** @type {?} */ toState = new StateValue(value, this.id); var /** @type {?} */ isObj = value && value.hasOwnProperty('value'); if (!isObj && fromState) { toState.absorbOptions(fromState.options); } triggersWithStates[triggerName] = toState; if (!fromState) { fromState = DEFAULT_STATE_VALUE; } else if (fromState === DELETED_STATE_VALUE) { return player; } var /** @type {?} */ 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)) { var /** @type {?} */ errors = []; var /** @type {?} */ fromStyles_1 = trigger.matchStyles(fromState.value, fromState.params, errors); var /** @type {?} */ toStyles_1 = trigger.matchStyles(toState.value, toState.params, errors); if (errors.length) { this._engine.reportError(errors); } else { this._engine.afterFlush(function () { eraseStyles(element, fromStyles_1); setStyles(element, toStyles_1); }); } } return; } var /** @type {?} */ playersOnElement = getOrSetAsInMap(this._engine.playersByElement, element, []); playersOnElement.forEach(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 == _this.id && player.triggerName == triggerName && player.queued) { player.destroy(); } }); var /** @type {?} */ transition = trigger.matchTransition(fromState.value, toState.value); var /** @type {?} */ 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(function () { removeClass(element, QUEUED_CLASSNAME); }); } player.onDone(function () { var /** @type {?} */ index = _this.players.indexOf(player); if (index >= 0) { _this.players.splice(index, 1); } var /** @type {?} */ players = _this._engine.playersByElement.get(element); if (players) { var /** @type {?} */ index_1 = players.indexOf(player); if (index_1 >= 0) { players.splice(index_1, 1); } } }); this.players.push(player); playersOnElement.push(player); return player; }; /** * @param {?} name * @return {?} */ AnimationTransitionNamespace.prototype.deregister = /** * @param {?} name * @return {?} */ function (name) { var _this = this; delete this._triggers[name]; this._engine.statesByElement.forEach(function (stateMap, element) { delete stateMap[name]; }); this._elementListeners.forEach(function (listeners, element) { _this._elementListeners.set(element, listeners.filter(function (entry) { return entry.name != name; })); }); }; /** * @param {?} element * @return {?} */ AnimationTransitionNamespace.prototype.clearElementCache = /** * @param {?} element * @return {?} */ function (element) { this._engine.statesByElement.delete(element); this._elementListeners.delete(element); var /** @type {?} */ elementPlayers = this._engine.playersByElement.get(element); if (elementPlayers) { elementPlayers.forEach(function (player) { return player.destroy(); }); this._engine.playersByElement.delete(element); } }; /** * @param {?} rootElement * @param {?} context * @param {?=} animate * @return {?} */ AnimationTransitionNamespace.prototype._signalRemovalForInnerTriggers = /** * @param {?} rootElement * @param {?} context * @param {?=} animate * @return {?} */ function (rootElement, context, animate) { var _this = this; if (animate === void 0) { animate = false; } // 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. this._engine.driver.query(rootElement, NG_TRIGGER_SELECTOR, true).forEach(function (elm) { // this means that an inner remove() operation has already kicked off // the animation on this element... if (elm[REMOVAL_FLAG]) return; var /** @type {?} */ namespaces = _this._engine.fetchNamespacesByElement(elm); if (namespaces.size) { namespaces.forEach(function (ns) { return ns.triggerLeaveAnimation(elm, context, false, true); }); } else { _this.clearElementCache(elm); } }); }; /** * @param {?} element * @param {?} context * @param {?=} destroyAfterComplete * @param {?=} defaultToFallback * @return {?} */ AnimationTransitionNamespace.prototype.triggerLeaveAnimation = /** * @param {?} element * @param {?} context * @param {?=} destroyAfterComplete * @param {?=} defaultToFallback * @return {?} */ function (element, context, destroyAfterComplete, defaultToFallback) { var _this = this; var /** @type {?} */ triggerStates = this._engine.statesByElement.get(element); if (triggerStates) { var /** @type {?} */ players_1 = []; Object.keys(triggerStates).forEach(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 (_this._triggers[triggerName]) { var /** @type {?} */ player = _this.trigger(element, triggerName, VOID_VALUE, defaultToFallback); if (player) { players_1.push(player); } } }); if (players_1.length) { this._engine.markElementAsRemoved(this.id, element, true, context); if (destroyAfterComplete) { optimizeGroupPlayer(players_1).onDone(function () { return _this._engine.processLeaveNode(element); }); } return true; } } return false; }; /** * @param {?} element * @return {?} */ AnimationTransitionNamespace.prototype.prepareLeaveAnimationListeners = /** * @param {?} element * @return {?} */ function (element) { var _this = this; var /** @type {?} */ listeners = this._elementListeners.get(element); if (listeners) { var /** @type {?} */ visitedTriggers_1 = new Set(); listeners.forEach(function (listener) { var /** @type {?} */ triggerName = listener.name; if (visitedTriggers_1.has(triggerName)) return; visitedTriggers_1.add(triggerName); var /** @type {?} */ trigger = _this._triggers[triggerName]; var /** @type {?} */ transition = trigger.fallbackTransition; var /** @type {?} */ elementStates = /** @type {?} */ ((_this._engine.statesByElement.get(element))); var /** @type {?} */ fromState = elementStates[triggerName] || DEFAULT_STATE_VALUE; var /** @type {?} */ toState = new StateValue(VOID_VALUE); var /** @type {?} */ player = new TransitionAnimationPlayer(_this.id, triggerName, element); _this._engine.totalQueuedPlayers++; _this._queue.push({ element: element, triggerName: triggerName, transition: transition, fromState: fromState, toState: toState, player: player, isFallbackTransition: true }); }); } }; /** * @param {?} element * @param {?} context * @return {?} */ AnimationTransitionNamespace.prototype.removeNode = /** * @param {?} element * @param {?} context * @return {?} */ function (element, context) { var _this = this; var /** @type {?} */ engine = this._engine; if (element.childElementCount) { this._signalRemovalForInnerTriggers(element, context, true); } // 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 var /** @type {?} */ containsPotentialParentTransition = false; if (engine.totalAnimations) { var /** @type {?} */ 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 fowards and // allow the element to be queued up for animation later. if (currentPlayers && currentPlayers.length) { containsPotentialParentTransition = true; } else { var /** @type {?} */ parent_1 = element; while (parent_1 = parent_1.parentNode) { var /** @type {?} */ triggers = engine.statesByElement.get(parent_1); 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 { // we do this after the flush has occurred such // that the callbacks can be fired engine.afterFlush(function () { return _this.clearElementCache(element); }); engine.destroyInnerAnimations(element); engine._onRemovalComplete(element, context); } }; /** * @param {?} element * @param {?} parent * @return {?} */ AnimationTransitionNamespace.prototype.insertNode = /** * @param {?} element * @param {?} parent * @return {?} */ function (element, parent) { addClass(element, this._hostClassName); }; /** * @param {?} microtaskId * @return {?} */ AnimationTransitionNamespace.prototype.drainQueuedTransitions = /** * @param {?} microtaskId * @return {?} */ function (microtaskId) { var _this = this; var /** @type {?} */ instructions = []; this._queue.forEach(function (entry) { var /** @type {?} */ player = entry.player; if (player.destroyed) return; var /** @type {?} */ element = entry.element; var /** @type {?} */ listeners = _this._elementListeners.get(element); if (listeners) { listeners.forEach(function (listener) { if (listener.name == entry.triggerName) { var /** @type {?} */ 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) { _this._engine.afterFlush(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(function (a, b) { // if depCount == 0 them move to front // otherwise if a contains b then move back var /** @type {?} */ d0 = a.transition.ast.depCount; var /** @type {?} */ d1 = b.transition.ast.depCount; if (d0 == 0 || d1 == 0) { return d0 - d1; } return _this._engine.driver.containsElement(a.element, b.element) ? 1 : -1; }); }; /** * @param {?} context * @return {?} */ AnimationTransitionNamespace.prototype.destroy = /** * @param {?} context * @return {?} */ function (context) { this.players.forEach(function (p) { return p.destroy(); }); this._signalRemovalForInnerTriggers(this.hostElement, context); }; /** * @param {?} element * @return {?} */ AnimationTransitionNamespace.prototype.elementContainsData = /** * @param {?} element * @return {?} */ function (element) { var /** @type {?} */ containsData = false; if (this._elementListeners.has(element)) containsData = true; containsData = (this._queue.find(function (entry) { return entry.element === element; }) ? true : false) || containsData; return containsData; }; return AnimationTransitionNamespace; }()); /** * @record */ var TransitionAnimationEngine = /** @class */ (function () { function TransitionAnimationEngine(driver, _normalizer) { this.driver = driver; this._normalizer = _normalizer; this.players = []; this.newHostElements = new Map(); this.playersByElement = new Map(); this.playersByQueriedElement = new Map(); this.statesByElement = new Map(); this.disabledNodes = new Set(); this.totalAnimations = 0; this.totalQueuedPlayers = 0; this._namespaceLookup = {}; this._namespaceList = []; this._flushFns = []; this._whenQuietFns = []; this.namespacesByHostElement = new Map(); this.collectedEnterElements = []; this.collectedLeaveElements = []; this.onRemovalComplete = function (element, context) { }; } /** @internal */ /** * \@internal * @param {?} element * @param {?} context * @return {?} */ TransitionAnimationEngine.prototype._onRemovalComplete = /** * \@internal * @param {?} element * @param {?} context * @return {?} */ function (element, context) { this.onRemovalComplete(element, context); }; Object.defineProperty(TransitionAnimationEngine.prototype, "queuedPlayers", { get: /** * @return {?} */ function () { var /** @type {?} */ players = []; this._namespaceList.forEach(function (ns) { ns.players.forEach(function (player) { if (player.queued) { players.push(player); } }); }); return players; }, enumerable: true, configurable: true }); /** * @param {?} namespaceId * @param {?} hostElement * @return {?} */ TransitionAnimationEngine.prototype.createNamespace = /** * @param {?} namespaceId * @param {?} hostElement * @return {?} */ function (namespaceId, hostElement) { var /** @type {?} */ 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; }; /** * @param {?} ns * @param {?} hostElement * @return {?} */ TransitionAnimationEngine.prototype._balanceNamespaceList = /** * @param {?} ns * @param {?} hostElement * @return {?} */ function (ns, hostElement) { var /** @type {?} */ limit = this._namespaceList.length - 1; if (limit >= 0) { var /** @type {?} */ found = false; for (var /** @type {?} */ i = limit; i >= 0; i--) { var /** @type {?} */ 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 {?} */ TransitionAnimationEngine.prototype.register = /** * @param {?} namespaceId * @param {?} hostElement * @return {?} */ function (namespaceId, hostElement) { var /** @type {?} */ ns = this._namespaceLookup[namespaceId]; if (!ns) { ns = this.createNamespace(namespaceId, hostElement); } return ns; }; /** * @param {?} namespaceId * @param {?} name * @param {?} trigger * @return {?} */ TransitionAnimationEngine.prototype.registerTrigger = /** * @param {?} namespaceId * @param {?} name * @param {?} trigger * @return {?} */ function (namespaceId, name, trigger) { var /** @type {?} */ ns = this._namespaceLookup[namespaceId]; if (ns && ns.register(name, trigger)) { this.totalAnimations++; } }; /** * @param {?} namespaceId * @param {?} context * @return {?} */ TransitionAnimationEngine.prototype.destroy = /** * @param {?} namespaceId * @param {?} context * @return {?} */ function (namespaceId, context) { var _this = this; if (!namespaceId) return; var /** @type {?} */ ns = this._fetchNamespace(namespaceId); this.afterFlush(function () { _this.namespacesByHostElement.delete(ns.hostElement); delete _this._namespaceLookup[namespaceId]; var /** @type {?} */ index = _this._namespaceList.indexOf(ns); if (index >= 0) { _this._namespaceList.splice(index, 1); } }); this.afterFlushAnimationsDone(function () { return ns.destroy(context); }); }; /** * @param {?} id * @return {?} */ TransitionAnimationEngine.prototype._fetchNamespace = /** * @param {?} id * @return {?} */ function (id) { return this._namespaceLookup[id]; }; /** * @param {?} element * @return {?} */ TransitionAnimationEngine.prototype.fetchNamespacesByElement = /** * @param {?} element * @return {?} */ function (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 var /** @type {?} */ namespaces = new Set(); var /** @type {?} */ elementStates = this.statesByElement.get(element); if (elementStates) { var /** @type {?} */ keys = Object.keys(elementStates); for (var /** @type {?} */ i = 0; i < keys.length; i++) { var /** @type {?} */ nsId = elementStates[keys[i]].namespaceId; if (nsId) { var /** @type {?} */ ns = this._fetchNamespace(nsId); if (ns) { namespaces.add(ns); } } } } return namespaces; }; /** * @param {?} namespaceId * @param {?} element * @param {?} name * @param {?} value * @return {?} */ TransitionAnimationEngine.prototype.trigger = /** * @param {?} namespaceId * @param {?} element * @param {?} name * @param {?} value * @return {?} */ function (namespaceId, element, name, value) { if (isElementNode(element)) { this._fetchNamespace(namespaceId).trigger(element, name, value); return true; } return false; }; /** * @param {?} namespaceId * @param {?} element * @param {?} parent * @param {?} insertBefore * @return {?} */ TransitionAnimationEngine.prototype.insertNode = /** * @param {?} namespaceId * @param {?} element * @param {?} parent * @param {?} insertBefore * @return {?} */ function (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 var /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); if (details && details.setForRemoval) { details.setForRemoval = false; } // 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) { this._fetchNamespace(namespaceId).insertNode(element, parent); } // only *directives and host elements are inserted before if (insertBefore) { this.collectEnterElement(element); } }; /** * @param {?} element * @return {?} */ TransitionAnimationEngine.prototype.collectEnterElement = /** * @param {?} element * @return {?} */ function (element) { this.collectedEnterElements.push(element); }; /** * @param {?} element * @param {?} value * @return {?} */ TransitionAnimationEngine.prototype.markElementAsDisabled = /** * @param {?} element * @param {?} value * @return {?} */ function (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 {?} context * @return {?} */ TransitionAnimationEngine.prototype.removeNode = /** * @param {?} namespaceId * @param {?} element * @param {?} context * @return {?} */ function (namespaceId, element, context) { if (!isElementNode(element)) { this._onRemovalComplete(element, context); return; } var /** @type {?} */ ns = namespaceId ? this._fetchNamespace(namespaceId) : null; if (ns) { ns.removeNode(element, context); } else { this.markElementAsRemoved(namespaceId, element, false, context); } }; /** * @param {?} namespaceId * @param {?} element * @param {?=} hasAnimation * @param {?=} context * @return {?} */ TransitionAnimationEngine.prototype.markElementAsRemoved = /** * @param {?} namespaceId * @param {?} element * @param {?=} hasAnimation * @param {?=} context * @return {?} */ function (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 {?} */ TransitionAnimationEngine.prototype.listen = /** * @param {?} namespaceId * @param {?} element * @param {?} name * @param {?} phase * @param {?} callback * @return {?} */ function (namespaceId, element, name, phase, callback) { if (isElementNode(element)) { return this._fetchNamespace(namespaceId).listen(element, name, phase, callback); } return function () { }; }; /** * @param {?} entry * @param {?} subTimelines * @param {?} enterClassName * @param {?} leaveClassName * @return {?} */ TransitionAnimationEngine.prototype._buildInstruction = /** * @param {?} entry * @param {?} subTimelines * @param {?} enterClassName * @param {?} leaveClassName * @return {?} */ function (entry, subTimelines, enterClassName, leaveClassName) { return entry.transition.build(this.driver, entry.element, entry.fromState.value, entry.toState.value, enterClassName, leaveClassName, entry.fromState.options, entry.toState.options, subTimelines); }; /** * @param {?} containerElement * @return {?} */ TransitionAnimationEngine.prototype.destroyInnerAnimations = /** * @param {?} containerElement * @return {?} */ function (containerElement) { var _this = this; var /** @type {?} */ elements = this.driver.query(containerElement, NG_TRIGGER_SELECTOR, true); elements.forEach(function (element) { return _this.destroyActiveAnimationsForElement(element); }); if (this.playersByQueriedElement.size == 0) return; elements = this.driver.query(containerElement, NG_ANIMATING_SELECTOR, true); elements.forEach(function (element) { return _this.finishActiveQueriedAnimationOnElement(element); }); }; /** * @param {?} element * @return {?} */ TransitionAnimationEngine.prototype.destroyActiveAnimationsForElement = /** * @param {?} element * @return {?} */ function (element) { var /** @type {?} */ players = this.playersByElement.get(element); if (players) { players.forEach(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(); } }); } var /** @type {?} */ stateMap = this.statesByElement.get(element); if (stateMap) { Object.keys(stateMap).forEach(function (triggerName) { return stateMap[triggerName] = DELETED_STATE_VALUE; }); } }; /** * @param {?} element * @return {?} */ TransitionAnimationEngine.prototype.finishActiveQueriedAnimationOnElement = /** * @param {?} element * @return {?} */ function (element) { var /** @type {?} */ players = this.playersByQueriedElement.get(element); if (players) { players.forEach(function (player) { return player.finish(); }); } }; /** * @return {?} */ TransitionAnimationEngine.prototype.whenRenderingDone = /** * @return {?} */ function () { var _this = this; return new Promise(function (resolve) { if (_this.players.length) { return optimizeGroupPlayer(_this.players).onDone(function () { return resolve(); }); } else { resolve(); } }); }; /** * @param {?} element * @return {?} */ TransitionAnimationEngine.prototype.processLeaveNode = /** * @param {?} element * @return {?} */ function (element) { var _this = this; var /** @type {?} */ 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); var /** @type {?} */ 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(function (node) { _this.markElementAsDisabled(element, false); }); }; /** * @param {?=} microtaskId * @return {?} */ TransitionAnimationEngine.prototype.flush = /** * @param {?=} microtaskId * @return {?} */ function (microtaskId) { var _this = this; if (microtaskId === void 0) { microtaskId = -1; } var /** @type {?} */ players = []; if (this.newHostElements.size) { this.newHostElements.forEach(function (ns, element) { return _this._balanceNamespaceList(ns, element); }); this.newHostElements.clear(); } if (this.totalAnimations && this.collectedEnterElements.length) { for (var /** @type {?} */ i = 0; i < this.collectedEnterElements.length; i++) { var /** @type {?} */ elm = this.collectedEnterElements[i]; addClass(elm, STAR_CLASSNAME); } } if (this._namespaceList.length && (this.totalQueuedPlayers || this.collectedLeaveElements.length)) { var /** @type {?} */ cleanupFns = []; try { players = this._flushAnimations(cleanupFns, microtaskId); } finally { for (var /** @type {?} */ i = 0; i < cleanupFns.length; i++) { cleanupFns[i](); } } } else { for (var /** @type {?} */ i = 0; i < this.collectedLeaveElements.length; i++) { var /** @type {?} */ element = this.collectedLeaveElements[i]; this.processLeaveNode(element); } } this.totalQueuedPlayers = 0; this.collectedEnterElements.length = 0; this.collectedLeaveElements.length = 0; this._flushFns.forEach(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 var /** @type {?} */ quietFns_1 = this._whenQuietFns; this._whenQuietFns = []; if (players.length) { optimizeGroupPlayer(players).onDone(function () { quietFns_1.forEach(function (fn) { return fn(); }); }); } else { quietFns_1.forEach(function (fn) { return fn(); }); } } }; /** * @param {?} errors * @return {?} */ TransitionAnimationEngine.prototype.reportError = /** * @param {?} errors * @return {?} */ function (errors) { throw new Error("Unable to process animations due to the following failed trigger transitions\n " + errors.join('\n')); }; /** * @param {?} cleanupFns * @param {?} microtaskId * @return {?} */ TransitionAnimationEngine.prototype._flushAnimations = /** * @param {?} cleanupFns * @param {?} microtaskId * @return {?} */ function (cleanupFns, microtaskId) { var _this = this; var /** @type {?} */ subTimelines = new ElementInstructionMap(); var /** @type {?} */ skippedPlayers = []; var /** @type {?} */ skippedPlayersMap = new Map(); var /** @type {?} */ queuedInstructions = []; var /** @type {?} */ queriedElements = new Map(); var /** @type {?} */ allPreStyleElements = new Map(); var /** @type {?} */ allPostStyleElements = new Map(); var /** @type {?} */ disabledElementsSet = new Set(); this.disabledNodes.forEach(function (node) { disabledElementsSet.add(node); var /** @type {?} */ nodesThatAreDisabled = _this.driver.query(node, QUEUED_SELECTOR, true); for (var /** @type {?} */ i_1 = 0; i_1 < nodesThatAreDisabled.length; i_1++) { disabledElementsSet.add(nodesThatAreDisabled[i_1]); } }); var /** @type {?} */ bodyNode = getBodyNode(); var /** @type {?} */ allTriggerElements = Array.from(this.statesByElement.keys()); var /** @type {?} */ 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). var /** @type {?} */ enterNodeMapIds = new Map(); var /** @type {?} */ i = 0; enterNodeMap.forEach(function (nodes, root) { var /** @type {?} */ className = ENTER_CLASSNAME + i++; enterNodeMapIds.set(root, className); nodes.forEach(function (node) { return addClass(node, className); }); }); var /** @type {?} */ allLeaveNodes = []; var /** @type {?} */ mergedLeaveNodes = new Set(); var /** @type {?} */ leaveNodesWithoutAnimations = new Set(); for (var /** @type {?} */ i_2 = 0; i_2 < this.collectedLeaveElements.length; i_2++) { var /** @type {?} */ element = this.collectedLeaveElements[i_2]; var /** @type {?} */ 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(function (elm) { return mergedLeaveNodes.add(elm); }); } else { leaveNodesWithoutAnimations.add(element); } } } var /** @type {?} */ leaveNodeMapIds = new Map(); var /** @type {?} */ leaveNodeMap = buildRootMap(allTriggerElements, Array.from(mergedLeaveNodes)); leaveNodeMap.forEach(function (nodes, root) { var /** @type {?} */ className = LEAVE_CLASSNAME + i++; leaveNodeMapIds.set(root, className); nodes.forEach(function (node) { return addClass(node, className); }); }); cleanupFns.push(function () { enterNodeMap.forEach(function (nodes, root) { var /** @type {?} */ className = /** @type {?} */ ((enterNodeMapIds.get(root))); nodes.forEach(function (node) { return removeClass(node, className); }); }); leaveNodeMap.forEach(function (nodes, root) { var /** @type {?} */ className = /** @type {?} */ ((leaveNodeMapIds.get(root))); nodes.forEach(function (node) { return removeClass(node, className); }); }); allLeaveNodes.forEach(function (element) { _this.processLeaveNode(element); }); }); var /** @type {?} */ allPlayers = []; var /** @type {?} */ erroneousTransitions = []; for (var /** @type {?} */ i_3 = this._namespaceList.length - 1; i_3 >= 0; i_3--) { var /** @type {?} */ ns = this._namespaceList[i_3]; ns.drainQueuedTransitions(microtaskId).forEach(function (entry) { var /** @type {?} */ player = entry.player; allPlayers.push(player); var /** @type {?} */ element = entry.element; if (!bodyNode || !_this.driver.containsElement(bodyNode, element)) { player.destroy(); return; } var /** @type {?} */ leaveClassName = /** @type {?} */ ((leaveNodeMapIds.get(element))); var /** @type {?} */ enterClassName = /** @type {?} */ ((enterNodeMapIds.get(element))); var /** @type {?} */ instruction = /** @type {?} */ ((_this._buildInstruction(entry, subTimelines, enterClassName, leaveClassName))); if (instruction.errors && instruction.errors.length) { erroneousTransitions.push(instruction); 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(function () { return eraseStyles(element, instruction.fromStyles); }); player.onDestroy(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(function (tl) { return tl.stretchStartingKeyframe = true; }); subTimelines.append(element, instruction.timelines); var /** @type {?} */ tuple = { instruction: instruction, player: player, element: element }; queuedInstructions.push(tuple); instruction.queriedElements.forEach(function (element) { return getOrSetAsInMap(queriedElements, element, []).push(player); }); instruction.preStyleProps.forEach(function (stringMap, element) { var /** @type {?} */ props = Object.keys(stringMap); if (props.length) { var /** @type {?} */ setVal_1 = /** @type {?} */ ((allPreStyleElements.get(element))); if (!setVal_1) { allPreStyleElements.set(element, setVal_1 = new Set()); } props.forEach(function (prop) { return setVal_1.add(prop); }); } }); instruction.postStyleProps.forEach(function (stringMap, element) { var /** @type {?} */ props = Object.keys(stringMap); var /** @type {?} */ setVal = /** @type {?} */ ((allPostStyleElements.get(element))); if (!setVal) { allPostStyleElements.set(element, setVal = new Set()); } props.forEach(function (prop) { return setVal.add(prop); }); }); }); } if (erroneousTransitions.length) { var /** @type {?} */ errors_1 = []; erroneousTransitions.forEach(function (instruction) { errors_1.push("@" + instruction.triggerName + " has failed due to:\n"); /** @type {?} */ ((instruction.errors)).forEach(function (error) { return errors_1.push("- " + error + "\n"); }); }); allPlayers.forEach(function (player) { return player.destroy(); }); this.reportError(errors_1); } var /** @type {?} */ 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. var /** @type {?} */ animationElementMap = new Map(); queuedInstructions.forEach(function (entry) { var /** @type {?} */ element = entry.element; if (subTimelines.has(element)) { animationElementMap.set(element, element); _this._beforeAnimationBuild(entry.player.namespaceId, entry.instruction, allPreviousPlayersMap); } }); skippedPlayers.forEach(function (player) { var /** @type {?} */ element = player.element; var /** @type {?} */ previousPlayers = _this._getPreviousPlayers(element, false, player.namespaceId, player.triggerName, null); previousPlayers.forEach(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) var /** @type {?} */ replaceNodes = allLeaveNodes.filter(function (node) { return replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements); }); // POST STAGE: fill the * styles var /** @type {?} */ postStylesMap = new Map(); var /** @type {?} */ allLeaveQueriedNodes = cloakAndComputeStyles(postStylesMap, this.driver, leaveNodesWithoutAnimations, allPostStyleElements, __WEBPACK_IMPORTED_MODULE_0__angular_animations__["AUTO_STYLE"]); allLeaveQueriedNodes.forEach(function (node) { if (replacePostStylesAsPre(node, allPreStyleElements, allPostStyleElements)) { replaceNodes.push(node); } }); // PRE STAGE: fill the ! styles var /** @type {?} */ preStylesMap = new Map(); enterNodeMap.forEach(function (nodes, root) { cloakAndComputeStyles(preStylesMap, _this.driver, new Set(nodes), allPreStyleElements, __WEBPACK_IMPORTED_MODULE_0__angular_animations__["ɵPRE_STYLE"]); }); replaceNodes.forEach(function (node) { var /** @type {?} */ post = postStylesMap.get(node); var /** @type {?} */ pre = preStylesMap.get(node); postStylesMap.set(node, /** @type {?} */ (Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __assign */])({}, post, pre))); }); var /** @type {?} */ rootPlayers = []; var /** @type {?} */ subPlayers = []; var /** @type {?} */ NO_PARENT_ANIMATION_ELEMENT_DETECTED = {}; queuedInstructions.forEach(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(function () { return setStyles(element, instruction.toStyles); }); 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). var /** @type {?} */ parentWithAnimation_1 = NO_PARENT_ANIMATION_ELEMENT_DETECTED; if (animationElementMap.size > 1) { var /** @type {?} */ elm = element; var /** @type {?} */ parentsToAdd = []; while (elm = elm.parentNode) { var /** @type {?} */ detectedParent = animationElementMap.get(elm); if (detectedParent) { parentWithAnimation_1 = detectedParent; break; } parentsToAdd.push(elm); } parentsToAdd.forEach(function (parent) { return animationElementMap.set(parent, parentWithAnimation_1); }); } var /** @type {?} */ innerPlayer = _this._buildAnimation(player.namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap); player.setRealPlayer(innerPlayer); if (parentWithAnimation_1 === NO_PARENT_ANIMATION_ELEMENT_DETECTED) { rootPlayers.push(player); } else { var /** @type {?} */ parentPlayers = _this.playersByElement.get(parentWithAnimation_1); if (parentPlayers && parentPlayers.length) { player.parentPlayer = optimizeGroupPlayer(parentPlayers); } skippedPlayers.push(player); } } else { eraseStyles(element, instruction.fromStyles); player.onDestroy(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(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 var /** @type {?} */ playersForElement = skippedPlayersMap.get(player.element); if (playersForElement && playersForElement.length) { var /** @type {?} */ 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(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 /** @type {?} */ i_4 = 0; i_4 < allLeaveNodes.length; i_4++) { var /** @type {?} */ element = allLeaveNodes[i_4]; var /** @type {?} */ details = /** @type {?} */ (element[REMOVAL_FLAG]); removeClass(element, 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 (details && details.hasAnimation) continue; var /** @type {?} */ 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) { var /** @type {?} */ queriedPlayerResults = queriedElements.get(element); if (queriedPlayerResults && queriedPlayerResults.length) { players.push.apply(players, queriedPlayerResults); } var /** @type {?} */ queriedInnerElements = this.driver.query(element, NG_ANIMATING_SELECTOR, true); for (var /** @type {?} */ j = 0; j < queriedInnerElements.length; j++) { var /** @type {?} */ queriedPlayers = queriedElements.get(queriedInnerElements[j]); if (queriedPlayers && queriedPlayers.length) { players.push.apply(players, queriedPlayers); } } } var /** @type {?} */ activePlayers = players.filter(function (p) { return !p.destroyed; }); if (activePlayers.length) { removeNodesAfterAnimationDone(this, element, activePlayers); } else { this.processLeaveNode(element); } } // this is required so the cleanup method doesn't remove them allLeaveNodes.length = 0; rootPlayers.forEach(function (player) { _this.players.push(player); player.onDone(function () { player.destroy(); var /** @type {?} */ index = _this.players.indexOf(player); _this.players.splice(index, 1); }); player.play(); }); return rootPlayers; }; /** * @param {?} namespaceId * @param {?} element * @return {?} */ TransitionAnimationEngine.prototype.elementContainsData = /** * @param {?} namespaceId * @param {?} element * @return {?} */ function (namespaceId, element) { var /** @type {?} */ containsData = false; var /** @type {?} */ 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 {?} */ TransitionAnimationEngine.prototype.afterFlush = /** * @param {?} callback * @return {?} */ function (callback) { this._flushFns.push(callback); }; /** * @param {?} callback * @return {?} */ TransitionAnimationEngine.prototype.afterFlushAnimationsDone = /** * @param {?} callback * @return {?} */ function (callback) { this._whenQuietFns.push(callback); }; /** * @param {?} element * @param {?} isQueriedElement * @param {?=} namespaceId * @param {?=} triggerName * @param {?=} toStateValue * @return {?} */ TransitionAnimationEngine.prototype._getPreviousPlayers = /** * @param {?} element * @param {?} isQueriedElement * @param {?=} namespaceId * @param {?=} triggerName * @param {?=} toStateValue * @return {?} */ function (element, isQueriedElement, namespaceId, triggerName, toStateValue) { var /** @type {?} */ players = []; if (isQueriedElement) { var /** @type {?} */ queriedElementPlayers = this.playersByQueriedElement.get(element); if (queriedElementPlayers) { players = queriedElementPlayers; } } else { var /** @type {?} */ elementPlayers = this.playersByElement.get(element); if (elementPlayers) { var /** @type {?} */ isRemovalAnimation_1 = !toStateValue || toStateValue == VOID_VALUE; elementPlayers.forEach(function (player) { if (player.queued) return; if (!isRemovalAnimation_1 && player.triggerName != triggerName) return; players.push(player); }); } } if (namespaceId || triggerName) { players = players.filter(function (player) { if (namespaceId && namespaceId != player.namespaceId) return false; if (triggerName && triggerName != player.triggerName) return false; return true; }); } return players; }; /** * @param {?} namespaceId * @param {?} instruction * @param {?} allPreviousPlayersMap * @return {?} */ TransitionAnimationEngine.prototype._beforeAnimationBuild = /** * @param {?} namespaceId * @param {?} instruction * @param {?} allPreviousPlayersMap * @return {?} */ function (namespaceId, instruction, allPreviousPlayersMap) { var /** @type {?} */ triggerName = instruction.triggerName; var /** @type {?} */ rootElement = instruction.element; // when a removal animation occurs, ALL previous players are collected // and destroyed (even if they are outside of the current namespace) var /** @type {?} */ targetNameSpaceId = instruction.isRemovalTransition ? undefined : namespaceId; var /** @type {?} */ targetTriggerName = instruction.isRemovalTransition ? undefined : triggerName; var _loop_1 = function (timelineInstruction) { var /** @type {?} */ element = timelineInstruction.element; var /** @type {?} */ isQueriedElement = element !== rootElement; var /** @type {?} */ players = getOrSetAsInMap(allPreviousPlayersMap, element, []); var /** @type {?} */ previousPlayers = this_1._getPreviousPlayers(element, isQueriedElement, targetNameSpaceId, targetTriggerName, instruction.toState); previousPlayers.forEach(function (player) { var /** @type {?} */ realPlayer = /** @type {?} */ (player.getRealPlayer()); if (realPlayer.beforeDestroy) { realPlayer.beforeDestroy(); } player.destroy(); players.push(player); }); }; var this_1 = this; for (var _i = 0, _a = instruction.timelines; _i < _a.length; _i++) { var timelineInstruction = _a[_i]; _loop_1(timelineInstruction); } // this needs to be done so that the PRE/POST styles can be // computed properly without interfering with the previous animation eraseStyles(rootElement, instruction.fromStyles); }; /** * @param {?} namespaceId * @param {?} instruction * @param {?} allPreviousPlayersMap * @param {?} skippedPlayersMap * @param {?} preStylesMap * @param {?} postStylesMap * @return {?} */ TransitionAnimationEngine.prototype._buildAnimation = /** * @param {?} namespaceId * @param {?} instruction * @param {?} allPreviousPlayersMap * @param {?} skippedPlayersMap * @param {?} preStylesMap * @param {?} postStylesMap * @return {?} */ function (namespaceId, instruction, allPreviousPlayersMap, skippedPlayersMap, preStylesMap, postStylesMap) { var _this = this; var /** @type {?} */ triggerName = instruction.triggerName; var /** @type {?} */ rootElement = instruction.element; // we first run this so that the previous animation player // data can be passed into the successive animation players var /** @type {?} */ allQueriedPlayers = []; var /** @type {?} */ allConsumedElements = new Set(); var /** @type {?} */ allSubElements = new Set(); var /** @type {?} */ allNewPlayers = instruction.timelines.map(function (timelineInstruction) { var /** @type {?} */ element = timelineInstruction.element; allConsumedElements.add(element); // FIXME (matsko): make sure to-be-removed animations are removed properly var /** @type {?} */ details = element[REMOVAL_FLAG]; if (details && details.removedBeforeQueried) return new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["NoopAnimationPlayer"](); var /** @type {?} */ isQueriedElement = element !== rootElement; var /** @type {?} */ previousPlayers = flattenGroupPlayers((allPreviousPlayersMap.get(element) || EMPTY_PLAYER_ARRAY) .map(function (p) { return p.getRealPlayer(); })) .filter(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 var /** @type {?} */ pp = /** @type {?} */ (p); return pp.element ? pp.element === element : false; }); var /** @type {?} */ preStyles = preStylesMap.get(element); var /** @type {?} */ postStyles = postStylesMap.get(element); var /** @type {?} */ keyframes = normalizeKeyframes(_this.driver, _this._normalizer, element, timelineInstruction.keyframes, preStyles, postStyles); var /** @type {?} */ player = _this._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) { var /** @type {?} */ wrappedPlayer = new TransitionAnimationPlayer(namespaceId, triggerName, element); wrappedPlayer.setRealPlayer(player); allQueriedPlayers.push(wrappedPlayer); } return player; }); allQueriedPlayers.forEach(function (player) { getOrSetAsInMap(_this.playersByQueriedElement, player.element, []).push(player); player.onDone(function () { return deleteOrUnsetInMap(_this.playersByQueriedElement, player.element, player); }); }); allConsumedElements.forEach(function (element) { return addClass(element, NG_ANIMATING_CLASSNAME); }); var /** @type {?} */ player = optimizeGroupPlayer(allNewPlayers); player.onDestroy(function () { allConsumedElements.forEach(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(function (element) { getOrSetAsInMap(skippedPlayersMap, element, []).push(player); }); return player; }; /** * @param {?} instruction * @param {?} keyframes * @param {?} previousPlayers * @return {?} */ TransitionAnimationEngine.prototype._buildPlayer = /** * @param {?} instruction * @param {?} keyframes * @param {?} previousPlayers * @return {?} */ function (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 __WEBPACK_IMPORTED_MODULE_0__angular_animations__["NoopAnimationPlayer"](); }; return TransitionAnimationEngine; }()); var TransitionAnimationPlayer = /** @class */ (function () { function TransitionAnimationPlayer(namespaceId, triggerName, element) { this.namespaceId = namespaceId; this.triggerName = triggerName; this.element = element; this._player = new __WEBPACK_IMPORTED_MODULE_0__angular_animations__["NoopAnimationPlayer"](); this._containsRealPlayer = false; this._queuedCallbacks = {}; this.destroyed = false; this.markedForDestroy = false; this.queued = true; } /** * @param {?} player * @return {?} */ TransitionAnimationPlayer.prototype.setRealPlayer = /** * @param {?} player * @return {?} */ function (player) { var _this = this; if (this._containsRealPlayer) return; this._player = player; Object.keys(this._queuedCallbacks).forEach(function (phase) { _this._queuedCallbacks[phase].forEach(function (callback) { return listenOnPlayer(player, phase, undefined, callback); }); }); this._queuedCallbacks = {}; this._containsRealPlayer = true; (/** @type {?} */ (this)).queued = false; }; /** * @return {?} */ TransitionAnimationPlayer.prototype.getRealPlayer = /** * @return {?} */ function () { return this._player; }; /** * @param {?} player * @return {?} */ TransitionAnimationPlayer.prototype.syncPlayerEvents = /** * @param {?} player * @return {?} */ function (player) { var _this = this; var /** @type {?} */ p = /** @type {?} */ (this._player); if (p.triggerCallback) { player.onStart(function () { return p.triggerCallback('start'); }); } player.onDone(function () { return _this.finish(); }); player.onDestroy(function () { return _this.destroy(); }); }; /** * @param {?} name * @param {?} callback * @return {?} */ TransitionAnimationPlayer.prototype._queueEvent = /** * @param {?} name * @param {?} callback * @return {?} */ function (name, callback) { getOrSetAsInMap(this._queuedCallbacks, name, []).push(callback); }; /** * @param {?} fn * @return {?} */ TransitionAnimationPlayer.prototype.onDone = /** * @param {?} fn * @return {?} */ function (fn) { if (this.queued) { this._queueEvent('done', fn); } this._player.onDone(fn); }; /** * @param {?} fn * @return {?} */ TransitionAnimationPlayer.prototype.onStart = /** * @param {?} fn * @return {?} */ function (fn) { if (this.queued) { this._queueEvent('start', fn); } this._player.onStart(fn); }; /** * @param {?} fn * @return {?} */ TransitionAnimationPlayer.prototype.onDestroy = /** * @param {?} fn * @return {?} */ function (fn) { if (this.queued) { this._queueEvent('destroy', fn); } this._player.onDestroy(fn); }; /** * @return {?} */ TransitionAnimationPlayer.prototype.init = /** * @return {?} */ function () { this._player.init(); }; /** * @return {?} */ TransitionAnimationPlayer.prototype.hasStarted = /** * @return {?} */ function () { return this.queued ? false : this._player.hasStarted(); }; /** * @return {?} */ TransitionAnimationPlayer.prototype.play = /** * @return {?} */ function () { !this.queued && this._player.play(); }; /** * @return {?} */ TransitionAnimationPlayer.prototype.pause = /** * @return {?} */ function () { !this.queued && this._player.pause(); }; /** * @return {?} */ TransitionAnimationPlayer.prototype.restart = /** * @return {?} */ function () { !this.queued && this._player.restart(); }; /** * @return {?} */ TransitionAnimationPlayer.prototype.finish = /** * @return {?} */ function () { this._player.finish(); }; /** * @return {?} */ TransitionAnimationPlayer.prototype.destroy = /** * @return {?} */ function () { (/** @type {?} */ (this)).destroyed = true; this._player.destroy(); }; /** * @return {?} */ TransitionAnimationPlayer.prototype.reset = /** * @return {?} */ function () { !this.queued && this._player.reset(); }; /** * @param {?} p * @return {?} */ TransitionAnimationPlayer.prototype.setPosition = /** * @param {?} p * @return {?} */ function (p) { if (!this.queued) { this._player.setPosition(p); } }; /** * @return {?} */ TransitionAnimationPlayer.prototype.getPosition = /** * @return {?} */ function () { return this.queued ? 0 : this._player.getPosition(); }; Object.defineProperty(TransitionAnimationPlayer.prototype, "totalTime", { get: /** * @return {?} */ function () { return this._player.totalTime; }, enumerable: true, configurable: true }); /* @internal */ /** * @param {?} phaseName * @return {?} */ TransitionAnimationPlayer.prototype.triggerCallback = /** * @param {?} phaseName * @return {?} */ function (phaseName) { var /** @type {?} */ p = /** @type {?} */ (this._player); if (p.triggerCallback) { p.triggerCallback(phaseName); } }; return TransitionAnimationPlayer; }()); /** * @param {?} map * @param {?} key * @param {?} value * @return {?} */ function deleteOrUnsetInMap(map, key, value) { var /** @type {?} */ currentValues; if (map instanceof Map) { currentValues = map.get(key); if (currentValues) { if (currentValues.length) { var /** @type {?} */ index = currentValues.indexOf(value); currentValues.splice(index, 1); } if (currentValues.length == 0) { map.delete(key); } } } else { currentValues = map[key]; if (currentValues) { if (currentValues.length) { var /** @type {?} */ index = currentValues.indexOf(value); currentValues.splice(index, 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) { var /** @type {?} */ 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) { var /** @type {?} */ cloakVals = []; elements.forEach(function (element) { return cloakVals.push(cloakElement(element)); }); var /** @type {?} */ failedElements = []; elementPropsMap.forEach(function (props, element) { var /** @type {?} */ styles = {}; props.forEach(function (prop) { var /** @type {?} */ 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) var /** @type {?} */ i = 0; elements.forEach(function (element) { return cloakElement(element, cloakVals[i++]); }); return failedElements; } /** * @param {?} roots * @param {?} nodes * @return {?} */ function buildRootMap(roots, nodes) { var /** @type {?} */ rootMap = new Map(); roots.forEach(function (root) { return rootMap.set(root, []); }); if (nodes.length == 0) return rootMap; var /** @type {?} */ NULL_NODE = 1; var /** @type {?} */ nodeSet = new Set(nodes); var /** @type {?} */ localRootMap = new Map(); /** * @param {?} node * @return {?} */ function getRoot(node) { if (!node) return NULL_NODE; var /** @type {?} */ root = localRootMap.get(node); if (root) return root; var /** @type {?} */ 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(function (node) { var /** @type {?} */ root = getRoot(node); if (root !== NULL_NODE) { /** @type {?} */ ((rootMap.get(root))).push(node); } }); return rootMap; } var CLASSES_CACHE_KEY = '$$classes'; /** * @param {?} element * @param {?} className * @return {?} */ function addClass(element, className) { if (element.classList) { element.classList.add(className); } else { var /** @type {?} */ 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 { var /** @type {?} */ 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(function () { return engine.processLeaveNode(element); }); } /** * @param {?} players * @return {?} */ function flattenGroupPlayers(players) { var /** @type {?} */ finalPlayers = []; _flattenGroupPlayersRecur(players, finalPlayers); return finalPlayers; } /** * @param {?} players * @param {?} finalPlayers * @return {?} */ function _flattenGroupPlayersRecur(players, finalPlayers) { for (var /** @type {?} */ i = 0; i < players.length; i++) { var /** @type {?} */ player = players[i]; if (player instanceof __WEBPACK_IMPORTED_MODULE_0__angular_animations__["ɵAnimationGroupPlayer"]) { _flattenGroupPlayersRecur(player.players, finalPlayers); } else { finalPlayers.push(/** @type {?} */ (player)); } } } /** * @param {?} a * @param {?} b * @return {?} */ function objEquals(a, b) { var /** @type {?} */ k1 = Object.keys(a); var /** @type {?} */ k2 = Object.keys(b); if (k1.length != k2.length) return false; for (var /** @type {?} */ i = 0; i < k1.length; i++) { var /** @type {?} */ 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) { var /** @type {?} */ postEntry = allPostStyleElements.get(element); if (!postEntry) return false; var /** @type {?} */ preEntry = allPreStyleElements.get(element); if (preEntry) { postEntry.forEach(function (data) { return ((preEntry)).add(data); }); } else { allPreStyleElements.set(element, postEntry); } allPostStyleElements.delete(element); return true; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var AnimationEngine = /** @class */ (function () { function AnimationEngine(_driver, normalizer) { var _this = this; this._driver = _driver; this._triggerCache = {}; this.onRemovalComplete = function (element, context) { }; this._transitionEngine = new TransitionAnimationEngine(_driver, normalizer); this._timelineEngine = new TimelineAnimationEngine(_driver, normalizer); this._transitionEngine.onRemovalComplete = function (element, context) { return _this.onRemovalComplete(element, context); }; } /** * @param {?} componentId * @param {?} namespaceId * @param {?} hostElement * @param {?} name * @param {?} metadata * @return {?} */ AnimationEngine.prototype.registerTrigger = /** * @param {?} componentId * @param {?} namespaceId * @param {?} hostElement * @param {?} name * @param {?} metadata * @return {?} */ function (componentId, namespaceId, hostElement, name, metadata) { var /** @type {?} */ cacheKey = componentId + '-' + name; var /** @type {?} */ trigger = this._triggerCache[cacheKey]; if (!trigger) { var /** @type {?} */ errors = []; var /** @type {?} */ ast = /** @type {?} */ (buildAnimationAst(this._driver, /** @type {?} */ (metadata), errors)); if (errors.length) { throw new Error("The animation trigger \"" + name + "\" has failed to build due to the following errors:\n - " + errors.join("\n - ")); } trigger = buildTrigger(name, ast); this._triggerCache[cacheKey] = trigger; } this._transitionEngine.registerTrigger(namespaceId, name, trigger); }; /** * @param {?} namespaceId * @param {?} hostElement * @return {?} */ AnimationEngine.prototype.register = /** * @param {?} namespaceId * @param {?} hostElement * @return {?} */ function (namespaceId, hostElement) { this._transitionEngine.register(namespaceId, hostElement); }; /** * @param {?} namespaceId * @param {?} context * @return {?} */ AnimationEngine.prototype.destroy = /** * @param {?} namespaceId * @param {?} context * @return {?} */ function (namespaceId, context) { this._transitionEngine.destroy(namespaceId, context); }; /** * @param {?} namespaceId * @param {?} element * @param {?} parent * @param {?} insertBefore * @return {?} */ AnimationEngine.prototype.onInsert = /** * @param {?} namespaceId * @param {?} element * @param {?} parent * @param {?} insertBefore * @return {?} */ function (namespaceId, element, parent, insertBefore) { this._transitionEngine.insertNode(namespaceId, element, parent, insertBefore); }; /** * @param {?} namespaceId * @param {?} element * @param {?} context * @return {?} */ AnimationEngine.prototype.onRemove = /** * @param {?} namespaceId * @param {?} element * @param {?} context * @return {?} */ function (namespaceId, element, context) { this._transitionEngine.removeNode(namespaceId, element, context); }; /** * @param {?} element * @param {?} disable * @return {?} */ AnimationEngine.prototype.disableAnimations = /** * @param {?} element * @param {?} disable * @return {?} */ function (element, disable) { this._transitionEngine.markElementAsDisabled(element, disable); }; /** * @param {?} namespaceId * @param {?} element * @param {?} property * @param {?} value * @return {?} */ AnimationEngine.prototype.process = /** * @param {?} namespaceId * @param {?} element * @param {?} property * @param {?} value * @return {?} */ function (namespaceId, element, property, value) { if (property.charAt(0) == '@') { var _a = parseTimelineCommand(property), id = _a[0], action = _a[1]; var /** @type {?} */ 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 {?} */ AnimationEngine.prototype.listen = /** * @param {?} namespaceId * @param {?} element * @param {?} eventName * @param {?} eventPhase * @param {?} callback * @return {?} */ function (namespaceId, element, eventName, eventPhase, callback) { // @@listen if (eventName.charAt(0) == '@') { var _a = parseTimelineCommand(eventName), id = _a[0], action = _a[1]; return this._timelineEngine.listen(id, element, action, callback); } return this._transitionEngine.listen(namespaceId, element, eventName, eventPhase, callback); }; /** * @param {?=} microtaskId * @return {?} */ AnimationEngine.prototype.flush = /** * @param {?=} microtaskId * @return {?} */ function (microtaskId) { if (microtaskId === void 0) { microtaskId = -1; } this._transitionEngine.flush(microtaskId); }; Object.defineProperty(AnimationEngine.prototype, "players", { get: /** * @return {?} */ function () { return (/** @type {?} */ (this._transitionEngine.players)) .concat(/** @type {?} */ (this._timelineEngine.players)); }, enumerable: true, configurable: true }); /** * @return {?} */ AnimationEngine.prototype.whenRenderingDone = /** * @return {?} */ function () { return this._transitionEngine.whenRenderingDone(); }; return AnimationEngine; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var WebAnimationsPlayer = /** @class */ (function () { function WebAnimationsPlayer(element, keyframes, options, previousPlayers) { if (previousPlayers === void 0) { previousPlayers = []; } var _this = this; this.element = element; this.keyframes = keyframes; this.options = options; this.previousPlayers = previousPlayers; 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.previousStyles = {}; this.currentSnapshot = {}; this._duration = /** @type {?} */ (options['duration']); this._delay = /** @type {?} */ (options['delay']) || 0; this.time = this._duration + this._delay; if (allowPreviousPlayerStylesMerge(this._duration, this._delay)) { previousPlayers.forEach(function (player) { var /** @type {?} */ styles = player.currentSnapshot; Object.keys(styles).forEach(function (prop) { return _this.previousStyles[prop] = styles[prop]; }); }); } } /** * @return {?} */ WebAnimationsPlayer.prototype._onFinish = /** * @return {?} */ function () { if (!this._finished) { this._finished = true; this._onDoneFns.forEach(function (fn) { return fn(); }); this._onDoneFns = []; } }; /** * @return {?} */ WebAnimationsPlayer.prototype.init = /** * @return {?} */ function () { this._buildPlayer(); this._preparePlayerBeforeStart(); }; /** * @return {?} */ WebAnimationsPlayer.prototype._buildPlayer = /** * @return {?} */ function () { var _this = this; if (this._initialized) return; this._initialized = true; var /** @type {?} */ keyframes = this.keyframes.map(function (styles) { return copyStyles(styles, false); }); var /** @type {?} */ previousStyleProps = Object.keys(this.previousStyles); if (previousStyleProps.length && keyframes.length) { var /** @type {?} */ startingKeyframe_1 = keyframes[0]; var /** @type {?} */ missingStyleProps_1 = []; previousStyleProps.forEach(function (prop) { if (!startingKeyframe_1.hasOwnProperty(prop)) { missingStyleProps_1.push(prop); } startingKeyframe_1[prop] = _this.previousStyles[prop]; }); if (missingStyleProps_1.length) { var /** @type {?} */ self_1 = this; var _loop_1 = function () { var /** @type {?} */ kf = keyframes[i]; missingStyleProps_1.forEach(function (prop) { kf[prop] = _computeStyle(self_1.element, prop); }); }; // tslint:disable-next-line for (var /** @type {?} */ i = 1; i < keyframes.length; i++) { _loop_1(); } } } (/** @type {?} */ (this)).domPlayer = this._triggerWebAnimation(this.element, keyframes, this.options); this._finalKeyframe = keyframes.length ? keyframes[keyframes.length - 1] : {}; this.domPlayer.addEventListener('finish', function () { return _this._onFinish(); }); }; /** * @return {?} */ WebAnimationsPlayer.prototype._preparePlayerBeforeStart = /** * @return {?} */ function () { // this is required so that the player doesn't start to animate right away if (this._delay) { this._resetDomPlayerState(); } else { this.domPlayer.pause(); } }; /** @internal */ /** * \@internal * @param {?} element * @param {?} keyframes * @param {?} options * @return {?} */ WebAnimationsPlayer.prototype._triggerWebAnimation = /** * \@internal * @param {?} element * @param {?} keyframes * @param {?} options * @return {?} */ function (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 {?} */ WebAnimationsPlayer.prototype.onStart = /** * @param {?} fn * @return {?} */ function (fn) { this._onStartFns.push(fn); }; /** * @param {?} fn * @return {?} */ WebAnimationsPlayer.prototype.onDone = /** * @param {?} fn * @return {?} */ function (fn) { this._onDoneFns.push(fn); }; /** * @param {?} fn * @return {?} */ WebAnimationsPlayer.prototype.onDestroy = /** * @param {?} fn * @return {?} */ function (fn) { this._onDestroyFns.push(fn); }; /** * @return {?} */ WebAnimationsPlayer.prototype.play = /** * @return {?} */ function () { this._buildPlayer(); if (!this.hasStarted()) { this._onStartFns.forEach(function (fn) { return fn(); }); this._onStartFns = []; this._started = true; } this.domPlayer.play(); }; /** * @return {?} */ WebAnimationsPlayer.prototype.pause = /** * @return {?} */ function () { this.init(); this.domPlayer.pause(); }; /** * @return {?} */ WebAnimationsPlayer.prototype.finish = /** * @return {?} */ function () { this.init(); this._onFinish(); this.domPlayer.finish(); }; /** * @return {?} */ WebAnimationsPlayer.prototype.reset = /** * @return {?} */ function () { this._resetDomPlayerState(); this._destroyed = false; this._finished = false; this._started = false; }; /** * @return {?} */ WebAnimationsPlayer.prototype._resetDomPlayerState = /** * @return {?} */ function () { if (this.domPlayer) { this.domPlayer.cancel(); } }; /** * @return {?} */ WebAnimationsPlayer.prototype.restart = /** * @return {?} */ function () { this.reset(); this.play(); }; /** * @return {?} */ WebAnimationsPlayer.prototype.hasStarted = /** * @return {?} */ function () { return this._started; }; /** * @return {?} */ WebAnimationsPlayer.prototype.destroy = /** * @return {?} */ function () { if (!this._destroyed) { this._destroyed = true; this._resetDomPlayerState(); this._onFinish(); this._onDestroyFns.forEach(function (fn) { return fn(); }); this._onDestroyFns = []; } }; /** * @param {?} p * @return {?} */ WebAnimationsPlayer.prototype.setPosition = /** * @param {?} p * @return {?} */ function (p) { this.domPlayer.currentTime = p * this.time; }; /** * @return {?} */ WebAnimationsPlayer.prototype.getPosition = /** * @return {?} */ function () { return this.domPlayer.currentTime / this.time; }; Object.defineProperty(WebAnimationsPlayer.prototype, "totalTime", { get: /** * @return {?} */ function () { return this._delay + this._duration; }, enumerable: true, configurable: true }); /** * @return {?} */ WebAnimationsPlayer.prototype.beforeDestroy = /** * @return {?} */ function () { var _this = this; var /** @type {?} */ styles = {}; if (this.hasStarted()) { Object.keys(this._finalKeyframe).forEach(function (prop) { if (prop != 'offset') { styles[prop] = _this._finished ? _this._finalKeyframe[prop] : _computeStyle(_this.element, prop); } }); } this.currentSnapshot = styles; }; /* @internal */ /** * @param {?} phaseName * @return {?} */ WebAnimationsPlayer.prototype.triggerCallback = /** * @param {?} phaseName * @return {?} */ function (phaseName) { var /** @type {?} */ methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns; methods.forEach(function (fn) { return fn(); }); methods.length = 0; }; return WebAnimationsPlayer; }()); /** * @param {?} element * @param {?} prop * @return {?} */ function _computeStyle(element, prop) { return (/** @type {?} */ (window.getComputedStyle(element)))[prop]; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var WebAnimationsDriver = /** @class */ (function () { function WebAnimationsDriver() { } /** * @param {?} prop * @return {?} */ WebAnimationsDriver.prototype.validateStyleProperty = /** * @param {?} prop * @return {?} */ function (prop) { return validateStyleProperty(prop); }; /** * @param {?} element * @param {?} selector * @return {?} */ WebAnimationsDriver.prototype.matchesElement = /** * @param {?} element * @param {?} selector * @return {?} */ function (element, selector) { return matchesElement(element, selector); }; /** * @param {?} elm1 * @param {?} elm2 * @return {?} */ WebAnimationsDriver.prototype.containsElement = /** * @param {?} elm1 * @param {?} elm2 * @return {?} */ function (elm1, elm2) { return containsElement(elm1, elm2); }; /** * @param {?} element * @param {?} selector * @param {?} multi * @return {?} */ WebAnimationsDriver.prototype.query = /** * @param {?} element * @param {?} selector * @param {?} multi * @return {?} */ function (element, selector, multi) { return invokeQuery(element, selector, multi); }; /** * @param {?} element * @param {?} prop * @param {?=} defaultValue * @return {?} */ WebAnimationsDriver.prototype.computeStyle = /** * @param {?} element * @param {?} prop * @param {?=} defaultValue * @return {?} */ function (element, prop, defaultValue) { return /** @type {?} */ ((/** @type {?} */ (window.getComputedStyle(element)))[prop]); }; /** * @param {?} element * @param {?} keyframes * @param {?} duration * @param {?} delay * @param {?} easing * @param {?=} previousPlayers * @return {?} */ WebAnimationsDriver.prototype.animate = /** * @param {?} element * @param {?} keyframes * @param {?} duration * @param {?} delay * @param {?} easing * @param {?=} previousPlayers * @return {?} */ function (element, keyframes, duration, delay, easing, previousPlayers) { if (previousPlayers === void 0) { previousPlayers = []; } var /** @type {?} */ fill = delay == 0 ? 'both' : 'forwards'; var /** @type {?} */ 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; } var /** @type {?} */ previousWebAnimationPlayers = /** @type {?} */ (previousPlayers.filter(function (player) { return player instanceof WebAnimationsPlayer; })); return new WebAnimationsPlayer(element, keyframes, playerOptions, previousWebAnimationPlayers); }; return WebAnimationsDriver; }()); /** * @return {?} */ function supportsWebAnimations() { return typeof Element !== 'undefined' && typeof (/** @type {?} */ (Element)).prototype['animate'] === 'function'; } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * @module * @description * Entry point for all public APIs of this package. */ /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=browser.js.map /***/ }), /***/ "./node_modules/@angular/common/esm5/common.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵregisterLocaleData", function() { return registerLocaleData; }); /* 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__, "registerLocaleData", function() { return registerLocaleData; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Plural", function() { return Plural; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumberFormatStyle", function() { return NumberFormatStyle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormStyle", function() { return FormStyle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TranslationWidth", function() { return TranslationWidth; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormatWidth", function() { return FormatWidth; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumberSymbol", function() { return NumberSymbol; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WeekDay", function() { return WeekDay; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCurrencySymbol", function() { return getCurrencySymbol; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDayPeriods", function() { return getLocaleDayPeriods; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDayNames", function() { return getLocaleDayNames; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleMonthNames", function() { return getLocaleMonthNames; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleId", function() { return getLocaleId; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleEraNames", function() { return getLocaleEraNames; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleWeekEndRange", function() { return getLocaleWeekEndRange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleFirstDayOfWeek", function() { return getLocaleFirstDayOfWeek; }); /* 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__, "getLocaleExtraDayPeriodRules", function() { return getLocaleExtraDayPeriodRules; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleExtraDayPeriods", function() { return getLocaleExtraDayPeriods; }); /* 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__, "getLocaleNumberSymbol", function() { return getLocaleNumberSymbol; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleNumberFormat", function() { return getLocaleNumberFormat; }); /* 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__, "ɵparseCookieValue", function() { return parseCookieValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommonModule", function() { return CommonModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedI18NPipesModule", function() { return DeprecatedI18NPipesModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgClass", function() { return NgClass; }); /* 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__, "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__, "NgComponentOutlet", function() { return NgComponentOutlet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOCUMENT", function() { return DOCUMENT; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsyncPipe", function() { return AsyncPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DatePipe", function() { return DatePipe; }); /* 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__, "LowerCasePipe", function() { return LowerCasePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CurrencyPipe", function() { return CurrencyPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DecimalPipe", function() { return DecimalPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PercentPipe", function() { return PercentPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SlicePipe", function() { return SlicePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UpperCasePipe", function() { return UpperCasePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TitleCasePipe", function() { return TitleCasePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedDatePipe", function() { return DeprecatedDatePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedCurrencyPipe", function() { return DeprecatedCurrencyPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedDecimalPipe", function() { return DeprecatedDecimalPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedPercentPipe", function() { return DeprecatedPercentPipe; }); /* 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__, "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__, "VERSION", function() { return VERSION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlatformLocation", function() { return PlatformLocation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOCATION_INITIALIZED", function() { return LOCATION_INITIALIZED; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocationStrategy", function() { return LocationStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_BASE_HREF", function() { return APP_BASE_HREF; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HashLocationStrategy", function() { return HashLocationStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PathLocationStrategy", function() { return PathLocationStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Location", function() { return Location; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵe", function() { return COMMON_DIRECTIVES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵd", function() { return findLocaleData; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵa", function() { return DEPRECATED_PLURAL_FN; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵb", function() { return getPluralCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵg", function() { return COMMON_DEPRECATED_I18N_PIPES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵf", function() { return COMMON_PIPES; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm5/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_tslib__ = __webpack_require__("./node_modules/tslib/tslib.es6.js"); /** * @license Angular v5.2.2 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 class should not be used directly by an application developer. Instead, use * {\@link Location}. * * `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform * agnostic. * This means that we can have different implementation of `PlatformLocation` for the different * platforms that angular supports. For example, `\@angular/platform-browser` provides an * implementation specific to the browser environment, while `\@angular/platform-webworker` provides * one suitable for use with web workers. * * The `PlatformLocation` class is used directly by all implementations of {\@link LocationStrategy} * when they need to interact with the DOM apis like pushState, popState, etc... * * {\@link LocationStrategy} in turn is used by the {\@link Location} service which is used directly * by the {\@link Router} in order to navigate between routes. Since all interactions between {\@link * Router} / * {\@link Location} / {\@link LocationStrategy} and DOM apis flow through the `PlatformLocation` * class they are all platform independent. * * \@stable * @abstract */ var PlatformLocation = /** @class */ (function () { function PlatformLocation() { } return PlatformLocation; }()); /** * \@whatItDoes indicates when a location is initialized * \@experimental */ var LOCATION_INITIALIZED = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('Location Initialized'); /** * A serializable version of the event from onPopState or onHashChange * * \@experimental * @record */ /** * \@experimental * @record */ /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * `LocationStrategy` is responsible for representing and reading route state * from the browser's URL. Angular provides two strategies: * {\@link HashLocationStrategy} and {\@link PathLocationStrategy}. * * This is used under the hood of the {\@link Location} service. * * Applications should use the {\@link Router} or {\@link Location} services to * interact with application route state. * * For instance, {\@link HashLocationStrategy} produces URLs like * `http://example.com#/foo`, and {\@link PathLocationStrategy} produces * `http://example.com/foo` as an equivalent URL. * * See these two classes for more. * * \@stable * @abstract */ var LocationStrategy = /** @class */ (function () { function LocationStrategy() { } return LocationStrategy; }()); /** * The `APP_BASE_HREF` token represents the base href to be used with the * {\@link PathLocationStrategy}. * * If you're using {\@link PathLocationStrategy}, you must provide a provider to a string * representing the URL prefix that should be preserved when generating and recognizing * URLs. * * ### Example * * ```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 {} * ``` * * \@stable */ var APP_BASE_HREF = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('appBaseHref'); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * \@experimental * @record */ /** * \@whatItDoes `Location` is a service that applications can use to interact with a browser's URL. * \@description * Depending on which {\@link LocationStrategy} is used, `Location` will either persist * to the URL's path or the URL's hash segment. * * Note: it's better to use {\@link Router#navigate} service to trigger route changes. Use * `Location` only if you need to interact with or create normalized URLs outside of * routing. * * `Location` is responsible for normalizing the URL against the application's base href. * A normalized URL is absolute from the URL host, includes the application's base href, and has no * trailing slash: * - `/my/app/user/123` is normalized * - `my/app/user/123` **is not** normalized * - `/my/app/user/123/` **is not** normalized * * ### Example * {\@example common/location/ts/path_location_component.ts region='LocationComponent'} * \@stable */ var Location = /** @class */ (function () { function Location(platformStrategy) { var _this = this; /** * \@internal */ this._subject = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); this._platformStrategy = platformStrategy; var /** @type {?} */ browserBaseHref = this._platformStrategy.getBaseHref(); this._baseHref = Location.stripTrailingSlash(_stripIndexHtml(browserBaseHref)); this._platformStrategy.onPopState(function (ev) { _this._subject.emit({ 'url': _this.path(true), 'pop': true, 'type': ev.type, }); }); } /** * Returns the normalized URL path. */ // TODO: vsavkin. Remove the boolean flag and always include hash once the deprecated router is // removed. /** * Returns the normalized URL path. * @param {?=} includeHash * @return {?} */ Location.prototype.path = /** * Returns the normalized URL path. * @param {?=} includeHash * @return {?} */ function (includeHash) { if (includeHash === void 0) { includeHash = false; } return this.normalize(this._platformStrategy.path(includeHash)); }; /** * Normalizes the given path and compares to the current normalized path. */ /** * Normalizes the given path and compares to the current normalized path. * @param {?} path * @param {?=} query * @return {?} */ Location.prototype.isCurrentPathEqualTo = /** * Normalizes the given path and compares to the current normalized path. * @param {?} path * @param {?=} query * @return {?} */ function (path, query) { if (query === void 0) { query = ''; } return this.path() == this.normalize(path + Location.normalizeQueryParams(query)); }; /** * Given a string representing a URL, returns the normalized URL path without leading or * trailing slashes. */ /** * Given a string representing a URL, returns the normalized URL path without leading or * trailing slashes. * @param {?} url * @return {?} */ Location.prototype.normalize = /** * Given a string representing a URL, returns the normalized URL path without leading or * trailing slashes. * @param {?} url * @return {?} */ function (url) { return Location.stripTrailingSlash(_stripBaseHref(this._baseHref, _stripIndexHtml(url))); }; /** * Given a string representing a URL, returns the platform-specific external URL path. * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one * before normalizing. This method will also add a hash if `HashLocationStrategy` is * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use. */ /** * Given a string representing a URL, returns the platform-specific external URL path. * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one * before normalizing. This method will also add a hash if `HashLocationStrategy` is * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use. * @param {?} url * @return {?} */ Location.prototype.prepareExternalUrl = /** * Given a string representing a URL, returns the platform-specific external URL path. * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one * before normalizing. This method will also add a hash if `HashLocationStrategy` is * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use. * @param {?} url * @return {?} */ function (url) { if (url && url[0] !== '/') { url = '/' + url; } return this._platformStrategy.prepareExternalUrl(url); }; // TODO: rename this method to pushState /** * Changes the browsers URL to the normalized version of the given URL, and pushes a * new item onto the platform's history. */ /** * Changes the browsers URL to the normalized version of the given URL, and pushes a * new item onto the platform's history. * @param {?} path * @param {?=} query * @return {?} */ Location.prototype.go = /** * Changes the browsers URL to the normalized version of the given URL, and pushes a * new item onto the platform's history. * @param {?} path * @param {?=} query * @return {?} */ function (path, query) { if (query === void 0) { query = ''; } this._platformStrategy.pushState(null, '', path, query); }; /** * Changes the browsers URL to the normalized version of the given URL, and replaces * the top item on the platform's history stack. */ /** * Changes the browsers URL to the normalized version of the given URL, and replaces * the top item on the platform's history stack. * @param {?} path * @param {?=} query * @return {?} */ Location.prototype.replaceState = /** * Changes the browsers URL to the normalized version of the given URL, and replaces * the top item on the platform's history stack. * @param {?} path * @param {?=} query * @return {?} */ function (path, query) { if (query === void 0) { query = ''; } this._platformStrategy.replaceState(null, '', path, query); }; /** * Navigates forward in the platform's history. */ /** * Navigates forward in the platform's history. * @return {?} */ Location.prototype.forward = /** * Navigates forward in the platform's history. * @return {?} */ function () { this._platformStrategy.forward(); }; /** * Navigates back in the platform's history. */ /** * Navigates back in the platform's history. * @return {?} */ Location.prototype.back = /** * Navigates back in the platform's history. * @return {?} */ function () { this._platformStrategy.back(); }; /** * Subscribe to the platform's `popState` events. */ /** * Subscribe to the platform's `popState` events. * @param {?} onNext * @param {?=} onThrow * @param {?=} onReturn * @return {?} */ Location.prototype.subscribe = /** * Subscribe to the platform's `popState` events. * @param {?} onNext * @param {?=} onThrow * @param {?=} onReturn * @return {?} */ function (onNext, onThrow, onReturn) { return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn }); }; /** * Given a string of url parameters, prepend with '?' if needed, otherwise return parameters as * is. * @param {?} params * @return {?} */ Location.normalizeQueryParams = /** * Given a string of url parameters, prepend with '?' if needed, otherwise return parameters as * is. * @param {?} params * @return {?} */ function (params) { return params && params[0] !== '?' ? '?' + params : params; }; /** * Given 2 parts of a url, join them with a slash if needed. * @param {?} start * @param {?} end * @return {?} */ Location.joinWithSlash = /** * Given 2 parts of a url, join them with a slash if needed. * @param {?} start * @param {?} end * @return {?} */ function (start, end) { if (start.length == 0) { return end; } if (end.length == 0) { return start; } var /** @type {?} */ 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; }; /** * If url has a trailing slash, remove it, otherwise return url as is. This * method looks for the first occurence of either #, ?, or the end of the * line as `/` characters after any of these should not be replaced. * @param {?} url * @return {?} */ Location.stripTrailingSlash = /** * If url has a trailing slash, remove it, otherwise return url as is. This * method looks for the first occurence of either #, ?, or the end of the * line as `/` characters after any of these should not be replaced. * @param {?} url * @return {?} */ function (url) { var /** @type {?} */ match = url.match(/#|\?|$/); var /** @type {?} */ pathEndIdx = match && match.index || url.length; var /** @type {?} */ droppedSlashIdx = pathEndIdx - (url[pathEndIdx - 1] === '/' ? 1 : 0); return url.slice(0, droppedSlashIdx) + url.slice(pathEndIdx); }; Location.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ Location.ctorParameters = function () { return [ { type: LocationStrategy, }, ]; }; return Location; }()); /** * @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 * @suppress {checkTypes} 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 */ /** * \@whatItDoes Use URL hash for storing application location data. * \@description * `HashLocationStrategy` is a {\@link LocationStrategy} used to configure the * {\@link Location} service to represent its state in the * [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) * of the browser's URL. * * For instance, if you call `location.go('/foo')`, the browser's URL will become * `example.com#/foo`. * * ### Example * * {\@example common/location/ts/hash_location_component.ts region='LocationComponent'} * * \@stable */ var HashLocationStrategy = /** @class */ (function (_super) { Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(HashLocationStrategy, _super); function HashLocationStrategy(_platformLocation, _baseHref) { var _this = _super.call(this) || this; _this._platformLocation = _platformLocation; _this._baseHref = ''; if (_baseHref != null) { _this._baseHref = _baseHref; } return _this; } /** * @param {?} fn * @return {?} */ HashLocationStrategy.prototype.onPopState = /** * @param {?} fn * @return {?} */ function (fn) { this._platformLocation.onPopState(fn); this._platformLocation.onHashChange(fn); }; /** * @return {?} */ HashLocationStrategy.prototype.getBaseHref = /** * @return {?} */ function () { return this._baseHref; }; /** * @param {?=} includeHash * @return {?} */ HashLocationStrategy.prototype.path = /** * @param {?=} includeHash * @return {?} */ function (includeHash) { if (includeHash === void 0) { includeHash = false; } // the hash value is always prefixed with a `#` // and if it is empty then it will stay empty var /** @type {?} */ path = this._platformLocation.hash; if (path == null) path = '#'; return path.length > 0 ? path.substring(1) : path; }; /** * @param {?} internal * @return {?} */ HashLocationStrategy.prototype.prepareExternalUrl = /** * @param {?} internal * @return {?} */ function (internal) { var /** @type {?} */ url = Location.joinWithSlash(this._baseHref, internal); return url.length > 0 ? ('#' + url) : url; }; /** * @param {?} state * @param {?} title * @param {?} path * @param {?} queryParams * @return {?} */ HashLocationStrategy.prototype.pushState = /** * @param {?} state * @param {?} title * @param {?} path * @param {?} queryParams * @return {?} */ function (state, title, path, queryParams) { var /** @type {?} */ url = this.prepareExternalUrl(path + Location.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 {?} */ HashLocationStrategy.prototype.replaceState = /** * @param {?} state * @param {?} title * @param {?} path * @param {?} queryParams * @return {?} */ function (state, title, path, queryParams) { var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams)); if (url.length == 0) { url = this._platformLocation.pathname; } this._platformLocation.replaceState(state, title, url); }; /** * @return {?} */ HashLocationStrategy.prototype.forward = /** * @return {?} */ function () { this._platformLocation.forward(); }; /** * @return {?} */ HashLocationStrategy.prototype.back = /** * @return {?} */ function () { this._platformLocation.back(); }; HashLocationStrategy.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ HashLocationStrategy.ctorParameters = function () { return [ { type: PlatformLocation, }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [APP_BASE_HREF,] },] }, ]; }; return HashLocationStrategy; }(LocationStrategy)); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * \@whatItDoes Use URL for storing application location data. * \@description * `PathLocationStrategy` is a {\@link LocationStrategy} used to configure the * {\@link Location} service to represent its state in the * [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the * browser's URL. * * If you're using `PathLocationStrategy`, you must provide a {\@link APP_BASE_HREF} * or add a base element to the document. This URL prefix that will be preserved * when generating and recognizing URLs. * * For instance, if you provide an `APP_BASE_HREF` of `'/my/app'` and call * `location.go('/foo')`, the browser's URL will become * `example.com/my/app/foo`. * * Similarly, if you add `` to the document and call * `location.go('/foo')`, the browser's URL will become * `example.com/my/app/foo`. * * ### Example * * {\@example common/location/ts/path_location_component.ts region='LocationComponent'} * * \@stable */ var PathLocationStrategy = /** @class */ (function (_super) { Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(PathLocationStrategy, _super); function PathLocationStrategy(_platformLocation, href) { var _this = _super.call(this) || this; _this._platformLocation = _platformLocation; if (href == null) { href = _this._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."); } _this._baseHref = href; return _this; } /** * @param {?} fn * @return {?} */ PathLocationStrategy.prototype.onPopState = /** * @param {?} fn * @return {?} */ function (fn) { this._platformLocation.onPopState(fn); this._platformLocation.onHashChange(fn); }; /** * @return {?} */ PathLocationStrategy.prototype.getBaseHref = /** * @return {?} */ function () { return this._baseHref; }; /** * @param {?} internal * @return {?} */ PathLocationStrategy.prototype.prepareExternalUrl = /** * @param {?} internal * @return {?} */ function (internal) { return Location.joinWithSlash(this._baseHref, internal); }; /** * @param {?=} includeHash * @return {?} */ PathLocationStrategy.prototype.path = /** * @param {?=} includeHash * @return {?} */ function (includeHash) { if (includeHash === void 0) { includeHash = false; } var /** @type {?} */ pathname = this._platformLocation.pathname + Location.normalizeQueryParams(this._platformLocation.search); var /** @type {?} */ hash = this._platformLocation.hash; return hash && includeHash ? "" + pathname + hash : pathname; }; /** * @param {?} state * @param {?} title * @param {?} url * @param {?} queryParams * @return {?} */ PathLocationStrategy.prototype.pushState = /** * @param {?} state * @param {?} title * @param {?} url * @param {?} queryParams * @return {?} */ function (state, title, url, queryParams) { var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams)); this._platformLocation.pushState(state, title, externalUrl); }; /** * @param {?} state * @param {?} title * @param {?} url * @param {?} queryParams * @return {?} */ PathLocationStrategy.prototype.replaceState = /** * @param {?} state * @param {?} title * @param {?} url * @param {?} queryParams * @return {?} */ function (state, title, url, queryParams) { var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams)); this._platformLocation.replaceState(state, title, externalUrl); }; /** * @return {?} */ PathLocationStrategy.prototype.forward = /** * @return {?} */ function () { this._platformLocation.forward(); }; /** * @return {?} */ PathLocationStrategy.prototype.back = /** * @return {?} */ function () { this._platformLocation.back(); }; PathLocationStrategy.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ PathLocationStrategy.ctorParameters = function () { return [ { type: PlatformLocation, }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [APP_BASE_HREF,] },] }, ]; }; return PathLocationStrategy; }(LocationStrategy)); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ var CURRENCIES = { 'AOA': [, 'Kz'], 'ARS': [, '$'], 'AUD': ['A$', '$'], 'BAM': [, 'KM'], 'BBD': [, '$'], 'BDT': [, '৳'], 'BMD': [, '$'], 'BND': [, '$'], 'BOB': [, 'Bs'], 'BRL': ['R$'], 'BSD': [, '$'], 'BWP': [, 'P'], 'BYN': [, 'р.'], 'BZD': [, '$'], 'CAD': ['CA$', '$'], 'CLP': [, '$'], 'CNY': ['CN¥', '¥'], 'COP': [, '$'], 'CRC': [, '₡'], 'CUC': [, '$'], 'CUP': [, '$'], 'CZK': [, 'Kč'], 'DKK': [, 'kr'], 'DOP': [, '$'], 'EGP': [, 'E£'], 'ESP': [, '₧'], 'EUR': ['€'], 'FJD': [, '$'], 'FKP': [, '£'], 'GBP': ['£'], 'GEL': [, '₾'], 'GIP': [, '£'], 'GNF': [, 'FG'], 'GTQ': [, 'Q'], 'GYD': [, '$'], 'HKD': ['HK$', '$'], 'HNL': [, 'L'], 'HRK': [, 'kn'], 'HUF': [, 'Ft'], 'IDR': [, 'Rp'], 'ILS': ['₪'], 'INR': ['₹'], 'ISK': [, 'kr'], 'JMD': [, '$'], 'JPY': ['¥'], 'KHR': [, '៛'], 'KMF': [, 'CF'], 'KPW': [, '₩'], 'KRW': ['₩'], 'KYD': [, '$'], 'KZT': [, '₸'], 'LAK': [, '₭'], 'LBP': [, 'L£'], 'LKR': [, 'Rs'], 'LRD': [, '$'], 'LTL': [, 'Lt'], 'LVL': [, 'Ls'], 'MGA': [, 'Ar'], 'MMK': [, 'K'], 'MNT': [, '₮'], 'MUR': [, 'Rs'], 'MXN': ['MX$', '$'], 'MYR': [, 'RM'], 'NAD': [, '$'], 'NGN': [, '₦'], 'NIO': [, 'C$'], 'NOK': [, 'kr'], 'NPR': [, 'Rs'], 'NZD': ['NZ$', '$'], 'PHP': [, '₱'], 'PKR': [, 'Rs'], 'PLN': [, 'zł'], 'PYG': [, '₲'], 'RON': [, 'lei'], 'RUB': [, '₽'], 'RUR': [, 'р.'], 'RWF': [, 'RF'], 'SBD': [, '$'], 'SEK': [, 'kr'], 'SGD': [, '$'], 'SHP': [, '£'], 'SRD': [, '$'], 'SSP': [, '£'], 'STD': [, 'Db'], 'SYP': [, '£'], 'THB': [, '฿'], 'TOP': [, 'T$'], 'TRY': [, '₺'], 'TTD': [, '$'], 'TWD': ['NT$', '$'], 'UAH': [, '₴'], 'USD': ['$'], 'UYU': [, '$'], 'VEF': [, 'Bs'], 'VND': ['₫'], 'XAF': ['FCFA'], 'XCD': ['EC$', '$'], 'XOF': ['CFA'], 'XPF': ['CFPF'], 'ZAR': [, 'R'], 'ZMW': [, 'ZK'], }; /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 /** * @param {?} n * @return {?} */ function plural(n) { var /** @type {?} */ i = Math.floor(Math.abs(n)), /** @type {?} */ v = n.toString().replace(/^[^.]*\.?/, '').length; if (i === 1 && v === 0) return 1; return 5; } var localeEn = [ 'en', [ ['a', 'p'], ['AM', 'PM'], ], [ ['AM', 'PM'], , ], [ ['S', 'M', 'T', 'W', 'T', 'F', 'S'], ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'] ], , [ ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'], ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ] ], , [['B', 'A'], ['BC', 'AD'], ['Before Christ', 'Anno Domini']], 0, [6, 0], ['M/d/yy', 'MMM d, y', 'MMMM d, y', 'EEEE, MMMM d, y'], ['h:mm a', 'h:mm:ss a', 'h:mm:ss a z', 'h:mm:ss a zzzz'], [ '{1}, {0}', , '{1} \'at\' {0}', ], ['.', ',', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'NaN', ':'], ['#,##0.###', '#,##0%', '¤#,##0.00', '#E0'], '$', 'US Dollar', plural ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * \@experimental i18n support is experimental. */ var LOCALE_DATA = {}; /** * Register global data to be used internally by Angular. See the * {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale data. * * \@experimental i18n support is experimental. * @param {?} data * @param {?=} localeId * @param {?=} extraData * @return {?} */ function registerLocaleData(data, localeId, extraData) { if (typeof localeId !== 'string') { extraData = localeId; localeId = data[0 /* LocaleId */]; } localeId = localeId.toLowerCase().replace(/_/g, '-'); LOCALE_DATA[localeId] = data; if (extraData) { LOCALE_DATA[localeId][18 /* ExtraData */] = extraData; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** @enum {number} */ 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"; /** @enum {number} */ 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"; /** @enum {number} */ var FormStyle = { Format: 0, Standalone: 1, }; FormStyle[FormStyle.Format] = "Format"; FormStyle[FormStyle.Standalone] = "Standalone"; /** @enum {number} */ var TranslationWidth = { Narrow: 0, Abbreviated: 1, Wide: 2, Short: 3, }; TranslationWidth[TranslationWidth.Narrow] = "Narrow"; TranslationWidth[TranslationWidth.Abbreviated] = "Abbreviated"; TranslationWidth[TranslationWidth.Wide] = "Wide"; TranslationWidth[TranslationWidth.Short] = "Short"; /** @enum {number} */ var FormatWidth = { Short: 0, Medium: 1, Long: 2, Full: 3, }; FormatWidth[FormatWidth.Short] = "Short"; FormatWidth[FormatWidth.Medium] = "Medium"; FormatWidth[FormatWidth.Long] = "Long"; FormatWidth[FormatWidth.Full] = "Full"; /** @enum {number} */ var NumberSymbol = { Decimal: 0, Group: 1, List: 2, PercentSign: 3, PlusSign: 4, MinusSign: 5, Exponential: 6, SuperscriptingExponent: 7, PerMille: 8, Infinity: 9, NaN: 10, TimeSeparator: 11, CurrencyDecimal: 12, 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"; /** @enum {number} */ 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"; /** * The locale id for the chosen locale (e.g `en-GB`). * * \@experimental i18n support is experimental. * @param {?} locale * @return {?} */ function getLocaleId(locale) { return findLocaleData(locale)[0 /* LocaleId */]; } /** * Periods of the day (e.g. `[AM, PM]` for en-US). * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} formStyle * @param {?} width * @return {?} */ function getLocaleDayPeriods(locale, formStyle, width) { var /** @type {?} */ data = findLocaleData(locale); var /** @type {?} */ amPmData = /** @type {?} */ ([data[1 /* DayPeriodsFormat */], data[2 /* DayPeriodsStandalone */]]); var /** @type {?} */ amPm = getLastDefinedValue(amPmData, formStyle); return getLastDefinedValue(amPm, width); } /** * Days of the week for the Gregorian calendar (e.g. `[Sunday, Monday, ... Saturday]` for en-US). * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} formStyle * @param {?} width * @return {?} */ function getLocaleDayNames(locale, formStyle, width) { var /** @type {?} */ data = findLocaleData(locale); var /** @type {?} */ daysData = /** @type {?} */ ([data[3 /* DaysFormat */], data[4 /* DaysStandalone */]]); var /** @type {?} */ days = getLastDefinedValue(daysData, formStyle); return getLastDefinedValue(days, width); } /** * Months of the year for the Gregorian calendar (e.g. `[January, February, ...]` for en-US). * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} formStyle * @param {?} width * @return {?} */ function getLocaleMonthNames(locale, formStyle, width) { var /** @type {?} */ data = findLocaleData(locale); var /** @type {?} */ monthsData = /** @type {?} */ ([data[5 /* MonthsFormat */], data[6 /* MonthsStandalone */]]); var /** @type {?} */ months = getLastDefinedValue(monthsData, formStyle); return getLastDefinedValue(months, width); } /** * Eras for the Gregorian calendar (e.g. AD/BC). * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} width * @return {?} */ function getLocaleEraNames(locale, width) { var /** @type {?} */ data = findLocaleData(locale); var /** @type {?} */ erasData = /** @type {?} */ (data[7 /* Eras */]); return getLastDefinedValue(erasData, width); } /** * First day of the week for this locale, based on english days (Sunday = 0, Monday = 1, ...). * For example in french the value would be 1 because the first day of the week is Monday. * * \@experimental i18n support is experimental. * @param {?} locale * @return {?} */ function getLocaleFirstDayOfWeek(locale) { var /** @type {?} */ data = findLocaleData(locale); return data[8 /* FirstDayOfWeek */]; } /** * Range of days in the week that represent the week-end for this locale, based on english days * (Sunday = 0, Monday = 1, ...). * For example in english the value would be [6,0] for Saturday to Sunday. * * \@experimental i18n support is experimental. * @param {?} locale * @return {?} */ function getLocaleWeekEndRange(locale) { var /** @type {?} */ data = findLocaleData(locale); return data[9 /* WeekendRange */]; } /** * Date format that depends on the locale. * * There are four basic date formats: * - `full` should contain long-weekday (EEEE), year (y), long-month (MMMM), day (d). * * For example, English uses `EEEE, MMMM d, y`, corresponding to a date like * "Tuesday, September 14, 1999". * * - `long` should contain year, long-month, day. * * For example, `MMMM d, y`, corresponding to a date like "September 14, 1999". * * - `medium` should contain year, abbreviated-month (MMM), day. * * For example, `MMM d, y`, corresponding to a date like "Sep 14, 1999". * For languages that do not use abbreviated months, use the numeric month (MM/M). For example, * `y/MM/dd`, corresponding to a date like "1999/09/14". * * - `short` should contain year, numeric-month (MM/M), and day. * * For example, `M/d/yy`, corresponding to a date like "9/14/99". * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} width * @return {?} */ function getLocaleDateFormat(locale, width) { var /** @type {?} */ data = findLocaleData(locale); return getLastDefinedValue(data[10 /* DateFormat */], width); } /** * Time format that depends on the locale. * * The standard formats include four basic time formats: * - `full` should contain hour (h/H), minute (mm), second (ss), and zone (zzzz). * - `long` should contain hour, minute, second, and zone (z) * - `medium` should contain hour, minute, second. * - `short` should contain hour, minute. * * Note: The patterns depend on whether the main country using your language uses 12-hour time or * not: * - For 12-hour time, use a pattern like `hh:mm a` using h to mean a 12-hour clock cycle running * 1 through 12 (midnight plus 1 minute is 12:01), or using K to mean a 12-hour clock cycle * running 0 through 11 (midnight plus 1 minute is 0:01). * - For 24-hour time, use a pattern like `HH:mm` using H to mean a 24-hour clock cycle running 0 * through 23 (midnight plus 1 minute is 0:01), or using k to mean a 24-hour clock cycle running * 1 through 24 (midnight plus 1 minute is 24:01). * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} width * @return {?} */ function getLocaleTimeFormat(locale, width) { var /** @type {?} */ data = findLocaleData(locale); return getLastDefinedValue(data[11 /* TimeFormat */], width); } /** * Date-time format that depends on the locale. * * The date-time pattern shows how to combine separate patterns for date (represented by {1}) * and time (represented by {0}) into a single pattern. It usually doesn't need to be changed. * What you want to pay attention to are: * - possibly removing a space for languages that don't use it, such as many East Asian languages * - possibly adding a comma, other punctuation, or a combining word * * For example: * - English uses `{1} 'at' {0}` or `{1}, {0}` (depending on date style), while Japanese uses * `{1}{0}`. * - An English formatted date-time using the combining pattern `{1}, {0}` could be * `Dec 10, 2010, 3:59:49 PM`. Notice the comma and space between the date portion and the time * portion. * * There are four formats (`full`, `long`, `medium`, `short`); the determination of which to use * is normally based on the date style. For example, if the date has a full month and weekday * name, the full combining pattern will be used to combine that with a time. If the date has * numeric month, the short version of the combining pattern will be used to combine that with a * time. English uses `{1} 'at' {0}` for full and long styles, and `{1}, {0}` for medium and short * styles. * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} width * @return {?} */ function getLocaleDateTimeFormat(locale, width) { var /** @type {?} */ data = findLocaleData(locale); var /** @type {?} */ dateTimeFormatData = /** @type {?} */ (data[12 /* DateTimeFormat */]); return getLastDefinedValue(dateTimeFormatData, width); } /** * Number symbol that can be used to replace placeholders in number formats. * See {\@link NumberSymbol} for more information. * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} symbol * @return {?} */ function getLocaleNumberSymbol(locale, symbol) { var /** @type {?} */ data = findLocaleData(locale); var /** @type {?} */ res = data[13 /* NumberSymbols */][symbol]; if (typeof res === 'undefined') { if (symbol === NumberSymbol.CurrencyDecimal) { return data[13 /* NumberSymbols */][NumberSymbol.Decimal]; } else if (symbol === NumberSymbol.CurrencyGroup) { return data[13 /* NumberSymbols */][NumberSymbol.Group]; } } return res; } /** * Number format that depends on the 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,67". 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; * they 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 Number Symbols 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). | * | ¤ | This will be replaced by a currency symbol, such as $ or USD. | * | % | This marks a percent format. The % symbol may change position, but must be retained. | * | E | This 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. | * * You can find more information * [on the CLDR website](http://cldr.unicode.org/translation/number-patterns) * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} type * @return {?} */ function getLocaleNumberFormat(locale, type) { var /** @type {?} */ data = findLocaleData(locale); return data[14 /* NumberFormats */][type]; } /** * The symbol used to represent the currency for the main country using this locale (e.g. $ for * the locale en-US). * The symbol will be `null` if the main country cannot be determined. * * \@experimental i18n support is experimental. * @param {?} locale * @return {?} */ function getLocaleCurrencySymbol(locale) { var /** @type {?} */ data = findLocaleData(locale); return data[15 /* CurrencySymbol */] || null; } /** * The name of the currency for the main country using this locale (e.g. USD for the locale * en-US). * The name will be `null` if the main country cannot be determined. * * \@experimental i18n support is experimental. * @param {?} locale * @return {?} */ function getLocaleCurrencyName(locale) { var /** @type {?} */ data = findLocaleData(locale); return data[16 /* CurrencyName */] || null; } /** * The locale plural function used by ICU expressions to determine the plural case to use. * See {\@link NgPlural} for more information. * * \@experimental i18n support is experimental. * @param {?} locale * @return {?} */ function getLocalePluralCase(locale) { var /** @type {?} */ data = findLocaleData(locale); return data[17 /* PluralCase */]; } /** * @param {?} data * @return {?} */ function checkFullData(data) { if (!data[18 /* ExtraData */]) { throw new Error("Missing extra locale data for the locale \"" + data[0 /* LocaleId */] + "\". Use \"registerLocaleData\" to load new data. See the \"I18n guide\" on angular.io to know more."); } } /** * Rules used to determine which day period to use (See `dayPeriods` below). * The rules can either be an array or a single value. If it's an array, consider it as "from" * and "to". If it's a single value then it means that the period is only valid at this exact * value. * There is always the same number of rules as the number of day periods, which means that the * first rule is applied to the first day period and so on. * You should fallback to AM/PM when there are no rules available. * * Note: this is only available if you load the full locale data. * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale * data. * * \@experimental i18n support is experimental. * @param {?} locale * @return {?} */ function getLocaleExtraDayPeriodRules(locale) { var /** @type {?} */ data = findLocaleData(locale); checkFullData(data); var /** @type {?} */ rules = data[18 /* ExtraData */][2 /* ExtraDayPeriodsRules */] || []; return rules.map(function (rule) { if (typeof rule === 'string') { return extractTime(rule); } return [extractTime(rule[0]), extractTime(rule[1])]; }); } /** * Day Periods indicate roughly how the day is broken up in different languages (e.g. morning, * noon, afternoon, midnight, ...). * You should use the function {\@link getLocaleExtraDayPeriodRules} to determine which period to * use. * You should fallback to AM/PM when there are no day periods available. * * Note: this is only available if you load the full locale data. * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale * data. * * \@experimental i18n support is experimental. * @param {?} locale * @param {?} formStyle * @param {?} width * @return {?} */ function getLocaleExtraDayPeriods(locale, formStyle, width) { var /** @type {?} */ data = findLocaleData(locale); checkFullData(data); var /** @type {?} */ dayPeriodsData = /** @type {?} */ ([ data[18 /* ExtraData */][0 /* ExtraDayPeriodFormats */], data[18 /* ExtraData */][1 /* ExtraDayPeriodStandalone */] ]); var /** @type {?} */ dayPeriods = getLastDefinedValue(dayPeriodsData, formStyle) || []; return getLastDefinedValue(dayPeriods, width) || []; } /** * Returns the first value that is defined in an array, going backwards. * * To avoid repeating the same data (e.g. when "format" and "standalone" are the same) we only * add the first one to the locale data arrays, the other ones are only defined when different. * We use this function to retrieve the first defined value. * * \@experimental i18n support is experimental. * @template T * @param {?} data * @param {?} index * @return {?} */ function getLastDefinedValue(data, index) { for (var /** @type {?} */ i = index; i > -1; i--) { if (typeof data[i] !== 'undefined') { return data[i]; } } throw new Error('Locale data API: locale data undefined'); } /** * Extract the hours and minutes from a string like "15:45" * @param {?} time * @return {?} */ function extractTime(time) { var _a = time.split(':'), h = _a[0], m = _a[1]; return { hours: +h, minutes: +m }; } /** * Finds the locale data for a locale id * * \@experimental i18n support is experimental. * @param {?} locale * @return {?} */ function findLocaleData(locale) { var /** @type {?} */ normalizedLocale = locale.toLowerCase().replace(/_/g, '-'); var /** @type {?} */ match = LOCALE_DATA[normalizedLocale]; if (match) { return match; } // let's try to find a parent locale var /** @type {?} */ parentLocale = normalizedLocale.split('-')[0]; match = LOCALE_DATA[parentLocale]; if (match) { return match; } if (parentLocale === 'en') { return localeEn; } throw new Error("Missing locale data for the locale \"" + locale + "\"."); } /** * Return the currency symbol for a given currency code, or the code if no symbol available * (e.g.: format narrow = $, format wide = US$, code = USD) * * \@experimental i18n support is experimental. * @param {?} code * @param {?} format * @return {?} */ function getCurrencySymbol(code, format) { var /** @type {?} */ currency = CURRENCIES[code] || []; var /** @type {?} */ symbolNarrow = currency[1]; if (format === 'narrow' && typeof symbolNarrow === 'string') { return symbolNarrow; } return currency[0] || code; } /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * @deprecated from v5 */ var DEPRECATED_PLURAL_FN = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('UseV4Plurals'); /** * \@experimental * @abstract */ var NgLocalization = /** @class */ (function () { function NgLocalization() { } return NgLocalization; }()); /** * 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) { var /** @type {?} */ key = "=" + 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 \"" + value + "\""); } /** * Returns the plural case based on the locale * * \@experimental */ var NgLocaleLocalization = /** @class */ (function (_super) { Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(NgLocaleLocalization, _super); function NgLocaleLocalization(locale, /** @deprecated from v5 */ deprecatedPluralFn) { var _this = _super.call(this) || this; _this.locale = locale; _this.deprecatedPluralFn = deprecatedPluralFn; return _this; } /** * @param {?} value * @param {?=} locale * @return {?} */ NgLocaleLocalization.prototype.getPluralCategory = /** * @param {?} value * @param {?=} locale * @return {?} */ function (value, locale) { var /** @type {?} */ plural = this.deprecatedPluralFn ? this.deprecatedPluralFn(locale || this.locale, value) : 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'; } }; NgLocaleLocalization.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NgLocaleLocalization.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [DEPRECATED_PLURAL_FN,] },] }, ]; }; return NgLocaleLocalization; }(NgLocalization)); /** * Returns the plural case based on the locale * * @deprecated from v5 the plural case function is in locale data files common/locales/*.ts * \@experimental * @param {?} locale * @param {?} nLike * @return {?} */ function getPluralCase(locale, nLike) { // TODO(vicb): lazy compute if (typeof nLike === 'string') { nLike = parseInt(/** @type {?} */ (nLike), 10); } var /** @type {?} */ n = /** @type {?} */ (nLike); var /** @type {?} */ nDecimal = n.toString().replace(/^[^.]*\.?/, ''); var /** @type {?} */ i = Math.floor(Math.abs(n)); var /** @type {?} */ v = nDecimal.length; var /** @type {?} */ f = parseInt(nDecimal, 10); var /** @type {?} */ t = parseInt(n.toString().replace(/^[^.]*\.?|0+$/g, ''), 10) || 0; var /** @type {?} */ lang = locale.split('-')[0].toLowerCase(); switch (lang) { case 'af': case 'asa': case 'az': case 'bem': case 'bez': case 'bg': case 'brx': case 'ce': case 'cgg': case 'chr': case 'ckb': case 'ee': case 'el': case 'eo': case 'es': case 'eu': case 'fo': case 'fur': case 'gsw': case 'ha': case 'haw': case 'hu': case 'jgo': case 'jmc': case 'ka': case 'kk': case 'kkj': case 'kl': case 'ks': case 'ksb': case 'ky': case 'lb': case 'lg': case 'mas': case 'mgo': case 'ml': case 'mn': case 'nb': case 'nd': case 'ne': case 'nn': case 'nnh': case 'nyn': case 'om': case 'or': case 'os': case 'ps': case 'rm': case 'rof': case 'rwk': case 'saq': case 'seh': case 'sn': case 'so': case 'sq': case 'ta': case 'te': case 'teo': case 'tk': case 'tr': case 'ug': case 'uz': case 'vo': case 'vun': case 'wae': case 'xog': if (n === 1) return Plural.One; return Plural.Other; case 'ak': case 'ln': case 'mg': case 'pa': case 'ti': if (n === Math.floor(n) && n >= 0 && n <= 1) return Plural.One; return Plural.Other; case 'am': case 'as': case 'bn': case 'fa': case 'gu': case 'hi': case 'kn': case 'mr': case 'zu': if (i === 0 || n === 1) return Plural.One; return Plural.Other; case 'ar': if (n === 0) return Plural.Zero; if (n === 1) return Plural.One; if (n === 2) return Plural.Two; if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10) return Plural.Few; if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99) return Plural.Many; return Plural.Other; case 'ast': case 'ca': case 'de': case 'en': case 'et': case 'fi': case 'fy': case 'gl': case 'it': case 'nl': case 'sv': case 'sw': case 'ur': case 'yi': if (i === 1 && v === 0) return Plural.One; return Plural.Other; case 'be': if (n % 10 === 1 && !(n % 100 === 11)) return Plural.One; if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 4 && !(n % 100 >= 12 && n % 100 <= 14)) return Plural.Few; if (n % 10 === 0 || n % 10 === Math.floor(n % 10) && n % 10 >= 5 && n % 10 <= 9 || n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 14) return Plural.Many; return Plural.Other; case 'br': if (n % 10 === 1 && !(n % 100 === 11 || n % 100 === 71 || n % 100 === 91)) return Plural.One; if (n % 10 === 2 && !(n % 100 === 12 || n % 100 === 72 || n % 100 === 92)) return Plural.Two; if (n % 10 === Math.floor(n % 10) && (n % 10 >= 3 && n % 10 <= 4 || n % 10 === 9) && !(n % 100 >= 10 && n % 100 <= 19 || n % 100 >= 70 && n % 100 <= 79 || n % 100 >= 90 && n % 100 <= 99)) return Plural.Few; if (!(n === 0) && n % 1e6 === 0) return Plural.Many; return Plural.Other; case 'bs': case 'hr': case 'sr': if (v === 0 && i % 10 === 1 && !(i % 100 === 11) || f % 10 === 1 && !(f % 100 === 11)) return Plural.One; if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 && !(i % 100 >= 12 && i % 100 <= 14) || f % 10 === Math.floor(f % 10) && f % 10 >= 2 && f % 10 <= 4 && !(f % 100 >= 12 && f % 100 <= 14)) return Plural.Few; return Plural.Other; case 'cs': case 'sk': if (i === 1 && v === 0) return Plural.One; if (i === Math.floor(i) && i >= 2 && i <= 4 && v === 0) return Plural.Few; if (!(v === 0)) return Plural.Many; return Plural.Other; case 'cy': if (n === 0) return Plural.Zero; if (n === 1) return Plural.One; if (n === 2) return Plural.Two; if (n === 3) return Plural.Few; if (n === 6) return Plural.Many; return Plural.Other; case 'da': if (n === 1 || !(t === 0) && (i === 0 || i === 1)) return Plural.One; return Plural.Other; case 'dsb': case 'hsb': if (v === 0 && i % 100 === 1 || f % 100 === 1) return Plural.One; if (v === 0 && i % 100 === 2 || f % 100 === 2) return Plural.Two; if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || f % 100 === Math.floor(f % 100) && f % 100 >= 3 && f % 100 <= 4) return Plural.Few; return Plural.Other; case 'ff': case 'fr': case 'hy': case 'kab': if (i === 0 || i === 1) return Plural.One; return Plural.Other; case 'fil': if (v === 0 && (i === 1 || i === 2 || i === 3) || v === 0 && !(i % 10 === 4 || i % 10 === 6 || i % 10 === 9) || !(v === 0) && !(f % 10 === 4 || f % 10 === 6 || f % 10 === 9)) return Plural.One; return Plural.Other; case 'ga': if (n === 1) return Plural.One; if (n === 2) return Plural.Two; if (n === Math.floor(n) && n >= 3 && n <= 6) return Plural.Few; if (n === Math.floor(n) && n >= 7 && n <= 10) return Plural.Many; return Plural.Other; case 'gd': if (n === 1 || n === 11) return Plural.One; if (n === 2 || n === 12) return Plural.Two; if (n === Math.floor(n) && (n >= 3 && n <= 10 || n >= 13 && n <= 19)) return Plural.Few; return Plural.Other; case 'gv': if (v === 0 && i % 10 === 1) return Plural.One; if (v === 0 && i % 10 === 2) return Plural.Two; if (v === 0 && (i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80)) return Plural.Few; if (!(v === 0)) return Plural.Many; return Plural.Other; case 'he': if (i === 1 && v === 0) return Plural.One; if (i === 2 && v === 0) return Plural.Two; if (v === 0 && !(n >= 0 && n <= 10) && n % 10 === 0) return Plural.Many; return Plural.Other; case 'is': if (t === 0 && i % 10 === 1 && !(i % 100 === 11) || !(t === 0)) return Plural.One; return Plural.Other; case 'ksh': if (n === 0) return Plural.Zero; if (n === 1) return Plural.One; return Plural.Other; case 'kw': case 'naq': case 'se': case 'smn': if (n === 1) return Plural.One; if (n === 2) return Plural.Two; return Plural.Other; case 'lag': if (n === 0) return Plural.Zero; if ((i === 0 || i === 1) && !(n === 0)) return Plural.One; return Plural.Other; case 'lt': if (n % 10 === 1 && !(n % 100 >= 11 && n % 100 <= 19)) return Plural.One; if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 9 && !(n % 100 >= 11 && n % 100 <= 19)) return Plural.Few; if (!(f === 0)) return Plural.Many; return Plural.Other; case 'lv': case 'prg': if (n % 10 === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19 || v === 2 && f % 100 === Math.floor(f % 100) && f % 100 >= 11 && f % 100 <= 19) return Plural.Zero; if (n % 10 === 1 && !(n % 100 === 11) || v === 2 && f % 10 === 1 && !(f % 100 === 11) || !(v === 2) && f % 10 === 1) return Plural.One; return Plural.Other; case 'mk': if (v === 0 && i % 10 === 1 || f % 10 === 1) return Plural.One; return Plural.Other; case 'mt': if (n === 1) return Plural.One; if (n === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 2 && n % 100 <= 10) return Plural.Few; if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19) return Plural.Many; return Plural.Other; case 'pl': if (i === 1 && v === 0) return Plural.One; if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 && !(i % 100 >= 12 && i % 100 <= 14)) return Plural.Few; if (v === 0 && !(i === 1) && i % 10 === Math.floor(i % 10) && i % 10 >= 0 && i % 10 <= 1 || v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 || v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 12 && i % 100 <= 14) return Plural.Many; return Plural.Other; case 'pt': if (n === Math.floor(n) && n >= 0 && n <= 2 && !(n === 2)) return Plural.One; return Plural.Other; case 'ro': if (i === 1 && v === 0) return Plural.One; if (!(v === 0) || n === 0 || !(n === 1) && n % 100 === Math.floor(n % 100) && n % 100 >= 1 && n % 100 <= 19) return Plural.Few; return Plural.Other; case 'ru': case 'uk': if (v === 0 && i % 10 === 1 && !(i % 100 === 11)) return Plural.One; if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 && !(i % 100 >= 12 && i % 100 <= 14)) return Plural.Few; if (v === 0 && i % 10 === 0 || v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 || v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 11 && i % 100 <= 14) return Plural.Many; return Plural.Other; case 'shi': if (i === 0 || n === 1) return Plural.One; if (n === Math.floor(n) && n >= 2 && n <= 10) return Plural.Few; return Plural.Other; case 'si': if (n === 0 || n === 1 || i === 0 && f === 1) return Plural.One; return Plural.Other; case 'sl': if (v === 0 && i % 100 === 1) return Plural.One; if (v === 0 && i % 100 === 2) return Plural.Two; if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || !(v === 0)) return Plural.Few; return Plural.Other; case 'tzm': if (n === Math.floor(n) && n >= 0 && n <= 1 || n === Math.floor(n) && n >= 11 && n <= 99) return Plural.One; return Plural.Other; // When there is no specification, the default is always "other" // Spec: http://cldr.unicode.org/index/cldr-spec/plural-rules // > other (required—general plural form — also used if the language only has a single form) default: return Plural.Other; } } /** * @fileoverview added by tsickle * @suppress {checkTypes} 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); for (var _i = 0, _a = cookieStr.split(';'); _i < _a.length; _i++) { var cookie = _a[_i]; var /** @type {?} */ eqIndex = cookie.indexOf('='); var _b = eqIndex == -1 ? [cookie, ''] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)], cookieName = _b[0], cookieValue = _b[1]; if (cookieName.trim() === name) { return decodeURIComponent(cookieValue); } } return null; } /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * \@ngModule CommonModule * * \@whatItDoes Adds and removes CSS classes on an HTML element. * * \@howToUse * ``` * ... * * ... * * ... * * ... * * ... * ``` * * \@description * * The CSS classes are updated as follows, depending on the type of the expression evaluation: * - `string` - the CSS classes listed in the string (space delimited) are added, * - `Array` - the CSS classes declared as Array elements are added, * - `Object` - keys are CSS classes that get added when the expression given in the value * evaluates to a truthy value, otherwise they are removed. * * \@stable */ var NgClass = /** @class */ (function () { function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) { this._iterableDiffers = _iterableDiffers; this._keyValueDiffers = _keyValueDiffers; this._ngEl = _ngEl; this._renderer = _renderer; this._initialClasses = []; } Object.defineProperty(NgClass.prototype, "klass", { set: /** * @param {?} v * @return {?} */ function (v) { this._applyInitialClasses(true); this._initialClasses = typeof v === 'string' ? v.split(/\s+/) : []; this._applyInitialClasses(false); this._applyClasses(this._rawClass, false); }, enumerable: true, configurable: true }); Object.defineProperty(NgClass.prototype, "ngClass", { set: /** * @param {?} v * @return {?} */ function (v) { this._cleanupClasses(this._rawClass); this._iterableDiffer = null; this._keyValueDiffer = null; this._rawClass = typeof v === 'string' ? v.split(/\s+/) : v; if (this._rawClass) { if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵisListLikeIterable"])(this._rawClass)) { this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create(); } else { this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create(); } } }, enumerable: true, configurable: true }); /** * @return {?} */ NgClass.prototype.ngDoCheck = /** * @return {?} */ function () { if (this._iterableDiffer) { var /** @type {?} */ iterableChanges = this._iterableDiffer.diff(/** @type {?} */ (this._rawClass)); if (iterableChanges) { this._applyIterableChanges(iterableChanges); } } else if (this._keyValueDiffer) { var /** @type {?} */ keyValueChanges = this._keyValueDiffer.diff(/** @type {?} */ (this._rawClass)); if (keyValueChanges) { this._applyKeyValueChanges(keyValueChanges); } } }; /** * @param {?} rawClassVal * @return {?} */ NgClass.prototype._cleanupClasses = /** * @param {?} rawClassVal * @return {?} */ function (rawClassVal) { this._applyClasses(rawClassVal, true); this._applyInitialClasses(false); }; /** * @param {?} changes * @return {?} */ NgClass.prototype._applyKeyValueChanges = /** * @param {?} changes * @return {?} */ function (changes) { var _this = this; changes.forEachAddedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); }); changes.forEachChangedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); }); changes.forEachRemovedItem(function (record) { if (record.previousValue) { _this._toggleClass(record.key, false); } }); }; /** * @param {?} changes * @return {?} */ NgClass.prototype._applyIterableChanges = /** * @param {?} changes * @return {?} */ function (changes) { var _this = this; changes.forEachAddedItem(function (record) { if (typeof record.item === 'string') { _this._toggleClass(record.item, true); } else { throw new Error("NgClass can only toggle CSS classes expressed as strings, got " + Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵstringify"])(record.item)); } }); changes.forEachRemovedItem(function (record) { return _this._toggleClass(record.item, false); }); }; /** * @param {?} isCleanup * @return {?} */ NgClass.prototype._applyInitialClasses = /** * @param {?} isCleanup * @return {?} */ function (isCleanup) { var _this = this; this._initialClasses.forEach(function (klass) { return _this._toggleClass(klass, !isCleanup); }); }; /** * @param {?} rawClassVal * @param {?} isCleanup * @return {?} */ NgClass.prototype._applyClasses = /** * @param {?} rawClassVal * @param {?} isCleanup * @return {?} */ function (rawClassVal, isCleanup) { var _this = this; if (rawClassVal) { if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) { (/** @type {?} */ (rawClassVal)).forEach(function (klass) { return _this._toggleClass(klass, !isCleanup); }); } else { Object.keys(rawClassVal).forEach(function (klass) { if (rawClassVal[klass] != null) _this._toggleClass(klass, !isCleanup); }); } } }; /** * @param {?} klass * @param {?} enabled * @return {?} */ NgClass.prototype._toggleClass = /** * @param {?} klass * @param {?} enabled * @return {?} */ function (klass, enabled) { var _this = this; klass = klass.trim(); if (klass) { klass.split(/\s+/g).forEach(function (klass) { if (enabled) { _this._renderer.addClass(_this._ngEl.nativeElement, klass); } else { _this._renderer.removeClass(_this._ngEl.nativeElement, klass); } }); } }; NgClass.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngClass]' },] }, ]; /** @nocollapse */ NgClass.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["IterableDiffers"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["KeyValueDiffers"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, ]; }; NgClass.propDecorators = { "klass": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['class',] },], "ngClass": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgClass; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * Instantiates a single {\@link Component} type and inserts its Host View into current View. * `NgComponentOutlet` provides a declarative approach for dynamic component creation. * * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and * any existing component will get destroyed. * * ### Fine tune control * * You can control the component creation process by using the following optional attributes: * * * `ngComponentOutletInjector`: Optional custom {\@link Injector} that will be used as parent for * the Component. Defaults to the injector of the current view container. * * * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content * section of the component, if exists. * * * `ngComponentOutletNgModuleFactory`: Optional module factory to allow dynamically loading other * module, then load a component from that module. * * ### Syntax * * Simple * ``` * * ``` * * Customized injector/content * ``` * * * ``` * * Customized ngModuleFactory * ``` * * * ``` * ## Example * * {\@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'} * * A more complete example with additional options: * * {\@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'} * A more complete example with ngModuleFactory: * * {\@example common/ngComponentOutlet/ts/module.ts region='NgModuleFactoryExample'} * * \@experimental */ var NgComponentOutlet = /** @class */ (function () { function NgComponentOutlet(_viewContainerRef) { this._viewContainerRef = _viewContainerRef; this._componentRef = null; this._moduleRef = null; } /** * @param {?} changes * @return {?} */ NgComponentOutlet.prototype.ngOnChanges = /** * @param {?} changes * @return {?} */ function (changes) { this._viewContainerRef.clear(); this._componentRef = null; if (this.ngComponentOutlet) { var /** @type {?} */ elInjector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector; if (changes['ngComponentOutletNgModuleFactory']) { if (this._moduleRef) this._moduleRef.destroy(); if (this.ngComponentOutletNgModuleFactory) { var /** @type {?} */ parentModule = elInjector.get(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModuleRef"]); this._moduleRef = this.ngComponentOutletNgModuleFactory.create(parentModule.injector); } else { this._moduleRef = null; } } var /** @type {?} */ componentFactoryResolver = this._moduleRef ? this._moduleRef.componentFactoryResolver : elInjector.get(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ComponentFactoryResolver"]); var /** @type {?} */ componentFactory = componentFactoryResolver.resolveComponentFactory(this.ngComponentOutlet); this._componentRef = this._viewContainerRef.createComponent(componentFactory, this._viewContainerRef.length, elInjector, this.ngComponentOutletContent); } }; /** * @return {?} */ NgComponentOutlet.prototype.ngOnDestroy = /** * @return {?} */ function () { if (this._moduleRef) this._moduleRef.destroy(); }; NgComponentOutlet.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngComponentOutlet]' },] }, ]; /** @nocollapse */ NgComponentOutlet.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, ]; }; NgComponentOutlet.propDecorators = { "ngComponentOutlet": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngComponentOutletInjector": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngComponentOutletContent": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngComponentOutletNgModuleFactory": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgComponentOutlet; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * \@stable */ var NgForOfContext = /** @class */ (function () { function NgForOfContext($implicit, ngForOf, index, count) { this.$implicit = $implicit; this.ngForOf = ngForOf; this.index = index; this.count = count; } Object.defineProperty(NgForOfContext.prototype, "first", { get: /** * @return {?} */ function () { return this.index === 0; }, enumerable: true, configurable: true }); Object.defineProperty(NgForOfContext.prototype, "last", { get: /** * @return {?} */ function () { return this.index === this.count - 1; }, enumerable: true, configurable: true }); Object.defineProperty(NgForOfContext.prototype, "even", { get: /** * @return {?} */ function () { return this.index % 2 === 0; }, enumerable: true, configurable: true }); Object.defineProperty(NgForOfContext.prototype, "odd", { get: /** * @return {?} */ function () { return !this.even; }, enumerable: true, configurable: true }); return NgForOfContext; }()); /** * The `NgForOf` directive instantiates a template once per item from an iterable. The context * for each instantiated template inherits from the outer context with the given loop variable * set to the current item from the iterable. * * ### Local Variables * * `NgForOf` provides several exported values that can be aliased to local variables: * * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`). * - `ngForOf: NgIterable`: The value of the iterable expression. Useful when the expression is * more complex then a property access, for example when using the async pipe (`userStreams | * async`). * - `index: number`: The index of the current item in the iterable. * - `first: boolean`: True when the item is the first item in the iterable. * - `last: boolean`: True when the item is the last item in the iterable. * - `even: boolean`: True when the item has an even index in the iterable. * - `odd: boolean`: True when the item has an odd index in the iterable. * * ``` *
  • * {{i}}/{{users.length}}. {{user}} default *
  • * ``` * * ### Change Propagation * * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM: * * * When an item is added, a new instance of the template is added to the DOM. * * When an item is removed, its template instance is removed from the DOM. * * When items are reordered, their respective templates are reordered in the DOM. * * Otherwise, the DOM element for that item will remain the same. * * Angular uses object identity to track insertions and deletions within the iterator and reproduce * those changes in the DOM. This has important implications for animations and any stateful * controls (such as `` elements which accept user input) that are present. Inserted rows can * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state * such as user input. * * It is possible for the identities of elements in the iterator to change while the data does not. * This can happen, for example, if the iterator produced from an RPC to the server, and that * RPC is re-run. Even if the data hasn't changed, the second response will produce objects with * different identities, and Angular will tear down the entire DOM and rebuild it (as if all old * elements were deleted and all new elements inserted). This is an expensive operation and should * be avoided if possible. * * To customize the default tracking algorithm, `NgForOf` supports `trackBy` option. * `trackBy` takes a function which has two arguments: `index` and `item`. * If `trackBy` is given, Angular tracks changes by the return value of the function. * * ### Syntax * * - `
  • ...
  • ` * * With `` element: * * ``` * *
  • ...
  • *
    * ``` * * ### Example * * See a [live demo](http://plnkr.co/edit/KVuXxDp0qinGDyo307QW?p=preview) for a more detailed * example. * * \@stable */ var NgForOf = /** @class */ (function () { function NgForOf(_viewContainer, _template, _differs) { this._viewContainer = _viewContainer; this._template = _template; this._differs = _differs; this._differ = null; } Object.defineProperty(NgForOf.prototype, "ngForTrackBy", { get: /** * @return {?} */ function () { return this._trackByFn; }, set: /** * @param {?} fn * @return {?} */ function (fn) { if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["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 " + JSON.stringify(fn) + ". " + "See https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html#!#change-propagation for more information."); } } this._trackByFn = fn; }, enumerable: true, configurable: true }); Object.defineProperty(NgForOf.prototype, "ngForTemplate", { set: /** * @param {?} value * @return {?} */ function (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; } }, enumerable: true, configurable: true }); /** * @param {?} changes * @return {?} */ NgForOf.prototype.ngOnChanges = /** * @param {?} changes * @return {?} */ function (changes) { if ('ngForOf' in changes) { // React on ngForOf changes only once all inputs have been initialized var /** @type {?} */ value = changes['ngForOf'].currentValue; if (!this._differ && value) { try { this._differ = this._differs.find(value).create(this.ngForTrackBy); } catch (/** @type {?} */ e) { throw new Error("Cannot find a differ supporting object '" + value + "' of type '" + getTypeNameForDebugging(value) + "'. NgFor only supports binding to Iterables such as Arrays."); } } } }; /** * @return {?} */ NgForOf.prototype.ngDoCheck = /** * @return {?} */ function () { if (this._differ) { var /** @type {?} */ changes = this._differ.diff(this.ngForOf); if (changes) this._applyChanges(changes); } }; /** * @param {?} changes * @return {?} */ NgForOf.prototype._applyChanges = /** * @param {?} changes * @return {?} */ function (changes) { var _this = this; var /** @type {?} */ insertTuples = []; changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) { if (item.previousIndex == null) { var /** @type {?} */ view = _this._viewContainer.createEmbeddedView(_this._template, new NgForOfContext(/** @type {?} */ ((null)), _this.ngForOf, -1, -1), currentIndex); var /** @type {?} */ tuple = new RecordViewTuple(item, view); insertTuples.push(tuple); } else if (currentIndex == null) { _this._viewContainer.remove(adjustedPreviousIndex); } else { var /** @type {?} */ view = /** @type {?} */ ((_this._viewContainer.get(adjustedPreviousIndex))); _this._viewContainer.move(view, currentIndex); var /** @type {?} */ tuple = new RecordViewTuple(item, /** @type {?} */ (view)); insertTuples.push(tuple); } }); for (var /** @type {?} */ i = 0; i < insertTuples.length; i++) { this._perViewChange(insertTuples[i].view, insertTuples[i].record); } for (var /** @type {?} */ i = 0, /** @type {?} */ ilen = this._viewContainer.length; i < ilen; i++) { var /** @type {?} */ viewRef = /** @type {?} */ (this._viewContainer.get(i)); viewRef.context.index = i; viewRef.context.count = ilen; } changes.forEachIdentityChange(function (record) { var /** @type {?} */ viewRef = /** @type {?} */ (_this._viewContainer.get(record.currentIndex)); viewRef.context.$implicit = record.item; }); }; /** * @param {?} view * @param {?} record * @return {?} */ NgForOf.prototype._perViewChange = /** * @param {?} view * @param {?} record * @return {?} */ function (view, record) { view.context.$implicit = record.item; }; NgForOf.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngFor][ngForOf]' },] }, ]; /** @nocollapse */ NgForOf.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["IterableDiffers"], }, ]; }; NgForOf.propDecorators = { "ngForOf": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngForTrackBy": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngForTemplate": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgForOf; }()); var RecordViewTuple = /** @class */ (function () { function RecordViewTuple(record, view) { this.record = record; this.view = view; } return RecordViewTuple; }()); /** * @param {?} type * @return {?} */ function getTypeNameForDebugging(type) { return type['name'] || typeof type; } /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * Conditionally includes a template based on the value of an `expression`. * * `ngIf` evaluates the `expression` and then renders the `then` or `else` template in its place * when expression is truthy or falsy respectively. Typically the: * - `then` template is the inline template of `ngIf` unless bound to a different value. * - `else` template is blank unless it is bound. * * ## Most common usage * * The most common usage of the `ngIf` directive is to conditionally show the inline template as * seen in this example: * {\@example common/ngIf/ts/module.ts region='NgIfSimple'} * * ## Showing an alternative template using `else` * * If it is necessary to display a template when the `expression` is falsy use the `else` template * binding as shown. Note that the `else` binding points to a `` labeled `#elseBlock`. * The template can be defined anywhere in the component view but is typically placed right after * `ngIf` for readability. * * {\@example common/ngIf/ts/module.ts region='NgIfElse'} * * ## Using non-inlined `then` template * * Usually the `then` template is the inlined template of the `ngIf`, but it can be changed using * a binding (just like `else`). Because `then` and `else` are bindings, the template references can * change at runtime as shown in this example. * * {\@example common/ngIf/ts/module.ts region='NgIfThenElse'} * * ## Storing conditional result in a variable * * A common pattern is that we need to show a set of properties from the same object. If the * object is undefined, then we have to use the safe-traversal-operator `?.` to guard against * dereferencing a `null` value. This is especially the case when waiting on async data such as * when using the `async` pipe as shown in following example: * * ``` * Hello {{ (userStream|async)?.last }}, {{ (userStream|async)?.first }}! * ``` * * There are several inefficiencies in the above example: * - We create multiple subscriptions on `userStream`. One for each `async` pipe, or two in the * example above. * - We cannot display an alternative screen while waiting for the data to arrive asynchronously. * - We have to use the safe-traversal-operator `?.` to access properties, which is cumbersome. * - We have to place the `async` pipe in parenthesis. * * A better way to do this is to use `ngIf` and store the result of the condition in a local * variable as shown in the the example below: * * {\@example common/ngIf/ts/module.ts region='NgIfAs'} * * Notice that: * - We use only one `async` pipe and hence only one subscription gets created. * - `ngIf` stores the result of the `userStream|async` in the local variable `user`. * - The local `user` can then be bound repeatedly in a more efficient way. * - No need to use the safe-traversal-operator `?.` to access properties as `ngIf` will only * display the data if `userStream` returns a value. * - We can display an alternative template while waiting for the data. * * ### Syntax * * Simple form: * - `
    ...
    ` * - `
    ...
    ` * * Form with an else block: * ``` *
    ...
    * ... * ``` * * Form with a `then` and `else` block: * ``` *
    * ... * ... * ``` * * Form with storing the value locally: * ``` *
    {{value}}
    * ... * ``` * * \@stable */ var NgIf = /** @class */ (function () { function NgIf(_viewContainer, templateRef) { this._viewContainer = _viewContainer; this._context = new NgIfContext(); this._thenTemplateRef = null; this._elseTemplateRef = null; this._thenViewRef = null; this._elseViewRef = null; this._thenTemplateRef = templateRef; } Object.defineProperty(NgIf.prototype, "ngIf", { set: /** * @param {?} condition * @return {?} */ function (condition) { this._context.$implicit = this._context.ngIf = condition; this._updateView(); }, enumerable: true, configurable: true }); Object.defineProperty(NgIf.prototype, "ngIfThen", { set: /** * @param {?} templateRef * @return {?} */ function (templateRef) { this._thenTemplateRef = templateRef; this._thenViewRef = null; // clear previous view if any. this._updateView(); }, enumerable: true, configurable: true }); Object.defineProperty(NgIf.prototype, "ngIfElse", { set: /** * @param {?} templateRef * @return {?} */ function (templateRef) { this._elseTemplateRef = templateRef; this._elseViewRef = null; // clear previous view if any. this._updateView(); }, enumerable: true, configurable: true }); /** * @return {?} */ NgIf.prototype._updateView = /** * @return {?} */ function () { 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); } } } }; NgIf.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngIf]' },] }, ]; /** @nocollapse */ NgIf.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, ]; }; NgIf.propDecorators = { "ngIf": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngIfThen": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngIfElse": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgIf; }()); /** * \@stable */ var NgIfContext = /** @class */ (function () { function NgIfContext() { this.$implicit = null; this.ngIf = null; } return NgIfContext; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ var SwitchView = /** @class */ (function () { function SwitchView(_viewContainerRef, _templateRef) { this._viewContainerRef = _viewContainerRef; this._templateRef = _templateRef; this._created = false; } /** * @return {?} */ SwitchView.prototype.create = /** * @return {?} */ function () { this._created = true; this._viewContainerRef.createEmbeddedView(this._templateRef); }; /** * @return {?} */ SwitchView.prototype.destroy = /** * @return {?} */ function () { this._created = false; this._viewContainerRef.clear(); }; /** * @param {?} created * @return {?} */ SwitchView.prototype.enforceState = /** * @param {?} created * @return {?} */ function (created) { if (created && !this._created) { this.create(); } else if (!created && this._created) { this.destroy(); } }; return SwitchView; }()); /** * \@ngModule CommonModule * * \@whatItDoes Adds / removes DOM sub-trees when the nest match expressions matches the switch * expression. * * \@howToUse * ``` * * ... * ... * ... * * * * * * ... * * ``` * \@description * * `NgSwitch` stamps out nested views when their match expression value matches the value of the * switch expression. * * In other words: * - you define a container element (where you place the directive with a switch expression on the * `[ngSwitch]="..."` attribute) * - you define inner views inside the `NgSwitch` and place a `*ngSwitchCase` attribute on the view * root elements. * * Elements within `NgSwitch` but outside of a `NgSwitchCase` or `NgSwitchDefault` directives will * be preserved at the location. * * The `ngSwitchCase` directive informs the parent `NgSwitch` of which view to display when the * expression is evaluated. * When no matching expression is found on a `ngSwitchCase` view, the `ngSwitchDefault` view is * stamped out. * * \@stable */ var NgSwitch = /** @class */ (function () { function NgSwitch() { this._defaultUsed = false; this._caseCount = 0; this._lastCaseCheckIndex = 0; this._lastCasesMatched = false; } Object.defineProperty(NgSwitch.prototype, "ngSwitch", { set: /** * @param {?} newValue * @return {?} */ function (newValue) { this._ngSwitch = newValue; if (this._caseCount === 0) { this._updateDefaultCases(true); } }, enumerable: true, configurable: true }); /** @internal */ /** * \@internal * @return {?} */ NgSwitch.prototype._addCase = /** * \@internal * @return {?} */ function () { return this._caseCount++; }; /** @internal */ /** * \@internal * @param {?} view * @return {?} */ NgSwitch.prototype._addDefault = /** * \@internal * @param {?} view * @return {?} */ function (view) { if (!this._defaultViews) { this._defaultViews = []; } this._defaultViews.push(view); }; /** @internal */ /** * \@internal * @param {?} value * @return {?} */ NgSwitch.prototype._matchCase = /** * \@internal * @param {?} value * @return {?} */ function (value) { var /** @type {?} */ 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; }; /** * @param {?} useDefault * @return {?} */ NgSwitch.prototype._updateDefaultCases = /** * @param {?} useDefault * @return {?} */ function (useDefault) { if (this._defaultViews && useDefault !== this._defaultUsed) { this._defaultUsed = useDefault; for (var /** @type {?} */ i = 0; i < this._defaultViews.length; i++) { var /** @type {?} */ defaultView = this._defaultViews[i]; defaultView.enforceState(useDefault); } } }; NgSwitch.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngSwitch]' },] }, ]; /** @nocollapse */ NgSwitch.ctorParameters = function () { return []; }; NgSwitch.propDecorators = { "ngSwitch": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgSwitch; }()); /** * \@ngModule CommonModule * * \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgSwitch} when the * given expression evaluate to respectively the same/different value as the switch * expression. * * \@howToUse * ``` * * ... * * ``` * \@description * * Insert the sub-tree when the expression evaluates to the same value as the enclosing switch * expression. * * If multiple match expressions match the switch expression value, all of them are displayed. * * See {\@link NgSwitch} for more details and example. * * \@stable */ var NgSwitchCase = /** @class */ (function () { function NgSwitchCase(viewContainer, templateRef, ngSwitch) { this.ngSwitch = ngSwitch; ngSwitch._addCase(); this._view = new SwitchView(viewContainer, templateRef); } /** * @return {?} */ NgSwitchCase.prototype.ngDoCheck = /** * @return {?} */ function () { this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase)); }; NgSwitchCase.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngSwitchCase]' },] }, ]; /** @nocollapse */ NgSwitchCase.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, { type: NgSwitch, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Host"] },] }, ]; }; NgSwitchCase.propDecorators = { "ngSwitchCase": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgSwitchCase; }()); /** * \@ngModule CommonModule * \@whatItDoes Creates a view that is added to the parent {\@link NgSwitch} when no case expressions * match the * switch expression. * * \@howToUse * ``` * * ... * ... * * ``` * * \@description * * Insert the sub-tree when no case expressions evaluate to the same value as the enclosing switch * expression. * * See {\@link NgSwitch} for more details and example. * * \@stable */ var NgSwitchDefault = /** @class */ (function () { function NgSwitchDefault(viewContainer, templateRef, ngSwitch) { ngSwitch._addDefault(new SwitchView(viewContainer, templateRef)); } NgSwitchDefault.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngSwitchDefault]' },] }, ]; /** @nocollapse */ NgSwitchDefault.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, { type: NgSwitch, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Host"] },] }, ]; }; return NgSwitchDefault; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * \@ngModule CommonModule * * \@whatItDoes Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization. * * \@howToUse * ``` * * there is nothing * there is one * there are a few * * ``` * * \@description * * Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees * that match the switch expression's pluralization category. * * To use this directive you must provide a container element that sets the `[ngPlural]` attribute * to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their * expression: * - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value * matches the switch expression exactly, * - otherwise, the view will be treated as a "category match", and will only display if exact * value matches aren't found and the value maps to its category for the defined locale. * * See http://cldr.unicode.org/index/cldr-spec/plural-rules * * \@experimental */ var NgPlural = /** @class */ (function () { function NgPlural(_localization) { this._localization = _localization; this._caseViews = {}; } Object.defineProperty(NgPlural.prototype, "ngPlural", { set: /** * @param {?} value * @return {?} */ function (value) { this._switchValue = value; this._updateView(); }, enumerable: true, configurable: true }); /** * @param {?} value * @param {?} switchView * @return {?} */ NgPlural.prototype.addCase = /** * @param {?} value * @param {?} switchView * @return {?} */ function (value, switchView) { this._caseViews[value] = switchView; }; /** * @return {?} */ NgPlural.prototype._updateView = /** * @return {?} */ function () { this._clearViews(); var /** @type {?} */ cases = Object.keys(this._caseViews); var /** @type {?} */ key = getPluralCategory(this._switchValue, cases, this._localization); this._activateView(this._caseViews[key]); }; /** * @return {?} */ NgPlural.prototype._clearViews = /** * @return {?} */ function () { if (this._activeView) this._activeView.destroy(); }; /** * @param {?} view * @return {?} */ NgPlural.prototype._activateView = /** * @param {?} view * @return {?} */ function (view) { if (view) { this._activeView = view; this._activeView.create(); } }; NgPlural.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngPlural]' },] }, ]; /** @nocollapse */ NgPlural.ctorParameters = function () { return [ { type: NgLocalization, }, ]; }; NgPlural.propDecorators = { "ngPlural": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgPlural; }()); /** * \@ngModule CommonModule * * \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgPlural} when the * given expression matches the plural expression according to CLDR rules. * * \@howToUse * ``` * * ... * ... * * ``` * * See {\@link NgPlural} for more details and example. * * \@experimental */ var NgPluralCase = /** @class */ (function () { function NgPluralCase(value, template, viewContainer, ngPlural) { this.value = value; var /** @type {?} */ isANumber = !isNaN(Number(value)); ngPlural.addCase(isANumber ? "=" + value : value, new SwitchView(viewContainer, template)); } NgPluralCase.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngPluralCase]' },] }, ]; /** @nocollapse */ NgPluralCase.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Attribute"], args: ['ngPluralCase',] },] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, { type: NgPlural, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Host"] },] }, ]; }; return NgPluralCase; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * \@ngModule CommonModule * * \@whatItDoes Update an HTML element styles. * * \@howToUse * ``` * ... * * ... * * ... * ``` * * \@description * * The styles are updated according to the value of the expression evaluation: * - keys are style names with an optional `.` suffix (ie 'top.px', 'font-style.em'), * - values are the values assigned to those properties (expressed in the given unit). * * \@stable */ var NgStyle = /** @class */ (function () { function NgStyle(_differs, _ngEl, _renderer) { this._differs = _differs; this._ngEl = _ngEl; this._renderer = _renderer; } Object.defineProperty(NgStyle.prototype, "ngStyle", { set: /** * @param {?} v * @return {?} */ function (v) { this._ngStyle = v; if (!this._differ && v) { this._differ = this._differs.find(v).create(); } }, enumerable: true, configurable: true }); /** * @return {?} */ NgStyle.prototype.ngDoCheck = /** * @return {?} */ function () { if (this._differ) { var /** @type {?} */ changes = this._differ.diff(this._ngStyle); if (changes) { this._applyChanges(changes); } } }; /** * @param {?} changes * @return {?} */ NgStyle.prototype._applyChanges = /** * @param {?} changes * @return {?} */ function (changes) { var _this = this; changes.forEachRemovedItem(function (record) { return _this._setStyle(record.key, null); }); changes.forEachAddedItem(function (record) { return _this._setStyle(record.key, record.currentValue); }); changes.forEachChangedItem(function (record) { return _this._setStyle(record.key, record.currentValue); }); }; /** * @param {?} nameAndUnit * @param {?} value * @return {?} */ NgStyle.prototype._setStyle = /** * @param {?} nameAndUnit * @param {?} value * @return {?} */ function (nameAndUnit, value) { var _a = nameAndUnit.split('.'), name = _a[0], unit = _a[1]; value = value != null && unit ? "" + value + unit : value; if (value != null) { this._renderer.setStyle(this._ngEl.nativeElement, name, /** @type {?} */ (value)); } else { this._renderer.removeStyle(this._ngEl.nativeElement, name); } }; NgStyle.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngStyle]' },] }, ]; /** @nocollapse */ NgStyle.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["KeyValueDiffers"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer2"], }, ]; }; NgStyle.propDecorators = { "ngStyle": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgStyle; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * \@ngModule CommonModule * * \@whatItDoes Inserts an embedded view from a prepared `TemplateRef` * * \@howToUse * ``` * * ``` * * \@description * * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`. * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding * by the local template `let` declarations. * * Note: using the key `$implicit` in the context object will set it's value as default. * * ## Example * * {\@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'} * * \@stable */ var NgTemplateOutlet = /** @class */ (function () { function NgTemplateOutlet(_viewContainerRef) { this._viewContainerRef = _viewContainerRef; } /** * @param {?} changes * @return {?} */ NgTemplateOutlet.prototype.ngOnChanges = /** * @param {?} changes * @return {?} */ function (changes) { var /** @type {?} */ recreateView = this._shouldRecreateView(changes); if (recreateView) { if (this._viewRef) { this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._viewRef)); } if (this.ngTemplateOutlet) { this._viewRef = this._viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, this.ngTemplateOutletContext); } } 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). * @param {?} changes * @return {?} */ NgTemplateOutlet.prototype._shouldRecreateView = /** * 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). * @param {?} changes * @return {?} */ function (changes) { var /** @type {?} */ ctxChange = changes['ngTemplateOutletContext']; return !!changes['ngTemplateOutlet'] || (ctxChange && this._hasContextShapeChanged(ctxChange)); }; /** * @param {?} ctxChange * @return {?} */ NgTemplateOutlet.prototype._hasContextShapeChanged = /** * @param {?} ctxChange * @return {?} */ function (ctxChange) { var /** @type {?} */ prevCtxKeys = Object.keys(ctxChange.previousValue || {}); var /** @type {?} */ currCtxKeys = Object.keys(ctxChange.currentValue || {}); if (prevCtxKeys.length === currCtxKeys.length) { for (var _i = 0, currCtxKeys_1 = currCtxKeys; _i < currCtxKeys_1.length; _i++) { var propName = currCtxKeys_1[_i]; if (prevCtxKeys.indexOf(propName) === -1) { return true; } } return false; } else { return true; } }; /** * @param {?} ctx * @return {?} */ NgTemplateOutlet.prototype._updateExistingContext = /** * @param {?} ctx * @return {?} */ function (ctx) { for (var _i = 0, _a = Object.keys(ctx); _i < _a.length; _i++) { var propName = _a[_i]; (/** @type {?} */ (this._viewRef.context))[propName] = (/** @type {?} */ (this.ngTemplateOutletContext))[propName]; } }; NgTemplateOutlet.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngTemplateOutlet]' },] }, ]; /** @nocollapse */ NgTemplateOutlet.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, ]; }; NgTemplateOutlet.propDecorators = { "ngTemplateOutletContext": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], "ngTemplateOutlet": [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], }; return NgTemplateOutlet; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 collection of Angular directives that are likely to be used in each and every Angular * application. */ var COMMON_DIRECTIVES = [ NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ var NAMED_FORMATS = {}; 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 = { Short: 0, ShortGMT: 1, Long: 2, Extended: 3, }; ZoneWidth[ZoneWidth.Short] = "Short"; ZoneWidth[ZoneWidth.ShortGMT] = "ShortGMT"; ZoneWidth[ZoneWidth.Long] = "Long"; ZoneWidth[ZoneWidth.Extended] = "Extended"; /** @enum {number} */ var DateType = { FullYear: 0, Month: 1, Date: 2, Hours: 3, Minutes: 4, Seconds: 5, Milliseconds: 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.Milliseconds] = "Milliseconds"; DateType[DateType.Day] = "Day"; /** @enum {number} */ 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"; /** * Transforms a date to a locale string based on a pattern and a timezone * * \@internal * @param {?} date * @param {?} format * @param {?} locale * @param {?=} timezone * @return {?} */ function formatDate(date, format, locale, timezone) { var /** @type {?} */ namedFormat = getNamedFormat(locale, format); format = namedFormat || format; var /** @type {?} */ parts = []; var /** @type {?} */ match; while (format) { match = DATE_FORMATS_SPLIT.exec(format); if (match) { parts = parts.concat(match.slice(1)); var /** @type {?} */ part = parts.pop(); if (!part) { break; } format = part; } else { parts.push(format); break; } } var /** @type {?} */ dateTimezoneOffset = date.getTimezoneOffset(); if (timezone) { dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset); date = convertTimezoneToLocal(date, timezone, true); } var /** @type {?} */ text = ''; parts.forEach(function (value) { var /** @type {?} */ 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) { var /** @type {?} */ localeId = getLocaleId(locale); NAMED_FORMATS[localeId] = NAMED_FORMATS[localeId] || {}; if (NAMED_FORMATS[localeId][format]) { return NAMED_FORMATS[localeId][format]; } var /** @type {?} */ 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': var /** @type {?} */ shortTime = getNamedFormat(locale, 'shortTime'); var /** @type {?} */ shortDate = getNamedFormat(locale, 'shortDate'); formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Short), [shortTime, shortDate]); break; case 'medium': var /** @type {?} */ mediumTime = getNamedFormat(locale, 'mediumTime'); var /** @type {?} */ mediumDate = getNamedFormat(locale, 'mediumDate'); formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Medium), [mediumTime, mediumDate]); break; case 'long': var /** @type {?} */ longTime = getNamedFormat(locale, 'longTime'); var /** @type {?} */ longDate = getNamedFormat(locale, 'longDate'); formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Long), [longTime, longDate]); break; case 'full': var /** @type {?} */ fullTime = getNamedFormat(locale, 'fullTime'); var /** @type {?} */ 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, 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, minusSign, trim, negWrap) { if (minusSign === void 0) { minusSign = '-'; } var /** @type {?} */ neg = ''; if (num < 0 || (negWrap && num <= 0)) { if (negWrap) { num = -num + 1; } else { num = -num; neg = minusSign; } } var /** @type {?} */ strNum = '' + num; while (strNum.length < digits) strNum = '0' + strNum; if (trim) { strNum = strNum.substr(strNum.length - digits); } return neg + strNum; } /** * 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, offset, trim, negWrap) { if (offset === void 0) { offset = 0; } if (trim === void 0) { trim = false; } if (negWrap === void 0) { negWrap = false; } return function (date, locale) { var /** @type {?} */ part = getDatePart(name, date, size); if (offset > 0 || part > -offset) { part += offset; } if (name === DateType.Hours && part === 0 && offset === -12) { part = 12; } return padNumber(part, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign), trim, negWrap); }; } /** * @param {?} name * @param {?} date * @param {?} size * @return {?} */ function getDatePart(name, date, size) { switch (name) { 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.Milliseconds: var /** @type {?} */ div = size === 1 ? 100 : (size === 2 ? 10 : 1); return Math.round(date.getMilliseconds() / div); case DateType.Day: return date.getDay(); default: throw new Error("Unknown DateType value \"" + name + "\"."); } } /** * 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, form, extended) { if (form === void 0) { form = FormStyle.Format; } if (extended === void 0) { extended = false; } 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: var /** @type {?} */ currentHours_1 = date.getHours(); var /** @type {?} */ currentMinutes_1 = date.getMinutes(); if (extended) { var /** @type {?} */ rules = getLocaleExtraDayPeriodRules(locale); var /** @type {?} */ dayPeriods_1 = getLocaleExtraDayPeriods(locale, form, width); var /** @type {?} */ result_1; rules.forEach(function (rule, index) { if (Array.isArray(rule)) { // morning, afternoon, evening, night var _a = rule[0], hoursFrom = _a.hours, minutesFrom = _a.minutes; var _b = rule[1], hoursTo = _b.hours, minutesTo = _b.minutes; if (currentHours_1 >= hoursFrom && currentMinutes_1 >= minutesFrom && (currentHours_1 < hoursTo || (currentHours_1 === hoursTo && currentMinutes_1 < minutesTo))) { result_1 = dayPeriods_1[index]; } } else { // noon or midnight var hours = rule.hours, minutes = rule.minutes; if (hours === currentHours_1 && minutes === currentMinutes_1) { result_1 = dayPeriods_1[index]; } } }); if (result_1) { return result_1; } } // if no rules for the day periods, we use am/pm by default return getLocaleDayPeriods(locale, form, /** @type {?} */ (width))[currentHours_1 < 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. var /** @type {?} */ unexpected = name; throw new Error("unexpected translation type " + 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 function (date, locale, offset) { var /** @type {?} */ zone = -1 * offset; var /** @type {?} */ minusSign = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign); var /** @type {?} */ 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 \"" + width + "\""); } }; } var JANUARY = 0; var THURSDAY = 4; /** * @param {?} year * @return {?} */ function getFirstThursdayOfYear(year) { var /** @type {?} */ 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, monthBased) { if (monthBased === void 0) { monthBased = false; } return function (date, locale) { var /** @type {?} */ result; if (monthBased) { var /** @type {?} */ nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1; var /** @type {?} */ today = date.getDate(); result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7); } else { var /** @type {?} */ firstThurs = getFirstThursdayOfYear(date.getFullYear()); var /** @type {?} */ thisThurs = getThursdayThisWeek(date); var /** @type {?} */ 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)); }; } var DATE_FORMATS = {}; /** * @param {?} format * @return {?} */ function getDateFormatter(format) { if (DATE_FORMATS[format]) { return DATE_FORMATS[format]; } var /** @type {?} */ 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 padded (0-9) case 'S': formatter = dateGetter(DateType.Milliseconds, 1); break; case 'SS': formatter = dateGetter(DateType.Milliseconds, 2); break; // = millisecond case 'SSS': formatter = dateGetter(DateType.Milliseconds, 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, ''); var /** @type {?} */ 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) { var /** @type {?} */ reverseValue = reverse ? -1 : 1; var /** @type {?} */ dateTimezoneOffset = date.getTimezoneOffset(); var /** @type {?} */ timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset); return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset)); } /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 {?} type * @param {?} value * @return {?} */ function invalidPipeArgumentError(type, value) { return Error("InvalidPipeArgument: '" + value + "' for pipe '" + Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵstringify"])(type) + "'"); } /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ var ISO8601_DATE_REGEX = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; /** * \@ngModule CommonModule * \@whatItDoes Formats a date according to locale rules. * \@howToUse `date_expression | date[:format[:timezone[:locale]]]` * \@description * * Where: * - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string * (https://www.w3.org/TR/NOTE-datetime). * - `format` indicates which date/time components to include. The format can be predefined as * shown below (all examples are given for `en-US`) or custom as shown in the table. * - `'short'`: equivalent to `'M/d/yy, h:mm a'` (e.g. `6/15/15, 9:03 AM`) * - `'medium'`: equivalent to `'MMM d, y, h:mm:ss a'` (e.g. `Jun 15, 2015, 9:03:01 AM`) * - `'long'`: equivalent to `'MMMM d, y, h:mm:ss a z'` (e.g. `June 15, 2015 at 9:03:01 AM GMT+1`) * - `'full'`: equivalent to `'EEEE, MMMM d, y, h:mm:ss a zzzz'` (e.g. `Monday, June 15, 2015 at * 9:03:01 AM GMT+01:00`) * - `'shortDate'`: equivalent to `'M/d/yy'` (e.g. `6/15/15`) * - `'mediumDate'`: equivalent to `'MMM d, y'` (e.g. `Jun 15, 2015`) * - `'longDate'`: equivalent to `'MMMM d, y'` (e.g. `June 15, 2015`) * - `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` (e.g. `Monday, June 15, 2015`) * - `'shortTime'`: equivalent to `'h:mm a'` (e.g. `9:03 AM`) * - `'mediumTime'`: equivalent to `'h:mm:ss a'` (e.g. `9:03:01 AM`) * - `'longTime'`: equivalent to `'h:mm:ss a z'` (e.g. `9:03:01 AM GMT+1`) * - `'fullTime'`: equivalent to `'h:mm:ss a zzzz'` (e.g. `9:03:01 AM GMT+01:00`) * - `timezone` to be used for formatting. It understands UTC/GMT and the continental US time zone * abbreviations, but for general use, use a time zone offset, for example, * `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian) * If not specified, the local system timezone of the end-user's browser will be used. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by * default) * * * | Field Type | Format | Description | Example Value | * |--------------------|-------------|---------------------------------------------------------------|------------------------------------------------------------| * | Era | G, GG & GGG | Abbreviated | AD | * | | GGGG | Wide | Anno Domini | * | | GGGGG | Narrow | A | * | Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 | * | | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 | * | | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 | * | | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 | * | Month | M | Numeric: 1 digit | 9, 12 | * | | MM | Numeric: 2 digits + zero padded | 09, 12 | * | | MMM | Abbreviated | Sep | * | | MMMM | Wide | September | * | | MMMMM | Narrow | S | * | Month standalone | L | Numeric: 1 digit | 9, 12 | * | | LL | Numeric: 2 digits + zero padded | 09, 12 | * | | LLL | Abbreviated | Sep | * | | LLLL | Wide | September | * | | LLLLL | Narrow | S | * | Week of year | w | Numeric: minimum digits | 1... 53 | * | | ww | Numeric: 2 digits + zero padded | 01... 53 | * | Week of month | W | Numeric: 1 digit | 1... 5 | * | Day of month | d | Numeric: minimum digits | 1 | * | | dd | Numeric: 2 digits + zero padded | 01 | * | Week day | E, EE & EEE | Abbreviated | Tue | * | | EEEE | Wide | Tuesday | * | | EEEEE | Narrow | T | * | | EEEEEE | Short | Tu | * | Period | a, aa & aaa | Abbreviated | am/pm or AM/PM | * | | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem | * | | aaaaa | Narrow | a/p | * | Period* | B, BB & BBB | Abbreviated | mid. | * | | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night | * | | BBBBB | Narrow | md | * | Period standalone* | b, bb & bbb | Abbreviated | mid. | * | | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night | * | | bbbbb | Narrow | md | * | Hour 1-12 | h | Numeric: minimum digits | 1, 12 | * | | hh | Numeric: 2 digits + zero padded | 01, 12 | * | Hour 0-23 | H | Numeric: minimum digits | 0, 23 | * | | HH | Numeric: 2 digits + zero padded | 00, 23 | * | Minute | m | Numeric: minimum digits | 8, 59 | * | | mm | Numeric: 2 digits + zero padded | 08, 59 | * | Second | s | Numeric: minimum digits | 0... 59 | * | | ss | Numeric: 2 digits + zero padded | 00... 59 | * | Fractional seconds | S | Numeric: 1 digit | 0... 9 | * | | SS | Numeric: 2 digits + zero padded | 00... 99 | * | | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 | * | Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 | * | | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 | * | | Z, ZZ & ZZZ | ISO8601 basic format | -0800 | * | | ZZZZ | Long localized GMT format | GMT-8:00 | * | | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 | * | | O, OO & OOO | Short localized GMT format | GMT-8 | * | | OOOO | Long localized GMT format | GMT-08:00 | * * * When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not * applied and the formatted text will have the same day, month and year of the expression. * * WARNINGS: * - this pipe has only access to en-US locale data by default. If you want to localize the dates * in another language, you will have to import data for other locales. * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import additional locale * data. * - Fields suffixed with * are only available in the extra dataset. * See the {\@linkDocs guide/i18n#i18n-pipes "I18n guide"} to know how to import extra locale * data. * - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated. * Instead users should treat the date as an immutable object and change the reference when the * pipe needs to re-run (this is to avoid reformatting the date on every change detection run * which would be an expensive operation). * * ### Examples * * Assuming `dateObj` is (year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11) * in the _local_ time and locale is 'en-US': * * {\@example common/pipes/ts/date_pipe.ts region='DatePipe'} * * \@stable */ var DatePipe = /** @class */ (function () { function DatePipe(locale) { this.locale = locale; } /** * @param {?} value * @param {?=} format * @param {?=} timezone * @param {?=} locale * @return {?} */ DatePipe.prototype.transform = /** * @param {?} value * @param {?=} format * @param {?=} timezone * @param {?=} locale * @return {?} */ function (value, format, timezone, locale) { if (format === void 0) { format = 'mediumDate'; } if (value == null || value === '' || value !== value) return null; if (typeof value === 'string') { value = value.trim(); } var /** @type {?} */ date; var /** @type {?} */ match; if (isDate$1(value)) { date = value; } else if (!isNaN(value - parseFloat(value))) { date = new Date(parseFloat(value)); } else if (typeof value === 'string' && /^(\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 _a = value.split('-').map(function (val) { return +val; }), y = _a[0], m = _a[1], d = _a[2]; date = new Date(y, m - 1, d); } else if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) { date = isoStringToDate(match); } else { date = new Date(value); } if (!isDate$1(date)) { throw invalidPipeArgumentError(DatePipe, value); } return formatDate(date, format, locale || this.locale, timezone); }; DatePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'date', pure: true },] }, ]; /** @nocollapse */ DatePipe.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, ]; }; return DatePipe; }()); /** * \@internal * @param {?} match * @return {?} */ function isoStringToDate(match) { var /** @type {?} */ date = new Date(0); var /** @type {?} */ tzHour = 0; var /** @type {?} */ tzMin = 0; // match[8] means that the string contains "Z" (UTC) or a timezone like "+01:00" or "+0100" var /** @type {?} */ dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear; var /** @type {?} */ timeSetter = match[8] ? date.setUTCHours : date.setHours; // if there is a timezone defined like "+01:00" or "+0100" if (match[9]) { tzHour = +(match[9] + match[10]); tzMin = +(match[9] + match[11]); } dateSetter.call(date, +(match[1]), +(match[2]) - 1, +(match[3])); var /** @type {?} */ h = +(match[4] || '0') - tzHour; var /** @type {?} */ m = +(match[5] || '0') - tzMin; var /** @type {?} */ s = +(match[6] || '0'); var /** @type {?} */ ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000); timeSetter.call(date, h, m, s, ms); return date; } /** * @param {?} value * @return {?} */ function isDate$1(value) { return value instanceof Date && !isNaN(value.valueOf()); } /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ var NumberFormatter = /** @class */ (function () { function NumberFormatter() { } /** * @param {?} num * @param {?} locale * @param {?} style * @param {?=} opts * @return {?} */ NumberFormatter.format = /** * @param {?} num * @param {?} locale * @param {?} style * @param {?=} opts * @return {?} */ function (num, locale, style, opts) { if (opts === void 0) { opts = {}; } var minimumIntegerDigits = opts.minimumIntegerDigits, minimumFractionDigits = opts.minimumFractionDigits, maximumFractionDigits = opts.maximumFractionDigits, currency = opts.currency, _a = opts.currencyAsSymbol, currencyAsSymbol = _a === void 0 ? false : _a; var /** @type {?} */ options = { minimumIntegerDigits: minimumIntegerDigits, minimumFractionDigits: minimumFractionDigits, maximumFractionDigits: maximumFractionDigits, style: NumberFormatStyle[style].toLowerCase() }; if (style == NumberFormatStyle.Currency) { options.currency = typeof currency == 'string' ? currency : undefined; options.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code'; } return new Intl.NumberFormat(locale, options).format(num); }; return NumberFormatter; }()); var DATE_FORMATS_SPLIT$1 = /((?:[^yMLdHhmsazZEwGjJ']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|J+|j+|m+|s+|a|z|Z|G+|w+))(.*)/; var PATTERN_ALIASES = { // Keys are quoted so they do not get renamed during closure compilation. 'yMMMdjms': datePartGetterFactory(combine([ digitCondition('year', 1), nameCondition('month', 3), digitCondition('day', 1), digitCondition('hour', 1), digitCondition('minute', 1), digitCondition('second', 1), ])), 'yMdjm': datePartGetterFactory(combine([ digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1), digitCondition('hour', 1), digitCondition('minute', 1) ])), 'yMMMMEEEEd': datePartGetterFactory(combine([ digitCondition('year', 1), nameCondition('month', 4), nameCondition('weekday', 4), digitCondition('day', 1) ])), 'yMMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 4), digitCondition('day', 1)])), 'yMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 3), digitCondition('day', 1)])), 'yMd': datePartGetterFactory(combine([digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1)])), 'jms': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('second', 1), digitCondition('minute', 1)])), 'jm': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('minute', 1)])) }; var DATE_FORMATS$1 = { // Keys are quoted so they do not get renamed. 'yyyy': datePartGetterFactory(digitCondition('year', 4)), 'yy': datePartGetterFactory(digitCondition('year', 2)), 'y': datePartGetterFactory(digitCondition('year', 1)), 'MMMM': datePartGetterFactory(nameCondition('month', 4)), 'MMM': datePartGetterFactory(nameCondition('month', 3)), 'MM': datePartGetterFactory(digitCondition('month', 2)), 'M': datePartGetterFactory(digitCondition('month', 1)), 'LLLL': datePartGetterFactory(nameCondition('month', 4)), 'L': datePartGetterFactory(nameCondition('month', 1)), 'dd': datePartGetterFactory(digitCondition('day', 2)), 'd': datePartGetterFactory(digitCondition('day', 1)), 'HH': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), false)))), 'H': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), false))), 'hh': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), true)))), 'h': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))), 'jj': datePartGetterFactory(digitCondition('hour', 2)), 'j': datePartGetterFactory(digitCondition('hour', 1)), 'mm': digitModifier(datePartGetterFactory(digitCondition('minute', 2))), 'm': datePartGetterFactory(digitCondition('minute', 1)), 'ss': digitModifier(datePartGetterFactory(digitCondition('second', 2))), 's': datePartGetterFactory(digitCondition('second', 1)), // while ISO 8601 requires fractions to be prefixed with `.` or `,` // we can be just safely rely on using `sss` since we currently don't support single or two digit // fractions 'sss': datePartGetterFactory(digitCondition('second', 3)), 'EEEE': datePartGetterFactory(nameCondition('weekday', 4)), 'EEE': datePartGetterFactory(nameCondition('weekday', 3)), 'EE': datePartGetterFactory(nameCondition('weekday', 2)), 'E': datePartGetterFactory(nameCondition('weekday', 1)), 'a': hourClockExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))), 'Z': timeZoneGetter$1('short'), 'z': timeZoneGetter$1('long'), 'ww': datePartGetterFactory({}), // Week of year, padded (00-53). Week 01 is the week with the // first Thursday of the year. not support ? 'w': datePartGetterFactory({}), // Week of year (0-53). Week 1 is the week with the first Thursday // of the year not support ? 'G': datePartGetterFactory(nameCondition('era', 1)), 'GG': datePartGetterFactory(nameCondition('era', 2)), 'GGG': datePartGetterFactory(nameCondition('era', 3)), 'GGGG': datePartGetterFactory(nameCondition('era', 4)) }; /** * @param {?} inner * @return {?} */ function digitModifier(inner) { return function (date, locale) { var /** @type {?} */ result = inner(date, locale); return result.length == 1 ? '0' + result : result; }; } /** * @param {?} inner * @return {?} */ function hourClockExtractor(inner) { return function (date, locale) { return inner(date, locale).split(' ')[1]; }; } /** * @param {?} inner * @return {?} */ function hourExtractor(inner) { return function (date, locale) { return inner(date, locale).split(' ')[0]; }; } /** * @param {?} date * @param {?} locale * @param {?} options * @return {?} */ function intlDateFormat(date, locale, options) { return new Intl.DateTimeFormat(locale, options).format(date).replace(/[\u200e\u200f]/g, ''); } /** * @param {?} timezone * @return {?} */ function timeZoneGetter$1(timezone) { // To workaround `Intl` API restriction for single timezone let format with 24 hours var /** @type {?} */ options = { hour: '2-digit', hour12: false, timeZoneName: timezone }; return function (date, locale) { var /** @type {?} */ result = intlDateFormat(date, locale, options); // Then extract first 3 letters that related to hours return result ? result.substring(3) : ''; }; } /** * @param {?} options * @param {?} value * @return {?} */ function hour12Modify(options, value) { options.hour12 = value; return options; } /** * @param {?} prop * @param {?} len * @return {?} */ function digitCondition(prop, len) { var /** @type {?} */ result = {}; result[prop] = len === 2 ? '2-digit' : 'numeric'; return result; } /** * @param {?} prop * @param {?} len * @return {?} */ function nameCondition(prop, len) { var /** @type {?} */ result = {}; if (len < 4) { result[prop] = len > 1 ? 'short' : 'narrow'; } else { result[prop] = 'long'; } return result; } /** * @param {?} options * @return {?} */ function combine(options) { return options.reduce(function (merged, opt) { return (Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __assign */])({}, merged, opt)); }, {}); } /** * @param {?} ret * @return {?} */ function datePartGetterFactory(ret) { return function (date, locale) { return intlDateFormat(date, locale, ret); }; } var DATE_FORMATTER_CACHE = new Map(); /** * @param {?} format * @param {?} date * @param {?} locale * @return {?} */ function dateFormatter(format, date, locale) { var /** @type {?} */ fn = PATTERN_ALIASES[format]; if (fn) return fn(date, locale); var /** @type {?} */ cacheKey = format; var /** @type {?} */ parts = DATE_FORMATTER_CACHE.get(cacheKey); if (!parts) { parts = []; var /** @type {?} */ match = void 0; DATE_FORMATS_SPLIT$1.exec(format); var /** @type {?} */ _format = format; while (_format) { match = DATE_FORMATS_SPLIT$1.exec(_format); if (match) { parts = parts.concat(match.slice(1)); _format = /** @type {?} */ ((parts.pop())); } else { parts.push(_format); _format = null; } } DATE_FORMATTER_CACHE.set(cacheKey, parts); } return parts.reduce(function (text, part) { var /** @type {?} */ fn = DATE_FORMATS$1[part]; return text + (fn ? fn(date, locale) : partToTime(part)); }, ''); } /** * @param {?} part * @return {?} */ function partToTime(part) { return part === '\'\'' ? '\'' : part.replace(/(^'|'$)/g, '').replace(/''/g, '\''); } var DateFormatter = /** @class */ (function () { function DateFormatter() { } /** * @param {?} date * @param {?} locale * @param {?} pattern * @return {?} */ DateFormatter.format = /** * @param {?} date * @param {?} locale * @param {?} pattern * @return {?} */ function (date, locale, pattern) { return dateFormatter(pattern, date, locale); }; return DateFormatter; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * \@ngModule CommonModule * \@whatItDoes Formats a date according to locale rules. * \@howToUse `date_expression | date[:format]` * \@description * * Where: * - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string * (https://www.w3.org/TR/NOTE-datetime). * - `format` indicates which date/time components to include. The format can be predefined as * shown below or custom as shown in the table. * - `'medium'`: equivalent to `'yMMMdjms'` (e.g. `Sep 3, 2010, 12:05:08 PM` for `en-US`) * - `'short'`: equivalent to `'yMdjm'` (e.g. `9/3/2010, 12:05 PM` for `en-US`) * - `'fullDate'`: equivalent to `'yMMMMEEEEd'` (e.g. `Friday, September 3, 2010` for `en-US`) * - `'longDate'`: equivalent to `'yMMMMd'` (e.g. `September 3, 2010` for `en-US`) * - `'mediumDate'`: equivalent to `'yMMMd'` (e.g. `Sep 3, 2010` for `en-US`) * - `'shortDate'`: equivalent to `'yMd'` (e.g. `9/3/2010` for `en-US`) * - `'mediumTime'`: equivalent to `'jms'` (e.g. `12:05:08 PM` for `en-US`) * - `'shortTime'`: equivalent to `'jm'` (e.g. `12:05 PM` for `en-US`) * * * | Component | Symbol | Narrow | Short Form | Long Form | Numeric | 2-digit | * |-----------|:------:|--------|--------------|-------------------|-----------|-----------| * | era | G | G (A) | GGG (AD) | GGGG (Anno Domini)| - | - | * | year | y | - | - | - | y (2015) | yy (15) | * | month | M | L (S) | MMM (Sep) | MMMM (September) | M (9) | MM (09) | * | day | d | - | - | - | d (3) | dd (03) | * | weekday | E | E (S) | EEE (Sun) | EEEE (Sunday) | - | - | * | hour | j | - | - | - | j (13) | jj (13) | * | hour12 | h | - | - | - | h (1 PM) | hh (01 PM)| * | hour24 | H | - | - | - | H (13) | HH (13) | * | minute | m | - | - | - | m (5) | mm (05) | * | second | s | - | - | - | s (9) | ss (09) | * | timezone | z | - | - | z (Pacific Standard Time)| - | - | * | timezone | Z | - | Z (GMT-8:00) | - | - | - | * | timezone | a | - | a (PM) | - | - | - | * * In javascript, only the components specified will be respected (not the ordering, * punctuations, ...) and details of the formatting will be dependent on the locale. * * Timezone of the formatted text will be the local system timezone of the end-user's machine. * * When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not * applied and the formatted text will have the same day, month and year of the expression. * * WARNINGS: * - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated. * Instead users should treat the date as an immutable object and change the reference when the * pipe needs to re-run (this is to avoid reformatting the date on every change detection run * which would be an expensive operation). * - this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera * browsers. * * ### Examples * * Assuming `dateObj` is (year: 2010, month: 9, day: 3, hour: 12 PM, minute: 05, second: 08) * in the _local_ time and locale is 'en-US': * * {\@example common/pipes/ts/date_pipe.ts region='DeprecatedDatePipe'} * * \@stable */ var DeprecatedDatePipe = /** @class */ (function () { function DeprecatedDatePipe(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} pattern * @return {?} */ DeprecatedDatePipe.prototype.transform = /** * @param {?} value * @param {?=} pattern * @return {?} */ function (value, pattern) { if (pattern === void 0) { pattern = 'mediumDate'; } if (value == null || value === '' || value !== value) return null; var /** @type {?} */ date; if (typeof value === 'string') { value = value.trim(); } if (isDate(value)) { date = value; } else if (!isNaN(value - parseFloat(value))) { date = new Date(parseFloat(value)); } else if (typeof value === 'string' && /^(\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 _a = value.split('-').map(function (val) { return parseInt(val, 10); }), y = _a[0], m = _a[1], d = _a[2]; date = new Date(y, m - 1, d); } else { date = new Date(value); } if (!isDate(date)) { var /** @type {?} */ match = void 0; if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) { date = isoStringToDate(match); } else { throw invalidPipeArgumentError(DeprecatedDatePipe, value); } } return DateFormatter.format(date, this._locale, DeprecatedDatePipe._ALIASES[pattern] || pattern); }; /** * \@internal */ DeprecatedDatePipe._ALIASES = { 'medium': 'yMMMdjms', 'short': 'yMdjm', 'fullDate': 'yMMMMEEEEd', 'longDate': 'yMMMMd', 'mediumDate': 'yMMMd', 'shortDate': 'yMd', 'mediumTime': 'jms', 'shortTime': 'jm' }; DeprecatedDatePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'date', pure: true },] }, ]; /** @nocollapse */ DeprecatedDatePipe.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, ]; }; return DeprecatedDatePipe; }()); /** * @param {?} value * @return {?} */ function isDate(value) { return value instanceof Date && !isNaN(value.valueOf()); } /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ var NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/; var MAX_DIGITS = 22; var DECIMAL_SEP = '.'; var ZERO_CHAR = '0'; var PATTERN_SEP = ';'; var GROUP_SEP = ','; var DIGIT_CHAR = '#'; var CURRENCY_CHAR = '¤'; var PERCENT_CHAR = '%'; /** * Transform a number to a locale string based on a style and a format * * \@internal * @param {?} value * @param {?} locale * @param {?} style * @param {?=} digitsInfo * @param {?=} currency * @return {?} */ function formatNumber$1(value, locale, style, digitsInfo, currency) { if (currency === void 0) { currency = null; } var /** @type {?} */ res = { str: null }; var /** @type {?} */ format = getLocaleNumberFormat(locale, style); var /** @type {?} */ num; // Convert strings to numbers if (typeof value === 'string' && !isNaN(+value - parseFloat(value))) { num = +value; } else if (typeof value !== 'number') { res.error = value + " is not a number"; return res; } else { num = value; } var /** @type {?} */ pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign)); var /** @type {?} */ formattedText = ''; var /** @type {?} */ isZero = false; if (!isFinite(num)) { formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity); } else { var /** @type {?} */ parsedNumber = parseNumber(num); if (style === NumberFormatStyle.Percent) { parsedNumber = toPercent(parsedNumber); } var /** @type {?} */ minInt = pattern.minInt; var /** @type {?} */ minFraction = pattern.minFrac; var /** @type {?} */ maxFraction = pattern.maxFrac; if (digitsInfo) { var /** @type {?} */ parts = digitsInfo.match(NUMBER_FORMAT_REGEXP); if (parts === null) { res.error = digitsInfo + " is not a valid digit info"; return res; } var /** @type {?} */ minIntPart = parts[1]; var /** @type {?} */ minFractionPart = parts[3]; var /** @type {?} */ 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); var /** @type {?} */ digits = parsedNumber.digits; var /** @type {?} */ integerLen = parsedNumber.integerLen; var /** @type {?} */ exponent = parsedNumber.exponent; var /** @type {?} */ decimals = []; isZero = digits.every(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 var /** @type {?} */ 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('')); } var /** @type {?} */ groupSymbol = currency ? NumberSymbol.CurrencyGroup : NumberSymbol.Group; formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol)); // append the decimal digits if (decimals.length) { var /** @type {?} */ decimalSymbol = currency ? NumberSymbol.CurrencyDecimal : NumberSymbol.Decimal; formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join(''); } if (exponent) { formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + '+' + exponent; } } if (num < 0 && !isZero) { formattedText = pattern.negPre + formattedText + pattern.negSuf; } else { formattedText = pattern.posPre + formattedText + pattern.posSuf; } if (style === NumberFormatStyle.Currency && currency !== null) { res.str = formattedText .replace(CURRENCY_CHAR, currency) .replace(CURRENCY_CHAR, ''); return res; } if (style === NumberFormatStyle.Percent) { res.str = formattedText.replace(new RegExp(PERCENT_CHAR, 'g'), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign)); return res; } res.str = formattedText; return res; } /** * @param {?} format * @param {?=} minusSign * @return {?} */ function parseNumberFormat(format, minusSign) { if (minusSign === void 0) { minusSign = '-'; } var /** @type {?} */ p = { minInt: 1, minFrac: 0, maxFrac: 0, posPre: '', posSuf: '', negPre: '', negSuf: '', gSize: 0, lgSize: 0 }; var /** @type {?} */ patternParts = format.split(PATTERN_SEP); var /** @type {?} */ positive = patternParts[0]; var /** @type {?} */ negative = patternParts[1]; var /** @type {?} */ 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 {?} */ integer = positiveParts[0], /** @type {?} */ fraction = positiveParts[1] || ''; p.posPre = integer.substr(0, integer.indexOf(DIGIT_CHAR)); for (var /** @type {?} */ i = 0; i < fraction.length; i++) { var /** @type {?} */ 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; } } var /** @type {?} */ 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) { var /** @type {?} */ trunkLen = positive.length - p.posPre.length - p.posSuf.length, /** @type {?} */ 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; } /** * @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 var /** @type {?} */ 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) { var /** @type {?} */ numStr = Math.abs(num) + ''; var /** @type {?} */ exponent = 0, /** @type {?} */ digits, /** @type {?} */ integerLen; var /** @type {?} */ i, /** @type {?} */ j, /** @type {?} */ 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] = +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 (" + minFrac + ") is higher than the maximum (" + maxFrac + ")."); } var /** @type {?} */ digits = parsedNumber.digits; var /** @type {?} */ fractionLen = digits.length - parsedNumber.integerLen; var /** @type {?} */ fractionSize = Math.min(Math.max(minFrac, fractionLen), maxFrac); // The index of the digit to where rounding is to occur var /** @type {?} */ roundAt = fractionSize + parsedNumber.integerLen; var /** @type {?} */ 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 /** @type {?} */ 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 /** @type {?} */ i = 1; i < roundAt; i++) digits[i] = 0; } if (digit >= 5) { if (roundAt - 1 < 0) { for (var /** @type {?} */ 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); var /** @type {?} */ 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 var /** @type {?} */ minLen = minFrac + parsedNumber.integerLen; // Do any carrying, e.g. a digit was rounded up to 10 var /** @type {?} */ carry = digits.reduceRight(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++; } } /** * \@internal * @param {?} text * @return {?} */ function parseIntAutoRadix(text) { var /** @type {?} */ result = parseInt(text); if (isNaN(result)) { throw new Error('Invalid integer literal when parsing ' + text); } return result; } /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 {?} pipe * @param {?} locale * @param {?} value * @param {?} style * @param {?=} digits * @param {?=} currency * @param {?=} currencyAsSymbol * @return {?} */ function formatNumber(pipe, locale, value, style, digits, currency, currencyAsSymbol) { if (currency === void 0) { currency = null; } if (currencyAsSymbol === void 0) { currencyAsSymbol = false; } if (value == null) return null; // Convert strings to numbers value = typeof value === 'string' && !isNaN(+value - parseFloat(value)) ? +value : value; if (typeof value !== 'number') { throw invalidPipeArgumentError(pipe, value); } var /** @type {?} */ minInt; var /** @type {?} */ minFraction; var /** @type {?} */ maxFraction; if (style !== NumberFormatStyle.Currency) { // rely on Intl default for currency minInt = 1; minFraction = 0; maxFraction = 3; } if (digits) { var /** @type {?} */ parts = digits.match(NUMBER_FORMAT_REGEXP); if (parts === null) { throw new Error(digits + " is not a valid digit info for number pipes"); } if (parts[1] != null) { // min integer digits minInt = parseIntAutoRadix(parts[1]); } if (parts[3] != null) { // min fraction digits minFraction = parseIntAutoRadix(parts[3]); } if (parts[5] != null) { // max fraction digits maxFraction = parseIntAutoRadix(parts[5]); } } return NumberFormatter.format(/** @type {?} */ (value), locale, style, { minimumIntegerDigits: minInt, minimumFractionDigits: minFraction, maximumFractionDigits: maxFraction, currency: currency, currencyAsSymbol: currencyAsSymbol, }); } /** * \@ngModule CommonModule * \@whatItDoes Formats a number according to locale rules. * \@howToUse `number_expression | number[:digitInfo]` * * Formats a number as text. Group sizing and separator and other locale-specific * configurations are based on the active locale. * * where `expression` is a number: * - `digitInfo` is a `string` which has a following format:
    * {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits} * - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`. * - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`. * - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`. * * For more information on the acceptable range for each of these numbers and other * details see your native internationalization library. * * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers * and may require a polyfill. See [Browser Support](guide/browser-support) for details. * * ### Example * * {\@example common/pipes/ts/number_pipe.ts region='DeprecatedNumberPipe'} * * \@stable */ var DeprecatedDecimalPipe = /** @class */ (function () { function DeprecatedDecimalPipe(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} digits * @return {?} */ DeprecatedDecimalPipe.prototype.transform = /** * @param {?} value * @param {?=} digits * @return {?} */ function (value, digits) { return formatNumber(DeprecatedDecimalPipe, this._locale, value, NumberFormatStyle.Decimal, digits); }; DeprecatedDecimalPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'number' },] }, ]; /** @nocollapse */ DeprecatedDecimalPipe.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, ]; }; return DeprecatedDecimalPipe; }()); /** * \@ngModule CommonModule * \@whatItDoes Formats a number as a percentage according to locale rules. * \@howToUse `number_expression | percent[:digitInfo]` * * \@description * * Formats a number as percentage. * * - `digitInfo` See {\@link DecimalPipe} for detailed description. * * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers * and may require a polyfill. See [Browser Support](guide/browser-support) for details. * * ### Example * * {\@example common/pipes/ts/percent_pipe.ts region='DeprecatedPercentPipe'} * * \@stable */ var DeprecatedPercentPipe = /** @class */ (function () { function DeprecatedPercentPipe(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} digits * @return {?} */ DeprecatedPercentPipe.prototype.transform = /** * @param {?} value * @param {?=} digits * @return {?} */ function (value, digits) { return formatNumber(DeprecatedPercentPipe, this._locale, value, NumberFormatStyle.Percent, digits); }; DeprecatedPercentPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'percent' },] }, ]; /** @nocollapse */ DeprecatedPercentPipe.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, ]; }; return DeprecatedPercentPipe; }()); /** * \@ngModule CommonModule * \@whatItDoes Formats a number as currency using locale rules. * \@howToUse `number_expression | currency[:currencyCode[:symbolDisplay[:digitInfo]]]` * \@description * * Use `currency` to format a number as currency. * * - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such * as `USD` for the US dollar and `EUR` for the euro. * - `symbolDisplay` is a boolean indicating whether to use the currency symbol or code. * - `true`: use symbol (e.g. `$`). * - `false`(default): use code (e.g. `USD`). * - `digitInfo` See {\@link DecimalPipe} for detailed description. * * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers * and may require a polyfill. See [Browser Support](guide/browser-support) for details. * * ### Example * * {\@example common/pipes/ts/currency_pipe.ts region='DeprecatedCurrencyPipe'} * * \@stable */ var DeprecatedCurrencyPipe = /** @class */ (function () { function DeprecatedCurrencyPipe(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} currencyCode * @param {?=} symbolDisplay * @param {?=} digits * @return {?} */ DeprecatedCurrencyPipe.prototype.transform = /** * @param {?} value * @param {?=} currencyCode * @param {?=} symbolDisplay * @param {?=} digits * @return {?} */ function (value, currencyCode, symbolDisplay, digits) { if (currencyCode === void 0) { currencyCode = 'USD'; } if (symbolDisplay === void 0) { symbolDisplay = false; } return formatNumber(DeprecatedCurrencyPipe, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay); }; DeprecatedCurrencyPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'currency' },] }, ]; /** @nocollapse */ DeprecatedCurrencyPipe.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, ]; }; return DeprecatedCurrencyPipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 collection of deprecated i18n pipes that require intl api * * @deprecated from v5 */ var COMMON_DEPRECATED_I18N_PIPES = [DeprecatedDecimalPipe, DeprecatedPercentPipe, DeprecatedCurrencyPipe, DeprecatedDatePipe]; /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ var ObservableStrategy = /** @class */ (function () { function ObservableStrategy() { } /** * @param {?} async * @param {?} updateLatestValue * @return {?} */ ObservableStrategy.prototype.createSubscription = /** * @param {?} async * @param {?} updateLatestValue * @return {?} */ function (async, updateLatestValue) { return async.subscribe({ next: updateLatestValue, error: function (e) { throw e; } }); }; /** * @param {?} subscription * @return {?} */ ObservableStrategy.prototype.dispose = /** * @param {?} subscription * @return {?} */ function (subscription) { subscription.unsubscribe(); }; /** * @param {?} subscription * @return {?} */ ObservableStrategy.prototype.onDestroy = /** * @param {?} subscription * @return {?} */ function (subscription) { subscription.unsubscribe(); }; return ObservableStrategy; }()); var PromiseStrategy = /** @class */ (function () { function PromiseStrategy() { } /** * @param {?} async * @param {?} updateLatestValue * @return {?} */ PromiseStrategy.prototype.createSubscription = /** * @param {?} async * @param {?} updateLatestValue * @return {?} */ function (async, updateLatestValue) { return async.then(updateLatestValue, function (e) { throw e; }); }; /** * @param {?} subscription * @return {?} */ PromiseStrategy.prototype.dispose = /** * @param {?} subscription * @return {?} */ function (subscription) { }; /** * @param {?} subscription * @return {?} */ PromiseStrategy.prototype.onDestroy = /** * @param {?} subscription * @return {?} */ function (subscription) { }; return PromiseStrategy; }()); var _promiseStrategy = new PromiseStrategy(); var _observableStrategy = new ObservableStrategy(); /** * \@ngModule CommonModule * \@whatItDoes Unwraps a value from an asynchronous primitive. * \@howToUse `observable_or_promise_expression | async` * \@description * The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has * emitted. When a new value is emitted, the `async` pipe marks the component to be checked for * changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid * potential memory leaks. * * * ## Examples * * This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the * promise. * * {\@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'} * * It's also possible to use `async` with Observables. The example below binds the `time` Observable * to the view. The Observable continuously updates the view with the current time. * * {\@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'} * * \@stable */ var AsyncPipe = /** @class */ (function () { function AsyncPipe(_ref) { this._ref = _ref; this._latestValue = null; this._latestReturnedValue = null; this._subscription = null; this._obj = null; this._strategy = /** @type {?} */ ((null)); } /** * @return {?} */ AsyncPipe.prototype.ngOnDestroy = /** * @return {?} */ function () { if (this._subscription) { this._dispose(); } }; /** * @param {?} obj * @return {?} */ AsyncPipe.prototype.transform = /** * @param {?} obj * @return {?} */ function (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 (this._latestValue === this._latestReturnedValue) { return this._latestReturnedValue; } this._latestReturnedValue = this._latestValue; return __WEBPACK_IMPORTED_MODULE_0__angular_core__["WrappedValue"].wrap(this._latestValue); }; /** * @param {?} obj * @return {?} */ AsyncPipe.prototype._subscribe = /** * @param {?} obj * @return {?} */ function (obj) { var _this = this; this._obj = obj; this._strategy = this._selectStrategy(obj); this._subscription = this._strategy.createSubscription(obj, function (value) { return _this._updateLatestValue(obj, value); }); }; /** * @param {?} obj * @return {?} */ AsyncPipe.prototype._selectStrategy = /** * @param {?} obj * @return {?} */ function (obj) { if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵisPromise"])(obj)) { return _promiseStrategy; } if (Object(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵisObservable"])(obj)) { return _observableStrategy; } throw invalidPipeArgumentError(AsyncPipe, obj); }; /** * @return {?} */ AsyncPipe.prototype._dispose = /** * @return {?} */ function () { this._strategy.dispose(/** @type {?} */ ((this._subscription))); this._latestValue = null; this._latestReturnedValue = null; this._subscription = null; this._obj = null; }; /** * @param {?} async * @param {?} value * @return {?} */ AsyncPipe.prototype._updateLatestValue = /** * @param {?} async * @param {?} value * @return {?} */ function (async, value) { if (async === this._obj) { this._latestValue = value; this._ref.markForCheck(); } }; AsyncPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'async', pure: false },] }, ]; /** @nocollapse */ AsyncPipe.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectorRef"], }, ]; }; return AsyncPipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 text to lowercase. * * {\@example common/pipes/ts/lowerupper_pipe.ts region='LowerUpperPipe' } * * \@stable */ var LowerCasePipe = /** @class */ (function () { function LowerCasePipe() { } /** * @param {?} value * @return {?} */ LowerCasePipe.prototype.transform = /** * @param {?} value * @return {?} */ function (value) { if (!value) return value; if (typeof value !== 'string') { throw invalidPipeArgumentError(LowerCasePipe, value); } return value.toLowerCase(); }; LowerCasePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'lowercase' },] }, ]; /** @nocollapse */ LowerCasePipe.ctorParameters = function () { return []; }; return LowerCasePipe; }()); /** * Helper method to transform a single word to titlecase. * * \@stable * @param {?} word * @return {?} */ function titleCaseWord(word) { if (!word) return word; return word[0].toUpperCase() + word.substr(1).toLowerCase(); } /** * Transforms text to titlecase. * * \@stable */ var TitleCasePipe = /** @class */ (function () { function TitleCasePipe() { } /** * @param {?} value * @return {?} */ TitleCasePipe.prototype.transform = /** * @param {?} value * @return {?} */ function (value) { if (!value) return value; if (typeof value !== 'string') { throw invalidPipeArgumentError(TitleCasePipe, value); } return value.split(/\b/g).map(function (word) { return titleCaseWord(word); }).join(''); }; TitleCasePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'titlecase' },] }, ]; /** @nocollapse */ TitleCasePipe.ctorParameters = function () { return []; }; return TitleCasePipe; }()); /** * Transforms text to uppercase. * * \@stable */ var UpperCasePipe = /** @class */ (function () { function UpperCasePipe() { } /** * @param {?} value * @return {?} */ UpperCasePipe.prototype.transform = /** * @param {?} value * @return {?} */ function (value) { if (!value) return value; if (typeof value !== 'string') { throw invalidPipeArgumentError(UpperCasePipe, value); } return value.toUpperCase(); }; UpperCasePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'uppercase' },] }, ]; /** @nocollapse */ UpperCasePipe.ctorParameters = function () { return []; }; return UpperCasePipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ var _INTERPOLATION_REGEXP = /#/g; /** * \@ngModule CommonModule * \@whatItDoes Maps a value to a string that pluralizes the value according to locale rules. * \@howToUse `expression | i18nPlural:mapping[:locale]` * \@description * * Where: * - `expression` is a number. * - `mapping` is an object that mimics the ICU format, see * http://userguide.icu-project.org/formatparse/messages * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by * default) * * ## Example * * {\@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'} * * \@experimental */ var I18nPluralPipe = /** @class */ (function () { function I18nPluralPipe(_localization) { this._localization = _localization; } /** * @param {?} value * @param {?} pluralMap * @param {?=} locale * @return {?} */ I18nPluralPipe.prototype.transform = /** * @param {?} value * @param {?} pluralMap * @param {?=} locale * @return {?} */ function (value, pluralMap, locale) { if (value == null) return ''; if (typeof pluralMap !== 'object' || pluralMap === null) { throw invalidPipeArgumentError(I18nPluralPipe, pluralMap); } var /** @type {?} */ key = getPluralCategory(value, Object.keys(pluralMap), this._localization, locale); return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString()); }; I18nPluralPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'i18nPlural', pure: true },] }, ]; /** @nocollapse */ I18nPluralPipe.ctorParameters = function () { return [ { type: NgLocalization, }, ]; }; return I18nPluralPipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * \@ngModule CommonModule * \@whatItDoes Generic selector that displays the string that matches the current value. * \@howToUse `expression | i18nSelect:mapping` * \@description * * Where `mapping` is an object that indicates the text that should be displayed * for different values of the provided `expression`. * If none of the keys of the mapping match the value of the `expression`, then the content * of the `other` key is returned when present, otherwise an empty string is returned. * * ## Example * * {\@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'} * * \@experimental */ var I18nSelectPipe = /** @class */ (function () { function I18nSelectPipe() { } /** * @param {?} value * @param {?} mapping * @return {?} */ I18nSelectPipe.prototype.transform = /** * @param {?} value * @param {?} mapping * @return {?} */ function (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 ''; }; I18nSelectPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'i18nSelect', pure: true },] }, ]; /** @nocollapse */ I18nSelectPipe.ctorParameters = function () { return []; }; return I18nSelectPipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * \@ngModule CommonModule * \@whatItDoes Converts value into JSON string. * \@howToUse `expression | json` * \@description * * Converts value into string using `JSON.stringify`. Useful for debugging. * * ### Example * {\@example common/pipes/ts/json_pipe.ts region='JsonPipe'} * * \@stable */ var JsonPipe = /** @class */ (function () { function JsonPipe() { } /** * @param {?} value * @return {?} */ JsonPipe.prototype.transform = /** * @param {?} value * @return {?} */ function (value) { return JSON.stringify(value, null, 2); }; JsonPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'json', pure: false },] }, ]; /** @nocollapse */ JsonPipe.ctorParameters = function () { return []; }; return JsonPipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * \@ngModule CommonModule * \@whatItDoes Formats a number according to locale rules. * \@howToUse `number_expression | number[:digitInfo[:locale]]` * * Formats a number as text. Group sizing and separator and other locale-specific * configurations are based on the active locale. * * where `expression` is a number: * - `digitInfo` is a `string` which has a following format:
    * {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits} * - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`. * - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`. * - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by * default) * * For more information on the acceptable range for each of these numbers and other * details see your native internationalization library. * * ### Example * * {\@example common/pipes/ts/number_pipe.ts region='NumberPipe'} * * \@stable */ var DecimalPipe = /** @class */ (function () { function DecimalPipe(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} digits * @param {?=} locale * @return {?} */ DecimalPipe.prototype.transform = /** * @param {?} value * @param {?=} digits * @param {?=} locale * @return {?} */ function (value, digits, locale) { if (isEmpty(value)) return null; locale = locale || this._locale; var _a = formatNumber$1(value, locale, NumberFormatStyle.Decimal, digits), str = _a.str, error = _a.error; if (error) { throw invalidPipeArgumentError(DecimalPipe, error); } return str; }; DecimalPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'number' },] }, ]; /** @nocollapse */ DecimalPipe.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, ]; }; return DecimalPipe; }()); /** * \@ngModule CommonModule * \@whatItDoes Formats a number as a percentage according to locale rules. * \@howToUse `number_expression | percent[:digitInfo[:locale]]` * * \@description * * Formats a number as percentage. * * - `digitInfo` See {\@link DecimalPipe} for detailed description. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by * default) * * ### Example * * {\@example common/pipes/ts/percent_pipe.ts region='PercentPipe'} * * \@stable */ var PercentPipe = /** @class */ (function () { function PercentPipe(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} digits * @param {?=} locale * @return {?} */ PercentPipe.prototype.transform = /** * @param {?} value * @param {?=} digits * @param {?=} locale * @return {?} */ function (value, digits, locale) { if (isEmpty(value)) return null; locale = locale || this._locale; var _a = formatNumber$1(value, locale, NumberFormatStyle.Percent, digits), str = _a.str, error = _a.error; if (error) { throw invalidPipeArgumentError(PercentPipe, error); } return str; }; PercentPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'percent' },] }, ]; /** @nocollapse */ PercentPipe.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, ]; }; return PercentPipe; }()); /** * \@ngModule CommonModule * \@whatItDoes Formats a number as currency using locale rules. * \@howToUse `number_expression | currency[:currencyCode[:display[:digitInfo[:locale]]]]` * \@description * * Use `currency` to format a number as currency. * * - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such * as `USD` for the US dollar and `EUR` for the euro. * - `display` indicates whether to show the currency symbol or the code. * - `code`: use code (e.g. `USD`). * - `symbol`(default): use symbol (e.g. `$`). * - `symbol-narrow`: some countries have two symbols for their currency, one regular and one * narrow (e.g. the canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`). * - boolean (deprecated from v5): `true` for symbol and false for `code` * If there is no narrow symbol for the chosen currency, the regular symbol will be used. * - `digitInfo` See {\@link DecimalPipe} for detailed description. * - `locale` is a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by * default) * * ### Example * * {\@example common/pipes/ts/currency_pipe.ts region='CurrencyPipe'} * * \@stable */ var CurrencyPipe = /** @class */ (function () { function CurrencyPipe(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} currencyCode * @param {?=} display * @param {?=} digits * @param {?=} locale * @return {?} */ CurrencyPipe.prototype.transform = /** * @param {?} value * @param {?=} currencyCode * @param {?=} display * @param {?=} digits * @param {?=} locale * @return {?} */ function (value, currencyCode, display, digits, locale) { if (display === void 0) { display = 'symbol'; } 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'; } var /** @type {?} */ currency = currencyCode || 'USD'; if (display !== 'code') { currency = getCurrencySymbol(currency, display === 'symbol' ? 'wide' : 'narrow'); } var _a = formatNumber$1(value, locale, NumberFormatStyle.Currency, digits, currency), str = _a.str, error = _a.error; if (error) { throw invalidPipeArgumentError(CurrencyPipe, error); } return str; }; CurrencyPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'currency' },] }, ]; /** @nocollapse */ CurrencyPipe.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, ]; }; return CurrencyPipe; }()); /** * @param {?} value * @return {?} */ function isEmpty(value) { return value == null || value === '' || value !== value; } /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * \@ngModule CommonModule * \@whatItDoes Creates a new List or String containing a subset (slice) of the elements. * \@howToUse `array_or_string_expression | slice:start[:end]` * \@description * * Where the input expression is a `List` or `String`, and: * - `start`: The starting index of the subset to return. * - **a positive integer**: return the item at `start` index and all items after * in the list or string expression. * - **a negative integer**: return the item at `start` index from the end and all items after * in the list or string expression. * - **if positive and greater than the size of the expression**: return an empty list or string. * - **if negative and greater than the size of the expression**: return entire list or string. * - `end`: The ending index of the subset to return. * - **omitted**: return all items until the end. * - **if positive**: return all items before `end` index of the list or string. * - **if negative**: return all items before `end` index from the end of the list or string. * * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()` * and `String.prototype.slice()`. * * When operating on a [List], the returned list is always a copy even when all * the elements are being returned. * * When operating on a blank value, the pipe returns the blank value. * * ## List Example * * This `ngFor` example: * * {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'} * * produces the following: * *
  • b
  • *
  • c
  • * * ## String Examples * * {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'} * * \@stable */ var SlicePipe = /** @class */ (function () { function SlicePipe() { } /** * @param {?} value * @param {?} start * @param {?=} end * @return {?} */ SlicePipe.prototype.transform = /** * @param {?} value * @param {?} start * @param {?=} end * @return {?} */ function (value, start, end) { if (value == null) return value; if (!this.supports(value)) { throw invalidPipeArgumentError(SlicePipe, value); } return value.slice(start, end); }; /** * @param {?} obj * @return {?} */ SlicePipe.prototype.supports = /** * @param {?} obj * @return {?} */ function (obj) { return typeof obj === 'string' || Array.isArray(obj); }; SlicePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'slice', pure: false },] }, ]; /** @nocollapse */ SlicePipe.ctorParameters = function () { return []; }; return SlicePipe; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 collection of Angular pipes that are likely to be used in each and every application. */ var COMMON_PIPES = [ AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, ]; /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * The module that includes all the basic Angular directives like {\@link NgIf}, {\@link NgForOf}, ... * * \@stable */ var CommonModule = /** @class */ (function () { function CommonModule() { } CommonModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [COMMON_DIRECTIVES, COMMON_PIPES], exports: [COMMON_DIRECTIVES, COMMON_PIPES], providers: [ { provide: NgLocalization, useClass: NgLocaleLocalization }, ], },] }, ]; /** @nocollapse */ CommonModule.ctorParameters = function () { return []; }; return CommonModule; }()); var ɵ0 = getPluralCase; /** * A module that contains the deprecated i18n pipes. * * @deprecated from v5 */ var DeprecatedI18NPipesModule = /** @class */ (function () { function DeprecatedI18NPipesModule() { } DeprecatedI18NPipesModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ declarations: [COMMON_DEPRECATED_I18N_PIPES], exports: [COMMON_DEPRECATED_I18N_PIPES], providers: [{ provide: DEPRECATED_PLURAL_FN, useValue: ɵ0 }], },] }, ]; /** @nocollapse */ DeprecatedI18NPipesModule.ctorParameters = function () { return []; }; return DeprecatedI18NPipesModule; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 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 into a Web Worker). * * \@stable */ var DOCUMENT = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('DocumentToken'); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ var PLATFORM_BROWSER_ID = 'browser'; var PLATFORM_SERVER_ID = 'server'; var PLATFORM_WORKER_APP_ID = 'browserWorkerApp'; var PLATFORM_WORKER_UI_ID = 'browserWorkerUi'; /** * Returns whether a platform id represents a browser platform. * \@experimental * @param {?} platformId * @return {?} */ function isPlatformBrowser(platformId) { return platformId === PLATFORM_BROWSER_ID; } /** * Returns whether a platform id represents a server platform. * \@experimental * @param {?} platformId * @return {?} */ function isPlatformServer(platformId) { return platformId === PLATFORM_SERVER_ID; } /** * Returns whether a platform id represents a web worker app platform. * \@experimental * @param {?} platformId * @return {?} */ function isPlatformWorkerApp(platformId) { return platformId === PLATFORM_WORKER_APP_ID; } /** * Returns whether a platform id represents a web worker UI platform. * \@experimental * @param {?} platformId * @return {?} */ function isPlatformWorkerUi(platformId) { return platformId === PLATFORM_WORKER_UI_ID; } /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * \@stable */ var VERSION = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["Version"]('5.2.2'); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * @module * @description * Entry point for all public APIs of the common package. */ /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * @module * @description * Entry point for all public APIs of this package. */ // This file only reexports content of the `src` folder. Keep it that way. /** * @fileoverview added by tsickle * @suppress {checkTypes} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=common.js.map /***/ }), /***/ "./node_modules/@angular/common/esm5/http.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export HttpBackend */ /* unused harmony export HttpHandler */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return HttpClient; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return HttpHeaders; }); /* unused harmony export HTTP_INTERCEPTORS */ /* unused harmony export JsonpClientBackend */ /* unused harmony export JsonpInterceptor */ /* unused harmony export HttpClientJsonpModule */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return HttpClientModule; }); /* unused harmony export HttpClientXsrfModule */ /* unused harmony export ɵinterceptingHandler */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return HttpParams; }); /* unused harmony export HttpUrlEncodingCodec */ /* unused harmony export HttpRequest */ /* unused harmony export HttpErrorResponse */ /* unused harmony export HttpEventType */ /* unused harmony export HttpHeaderResponse */ /* unused harmony export HttpResponse */ /* unused harmony export HttpResponseBase */ /* unused harmony export HttpXhrBackend */ /* unused harmony export XhrFactory */ /* unused harmony export HttpXsrfTokenExtractor */ /* unused harmony export ɵa */ /* unused harmony export ɵb */ /* unused harmony export ɵc */ /* unused harmony export ɵd */ /* unused harmony export ɵg */ /* unused harmony export ɵh */ /* unused harmony export ɵe */ /* unused harmony export ɵf */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/esm5/core.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_observable_of__ = __webpack_require__("./node_modules/rxjs/_esm5/observable/of.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_operator_concatMap__ = __webpack_require__("./node_modules/rxjs/_esm5/operator/concatMap.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_filter__ = __webpack_require__("./node_modules/rxjs/_esm5/operator/filter.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__ = __webpack_require__("./node_modules/rxjs/_esm5/operator/map.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_tslib__ = __webpack_require__("./node_modules/tslib/tslib.es6.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__angular_common__ = __webpack_require__("./node_modules/@angular/common/esm5/common.js"); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_rxjs_Observable__ = __webpack_require__("./node_modules/rxjs/_esm5/Observable.js"); /** * @license Angular v5.2.2 * (c) 2010-2018 Google, Inc. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes} 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. * * \@stable * @abstract */ var HttpHandler = /** @class */ (function () { function HttpHandler() { } return HttpHandler; }()); /** * 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. * * \@stable * @abstract */ var HttpBackend = /** @class */ (function () { function HttpBackend() { } return HttpBackend; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * Immutable set of Http headers, with lazy parsing. * \@stable */ var HttpHeaders = /** @class */ (function () { function HttpHeaders(headers) { var _this = this; /** * 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 = function () { _this.headers = new Map(); headers.split('\n').forEach(function (line) { var /** @type {?} */ index = line.indexOf(':'); if (index > 0) { var /** @type {?} */ name_1 = line.slice(0, index); var /** @type {?} */ key = name_1.toLowerCase(); var /** @type {?} */ value = line.slice(index + 1).trim(); _this.maybeSetNormalizedName(name_1, key); if (_this.headers.has(key)) { /** @type {?} */ ((_this.headers.get(key))).push(value); } else { _this.headers.set(key, [value]); } } }); }; } else { this.lazyInit = function () { _this.headers = new Map(); Object.keys(headers).forEach(function (name) { var /** @type {?} */ values = headers[name]; var /** @type {?} */ key = name.toLowerCase(); if (typeof values === 'string') { values = [values]; } if (values.length > 0) { _this.headers.set(key, values); _this.maybeSetNormalizedName(name, key); } }); }; } } /** * Checks for existence of header by given name. */ /** * Checks for existence of header by given name. * @param {?} name * @return {?} */ HttpHeaders.prototype.has = /** * Checks for existence of header by given name. * @param {?} name * @return {?} */ function (name) { this.init(); return this.headers.has(name.toLowerCase()); }; /** * Returns first header that matches given name. */ /** * Returns first header that matches given name. * @param {?} name * @return {?} */ HttpHeaders.prototype.get = /** * Returns first header that matches given name. * @param {?} name * @return {?} */ function (name) { this.init(); var /** @type {?} */ values = this.headers.get(name.toLowerCase()); return values && values.length > 0 ? values[0] : null; }; /** * Returns the names of the headers */ /** * Returns the names of the headers * @return {?} */ HttpHeaders.prototype.keys = /** * Returns the names of the headers * @return {?} */ function () { this.init(); return Array.from(this.normalizedNames.values()); }; /** * Returns list of header values for a given name. */ /** * Returns list of header values for a given name. * @param {?} name * @return {?} */ HttpHeaders.prototype.getAll = /** * Returns list of header values for a given name. * @param {?} name * @return {?} */ function (name) { this.init(); return this.headers.get(name.toLowerCase()) || null; }; /** * @param {?} name * @param {?} value * @return {?} */ HttpHeaders.prototype.append = /** * @param {?} name * @param {?} value * @return {?} */ function (name, value) { return this.clone({ name: name, value: value, op: 'a' }); }; /** * @param {?} name * @param {?} value * @return {?} */ HttpHeaders.prototype.set = /** * @param {?} name * @param {?} value * @return {?} */ function (name, value) { return this.clone({ name: name, value: value, op: 's' }); }; /** * @param {?} name * @param {?=} value * @return {?} */ HttpHeaders.prototype.delete = /** * @param {?} name * @param {?=} value * @return {?} */ function (name, value) { return this.clone({ name: name, value: value, op: 'd' }); }; /** * @param {?} name * @param {?} lcName * @return {?} */ HttpHeaders.prototype.maybeSetNormalizedName = /** * @param {?} name * @param {?} lcName * @return {?} */ function (name, lcName) { if (!this.normalizedNames.has(lcName)) { this.normalizedNames.set(lcName, name); } }; /** * @return {?} */ HttpHeaders.prototype.init = /** * @return {?} */ function () { var _this = 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(function (update) { return _this.applyUpdate(update); }); this.lazyUpdate = null; } } }; /** * @param {?} other * @return {?} */ HttpHeaders.prototype.copyFrom = /** * @param {?} other * @return {?} */ function (other) { var _this = this; other.init(); Array.from(other.headers.keys()).forEach(function (key) { _this.headers.set(key, /** @type {?} */ ((other.headers.get(key)))); _this.normalizedNames.set(key, /** @type {?} */ ((other.normalizedNames.get(key)))); }); }; /** * @param {?} update * @return {?} */ HttpHeaders.prototype.clone = /** * @param {?} update * @return {?} */ function (update) { var /** @type {?} */ clone = new HttpHeaders(); clone.lazyInit = (!!this.lazyInit && this.lazyInit instanceof HttpHeaders) ? this.lazyInit : this; clone.lazyUpdate = (this.lazyUpdate || []).concat([update]); return clone; }; /** * @param {?} update * @return {?} */ HttpHeaders.prototype.applyUpdate = /** * @param {?} update * @return {?} */ function (update) { var /** @type {?} */ key = update.name.toLowerCase(); switch (update.op) { case 'a': case 's': var /** @type {?} */ value = /** @type {?} */ ((update.value)); if (typeof value === 'string') { value = [value]; } if (value.length === 0) { return; } this.maybeSetNormalizedName(update.name, key); var /** @type {?} */ base = (update.op === 'a' ? this.headers.get(key) : undefined) || []; base.push.apply(base, value); this.headers.set(key, base); break; case 'd': var /** @type {?} */ toDelete_1 = /** @type {?} */ (update.value); if (!toDelete_1) { this.headers.delete(key); this.normalizedNames.delete(key); } else { var /** @type {?} */ existing = this.headers.get(key); if (!existing) { return; } existing = existing.filter(function (value) { return toDelete_1.indexOf(value) === -1; }); if (existing.length === 0) { this.headers.delete(key); this.normalizedNames.delete(key); } else { this.headers.set(key, existing); } } break; } }; /** * @internal */ /** * \@internal * @param {?} fn * @return {?} */ HttpHeaders.prototype.forEach = /** * \@internal * @param {?} fn * @return {?} */ function (fn) { var _this = this; this.init(); Array.from(this.normalizedNames.keys()) .forEach(function (key) { return fn(/** @type {?} */ ((_this.normalizedNames.get(key))), /** @type {?} */ ((_this.headers.get(key)))); }); }; return HttpHeaders; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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`. * * \@stable * * @record */ /** * A `HttpParameterCodec` that uses `encodeURIComponent` and `decodeURIComponent` to * serialize and parse URL parameter keys and values. * * \@stable */ var HttpUrlEncodingCodec = /** @class */ (function () { function HttpUrlEncodingCodec() { } /** * @param {?} k * @return {?} */ HttpUrlEncodingCodec.prototype.encodeKey = /** * @param {?} k * @return {?} */ function (k) { return standardEncoding(k); }; /** * @param {?} v * @return {?} */ HttpUrlEncodingCodec.prototype.encodeValue = /** * @param {?} v * @return {?} */ function (v) { return standardEncoding(v); }; /** * @param {?} k * @return {?} */ HttpUrlEncodingCodec.prototype.decodeKey = /** * @param {?} k * @return {?} */ function (k) { return decodeURIComponent(k); }; /** * @param {?} v * @return {?} */ HttpUrlEncodingCodec.prototype.decodeValue = /** * @param {?} v * @return {?} */ function (v) { return decodeURIComponent(v); }; return HttpUrlEncodingCodec; }()); /** * @param {?} rawParams * @param {?} codec * @return {?} */ function paramParser(rawParams, codec) { var /** @type {?} */ map$$1 = new Map(); if (rawParams.length > 0) { var /** @type {?} */ params = rawParams.split('&'); params.forEach(function (param) { var /** @type {?} */ eqIdx = param.indexOf('='); var _a = eqIdx == -1 ? [codec.decodeKey(param), ''] : [codec.decodeKey(param.slice(0, eqIdx)), codec.decodeValue(param.slice(eqIdx + 1))], key = _a[0], val = _a[1]; var /** @type {?} */ list = map$$1.get(key) || []; list.push(val); map$$1.set(key, list); }); } return map$$1; } /** * @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, '/'); } /** * Options used to construct an `HttpParams` instance. * @record */ /** * 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. * * \@stable */ var HttpParams = /** @class */ (function () { function HttpParams(options) { if (options === void 0) { options = /** @type {?} */ ({}); } var _this = this; 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(function (key) { var /** @type {?} */ value = (/** @type {?} */ (options.fromObject))[key]; /** @type {?} */ ((_this.map)).set(key, Array.isArray(value) ? value : [value]); }); } else { this.map = null; } } /** * Check whether the body has one or more values for the given parameter name. */ /** * Check whether the body has one or more values for the given parameter name. * @param {?} param * @return {?} */ HttpParams.prototype.has = /** * Check whether the body has one or more values for the given parameter name. * @param {?} param * @return {?} */ function (param) { this.init(); return /** @type {?} */ ((this.map)).has(param); }; /** * Get the first value for the given parameter name, or `null` if it's not present. */ /** * Get the first value for the given parameter name, or `null` if it's not present. * @param {?} param * @return {?} */ HttpParams.prototype.get = /** * Get the first value for the given parameter name, or `null` if it's not present. * @param {?} param * @return {?} */ function (param) { this.init(); var /** @type {?} */ res = /** @type {?} */ ((this.map)).get(param); return !!res ? res[0] : null; }; /** * Get all values for the given parameter name, or `null` if it's not present. */ /** * Get all values for the given parameter name, or `null` if it's not present. * @param {?} param * @return {?} */ HttpParams.prototype.getAll = /** * Get all values for the given parameter name, or `null` if it's not present. * @param {?} param * @return {?} */ function (param) { this.init(); return /** @type {?} */ ((this.map)).get(param) || null; }; /** * Get all the parameter names for this body. */ /** * Get all the parameter names for this body. * @return {?} */ HttpParams.prototype.keys = /** * Get all the parameter names for this body. * @return {?} */ function () { this.init(); return Array.from(/** @type {?} */ ((this.map)).keys()); }; /** * Construct a new body with an appended value for the given parameter name. */ /** * Construct a new body with an appended value for the given parameter name. * @param {?} param * @param {?} value * @return {?} */ HttpParams.prototype.append = /** * Construct a new body with an appended value for the given parameter name. * @param {?} param * @param {?} value * @return {?} */ function (param, value) { return this.clone({ param: param, value: value, op: 'a' }); }; /** * Construct a new body with a new value for the given parameter name. */ /** * Construct a new body with a new value for the given parameter name. * @param {?} param * @param {?} value * @return {?} */ HttpParams.prototype.set = /** * Construct a new body with a new value for the given parameter name. * @param {?} param * @param {?} value * @return {?} */ function (param, value) { return this.clone({ param: param, value: value, op: 's' }); }; /** * Construct a new body with either the given value for the given parameter * removed, if a value is given, or all values for the given parameter removed * if not. */ /** * Construct a new body with either the given value for the given parameter * removed, if a value is given, or all values for the given parameter removed * if not. * @param {?} param * @param {?=} value * @return {?} */ HttpParams.prototype.delete = /** * Construct a new body with either the given value for the given parameter * removed, if a value is given, or all values for the given parameter removed * if not. * @param {?} param * @param {?=} value * @return {?} */ function (param, value) { return this.clone({ param: param, value: value, op: 'd' }); }; /** * Serialize the body to an encoded string, where key-value pairs (separated by `=`) are * separated by `&`s. */ /** * Serialize the body to an encoded string, where key-value pairs (separated by `=`) are * separated by `&`s. * @return {?} */ HttpParams.prototype.toString = /** * Serialize the body to an encoded string, where key-value pairs (separated by `=`) are * separated by `&`s. * @return {?} */ function () { var _this = this; this.init(); return this.keys() .map(function (key) { var /** @type {?} */ eKey = _this.encoder.encodeKey(key); return /** @type {?} */ ((/** @type {?} */ ((_this.map)).get(key))).map(function (value) { return eKey + '=' + _this.encoder.encodeValue(value); }).join('&'); }) .join('&'); }; /** * @param {?} update * @return {?} */ HttpParams.prototype.clone = /** * @param {?} update * @return {?} */ function (update) { var /** @type {?} */ clone = new HttpParams(/** @type {?} */ ({ encoder: this.encoder })); clone.cloneFrom = this.cloneFrom || this; clone.updates = (this.updates || []).concat([update]); return clone; }; /** * @return {?} */ HttpParams.prototype.init = /** * @return {?} */ function () { var _this = this; if (this.map === null) { this.map = new Map(); } if (this.cloneFrom !== null) { this.cloneFrom.init(); this.cloneFrom.keys().forEach(function (key) { return ((_this.map)).set(key, /** @type {?} */ ((/** @type {?} */ ((/** @type {?} */ ((_this.cloneFrom)).map)).get(key)))); }); /** @type {?} */ ((this.updates)).forEach(function (update) { switch (update.op) { case 'a': case 's': var /** @type {?} */ base = (update.op === 'a' ? /** @type {?} */ ((_this.map)).get(update.param) : undefined) || []; base.push(/** @type {?} */ ((update.value))); /** @type {?} */ ((_this.map)).set(update.param, base); break; case 'd': if (update.value !== undefined) { var /** @type {?} */ base_1 = /** @type {?} */ ((_this.map)).get(update.param) || []; var /** @type {?} */ idx = base_1.indexOf(update.value); if (idx !== -1) { base_1.splice(idx, 1); } if (base_1.length > 0) { /** @type {?} */ ((_this.map)).set(update.param, base_1); } else { /** @type {?} */ ((_this.map)).delete(update.param); } } else { /** @type {?} */ ((_this.map)).delete(update.param); break; } } }); this.cloneFrom = null; } }; return HttpParams; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * 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. * * \@stable */ var HttpRequest = /** @class */ (function () { function HttpRequest(method, url, third, fourth) { 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. var /** @type {?} */ 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. var /** @type {?} */ 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 '?'. var /** @type {?} */ 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. var /** @type {?} */ 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. */ /** * Transform the free-form body into a serialized format suitable for * transmission to the server. * @return {?} */ HttpRequest.prototype.serializeBody = /** * Transform the free-form body into a serialized format suitable for * transmission to the server. * @return {?} */ function () { // 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`. */ /** * 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 {?} */ HttpRequest.prototype.detectContentTypeHeader = /** * 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 {?} */ function () { // 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 {?} */ HttpRequest.prototype.clone = /** * @param {?=} update * @return {?} */ function (update) { if (update === void 0) { update = {}; } // For method, url, and responseType, take the current value unless // it is overridden in the update hash. var /** @type {?} */ method = update.method || this.method; var /** @type {?} */ url = update.url || this.url; var /** @type {?} */ 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. var /** @type {?} */ body = (update.body !== undefined) ? update.body : this.body; // Carefully handle the boolean options to differentiate between // `false` and `undefined` in the update args. var /** @type {?} */ withCredentials = (update.withCredentials !== undefined) ? update.withCredentials : this.withCredentials; var /** @type {?} */ reportProgress = (update.reportProgress !== undefined) ? update.reportProgress : this.reportProgress; // Headers and params may be appended to if `setHeaders` or // `setParams` are used. var /** @type {?} */ headers = update.headers || this.headers; var /** @type {?} */ 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(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(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; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** @enum {number} */ 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"; /** * Base interface for progress events. * * \@stable * @record */ /** * A download progress event. * * \@stable * @record */ /** * An upload progress event. * * \@stable * @record */ /** * 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. * * \@stable * @record */ /** * A user-defined event. * * Grouping all custom events under this type ensures they will be handled * and forwarded by all implementations of interceptors. * * \@stable * @record */ /** * 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. * * \@stable * @record */ /** * Base class for both `HttpResponse` and `HttpHeaderResponse`. * * \@stable * @abstract */ var HttpResponseBase = /** @class */ (function () { /** * 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. */ function HttpResponseBase(init, defaultStatus, defaultStatusText) { if (defaultStatus === void 0) { defaultStatus = 200; } if (defaultStatusText === void 0) { defaultStatusText = 'OK'; } // 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; } return HttpResponseBase; }()); /** * 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. * * \@stable */ var HttpHeaderResponse = /** @class */ (function (_super) { Object(__WEBPACK_IMPORTED_MODULE_5_tslib__["b" /* __extends */])(HttpHeaderResponse, _super); /** * Create a new `HttpHeaderResponse` with the given parameters. */ function HttpHeaderResponse(init) { if (init === void 0) { init = {}; } var _this = _super.call(this, init) || this; _this.type = HttpEventType.ResponseHeader; return _this; } /** * Copy this `HttpHeaderResponse`, overriding its contents with the * given parameter hash. */ /** * Copy this `HttpHeaderResponse`, overriding its contents with the * given parameter hash. * @param {?=} update * @return {?} */ HttpHeaderResponse.prototype.clone = /** * Copy this `HttpHeaderResponse`, overriding its contents with the * given parameter hash. * @param {?=} update * @return {?} */ function (update) { if (update === void 0) { update = {}; } // 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)); /** * 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. * * \@stable */ var HttpResponse = /** @class */ (function (_super) { Object(__WEBPACK_IMPORTED_MODULE_5_tslib__["b" /* __extends */])(HttpResponse, _super); /** * Construct a new `HttpResponse`. */ function HttpResponse(init) { if (init === void 0) { init = {}; } var _this = _super.call(this, init) || this; _this.type = HttpEventType.Response; _this.body = init.body !== undefined ? init.body : null; return _this; } /** * @param {?=} update * @return {?} */ HttpResponse.prototype.clone = /** * @param {?=} update * @return {?} */ function (update) { if (update === void 0) { update = {}; } 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)); /** * 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. * * \@stable */ var HttpErrorResponse = /** @class */ (function (_super) { Object(__WEBPACK_IMPORTED_MODULE_5_tslib__["b" /* __extends */])(HttpErrorResponse, _super); function HttpErrorResponse(init) { var _this = // Initialize with a default status of 0 / Unknown Error. _super.call(this, init, 0, 'Unknown Error') || this; _this.name = 'HttpErrorResponse'; /** * Errors are never okay, even when the status code is in the 2xx success range. */ _this.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 (_this.status >= 200 && _this.status < 300) { _this.message = "Http failure during parsing for " + (init.url || '(unknown url)'); } else { _this.message = "Http failure response for " + (init.url || '(unknown url)') + ": " + init.status + " " + init.statusText; } _this.error = init.error || null; return _this; } return HttpErrorResponse; }(HttpResponseBase)); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * Construct an instance of `HttpRequestOptions` from a source `HttpMethodOptions` and * the given `body`. Basically, this clones the object and adds the body. * @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, }; } /** * Perform HTTP requests. * * `HttpClient` is available as an injectable class, with methods to perform HTTP requests. * Each request method has multiple signatures, and the return type varies according to which * signature is called (mainly the values of `observe` and `responseType`). * * \@stable */ var HttpClient = /** @class */ (function () { function HttpClient(handler) { this.handler = handler; } /** * Constructs an `Observable` for a particular HTTP request that, when subscribed, * fires the request through the chain of registered interceptors and on to the * server. * * This method can be called in one of two ways. Either an `HttpRequest` * instance can be passed directly as the only parameter, or a method can be * passed as the first parameter, a string URL as the second, and an * options hash as the third. * * If a `HttpRequest` object is passed directly, an `Observable` of the * raw `HttpEvent` stream will be returned. * * If a request is instead built by providing a URL, the options object * determines the return type of `request()`. In addition to configuring * request parameters such as the outgoing headers and/or the body, the options * hash specifies two key pieces of information about the request: the * `responseType` and what to `observe`. * * The `responseType` value determines how a successful response body will be * parsed. If `responseType` is the default `json`, a type interface for the * resulting object may be passed as a type parameter to `request()`. * * The `observe` value determines the return type of `request()`, based on what * the consumer is interested in observing. A value of `events` will return an * `Observable` representing the raw `HttpEvent` stream, * including progress events by default. A value of `response` will return an * `Observable>` where the `T` parameter of `HttpResponse` * depends on the `responseType` and any optionally provided type parameter. * A value of `body` will return an `Observable` with the same `T` body type. */ /** * Constructs an `Observable` for a particular HTTP request that, when subscribed, * fires the request through the chain of registered interceptors and on to the * server. * * This method can be called in one of two ways. Either an `HttpRequest` * instance can be passed directly as the only parameter, or a method can be * passed as the first parameter, a string URL as the second, and an * options hash as the third. * * If a `HttpRequest` object is passed directly, an `Observable` of the * raw `HttpEvent` stream will be returned. * * If a request is instead built by providing a URL, the options object * determines the return type of `request()`. In addition to configuring * request parameters such as the outgoing headers and/or the body, the options * hash specifies two key pieces of information about the request: the * `responseType` and what to `observe`. * * The `responseType` value determines how a successful response body will be * parsed. If `responseType` is the default `json`, a type interface for the * resulting object may be passed as a type parameter to `request()`. * * The `observe` value determines the return type of `request()`, based on what * the consumer is interested in observing. A value of `events` will return an * `Observable` representing the raw `HttpEvent` stream, * including progress events by default. A value of `response` will return an * `Observable>` where the `T` parameter of `HttpResponse` * depends on the `responseType` and any optionally provided type parameter. * A value of `body` will return an `Observable` with the same `T` body type. * @param {?} first * @param {?=} url * @param {?=} options * @return {?} */ HttpClient.prototype.request = /** * Constructs an `Observable` for a particular HTTP request that, when subscribed, * fires the request through the chain of registered interceptors and on to the * server. * * This method can be called in one of two ways. Either an `HttpRequest` * instance can be passed directly as the only parameter, or a method can be * passed as the first parameter, a string URL as the second, and an * options hash as the third. * * If a `HttpRequest` object is passed directly, an `Observable` of the * raw `HttpEvent` stream will be returned. * * If a request is instead built by providing a URL, the options object * determines the return type of `request()`. In addition to configuring * request parameters such as the outgoing headers and/or the body, the options * hash specifies two key pieces of information about the request: the * `responseType` and what to `observe`. * * The `responseType` value determines how a successful response body will be * parsed. If `responseType` is the default `json`, a type interface for the * resulting object may be passed as a type parameter to `request()`. * * The `observe` value determines the return type of `request()`, based on what * the consumer is interested in observing. A value of `events` will return an * `Observable` representing the raw `HttpEvent` stream, * including progress events by default. A value of `response` will return an * `Observable>` where the `T` parameter of `HttpResponse` * depends on the `responseType` and any optionally provided type parameter. * A value of `body` will return an `Observable` with the same `T` body type. * @param {?} first * @param {?=} url * @param {?=} options * @return {?} */ function (first, url, options) { var _this = this; if (options === void 0) { options = {}; } var /** @type {?} */ req; // Firstly, 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 = /** @type {?} */ (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. var /** @type {?} */ headers = undefined; if (options.headers instanceof HttpHeaders) { headers = options.headers; } else { headers = new HttpHeaders(options.headers); } // Sort out parameters. var /** @type {?} */ 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). var /** @type {?} */ events$ = __WEBPACK_IMPORTED_MODULE_2_rxjs_operator_concatMap__["a" /* concatMap */].call(Object(__WEBPACK_IMPORTED_MODULE_1_rxjs_observable_of__["a" /* of */])(req), function (req) { return _this.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). var /** @type {?} */ res$ = __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_filter__["a" /* filter */].call(events$, 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 __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__["a" /* map */].call(res$, 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 __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__["a" /* map */].call(res$, 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 __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__["a" /* map */].call(res$, 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 __WEBPACK_IMPORTED_MODULE_4_rxjs_operator_map__["a" /* map */].call(res$, 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 " + options.observe + "}"); } }; /** * Constructs an `Observable` which, when subscribed, will cause the configured * DELETE request to be executed on the server. See the individual overloads for * details of `delete()`'s return type based on the provided options. */ /** * Constructs an `Observable` which, when subscribed, will cause the configured * DELETE request to be executed on the server. See the individual overloads for * details of `delete()`'s return type based on the provided options. * @param {?} url * @param {?=} options * @return {?} */ HttpClient.prototype.delete = /** * Constructs an `Observable` which, when subscribed, will cause the configured * DELETE request to be executed on the server. See the individual overloads for * details of `delete()`'s return type based on the provided options. * @param {?} url * @param {?=} options * @return {?} */ function (url, options) { if (options === void 0) { options = {}; } return this.request('DELETE', url, /** @type {?} */ (options)); }; /** * Constructs an `Observable` which, when subscribed, will cause the configured * GET request to be executed on the server. See the individual overloads for * details of `get()`'s return type based on the provided options. */ /** * Constructs an `Observable` which, when subscribed, will cause the configured * GET request to be executed on the server. See the individual overloads for * details of `get()`'s return type based on the provided options. * @param {?} url * @param {?=} options * @return {?} */ HttpClient.prototype.get = /** * Constructs an `Observable` which, when subscribed, will cause the configured * GET request to be executed on the server. See the individual overloads for * details of `get()`'s return type based on the provided options. * @param {?} url * @param {?=} options * @return {?} */ function (url, options) { if (options === void 0) { options = {}; } return this.request('GET', url, /** @type {?} */ (options)); }; /** * Constructs an `Observable` which, when subscribed, will cause the configured * HEAD request to be executed on the server. See the individual overloads for * details of `head()`'s return type based on the provided options. */ /** * Constructs an `Observable` which, when subscribed, will cause the configured * HEAD request to be executed on the server. See the individual overloads for * details of `head()`'s return type based on the provided options. * @param {?} url * @param {?=} options * @return {?} */ HttpClient.prototype.head = /** * Constructs an `Observable` which, when subscribed, will cause the configured * HEAD request to be executed on the server. See the individual overloads for * details of `head()`'s return type based on the provided options. * @param {?} url * @param {?=} options * @return {?} */ function (url, options) { if (options === void 0) { options = {}; } return this.request('HEAD', url, /** @type {?} */ (options)); }; /** * Constructs an `Observable` which, when subscribed, will cause a request * with the special method `JSONP` to be dispatched via the interceptor pipeline. * * A suitable interceptor must be installed (e.g. via the `HttpClientJsonpModule`). * If no such interceptor is reached, then the `JSONP` request will likely be * rejected by the configured backend. */ /** * Constructs an `Observable` which, when subscribed, will cause a request * with the special method `JSONP` to be dispatched via the interceptor pipeline. * * A suitable interceptor must be installed (e.g. via the `HttpClientJsonpModule`). * If no such interceptor is reached, then the `JSONP` request will likely be * rejected by the configured backend. * @template T * @param {?} url * @param {?} callbackParam * @return {?} */ HttpClient.prototype.jsonp = /** * Constructs an `Observable` which, when subscribed, will cause a request * with the special method `JSONP` to be dispatched via the interceptor pipeline. * * A suitable interceptor must be installed (e.g. via the `HttpClientJsonpModule`). * If no such interceptor is reached, then the `JSONP` request will likely be * rejected by the configured backend. * @template T * @param {?} url * @param {?} callbackParam * @return {?} */ function (url, callbackParam) { return this.request('JSONP', url, { params: new HttpParams().append(callbackParam, 'JSONP_CALLBACK'), observe: 'body', responseType: 'json', }); }; /** * Constructs an `Observable` which, when subscribed, will cause the configured * OPTIONS request to be executed on the server. See the individual overloads for * details of `options()`'s return type based on the provided options. */ /** * Constructs an `Observable` which, when subscribed, will cause the configured * OPTIONS request to be executed on the server. See the individual overloads for * details of `options()`'s return type based on the provided options. * @param {?} url * @param {?=} options * @return {?} */ HttpClient.prototype.options = /** * Constructs an `Observable` which, when subscribed, will cause the configured * OPTIONS request to be executed on the server. See the individual overloads for * details of `options()`'s return type based on the provided options. * @param {?} url * @param {?=} options * @return {?} */ function (url, options) { if (options === void 0) { options = {}; } return this.request('OPTIONS', url, /** @type {?} */ (options)); }; /** * Constructs an `Observable` which, when subscribed, will cause the configured * PATCH request to be executed on the server. See the individual overloads for * details of `patch()`'s return type based on the provided options. */ /** * Constructs an `Observable` which, when subscribed, will cause the configured * PATCH request to be executed on the server. See the individual overloads for * details of `patch()`'s return type based on the provided options. * @param {?} url * @param {?} body * @param {?=} options * @return {?} */ HttpClient.prototype.patch = /** * Constructs an `Observable` which, when subscribed, will cause the configured * PATCH request to be executed on the server. See the individual overloads for * details of `patch()`'s return type based on the provided options. * @param {?} url * @param {?} body * @param {?=} options * @return {?} */ function (url, body, options) { if (options === void 0) { options = {}; } return this.request('PATCH', url, addBody(options, body)); }; /** * Constructs an `Observable` which, when subscribed, will cause the configured * POST request to be executed on the server. See the individual overloads for * details of `post()`'s return type based on the provided options. */ /** * Constructs an `Observable` which, when subscribed, will cause the configured * POST request to be executed on the server. See the individual overloads for * details of `post()`'s return type based on the provided options. * @param {?} url * @param {?} body * @param {?=} options * @return {?} */ HttpClient.prototype.post = /** * Constructs an `Observable` which, when subscribed, will cause the configured * POST request to be executed on the server. See the individual overloads for * details of `post()`'s return type based on the provided options. * @param {?} url * @param {?} body * @param {?=} options * @return {?} */ function (url, body, options) { if (options === void 0) { options = {}; } return this.request('POST', url, addBody(options, body)); }; /** * Constructs an `Observable` which, when subscribed, will cause the configured * POST request to be executed on the server. See the individual overloads for * details of `post()`'s return type based on the provided options. */ /** * Constructs an `Observable` which, when subscribed, will cause the configured * POST request to be executed on the server. See the individual overloads for * details of `post()`'s return type based on the provided options. * @param {?} url * @param {?} body * @param {?=} options * @return {?} */ HttpClient.prototype.put = /** * Constructs an `Observable` which, when subscribed, will cause the configured * POST request to be executed on the server. See the individual overloads for * details of `post()`'s return type based on the provided options. * @param {?} url * @param {?} body * @param {?=} options * @return {?} */ function (url, body, options) { if (options === void 0) { options = {}; } return this.request('PUT', url, addBody(options, body)); }; HttpClient.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ HttpClient.ctorParameters = function () { return [ { type: HttpHandler, }, ]; }; return HttpClient; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ /** * Intercepts `HttpRequest` and handles them. * * Most interceptors will transform the outgoing request before passing it to the * next interceptor in the chain, by calling `next.handle(transformedReq)`. * * In rare cases, interceptors may wish to completely handle a request themselves, * and not delegate to the remainder of the chain. This behavior is allowed. * * \@stable * @record */ /** * `HttpHandler` which applies an `HttpInterceptor` to an `HttpRequest`. * * \@stable */ var HttpInterceptorHandler = /** @class */ (function () { function HttpInterceptorHandler(next, interceptor) { this.next = next; this.interceptor = interceptor; } /** * @param {?} req * @return {?} */ HttpInterceptorHandler.prototype.handle = /** * @param {?} req * @return {?} */ function (req) { return this.interceptor.intercept(req, this.next); }; return HttpInterceptorHandler; }()); /** * A multi-provider token which represents the array of `HttpInterceptor`s that * are registered. * * \@stable */ var HTTP_INTERCEPTORS = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('HTTP_INTERCEPTORS'); var NoopInterceptor = /** @class */ (function () { function NoopInterceptor() { } /** * @param {?} req * @param {?} next * @return {?} */ NoopInterceptor.prototype.intercept = /** * @param {?} req * @param {?} next * @return {?} */ function (req, next) { return next.handle(req); }; NoopInterceptor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, ]; /** @nocollapse */ NoopInterceptor.ctorParameters = function () { return []; }; return NoopInterceptor; }()); /** * @fileoverview added by tsickle * @suppress {checkTypes} 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 */ // 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. var nextRequestId = 0; // Error text given when a JSONP script is injected, but doesn't invoke the callback // passed in its URL. 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. var JSONP_ERR_WRONG_METHOD = 'JSONP requests must use JSONP request method.'; 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. * * \@stable * @abstract */ var JsonpCallbackContext = /** @class */ (function () { function JsonpCallbackContext() { } return JsonpCallbackContext; }()); /** * `HttpBackend` that only processes `HttpRequest` with the JSONP method, * by performing JSONP style requests. * * \@stable */ var JsonpClientBackend = /** @class */ (function () { function JsonpClientBackend(callbackMap, document) { this.callbackMap = callbackMap; this.document = document; } /** * Get the name of the next callback method, by incrementing the global `nextRequestId`. * @return {?} */ JsonpClientBackend.prototype.nextCallback = /** * Get the name of the next callback method, by incrementing the global `nextRequestId`. * @return {?} */ function () { return "ng_jsonp_callback_" + nextRequestId++; }; /** * Process a JSONP request and return an event stream of the results. */ /** * Process a JSONP request and return an event stream of the results. * @param {?} req * @return {?} */ JsonpClientBackend.prototype.handle = /** * Process a JSONP request and return an event stream of the results. * @param {?} req * @return {?} */ function (req) { var _this = 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 __WEBPACK_IMPORTED_MODULE_7_rxjs_Observable__["a" /* Observable */](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. var /** @type {?} */ callback = _this.nextCallback(); var /** @type {?} */ url = req.urlWithParams.replace(/=JSONP_CALLBACK(&|$)/, "=" + callback + "$1"); // Construct the