UNPKG

495 kBJavaScriptView Raw
1/**
2 * @license Angular v4.2.3
3 * (c) 2010-2017 Google, Inc. https://angular.io/
4 * License: MIT
5 */
6(function (global, factory) {
7 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs/Observable'), require('rxjs/observable/merge'), require('rxjs/operator/share'), require('rxjs/Subject')) :
8 typeof define === 'function' && define.amd ? define(['exports', 'rxjs/Observable', 'rxjs/observable/merge', 'rxjs/operator/share', 'rxjs/Subject'], factory) :
9 (factory((global.ng = global.ng || {}, global.ng.core = global.ng.core || {}),global.Rx,global.Rx.Observable,global.Rx.Observable.prototype,global.Rx));
10}(this, (function (exports,rxjs_Observable,rxjs_observable_merge,rxjs_operator_share,rxjs_Subject) { 'use strict';
11
12/*! *****************************************************************************
13Copyright (c) Microsoft Corporation. All rights reserved.
14Licensed under the Apache License, Version 2.0 (the "License"); you may not use
15this file except in compliance with the License. You may obtain a copy of the
16License at http://www.apache.org/licenses/LICENSE-2.0
17
18THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
19KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
20WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
21MERCHANTABLITY OR NON-INFRINGEMENT.
22
23See the Apache Version 2.0 License for specific language governing permissions
24and limitations under the License.
25***************************************************************************** */
26/* global Reflect, Promise */
27
28var extendStatics = Object.setPrototypeOf ||
29 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
30 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
31
32function __extends(d, b) {
33 extendStatics(d, b);
34 function __() { this.constructor = d; }
35 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
36}
37
38/**
39 * @license Angular v4.2.3
40 * (c) 2010-2017 Google, Inc. https://angular.io/
41 * License: MIT
42 */
43/**
44 * Creates a token that can be used in a DI Provider.
45 *
46 * ### Example ([live demo](http://plnkr.co/edit/Ys9ezXpj2Mnoy3Uc8KBp?p=preview))
47 *
48 * ```typescript
49 * var t = new OpaqueToken("value");
50 *
51 * var injector = Injector.resolveAndCreate([
52 * {provide: t, useValue: "bindingValue"}
53 * ]);
54 *
55 * expect(injector.get(t)).toEqual("bindingValue");
56 * ```
57 *
58 * Using an `OpaqueToken` is preferable to using strings as tokens because of possible collisions
59 * caused by multiple providers using the same string as two different tokens.
60 *
61 * Using an `OpaqueToken` is preferable to using an `Object` as tokens because it provides better
62 * error messages.
63 * @deprecated since v4.0.0 because it does not support type information, use `InjectionToken<?>`
64 * instead.
65 */
66var OpaqueToken = (function () {
67 /**
68 * @param {?} _desc
69 */
70 function OpaqueToken(_desc) {
71 this._desc = _desc;
72 }
73 /**
74 * @return {?}
75 */
76 OpaqueToken.prototype.toString = function () { return "Token " + this._desc; };
77 return OpaqueToken;
78}());
79/**
80 * Creates a token that can be used in a DI Provider.
81 *
82 * Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a
83 * runtime representation) such as when injecting an interface, callable type, array or
84 * parametrized type.
85 *
86 * `InjectionToken` is parameterized on `T` which is the type of object which will be returned by
87 * the `Injector`. This provides additional level of type safety.
88 *
89 * ```
90 * interface MyInterface {...}
91 * var myInterface = injector.get(new InjectionToken<MyInterface>('SomeToken'));
92 * // myInterface is inferred to be MyInterface.
93 * ```
94 *
95 * ### Example
96 *
97 * {\@example core/di/ts/injector_spec.ts region='InjectionToken'}
98 *
99 * \@stable
100 */
101var InjectionToken = (function (_super) {
102 __extends(InjectionToken, _super);
103 /**
104 * @param {?} desc
105 */
106 function InjectionToken(desc) {
107 return _super.call(this, desc) || this;
108 }
109 /**
110 * @return {?}
111 */
112 InjectionToken.prototype.toString = function () { return "InjectionToken " + this._desc; };
113 return InjectionToken;
114}(OpaqueToken));
115/**
116 * @license
117 * Copyright Google Inc. All Rights Reserved.
118 *
119 * Use of this source code is governed by an MIT-style license that can be
120 * found in the LICENSE file at https://angular.io/license
121 */
122var __window = typeof window !== 'undefined' && window;
123var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
124 self instanceof WorkerGlobalScope && self;
125var __global = typeof global !== 'undefined' && global;
126var _global = __window || __global || __self;
127var _symbolIterator = null;
128/**
129 * @return {?}
130 */
131function getSymbolIterator() {
132 if (!_symbolIterator) {
133 var /** @type {?} */ Symbol = _global['Symbol'];
134 if (Symbol && Symbol.iterator) {
135 _symbolIterator = Symbol.iterator;
136 }
137 else {
138 // es6-shim specific logic
139 var /** @type {?} */ keys = Object.getOwnPropertyNames(Map.prototype);
140 for (var /** @type {?} */ i = 0; i < keys.length; ++i) {
141 var /** @type {?} */ key = keys[i];
142 if (key !== 'entries' && key !== 'size' &&
143 ((Map)).prototype[key] === Map.prototype['entries']) {
144 _symbolIterator = key;
145 }
146 }
147 }
148 }
149 return _symbolIterator;
150}
151/**
152 * @param {?} fn
153 * @return {?}
154 */
155function scheduleMicroTask(fn) {
156 Zone.current.scheduleMicroTask('scheduleMicrotask', fn);
157}
158/**
159 * @param {?} a
160 * @param {?} b
161 * @return {?}
162 */
163function looseIdentical(a, b) {
164 return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b);
165}
166/**
167 * @param {?} token
168 * @return {?}
169 */
170function stringify(token) {
171 if (typeof token === 'string') {
172 return token;
173 }
174 if (token == null) {
175 return '' + token;
176 }
177 if (token.overriddenName) {
178 return "" + token.overriddenName;
179 }
180 if (token.name) {
181 return "" + token.name;
182 }
183 var /** @type {?} */ res = token.toString();
184 if (res == null) {
185 return '' + res;
186 }
187 var /** @type {?} */ newLineIndex = res.indexOf('\n');
188 return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
189}
190/**
191 * @license
192 * Copyright Google Inc. All Rights Reserved.
193 *
194 * Use of this source code is governed by an MIT-style license that can be
195 * found in the LICENSE file at https://angular.io/license
196 */
197var _nextClassId = 0;
198var Reflect$1 = _global['Reflect'];
199/**
200 * @param {?} annotation
201 * @return {?}
202 */
203function extractAnnotation(annotation) {
204 if (typeof annotation === 'function' && annotation.hasOwnProperty('annotation')) {
205 // it is a decorator, extract annotation
206 annotation = annotation.annotation;
207 }
208 return annotation;
209}
210/**
211 * @param {?} fnOrArray
212 * @param {?} key
213 * @return {?}
214 */
215function applyParams(fnOrArray, key) {
216 if (fnOrArray === Object || fnOrArray === String || fnOrArray === Function ||
217 fnOrArray === Number || fnOrArray === Array) {
218 throw new Error("Can not use native " + stringify(fnOrArray) + " as constructor");
219 }
220 if (typeof fnOrArray === 'function') {
221 return fnOrArray;
222 }
223 if (Array.isArray(fnOrArray)) {
224 var /** @type {?} */ annotations = (fnOrArray);
225 var /** @type {?} */ annoLength = annotations.length - 1;
226 var /** @type {?} */ fn = fnOrArray[annoLength];
227 if (typeof fn !== 'function') {
228 throw new Error("Last position of Class method array must be Function in key " + key + " was '" + stringify(fn) + "'");
229 }
230 if (annoLength != fn.length) {
231 throw new Error("Number of annotations (" + annoLength + ") does not match number of arguments (" + fn.length + ") in the function: " + stringify(fn));
232 }
233 var /** @type {?} */ paramsAnnotations = [];
234 for (var /** @type {?} */ i = 0, /** @type {?} */ ii = annotations.length - 1; i < ii; i++) {
235 var /** @type {?} */ paramAnnotations = [];
236 paramsAnnotations.push(paramAnnotations);
237 var /** @type {?} */ annotation = annotations[i];
238 if (Array.isArray(annotation)) {
239 for (var /** @type {?} */ j = 0; j < annotation.length; j++) {
240 paramAnnotations.push(extractAnnotation(annotation[j]));
241 }
242 }
243 else if (typeof annotation === 'function') {
244 paramAnnotations.push(extractAnnotation(annotation));
245 }
246 else {
247 paramAnnotations.push(annotation);
248 }
249 }
250 Reflect$1.defineMetadata('parameters', paramsAnnotations, fn);
251 return fn;
252 }
253 throw new Error("Only Function or Array is supported in Class definition for key '" + key + "' is '" + stringify(fnOrArray) + "'");
254}
255/**
256 * Provides a way for expressing ES6 classes with parameter annotations in ES5.
257 *
258 * ## Basic Example
259 *
260 * ```
261 * var Greeter = ng.Class({
262 * constructor: function(name) {
263 * this.name = name;
264 * },
265 *
266 * greet: function() {
267 * alert('Hello ' + this.name + '!');
268 * }
269 * });
270 * ```
271 *
272 * is equivalent to ES6:
273 *
274 * ```
275 * class Greeter {
276 * constructor(name) {
277 * this.name = name;
278 * }
279 *
280 * greet() {
281 * alert('Hello ' + this.name + '!');
282 * }
283 * }
284 * ```
285 *
286 * or equivalent to ES5:
287 *
288 * ```
289 * var Greeter = function (name) {
290 * this.name = name;
291 * }
292 *
293 * Greeter.prototype.greet = function () {
294 * alert('Hello ' + this.name + '!');
295 * }
296 * ```
297 *
298 * ### Example with parameter annotations
299 *
300 * ```
301 * var MyService = ng.Class({
302 * constructor: [String, [new Optional(), Service], function(name, myService) {
303 * ...
304 * }]
305 * });
306 * ```
307 *
308 * is equivalent to ES6:
309 *
310 * ```
311 * class MyService {
312 * constructor(name: string, \@Optional() myService: Service) {
313 * ...
314 * }
315 * }
316 * ```
317 *
318 * ### Example with inheritance
319 *
320 * ```
321 * var Shape = ng.Class({
322 * constructor: (color) {
323 * this.color = color;
324 * }
325 * });
326 *
327 * var Square = ng.Class({
328 * extends: Shape,
329 * constructor: function(color, size) {
330 * Shape.call(this, color);
331 * this.size = size;
332 * }
333 * });
334 * ```
335 * @suppress {globalThis}
336 * \@stable
337 * @param {?} clsDef
338 * @return {?}
339 */
340function Class(clsDef) {
341 var /** @type {?} */ constructor = applyParams(clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor');
342 var /** @type {?} */ proto = constructor.prototype;
343 if (clsDef.hasOwnProperty('extends')) {
344 if (typeof clsDef.extends === 'function') {
345 ((constructor)).prototype = proto =
346 Object.create(((clsDef.extends)).prototype);
347 }
348 else {
349 throw new Error("Class definition 'extends' property must be a constructor function was: " + stringify(clsDef.extends));
350 }
351 }
352 for (var /** @type {?} */ key in clsDef) {
353 if (key !== 'extends' && key !== 'prototype' && clsDef.hasOwnProperty(key)) {
354 proto[key] = applyParams(clsDef[key], key);
355 }
356 }
357 if (this && this.annotations instanceof Array) {
358 Reflect$1.defineMetadata('annotations', this.annotations, constructor);
359 }
360 var /** @type {?} */ constructorName = constructor['name'];
361 if (!constructorName || constructorName === 'constructor') {
362 ((constructor))['overriddenName'] = "class" + _nextClassId++;
363 }
364 return (constructor);
365}
366/**
367 * @suppress {globalThis}
368 * @param {?} name
369 * @param {?=} props
370 * @param {?=} parentClass
371 * @param {?=} chainFn
372 * @return {?}
373 */
374function makeDecorator(name, props, parentClass, chainFn) {
375 var /** @type {?} */ metaCtor = makeMetadataCtor(props);
376 /**
377 * @param {?} objOrType
378 * @return {?}
379 */
380 function DecoratorFactory(objOrType) {
381 if (!(Reflect$1 && Reflect$1.getOwnMetadata)) {
382 throw 'reflect-metadata shim is required when using class decorators';
383 }
384 if (this instanceof DecoratorFactory) {
385 metaCtor.call(this, objOrType);
386 return this;
387 }
388 var /** @type {?} */ annotationInstance = new ((DecoratorFactory))(objOrType);
389 var /** @type {?} */ chainAnnotation = typeof this === 'function' && Array.isArray(this.annotations) ? this.annotations : [];
390 chainAnnotation.push(annotationInstance);
391 var /** @type {?} */ TypeDecorator = (function TypeDecorator(cls) {
392 var /** @type {?} */ annotations = Reflect$1.getOwnMetadata('annotations', cls) || [];
393 annotations.push(annotationInstance);
394 Reflect$1.defineMetadata('annotations', annotations, cls);
395 return cls;
396 });
397 TypeDecorator.annotations = chainAnnotation;
398 TypeDecorator.Class = Class;
399 if (chainFn)
400 chainFn(TypeDecorator);
401 return TypeDecorator;
402 }
403 if (parentClass) {
404 DecoratorFactory.prototype = Object.create(parentClass.prototype);
405 }
406 DecoratorFactory.prototype.toString = function () { return "@" + name; };
407 ((DecoratorFactory)).annotationCls = DecoratorFactory;
408 return DecoratorFactory;
409}
410/**
411 * @param {?=} props
412 * @return {?}
413 */
414function makeMetadataCtor(props) {
415 return function ctor() {
416 var args = [];
417 for (var _i = 0; _i < arguments.length; _i++) {
418 args[_i] = arguments[_i];
419 }
420 if (props) {
421 var /** @type {?} */ values = props.apply(void 0, args);
422 for (var /** @type {?} */ propName in values) {
423 this[propName] = values[propName];
424 }
425 }
426 };
427}
428/**
429 * @param {?} name
430 * @param {?=} props
431 * @param {?=} parentClass
432 * @return {?}
433 */
434function makeParamDecorator(name, props, parentClass) {
435 var /** @type {?} */ metaCtor = makeMetadataCtor(props);
436 /**
437 * @param {...?} args
438 * @return {?}
439 */
440 function ParamDecoratorFactory() {
441 var args = [];
442 for (var _i = 0; _i < arguments.length; _i++) {
443 args[_i] = arguments[_i];
444 }
445 if (this instanceof ParamDecoratorFactory) {
446 metaCtor.apply(this, args);
447 return this;
448 }
449 var /** @type {?} */ annotationInstance = new (((ParamDecoratorFactory)).bind.apply(((ParamDecoratorFactory)), [void 0].concat(args)))();
450 ((ParamDecorator)).annotation = annotationInstance;
451 return ParamDecorator;
452 /**
453 * @param {?} cls
454 * @param {?} unusedKey
455 * @param {?} index
456 * @return {?}
457 */
458 function ParamDecorator(cls, unusedKey, index) {
459 var /** @type {?} */ parameters = Reflect$1.getOwnMetadata('parameters', cls) || [];
460 // there might be gaps if some in between parameters do not have annotations.
461 // we pad with nulls.
462 while (parameters.length <= index) {
463 parameters.push(null);
464 }
465 parameters[index] = parameters[index] || []; /** @type {?} */
466 ((parameters[index])).push(annotationInstance);
467 Reflect$1.defineMetadata('parameters', parameters, cls);
468 return cls;
469 }
470 }
471 if (parentClass) {
472 ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);
473 }
474 ParamDecoratorFactory.prototype.toString = function () { return "@" + name; };
475 ((ParamDecoratorFactory)).annotationCls = ParamDecoratorFactory;
476 return ParamDecoratorFactory;
477}
478/**
479 * @param {?} name
480 * @param {?=} props
481 * @param {?=} parentClass
482 * @return {?}
483 */
484function makePropDecorator(name, props, parentClass) {
485 var /** @type {?} */ metaCtor = makeMetadataCtor(props);
486 /**
487 * @param {...?} args
488 * @return {?}
489 */
490 function PropDecoratorFactory() {
491 var args = [];
492 for (var _i = 0; _i < arguments.length; _i++) {
493 args[_i] = arguments[_i];
494 }
495 if (this instanceof PropDecoratorFactory) {
496 metaCtor.apply(this, args);
497 return this;
498 }
499 var /** @type {?} */ decoratorInstance = new (((PropDecoratorFactory)).bind.apply(((PropDecoratorFactory)), [void 0].concat(args)))();
500 return function PropDecorator(target, name) {
501 var /** @type {?} */ meta = Reflect$1.getOwnMetadata('propMetadata', target.constructor) || {};
502 meta[name] = meta.hasOwnProperty(name) && meta[name] || [];
503 meta[name].unshift(decoratorInstance);
504 Reflect$1.defineMetadata('propMetadata', meta, target.constructor);
505 };
506 }
507 if (parentClass) {
508 PropDecoratorFactory.prototype = Object.create(parentClass.prototype);
509 }
510 PropDecoratorFactory.prototype.toString = function () { return "@" + name; };
511 ((PropDecoratorFactory)).annotationCls = PropDecoratorFactory;
512 return PropDecoratorFactory;
513}
514/**
515 * @license
516 * Copyright Google Inc. All Rights Reserved.
517 *
518 * Use of this source code is governed by an MIT-style license that can be
519 * found in the LICENSE file at https://angular.io/license
520 */
521/**
522 * This token can be used to create a virtual provider that will populate the
523 * `entryComponents` fields of components and ng modules based on its `useValue`.
524 * All components that are referenced in the `useValue` value (either directly
525 * or in a nested array or map) will be added to the `entryComponents` property.
526 *
527 * ### Example
528 * The following example shows how the router can populate the `entryComponents`
529 * field of an NgModule based on the router configuration which refers
530 * to components.
531 *
532 * ```typescript
533 * // helper function inside the router
534 * function provideRoutes(routes) {
535 * return [
536 * {provide: ROUTES, useValue: routes},
537 * {provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: routes, multi: true}
538 * ];
539 * }
540 *
541 * // user code
542 * let routes = [
543 * {path: '/root', component: RootComp},
544 * {path: '/teams', component: TeamsComp}
545 * ];
546 *
547 * \@NgModule({
548 * providers: [provideRoutes(routes)]
549 * })
550 * class ModuleWithRoutes {}
551 * ```
552 *
553 * \@experimental
554 */
555var ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken('AnalyzeForEntryComponents');
556/**
557 * Attribute decorator and metadata.
558 *
559 * \@stable
560 * \@Annotation
561 */
562var Attribute = makeParamDecorator('Attribute', function (attributeName) { return ({ attributeName: attributeName }); });
563/**
564 * Base class for query metadata.
565 *
566 * See {\@link ContentChildren}, {\@link ContentChild}, {\@link ViewChildren}, {\@link ViewChild} for
567 * more information.
568 *
569 * \@stable
570 * @abstract
571 */
572var Query = (function () {
573 function Query() {
574 }
575 return Query;
576}());
577/**
578 * ContentChildren decorator and metadata.
579 *
580 * \@stable
581 * \@Annotation
582 */
583var ContentChildren = makePropDecorator('ContentChildren', function (selector, data) {
584 if (data === void 0) { data = {}; }
585 return (Object.assign({ selector: selector, first: false, isViewQuery: false, descendants: false }, data));
586}, Query);
587/**
588 * ContentChild decorator and metadata.
589 *
590 * \@stable
591 * \@Annotation
592 */
593var ContentChild = makePropDecorator('ContentChild', function (selector, data) {
594 if (data === void 0) { data = {}; }
595 return (Object.assign({ selector: selector, first: true, isViewQuery: false, descendants: true }, data));
596}, Query);
597/**
598 * ViewChildren decorator and metadata.
599 *
600 * \@stable
601 * \@Annotation
602 */
603var ViewChildren = makePropDecorator('ViewChildren', function (selector, data) {
604 if (data === void 0) { data = {}; }
605 return (Object.assign({ selector: selector, first: false, isViewQuery: true, descendants: true }, data));
606}, Query);
607/**
608 * ViewChild decorator and metadata.
609 *
610 * \@stable
611 * \@Annotation
612 */
613var ViewChild = makePropDecorator('ViewChild', function (selector, data) { return (Object.assign({ selector: selector, first: true, isViewQuery: true, descendants: true }, data)); }, Query);
614var ChangeDetectionStrategy = {};
615ChangeDetectionStrategy.OnPush = 0;
616ChangeDetectionStrategy.Default = 1;
617ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = "OnPush";
618ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default";
619var ChangeDetectorStatus = {};
620ChangeDetectorStatus.CheckOnce = 0;
621ChangeDetectorStatus.Checked = 1;
622ChangeDetectorStatus.CheckAlways = 2;
623ChangeDetectorStatus.Detached = 3;
624ChangeDetectorStatus.Errored = 4;
625ChangeDetectorStatus.Destroyed = 5;
626ChangeDetectorStatus[ChangeDetectorStatus.CheckOnce] = "CheckOnce";
627ChangeDetectorStatus[ChangeDetectorStatus.Checked] = "Checked";
628ChangeDetectorStatus[ChangeDetectorStatus.CheckAlways] = "CheckAlways";
629ChangeDetectorStatus[ChangeDetectorStatus.Detached] = "Detached";
630ChangeDetectorStatus[ChangeDetectorStatus.Errored] = "Errored";
631ChangeDetectorStatus[ChangeDetectorStatus.Destroyed] = "Destroyed";
632/**
633 * @param {?} changeDetectionStrategy
634 * @return {?}
635 */
636function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
637 return changeDetectionStrategy == null ||
638 changeDetectionStrategy === ChangeDetectionStrategy.Default;
639}
640/**
641 * @license
642 * Copyright Google Inc. All Rights Reserved.
643 *
644 * Use of this source code is governed by an MIT-style license that can be
645 * found in the LICENSE file at https://angular.io/license
646 */
647/**
648 * Directive decorator and metadata.
649 *
650 * \@stable
651 * \@Annotation
652 */
653var Directive = makeDecorator('Directive', function (dir) {
654 if (dir === void 0) { dir = {}; }
655 return dir;
656});
657/**
658 * Component decorator and metadata.
659 *
660 * \@stable
661 * \@Annotation
662 */
663var Component = makeDecorator('Component', function (c) {
664 if (c === void 0) { c = {}; }
665 return (Object.assign({ changeDetection: ChangeDetectionStrategy.Default }, c));
666}, Directive);
667/**
668 * Pipe decorator and metadata.
669 *
670 * \@stable
671 * \@Annotation
672 */
673var Pipe = makeDecorator('Pipe', function (p) { return (Object.assign({ pure: true }, p)); });
674/**
675 * Input decorator and metadata.
676 *
677 * \@stable
678 * \@Annotation
679 */
680var Input = makePropDecorator('Input', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
681/**
682 * Output decorator and metadata.
683 *
684 * \@stable
685 * \@Annotation
686 */
687var Output = makePropDecorator('Output', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
688/**
689 * HostBinding decorator and metadata.
690 *
691 * \@stable
692 * \@Annotation
693 */
694var HostBinding = makePropDecorator('HostBinding', function (hostPropertyName) { return ({ hostPropertyName: hostPropertyName }); });
695/**
696 * HostListener decorator and metadata.
697 *
698 * \@stable
699 * \@Annotation
700 */
701var HostListener = makePropDecorator('HostListener', function (eventName, args) { return ({ eventName: eventName, args: args }); });
702/**
703 * @license
704 * Copyright Google Inc. All Rights Reserved.
705 *
706 * Use of this source code is governed by an MIT-style license that can be
707 * found in the LICENSE file at https://angular.io/license
708 */
709/**
710 * Defines a schema that will allow:
711 * - any non-Angular elements with a `-` in their name,
712 * - any properties on elements with a `-` in their name which is the common rule for custom
713 * elements.
714 *
715 * \@stable
716 */
717var CUSTOM_ELEMENTS_SCHEMA = {
718 name: 'custom-elements'
719};
720/**
721 * Defines a schema that will allow any property on any element.
722 *
723 * \@experimental
724 */
725var NO_ERRORS_SCHEMA = {
726 name: 'no-errors-schema'
727};
728/**
729 * NgModule decorator and metadata.
730 *
731 * \@stable
732 * \@Annotation
733 */
734var NgModule = makeDecorator('NgModule', function (ngModule) { return ngModule; });
735var ViewEncapsulation = {};
736ViewEncapsulation.Emulated = 0;
737ViewEncapsulation.Native = 1;
738ViewEncapsulation.None = 2;
739ViewEncapsulation[ViewEncapsulation.Emulated] = "Emulated";
740ViewEncapsulation[ViewEncapsulation.Native] = "Native";
741ViewEncapsulation[ViewEncapsulation.None] = "None";
742/**
743 * Metadata properties available for configuring Views.
744 *
745 * For details on the `\@Component` annotation, see {\@link Component}.
746 *
747 * ### Example
748 *
749 * ```
750 * \@Component({
751 * selector: 'greet',
752 * template: 'Hello {{name}}!',
753 * })
754 * class Greet {
755 * name: string;
756 *
757 * constructor() {
758 * this.name = 'World';
759 * }
760 * }
761 * ```
762 *
763 * @deprecated Use Component instead.
764 *
765 * {\@link Component}
766 */
767var ViewMetadata = (function () {
768 /**
769 * @param {?=} __0
770 */
771 function ViewMetadata(_a) {
772 var _b = _a === void 0 ? {} : _a, templateUrl = _b.templateUrl, template = _b.template, encapsulation = _b.encapsulation, styles = _b.styles, styleUrls = _b.styleUrls, animations = _b.animations, interpolation = _b.interpolation;
773 this.templateUrl = templateUrl;
774 this.template = template;
775 this.styleUrls = styleUrls;
776 this.styles = styles;
777 this.encapsulation = encapsulation;
778 this.animations = animations;
779 this.interpolation = interpolation;
780 }
781 return ViewMetadata;
782}());
783/**
784 * @license
785 * Copyright Google Inc. All Rights Reserved.
786 *
787 * Use of this source code is governed by an MIT-style license that can be
788 * found in the LICENSE file at https://angular.io/license
789 */
790/**
791 * \@whatItDoes Represents the version of Angular
792 *
793 * \@stable
794 */
795var Version = (function () {
796 /**
797 * @param {?} full
798 */
799 function Version(full) {
800 this.full = full;
801 }
802 Object.defineProperty(Version.prototype, "major", {
803 /**
804 * @return {?}
805 */
806 get: function () { return this.full.split('.')[0]; },
807 enumerable: true,
808 configurable: true
809 });
810 Object.defineProperty(Version.prototype, "minor", {
811 /**
812 * @return {?}
813 */
814 get: function () { return this.full.split('.')[1]; },
815 enumerable: true,
816 configurable: true
817 });
818 Object.defineProperty(Version.prototype, "patch", {
819 /**
820 * @return {?}
821 */
822 get: function () { return this.full.split('.').slice(2).join('.'); },
823 enumerable: true,
824 configurable: true
825 });
826 return Version;
827}());
828/**
829 * \@stable
830 */
831var VERSION = new Version('4.2.3');
832/**
833 * @license
834 * Copyright Google Inc. All Rights Reserved.
835 *
836 * Use of this source code is governed by an MIT-style license that can be
837 * found in the LICENSE file at https://angular.io/license
838 */
839/**
840 * Inject decorator and metadata.
841 *
842 * \@stable
843 * \@Annotation
844 */
845var Inject = makeParamDecorator('Inject', function (token) { return ({ token: token }); });
846/**
847 * Optional decorator and metadata.
848 *
849 * \@stable
850 * \@Annotation
851 */
852var Optional = makeParamDecorator('Optional');
853/**
854 * Injectable decorator and metadata.
855 *
856 * \@stable
857 * \@Annotation
858 */
859var Injectable = makeDecorator('Injectable');
860/**
861 * Self decorator and metadata.
862 *
863 * \@stable
864 * \@Annotation
865 */
866var Self = makeParamDecorator('Self');
867/**
868 * SkipSelf decorator and metadata.
869 *
870 * \@stable
871 * \@Annotation
872 */
873var SkipSelf = makeParamDecorator('SkipSelf');
874/**
875 * Host decorator and metadata.
876 *
877 * \@stable
878 * \@Annotation
879 */
880var Host = makeParamDecorator('Host');
881/**
882 * @license
883 * Copyright Google Inc. All Rights Reserved.
884 *
885 * Use of this source code is governed by an MIT-style license that can be
886 * found in the LICENSE file at https://angular.io/license
887 */
888/**
889 * Allows to refer to references which are not yet defined.
890 *
891 * For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of
892 * DI is declared,
893 * but not yet defined. It is also used when the `token` which we use when creating a query is not
894 * yet defined.
895 *
896 * ### Example
897 * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'}
898 * \@experimental
899 * @param {?} forwardRefFn
900 * @return {?}
901 */
902function forwardRef(forwardRefFn) {
903 ((forwardRefFn)).__forward_ref__ = forwardRef;
904 ((forwardRefFn)).toString = function () { return stringify(this()); };
905 return (((forwardRefFn)));
906}
907/**
908 * Lazily retrieves the reference value from a forwardRef.
909 *
910 * Acts as the identity function when given a non-forward-ref value.
911 *
912 * ### Example ([live demo](http://plnkr.co/edit/GU72mJrk1fiodChcmiDR?p=preview))
913 *
914 * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'}
915 *
916 * See: {\@link forwardRef}
917 * \@experimental
918 * @param {?} type
919 * @return {?}
920 */
921function resolveForwardRef(type) {
922 if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') &&
923 type.__forward_ref__ === forwardRef) {
924 return ((type))();
925 }
926 else {
927 return type;
928 }
929}
930/**
931 * @license
932 * Copyright Google Inc. All Rights Reserved.
933 *
934 * Use of this source code is governed by an MIT-style license that can be
935 * found in the LICENSE file at https://angular.io/license
936 */
937var _THROW_IF_NOT_FOUND = new Object();
938var THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
939var _NullInjector = (function () {
940 function _NullInjector() {
941 }
942 /**
943 * @param {?} token
944 * @param {?=} notFoundValue
945 * @return {?}
946 */
947 _NullInjector.prototype.get = function (token, notFoundValue) {
948 if (notFoundValue === void 0) { notFoundValue = _THROW_IF_NOT_FOUND; }
949 if (notFoundValue === _THROW_IF_NOT_FOUND) {
950 throw new Error("No provider for " + stringify(token) + "!");
951 }
952 return notFoundValue;
953 };
954 return _NullInjector;
955}());
956/**
957 * \@whatItDoes Injector interface
958 * \@howToUse
959 * ```
960 * const injector: Injector = ...;
961 * injector.get(...);
962 * ```
963 *
964 * \@description
965 * For more details, see the {\@linkDocs guide/dependency-injection "Dependency Injection Guide"}.
966 *
967 * ### Example
968 *
969 * {\@example core/di/ts/injector_spec.ts region='Injector'}
970 *
971 * `Injector` returns itself when given `Injector` as a token:
972 * {\@example core/di/ts/injector_spec.ts region='injectInjector'}
973 *
974 * \@stable
975 * @abstract
976 */
977var Injector = (function () {
978 function Injector() {
979 }
980 /**
981 * Retrieves an instance from the injector based on the provided token.
982 * If not found:
983 * - Throws an error if no `notFoundValue` that is not equal to
984 * Injector.THROW_IF_NOT_FOUND is given
985 * - Returns the `notFoundValue` otherwise
986 * @abstract
987 * @template T
988 * @param {?} token
989 * @param {?=} notFoundValue
990 * @return {?}
991 */
992 Injector.prototype.get = function (token, notFoundValue) { };
993 /**
994 * @deprecated from v4.0.0 use Type<T> or InjectionToken<T>
995 * @suppress {duplicate}
996 * @abstract
997 * @param {?} token
998 * @param {?=} notFoundValue
999 * @return {?}
1000 */
1001 Injector.prototype.get = function (token, notFoundValue) { };
1002 return Injector;
1003}());
1004Injector.THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
1005Injector.NULL = new _NullInjector();
1006/**
1007 * @license
1008 * Copyright Google Inc. All Rights Reserved.
1009 *
1010 * Use of this source code is governed by an MIT-style license that can be
1011 * found in the LICENSE file at https://angular.io/license
1012 */
1013var ERROR_COMPONENT_TYPE = 'ngComponentType';
1014var ERROR_DEBUG_CONTEXT = 'ngDebugContext';
1015var ERROR_ORIGINAL_ERROR = 'ngOriginalError';
1016var ERROR_LOGGER = 'ngErrorLogger';
1017/**
1018 * @param {?} error
1019 * @return {?}
1020 */
1021/**
1022 * @param {?} error
1023 * @return {?}
1024 */
1025function getDebugContext(error) {
1026 return ((error))[ERROR_DEBUG_CONTEXT];
1027}
1028/**
1029 * @param {?} error
1030 * @return {?}
1031 */
1032function getOriginalError(error) {
1033 return ((error))[ERROR_ORIGINAL_ERROR];
1034}
1035/**
1036 * @param {?} error
1037 * @return {?}
1038 */
1039function getErrorLogger(error) {
1040 return ((error))[ERROR_LOGGER] || defaultErrorLogger;
1041}
1042/**
1043 * @param {?} console
1044 * @param {...?} values
1045 * @return {?}
1046 */
1047function defaultErrorLogger(console) {
1048 var values = [];
1049 for (var _i = 1; _i < arguments.length; _i++) {
1050 values[_i - 1] = arguments[_i];
1051 }
1052 console.error.apply(console, values);
1053}
1054/**
1055 * @license
1056 * Copyright Google Inc. All Rights Reserved.
1057 *
1058 * Use of this source code is governed by an MIT-style license that can be
1059 * found in the LICENSE file at https://angular.io/license
1060 */
1061/**
1062 * \@whatItDoes Provides a hook for centralized exception handling.
1063 *
1064 * \@description
1065 *
1066 * The default implementation of `ErrorHandler` prints error messages to the `console`. To
1067 * intercept error handling, write a custom exception handler that replaces this default as
1068 * appropriate for your app.
1069 *
1070 * ### Example
1071 *
1072 * ```
1073 * class MyErrorHandler implements ErrorHandler {
1074 * handleError(error) {
1075 * // do something with the exception
1076 * }
1077 * }
1078 *
1079 * \@NgModule({
1080 * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
1081 * })
1082 * class MyModule {}
1083 * ```
1084 *
1085 * \@stable
1086 */
1087var ErrorHandler = (function () {
1088 /**
1089 * @param {?=} deprecatedParameter
1090 */
1091 function ErrorHandler(
1092 /**
1093 * @deprecated since v4.0 parameter no longer has an effect, as ErrorHandler will never
1094 * rethrow.
1095 */
1096 deprecatedParameter) {
1097 /**
1098 * \@internal
1099 */
1100 this._console = console;
1101 }
1102 /**
1103 * @param {?} error
1104 * @return {?}
1105 */
1106 ErrorHandler.prototype.handleError = function (error) {
1107 var /** @type {?} */ originalError = this._findOriginalError(error);
1108 var /** @type {?} */ context = this._findContext(error);
1109 // Note: Browser consoles show the place from where console.error was called.
1110 // We can use this to give users additional information about the error.
1111 var /** @type {?} */ errorLogger = getErrorLogger(error);
1112 errorLogger(this._console, "ERROR", error);
1113 if (originalError) {
1114 errorLogger(this._console, "ORIGINAL ERROR", originalError);
1115 }
1116 if (context) {
1117 errorLogger(this._console, 'ERROR CONTEXT', context);
1118 }
1119 };
1120 /**
1121 * \@internal
1122 * @param {?} error
1123 * @return {?}
1124 */
1125 ErrorHandler.prototype._findContext = function (error) {
1126 if (error) {
1127 return getDebugContext(error) ? getDebugContext(error) :
1128 this._findContext(getOriginalError(error));
1129 }
1130 return null;
1131 };
1132 /**
1133 * \@internal
1134 * @param {?} error
1135 * @return {?}
1136 */
1137 ErrorHandler.prototype._findOriginalError = function (error) {
1138 var /** @type {?} */ e = getOriginalError(error);
1139 while (e && getOriginalError(e)) {
1140 e = getOriginalError(e);
1141 }
1142 return e;
1143 };
1144 return ErrorHandler;
1145}());
1146/**
1147 * @param {?} message
1148 * @param {?} originalError
1149 * @return {?}
1150 */
1151function wrappedError(message, originalError) {
1152 var /** @type {?} */ msg = message + " caused by: " + (originalError instanceof Error ? originalError.message : originalError);
1153 var /** @type {?} */ error = Error(msg);
1154 ((error))[ERROR_ORIGINAL_ERROR] = originalError;
1155 return error;
1156}
1157/**
1158 * @license
1159 * Copyright Google Inc. All Rights Reserved.
1160 *
1161 * Use of this source code is governed by an MIT-style license that can be
1162 * found in the LICENSE file at https://angular.io/license
1163 */
1164/**
1165 * @param {?} keys
1166 * @return {?}
1167 */
1168function findFirstClosedCycle(keys) {
1169 var /** @type {?} */ res = [];
1170 for (var /** @type {?} */ i = 0; i < keys.length; ++i) {
1171 if (res.indexOf(keys[i]) > -1) {
1172 res.push(keys[i]);
1173 return res;
1174 }
1175 res.push(keys[i]);
1176 }
1177 return res;
1178}
1179/**
1180 * @param {?} keys
1181 * @return {?}
1182 */
1183function constructResolvingPath(keys) {
1184 if (keys.length > 1) {
1185 var /** @type {?} */ reversed = findFirstClosedCycle(keys.slice().reverse());
1186 var /** @type {?} */ tokenStrs = reversed.map(function (k) { return stringify(k.token); });
1187 return ' (' + tokenStrs.join(' -> ') + ')';
1188 }
1189 return '';
1190}
1191/**
1192 * @param {?} injector
1193 * @param {?} key
1194 * @param {?} constructResolvingMessage
1195 * @param {?=} originalError
1196 * @return {?}
1197 */
1198function injectionError(injector, key, constructResolvingMessage, originalError) {
1199 var /** @type {?} */ keys = [key];
1200 var /** @type {?} */ errMsg = constructResolvingMessage(keys);
1201 var /** @type {?} */ error = ((originalError ? wrappedError(errMsg, originalError) : Error(errMsg)));
1202 error.addKey = addKey;
1203 error.keys = keys;
1204 error.injectors = [injector];
1205 error.constructResolvingMessage = constructResolvingMessage;
1206 ((error))[ERROR_ORIGINAL_ERROR] = originalError;
1207 return error;
1208}
1209/**
1210 * @this {?}
1211 * @param {?} injector
1212 * @param {?} key
1213 * @return {?}
1214 */
1215function addKey(injector, key) {
1216 this.injectors.push(injector);
1217 this.keys.push(key);
1218 // Note: This updated message won't be reflected in the `.stack` property
1219 this.message = this.constructResolvingMessage(this.keys);
1220}
1221/**
1222 * Thrown when trying to retrieve a dependency by key from {\@link Injector}, but the
1223 * {\@link Injector} does not have a {\@link Provider} for the given key.
1224 *
1225 * ### Example ([live demo](http://plnkr.co/edit/vq8D3FRB9aGbnWJqtEPE?p=preview))
1226 *
1227 * ```typescript
1228 * class A {
1229 * constructor(b:B) {}
1230 * }
1231 *
1232 * expect(() => Injector.resolveAndCreate([A])).toThrowError();
1233 * ```
1234 * @param {?} injector
1235 * @param {?} key
1236 * @return {?}
1237 */
1238function noProviderError(injector, key) {
1239 return injectionError(injector, key, function (keys) {
1240 var /** @type {?} */ first = stringify(keys[0].token);
1241 return "No provider for " + first + "!" + constructResolvingPath(keys);
1242 });
1243}
1244/**
1245 * Thrown when dependencies form a cycle.
1246 *
1247 * ### Example ([live demo](http://plnkr.co/edit/wYQdNos0Tzql3ei1EV9j?p=info))
1248 *
1249 * ```typescript
1250 * var injector = Injector.resolveAndCreate([
1251 * {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]},
1252 * {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]}
1253 * ]);
1254 *
1255 * expect(() => injector.get("one")).toThrowError();
1256 * ```
1257 *
1258 * Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed.
1259 * @param {?} injector
1260 * @param {?} key
1261 * @return {?}
1262 */
1263function cyclicDependencyError(injector, key) {
1264 return injectionError(injector, key, function (keys) {
1265 return "Cannot instantiate cyclic dependency!" + constructResolvingPath(keys);
1266 });
1267}
1268/**
1269 * Thrown when a constructing type returns with an Error.
1270 *
1271 * The `InstantiationError` class contains the original error plus the dependency graph which caused
1272 * this object to be instantiated.
1273 *
1274 * ### Example ([live demo](http://plnkr.co/edit/7aWYdcqTQsP0eNqEdUAf?p=preview))
1275 *
1276 * ```typescript
1277 * class A {
1278 * constructor() {
1279 * throw new Error('message');
1280 * }
1281 * }
1282 *
1283 * var injector = Injector.resolveAndCreate([A]);
1284 * try {
1285 * injector.get(A);
1286 * } catch (e) {
1287 * expect(e instanceof InstantiationError).toBe(true);
1288 * expect(e.originalException.message).toEqual("message");
1289 * expect(e.originalStack).toBeDefined();
1290 * }
1291 * ```
1292 * @param {?} injector
1293 * @param {?} originalException
1294 * @param {?} originalStack
1295 * @param {?} key
1296 * @return {?}
1297 */
1298function instantiationError(injector, originalException, originalStack, key) {
1299 return injectionError(injector, key, function (keys) {
1300 var /** @type {?} */ first = stringify(keys[0].token);
1301 return originalException.message + ": Error during instantiation of " + first + "!" + constructResolvingPath(keys) + ".";
1302 }, originalException);
1303}
1304/**
1305 * Thrown when an object other then {\@link Provider} (or `Type`) is passed to {\@link Injector}
1306 * creation.
1307 *
1308 * ### Example ([live demo](http://plnkr.co/edit/YatCFbPAMCL0JSSQ4mvH?p=preview))
1309 *
1310 * ```typescript
1311 * expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError();
1312 * ```
1313 * @param {?} provider
1314 * @return {?}
1315 */
1316function invalidProviderError(provider) {
1317 return Error("Invalid provider - only instances of Provider and Type are allowed, got: " + provider);
1318}
1319/**
1320 * Thrown when the class has no annotation information.
1321 *
1322 * Lack of annotation information prevents the {\@link Injector} from determining which dependencies
1323 * need to be injected into the constructor.
1324 *
1325 * ### Example ([live demo](http://plnkr.co/edit/rHnZtlNS7vJOPQ6pcVkm?p=preview))
1326 *
1327 * ```typescript
1328 * class A {
1329 * constructor(b) {}
1330 * }
1331 *
1332 * expect(() => Injector.resolveAndCreate([A])).toThrowError();
1333 * ```
1334 *
1335 * This error is also thrown when the class not marked with {\@link Injectable} has parameter types.
1336 *
1337 * ```typescript
1338 * class B {}
1339 *
1340 * class A {
1341 * constructor(b:B) {} // no information about the parameter types of A is available at runtime.
1342 * }
1343 *
1344 * expect(() => Injector.resolveAndCreate([A,B])).toThrowError();
1345 * ```
1346 * \@stable
1347 * @param {?} typeOrFunc
1348 * @param {?} params
1349 * @return {?}
1350 */
1351function noAnnotationError(typeOrFunc, params) {
1352 var /** @type {?} */ signature = [];
1353 for (var /** @type {?} */ i = 0, /** @type {?} */ ii = params.length; i < ii; i++) {
1354 var /** @type {?} */ parameter = params[i];
1355 if (!parameter || parameter.length == 0) {
1356 signature.push('?');
1357 }
1358 else {
1359 signature.push(parameter.map(stringify).join(' '));
1360 }
1361 }
1362 return Error('Cannot resolve all parameters for \'' + stringify(typeOrFunc) + '\'(' +
1363 signature.join(', ') + '). ' +
1364 'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' +
1365 stringify(typeOrFunc) + '\' is decorated with Injectable.');
1366}
1367/**
1368 * Thrown when getting an object by index.
1369 *
1370 * ### Example ([live demo](http://plnkr.co/edit/bRs0SX2OTQiJzqvjgl8P?p=preview))
1371 *
1372 * ```typescript
1373 * class A {}
1374 *
1375 * var injector = Injector.resolveAndCreate([A]);
1376 *
1377 * expect(() => injector.getAt(100)).toThrowError();
1378 * ```
1379 * \@stable
1380 * @param {?} index
1381 * @return {?}
1382 */
1383function outOfBoundsError(index) {
1384 return Error("Index " + index + " is out-of-bounds.");
1385}
1386/**
1387 * Thrown when a multi provider and a regular provider are bound to the same token.
1388 *
1389 * ### Example
1390 *
1391 * ```typescript
1392 * expect(() => Injector.resolveAndCreate([
1393 * { provide: "Strings", useValue: "string1", multi: true},
1394 * { provide: "Strings", useValue: "string2", multi: false}
1395 * ])).toThrowError();
1396 * ```
1397 * @param {?} provider1
1398 * @param {?} provider2
1399 * @return {?}
1400 */
1401function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) {
1402 return Error("Cannot mix multi providers and regular providers, got: " + provider1 + " " + provider2);
1403}
1404/**
1405 * @license
1406 * Copyright Google Inc. All Rights Reserved.
1407 *
1408 * Use of this source code is governed by an MIT-style license that can be
1409 * found in the LICENSE file at https://angular.io/license
1410 */
1411/**
1412 * A unique object used for retrieving items from the {\@link ReflectiveInjector}.
1413 *
1414 * Keys have:
1415 * - a system-wide unique `id`.
1416 * - a `token`.
1417 *
1418 * `Key` is used internally by {\@link ReflectiveInjector} because its system-wide unique `id` allows
1419 * the
1420 * injector to store created objects in a more efficient way.
1421 *
1422 * `Key` should not be created directly. {\@link ReflectiveInjector} creates keys automatically when
1423 * resolving
1424 * providers.
1425 * \@experimental
1426 */
1427var ReflectiveKey = (function () {
1428 /**
1429 * Private
1430 * @param {?} token
1431 * @param {?} id
1432 */
1433 function ReflectiveKey(token, id) {
1434 this.token = token;
1435 this.id = id;
1436 if (!token) {
1437 throw new Error('Token must be defined!');
1438 }
1439 }
1440 Object.defineProperty(ReflectiveKey.prototype, "displayName", {
1441 /**
1442 * Returns a stringified token.
1443 * @return {?}
1444 */
1445 get: function () { return stringify(this.token); },
1446 enumerable: true,
1447 configurable: true
1448 });
1449 /**
1450 * Retrieves a `Key` for a token.
1451 * @param {?} token
1452 * @return {?}
1453 */
1454 ReflectiveKey.get = function (token) {
1455 return _globalKeyRegistry.get(resolveForwardRef(token));
1456 };
1457 Object.defineProperty(ReflectiveKey, "numberOfKeys", {
1458 /**
1459 * @return {?} the number of keys registered in the system.
1460 */
1461 get: function () { return _globalKeyRegistry.numberOfKeys; },
1462 enumerable: true,
1463 configurable: true
1464 });
1465 return ReflectiveKey;
1466}());
1467/**
1468 * \@internal
1469 */
1470var KeyRegistry = (function () {
1471 function KeyRegistry() {
1472 this._allKeys = new Map();
1473 }
1474 /**
1475 * @param {?} token
1476 * @return {?}
1477 */
1478 KeyRegistry.prototype.get = function (token) {
1479 if (token instanceof ReflectiveKey)
1480 return token;
1481 if (this._allKeys.has(token)) {
1482 return ((this._allKeys.get(token)));
1483 }
1484 var /** @type {?} */ newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys);
1485 this._allKeys.set(token, newKey);
1486 return newKey;
1487 };
1488 Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", {
1489 /**
1490 * @return {?}
1491 */
1492 get: function () { return this._allKeys.size; },
1493 enumerable: true,
1494 configurable: true
1495 });
1496 return KeyRegistry;
1497}());
1498var _globalKeyRegistry = new KeyRegistry();
1499/**
1500 * \@whatItDoes Represents a type that a Component or other object is instances of.
1501 *
1502 * \@description
1503 *
1504 * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
1505 * the `MyCustomComponent` constructor function.
1506 *
1507 * \@stable
1508 */
1509var Type = Function;
1510/**
1511 * @param {?} v
1512 * @return {?}
1513 */
1514function isType(v) {
1515 return typeof v === 'function';
1516}
1517/**
1518 * @license
1519 * Copyright Google Inc. All Rights Reserved.
1520 *
1521 * Use of this source code is governed by an MIT-style license that can be
1522 * found in the LICENSE file at https://angular.io/license
1523 */
1524/**
1525 * Attention: This regex has to hold even if the code is minified!
1526 */
1527var DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*arguments\)/;
1528var ReflectionCapabilities = (function () {
1529 /**
1530 * @param {?=} reflect
1531 */
1532 function ReflectionCapabilities(reflect) {
1533 this._reflect = reflect || _global['Reflect'];
1534 }
1535 /**
1536 * @return {?}
1537 */
1538 ReflectionCapabilities.prototype.isReflectionEnabled = function () { return true; };
1539 /**
1540 * @template T
1541 * @param {?} t
1542 * @return {?}
1543 */
1544 ReflectionCapabilities.prototype.factory = function (t) { return function () {
1545 var args = [];
1546 for (var _i = 0; _i < arguments.length; _i++) {
1547 args[_i] = arguments[_i];
1548 }
1549 return new (t.bind.apply(t, [void 0].concat(args)))();
1550 }; };
1551 /**
1552 * \@internal
1553 * @param {?} paramTypes
1554 * @param {?} paramAnnotations
1555 * @return {?}
1556 */
1557 ReflectionCapabilities.prototype._zipTypesAndAnnotations = function (paramTypes, paramAnnotations) {
1558 var /** @type {?} */ result;
1559 if (typeof paramTypes === 'undefined') {
1560 result = new Array(paramAnnotations.length);
1561 }
1562 else {
1563 result = new Array(paramTypes.length);
1564 }
1565 for (var /** @type {?} */ i = 0; i < result.length; i++) {
1566 // TS outputs Object for parameters without types, while Traceur omits
1567 // the annotations. For now we preserve the Traceur behavior to aid
1568 // migration, but this can be revisited.
1569 if (typeof paramTypes === 'undefined') {
1570 result[i] = [];
1571 }
1572 else if (paramTypes[i] != Object) {
1573 result[i] = [paramTypes[i]];
1574 }
1575 else {
1576 result[i] = [];
1577 }
1578 if (paramAnnotations && paramAnnotations[i] != null) {
1579 result[i] = result[i].concat(paramAnnotations[i]);
1580 }
1581 }
1582 return result;
1583 };
1584 /**
1585 * @param {?} type
1586 * @param {?} parentCtor
1587 * @return {?}
1588 */
1589 ReflectionCapabilities.prototype._ownParameters = function (type, parentCtor) {
1590 // If we have no decorators, we only have function.length as metadata.
1591 // In that case, to detect whether a child class declared an own constructor or not,
1592 // we need to look inside of that constructor to check whether it is
1593 // just calling the parent.
1594 // This also helps to work around for https://github.com/Microsoft/TypeScript/issues/12439
1595 // that sets 'design:paramtypes' to []
1596 // if a class inherits from another class but has no ctor declared itself.
1597 if (DELEGATE_CTOR.exec(type.toString())) {
1598 return null;
1599 }
1600 // Prefer the direct API.
1601 if (((type)).parameters && ((type)).parameters !== parentCtor.parameters) {
1602 return ((type)).parameters;
1603 }
1604 // API of tsickle for lowering decorators to properties on the class.
1605 var /** @type {?} */ tsickleCtorParams = ((type)).ctorParameters;
1606 if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) {
1607 // Newer tsickle uses a function closure
1608 // Retain the non-function case for compatibility with older tsickle
1609 var /** @type {?} */ ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams;
1610 var /** @type {?} */ paramTypes = ctorParameters.map(function (ctorParam) { return ctorParam && ctorParam.type; });
1611 var /** @type {?} */ paramAnnotations = ctorParameters.map(function (ctorParam) { return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators); });
1612 return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
1613 }
1614 // API for metadata created by invoking the decorators.
1615 if (this._reflect != null && this._reflect.getOwnMetadata != null) {
1616 var /** @type {?} */ paramAnnotations = this._reflect.getOwnMetadata('parameters', type);
1617 var /** @type {?} */ paramTypes = this._reflect.getOwnMetadata('design:paramtypes', type);
1618 if (paramTypes || paramAnnotations) {
1619 return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
1620 }
1621 }
1622 // If a class has no decorators, at least create metadata
1623 // based on function.length.
1624 // Note: We know that this is a real constructor as we checked
1625 // the content of the constructor above.
1626 return new Array(((type.length))).fill(undefined);
1627 };
1628 /**
1629 * @param {?} type
1630 * @return {?}
1631 */
1632 ReflectionCapabilities.prototype.parameters = function (type) {
1633 // Note: only report metadata if we have at least one class decorator
1634 // to stay in sync with the static reflector.
1635 if (!isType(type)) {
1636 return [];
1637 }
1638 var /** @type {?} */ parentCtor = getParentCtor(type);
1639 var /** @type {?} */ parameters = this._ownParameters(type, parentCtor);
1640 if (!parameters && parentCtor !== Object) {
1641 parameters = this.parameters(parentCtor);
1642 }
1643 return parameters || [];
1644 };
1645 /**
1646 * @param {?} typeOrFunc
1647 * @param {?} parentCtor
1648 * @return {?}
1649 */
1650 ReflectionCapabilities.prototype._ownAnnotations = function (typeOrFunc, parentCtor) {
1651 // Prefer the direct API.
1652 if (((typeOrFunc)).annotations && ((typeOrFunc)).annotations !== parentCtor.annotations) {
1653 var /** @type {?} */ annotations = ((typeOrFunc)).annotations;
1654 if (typeof annotations === 'function' && annotations.annotations) {
1655 annotations = annotations.annotations;
1656 }
1657 return annotations;
1658 }
1659 // API of tsickle for lowering decorators to properties on the class.
1660 if (((typeOrFunc)).decorators && ((typeOrFunc)).decorators !== parentCtor.decorators) {
1661 return convertTsickleDecoratorIntoMetadata(((typeOrFunc)).decorators);
1662 }
1663 // API for metadata created by invoking the decorators.
1664 if (this._reflect && this._reflect.getOwnMetadata) {
1665 return this._reflect.getOwnMetadata('annotations', typeOrFunc);
1666 }
1667 return null;
1668 };
1669 /**
1670 * @param {?} typeOrFunc
1671 * @return {?}
1672 */
1673 ReflectionCapabilities.prototype.annotations = function (typeOrFunc) {
1674 if (!isType(typeOrFunc)) {
1675 return [];
1676 }
1677 var /** @type {?} */ parentCtor = getParentCtor(typeOrFunc);
1678 var /** @type {?} */ ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || [];
1679 var /** @type {?} */ parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : [];
1680 return parentAnnotations.concat(ownAnnotations);
1681 };
1682 /**
1683 * @param {?} typeOrFunc
1684 * @param {?} parentCtor
1685 * @return {?}
1686 */
1687 ReflectionCapabilities.prototype._ownPropMetadata = function (typeOrFunc, parentCtor) {
1688 // Prefer the direct API.
1689 if (((typeOrFunc)).propMetadata &&
1690 ((typeOrFunc)).propMetadata !== parentCtor.propMetadata) {
1691 var /** @type {?} */ propMetadata = ((typeOrFunc)).propMetadata;
1692 if (typeof propMetadata === 'function' && propMetadata.propMetadata) {
1693 propMetadata = propMetadata.propMetadata;
1694 }
1695 return propMetadata;
1696 }
1697 // API of tsickle for lowering decorators to properties on the class.
1698 if (((typeOrFunc)).propDecorators &&
1699 ((typeOrFunc)).propDecorators !== parentCtor.propDecorators) {
1700 var /** @type {?} */ propDecorators_1 = ((typeOrFunc)).propDecorators;
1701 var /** @type {?} */ propMetadata_1 = ({});
1702 Object.keys(propDecorators_1).forEach(function (prop) {
1703 propMetadata_1[prop] = convertTsickleDecoratorIntoMetadata(propDecorators_1[prop]);
1704 });
1705 return propMetadata_1;
1706 }
1707 // API for metadata created by invoking the decorators.
1708 if (this._reflect && this._reflect.getOwnMetadata) {
1709 return this._reflect.getOwnMetadata('propMetadata', typeOrFunc);
1710 }
1711 return null;
1712 };
1713 /**
1714 * @param {?} typeOrFunc
1715 * @return {?}
1716 */
1717 ReflectionCapabilities.prototype.propMetadata = function (typeOrFunc) {
1718 if (!isType(typeOrFunc)) {
1719 return {};
1720 }
1721 var /** @type {?} */ parentCtor = getParentCtor(typeOrFunc);
1722 var /** @type {?} */ propMetadata = {};
1723 if (parentCtor !== Object) {
1724 var /** @type {?} */ parentPropMetadata_1 = this.propMetadata(parentCtor);
1725 Object.keys(parentPropMetadata_1).forEach(function (propName) {
1726 propMetadata[propName] = parentPropMetadata_1[propName];
1727 });
1728 }
1729 var /** @type {?} */ ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);
1730 if (ownPropMetadata) {
1731 Object.keys(ownPropMetadata).forEach(function (propName) {
1732 var /** @type {?} */ decorators = [];
1733 if (propMetadata.hasOwnProperty(propName)) {
1734 decorators.push.apply(decorators, propMetadata[propName]);
1735 }
1736 decorators.push.apply(decorators, ownPropMetadata[propName]);
1737 propMetadata[propName] = decorators;
1738 });
1739 }
1740 return propMetadata;
1741 };
1742 /**
1743 * @param {?} type
1744 * @param {?} lcProperty
1745 * @return {?}
1746 */
1747 ReflectionCapabilities.prototype.hasLifecycleHook = function (type, lcProperty) {
1748 return type instanceof Type && lcProperty in type.prototype;
1749 };
1750 /**
1751 * @param {?} name
1752 * @return {?}
1753 */
1754 ReflectionCapabilities.prototype.getter = function (name) { return (new Function('o', 'return o.' + name + ';')); };
1755 /**
1756 * @param {?} name
1757 * @return {?}
1758 */
1759 ReflectionCapabilities.prototype.setter = function (name) {
1760 return (new Function('o', 'v', 'return o.' + name + ' = v;'));
1761 };
1762 /**
1763 * @param {?} name
1764 * @return {?}
1765 */
1766 ReflectionCapabilities.prototype.method = function (name) {
1767 var /** @type {?} */ functionBody = "if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);";
1768 return (new Function('o', 'args', functionBody));
1769 };
1770 /**
1771 * @param {?} type
1772 * @return {?}
1773 */
1774 ReflectionCapabilities.prototype.importUri = function (type) {
1775 // StaticSymbol
1776 if (typeof type === 'object' && type['filePath']) {
1777 return type['filePath'];
1778 }
1779 // Runtime type
1780 return "./" + stringify(type);
1781 };
1782 /**
1783 * @param {?} type
1784 * @return {?}
1785 */
1786 ReflectionCapabilities.prototype.resourceUri = function (type) { return "./" + stringify(type); };
1787 /**
1788 * @param {?} name
1789 * @param {?} moduleUrl
1790 * @param {?} members
1791 * @param {?} runtime
1792 * @return {?}
1793 */
1794 ReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) {
1795 return runtime;
1796 };
1797 /**
1798 * @param {?} enumIdentifier
1799 * @param {?} name
1800 * @return {?}
1801 */
1802 ReflectionCapabilities.prototype.resolveEnum = function (enumIdentifier, name) { return enumIdentifier[name]; };
1803 return ReflectionCapabilities;
1804}());
1805/**
1806 * @param {?} decoratorInvocations
1807 * @return {?}
1808 */
1809function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
1810 if (!decoratorInvocations) {
1811 return [];
1812 }
1813 return decoratorInvocations.map(function (decoratorInvocation) {
1814 var /** @type {?} */ decoratorType = decoratorInvocation.type;
1815 var /** @type {?} */ annotationCls = decoratorType.annotationCls;
1816 var /** @type {?} */ annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
1817 return new (annotationCls.bind.apply(annotationCls, [void 0].concat(annotationArgs)))();
1818 });
1819}
1820/**
1821 * @param {?} ctor
1822 * @return {?}
1823 */
1824function getParentCtor(ctor) {
1825 var /** @type {?} */ parentProto = Object.getPrototypeOf(ctor.prototype);
1826 var /** @type {?} */ parentCtor = parentProto ? parentProto.constructor : null;
1827 // Note: We always use `Object` as the null value
1828 // to simplify checking later on.
1829 return parentCtor || Object;
1830}
1831/**
1832 * @license
1833 * Copyright Google Inc. All Rights Reserved.
1834 *
1835 * Use of this source code is governed by an MIT-style license that can be
1836 * found in the LICENSE file at https://angular.io/license
1837 */
1838/**
1839 * Provides access to reflection data about symbols. Used internally by Angular
1840 * to power dependency injection and compilation.
1841 */
1842var Reflector = (function () {
1843 /**
1844 * @param {?} reflectionCapabilities
1845 */
1846 function Reflector(reflectionCapabilities) {
1847 this.reflectionCapabilities = reflectionCapabilities;
1848 }
1849 /**
1850 * @param {?} caps
1851 * @return {?}
1852 */
1853 Reflector.prototype.updateCapabilities = function (caps) { this.reflectionCapabilities = caps; };
1854 /**
1855 * @param {?} type
1856 * @return {?}
1857 */
1858 Reflector.prototype.factory = function (type) { return this.reflectionCapabilities.factory(type); };
1859 /**
1860 * @param {?} typeOrFunc
1861 * @return {?}
1862 */
1863 Reflector.prototype.parameters = function (typeOrFunc) {
1864 return this.reflectionCapabilities.parameters(typeOrFunc);
1865 };
1866 /**
1867 * @param {?} typeOrFunc
1868 * @return {?}
1869 */
1870 Reflector.prototype.annotations = function (typeOrFunc) {
1871 return this.reflectionCapabilities.annotations(typeOrFunc);
1872 };
1873 /**
1874 * @param {?} typeOrFunc
1875 * @return {?}
1876 */
1877 Reflector.prototype.propMetadata = function (typeOrFunc) {
1878 return this.reflectionCapabilities.propMetadata(typeOrFunc);
1879 };
1880 /**
1881 * @param {?} type
1882 * @param {?} lcProperty
1883 * @return {?}
1884 */
1885 Reflector.prototype.hasLifecycleHook = function (type, lcProperty) {
1886 return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
1887 };
1888 /**
1889 * @param {?} name
1890 * @return {?}
1891 */
1892 Reflector.prototype.getter = function (name) { return this.reflectionCapabilities.getter(name); };
1893 /**
1894 * @param {?} name
1895 * @return {?}
1896 */
1897 Reflector.prototype.setter = function (name) { return this.reflectionCapabilities.setter(name); };
1898 /**
1899 * @param {?} name
1900 * @return {?}
1901 */
1902 Reflector.prototype.method = function (name) { return this.reflectionCapabilities.method(name); };
1903 /**
1904 * @param {?} type
1905 * @return {?}
1906 */
1907 Reflector.prototype.importUri = function (type) { return this.reflectionCapabilities.importUri(type); };
1908 /**
1909 * @param {?} type
1910 * @return {?}
1911 */
1912 Reflector.prototype.resourceUri = function (type) { return this.reflectionCapabilities.resourceUri(type); };
1913 /**
1914 * @param {?} name
1915 * @param {?} moduleUrl
1916 * @param {?} members
1917 * @param {?} runtime
1918 * @return {?}
1919 */
1920 Reflector.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) {
1921 return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime);
1922 };
1923 /**
1924 * @param {?} identifier
1925 * @param {?} name
1926 * @return {?}
1927 */
1928 Reflector.prototype.resolveEnum = function (identifier, name) {
1929 return this.reflectionCapabilities.resolveEnum(identifier, name);
1930 };
1931 return Reflector;
1932}());
1933/**
1934 * @license
1935 * Copyright Google Inc. All Rights Reserved.
1936 *
1937 * Use of this source code is governed by an MIT-style license that can be
1938 * found in the LICENSE file at https://angular.io/license
1939 */
1940/**
1941 * The {\@link Reflector} used internally in Angular to access metadata
1942 * about symbols.
1943 */
1944var reflector = new Reflector(new ReflectionCapabilities());
1945/**
1946 * @license
1947 * Copyright Google Inc. All Rights Reserved.
1948 *
1949 * Use of this source code is governed by an MIT-style license that can be
1950 * found in the LICENSE file at https://angular.io/license
1951 */
1952/**
1953 * `Dependency` is used by the framework to extend DI.
1954 * This is internal to Angular and should not be used directly.
1955 */
1956var ReflectiveDependency = (function () {
1957 /**
1958 * @param {?} key
1959 * @param {?} optional
1960 * @param {?} visibility
1961 */
1962 function ReflectiveDependency(key, optional, visibility) {
1963 this.key = key;
1964 this.optional = optional;
1965 this.visibility = visibility;
1966 }
1967 /**
1968 * @param {?} key
1969 * @return {?}
1970 */
1971 ReflectiveDependency.fromKey = function (key) {
1972 return new ReflectiveDependency(key, false, null);
1973 };
1974 return ReflectiveDependency;
1975}());
1976var _EMPTY_LIST = [];
1977var ResolvedReflectiveProvider_ = (function () {
1978 /**
1979 * @param {?} key
1980 * @param {?} resolvedFactories
1981 * @param {?} multiProvider
1982 */
1983 function ResolvedReflectiveProvider_(key, resolvedFactories, multiProvider) {
1984 this.key = key;
1985 this.resolvedFactories = resolvedFactories;
1986 this.multiProvider = multiProvider;
1987 }
1988 Object.defineProperty(ResolvedReflectiveProvider_.prototype, "resolvedFactory", {
1989 /**
1990 * @return {?}
1991 */
1992 get: function () { return this.resolvedFactories[0]; },
1993 enumerable: true,
1994 configurable: true
1995 });
1996 return ResolvedReflectiveProvider_;
1997}());
1998/**
1999 * An internal resolved representation of a factory function created by resolving {\@link
2000 * Provider}.
2001 * \@experimental
2002 */
2003var ResolvedReflectiveFactory = (function () {
2004 /**
2005 * @param {?} factory
2006 * @param {?} dependencies
2007 */
2008 function ResolvedReflectiveFactory(factory, dependencies) {
2009 this.factory = factory;
2010 this.dependencies = dependencies;
2011 }
2012 return ResolvedReflectiveFactory;
2013}());
2014/**
2015 * Resolve a single provider.
2016 * @param {?} provider
2017 * @return {?}
2018 */
2019function resolveReflectiveFactory(provider) {
2020 var /** @type {?} */ factoryFn;
2021 var /** @type {?} */ resolvedDeps;
2022 if (provider.useClass) {
2023 var /** @type {?} */ useClass = resolveForwardRef(provider.useClass);
2024 factoryFn = reflector.factory(useClass);
2025 resolvedDeps = _dependenciesFor(useClass);
2026 }
2027 else if (provider.useExisting) {
2028 factoryFn = function (aliasInstance) { return aliasInstance; };
2029 resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))];
2030 }
2031 else if (provider.useFactory) {
2032 factoryFn = provider.useFactory;
2033 resolvedDeps = constructDependencies(provider.useFactory, provider.deps);
2034 }
2035 else {
2036 factoryFn = function () { return provider.useValue; };
2037 resolvedDeps = _EMPTY_LIST;
2038 }
2039 return new ResolvedReflectiveFactory(factoryFn, resolvedDeps);
2040}
2041/**
2042 * Converts the {\@link Provider} into {\@link ResolvedProvider}.
2043 *
2044 * {\@link Injector} internally only uses {\@link ResolvedProvider}, {\@link Provider} contains
2045 * convenience provider syntax.
2046 * @param {?} provider
2047 * @return {?}
2048 */
2049function resolveReflectiveProvider(provider) {
2050 return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false);
2051}
2052/**
2053 * Resolve a list of Providers.
2054 * @param {?} providers
2055 * @return {?}
2056 */
2057function resolveReflectiveProviders(providers) {
2058 var /** @type {?} */ normalized = _normalizeProviders(providers, []);
2059 var /** @type {?} */ resolved = normalized.map(resolveReflectiveProvider);
2060 var /** @type {?} */ resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map());
2061 return Array.from(resolvedProviderMap.values());
2062}
2063/**
2064 * Merges a list of ResolvedProviders into a list where
2065 * each key is contained exactly once and multi providers
2066 * have been merged.
2067 * @param {?} providers
2068 * @param {?} normalizedProvidersMap
2069 * @return {?}
2070 */
2071function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) {
2072 for (var /** @type {?} */ i = 0; i < providers.length; i++) {
2073 var /** @type {?} */ provider = providers[i];
2074 var /** @type {?} */ existing = normalizedProvidersMap.get(provider.key.id);
2075 if (existing) {
2076 if (provider.multiProvider !== existing.multiProvider) {
2077 throw mixingMultiProvidersWithRegularProvidersError(existing, provider);
2078 }
2079 if (provider.multiProvider) {
2080 for (var /** @type {?} */ j = 0; j < provider.resolvedFactories.length; j++) {
2081 existing.resolvedFactories.push(provider.resolvedFactories[j]);
2082 }
2083 }
2084 else {
2085 normalizedProvidersMap.set(provider.key.id, provider);
2086 }
2087 }
2088 else {
2089 var /** @type {?} */ resolvedProvider = void 0;
2090 if (provider.multiProvider) {
2091 resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider);
2092 }
2093 else {
2094 resolvedProvider = provider;
2095 }
2096 normalizedProvidersMap.set(provider.key.id, resolvedProvider);
2097 }
2098 }
2099 return normalizedProvidersMap;
2100}
2101/**
2102 * @param {?} providers
2103 * @param {?} res
2104 * @return {?}
2105 */
2106function _normalizeProviders(providers, res) {
2107 providers.forEach(function (b) {
2108 if (b instanceof Type) {
2109 res.push({ provide: b, useClass: b });
2110 }
2111 else if (b && typeof b == 'object' && ((b)).provide !== undefined) {
2112 res.push(/** @type {?} */ (b));
2113 }
2114 else if (b instanceof Array) {
2115 _normalizeProviders(b, res);
2116 }
2117 else {
2118 throw invalidProviderError(b);
2119 }
2120 });
2121 return res;
2122}
2123/**
2124 * @param {?} typeOrFunc
2125 * @param {?=} dependencies
2126 * @return {?}
2127 */
2128function constructDependencies(typeOrFunc, dependencies) {
2129 if (!dependencies) {
2130 return _dependenciesFor(typeOrFunc);
2131 }
2132 else {
2133 var /** @type {?} */ params_1 = dependencies.map(function (t) { return [t]; });
2134 return dependencies.map(function (t) { return _extractToken(typeOrFunc, t, params_1); });
2135 }
2136}
2137/**
2138 * @param {?} typeOrFunc
2139 * @return {?}
2140 */
2141function _dependenciesFor(typeOrFunc) {
2142 var /** @type {?} */ params = reflector.parameters(typeOrFunc);
2143 if (!params)
2144 return [];
2145 if (params.some(function (p) { return p == null; })) {
2146 throw noAnnotationError(typeOrFunc, params);
2147 }
2148 return params.map(function (p) { return _extractToken(typeOrFunc, p, params); });
2149}
2150/**
2151 * @param {?} typeOrFunc
2152 * @param {?} metadata
2153 * @param {?} params
2154 * @return {?}
2155 */
2156function _extractToken(typeOrFunc, metadata, params) {
2157 var /** @type {?} */ token = null;
2158 var /** @type {?} */ optional = false;
2159 if (!Array.isArray(metadata)) {
2160 if (metadata instanceof Inject) {
2161 return _createDependency(metadata.token, optional, null);
2162 }
2163 else {
2164 return _createDependency(metadata, optional, null);
2165 }
2166 }
2167 var /** @type {?} */ visibility = null;
2168 for (var /** @type {?} */ i = 0; i < metadata.length; ++i) {
2169 var /** @type {?} */ paramMetadata = metadata[i];
2170 if (paramMetadata instanceof Type) {
2171 token = paramMetadata;
2172 }
2173 else if (paramMetadata instanceof Inject) {
2174 token = paramMetadata.token;
2175 }
2176 else if (paramMetadata instanceof Optional) {
2177 optional = true;
2178 }
2179 else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) {
2180 visibility = paramMetadata;
2181 }
2182 else if (paramMetadata instanceof InjectionToken) {
2183 token = paramMetadata;
2184 }
2185 }
2186 token = resolveForwardRef(token);
2187 if (token != null) {
2188 return _createDependency(token, optional, visibility);
2189 }
2190 else {
2191 throw noAnnotationError(typeOrFunc, params);
2192 }
2193}
2194/**
2195 * @param {?} token
2196 * @param {?} optional
2197 * @param {?} visibility
2198 * @return {?}
2199 */
2200function _createDependency(token, optional, visibility) {
2201 return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility);
2202}
2203/**
2204 * @license
2205 * Copyright Google Inc. All Rights Reserved.
2206 *
2207 * Use of this source code is governed by an MIT-style license that can be
2208 * found in the LICENSE file at https://angular.io/license
2209 */
2210// Threshold for the dynamic version
2211var UNDEFINED = new Object();
2212/**
2213 * A ReflectiveDependency injection container used for instantiating objects and resolving
2214 * dependencies.
2215 *
2216 * An `Injector` is a replacement for a `new` operator, which can automatically resolve the
2217 * constructor dependencies.
2218 *
2219 * In typical use, application code asks for the dependencies in the constructor and they are
2220 * resolved by the `Injector`.
2221 *
2222 * ### Example ([live demo](http://plnkr.co/edit/jzjec0?p=preview))
2223 *
2224 * The following example creates an `Injector` configured to create `Engine` and `Car`.
2225 *
2226 * ```typescript
2227 * \@Injectable()
2228 * class Engine {
2229 * }
2230 *
2231 * \@Injectable()
2232 * class Car {
2233 * constructor(public engine:Engine) {}
2234 * }
2235 *
2236 * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
2237 * var car = injector.get(Car);
2238 * expect(car instanceof Car).toBe(true);
2239 * expect(car.engine instanceof Engine).toBe(true);
2240 * ```
2241 *
2242 * Notice, we don't use the `new` operator because we explicitly want to have the `Injector`
2243 * resolve all of the object's dependencies automatically.
2244 *
2245 * \@stable
2246 * @abstract
2247 */
2248var ReflectiveInjector = (function () {
2249 function ReflectiveInjector() {
2250 }
2251 /**
2252 * Turns an array of provider definitions into an array of resolved providers.
2253 *
2254 * A resolution is a process of flattening multiple nested arrays and converting individual
2255 * providers into an array of {\@link ResolvedReflectiveProvider}s.
2256 *
2257 * ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview))
2258 *
2259 * ```typescript
2260 * \@Injectable()
2261 * class Engine {
2262 * }
2263 *
2264 * \@Injectable()
2265 * class Car {
2266 * constructor(public engine:Engine) {}
2267 * }
2268 *
2269 * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]);
2270 *
2271 * expect(providers.length).toEqual(2);
2272 *
2273 * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true);
2274 * expect(providers[0].key.displayName).toBe("Car");
2275 * expect(providers[0].dependencies.length).toEqual(1);
2276 * expect(providers[0].factory).toBeDefined();
2277 *
2278 * expect(providers[1].key.displayName).toBe("Engine");
2279 * });
2280 * ```
2281 *
2282 * See {\@link ReflectiveInjector#fromResolvedProviders} for more info.
2283 * @param {?} providers
2284 * @return {?}
2285 */
2286 ReflectiveInjector.resolve = function (providers) {
2287 return resolveReflectiveProviders(providers);
2288 };
2289 /**
2290 * Resolves an array of providers and creates an injector from those providers.
2291 *
2292 * The passed-in providers can be an array of `Type`, {\@link Provider},
2293 * or a recursive array of more providers.
2294 *
2295 * ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview))
2296 *
2297 * ```typescript
2298 * \@Injectable()
2299 * class Engine {
2300 * }
2301 *
2302 * \@Injectable()
2303 * class Car {
2304 * constructor(public engine:Engine) {}
2305 * }
2306 *
2307 * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
2308 * expect(injector.get(Car) instanceof Car).toBe(true);
2309 * ```
2310 *
2311 * This function is slower than the corresponding `fromResolvedProviders`
2312 * because it needs to resolve the passed-in providers first.
2313 * See {\@link ReflectiveInjector#resolve} and {\@link ReflectiveInjector#fromResolvedProviders}.
2314 * @param {?} providers
2315 * @param {?=} parent
2316 * @return {?}
2317 */
2318 ReflectiveInjector.resolveAndCreate = function (providers, parent) {
2319 var /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
2320 return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
2321 };
2322 /**
2323 * Creates an injector from previously resolved providers.
2324 *
2325 * This API is the recommended way to construct injectors in performance-sensitive parts.
2326 *
2327 * ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview))
2328 *
2329 * ```typescript
2330 * \@Injectable()
2331 * class Engine {
2332 * }
2333 *
2334 * \@Injectable()
2335 * class Car {
2336 * constructor(public engine:Engine) {}
2337 * }
2338 *
2339 * var providers = ReflectiveInjector.resolve([Car, Engine]);
2340 * var injector = ReflectiveInjector.fromResolvedProviders(providers);
2341 * expect(injector.get(Car) instanceof Car).toBe(true);
2342 * ```
2343 * \@experimental
2344 * @param {?} providers
2345 * @param {?=} parent
2346 * @return {?}
2347 */
2348 ReflectiveInjector.fromResolvedProviders = function (providers, parent) {
2349 return new ReflectiveInjector_(providers, parent);
2350 };
2351 /**
2352 * Parent of this injector.
2353 *
2354 * <!-- TODO: Add a link to the section of the user guide talking about hierarchical injection.
2355 * -->
2356 *
2357 * ### Example ([live demo](http://plnkr.co/edit/eosMGo?p=preview))
2358 *
2359 * ```typescript
2360 * var parent = ReflectiveInjector.resolveAndCreate([]);
2361 * var child = parent.resolveAndCreateChild([]);
2362 * expect(child.parent).toBe(parent);
2363 * ```
2364 * @abstract
2365 * @return {?}
2366 */
2367 ReflectiveInjector.prototype.parent = function () { };
2368 /**
2369 * Resolves an array of providers and creates a child injector from those providers.
2370 *
2371 * <!-- TODO: Add a link to the section of the user guide talking about hierarchical injection.
2372 * -->
2373 *
2374 * The passed-in providers can be an array of `Type`, {\@link Provider},
2375 * or a recursive array of more providers.
2376 *
2377 * ### Example ([live demo](http://plnkr.co/edit/opB3T4?p=preview))
2378 *
2379 * ```typescript
2380 * class ParentProvider {}
2381 * class ChildProvider {}
2382 *
2383 * var parent = ReflectiveInjector.resolveAndCreate([ParentProvider]);
2384 * var child = parent.resolveAndCreateChild([ChildProvider]);
2385 *
2386 * expect(child.get(ParentProvider) instanceof ParentProvider).toBe(true);
2387 * expect(child.get(ChildProvider) instanceof ChildProvider).toBe(true);
2388 * expect(child.get(ParentProvider)).toBe(parent.get(ParentProvider));
2389 * ```
2390 *
2391 * This function is slower than the corresponding `createChildFromResolved`
2392 * because it needs to resolve the passed-in providers first.
2393 * See {\@link ReflectiveInjector#resolve} and {\@link ReflectiveInjector#createChildFromResolved}.
2394 * @abstract
2395 * @param {?} providers
2396 * @return {?}
2397 */
2398 ReflectiveInjector.prototype.resolveAndCreateChild = function (providers) { };
2399 /**
2400 * Creates a child injector from previously resolved providers.
2401 *
2402 * <!-- TODO: Add a link to the section of the user guide talking about hierarchical injection.
2403 * -->
2404 *
2405 * This API is the recommended way to construct injectors in performance-sensitive parts.
2406 *
2407 * ### Example ([live demo](http://plnkr.co/edit/VhyfjN?p=preview))
2408 *
2409 * ```typescript
2410 * class ParentProvider {}
2411 * class ChildProvider {}
2412 *
2413 * var parentProviders = ReflectiveInjector.resolve([ParentProvider]);
2414 * var childProviders = ReflectiveInjector.resolve([ChildProvider]);
2415 *
2416 * var parent = ReflectiveInjector.fromResolvedProviders(parentProviders);
2417 * var child = parent.createChildFromResolved(childProviders);
2418 *
2419 * expect(child.get(ParentProvider) instanceof ParentProvider).toBe(true);
2420 * expect(child.get(ChildProvider) instanceof ChildProvider).toBe(true);
2421 * expect(child.get(ParentProvider)).toBe(parent.get(ParentProvider));
2422 * ```
2423 * @abstract
2424 * @param {?} providers
2425 * @return {?}
2426 */
2427 ReflectiveInjector.prototype.createChildFromResolved = function (providers) { };
2428 /**
2429 * Resolves a provider and instantiates an object in the context of the injector.
2430 *
2431 * The created object does not get cached by the injector.
2432 *
2433 * ### Example ([live demo](http://plnkr.co/edit/yvVXoB?p=preview))
2434 *
2435 * ```typescript
2436 * \@Injectable()
2437 * class Engine {
2438 * }
2439 *
2440 * \@Injectable()
2441 * class Car {
2442 * constructor(public engine:Engine) {}
2443 * }
2444 *
2445 * var injector = ReflectiveInjector.resolveAndCreate([Engine]);
2446 *
2447 * var car = injector.resolveAndInstantiate(Car);
2448 * expect(car.engine).toBe(injector.get(Engine));
2449 * expect(car).not.toBe(injector.resolveAndInstantiate(Car));
2450 * ```
2451 * @abstract
2452 * @param {?} provider
2453 * @return {?}
2454 */
2455 ReflectiveInjector.prototype.resolveAndInstantiate = function (provider) { };
2456 /**
2457 * Instantiates an object using a resolved provider in the context of the injector.
2458 *
2459 * The created object does not get cached by the injector.
2460 *
2461 * ### Example ([live demo](http://plnkr.co/edit/ptCImQ?p=preview))
2462 *
2463 * ```typescript
2464 * \@Injectable()
2465 * class Engine {
2466 * }
2467 *
2468 * \@Injectable()
2469 * class Car {
2470 * constructor(public engine:Engine) {}
2471 * }
2472 *
2473 * var injector = ReflectiveInjector.resolveAndCreate([Engine]);
2474 * var carProvider = ReflectiveInjector.resolve([Car])[0];
2475 * var car = injector.instantiateResolved(carProvider);
2476 * expect(car.engine).toBe(injector.get(Engine));
2477 * expect(car).not.toBe(injector.instantiateResolved(carProvider));
2478 * ```
2479 * @abstract
2480 * @param {?} provider
2481 * @return {?}
2482 */
2483 ReflectiveInjector.prototype.instantiateResolved = function (provider) { };
2484 /**
2485 * @abstract
2486 * @param {?} token
2487 * @param {?=} notFoundValue
2488 * @return {?}
2489 */
2490 ReflectiveInjector.prototype.get = function (token, notFoundValue) { };
2491 return ReflectiveInjector;
2492}());
2493var ReflectiveInjector_ = (function () {
2494 /**
2495 * Private
2496 * @param {?} _providers
2497 * @param {?=} _parent
2498 */
2499 function ReflectiveInjector_(_providers, _parent) {
2500 /**
2501 * \@internal
2502 */
2503 this._constructionCounter = 0;
2504 this._providers = _providers;
2505 this._parent = _parent || null;
2506 var len = _providers.length;
2507 this.keyIds = new Array(len);
2508 this.objs = new Array(len);
2509 for (var i = 0; i < len; i++) {
2510 this.keyIds[i] = _providers[i].key.id;
2511 this.objs[i] = UNDEFINED;
2512 }
2513 }
2514 /**
2515 * @param {?} token
2516 * @param {?=} notFoundValue
2517 * @return {?}
2518 */
2519 ReflectiveInjector_.prototype.get = function (token, notFoundValue) {
2520 if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; }
2521 return this._getByKey(ReflectiveKey.get(token), null, notFoundValue);
2522 };
2523 Object.defineProperty(ReflectiveInjector_.prototype, "parent", {
2524 /**
2525 * @return {?}
2526 */
2527 get: function () { return this._parent; },
2528 enumerable: true,
2529 configurable: true
2530 });
2531 /**
2532 * @param {?} providers
2533 * @return {?}
2534 */
2535 ReflectiveInjector_.prototype.resolveAndCreateChild = function (providers) {
2536 var /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
2537 return this.createChildFromResolved(ResolvedReflectiveProviders);
2538 };
2539 /**
2540 * @param {?} providers
2541 * @return {?}
2542 */
2543 ReflectiveInjector_.prototype.createChildFromResolved = function (providers) {
2544 var /** @type {?} */ inj = new ReflectiveInjector_(providers);
2545 inj._parent = this;
2546 return inj;
2547 };
2548 /**
2549 * @param {?} provider
2550 * @return {?}
2551 */
2552 ReflectiveInjector_.prototype.resolveAndInstantiate = function (provider) {
2553 return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
2554 };
2555 /**
2556 * @param {?} provider
2557 * @return {?}
2558 */
2559 ReflectiveInjector_.prototype.instantiateResolved = function (provider) {
2560 return this._instantiateProvider(provider);
2561 };
2562 /**
2563 * @param {?} index
2564 * @return {?}
2565 */
2566 ReflectiveInjector_.prototype.getProviderAtIndex = function (index) {
2567 if (index < 0 || index >= this._providers.length) {
2568 throw outOfBoundsError(index);
2569 }
2570 return this._providers[index];
2571 };
2572 /**
2573 * \@internal
2574 * @param {?} provider
2575 * @return {?}
2576 */
2577 ReflectiveInjector_.prototype._new = function (provider) {
2578 if (this._constructionCounter++ > this._getMaxNumberOfObjects()) {
2579 throw cyclicDependencyError(this, provider.key);
2580 }
2581 return this._instantiateProvider(provider);
2582 };
2583 /**
2584 * @return {?}
2585 */
2586 ReflectiveInjector_.prototype._getMaxNumberOfObjects = function () { return this.objs.length; };
2587 /**
2588 * @param {?} provider
2589 * @return {?}
2590 */
2591 ReflectiveInjector_.prototype._instantiateProvider = function (provider) {
2592 if (provider.multiProvider) {
2593 var /** @type {?} */ res = new Array(provider.resolvedFactories.length);
2594 for (var /** @type {?} */ i = 0; i < provider.resolvedFactories.length; ++i) {
2595 res[i] = this._instantiate(provider, provider.resolvedFactories[i]);
2596 }
2597 return res;
2598 }
2599 else {
2600 return this._instantiate(provider, provider.resolvedFactories[0]);
2601 }
2602 };
2603 /**
2604 * @param {?} provider
2605 * @param {?} ResolvedReflectiveFactory
2606 * @return {?}
2607 */
2608 ReflectiveInjector_.prototype._instantiate = function (provider, ResolvedReflectiveFactory$$1) {
2609 var _this = this;
2610 var /** @type {?} */ factory = ResolvedReflectiveFactory$$1.factory;
2611 var /** @type {?} */ deps;
2612 try {
2613 deps =
2614 ResolvedReflectiveFactory$$1.dependencies.map(function (dep) { return _this._getByReflectiveDependency(dep); });
2615 }
2616 catch (e) {
2617 if (e.addKey) {
2618 e.addKey(this, provider.key);
2619 }
2620 throw e;
2621 }
2622 var /** @type {?} */ obj;
2623 try {
2624 obj = factory.apply(void 0, deps);
2625 }
2626 catch (e) {
2627 throw instantiationError(this, e, e.stack, provider.key);
2628 }
2629 return obj;
2630 };
2631 /**
2632 * @param {?} dep
2633 * @return {?}
2634 */
2635 ReflectiveInjector_.prototype._getByReflectiveDependency = function (dep) {
2636 return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND);
2637 };
2638 /**
2639 * @param {?} key
2640 * @param {?} visibility
2641 * @param {?} notFoundValue
2642 * @return {?}
2643 */
2644 ReflectiveInjector_.prototype._getByKey = function (key, visibility, notFoundValue) {
2645 if (key === INJECTOR_KEY) {
2646 return this;
2647 }
2648 if (visibility instanceof Self) {
2649 return this._getByKeySelf(key, notFoundValue);
2650 }
2651 else {
2652 return this._getByKeyDefault(key, notFoundValue, visibility);
2653 }
2654 };
2655 /**
2656 * @param {?} keyId
2657 * @return {?}
2658 */
2659 ReflectiveInjector_.prototype._getObjByKeyId = function (keyId) {
2660 for (var /** @type {?} */ i = 0; i < this.keyIds.length; i++) {
2661 if (this.keyIds[i] === keyId) {
2662 if (this.objs[i] === UNDEFINED) {
2663 this.objs[i] = this._new(this._providers[i]);
2664 }
2665 return this.objs[i];
2666 }
2667 }
2668 return UNDEFINED;
2669 };
2670 /**
2671 * \@internal
2672 * @param {?} key
2673 * @param {?} notFoundValue
2674 * @return {?}
2675 */
2676 ReflectiveInjector_.prototype._throwOrNull = function (key, notFoundValue) {
2677 if (notFoundValue !== THROW_IF_NOT_FOUND) {
2678 return notFoundValue;
2679 }
2680 else {
2681 throw noProviderError(this, key);
2682 }
2683 };
2684 /**
2685 * \@internal
2686 * @param {?} key
2687 * @param {?} notFoundValue
2688 * @return {?}
2689 */
2690 ReflectiveInjector_.prototype._getByKeySelf = function (key, notFoundValue) {
2691 var /** @type {?} */ obj = this._getObjByKeyId(key.id);
2692 return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
2693 };
2694 /**
2695 * \@internal
2696 * @param {?} key
2697 * @param {?} notFoundValue
2698 * @param {?} visibility
2699 * @return {?}
2700 */
2701 ReflectiveInjector_.prototype._getByKeyDefault = function (key, notFoundValue, visibility) {
2702 var /** @type {?} */ inj;
2703 if (visibility instanceof SkipSelf) {
2704 inj = this._parent;
2705 }
2706 else {
2707 inj = this;
2708 }
2709 while (inj instanceof ReflectiveInjector_) {
2710 var /** @type {?} */ inj_ = (inj);
2711 var /** @type {?} */ obj = inj_._getObjByKeyId(key.id);
2712 if (obj !== UNDEFINED)
2713 return obj;
2714 inj = inj_._parent;
2715 }
2716 if (inj !== null) {
2717 return inj.get(key.token, notFoundValue);
2718 }
2719 else {
2720 return this._throwOrNull(key, notFoundValue);
2721 }
2722 };
2723 Object.defineProperty(ReflectiveInjector_.prototype, "displayName", {
2724 /**
2725 * @return {?}
2726 */
2727 get: function () {
2728 var /** @type {?} */ providers = _mapProviders(this, function (b) { return ' "' + b.key.displayName + '" '; })
2729 .join(', ');
2730 return "ReflectiveInjector(providers: [" + providers + "])";
2731 },
2732 enumerable: true,
2733 configurable: true
2734 });
2735 /**
2736 * @return {?}
2737 */
2738 ReflectiveInjector_.prototype.toString = function () { return this.displayName; };
2739 return ReflectiveInjector_;
2740}());
2741var INJECTOR_KEY = ReflectiveKey.get(Injector);
2742/**
2743 * @param {?} injector
2744 * @param {?} fn
2745 * @return {?}
2746 */
2747function _mapProviders(injector, fn) {
2748 var /** @type {?} */ res = new Array(injector._providers.length);
2749 for (var /** @type {?} */ i = 0; i < injector._providers.length; ++i) {
2750 res[i] = fn(injector.getProviderAtIndex(i));
2751 }
2752 return res;
2753}
2754/**
2755 * @license
2756 * Copyright Google Inc. All Rights Reserved.
2757 *
2758 * Use of this source code is governed by an MIT-style license that can be
2759 * found in the LICENSE file at https://angular.io/license
2760 */
2761/**
2762 * @module
2763 * @description
2764 * The `di` module provides dependency injection container services.
2765 */
2766/**
2767 * @license
2768 * Copyright Google Inc. All Rights Reserved.
2769 *
2770 * Use of this source code is governed by an MIT-style license that can be
2771 * found in the LICENSE file at https://angular.io/license
2772 */
2773/**
2774 * Determine if the argument is shaped like a Promise
2775 * @param {?} obj
2776 * @return {?}
2777 */
2778function isPromise(obj) {
2779 // allow any Promise/A+ compliant thenable.
2780 // It's up to the caller to ensure that obj.then conforms to the spec
2781 return !!obj && typeof obj.then === 'function';
2782}
2783/**
2784 * Determine if the argument is an Observable
2785 * @param {?} obj
2786 * @return {?}
2787 */
2788function isObservable(obj) {
2789 // TODO use Symbol.observable when https://github.com/ReactiveX/rxjs/issues/2415 will be resolved
2790 return !!obj && typeof obj.subscribe === 'function';
2791}
2792/**
2793 * @license
2794 * Copyright Google Inc. All Rights Reserved.
2795 *
2796 * Use of this source code is governed by an MIT-style license that can be
2797 * found in the LICENSE file at https://angular.io/license
2798 */
2799/**
2800 * A function that will be executed when an application is initialized.
2801 * \@experimental
2802 */
2803var APP_INITIALIZER = new InjectionToken('Application Initializer');
2804/**
2805 * A class that reflects the state of running {\@link APP_INITIALIZER}s.
2806 *
2807 * \@experimental
2808 */
2809var ApplicationInitStatus = (function () {
2810 /**
2811 * @param {?} appInits
2812 */
2813 function ApplicationInitStatus(appInits) {
2814 var _this = this;
2815 this.appInits = appInits;
2816 this.initialized = false;
2817 this._done = false;
2818 this._donePromise = new Promise(function (res, rej) {
2819 _this.resolve = res;
2820 _this.reject = rej;
2821 });
2822 }
2823 /**
2824 * \@internal
2825 * @return {?}
2826 */
2827 ApplicationInitStatus.prototype.runInitializers = function () {
2828 var _this = this;
2829 if (this.initialized) {
2830 return;
2831 }
2832 var /** @type {?} */ asyncInitPromises = [];
2833 var /** @type {?} */ complete = function () {
2834 _this._done = true;
2835 _this.resolve();
2836 };
2837 if (this.appInits) {
2838 for (var /** @type {?} */ i = 0; i < this.appInits.length; i++) {
2839 var /** @type {?} */ initResult = this.appInits[i]();
2840 if (isPromise(initResult)) {
2841 asyncInitPromises.push(initResult);
2842 }
2843 }
2844 }
2845 Promise.all(asyncInitPromises).then(function () { complete(); }).catch(function (e) { _this.reject(e); });
2846 if (asyncInitPromises.length === 0) {
2847 complete();
2848 }
2849 this.initialized = true;
2850 };
2851 Object.defineProperty(ApplicationInitStatus.prototype, "done", {
2852 /**
2853 * @return {?}
2854 */
2855 get: function () { return this._done; },
2856 enumerable: true,
2857 configurable: true
2858 });
2859 Object.defineProperty(ApplicationInitStatus.prototype, "donePromise", {
2860 /**
2861 * @return {?}
2862 */
2863 get: function () { return this._donePromise; },
2864 enumerable: true,
2865 configurable: true
2866 });
2867 return ApplicationInitStatus;
2868}());
2869ApplicationInitStatus.decorators = [
2870 { type: Injectable },
2871];
2872/**
2873 * @nocollapse
2874 */
2875ApplicationInitStatus.ctorParameters = function () { return [
2876 { type: Array, decorators: [{ type: Inject, args: [APP_INITIALIZER,] }, { type: Optional },] },
2877]; };
2878/**
2879 * @license
2880 * Copyright Google Inc. All Rights Reserved.
2881 *
2882 * Use of this source code is governed by an MIT-style license that can be
2883 * found in the LICENSE file at https://angular.io/license
2884 */
2885/**
2886 * A DI Token representing a unique string id assigned to the application by Angular and used
2887 * primarily for prefixing application attributes and CSS styles when
2888 * {\@link ViewEncapsulation#Emulated} is being used.
2889 *
2890 * If you need to avoid randomly generated value to be used as an application id, you can provide
2891 * a custom value via a DI provider <!-- TODO: provider --> configuring the root {\@link Injector}
2892 * using this token.
2893 * \@experimental
2894 */
2895var APP_ID = new InjectionToken('AppId');
2896/**
2897 * @return {?}
2898 */
2899function _appIdRandomProviderFactory() {
2900 return "" + _randomChar() + _randomChar() + _randomChar();
2901}
2902/**
2903 * Providers that will generate a random APP_ID_TOKEN.
2904 * \@experimental
2905 */
2906var APP_ID_RANDOM_PROVIDER = {
2907 provide: APP_ID,
2908 useFactory: _appIdRandomProviderFactory,
2909 deps: [],
2910};
2911/**
2912 * @return {?}
2913 */
2914function _randomChar() {
2915 return String.fromCharCode(97 + Math.floor(Math.random() * 25));
2916}
2917/**
2918 * A function that will be executed when a platform is initialized.
2919 * \@experimental
2920 */
2921var PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer');
2922/**
2923 * A token that indicates an opaque platform id.
2924 * \@experimental
2925 */
2926var PLATFORM_ID = new InjectionToken('Platform ID');
2927/**
2928 * All callbacks provided via this token will be called for every component that is bootstrapped.
2929 * Signature of the callback:
2930 *
2931 * `(componentRef: ComponentRef) => void`.
2932 *
2933 * \@experimental
2934 */
2935var APP_BOOTSTRAP_LISTENER = new InjectionToken('appBootstrapListener');
2936/**
2937 * A token which indicates the root directory of the application
2938 * \@experimental
2939 */
2940var PACKAGE_ROOT_URL = new InjectionToken('Application Packages Root URL');
2941/**
2942 * @license
2943 * Copyright Google Inc. All Rights Reserved.
2944 *
2945 * Use of this source code is governed by an MIT-style license that can be
2946 * found in the LICENSE file at https://angular.io/license
2947 */
2948var Console = (function () {
2949 function Console() {
2950 }
2951 /**
2952 * @param {?} message
2953 * @return {?}
2954 */
2955 Console.prototype.log = function (message) {
2956 // tslint:disable-next-line:no-console
2957 console.log(message);
2958 };
2959 /**
2960 * @param {?} message
2961 * @return {?}
2962 */
2963 Console.prototype.warn = function (message) {
2964 // tslint:disable-next-line:no-console
2965 console.warn(message);
2966 };
2967 return Console;
2968}());
2969Console.decorators = [
2970 { type: Injectable },
2971];
2972/**
2973 * @nocollapse
2974 */
2975Console.ctorParameters = function () { return []; };
2976/**
2977 * @license
2978 * Copyright Google Inc. All Rights Reserved.
2979 *
2980 * Use of this source code is governed by an MIT-style license that can be
2981 * found in the LICENSE file at https://angular.io/license
2982 */
2983/**
2984 * Combination of NgModuleFactory and ComponentFactorys.
2985 *
2986 * \@experimental
2987 */
2988var ModuleWithComponentFactories = (function () {
2989 /**
2990 * @param {?} ngModuleFactory
2991 * @param {?} componentFactories
2992 */
2993 function ModuleWithComponentFactories(ngModuleFactory, componentFactories) {
2994 this.ngModuleFactory = ngModuleFactory;
2995 this.componentFactories = componentFactories;
2996 }
2997 return ModuleWithComponentFactories;
2998}());
2999/**
3000 * @return {?}
3001 */
3002function _throwError() {
3003 throw new Error("Runtime compiler is not loaded");
3004}
3005/**
3006 * Low-level service for running the angular compiler during runtime
3007 * to create {\@link ComponentFactory}s, which
3008 * can later be used to create and render a Component instance.
3009 *
3010 * Each `\@NgModule` provides an own `Compiler` to its injector,
3011 * that will use the directives/pipes of the ng module for compilation
3012 * of components.
3013 * \@stable
3014 */
3015var Compiler = (function () {
3016 function Compiler() {
3017 }
3018 /**
3019 * Compiles the given NgModule and all of its components. All templates of the components listed
3020 * in `entryComponents` have to be inlined.
3021 * @template T
3022 * @param {?} moduleType
3023 * @return {?}
3024 */
3025 Compiler.prototype.compileModuleSync = function (moduleType) { throw _throwError(); };
3026 /**
3027 * Compiles the given NgModule and all of its components
3028 * @template T
3029 * @param {?} moduleType
3030 * @return {?}
3031 */
3032 Compiler.prototype.compileModuleAsync = function (moduleType) { throw _throwError(); };
3033 /**
3034 * Same as {\@link #compileModuleSync} but also creates ComponentFactories for all components.
3035 * @template T
3036 * @param {?} moduleType
3037 * @return {?}
3038 */
3039 Compiler.prototype.compileModuleAndAllComponentsSync = function (moduleType) {
3040 throw _throwError();
3041 };
3042 /**
3043 * Same as {\@link #compileModuleAsync} but also creates ComponentFactories for all components.
3044 * @template T
3045 * @param {?} moduleType
3046 * @return {?}
3047 */
3048 Compiler.prototype.compileModuleAndAllComponentsAsync = function (moduleType) {
3049 throw _throwError();
3050 };
3051 /**
3052 * Exposes the CSS-style selectors that have been used in `ngContent` directives within
3053 * the template of the given component.
3054 * This is used by the `upgrade` library to compile the appropriate transclude content
3055 * in the AngularJS wrapper component.
3056 *
3057 * @deprecated since v4. Use ComponentFactory.ngContentSelectors instead.
3058 * @param {?} component
3059 * @return {?}
3060 */
3061 Compiler.prototype.getNgContentSelectors = function (component) { throw _throwError(); };
3062 /**
3063 * Clears all caches.
3064 * @return {?}
3065 */
3066 Compiler.prototype.clearCache = function () { };
3067 /**
3068 * Clears the cache for the given component/ngModule.
3069 * @param {?} type
3070 * @return {?}
3071 */
3072 Compiler.prototype.clearCacheFor = function (type) { };
3073 return Compiler;
3074}());
3075Compiler.decorators = [
3076 { type: Injectable },
3077];
3078/**
3079 * @nocollapse
3080 */
3081Compiler.ctorParameters = function () { return []; };
3082/**
3083 * Token to provide CompilerOptions in the platform injector.
3084 *
3085 * \@experimental
3086 */
3087var COMPILER_OPTIONS = new InjectionToken('compilerOptions');
3088/**
3089 * A factory for creating a Compiler
3090 *
3091 * \@experimental
3092 * @abstract
3093 */
3094var CompilerFactory = (function () {
3095 function CompilerFactory() {
3096 }
3097 /**
3098 * @abstract
3099 * @param {?=} options
3100 * @return {?}
3101 */
3102 CompilerFactory.prototype.createCompiler = function (options) { };
3103 return CompilerFactory;
3104}());
3105/**
3106 * @license
3107 * Copyright Google Inc. All Rights Reserved.
3108 *
3109 * Use of this source code is governed by an MIT-style license that can be
3110 * found in the LICENSE file at https://angular.io/license
3111 */
3112/**
3113 * Represents an instance of a Component created via a {\@link ComponentFactory}.
3114 *
3115 * `ComponentRef` provides access to the Component Instance as well other objects related to this
3116 * Component Instance and allows you to destroy the Component Instance via the {\@link #destroy}
3117 * method.
3118 * \@stable
3119 * @abstract
3120 */
3121var ComponentRef = (function () {
3122 function ComponentRef() {
3123 }
3124 /**
3125 * Location of the Host Element of this Component Instance.
3126 * @abstract
3127 * @return {?}
3128 */
3129 ComponentRef.prototype.location = function () { };
3130 /**
3131 * The injector on which the component instance exists.
3132 * @abstract
3133 * @return {?}
3134 */
3135 ComponentRef.prototype.injector = function () { };
3136 /**
3137 * The instance of the Component.
3138 * @abstract
3139 * @return {?}
3140 */
3141 ComponentRef.prototype.instance = function () { };
3142 /**
3143 * The {\@link ViewRef} of the Host View of this Component instance.
3144 * @abstract
3145 * @return {?}
3146 */
3147 ComponentRef.prototype.hostView = function () { };
3148 /**
3149 * The {\@link ChangeDetectorRef} of the Component instance.
3150 * @abstract
3151 * @return {?}
3152 */
3153 ComponentRef.prototype.changeDetectorRef = function () { };
3154 /**
3155 * The component type.
3156 * @abstract
3157 * @return {?}
3158 */
3159 ComponentRef.prototype.componentType = function () { };
3160 /**
3161 * Destroys the component instance and all of the data structures associated with it.
3162 * @abstract
3163 * @return {?}
3164 */
3165 ComponentRef.prototype.destroy = function () { };
3166 /**
3167 * Allows to register a callback that will be called when the component is destroyed.
3168 * @abstract
3169 * @param {?} callback
3170 * @return {?}
3171 */
3172 ComponentRef.prototype.onDestroy = function (callback) { };
3173 return ComponentRef;
3174}());
3175/**
3176 * \@stable
3177 * @abstract
3178 */
3179var ComponentFactory = (function () {
3180 function ComponentFactory() {
3181 }
3182 /**
3183 * @abstract
3184 * @return {?}
3185 */
3186 ComponentFactory.prototype.selector = function () { };
3187 /**
3188 * @abstract
3189 * @return {?}
3190 */
3191 ComponentFactory.prototype.componentType = function () { };
3192 /**
3193 * selector for all <ng-content> elements in the component.
3194 * @abstract
3195 * @return {?}
3196 */
3197 ComponentFactory.prototype.ngContentSelectors = function () { };
3198 /**
3199 * the inputs of the component.
3200 * @abstract
3201 * @return {?}
3202 */
3203 ComponentFactory.prototype.inputs = function () { };
3204 /**
3205 * the outputs of the component.
3206 * @abstract
3207 * @return {?}
3208 */
3209 ComponentFactory.prototype.outputs = function () { };
3210 /**
3211 * Creates a new component.
3212 * @abstract
3213 * @param {?} injector
3214 * @param {?=} projectableNodes
3215 * @param {?=} rootSelectorOrNode
3216 * @param {?=} ngModule
3217 * @return {?}
3218 */
3219 ComponentFactory.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) { };
3220 return ComponentFactory;
3221}());
3222/**
3223 * @license
3224 * Copyright Google Inc. All Rights Reserved.
3225 *
3226 * Use of this source code is governed by an MIT-style license that can be
3227 * found in the LICENSE file at https://angular.io/license
3228 */
3229/**
3230 * @param {?} component
3231 * @return {?}
3232 */
3233function noComponentFactoryError(component) {
3234 var /** @type {?} */ error = Error("No component factory found for " + stringify(component) + ". Did you add it to @NgModule.entryComponents?");
3235 ((error))[ERROR_COMPONENT] = component;
3236 return error;
3237}
3238var ERROR_COMPONENT = 'ngComponent';
3239/**
3240 * @param {?} error
3241 * @return {?}
3242 */
3243var _NullComponentFactoryResolver = (function () {
3244 function _NullComponentFactoryResolver() {
3245 }
3246 /**
3247 * @template T
3248 * @param {?} component
3249 * @return {?}
3250 */
3251 _NullComponentFactoryResolver.prototype.resolveComponentFactory = function (component) {
3252 throw noComponentFactoryError(component);
3253 };
3254 return _NullComponentFactoryResolver;
3255}());
3256/**
3257 * \@stable
3258 * @abstract
3259 */
3260var ComponentFactoryResolver = (function () {
3261 function ComponentFactoryResolver() {
3262 }
3263 /**
3264 * @abstract
3265 * @template T
3266 * @param {?} component
3267 * @return {?}
3268 */
3269 ComponentFactoryResolver.prototype.resolveComponentFactory = function (component) { };
3270 return ComponentFactoryResolver;
3271}());
3272ComponentFactoryResolver.NULL = new _NullComponentFactoryResolver();
3273var CodegenComponentFactoryResolver = (function () {
3274 /**
3275 * @param {?} factories
3276 * @param {?} _parent
3277 * @param {?} _ngModule
3278 */
3279 function CodegenComponentFactoryResolver(factories, _parent, _ngModule) {
3280 this._parent = _parent;
3281 this._ngModule = _ngModule;
3282 this._factories = new Map();
3283 for (var i = 0; i < factories.length; i++) {
3284 var factory = factories[i];
3285 this._factories.set(factory.componentType, factory);
3286 }
3287 }
3288 /**
3289 * @template T
3290 * @param {?} component
3291 * @return {?}
3292 */
3293 CodegenComponentFactoryResolver.prototype.resolveComponentFactory = function (component) {
3294 var /** @type {?} */ factory = this._factories.get(component);
3295 if (!factory && this._parent) {
3296 factory = this._parent.resolveComponentFactory(component);
3297 }
3298 if (!factory) {
3299 throw noComponentFactoryError(component);
3300 }
3301 return new ComponentFactoryBoundToModule(factory, this._ngModule);
3302 };
3303 return CodegenComponentFactoryResolver;
3304}());
3305var ComponentFactoryBoundToModule = (function (_super) {
3306 __extends(ComponentFactoryBoundToModule, _super);
3307 /**
3308 * @param {?} factory
3309 * @param {?} ngModule
3310 */
3311 function ComponentFactoryBoundToModule(factory, ngModule) {
3312 var _this = _super.call(this) || this;
3313 _this.factory = factory;
3314 _this.ngModule = ngModule;
3315 return _this;
3316 }
3317 Object.defineProperty(ComponentFactoryBoundToModule.prototype, "selector", {
3318 /**
3319 * @return {?}
3320 */
3321 get: function () { return this.factory.selector; },
3322 enumerable: true,
3323 configurable: true
3324 });
3325 Object.defineProperty(ComponentFactoryBoundToModule.prototype, "componentType", {
3326 /**
3327 * @return {?}
3328 */
3329 get: function () { return this.factory.componentType; },
3330 enumerable: true,
3331 configurable: true
3332 });
3333 Object.defineProperty(ComponentFactoryBoundToModule.prototype, "ngContentSelectors", {
3334 /**
3335 * @return {?}
3336 */
3337 get: function () { return this.factory.ngContentSelectors; },
3338 enumerable: true,
3339 configurable: true
3340 });
3341 Object.defineProperty(ComponentFactoryBoundToModule.prototype, "inputs", {
3342 /**
3343 * @return {?}
3344 */
3345 get: function () { return this.factory.inputs; },
3346 enumerable: true,
3347 configurable: true
3348 });
3349 Object.defineProperty(ComponentFactoryBoundToModule.prototype, "outputs", {
3350 /**
3351 * @return {?}
3352 */
3353 get: function () { return this.factory.outputs; },
3354 enumerable: true,
3355 configurable: true
3356 });
3357 /**
3358 * @param {?} injector
3359 * @param {?=} projectableNodes
3360 * @param {?=} rootSelectorOrNode
3361 * @param {?=} ngModule
3362 * @return {?}
3363 */
3364 ComponentFactoryBoundToModule.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
3365 return this.factory.create(injector, projectableNodes, rootSelectorOrNode, ngModule || this.ngModule);
3366 };
3367 return ComponentFactoryBoundToModule;
3368}(ComponentFactory));
3369/**
3370 * @license
3371 * Copyright Google Inc. All Rights Reserved.
3372 *
3373 * Use of this source code is governed by an MIT-style license that can be
3374 * found in the LICENSE file at https://angular.io/license
3375 */
3376/**
3377 * Represents an instance of an NgModule created via a {\@link NgModuleFactory}.
3378 *
3379 * `NgModuleRef` provides access to the NgModule Instance as well other objects related to this
3380 * NgModule Instance.
3381 *
3382 * \@stable
3383 * @abstract
3384 */
3385var NgModuleRef = (function () {
3386 function NgModuleRef() {
3387 }
3388 /**
3389 * The injector that contains all of the providers of the NgModule.
3390 * @abstract
3391 * @return {?}
3392 */
3393 NgModuleRef.prototype.injector = function () { };
3394 /**
3395 * The ComponentFactoryResolver to get hold of the ComponentFactories
3396 * declared in the `entryComponents` property of the module.
3397 * @abstract
3398 * @return {?}
3399 */
3400 NgModuleRef.prototype.componentFactoryResolver = function () { };
3401 /**
3402 * The NgModule instance.
3403 * @abstract
3404 * @return {?}
3405 */
3406 NgModuleRef.prototype.instance = function () { };
3407 /**
3408 * Destroys the module instance and all of the data structures associated with it.
3409 * @abstract
3410 * @return {?}
3411 */
3412 NgModuleRef.prototype.destroy = function () { };
3413 /**
3414 * Allows to register a callback that will be called when the module is destroyed.
3415 * @abstract
3416 * @param {?} callback
3417 * @return {?}
3418 */
3419 NgModuleRef.prototype.onDestroy = function (callback) { };
3420 return NgModuleRef;
3421}());
3422/**
3423 * \@experimental
3424 * @abstract
3425 */
3426var NgModuleFactory = (function () {
3427 function NgModuleFactory() {
3428 }
3429 /**
3430 * @abstract
3431 * @return {?}
3432 */
3433 NgModuleFactory.prototype.moduleType = function () { };
3434 /**
3435 * @abstract
3436 * @param {?} parentInjector
3437 * @return {?}
3438 */
3439 NgModuleFactory.prototype.create = function (parentInjector) { };
3440 return NgModuleFactory;
3441}());
3442/**
3443 * @license
3444 * Copyright Google Inc. All Rights Reserved.
3445 *
3446 * Use of this source code is governed by an MIT-style license that can be
3447 * found in the LICENSE file at https://angular.io/license
3448 */
3449var trace;
3450var events;
3451/**
3452 * @return {?}
3453 */
3454function detectWTF() {
3455 var /** @type {?} */ wtf = ((_global) /** TODO #9100 */)['wtf'];
3456 if (wtf) {
3457 trace = wtf['trace'];
3458 if (trace) {
3459 events = trace['events'];
3460 return true;
3461 }
3462 }
3463 return false;
3464}
3465/**
3466 * @param {?} signature
3467 * @param {?=} flags
3468 * @return {?}
3469 */
3470function createScope$1(signature, flags) {
3471 if (flags === void 0) { flags = null; }
3472 return events.createScope(signature, flags);
3473}
3474/**
3475 * @template T
3476 * @param {?} scope
3477 * @param {?=} returnValue
3478 * @return {?}
3479 */
3480function leave(scope, returnValue) {
3481 trace.leaveScope(scope, returnValue);
3482 return returnValue;
3483}
3484/**
3485 * @param {?} rangeType
3486 * @param {?} action
3487 * @return {?}
3488 */
3489function startTimeRange(rangeType, action) {
3490 return trace.beginTimeRange(rangeType, action);
3491}
3492/**
3493 * @param {?} range
3494 * @return {?}
3495 */
3496function endTimeRange(range) {
3497 trace.endTimeRange(range);
3498}
3499/**
3500 * @license
3501 * Copyright Google Inc. All Rights Reserved.
3502 *
3503 * Use of this source code is governed by an MIT-style license that can be
3504 * found in the LICENSE file at https://angular.io/license
3505 */
3506/**
3507 * True if WTF is enabled.
3508 */
3509var wtfEnabled = detectWTF();
3510/**
3511 * @param {?=} arg0
3512 * @param {?=} arg1
3513 * @return {?}
3514 */
3515function noopScope(arg0, arg1) {
3516 return null;
3517}
3518/**
3519 * Create trace scope.
3520 *
3521 * Scopes must be strictly nested and are analogous to stack frames, but
3522 * do not have to follow the stack frames. Instead it is recommended that they follow logical
3523 * nesting. You may want to use
3524 * [Event
3525 * Signatures](http://google.github.io/tracing-framework/instrumenting-code.html#custom-events)
3526 * as they are defined in WTF.
3527 *
3528 * Used to mark scope entry. The return value is used to leave the scope.
3529 *
3530 * var myScope = wtfCreateScope('MyClass#myMethod(ascii someVal)');
3531 *
3532 * someMethod() {
3533 * var s = myScope('Foo'); // 'Foo' gets stored in tracing UI
3534 * // DO SOME WORK HERE
3535 * return wtfLeave(s, 123); // Return value 123
3536 * }
3537 *
3538 * Note, adding try-finally block around the work to ensure that `wtfLeave` gets called can
3539 * negatively impact the performance of your application. For this reason we recommend that
3540 * you don't add them to ensure that `wtfLeave` gets called. In production `wtfLeave` is a noop and
3541 * so try-finally block has no value. When debugging perf issues, skipping `wtfLeave`, do to
3542 * exception, will produce incorrect trace, but presence of exception signifies logic error which
3543 * needs to be fixed before the app should be profiled. Add try-finally only when you expect that
3544 * an exception is expected during normal execution while profiling.
3545 *
3546 * \@experimental
3547 */
3548var wtfCreateScope = wtfEnabled ? createScope$1 : function (signature, flags) { return noopScope; };
3549/**
3550 * Used to mark end of Scope.
3551 *
3552 * - `scope` to end.
3553 * - `returnValue` (optional) to be passed to the WTF.
3554 *
3555 * Returns the `returnValue for easy chaining.
3556 * \@experimental
3557 */
3558var wtfLeave = wtfEnabled ? leave : function (s, r) { return r; };
3559/**
3560 * Used to mark Async start. Async are similar to scope but they don't have to be strictly nested.
3561 * The return value is used in the call to [endAsync]. Async ranges only work if WTF has been
3562 * enabled.
3563 *
3564 * someMethod() {
3565 * var s = wtfStartTimeRange('HTTP:GET', 'some.url');
3566 * var future = new Future.delay(5).then((_) {
3567 * wtfEndTimeRange(s);
3568 * });
3569 * }
3570 * \@experimental
3571 */
3572var wtfStartTimeRange = wtfEnabled ? startTimeRange : function (rangeType, action) { return null; };
3573/**
3574 * Ends a async time range operation.
3575 * [range] is the return value from [wtfStartTimeRange] Async ranges only work if WTF has been
3576 * enabled.
3577 * \@experimental
3578 */
3579var wtfEndTimeRange = wtfEnabled ? endTimeRange : function (r) { return null; };
3580/**
3581 * @license
3582 * Copyright Google Inc. All Rights Reserved.
3583 *
3584 * Use of this source code is governed by an MIT-style license that can be
3585 * found in the LICENSE file at https://angular.io/license
3586 */
3587/**
3588 * Use by directives and components to emit custom Events.
3589 *
3590 * ### Examples
3591 *
3592 * In the following example, `Zippy` alternatively emits `open` and `close` events when its
3593 * title gets clicked:
3594 *
3595 * ```
3596 * \@Component({
3597 * selector: 'zippy',
3598 * template: `
3599 * <div class="zippy">
3600 * <div (click)="toggle()">Toggle</div>
3601 * <div [hidden]="!visible">
3602 * <ng-content></ng-content>
3603 * </div>
3604 * </div>`})
3605 * export class Zippy {
3606 * visible: boolean = true;
3607 * \@Output() open: EventEmitter<any> = new EventEmitter();
3608 * \@Output() close: EventEmitter<any> = new EventEmitter();
3609 *
3610 * toggle() {
3611 * this.visible = !this.visible;
3612 * if (this.visible) {
3613 * this.open.emit(null);
3614 * } else {
3615 * this.close.emit(null);
3616 * }
3617 * }
3618 * }
3619 * ```
3620 *
3621 * The events payload can be accessed by the parameter `$event` on the components output event
3622 * handler:
3623 *
3624 * ```
3625 * <zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy>
3626 * ```
3627 *
3628 * Uses Rx.Observable but provides an adapter to make it work as specified here:
3629 * https://github.com/jhusain/observable-spec
3630 *
3631 * Once a reference implementation of the spec is available, switch to it.
3632 * \@stable
3633 */
3634var EventEmitter = (function (_super) {
3635 __extends(EventEmitter, _super);
3636 /**
3637 * Creates an instance of {\@link EventEmitter}, which depending on `isAsync`,
3638 * delivers events synchronously or asynchronously.
3639 *
3640 * @param {?=} isAsync By default, events are delivered synchronously (default value: `false`).
3641 * Set to `true` for asynchronous event delivery.
3642 */
3643 function EventEmitter(isAsync) {
3644 if (isAsync === void 0) { isAsync = false; }
3645 var _this = _super.call(this) || this;
3646 _this.__isAsync = isAsync;
3647 return _this;
3648 }
3649 /**
3650 * @param {?=} value
3651 * @return {?}
3652 */
3653 EventEmitter.prototype.emit = function (value) { _super.prototype.next.call(this, value); };
3654 /**
3655 * @param {?=} generatorOrNext
3656 * @param {?=} error
3657 * @param {?=} complete
3658 * @return {?}
3659 */
3660 EventEmitter.prototype.subscribe = function (generatorOrNext, error, complete) {
3661 var /** @type {?} */ schedulerFn;
3662 var /** @type {?} */ errorFn = function (err) { return null; };
3663 var /** @type {?} */ completeFn = function () { return null; };
3664 if (generatorOrNext && typeof generatorOrNext === 'object') {
3665 schedulerFn = this.__isAsync ? function (value) {
3666 setTimeout(function () { return generatorOrNext.next(value); });
3667 } : function (value) { generatorOrNext.next(value); };
3668 if (generatorOrNext.error) {
3669 errorFn = this.__isAsync ? function (err) { setTimeout(function () { return generatorOrNext.error(err); }); } :
3670 function (err) { generatorOrNext.error(err); };
3671 }
3672 if (generatorOrNext.complete) {
3673 completeFn = this.__isAsync ? function () { setTimeout(function () { return generatorOrNext.complete(); }); } :
3674 function () { generatorOrNext.complete(); };
3675 }
3676 }
3677 else {
3678 schedulerFn = this.__isAsync ? function (value) { setTimeout(function () { return generatorOrNext(value); }); } :
3679 function (value) { generatorOrNext(value); };
3680 if (error) {
3681 errorFn =
3682 this.__isAsync ? function (err) { setTimeout(function () { return error(err); }); } : function (err) { error(err); };
3683 }
3684 if (complete) {
3685 completeFn =
3686 this.__isAsync ? function () { setTimeout(function () { return complete(); }); } : function () { complete(); };
3687 }
3688 }
3689 return _super.prototype.subscribe.call(this, schedulerFn, errorFn, completeFn);
3690 };
3691 return EventEmitter;
3692}(rxjs_Subject.Subject));
3693/**
3694 * @license
3695 * Copyright Google Inc. All Rights Reserved.
3696 *
3697 * Use of this source code is governed by an MIT-style license that can be
3698 * found in the LICENSE file at https://angular.io/license
3699 */
3700/**
3701 * An injectable service for executing work inside or outside of the Angular zone.
3702 *
3703 * The most common use of this service is to optimize performance when starting a work consisting of
3704 * one or more asynchronous tasks that don't require UI updates or error handling to be handled by
3705 * Angular. Such tasks can be kicked off via {\@link #runOutsideAngular} and if needed, these tasks
3706 * can reenter the Angular zone via {\@link #run}.
3707 *
3708 * <!-- TODO: add/fix links to:
3709 * - docs explaining zones and the use of zones in Angular and change-detection
3710 * - link to runOutsideAngular/run (throughout this file!)
3711 * -->
3712 *
3713 * ### Example
3714 *
3715 * ```
3716 * import {Component, NgZone} from '\@angular/core';
3717 * import {NgIf} from '\@angular/common';
3718 *
3719 * \@Component({
3720 * selector: 'ng-zone-demo'.
3721 * template: `
3722 * <h2>Demo: NgZone</h2>
3723 *
3724 * <p>Progress: {{progress}}%</p>
3725 * <p *ngIf="progress >= 100">Done processing {{label}} of Angular zone!</p>
3726 *
3727 * <button (click)="processWithinAngularZone()">Process within Angular zone</button>
3728 * <button (click)="processOutsideOfAngularZone()">Process outside of Angular zone</button>
3729 * `,
3730 * })
3731 * export class NgZoneDemo {
3732 * progress: number = 0;
3733 * label: string;
3734 *
3735 * constructor(private _ngZone: NgZone) {}
3736 *
3737 * // Loop inside the Angular zone
3738 * // so the UI DOES refresh after each setTimeout cycle
3739 * processWithinAngularZone() {
3740 * this.label = 'inside';
3741 * this.progress = 0;
3742 * this._increaseProgress(() => console.log('Inside Done!'));
3743 * }
3744 *
3745 * // Loop outside of the Angular zone
3746 * // so the UI DOES NOT refresh after each setTimeout cycle
3747 * processOutsideOfAngularZone() {
3748 * this.label = 'outside';
3749 * this.progress = 0;
3750 * this._ngZone.runOutsideAngular(() => {
3751 * this._increaseProgress(() => {
3752 * // reenter the Angular zone and display done
3753 * this._ngZone.run(() => {console.log('Outside Done!') });
3754 * }}));
3755 * }
3756 *
3757 * _increaseProgress(doneCallback: () => void) {
3758 * this.progress += 1;
3759 * console.log(`Current progress: ${this.progress}%`);
3760 *
3761 * if (this.progress < 100) {
3762 * window.setTimeout(() => this._increaseProgress(doneCallback)), 10)
3763 * } else {
3764 * doneCallback();
3765 * }
3766 * }
3767 * }
3768 * ```
3769 *
3770 * \@experimental
3771 */
3772var NgZone = (function () {
3773 /**
3774 * @param {?} __0
3775 */
3776 function NgZone(_a) {
3777 var _b = _a.enableLongStackTrace, enableLongStackTrace = _b === void 0 ? false : _b;
3778 this._hasPendingMicrotasks = false;
3779 this._hasPendingMacrotasks = false;
3780 this._isStable = true;
3781 this._nesting = 0;
3782 this._onUnstable = new EventEmitter(false);
3783 this._onMicrotaskEmpty = new EventEmitter(false);
3784 this._onStable = new EventEmitter(false);
3785 this._onErrorEvents = new EventEmitter(false);
3786 if (typeof Zone == 'undefined') {
3787 throw new Error('Angular requires Zone.js prolyfill.');
3788 }
3789 Zone.assertZonePatched();
3790 this.outer = this.inner = Zone.current;
3791 if (Zone['wtfZoneSpec']) {
3792 this.inner = this.inner.fork(Zone['wtfZoneSpec']);
3793 }
3794 if (enableLongStackTrace && Zone['longStackTraceZoneSpec']) {
3795 this.inner = this.inner.fork(Zone['longStackTraceZoneSpec']);
3796 }
3797 this.forkInnerZoneWithAngularBehavior();
3798 }
3799 /**
3800 * @return {?}
3801 */
3802 NgZone.isInAngularZone = function () { return Zone.current.get('isAngularZone') === true; };
3803 /**
3804 * @return {?}
3805 */
3806 NgZone.assertInAngularZone = function () {
3807 if (!NgZone.isInAngularZone()) {
3808 throw new Error('Expected to be in Angular Zone, but it is not!');
3809 }
3810 };
3811 /**
3812 * @return {?}
3813 */
3814 NgZone.assertNotInAngularZone = function () {
3815 if (NgZone.isInAngularZone()) {
3816 throw new Error('Expected to not be in Angular Zone, but it is!');
3817 }
3818 };
3819 /**
3820 * Executes the `fn` function synchronously within the Angular zone and returns value returned by
3821 * the function.
3822 *
3823 * Running functions via `run` allows you to reenter Angular zone from a task that was executed
3824 * outside of the Angular zone (typically started via {\@link #runOutsideAngular}).
3825 *
3826 * Any future tasks or microtasks scheduled from within this function will continue executing from
3827 * within the Angular zone.
3828 *
3829 * If a synchronous error happens it will be rethrown and not reported via `onError`.
3830 * @param {?} fn
3831 * @return {?}
3832 */
3833 NgZone.prototype.run = function (fn) { return this.inner.run(fn); };
3834 /**
3835 * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
3836 * rethrown.
3837 * @param {?} fn
3838 * @return {?}
3839 */
3840 NgZone.prototype.runGuarded = function (fn) { return this.inner.runGuarded(fn); };
3841 /**
3842 * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
3843 * the function.
3844 *
3845 * Running functions via {\@link #runOutsideAngular} allows you to escape Angular's zone and do
3846 * work that
3847 * doesn't trigger Angular change-detection or is subject to Angular's error handling.
3848 *
3849 * Any future tasks or microtasks scheduled from within this function will continue executing from
3850 * outside of the Angular zone.
3851 *
3852 * Use {\@link #run} to reenter the Angular zone and do work that updates the application model.
3853 * @param {?} fn
3854 * @return {?}
3855 */
3856 NgZone.prototype.runOutsideAngular = function (fn) { return this.outer.run(fn); };
3857 Object.defineProperty(NgZone.prototype, "onUnstable", {
3858 /**
3859 * Notifies when code enters Angular Zone. This gets fired first on VM Turn.
3860 * @return {?}
3861 */
3862 get: function () { return this._onUnstable; },
3863 enumerable: true,
3864 configurable: true
3865 });
3866 Object.defineProperty(NgZone.prototype, "onMicrotaskEmpty", {
3867 /**
3868 * Notifies when there is no more microtasks enqueue in the current VM Turn.
3869 * This is a hint for Angular to do change detection, which may enqueue more microtasks.
3870 * For this reason this event can fire multiple times per VM Turn.
3871 * @return {?}
3872 */
3873 get: function () { return this._onMicrotaskEmpty; },
3874 enumerable: true,
3875 configurable: true
3876 });
3877 Object.defineProperty(NgZone.prototype, "onStable", {
3878 /**
3879 * Notifies when the last `onMicrotaskEmpty` has run and there are no more microtasks, which
3880 * implies we are about to relinquish VM turn.
3881 * This event gets called just once.
3882 * @return {?}
3883 */
3884 get: function () { return this._onStable; },
3885 enumerable: true,
3886 configurable: true
3887 });
3888 Object.defineProperty(NgZone.prototype, "onError", {
3889 /**
3890 * Notify that an error has been delivered.
3891 * @return {?}
3892 */
3893 get: function () { return this._onErrorEvents; },
3894 enumerable: true,
3895 configurable: true
3896 });
3897 Object.defineProperty(NgZone.prototype, "isStable", {
3898 /**
3899 * Whether there are no outstanding microtasks or macrotasks.
3900 * @return {?}
3901 */
3902 get: function () { return this._isStable; },
3903 enumerable: true,
3904 configurable: true
3905 });
3906 Object.defineProperty(NgZone.prototype, "hasPendingMicrotasks", {
3907 /**
3908 * @return {?}
3909 */
3910 get: function () { return this._hasPendingMicrotasks; },
3911 enumerable: true,
3912 configurable: true
3913 });
3914 Object.defineProperty(NgZone.prototype, "hasPendingMacrotasks", {
3915 /**
3916 * @return {?}
3917 */
3918 get: function () { return this._hasPendingMacrotasks; },
3919 enumerable: true,
3920 configurable: true
3921 });
3922 /**
3923 * @return {?}
3924 */
3925 NgZone.prototype.checkStable = function () {
3926 var _this = this;
3927 if (this._nesting == 0 && !this._hasPendingMicrotasks && !this._isStable) {
3928 try {
3929 this._nesting++;
3930 this._onMicrotaskEmpty.emit(null);
3931 }
3932 finally {
3933 this._nesting--;
3934 if (!this._hasPendingMicrotasks) {
3935 try {
3936 this.runOutsideAngular(function () { return _this._onStable.emit(null); });
3937 }
3938 finally {
3939 this._isStable = true;
3940 }
3941 }
3942 }
3943 }
3944 };
3945 /**
3946 * @return {?}
3947 */
3948 NgZone.prototype.forkInnerZoneWithAngularBehavior = function () {
3949 var _this = this;
3950 this.inner = this.inner.fork({
3951 name: 'angular',
3952 properties: /** @type {?} */ ({ 'isAngularZone': true }),
3953 onInvokeTask: function (delegate, current, target, task, applyThis, applyArgs) {
3954 try {
3955 _this.onEnter();
3956 return delegate.invokeTask(target, task, applyThis, applyArgs);
3957 }
3958 finally {
3959 _this.onLeave();
3960 }
3961 },
3962 onInvoke: function (delegate, current, target, callback, applyThis, applyArgs, source) {
3963 try {
3964 _this.onEnter();
3965 return delegate.invoke(target, callback, applyThis, applyArgs, source);
3966 }
3967 finally {
3968 _this.onLeave();
3969 }
3970 },
3971 onHasTask: function (delegate, current, target, hasTaskState) {
3972 delegate.hasTask(target, hasTaskState);
3973 if (current === target) {
3974 // We are only interested in hasTask events which originate from our zone
3975 // (A child hasTask event is not interesting to us)
3976 if (hasTaskState.change == 'microTask') {
3977 _this.setHasMicrotask(hasTaskState.microTask);
3978 }
3979 else if (hasTaskState.change == 'macroTask') {
3980 _this.setHasMacrotask(hasTaskState.macroTask);
3981 }
3982 }
3983 },
3984 onHandleError: function (delegate, current, target, error) {
3985 delegate.handleError(target, error);
3986 _this.triggerError(error);
3987 return false;
3988 }
3989 });
3990 };
3991 /**
3992 * @return {?}
3993 */
3994 NgZone.prototype.onEnter = function () {
3995 this._nesting++;
3996 if (this._isStable) {
3997 this._isStable = false;
3998 this._onUnstable.emit(null);
3999 }
4000 };
4001 /**
4002 * @return {?}
4003 */
4004 NgZone.prototype.onLeave = function () {
4005 this._nesting--;
4006 this.checkStable();
4007 };
4008 /**
4009 * @param {?} hasMicrotasks
4010 * @return {?}
4011 */
4012 NgZone.prototype.setHasMicrotask = function (hasMicrotasks) {
4013 this._hasPendingMicrotasks = hasMicrotasks;
4014 this.checkStable();
4015 };
4016 /**
4017 * @param {?} hasMacrotasks
4018 * @return {?}
4019 */
4020 NgZone.prototype.setHasMacrotask = function (hasMacrotasks) { this._hasPendingMacrotasks = hasMacrotasks; };
4021 /**
4022 * @param {?} error
4023 * @return {?}
4024 */
4025 NgZone.prototype.triggerError = function (error) { this._onErrorEvents.emit(error); };
4026 return NgZone;
4027}());
4028/**
4029 * @license
4030 * Copyright Google Inc. All Rights Reserved.
4031 *
4032 * Use of this source code is governed by an MIT-style license that can be
4033 * found in the LICENSE file at https://angular.io/license
4034 */
4035/**
4036 * The Testability service provides testing hooks that can be accessed from
4037 * the browser and by services such as Protractor. Each bootstrapped Angular
4038 * application on the page will have an instance of Testability.
4039 * \@experimental
4040 */
4041var Testability = (function () {
4042 /**
4043 * @param {?} _ngZone
4044 */
4045 function Testability(_ngZone) {
4046 this._ngZone = _ngZone;
4047 /**
4048 * \@internal
4049 */
4050 this._pendingCount = 0;
4051 /**
4052 * \@internal
4053 */
4054 this._isZoneStable = true;
4055 /**
4056 * Whether any work was done since the last 'whenStable' callback. This is
4057 * useful to detect if this could have potentially destabilized another
4058 * component while it is stabilizing.
4059 * \@internal
4060 */
4061 this._didWork = false;
4062 /**
4063 * \@internal
4064 */
4065 this._callbacks = [];
4066 this._watchAngularEvents();
4067 }
4068 /**
4069 * \@internal
4070 * @return {?}
4071 */
4072 Testability.prototype._watchAngularEvents = function () {
4073 var _this = this;
4074 this._ngZone.onUnstable.subscribe({
4075 next: function () {
4076 _this._didWork = true;
4077 _this._isZoneStable = false;
4078 }
4079 });
4080 this._ngZone.runOutsideAngular(function () {
4081 _this._ngZone.onStable.subscribe({
4082 next: function () {
4083 NgZone.assertNotInAngularZone();
4084 scheduleMicroTask(function () {
4085 _this._isZoneStable = true;
4086 _this._runCallbacksIfReady();
4087 });
4088 }
4089 });
4090 });
4091 };
4092 /**
4093 * @return {?}
4094 */
4095 Testability.prototype.increasePendingRequestCount = function () {
4096 this._pendingCount += 1;
4097 this._didWork = true;
4098 return this._pendingCount;
4099 };
4100 /**
4101 * @return {?}
4102 */
4103 Testability.prototype.decreasePendingRequestCount = function () {
4104 this._pendingCount -= 1;
4105 if (this._pendingCount < 0) {
4106 throw new Error('pending async requests below zero');
4107 }
4108 this._runCallbacksIfReady();
4109 return this._pendingCount;
4110 };
4111 /**
4112 * @return {?}
4113 */
4114 Testability.prototype.isStable = function () {
4115 return this._isZoneStable && this._pendingCount == 0 && !this._ngZone.hasPendingMacrotasks;
4116 };
4117 /**
4118 * \@internal
4119 * @return {?}
4120 */
4121 Testability.prototype._runCallbacksIfReady = function () {
4122 var _this = this;
4123 if (this.isStable()) {
4124 // Schedules the call backs in a new frame so that it is always async.
4125 scheduleMicroTask(function () {
4126 while (_this._callbacks.length !== 0) {
4127 (((_this._callbacks.pop())))(_this._didWork);
4128 }
4129 _this._didWork = false;
4130 });
4131 }
4132 else {
4133 // Not Ready
4134 this._didWork = true;
4135 }
4136 };
4137 /**
4138 * @param {?} callback
4139 * @return {?}
4140 */
4141 Testability.prototype.whenStable = function (callback) {
4142 this._callbacks.push(callback);
4143 this._runCallbacksIfReady();
4144 };
4145 /**
4146 * @return {?}
4147 */
4148 Testability.prototype.getPendingRequestCount = function () { return this._pendingCount; };
4149 /**
4150 * @deprecated use findProviders
4151 * @param {?} using
4152 * @param {?} provider
4153 * @param {?} exactMatch
4154 * @return {?}
4155 */
4156 Testability.prototype.findBindings = function (using, provider, exactMatch) {
4157 // TODO(juliemr): implement.
4158 return [];
4159 };
4160 /**
4161 * @param {?} using
4162 * @param {?} provider
4163 * @param {?} exactMatch
4164 * @return {?}
4165 */
4166 Testability.prototype.findProviders = function (using, provider, exactMatch) {
4167 // TODO(juliemr): implement.
4168 return [];
4169 };
4170 return Testability;
4171}());
4172Testability.decorators = [
4173 { type: Injectable },
4174];
4175/**
4176 * @nocollapse
4177 */
4178Testability.ctorParameters = function () { return [
4179 { type: NgZone, },
4180]; };
4181/**
4182 * A global registry of {\@link Testability} instances for specific elements.
4183 * \@experimental
4184 */
4185var TestabilityRegistry = (function () {
4186 function TestabilityRegistry() {
4187 /**
4188 * \@internal
4189 */
4190 this._applications = new Map();
4191 _testabilityGetter.addToWindow(this);
4192 }
4193 /**
4194 * @param {?} token
4195 * @param {?} testability
4196 * @return {?}
4197 */
4198 TestabilityRegistry.prototype.registerApplication = function (token, testability) {
4199 this._applications.set(token, testability);
4200 };
4201 /**
4202 * @param {?} elem
4203 * @return {?}
4204 */
4205 TestabilityRegistry.prototype.getTestability = function (elem) { return this._applications.get(elem) || null; };
4206 /**
4207 * @return {?}
4208 */
4209 TestabilityRegistry.prototype.getAllTestabilities = function () { return Array.from(this._applications.values()); };
4210 /**
4211 * @return {?}
4212 */
4213 TestabilityRegistry.prototype.getAllRootElements = function () { return Array.from(this._applications.keys()); };
4214 /**
4215 * @param {?} elem
4216 * @param {?=} findInAncestors
4217 * @return {?}
4218 */
4219 TestabilityRegistry.prototype.findTestabilityInTree = function (elem, findInAncestors) {
4220 if (findInAncestors === void 0) { findInAncestors = true; }
4221 return _testabilityGetter.findTestabilityInTree(this, elem, findInAncestors);
4222 };
4223 return TestabilityRegistry;
4224}());
4225TestabilityRegistry.decorators = [
4226 { type: Injectable },
4227];
4228/**
4229 * @nocollapse
4230 */
4231TestabilityRegistry.ctorParameters = function () { return []; };
4232var _NoopGetTestability = (function () {
4233 function _NoopGetTestability() {
4234 }
4235 /**
4236 * @param {?} registry
4237 * @return {?}
4238 */
4239 _NoopGetTestability.prototype.addToWindow = function (registry) { };
4240 /**
4241 * @param {?} registry
4242 * @param {?} elem
4243 * @param {?} findInAncestors
4244 * @return {?}
4245 */
4246 _NoopGetTestability.prototype.findTestabilityInTree = function (registry, elem, findInAncestors) {
4247 return null;
4248 };
4249 return _NoopGetTestability;
4250}());
4251/**
4252 * Set the {\@link GetTestability} implementation used by the Angular testing framework.
4253 * \@experimental
4254 * @param {?} getter
4255 * @return {?}
4256 */
4257function setTestabilityGetter(getter) {
4258 _testabilityGetter = getter;
4259}
4260var _testabilityGetter = new _NoopGetTestability();
4261/**
4262 * @license
4263 * Copyright Google Inc. All Rights Reserved.
4264 *
4265 * Use of this source code is governed by an MIT-style license that can be
4266 * found in the LICENSE file at https://angular.io/license
4267 */
4268var _devMode = true;
4269var _runModeLocked = false;
4270var _platform;
4271var ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
4272/**
4273 * Disable Angular's development mode, which turns off assertions and other
4274 * checks within the framework.
4275 *
4276 * One important assertion this disables verifies that a change detection pass
4277 * does not result in additional changes to any bindings (also known as
4278 * unidirectional data flow).
4279 *
4280 * \@stable
4281 * @return {?}
4282 */
4283function enableProdMode() {
4284 if (_runModeLocked) {
4285 throw new Error('Cannot enable prod mode after platform setup.');
4286 }
4287 _devMode = false;
4288}
4289/**
4290 * Returns whether Angular is in development mode. After called once,
4291 * the value is locked and won't change any more.
4292 *
4293 * By default, this is true, unless a user calls `enableProdMode` before calling this.
4294 *
4295 * \@experimental APIs related to application bootstrap are currently under review.
4296 * @return {?}
4297 */
4298function isDevMode() {
4299 _runModeLocked = true;
4300 return _devMode;
4301}
4302/**
4303 * A token for third-party components that can register themselves with NgProbe.
4304 *
4305 * \@experimental
4306 */
4307var NgProbeToken = (function () {
4308 /**
4309 * @param {?} name
4310 * @param {?} token
4311 */
4312 function NgProbeToken(name, token) {
4313 this.name = name;
4314 this.token = token;
4315 }
4316 return NgProbeToken;
4317}());
4318/**
4319 * Creates a platform.
4320 * Platforms have to be eagerly created via this function.
4321 *
4322 * \@experimental APIs related to application bootstrap are currently under review.
4323 * @param {?} injector
4324 * @return {?}
4325 */
4326function createPlatform(injector) {
4327 if (_platform && !_platform.destroyed &&
4328 !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
4329 throw new Error('There can be only one platform. Destroy the previous one to create a new one.');
4330 }
4331 _platform = injector.get(PlatformRef);
4332 var /** @type {?} */ inits = injector.get(PLATFORM_INITIALIZER, null);
4333 if (inits)
4334 inits.forEach(function (init) { return init(); });
4335 return _platform;
4336}
4337/**
4338 * Creates a factory for a platform
4339 *
4340 * \@experimental APIs related to application bootstrap are currently under review.
4341 * @param {?} parentPlatformFactory
4342 * @param {?} name
4343 * @param {?=} providers
4344 * @return {?}
4345 */
4346function createPlatformFactory(parentPlatformFactory, name, providers) {
4347 if (providers === void 0) { providers = []; }
4348 var /** @type {?} */ marker = new InjectionToken("Platform: " + name);
4349 return function (extraProviders) {
4350 if (extraProviders === void 0) { extraProviders = []; }
4351 var /** @type {?} */ platform = getPlatform();
4352 if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
4353 if (parentPlatformFactory) {
4354 parentPlatformFactory(providers.concat(extraProviders).concat({ provide: marker, useValue: true }));
4355 }
4356 else {
4357 createPlatform(ReflectiveInjector.resolveAndCreate(providers.concat(extraProviders).concat({ provide: marker, useValue: true })));
4358 }
4359 }
4360 return assertPlatform(marker);
4361 };
4362}
4363/**
4364 * Checks that there currently is a platform which contains the given token as a provider.
4365 *
4366 * \@experimental APIs related to application bootstrap are currently under review.
4367 * @param {?} requiredToken
4368 * @return {?}
4369 */
4370function assertPlatform(requiredToken) {
4371 var /** @type {?} */ platform = getPlatform();
4372 if (!platform) {
4373 throw new Error('No platform exists!');
4374 }
4375 if (!platform.injector.get(requiredToken, null)) {
4376 throw new Error('A platform with a different configuration has been created. Please destroy it first.');
4377 }
4378 return platform;
4379}
4380/**
4381 * Destroy the existing platform.
4382 *
4383 * \@experimental APIs related to application bootstrap are currently under review.
4384 * @return {?}
4385 */
4386function destroyPlatform() {
4387 if (_platform && !_platform.destroyed) {
4388 _platform.destroy();
4389 }
4390}
4391/**
4392 * Returns the current platform.
4393 *
4394 * \@experimental APIs related to application bootstrap are currently under review.
4395 * @return {?}
4396 */
4397function getPlatform() {
4398 return _platform && !_platform.destroyed ? _platform : null;
4399}
4400/**
4401 * The Angular platform is the entry point for Angular on a web page. Each page
4402 * has exactly one platform, and services (such as reflection) which are common
4403 * to every Angular application running on the page are bound in its scope.
4404 *
4405 * A page's platform is initialized implicitly when a platform is created via a platform factory
4406 * (e.g. {\@link platformBrowser}), or explicitly by calling the {\@link createPlatform} function.
4407 *
4408 * \@stable
4409 * @abstract
4410 */
4411var PlatformRef = (function () {
4412 function PlatformRef() {
4413 }
4414 /**
4415 * Creates an instance of an `\@NgModule` for the given platform
4416 * for offline compilation.
4417 *
4418 * ## Simple Example
4419 *
4420 * ```typescript
4421 * my_module.ts:
4422 *
4423 * \@NgModule({
4424 * imports: [BrowserModule]
4425 * })
4426 * class MyModule {}
4427 *
4428 * main.ts:
4429 * import {MyModuleNgFactory} from './my_module.ngfactory';
4430 * import {platformBrowser} from '\@angular/platform-browser';
4431 *
4432 * let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
4433 * ```
4434 *
4435 * \@experimental APIs related to application bootstrap are currently under review.
4436 * @abstract
4437 * @template M
4438 * @param {?} moduleFactory
4439 * @return {?}
4440 */
4441 PlatformRef.prototype.bootstrapModuleFactory = function (moduleFactory) { };
4442 /**
4443 * Creates an instance of an `\@NgModule` for a given platform using the given runtime compiler.
4444 *
4445 * ## Simple Example
4446 *
4447 * ```typescript
4448 * \@NgModule({
4449 * imports: [BrowserModule]
4450 * })
4451 * class MyModule {}
4452 *
4453 * let moduleRef = platformBrowser().bootstrapModule(MyModule);
4454 * ```
4455 * \@stable
4456 * @abstract
4457 * @template M
4458 * @param {?} moduleType
4459 * @param {?=} compilerOptions
4460 * @return {?}
4461 */
4462 PlatformRef.prototype.bootstrapModule = function (moduleType, compilerOptions) { };
4463 /**
4464 * Register a listener to be called when the platform is disposed.
4465 * @abstract
4466 * @param {?} callback
4467 * @return {?}
4468 */
4469 PlatformRef.prototype.onDestroy = function (callback) { };
4470 /**
4471 * Retrieve the platform {\@link Injector}, which is the parent injector for
4472 * every Angular application on the page and provides singleton providers.
4473 * @abstract
4474 * @return {?}
4475 */
4476 PlatformRef.prototype.injector = function () { };
4477 /**
4478 * Destroy the Angular platform and all Angular applications on the page.
4479 * @abstract
4480 * @return {?}
4481 */
4482 PlatformRef.prototype.destroy = function () { };
4483 /**
4484 * @abstract
4485 * @return {?}
4486 */
4487 PlatformRef.prototype.destroyed = function () { };
4488 return PlatformRef;
4489}());
4490/**
4491 * @param {?} errorHandler
4492 * @param {?} callback
4493 * @return {?}
4494 */
4495function _callAndReportToErrorHandler(errorHandler, callback) {
4496 try {
4497 var /** @type {?} */ result = callback();
4498 if (isPromise(result)) {
4499 return result.catch(function (e) {
4500 errorHandler.handleError(e);
4501 // rethrow as the exception handler might not do it
4502 throw e;
4503 });
4504 }
4505 return result;
4506 }
4507 catch (e) {
4508 errorHandler.handleError(e);
4509 // rethrow as the exception handler might not do it
4510 throw e;
4511 }
4512}
4513/**
4514 * workaround https://github.com/angular/tsickle/issues/350
4515 * @suppress {checkTypes}
4516 */
4517var PlatformRef_ = (function (_super) {
4518 __extends(PlatformRef_, _super);
4519 /**
4520 * @param {?} _injector
4521 */
4522 function PlatformRef_(_injector) {
4523 var _this = _super.call(this) || this;
4524 _this._injector = _injector;
4525 _this._modules = [];
4526 _this._destroyListeners = [];
4527 _this._destroyed = false;
4528 return _this;
4529 }
4530 /**
4531 * @param {?} callback
4532 * @return {?}
4533 */
4534 PlatformRef_.prototype.onDestroy = function (callback) { this._destroyListeners.push(callback); };
4535 Object.defineProperty(PlatformRef_.prototype, "injector", {
4536 /**
4537 * @return {?}
4538 */
4539 get: function () { return this._injector; },
4540 enumerable: true,
4541 configurable: true
4542 });
4543 Object.defineProperty(PlatformRef_.prototype, "destroyed", {
4544 /**
4545 * @return {?}
4546 */
4547 get: function () { return this._destroyed; },
4548 enumerable: true,
4549 configurable: true
4550 });
4551 /**
4552 * @return {?}
4553 */
4554 PlatformRef_.prototype.destroy = function () {
4555 if (this._destroyed) {
4556 throw new Error('The platform has already been destroyed!');
4557 }
4558 this._modules.slice().forEach(function (module) { return module.destroy(); });
4559 this._destroyListeners.forEach(function (listener) { return listener(); });
4560 this._destroyed = true;
4561 };
4562 /**
4563 * @template M
4564 * @param {?} moduleFactory
4565 * @return {?}
4566 */
4567 PlatformRef_.prototype.bootstrapModuleFactory = function (moduleFactory) {
4568 return this._bootstrapModuleFactoryWithZone(moduleFactory);
4569 };
4570 /**
4571 * @template M
4572 * @param {?} moduleFactory
4573 * @param {?=} ngZone
4574 * @return {?}
4575 */
4576 PlatformRef_.prototype._bootstrapModuleFactoryWithZone = function (moduleFactory, ngZone) {
4577 var _this = this;
4578 // Note: We need to create the NgZone _before_ we instantiate the module,
4579 // as instantiating the module creates some providers eagerly.
4580 // So we create a mini parent injector that just contains the new NgZone and
4581 // pass that as parent to the NgModuleFactory.
4582 if (!ngZone)
4583 ngZone = new NgZone({ enableLongStackTrace: isDevMode() });
4584 // Attention: Don't use ApplicationRef.run here,
4585 // as we want to be sure that all possible constructor calls are inside `ngZone.run`!
4586 return ngZone.run(function () {
4587 var /** @type {?} */ ngZoneInjector = ReflectiveInjector.resolveAndCreate([{ provide: NgZone, useValue: ngZone }], _this.injector);
4588 var /** @type {?} */ moduleRef = (moduleFactory.create(ngZoneInjector));
4589 var /** @type {?} */ exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
4590 if (!exceptionHandler) {
4591 throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?');
4592 }
4593 moduleRef.onDestroy(function () { return remove(_this._modules, moduleRef); }); /** @type {?} */
4594 ((ngZone)).onError.subscribe({ next: function (error) { exceptionHandler.handleError(error); } });
4595 return _callAndReportToErrorHandler(exceptionHandler, function () {
4596 var /** @type {?} */ initStatus = moduleRef.injector.get(ApplicationInitStatus);
4597 initStatus.runInitializers();
4598 return initStatus.donePromise.then(function () {
4599 _this._moduleDoBootstrap(moduleRef);
4600 return moduleRef;
4601 });
4602 });
4603 });
4604 };
4605 /**
4606 * @template M
4607 * @param {?} moduleType
4608 * @param {?=} compilerOptions
4609 * @return {?}
4610 */
4611 PlatformRef_.prototype.bootstrapModule = function (moduleType, compilerOptions) {
4612 if (compilerOptions === void 0) { compilerOptions = []; }
4613 return this._bootstrapModuleWithZone(moduleType, compilerOptions);
4614 };
4615 /**
4616 * @template M
4617 * @param {?} moduleType
4618 * @param {?=} compilerOptions
4619 * @param {?=} ngZone
4620 * @return {?}
4621 */
4622 PlatformRef_.prototype._bootstrapModuleWithZone = function (moduleType, compilerOptions, ngZone) {
4623 var _this = this;
4624 if (compilerOptions === void 0) { compilerOptions = []; }
4625 var /** @type {?} */ compilerFactory = this.injector.get(CompilerFactory);
4626 var /** @type {?} */ compiler = compilerFactory.createCompiler(Array.isArray(compilerOptions) ? compilerOptions : [compilerOptions]);
4627 return compiler.compileModuleAsync(moduleType)
4628 .then(function (moduleFactory) { return _this._bootstrapModuleFactoryWithZone(moduleFactory, ngZone); });
4629 };
4630 /**
4631 * @param {?} moduleRef
4632 * @return {?}
4633 */
4634 PlatformRef_.prototype._moduleDoBootstrap = function (moduleRef) {
4635 var /** @type {?} */ appRef = (moduleRef.injector.get(ApplicationRef));
4636 if (moduleRef._bootstrapComponents.length > 0) {
4637 moduleRef._bootstrapComponents.forEach(function (f) { return appRef.bootstrap(f); });
4638 }
4639 else if (moduleRef.instance.ngDoBootstrap) {
4640 moduleRef.instance.ngDoBootstrap(appRef);
4641 }
4642 else {
4643 throw new Error("The module " + stringify(moduleRef.instance.constructor) + " was bootstrapped, but it does not declare \"@NgModule.bootstrap\" components nor a \"ngDoBootstrap\" method. " +
4644 "Please define one of these.");
4645 }
4646 this._modules.push(moduleRef);
4647 };
4648 return PlatformRef_;
4649}(PlatformRef));
4650PlatformRef_.decorators = [
4651 { type: Injectable },
4652];
4653/**
4654 * @nocollapse
4655 */
4656PlatformRef_.ctorParameters = function () { return [
4657 { type: Injector, },
4658]; };
4659/**
4660 * A reference to an Angular application running on a page.
4661 *
4662 * \@stable
4663 * @abstract
4664 */
4665var ApplicationRef = (function () {
4666 function ApplicationRef() {
4667 }
4668 /**
4669 * Bootstrap a new component at the root level of the application.
4670 *
4671 * ### Bootstrap process
4672 *
4673 * When bootstrapping a new root component into an application, Angular mounts the
4674 * specified application component onto DOM elements identified by the [componentType]'s
4675 * selector and kicks off automatic change detection to finish initializing the component.
4676 *
4677 * Optionally, a component can be mounted onto a DOM element that does not match the
4678 * [componentType]'s selector.
4679 *
4680 * ### Example
4681 * {\@example core/ts/platform/platform.ts region='longform'}
4682 * @abstract
4683 * @template C
4684 * @param {?} componentFactory
4685 * @param {?=} rootSelectorOrNode
4686 * @return {?}
4687 */
4688 ApplicationRef.prototype.bootstrap = function (componentFactory, rootSelectorOrNode) { };
4689 /**
4690 * Invoke this method to explicitly process change detection and its side-effects.
4691 *
4692 * In development mode, `tick()` also performs a second change detection cycle to ensure that no
4693 * further changes are detected. If additional changes are picked up during this second cycle,
4694 * bindings in the app have side-effects that cannot be resolved in a single change detection
4695 * pass.
4696 * In this case, Angular throws an error, since an Angular application can only have one change
4697 * detection pass during which all change detection must complete.
4698 * @abstract
4699 * @return {?}
4700 */
4701 ApplicationRef.prototype.tick = function () { };
4702 /**
4703 * Get a list of component types registered to this application.
4704 * This list is populated even before the component is created.
4705 * @abstract
4706 * @return {?}
4707 */
4708 ApplicationRef.prototype.componentTypes = function () { };
4709 /**
4710 * Get a list of components registered to this application.
4711 * @abstract
4712 * @return {?}
4713 */
4714 ApplicationRef.prototype.components = function () { };
4715 /**
4716 * Attaches a view so that it will be dirty checked.
4717 * The view will be automatically detached when it is destroyed.
4718 * This will throw if the view is already attached to a ViewContainer.
4719 * @abstract
4720 * @param {?} view
4721 * @return {?}
4722 */
4723 ApplicationRef.prototype.attachView = function (view) { };
4724 /**
4725 * Detaches a view from dirty checking again.
4726 * @abstract
4727 * @param {?} view
4728 * @return {?}
4729 */
4730 ApplicationRef.prototype.detachView = function (view) { };
4731 /**
4732 * Returns the number of attached views.
4733 * @abstract
4734 * @return {?}
4735 */
4736 ApplicationRef.prototype.viewCount = function () { };
4737 /**
4738 * Returns an Observable that indicates when the application is stable or unstable.
4739 * @abstract
4740 * @return {?}
4741 */
4742 ApplicationRef.prototype.isStable = function () { };
4743 return ApplicationRef;
4744}());
4745/**
4746 * workaround https://github.com/angular/tsickle/issues/350
4747 * @suppress {checkTypes}
4748 */
4749var ApplicationRef_ = (function (_super) {
4750 __extends(ApplicationRef_, _super);
4751 /**
4752 * @param {?} _zone
4753 * @param {?} _console
4754 * @param {?} _injector
4755 * @param {?} _exceptionHandler
4756 * @param {?} _componentFactoryResolver
4757 * @param {?} _initStatus
4758 */
4759 function ApplicationRef_(_zone, _console, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus) {
4760 var _this = _super.call(this) || this;
4761 _this._zone = _zone;
4762 _this._console = _console;
4763 _this._injector = _injector;
4764 _this._exceptionHandler = _exceptionHandler;
4765 _this._componentFactoryResolver = _componentFactoryResolver;
4766 _this._initStatus = _initStatus;
4767 _this._bootstrapListeners = [];
4768 _this._rootComponents = [];
4769 _this._rootComponentTypes = [];
4770 _this._views = [];
4771 _this._runningTick = false;
4772 _this._enforceNoNewChanges = false;
4773 _this._stable = true;
4774 _this._enforceNoNewChanges = isDevMode();
4775 _this._zone.onMicrotaskEmpty.subscribe({ next: function () { _this._zone.run(function () { _this.tick(); }); } });
4776 var isCurrentlyStable = new rxjs_Observable.Observable(function (observer) {
4777 _this._stable = _this._zone.isStable && !_this._zone.hasPendingMacrotasks &&
4778 !_this._zone.hasPendingMicrotasks;
4779 _this._zone.runOutsideAngular(function () {
4780 observer.next(_this._stable);
4781 observer.complete();
4782 });
4783 });
4784 var isStable = new rxjs_Observable.Observable(function (observer) {
4785 var stableSub = _this._zone.onStable.subscribe(function () {
4786 NgZone.assertNotInAngularZone();
4787 // Check whether there are no pending macro/micro tasks in the next tick
4788 // to allow for NgZone to update the state.
4789 scheduleMicroTask(function () {
4790 if (!_this._stable && !_this._zone.hasPendingMacrotasks &&
4791 !_this._zone.hasPendingMicrotasks) {
4792 _this._stable = true;
4793 observer.next(true);
4794 }
4795 });
4796 });
4797 var unstableSub = _this._zone.onUnstable.subscribe(function () {
4798 NgZone.assertInAngularZone();
4799 if (_this._stable) {
4800 _this._stable = false;
4801 _this._zone.runOutsideAngular(function () { observer.next(false); });
4802 }
4803 });
4804 return function () {
4805 stableSub.unsubscribe();
4806 unstableSub.unsubscribe();
4807 };
4808 });
4809 _this._isStable = rxjs_observable_merge.merge(isCurrentlyStable, rxjs_operator_share.share.call(isStable));
4810 return _this;
4811 }
4812 /**
4813 * @param {?} viewRef
4814 * @return {?}
4815 */
4816 ApplicationRef_.prototype.attachView = function (viewRef) {
4817 var /** @type {?} */ view = ((viewRef));
4818 this._views.push(view);
4819 view.attachToAppRef(this);
4820 };
4821 /**
4822 * @param {?} viewRef
4823 * @return {?}
4824 */
4825 ApplicationRef_.prototype.detachView = function (viewRef) {
4826 var /** @type {?} */ view = ((viewRef));
4827 remove(this._views, view);
4828 view.detachFromAppRef();
4829 };
4830 /**
4831 * @template C
4832 * @param {?} componentOrFactory
4833 * @param {?=} rootSelectorOrNode
4834 * @return {?}
4835 */
4836 ApplicationRef_.prototype.bootstrap = function (componentOrFactory, rootSelectorOrNode) {
4837 var _this = this;
4838 if (!this._initStatus.done) {
4839 throw new Error('Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.');
4840 }
4841 var /** @type {?} */ componentFactory;
4842 if (componentOrFactory instanceof ComponentFactory) {
4843 componentFactory = componentOrFactory;
4844 }
4845 else {
4846 componentFactory = ((this._componentFactoryResolver.resolveComponentFactory(componentOrFactory)));
4847 }
4848 this._rootComponentTypes.push(componentFactory.componentType);
4849 // Create a factory associated with the current module if it's not bound to some other
4850 var /** @type {?} */ ngModule = componentFactory instanceof ComponentFactoryBoundToModule ?
4851 null :
4852 this._injector.get(NgModuleRef);
4853 var /** @type {?} */ selectorOrNode = rootSelectorOrNode || componentFactory.selector;
4854 var /** @type {?} */ compRef = componentFactory.create(Injector.NULL, [], selectorOrNode, ngModule);
4855 compRef.onDestroy(function () { _this._unloadComponent(compRef); });
4856 var /** @type {?} */ testability = compRef.injector.get(Testability, null);
4857 if (testability) {
4858 compRef.injector.get(TestabilityRegistry)
4859 .registerApplication(compRef.location.nativeElement, testability);
4860 }
4861 this._loadComponent(compRef);
4862 if (isDevMode()) {
4863 this._console.log("Angular is running in the development mode. Call enableProdMode() to enable the production mode.");
4864 }
4865 return compRef;
4866 };
4867 /**
4868 * @param {?} componentRef
4869 * @return {?}
4870 */
4871 ApplicationRef_.prototype._loadComponent = function (componentRef) {
4872 this.attachView(componentRef.hostView);
4873 this.tick();
4874 this._rootComponents.push(componentRef);
4875 // Get the listeners lazily to prevent DI cycles.
4876 var /** @type {?} */ listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []).concat(this._bootstrapListeners);
4877 listeners.forEach(function (listener) { return listener(componentRef); });
4878 };
4879 /**
4880 * @param {?} componentRef
4881 * @return {?}
4882 */
4883 ApplicationRef_.prototype._unloadComponent = function (componentRef) {
4884 this.detachView(componentRef.hostView);
4885 remove(this._rootComponents, componentRef);
4886 };
4887 /**
4888 * @return {?}
4889 */
4890 ApplicationRef_.prototype.tick = function () {
4891 if (this._runningTick) {
4892 throw new Error('ApplicationRef.tick is called recursively');
4893 }
4894 var /** @type {?} */ scope = ApplicationRef_._tickScope();
4895 try {
4896 this._runningTick = true;
4897 this._views.forEach(function (view) { return view.detectChanges(); });
4898 if (this._enforceNoNewChanges) {
4899 this._views.forEach(function (view) { return view.checkNoChanges(); });
4900 }
4901 }
4902 catch (e) {
4903 // Attention: Don't rethrow as it could cancel subscriptions to Observables!
4904 this._exceptionHandler.handleError(e);
4905 }
4906 finally {
4907 this._runningTick = false;
4908 wtfLeave(scope);
4909 }
4910 };
4911 /**
4912 * @return {?}
4913 */
4914 ApplicationRef_.prototype.ngOnDestroy = function () {
4915 // TODO(alxhub): Dispose of the NgZone.
4916 this._views.slice().forEach(function (view) { return view.destroy(); });
4917 };
4918 Object.defineProperty(ApplicationRef_.prototype, "viewCount", {
4919 /**
4920 * @return {?}
4921 */
4922 get: function () { return this._views.length; },
4923 enumerable: true,
4924 configurable: true
4925 });
4926 Object.defineProperty(ApplicationRef_.prototype, "componentTypes", {
4927 /**
4928 * @return {?}
4929 */
4930 get: function () { return this._rootComponentTypes; },
4931 enumerable: true,
4932 configurable: true
4933 });
4934 Object.defineProperty(ApplicationRef_.prototype, "components", {
4935 /**
4936 * @return {?}
4937 */
4938 get: function () { return this._rootComponents; },
4939 enumerable: true,
4940 configurable: true
4941 });
4942 Object.defineProperty(ApplicationRef_.prototype, "isStable", {
4943 /**
4944 * @return {?}
4945 */
4946 get: function () { return this._isStable; },
4947 enumerable: true,
4948 configurable: true
4949 });
4950 return ApplicationRef_;
4951}(ApplicationRef));
4952/**
4953 * \@internal
4954 */
4955ApplicationRef_._tickScope = wtfCreateScope('ApplicationRef#tick()');
4956ApplicationRef_.decorators = [
4957 { type: Injectable },
4958];
4959/**
4960 * @nocollapse
4961 */
4962ApplicationRef_.ctorParameters = function () { return [
4963 { type: NgZone, },
4964 { type: Console, },
4965 { type: Injector, },
4966 { type: ErrorHandler, },
4967 { type: ComponentFactoryResolver, },
4968 { type: ApplicationInitStatus, },
4969]; };
4970/**
4971 * @template T
4972 * @param {?} list
4973 * @param {?} el
4974 * @return {?}
4975 */
4976function remove(list, el) {
4977 var /** @type {?} */ index = list.indexOf(el);
4978 if (index > -1) {
4979 list.splice(index, 1);
4980 }
4981}
4982/**
4983 * @license
4984 * Copyright Google Inc. All Rights Reserved.
4985 *
4986 * Use of this source code is governed by an MIT-style license that can be
4987 * found in the LICENSE file at https://angular.io/license
4988 */
4989// Public API for Zone
4990/**
4991 * @license
4992 * Copyright Google Inc. All Rights Reserved.
4993 *
4994 * Use of this source code is governed by an MIT-style license that can be
4995 * found in the LICENSE file at https://angular.io/license
4996 */
4997/**
4998 * @deprecated Use `RendererType2` (and `Renderer2`) instead.
4999 */
5000var RenderComponentType = (function () {
5001 /**
5002 * @param {?} id
5003 * @param {?} templateUrl
5004 * @param {?} slotCount
5005 * @param {?} encapsulation
5006 * @param {?} styles
5007 * @param {?} animations
5008 */
5009 function RenderComponentType(id, templateUrl, slotCount, encapsulation, styles, animations) {
5010 this.id = id;
5011 this.templateUrl = templateUrl;
5012 this.slotCount = slotCount;
5013 this.encapsulation = encapsulation;
5014 this.styles = styles;
5015 this.animations = animations;
5016 }
5017 return RenderComponentType;
5018}());
5019/**
5020 * @deprecated Debug info is handeled internally in the view engine now.
5021 * @abstract
5022 */
5023var RenderDebugInfo = (function () {
5024 function RenderDebugInfo() {
5025 }
5026 /**
5027 * @abstract
5028 * @return {?}
5029 */
5030 RenderDebugInfo.prototype.injector = function () { };
5031 /**
5032 * @abstract
5033 * @return {?}
5034 */
5035 RenderDebugInfo.prototype.component = function () { };
5036 /**
5037 * @abstract
5038 * @return {?}
5039 */
5040 RenderDebugInfo.prototype.providerTokens = function () { };
5041 /**
5042 * @abstract
5043 * @return {?}
5044 */
5045 RenderDebugInfo.prototype.references = function () { };
5046 /**
5047 * @abstract
5048 * @return {?}
5049 */
5050 RenderDebugInfo.prototype.context = function () { };
5051 /**
5052 * @abstract
5053 * @return {?}
5054 */
5055 RenderDebugInfo.prototype.source = function () { };
5056 return RenderDebugInfo;
5057}());
5058/**
5059 * @deprecated Use the `Renderer2` instead.
5060 * @abstract
5061 */
5062var Renderer = (function () {
5063 function Renderer() {
5064 }
5065 /**
5066 * @abstract
5067 * @param {?} selectorOrNode
5068 * @param {?=} debugInfo
5069 * @return {?}
5070 */
5071 Renderer.prototype.selectRootElement = function (selectorOrNode, debugInfo) { };
5072 /**
5073 * @abstract
5074 * @param {?} parentElement
5075 * @param {?} name
5076 * @param {?=} debugInfo
5077 * @return {?}
5078 */
5079 Renderer.prototype.createElement = function (parentElement, name, debugInfo) { };
5080 /**
5081 * @abstract
5082 * @param {?} hostElement
5083 * @return {?}
5084 */
5085 Renderer.prototype.createViewRoot = function (hostElement) { };
5086 /**
5087 * @abstract
5088 * @param {?} parentElement
5089 * @param {?=} debugInfo
5090 * @return {?}
5091 */
5092 Renderer.prototype.createTemplateAnchor = function (parentElement, debugInfo) { };
5093 /**
5094 * @abstract
5095 * @param {?} parentElement
5096 * @param {?} value
5097 * @param {?=} debugInfo
5098 * @return {?}
5099 */
5100 Renderer.prototype.createText = function (parentElement, value, debugInfo) { };
5101 /**
5102 * @abstract
5103 * @param {?} parentElement
5104 * @param {?} nodes
5105 * @return {?}
5106 */
5107 Renderer.prototype.projectNodes = function (parentElement, nodes) { };
5108 /**
5109 * @abstract
5110 * @param {?} node
5111 * @param {?} viewRootNodes
5112 * @return {?}
5113 */
5114 Renderer.prototype.attachViewAfter = function (node, viewRootNodes) { };
5115 /**
5116 * @abstract
5117 * @param {?} viewRootNodes
5118 * @return {?}
5119 */
5120 Renderer.prototype.detachView = function (viewRootNodes) { };
5121 /**
5122 * @abstract
5123 * @param {?} hostElement
5124 * @param {?} viewAllNodes
5125 * @return {?}
5126 */
5127 Renderer.prototype.destroyView = function (hostElement, viewAllNodes) { };
5128 /**
5129 * @abstract
5130 * @param {?} renderElement
5131 * @param {?} name
5132 * @param {?} callback
5133 * @return {?}
5134 */
5135 Renderer.prototype.listen = function (renderElement, name, callback) { };
5136 /**
5137 * @abstract
5138 * @param {?} target
5139 * @param {?} name
5140 * @param {?} callback
5141 * @return {?}
5142 */
5143 Renderer.prototype.listenGlobal = function (target, name, callback) { };
5144 /**
5145 * @abstract
5146 * @param {?} renderElement
5147 * @param {?} propertyName
5148 * @param {?} propertyValue
5149 * @return {?}
5150 */
5151 Renderer.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) { };
5152 /**
5153 * @abstract
5154 * @param {?} renderElement
5155 * @param {?} attributeName
5156 * @param {?} attributeValue
5157 * @return {?}
5158 */
5159 Renderer.prototype.setElementAttribute = function (renderElement, attributeName, attributeValue) { };
5160 /**
5161 * Used only in debug mode to serialize property changes to dom nodes as attributes.
5162 * @abstract
5163 * @param {?} renderElement
5164 * @param {?} propertyName
5165 * @param {?} propertyValue
5166 * @return {?}
5167 */
5168 Renderer.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) { };
5169 /**
5170 * @abstract
5171 * @param {?} renderElement
5172 * @param {?} className
5173 * @param {?} isAdd
5174 * @return {?}
5175 */
5176 Renderer.prototype.setElementClass = function (renderElement, className, isAdd) { };
5177 /**
5178 * @abstract
5179 * @param {?} renderElement
5180 * @param {?} styleName
5181 * @param {?} styleValue
5182 * @return {?}
5183 */
5184 Renderer.prototype.setElementStyle = function (renderElement, styleName, styleValue) { };
5185 /**
5186 * @abstract
5187 * @param {?} renderElement
5188 * @param {?} methodName
5189 * @param {?=} args
5190 * @return {?}
5191 */
5192 Renderer.prototype.invokeElementMethod = function (renderElement, methodName, args) { };
5193 /**
5194 * @abstract
5195 * @param {?} renderNode
5196 * @param {?} text
5197 * @return {?}
5198 */
5199 Renderer.prototype.setText = function (renderNode, text) { };
5200 /**
5201 * @abstract
5202 * @param {?} element
5203 * @param {?} startingStyles
5204 * @param {?} keyframes
5205 * @param {?} duration
5206 * @param {?} delay
5207 * @param {?} easing
5208 * @param {?=} previousPlayers
5209 * @return {?}
5210 */
5211 Renderer.prototype.animate = function (element, startingStyles, keyframes, duration, delay, easing, previousPlayers) { };
5212 return Renderer;
5213}());
5214var Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
5215/**
5216 * Injectable service that provides a low-level interface for modifying the UI.
5217 *
5218 * Use this service to bypass Angular's templating and make custom UI changes that can't be
5219 * expressed declaratively. For example if you need to set a property or an attribute whose name is
5220 * not statically known, use {\@link Renderer#setElementProperty} or {\@link
5221 * Renderer#setElementAttribute}
5222 * respectively.
5223 *
5224 * If you are implementing a custom renderer, you must implement this interface.
5225 *
5226 * The default Renderer implementation is `DomRenderer`. Also available is `WebWorkerRenderer`.
5227 *
5228 * @deprecated Use `RendererFactory2` instead.
5229 * @abstract
5230 */
5231var RootRenderer = (function () {
5232 function RootRenderer() {
5233 }
5234 /**
5235 * @abstract
5236 * @param {?} componentType
5237 * @return {?}
5238 */
5239 RootRenderer.prototype.renderComponent = function (componentType) { };
5240 return RootRenderer;
5241}());
5242/**
5243 * \@experimental
5244 * @abstract
5245 */
5246var RendererFactory2 = (function () {
5247 function RendererFactory2() {
5248 }
5249 /**
5250 * @abstract
5251 * @param {?} hostElement
5252 * @param {?} type
5253 * @return {?}
5254 */
5255 RendererFactory2.prototype.createRenderer = function (hostElement, type) { };
5256 /**
5257 * @abstract
5258 * @return {?}
5259 */
5260 RendererFactory2.prototype.begin = function () { };
5261 /**
5262 * @abstract
5263 * @return {?}
5264 */
5265 RendererFactory2.prototype.end = function () { };
5266 /**
5267 * @abstract
5268 * @return {?}
5269 */
5270 RendererFactory2.prototype.whenRenderingDone = function () { };
5271 return RendererFactory2;
5272}());
5273var RendererStyleFlags2 = {};
5274RendererStyleFlags2.Important = 1;
5275RendererStyleFlags2.DashCase = 2;
5276RendererStyleFlags2[RendererStyleFlags2.Important] = "Important";
5277RendererStyleFlags2[RendererStyleFlags2.DashCase] = "DashCase";
5278/**
5279 * \@experimental
5280 * @abstract
5281 */
5282var Renderer2 = (function () {
5283 function Renderer2() {
5284 }
5285 /**
5286 * This field can be used to store arbitrary data on this renderer instance.
5287 * This is useful for renderers that delegate to other renderers.
5288 * @abstract
5289 * @return {?}
5290 */
5291 Renderer2.prototype.data = function () { };
5292 /**
5293 * @abstract
5294 * @return {?}
5295 */
5296 Renderer2.prototype.destroy = function () { };
5297 /**
5298 * @abstract
5299 * @param {?} name
5300 * @param {?=} namespace
5301 * @return {?}
5302 */
5303 Renderer2.prototype.createElement = function (name, namespace) { };
5304 /**
5305 * @abstract
5306 * @param {?} value
5307 * @return {?}
5308 */
5309 Renderer2.prototype.createComment = function (value) { };
5310 /**
5311 * @abstract
5312 * @param {?} value
5313 * @return {?}
5314 */
5315 Renderer2.prototype.createText = function (value) { };
5316 /**
5317 * @abstract
5318 * @param {?} parent
5319 * @param {?} newChild
5320 * @return {?}
5321 */
5322 Renderer2.prototype.appendChild = function (parent, newChild) { };
5323 /**
5324 * @abstract
5325 * @param {?} parent
5326 * @param {?} newChild
5327 * @param {?} refChild
5328 * @return {?}
5329 */
5330 Renderer2.prototype.insertBefore = function (parent, newChild, refChild) { };
5331 /**
5332 * @abstract
5333 * @param {?} parent
5334 * @param {?} oldChild
5335 * @return {?}
5336 */
5337 Renderer2.prototype.removeChild = function (parent, oldChild) { };
5338 /**
5339 * @abstract
5340 * @param {?} selectorOrNode
5341 * @return {?}
5342 */
5343 Renderer2.prototype.selectRootElement = function (selectorOrNode) { };
5344 /**
5345 * Attention: On WebWorkers, this will always return a value,
5346 * as we are asking for a result synchronously. I.e.
5347 * the caller can't rely on checking whether this is null or not.
5348 * @abstract
5349 * @param {?} node
5350 * @return {?}
5351 */
5352 Renderer2.prototype.parentNode = function (node) { };
5353 /**
5354 * Attention: On WebWorkers, this will always return a value,
5355 * as we are asking for a result synchronously. I.e.
5356 * the caller can't rely on checking whether this is null or not.
5357 * @abstract
5358 * @param {?} node
5359 * @return {?}
5360 */
5361 Renderer2.prototype.nextSibling = function (node) { };
5362 /**
5363 * @abstract
5364 * @param {?} el
5365 * @param {?} name
5366 * @param {?} value
5367 * @param {?=} namespace
5368 * @return {?}
5369 */
5370 Renderer2.prototype.setAttribute = function (el, name, value, namespace) { };
5371 /**
5372 * @abstract
5373 * @param {?} el
5374 * @param {?} name
5375 * @param {?=} namespace
5376 * @return {?}
5377 */
5378 Renderer2.prototype.removeAttribute = function (el, name, namespace) { };
5379 /**
5380 * @abstract
5381 * @param {?} el
5382 * @param {?} name
5383 * @return {?}
5384 */
5385 Renderer2.prototype.addClass = function (el, name) { };
5386 /**
5387 * @abstract
5388 * @param {?} el
5389 * @param {?} name
5390 * @return {?}
5391 */
5392 Renderer2.prototype.removeClass = function (el, name) { };
5393 /**
5394 * @abstract
5395 * @param {?} el
5396 * @param {?} style
5397 * @param {?} value
5398 * @param {?=} flags
5399 * @return {?}
5400 */
5401 Renderer2.prototype.setStyle = function (el, style, value, flags) { };
5402 /**
5403 * @abstract
5404 * @param {?} el
5405 * @param {?} style
5406 * @param {?=} flags
5407 * @return {?}
5408 */
5409 Renderer2.prototype.removeStyle = function (el, style, flags) { };
5410 /**
5411 * @abstract
5412 * @param {?} el
5413 * @param {?} name
5414 * @param {?} value
5415 * @return {?}
5416 */
5417 Renderer2.prototype.setProperty = function (el, name, value) { };
5418 /**
5419 * @abstract
5420 * @param {?} node
5421 * @param {?} value
5422 * @return {?}
5423 */
5424 Renderer2.prototype.setValue = function (node, value) { };
5425 /**
5426 * @abstract
5427 * @param {?} target
5428 * @param {?} eventName
5429 * @param {?} callback
5430 * @return {?}
5431 */
5432 Renderer2.prototype.listen = function (target, eventName, callback) { };
5433 return Renderer2;
5434}());
5435/**
5436 * @license
5437 * Copyright Google Inc. All Rights Reserved.
5438 *
5439 * Use of this source code is governed by an MIT-style license that can be
5440 * found in the LICENSE file at https://angular.io/license
5441 */
5442// Public API for render
5443var ElementRef = (function () {
5444 /**
5445 * @param {?} nativeElement
5446 */
5447 function ElementRef(nativeElement) {
5448 this.nativeElement = nativeElement;
5449 }
5450 return ElementRef;
5451}());
5452/**
5453 * @license
5454 * Copyright Google Inc. All Rights Reserved.
5455 *
5456 * Use of this source code is governed by an MIT-style license that can be
5457 * found in the LICENSE file at https://angular.io/license
5458 */
5459/**
5460 * Used to load ng module factories.
5461 * \@stable
5462 * @abstract
5463 */
5464var NgModuleFactoryLoader = (function () {
5465 function NgModuleFactoryLoader() {
5466 }
5467 /**
5468 * @abstract
5469 * @param {?} path
5470 * @return {?}
5471 */
5472 NgModuleFactoryLoader.prototype.load = function (path) { };
5473 return NgModuleFactoryLoader;
5474}());
5475var moduleFactories = new Map();
5476/**
5477 * Registers a loaded module. Should only be called from generated NgModuleFactory code.
5478 * \@experimental
5479 * @param {?} id
5480 * @param {?} factory
5481 * @return {?}
5482 */
5483function registerModuleFactory(id, factory) {
5484 var /** @type {?} */ existing = moduleFactories.get(id);
5485 if (existing) {
5486 throw new Error("Duplicate module registered for " + id + " - " + existing.moduleType.name + " vs " + factory.moduleType.name);
5487 }
5488 moduleFactories.set(id, factory);
5489}
5490/**
5491 * @return {?}
5492 */
5493/**
5494 * Returns the NgModuleFactory with the given id, if it exists and has been loaded.
5495 * Factories for modules that do not specify an `id` cannot be retrieved. Throws if the module
5496 * cannot be found.
5497 * \@experimental
5498 * @param {?} id
5499 * @return {?}
5500 */
5501function getModuleFactory(id) {
5502 var /** @type {?} */ factory = moduleFactories.get(id);
5503 if (!factory)
5504 throw new Error("No module with ID " + id + " loaded");
5505 return factory;
5506}
5507/**
5508 * @license
5509 * Copyright Google Inc. All Rights Reserved.
5510 *
5511 * Use of this source code is governed by an MIT-style license that can be
5512 * found in the LICENSE file at https://angular.io/license
5513 */
5514/**
5515 * An unmodifiable list of items that Angular keeps up to date when the state
5516 * of the application changes.
5517 *
5518 * The type of object that {\@link ViewChildren}, {\@link ContentChildren}, and {\@link QueryList}
5519 * provide.
5520 *
5521 * Implements an iterable interface, therefore it can be used in both ES6
5522 * javascript `for (var i of items)` loops as well as in Angular templates with
5523 * `*ngFor="let i of myList"`.
5524 *
5525 * Changes can be observed by subscribing to the changes `Observable`.
5526 *
5527 * NOTE: In the future this class will implement an `Observable` interface.
5528 *
5529 * ### Example ([live demo](http://plnkr.co/edit/RX8sJnQYl9FWuSCWme5z?p=preview))
5530 * ```typescript
5531 * \@Component({...})
5532 * class Container {
5533 * \@ViewChildren(Item) items:QueryList<Item>;
5534 * }
5535 * ```
5536 * \@stable
5537 */
5538var QueryList = (function () {
5539 function QueryList() {
5540 this._dirty = true;
5541 this._results = [];
5542 this._emitter = new EventEmitter();
5543 }
5544 Object.defineProperty(QueryList.prototype, "changes", {
5545 /**
5546 * @return {?}
5547 */
5548 get: function () { return this._emitter; },
5549 enumerable: true,
5550 configurable: true
5551 });
5552 Object.defineProperty(QueryList.prototype, "length", {
5553 /**
5554 * @return {?}
5555 */
5556 get: function () { return this._results.length; },
5557 enumerable: true,
5558 configurable: true
5559 });
5560 Object.defineProperty(QueryList.prototype, "first", {
5561 /**
5562 * @return {?}
5563 */
5564 get: function () { return this._results[0]; },
5565 enumerable: true,
5566 configurable: true
5567 });
5568 Object.defineProperty(QueryList.prototype, "last", {
5569 /**
5570 * @return {?}
5571 */
5572 get: function () { return this._results[this.length - 1]; },
5573 enumerable: true,
5574 configurable: true
5575 });
5576 /**
5577 * See
5578 * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
5579 * @template U
5580 * @param {?} fn
5581 * @return {?}
5582 */
5583 QueryList.prototype.map = function (fn) { return this._results.map(fn); };
5584 /**
5585 * See
5586 * [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
5587 * @param {?} fn
5588 * @return {?}
5589 */
5590 QueryList.prototype.filter = function (fn) {
5591 return this._results.filter(fn);
5592 };
5593 /**
5594 * See
5595 * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
5596 * @param {?} fn
5597 * @return {?}
5598 */
5599 QueryList.prototype.find = function (fn) {
5600 return this._results.find(fn);
5601 };
5602 /**
5603 * See
5604 * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
5605 * @template U
5606 * @param {?} fn
5607 * @param {?} init
5608 * @return {?}
5609 */
5610 QueryList.prototype.reduce = function (fn, init) {
5611 return this._results.reduce(fn, init);
5612 };
5613 /**
5614 * See
5615 * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
5616 * @param {?} fn
5617 * @return {?}
5618 */
5619 QueryList.prototype.forEach = function (fn) { this._results.forEach(fn); };
5620 /**
5621 * See
5622 * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
5623 * @param {?} fn
5624 * @return {?}
5625 */
5626 QueryList.prototype.some = function (fn) {
5627 return this._results.some(fn);
5628 };
5629 /**
5630 * @return {?}
5631 */
5632 QueryList.prototype.toArray = function () { return this._results.slice(); };
5633 /**
5634 * @return {?}
5635 */
5636 QueryList.prototype[getSymbolIterator()] = function () { return ((this._results))[getSymbolIterator()](); };
5637 /**
5638 * @return {?}
5639 */
5640 QueryList.prototype.toString = function () { return this._results.toString(); };
5641 /**
5642 * @param {?} res
5643 * @return {?}
5644 */
5645 QueryList.prototype.reset = function (res) {
5646 this._results = flatten(res);
5647 this._dirty = false;
5648 };
5649 /**
5650 * @return {?}
5651 */
5652 QueryList.prototype.notifyOnChanges = function () { this._emitter.emit(this); };
5653 /**
5654 * internal
5655 * @return {?}
5656 */
5657 QueryList.prototype.setDirty = function () { this._dirty = true; };
5658 Object.defineProperty(QueryList.prototype, "dirty", {
5659 /**
5660 * internal
5661 * @return {?}
5662 */
5663 get: function () { return this._dirty; },
5664 enumerable: true,
5665 configurable: true
5666 });
5667 return QueryList;
5668}());
5669/**
5670 * @template T
5671 * @param {?} list
5672 * @return {?}
5673 */
5674function flatten(list) {
5675 return list.reduce(function (flat, item) {
5676 var /** @type {?} */ flatItem = Array.isArray(item) ? flatten(item) : item;
5677 return ((flat)).concat(flatItem);
5678 }, []);
5679}
5680/**
5681 * @license
5682 * Copyright Google Inc. All Rights Reserved.
5683 *
5684 * Use of this source code is governed by an MIT-style license that can be
5685 * found in the LICENSE file at https://angular.io/license
5686 */
5687var _SEPARATOR = '#';
5688var FACTORY_CLASS_SUFFIX = 'NgFactory';
5689/**
5690 * Configuration for SystemJsNgModuleLoader.
5691 * token.
5692 *
5693 * \@experimental
5694 * @abstract
5695 */
5696var SystemJsNgModuleLoaderConfig = (function () {
5697 function SystemJsNgModuleLoaderConfig() {
5698 }
5699 return SystemJsNgModuleLoaderConfig;
5700}());
5701var DEFAULT_CONFIG = {
5702 factoryPathPrefix: '',
5703 factoryPathSuffix: '.ngfactory',
5704};
5705/**
5706 * NgModuleFactoryLoader that uses SystemJS to load NgModuleFactory
5707 * \@experimental
5708 */
5709var SystemJsNgModuleLoader = (function () {
5710 /**
5711 * @param {?} _compiler
5712 * @param {?=} config
5713 */
5714 function SystemJsNgModuleLoader(_compiler, config) {
5715 this._compiler = _compiler;
5716 this._config = config || DEFAULT_CONFIG;
5717 }
5718 /**
5719 * @param {?} path
5720 * @return {?}
5721 */
5722 SystemJsNgModuleLoader.prototype.load = function (path) {
5723 var /** @type {?} */ offlineMode = this._compiler instanceof Compiler;
5724 return offlineMode ? this.loadFactory(path) : this.loadAndCompile(path);
5725 };
5726 /**
5727 * @param {?} path
5728 * @return {?}
5729 */
5730 SystemJsNgModuleLoader.prototype.loadAndCompile = function (path) {
5731 var _this = this;
5732 var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1];
5733 if (exportName === undefined) {
5734 exportName = 'default';
5735 }
5736 return System.import(module)
5737 .then(function (module) { return module[exportName]; })
5738 .then(function (type) { return checkNotEmpty(type, module, exportName); })
5739 .then(function (type) { return _this._compiler.compileModuleAsync(type); });
5740 };
5741 /**
5742 * @param {?} path
5743 * @return {?}
5744 */
5745 SystemJsNgModuleLoader.prototype.loadFactory = function (path) {
5746 var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1];
5747 var /** @type {?} */ factoryClassSuffix = FACTORY_CLASS_SUFFIX;
5748 if (exportName === undefined) {
5749 exportName = 'default';
5750 factoryClassSuffix = '';
5751 }
5752 return System.import(this._config.factoryPathPrefix + module + this._config.factoryPathSuffix)
5753 .then(function (module) { return module[exportName + factoryClassSuffix]; })
5754 .then(function (factory) { return checkNotEmpty(factory, module, exportName); });
5755 };
5756 return SystemJsNgModuleLoader;
5757}());
5758SystemJsNgModuleLoader.decorators = [
5759 { type: Injectable },
5760];
5761/**
5762 * @nocollapse
5763 */
5764SystemJsNgModuleLoader.ctorParameters = function () { return [
5765 { type: Compiler, },
5766 { type: SystemJsNgModuleLoaderConfig, decorators: [{ type: Optional },] },
5767]; };
5768/**
5769 * @param {?} value
5770 * @param {?} modulePath
5771 * @param {?} exportName
5772 * @return {?}
5773 */
5774function checkNotEmpty(value, modulePath, exportName) {
5775 if (!value) {
5776 throw new Error("Cannot find '" + exportName + "' in '" + modulePath + "'");
5777 }
5778 return value;
5779}
5780/**
5781 * @license
5782 * Copyright Google Inc. All Rights Reserved.
5783 *
5784 * Use of this source code is governed by an MIT-style license that can be
5785 * found in the LICENSE file at https://angular.io/license
5786 */
5787/**
5788 * Represents an Embedded Template that can be used to instantiate Embedded Views.
5789 *
5790 * You can access a `TemplateRef`, in two ways. Via a directive placed on a `<ng-template>` element
5791 * (or directive prefixed with `*`) and have the `TemplateRef` for this Embedded View injected into
5792 * the constructor of the directive using the `TemplateRef` Token. Alternatively you can query for
5793 * the `TemplateRef` from a Component or a Directive via {\@link Query}.
5794 *
5795 * To instantiate Embedded Views based on a Template, use
5796 * {\@link ViewContainerRef#createEmbeddedView}, which will create the View and attach it to the
5797 * View Container.
5798 * \@stable
5799 * @abstract
5800 */
5801var TemplateRef = (function () {
5802 function TemplateRef() {
5803 }
5804 /**
5805 * @abstract
5806 * @return {?}
5807 */
5808 TemplateRef.prototype.elementRef = function () { };
5809 /**
5810 * @abstract
5811 * @param {?} context
5812 * @return {?}
5813 */
5814 TemplateRef.prototype.createEmbeddedView = function (context) { };
5815 return TemplateRef;
5816}());
5817/**
5818 * @license
5819 * Copyright Google Inc. All Rights Reserved.
5820 *
5821 * Use of this source code is governed by an MIT-style license that can be
5822 * found in the LICENSE file at https://angular.io/license
5823 */
5824/**
5825 * Represents a container where one or more Views can be attached.
5826 *
5827 * The container can contain two kinds of Views. Host Views, created by instantiating a
5828 * {\@link Component} via {\@link #createComponent}, and Embedded Views, created by instantiating an
5829 * {\@link TemplateRef Embedded Template} via {\@link #createEmbeddedView}.
5830 *
5831 * The location of the View Container within the containing View is specified by the Anchor
5832 * `element`. Each View Container can have only one Anchor Element and each Anchor Element can only
5833 * have a single View Container.
5834 *
5835 * Root elements of Views attached to this container become siblings of the Anchor Element in
5836 * the Rendered View.
5837 *
5838 * To access a `ViewContainerRef` of an Element, you can either place a {\@link Directive} injected
5839 * with `ViewContainerRef` on the Element, or you obtain it via a {\@link ViewChild} query.
5840 * \@stable
5841 * @abstract
5842 */
5843var ViewContainerRef = (function () {
5844 function ViewContainerRef() {
5845 }
5846 /**
5847 * Anchor element that specifies the location of this container in the containing View.
5848 * <!-- TODO: rename to anchorElement -->
5849 * @abstract
5850 * @return {?}
5851 */
5852 ViewContainerRef.prototype.element = function () { };
5853 /**
5854 * @abstract
5855 * @return {?}
5856 */
5857 ViewContainerRef.prototype.injector = function () { };
5858 /**
5859 * @abstract
5860 * @return {?}
5861 */
5862 ViewContainerRef.prototype.parentInjector = function () { };
5863 /**
5864 * Destroys all Views in this container.
5865 * @abstract
5866 * @return {?}
5867 */
5868 ViewContainerRef.prototype.clear = function () { };
5869 /**
5870 * Returns the {\@link ViewRef} for the View located in this container at the specified index.
5871 * @abstract
5872 * @param {?} index
5873 * @return {?}
5874 */
5875 ViewContainerRef.prototype.get = function (index) { };
5876 /**
5877 * Returns the number of Views currently attached to this container.
5878 * @abstract
5879 * @return {?}
5880 */
5881 ViewContainerRef.prototype.length = function () { };
5882 /**
5883 * Instantiates an Embedded View based on the {\@link TemplateRef `templateRef`} and inserts it
5884 * into this container at the specified `index`.
5885 *
5886 * If `index` is not specified, the new View will be inserted as the last View in the container.
5887 *
5888 * Returns the {\@link ViewRef} for the newly created View.
5889 * @abstract
5890 * @template C
5891 * @param {?} templateRef
5892 * @param {?=} context
5893 * @param {?=} index
5894 * @return {?}
5895 */
5896 ViewContainerRef.prototype.createEmbeddedView = function (templateRef, context, index) { };
5897 /**
5898 * Instantiates a single {\@link Component} and inserts its Host View into this container at the
5899 * specified `index`.
5900 *
5901 * The component is instantiated using its {\@link ComponentFactory} which can be
5902 * obtained via {\@link ComponentFactoryResolver#resolveComponentFactory}.
5903 *
5904 * If `index` is not specified, the new View will be inserted as the last View in the container.
5905 *
5906 * You can optionally specify the {\@link Injector} that will be used as parent for the Component.
5907 *
5908 * Returns the {\@link ComponentRef} of the Host View created for the newly instantiated Component.
5909 * @abstract
5910 * @template C
5911 * @param {?} componentFactory
5912 * @param {?=} index
5913 * @param {?=} injector
5914 * @param {?=} projectableNodes
5915 * @param {?=} ngModule
5916 * @return {?}
5917 */
5918 ViewContainerRef.prototype.createComponent = function (componentFactory, index, injector, projectableNodes, ngModule) { };
5919 /**
5920 * Inserts a View identified by a {\@link ViewRef} into the container at the specified `index`.
5921 *
5922 * If `index` is not specified, the new View will be inserted as the last View in the container.
5923 *
5924 * Returns the inserted {\@link ViewRef}.
5925 * @abstract
5926 * @param {?} viewRef
5927 * @param {?=} index
5928 * @return {?}
5929 */
5930 ViewContainerRef.prototype.insert = function (viewRef, index) { };
5931 /**
5932 * Moves a View identified by a {\@link ViewRef} into the container at the specified `index`.
5933 *
5934 * Returns the inserted {\@link ViewRef}.
5935 * @abstract
5936 * @param {?} viewRef
5937 * @param {?} currentIndex
5938 * @return {?}
5939 */
5940 ViewContainerRef.prototype.move = function (viewRef, currentIndex) { };
5941 /**
5942 * Returns the index of the View, specified via {\@link ViewRef}, within the current container or
5943 * `-1` if this container doesn't contain the View.
5944 * @abstract
5945 * @param {?} viewRef
5946 * @return {?}
5947 */
5948 ViewContainerRef.prototype.indexOf = function (viewRef) { };
5949 /**
5950 * Destroys a View attached to this container at the specified `index`.
5951 *
5952 * If `index` is not specified, the last View in the container will be removed.
5953 * @abstract
5954 * @param {?=} index
5955 * @return {?}
5956 */
5957 ViewContainerRef.prototype.remove = function (index) { };
5958 /**
5959 * Use along with {\@link #insert} to move a View within the current container.
5960 *
5961 * If the `index` param is omitted, the last {\@link ViewRef} is detached.
5962 * @abstract
5963 * @param {?=} index
5964 * @return {?}
5965 */
5966 ViewContainerRef.prototype.detach = function (index) { };
5967 return ViewContainerRef;
5968}());
5969/**
5970 * \@stable
5971 * @abstract
5972 */
5973var ChangeDetectorRef = (function () {
5974 function ChangeDetectorRef() {
5975 }
5976 /**
5977 * Marks all {\@link ChangeDetectionStrategy#OnPush} ancestors as to be checked.
5978 *
5979 * <!-- TODO: Add a link to a chapter on OnPush components -->
5980 *
5981 * ### Example ([live demo](http://plnkr.co/edit/GC512b?p=preview))
5982 *
5983 * ```typescript
5984 * \@Component({
5985 * selector: 'cmp',
5986 * changeDetection: ChangeDetectionStrategy.OnPush,
5987 * template: `Number of ticks: {{numberOfTicks}}`
5988 * })
5989 * class Cmp {
5990 * numberOfTicks = 0;
5991 *
5992 * constructor(ref: ChangeDetectorRef) {
5993 * setInterval(() => {
5994 * this.numberOfTicks ++
5995 * // the following is required, otherwise the view will not be updated
5996 * this.ref.markForCheck();
5997 * }, 1000);
5998 * }
5999 * }
6000 *
6001 * \@Component({
6002 * selector: 'app',
6003 * changeDetection: ChangeDetectionStrategy.OnPush,
6004 * template: `
6005 * <cmp><cmp>
6006 * `,
6007 * })
6008 * class App {
6009 * }
6010 * ```
6011 * @abstract
6012 * @return {?}
6013 */
6014 ChangeDetectorRef.prototype.markForCheck = function () { };
6015 /**
6016 * Detaches the change detector from the change detector tree.
6017 *
6018 * The detached change detector will not be checked until it is reattached.
6019 *
6020 * This can also be used in combination with {\@link ChangeDetectorRef#detectChanges} to implement
6021 * local change
6022 * detection checks.
6023 *
6024 * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
6025 * <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
6026 *
6027 * ### Example
6028 *
6029 * The following example defines a component with a large list of readonly data.
6030 * Imagine the data changes constantly, many times per second. For performance reasons,
6031 * we want to check and update the list every five seconds. We can do that by detaching
6032 * the component's change detector and doing a local check every five seconds.
6033 *
6034 * ```typescript
6035 * class DataProvider {
6036 * // in a real application the returned data will be different every time
6037 * get data() {
6038 * return [1,2,3,4,5];
6039 * }
6040 * }
6041 *
6042 * \@Component({
6043 * selector: 'giant-list',
6044 * template: `
6045 * <li *ngFor="let d of dataProvider.data">Data {{d}}</lig>
6046 * `,
6047 * })
6048 * class GiantList {
6049 * constructor(private ref: ChangeDetectorRef, private dataProvider:DataProvider) {
6050 * ref.detach();
6051 * setInterval(() => {
6052 * this.ref.detectChanges();
6053 * }, 5000);
6054 * }
6055 * }
6056 *
6057 * \@Component({
6058 * selector: 'app',
6059 * providers: [DataProvider],
6060 * template: `
6061 * <giant-list><giant-list>
6062 * `,
6063 * })
6064 * class App {
6065 * }
6066 * ```
6067 * @abstract
6068 * @return {?}
6069 */
6070 ChangeDetectorRef.prototype.detach = function () { };
6071 /**
6072 * Checks the change detector and its children.
6073 *
6074 * This can also be used in combination with {\@link ChangeDetectorRef#detach} to implement local
6075 * change detection
6076 * checks.
6077 *
6078 * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
6079 * <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
6080 *
6081 * ### Example
6082 *
6083 * The following example defines a component with a large list of readonly data.
6084 * Imagine, the data changes constantly, many times per second. For performance reasons,
6085 * we want to check and update the list every five seconds.
6086 *
6087 * We can do that by detaching the component's change detector and doing a local change detection
6088 * check
6089 * every five seconds.
6090 *
6091 * See {\@link ChangeDetectorRef#detach} for more information.
6092 * @abstract
6093 * @return {?}
6094 */
6095 ChangeDetectorRef.prototype.detectChanges = function () { };
6096 /**
6097 * Checks the change detector and its children, and throws if any changes are detected.
6098 *
6099 * This is used in development mode to verify that running change detection doesn't introduce
6100 * other changes.
6101 * @abstract
6102 * @return {?}
6103 */
6104 ChangeDetectorRef.prototype.checkNoChanges = function () { };
6105 /**
6106 * Reattach the change detector to the change detector tree.
6107 *
6108 * This also marks OnPush ancestors as to be checked. This reattached change detector will be
6109 * checked during the next change detection run.
6110 *
6111 * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
6112 *
6113 * ### Example ([live demo](http://plnkr.co/edit/aUhZha?p=preview))
6114 *
6115 * The following example creates a component displaying `live` data. The component will detach
6116 * its change detector from the main change detector tree when the component's live property
6117 * is set to false.
6118 *
6119 * ```typescript
6120 * class DataProvider {
6121 * data = 1;
6122 *
6123 * constructor() {
6124 * setInterval(() => {
6125 * this.data = this.data * 2;
6126 * }, 500);
6127 * }
6128 * }
6129 *
6130 * \@Component({
6131 * selector: 'live-data',
6132 * inputs: ['live'],
6133 * template: 'Data: {{dataProvider.data}}'
6134 * })
6135 * class LiveData {
6136 * constructor(private ref: ChangeDetectorRef, private dataProvider:DataProvider) {}
6137 *
6138 * set live(value) {
6139 * if (value)
6140 * this.ref.reattach();
6141 * else
6142 * this.ref.detach();
6143 * }
6144 * }
6145 *
6146 * \@Component({
6147 * selector: 'app',
6148 * providers: [DataProvider],
6149 * template: `
6150 * Live Update: <input type="checkbox" [(ngModel)]="live">
6151 * <live-data [live]="live"><live-data>
6152 * `,
6153 * })
6154 * class App {
6155 * live = true;
6156 * }
6157 * ```
6158 * @abstract
6159 * @return {?}
6160 */
6161 ChangeDetectorRef.prototype.reattach = function () { };
6162 return ChangeDetectorRef;
6163}());
6164/**
6165 * @license
6166 * Copyright Google Inc. All Rights Reserved.
6167 *
6168 * Use of this source code is governed by an MIT-style license that can be
6169 * found in the LICENSE file at https://angular.io/license
6170 */
6171/**
6172 * \@stable
6173 * @abstract
6174 */
6175var ViewRef = (function (_super) {
6176 __extends(ViewRef, _super);
6177 function ViewRef() {
6178 return _super !== null && _super.apply(this, arguments) || this;
6179 }
6180 /**
6181 * Destroys the view and all of the data structures associated with it.
6182 * @abstract
6183 * @return {?}
6184 */
6185 ViewRef.prototype.destroy = function () { };
6186 /**
6187 * @abstract
6188 * @return {?}
6189 */
6190 ViewRef.prototype.destroyed = function () { };
6191 /**
6192 * @abstract
6193 * @param {?} callback
6194 * @return {?}
6195 */
6196 ViewRef.prototype.onDestroy = function (callback) { };
6197 return ViewRef;
6198}(ChangeDetectorRef));
6199/**
6200 * Represents an Angular View.
6201 *
6202 * <!-- TODO: move the next two paragraphs to the dev guide -->
6203 * A View is a fundamental building block of the application UI. It is the smallest grouping of
6204 * Elements which are created and destroyed together.
6205 *
6206 * Properties of elements in a View can change, but the structure (number and order) of elements in
6207 * a View cannot. Changing the structure of Elements can only be done by inserting, moving or
6208 * removing nested Views via a {\@link ViewContainerRef}. Each View can contain many View Containers.
6209 * <!-- /TODO -->
6210 *
6211 * ### Example
6212 *
6213 * Given this template...
6214 *
6215 * ```
6216 * Count: {{items.length}}
6217 * <ul>
6218 * <li *ngFor="let item of items">{{item}}</li>
6219 * </ul>
6220 * ```
6221 *
6222 * We have two {\@link TemplateRef}s:
6223 *
6224 * Outer {\@link TemplateRef}:
6225 * ```
6226 * Count: {{items.length}}
6227 * <ul>
6228 * <ng-template ngFor let-item [ngForOf]="items"></ng-template>
6229 * </ul>
6230 * ```
6231 *
6232 * Inner {\@link TemplateRef}:
6233 * ```
6234 * <li>{{item}}</li>
6235 * ```
6236 *
6237 * Notice that the original template is broken down into two separate {\@link TemplateRef}s.
6238 *
6239 * The outer/inner {\@link TemplateRef}s are then assembled into views like so:
6240 *
6241 * ```
6242 * <!-- ViewRef: outer-0 -->
6243 * Count: 2
6244 * <ul>
6245 * <ng-template view-container-ref></ng-template>
6246 * <!-- ViewRef: inner-1 --><li>first</li><!-- /ViewRef: inner-1 -->
6247 * <!-- ViewRef: inner-2 --><li>second</li><!-- /ViewRef: inner-2 -->
6248 * </ul>
6249 * <!-- /ViewRef: outer-0 -->
6250 * ```
6251 * \@experimental
6252 * @abstract
6253 */
6254var EmbeddedViewRef = (function (_super) {
6255 __extends(EmbeddedViewRef, _super);
6256 function EmbeddedViewRef() {
6257 return _super !== null && _super.apply(this, arguments) || this;
6258 }
6259 /**
6260 * @abstract
6261 * @return {?}
6262 */
6263 EmbeddedViewRef.prototype.context = function () { };
6264 /**
6265 * @abstract
6266 * @return {?}
6267 */
6268 EmbeddedViewRef.prototype.rootNodes = function () { };
6269 return EmbeddedViewRef;
6270}(ViewRef));
6271/**
6272 * @license
6273 * Copyright Google Inc. All Rights Reserved.
6274 *
6275 * Use of this source code is governed by an MIT-style license that can be
6276 * found in the LICENSE file at https://angular.io/license
6277 */
6278// Public API for compiler
6279/**
6280 * @license
6281 * Copyright Google Inc. All Rights Reserved.
6282 *
6283 * Use of this source code is governed by an MIT-style license that can be
6284 * found in the LICENSE file at https://angular.io/license
6285 */
6286var EventListener = (function () {
6287 /**
6288 * @param {?} name
6289 * @param {?} callback
6290 */
6291 function EventListener(name, callback) {
6292 this.name = name;
6293 this.callback = callback;
6294 }
6295
6296 return EventListener;
6297}());
6298/**
6299 * \@experimental All debugging apis are currently experimental.
6300 */
6301var DebugNode = (function () {
6302 /**
6303 * @param {?} nativeNode
6304 * @param {?} parent
6305 * @param {?} _debugContext
6306 */
6307 function DebugNode(nativeNode, parent, _debugContext) {
6308 this._debugContext = _debugContext;
6309 this.nativeNode = nativeNode;
6310 if (parent && parent instanceof DebugElement) {
6311 parent.addChild(this);
6312 }
6313 else {
6314 this.parent = null;
6315 }
6316 this.listeners = [];
6317 }
6318 Object.defineProperty(DebugNode.prototype, "injector", {
6319 /**
6320 * @return {?}
6321 */
6322 get: function () { return this._debugContext.injector; },
6323 enumerable: true,
6324 configurable: true
6325 });
6326 Object.defineProperty(DebugNode.prototype, "componentInstance", {
6327 /**
6328 * @return {?}
6329 */
6330 get: function () { return this._debugContext.component; },
6331 enumerable: true,
6332 configurable: true
6333 });
6334 Object.defineProperty(DebugNode.prototype, "context", {
6335 /**
6336 * @return {?}
6337 */
6338 get: function () { return this._debugContext.context; },
6339 enumerable: true,
6340 configurable: true
6341 });
6342 Object.defineProperty(DebugNode.prototype, "references", {
6343 /**
6344 * @return {?}
6345 */
6346 get: function () { return this._debugContext.references; },
6347 enumerable: true,
6348 configurable: true
6349 });
6350 Object.defineProperty(DebugNode.prototype, "providerTokens", {
6351 /**
6352 * @return {?}
6353 */
6354 get: function () { return this._debugContext.providerTokens; },
6355 enumerable: true,
6356 configurable: true
6357 });
6358 Object.defineProperty(DebugNode.prototype, "source", {
6359 /**
6360 * @deprecated since v4
6361 * @return {?}
6362 */
6363 get: function () { return 'Deprecated since v4'; },
6364 enumerable: true,
6365 configurable: true
6366 });
6367 return DebugNode;
6368}());
6369/**
6370 * \@experimental All debugging apis are currently experimental.
6371 */
6372var DebugElement = (function (_super) {
6373 __extends(DebugElement, _super);
6374 /**
6375 * @param {?} nativeNode
6376 * @param {?} parent
6377 * @param {?} _debugContext
6378 */
6379 function DebugElement(nativeNode, parent, _debugContext) {
6380 var _this = _super.call(this, nativeNode, parent, _debugContext) || this;
6381 _this.properties = {};
6382 _this.attributes = {};
6383 _this.classes = {};
6384 _this.styles = {};
6385 _this.childNodes = [];
6386 _this.nativeElement = nativeNode;
6387 return _this;
6388 }
6389 /**
6390 * @param {?} child
6391 * @return {?}
6392 */
6393 DebugElement.prototype.addChild = function (child) {
6394 if (child) {
6395 this.childNodes.push(child);
6396 child.parent = this;
6397 }
6398 };
6399 /**
6400 * @param {?} child
6401 * @return {?}
6402 */
6403 DebugElement.prototype.removeChild = function (child) {
6404 var /** @type {?} */ childIndex = this.childNodes.indexOf(child);
6405 if (childIndex !== -1) {
6406 child.parent = null;
6407 this.childNodes.splice(childIndex, 1);
6408 }
6409 };
6410 /**
6411 * @param {?} child
6412 * @param {?} newChildren
6413 * @return {?}
6414 */
6415 DebugElement.prototype.insertChildrenAfter = function (child, newChildren) {
6416 var _this = this;
6417 var /** @type {?} */ siblingIndex = this.childNodes.indexOf(child);
6418 if (siblingIndex !== -1) {
6419 (_a = this.childNodes).splice.apply(_a, [siblingIndex + 1, 0].concat(newChildren));
6420 newChildren.forEach(function (c) {
6421 if (c.parent) {
6422 c.parent.removeChild(c);
6423 }
6424 c.parent = _this;
6425 });
6426 }
6427 var _a;
6428 };
6429 /**
6430 * @param {?} refChild
6431 * @param {?} newChild
6432 * @return {?}
6433 */
6434 DebugElement.prototype.insertBefore = function (refChild, newChild) {
6435 var /** @type {?} */ refIndex = this.childNodes.indexOf(refChild);
6436 if (refIndex === -1) {
6437 this.addChild(newChild);
6438 }
6439 else {
6440 if (newChild.parent) {
6441 newChild.parent.removeChild(newChild);
6442 }
6443 newChild.parent = this;
6444 this.childNodes.splice(refIndex, 0, newChild);
6445 }
6446 };
6447 /**
6448 * @param {?} predicate
6449 * @return {?}
6450 */
6451 DebugElement.prototype.query = function (predicate) {
6452 var /** @type {?} */ results = this.queryAll(predicate);
6453 return results[0] || null;
6454 };
6455 /**
6456 * @param {?} predicate
6457 * @return {?}
6458 */
6459 DebugElement.prototype.queryAll = function (predicate) {
6460 var /** @type {?} */ matches = [];
6461 _queryElementChildren(this, predicate, matches);
6462 return matches;
6463 };
6464 /**
6465 * @param {?} predicate
6466 * @return {?}
6467 */
6468 DebugElement.prototype.queryAllNodes = function (predicate) {
6469 var /** @type {?} */ matches = [];
6470 _queryNodeChildren(this, predicate, matches);
6471 return matches;
6472 };
6473 Object.defineProperty(DebugElement.prototype, "children", {
6474 /**
6475 * @return {?}
6476 */
6477 get: function () {
6478 return (this.childNodes.filter(function (node) { return node instanceof DebugElement; }));
6479 },
6480 enumerable: true,
6481 configurable: true
6482 });
6483 /**
6484 * @param {?} eventName
6485 * @param {?} eventObj
6486 * @return {?}
6487 */
6488 DebugElement.prototype.triggerEventHandler = function (eventName, eventObj) {
6489 this.listeners.forEach(function (listener) {
6490 if (listener.name == eventName) {
6491 listener.callback(eventObj);
6492 }
6493 });
6494 };
6495 return DebugElement;
6496}(DebugNode));
6497/**
6498 * \@experimental
6499 * @param {?} debugEls
6500 * @return {?}
6501 */
6502function asNativeElements(debugEls) {
6503 return debugEls.map(function (el) { return el.nativeElement; });
6504}
6505/**
6506 * @param {?} element
6507 * @param {?} predicate
6508 * @param {?} matches
6509 * @return {?}
6510 */
6511function _queryElementChildren(element, predicate, matches) {
6512 element.childNodes.forEach(function (node) {
6513 if (node instanceof DebugElement) {
6514 if (predicate(node)) {
6515 matches.push(node);
6516 }
6517 _queryElementChildren(node, predicate, matches);
6518 }
6519 });
6520}
6521/**
6522 * @param {?} parentNode
6523 * @param {?} predicate
6524 * @param {?} matches
6525 * @return {?}
6526 */
6527function _queryNodeChildren(parentNode, predicate, matches) {
6528 if (parentNode instanceof DebugElement) {
6529 parentNode.childNodes.forEach(function (node) {
6530 if (predicate(node)) {
6531 matches.push(node);
6532 }
6533 if (node instanceof DebugElement) {
6534 _queryNodeChildren(node, predicate, matches);
6535 }
6536 });
6537 }
6538}
6539// Need to keep the nodes in a global Map so that multiple angular apps are supported.
6540var _nativeNodeToDebugNode = new Map();
6541/**
6542 * \@experimental
6543 * @param {?} nativeNode
6544 * @return {?}
6545 */
6546function getDebugNode(nativeNode) {
6547 return _nativeNodeToDebugNode.get(nativeNode) || null;
6548}
6549/**
6550 * @return {?}
6551 */
6552/**
6553 * @param {?} node
6554 * @return {?}
6555 */
6556function indexDebugNode(node) {
6557 _nativeNodeToDebugNode.set(node.nativeNode, node);
6558}
6559/**
6560 * @param {?} node
6561 * @return {?}
6562 */
6563function removeDebugNodeFromIndex(node) {
6564 _nativeNodeToDebugNode.delete(node.nativeNode);
6565}
6566/**
6567 * @license
6568 * Copyright Google Inc. All Rights Reserved.
6569 *
6570 * Use of this source code is governed by an MIT-style license that can be
6571 * found in the LICENSE file at https://angular.io/license
6572 */
6573/**
6574 * @param {?} a
6575 * @param {?} b
6576 * @return {?}
6577 */
6578function devModeEqual(a, b) {
6579 var /** @type {?} */ isListLikeIterableA = isListLikeIterable(a);
6580 var /** @type {?} */ isListLikeIterableB = isListLikeIterable(b);
6581 if (isListLikeIterableA && isListLikeIterableB) {
6582 return areIterablesEqual(a, b, devModeEqual);
6583 }
6584 else {
6585 var /** @type {?} */ isAObject = a && (typeof a === 'object' || typeof a === 'function');
6586 var /** @type {?} */ isBObject = b && (typeof b === 'object' || typeof b === 'function');
6587 if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
6588 return true;
6589 }
6590 else {
6591 return looseIdentical(a, b);
6592 }
6593 }
6594}
6595/**
6596 * Indicates that the result of a {\@link Pipe} transformation has changed even though the
6597 * reference
6598 * has not changed.
6599 *
6600 * The wrapped value will be unwrapped by change detection, and the unwrapped value will be stored.
6601 *
6602 * Example:
6603 *
6604 * ```
6605 * if (this._latestValue === this._latestReturnedValue) {
6606 * return this._latestReturnedValue;
6607 * } else {
6608 * this._latestReturnedValue = this._latestValue;
6609 * return WrappedValue.wrap(this._latestValue); // this will force update
6610 * }
6611 * ```
6612 * \@stable
6613 */
6614var WrappedValue = (function () {
6615 /**
6616 * @param {?} wrapped
6617 */
6618 function WrappedValue(wrapped) {
6619 this.wrapped = wrapped;
6620 }
6621 /**
6622 * @param {?} value
6623 * @return {?}
6624 */
6625 WrappedValue.wrap = function (value) { return new WrappedValue(value); };
6626 return WrappedValue;
6627}());
6628/**
6629 * Helper class for unwrapping WrappedValue s
6630 */
6631var ValueUnwrapper = (function () {
6632 function ValueUnwrapper() {
6633 this.hasWrappedValue = false;
6634 }
6635 /**
6636 * @param {?} value
6637 * @return {?}
6638 */
6639 ValueUnwrapper.prototype.unwrap = function (value) {
6640 if (value instanceof WrappedValue) {
6641 this.hasWrappedValue = true;
6642 return value.wrapped;
6643 }
6644 return value;
6645 };
6646 /**
6647 * @return {?}
6648 */
6649 ValueUnwrapper.prototype.reset = function () { this.hasWrappedValue = false; };
6650 return ValueUnwrapper;
6651}());
6652/**
6653 * Represents a basic change from a previous to a new value.
6654 * \@stable
6655 */
6656var SimpleChange = (function () {
6657 /**
6658 * @param {?} previousValue
6659 * @param {?} currentValue
6660 * @param {?} firstChange
6661 */
6662 function SimpleChange(previousValue, currentValue, firstChange) {
6663 this.previousValue = previousValue;
6664 this.currentValue = currentValue;
6665 this.firstChange = firstChange;
6666 }
6667 /**
6668 * Check whether the new value is the first value assigned.
6669 * @return {?}
6670 */
6671 SimpleChange.prototype.isFirstChange = function () { return this.firstChange; };
6672 return SimpleChange;
6673}());
6674/**
6675 * @param {?} obj
6676 * @return {?}
6677 */
6678function isListLikeIterable(obj) {
6679 if (!isJsObject(obj))
6680 return false;
6681 return Array.isArray(obj) ||
6682 (!(obj instanceof Map) &&
6683 getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
6684}
6685/**
6686 * @param {?} a
6687 * @param {?} b
6688 * @param {?} comparator
6689 * @return {?}
6690 */
6691function areIterablesEqual(a, b, comparator) {
6692 var /** @type {?} */ iterator1 = a[getSymbolIterator()]();
6693 var /** @type {?} */ iterator2 = b[getSymbolIterator()]();
6694 while (true) {
6695 var /** @type {?} */ item1 = iterator1.next();
6696 var /** @type {?} */ item2 = iterator2.next();
6697 if (item1.done && item2.done)
6698 return true;
6699 if (item1.done || item2.done)
6700 return false;
6701 if (!comparator(item1.value, item2.value))
6702 return false;
6703 }
6704}
6705/**
6706 * @param {?} obj
6707 * @param {?} fn
6708 * @return {?}
6709 */
6710function iterateListLike(obj, fn) {
6711 if (Array.isArray(obj)) {
6712 for (var /** @type {?} */ i = 0; i < obj.length; i++) {
6713 fn(obj[i]);
6714 }
6715 }
6716 else {
6717 var /** @type {?} */ iterator = obj[getSymbolIterator()]();
6718 var /** @type {?} */ item = void 0;
6719 while (!((item = iterator.next()).done)) {
6720 fn(item.value);
6721 }
6722 }
6723}
6724/**
6725 * @param {?} o
6726 * @return {?}
6727 */
6728function isJsObject(o) {
6729 return o !== null && (typeof o === 'function' || typeof o === 'object');
6730}
6731/**
6732 * @license
6733 * Copyright Google Inc. All Rights Reserved.
6734 *
6735 * Use of this source code is governed by an MIT-style license that can be
6736 * found in the LICENSE file at https://angular.io/license
6737 */
6738var DefaultIterableDifferFactory = (function () {
6739 function DefaultIterableDifferFactory() {
6740 }
6741 /**
6742 * @param {?} obj
6743 * @return {?}
6744 */
6745 DefaultIterableDifferFactory.prototype.supports = function (obj) { return isListLikeIterable(obj); };
6746 /**
6747 * @deprecated v4.0.0 - ChangeDetectorRef is not used and is no longer a parameter
6748 * @template V
6749 * @param {?=} cdRefOrTrackBy
6750 * @param {?=} trackByFn
6751 * @return {?}
6752 */
6753 DefaultIterableDifferFactory.prototype.create = function (cdRefOrTrackBy, trackByFn) {
6754 return new DefaultIterableDiffer(trackByFn || (cdRefOrTrackBy));
6755 };
6756 return DefaultIterableDifferFactory;
6757}());
6758var trackByIdentity = function (index, item) { return item; };
6759/**
6760 * @deprecated v4.0.0 - Should not be part of public API.
6761 */
6762var DefaultIterableDiffer = (function () {
6763 /**
6764 * @param {?=} trackByFn
6765 */
6766 function DefaultIterableDiffer(trackByFn) {
6767 this._length = 0;
6768 this._collection = null;
6769 this._linkedRecords = null;
6770 this._unlinkedRecords = null;
6771 this._previousItHead = null;
6772 this._itHead = null;
6773 this._itTail = null;
6774 this._additionsHead = null;
6775 this._additionsTail = null;
6776 this._movesHead = null;
6777 this._movesTail = null;
6778 this._removalsHead = null;
6779 this._removalsTail = null;
6780 this._identityChangesHead = null;
6781 this._identityChangesTail = null;
6782 this._trackByFn = trackByFn || trackByIdentity;
6783 }
6784 Object.defineProperty(DefaultIterableDiffer.prototype, "collection", {
6785 /**
6786 * @return {?}
6787 */
6788 get: function () { return this._collection; },
6789 enumerable: true,
6790 configurable: true
6791 });
6792 Object.defineProperty(DefaultIterableDiffer.prototype, "length", {
6793 /**
6794 * @return {?}
6795 */
6796 get: function () { return this._length; },
6797 enumerable: true,
6798 configurable: true
6799 });
6800 /**
6801 * @param {?} fn
6802 * @return {?}
6803 */
6804 DefaultIterableDiffer.prototype.forEachItem = function (fn) {
6805 var /** @type {?} */ record;
6806 for (record = this._itHead; record !== null; record = record._next) {
6807 fn(record);
6808 }
6809 };
6810 /**
6811 * @param {?} fn
6812 * @return {?}
6813 */
6814 DefaultIterableDiffer.prototype.forEachOperation = function (fn) {
6815 var /** @type {?} */ nextIt = this._itHead;
6816 var /** @type {?} */ nextRemove = this._removalsHead;
6817 var /** @type {?} */ addRemoveOffset = 0;
6818 var /** @type {?} */ moveOffsets = null;
6819 while (nextIt || nextRemove) {
6820 // Figure out which is the next record to process
6821 // Order: remove, add, move
6822 var /** @type {?} */ record = !nextRemove ||
6823 nextIt && ((nextIt.currentIndex)) <
6824 getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ? ((nextIt)) :
6825 nextRemove;
6826 var /** @type {?} */ adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets);
6827 var /** @type {?} */ currentIndex = record.currentIndex;
6828 // consume the item, and adjust the addRemoveOffset and update moveDistance if necessary
6829 if (record === nextRemove) {
6830 addRemoveOffset--;
6831 nextRemove = nextRemove._nextRemoved;
6832 }
6833 else {
6834 nextIt = ((nextIt))._next;
6835 if (record.previousIndex == null) {
6836 addRemoveOffset++;
6837 }
6838 else {
6839 // INVARIANT: currentIndex < previousIndex
6840 if (!moveOffsets)
6841 moveOffsets = [];
6842 var /** @type {?} */ localMovePreviousIndex = adjPreviousIndex - addRemoveOffset;
6843 var /** @type {?} */ localCurrentIndex = ((currentIndex)) - addRemoveOffset;
6844 if (localMovePreviousIndex != localCurrentIndex) {
6845 for (var /** @type {?} */ i = 0; i < localMovePreviousIndex; i++) {
6846 var /** @type {?} */ offset = i < moveOffsets.length ? moveOffsets[i] : (moveOffsets[i] = 0);
6847 var /** @type {?} */ index = offset + i;
6848 if (localCurrentIndex <= index && index < localMovePreviousIndex) {
6849 moveOffsets[i] = offset + 1;
6850 }
6851 }
6852 var /** @type {?} */ previousIndex = record.previousIndex;
6853 moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex;
6854 }
6855 }
6856 }
6857 if (adjPreviousIndex !== currentIndex) {
6858 fn(record, adjPreviousIndex, currentIndex);
6859 }
6860 }
6861 };
6862 /**
6863 * @param {?} fn
6864 * @return {?}
6865 */
6866 DefaultIterableDiffer.prototype.forEachPreviousItem = function (fn) {
6867 var /** @type {?} */ record;
6868 for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
6869 fn(record);
6870 }
6871 };
6872 /**
6873 * @param {?} fn
6874 * @return {?}
6875 */
6876 DefaultIterableDiffer.prototype.forEachAddedItem = function (fn) {
6877 var /** @type {?} */ record;
6878 for (record = this._additionsHead; record !== null; record = record._nextAdded) {
6879 fn(record);
6880 }
6881 };
6882 /**
6883 * @param {?} fn
6884 * @return {?}
6885 */
6886 DefaultIterableDiffer.prototype.forEachMovedItem = function (fn) {
6887 var /** @type {?} */ record;
6888 for (record = this._movesHead; record !== null; record = record._nextMoved) {
6889 fn(record);
6890 }
6891 };
6892 /**
6893 * @param {?} fn
6894 * @return {?}
6895 */
6896 DefaultIterableDiffer.prototype.forEachRemovedItem = function (fn) {
6897 var /** @type {?} */ record;
6898 for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
6899 fn(record);
6900 }
6901 };
6902 /**
6903 * @param {?} fn
6904 * @return {?}
6905 */
6906 DefaultIterableDiffer.prototype.forEachIdentityChange = function (fn) {
6907 var /** @type {?} */ record;
6908 for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) {
6909 fn(record);
6910 }
6911 };
6912 /**
6913 * @param {?} collection
6914 * @return {?}
6915 */
6916 DefaultIterableDiffer.prototype.diff = function (collection) {
6917 if (collection == null)
6918 collection = [];
6919 if (!isListLikeIterable(collection)) {
6920 throw new Error("Error trying to diff '" + stringify(collection) + "'. Only arrays and iterables are allowed");
6921 }
6922 if (this.check(collection)) {
6923 return this;
6924 }
6925 else {
6926 return null;
6927 }
6928 };
6929 /**
6930 * @return {?}
6931 */
6932 DefaultIterableDiffer.prototype.onDestroy = function () { };
6933 /**
6934 * @param {?} collection
6935 * @return {?}
6936 */
6937 DefaultIterableDiffer.prototype.check = function (collection) {
6938 var _this = this;
6939 this._reset();
6940 var /** @type {?} */ record = this._itHead;
6941 var /** @type {?} */ mayBeDirty = false;
6942 var /** @type {?} */ index;
6943 var /** @type {?} */ item;
6944 var /** @type {?} */ itemTrackBy;
6945 if (Array.isArray(collection)) {
6946 this._length = collection.length;
6947 for (var /** @type {?} */ index_1 = 0; index_1 < this._length; index_1++) {
6948 item = collection[index_1];
6949 itemTrackBy = this._trackByFn(index_1, item);
6950 if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
6951 record = this._mismatch(record, item, itemTrackBy, index_1);
6952 mayBeDirty = true;
6953 }
6954 else {
6955 if (mayBeDirty) {
6956 // TODO(misko): can we limit this to duplicates only?
6957 record = this._verifyReinsertion(record, item, itemTrackBy, index_1);
6958 }
6959 if (!looseIdentical(record.item, item))
6960 this._addIdentityChange(record, item);
6961 }
6962 record = record._next;
6963 }
6964 }
6965 else {
6966 index = 0;
6967 iterateListLike(collection, function (item) {
6968 itemTrackBy = _this._trackByFn(index, item);
6969 if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
6970 record = _this._mismatch(record, item, itemTrackBy, index);
6971 mayBeDirty = true;
6972 }
6973 else {
6974 if (mayBeDirty) {
6975 // TODO(misko): can we limit this to duplicates only?
6976 record = _this._verifyReinsertion(record, item, itemTrackBy, index);
6977 }
6978 if (!looseIdentical(record.item, item))
6979 _this._addIdentityChange(record, item);
6980 }
6981 record = record._next;
6982 index++;
6983 });
6984 this._length = index;
6985 }
6986 this._truncate(record);
6987 this._collection = collection;
6988 return this.isDirty;
6989 };
6990 Object.defineProperty(DefaultIterableDiffer.prototype, "isDirty", {
6991 /**
6992 * @return {?}
6993 */
6994 get: function () {
6995 return this._additionsHead !== null || this._movesHead !== null ||
6996 this._removalsHead !== null || this._identityChangesHead !== null;
6997 },
6998 enumerable: true,
6999 configurable: true
7000 });
7001 /**
7002 * Reset the state of the change objects to show no changes. This means set previousKey to
7003 * currentKey, and clear all of the queues (additions, moves, removals).
7004 * Set the previousIndexes of moved and added items to their currentIndexes
7005 * Reset the list of additions, moves and removals
7006 *
7007 * \@internal
7008 * @return {?}
7009 */
7010 DefaultIterableDiffer.prototype._reset = function () {
7011 if (this.isDirty) {
7012 var /** @type {?} */ record = void 0;
7013 var /** @type {?} */ nextRecord = void 0;
7014 for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {
7015 record._nextPrevious = record._next;
7016 }
7017 for (record = this._additionsHead; record !== null; record = record._nextAdded) {
7018 record.previousIndex = record.currentIndex;
7019 }
7020 this._additionsHead = this._additionsTail = null;
7021 for (record = this._movesHead; record !== null; record = nextRecord) {
7022 record.previousIndex = record.currentIndex;
7023 nextRecord = record._nextMoved;
7024 }
7025 this._movesHead = this._movesTail = null;
7026 this._removalsHead = this._removalsTail = null;
7027 this._identityChangesHead = this._identityChangesTail = null;
7028 // todo(vicb) when assert gets supported
7029 // assert(!this.isDirty);
7030 }
7031 };
7032 /**
7033 * This is the core function which handles differences between collections.
7034 *
7035 * - `record` is the record which we saw at this position last time. If null then it is a new
7036 * item.
7037 * - `item` is the current item in the collection
7038 * - `index` is the position of the item in the collection
7039 *
7040 * \@internal
7041 * @param {?} record
7042 * @param {?} item
7043 * @param {?} itemTrackBy
7044 * @param {?} index
7045 * @return {?}
7046 */
7047 DefaultIterableDiffer.prototype._mismatch = function (record, item, itemTrackBy, index) {
7048 // The previous record after which we will append the current one.
7049 var /** @type {?} */ previousRecord;
7050 if (record === null) {
7051 previousRecord = ((this._itTail));
7052 }
7053 else {
7054 previousRecord = ((record._prev));
7055 // Remove the record from the collection since we know it does not match the item.
7056 this._remove(record);
7057 }
7058 // Attempt to see if we have seen the item before.
7059 record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index);
7060 if (record !== null) {
7061 // We have seen this before, we need to move it forward in the collection.
7062 // But first we need to check if identity changed, so we can update in view if necessary
7063 if (!looseIdentical(record.item, item))
7064 this._addIdentityChange(record, item);
7065 this._moveAfter(record, previousRecord, index);
7066 }
7067 else {
7068 // Never seen it, check evicted list.
7069 record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
7070 if (record !== null) {
7071 // It is an item which we have evicted earlier: reinsert it back into the list.
7072 // But first we need to check if identity changed, so we can update in view if necessary
7073 if (!looseIdentical(record.item, item))
7074 this._addIdentityChange(record, item);
7075 this._reinsertAfter(record, previousRecord, index);
7076 }
7077 else {
7078 // It is a new item: add it.
7079 record =
7080 this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index);
7081 }
7082 }
7083 return record;
7084 };
7085 /**
7086 * This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
7087 *
7088 * Use case: `[a, a]` => `[b, a, a]`
7089 *
7090 * If we did not have this check then the insertion of `b` would:
7091 * 1) evict first `a`
7092 * 2) insert `b` at `0` index.
7093 * 3) leave `a` at index `1` as is. <-- this is wrong!
7094 * 3) reinsert `a` at index 2. <-- this is wrong!
7095 *
7096 * The correct behavior is:
7097 * 1) evict first `a`
7098 * 2) insert `b` at `0` index.
7099 * 3) reinsert `a` at index 1.
7100 * 3) move `a` at from `1` to `2`.
7101 *
7102 *
7103 * Double check that we have not evicted a duplicate item. We need to check if the item type may
7104 * have already been removed:
7105 * The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
7106 * at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
7107 * better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
7108 * at the end.
7109 *
7110 * \@internal
7111 * @param {?} record
7112 * @param {?} item
7113 * @param {?} itemTrackBy
7114 * @param {?} index
7115 * @return {?}
7116 */
7117 DefaultIterableDiffer.prototype._verifyReinsertion = function (record, item, itemTrackBy, index) {
7118 var /** @type {?} */ reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
7119 if (reinsertRecord !== null) {
7120 record = this._reinsertAfter(reinsertRecord, /** @type {?} */ ((record._prev)), index);
7121 }
7122 else if (record.currentIndex != index) {
7123 record.currentIndex = index;
7124 this._addToMoves(record, index);
7125 }
7126 return record;
7127 };
7128 /**
7129 * Get rid of any excess {\@link IterableChangeRecord_}s from the previous collection
7130 *
7131 * - `record` The first excess {\@link IterableChangeRecord_}.
7132 *
7133 * \@internal
7134 * @param {?} record
7135 * @return {?}
7136 */
7137 DefaultIterableDiffer.prototype._truncate = function (record) {
7138 // Anything after that needs to be removed;
7139 while (record !== null) {
7140 var /** @type {?} */ nextRecord = record._next;
7141 this._addToRemovals(this._unlink(record));
7142 record = nextRecord;
7143 }
7144 if (this._unlinkedRecords !== null) {
7145 this._unlinkedRecords.clear();
7146 }
7147 if (this._additionsTail !== null) {
7148 this._additionsTail._nextAdded = null;
7149 }
7150 if (this._movesTail !== null) {
7151 this._movesTail._nextMoved = null;
7152 }
7153 if (this._itTail !== null) {
7154 this._itTail._next = null;
7155 }
7156 if (this._removalsTail !== null) {
7157 this._removalsTail._nextRemoved = null;
7158 }
7159 if (this._identityChangesTail !== null) {
7160 this._identityChangesTail._nextIdentityChange = null;
7161 }
7162 };
7163 /**
7164 * \@internal
7165 * @param {?} record
7166 * @param {?} prevRecord
7167 * @param {?} index
7168 * @return {?}
7169 */
7170 DefaultIterableDiffer.prototype._reinsertAfter = function (record, prevRecord, index) {
7171 if (this._unlinkedRecords !== null) {
7172 this._unlinkedRecords.remove(record);
7173 }
7174 var /** @type {?} */ prev = record._prevRemoved;
7175 var /** @type {?} */ next = record._nextRemoved;
7176 if (prev === null) {
7177 this._removalsHead = next;
7178 }
7179 else {
7180 prev._nextRemoved = next;
7181 }
7182 if (next === null) {
7183 this._removalsTail = prev;
7184 }
7185 else {
7186 next._prevRemoved = prev;
7187 }
7188 this._insertAfter(record, prevRecord, index);
7189 this._addToMoves(record, index);
7190 return record;
7191 };
7192 /**
7193 * \@internal
7194 * @param {?} record
7195 * @param {?} prevRecord
7196 * @param {?} index
7197 * @return {?}
7198 */
7199 DefaultIterableDiffer.prototype._moveAfter = function (record, prevRecord, index) {
7200 this._unlink(record);
7201 this._insertAfter(record, prevRecord, index);
7202 this._addToMoves(record, index);
7203 return record;
7204 };
7205 /**
7206 * \@internal
7207 * @param {?} record
7208 * @param {?} prevRecord
7209 * @param {?} index
7210 * @return {?}
7211 */
7212 DefaultIterableDiffer.prototype._addAfter = function (record, prevRecord, index) {
7213 this._insertAfter(record, prevRecord, index);
7214 if (this._additionsTail === null) {
7215 // todo(vicb)
7216 // assert(this._additionsHead === null);
7217 this._additionsTail = this._additionsHead = record;
7218 }
7219 else {
7220 // todo(vicb)
7221 // assert(_additionsTail._nextAdded === null);
7222 // assert(record._nextAdded === null);
7223 this._additionsTail = this._additionsTail._nextAdded = record;
7224 }
7225 return record;
7226 };
7227 /**
7228 * \@internal
7229 * @param {?} record
7230 * @param {?} prevRecord
7231 * @param {?} index
7232 * @return {?}
7233 */
7234 DefaultIterableDiffer.prototype._insertAfter = function (record, prevRecord, index) {
7235 // todo(vicb)
7236 // assert(record != prevRecord);
7237 // assert(record._next === null);
7238 // assert(record._prev === null);
7239 var /** @type {?} */ next = prevRecord === null ? this._itHead : prevRecord._next;
7240 // todo(vicb)
7241 // assert(next != record);
7242 // assert(prevRecord != record);
7243 record._next = next;
7244 record._prev = prevRecord;
7245 if (next === null) {
7246 this._itTail = record;
7247 }
7248 else {
7249 next._prev = record;
7250 }
7251 if (prevRecord === null) {
7252 this._itHead = record;
7253 }
7254 else {
7255 prevRecord._next = record;
7256 }
7257 if (this._linkedRecords === null) {
7258 this._linkedRecords = new _DuplicateMap();
7259 }
7260 this._linkedRecords.put(record);
7261 record.currentIndex = index;
7262 return record;
7263 };
7264 /**
7265 * \@internal
7266 * @param {?} record
7267 * @return {?}
7268 */
7269 DefaultIterableDiffer.prototype._remove = function (record) {
7270 return this._addToRemovals(this._unlink(record));
7271 };
7272 /**
7273 * \@internal
7274 * @param {?} record
7275 * @return {?}
7276 */
7277 DefaultIterableDiffer.prototype._unlink = function (record) {
7278 if (this._linkedRecords !== null) {
7279 this._linkedRecords.remove(record);
7280 }
7281 var /** @type {?} */ prev = record._prev;
7282 var /** @type {?} */ next = record._next;
7283 // todo(vicb)
7284 // assert((record._prev = null) === null);
7285 // assert((record._next = null) === null);
7286 if (prev === null) {
7287 this._itHead = next;
7288 }
7289 else {
7290 prev._next = next;
7291 }
7292 if (next === null) {
7293 this._itTail = prev;
7294 }
7295 else {
7296 next._prev = prev;
7297 }
7298 return record;
7299 };
7300 /**
7301 * \@internal
7302 * @param {?} record
7303 * @param {?} toIndex
7304 * @return {?}
7305 */
7306 DefaultIterableDiffer.prototype._addToMoves = function (record, toIndex) {
7307 // todo(vicb)
7308 // assert(record._nextMoved === null);
7309 if (record.previousIndex === toIndex) {
7310 return record;
7311 }
7312 if (this._movesTail === null) {
7313 // todo(vicb)
7314 // assert(_movesHead === null);
7315 this._movesTail = this._movesHead = record;
7316 }
7317 else {
7318 // todo(vicb)
7319 // assert(_movesTail._nextMoved === null);
7320 this._movesTail = this._movesTail._nextMoved = record;
7321 }
7322 return record;
7323 };
7324 /**
7325 * @param {?} record
7326 * @return {?}
7327 */
7328 DefaultIterableDiffer.prototype._addToRemovals = function (record) {
7329 if (this._unlinkedRecords === null) {
7330 this._unlinkedRecords = new _DuplicateMap();
7331 }
7332 this._unlinkedRecords.put(record);
7333 record.currentIndex = null;
7334 record._nextRemoved = null;
7335 if (this._removalsTail === null) {
7336 // todo(vicb)
7337 // assert(_removalsHead === null);
7338 this._removalsTail = this._removalsHead = record;
7339 record._prevRemoved = null;
7340 }
7341 else {
7342 // todo(vicb)
7343 // assert(_removalsTail._nextRemoved === null);
7344 // assert(record._nextRemoved === null);
7345 record._prevRemoved = this._removalsTail;
7346 this._removalsTail = this._removalsTail._nextRemoved = record;
7347 }
7348 return record;
7349 };
7350 /**
7351 * \@internal
7352 * @param {?} record
7353 * @param {?} item
7354 * @return {?}
7355 */
7356 DefaultIterableDiffer.prototype._addIdentityChange = function (record, item) {
7357 record.item = item;
7358 if (this._identityChangesTail === null) {
7359 this._identityChangesTail = this._identityChangesHead = record;
7360 }
7361 else {
7362 this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record;
7363 }
7364 return record;
7365 };
7366 /**
7367 * @return {?}
7368 */
7369 DefaultIterableDiffer.prototype.toString = function () {
7370 var /** @type {?} */ list = [];
7371 this.forEachItem(function (record) { return list.push(record); });
7372 var /** @type {?} */ previous = [];
7373 this.forEachPreviousItem(function (record) { return previous.push(record); });
7374 var /** @type {?} */ additions = [];
7375 this.forEachAddedItem(function (record) { return additions.push(record); });
7376 var /** @type {?} */ moves = [];
7377 this.forEachMovedItem(function (record) { return moves.push(record); });
7378 var /** @type {?} */ removals = [];
7379 this.forEachRemovedItem(function (record) { return removals.push(record); });
7380 var /** @type {?} */ identityChanges = [];
7381 this.forEachIdentityChange(function (record) { return identityChanges.push(record); });
7382 return 'collection: ' + list.join(', ') + '\n' +
7383 'previous: ' + previous.join(', ') + '\n' +
7384 'additions: ' + additions.join(', ') + '\n' +
7385 'moves: ' + moves.join(', ') + '\n' +
7386 'removals: ' + removals.join(', ') + '\n' +
7387 'identityChanges: ' + identityChanges.join(', ') + '\n';
7388 };
7389 return DefaultIterableDiffer;
7390}());
7391/**
7392 * \@stable
7393 */
7394var IterableChangeRecord_ = (function () {
7395 /**
7396 * @param {?} item
7397 * @param {?} trackById
7398 */
7399 function IterableChangeRecord_(item, trackById) {
7400 this.item = item;
7401 this.trackById = trackById;
7402 this.currentIndex = null;
7403 this.previousIndex = null;
7404 /**
7405 * \@internal
7406 */
7407 this._nextPrevious = null;
7408 /**
7409 * \@internal
7410 */
7411 this._prev = null;
7412 /**
7413 * \@internal
7414 */
7415 this._next = null;
7416 /**
7417 * \@internal
7418 */
7419 this._prevDup = null;
7420 /**
7421 * \@internal
7422 */
7423 this._nextDup = null;
7424 /**
7425 * \@internal
7426 */
7427 this._prevRemoved = null;
7428 /**
7429 * \@internal
7430 */
7431 this._nextRemoved = null;
7432 /**
7433 * \@internal
7434 */
7435 this._nextAdded = null;
7436 /**
7437 * \@internal
7438 */
7439 this._nextMoved = null;
7440 /**
7441 * \@internal
7442 */
7443 this._nextIdentityChange = null;
7444 }
7445 /**
7446 * @return {?}
7447 */
7448 IterableChangeRecord_.prototype.toString = function () {
7449 return this.previousIndex === this.currentIndex ? stringify(this.item) :
7450 stringify(this.item) + '[' +
7451 stringify(this.previousIndex) + '->' + stringify(this.currentIndex) + ']';
7452 };
7453 return IterableChangeRecord_;
7454}());
7455var _DuplicateItemRecordList = (function () {
7456 function _DuplicateItemRecordList() {
7457 /**
7458 * \@internal
7459 */
7460 this._head = null;
7461 /**
7462 * \@internal
7463 */
7464 this._tail = null;
7465 }
7466 /**
7467 * Append the record to the list of duplicates.
7468 *
7469 * Note: by design all records in the list of duplicates hold the same value in record.item.
7470 * @param {?} record
7471 * @return {?}
7472 */
7473 _DuplicateItemRecordList.prototype.add = function (record) {
7474 if (this._head === null) {
7475 this._head = this._tail = record;
7476 record._nextDup = null;
7477 record._prevDup = null;
7478 }
7479 else {
7480 ((
7481 // todo(vicb)
7482 // assert(record.item == _head.item ||
7483 // record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN);
7484 this._tail))._nextDup = record;
7485 record._prevDup = this._tail;
7486 record._nextDup = null;
7487 this._tail = record;
7488 }
7489 };
7490 /**
7491 * @param {?} trackById
7492 * @param {?} afterIndex
7493 * @return {?}
7494 */
7495 _DuplicateItemRecordList.prototype.get = function (trackById, afterIndex) {
7496 var /** @type {?} */ record;
7497 for (record = this._head; record !== null; record = record._nextDup) {
7498 if ((afterIndex === null || afterIndex < ((record.currentIndex))) &&
7499 looseIdentical(record.trackById, trackById)) {
7500 return record;
7501 }
7502 }
7503 return null;
7504 };
7505 /**
7506 * Remove one {\@link IterableChangeRecord_} from the list of duplicates.
7507 *
7508 * Returns whether the list of duplicates is empty.
7509 * @param {?} record
7510 * @return {?}
7511 */
7512 _DuplicateItemRecordList.prototype.remove = function (record) {
7513 // todo(vicb)
7514 // assert(() {
7515 // // verify that the record being removed is in the list.
7516 // for (IterableChangeRecord_ cursor = _head; cursor != null; cursor = cursor._nextDup) {
7517 // if (identical(cursor, record)) return true;
7518 // }
7519 // return false;
7520 //});
7521 var /** @type {?} */ prev = record._prevDup;
7522 var /** @type {?} */ next = record._nextDup;
7523 if (prev === null) {
7524 this._head = next;
7525 }
7526 else {
7527 prev._nextDup = next;
7528 }
7529 if (next === null) {
7530 this._tail = prev;
7531 }
7532 else {
7533 next._prevDup = prev;
7534 }
7535 return this._head === null;
7536 };
7537 return _DuplicateItemRecordList;
7538}());
7539var _DuplicateMap = (function () {
7540 function _DuplicateMap() {
7541 this.map = new Map();
7542 }
7543 /**
7544 * @param {?} record
7545 * @return {?}
7546 */
7547 _DuplicateMap.prototype.put = function (record) {
7548 var /** @type {?} */ key = record.trackById;
7549 var /** @type {?} */ duplicates = this.map.get(key);
7550 if (!duplicates) {
7551 duplicates = new _DuplicateItemRecordList();
7552 this.map.set(key, duplicates);
7553 }
7554 duplicates.add(record);
7555 };
7556 /**
7557 * Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we
7558 * have already iterated over, we use the afterIndex to pretend it is not there.
7559 *
7560 * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
7561 * have any more `a`s needs to return the last `a` not the first or second.
7562 * @param {?} trackById
7563 * @param {?} afterIndex
7564 * @return {?}
7565 */
7566 _DuplicateMap.prototype.get = function (trackById, afterIndex) {
7567 var /** @type {?} */ key = trackById;
7568 var /** @type {?} */ recordList = this.map.get(key);
7569 return recordList ? recordList.get(trackById, afterIndex) : null;
7570 };
7571 /**
7572 * Removes a {\@link IterableChangeRecord_} from the list of duplicates.
7573 *
7574 * The list of duplicates also is removed from the map if it gets empty.
7575 * @param {?} record
7576 * @return {?}
7577 */
7578 _DuplicateMap.prototype.remove = function (record) {
7579 var /** @type {?} */ key = record.trackById;
7580 var /** @type {?} */ recordList = ((this.map.get(key)));
7581 // Remove the list of duplicates when it gets empty
7582 if (recordList.remove(record)) {
7583 this.map.delete(key);
7584 }
7585 return record;
7586 };
7587 Object.defineProperty(_DuplicateMap.prototype, "isEmpty", {
7588 /**
7589 * @return {?}
7590 */
7591 get: function () { return this.map.size === 0; },
7592 enumerable: true,
7593 configurable: true
7594 });
7595 /**
7596 * @return {?}
7597 */
7598 _DuplicateMap.prototype.clear = function () { this.map.clear(); };
7599 /**
7600 * @return {?}
7601 */
7602 _DuplicateMap.prototype.toString = function () { return '_DuplicateMap(' + stringify(this.map) + ')'; };
7603 return _DuplicateMap;
7604}());
7605/**
7606 * @param {?} item
7607 * @param {?} addRemoveOffset
7608 * @param {?} moveOffsets
7609 * @return {?}
7610 */
7611function getPreviousIndex(item, addRemoveOffset, moveOffsets) {
7612 var /** @type {?} */ previousIndex = item.previousIndex;
7613 if (previousIndex === null)
7614 return previousIndex;
7615 var /** @type {?} */ moveOffset = 0;
7616 if (moveOffsets && previousIndex < moveOffsets.length) {
7617 moveOffset = moveOffsets[previousIndex];
7618 }
7619 return previousIndex + addRemoveOffset + moveOffset;
7620}
7621/**
7622 * @license
7623 * Copyright Google Inc. All Rights Reserved.
7624 *
7625 * Use of this source code is governed by an MIT-style license that can be
7626 * found in the LICENSE file at https://angular.io/license
7627 */
7628var DefaultKeyValueDifferFactory = (function () {
7629 function DefaultKeyValueDifferFactory() {
7630 }
7631 /**
7632 * @param {?} obj
7633 * @return {?}
7634 */
7635 DefaultKeyValueDifferFactory.prototype.supports = function (obj) { return obj instanceof Map || isJsObject(obj); };
7636 /**
7637 * @deprecated v4.0.0 - ChangeDetectorRef is not used and is no longer a parameter
7638 * @template K, V
7639 * @param {?=} cd
7640 * @return {?}
7641 */
7642 DefaultKeyValueDifferFactory.prototype.create = function (cd) {
7643 return new DefaultKeyValueDiffer();
7644 };
7645 return DefaultKeyValueDifferFactory;
7646}());
7647var DefaultKeyValueDiffer = (function () {
7648 function DefaultKeyValueDiffer() {
7649 this._records = new Map();
7650 this._mapHead = null;
7651 this._appendAfter = null;
7652 this._previousMapHead = null;
7653 this._changesHead = null;
7654 this._changesTail = null;
7655 this._additionsHead = null;
7656 this._additionsTail = null;
7657 this._removalsHead = null;
7658 this._removalsTail = null;
7659 }
7660 Object.defineProperty(DefaultKeyValueDiffer.prototype, "isDirty", {
7661 /**
7662 * @return {?}
7663 */
7664 get: function () {
7665 return this._additionsHead !== null || this._changesHead !== null ||
7666 this._removalsHead !== null;
7667 },
7668 enumerable: true,
7669 configurable: true
7670 });
7671 /**
7672 * @param {?} fn
7673 * @return {?}
7674 */
7675 DefaultKeyValueDiffer.prototype.forEachItem = function (fn) {
7676 var /** @type {?} */ record;
7677 for (record = this._mapHead; record !== null; record = record._next) {
7678 fn(record);
7679 }
7680 };
7681 /**
7682 * @param {?} fn
7683 * @return {?}
7684 */
7685 DefaultKeyValueDiffer.prototype.forEachPreviousItem = function (fn) {
7686 var /** @type {?} */ record;
7687 for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
7688 fn(record);
7689 }
7690 };
7691 /**
7692 * @param {?} fn
7693 * @return {?}
7694 */
7695 DefaultKeyValueDiffer.prototype.forEachChangedItem = function (fn) {
7696 var /** @type {?} */ record;
7697 for (record = this._changesHead; record !== null; record = record._nextChanged) {
7698 fn(record);
7699 }
7700 };
7701 /**
7702 * @param {?} fn
7703 * @return {?}
7704 */
7705 DefaultKeyValueDiffer.prototype.forEachAddedItem = function (fn) {
7706 var /** @type {?} */ record;
7707 for (record = this._additionsHead; record !== null; record = record._nextAdded) {
7708 fn(record);
7709 }
7710 };
7711 /**
7712 * @param {?} fn
7713 * @return {?}
7714 */
7715 DefaultKeyValueDiffer.prototype.forEachRemovedItem = function (fn) {
7716 var /** @type {?} */ record;
7717 for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
7718 fn(record);
7719 }
7720 };
7721 /**
7722 * @param {?=} map
7723 * @return {?}
7724 */
7725 DefaultKeyValueDiffer.prototype.diff = function (map) {
7726 if (!map) {
7727 map = new Map();
7728 }
7729 else if (!(map instanceof Map || isJsObject(map))) {
7730 throw new Error("Error trying to diff '" + stringify(map) + "'. Only maps and objects are allowed");
7731 }
7732 return this.check(map) ? this : null;
7733 };
7734 /**
7735 * @return {?}
7736 */
7737 DefaultKeyValueDiffer.prototype.onDestroy = function () { };
7738 /**
7739 * Check the current state of the map vs the previous.
7740 * The algorithm is optimised for when the keys do no change.
7741 * @param {?} map
7742 * @return {?}
7743 */
7744 DefaultKeyValueDiffer.prototype.check = function (map) {
7745 var _this = this;
7746 this._reset();
7747 var /** @type {?} */ insertBefore = this._mapHead;
7748 this._appendAfter = null;
7749 this._forEach(map, function (value, key) {
7750 if (insertBefore && insertBefore.key === key) {
7751 _this._maybeAddToChanges(insertBefore, value);
7752 _this._appendAfter = insertBefore;
7753 insertBefore = insertBefore._next;
7754 }
7755 else {
7756 var /** @type {?} */ record = _this._getOrCreateRecordForKey(key, value);
7757 insertBefore = _this._insertBeforeOrAppend(insertBefore, record);
7758 }
7759 });
7760 // Items remaining at the end of the list have been deleted
7761 if (insertBefore) {
7762 if (insertBefore._prev) {
7763 insertBefore._prev._next = null;
7764 }
7765 this._removalsHead = insertBefore;
7766 for (var /** @type {?} */ record = insertBefore; record !== null; record = record._nextRemoved) {
7767 if (record === this._mapHead) {
7768 this._mapHead = null;
7769 }
7770 this._records.delete(record.key);
7771 record._nextRemoved = record._next;
7772 record.previousValue = record.currentValue;
7773 record.currentValue = null;
7774 record._prev = null;
7775 record._next = null;
7776 }
7777 }
7778 // Make sure tails have no next records from previous runs
7779 if (this._changesTail)
7780 this._changesTail._nextChanged = null;
7781 if (this._additionsTail)
7782 this._additionsTail._nextAdded = null;
7783 return this.isDirty;
7784 };
7785 /**
7786 * Inserts a record before `before` or append at the end of the list when `before` is null.
7787 *
7788 * Notes:
7789 * - This method appends at `this._appendAfter`,
7790 * - This method updates `this._appendAfter`,
7791 * - The return value is the new value for the insertion pointer.
7792 * @param {?} before
7793 * @param {?} record
7794 * @return {?}
7795 */
7796 DefaultKeyValueDiffer.prototype._insertBeforeOrAppend = function (before, record) {
7797 if (before) {
7798 var /** @type {?} */ prev = before._prev;
7799 record._next = before;
7800 record._prev = prev;
7801 before._prev = record;
7802 if (prev) {
7803 prev._next = record;
7804 }
7805 if (before === this._mapHead) {
7806 this._mapHead = record;
7807 }
7808 this._appendAfter = before;
7809 return before;
7810 }
7811 if (this._appendAfter) {
7812 this._appendAfter._next = record;
7813 record._prev = this._appendAfter;
7814 }
7815 else {
7816 this._mapHead = record;
7817 }
7818 this._appendAfter = record;
7819 return null;
7820 };
7821 /**
7822 * @param {?} key
7823 * @param {?} value
7824 * @return {?}
7825 */
7826 DefaultKeyValueDiffer.prototype._getOrCreateRecordForKey = function (key, value) {
7827 if (this._records.has(key)) {
7828 var /** @type {?} */ record_1 = ((this._records.get(key)));
7829 this._maybeAddToChanges(record_1, value);
7830 var /** @type {?} */ prev = record_1._prev;
7831 var /** @type {?} */ next = record_1._next;
7832 if (prev) {
7833 prev._next = next;
7834 }
7835 if (next) {
7836 next._prev = prev;
7837 }
7838 record_1._next = null;
7839 record_1._prev = null;
7840 return record_1;
7841 }
7842 var /** @type {?} */ record = new KeyValueChangeRecord_(key);
7843 this._records.set(key, record);
7844 record.currentValue = value;
7845 this._addToAdditions(record);
7846 return record;
7847 };
7848 /**
7849 * \@internal
7850 * @return {?}
7851 */
7852 DefaultKeyValueDiffer.prototype._reset = function () {
7853 if (this.isDirty) {
7854 var /** @type {?} */ record = void 0;
7855 // let `_previousMapHead` contain the state of the map before the changes
7856 this._previousMapHead = this._mapHead;
7857 for (record = this._previousMapHead; record !== null; record = record._next) {
7858 record._nextPrevious = record._next;
7859 }
7860 // Update `record.previousValue` with the value of the item before the changes
7861 // We need to update all changed items (that's those which have been added and changed)
7862 for (record = this._changesHead; record !== null; record = record._nextChanged) {
7863 record.previousValue = record.currentValue;
7864 }
7865 for (record = this._additionsHead; record != null; record = record._nextAdded) {
7866 record.previousValue = record.currentValue;
7867 }
7868 this._changesHead = this._changesTail = null;
7869 this._additionsHead = this._additionsTail = null;
7870 this._removalsHead = null;
7871 }
7872 };
7873 /**
7874 * @param {?} record
7875 * @param {?} newValue
7876 * @return {?}
7877 */
7878 DefaultKeyValueDiffer.prototype._maybeAddToChanges = function (record, newValue) {
7879 if (!looseIdentical(newValue, record.currentValue)) {
7880 record.previousValue = record.currentValue;
7881 record.currentValue = newValue;
7882 this._addToChanges(record);
7883 }
7884 };
7885 /**
7886 * @param {?} record
7887 * @return {?}
7888 */
7889 DefaultKeyValueDiffer.prototype._addToAdditions = function (record) {
7890 if (this._additionsHead === null) {
7891 this._additionsHead = this._additionsTail = record;
7892 }
7893 else {
7894 ((this._additionsTail))._nextAdded = record;
7895 this._additionsTail = record;
7896 }
7897 };
7898 /**
7899 * @param {?} record
7900 * @return {?}
7901 */
7902 DefaultKeyValueDiffer.prototype._addToChanges = function (record) {
7903 if (this._changesHead === null) {
7904 this._changesHead = this._changesTail = record;
7905 }
7906 else {
7907 ((this._changesTail))._nextChanged = record;
7908 this._changesTail = record;
7909 }
7910 };
7911 /**
7912 * @return {?}
7913 */
7914 DefaultKeyValueDiffer.prototype.toString = function () {
7915 var /** @type {?} */ items = [];
7916 var /** @type {?} */ previous = [];
7917 var /** @type {?} */ changes = [];
7918 var /** @type {?} */ additions = [];
7919 var /** @type {?} */ removals = [];
7920 this.forEachItem(function (r) { return items.push(stringify(r)); });
7921 this.forEachPreviousItem(function (r) { return previous.push(stringify(r)); });
7922 this.forEachChangedItem(function (r) { return changes.push(stringify(r)); });
7923 this.forEachAddedItem(function (r) { return additions.push(stringify(r)); });
7924 this.forEachRemovedItem(function (r) { return removals.push(stringify(r)); });
7925 return 'map: ' + items.join(', ') + '\n' +
7926 'previous: ' + previous.join(', ') + '\n' +
7927 'additions: ' + additions.join(', ') + '\n' +
7928 'changes: ' + changes.join(', ') + '\n' +
7929 'removals: ' + removals.join(', ') + '\n';
7930 };
7931 /**
7932 * \@internal
7933 * @template K, V
7934 * @param {?} obj
7935 * @param {?} fn
7936 * @return {?}
7937 */
7938 DefaultKeyValueDiffer.prototype._forEach = function (obj, fn) {
7939 if (obj instanceof Map) {
7940 obj.forEach(fn);
7941 }
7942 else {
7943 Object.keys(obj).forEach(function (k) { return fn(obj[k], k); });
7944 }
7945 };
7946 return DefaultKeyValueDiffer;
7947}());
7948/**
7949 * \@stable
7950 */
7951var KeyValueChangeRecord_ = (function () {
7952 /**
7953 * @param {?} key
7954 */
7955 function KeyValueChangeRecord_(key) {
7956 this.key = key;
7957 this.previousValue = null;
7958 this.currentValue = null;
7959 /**
7960 * \@internal
7961 */
7962 this._nextPrevious = null;
7963 /**
7964 * \@internal
7965 */
7966 this._next = null;
7967 /**
7968 * \@internal
7969 */
7970 this._prev = null;
7971 /**
7972 * \@internal
7973 */
7974 this._nextAdded = null;
7975 /**
7976 * \@internal
7977 */
7978 this._nextRemoved = null;
7979 /**
7980 * \@internal
7981 */
7982 this._nextChanged = null;
7983 }
7984 /**
7985 * @return {?}
7986 */
7987 KeyValueChangeRecord_.prototype.toString = function () {
7988 return looseIdentical(this.previousValue, this.currentValue) ?
7989 stringify(this.key) :
7990 (stringify(this.key) + '[' + stringify(this.previousValue) + '->' +
7991 stringify(this.currentValue) + ']');
7992 };
7993 return KeyValueChangeRecord_;
7994}());
7995/**
7996 * @license
7997 * Copyright Google Inc. All Rights Reserved.
7998 *
7999 * Use of this source code is governed by an MIT-style license that can be
8000 * found in the LICENSE file at https://angular.io/license
8001 */
8002/**
8003 * A repository of different iterable diffing strategies used by NgFor, NgClass, and others.
8004 * \@stable
8005 */
8006var IterableDiffers = (function () {
8007 /**
8008 * @param {?} factories
8009 */
8010 function IterableDiffers(factories) {
8011 this.factories = factories;
8012 }
8013 /**
8014 * @param {?} factories
8015 * @param {?=} parent
8016 * @return {?}
8017 */
8018 IterableDiffers.create = function (factories, parent) {
8019 if (parent != null) {
8020 var /** @type {?} */ copied = parent.factories.slice();
8021 factories = factories.concat(copied);
8022 return new IterableDiffers(factories);
8023 }
8024 else {
8025 return new IterableDiffers(factories);
8026 }
8027 };
8028 /**
8029 * Takes an array of {\@link IterableDifferFactory} and returns a provider used to extend the
8030 * inherited {\@link IterableDiffers} instance with the provided factories and return a new
8031 * {\@link IterableDiffers} instance.
8032 *
8033 * The following example shows how to extend an existing list of factories,
8034 * which will only be applied to the injector for this component and its children.
8035 * This step is all that's required to make a new {\@link IterableDiffer} available.
8036 *
8037 * ### Example
8038 *
8039 * ```
8040 * \@Component({
8041 * viewProviders: [
8042 * IterableDiffers.extend([new ImmutableListDiffer()])
8043 * ]
8044 * })
8045 * ```
8046 * @param {?} factories
8047 * @return {?}
8048 */
8049 IterableDiffers.extend = function (factories) {
8050 return {
8051 provide: IterableDiffers,
8052 useFactory: function (parent) {
8053 if (!parent) {
8054 // Typically would occur when calling IterableDiffers.extend inside of dependencies passed
8055 // to
8056 // bootstrap(), which would override default pipes instead of extending them.
8057 throw new Error('Cannot extend IterableDiffers without a parent injector');
8058 }
8059 return IterableDiffers.create(factories, parent);
8060 },
8061 // Dependency technically isn't optional, but we can provide a better error message this way.
8062 deps: [[IterableDiffers, new SkipSelf(), new Optional()]]
8063 };
8064 };
8065 /**
8066 * @param {?} iterable
8067 * @return {?}
8068 */
8069 IterableDiffers.prototype.find = function (iterable) {
8070 var /** @type {?} */ factory = this.factories.find(function (f) { return f.supports(iterable); });
8071 if (factory != null) {
8072 return factory;
8073 }
8074 else {
8075 throw new Error("Cannot find a differ supporting object '" + iterable + "' of type '" + getTypeNameForDebugging(iterable) + "'");
8076 }
8077 };
8078 return IterableDiffers;
8079}());
8080/**
8081 * @param {?} type
8082 * @return {?}
8083 */
8084function getTypeNameForDebugging(type) {
8085 return type['name'] || typeof type;
8086}
8087/**
8088 * @license
8089 * Copyright Google Inc. All Rights Reserved.
8090 *
8091 * Use of this source code is governed by an MIT-style license that can be
8092 * found in the LICENSE file at https://angular.io/license
8093 */
8094/**
8095 * A repository of different Map diffing strategies used by NgClass, NgStyle, and others.
8096 * \@stable
8097 */
8098var KeyValueDiffers = (function () {
8099 /**
8100 * @param {?} factories
8101 */
8102 function KeyValueDiffers(factories) {
8103 this.factories = factories;
8104 }
8105 /**
8106 * @template S
8107 * @param {?} factories
8108 * @param {?=} parent
8109 * @return {?}
8110 */
8111 KeyValueDiffers.create = function (factories, parent) {
8112 if (parent) {
8113 var /** @type {?} */ copied = parent.factories.slice();
8114 factories = factories.concat(copied);
8115 }
8116 return new KeyValueDiffers(factories);
8117 };
8118 /**
8119 * Takes an array of {\@link KeyValueDifferFactory} and returns a provider used to extend the
8120 * inherited {\@link KeyValueDiffers} instance with the provided factories and return a new
8121 * {\@link KeyValueDiffers} instance.
8122 *
8123 * The following example shows how to extend an existing list of factories,
8124 * which will only be applied to the injector for this component and its children.
8125 * This step is all that's required to make a new {\@link KeyValueDiffer} available.
8126 *
8127 * ### Example
8128 *
8129 * ```
8130 * \@Component({
8131 * viewProviders: [
8132 * KeyValueDiffers.extend([new ImmutableMapDiffer()])
8133 * ]
8134 * })
8135 * ```
8136 * @template S
8137 * @param {?} factories
8138 * @return {?}
8139 */
8140 KeyValueDiffers.extend = function (factories) {
8141 return {
8142 provide: KeyValueDiffers,
8143 useFactory: function (parent) {
8144 if (!parent) {
8145 // Typically would occur when calling KeyValueDiffers.extend inside of dependencies passed
8146 // to bootstrap(), which would override default pipes instead of extending them.
8147 throw new Error('Cannot extend KeyValueDiffers without a parent injector');
8148 }
8149 return KeyValueDiffers.create(factories, parent);
8150 },
8151 // Dependency technically isn't optional, but we can provide a better error message this way.
8152 deps: [[KeyValueDiffers, new SkipSelf(), new Optional()]]
8153 };
8154 };
8155 /**
8156 * @param {?} kv
8157 * @return {?}
8158 */
8159 KeyValueDiffers.prototype.find = function (kv) {
8160 var /** @type {?} */ factory = this.factories.find(function (f) { return f.supports(kv); });
8161 if (factory) {
8162 return factory;
8163 }
8164 throw new Error("Cannot find a differ supporting object '" + kv + "'");
8165 };
8166 return KeyValueDiffers;
8167}());
8168/**
8169 * @license
8170 * Copyright Google Inc. All Rights Reserved.
8171 *
8172 * Use of this source code is governed by an MIT-style license that can be
8173 * found in the LICENSE file at https://angular.io/license
8174 */
8175/**
8176 * Structural diffing for `Object`s and `Map`s.
8177 */
8178var keyValDiff = [new DefaultKeyValueDifferFactory()];
8179/**
8180 * Structural diffing for `Iterable` types such as `Array`s.
8181 */
8182var iterableDiff = [new DefaultIterableDifferFactory()];
8183var defaultIterableDiffers = new IterableDiffers(iterableDiff);
8184var defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
8185/**
8186 * @license
8187 * Copyright Google Inc. All Rights Reserved.
8188 *
8189 * Use of this source code is governed by an MIT-style license that can be
8190 * found in the LICENSE file at https://angular.io/license
8191 */
8192/**
8193 * @module
8194 * @description
8195 * Change detection enables data binding in Angular.
8196 */
8197/**
8198 * @license
8199 * Copyright Google Inc. All Rights Reserved.
8200 *
8201 * Use of this source code is governed by an MIT-style license that can be
8202 * found in the LICENSE file at https://angular.io/license
8203 */
8204/**
8205 * @return {?}
8206 */
8207function _reflector() {
8208 return reflector;
8209}
8210var _CORE_PLATFORM_PROVIDERS = [
8211 // Set a default platform name for platforms that don't set it explicitly.
8212 { provide: PLATFORM_ID, useValue: 'unknown' },
8213 PlatformRef_,
8214 { provide: PlatformRef, useExisting: PlatformRef_ },
8215 { provide: Reflector, useFactory: _reflector, deps: [] },
8216 TestabilityRegistry,
8217 Console,
8218];
8219/**
8220 * This platform has to be included in any other platform
8221 *
8222 * \@experimental
8223 */
8224var platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
8225/**
8226 * @license
8227 * Copyright Google Inc. All Rights Reserved.
8228 *
8229 * Use of this source code is governed by an MIT-style license that can be
8230 * found in the LICENSE file at https://angular.io/license
8231 */
8232/**
8233 * \@experimental i18n support is experimental.
8234 */
8235var LOCALE_ID = new InjectionToken('LocaleId');
8236/**
8237 * \@experimental i18n support is experimental.
8238 */
8239var TRANSLATIONS = new InjectionToken('Translations');
8240/**
8241 * \@experimental i18n support is experimental.
8242 */
8243var TRANSLATIONS_FORMAT = new InjectionToken('TranslationsFormat');
8244var MissingTranslationStrategy = {};
8245MissingTranslationStrategy.Error = 0;
8246MissingTranslationStrategy.Warning = 1;
8247MissingTranslationStrategy.Ignore = 2;
8248MissingTranslationStrategy[MissingTranslationStrategy.Error] = "Error";
8249MissingTranslationStrategy[MissingTranslationStrategy.Warning] = "Warning";
8250MissingTranslationStrategy[MissingTranslationStrategy.Ignore] = "Ignore";
8251/**
8252 * @license
8253 * Copyright Google Inc. All Rights Reserved.
8254 *
8255 * Use of this source code is governed by an MIT-style license that can be
8256 * found in the LICENSE file at https://angular.io/license
8257 */
8258/**
8259 * @return {?}
8260 */
8261function _iterableDiffersFactory() {
8262 return defaultIterableDiffers;
8263}
8264/**
8265 * @return {?}
8266 */
8267function _keyValueDiffersFactory() {
8268 return defaultKeyValueDiffers;
8269}
8270/**
8271 * @param {?=} locale
8272 * @return {?}
8273 */
8274function _localeFactory(locale) {
8275 return locale || 'en-US';
8276}
8277/**
8278 * This module includes the providers of \@angular/core that are needed
8279 * to bootstrap components via `ApplicationRef`.
8280 *
8281 * \@experimental
8282 */
8283var ApplicationModule = (function () {
8284 /**
8285 * @param {?} appRef
8286 */
8287 function ApplicationModule(appRef) {
8288 }
8289 return ApplicationModule;
8290}());
8291ApplicationModule.decorators = [
8292 { type: NgModule, args: [{
8293 providers: [
8294 ApplicationRef_,
8295 { provide: ApplicationRef, useExisting: ApplicationRef_ },
8296 ApplicationInitStatus,
8297 Compiler,
8298 APP_ID_RANDOM_PROVIDER,
8299 { provide: IterableDiffers, useFactory: _iterableDiffersFactory },
8300 { provide: KeyValueDiffers, useFactory: _keyValueDiffersFactory },
8301 {
8302 provide: LOCALE_ID,
8303 useFactory: _localeFactory,
8304 deps: [[new Inject(LOCALE_ID), new Optional(), new SkipSelf()]]
8305 },
8306 ]
8307 },] },
8308];
8309/**
8310 * @nocollapse
8311 */
8312ApplicationModule.ctorParameters = function () { return [
8313 { type: ApplicationRef, },
8314]; };
8315var SecurityContext = {};
8316SecurityContext.NONE = 0;
8317SecurityContext.HTML = 1;
8318SecurityContext.STYLE = 2;
8319SecurityContext.SCRIPT = 3;
8320SecurityContext.URL = 4;
8321SecurityContext.RESOURCE_URL = 5;
8322SecurityContext[SecurityContext.NONE] = "NONE";
8323SecurityContext[SecurityContext.HTML] = "HTML";
8324SecurityContext[SecurityContext.STYLE] = "STYLE";
8325SecurityContext[SecurityContext.SCRIPT] = "SCRIPT";
8326SecurityContext[SecurityContext.URL] = "URL";
8327SecurityContext[SecurityContext.RESOURCE_URL] = "RESOURCE_URL";
8328/**
8329 * Sanitizer is used by the views to sanitize potentially dangerous values.
8330 *
8331 * \@stable
8332 * @abstract
8333 */
8334var Sanitizer = (function () {
8335 function Sanitizer() {
8336 }
8337 /**
8338 * @abstract
8339 * @param {?} context
8340 * @param {?} value
8341 * @return {?}
8342 */
8343 Sanitizer.prototype.sanitize = function (context, value) { };
8344 return Sanitizer;
8345}());
8346/**
8347 * @license
8348 * Copyright Google Inc. All Rights Reserved.
8349 *
8350 * Use of this source code is governed by an MIT-style license that can be
8351 * found in the LICENSE file at https://angular.io/license
8352 */
8353/**
8354 * Node instance data.
8355 *
8356 * We have a separate type per NodeType to save memory
8357 * (TextData | ElementData | ProviderData | PureExpressionData | QueryList<any>)
8358 *
8359 * To keep our code monomorphic,
8360 * we prohibit using `NodeData` directly but enforce the use of accessors (`asElementData`, ...).
8361 * This way, no usage site can get a `NodeData` from view.nodes and then use it for different
8362 * purposes.
8363 */
8364/**
8365 * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
8366 * @param {?} view
8367 * @param {?} index
8368 * @return {?}
8369 */
8370function asTextData(view, index) {
8371 return (view.nodes[index]);
8372}
8373/**
8374 * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
8375 * @param {?} view
8376 * @param {?} index
8377 * @return {?}
8378 */
8379function asElementData(view, index) {
8380 return (view.nodes[index]);
8381}
8382/**
8383 * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
8384 * @param {?} view
8385 * @param {?} index
8386 * @return {?}
8387 */
8388function asProviderData(view, index) {
8389 return (view.nodes[index]);
8390}
8391/**
8392 * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
8393 * @param {?} view
8394 * @param {?} index
8395 * @return {?}
8396 */
8397function asPureExpressionData(view, index) {
8398 return (view.nodes[index]);
8399}
8400/**
8401 * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
8402 * @param {?} view
8403 * @param {?} index
8404 * @return {?}
8405 */
8406function asQueryList(view, index) {
8407 return (view.nodes[index]);
8408}
8409/**
8410 * @abstract
8411 */
8412var DebugContext = (function () {
8413 function DebugContext() {
8414 }
8415 /**
8416 * @abstract
8417 * @return {?}
8418 */
8419 DebugContext.prototype.view = function () { };
8420 /**
8421 * @abstract
8422 * @return {?}
8423 */
8424 DebugContext.prototype.nodeIndex = function () { };
8425 /**
8426 * @abstract
8427 * @return {?}
8428 */
8429 DebugContext.prototype.injector = function () { };
8430 /**
8431 * @abstract
8432 * @return {?}
8433 */
8434 DebugContext.prototype.component = function () { };
8435 /**
8436 * @abstract
8437 * @return {?}
8438 */
8439 DebugContext.prototype.providerTokens = function () { };
8440 /**
8441 * @abstract
8442 * @return {?}
8443 */
8444 DebugContext.prototype.references = function () { };
8445 /**
8446 * @abstract
8447 * @return {?}
8448 */
8449 DebugContext.prototype.context = function () { };
8450 /**
8451 * @abstract
8452 * @return {?}
8453 */
8454 DebugContext.prototype.componentRenderElement = function () { };
8455 /**
8456 * @abstract
8457 * @return {?}
8458 */
8459 DebugContext.prototype.renderNode = function () { };
8460 /**
8461 * @abstract
8462 * @param {?} console
8463 * @param {...?} values
8464 * @return {?}
8465 */
8466 DebugContext.prototype.logError = function (console) {
8467 var values = [];
8468 for (var _i = 1; _i < arguments.length; _i++) {
8469 values[_i - 1] = arguments[_i];
8470 }
8471 };
8472 return DebugContext;
8473}());
8474/**
8475 * This object is used to prevent cycles in the source files and to have a place where
8476 * debug mode can hook it. It is lazily filled when `isDevMode` is known.
8477 */
8478var Services = {
8479 setCurrentNode: undefined,
8480 createRootView: undefined,
8481 createEmbeddedView: undefined,
8482 createComponentView: undefined,
8483 createNgModuleRef: undefined,
8484 overrideProvider: undefined,
8485 clearProviderOverrides: undefined,
8486 checkAndUpdateView: undefined,
8487 checkNoChangesView: undefined,
8488 destroyView: undefined,
8489 resolveDep: undefined,
8490 createDebugContext: undefined,
8491 handleEvent: undefined,
8492 updateDirectives: undefined,
8493 updateRenderer: undefined,
8494 dirtyParentQueries: undefined,
8495};
8496/**
8497 * @license
8498 * Copyright Google Inc. All Rights Reserved.
8499 *
8500 * Use of this source code is governed by an MIT-style license that can be
8501 * found in the LICENSE file at https://angular.io/license
8502 */
8503/**
8504 * @param {?} context
8505 * @param {?} oldValue
8506 * @param {?} currValue
8507 * @param {?} isFirstCheck
8508 * @return {?}
8509 */
8510function expressionChangedAfterItHasBeenCheckedError(context, oldValue, currValue, isFirstCheck) {
8511 var /** @type {?} */ msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
8512 if (isFirstCheck) {
8513 msg +=
8514 " It seems like the view has been created after its parent and its children have been dirty checked." +
8515 " Has it been created in a change detection hook ?";
8516 }
8517 return viewDebugError(msg, context);
8518}
8519/**
8520 * @param {?} err
8521 * @param {?} context
8522 * @return {?}
8523 */
8524function viewWrappedDebugError(err, context) {
8525 if (!(err instanceof Error)) {
8526 // errors that are not Error instances don't have a stack,
8527 // so it is ok to wrap them into a new Error object...
8528 err = new Error(err.toString());
8529 }
8530 _addDebugContext(err, context);
8531 return err;
8532}
8533/**
8534 * @param {?} msg
8535 * @param {?} context
8536 * @return {?}
8537 */
8538function viewDebugError(msg, context) {
8539 var /** @type {?} */ err = new Error(msg);
8540 _addDebugContext(err, context);
8541 return err;
8542}
8543/**
8544 * @param {?} err
8545 * @param {?} context
8546 * @return {?}
8547 */
8548function _addDebugContext(err, context) {
8549 ((err))[ERROR_DEBUG_CONTEXT] = context;
8550 ((err))[ERROR_LOGGER] = context.logError.bind(context);
8551}
8552/**
8553 * @param {?} err
8554 * @return {?}
8555 */
8556function isViewDebugError(err) {
8557 return !!getDebugContext(err);
8558}
8559/**
8560 * @param {?} action
8561 * @return {?}
8562 */
8563function viewDestroyedError(action) {
8564 return new Error("ViewDestroyedError: Attempt to use a destroyed view: " + action);
8565}
8566/**
8567 * @license
8568 * Copyright Google Inc. All Rights Reserved.
8569 *
8570 * Use of this source code is governed by an MIT-style license that can be
8571 * found in the LICENSE file at https://angular.io/license
8572 */
8573var NOOP = function () { };
8574var _tokenKeyCache = new Map();
8575/**
8576 * @param {?} token
8577 * @return {?}
8578 */
8579function tokenKey(token) {
8580 var /** @type {?} */ key = _tokenKeyCache.get(token);
8581 if (!key) {
8582 key = stringify(token) + '_' + _tokenKeyCache.size;
8583 _tokenKeyCache.set(token, key);
8584 }
8585 return key;
8586}
8587/**
8588 * @param {?} view
8589 * @param {?} nodeIdx
8590 * @param {?} bindingIdx
8591 * @param {?} value
8592 * @return {?}
8593 */
8594function unwrapValue(view, nodeIdx, bindingIdx, value) {
8595 if (value instanceof WrappedValue) {
8596 value = value.wrapped;
8597 var /** @type {?} */ globalBindingIdx = view.def.nodes[nodeIdx].bindingIndex + bindingIdx;
8598 var /** @type {?} */ oldValue = view.oldValues[globalBindingIdx];
8599 if (oldValue instanceof WrappedValue) {
8600 oldValue = oldValue.wrapped;
8601 }
8602 view.oldValues[globalBindingIdx] = new WrappedValue(oldValue);
8603 }
8604 return value;
8605}
8606var UNDEFINED_RENDERER_TYPE_ID = '$$undefined';
8607var EMPTY_RENDERER_TYPE_ID = '$$empty';
8608/**
8609 * @param {?} values
8610 * @return {?}
8611 */
8612function createRendererType2(values) {
8613 return {
8614 id: UNDEFINED_RENDERER_TYPE_ID,
8615 styles: values.styles,
8616 encapsulation: values.encapsulation,
8617 data: values.data
8618 };
8619}
8620var _renderCompCount = 0;
8621/**
8622 * @param {?=} type
8623 * @return {?}
8624 */
8625function resolveRendererType2(type) {
8626 if (type && type.id === UNDEFINED_RENDERER_TYPE_ID) {
8627 // first time we see this RendererType2. Initialize it...
8628 var /** @type {?} */ isFilled = ((type.encapsulation != null && type.encapsulation !== ViewEncapsulation.None) ||
8629 type.styles.length || Object.keys(type.data).length);
8630 if (isFilled) {
8631 type.id = "c" + _renderCompCount++;
8632 }
8633 else {
8634 type.id = EMPTY_RENDERER_TYPE_ID;
8635 }
8636 }
8637 if (type && type.id === EMPTY_RENDERER_TYPE_ID) {
8638 type = null;
8639 }
8640 return type || null;
8641}
8642/**
8643 * @param {?} view
8644 * @param {?} def
8645 * @param {?} bindingIdx
8646 * @param {?} value
8647 * @return {?}
8648 */
8649function checkBinding(view, def, bindingIdx, value) {
8650 var /** @type {?} */ oldValues = view.oldValues;
8651 if ((view.state & 2 /* FirstCheck */) ||
8652 !looseIdentical(oldValues[def.bindingIndex + bindingIdx], value)) {
8653 return true;
8654 }
8655 return false;
8656}
8657/**
8658 * @param {?} view
8659 * @param {?} def
8660 * @param {?} bindingIdx
8661 * @param {?} value
8662 * @return {?}
8663 */
8664function checkAndUpdateBinding(view, def, bindingIdx, value) {
8665 if (checkBinding(view, def, bindingIdx, value)) {
8666 view.oldValues[def.bindingIndex + bindingIdx] = value;
8667 return true;
8668 }
8669 return false;
8670}
8671/**
8672 * @param {?} view
8673 * @param {?} def
8674 * @param {?} bindingIdx
8675 * @param {?} value
8676 * @return {?}
8677 */
8678function checkBindingNoChanges(view, def, bindingIdx, value) {
8679 var /** @type {?} */ oldValue = view.oldValues[def.bindingIndex + bindingIdx];
8680 if ((view.state & 1 /* BeforeFirstCheck */) || !devModeEqual(oldValue, value)) {
8681 throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, def.index), oldValue, value, (view.state & 1 /* BeforeFirstCheck */) !== 0);
8682 }
8683}
8684/**
8685 * @param {?} view
8686 * @return {?}
8687 */
8688function markParentViewsForCheck(view) {
8689 var /** @type {?} */ currView = view;
8690 while (currView) {
8691 if (currView.def.flags & 2 /* OnPush */) {
8692 currView.state |= 8 /* ChecksEnabled */;
8693 }
8694 currView = currView.viewContainerParent || currView.parent;
8695 }
8696}
8697/**
8698 * @param {?} view
8699 * @param {?} endView
8700 * @return {?}
8701 */
8702function markParentViewsForCheckProjectedViews(view, endView) {
8703 var /** @type {?} */ currView = view;
8704 while (currView && currView !== endView) {
8705 currView.state |= 64 /* CheckProjectedViews */;
8706 currView = currView.viewContainerParent || currView.parent;
8707 }
8708}
8709/**
8710 * @param {?} view
8711 * @param {?} nodeIndex
8712 * @param {?} eventName
8713 * @param {?} event
8714 * @return {?}
8715 */
8716function dispatchEvent(view, nodeIndex, eventName, event) {
8717 var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
8718 var /** @type {?} */ startView = nodeDef.flags & 33554432 /* ComponentView */ ? asElementData(view, nodeIndex).componentView : view;
8719 markParentViewsForCheck(startView);
8720 return Services.handleEvent(view, nodeIndex, eventName, event);
8721}
8722/**
8723 * @param {?} view
8724 * @return {?}
8725 */
8726function declaredViewContainer(view) {
8727 if (view.parent) {
8728 var /** @type {?} */ parentView = view.parent;
8729 return asElementData(parentView, /** @type {?} */ ((view.parentNodeDef)).index);
8730 }
8731 return null;
8732}
8733/**
8734 * for component views, this is the host element.
8735 * for embedded views, this is the index of the parent node
8736 * that contains the view container.
8737 * @param {?} view
8738 * @return {?}
8739 */
8740function viewParentEl(view) {
8741 var /** @type {?} */ parentView = view.parent;
8742 if (parentView) {
8743 return ((view.parentNodeDef)).parent;
8744 }
8745 else {
8746 return null;
8747 }
8748}
8749/**
8750 * @param {?} view
8751 * @param {?} def
8752 * @return {?}
8753 */
8754function renderNode(view, def) {
8755 switch (def.flags & 201347067 /* Types */) {
8756 case 1 /* TypeElement */:
8757 return asElementData(view, def.index).renderElement;
8758 case 2 /* TypeText */:
8759 return asTextData(view, def.index).renderText;
8760 }
8761}
8762/**
8763 * @param {?} target
8764 * @param {?} name
8765 * @return {?}
8766 */
8767function elementEventFullName(target, name) {
8768 return target ? target + ":" + name : name;
8769}
8770/**
8771 * @param {?} view
8772 * @return {?}
8773 */
8774function isComponentView(view) {
8775 return !!view.parent && !!(((view.parentNodeDef)).flags & 32768 /* Component */);
8776}
8777/**
8778 * @param {?} view
8779 * @return {?}
8780 */
8781function isEmbeddedView(view) {
8782 return !!view.parent && !(((view.parentNodeDef)).flags & 32768 /* Component */);
8783}
8784/**
8785 * @param {?} queryId
8786 * @return {?}
8787 */
8788function filterQueryId(queryId) {
8789 return 1 << (queryId % 32);
8790}
8791/**
8792 * @param {?} matchedQueriesDsl
8793 * @return {?}
8794 */
8795function splitMatchedQueriesDsl(matchedQueriesDsl) {
8796 var /** @type {?} */ matchedQueries = {};
8797 var /** @type {?} */ matchedQueryIds = 0;
8798 var /** @type {?} */ references = {};
8799 if (matchedQueriesDsl) {
8800 matchedQueriesDsl.forEach(function (_a) {
8801 var queryId = _a[0], valueType = _a[1];
8802 if (typeof queryId === 'number') {
8803 matchedQueries[queryId] = valueType;
8804 matchedQueryIds |= filterQueryId(queryId);
8805 }
8806 else {
8807 references[queryId] = valueType;
8808 }
8809 });
8810 }
8811 return { matchedQueries: matchedQueries, references: references, matchedQueryIds: matchedQueryIds };
8812}
8813/**
8814 * @param {?} deps
8815 * @return {?}
8816 */
8817function splitDepsDsl(deps) {
8818 return deps.map(function (value) {
8819 var /** @type {?} */ token;
8820 var /** @type {?} */ flags;
8821 if (Array.isArray(value)) {
8822 flags = value[0], token = value[1];
8823 }
8824 else {
8825 flags = 0 /* None */;
8826 token = value;
8827 }
8828 return { flags: flags, token: token, tokenKey: tokenKey(token) };
8829 });
8830}
8831/**
8832 * @param {?} view
8833 * @param {?} renderHost
8834 * @param {?} def
8835 * @return {?}
8836 */
8837function getParentRenderElement(view, renderHost, def) {
8838 var /** @type {?} */ renderParent = def.renderParent;
8839 if (renderParent) {
8840 if ((renderParent.flags & 1 /* TypeElement */) === 0 ||
8841 (renderParent.flags & 33554432 /* ComponentView */) === 0 ||
8842 (((renderParent.element)).componentRendererType && ((((renderParent.element)).componentRendererType)).encapsulation ===
8843 ViewEncapsulation.Native)) {
8844 // only children of non components, or children of components with native encapsulation should
8845 // be attached.
8846 return asElementData(view, /** @type {?} */ ((def.renderParent)).index).renderElement;
8847 }
8848 }
8849 else {
8850 return renderHost;
8851 }
8852}
8853var DEFINITION_CACHE = new WeakMap();
8854/**
8855 * @template D
8856 * @param {?} factory
8857 * @return {?}
8858 */
8859function resolveDefinition(factory) {
8860 var /** @type {?} */ value = (((DEFINITION_CACHE.get(factory))));
8861 if (!value) {
8862 value = factory(function () { return NOOP; });
8863 value.factory = factory;
8864 DEFINITION_CACHE.set(factory, value);
8865 }
8866 return value;
8867}
8868/**
8869 * @param {?} view
8870 * @return {?}
8871 */
8872function rootRenderNodes(view) {
8873 var /** @type {?} */ renderNodes = [];
8874 visitRootRenderNodes(view, 0 /* Collect */, undefined, undefined, renderNodes);
8875 return renderNodes;
8876}
8877/**
8878 * @param {?} view
8879 * @param {?} action
8880 * @param {?} parentNode
8881 * @param {?} nextSibling
8882 * @param {?=} target
8883 * @return {?}
8884 */
8885function visitRootRenderNodes(view, action, parentNode, nextSibling, target) {
8886 // We need to re-compute the parent node in case the nodes have been moved around manually
8887 if (action === 3 /* RemoveChild */) {
8888 parentNode = view.renderer.parentNode(renderNode(view, /** @type {?} */ ((view.def.lastRenderRootNode))));
8889 }
8890 visitSiblingRenderNodes(view, action, 0, view.def.nodes.length - 1, parentNode, nextSibling, target);
8891}
8892/**
8893 * @param {?} view
8894 * @param {?} action
8895 * @param {?} startIndex
8896 * @param {?} endIndex
8897 * @param {?} parentNode
8898 * @param {?} nextSibling
8899 * @param {?=} target
8900 * @return {?}
8901 */
8902function visitSiblingRenderNodes(view, action, startIndex, endIndex, parentNode, nextSibling, target) {
8903 for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) {
8904 var /** @type {?} */ nodeDef = view.def.nodes[i];
8905 if (nodeDef.flags & (1 /* TypeElement */ | 2 /* TypeText */ | 8 /* TypeNgContent */)) {
8906 visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target);
8907 }
8908 // jump to next sibling
8909 i += nodeDef.childCount;
8910 }
8911}
8912/**
8913 * @param {?} view
8914 * @param {?} ngContentIndex
8915 * @param {?} action
8916 * @param {?} parentNode
8917 * @param {?} nextSibling
8918 * @param {?=} target
8919 * @return {?}
8920 */
8921function visitProjectedRenderNodes(view, ngContentIndex, action, parentNode, nextSibling, target) {
8922 var /** @type {?} */ compView = view;
8923 while (compView && !isComponentView(compView)) {
8924 compView = compView.parent;
8925 }
8926 var /** @type {?} */ hostView = ((compView)).parent;
8927 var /** @type {?} */ hostElDef = viewParentEl(/** @type {?} */ ((compView)));
8928 var /** @type {?} */ startIndex = ((hostElDef)).index + 1;
8929 var /** @type {?} */ endIndex = ((hostElDef)).index + ((hostElDef)).childCount;
8930 for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) {
8931 var /** @type {?} */ nodeDef = ((hostView)).def.nodes[i];
8932 if (nodeDef.ngContentIndex === ngContentIndex) {
8933 visitRenderNode(/** @type {?} */ ((hostView)), nodeDef, action, parentNode, nextSibling, target);
8934 }
8935 // jump to next sibling
8936 i += nodeDef.childCount;
8937 }
8938 if (!((hostView)).parent) {
8939 // a root view
8940 var /** @type {?} */ projectedNodes = view.root.projectableNodes[ngContentIndex];
8941 if (projectedNodes) {
8942 for (var /** @type {?} */ i = 0; i < projectedNodes.length; i++) {
8943 execRenderNodeAction(view, projectedNodes[i], action, parentNode, nextSibling, target);
8944 }
8945 }
8946 }
8947}
8948/**
8949 * @param {?} view
8950 * @param {?} nodeDef
8951 * @param {?} action
8952 * @param {?} parentNode
8953 * @param {?} nextSibling
8954 * @param {?=} target
8955 * @return {?}
8956 */
8957function visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target) {
8958 if (nodeDef.flags & 8 /* TypeNgContent */) {
8959 visitProjectedRenderNodes(view, /** @type {?} */ ((nodeDef.ngContent)).index, action, parentNode, nextSibling, target);
8960 }
8961 else {
8962 var /** @type {?} */ rn = renderNode(view, nodeDef);
8963 if (action === 3 /* RemoveChild */ && (nodeDef.flags & 33554432 /* ComponentView */) &&
8964 (nodeDef.bindingFlags & 48 /* CatSyntheticProperty */)) {
8965 // Note: we might need to do both actions.
8966 if (nodeDef.bindingFlags & (16 /* SyntheticProperty */)) {
8967 execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
8968 }
8969 if (nodeDef.bindingFlags & (32 /* SyntheticHostProperty */)) {
8970 var /** @type {?} */ compView = asElementData(view, nodeDef.index).componentView;
8971 execRenderNodeAction(compView, rn, action, parentNode, nextSibling, target);
8972 }
8973 }
8974 else {
8975 execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
8976 }
8977 if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
8978 var /** @type {?} */ embeddedViews = ((asElementData(view, nodeDef.index).viewContainer))._embeddedViews;
8979 for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) {
8980 visitRootRenderNodes(embeddedViews[k], action, parentNode, nextSibling, target);
8981 }
8982 }
8983 if (nodeDef.flags & 1 /* TypeElement */ && !((nodeDef.element)).name) {
8984 visitSiblingRenderNodes(view, action, nodeDef.index + 1, nodeDef.index + nodeDef.childCount, parentNode, nextSibling, target);
8985 }
8986 }
8987}
8988/**
8989 * @param {?} view
8990 * @param {?} renderNode
8991 * @param {?} action
8992 * @param {?} parentNode
8993 * @param {?} nextSibling
8994 * @param {?=} target
8995 * @return {?}
8996 */
8997function execRenderNodeAction(view, renderNode, action, parentNode, nextSibling, target) {
8998 var /** @type {?} */ renderer = view.renderer;
8999 switch (action) {
9000 case 1 /* AppendChild */:
9001 renderer.appendChild(parentNode, renderNode);
9002 break;
9003 case 2 /* InsertBefore */:
9004 renderer.insertBefore(parentNode, renderNode, nextSibling);
9005 break;
9006 case 3 /* RemoveChild */:
9007 renderer.removeChild(parentNode, renderNode);
9008 break;
9009 case 0 /* Collect */:
9010 ((target)).push(renderNode);
9011 break;
9012 }
9013}
9014var NS_PREFIX_RE = /^:([^:]+):(.+)$/;
9015/**
9016 * @param {?} name
9017 * @return {?}
9018 */
9019function splitNamespace(name) {
9020 if (name[0] === ':') {
9021 var /** @type {?} */ match = ((name.match(NS_PREFIX_RE)));
9022 return [match[1], match[2]];
9023 }
9024 return ['', name];
9025}
9026/**
9027 * @param {?} bindings
9028 * @return {?}
9029 */
9030function calcBindingFlags(bindings) {
9031 var /** @type {?} */ flags = 0;
9032 for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
9033 flags |= bindings[i].flags;
9034 }
9035 return flags;
9036}
9037/**
9038 * @param {?} valueCount
9039 * @param {?} constAndInterp
9040 * @return {?}
9041 */
9042function interpolate(valueCount, constAndInterp) {
9043 var /** @type {?} */ result = '';
9044 for (var /** @type {?} */ i = 0; i < valueCount * 2; i = i + 2) {
9045 result = result + constAndInterp[i] + _toStringWithNull(constAndInterp[i + 1]);
9046 }
9047 return result + constAndInterp[valueCount * 2];
9048}
9049/**
9050 * @param {?} valueCount
9051 * @param {?} c0
9052 * @param {?} a1
9053 * @param {?} c1
9054 * @param {?=} a2
9055 * @param {?=} c2
9056 * @param {?=} a3
9057 * @param {?=} c3
9058 * @param {?=} a4
9059 * @param {?=} c4
9060 * @param {?=} a5
9061 * @param {?=} c5
9062 * @param {?=} a6
9063 * @param {?=} c6
9064 * @param {?=} a7
9065 * @param {?=} c7
9066 * @param {?=} a8
9067 * @param {?=} c8
9068 * @param {?=} a9
9069 * @param {?=} c9
9070 * @return {?}
9071 */
9072function inlineInterpolate(valueCount, c0, a1, c1, a2, c2, a3, c3, a4, c4, a5, c5, a6, c6, a7, c7, a8, c8, a9, c9) {
9073 switch (valueCount) {
9074 case 1:
9075 return c0 + _toStringWithNull(a1) + c1;
9076 case 2:
9077 return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2;
9078 case 3:
9079 return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
9080 c3;
9081 case 4:
9082 return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
9083 c3 + _toStringWithNull(a4) + c4;
9084 case 5:
9085 return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
9086 c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5;
9087 case 6:
9088 return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
9089 c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6;
9090 case 7:
9091 return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
9092 c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
9093 c6 + _toStringWithNull(a7) + c7;
9094 case 8:
9095 return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
9096 c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
9097 c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8;
9098 case 9:
9099 return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
9100 c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
9101 c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) + c9;
9102 default:
9103 throw new Error("Does not support more than 9 expressions");
9104 }
9105}
9106/**
9107 * @param {?} v
9108 * @return {?}
9109 */
9110function _toStringWithNull(v) {
9111 return v != null ? v.toString() : '';
9112}
9113var EMPTY_ARRAY = [];
9114var EMPTY_MAP = {};
9115/**
9116 * @license
9117 * Copyright Google Inc. All Rights Reserved.
9118 *
9119 * Use of this source code is governed by an MIT-style license that can be
9120 * found in the LICENSE file at https://angular.io/license
9121 */
9122/**
9123 * @param {?} flags
9124 * @param {?} matchedQueriesDsl
9125 * @param {?} ngContentIndex
9126 * @param {?} childCount
9127 * @param {?=} handleEvent
9128 * @param {?=} templateFactory
9129 * @return {?}
9130 */
9131function anchorDef(flags, matchedQueriesDsl, ngContentIndex, childCount, handleEvent, templateFactory) {
9132 flags |= 1 /* TypeElement */;
9133 var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
9134 var /** @type {?} */ template = templateFactory ? resolveDefinition(templateFactory) : null;
9135 return {
9136 // will bet set by the view definition
9137 index: -1,
9138 parent: null,
9139 renderParent: null,
9140 bindingIndex: -1,
9141 outputIndex: -1,
9142 // regular values
9143 flags: flags,
9144 childFlags: 0,
9145 directChildFlags: 0,
9146 childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount,
9147 bindings: [],
9148 bindingFlags: 0,
9149 outputs: [],
9150 element: {
9151 ns: null,
9152 name: null,
9153 attrs: null, template: template,
9154 componentProvider: null,
9155 componentView: null,
9156 componentRendererType: null,
9157 publicProviders: null,
9158 allProviders: null,
9159 handleEvent: handleEvent || NOOP
9160 },
9161 provider: null,
9162 text: null,
9163 query: null,
9164 ngContent: null
9165 };
9166}
9167/**
9168 * @param {?} flags
9169 * @param {?} matchedQueriesDsl
9170 * @param {?} ngContentIndex
9171 * @param {?} childCount
9172 * @param {?} namespaceAndName
9173 * @param {?=} fixedAttrs
9174 * @param {?=} bindings
9175 * @param {?=} outputs
9176 * @param {?=} handleEvent
9177 * @param {?=} componentView
9178 * @param {?=} componentRendererType
9179 * @return {?}
9180 */
9181function elementDef(flags, matchedQueriesDsl, ngContentIndex, childCount, namespaceAndName, fixedAttrs, bindings, outputs, handleEvent, componentView, componentRendererType) {
9182 if (fixedAttrs === void 0) { fixedAttrs = []; }
9183 if (!handleEvent) {
9184 handleEvent = NOOP;
9185 }
9186 var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
9187 var /** @type {?} */ ns = ((null));
9188 var /** @type {?} */ name = ((null));
9189 if (namespaceAndName) {
9190 _b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1];
9191 }
9192 bindings = bindings || [];
9193 var /** @type {?} */ bindingDefs = new Array(bindings.length);
9194 for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
9195 var _c = bindings[i], bindingFlags = _c[0], namespaceAndName_1 = _c[1], suffixOrSecurityContext = _c[2];
9196 var _d = splitNamespace(namespaceAndName_1), ns_1 = _d[0], name_1 = _d[1];
9197 var /** @type {?} */ securityContext = ((undefined));
9198 var /** @type {?} */ suffix = ((undefined));
9199 switch (bindingFlags & 15 /* Types */) {
9200 case 4 /* TypeElementStyle */:
9201 suffix = (suffixOrSecurityContext);
9202 break;
9203 case 1 /* TypeElementAttribute */:
9204 case 8 /* TypeProperty */:
9205 securityContext = (suffixOrSecurityContext);
9206 break;
9207 }
9208 bindingDefs[i] =
9209 { flags: bindingFlags, ns: ns_1, name: name_1, nonMinifiedName: name_1, securityContext: securityContext, suffix: suffix };
9210 }
9211 outputs = outputs || [];
9212 var /** @type {?} */ outputDefs = new Array(outputs.length);
9213 for (var /** @type {?} */ i = 0; i < outputs.length; i++) {
9214 var _e = outputs[i], target = _e[0], eventName = _e[1];
9215 outputDefs[i] = {
9216 type: 0 /* ElementOutput */,
9217 target: /** @type {?} */ (target), eventName: eventName,
9218 propName: null
9219 };
9220 }
9221 fixedAttrs = fixedAttrs || [];
9222 var /** @type {?} */ attrs = (fixedAttrs.map(function (_a) {
9223 var namespaceAndName = _a[0], value = _a[1];
9224 var _b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1];
9225 return [ns, name, value];
9226 }));
9227 componentRendererType = resolveRendererType2(componentRendererType);
9228 if (componentView) {
9229 flags |= 33554432 /* ComponentView */;
9230 }
9231 flags |= 1 /* TypeElement */;
9232 return {
9233 // will bet set by the view definition
9234 index: -1,
9235 parent: null,
9236 renderParent: null,
9237 bindingIndex: -1,
9238 outputIndex: -1,
9239 // regular values
9240 flags: flags,
9241 childFlags: 0,
9242 directChildFlags: 0,
9243 childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount,
9244 bindings: bindingDefs,
9245 bindingFlags: calcBindingFlags(bindingDefs),
9246 outputs: outputDefs,
9247 element: {
9248 ns: ns,
9249 name: name,
9250 attrs: attrs,
9251 template: null,
9252 // will bet set by the view definition
9253 componentProvider: null,
9254 componentView: componentView || null,
9255 componentRendererType: componentRendererType,
9256 publicProviders: null,
9257 allProviders: null,
9258 handleEvent: handleEvent || NOOP,
9259 },
9260 provider: null,
9261 text: null,
9262 query: null,
9263 ngContent: null
9264 };
9265 var _b;
9266}
9267/**
9268 * @param {?} view
9269 * @param {?} renderHost
9270 * @param {?} def
9271 * @return {?}
9272 */
9273function createElement(view, renderHost, def) {
9274 var /** @type {?} */ elDef = ((def.element));
9275 var /** @type {?} */ rootSelectorOrNode = view.root.selectorOrNode;
9276 var /** @type {?} */ renderer = view.renderer;
9277 var /** @type {?} */ el;
9278 if (view.parent || !rootSelectorOrNode) {
9279 if (elDef.name) {
9280 el = renderer.createElement(elDef.name, elDef.ns);
9281 }
9282 else {
9283 el = renderer.createComment('');
9284 }
9285 var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def);
9286 if (parentEl) {
9287 renderer.appendChild(parentEl, el);
9288 }
9289 }
9290 else {
9291 el = renderer.selectRootElement(rootSelectorOrNode);
9292 }
9293 if (elDef.attrs) {
9294 for (var /** @type {?} */ i = 0; i < elDef.attrs.length; i++) {
9295 var _a = elDef.attrs[i], ns = _a[0], name = _a[1], value = _a[2];
9296 renderer.setAttribute(el, name, value, ns);
9297 }
9298 }
9299 return el;
9300}
9301/**
9302 * @param {?} view
9303 * @param {?} compView
9304 * @param {?} def
9305 * @param {?} el
9306 * @return {?}
9307 */
9308function listenToElementOutputs(view, compView, def, el) {
9309 for (var /** @type {?} */ i = 0; i < def.outputs.length; i++) {
9310 var /** @type {?} */ output = def.outputs[i];
9311 var /** @type {?} */ handleEventClosure = renderEventHandlerClosure(view, def.index, elementEventFullName(output.target, output.eventName));
9312 var /** @type {?} */ listenTarget = output.target;
9313 var /** @type {?} */ listenerView = view;
9314 if (output.target === 'component') {
9315 listenTarget = null;
9316 listenerView = compView;
9317 }
9318 var /** @type {?} */ disposable = (listenerView.renderer.listen(listenTarget || el, output.eventName, handleEventClosure)); /** @type {?} */
9319 ((view.disposables))[def.outputIndex + i] = disposable;
9320 }
9321}
9322/**
9323 * @param {?} view
9324 * @param {?} index
9325 * @param {?} eventName
9326 * @return {?}
9327 */
9328function renderEventHandlerClosure(view, index, eventName) {
9329 return function (event) {
9330 try {
9331 return dispatchEvent(view, index, eventName, event);
9332 }
9333 catch (e) {
9334 // Attention: Don't rethrow, to keep in sync with directive events.
9335 view.root.errorHandler.handleError(e);
9336 }
9337 };
9338}
9339/**
9340 * @param {?} view
9341 * @param {?} def
9342 * @param {?} v0
9343 * @param {?} v1
9344 * @param {?} v2
9345 * @param {?} v3
9346 * @param {?} v4
9347 * @param {?} v5
9348 * @param {?} v6
9349 * @param {?} v7
9350 * @param {?} v8
9351 * @param {?} v9
9352 * @return {?}
9353 */
9354function checkAndUpdateElementInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
9355 var /** @type {?} */ bindLen = def.bindings.length;
9356 var /** @type {?} */ changed = false;
9357 if (bindLen > 0 && checkAndUpdateElementValue(view, def, 0, v0))
9358 changed = true;
9359 if (bindLen > 1 && checkAndUpdateElementValue(view, def, 1, v1))
9360 changed = true;
9361 if (bindLen > 2 && checkAndUpdateElementValue(view, def, 2, v2))
9362 changed = true;
9363 if (bindLen > 3 && checkAndUpdateElementValue(view, def, 3, v3))
9364 changed = true;
9365 if (bindLen > 4 && checkAndUpdateElementValue(view, def, 4, v4))
9366 changed = true;
9367 if (bindLen > 5 && checkAndUpdateElementValue(view, def, 5, v5))
9368 changed = true;
9369 if (bindLen > 6 && checkAndUpdateElementValue(view, def, 6, v6))
9370 changed = true;
9371 if (bindLen > 7 && checkAndUpdateElementValue(view, def, 7, v7))
9372 changed = true;
9373 if (bindLen > 8 && checkAndUpdateElementValue(view, def, 8, v8))
9374 changed = true;
9375 if (bindLen > 9 && checkAndUpdateElementValue(view, def, 9, v9))
9376 changed = true;
9377 return changed;
9378}
9379/**
9380 * @param {?} view
9381 * @param {?} def
9382 * @param {?} values
9383 * @return {?}
9384 */
9385function checkAndUpdateElementDynamic(view, def, values) {
9386 var /** @type {?} */ changed = false;
9387 for (var /** @type {?} */ i = 0; i < values.length; i++) {
9388 if (checkAndUpdateElementValue(view, def, i, values[i]))
9389 changed = true;
9390 }
9391 return changed;
9392}
9393/**
9394 * @param {?} view
9395 * @param {?} def
9396 * @param {?} bindingIdx
9397 * @param {?} value
9398 * @return {?}
9399 */
9400function checkAndUpdateElementValue(view, def, bindingIdx, value) {
9401 if (!checkAndUpdateBinding(view, def, bindingIdx, value)) {
9402 return false;
9403 }
9404 var /** @type {?} */ binding = def.bindings[bindingIdx];
9405 var /** @type {?} */ elData = asElementData(view, def.index);
9406 var /** @type {?} */ renderNode$$1 = elData.renderElement;
9407 var /** @type {?} */ name = ((binding.name));
9408 switch (binding.flags & 15 /* Types */) {
9409 case 1 /* TypeElementAttribute */:
9410 setElementAttribute(view, binding, renderNode$$1, binding.ns, name, value);
9411 break;
9412 case 2 /* TypeElementClass */:
9413 setElementClass(view, renderNode$$1, name, value);
9414 break;
9415 case 4 /* TypeElementStyle */:
9416 setElementStyle(view, binding, renderNode$$1, name, value);
9417 break;
9418 case 8 /* TypeProperty */:
9419 var /** @type {?} */ bindView = (def.flags & 33554432 /* ComponentView */ &&
9420 binding.flags & 32 /* SyntheticHostProperty */) ?
9421 elData.componentView :
9422 view;
9423 setElementProperty(bindView, binding, renderNode$$1, name, value);
9424 break;
9425 }
9426 return true;
9427}
9428/**
9429 * @param {?} view
9430 * @param {?} binding
9431 * @param {?} renderNode
9432 * @param {?} ns
9433 * @param {?} name
9434 * @param {?} value
9435 * @return {?}
9436 */
9437function setElementAttribute(view, binding, renderNode$$1, ns, name, value) {
9438 var /** @type {?} */ securityContext = binding.securityContext;
9439 var /** @type {?} */ renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
9440 renderValue = renderValue != null ? renderValue.toString() : null;
9441 var /** @type {?} */ renderer = view.renderer;
9442 if (value != null) {
9443 renderer.setAttribute(renderNode$$1, name, renderValue, ns);
9444 }
9445 else {
9446 renderer.removeAttribute(renderNode$$1, name, ns);
9447 }
9448}
9449/**
9450 * @param {?} view
9451 * @param {?} renderNode
9452 * @param {?} name
9453 * @param {?} value
9454 * @return {?}
9455 */
9456function setElementClass(view, renderNode$$1, name, value) {
9457 var /** @type {?} */ renderer = view.renderer;
9458 if (value) {
9459 renderer.addClass(renderNode$$1, name);
9460 }
9461 else {
9462 renderer.removeClass(renderNode$$1, name);
9463 }
9464}
9465/**
9466 * @param {?} view
9467 * @param {?} binding
9468 * @param {?} renderNode
9469 * @param {?} name
9470 * @param {?} value
9471 * @return {?}
9472 */
9473function setElementStyle(view, binding, renderNode$$1, name, value) {
9474 var /** @type {?} */ renderValue = view.root.sanitizer.sanitize(SecurityContext.STYLE, /** @type {?} */ (value));
9475 if (renderValue != null) {
9476 renderValue = renderValue.toString();
9477 var /** @type {?} */ unit = binding.suffix;
9478 if (unit != null) {
9479 renderValue = renderValue + unit;
9480 }
9481 }
9482 else {
9483 renderValue = null;
9484 }
9485 var /** @type {?} */ renderer = view.renderer;
9486 if (renderValue != null) {
9487 renderer.setStyle(renderNode$$1, name, renderValue);
9488 }
9489 else {
9490 renderer.removeStyle(renderNode$$1, name);
9491 }
9492}
9493/**
9494 * @param {?} view
9495 * @param {?} binding
9496 * @param {?} renderNode
9497 * @param {?} name
9498 * @param {?} value
9499 * @return {?}
9500 */
9501function setElementProperty(view, binding, renderNode$$1, name, value) {
9502 var /** @type {?} */ securityContext = binding.securityContext;
9503 var /** @type {?} */ renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
9504 view.renderer.setProperty(renderNode$$1, name, renderValue);
9505}
9506/**
9507 * @license
9508 * Copyright Google Inc. All Rights Reserved.
9509 *
9510 * Use of this source code is governed by an MIT-style license that can be
9511 * found in the LICENSE file at https://angular.io/license
9512 */
9513var NOT_CREATED$1 = new Object();
9514var InjectorRefTokenKey$1 = tokenKey(Injector);
9515var NgModuleRefTokenKey = tokenKey(NgModuleRef);
9516/**
9517 * @param {?} flags
9518 * @param {?} token
9519 * @param {?} value
9520 * @param {?} deps
9521 * @return {?}
9522 */
9523function moduleProvideDef(flags, token, value, deps) {
9524 var /** @type {?} */ depDefs = splitDepsDsl(deps);
9525 return {
9526 // will bet set by the module definition
9527 index: -1,
9528 deps: depDefs, flags: flags, token: token, value: value
9529 };
9530}
9531/**
9532 * @param {?} providers
9533 * @return {?}
9534 */
9535function moduleDef(providers) {
9536 var /** @type {?} */ providersByKey = {};
9537 for (var /** @type {?} */ i = 0; i < providers.length; i++) {
9538 var /** @type {?} */ provider = providers[i];
9539 provider.index = i;
9540 providersByKey[tokenKey(provider.token)] = provider;
9541 }
9542 return {
9543 // Will be filled later...
9544 factory: null,
9545 providersByKey: providersByKey,
9546 providers: providers
9547 };
9548}
9549/**
9550 * @param {?} data
9551 * @return {?}
9552 */
9553function initNgModule(data) {
9554 var /** @type {?} */ def = data._def;
9555 var /** @type {?} */ providers = data._providers = new Array(def.providers.length);
9556 for (var /** @type {?} */ i = 0; i < def.providers.length; i++) {
9557 var /** @type {?} */ provDef = def.providers[i];
9558 providers[i] = provDef.flags & 4096 /* LazyProvider */ ? NOT_CREATED$1 :
9559 _createProviderInstance$1(data, provDef);
9560 }
9561}
9562/**
9563 * @param {?} data
9564 * @param {?} depDef
9565 * @param {?=} notFoundValue
9566 * @return {?}
9567 */
9568function resolveNgModuleDep(data, depDef, notFoundValue) {
9569 if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
9570 if (depDef.flags & 8 /* Value */) {
9571 return depDef.token;
9572 }
9573 if (depDef.flags & 2 /* Optional */) {
9574 notFoundValue = null;
9575 }
9576 if (depDef.flags & 1 /* SkipSelf */) {
9577 return data._parent.get(depDef.token, notFoundValue);
9578 }
9579 var /** @type {?} */ tokenKey$$1 = depDef.tokenKey;
9580 switch (tokenKey$$1) {
9581 case InjectorRefTokenKey$1:
9582 case NgModuleRefTokenKey:
9583 return data;
9584 }
9585 var /** @type {?} */ providerDef = data._def.providersByKey[tokenKey$$1];
9586 if (providerDef) {
9587 var /** @type {?} */ providerInstance = data._providers[providerDef.index];
9588 if (providerInstance === NOT_CREATED$1) {
9589 providerInstance = data._providers[providerDef.index] =
9590 _createProviderInstance$1(data, providerDef);
9591 }
9592 return providerInstance;
9593 }
9594 return data._parent.get(depDef.token, notFoundValue);
9595}
9596/**
9597 * @param {?} ngModule
9598 * @param {?} providerDef
9599 * @return {?}
9600 */
9601function _createProviderInstance$1(ngModule, providerDef) {
9602 var /** @type {?} */ injectable;
9603 switch (providerDef.flags & 201347067 /* Types */) {
9604 case 512 /* TypeClassProvider */:
9605 injectable = _createClass(ngModule, providerDef.value, providerDef.deps);
9606 break;
9607 case 1024 /* TypeFactoryProvider */:
9608 injectable = _callFactory(ngModule, providerDef.value, providerDef.deps);
9609 break;
9610 case 2048 /* TypeUseExistingProvider */:
9611 injectable = resolveNgModuleDep(ngModule, providerDef.deps[0]);
9612 break;
9613 case 256 /* TypeValueProvider */:
9614 injectable = providerDef.value;
9615 break;
9616 }
9617 return injectable;
9618}
9619/**
9620 * @param {?} ngModule
9621 * @param {?} ctor
9622 * @param {?} deps
9623 * @return {?}
9624 */
9625function _createClass(ngModule, ctor, deps) {
9626 var /** @type {?} */ len = deps.length;
9627 var /** @type {?} */ injectable;
9628 switch (len) {
9629 case 0:
9630 injectable = new ctor();
9631 break;
9632 case 1:
9633 injectable = new ctor(resolveNgModuleDep(ngModule, deps[0]));
9634 break;
9635 case 2:
9636 injectable =
9637 new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
9638 break;
9639 case 3:
9640 injectable = new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
9641 break;
9642 default:
9643 var /** @type {?} */ depValues = new Array(len);
9644 for (var /** @type {?} */ i = 0; i < len; i++) {
9645 depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
9646 }
9647 injectable = new (ctor.bind.apply(ctor, [void 0].concat(depValues)))();
9648 }
9649 return injectable;
9650}
9651/**
9652 * @param {?} ngModule
9653 * @param {?} factory
9654 * @param {?} deps
9655 * @return {?}
9656 */
9657function _callFactory(ngModule, factory, deps) {
9658 var /** @type {?} */ len = deps.length;
9659 var /** @type {?} */ injectable;
9660 switch (len) {
9661 case 0:
9662 injectable = factory();
9663 break;
9664 case 1:
9665 injectable = factory(resolveNgModuleDep(ngModule, deps[0]));
9666 break;
9667 case 2:
9668 injectable =
9669 factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
9670 break;
9671 case 3:
9672 injectable = factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
9673 break;
9674 default:
9675 var /** @type {?} */ depValues = Array(len);
9676 for (var /** @type {?} */ i = 0; i < len; i++) {
9677 depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
9678 }
9679 injectable = factory.apply(void 0, depValues);
9680 }
9681 return injectable;
9682}
9683/**
9684 * @param {?} ngModule
9685 * @param {?} lifecycles
9686 * @return {?}
9687 */
9688function callNgModuleLifecycle(ngModule, lifecycles) {
9689 var /** @type {?} */ def = ngModule._def;
9690 for (var /** @type {?} */ i = 0; i < def.providers.length; i++) {
9691 var /** @type {?} */ provDef = def.providers[i];
9692 if (provDef.flags & 131072 /* OnDestroy */) {
9693 var /** @type {?} */ instance = ngModule._providers[i];
9694 if (instance && instance !== NOT_CREATED$1) {
9695 instance.ngOnDestroy();
9696 }
9697 }
9698 }
9699}
9700/**
9701 * @license
9702 * Copyright Google Inc. All Rights Reserved.
9703 *
9704 * Use of this source code is governed by an MIT-style license that can be
9705 * found in the LICENSE file at https://angular.io/license
9706 */
9707/**
9708 * @param {?} parentView
9709 * @param {?} elementData
9710 * @param {?} viewIndex
9711 * @param {?} view
9712 * @return {?}
9713 */
9714function attachEmbeddedView(parentView, elementData, viewIndex, view) {
9715 var /** @type {?} */ embeddedViews = ((elementData.viewContainer))._embeddedViews;
9716 if (viewIndex === null || viewIndex === undefined) {
9717 viewIndex = embeddedViews.length;
9718 }
9719 view.viewContainerParent = parentView;
9720 addToArray(embeddedViews, /** @type {?} */ ((viewIndex)), view);
9721 attachProjectedView(elementData, view);
9722 Services.dirtyParentQueries(view);
9723 var /** @type {?} */ prevView = ((viewIndex)) > 0 ? embeddedViews[((viewIndex)) - 1] : null;
9724 renderAttachEmbeddedView(elementData, prevView, view);
9725}
9726/**
9727 * @param {?} vcElementData
9728 * @param {?} view
9729 * @return {?}
9730 */
9731function attachProjectedView(vcElementData, view) {
9732 var /** @type {?} */ dvcElementData = declaredViewContainer(view);
9733 if (!dvcElementData || dvcElementData === vcElementData ||
9734 view.state & 16 /* IsProjectedView */) {
9735 return;
9736 }
9737 // Note: For performance reasons, we
9738 // - add a view to template._projectedViews only 1x throughout its lifetime,
9739 // and remove it not until the view is destroyed.
9740 // (hard, as when a parent view is attached/detached we would need to attach/detach all
9741 // nested projected views as well, even accross component boundaries).
9742 // - don't track the insertion order of views in the projected views array
9743 // (hard, as when the views of the same template are inserted different view containers)
9744 view.state |= 16 /* IsProjectedView */;
9745 var /** @type {?} */ projectedViews = dvcElementData.template._projectedViews;
9746 if (!projectedViews) {
9747 projectedViews = dvcElementData.template._projectedViews = [];
9748 }
9749 projectedViews.push(view);
9750 // Note: we are changing the NodeDef here as we cannot calculate
9751 // the fact whether a template is used for projection during compilation.
9752 markNodeAsProjectedTemplate(/** @type {?} */ ((view.parent)).def, /** @type {?} */ ((view.parentNodeDef)));
9753}
9754/**
9755 * @param {?} viewDef
9756 * @param {?} nodeDef
9757 * @return {?}
9758 */
9759function markNodeAsProjectedTemplate(viewDef, nodeDef) {
9760 if (nodeDef.flags & 4 /* ProjectedTemplate */) {
9761 return;
9762 }
9763 viewDef.nodeFlags |= 4 /* ProjectedTemplate */;
9764 nodeDef.flags |= 4 /* ProjectedTemplate */;
9765 var /** @type {?} */ parentNodeDef = nodeDef.parent;
9766 while (parentNodeDef) {
9767 parentNodeDef.childFlags |= 4 /* ProjectedTemplate */;
9768 parentNodeDef = parentNodeDef.parent;
9769 }
9770}
9771/**
9772 * @param {?} elementData
9773 * @param {?=} viewIndex
9774 * @return {?}
9775 */
9776function detachEmbeddedView(elementData, viewIndex) {
9777 var /** @type {?} */ embeddedViews = ((elementData.viewContainer))._embeddedViews;
9778 if (viewIndex == null || viewIndex >= embeddedViews.length) {
9779 viewIndex = embeddedViews.length - 1;
9780 }
9781 if (viewIndex < 0) {
9782 return null;
9783 }
9784 var /** @type {?} */ view = embeddedViews[viewIndex];
9785 view.viewContainerParent = null;
9786 removeFromArray(embeddedViews, viewIndex);
9787 // See attachProjectedView for why we don't update projectedViews here.
9788 Services.dirtyParentQueries(view);
9789 renderDetachView(view);
9790 return view;
9791}
9792/**
9793 * @param {?} view
9794 * @return {?}
9795 */
9796function detachProjectedView(view) {
9797 if (!(view.state & 16 /* IsProjectedView */)) {
9798 return;
9799 }
9800 var /** @type {?} */ dvcElementData = declaredViewContainer(view);
9801 if (dvcElementData) {
9802 var /** @type {?} */ projectedViews = dvcElementData.template._projectedViews;
9803 if (projectedViews) {
9804 removeFromArray(projectedViews, projectedViews.indexOf(view));
9805 Services.dirtyParentQueries(view);
9806 }
9807 }
9808}
9809/**
9810 * @param {?} elementData
9811 * @param {?} oldViewIndex
9812 * @param {?} newViewIndex
9813 * @return {?}
9814 */
9815function moveEmbeddedView(elementData, oldViewIndex, newViewIndex) {
9816 var /** @type {?} */ embeddedViews = ((elementData.viewContainer))._embeddedViews;
9817 var /** @type {?} */ view = embeddedViews[oldViewIndex];
9818 removeFromArray(embeddedViews, oldViewIndex);
9819 if (newViewIndex == null) {
9820 newViewIndex = embeddedViews.length;
9821 }
9822 addToArray(embeddedViews, newViewIndex, view);
9823 // Note: Don't need to change projectedViews as the order in there
9824 // as always invalid...
9825 Services.dirtyParentQueries(view);
9826 renderDetachView(view);
9827 var /** @type {?} */ prevView = newViewIndex > 0 ? embeddedViews[newViewIndex - 1] : null;
9828 renderAttachEmbeddedView(elementData, prevView, view);
9829 return view;
9830}
9831/**
9832 * @param {?} elementData
9833 * @param {?} prevView
9834 * @param {?} view
9835 * @return {?}
9836 */
9837function renderAttachEmbeddedView(elementData, prevView, view) {
9838 var /** @type {?} */ prevRenderNode = prevView ? renderNode(prevView, /** @type {?} */ ((prevView.def.lastRenderRootNode))) :
9839 elementData.renderElement;
9840 var /** @type {?} */ parentNode = view.renderer.parentNode(prevRenderNode);
9841 var /** @type {?} */ nextSibling = view.renderer.nextSibling(prevRenderNode);
9842 // Note: We can't check if `nextSibling` is present, as on WebWorkers it will always be!
9843 // However, browsers automatically do `appendChild` when there is no `nextSibling`.
9844 visitRootRenderNodes(view, 2 /* InsertBefore */, parentNode, nextSibling, undefined);
9845}
9846/**
9847 * @param {?} view
9848 * @return {?}
9849 */
9850function renderDetachView(view) {
9851 visitRootRenderNodes(view, 3 /* RemoveChild */, null, null, undefined);
9852}
9853/**
9854 * @param {?} arr
9855 * @param {?} index
9856 * @param {?} value
9857 * @return {?}
9858 */
9859function addToArray(arr, index, value) {
9860 // perf: array.push is faster than array.splice!
9861 if (index >= arr.length) {
9862 arr.push(value);
9863 }
9864 else {
9865 arr.splice(index, 0, value);
9866 }
9867}
9868/**
9869 * @param {?} arr
9870 * @param {?} index
9871 * @return {?}
9872 */
9873function removeFromArray(arr, index) {
9874 // perf: array.pop is faster than array.splice!
9875 if (index >= arr.length - 1) {
9876 arr.pop();
9877 }
9878 else {
9879 arr.splice(index, 1);
9880 }
9881}
9882/**
9883 * @license
9884 * Copyright Google Inc. All Rights Reserved.
9885 *
9886 * Use of this source code is governed by an MIT-style license that can be
9887 * found in the LICENSE file at https://angular.io/license
9888 */
9889var EMPTY_CONTEXT = new Object();
9890/**
9891 * @param {?} selector
9892 * @param {?} componentType
9893 * @param {?} viewDefFactory
9894 * @param {?} inputs
9895 * @param {?} outputs
9896 * @param {?} ngContentSelectors
9897 * @return {?}
9898 */
9899function createComponentFactory(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors) {
9900 return new ComponentFactory_(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors);
9901}
9902/**
9903 * @param {?} componentFactory
9904 * @return {?}
9905 */
9906function getComponentViewDefinitionFactory(componentFactory) {
9907 return ((componentFactory)).viewDefFactory;
9908}
9909var ComponentFactory_ = (function (_super) {
9910 __extends(ComponentFactory_, _super);
9911 /**
9912 * @param {?} selector
9913 * @param {?} componentType
9914 * @param {?} viewDefFactory
9915 * @param {?} _inputs
9916 * @param {?} _outputs
9917 * @param {?} ngContentSelectors
9918 */
9919 function ComponentFactory_(selector, componentType, viewDefFactory, _inputs, _outputs, ngContentSelectors) {
9920 var _this =
9921 // Attention: this ctor is called as top level function.
9922 // Putting any logic in here will destroy closure tree shaking!
9923 _super.call(this) || this;
9924 _this.selector = selector;
9925 _this.componentType = componentType;
9926 _this._inputs = _inputs;
9927 _this._outputs = _outputs;
9928 _this.ngContentSelectors = ngContentSelectors;
9929 _this.viewDefFactory = viewDefFactory;
9930 return _this;
9931 }
9932 Object.defineProperty(ComponentFactory_.prototype, "inputs", {
9933 /**
9934 * @return {?}
9935 */
9936 get: function () {
9937 var /** @type {?} */ inputsArr = [];
9938 var /** @type {?} */ inputs = ((this._inputs));
9939 for (var /** @type {?} */ propName in inputs) {
9940 var /** @type {?} */ templateName = inputs[propName];
9941 inputsArr.push({ propName: propName, templateName: templateName });
9942 }
9943 return inputsArr;
9944 },
9945 enumerable: true,
9946 configurable: true
9947 });
9948 Object.defineProperty(ComponentFactory_.prototype, "outputs", {
9949 /**
9950 * @return {?}
9951 */
9952 get: function () {
9953 var /** @type {?} */ outputsArr = [];
9954 for (var /** @type {?} */ propName in this._outputs) {
9955 var /** @type {?} */ templateName = this._outputs[propName];
9956 outputsArr.push({ propName: propName, templateName: templateName });
9957 }
9958 return outputsArr;
9959 },
9960 enumerable: true,
9961 configurable: true
9962 });
9963 /**
9964 * Creates a new component.
9965 * @param {?} injector
9966 * @param {?=} projectableNodes
9967 * @param {?=} rootSelectorOrNode
9968 * @param {?=} ngModule
9969 * @return {?}
9970 */
9971 ComponentFactory_.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
9972 if (!ngModule) {
9973 throw new Error('ngModule should be provided');
9974 }
9975 var /** @type {?} */ viewDef = resolveDefinition(this.viewDefFactory);
9976 var /** @type {?} */ componentNodeIndex = ((((viewDef.nodes[0].element)).componentProvider)).index;
9977 var /** @type {?} */ view = Services.createRootView(injector, projectableNodes || [], rootSelectorOrNode, viewDef, ngModule, EMPTY_CONTEXT);
9978 var /** @type {?} */ component = asProviderData(view, componentNodeIndex).instance;
9979 if (rootSelectorOrNode) {
9980 view.renderer.setAttribute(asElementData(view, 0).renderElement, 'ng-version', VERSION.full);
9981 }
9982 return new ComponentRef_(view, new ViewRef_(view), component);
9983 };
9984 return ComponentFactory_;
9985}(ComponentFactory));
9986var ComponentRef_ = (function (_super) {
9987 __extends(ComponentRef_, _super);
9988 /**
9989 * @param {?} _view
9990 * @param {?} _viewRef
9991 * @param {?} _component
9992 */
9993 function ComponentRef_(_view, _viewRef, _component) {
9994 var _this = _super.call(this) || this;
9995 _this._view = _view;
9996 _this._viewRef = _viewRef;
9997 _this._component = _component;
9998 _this._elDef = _this._view.def.nodes[0];
9999 return _this;
10000 }
10001 Object.defineProperty(ComponentRef_.prototype, "location", {
10002 /**
10003 * @return {?}
10004 */
10005 get: function () {
10006 return new ElementRef(asElementData(this._view, this._elDef.index).renderElement);
10007 },
10008 enumerable: true,
10009 configurable: true
10010 });
10011 Object.defineProperty(ComponentRef_.prototype, "injector", {
10012 /**
10013 * @return {?}
10014 */
10015 get: function () { return new Injector_(this._view, this._elDef); },
10016 enumerable: true,
10017 configurable: true
10018 });
10019 Object.defineProperty(ComponentRef_.prototype, "instance", {
10020 /**
10021 * @return {?}
10022 */
10023 get: function () { return this._component; },
10024 enumerable: true,
10025 configurable: true
10026 });
10027
10028 Object.defineProperty(ComponentRef_.prototype, "hostView", {
10029 /**
10030 * @return {?}
10031 */
10032 get: function () { return this._viewRef; },
10033 enumerable: true,
10034 configurable: true
10035 });
10036
10037 Object.defineProperty(ComponentRef_.prototype, "changeDetectorRef", {
10038 /**
10039 * @return {?}
10040 */
10041 get: function () { return this._viewRef; },
10042 enumerable: true,
10043 configurable: true
10044 });
10045
10046 Object.defineProperty(ComponentRef_.prototype, "componentType", {
10047 /**
10048 * @return {?}
10049 */
10050 get: function () { return (this._component.constructor); },
10051 enumerable: true,
10052 configurable: true
10053 });
10054 /**
10055 * @return {?}
10056 */
10057 ComponentRef_.prototype.destroy = function () { this._viewRef.destroy(); };
10058 /**
10059 * @param {?} callback
10060 * @return {?}
10061 */
10062 ComponentRef_.prototype.onDestroy = function (callback) { this._viewRef.onDestroy(callback); };
10063 return ComponentRef_;
10064}(ComponentRef));
10065/**
10066 * @param {?} view
10067 * @param {?} elDef
10068 * @param {?} elData
10069 * @return {?}
10070 */
10071function createViewContainerData(view, elDef, elData) {
10072 return new ViewContainerRef_(view, elDef, elData);
10073}
10074var ViewContainerRef_ = (function () {
10075 /**
10076 * @param {?} _view
10077 * @param {?} _elDef
10078 * @param {?} _data
10079 */
10080 function ViewContainerRef_(_view, _elDef, _data) {
10081 this._view = _view;
10082 this._elDef = _elDef;
10083 this._data = _data;
10084 /**
10085 * \@internal
10086 */
10087 this._embeddedViews = [];
10088 }
10089 Object.defineProperty(ViewContainerRef_.prototype, "element", {
10090 /**
10091 * @return {?}
10092 */
10093 get: function () { return new ElementRef(this._data.renderElement); },
10094 enumerable: true,
10095 configurable: true
10096 });
10097 Object.defineProperty(ViewContainerRef_.prototype, "injector", {
10098 /**
10099 * @return {?}
10100 */
10101 get: function () { return new Injector_(this._view, this._elDef); },
10102 enumerable: true,
10103 configurable: true
10104 });
10105 Object.defineProperty(ViewContainerRef_.prototype, "parentInjector", {
10106 /**
10107 * @return {?}
10108 */
10109 get: function () {
10110 var /** @type {?} */ view = this._view;
10111 var /** @type {?} */ elDef = this._elDef.parent;
10112 while (!elDef && view) {
10113 elDef = viewParentEl(view);
10114 view = ((view.parent));
10115 }
10116 return view ? new Injector_(view, elDef) : new Injector_(this._view, null);
10117 },
10118 enumerable: true,
10119 configurable: true
10120 });
10121 /**
10122 * @return {?}
10123 */
10124 ViewContainerRef_.prototype.clear = function () {
10125 var /** @type {?} */ len = this._embeddedViews.length;
10126 for (var /** @type {?} */ i = len - 1; i >= 0; i--) {
10127 var /** @type {?} */ view = ((detachEmbeddedView(this._data, i)));
10128 Services.destroyView(view);
10129 }
10130 };
10131 /**
10132 * @param {?} index
10133 * @return {?}
10134 */
10135 ViewContainerRef_.prototype.get = function (index) {
10136 var /** @type {?} */ view = this._embeddedViews[index];
10137 if (view) {
10138 var /** @type {?} */ ref = new ViewRef_(view);
10139 ref.attachToViewContainerRef(this);
10140 return ref;
10141 }
10142 return null;
10143 };
10144 Object.defineProperty(ViewContainerRef_.prototype, "length", {
10145 /**
10146 * @return {?}
10147 */
10148 get: function () { return this._embeddedViews.length; },
10149 enumerable: true,
10150 configurable: true
10151 });
10152
10153 /**
10154 * @template C
10155 * @param {?} templateRef
10156 * @param {?=} context
10157 * @param {?=} index
10158 * @return {?}
10159 */
10160 ViewContainerRef_.prototype.createEmbeddedView = function (templateRef, context, index) {
10161 var /** @type {?} */ viewRef = templateRef.createEmbeddedView(context || ({}));
10162 this.insert(viewRef, index);
10163 return viewRef;
10164 };
10165 /**
10166 * @template C
10167 * @param {?} componentFactory
10168 * @param {?=} index
10169 * @param {?=} injector
10170 * @param {?=} projectableNodes
10171 * @param {?=} ngModuleRef
10172 * @return {?}
10173 */
10174 ViewContainerRef_.prototype.createComponent = function (componentFactory, index, injector, projectableNodes, ngModuleRef) {
10175 var /** @type {?} */ contextInjector = injector || this.parentInjector;
10176 if (!ngModuleRef && !(componentFactory instanceof ComponentFactoryBoundToModule)) {
10177 ngModuleRef = contextInjector.get(NgModuleRef);
10178 }
10179 var /** @type {?} */ componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef);
10180 this.insert(componentRef.hostView, index);
10181 return componentRef;
10182 };
10183 /**
10184 * @param {?} viewRef
10185 * @param {?=} index
10186 * @return {?}
10187 */
10188 ViewContainerRef_.prototype.insert = function (viewRef, index) {
10189 var /** @type {?} */ viewRef_ = (viewRef);
10190 var /** @type {?} */ viewData = viewRef_._view;
10191 attachEmbeddedView(this._view, this._data, index, viewData);
10192 viewRef_.attachToViewContainerRef(this);
10193 return viewRef;
10194 };
10195 /**
10196 * @param {?} viewRef
10197 * @param {?} currentIndex
10198 * @return {?}
10199 */
10200 ViewContainerRef_.prototype.move = function (viewRef, currentIndex) {
10201 var /** @type {?} */ previousIndex = this._embeddedViews.indexOf(viewRef._view);
10202 moveEmbeddedView(this._data, previousIndex, currentIndex);
10203 return viewRef;
10204 };
10205 /**
10206 * @param {?} viewRef
10207 * @return {?}
10208 */
10209 ViewContainerRef_.prototype.indexOf = function (viewRef) {
10210 return this._embeddedViews.indexOf(((viewRef))._view);
10211 };
10212 /**
10213 * @param {?=} index
10214 * @return {?}
10215 */
10216 ViewContainerRef_.prototype.remove = function (index) {
10217 var /** @type {?} */ viewData = detachEmbeddedView(this._data, index);
10218 if (viewData) {
10219 Services.destroyView(viewData);
10220 }
10221 };
10222 /**
10223 * @param {?=} index
10224 * @return {?}
10225 */
10226 ViewContainerRef_.prototype.detach = function (index) {
10227 var /** @type {?} */ view = detachEmbeddedView(this._data, index);
10228 return view ? new ViewRef_(view) : null;
10229 };
10230 return ViewContainerRef_;
10231}());
10232/**
10233 * @param {?} view
10234 * @return {?}
10235 */
10236function createChangeDetectorRef(view) {
10237 return new ViewRef_(view);
10238}
10239var ViewRef_ = (function () {
10240 /**
10241 * @param {?} _view
10242 */
10243 function ViewRef_(_view) {
10244 this._view = _view;
10245 this._viewContainerRef = null;
10246 this._appRef = null;
10247 }
10248 Object.defineProperty(ViewRef_.prototype, "rootNodes", {
10249 /**
10250 * @return {?}
10251 */
10252 get: function () { return rootRenderNodes(this._view); },
10253 enumerable: true,
10254 configurable: true
10255 });
10256 Object.defineProperty(ViewRef_.prototype, "context", {
10257 /**
10258 * @return {?}
10259 */
10260 get: function () { return this._view.context; },
10261 enumerable: true,
10262 configurable: true
10263 });
10264 Object.defineProperty(ViewRef_.prototype, "destroyed", {
10265 /**
10266 * @return {?}
10267 */
10268 get: function () { return (this._view.state & 128 /* Destroyed */) !== 0; },
10269 enumerable: true,
10270 configurable: true
10271 });
10272 /**
10273 * @return {?}
10274 */
10275 ViewRef_.prototype.markForCheck = function () { markParentViewsForCheck(this._view); };
10276 /**
10277 * @return {?}
10278 */
10279 ViewRef_.prototype.detach = function () { this._view.state &= ~4 /* Attached */; };
10280 /**
10281 * @return {?}
10282 */
10283 ViewRef_.prototype.detectChanges = function () {
10284 var /** @type {?} */ fs = this._view.root.rendererFactory;
10285 if (fs.begin) {
10286 fs.begin();
10287 }
10288 Services.checkAndUpdateView(this._view);
10289 if (fs.end) {
10290 fs.end();
10291 }
10292 };
10293 /**
10294 * @return {?}
10295 */
10296 ViewRef_.prototype.checkNoChanges = function () { Services.checkNoChangesView(this._view); };
10297 /**
10298 * @return {?}
10299 */
10300 ViewRef_.prototype.reattach = function () { this._view.state |= 4 /* Attached */; };
10301 /**
10302 * @param {?} callback
10303 * @return {?}
10304 */
10305 ViewRef_.prototype.onDestroy = function (callback) {
10306 if (!this._view.disposables) {
10307 this._view.disposables = [];
10308 }
10309 this._view.disposables.push(/** @type {?} */ (callback));
10310 };
10311 /**
10312 * @return {?}
10313 */
10314 ViewRef_.prototype.destroy = function () {
10315 if (this._appRef) {
10316 this._appRef.detachView(this);
10317 }
10318 else if (this._viewContainerRef) {
10319 this._viewContainerRef.detach(this._viewContainerRef.indexOf(this));
10320 }
10321 Services.destroyView(this._view);
10322 };
10323 /**
10324 * @return {?}
10325 */
10326 ViewRef_.prototype.detachFromAppRef = function () {
10327 this._appRef = null;
10328 renderDetachView(this._view);
10329 Services.dirtyParentQueries(this._view);
10330 };
10331 /**
10332 * @param {?} appRef
10333 * @return {?}
10334 */
10335 ViewRef_.prototype.attachToAppRef = function (appRef) {
10336 if (this._viewContainerRef) {
10337 throw new Error('This view is already attached to a ViewContainer!');
10338 }
10339 this._appRef = appRef;
10340 };
10341 /**
10342 * @param {?} vcRef
10343 * @return {?}
10344 */
10345 ViewRef_.prototype.attachToViewContainerRef = function (vcRef) {
10346 if (this._appRef) {
10347 throw new Error('This view is already attached directly to the ApplicationRef!');
10348 }
10349 this._viewContainerRef = vcRef;
10350 };
10351 return ViewRef_;
10352}());
10353/**
10354 * @param {?} view
10355 * @param {?} def
10356 * @return {?}
10357 */
10358function createTemplateData(view, def) {
10359 return new TemplateRef_(view, def);
10360}
10361var TemplateRef_ = (function (_super) {
10362 __extends(TemplateRef_, _super);
10363 /**
10364 * @param {?} _parentView
10365 * @param {?} _def
10366 */
10367 function TemplateRef_(_parentView, _def) {
10368 var _this = _super.call(this) || this;
10369 _this._parentView = _parentView;
10370 _this._def = _def;
10371 return _this;
10372 }
10373 /**
10374 * @param {?} context
10375 * @return {?}
10376 */
10377 TemplateRef_.prototype.createEmbeddedView = function (context) {
10378 return new ViewRef_(Services.createEmbeddedView(this._parentView, this._def, /** @type {?} */ ((((this._def.element)).template)), context));
10379 };
10380 Object.defineProperty(TemplateRef_.prototype, "elementRef", {
10381 /**
10382 * @return {?}
10383 */
10384 get: function () {
10385 return new ElementRef(asElementData(this._parentView, this._def.index).renderElement);
10386 },
10387 enumerable: true,
10388 configurable: true
10389 });
10390 return TemplateRef_;
10391}(TemplateRef));
10392/**
10393 * @param {?} view
10394 * @param {?} elDef
10395 * @return {?}
10396 */
10397function createInjector(view, elDef) {
10398 return new Injector_(view, elDef);
10399}
10400var Injector_ = (function () {
10401 /**
10402 * @param {?} view
10403 * @param {?} elDef
10404 */
10405 function Injector_(view, elDef) {
10406 this.view = view;
10407 this.elDef = elDef;
10408 }
10409 /**
10410 * @param {?} token
10411 * @param {?=} notFoundValue
10412 * @return {?}
10413 */
10414 Injector_.prototype.get = function (token, notFoundValue) {
10415 if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
10416 var /** @type {?} */ allowPrivateServices = this.elDef ? (this.elDef.flags & 33554432 /* ComponentView */) !== 0 : false;
10417 return Services.resolveDep(this.view, this.elDef, allowPrivateServices, { flags: 0 /* None */, token: token, tokenKey: tokenKey(token) }, notFoundValue);
10418 };
10419 return Injector_;
10420}());
10421/**
10422 * @param {?} view
10423 * @param {?} index
10424 * @return {?}
10425 */
10426function nodeValue(view, index) {
10427 var /** @type {?} */ def = view.def.nodes[index];
10428 if (def.flags & 1 /* TypeElement */) {
10429 var /** @type {?} */ elData = asElementData(view, def.index);
10430 return ((def.element)).template ? elData.template : elData.renderElement;
10431 }
10432 else if (def.flags & 2 /* TypeText */) {
10433 return asTextData(view, def.index).renderText;
10434 }
10435 else if (def.flags & (20224 /* CatProvider */ | 16 /* TypePipe */)) {
10436 return asProviderData(view, def.index).instance;
10437 }
10438 throw new Error("Illegal state: read nodeValue for node index " + index);
10439}
10440/**
10441 * @param {?} view
10442 * @return {?}
10443 */
10444function createRendererV1(view) {
10445 return new RendererAdapter(view.renderer);
10446}
10447var RendererAdapter = (function () {
10448 /**
10449 * @param {?} delegate
10450 */
10451 function RendererAdapter(delegate) {
10452 this.delegate = delegate;
10453 }
10454 /**
10455 * @param {?} selectorOrNode
10456 * @return {?}
10457 */
10458 RendererAdapter.prototype.selectRootElement = function (selectorOrNode) {
10459 return this.delegate.selectRootElement(selectorOrNode);
10460 };
10461 /**
10462 * @param {?} parent
10463 * @param {?} namespaceAndName
10464 * @return {?}
10465 */
10466 RendererAdapter.prototype.createElement = function (parent, namespaceAndName) {
10467 var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1];
10468 var /** @type {?} */ el = this.delegate.createElement(name, ns);
10469 if (parent) {
10470 this.delegate.appendChild(parent, el);
10471 }
10472 return el;
10473 };
10474 /**
10475 * @param {?} hostElement
10476 * @return {?}
10477 */
10478 RendererAdapter.prototype.createViewRoot = function (hostElement) { return hostElement; };
10479 /**
10480 * @param {?} parentElement
10481 * @return {?}
10482 */
10483 RendererAdapter.prototype.createTemplateAnchor = function (parentElement) {
10484 var /** @type {?} */ comment = this.delegate.createComment('');
10485 if (parentElement) {
10486 this.delegate.appendChild(parentElement, comment);
10487 }
10488 return comment;
10489 };
10490 /**
10491 * @param {?} parentElement
10492 * @param {?} value
10493 * @return {?}
10494 */
10495 RendererAdapter.prototype.createText = function (parentElement, value) {
10496 var /** @type {?} */ node = this.delegate.createText(value);
10497 if (parentElement) {
10498 this.delegate.appendChild(parentElement, node);
10499 }
10500 return node;
10501 };
10502 /**
10503 * @param {?} parentElement
10504 * @param {?} nodes
10505 * @return {?}
10506 */
10507 RendererAdapter.prototype.projectNodes = function (parentElement, nodes) {
10508 for (var /** @type {?} */ i = 0; i < nodes.length; i++) {
10509 this.delegate.appendChild(parentElement, nodes[i]);
10510 }
10511 };
10512 /**
10513 * @param {?} node
10514 * @param {?} viewRootNodes
10515 * @return {?}
10516 */
10517 RendererAdapter.prototype.attachViewAfter = function (node, viewRootNodes) {
10518 var /** @type {?} */ parentElement = this.delegate.parentNode(node);
10519 var /** @type {?} */ nextSibling = this.delegate.nextSibling(node);
10520 for (var /** @type {?} */ i = 0; i < viewRootNodes.length; i++) {
10521 this.delegate.insertBefore(parentElement, viewRootNodes[i], nextSibling);
10522 }
10523 };
10524 /**
10525 * @param {?} viewRootNodes
10526 * @return {?}
10527 */
10528 RendererAdapter.prototype.detachView = function (viewRootNodes) {
10529 for (var /** @type {?} */ i = 0; i < viewRootNodes.length; i++) {
10530 var /** @type {?} */ node = viewRootNodes[i];
10531 var /** @type {?} */ parentElement = this.delegate.parentNode(node);
10532 this.delegate.removeChild(parentElement, node);
10533 }
10534 };
10535 /**
10536 * @param {?} hostElement
10537 * @param {?} viewAllNodes
10538 * @return {?}
10539 */
10540 RendererAdapter.prototype.destroyView = function (hostElement, viewAllNodes) {
10541 for (var /** @type {?} */ i = 0; i < viewAllNodes.length; i++) {
10542 ((this.delegate.destroyNode))(viewAllNodes[i]);
10543 }
10544 };
10545 /**
10546 * @param {?} renderElement
10547 * @param {?} name
10548 * @param {?} callback
10549 * @return {?}
10550 */
10551 RendererAdapter.prototype.listen = function (renderElement, name, callback) {
10552 return this.delegate.listen(renderElement, name, /** @type {?} */ (callback));
10553 };
10554 /**
10555 * @param {?} target
10556 * @param {?} name
10557 * @param {?} callback
10558 * @return {?}
10559 */
10560 RendererAdapter.prototype.listenGlobal = function (target, name, callback) {
10561 return this.delegate.listen(target, name, /** @type {?} */ (callback));
10562 };
10563 /**
10564 * @param {?} renderElement
10565 * @param {?} propertyName
10566 * @param {?} propertyValue
10567 * @return {?}
10568 */
10569 RendererAdapter.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) {
10570 this.delegate.setProperty(renderElement, propertyName, propertyValue);
10571 };
10572 /**
10573 * @param {?} renderElement
10574 * @param {?} namespaceAndName
10575 * @param {?} attributeValue
10576 * @return {?}
10577 */
10578 RendererAdapter.prototype.setElementAttribute = function (renderElement, namespaceAndName, attributeValue) {
10579 var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1];
10580 if (attributeValue != null) {
10581 this.delegate.setAttribute(renderElement, name, attributeValue, ns);
10582 }
10583 else {
10584 this.delegate.removeAttribute(renderElement, name, ns);
10585 }
10586 };
10587 /**
10588 * @param {?} renderElement
10589 * @param {?} propertyName
10590 * @param {?} propertyValue
10591 * @return {?}
10592 */
10593 RendererAdapter.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) { };
10594 /**
10595 * @param {?} renderElement
10596 * @param {?} className
10597 * @param {?} isAdd
10598 * @return {?}
10599 */
10600 RendererAdapter.prototype.setElementClass = function (renderElement, className, isAdd) {
10601 if (isAdd) {
10602 this.delegate.addClass(renderElement, className);
10603 }
10604 else {
10605 this.delegate.removeClass(renderElement, className);
10606 }
10607 };
10608 /**
10609 * @param {?} renderElement
10610 * @param {?} styleName
10611 * @param {?} styleValue
10612 * @return {?}
10613 */
10614 RendererAdapter.prototype.setElementStyle = function (renderElement, styleName, styleValue) {
10615 if (styleValue != null) {
10616 this.delegate.setStyle(renderElement, styleName, styleValue);
10617 }
10618 else {
10619 this.delegate.removeStyle(renderElement, styleName);
10620 }
10621 };
10622 /**
10623 * @param {?} renderElement
10624 * @param {?} methodName
10625 * @param {?} args
10626 * @return {?}
10627 */
10628 RendererAdapter.prototype.invokeElementMethod = function (renderElement, methodName, args) {
10629 ((renderElement))[methodName].apply(renderElement, args);
10630 };
10631 /**
10632 * @param {?} renderNode
10633 * @param {?} text
10634 * @return {?}
10635 */
10636 RendererAdapter.prototype.setText = function (renderNode$$1, text) { this.delegate.setValue(renderNode$$1, text); };
10637 /**
10638 * @return {?}
10639 */
10640 RendererAdapter.prototype.animate = function () { throw new Error('Renderer.animate is no longer supported!'); };
10641 return RendererAdapter;
10642}());
10643/**
10644 * @param {?} moduleType
10645 * @param {?} parent
10646 * @param {?} bootstrapComponents
10647 * @param {?} def
10648 * @return {?}
10649 */
10650function createNgModuleRef(moduleType, parent, bootstrapComponents, def) {
10651 return new NgModuleRef_(moduleType, parent, bootstrapComponents, def);
10652}
10653var NgModuleRef_ = (function () {
10654 /**
10655 * @param {?} _moduleType
10656 * @param {?} _parent
10657 * @param {?} _bootstrapComponents
10658 * @param {?} _def
10659 */
10660 function NgModuleRef_(_moduleType, _parent, _bootstrapComponents, _def) {
10661 this._moduleType = _moduleType;
10662 this._parent = _parent;
10663 this._bootstrapComponents = _bootstrapComponents;
10664 this._def = _def;
10665 this._destroyListeners = [];
10666 this._destroyed = false;
10667 initNgModule(this);
10668 }
10669 /**
10670 * @param {?} token
10671 * @param {?=} notFoundValue
10672 * @return {?}
10673 */
10674 NgModuleRef_.prototype.get = function (token, notFoundValue) {
10675 if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
10676 return resolveNgModuleDep(this, { token: token, tokenKey: tokenKey(token), flags: 0 /* None */ }, notFoundValue);
10677 };
10678 Object.defineProperty(NgModuleRef_.prototype, "instance", {
10679 /**
10680 * @return {?}
10681 */
10682 get: function () { return this.get(this._moduleType); },
10683 enumerable: true,
10684 configurable: true
10685 });
10686 Object.defineProperty(NgModuleRef_.prototype, "componentFactoryResolver", {
10687 /**
10688 * @return {?}
10689 */
10690 get: function () { return this.get(ComponentFactoryResolver); },
10691 enumerable: true,
10692 configurable: true
10693 });
10694 Object.defineProperty(NgModuleRef_.prototype, "injector", {
10695 /**
10696 * @return {?}
10697 */
10698 get: function () { return this; },
10699 enumerable: true,
10700 configurable: true
10701 });
10702 /**
10703 * @return {?}
10704 */
10705 NgModuleRef_.prototype.destroy = function () {
10706 if (this._destroyed) {
10707 throw new Error("The ng module " + stringify(this.instance.constructor) + " has already been destroyed.");
10708 }
10709 this._destroyed = true;
10710 callNgModuleLifecycle(this, 131072 /* OnDestroy */);
10711 this._destroyListeners.forEach(function (listener) { return listener(); });
10712 };
10713 /**
10714 * @param {?} callback
10715 * @return {?}
10716 */
10717 NgModuleRef_.prototype.onDestroy = function (callback) { this._destroyListeners.push(callback); };
10718 return NgModuleRef_;
10719}());
10720/**
10721 * @license
10722 * Copyright Google Inc. All Rights Reserved.
10723 *
10724 * Use of this source code is governed by an MIT-style license that can be
10725 * found in the LICENSE file at https://angular.io/license
10726 */
10727var RendererV1TokenKey = tokenKey(Renderer);
10728var Renderer2TokenKey = tokenKey(Renderer2);
10729var ElementRefTokenKey = tokenKey(ElementRef);
10730var ViewContainerRefTokenKey = tokenKey(ViewContainerRef);
10731var TemplateRefTokenKey = tokenKey(TemplateRef);
10732var ChangeDetectorRefTokenKey = tokenKey(ChangeDetectorRef);
10733var InjectorRefTokenKey = tokenKey(Injector);
10734var NOT_CREATED = new Object();
10735/**
10736 * @param {?} flags
10737 * @param {?} matchedQueries
10738 * @param {?} childCount
10739 * @param {?} ctor
10740 * @param {?} deps
10741 * @param {?=} props
10742 * @param {?=} outputs
10743 * @return {?}
10744 */
10745function directiveDef(flags, matchedQueries, childCount, ctor, deps, props, outputs) {
10746 var /** @type {?} */ bindings = [];
10747 if (props) {
10748 for (var /** @type {?} */ prop in props) {
10749 var _a = props[prop], bindingIndex = _a[0], nonMinifiedName = _a[1];
10750 bindings[bindingIndex] = {
10751 flags: 8 /* TypeProperty */,
10752 name: prop, nonMinifiedName: nonMinifiedName,
10753 ns: null,
10754 securityContext: null,
10755 suffix: null
10756 };
10757 }
10758 }
10759 var /** @type {?} */ outputDefs = [];
10760 if (outputs) {
10761 for (var /** @type {?} */ propName in outputs) {
10762 outputDefs.push({ type: 1 /* DirectiveOutput */, propName: propName, target: null, eventName: outputs[propName] });
10763 }
10764 }
10765 flags |= 16384 /* TypeDirective */;
10766 return _def(flags, matchedQueries, childCount, ctor, ctor, deps, bindings, outputDefs);
10767}
10768/**
10769 * @param {?} flags
10770 * @param {?} ctor
10771 * @param {?} deps
10772 * @return {?}
10773 */
10774function pipeDef(flags, ctor, deps) {
10775 flags |= 16 /* TypePipe */;
10776 return _def(flags, null, 0, ctor, ctor, deps);
10777}
10778/**
10779 * @param {?} flags
10780 * @param {?} matchedQueries
10781 * @param {?} token
10782 * @param {?} value
10783 * @param {?} deps
10784 * @return {?}
10785 */
10786function providerDef(flags, matchedQueries, token, value, deps) {
10787 return _def(flags, matchedQueries, 0, token, value, deps);
10788}
10789/**
10790 * @param {?} flags
10791 * @param {?} matchedQueriesDsl
10792 * @param {?} childCount
10793 * @param {?} token
10794 * @param {?} value
10795 * @param {?} deps
10796 * @param {?=} bindings
10797 * @param {?=} outputs
10798 * @return {?}
10799 */
10800function _def(flags, matchedQueriesDsl, childCount, token, value, deps, bindings, outputs) {
10801 var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
10802 if (!outputs) {
10803 outputs = [];
10804 }
10805 if (!bindings) {
10806 bindings = [];
10807 }
10808 var /** @type {?} */ depDefs = splitDepsDsl(deps);
10809 return {
10810 // will bet set by the view definition
10811 index: -1,
10812 parent: null,
10813 renderParent: null,
10814 bindingIndex: -1,
10815 outputIndex: -1,
10816 // regular values
10817 flags: flags,
10818 childFlags: 0,
10819 directChildFlags: 0,
10820 childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references,
10821 ngContentIndex: -1, childCount: childCount, bindings: bindings,
10822 bindingFlags: calcBindingFlags(bindings), outputs: outputs,
10823 element: null,
10824 provider: { token: token, value: value, deps: depDefs },
10825 text: null,
10826 query: null,
10827 ngContent: null
10828 };
10829}
10830/**
10831 * @param {?} view
10832 * @param {?} def
10833 * @return {?}
10834 */
10835function createProviderInstance(view, def) {
10836 return def.flags & 4096 /* LazyProvider */ ? NOT_CREATED : _createProviderInstance(view, def);
10837}
10838/**
10839 * @param {?} view
10840 * @param {?} def
10841 * @return {?}
10842 */
10843function createPipeInstance(view, def) {
10844 // deps are looked up from component.
10845 var /** @type {?} */ compView = view;
10846 while (compView.parent && !isComponentView(compView)) {
10847 compView = compView.parent;
10848 }
10849 // pipes can see the private services of the component
10850 var /** @type {?} */ allowPrivateServices = true;
10851 // pipes are always eager and classes!
10852 return createClass(/** @type {?} */ ((compView.parent)), /** @type {?} */ ((viewParentEl(compView))), allowPrivateServices, /** @type {?} */ ((def.provider)).value, /** @type {?} */ ((def.provider)).deps);
10853}
10854/**
10855 * @param {?} view
10856 * @param {?} def
10857 * @return {?}
10858 */
10859function createDirectiveInstance(view, def) {
10860 // components can see other private services, other directives can't.
10861 var /** @type {?} */ allowPrivateServices = (def.flags & 32768 /* Component */) > 0;
10862 // directives are always eager and classes!
10863 var /** @type {?} */ instance = createClass(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((def.provider)).value, /** @type {?} */ ((def.provider)).deps);
10864 if (def.outputs.length) {
10865 for (var /** @type {?} */ i = 0; i < def.outputs.length; i++) {
10866 var /** @type {?} */ output = def.outputs[i];
10867 var /** @type {?} */ subscription = instance[((output.propName))].subscribe(eventHandlerClosure(view, /** @type {?} */ ((def.parent)).index, output.eventName)); /** @type {?} */
10868 ((view.disposables))[def.outputIndex + i] = subscription.unsubscribe.bind(subscription);
10869 }
10870 }
10871 return instance;
10872}
10873/**
10874 * @param {?} view
10875 * @param {?} index
10876 * @param {?} eventName
10877 * @return {?}
10878 */
10879function eventHandlerClosure(view, index, eventName) {
10880 return function (event) {
10881 try {
10882 return dispatchEvent(view, index, eventName, event);
10883 }
10884 catch (e) {
10885 // Attention: Don't rethrow, as it would cancel Observable subscriptions!
10886 view.root.errorHandler.handleError(e);
10887 }
10888 };
10889}
10890/**
10891 * @param {?} view
10892 * @param {?} def
10893 * @param {?} v0
10894 * @param {?} v1
10895 * @param {?} v2
10896 * @param {?} v3
10897 * @param {?} v4
10898 * @param {?} v5
10899 * @param {?} v6
10900 * @param {?} v7
10901 * @param {?} v8
10902 * @param {?} v9
10903 * @return {?}
10904 */
10905function checkAndUpdateDirectiveInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
10906 var /** @type {?} */ providerData = asProviderData(view, def.index);
10907 var /** @type {?} */ directive = providerData.instance;
10908 var /** @type {?} */ changed = false;
10909 var /** @type {?} */ changes = ((undefined));
10910 var /** @type {?} */ bindLen = def.bindings.length;
10911 if (bindLen > 0 && checkBinding(view, def, 0, v0)) {
10912 changed = true;
10913 changes = updateProp(view, providerData, def, 0, v0, changes);
10914 }
10915 if (bindLen > 1 && checkBinding(view, def, 1, v1)) {
10916 changed = true;
10917 changes = updateProp(view, providerData, def, 1, v1, changes);
10918 }
10919 if (bindLen > 2 && checkBinding(view, def, 2, v2)) {
10920 changed = true;
10921 changes = updateProp(view, providerData, def, 2, v2, changes);
10922 }
10923 if (bindLen > 3 && checkBinding(view, def, 3, v3)) {
10924 changed = true;
10925 changes = updateProp(view, providerData, def, 3, v3, changes);
10926 }
10927 if (bindLen > 4 && checkBinding(view, def, 4, v4)) {
10928 changed = true;
10929 changes = updateProp(view, providerData, def, 4, v4, changes);
10930 }
10931 if (bindLen > 5 && checkBinding(view, def, 5, v5)) {
10932 changed = true;
10933 changes = updateProp(view, providerData, def, 5, v5, changes);
10934 }
10935 if (bindLen > 6 && checkBinding(view, def, 6, v6)) {
10936 changed = true;
10937 changes = updateProp(view, providerData, def, 6, v6, changes);
10938 }
10939 if (bindLen > 7 && checkBinding(view, def, 7, v7)) {
10940 changed = true;
10941 changes = updateProp(view, providerData, def, 7, v7, changes);
10942 }
10943 if (bindLen > 8 && checkBinding(view, def, 8, v8)) {
10944 changed = true;
10945 changes = updateProp(view, providerData, def, 8, v8, changes);
10946 }
10947 if (bindLen > 9 && checkBinding(view, def, 9, v9)) {
10948 changed = true;
10949 changes = updateProp(view, providerData, def, 9, v9, changes);
10950 }
10951 if (changes) {
10952 directive.ngOnChanges(changes);
10953 }
10954 if ((view.state & 2 /* FirstCheck */) && (def.flags & 65536 /* OnInit */)) {
10955 directive.ngOnInit();
10956 }
10957 if (def.flags & 262144 /* DoCheck */) {
10958 directive.ngDoCheck();
10959 }
10960 return changed;
10961}
10962/**
10963 * @param {?} view
10964 * @param {?} def
10965 * @param {?} values
10966 * @return {?}
10967 */
10968function checkAndUpdateDirectiveDynamic(view, def, values) {
10969 var /** @type {?} */ providerData = asProviderData(view, def.index);
10970 var /** @type {?} */ directive = providerData.instance;
10971 var /** @type {?} */ changed = false;
10972 var /** @type {?} */ changes = ((undefined));
10973 for (var /** @type {?} */ i = 0; i < values.length; i++) {
10974 if (checkBinding(view, def, i, values[i])) {
10975 changed = true;
10976 changes = updateProp(view, providerData, def, i, values[i], changes);
10977 }
10978 }
10979 if (changes) {
10980 directive.ngOnChanges(changes);
10981 }
10982 if ((view.state & 2 /* FirstCheck */) && (def.flags & 65536 /* OnInit */)) {
10983 directive.ngOnInit();
10984 }
10985 if (def.flags & 262144 /* DoCheck */) {
10986 directive.ngDoCheck();
10987 }
10988 return changed;
10989}
10990/**
10991 * @param {?} view
10992 * @param {?} def
10993 * @return {?}
10994 */
10995function _createProviderInstance(view, def) {
10996 // private services can see other private services
10997 var /** @type {?} */ allowPrivateServices = (def.flags & 8192 /* PrivateProvider */) > 0;
10998 var /** @type {?} */ providerDef = def.provider;
10999 var /** @type {?} */ injectable;
11000 switch (def.flags & 201347067 /* Types */) {
11001 case 512 /* TypeClassProvider */:
11002 injectable = createClass(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).value, /** @type {?} */ ((providerDef)).deps);
11003 break;
11004 case 1024 /* TypeFactoryProvider */:
11005 injectable = callFactory(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).value, /** @type {?} */ ((providerDef)).deps);
11006 break;
11007 case 2048 /* TypeUseExistingProvider */:
11008 injectable = resolveDep(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).deps[0]);
11009 break;
11010 case 256 /* TypeValueProvider */:
11011 injectable = ((providerDef)).value;
11012 break;
11013 }
11014 return injectable;
11015}
11016/**
11017 * @param {?} view
11018 * @param {?} elDef
11019 * @param {?} allowPrivateServices
11020 * @param {?} ctor
11021 * @param {?} deps
11022 * @return {?}
11023 */
11024function createClass(view, elDef, allowPrivateServices, ctor, deps) {
11025 var /** @type {?} */ len = deps.length;
11026 var /** @type {?} */ injectable;
11027 switch (len) {
11028 case 0:
11029 injectable = new ctor();
11030 break;
11031 case 1:
11032 injectable = new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]));
11033 break;
11034 case 2:
11035 injectable = new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
11036 break;
11037 case 3:
11038 injectable = new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
11039 break;
11040 default:
11041 var /** @type {?} */ depValues = new Array(len);
11042 for (var /** @type {?} */ i = 0; i < len; i++) {
11043 depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
11044 }
11045 injectable = new (ctor.bind.apply(ctor, [void 0].concat(depValues)))();
11046 }
11047 return injectable;
11048}
11049/**
11050 * @param {?} view
11051 * @param {?} elDef
11052 * @param {?} allowPrivateServices
11053 * @param {?} factory
11054 * @param {?} deps
11055 * @return {?}
11056 */
11057function callFactory(view, elDef, allowPrivateServices, factory, deps) {
11058 var /** @type {?} */ len = deps.length;
11059 var /** @type {?} */ injectable;
11060 switch (len) {
11061 case 0:
11062 injectable = factory();
11063 break;
11064 case 1:
11065 injectable = factory(resolveDep(view, elDef, allowPrivateServices, deps[0]));
11066 break;
11067 case 2:
11068 injectable = factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
11069 break;
11070 case 3:
11071 injectable = factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
11072 break;
11073 default:
11074 var /** @type {?} */ depValues = Array(len);
11075 for (var /** @type {?} */ i = 0; i < len; i++) {
11076 depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
11077 }
11078 injectable = factory.apply(void 0, depValues);
11079 }
11080 return injectable;
11081}
11082// This default value is when checking the hierarchy for a token.
11083//
11084// It means both:
11085// - the token is not provided by the current injector,
11086// - only the element injectors should be checked (ie do not check module injectors
11087//
11088// mod1
11089// /
11090// el1 mod2
11091// \ /
11092// el2
11093//
11094// When requesting el2.injector.get(token), we should check in the following order and return the
11095// first found value:
11096// - el2.injector.get(token, default)
11097// - el1.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) -> do not check the module
11098// - mod2.injector.get(token, default)
11099var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
11100/**
11101 * @param {?} view
11102 * @param {?} elDef
11103 * @param {?} allowPrivateServices
11104 * @param {?} depDef
11105 * @param {?=} notFoundValue
11106 * @return {?}
11107 */
11108function resolveDep(view, elDef, allowPrivateServices, depDef, notFoundValue) {
11109 if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
11110 if (depDef.flags & 8 /* Value */) {
11111 return depDef.token;
11112 }
11113 var /** @type {?} */ startView = view;
11114 if (depDef.flags & 2 /* Optional */) {
11115 notFoundValue = null;
11116 }
11117 var /** @type {?} */ tokenKey$$1 = depDef.tokenKey;
11118 if (tokenKey$$1 === ChangeDetectorRefTokenKey) {
11119 // directives on the same element as a component should be able to control the change detector
11120 // of that component as well.
11121 allowPrivateServices = !!(elDef && ((elDef.element)).componentView);
11122 }
11123 if (elDef && (depDef.flags & 1 /* SkipSelf */)) {
11124 allowPrivateServices = false;
11125 elDef = ((elDef.parent));
11126 }
11127 while (view) {
11128 if (elDef) {
11129 switch (tokenKey$$1) {
11130 case RendererV1TokenKey: {
11131 var /** @type {?} */ compView = findCompView(view, elDef, allowPrivateServices);
11132 return createRendererV1(compView);
11133 }
11134 case Renderer2TokenKey: {
11135 var /** @type {?} */ compView = findCompView(view, elDef, allowPrivateServices);
11136 return compView.renderer;
11137 }
11138 case ElementRefTokenKey:
11139 return new ElementRef(asElementData(view, elDef.index).renderElement);
11140 case ViewContainerRefTokenKey:
11141 return asElementData(view, elDef.index).viewContainer;
11142 case TemplateRefTokenKey: {
11143 if (((elDef.element)).template) {
11144 return asElementData(view, elDef.index).template;
11145 }
11146 break;
11147 }
11148 case ChangeDetectorRefTokenKey: {
11149 var /** @type {?} */ cdView = findCompView(view, elDef, allowPrivateServices);
11150 return createChangeDetectorRef(cdView);
11151 }
11152 case InjectorRefTokenKey:
11153 return createInjector(view, elDef);
11154 default:
11155 var /** @type {?} */ providerDef_1 = (((allowPrivateServices ? ((elDef.element)).allProviders : ((elDef.element)).publicProviders)))[tokenKey$$1];
11156 if (providerDef_1) {
11157 var /** @type {?} */ providerData = asProviderData(view, providerDef_1.index);
11158 if (providerData.instance === NOT_CREATED) {
11159 providerData.instance = _createProviderInstance(view, providerDef_1);
11160 }
11161 return providerData.instance;
11162 }
11163 }
11164 }
11165 allowPrivateServices = isComponentView(view);
11166 elDef = ((viewParentEl(view)));
11167 view = ((view.parent));
11168 }
11169 var /** @type {?} */ value = startView.root.injector.get(depDef.token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR);
11170 if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
11171 notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
11172 // Return the value from the root element injector when
11173 // - it provides it
11174 // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
11175 // - the module injector should not be checked
11176 // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
11177 return value;
11178 }
11179 return startView.root.ngModule.injector.get(depDef.token, notFoundValue);
11180}
11181/**
11182 * @param {?} view
11183 * @param {?} elDef
11184 * @param {?} allowPrivateServices
11185 * @return {?}
11186 */
11187function findCompView(view, elDef, allowPrivateServices) {
11188 var /** @type {?} */ compView;
11189 if (allowPrivateServices) {
11190 compView = asElementData(view, elDef.index).componentView;
11191 }
11192 else {
11193 compView = view;
11194 while (compView.parent && !isComponentView(compView)) {
11195 compView = compView.parent;
11196 }
11197 }
11198 return compView;
11199}
11200/**
11201 * @param {?} view
11202 * @param {?} providerData
11203 * @param {?} def
11204 * @param {?} bindingIdx
11205 * @param {?} value
11206 * @param {?} changes
11207 * @return {?}
11208 */
11209function updateProp(view, providerData, def, bindingIdx, value, changes) {
11210 if (def.flags & 32768 /* Component */) {
11211 var /** @type {?} */ compView = asElementData(view, /** @type {?} */ ((def.parent)).index).componentView;
11212 if (compView.def.flags & 2 /* OnPush */) {
11213 compView.state |= 8 /* ChecksEnabled */;
11214 }
11215 }
11216 var /** @type {?} */ binding = def.bindings[bindingIdx];
11217 var /** @type {?} */ propName = ((binding.name));
11218 // Note: This is still safe with Closure Compiler as
11219 // the user passed in the property name as an object has to `providerDef`,
11220 // so Closure Compiler will have renamed the property correctly already.
11221 providerData.instance[propName] = value;
11222 if (def.flags & 524288 /* OnChanges */) {
11223 changes = changes || {};
11224 var /** @type {?} */ oldValue = view.oldValues[def.bindingIndex + bindingIdx];
11225 if (oldValue instanceof WrappedValue) {
11226 oldValue = oldValue.wrapped;
11227 }
11228 var /** @type {?} */ binding_1 = def.bindings[bindingIdx];
11229 changes[((binding_1.nonMinifiedName))] =
11230 new SimpleChange(oldValue, value, (view.state & 2 /* FirstCheck */) !== 0);
11231 }
11232 view.oldValues[def.bindingIndex + bindingIdx] = value;
11233 return changes;
11234}
11235/**
11236 * @param {?} view
11237 * @param {?} lifecycles
11238 * @return {?}
11239 */
11240function callLifecycleHooksChildrenFirst(view, lifecycles) {
11241 if (!(view.def.nodeFlags & lifecycles)) {
11242 return;
11243 }
11244 var /** @type {?} */ nodes = view.def.nodes;
11245 for (var /** @type {?} */ i = 0; i < nodes.length; i++) {
11246 var /** @type {?} */ nodeDef = nodes[i];
11247 var /** @type {?} */ parent = nodeDef.parent;
11248 if (!parent && nodeDef.flags & lifecycles) {
11249 // matching root node (e.g. a pipe)
11250 callProviderLifecycles(view, i, nodeDef.flags & lifecycles);
11251 }
11252 if ((nodeDef.childFlags & lifecycles) === 0) {
11253 // no child matches one of the lifecycles
11254 i += nodeDef.childCount;
11255 }
11256 while (parent && (parent.flags & 1 /* TypeElement */) &&
11257 i === parent.index + parent.childCount) {
11258 // last child of an element
11259 if (parent.directChildFlags & lifecycles) {
11260 callElementProvidersLifecycles(view, parent, lifecycles);
11261 }
11262 parent = parent.parent;
11263 }
11264 }
11265}
11266/**
11267 * @param {?} view
11268 * @param {?} elDef
11269 * @param {?} lifecycles
11270 * @return {?}
11271 */
11272function callElementProvidersLifecycles(view, elDef, lifecycles) {
11273 for (var /** @type {?} */ i = elDef.index + 1; i <= elDef.index + elDef.childCount; i++) {
11274 var /** @type {?} */ nodeDef = view.def.nodes[i];
11275 if (nodeDef.flags & lifecycles) {
11276 callProviderLifecycles(view, i, nodeDef.flags & lifecycles);
11277 }
11278 // only visit direct children
11279 i += nodeDef.childCount;
11280 }
11281}
11282/**
11283 * @param {?} view
11284 * @param {?} index
11285 * @param {?} lifecycles
11286 * @return {?}
11287 */
11288function callProviderLifecycles(view, index, lifecycles) {
11289 var /** @type {?} */ provider = asProviderData(view, index).instance;
11290 if (provider === NOT_CREATED) {
11291 return;
11292 }
11293 Services.setCurrentNode(view, index);
11294 if (lifecycles & 1048576 /* AfterContentInit */) {
11295 provider.ngAfterContentInit();
11296 }
11297 if (lifecycles & 2097152 /* AfterContentChecked */) {
11298 provider.ngAfterContentChecked();
11299 }
11300 if (lifecycles & 4194304 /* AfterViewInit */) {
11301 provider.ngAfterViewInit();
11302 }
11303 if (lifecycles & 8388608 /* AfterViewChecked */) {
11304 provider.ngAfterViewChecked();
11305 }
11306 if (lifecycles & 131072 /* OnDestroy */) {
11307 provider.ngOnDestroy();
11308 }
11309}
11310/**
11311 * @license
11312 * Copyright Google Inc. All Rights Reserved.
11313 *
11314 * Use of this source code is governed by an MIT-style license that can be
11315 * found in the LICENSE file at https://angular.io/license
11316 */
11317/**
11318 * @param {?} flags
11319 * @param {?} id
11320 * @param {?} bindings
11321 * @return {?}
11322 */
11323function queryDef(flags, id, bindings) {
11324 var /** @type {?} */ bindingDefs = [];
11325 for (var /** @type {?} */ propName in bindings) {
11326 var /** @type {?} */ bindingType = bindings[propName];
11327 bindingDefs.push({ propName: propName, bindingType: bindingType });
11328 }
11329 return {
11330 // will bet set by the view definition
11331 index: -1,
11332 parent: null,
11333 renderParent: null,
11334 bindingIndex: -1,
11335 outputIndex: -1,
11336 // regular values
11337 flags: flags,
11338 childFlags: 0,
11339 directChildFlags: 0,
11340 childMatchedQueries: 0,
11341 ngContentIndex: -1,
11342 matchedQueries: {},
11343 matchedQueryIds: 0,
11344 references: {},
11345 childCount: 0,
11346 bindings: [],
11347 bindingFlags: 0,
11348 outputs: [],
11349 element: null,
11350 provider: null,
11351 text: null,
11352 query: { id: id, filterId: filterQueryId(id), bindings: bindingDefs },
11353 ngContent: null
11354 };
11355}
11356/**
11357 * @return {?}
11358 */
11359function createQuery() {
11360 return new QueryList();
11361}
11362/**
11363 * @param {?} view
11364 * @return {?}
11365 */
11366function dirtyParentQueries(view) {
11367 var /** @type {?} */ queryIds = view.def.nodeMatchedQueries;
11368 while (view.parent && isEmbeddedView(view)) {
11369 var /** @type {?} */ tplDef = ((view.parentNodeDef));
11370 view = view.parent;
11371 // content queries
11372 var /** @type {?} */ end = tplDef.index + tplDef.childCount;
11373 for (var /** @type {?} */ i = 0; i <= end; i++) {
11374 var /** @type {?} */ nodeDef = view.def.nodes[i];
11375 if ((nodeDef.flags & 67108864 /* TypeContentQuery */) &&
11376 (nodeDef.flags & 536870912 /* DynamicQuery */) &&
11377 (((nodeDef.query)).filterId & queryIds) === ((nodeDef.query)).filterId) {
11378 asQueryList(view, i).setDirty();
11379 }
11380 if ((nodeDef.flags & 1 /* TypeElement */ && i + nodeDef.childCount < tplDef.index) ||
11381 !(nodeDef.childFlags & 67108864 /* TypeContentQuery */) ||
11382 !(nodeDef.childFlags & 536870912 /* DynamicQuery */)) {
11383 // skip elements that don't contain the template element or no query.
11384 i += nodeDef.childCount;
11385 }
11386 }
11387 }
11388 // view queries
11389 if (view.def.nodeFlags & 134217728 /* TypeViewQuery */) {
11390 for (var /** @type {?} */ i = 0; i < view.def.nodes.length; i++) {
11391 var /** @type {?} */ nodeDef = view.def.nodes[i];
11392 if ((nodeDef.flags & 134217728 /* TypeViewQuery */) && (nodeDef.flags & 536870912 /* DynamicQuery */)) {
11393 asQueryList(view, i).setDirty();
11394 }
11395 // only visit the root nodes
11396 i += nodeDef.childCount;
11397 }
11398 }
11399}
11400/**
11401 * @param {?} view
11402 * @param {?} nodeDef
11403 * @return {?}
11404 */
11405function checkAndUpdateQuery(view, nodeDef) {
11406 var /** @type {?} */ queryList = asQueryList(view, nodeDef.index);
11407 if (!queryList.dirty) {
11408 return;
11409 }
11410 var /** @type {?} */ directiveInstance;
11411 var /** @type {?} */ newValues = ((undefined));
11412 if (nodeDef.flags & 67108864 /* TypeContentQuery */) {
11413 var /** @type {?} */ elementDef_1 = ((((nodeDef.parent)).parent));
11414 newValues = calcQueryValues(view, elementDef_1.index, elementDef_1.index + elementDef_1.childCount, /** @type {?} */ ((nodeDef.query)), []);
11415 directiveInstance = asProviderData(view, /** @type {?} */ ((nodeDef.parent)).index).instance;
11416 }
11417 else if (nodeDef.flags & 134217728 /* TypeViewQuery */) {
11418 newValues = calcQueryValues(view, 0, view.def.nodes.length - 1, /** @type {?} */ ((nodeDef.query)), []);
11419 directiveInstance = view.component;
11420 }
11421 queryList.reset(newValues);
11422 var /** @type {?} */ bindings = ((nodeDef.query)).bindings;
11423 var /** @type {?} */ notify = false;
11424 for (var /** @type {?} */ i = 0; i < bindings.length; i++) {
11425 var /** @type {?} */ binding = bindings[i];
11426 var /** @type {?} */ boundValue = void 0;
11427 switch (binding.bindingType) {
11428 case 0 /* First */:
11429 boundValue = queryList.first;
11430 break;
11431 case 1 /* All */:
11432 boundValue = queryList;
11433 notify = true;
11434 break;
11435 }
11436 directiveInstance[binding.propName] = boundValue;
11437 }
11438 if (notify) {
11439 queryList.notifyOnChanges();
11440 }
11441}
11442/**
11443 * @param {?} view
11444 * @param {?} startIndex
11445 * @param {?} endIndex
11446 * @param {?} queryDef
11447 * @param {?} values
11448 * @return {?}
11449 */
11450function calcQueryValues(view, startIndex, endIndex, queryDef, values) {
11451 for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) {
11452 var /** @type {?} */ nodeDef = view.def.nodes[i];
11453 var /** @type {?} */ valueType = nodeDef.matchedQueries[queryDef.id];
11454 if (valueType != null) {
11455 values.push(getQueryValue(view, nodeDef, valueType));
11456 }
11457 if (nodeDef.flags & 1 /* TypeElement */ && ((nodeDef.element)).template &&
11458 (((((nodeDef.element)).template)).nodeMatchedQueries & queryDef.filterId) ===
11459 queryDef.filterId) {
11460 // check embedded views that were attached at the place of their template.
11461 var /** @type {?} */ elementData = asElementData(view, i);
11462 if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
11463 var /** @type {?} */ embeddedViews = ((elementData.viewContainer))._embeddedViews;
11464 for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) {
11465 var /** @type {?} */ embeddedView = embeddedViews[k];
11466 var /** @type {?} */ dvc = declaredViewContainer(embeddedView);
11467 if (dvc && dvc === elementData) {
11468 calcQueryValues(embeddedView, 0, embeddedView.def.nodes.length - 1, queryDef, values);
11469 }
11470 }
11471 }
11472 var /** @type {?} */ projectedViews = elementData.template._projectedViews;
11473 if (projectedViews) {
11474 for (var /** @type {?} */ k = 0; k < projectedViews.length; k++) {
11475 var /** @type {?} */ projectedView = projectedViews[k];
11476 calcQueryValues(projectedView, 0, projectedView.def.nodes.length - 1, queryDef, values);
11477 }
11478 }
11479 }
11480 if ((nodeDef.childMatchedQueries & queryDef.filterId) !== queryDef.filterId) {
11481 // if no child matches the query, skip the children.
11482 i += nodeDef.childCount;
11483 }
11484 }
11485 return values;
11486}
11487/**
11488 * @param {?} view
11489 * @param {?} nodeDef
11490 * @param {?} queryValueType
11491 * @return {?}
11492 */
11493function getQueryValue(view, nodeDef, queryValueType) {
11494 if (queryValueType != null) {
11495 // a match
11496 var /** @type {?} */ value = void 0;
11497 switch (queryValueType) {
11498 case 1 /* RenderElement */:
11499 value = asElementData(view, nodeDef.index).renderElement;
11500 break;
11501 case 0 /* ElementRef */:
11502 value = new ElementRef(asElementData(view, nodeDef.index).renderElement);
11503 break;
11504 case 2 /* TemplateRef */:
11505 value = asElementData(view, nodeDef.index).template;
11506 break;
11507 case 3 /* ViewContainerRef */:
11508 value = asElementData(view, nodeDef.index).viewContainer;
11509 break;
11510 case 4 /* Provider */:
11511 value = asProviderData(view, nodeDef.index).instance;
11512 break;
11513 }
11514 return value;
11515 }
11516}
11517/**
11518 * @license
11519 * Copyright Google Inc. All Rights Reserved.
11520 *
11521 * Use of this source code is governed by an MIT-style license that can be
11522 * found in the LICENSE file at https://angular.io/license
11523 */
11524/**
11525 * @param {?} ngContentIndex
11526 * @param {?} index
11527 * @return {?}
11528 */
11529function ngContentDef(ngContentIndex, index) {
11530 return {
11531 // will bet set by the view definition
11532 index: -1,
11533 parent: null,
11534 renderParent: null,
11535 bindingIndex: -1,
11536 outputIndex: -1,
11537 // regular values
11538 flags: 8 /* TypeNgContent */,
11539 childFlags: 0,
11540 directChildFlags: 0,
11541 childMatchedQueries: 0,
11542 matchedQueries: {},
11543 matchedQueryIds: 0,
11544 references: {}, ngContentIndex: ngContentIndex,
11545 childCount: 0,
11546 bindings: [],
11547 bindingFlags: 0,
11548 outputs: [],
11549 element: null,
11550 provider: null,
11551 text: null,
11552 query: null,
11553 ngContent: { index: index }
11554 };
11555}
11556/**
11557 * @param {?} view
11558 * @param {?} renderHost
11559 * @param {?} def
11560 * @return {?}
11561 */
11562function appendNgContent(view, renderHost, def) {
11563 var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def);
11564 if (!parentEl) {
11565 // Nothing to do if there is no parent element.
11566 return;
11567 }
11568 var /** @type {?} */ ngContentIndex = ((def.ngContent)).index;
11569 visitProjectedRenderNodes(view, ngContentIndex, 1 /* AppendChild */, parentEl, null, undefined);
11570}
11571/**
11572 * @license
11573 * Copyright Google Inc. All Rights Reserved.
11574 *
11575 * Use of this source code is governed by an MIT-style license that can be
11576 * found in the LICENSE file at https://angular.io/license
11577 */
11578/**
11579 * @param {?} argCount
11580 * @return {?}
11581 */
11582function purePipeDef(argCount) {
11583 // argCount + 1 to include the pipe as first arg
11584 return _pureExpressionDef(128 /* TypePurePipe */, new Array(argCount + 1));
11585}
11586/**
11587 * @param {?} argCount
11588 * @return {?}
11589 */
11590function pureArrayDef(argCount) {
11591 return _pureExpressionDef(32 /* TypePureArray */, new Array(argCount));
11592}
11593/**
11594 * @param {?} propertyNames
11595 * @return {?}
11596 */
11597function pureObjectDef(propertyNames) {
11598 return _pureExpressionDef(64 /* TypePureObject */, propertyNames);
11599}
11600/**
11601 * @param {?} flags
11602 * @param {?} propertyNames
11603 * @return {?}
11604 */
11605function _pureExpressionDef(flags, propertyNames) {
11606 var /** @type {?} */ bindings = new Array(propertyNames.length);
11607 for (var /** @type {?} */ i = 0; i < propertyNames.length; i++) {
11608 var /** @type {?} */ prop = propertyNames[i];
11609 bindings[i] = {
11610 flags: 8 /* TypeProperty */,
11611 name: prop,
11612 ns: null,
11613 nonMinifiedName: prop,
11614 securityContext: null,
11615 suffix: null
11616 };
11617 }
11618 return {
11619 // will bet set by the view definition
11620 index: -1,
11621 parent: null,
11622 renderParent: null,
11623 bindingIndex: -1,
11624 outputIndex: -1,
11625 // regular values
11626 flags: flags,
11627 childFlags: 0,
11628 directChildFlags: 0,
11629 childMatchedQueries: 0,
11630 matchedQueries: {},
11631 matchedQueryIds: 0,
11632 references: {},
11633 ngContentIndex: -1,
11634 childCount: 0, bindings: bindings,
11635 bindingFlags: calcBindingFlags(bindings),
11636 outputs: [],
11637 element: null,
11638 provider: null,
11639 text: null,
11640 query: null,
11641 ngContent: null
11642 };
11643}
11644/**
11645 * @param {?} view
11646 * @param {?} def
11647 * @return {?}
11648 */
11649function createPureExpression(view, def) {
11650 return { value: undefined };
11651}
11652/**
11653 * @param {?} view
11654 * @param {?} def
11655 * @param {?} v0
11656 * @param {?} v1
11657 * @param {?} v2
11658 * @param {?} v3
11659 * @param {?} v4
11660 * @param {?} v5
11661 * @param {?} v6
11662 * @param {?} v7
11663 * @param {?} v8
11664 * @param {?} v9
11665 * @return {?}
11666 */
11667function checkAndUpdatePureExpressionInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
11668 var /** @type {?} */ bindings = def.bindings;
11669 var /** @type {?} */ changed = false;
11670 var /** @type {?} */ bindLen = bindings.length;
11671 if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
11672 changed = true;
11673 if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
11674 changed = true;
11675 if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
11676 changed = true;
11677 if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
11678 changed = true;
11679 if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
11680 changed = true;
11681 if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
11682 changed = true;
11683 if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
11684 changed = true;
11685 if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
11686 changed = true;
11687 if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
11688 changed = true;
11689 if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
11690 changed = true;
11691 if (changed) {
11692 var /** @type {?} */ data = asPureExpressionData(view, def.index);
11693 var /** @type {?} */ value = void 0;
11694 switch (def.flags & 201347067 /* Types */) {
11695 case 32 /* TypePureArray */:
11696 value = new Array(bindings.length);
11697 if (bindLen > 0)
11698 value[0] = v0;
11699 if (bindLen > 1)
11700 value[1] = v1;
11701 if (bindLen > 2)
11702 value[2] = v2;
11703 if (bindLen > 3)
11704 value[3] = v3;
11705 if (bindLen > 4)
11706 value[4] = v4;
11707 if (bindLen > 5)
11708 value[5] = v5;
11709 if (bindLen > 6)
11710 value[6] = v6;
11711 if (bindLen > 7)
11712 value[7] = v7;
11713 if (bindLen > 8)
11714 value[8] = v8;
11715 if (bindLen > 9)
11716 value[9] = v9;
11717 break;
11718 case 64 /* TypePureObject */:
11719 value = {};
11720 if (bindLen > 0)
11721 value[((bindings[0].name))] = v0;
11722 if (bindLen > 1)
11723 value[((bindings[1].name))] = v1;
11724 if (bindLen > 2)
11725 value[((bindings[2].name))] = v2;
11726 if (bindLen > 3)
11727 value[((bindings[3].name))] = v3;
11728 if (bindLen > 4)
11729 value[((bindings[4].name))] = v4;
11730 if (bindLen > 5)
11731 value[((bindings[5].name))] = v5;
11732 if (bindLen > 6)
11733 value[((bindings[6].name))] = v6;
11734 if (bindLen > 7)
11735 value[((bindings[7].name))] = v7;
11736 if (bindLen > 8)
11737 value[((bindings[8].name))] = v8;
11738 if (bindLen > 9)
11739 value[((bindings[9].name))] = v9;
11740 break;
11741 case 128 /* TypePurePipe */:
11742 var /** @type {?} */ pipe = v0;
11743 switch (bindLen) {
11744 case 1:
11745 value = pipe.transform(v0);
11746 break;
11747 case 2:
11748 value = pipe.transform(v1);
11749 break;
11750 case 3:
11751 value = pipe.transform(v1, v2);
11752 break;
11753 case 4:
11754 value = pipe.transform(v1, v2, v3);
11755 break;
11756 case 5:
11757 value = pipe.transform(v1, v2, v3, v4);
11758 break;
11759 case 6:
11760 value = pipe.transform(v1, v2, v3, v4, v5);
11761 break;
11762 case 7:
11763 value = pipe.transform(v1, v2, v3, v4, v5, v6);
11764 break;
11765 case 8:
11766 value = pipe.transform(v1, v2, v3, v4, v5, v6, v7);
11767 break;
11768 case 9:
11769 value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8);
11770 break;
11771 case 10:
11772 value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8, v9);
11773 break;
11774 }
11775 break;
11776 }
11777 data.value = value;
11778 }
11779 return changed;
11780}
11781/**
11782 * @param {?} view
11783 * @param {?} def
11784 * @param {?} values
11785 * @return {?}
11786 */
11787function checkAndUpdatePureExpressionDynamic(view, def, values) {
11788 var /** @type {?} */ bindings = def.bindings;
11789 var /** @type {?} */ changed = false;
11790 for (var /** @type {?} */ i = 0; i < values.length; i++) {
11791 // Note: We need to loop over all values, so that
11792 // the old values are updates as well!
11793 if (checkAndUpdateBinding(view, def, i, values[i])) {
11794 changed = true;
11795 }
11796 }
11797 if (changed) {
11798 var /** @type {?} */ data = asPureExpressionData(view, def.index);
11799 var /** @type {?} */ value = void 0;
11800 switch (def.flags & 201347067 /* Types */) {
11801 case 32 /* TypePureArray */:
11802 value = values;
11803 break;
11804 case 64 /* TypePureObject */:
11805 value = {};
11806 for (var /** @type {?} */ i = 0; i < values.length; i++) {
11807 value[((bindings[i].name))] = values[i];
11808 }
11809 break;
11810 case 128 /* TypePurePipe */:
11811 var /** @type {?} */ pipe = values[0];
11812 var /** @type {?} */ params = values.slice(1);
11813 value = pipe.transform.apply(pipe, params);
11814 break;
11815 }
11816 data.value = value;
11817 }
11818 return changed;
11819}
11820/**
11821 * @license
11822 * Copyright Google Inc. All Rights Reserved.
11823 *
11824 * Use of this source code is governed by an MIT-style license that can be
11825 * found in the LICENSE file at https://angular.io/license
11826 */
11827/**
11828 * @param {?} ngContentIndex
11829 * @param {?} constants
11830 * @return {?}
11831 */
11832function textDef(ngContentIndex, constants) {
11833 var /** @type {?} */ bindings = new Array(constants.length - 1);
11834 for (var /** @type {?} */ i = 1; i < constants.length; i++) {
11835 bindings[i - 1] = {
11836 flags: 8 /* TypeProperty */,
11837 name: null,
11838 ns: null,
11839 nonMinifiedName: null,
11840 securityContext: null,
11841 suffix: constants[i]
11842 };
11843 }
11844 var /** @type {?} */ flags = 2;
11845 return {
11846 // will bet set by the view definition
11847 index: -1,
11848 parent: null,
11849 renderParent: null,
11850 bindingIndex: -1,
11851 outputIndex: -1,
11852 // regular values
11853 flags: flags,
11854 childFlags: 0,
11855 directChildFlags: 0,
11856 childMatchedQueries: 0,
11857 matchedQueries: {},
11858 matchedQueryIds: 0,
11859 references: {}, ngContentIndex: ngContentIndex,
11860 childCount: 0, bindings: bindings,
11861 bindingFlags: calcBindingFlags(bindings),
11862 outputs: [],
11863 element: null,
11864 provider: null,
11865 text: { prefix: constants[0] },
11866 query: null,
11867 ngContent: null
11868 };
11869}
11870/**
11871 * @param {?} view
11872 * @param {?} renderHost
11873 * @param {?} def
11874 * @return {?}
11875 */
11876function createText(view, renderHost, def) {
11877 var /** @type {?} */ renderNode$$1;
11878 var /** @type {?} */ renderer = view.renderer;
11879 renderNode$$1 = renderer.createText(/** @type {?} */ ((def.text)).prefix);
11880 var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def);
11881 if (parentEl) {
11882 renderer.appendChild(parentEl, renderNode$$1);
11883 }
11884 return { renderText: renderNode$$1 };
11885}
11886/**
11887 * @param {?} view
11888 * @param {?} def
11889 * @param {?} v0
11890 * @param {?} v1
11891 * @param {?} v2
11892 * @param {?} v3
11893 * @param {?} v4
11894 * @param {?} v5
11895 * @param {?} v6
11896 * @param {?} v7
11897 * @param {?} v8
11898 * @param {?} v9
11899 * @return {?}
11900 */
11901function checkAndUpdateTextInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
11902 var /** @type {?} */ changed = false;
11903 var /** @type {?} */ bindings = def.bindings;
11904 var /** @type {?} */ bindLen = bindings.length;
11905 if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
11906 changed = true;
11907 if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
11908 changed = true;
11909 if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
11910 changed = true;
11911 if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
11912 changed = true;
11913 if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
11914 changed = true;
11915 if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
11916 changed = true;
11917 if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
11918 changed = true;
11919 if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
11920 changed = true;
11921 if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
11922 changed = true;
11923 if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
11924 changed = true;
11925 if (changed) {
11926 var /** @type {?} */ value = ((def.text)).prefix;
11927 if (bindLen > 0)
11928 value += _addInterpolationPart(v0, bindings[0]);
11929 if (bindLen > 1)
11930 value += _addInterpolationPart(v1, bindings[1]);
11931 if (bindLen > 2)
11932 value += _addInterpolationPart(v2, bindings[2]);
11933 if (bindLen > 3)
11934 value += _addInterpolationPart(v3, bindings[3]);
11935 if (bindLen > 4)
11936 value += _addInterpolationPart(v4, bindings[4]);
11937 if (bindLen > 5)
11938 value += _addInterpolationPart(v5, bindings[5]);
11939 if (bindLen > 6)
11940 value += _addInterpolationPart(v6, bindings[6]);
11941 if (bindLen > 7)
11942 value += _addInterpolationPart(v7, bindings[7]);
11943 if (bindLen > 8)
11944 value += _addInterpolationPart(v8, bindings[8]);
11945 if (bindLen > 9)
11946 value += _addInterpolationPart(v9, bindings[9]);
11947 var /** @type {?} */ renderNode$$1 = asTextData(view, def.index).renderText;
11948 view.renderer.setValue(renderNode$$1, value);
11949 }
11950 return changed;
11951}
11952/**
11953 * @param {?} view
11954 * @param {?} def
11955 * @param {?} values
11956 * @return {?}
11957 */
11958function checkAndUpdateTextDynamic(view, def, values) {
11959 var /** @type {?} */ bindings = def.bindings;
11960 var /** @type {?} */ changed = false;
11961 for (var /** @type {?} */ i = 0; i < values.length; i++) {
11962 // Note: We need to loop over all values, so that
11963 // the old values are updates as well!
11964 if (checkAndUpdateBinding(view, def, i, values[i])) {
11965 changed = true;
11966 }
11967 }
11968 if (changed) {
11969 var /** @type {?} */ value = '';
11970 for (var /** @type {?} */ i = 0; i < values.length; i++) {
11971 value = value + _addInterpolationPart(values[i], bindings[i]);
11972 }
11973 value = ((def.text)).prefix + value;
11974 var /** @type {?} */ renderNode$$1 = asTextData(view, def.index).renderText;
11975 view.renderer.setValue(renderNode$$1, value);
11976 }
11977 return changed;
11978}
11979/**
11980 * @param {?} value
11981 * @param {?} binding
11982 * @return {?}
11983 */
11984function _addInterpolationPart(value, binding) {
11985 var /** @type {?} */ valueStr = value != null ? value.toString() : '';
11986 return valueStr + binding.suffix;
11987}
11988/**
11989 * @license
11990 * Copyright Google Inc. All Rights Reserved.
11991 *
11992 * Use of this source code is governed by an MIT-style license that can be
11993 * found in the LICENSE file at https://angular.io/license
11994 */
11995/**
11996 * @param {?} flags
11997 * @param {?} nodes
11998 * @param {?=} updateDirectives
11999 * @param {?=} updateRenderer
12000 * @return {?}
12001 */
12002function viewDef(flags, nodes, updateDirectives, updateRenderer) {
12003 // clone nodes and set auto calculated values
12004 var /** @type {?} */ viewBindingCount = 0;
12005 var /** @type {?} */ viewDisposableCount = 0;
12006 var /** @type {?} */ viewNodeFlags = 0;
12007 var /** @type {?} */ viewRootNodeFlags = 0;
12008 var /** @type {?} */ viewMatchedQueries = 0;
12009 var /** @type {?} */ currentParent = null;
12010 var /** @type {?} */ currentElementHasPublicProviders = false;
12011 var /** @type {?} */ currentElementHasPrivateProviders = false;
12012 var /** @type {?} */ lastRenderRootNode = null;
12013 for (var /** @type {?} */ i = 0; i < nodes.length; i++) {
12014 while (currentParent && i > currentParent.index + currentParent.childCount) {
12015 var /** @type {?} */ newParent = currentParent.parent;
12016 if (newParent) {
12017 newParent.childFlags |= ((currentParent.childFlags));
12018 newParent.childMatchedQueries |= currentParent.childMatchedQueries;
12019 }
12020 currentParent = newParent;
12021 }
12022 var /** @type {?} */ node = nodes[i];
12023 node.index = i;
12024 node.parent = currentParent;
12025 node.bindingIndex = viewBindingCount;
12026 node.outputIndex = viewDisposableCount;
12027 // renderParent needs to account for ng-container!
12028 var /** @type {?} */ currentRenderParent = void 0;
12029 if (currentParent && currentParent.flags & 1 /* TypeElement */ &&
12030 !((currentParent.element)).name) {
12031 currentRenderParent = currentParent.renderParent;
12032 }
12033 else {
12034 currentRenderParent = currentParent;
12035 }
12036 node.renderParent = currentRenderParent;
12037 if (node.element) {
12038 var /** @type {?} */ elDef = node.element;
12039 elDef.publicProviders =
12040 currentParent ? ((currentParent.element)).publicProviders : Object.create(null);
12041 elDef.allProviders = elDef.publicProviders;
12042 // Note: We assume that all providers of an element are before any child element!
12043 currentElementHasPublicProviders = false;
12044 currentElementHasPrivateProviders = false;
12045 }
12046 validateNode(currentParent, node, nodes.length);
12047 viewNodeFlags |= node.flags;
12048 viewMatchedQueries |= node.matchedQueryIds;
12049 if (node.element && node.element.template) {
12050 viewMatchedQueries |= node.element.template.nodeMatchedQueries;
12051 }
12052 if (currentParent) {
12053 currentParent.childFlags |= node.flags;
12054 currentParent.directChildFlags |= node.flags;
12055 currentParent.childMatchedQueries |= node.matchedQueryIds;
12056 if (node.element && node.element.template) {
12057 currentParent.childMatchedQueries |= node.element.template.nodeMatchedQueries;
12058 }
12059 }
12060 else {
12061 viewRootNodeFlags |= node.flags;
12062 }
12063 viewBindingCount += node.bindings.length;
12064 viewDisposableCount += node.outputs.length;
12065 if (!currentRenderParent && (node.flags & 3 /* CatRenderNode */)) {
12066 lastRenderRootNode = node;
12067 }
12068 if (node.flags & 20224 /* CatProvider */) {
12069 if (!currentElementHasPublicProviders) {
12070 currentElementHasPublicProviders = true; /** @type {?} */
12071 ((((
12072 // Use prototypical inheritance to not get O(n^2) complexity...
12073 currentParent)).element)).publicProviders =
12074 Object.create(/** @type {?} */ ((((currentParent)).element)).publicProviders); /** @type {?} */
12075 ((((currentParent)).element)).allProviders = ((((currentParent)).element)).publicProviders;
12076 }
12077 var /** @type {?} */ isPrivateService = (node.flags & 8192 /* PrivateProvider */) !== 0;
12078 var /** @type {?} */ isComponent = (node.flags & 32768 /* Component */) !== 0;
12079 if (!isPrivateService || isComponent) {
12080 ((((((currentParent)).element)).publicProviders))[tokenKey(/** @type {?} */ ((node.provider)).token)] = node;
12081 }
12082 else {
12083 if (!currentElementHasPrivateProviders) {
12084 currentElementHasPrivateProviders = true; /** @type {?} */
12085 ((((
12086 // Use protoyypical inheritance to not get O(n^2) complexity...
12087 currentParent)).element)).allProviders =
12088 Object.create(/** @type {?} */ ((((currentParent)).element)).publicProviders);
12089 } /** @type {?} */
12090 ((((((currentParent)).element)).allProviders))[tokenKey(/** @type {?} */ ((node.provider)).token)] = node;
12091 }
12092 if (isComponent) {
12093 ((((currentParent)).element)).componentProvider = node;
12094 }
12095 }
12096 if (node.childCount) {
12097 currentParent = node;
12098 }
12099 }
12100 while (currentParent) {
12101 var /** @type {?} */ newParent = currentParent.parent;
12102 if (newParent) {
12103 newParent.childFlags |= currentParent.childFlags;
12104 newParent.childMatchedQueries |= currentParent.childMatchedQueries;
12105 }
12106 currentParent = newParent;
12107 }
12108 var /** @type {?} */ handleEvent = function (view, nodeIndex, eventName, event) { return ((((nodes[nodeIndex].element)).handleEvent))(view, eventName, event); };
12109 return {
12110 // Will be filled later...
12111 factory: null,
12112 nodeFlags: viewNodeFlags,
12113 rootNodeFlags: viewRootNodeFlags,
12114 nodeMatchedQueries: viewMatchedQueries, flags: flags,
12115 nodes: nodes,
12116 updateDirectives: updateDirectives || NOOP,
12117 updateRenderer: updateRenderer || NOOP,
12118 handleEvent: handleEvent || NOOP,
12119 bindingCount: viewBindingCount,
12120 outputCount: viewDisposableCount, lastRenderRootNode: lastRenderRootNode
12121 };
12122}
12123/**
12124 * @param {?} parent
12125 * @param {?} node
12126 * @param {?} nodeCount
12127 * @return {?}
12128 */
12129function validateNode(parent, node, nodeCount) {
12130 var /** @type {?} */ template = node.element && node.element.template;
12131 if (template) {
12132 if (!template.lastRenderRootNode) {
12133 throw new Error("Illegal State: Embedded templates without nodes are not allowed!");
12134 }
12135 if (template.lastRenderRootNode &&
12136 template.lastRenderRootNode.flags & 16777216 /* EmbeddedViews */) {
12137 throw new Error("Illegal State: Last root node of a template can't have embedded views, at index " + node.index + "!");
12138 }
12139 }
12140 if (node.flags & 20224 /* CatProvider */) {
12141 var /** @type {?} */ parentFlags = parent ? parent.flags : 0;
12142 if ((parentFlags & 1 /* TypeElement */) === 0) {
12143 throw new Error("Illegal State: Provider/Directive nodes need to be children of elements or anchors, at index " + node.index + "!");
12144 }
12145 }
12146 if (node.query) {
12147 if (node.flags & 67108864 /* TypeContentQuery */ &&
12148 (!parent || (parent.flags & 16384 /* TypeDirective */) === 0)) {
12149 throw new Error("Illegal State: Content Query nodes need to be children of directives, at index " + node.index + "!");
12150 }
12151 if (node.flags & 134217728 /* TypeViewQuery */ && parent) {
12152 throw new Error("Illegal State: View Query nodes have to be top level nodes, at index " + node.index + "!");
12153 }
12154 }
12155 if (node.childCount) {
12156 var /** @type {?} */ parentEnd = parent ? parent.index + parent.childCount : nodeCount - 1;
12157 if (node.index <= parentEnd && node.index + node.childCount > parentEnd) {
12158 throw new Error("Illegal State: childCount of node leads outside of parent, at index " + node.index + "!");
12159 }
12160 }
12161}
12162/**
12163 * @param {?} parent
12164 * @param {?} anchorDef
12165 * @param {?} viewDef
12166 * @param {?=} context
12167 * @return {?}
12168 */
12169function createEmbeddedView(parent, anchorDef$$1, viewDef, context) {
12170 // embedded views are seen as siblings to the anchor, so we need
12171 // to get the parent of the anchor and use it as parentIndex.
12172 var /** @type {?} */ view = createView(parent.root, parent.renderer, parent, anchorDef$$1, viewDef);
12173 initView(view, parent.component, context);
12174 createViewNodes(view);
12175 return view;
12176}
12177/**
12178 * @param {?} root
12179 * @param {?} def
12180 * @param {?=} context
12181 * @return {?}
12182 */
12183function createRootView(root, def, context) {
12184 var /** @type {?} */ view = createView(root, root.renderer, null, null, def);
12185 initView(view, context, context);
12186 createViewNodes(view);
12187 return view;
12188}
12189/**
12190 * @param {?} parentView
12191 * @param {?} nodeDef
12192 * @param {?} viewDef
12193 * @param {?} hostElement
12194 * @return {?}
12195 */
12196function createComponentView(parentView, nodeDef, viewDef, hostElement) {
12197 var /** @type {?} */ rendererType = ((nodeDef.element)).componentRendererType;
12198 var /** @type {?} */ compRenderer;
12199 if (!rendererType) {
12200 compRenderer = parentView.root.renderer;
12201 }
12202 else {
12203 compRenderer = parentView.root.rendererFactory.createRenderer(hostElement, rendererType);
12204 }
12205 return createView(parentView.root, compRenderer, parentView, /** @type {?} */ ((nodeDef.element)).componentProvider, viewDef);
12206}
12207/**
12208 * @param {?} root
12209 * @param {?} renderer
12210 * @param {?} parent
12211 * @param {?} parentNodeDef
12212 * @param {?} def
12213 * @return {?}
12214 */
12215function createView(root, renderer, parent, parentNodeDef, def) {
12216 var /** @type {?} */ nodes = new Array(def.nodes.length);
12217 var /** @type {?} */ disposables = def.outputCount ? new Array(def.outputCount) : null;
12218 var /** @type {?} */ view = {
12219 def: def,
12220 parent: parent,
12221 viewContainerParent: null, parentNodeDef: parentNodeDef,
12222 context: null,
12223 component: null, nodes: nodes,
12224 state: 13 /* CatInit */, root: root, renderer: renderer,
12225 oldValues: new Array(def.bindingCount), disposables: disposables
12226 };
12227 return view;
12228}
12229/**
12230 * @param {?} view
12231 * @param {?} component
12232 * @param {?} context
12233 * @return {?}
12234 */
12235function initView(view, component, context) {
12236 view.component = component;
12237 view.context = context;
12238}
12239/**
12240 * @param {?} view
12241 * @return {?}
12242 */
12243function createViewNodes(view) {
12244 var /** @type {?} */ renderHost;
12245 if (isComponentView(view)) {
12246 var /** @type {?} */ hostDef = view.parentNodeDef;
12247 renderHost = asElementData(/** @type {?} */ ((view.parent)), /** @type {?} */ ((((hostDef)).parent)).index).renderElement;
12248 }
12249 var /** @type {?} */ def = view.def;
12250 var /** @type {?} */ nodes = view.nodes;
12251 for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
12252 var /** @type {?} */ nodeDef = def.nodes[i];
12253 Services.setCurrentNode(view, i);
12254 var /** @type {?} */ nodeData = void 0;
12255 switch (nodeDef.flags & 201347067 /* Types */) {
12256 case 1 /* TypeElement */:
12257 var /** @type {?} */ el = (createElement(view, renderHost, nodeDef));
12258 var /** @type {?} */ componentView = ((undefined));
12259 if (nodeDef.flags & 33554432 /* ComponentView */) {
12260 var /** @type {?} */ compViewDef = resolveDefinition(/** @type {?} */ ((((nodeDef.element)).componentView)));
12261 componentView = Services.createComponentView(view, nodeDef, compViewDef, el);
12262 }
12263 listenToElementOutputs(view, componentView, nodeDef, el);
12264 nodeData = ({
12265 renderElement: el,
12266 componentView: componentView,
12267 viewContainer: null,
12268 template: /** @type {?} */ ((nodeDef.element)).template ? createTemplateData(view, nodeDef) : undefined
12269 });
12270 if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
12271 nodeData.viewContainer = createViewContainerData(view, nodeDef, nodeData);
12272 }
12273 break;
12274 case 2 /* TypeText */:
12275 nodeData = (createText(view, renderHost, nodeDef));
12276 break;
12277 case 512 /* TypeClassProvider */:
12278 case 1024 /* TypeFactoryProvider */:
12279 case 2048 /* TypeUseExistingProvider */:
12280 case 256 /* TypeValueProvider */: {
12281 var /** @type {?} */ instance = createProviderInstance(view, nodeDef);
12282 nodeData = ({ instance: instance });
12283 break;
12284 }
12285 case 16 /* TypePipe */: {
12286 var /** @type {?} */ instance = createPipeInstance(view, nodeDef);
12287 nodeData = ({ instance: instance });
12288 break;
12289 }
12290 case 16384 /* TypeDirective */: {
12291 var /** @type {?} */ instance = createDirectiveInstance(view, nodeDef);
12292 nodeData = ({ instance: instance });
12293 if (nodeDef.flags & 32768 /* Component */) {
12294 var /** @type {?} */ compView = asElementData(view, /** @type {?} */ ((nodeDef.parent)).index).componentView;
12295 initView(compView, instance, instance);
12296 }
12297 break;
12298 }
12299 case 32 /* TypePureArray */:
12300 case 64 /* TypePureObject */:
12301 case 128 /* TypePurePipe */:
12302 nodeData = (createPureExpression(view, nodeDef));
12303 break;
12304 case 67108864 /* TypeContentQuery */:
12305 case 134217728 /* TypeViewQuery */:
12306 nodeData = (createQuery());
12307 break;
12308 case 8 /* TypeNgContent */:
12309 appendNgContent(view, renderHost, nodeDef);
12310 // no runtime data needed for NgContent...
12311 nodeData = undefined;
12312 break;
12313 }
12314 nodes[i] = nodeData;
12315 }
12316 // Create the ViewData.nodes of component views after we created everything else,
12317 // so that e.g. ng-content works
12318 execComponentViewsAction(view, ViewAction.CreateViewNodes);
12319 // fill static content and view queries
12320 execQueriesAction(view, 67108864 /* TypeContentQuery */ | 134217728 /* TypeViewQuery */, 268435456 /* StaticQuery */, 0 /* CheckAndUpdate */);
12321}
12322/**
12323 * @param {?} view
12324 * @return {?}
12325 */
12326function checkNoChangesView(view) {
12327 markProjectedViewsForCheck(view);
12328 Services.updateDirectives(view, 1 /* CheckNoChanges */);
12329 execEmbeddedViewsAction(view, ViewAction.CheckNoChanges);
12330 Services.updateRenderer(view, 1 /* CheckNoChanges */);
12331 execComponentViewsAction(view, ViewAction.CheckNoChanges);
12332 // Note: We don't check queries for changes as we didn't do this in v2.x.
12333 // TODO(tbosch): investigate if we can enable the check again in v5.x with a nicer error message.
12334 view.state &= ~(64 /* CheckProjectedViews */ | 32 /* CheckProjectedView */);
12335}
12336/**
12337 * @param {?} view
12338 * @return {?}
12339 */
12340function checkAndUpdateView(view) {
12341 if (view.state & 1 /* BeforeFirstCheck */) {
12342 view.state &= ~1 /* BeforeFirstCheck */;
12343 view.state |= 2 /* FirstCheck */;
12344 }
12345 else {
12346 view.state &= ~2 /* FirstCheck */;
12347 }
12348 markProjectedViewsForCheck(view);
12349 Services.updateDirectives(view, 0 /* CheckAndUpdate */);
12350 execEmbeddedViewsAction(view, ViewAction.CheckAndUpdate);
12351 execQueriesAction(view, 67108864 /* TypeContentQuery */, 536870912 /* DynamicQuery */, 0 /* CheckAndUpdate */);
12352 callLifecycleHooksChildrenFirst(view, 2097152 /* AfterContentChecked */ |
12353 (view.state & 2 /* FirstCheck */ ? 1048576 /* AfterContentInit */ : 0));
12354 Services.updateRenderer(view, 0 /* CheckAndUpdate */);
12355 execComponentViewsAction(view, ViewAction.CheckAndUpdate);
12356 execQueriesAction(view, 134217728 /* TypeViewQuery */, 536870912 /* DynamicQuery */, 0 /* CheckAndUpdate */);
12357 callLifecycleHooksChildrenFirst(view, 8388608 /* AfterViewChecked */ |
12358 (view.state & 2 /* FirstCheck */ ? 4194304 /* AfterViewInit */ : 0));
12359 if (view.def.flags & 2 /* OnPush */) {
12360 view.state &= ~8 /* ChecksEnabled */;
12361 }
12362 view.state &= ~(64 /* CheckProjectedViews */ | 32 /* CheckProjectedView */);
12363}
12364/**
12365 * @param {?} view
12366 * @param {?} nodeDef
12367 * @param {?} argStyle
12368 * @param {?=} v0
12369 * @param {?=} v1
12370 * @param {?=} v2
12371 * @param {?=} v3
12372 * @param {?=} v4
12373 * @param {?=} v5
12374 * @param {?=} v6
12375 * @param {?=} v7
12376 * @param {?=} v8
12377 * @param {?=} v9
12378 * @return {?}
12379 */
12380function checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
12381 if (argStyle === 0 /* Inline */) {
12382 return checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
12383 }
12384 else {
12385 return checkAndUpdateNodeDynamic(view, nodeDef, v0);
12386 }
12387}
12388/**
12389 * @param {?} view
12390 * @return {?}
12391 */
12392function markProjectedViewsForCheck(view) {
12393 var /** @type {?} */ def = view.def;
12394 if (!(def.nodeFlags & 4 /* ProjectedTemplate */)) {
12395 return;
12396 }
12397 for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
12398 var /** @type {?} */ nodeDef = def.nodes[i];
12399 if (nodeDef.flags & 4 /* ProjectedTemplate */) {
12400 var /** @type {?} */ projectedViews = asElementData(view, i).template._projectedViews;
12401 if (projectedViews) {
12402 for (var /** @type {?} */ i_1 = 0; i_1 < projectedViews.length; i_1++) {
12403 var /** @type {?} */ projectedView = projectedViews[i_1];
12404 projectedView.state |= 32 /* CheckProjectedView */;
12405 markParentViewsForCheckProjectedViews(projectedView, view);
12406 }
12407 }
12408 }
12409 else if ((nodeDef.childFlags & 4 /* ProjectedTemplate */) === 0) {
12410 // a parent with leafs
12411 // no child is a component,
12412 // then skip the children
12413 i += nodeDef.childCount;
12414 }
12415 }
12416}
12417/**
12418 * @param {?} view
12419 * @param {?} nodeDef
12420 * @param {?=} v0
12421 * @param {?=} v1
12422 * @param {?=} v2
12423 * @param {?=} v3
12424 * @param {?=} v4
12425 * @param {?=} v5
12426 * @param {?=} v6
12427 * @param {?=} v7
12428 * @param {?=} v8
12429 * @param {?=} v9
12430 * @return {?}
12431 */
12432function checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
12433 var /** @type {?} */ changed = false;
12434 switch (nodeDef.flags & 201347067 /* Types */) {
12435 case 1 /* TypeElement */:
12436 changed = checkAndUpdateElementInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
12437 break;
12438 case 2 /* TypeText */:
12439 changed = checkAndUpdateTextInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
12440 break;
12441 case 16384 /* TypeDirective */:
12442 changed =
12443 checkAndUpdateDirectiveInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
12444 break;
12445 case 32 /* TypePureArray */:
12446 case 64 /* TypePureObject */:
12447 case 128 /* TypePurePipe */:
12448 changed =
12449 checkAndUpdatePureExpressionInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
12450 break;
12451 }
12452 return changed;
12453}
12454/**
12455 * @param {?} view
12456 * @param {?} nodeDef
12457 * @param {?} values
12458 * @return {?}
12459 */
12460function checkAndUpdateNodeDynamic(view, nodeDef, values) {
12461 var /** @type {?} */ changed = false;
12462 switch (nodeDef.flags & 201347067 /* Types */) {
12463 case 1 /* TypeElement */:
12464 changed = checkAndUpdateElementDynamic(view, nodeDef, values);
12465 break;
12466 case 2 /* TypeText */:
12467 changed = checkAndUpdateTextDynamic(view, nodeDef, values);
12468 break;
12469 case 16384 /* TypeDirective */:
12470 changed = checkAndUpdateDirectiveDynamic(view, nodeDef, values);
12471 break;
12472 case 32 /* TypePureArray */:
12473 case 64 /* TypePureObject */:
12474 case 128 /* TypePurePipe */:
12475 changed = checkAndUpdatePureExpressionDynamic(view, nodeDef, values);
12476 break;
12477 }
12478 if (changed) {
12479 // Update oldValues after all bindings have been updated,
12480 // as a setter for a property might update other properties.
12481 var /** @type {?} */ bindLen = nodeDef.bindings.length;
12482 var /** @type {?} */ bindingStart = nodeDef.bindingIndex;
12483 var /** @type {?} */ oldValues = view.oldValues;
12484 for (var /** @type {?} */ i = 0; i < bindLen; i++) {
12485 oldValues[bindingStart + i] = values[i];
12486 }
12487 }
12488 return changed;
12489}
12490/**
12491 * @param {?} view
12492 * @param {?} nodeDef
12493 * @param {?} argStyle
12494 * @param {?=} v0
12495 * @param {?=} v1
12496 * @param {?=} v2
12497 * @param {?=} v3
12498 * @param {?=} v4
12499 * @param {?=} v5
12500 * @param {?=} v6
12501 * @param {?=} v7
12502 * @param {?=} v8
12503 * @param {?=} v9
12504 * @return {?}
12505 */
12506function checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
12507 if (argStyle === 0 /* Inline */) {
12508 checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
12509 }
12510 else {
12511 checkNoChangesNodeDynamic(view, nodeDef, v0);
12512 }
12513 // Returning false is ok here as we would have thrown in case of a change.
12514 return false;
12515}
12516/**
12517 * @param {?} view
12518 * @param {?} nodeDef
12519 * @param {?} v0
12520 * @param {?} v1
12521 * @param {?} v2
12522 * @param {?} v3
12523 * @param {?} v4
12524 * @param {?} v5
12525 * @param {?} v6
12526 * @param {?} v7
12527 * @param {?} v8
12528 * @param {?} v9
12529 * @return {?}
12530 */
12531function checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
12532 var /** @type {?} */ bindLen = nodeDef.bindings.length;
12533 if (bindLen > 0)
12534 checkBindingNoChanges(view, nodeDef, 0, v0);
12535 if (bindLen > 1)
12536 checkBindingNoChanges(view, nodeDef, 1, v1);
12537 if (bindLen > 2)
12538 checkBindingNoChanges(view, nodeDef, 2, v2);
12539 if (bindLen > 3)
12540 checkBindingNoChanges(view, nodeDef, 3, v3);
12541 if (bindLen > 4)
12542 checkBindingNoChanges(view, nodeDef, 4, v4);
12543 if (bindLen > 5)
12544 checkBindingNoChanges(view, nodeDef, 5, v5);
12545 if (bindLen > 6)
12546 checkBindingNoChanges(view, nodeDef, 6, v6);
12547 if (bindLen > 7)
12548 checkBindingNoChanges(view, nodeDef, 7, v7);
12549 if (bindLen > 8)
12550 checkBindingNoChanges(view, nodeDef, 8, v8);
12551 if (bindLen > 9)
12552 checkBindingNoChanges(view, nodeDef, 9, v9);
12553}
12554/**
12555 * @param {?} view
12556 * @param {?} nodeDef
12557 * @param {?} values
12558 * @return {?}
12559 */
12560function checkNoChangesNodeDynamic(view, nodeDef, values) {
12561 for (var /** @type {?} */ i = 0; i < values.length; i++) {
12562 checkBindingNoChanges(view, nodeDef, i, values[i]);
12563 }
12564}
12565/**
12566 * @param {?} view
12567 * @param {?} nodeDef
12568 * @return {?}
12569 */
12570function checkNoChangesQuery(view, nodeDef) {
12571 var /** @type {?} */ queryList = asQueryList(view, nodeDef.index);
12572 if (queryList.dirty) {
12573 throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, nodeDef.index), "Query " + ((nodeDef.query)).id + " not dirty", "Query " + ((nodeDef.query)).id + " dirty", (view.state & 1 /* BeforeFirstCheck */) !== 0);
12574 }
12575}
12576/**
12577 * @param {?} view
12578 * @return {?}
12579 */
12580function destroyView(view) {
12581 if (view.state & 128 /* Destroyed */) {
12582 return;
12583 }
12584 execEmbeddedViewsAction(view, ViewAction.Destroy);
12585 execComponentViewsAction(view, ViewAction.Destroy);
12586 callLifecycleHooksChildrenFirst(view, 131072 /* OnDestroy */);
12587 if (view.disposables) {
12588 for (var /** @type {?} */ i = 0; i < view.disposables.length; i++) {
12589 view.disposables[i]();
12590 }
12591 }
12592 detachProjectedView(view);
12593 if (view.renderer.destroyNode) {
12594 destroyViewNodes(view);
12595 }
12596 if (isComponentView(view)) {
12597 view.renderer.destroy();
12598 }
12599 view.state |= 128 /* Destroyed */;
12600}
12601/**
12602 * @param {?} view
12603 * @return {?}
12604 */
12605function destroyViewNodes(view) {
12606 var /** @type {?} */ len = view.def.nodes.length;
12607 for (var /** @type {?} */ i = 0; i < len; i++) {
12608 var /** @type {?} */ def = view.def.nodes[i];
12609 if (def.flags & 1 /* TypeElement */) {
12610 ((view.renderer.destroyNode))(asElementData(view, i).renderElement);
12611 }
12612 else if (def.flags & 2 /* TypeText */) {
12613 ((view.renderer.destroyNode))(asTextData(view, i).renderText);
12614 }
12615 }
12616}
12617var ViewAction = {};
12618ViewAction.CreateViewNodes = 0;
12619ViewAction.CheckNoChanges = 1;
12620ViewAction.CheckNoChangesProjectedViews = 2;
12621ViewAction.CheckAndUpdate = 3;
12622ViewAction.CheckAndUpdateProjectedViews = 4;
12623ViewAction.Destroy = 5;
12624ViewAction[ViewAction.CreateViewNodes] = "CreateViewNodes";
12625ViewAction[ViewAction.CheckNoChanges] = "CheckNoChanges";
12626ViewAction[ViewAction.CheckNoChangesProjectedViews] = "CheckNoChangesProjectedViews";
12627ViewAction[ViewAction.CheckAndUpdate] = "CheckAndUpdate";
12628ViewAction[ViewAction.CheckAndUpdateProjectedViews] = "CheckAndUpdateProjectedViews";
12629ViewAction[ViewAction.Destroy] = "Destroy";
12630/**
12631 * @param {?} view
12632 * @param {?} action
12633 * @return {?}
12634 */
12635function execComponentViewsAction(view, action) {
12636 var /** @type {?} */ def = view.def;
12637 if (!(def.nodeFlags & 33554432 /* ComponentView */)) {
12638 return;
12639 }
12640 for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
12641 var /** @type {?} */ nodeDef = def.nodes[i];
12642 if (nodeDef.flags & 33554432 /* ComponentView */) {
12643 // a leaf
12644 callViewAction(asElementData(view, i).componentView, action);
12645 }
12646 else if ((nodeDef.childFlags & 33554432 /* ComponentView */) === 0) {
12647 // a parent with leafs
12648 // no child is a component,
12649 // then skip the children
12650 i += nodeDef.childCount;
12651 }
12652 }
12653}
12654/**
12655 * @param {?} view
12656 * @param {?} action
12657 * @return {?}
12658 */
12659function execEmbeddedViewsAction(view, action) {
12660 var /** @type {?} */ def = view.def;
12661 if (!(def.nodeFlags & 16777216 /* EmbeddedViews */)) {
12662 return;
12663 }
12664 for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
12665 var /** @type {?} */ nodeDef = def.nodes[i];
12666 if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
12667 // a leaf
12668 var /** @type {?} */ embeddedViews = ((asElementData(view, i).viewContainer))._embeddedViews;
12669 for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) {
12670 callViewAction(embeddedViews[k], action);
12671 }
12672 }
12673 else if ((nodeDef.childFlags & 16777216 /* EmbeddedViews */) === 0) {
12674 // a parent with leafs
12675 // no child is a component,
12676 // then skip the children
12677 i += nodeDef.childCount;
12678 }
12679 }
12680}
12681/**
12682 * @param {?} view
12683 * @param {?} action
12684 * @return {?}
12685 */
12686function callViewAction(view, action) {
12687 var /** @type {?} */ viewState = view.state;
12688 switch (action) {
12689 case ViewAction.CheckNoChanges:
12690 if ((viewState & 128 /* Destroyed */) === 0) {
12691 if ((viewState & 12 /* CatDetectChanges */) === 12 /* CatDetectChanges */) {
12692 checkNoChangesView(view);
12693 }
12694 else if (viewState & 64 /* CheckProjectedViews */) {
12695 execProjectedViewsAction(view, ViewAction.CheckNoChangesProjectedViews);
12696 }
12697 }
12698 break;
12699 case ViewAction.CheckNoChangesProjectedViews:
12700 if ((viewState & 128 /* Destroyed */) === 0) {
12701 if (viewState & 32 /* CheckProjectedView */) {
12702 checkNoChangesView(view);
12703 }
12704 else if (viewState & 64 /* CheckProjectedViews */) {
12705 execProjectedViewsAction(view, action);
12706 }
12707 }
12708 break;
12709 case ViewAction.CheckAndUpdate:
12710 if ((viewState & 128 /* Destroyed */) === 0) {
12711 if ((viewState & 12 /* CatDetectChanges */) === 12 /* CatDetectChanges */) {
12712 checkAndUpdateView(view);
12713 }
12714 else if (viewState & 64 /* CheckProjectedViews */) {
12715 execProjectedViewsAction(view, ViewAction.CheckAndUpdateProjectedViews);
12716 }
12717 }
12718 break;
12719 case ViewAction.CheckAndUpdateProjectedViews:
12720 if ((viewState & 128 /* Destroyed */) === 0) {
12721 if (viewState & 32 /* CheckProjectedView */) {
12722 checkAndUpdateView(view);
12723 }
12724 else if (viewState & 64 /* CheckProjectedViews */) {
12725 execProjectedViewsAction(view, action);
12726 }
12727 }
12728 break;
12729 case ViewAction.Destroy:
12730 // Note: destroyView recurses over all views,
12731 // so we don't need to special case projected views here.
12732 destroyView(view);
12733 break;
12734 case ViewAction.CreateViewNodes:
12735 createViewNodes(view);
12736 break;
12737 }
12738}
12739/**
12740 * @param {?} view
12741 * @param {?} action
12742 * @return {?}
12743 */
12744function execProjectedViewsAction(view, action) {
12745 execEmbeddedViewsAction(view, action);
12746 execComponentViewsAction(view, action);
12747}
12748/**
12749 * @param {?} view
12750 * @param {?} queryFlags
12751 * @param {?} staticDynamicQueryFlag
12752 * @param {?} checkType
12753 * @return {?}
12754 */
12755function execQueriesAction(view, queryFlags, staticDynamicQueryFlag, checkType) {
12756 if (!(view.def.nodeFlags & queryFlags) || !(view.def.nodeFlags & staticDynamicQueryFlag)) {
12757 return;
12758 }
12759 var /** @type {?} */ nodeCount = view.def.nodes.length;
12760 for (var /** @type {?} */ i = 0; i < nodeCount; i++) {
12761 var /** @type {?} */ nodeDef = view.def.nodes[i];
12762 if ((nodeDef.flags & queryFlags) && (nodeDef.flags & staticDynamicQueryFlag)) {
12763 Services.setCurrentNode(view, nodeDef.index);
12764 switch (checkType) {
12765 case 0 /* CheckAndUpdate */:
12766 checkAndUpdateQuery(view, nodeDef);
12767 break;
12768 case 1 /* CheckNoChanges */:
12769 checkNoChangesQuery(view, nodeDef);
12770 break;
12771 }
12772 }
12773 if (!(nodeDef.childFlags & queryFlags) || !(nodeDef.childFlags & staticDynamicQueryFlag)) {
12774 // no child has a matching query
12775 // then skip the children
12776 i += nodeDef.childCount;
12777 }
12778 }
12779}
12780/**
12781 * @license
12782 * Copyright Google Inc. All Rights Reserved.
12783 *
12784 * Use of this source code is governed by an MIT-style license that can be
12785 * found in the LICENSE file at https://angular.io/license
12786 */
12787var initialized = false;
12788/**
12789 * @return {?}
12790 */
12791function initServicesIfNeeded() {
12792 if (initialized) {
12793 return;
12794 }
12795 initialized = true;
12796 var /** @type {?} */ services = isDevMode() ? createDebugServices() : createProdServices();
12797 Services.setCurrentNode = services.setCurrentNode;
12798 Services.createRootView = services.createRootView;
12799 Services.createEmbeddedView = services.createEmbeddedView;
12800 Services.createComponentView = services.createComponentView;
12801 Services.createNgModuleRef = services.createNgModuleRef;
12802 Services.overrideProvider = services.overrideProvider;
12803 Services.clearProviderOverrides = services.clearProviderOverrides;
12804 Services.checkAndUpdateView = services.checkAndUpdateView;
12805 Services.checkNoChangesView = services.checkNoChangesView;
12806 Services.destroyView = services.destroyView;
12807 Services.resolveDep = resolveDep;
12808 Services.createDebugContext = services.createDebugContext;
12809 Services.handleEvent = services.handleEvent;
12810 Services.updateDirectives = services.updateDirectives;
12811 Services.updateRenderer = services.updateRenderer;
12812 Services.dirtyParentQueries = dirtyParentQueries;
12813}
12814/**
12815 * @return {?}
12816 */
12817function createProdServices() {
12818 return {
12819 setCurrentNode: function () { },
12820 createRootView: createProdRootView,
12821 createEmbeddedView: createEmbeddedView,
12822 createComponentView: createComponentView,
12823 createNgModuleRef: createNgModuleRef,
12824 overrideProvider: NOOP,
12825 clearProviderOverrides: NOOP,
12826 checkAndUpdateView: checkAndUpdateView,
12827 checkNoChangesView: checkNoChangesView,
12828 destroyView: destroyView,
12829 createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); },
12830 handleEvent: function (view, nodeIndex, eventName, event) { return view.def.handleEvent(view, nodeIndex, eventName, event); },
12831 updateDirectives: function (view, checkType) { return view.def.updateDirectives(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode :
12832 prodCheckNoChangesNode, view); },
12833 updateRenderer: function (view, checkType) { return view.def.updateRenderer(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode :
12834 prodCheckNoChangesNode, view); },
12835 };
12836}
12837/**
12838 * @return {?}
12839 */
12840function createDebugServices() {
12841 return {
12842 setCurrentNode: debugSetCurrentNode,
12843 createRootView: debugCreateRootView,
12844 createEmbeddedView: debugCreateEmbeddedView,
12845 createComponentView: debugCreateComponentView,
12846 createNgModuleRef: debugCreateNgModuleRef,
12847 overrideProvider: debugOverrideProvider,
12848 clearProviderOverrides: debugClearProviderOverrides,
12849 checkAndUpdateView: debugCheckAndUpdateView,
12850 checkNoChangesView: debugCheckNoChangesView,
12851 destroyView: debugDestroyView,
12852 createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); },
12853 handleEvent: debugHandleEvent,
12854 updateDirectives: debugUpdateDirectives,
12855 updateRenderer: debugUpdateRenderer,
12856 };
12857}
12858/**
12859 * @param {?} elInjector
12860 * @param {?} projectableNodes
12861 * @param {?} rootSelectorOrNode
12862 * @param {?} def
12863 * @param {?} ngModule
12864 * @param {?=} context
12865 * @return {?}
12866 */
12867function createProdRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
12868 var /** @type {?} */ rendererFactory = ngModule.injector.get(RendererFactory2);
12869 return createRootView(createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode), def, context);
12870}
12871/**
12872 * @param {?} elInjector
12873 * @param {?} projectableNodes
12874 * @param {?} rootSelectorOrNode
12875 * @param {?} def
12876 * @param {?} ngModule
12877 * @param {?=} context
12878 * @return {?}
12879 */
12880function debugCreateRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
12881 var /** @type {?} */ rendererFactory = ngModule.injector.get(RendererFactory2);
12882 var /** @type {?} */ root = createRootData(elInjector, ngModule, new DebugRendererFactory2(rendererFactory), projectableNodes, rootSelectorOrNode);
12883 var /** @type {?} */ defWithOverride = applyProviderOverridesToView(def);
12884 return callWithDebugContext(DebugAction.create, createRootView, null, [root, defWithOverride, context]);
12885}
12886/**
12887 * @param {?} elInjector
12888 * @param {?} ngModule
12889 * @param {?} rendererFactory
12890 * @param {?} projectableNodes
12891 * @param {?} rootSelectorOrNode
12892 * @return {?}
12893 */
12894function createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode) {
12895 var /** @type {?} */ sanitizer = ngModule.injector.get(Sanitizer);
12896 var /** @type {?} */ errorHandler = ngModule.injector.get(ErrorHandler);
12897 var /** @type {?} */ renderer = rendererFactory.createRenderer(null, null);
12898 return {
12899 ngModule: ngModule,
12900 injector: elInjector, projectableNodes: projectableNodes,
12901 selectorOrNode: rootSelectorOrNode, sanitizer: sanitizer, rendererFactory: rendererFactory, renderer: renderer, errorHandler: errorHandler
12902 };
12903}
12904/**
12905 * @param {?} parentView
12906 * @param {?} anchorDef
12907 * @param {?} viewDef
12908 * @param {?=} context
12909 * @return {?}
12910 */
12911function debugCreateEmbeddedView(parentView, anchorDef, viewDef$$1, context) {
12912 var /** @type {?} */ defWithOverride = applyProviderOverridesToView(viewDef$$1);
12913 return callWithDebugContext(DebugAction.create, createEmbeddedView, null, [parentView, anchorDef, defWithOverride, context]);
12914}
12915/**
12916 * @param {?} parentView
12917 * @param {?} nodeDef
12918 * @param {?} viewDef
12919 * @param {?} hostElement
12920 * @return {?}
12921 */
12922function debugCreateComponentView(parentView, nodeDef, viewDef$$1, hostElement) {
12923 var /** @type {?} */ defWithOverride = applyProviderOverridesToView(viewDef$$1);
12924 return callWithDebugContext(DebugAction.create, createComponentView, null, [parentView, nodeDef, defWithOverride, hostElement]);
12925}
12926/**
12927 * @param {?} moduleType
12928 * @param {?} parentInjector
12929 * @param {?} bootstrapComponents
12930 * @param {?} def
12931 * @return {?}
12932 */
12933function debugCreateNgModuleRef(moduleType, parentInjector, bootstrapComponents, def) {
12934 var /** @type {?} */ defWithOverride = applyProviderOverridesToNgModule(def);
12935 return createNgModuleRef(moduleType, parentInjector, bootstrapComponents, defWithOverride);
12936}
12937var providerOverrides = new Map();
12938/**
12939 * @param {?} override
12940 * @return {?}
12941 */
12942function debugOverrideProvider(override) {
12943 providerOverrides.set(override.token, override);
12944}
12945/**
12946 * @return {?}
12947 */
12948function debugClearProviderOverrides() {
12949 providerOverrides.clear();
12950}
12951/**
12952 * @param {?} def
12953 * @return {?}
12954 */
12955function applyProviderOverridesToView(def) {
12956 if (providerOverrides.size === 0) {
12957 return def;
12958 }
12959 var /** @type {?} */ elementIndicesWithOverwrittenProviders = findElementIndicesWithOverwrittenProviders(def);
12960 if (elementIndicesWithOverwrittenProviders.length === 0) {
12961 return def;
12962 }
12963 // clone the whole view definition,
12964 // as it maintains references between the nodes that are hard to update.
12965 def = ((def.factory))(function () { return NOOP; });
12966 for (var /** @type {?} */ i = 0; i < elementIndicesWithOverwrittenProviders.length; i++) {
12967 applyProviderOverridesToElement(def, elementIndicesWithOverwrittenProviders[i]);
12968 }
12969 return def;
12970 /**
12971 * @param {?} def
12972 * @return {?}
12973 */
12974 function findElementIndicesWithOverwrittenProviders(def) {
12975 var /** @type {?} */ elIndicesWithOverwrittenProviders = [];
12976 var /** @type {?} */ lastElementDef = null;
12977 for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) {
12978 var /** @type {?} */ nodeDef = def.nodes[i];
12979 if (nodeDef.flags & 1 /* TypeElement */) {
12980 lastElementDef = nodeDef;
12981 }
12982 if (lastElementDef && nodeDef.flags & 3840 /* CatProviderNoDirective */ &&
12983 providerOverrides.has(/** @type {?} */ ((nodeDef.provider)).token)) {
12984 elIndicesWithOverwrittenProviders.push(/** @type {?} */ ((lastElementDef)).index);
12985 lastElementDef = null;
12986 }
12987 }
12988 return elIndicesWithOverwrittenProviders;
12989 }
12990 /**
12991 * @param {?} viewDef
12992 * @param {?} elIndex
12993 * @return {?}
12994 */
12995 function applyProviderOverridesToElement(viewDef$$1, elIndex) {
12996 for (var /** @type {?} */ i = elIndex + 1; i < viewDef$$1.nodes.length; i++) {
12997 var /** @type {?} */ nodeDef = viewDef$$1.nodes[i];
12998 if (nodeDef.flags & 1 /* TypeElement */) {
12999 // stop at the next element
13000 return;
13001 }
13002 if (nodeDef.flags & 3840 /* CatProviderNoDirective */) {
13003 // Make all providers lazy, so that we don't get into trouble
13004 // with ordering problems of providers on the same element
13005 nodeDef.flags |= 4096 /* LazyProvider */;
13006 var /** @type {?} */ provider = ((nodeDef.provider));
13007 var /** @type {?} */ override = providerOverrides.get(provider.token);
13008 if (override) {
13009 nodeDef.flags = (nodeDef.flags & ~3840 /* CatProviderNoDirective */) | override.flags;
13010 provider.deps = splitDepsDsl(override.deps);
13011 provider.value = override.value;
13012 }
13013 }
13014 }
13015 }
13016}
13017/**
13018 * @param {?} def
13019 * @return {?}
13020 */
13021function applyProviderOverridesToNgModule(def) {
13022 if (providerOverrides.size === 0 || !hasOverrrides(def)) {
13023 return def;
13024 }
13025 // clone the whole view definition,
13026 // as it maintains references between the nodes that are hard to update.
13027 def = ((def.factory))(function () { return NOOP; });
13028 applyProviderOverrides(def);
13029 return def;
13030 /**
13031 * @param {?} def
13032 * @return {?}
13033 */
13034 function hasOverrrides(def) {
13035 return def.providers.some(function (node) { return !!(node.flags & 3840 /* CatProviderNoDirective */) && providerOverrides.has(node.token); });
13036 }
13037 /**
13038 * @param {?} def
13039 * @return {?}
13040 */
13041 function applyProviderOverrides(def) {
13042 for (var /** @type {?} */ i = 0; i < def.providers.length; i++) {
13043 var /** @type {?} */ provider = def.providers[i];
13044 // Make all providers lazy, so that we don't get into trouble
13045 // with ordering problems of providers on the same element
13046 provider.flags |= 4096 /* LazyProvider */;
13047 var /** @type {?} */ override = providerOverrides.get(provider.token);
13048 if (override) {
13049 provider.flags = (provider.flags & ~3840 /* CatProviderNoDirective */) | override.flags;
13050 provider.deps = splitDepsDsl(override.deps);
13051 provider.value = override.value;
13052 }
13053 }
13054 }
13055}
13056/**
13057 * @param {?} view
13058 * @param {?} nodeIndex
13059 * @param {?} argStyle
13060 * @param {?=} v0
13061 * @param {?=} v1
13062 * @param {?=} v2
13063 * @param {?=} v3
13064 * @param {?=} v4
13065 * @param {?=} v5
13066 * @param {?=} v6
13067 * @param {?=} v7
13068 * @param {?=} v8
13069 * @param {?=} v9
13070 * @return {?}
13071 */
13072function prodCheckAndUpdateNode(view, nodeIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
13073 var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
13074 checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
13075 return (nodeDef.flags & 224 /* CatPureExpression */) ?
13076 asPureExpressionData(view, nodeIndex).value :
13077 undefined;
13078}
13079/**
13080 * @param {?} view
13081 * @param {?} nodeIndex
13082 * @param {?} argStyle
13083 * @param {?=} v0
13084 * @param {?=} v1
13085 * @param {?=} v2
13086 * @param {?=} v3
13087 * @param {?=} v4
13088 * @param {?=} v5
13089 * @param {?=} v6
13090 * @param {?=} v7
13091 * @param {?=} v8
13092 * @param {?=} v9
13093 * @return {?}
13094 */
13095function prodCheckNoChangesNode(view, nodeIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
13096 var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
13097 checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
13098 return (nodeDef.flags & 224 /* CatPureExpression */) ?
13099 asPureExpressionData(view, nodeIndex).value :
13100 undefined;
13101}
13102/**
13103 * @param {?} view
13104 * @return {?}
13105 */
13106function debugCheckAndUpdateView(view) {
13107 return callWithDebugContext(DebugAction.detectChanges, checkAndUpdateView, null, [view]);
13108}
13109/**
13110 * @param {?} view
13111 * @return {?}
13112 */
13113function debugCheckNoChangesView(view) {
13114 return callWithDebugContext(DebugAction.checkNoChanges, checkNoChangesView, null, [view]);
13115}
13116/**
13117 * @param {?} view
13118 * @return {?}
13119 */
13120function debugDestroyView(view) {
13121 return callWithDebugContext(DebugAction.destroy, destroyView, null, [view]);
13122}
13123var DebugAction = {};
13124DebugAction.create = 0;
13125DebugAction.detectChanges = 1;
13126DebugAction.checkNoChanges = 2;
13127DebugAction.destroy = 3;
13128DebugAction.handleEvent = 4;
13129DebugAction[DebugAction.create] = "create";
13130DebugAction[DebugAction.detectChanges] = "detectChanges";
13131DebugAction[DebugAction.checkNoChanges] = "checkNoChanges";
13132DebugAction[DebugAction.destroy] = "destroy";
13133DebugAction[DebugAction.handleEvent] = "handleEvent";
13134var _currentAction;
13135var _currentView;
13136var _currentNodeIndex;
13137/**
13138 * @param {?} view
13139 * @param {?} nodeIndex
13140 * @return {?}
13141 */
13142function debugSetCurrentNode(view, nodeIndex) {
13143 _currentView = view;
13144 _currentNodeIndex = nodeIndex;
13145}
13146/**
13147 * @param {?} view
13148 * @param {?} nodeIndex
13149 * @param {?} eventName
13150 * @param {?} event
13151 * @return {?}
13152 */
13153function debugHandleEvent(view, nodeIndex, eventName, event) {
13154 debugSetCurrentNode(view, nodeIndex);
13155 return callWithDebugContext(DebugAction.handleEvent, view.def.handleEvent, null, [view, nodeIndex, eventName, event]);
13156}
13157/**
13158 * @param {?} view
13159 * @param {?} checkType
13160 * @return {?}
13161 */
13162function debugUpdateDirectives(view, checkType) {
13163 if (view.state & 128 /* Destroyed */) {
13164 throw viewDestroyedError(DebugAction[_currentAction]);
13165 }
13166 debugSetCurrentNode(view, nextDirectiveWithBinding(view, 0));
13167 return view.def.updateDirectives(debugCheckDirectivesFn, view);
13168 /**
13169 * @param {?} view
13170 * @param {?} nodeIndex
13171 * @param {?} argStyle
13172 * @param {...?} values
13173 * @return {?}
13174 */
13175 function debugCheckDirectivesFn(view, nodeIndex, argStyle) {
13176 var values = [];
13177 for (var _i = 3; _i < arguments.length; _i++) {
13178 values[_i - 3] = arguments[_i];
13179 }
13180 var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
13181 if (checkType === 0 /* CheckAndUpdate */) {
13182 debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
13183 }
13184 else {
13185 debugCheckNoChangesNode(view, nodeDef, argStyle, values);
13186 }
13187 if (nodeDef.flags & 16384 /* TypeDirective */) {
13188 debugSetCurrentNode(view, nextDirectiveWithBinding(view, nodeIndex));
13189 }
13190 return (nodeDef.flags & 224 /* CatPureExpression */) ?
13191 asPureExpressionData(view, nodeDef.index).value :
13192 undefined;
13193 }
13194}
13195/**
13196 * @param {?} view
13197 * @param {?} checkType
13198 * @return {?}
13199 */
13200function debugUpdateRenderer(view, checkType) {
13201 if (view.state & 128 /* Destroyed */) {
13202 throw viewDestroyedError(DebugAction[_currentAction]);
13203 }
13204 debugSetCurrentNode(view, nextRenderNodeWithBinding(view, 0));
13205 return view.def.updateRenderer(debugCheckRenderNodeFn, view);
13206 /**
13207 * @param {?} view
13208 * @param {?} nodeIndex
13209 * @param {?} argStyle
13210 * @param {...?} values
13211 * @return {?}
13212 */
13213 function debugCheckRenderNodeFn(view, nodeIndex, argStyle) {
13214 var values = [];
13215 for (var _i = 3; _i < arguments.length; _i++) {
13216 values[_i - 3] = arguments[_i];
13217 }
13218 var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex];
13219 if (checkType === 0 /* CheckAndUpdate */) {
13220 debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
13221 }
13222 else {
13223 debugCheckNoChangesNode(view, nodeDef, argStyle, values);
13224 }
13225 if (nodeDef.flags & 3 /* CatRenderNode */) {
13226 debugSetCurrentNode(view, nextRenderNodeWithBinding(view, nodeIndex));
13227 }
13228 return (nodeDef.flags & 224 /* CatPureExpression */) ?
13229 asPureExpressionData(view, nodeDef.index).value :
13230 undefined;
13231 }
13232}
13233/**
13234 * @param {?} view
13235 * @param {?} nodeDef
13236 * @param {?} argStyle
13237 * @param {?} givenValues
13238 * @return {?}
13239 */
13240function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) {
13241 var /** @type {?} */ changed = ((checkAndUpdateNode)).apply(void 0, [view, nodeDef, argStyle].concat(givenValues));
13242 if (changed) {
13243 var /** @type {?} */ values = argStyle === 1 /* Dynamic */ ? givenValues[0] : givenValues;
13244 if (nodeDef.flags & 16384 /* TypeDirective */) {
13245 var /** @type {?} */ bindingValues = {};
13246 for (var /** @type {?} */ i = 0; i < nodeDef.bindings.length; i++) {
13247 var /** @type {?} */ binding = nodeDef.bindings[i];
13248 var /** @type {?} */ value = values[i];
13249 if (binding.flags & 8 /* TypeProperty */) {
13250 bindingValues[normalizeDebugBindingName(/** @type {?} */ ((binding.nonMinifiedName)))] =
13251 normalizeDebugBindingValue(value);
13252 }
13253 }
13254 var /** @type {?} */ elDef = ((nodeDef.parent));
13255 var /** @type {?} */ el = asElementData(view, elDef.index).renderElement;
13256 if (!((elDef.element)).name) {
13257 // a comment.
13258 view.renderer.setValue(el, "bindings=" + JSON.stringify(bindingValues, null, 2));
13259 }
13260 else {
13261 // a regular element.
13262 for (var /** @type {?} */ attr in bindingValues) {
13263 var /** @type {?} */ value = bindingValues[attr];
13264 if (value != null) {
13265 view.renderer.setAttribute(el, attr, value);
13266 }
13267 else {
13268 view.renderer.removeAttribute(el, attr);
13269 }
13270 }
13271 }
13272 }
13273 }
13274}
13275/**
13276 * @param {?} view
13277 * @param {?} nodeDef
13278 * @param {?} argStyle
13279 * @param {?} values
13280 * @return {?}
13281 */
13282function debugCheckNoChangesNode(view, nodeDef, argStyle, values) {
13283 ((checkNoChangesNode)).apply(void 0, [view, nodeDef, argStyle].concat(values));
13284}
13285/**
13286 * @param {?} name
13287 * @return {?}
13288 */
13289function normalizeDebugBindingName(name) {
13290 // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
13291 name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
13292 return "ng-reflect-" + name;
13293}
13294var CAMEL_CASE_REGEXP = /([A-Z])/g;
13295/**
13296 * @param {?} input
13297 * @return {?}
13298 */
13299function camelCaseToDashCase(input) {
13300 return input.replace(CAMEL_CASE_REGEXP, function () {
13301 var m = [];
13302 for (var _i = 0; _i < arguments.length; _i++) {
13303 m[_i] = arguments[_i];
13304 }
13305 return '-' + m[1].toLowerCase();
13306 });
13307}
13308/**
13309 * @param {?} value
13310 * @return {?}
13311 */
13312function normalizeDebugBindingValue(value) {
13313 try {
13314 // Limit the size of the value as otherwise the DOM just gets polluted.
13315 return value != null ? value.toString().slice(0, 30) : value;
13316 }
13317 catch (e) {
13318 return '[ERROR] Exception while trying to serialize the value';
13319 }
13320}
13321/**
13322 * @param {?} view
13323 * @param {?} nodeIndex
13324 * @return {?}
13325 */
13326function nextDirectiveWithBinding(view, nodeIndex) {
13327 for (var /** @type {?} */ i = nodeIndex; i < view.def.nodes.length; i++) {
13328 var /** @type {?} */ nodeDef = view.def.nodes[i];
13329 if (nodeDef.flags & 16384 /* TypeDirective */ && nodeDef.bindings && nodeDef.bindings.length) {
13330 return i;
13331 }
13332 }
13333 return null;
13334}
13335/**
13336 * @param {?} view
13337 * @param {?} nodeIndex
13338 * @return {?}
13339 */
13340function nextRenderNodeWithBinding(view, nodeIndex) {
13341 for (var /** @type {?} */ i = nodeIndex; i < view.def.nodes.length; i++) {
13342 var /** @type {?} */ nodeDef = view.def.nodes[i];
13343 if ((nodeDef.flags & 3 /* CatRenderNode */) && nodeDef.bindings && nodeDef.bindings.length) {
13344 return i;
13345 }
13346 }
13347 return null;
13348}
13349var DebugContext_ = (function () {
13350 /**
13351 * @param {?} view
13352 * @param {?} nodeIndex
13353 */
13354 function DebugContext_(view, nodeIndex) {
13355 this.view = view;
13356 this.nodeIndex = nodeIndex;
13357 if (nodeIndex == null) {
13358 this.nodeIndex = nodeIndex = 0;
13359 }
13360 this.nodeDef = view.def.nodes[nodeIndex];
13361 var elDef = this.nodeDef;
13362 var elView = view;
13363 while (elDef && (elDef.flags & 1 /* TypeElement */) === 0) {
13364 elDef = elDef.parent;
13365 }
13366 if (!elDef) {
13367 while (!elDef && elView) {
13368 elDef = viewParentEl(elView);
13369 elView = elView.parent;
13370 }
13371 }
13372 this.elDef = elDef;
13373 this.elView = elView;
13374 }
13375 Object.defineProperty(DebugContext_.prototype, "elOrCompView", {
13376 /**
13377 * @return {?}
13378 */
13379 get: function () {
13380 // Has to be done lazily as we use the DebugContext also during creation of elements...
13381 return asElementData(this.elView, this.elDef.index).componentView || this.view;
13382 },
13383 enumerable: true,
13384 configurable: true
13385 });
13386 Object.defineProperty(DebugContext_.prototype, "injector", {
13387 /**
13388 * @return {?}
13389 */
13390 get: function () { return createInjector(this.elView, this.elDef); },
13391 enumerable: true,
13392 configurable: true
13393 });
13394 Object.defineProperty(DebugContext_.prototype, "component", {
13395 /**
13396 * @return {?}
13397 */
13398 get: function () { return this.elOrCompView.component; },
13399 enumerable: true,
13400 configurable: true
13401 });
13402 Object.defineProperty(DebugContext_.prototype, "context", {
13403 /**
13404 * @return {?}
13405 */
13406 get: function () { return this.elOrCompView.context; },
13407 enumerable: true,
13408 configurable: true
13409 });
13410 Object.defineProperty(DebugContext_.prototype, "providerTokens", {
13411 /**
13412 * @return {?}
13413 */
13414 get: function () {
13415 var /** @type {?} */ tokens = [];
13416 if (this.elDef) {
13417 for (var /** @type {?} */ i = this.elDef.index + 1; i <= this.elDef.index + this.elDef.childCount; i++) {
13418 var /** @type {?} */ childDef = this.elView.def.nodes[i];
13419 if (childDef.flags & 20224 /* CatProvider */) {
13420 tokens.push(/** @type {?} */ ((childDef.provider)).token);
13421 }
13422 i += childDef.childCount;
13423 }
13424 }
13425 return tokens;
13426 },
13427 enumerable: true,
13428 configurable: true
13429 });
13430 Object.defineProperty(DebugContext_.prototype, "references", {
13431 /**
13432 * @return {?}
13433 */
13434 get: function () {
13435 var /** @type {?} */ references = {};
13436 if (this.elDef) {
13437 collectReferences(this.elView, this.elDef, references);
13438 for (var /** @type {?} */ i = this.elDef.index + 1; i <= this.elDef.index + this.elDef.childCount; i++) {
13439 var /** @type {?} */ childDef = this.elView.def.nodes[i];
13440 if (childDef.flags & 20224 /* CatProvider */) {
13441 collectReferences(this.elView, childDef, references);
13442 }
13443 i += childDef.childCount;
13444 }
13445 }
13446 return references;
13447 },
13448 enumerable: true,
13449 configurable: true
13450 });
13451 Object.defineProperty(DebugContext_.prototype, "componentRenderElement", {
13452 /**
13453 * @return {?}
13454 */
13455 get: function () {
13456 var /** @type {?} */ elData = findHostElement(this.elOrCompView);
13457 return elData ? elData.renderElement : undefined;
13458 },
13459 enumerable: true,
13460 configurable: true
13461 });
13462 Object.defineProperty(DebugContext_.prototype, "renderNode", {
13463 /**
13464 * @return {?}
13465 */
13466 get: function () {
13467 return this.nodeDef.flags & 2 /* TypeText */ ? renderNode(this.view, this.nodeDef) :
13468 renderNode(this.elView, this.elDef);
13469 },
13470 enumerable: true,
13471 configurable: true
13472 });
13473 /**
13474 * @param {?} console
13475 * @param {...?} values
13476 * @return {?}
13477 */
13478 DebugContext_.prototype.logError = function (console) {
13479 var values = [];
13480 for (var _i = 1; _i < arguments.length; _i++) {
13481 values[_i - 1] = arguments[_i];
13482 }
13483 var /** @type {?} */ logViewDef;
13484 var /** @type {?} */ logNodeIndex;
13485 if (this.nodeDef.flags & 2 /* TypeText */) {
13486 logViewDef = this.view.def;
13487 logNodeIndex = this.nodeDef.index;
13488 }
13489 else {
13490 logViewDef = this.elView.def;
13491 logNodeIndex = this.elDef.index;
13492 }
13493 // Note: we only generate a log function for text and element nodes
13494 // to make the generated code as small as possible.
13495 var /** @type {?} */ renderNodeIndex = getRenderNodeIndex(logViewDef, logNodeIndex);
13496 var /** @type {?} */ currRenderNodeIndex = -1;
13497 var /** @type {?} */ nodeLogger = function () {
13498 currRenderNodeIndex++;
13499 if (currRenderNodeIndex === renderNodeIndex) {
13500 return (_a = console.error).bind.apply(_a, [console].concat(values));
13501 }
13502 else {
13503 return NOOP;
13504 }
13505 var _a;
13506 }; /** @type {?} */
13507 ((logViewDef.factory))(nodeLogger);
13508 if (currRenderNodeIndex < renderNodeIndex) {
13509 console.error('Illegal state: the ViewDefinitionFactory did not call the logger!');
13510 console.error.apply(console, values);
13511 }
13512 };
13513 return DebugContext_;
13514}());
13515/**
13516 * @param {?} viewDef
13517 * @param {?} nodeIndex
13518 * @return {?}
13519 */
13520function getRenderNodeIndex(viewDef$$1, nodeIndex) {
13521 var /** @type {?} */ renderNodeIndex = -1;
13522 for (var /** @type {?} */ i = 0; i <= nodeIndex; i++) {
13523 var /** @type {?} */ nodeDef = viewDef$$1.nodes[i];
13524 if (nodeDef.flags & 3 /* CatRenderNode */) {
13525 renderNodeIndex++;
13526 }
13527 }
13528 return renderNodeIndex;
13529}
13530/**
13531 * @param {?} view
13532 * @return {?}
13533 */
13534function findHostElement(view) {
13535 while (view && !isComponentView(view)) {
13536 view = ((view.parent));
13537 }
13538 if (view.parent) {
13539 return asElementData(view.parent, /** @type {?} */ ((viewParentEl(view))).index);
13540 }
13541 return null;
13542}
13543/**
13544 * @param {?} view
13545 * @param {?} nodeDef
13546 * @param {?} references
13547 * @return {?}
13548 */
13549function collectReferences(view, nodeDef, references) {
13550 for (var /** @type {?} */ refName in nodeDef.references) {
13551 references[refName] = getQueryValue(view, nodeDef, nodeDef.references[refName]);
13552 }
13553}
13554/**
13555 * @param {?} action
13556 * @param {?} fn
13557 * @param {?} self
13558 * @param {?} args
13559 * @return {?}
13560 */
13561function callWithDebugContext(action, fn, self, args) {
13562 var /** @type {?} */ oldAction = _currentAction;
13563 var /** @type {?} */ oldView = _currentView;
13564 var /** @type {?} */ oldNodeIndex = _currentNodeIndex;
13565 try {
13566 _currentAction = action;
13567 var /** @type {?} */ result = fn.apply(self, args);
13568 _currentView = oldView;
13569 _currentNodeIndex = oldNodeIndex;
13570 _currentAction = oldAction;
13571 return result;
13572 }
13573 catch (e) {
13574 if (isViewDebugError(e) || !_currentView) {
13575 throw e;
13576 }
13577 throw viewWrappedDebugError(e, /** @type {?} */ ((getCurrentDebugContext())));
13578 }
13579}
13580/**
13581 * @return {?}
13582 */
13583function getCurrentDebugContext() {
13584 return _currentView ? new DebugContext_(_currentView, _currentNodeIndex) : null;
13585}
13586var DebugRendererFactory2 = (function () {
13587 /**
13588 * @param {?} delegate
13589 */
13590 function DebugRendererFactory2(delegate) {
13591 this.delegate = delegate;
13592 }
13593 /**
13594 * @param {?} element
13595 * @param {?} renderData
13596 * @return {?}
13597 */
13598 DebugRendererFactory2.prototype.createRenderer = function (element, renderData) {
13599 return new DebugRenderer2(this.delegate.createRenderer(element, renderData));
13600 };
13601 /**
13602 * @return {?}
13603 */
13604 DebugRendererFactory2.prototype.begin = function () {
13605 if (this.delegate.begin) {
13606 this.delegate.begin();
13607 }
13608 };
13609 /**
13610 * @return {?}
13611 */
13612 DebugRendererFactory2.prototype.end = function () {
13613 if (this.delegate.end) {
13614 this.delegate.end();
13615 }
13616 };
13617 /**
13618 * @return {?}
13619 */
13620 DebugRendererFactory2.prototype.whenRenderingDone = function () {
13621 if (this.delegate.whenRenderingDone) {
13622 return this.delegate.whenRenderingDone();
13623 }
13624 return Promise.resolve(null);
13625 };
13626 return DebugRendererFactory2;
13627}());
13628var DebugRenderer2 = (function () {
13629 /**
13630 * @param {?} delegate
13631 */
13632 function DebugRenderer2(delegate) {
13633 this.delegate = delegate;
13634 }
13635 Object.defineProperty(DebugRenderer2.prototype, "data", {
13636 /**
13637 * @return {?}
13638 */
13639 get: function () { return this.delegate.data; },
13640 enumerable: true,
13641 configurable: true
13642 });
13643 /**
13644 * @param {?} node
13645 * @return {?}
13646 */
13647 DebugRenderer2.prototype.destroyNode = function (node) {
13648 removeDebugNodeFromIndex(/** @type {?} */ ((getDebugNode(node))));
13649 if (this.delegate.destroyNode) {
13650 this.delegate.destroyNode(node);
13651 }
13652 };
13653 /**
13654 * @return {?}
13655 */
13656 DebugRenderer2.prototype.destroy = function () { this.delegate.destroy(); };
13657 /**
13658 * @param {?} name
13659 * @param {?=} namespace
13660 * @return {?}
13661 */
13662 DebugRenderer2.prototype.createElement = function (name, namespace) {
13663 var /** @type {?} */ el = this.delegate.createElement(name, namespace);
13664 var /** @type {?} */ debugCtx = getCurrentDebugContext();
13665 if (debugCtx) {
13666 var /** @type {?} */ debugEl = new DebugElement(el, null, debugCtx);
13667 debugEl.name = name;
13668 indexDebugNode(debugEl);
13669 }
13670 return el;
13671 };
13672 /**
13673 * @param {?} value
13674 * @return {?}
13675 */
13676 DebugRenderer2.prototype.createComment = function (value) {
13677 var /** @type {?} */ comment = this.delegate.createComment(value);
13678 var /** @type {?} */ debugCtx = getCurrentDebugContext();
13679 if (debugCtx) {
13680 indexDebugNode(new DebugNode(comment, null, debugCtx));
13681 }
13682 return comment;
13683 };
13684 /**
13685 * @param {?} value
13686 * @return {?}
13687 */
13688 DebugRenderer2.prototype.createText = function (value) {
13689 var /** @type {?} */ text = this.delegate.createText(value);
13690 var /** @type {?} */ debugCtx = getCurrentDebugContext();
13691 if (debugCtx) {
13692 indexDebugNode(new DebugNode(text, null, debugCtx));
13693 }
13694 return text;
13695 };
13696 /**
13697 * @param {?} parent
13698 * @param {?} newChild
13699 * @return {?}
13700 */
13701 DebugRenderer2.prototype.appendChild = function (parent, newChild) {
13702 var /** @type {?} */ debugEl = getDebugNode(parent);
13703 var /** @type {?} */ debugChildEl = getDebugNode(newChild);
13704 if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
13705 debugEl.addChild(debugChildEl);
13706 }
13707 this.delegate.appendChild(parent, newChild);
13708 };
13709 /**
13710 * @param {?} parent
13711 * @param {?} newChild
13712 * @param {?} refChild
13713 * @return {?}
13714 */
13715 DebugRenderer2.prototype.insertBefore = function (parent, newChild, refChild) {
13716 var /** @type {?} */ debugEl = getDebugNode(parent);
13717 var /** @type {?} */ debugChildEl = getDebugNode(newChild);
13718 var /** @type {?} */ debugRefEl = ((getDebugNode(refChild)));
13719 if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
13720 debugEl.insertBefore(debugRefEl, debugChildEl);
13721 }
13722 this.delegate.insertBefore(parent, newChild, refChild);
13723 };
13724 /**
13725 * @param {?} parent
13726 * @param {?} oldChild
13727 * @return {?}
13728 */
13729 DebugRenderer2.prototype.removeChild = function (parent, oldChild) {
13730 var /** @type {?} */ debugEl = getDebugNode(parent);
13731 var /** @type {?} */ debugChildEl = getDebugNode(oldChild);
13732 if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
13733 debugEl.removeChild(debugChildEl);
13734 }
13735 this.delegate.removeChild(parent, oldChild);
13736 };
13737 /**
13738 * @param {?} selectorOrNode
13739 * @return {?}
13740 */
13741 DebugRenderer2.prototype.selectRootElement = function (selectorOrNode) {
13742 var /** @type {?} */ el = this.delegate.selectRootElement(selectorOrNode);
13743 var /** @type {?} */ debugCtx = getCurrentDebugContext();
13744 if (debugCtx) {
13745 indexDebugNode(new DebugElement(el, null, debugCtx));
13746 }
13747 return el;
13748 };
13749 /**
13750 * @param {?} el
13751 * @param {?} name
13752 * @param {?} value
13753 * @param {?=} namespace
13754 * @return {?}
13755 */
13756 DebugRenderer2.prototype.setAttribute = function (el, name, value, namespace) {
13757 var /** @type {?} */ debugEl = getDebugNode(el);
13758 if (debugEl && debugEl instanceof DebugElement) {
13759 var /** @type {?} */ fullName = namespace ? namespace + ':' + name : name;
13760 debugEl.attributes[fullName] = value;
13761 }
13762 this.delegate.setAttribute(el, name, value, namespace);
13763 };
13764 /**
13765 * @param {?} el
13766 * @param {?} name
13767 * @param {?=} namespace
13768 * @return {?}
13769 */
13770 DebugRenderer2.prototype.removeAttribute = function (el, name, namespace) {
13771 var /** @type {?} */ debugEl = getDebugNode(el);
13772 if (debugEl && debugEl instanceof DebugElement) {
13773 var /** @type {?} */ fullName = namespace ? namespace + ':' + name : name;
13774 debugEl.attributes[fullName] = null;
13775 }
13776 this.delegate.removeAttribute(el, name, namespace);
13777 };
13778 /**
13779 * @param {?} el
13780 * @param {?} name
13781 * @return {?}
13782 */
13783 DebugRenderer2.prototype.addClass = function (el, name) {
13784 var /** @type {?} */ debugEl = getDebugNode(el);
13785 if (debugEl && debugEl instanceof DebugElement) {
13786 debugEl.classes[name] = true;
13787 }
13788 this.delegate.addClass(el, name);
13789 };
13790 /**
13791 * @param {?} el
13792 * @param {?} name
13793 * @return {?}
13794 */
13795 DebugRenderer2.prototype.removeClass = function (el, name) {
13796 var /** @type {?} */ debugEl = getDebugNode(el);
13797 if (debugEl && debugEl instanceof DebugElement) {
13798 debugEl.classes[name] = false;
13799 }
13800 this.delegate.removeClass(el, name);
13801 };
13802 /**
13803 * @param {?} el
13804 * @param {?} style
13805 * @param {?} value
13806 * @param {?} flags
13807 * @return {?}
13808 */
13809 DebugRenderer2.prototype.setStyle = function (el, style, value, flags) {
13810 var /** @type {?} */ debugEl = getDebugNode(el);
13811 if (debugEl && debugEl instanceof DebugElement) {
13812 debugEl.styles[style] = value;
13813 }
13814 this.delegate.setStyle(el, style, value, flags);
13815 };
13816 /**
13817 * @param {?} el
13818 * @param {?} style
13819 * @param {?} flags
13820 * @return {?}
13821 */
13822 DebugRenderer2.prototype.removeStyle = function (el, style, flags) {
13823 var /** @type {?} */ debugEl = getDebugNode(el);
13824 if (debugEl && debugEl instanceof DebugElement) {
13825 debugEl.styles[style] = null;
13826 }
13827 this.delegate.removeStyle(el, style, flags);
13828 };
13829 /**
13830 * @param {?} el
13831 * @param {?} name
13832 * @param {?} value
13833 * @return {?}
13834 */
13835 DebugRenderer2.prototype.setProperty = function (el, name, value) {
13836 var /** @type {?} */ debugEl = getDebugNode(el);
13837 if (debugEl && debugEl instanceof DebugElement) {
13838 debugEl.properties[name] = value;
13839 }
13840 this.delegate.setProperty(el, name, value);
13841 };
13842 /**
13843 * @param {?} target
13844 * @param {?} eventName
13845 * @param {?} callback
13846 * @return {?}
13847 */
13848 DebugRenderer2.prototype.listen = function (target, eventName, callback) {
13849 if (typeof target !== 'string') {
13850 var /** @type {?} */ debugEl = getDebugNode(target);
13851 if (debugEl) {
13852 debugEl.listeners.push(new EventListener(eventName, callback));
13853 }
13854 }
13855 return this.delegate.listen(target, eventName, callback);
13856 };
13857 /**
13858 * @param {?} node
13859 * @return {?}
13860 */
13861 DebugRenderer2.prototype.parentNode = function (node) { return this.delegate.parentNode(node); };
13862 /**
13863 * @param {?} node
13864 * @return {?}
13865 */
13866 DebugRenderer2.prototype.nextSibling = function (node) { return this.delegate.nextSibling(node); };
13867 /**
13868 * @param {?} node
13869 * @param {?} value
13870 * @return {?}
13871 */
13872 DebugRenderer2.prototype.setValue = function (node, value) { return this.delegate.setValue(node, value); };
13873 return DebugRenderer2;
13874}());
13875/**
13876 * @license
13877 * Copyright Google Inc. All Rights Reserved.
13878 *
13879 * Use of this source code is governed by an MIT-style license that can be
13880 * found in the LICENSE file at https://angular.io/license
13881 */
13882/**
13883 * @param {?} override
13884 * @return {?}
13885 */
13886function overrideProvider(override) {
13887 initServicesIfNeeded();
13888 return Services.overrideProvider(override);
13889}
13890/**
13891 * @return {?}
13892 */
13893function clearProviderOverrides() {
13894 initServicesIfNeeded();
13895 return Services.clearProviderOverrides();
13896}
13897/**
13898 * @param {?} ngModuleType
13899 * @param {?} bootstrapComponents
13900 * @param {?} defFactory
13901 * @return {?}
13902 */
13903function createNgModuleFactory(ngModuleType, bootstrapComponents, defFactory) {
13904 return new NgModuleFactory_(ngModuleType, bootstrapComponents, defFactory);
13905}
13906var NgModuleFactory_ = (function (_super) {
13907 __extends(NgModuleFactory_, _super);
13908 /**
13909 * @param {?} moduleType
13910 * @param {?} _bootstrapComponents
13911 * @param {?} _ngModuleDefFactory
13912 */
13913 function NgModuleFactory_(moduleType, _bootstrapComponents, _ngModuleDefFactory) {
13914 var _this =
13915 // Attention: this ctor is called as top level function.
13916 // Putting any logic in here will destroy closure tree shaking!
13917 _super.call(this) || this;
13918 _this.moduleType = moduleType;
13919 _this._bootstrapComponents = _bootstrapComponents;
13920 _this._ngModuleDefFactory = _ngModuleDefFactory;
13921 return _this;
13922 }
13923 /**
13924 * @param {?} parentInjector
13925 * @return {?}
13926 */
13927 NgModuleFactory_.prototype.create = function (parentInjector) {
13928 initServicesIfNeeded();
13929 var /** @type {?} */ def = resolveDefinition(this._ngModuleDefFactory);
13930 return Services.createNgModuleRef(this.moduleType, parentInjector || Injector.NULL, this._bootstrapComponents, def);
13931 };
13932 return NgModuleFactory_;
13933}(NgModuleFactory));
13934/**
13935 * @license
13936 * Copyright Google Inc. All Rights Reserved.
13937 *
13938 * Use of this source code is governed by an MIT-style license that can be
13939 * found in the LICENSE file at https://angular.io/license
13940 */
13941/**
13942 * @license
13943 * Copyright Google Inc. All Rights Reserved.
13944 *
13945 * Use of this source code is governed by an MIT-style license that can be
13946 * found in the LICENSE file at https://angular.io/license
13947 */
13948/**
13949 * @license
13950 * Copyright Google Inc. All Rights Reserved.
13951 *
13952 * Use of this source code is governed by an MIT-style license that can be
13953 * found in the LICENSE file at https://angular.io/license
13954 */
13955/**
13956 * \@experimental Animation support is experimental.
13957 */
13958/**
13959 * `trigger` is an animation-specific function that is designed to be used inside of Angular's
13960 * animation DSL language. If this information is new, please navigate to the {\@link
13961 * Component#animations component animations metadata page} to gain a better understanding of
13962 * how animations in Angular are used.
13963 *
13964 * `trigger` Creates an animation trigger which will a list of {\@link state state} and {\@link
13965 * transition transition} entries that will be evaluated when the expression bound to the trigger
13966 * changes.
13967 *
13968 * Triggers are registered within the component annotation data under the {\@link
13969 * Component#animations animations section}. An animation trigger can be placed on an element
13970 * within a template by referencing the name of the trigger followed by the expression value that the
13971 * trigger is bound to (in the form of `[\@triggerName]="expression"`.
13972 *
13973 * ### Usage
13974 *
13975 * `trigger` will create an animation trigger reference based on the provided `name` value. The
13976 * provided `animation` value is expected to be an array consisting of {\@link state state} and {\@link
13977 * transition transition} declarations.
13978 *
13979 * ```typescript
13980 * \@Component({
13981 * selector: 'my-component',
13982 * templateUrl: 'my-component-tpl.html',
13983 * animations: [
13984 * trigger("myAnimationTrigger", [
13985 * state(...),
13986 * state(...),
13987 * transition(...),
13988 * transition(...)
13989 * ])
13990 * ]
13991 * })
13992 * class MyComponent {
13993 * myStatusExp = "something";
13994 * }
13995 * ```
13996 *
13997 * The template associated with this component will make use of the `myAnimationTrigger` animation
13998 * trigger by binding to an element within its template code.
13999 *
14000 * ```html
14001 * <!-- somewhere inside of my-component-tpl.html -->
14002 * <div [\@myAnimationTrigger]="myStatusExp">...</div>
14003 * tools/gulp-tasks/validate-commit-message.js ```
14004 *
14005 * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
14006 *
14007 * \@experimental Animation support is experimental.
14008 * @param {?} name
14009 * @param {?} definitions
14010 * @return {?}
14011 */
14012function trigger$1(name, definitions) {
14013 return { type: 7 /* Trigger */, name: name, definitions: definitions, options: {} };
14014}
14015/**
14016 * `animate` is an animation-specific function that is designed to be used inside of Angular's
14017 * animation DSL language. If this information is new, please navigate to the {\@link
14018 * Component#animations component animations metadata page} to gain a better understanding of
14019 * how animations in Angular are used.
14020 *
14021 * `animate` specifies an animation step that will apply the provided `styles` data for a given
14022 * amount of time based on the provided `timing` expression value. Calls to `animate` are expected
14023 * to be used within {\@link sequence an animation sequence}, {\@link group group}, or {\@link
14024 * transition transition}.
14025 *
14026 * ### Usage
14027 *
14028 * The `animate` function accepts two input parameters: `timing` and `styles`:
14029 *
14030 * - `timing` is a string based value that can be a combination of a duration with optional delay
14031 * and easing values. The format for the expression breaks down to `duration delay easing`
14032 * (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000,
14033 * delay=100, easing=ease-out`. If a numeric value is provided then that will be used as the
14034 * `duration` value in millisecond form.
14035 * - `styles` is the style input data which can either be a call to {\@link style style} or {\@link
14036 * keyframes keyframes}. If left empty then the styles from the destination state will be collected
14037 * and used (this is useful when describing an animation step that will complete an animation by
14038 * {\@link transition#the-final-animate-call animating to the final state}).
14039 *
14040 * ```typescript
14041 * // various functions for specifying timing data
14042 * animate(500, style(...))
14043 * animate("1s", style(...))
14044 * animate("100ms 0.5s", style(...))
14045 * animate("5s ease", style(...))
14046 * animate("5s 10ms cubic-bezier(.17,.67,.88,.1)", style(...))
14047 *
14048 * // either style() of keyframes() can be used
14049 * animate(500, style({ background: "red" }))
14050 * animate(500, keyframes([
14051 * style({ background: "blue" })),
14052 * style({ background: "red" }))
14053 * ])
14054 * ```
14055 *
14056 * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
14057 *
14058 * \@experimental Animation support is experimental.
14059 * @param {?} timings
14060 * @param {?=} styles
14061 * @return {?}
14062 */
14063function animate$1(timings, styles) {
14064 if (styles === void 0) { styles = null; }
14065 return { type: 4 /* Animate */, styles: styles, timings: timings };
14066}
14067/**
14068 * `group` is an animation-specific function that is designed to be used inside of Angular's
14069 * animation DSL language. If this information is new, please navigate to the {\@link
14070 * Component#animations component animations metadata page} to gain a better understanding of
14071 * how animations in Angular are used.
14072 *
14073 * `group` specifies a list of animation steps that are all run in parallel. Grouped animations are
14074 * useful when a series of styles must be animated/closed off at different statrting/ending times.
14075 *
14076 * The `group` function can either be used within a {\@link sequence sequence} or a {\@link transition
14077 * transition} and it will only continue to the next instruction once all of the inner animation
14078 * steps have completed.
14079 *
14080 * ### Usage
14081 *
14082 * The `steps` data that is passed into the `group` animation function can either consist of {\@link
14083 * style style} or {\@link animate animate} function calls. Each call to `style()` or `animate()`
14084 * within a group will be executed instantly (use {\@link keyframes keyframes} or a {\@link
14085 * animate#usage animate() with a delay value} to offset styles to be applied at a later time).
14086 *
14087 * ```typescript
14088 * group([
14089 * animate("1s", { background: "black" }))
14090 * animate("2s", { color: "white" }))
14091 * ])
14092 * ```
14093 *
14094 * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
14095 *
14096 * \@experimental Animation support is experimental.
14097 * @param {?} steps
14098 * @param {?=} options
14099 * @return {?}
14100 */
14101function group$1(steps, options) {
14102 if (options === void 0) { options = null; }
14103 return { type: 3 /* Group */, steps: steps, options: options };
14104}
14105/**
14106 * `sequence` is an animation-specific function that is designed to be used inside of Angular's
14107 * animation DSL language. If this information is new, please navigate to the {\@link
14108 * Component#animations component animations metadata page} to gain a better understanding of
14109 * how animations in Angular are used.
14110 *
14111 * `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used by
14112 * default when an array is passed as animation data into {\@link transition transition}.)
14113 *
14114 * The `sequence` function can either be used within a {\@link group group} or a {\@link transition
14115 * transition} and it will only continue to the next instruction once each of the inner animation
14116 * steps have completed.
14117 *
14118 * To perform animation styling in parallel with other animation steps then have a look at the
14119 * {\@link group group} animation function.
14120 *
14121 * ### Usage
14122 *
14123 * The `steps` data that is passed into the `sequence` animation function can either consist of
14124 * {\@link style style} or {\@link animate animate} function calls. A call to `style()` will apply the
14125 * provided styling data immediately while a call to `animate()` will apply its styling data over a
14126 * given time depending on its timing data.
14127 *
14128 * ```typescript
14129 * sequence([
14130 * style({ opacity: 0 })),
14131 * animate("1s", { opacity: 1 }))
14132 * ])
14133 * ```
14134 *
14135 * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
14136 *
14137 * \@experimental Animation support is experimental.
14138 * @param {?} steps
14139 * @param {?=} options
14140 * @return {?}
14141 */
14142function sequence$1(steps, options) {
14143 if (options === void 0) { options = null; }
14144 return { type: 2 /* Sequence */, steps: steps, options: options };
14145}
14146/**
14147 * `style` is an animation-specific function that is designed to be used inside of Angular's
14148 * animation DSL language. If this information is new, please navigate to the {\@link
14149 * Component#animations component animations metadata page} to gain a better understanding of
14150 * how animations in Angular are used.
14151 *
14152 * `style` declares a key/value object containing CSS properties/styles that can then be used for
14153 * {\@link state animation states}, within an {\@link sequence animation sequence}, or as styling data
14154 * for both {\@link animate animate} and {\@link keyframes keyframes}.
14155 *
14156 * ### Usage
14157 *
14158 * `style` takes in a key/value string map as data and expects one or more CSS property/value pairs
14159 * to be defined.
14160 *
14161 * ```typescript
14162 * // string values are used for css properties
14163 * style({ background: "red", color: "blue" })
14164 *
14165 * // numerical (pixel) values are also supported
14166 * style({ width: 100, height: 0 })
14167 * ```
14168 *
14169 * #### Auto-styles (using `*`)
14170 *
14171 * When an asterix (`*`) character is used as a value then it will be detected from the element
14172 * being animated and applied as animation data when the animation starts.
14173 *
14174 * This feature proves useful for a state depending on layout and/or environment factors; in such
14175 * cases the styles are calculated just before the animation starts.
14176 *
14177 * ```typescript
14178 * // the steps below will animate from 0 to the
14179 * // actual height of the element
14180 * style({ height: 0 }),
14181 * animate("1s", style({ height: "*" }))
14182 * ```
14183 *
14184 * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
14185 *
14186 * \@experimental Animation support is experimental.
14187 * @param {?} tokens
14188 * @return {?}
14189 */
14190function style$1(tokens) {
14191 return { type: 6 /* Style */, styles: tokens, offset: null };
14192}
14193/**
14194 * `state` is an animation-specific function that is designed to be used inside of Angular's
14195 * animation DSL language. If this information is new, please navigate to the {\@link
14196 * Component#animations component animations metadata page} to gain a better understanding of
14197 * how animations in Angular are used.
14198 *
14199 * `state` declares an animation state within the given trigger. When a state is active within a
14200 * component then its associated styles will persist on the element that the trigger is attached to
14201 * (even when the animation ends).
14202 *
14203 * To animate between states, have a look at the animation {\@link transition transition} DSL
14204 * function. To register states to an animation trigger please have a look at the {\@link trigger
14205 * trigger} function.
14206 *
14207 * #### The `void` state
14208 *
14209 * The `void` state value is a reserved word that angular uses to determine when the element is not
14210 * apart of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the
14211 * associated element is void).
14212 *
14213 * #### The `*` (default) state
14214 *
14215 * The `*` state (when styled) is a fallback state that will be used if the state that is being
14216 * animated is not declared within the trigger.
14217 *
14218 * ### Usage
14219 *
14220 * `state` will declare an animation state with its associated styles
14221 * within the given trigger.
14222 *
14223 * - `stateNameExpr` can be one or more state names separated by commas.
14224 * - `styles` refers to the {\@link style styling data} that will be persisted on the element once
14225 * the state has been reached.
14226 *
14227 * ```typescript
14228 * // "void" is a reserved name for a state and is used to represent
14229 * // the state in which an element is detached from from the application.
14230 * state("void", style({ height: 0 }))
14231 *
14232 * // user-defined states
14233 * state("closed", style({ height: 0 }))
14234 * state("open, visible", style({ height: "*" }))
14235 * ```
14236 *
14237 * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
14238 *
14239 * \@experimental Animation support is experimental.
14240 * @param {?} name
14241 * @param {?} styles
14242 * @return {?}
14243 */
14244function state$1(name, styles) {
14245 return { type: 0 /* State */, name: name, styles: styles };
14246}
14247/**
14248 * `keyframes` is an animation-specific function that is designed to be used inside of Angular's
14249 * animation DSL language. If this information is new, please navigate to the {\@link
14250 * Component#animations component animations metadata page} to gain a better understanding of
14251 * how animations in Angular are used.
14252 *
14253 * `keyframes` specifies a collection of {\@link style style} entries each optionally characterized
14254 * by an `offset` value.
14255 *
14256 * ### Usage
14257 *
14258 * The `keyframes` animation function is designed to be used alongside the {\@link animate animate}
14259 * animation function. Instead of applying animations from where they are currently to their
14260 * destination, keyframes can describe how each style entry is applied and at what point within the
14261 * animation arc (much like CSS Keyframe Animations do).
14262 *
14263 * For each `style()` entry an `offset` value can be set. Doing so allows to specifiy at what
14264 * percentage of the animate time the styles will be applied.
14265 *
14266 * ```typescript
14267 * // the provided offset values describe when each backgroundColor value is applied.
14268 * animate("5s", keyframes([
14269 * style({ backgroundColor: "red", offset: 0 }),
14270 * style({ backgroundColor: "blue", offset: 0.2 }),
14271 * style({ backgroundColor: "orange", offset: 0.3 }),
14272 * style({ backgroundColor: "black", offset: 1 })
14273 * ]))
14274 * ```
14275 *
14276 * Alternatively, if there are no `offset` values used within the style entries then the offsets
14277 * will be calculated automatically.
14278 *
14279 * ```typescript
14280 * animate("5s", keyframes([
14281 * style({ backgroundColor: "red" }) // offset = 0
14282 * style({ backgroundColor: "blue" }) // offset = 0.33
14283 * style({ backgroundColor: "orange" }) // offset = 0.66
14284 * style({ backgroundColor: "black" }) // offset = 1
14285 * ]))
14286 * ```
14287 *
14288 * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
14289 *
14290 * \@experimental Animation support is experimental.
14291 * @param {?} steps
14292 * @return {?}
14293 */
14294function keyframes$1(steps) {
14295 return { type: 5 /* Keyframes */, steps: steps };
14296}
14297/**
14298 * `transition` is an animation-specific function that is designed to be used inside of Angular's
14299 * animation DSL language. If this information is new, please navigate to the {\@link
14300 * Component#animations component animations metadata page} to gain a better understanding of
14301 * how animations in Angular are used.
14302 *
14303 * `transition` declares the {\@link sequence sequence of animation steps} that will be run when the
14304 * provided `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 =>
14305 * state2` which consists of two known states (use an asterix (`*`) to refer to a dynamic starting
14306 * and/or ending state).
14307 *
14308 * A function can also be provided as the `stateChangeExpr` argument for a transition and this
14309 * function will be executed each time a state change occurs. If the value returned within the
14310 * function is true then the associated animation will be run.
14311 *
14312 * Animation transitions are placed within an {\@link trigger animation trigger}. For an transition
14313 * to animate to a state value and persist its styles then one or more {\@link state animation
14314 * states} is expected to be defined.
14315 *
14316 * ### Usage
14317 *
14318 * An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on
14319 * what the previous state is and what the current state has become. In other words, if a transition
14320 * is defined that matches the old/current state criteria then the associated animation will be
14321 * triggered.
14322 *
14323 * ```typescript
14324 * // all transition/state changes are defined within an animation trigger
14325 * trigger("myAnimationTrigger", [
14326 * // if a state is defined then its styles will be persisted when the
14327 * // animation has fully completed itself
14328 * state("on", style({ background: "green" })),
14329 * state("off", style({ background: "grey" })),
14330 *
14331 * // a transition animation that will be kicked off when the state value
14332 * // bound to "myAnimationTrigger" changes from "on" to "off"
14333 * transition("on => off", animate(500)),
14334 *
14335 * // it is also possible to do run the same animation for both directions
14336 * transition("on <=> off", animate(500)),
14337 *
14338 * // or to define multiple states pairs separated by commas
14339 * transition("on => off, off => void", animate(500)),
14340 *
14341 * // this is a catch-all state change for when an element is inserted into
14342 * // the page and the destination state is unknown
14343 * transition("void => *", [
14344 * style({ opacity: 0 }),
14345 * animate(500)
14346 * ]),
14347 *
14348 * // this will capture a state change between any states
14349 * transition("* => *", animate("1s 0s")),
14350 *
14351 * // you can also go full out and include a function
14352 * transition((fromState, toState) => {
14353 * // when `true` then it will allow the animation below to be invoked
14354 * return fromState == "off" && toState == "on";
14355 * }, animate("1s 0s"))
14356 * ])
14357 * ```
14358 *
14359 * The template associated with this component will make use of the `myAnimationTrigger` animation
14360 * trigger by binding to an element within its template code.
14361 *
14362 * ```html
14363 * <!-- somewhere inside of my-component-tpl.html -->
14364 * <div [\@myAnimationTrigger]="myStatusExp">...</div>
14365 * ```
14366 *
14367 * #### The final `animate` call
14368 *
14369 * If the final step within the transition steps is a call to `animate()` that **only** uses a
14370 * timing value with **no style data** then it will be automatically used as the final animation arc
14371 * for the element to animate itself to the final state. This involves an automatic mix of
14372 * adding/removing CSS styles so that the element will be in the exact state it should be for the
14373 * applied state to be presented correctly.
14374 *
14375 * ```
14376 * // start off by hiding the element, but make sure that it animates properly to whatever state
14377 * // is currently active for "myAnimationTrigger"
14378 * transition("void => *", [
14379 * style({ opacity: 0 }),
14380 * animate(500)
14381 * ])
14382 * ```
14383 *
14384 * ### Transition Aliases (`:enter` and `:leave`)
14385 *
14386 * Given that enter (insertion) and leave (removal) animations are so common, the `transition`
14387 * function accepts both `:enter` and `:leave` values which are aliases for the `void => *` and `*
14388 * => void` state changes.
14389 *
14390 * ```
14391 * transition(":enter", [
14392 * style({ opacity: 0 }),
14393 * animate(500, style({ opacity: 1 }))
14394 * ])
14395 * transition(":leave", [
14396 * animate(500, style({ opacity: 0 }))
14397 * ])
14398 * ```
14399 *
14400 * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
14401 *
14402 * \@experimental Animation support is experimental.
14403 * @param {?} stateChangeExpr
14404 * @param {?} steps
14405 * @param {?=} options
14406 * @return {?}
14407 */
14408function transition$1(stateChangeExpr, steps, options) {
14409 if (options === void 0) { options = null; }
14410 return { type: 1 /* Transition */, expr: stateChangeExpr, animation: steps, options: options };
14411}
14412/**
14413 * `animation` is an animation-specific function that is designed to be used inside of Angular's
14414 * animation DSL language.
14415 *
14416 * `var myAnimation = animation(...)` is designed to produce a reusable animation that can be later
14417 * invoked in another animation or sequence. Reusable animations are designed to make use of
14418 * animation parameters and the produced animation can be used via the `useAnimation` method.
14419 *
14420 * ```
14421 * var fadeAnimation = animation([
14422 * style({ opacity: '{{ start }}' }),
14423 * animate('{{ time }}',
14424 * style({ opacity: '{{ end }}'))
14425 * ], { params: { time: '1000ms', start: 0, end: 1 }});
14426 * ```
14427 *
14428 * If parameters are attached to an animation then they act as **default parameter values**. When an
14429 * animation is invoked via `useAnimation` then parameter values are allowed to be passed in
14430 * directly. If any of the passed in parameter values are missing then the default values will be
14431 * used.
14432 *
14433 * ```
14434 * useAnimation(fadeAnimation, {
14435 * params: {
14436 * time: '2s',
14437 * start: 1,
14438 * end: 0
14439 * }
14440 * })
14441 * ```
14442 *
14443 * If one or more parameter values are missing before animated then an error will be thrown.
14444 *
14445 * \@experimental Animation support is experimental.
14446 * @param {?} steps
14447 * @param {?=} options
14448 * @return {?}
14449 */
14450/**
14451 * `animateChild` is an animation-specific function that is designed to be used inside of Angular's
14452 * animation DSL language. It works by allowing a queried element to execute its own
14453 * animation within the animation sequence.
14454 *
14455 * Each time an animation is triggered in angular, the parent animation
14456 * will always get priority and any child animations will be blocked. In order
14457 * for a child animation to run, the parent animation must query each of the elements
14458 * containing child animations and then allow the animations to run using `animateChild`.
14459 *
14460 * The example HTML code below shows both parent and child elements that have animation
14461 * triggers that will execute at the same time.
14462 *
14463 * ```html
14464 * <!-- parent-child.component.html -->
14465 * <button (click)="exp =! exp">Toggle</button>
14466 * <hr>
14467 *
14468 * <div [\@parentAnimation]="exp">
14469 * <header>Hello</header>
14470 * <div [\@childAnimation]="exp">
14471 * one
14472 * </div>
14473 * <div [\@childAnimation]="exp">
14474 * two
14475 * </div>
14476 * <div [\@childAnimation]="exp">
14477 * three
14478 * </div>
14479 * </div>
14480 * ```
14481 *
14482 * Now when the `exp` value changes to true, only the `parentAnimation` animation will animate
14483 * because it has priority. However, using `query` and `animateChild` each of the inner animations
14484 * can also fire:
14485 *
14486 * ```ts
14487 * // parent-child.component.ts
14488 * import {trigger, transition, animate, style, query, animateChild} from '\@angular/animations';
14489 * \@Component({
14490 * selector: 'parent-child-component',
14491 * animations: [
14492 * trigger('parentAnimation', [
14493 * transition('false => true', [
14494 * query('header', [
14495 * style({ opacity: 0 }),
14496 * animate(500, style({ opacity: 1 }))
14497 * ]),
14498 * query('\@childAnimation', [
14499 * animateChild()
14500 * ])
14501 * ])
14502 * ]),
14503 * trigger('childAnimation', [
14504 * transition('false => true', [
14505 * style({ opacity: 0 }),
14506 * animate(500, style({ opacity: 1 }))
14507 * ])
14508 * ])
14509 * ]
14510 * })
14511 * class ParentChildCmp {
14512 * exp: boolean = false;
14513 * }
14514 * ```
14515 *
14516 * In the animation code above, when the `parentAnimation` transition kicks off it first queries to
14517 * find the header element and fades it in. It then finds each of the sub elements that contain the
14518 * `\@childAnimation` trigger and then allows for their animations to fire.
14519 *
14520 * This example can be further extended by using stagger:
14521 *
14522 * ```ts
14523 * query('\@childAnimation', stagger(100, [
14524 * animateChild()
14525 * ]))
14526 * ```
14527 *
14528 * Now each of the sub animations start off with respect to the `100ms` staggering step.
14529 *
14530 * ## The first frame of child animations
14531 * When sub animations are executed using `animateChild` the animation engine will always apply the
14532 * first frame of every sub animation immediately at the start of the animation sequence. This way
14533 * the parent animation does not need to set any initial styling data on the sub elements before the
14534 * sub animations kick off.
14535 *
14536 * In the example above the first frame of the `childAnimation`'s `false => true` transition
14537 * consists of a style of `opacity: 0`. This is applied immediately when the `parentAnimation`
14538 * animation transition sequence starts. Only then when the `\@childAnimation` is queried and called
14539 * with `animateChild` will it then animate to its destination of `opacity: 1`.
14540 *
14541 * Note that this feature designed to be used alongside {\@link query query()} and it will only work
14542 * with animations that are assigned using the Angular animation DSL (this means that CSS keyframes
14543 * and transitions are not handled by this API).
14544 *
14545 * \@experimental Animation support is experimental.
14546 * @param {?=} options
14547 * @return {?}
14548 */
14549/**
14550 * `useAnimation` is an animation-specific function that is designed to be used inside of Angular's
14551 * animation DSL language. It is used to kick off a reusable animation that is created using {\@link
14552 * animation animation()}.
14553 *
14554 * \@experimental Animation support is experimental.
14555 * @param {?} animation
14556 * @param {?=} options
14557 * @return {?}
14558 */
14559/**
14560 * `query` is an animation-specific function that is designed to be used inside of Angular's
14561 * animation DSL language.
14562 *
14563 * query() is used to find one or more inner elements within the current element that is
14564 * being animated within the sequence. The provided animation steps are applied
14565 * to the queried element (by default, an array is provided, then this will be
14566 * treated as an animation sequence).
14567 *
14568 * ### Usage
14569 *
14570 * query() is designed to collect mutiple elements and works internally by using
14571 * `element.querySelectorAll`. An additional options object can be provided which
14572 * can be used to limit the total amount of items to be collected.
14573 *
14574 * ```js
14575 * query('div', [
14576 * animate(...),
14577 * animate(...)
14578 * ], { limit: 1 })
14579 * ```
14580 *
14581 * query(), by default, will throw an error when zero items are found. If a query
14582 * has the `optional` flag set to true then this error will be ignored.
14583 *
14584 * ```js
14585 * query('.some-element-that-may-not-be-there', [
14586 * animate(...),
14587 * animate(...)
14588 * ], { optional: true })
14589 * ```
14590 *
14591 * ### Special Selector Values
14592 *
14593 * The selector value within a query can collect elements that contain angular-specific
14594 * characteristics
14595 * using special pseudo-selectors tokens.
14596 *
14597 * These include:
14598 *
14599 * - Querying for newly inserted/removed elements using `query(":enter")`/`query(":leave")`
14600 * - Querying all currently animating elements using `query(":animating")`
14601 * - Querying elements that contain an animation trigger using `query("\@triggerName")`
14602 * - Querying all elements that contain an animation triggers using `query("\@*")`
14603 * - Including the current element into the animation sequence using `query(":self")`
14604 *
14605 *
14606 * Each of these pseudo-selector tokens can be merged together into a combined query selector
14607 * string:
14608 *
14609 * ```
14610 * query(':self, .record:enter, .record:leave, \@subTrigger', [...])
14611 * ```
14612 *
14613 * ### Demo
14614 *
14615 * ```
14616 * \@Component({
14617 * selector: 'inner',
14618 * template: `
14619 * <div [\@queryAnimation]="exp">
14620 * <h1>Title</h1>
14621 * <div class="content">
14622 * Blah blah blah
14623 * </div>
14624 * </div>
14625 * `,
14626 * animations: [
14627 * trigger('queryAnimation', [
14628 * transition('* => goAnimate', [
14629 * // hide the inner elements
14630 * query('h1', style({ opacity: 0 })),
14631 * query('.content', style({ opacity: 0 })),
14632 *
14633 * // animate the inner elements in, one by one
14634 * query('h1', animate(1000, style({ opacity: 1 })),
14635 * query('.content', animate(1000, style({ opacity: 1 })),
14636 * ])
14637 * ])
14638 * ]
14639 * })
14640 * class Cmp {
14641 * exp = '';
14642 *
14643 * goAnimate() {
14644 * this.exp = 'goAnimate';
14645 * }
14646 * }
14647 * ```
14648 *
14649 * \@experimental Animation support is experimental.
14650 * @param {?} selector
14651 * @param {?} animation
14652 * @param {?=} options
14653 * @return {?}
14654 */
14655/**
14656 * `stagger` is an animation-specific function that is designed to be used inside of Angular's
14657 * animation DSL language. It is designed to be used inside of an animation {\@link query query()}
14658 * and works by issuing a timing gap between after each queried item is animated.
14659 *
14660 * ### Usage
14661 *
14662 * In the example below there is a container element that wraps a list of items stamped out
14663 * by an ngFor. The container element contains an animation trigger that will later be set
14664 * to query for each of the inner items.
14665 *
14666 * ```html
14667 * <!-- list.component.html -->
14668 * <button (click)="toggle()">Show / Hide Items</button>
14669 * <hr />
14670 * <div [\@listAnimation]="items.length">
14671 * <div *ngFor="let item of items">
14672 * {{ item }}
14673 * </div>
14674 * </div>
14675 * ```
14676 *
14677 * The component code for this looks as such:
14678 *
14679 * ```ts
14680 * import {trigger, transition, style, animate, query, stagger} from '\@angular/animations';
14681 * \@Component({
14682 * templateUrl: 'list.component.html',
14683 * animations: [
14684 * trigger('listAnimation', [
14685 * //...
14686 * ])
14687 * ]
14688 * })
14689 * class ListComponent {
14690 * items = [];
14691 *
14692 * showItems() {
14693 * this.items = [0,1,2,3,4];
14694 * }
14695 *
14696 * hideItems() {
14697 * this.items = [];
14698 * }
14699 *
14700 * toggle() {
14701 * this.items.length ? this.hideItems() : this.showItems();
14702 * }
14703 * }
14704 * ```
14705 *
14706 * And now for the animation trigger code:
14707 *
14708 * ```ts
14709 * trigger('listAnimation', [
14710 * transition('* => *', [ // each time the binding value changes
14711 * query(':leave', [
14712 * stagger(100, [
14713 * animate('0.5s', style({ opacity: 0 }))
14714 * ])
14715 * ]),
14716 * query(':enter', [
14717 * style({ opacity: 0 }),
14718 * stagger(100, [
14719 * animate('0.5s', style({ opacity: 1 }))
14720 * ])
14721 * ])
14722 * ])
14723 * ])
14724 * ```
14725 *
14726 * Now each time the items are added/removed then either the opacity
14727 * fade-in animation will run or each removed item will be faded out.
14728 * When either of these animations occur then a stagger effect will be
14729 * applied after each item's animation is started.
14730 *
14731 * \@experimental Animation support is experimental.
14732 * @param {?} timings
14733 * @param {?} animation
14734 * @return {?}
14735 */
14736/**
14737 * @license
14738 * Copyright Google Inc. All Rights Reserved.
14739 *
14740 * Use of this source code is governed by an MIT-style license that can be
14741 * found in the LICENSE file at https://angular.io/license
14742 */
14743/**
14744 * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
14745 */
14746var AUTO_STYLE$$1 = '*';
14747/**
14748 * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
14749 * @param {?} name
14750 * @param {?} definitions
14751 * @return {?}
14752 */
14753function trigger$$1(name, definitions) {
14754 return trigger$1(name, definitions);
14755}
14756/**
14757 * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
14758 * @param {?} timings
14759 * @param {?=} styles
14760 * @return {?}
14761 */
14762function animate$$1(timings, styles) {
14763 return animate$1(timings, styles);
14764}
14765/**
14766 * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
14767 * @param {?} steps
14768 * @return {?}
14769 */
14770function group$$1(steps) {
14771 return group$1(steps);
14772}
14773/**
14774 * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
14775 * @param {?} steps
14776 * @return {?}
14777 */
14778function sequence$$1(steps) {
14779 return sequence$1(steps);
14780}
14781/**
14782 * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
14783 * @param {?} tokens
14784 * @return {?}
14785 */
14786function style$$1(tokens) {
14787 return style$1(tokens);
14788}
14789/**
14790 * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
14791 * @param {?} name
14792 * @param {?} styles
14793 * @return {?}
14794 */
14795function state$$1(name, styles) {
14796 return state$1(name, styles);
14797}
14798/**
14799 * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
14800 * @param {?} steps
14801 * @return {?}
14802 */
14803function keyframes$$1(steps) {
14804 return keyframes$1(steps);
14805}
14806/**
14807 * @deprecated This symbol has moved. Please Import from \@angular/animations instead!
14808 * @param {?} stateChangeExpr
14809 * @param {?} steps
14810 * @return {?}
14811 */
14812function transition$$1(stateChangeExpr, steps) {
14813 return transition$1(stateChangeExpr, steps);
14814}
14815
14816exports.Class = Class;
14817exports.createPlatform = createPlatform;
14818exports.assertPlatform = assertPlatform;
14819exports.destroyPlatform = destroyPlatform;
14820exports.getPlatform = getPlatform;
14821exports.PlatformRef = PlatformRef;
14822exports.ApplicationRef = ApplicationRef;
14823exports.enableProdMode = enableProdMode;
14824exports.isDevMode = isDevMode;
14825exports.createPlatformFactory = createPlatformFactory;
14826exports.NgProbeToken = NgProbeToken;
14827exports.APP_ID = APP_ID;
14828exports.PACKAGE_ROOT_URL = PACKAGE_ROOT_URL;
14829exports.PLATFORM_INITIALIZER = PLATFORM_INITIALIZER;
14830exports.PLATFORM_ID = PLATFORM_ID;
14831exports.APP_BOOTSTRAP_LISTENER = APP_BOOTSTRAP_LISTENER;
14832exports.APP_INITIALIZER = APP_INITIALIZER;
14833exports.ApplicationInitStatus = ApplicationInitStatus;
14834exports.DebugElement = DebugElement;
14835exports.DebugNode = DebugNode;
14836exports.asNativeElements = asNativeElements;
14837exports.getDebugNode = getDebugNode;
14838exports.Testability = Testability;
14839exports.TestabilityRegistry = TestabilityRegistry;
14840exports.setTestabilityGetter = setTestabilityGetter;
14841exports.TRANSLATIONS = TRANSLATIONS;
14842exports.TRANSLATIONS_FORMAT = TRANSLATIONS_FORMAT;
14843exports.LOCALE_ID = LOCALE_ID;
14844exports.MissingTranslationStrategy = MissingTranslationStrategy;
14845exports.ApplicationModule = ApplicationModule;
14846exports.wtfCreateScope = wtfCreateScope;
14847exports.wtfLeave = wtfLeave;
14848exports.wtfStartTimeRange = wtfStartTimeRange;
14849exports.wtfEndTimeRange = wtfEndTimeRange;
14850exports.Type = Type;
14851exports.EventEmitter = EventEmitter;
14852exports.ErrorHandler = ErrorHandler;
14853exports.Sanitizer = Sanitizer;
14854exports.SecurityContext = SecurityContext;
14855exports.ANALYZE_FOR_ENTRY_COMPONENTS = ANALYZE_FOR_ENTRY_COMPONENTS;
14856exports.Attribute = Attribute;
14857exports.ContentChild = ContentChild;
14858exports.ContentChildren = ContentChildren;
14859exports.Query = Query;
14860exports.ViewChild = ViewChild;
14861exports.ViewChildren = ViewChildren;
14862exports.Component = Component;
14863exports.Directive = Directive;
14864exports.HostBinding = HostBinding;
14865exports.HostListener = HostListener;
14866exports.Input = Input;
14867exports.Output = Output;
14868exports.Pipe = Pipe;
14869exports.CUSTOM_ELEMENTS_SCHEMA = CUSTOM_ELEMENTS_SCHEMA;
14870exports.NO_ERRORS_SCHEMA = NO_ERRORS_SCHEMA;
14871exports.NgModule = NgModule;
14872exports.ViewEncapsulation = ViewEncapsulation;
14873exports.Version = Version;
14874exports.VERSION = VERSION;
14875exports.forwardRef = forwardRef;
14876exports.resolveForwardRef = resolveForwardRef;
14877exports.Injector = Injector;
14878exports.ReflectiveInjector = ReflectiveInjector;
14879exports.ResolvedReflectiveFactory = ResolvedReflectiveFactory;
14880exports.ReflectiveKey = ReflectiveKey;
14881exports.InjectionToken = InjectionToken;
14882exports.OpaqueToken = OpaqueToken;
14883exports.Inject = Inject;
14884exports.Optional = Optional;
14885exports.Injectable = Injectable;
14886exports.Self = Self;
14887exports.SkipSelf = SkipSelf;
14888exports.Host = Host;
14889exports.NgZone = NgZone;
14890exports.RenderComponentType = RenderComponentType;
14891exports.Renderer = Renderer;
14892exports.Renderer2 = Renderer2;
14893exports.RendererFactory2 = RendererFactory2;
14894exports.RendererStyleFlags2 = RendererStyleFlags2;
14895exports.RootRenderer = RootRenderer;
14896exports.COMPILER_OPTIONS = COMPILER_OPTIONS;
14897exports.Compiler = Compiler;
14898exports.CompilerFactory = CompilerFactory;
14899exports.ModuleWithComponentFactories = ModuleWithComponentFactories;
14900exports.ComponentFactory = ComponentFactory;
14901exports.ComponentRef = ComponentRef;
14902exports.ComponentFactoryResolver = ComponentFactoryResolver;
14903exports.ElementRef = ElementRef;
14904exports.NgModuleFactory = NgModuleFactory;
14905exports.NgModuleRef = NgModuleRef;
14906exports.NgModuleFactoryLoader = NgModuleFactoryLoader;
14907exports.getModuleFactory = getModuleFactory;
14908exports.QueryList = QueryList;
14909exports.SystemJsNgModuleLoader = SystemJsNgModuleLoader;
14910exports.SystemJsNgModuleLoaderConfig = SystemJsNgModuleLoaderConfig;
14911exports.TemplateRef = TemplateRef;
14912exports.ViewContainerRef = ViewContainerRef;
14913exports.EmbeddedViewRef = EmbeddedViewRef;
14914exports.ViewRef = ViewRef;
14915exports.ChangeDetectionStrategy = ChangeDetectionStrategy;
14916exports.ChangeDetectorRef = ChangeDetectorRef;
14917exports.DefaultIterableDiffer = DefaultIterableDiffer;
14918exports.IterableDiffers = IterableDiffers;
14919exports.KeyValueDiffers = KeyValueDiffers;
14920exports.SimpleChange = SimpleChange;
14921exports.WrappedValue = WrappedValue;
14922exports.platformCore = platformCore;
14923exports.ɵALLOW_MULTIPLE_PLATFORMS = ALLOW_MULTIPLE_PLATFORMS;
14924exports.ɵAPP_ID_RANDOM_PROVIDER = APP_ID_RANDOM_PROVIDER;
14925exports.ɵValueUnwrapper = ValueUnwrapper;
14926exports.ɵdevModeEqual = devModeEqual;
14927exports.ɵisListLikeIterable = isListLikeIterable;
14928exports.ɵChangeDetectorStatus = ChangeDetectorStatus;
14929exports.ɵisDefaultChangeDetectionStrategy = isDefaultChangeDetectionStrategy;
14930exports.ɵConsole = Console;
14931exports.ɵERROR_COMPONENT_TYPE = ERROR_COMPONENT_TYPE;
14932exports.ɵComponentFactory = ComponentFactory;
14933exports.ɵCodegenComponentFactoryResolver = CodegenComponentFactoryResolver;
14934exports.ɵViewMetadata = ViewMetadata;
14935exports.ɵReflectionCapabilities = ReflectionCapabilities;
14936exports.ɵRenderDebugInfo = RenderDebugInfo;
14937exports.ɵglobal = _global;
14938exports.ɵlooseIdentical = looseIdentical;
14939exports.ɵstringify = stringify;
14940exports.ɵmakeDecorator = makeDecorator;
14941exports.ɵisObservable = isObservable;
14942exports.ɵisPromise = isPromise;
14943exports.ɵclearProviderOverrides = clearProviderOverrides;
14944exports.ɵoverrideProvider = overrideProvider;
14945exports.ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR;
14946exports.ɵregisterModuleFactory = registerModuleFactory;
14947exports.ɵEMPTY_ARRAY = EMPTY_ARRAY;
14948exports.ɵEMPTY_MAP = EMPTY_MAP;
14949exports.ɵand = anchorDef;
14950exports.ɵccf = createComponentFactory;
14951exports.ɵcmf = createNgModuleFactory;
14952exports.ɵcrt = createRendererType2;
14953exports.ɵdid = directiveDef;
14954exports.ɵeld = elementDef;
14955exports.ɵelementEventFullName = elementEventFullName;
14956exports.ɵgetComponentViewDefinitionFactory = getComponentViewDefinitionFactory;
14957exports.ɵinlineInterpolate = inlineInterpolate;
14958exports.ɵinterpolate = interpolate;
14959exports.ɵmod = moduleDef;
14960exports.ɵmpd = moduleProvideDef;
14961exports.ɵncd = ngContentDef;
14962exports.ɵnov = nodeValue;
14963exports.ɵpid = pipeDef;
14964exports.ɵprd = providerDef;
14965exports.ɵpad = pureArrayDef;
14966exports.ɵpod = pureObjectDef;
14967exports.ɵppd = purePipeDef;
14968exports.ɵqud = queryDef;
14969exports.ɵted = textDef;
14970exports.ɵunv = unwrapValue;
14971exports.ɵvid = viewDef;
14972exports.AUTO_STYLE = AUTO_STYLE$$1;
14973exports.trigger = trigger$$1;
14974exports.animate = animate$$1;
14975exports.group = group$$1;
14976exports.sequence = sequence$$1;
14977exports.style = style$$1;
14978exports.state = state$$1;
14979exports.keyframes = keyframes$$1;
14980exports.transition = transition$$1;
14981exports.ɵx = animate$1;
14982exports.ɵy = group$1;
14983exports.ɵbc = keyframes$1;
14984exports.ɵz = sequence$1;
14985exports.ɵbb = state$1;
14986exports.ɵba = style$1;
14987exports.ɵbd = transition$1;
14988exports.ɵw = trigger$1;
14989exports.ɵk = _iterableDiffersFactory;
14990exports.ɵl = _keyValueDiffersFactory;
14991exports.ɵm = _localeFactory;
14992exports.ɵe = ApplicationRef_;
14993exports.ɵf = _appIdRandomProviderFactory;
14994exports.ɵg = defaultIterableDiffers;
14995exports.ɵh = defaultKeyValueDiffers;
14996exports.ɵi = DefaultIterableDifferFactory;
14997exports.ɵj = DefaultKeyValueDifferFactory;
14998exports.ɵb = ReflectiveInjector_;
14999exports.ɵc = ReflectiveDependency;
15000exports.ɵd = resolveReflectiveProviders;
15001exports.ɵn = wtfEnabled;
15002exports.ɵp = createScope$1;
15003exports.ɵo = detectWTF;
15004exports.ɵs = endTimeRange;
15005exports.ɵq = leave;
15006exports.ɵr = startTimeRange;
15007exports.ɵa = makeParamDecorator;
15008exports.ɵt = _def;
15009exports.ɵu = DebugContext;
15010
15011Object.defineProperty(exports, '__esModule', { value: true });
15012
15013})));
15014//# sourceMappingURL=core.umd.js.map