UNPKG

461 kBJavaScriptView Raw
1/**
2 * @license Angular v2.4.10
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/symbol/observable'), require('rxjs/Subject'), require('rxjs/Observable')) :
8 typeof define === 'function' && define.amd ? define(['exports', 'rxjs/symbol/observable', 'rxjs/Subject', 'rxjs/Observable'], factory) :
9 (factory((global.ng = global.ng || {}, global.ng.core = global.ng.core || {}),global.rxjs_symbol_observable,global.Rx,global.Rx));
10}(this, function (exports,rxjs_symbol_observable,rxjs_Subject,rxjs_Observable) { 'use strict';
11
12 /**
13 * @license
14 * Copyright Google Inc. All Rights Reserved.
15 *
16 * Use of this source code is governed by an MIT-style license that can be
17 * found in the LICENSE file at https://angular.io/license
18 */
19 var /** @type {?} */ globalScope;
20 if (typeof window === 'undefined') {
21 if (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) {
22 // TODO: Replace any with WorkerGlobalScope from lib.webworker.d.ts #3492
23 globalScope = (self);
24 }
25 else {
26 globalScope = (global);
27 }
28 }
29 else {
30 globalScope = (window);
31 }
32 /**
33 * @param {?} fn
34 * @return {?}
35 */
36 function scheduleMicroTask(fn) {
37 Zone.current.scheduleMicroTask('scheduleMicrotask', fn);
38 }
39 // Need to declare a new variable for global here since TypeScript
40 // exports the original value of the symbol.
41 var /** @type {?} */ global$1 = globalScope;
42 /**
43 * @param {?} type
44 * @return {?}
45 */
46 function getTypeNameForDebugging(type) {
47 return type['name'] || typeof type;
48 }
49 // TODO: remove calls to assert in production environment
50 // Note: Can't just export this and import in in other files
51 // as `assert` is a reserved keyword in Dart
52 global$1.assert = function assert(condition) {
53 // TODO: to be fixed properly via #2830, noop for now
54 };
55 /**
56 * @param {?} obj
57 * @return {?}
58 */
59 function isPresent(obj) {
60 return obj != null;
61 }
62 /**
63 * @param {?} obj
64 * @return {?}
65 */
66 function isBlank(obj) {
67 return obj == null;
68 }
69 /**
70 * @param {?} token
71 * @return {?}
72 */
73 function stringify(token) {
74 if (typeof token === 'string') {
75 return token;
76 }
77 if (token == null) {
78 return '' + token;
79 }
80 if (token.overriddenName) {
81 return "" + token.overriddenName;
82 }
83 if (token.name) {
84 return "" + token.name;
85 }
86 var /** @type {?} */ res = token.toString();
87 var /** @type {?} */ newLineIndex = res.indexOf('\n');
88 return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
89 }
90 /**
91 * @param {?} a
92 * @param {?} b
93 * @return {?}
94 */
95 function looseIdentical(a, b) {
96 return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b);
97 }
98 /**
99 * @param {?} o
100 * @return {?}
101 */
102 function isJsObject(o) {
103 return o !== null && (typeof o === 'function' || typeof o === 'object');
104 }
105 /**
106 * @param {?} obj
107 * @return {?}
108 */
109 function print(obj) {
110 // tslint:disable-next-line:no-console
111 console.log(obj);
112 }
113 /**
114 * @param {?} obj
115 * @return {?}
116 */
117 function warn(obj) {
118 console.warn(obj);
119 }
120 var /** @type {?} */ _symbolIterator = null;
121 /**
122 * @return {?}
123 */
124 function getSymbolIterator() {
125 if (!_symbolIterator) {
126 if (((globalScope)).Symbol && Symbol.iterator) {
127 _symbolIterator = Symbol.iterator;
128 }
129 else {
130 // es6-shim specific logic
131 var /** @type {?} */ keys = Object.getOwnPropertyNames(Map.prototype);
132 for (var /** @type {?} */ i = 0; i < keys.length; ++i) {
133 var /** @type {?} */ key = keys[i];
134 if (key !== 'entries' && key !== 'size' &&
135 ((Map)).prototype[key] === Map.prototype['entries']) {
136 _symbolIterator = key;
137 }
138 }
139 }
140 }
141 return _symbolIterator;
142 }
143 /**
144 * @param {?} obj
145 * @return {?}
146 */
147 function isPrimitive(obj) {
148 return !isJsObject(obj);
149 }
150
151 var /** @type {?} */ _nextClassId = 0;
152 var /** @type {?} */ Reflect = global$1.Reflect;
153 /**
154 * @param {?} annotation
155 * @return {?}
156 */
157 function extractAnnotation(annotation) {
158 if (typeof annotation === 'function' && annotation.hasOwnProperty('annotation')) {
159 // it is a decorator, extract annotation
160 annotation = annotation.annotation;
161 }
162 return annotation;
163 }
164 /**
165 * @param {?} fnOrArray
166 * @param {?} key
167 * @return {?}
168 */
169 function applyParams(fnOrArray, key) {
170 if (fnOrArray === Object || fnOrArray === String || fnOrArray === Function ||
171 fnOrArray === Number || fnOrArray === Array) {
172 throw new Error("Can not use native " + stringify(fnOrArray) + " as constructor");
173 }
174 if (typeof fnOrArray === 'function') {
175 return fnOrArray;
176 }
177 if (Array.isArray(fnOrArray)) {
178 var /** @type {?} */ annotations = fnOrArray;
179 var /** @type {?} */ annoLength = annotations.length - 1;
180 var /** @type {?} */ fn = fnOrArray[annoLength];
181 if (typeof fn !== 'function') {
182 throw new Error("Last position of Class method array must be Function in key " + key + " was '" + stringify(fn) + "'");
183 }
184 if (annoLength != fn.length) {
185 throw new Error("Number of annotations (" + annoLength + ") does not match number of arguments (" + fn.length + ") in the function: " + stringify(fn));
186 }
187 var /** @type {?} */ paramsAnnotations = [];
188 for (var /** @type {?} */ i = 0, /** @type {?} */ ii = annotations.length - 1; i < ii; i++) {
189 var /** @type {?} */ paramAnnotations = [];
190 paramsAnnotations.push(paramAnnotations);
191 var /** @type {?} */ annotation = annotations[i];
192 if (Array.isArray(annotation)) {
193 for (var /** @type {?} */ j = 0; j < annotation.length; j++) {
194 paramAnnotations.push(extractAnnotation(annotation[j]));
195 }
196 }
197 else if (typeof annotation === 'function') {
198 paramAnnotations.push(extractAnnotation(annotation));
199 }
200 else {
201 paramAnnotations.push(annotation);
202 }
203 }
204 Reflect.defineMetadata('parameters', paramsAnnotations, fn);
205 return fn;
206 }
207 throw new Error("Only Function or Array is supported in Class definition for key '" + key + "' is '" + stringify(fnOrArray) + "'");
208 }
209 /**
210 * Provides a way for expressing ES6 classes with parameter annotations in ES5.
211 *
212 * ## Basic Example
213 *
214 * ```
215 * var Greeter = ng.Class({
216 * constructor: function(name) {
217 * this.name = name;
218 * },
219 *
220 * greet: function() {
221 * alert('Hello ' + this.name + '!');
222 * }
223 * });
224 * ```
225 *
226 * is equivalent to ES6:
227 *
228 * ```
229 * class Greeter {
230 * constructor(name) {
231 * this.name = name;
232 * }
233 *
234 * greet() {
235 * alert('Hello ' + this.name + '!');
236 * }
237 * }
238 * ```
239 *
240 * or equivalent to ES5:
241 *
242 * ```
243 * var Greeter = function (name) {
244 * this.name = name;
245 * }
246 *
247 * Greeter.prototype.greet = function () {
248 * alert('Hello ' + this.name + '!');
249 * }
250 * ```
251 *
252 * ### Example with parameter annotations
253 *
254 * ```
255 * var MyService = ng.Class({
256 * constructor: [String, [new Optional(), Service], function(name, myService) {
257 * ...
258 * }]
259 * });
260 * ```
261 *
262 * is equivalent to ES6:
263 *
264 * ```
265 * class MyService {
266 * constructor(name: string, \@Optional() myService: Service) {
267 * ...
268 * }
269 * }
270 * ```
271 *
272 * ### Example with inheritance
273 *
274 * ```
275 * var Shape = ng.Class({
276 * constructor: (color) {
277 * this.color = color;
278 * }
279 * });
280 *
281 * var Square = ng.Class({
282 * extends: Shape,
283 * constructor: function(color, size) {
284 * Shape.call(this, color);
285 * this.size = size;
286 * }
287 * });
288 * ```
289 * \@stable
290 * @param {?} clsDef
291 * @return {?}
292 */
293 function Class(clsDef) {
294 var /** @type {?} */ constructor = applyParams(clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor');
295 var /** @type {?} */ proto = constructor.prototype;
296 if (clsDef.hasOwnProperty('extends')) {
297 if (typeof clsDef.extends === 'function') {
298 ((constructor)).prototype = proto =
299 Object.create(((clsDef.extends)).prototype);
300 }
301 else {
302 throw new Error("Class definition 'extends' property must be a constructor function was: " + stringify(clsDef.extends));
303 }
304 }
305 for (var key in clsDef) {
306 if (key !== 'extends' && key !== 'prototype' && clsDef.hasOwnProperty(key)) {
307 proto[key] = applyParams(clsDef[key], key);
308 }
309 }
310 if (this && this.annotations instanceof Array) {
311 Reflect.defineMetadata('annotations', this.annotations, constructor);
312 }
313 var /** @type {?} */ constructorName = constructor['name'];
314 if (!constructorName || constructorName === 'constructor') {
315 ((constructor))['overriddenName'] = "class" + _nextClassId++;
316 }
317 return (constructor);
318 }
319 /**
320 * @param {?} name
321 * @param {?} props
322 * @param {?=} parentClass
323 * @param {?=} chainFn
324 * @return {?}
325 */
326 function makeDecorator(name, props, parentClass, chainFn) {
327 if (chainFn === void 0) { chainFn = null; }
328 var /** @type {?} */ metaCtor = makeMetadataCtor([props]);
329 /**
330 * @param {?} objOrType
331 * @return {?}
332 */
333 function DecoratorFactory(objOrType) {
334 if (!(Reflect && Reflect.getOwnMetadata)) {
335 throw 'reflect-metadata shim is required when using class decorators';
336 }
337 if (this instanceof DecoratorFactory) {
338 metaCtor.call(this, objOrType);
339 return this;
340 }
341 var /** @type {?} */ annotationInstance = new ((DecoratorFactory))(objOrType);
342 var /** @type {?} */ chainAnnotation = typeof this === 'function' && Array.isArray(this.annotations) ? this.annotations : [];
343 chainAnnotation.push(annotationInstance);
344 var /** @type {?} */ TypeDecorator = (function TypeDecorator(cls) {
345 var /** @type {?} */ annotations = Reflect.getOwnMetadata('annotations', cls) || [];
346 annotations.push(annotationInstance);
347 Reflect.defineMetadata('annotations', annotations, cls);
348 return cls;
349 });
350 TypeDecorator.annotations = chainAnnotation;
351 TypeDecorator.Class = Class;
352 if (chainFn)
353 chainFn(TypeDecorator);
354 return TypeDecorator;
355 }
356 if (parentClass) {
357 DecoratorFactory.prototype = Object.create(parentClass.prototype);
358 }
359 DecoratorFactory.prototype.toString = function () { return ("@" + name); };
360 ((DecoratorFactory)).annotationCls = DecoratorFactory;
361 return DecoratorFactory;
362 }
363 /**
364 * @param {?} props
365 * @return {?}
366 */
367 function makeMetadataCtor(props) {
368 return function ctor() {
369 var _this = this;
370 var args = [];
371 for (var _i = 0; _i < arguments.length; _i++) {
372 args[_i - 0] = arguments[_i];
373 }
374 props.forEach(function (prop, i) {
375 var /** @type {?} */ argVal = args[i];
376 if (Array.isArray(prop)) {
377 // plain parameter
378 _this[prop[0]] = argVal === undefined ? prop[1] : argVal;
379 }
380 else {
381 for (var propName in prop) {
382 _this[propName] =
383 argVal && argVal.hasOwnProperty(propName) ? argVal[propName] : prop[propName];
384 }
385 }
386 });
387 };
388 }
389 /**
390 * @param {?} name
391 * @param {?} props
392 * @param {?=} parentClass
393 * @return {?}
394 */
395 function makeParamDecorator(name, props, parentClass) {
396 var /** @type {?} */ metaCtor = makeMetadataCtor(props);
397 /**
398 * @param {...?} args
399 * @return {?}
400 */
401 function ParamDecoratorFactory() {
402 var args = [];
403 for (var _i = 0; _i < arguments.length; _i++) {
404 args[_i - 0] = arguments[_i];
405 }
406 if (this instanceof ParamDecoratorFactory) {
407 metaCtor.apply(this, args);
408 return this;
409 }
410 var /** @type {?} */ annotationInstance = new ((_a = ((ParamDecoratorFactory))).bind.apply(_a, [void 0].concat(args)))();
411 ((ParamDecorator)).annotation = annotationInstance;
412 return ParamDecorator;
413 /**
414 * @param {?} cls
415 * @param {?} unusedKey
416 * @param {?} index
417 * @return {?}
418 */
419 function ParamDecorator(cls, unusedKey, index) {
420 var /** @type {?} */ parameters = Reflect.getOwnMetadata('parameters', cls) || [];
421 // there might be gaps if some in between parameters do not have annotations.
422 // we pad with nulls.
423 while (parameters.length <= index) {
424 parameters.push(null);
425 }
426 parameters[index] = parameters[index] || [];
427 parameters[index].push(annotationInstance);
428 Reflect.defineMetadata('parameters', parameters, cls);
429 return cls;
430 }
431 var _a;
432 }
433 if (parentClass) {
434 ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);
435 }
436 ParamDecoratorFactory.prototype.toString = function () { return ("@" + name); };
437 ((ParamDecoratorFactory)).annotationCls = ParamDecoratorFactory;
438 return ParamDecoratorFactory;
439 }
440 /**
441 * @param {?} name
442 * @param {?} props
443 * @param {?=} parentClass
444 * @return {?}
445 */
446 function makePropDecorator(name, props, parentClass) {
447 var /** @type {?} */ metaCtor = makeMetadataCtor(props);
448 /**
449 * @param {...?} args
450 * @return {?}
451 */
452 function PropDecoratorFactory() {
453 var args = [];
454 for (var _i = 0; _i < arguments.length; _i++) {
455 args[_i - 0] = arguments[_i];
456 }
457 if (this instanceof PropDecoratorFactory) {
458 metaCtor.apply(this, args);
459 return this;
460 }
461 var /** @type {?} */ decoratorInstance = new ((_a = ((PropDecoratorFactory))).bind.apply(_a, [void 0].concat(args)))();
462 return function PropDecorator(target, name) {
463 var /** @type {?} */ meta = Reflect.getOwnMetadata('propMetadata', target.constructor) || {};
464 meta[name] = meta.hasOwnProperty(name) && meta[name] || [];
465 meta[name].unshift(decoratorInstance);
466 Reflect.defineMetadata('propMetadata', meta, target.constructor);
467 };
468 var _a;
469 }
470 if (parentClass) {
471 PropDecoratorFactory.prototype = Object.create(parentClass.prototype);
472 }
473 PropDecoratorFactory.prototype.toString = function () { return ("@" + name); };
474 ((PropDecoratorFactory)).annotationCls = PropDecoratorFactory;
475 return PropDecoratorFactory;
476 }
477
478 /**
479 * Inject decorator and metadata.
480 *
481 * @stable
482 * @Annotation
483 */
484 var /** @type {?} */ Inject = makeParamDecorator('Inject', [['token', undefined]]);
485 /**
486 * Optional decorator and metadata.
487 *
488 * @stable
489 * @Annotation
490 */
491 var /** @type {?} */ Optional = makeParamDecorator('Optional', []);
492 /**
493 * Injectable decorator and metadata.
494 *
495 * @stable
496 * @Annotation
497 */
498 var /** @type {?} */ Injectable = (makeDecorator('Injectable', []));
499 /**
500 * Self decorator and metadata.
501 *
502 * @stable
503 * @Annotation
504 */
505 var /** @type {?} */ Self = makeParamDecorator('Self', []);
506 /**
507 * SkipSelf decorator and metadata.
508 *
509 * @stable
510 * @Annotation
511 */
512 var /** @type {?} */ SkipSelf = makeParamDecorator('SkipSelf', []);
513 /**
514 * Host decorator and metadata.
515 *
516 * @stable
517 * @Annotation
518 */
519 var /** @type {?} */ Host = makeParamDecorator('Host', []);
520
521 var OpaqueToken = (function () {
522 /**
523 * @param {?} _desc
524 */
525 function OpaqueToken(_desc) {
526 this._desc = _desc;
527 }
528 /**
529 * @return {?}
530 */
531 OpaqueToken.prototype.toString = function () { return "Token " + this._desc; };
532 OpaqueToken.decorators = [
533 { type: Injectable },
534 ];
535 /** @nocollapse */
536 OpaqueToken.ctorParameters = function () { return [
537 null,
538 ]; };
539 return OpaqueToken;
540 }());
541
542 /**
543 * This token can be used to create a virtual provider that will populate the
544 * `entryComponents` fields of components and ng modules based on its `useValue`.
545 * All components that are referenced in the `useValue` value (either directly
546 * or in a nested array or map) will be added to the `entryComponents` property.
547 *
548 * ### Example
549 * The following example shows how the router can populate the `entryComponents`
550 * field of an NgModule based on the router configuration which refers
551 * to components.
552 *
553 * ```typescript
554 * // helper function inside the router
555 * function provideRoutes(routes) {
556 * return [
557 * {provide: ROUTES, useValue: routes},
558 * {provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: routes, multi: true}
559 * ];
560 * }
561 *
562 * // user code
563 * let routes = [
564 * {path: '/root', component: RootComp},
565 * {path: '/teams', component: TeamsComp}
566 * ];
567 *
568 * @NgModule({
569 * providers: [provideRoutes(routes)]
570 * })
571 * class ModuleWithRoutes {}
572 * ```
573 *
574 * @experimental
575 */
576 var /** @type {?} */ ANALYZE_FOR_ENTRY_COMPONENTS = new OpaqueToken('AnalyzeForEntryComponents');
577 /**
578 * Attribute decorator and metadata.
579 *
580 * @stable
581 * @Annotation
582 */
583 var /** @type {?} */ Attribute = makeParamDecorator('Attribute', [['attributeName', undefined]]);
584 /**
585 * Base class for query metadata.
586 *
587 * See {\@link ContentChildren}, {\@link ContentChild}, {\@link ViewChildren}, {\@link ViewChild} for
588 * more information.
589 *
590 * \@stable
591 * @abstract
592 */
593 var Query = (function () {
594 function Query() {
595 }
596 return Query;
597 }());
598 /**
599 * ContentChildren decorator and metadata.
600 *
601 * @stable
602 * @Annotation
603 */
604 var /** @type {?} */ ContentChildren = (makePropDecorator('ContentChildren', [
605 ['selector', undefined], {
606 first: false,
607 isViewQuery: false,
608 descendants: false,
609 read: undefined,
610 }
611 ], Query));
612 /**
613 * ContentChild decorator and metadata.
614 *
615 * @stable
616 * @Annotation
617 */
618 var /** @type {?} */ ContentChild = makePropDecorator('ContentChild', [
619 ['selector', undefined], {
620 first: true,
621 isViewQuery: false,
622 descendants: true,
623 read: undefined,
624 }
625 ], Query);
626 /**
627 * ViewChildren decorator and metadata.
628 *
629 * @stable
630 * @Annotation
631 */
632 var /** @type {?} */ ViewChildren = makePropDecorator('ViewChildren', [
633 ['selector', undefined], {
634 first: false,
635 isViewQuery: true,
636 descendants: true,
637 read: undefined,
638 }
639 ], Query);
640 /**
641 * ViewChild decorator and metadata.
642 *
643 * @stable
644 * @Annotation
645 */
646 var /** @type {?} */ ViewChild = makePropDecorator('ViewChild', [
647 ['selector', undefined], {
648 first: true,
649 isViewQuery: true,
650 descendants: true,
651 read: undefined,
652 }
653 ], Query);
654
655 var ChangeDetectionStrategy = {};
656 ChangeDetectionStrategy.OnPush = 0;
657 ChangeDetectionStrategy.Default = 1;
658 ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = "OnPush";
659 ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default";
660 var ChangeDetectorStatus = {};
661 ChangeDetectorStatus.CheckOnce = 0;
662 ChangeDetectorStatus.Checked = 1;
663 ChangeDetectorStatus.CheckAlways = 2;
664 ChangeDetectorStatus.Detached = 3;
665 ChangeDetectorStatus.Errored = 4;
666 ChangeDetectorStatus.Destroyed = 5;
667 ChangeDetectorStatus[ChangeDetectorStatus.CheckOnce] = "CheckOnce";
668 ChangeDetectorStatus[ChangeDetectorStatus.Checked] = "Checked";
669 ChangeDetectorStatus[ChangeDetectorStatus.CheckAlways] = "CheckAlways";
670 ChangeDetectorStatus[ChangeDetectorStatus.Detached] = "Detached";
671 ChangeDetectorStatus[ChangeDetectorStatus.Errored] = "Errored";
672 ChangeDetectorStatus[ChangeDetectorStatus.Destroyed] = "Destroyed";
673 /**
674 * @param {?} changeDetectionStrategy
675 * @return {?}
676 */
677 function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
678 return isBlank(changeDetectionStrategy) ||
679 changeDetectionStrategy === ChangeDetectionStrategy.Default;
680 }
681
682 /**
683 * Directive decorator and metadata.
684 *
685 * @stable
686 * @Annotation
687 */
688 var /** @type {?} */ Directive = (makeDecorator('Directive', {
689 selector: undefined,
690 inputs: undefined,
691 outputs: undefined,
692 host: undefined,
693 providers: undefined,
694 exportAs: undefined,
695 queries: undefined
696 }));
697 /**
698 * Component decorator and metadata.
699 *
700 * @stable
701 * @Annotation
702 */
703 var /** @type {?} */ Component = (makeDecorator('Component', {
704 selector: undefined,
705 inputs: undefined,
706 outputs: undefined,
707 host: undefined,
708 exportAs: undefined,
709 moduleId: undefined,
710 providers: undefined,
711 viewProviders: undefined,
712 changeDetection: ChangeDetectionStrategy.Default,
713 queries: undefined,
714 templateUrl: undefined,
715 template: undefined,
716 styleUrls: undefined,
717 styles: undefined,
718 animations: undefined,
719 encapsulation: undefined,
720 interpolation: undefined,
721 entryComponents: undefined
722 }, Directive));
723 /**
724 * Pipe decorator and metadata.
725 *
726 * @stable
727 * @Annotation
728 */
729 var /** @type {?} */ Pipe = (makeDecorator('Pipe', {
730 name: undefined,
731 pure: true,
732 }));
733 /**
734 * Input decorator and metadata.
735 *
736 * @stable
737 * @Annotation
738 */
739 var /** @type {?} */ Input = makePropDecorator('Input', [['bindingPropertyName', undefined]]);
740 /**
741 * Output decorator and metadata.
742 *
743 * @stable
744 * @Annotation
745 */
746 var /** @type {?} */ Output = makePropDecorator('Output', [['bindingPropertyName', undefined]]);
747 /**
748 * HostBinding decorator and metadata.
749 *
750 * @stable
751 * @Annotation
752 */
753 var /** @type {?} */ HostBinding = makePropDecorator('HostBinding', [['hostPropertyName', undefined]]);
754 /**
755 * HostListener decorator and metadata.
756 *
757 * @stable
758 * @Annotation
759 */
760 var /** @type {?} */ HostListener = makePropDecorator('HostListener', [['eventName', undefined], ['args', []]]);
761
762 /**
763 * @license
764 * Copyright Google Inc. All Rights Reserved.
765 *
766 * Use of this source code is governed by an MIT-style license that can be
767 * found in the LICENSE file at https://angular.io/license
768 */
769 var LifecycleHooks = {};
770 LifecycleHooks.OnInit = 0;
771 LifecycleHooks.OnDestroy = 1;
772 LifecycleHooks.DoCheck = 2;
773 LifecycleHooks.OnChanges = 3;
774 LifecycleHooks.AfterContentInit = 4;
775 LifecycleHooks.AfterContentChecked = 5;
776 LifecycleHooks.AfterViewInit = 6;
777 LifecycleHooks.AfterViewChecked = 7;
778 LifecycleHooks[LifecycleHooks.OnInit] = "OnInit";
779 LifecycleHooks[LifecycleHooks.OnDestroy] = "OnDestroy";
780 LifecycleHooks[LifecycleHooks.DoCheck] = "DoCheck";
781 LifecycleHooks[LifecycleHooks.OnChanges] = "OnChanges";
782 LifecycleHooks[LifecycleHooks.AfterContentInit] = "AfterContentInit";
783 LifecycleHooks[LifecycleHooks.AfterContentChecked] = "AfterContentChecked";
784 LifecycleHooks[LifecycleHooks.AfterViewInit] = "AfterViewInit";
785 LifecycleHooks[LifecycleHooks.AfterViewChecked] = "AfterViewChecked";
786 var /** @type {?} */ LIFECYCLE_HOOKS_VALUES = [
787 LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges,
788 LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit,
789 LifecycleHooks.AfterViewChecked
790 ];
791 /**
792 * \@whatItDoes Lifecycle hook that is called when any data-bound property of a directive changes.
793 * \@howToUse
794 * {\@example core/ts/metadata/lifecycle_hooks_spec.ts region='OnChanges'}
795 *
796 * \@description
797 * `ngOnChanges` is called right after the data-bound properties have been checked and before view
798 * and content children are checked if at least one of them has changed.
799 * The `changes` parameter contains the changed properties.
800 *
801 * See {\@linkDocs guide/lifecycle-hooks#onchanges "Lifecycle Hooks Guide"}.
802 *
803 * \@stable
804 * @abstract
805 */
806 var OnChanges = (function () {
807 function OnChanges() {
808 }
809 /**
810 * @abstract
811 * @param {?} changes
812 * @return {?}
813 */
814 OnChanges.prototype.ngOnChanges = function (changes) { };
815 return OnChanges;
816 }());
817 /**
818 * \@whatItDoes Lifecycle hook that is called after data-bound properties of a directive are
819 * initialized.
820 * \@howToUse
821 * {\@example core/ts/metadata/lifecycle_hooks_spec.ts region='OnInit'}
822 *
823 * \@description
824 * `ngOnInit` is called right after the directive's data-bound properties have been checked for the
825 * first time, and before any of its children have been checked. It is invoked only once when the
826 * directive is instantiated.
827 *
828 * See {\@linkDocs guide/lifecycle-hooks "Lifecycle Hooks Guide"}.
829 *
830 * \@stable
831 * @abstract
832 */
833 var OnInit = (function () {
834 function OnInit() {
835 }
836 /**
837 * @abstract
838 * @return {?}
839 */
840 OnInit.prototype.ngOnInit = function () { };
841 return OnInit;
842 }());
843 /**
844 * \@whatItDoes Lifecycle hook that is called when Angular dirty checks a directive.
845 * \@howToUse
846 * {\@example core/ts/metadata/lifecycle_hooks_spec.ts region='DoCheck'}
847 *
848 * \@description
849 * `ngDoCheck` gets called to check the changes in the directives in addition to the default
850 * algorithm. The default change detection algorithm looks for differences by comparing
851 * bound-property values by reference across change detection runs.
852 *
853 * Note that a directive typically should not use both `DoCheck` and {\@link OnChanges} to respond to
854 * changes on the same input, as `ngOnChanges` will continue to be called when the default change
855 * detector detects changes.
856 *
857 * See {\@link KeyValueDiffers} and {\@link IterableDiffers} for implementing custom dirty checking
858 * for collections.
859 *
860 * See {\@linkDocs guide/lifecycle-hooks#docheck "Lifecycle Hooks Guide"}.
861 *
862 * \@stable
863 * @abstract
864 */
865 var DoCheck = (function () {
866 function DoCheck() {
867 }
868 /**
869 * @abstract
870 * @return {?}
871 */
872 DoCheck.prototype.ngDoCheck = function () { };
873 return DoCheck;
874 }());
875 /**
876 * \@whatItDoes Lifecycle hook that is called when a directive, pipe or service is destroyed.
877 * \@howToUse
878 * {\@example core/ts/metadata/lifecycle_hooks_spec.ts region='OnDestroy'}
879 *
880 * \@description
881 * `ngOnDestroy` callback is typically used for any custom cleanup that needs to occur when the
882 * instance is destroyed.
883 *
884 * See {\@linkDocs guide/lifecycle-hooks "Lifecycle Hooks Guide"}.
885 *
886 * \@stable
887 * @abstract
888 */
889 var OnDestroy = (function () {
890 function OnDestroy() {
891 }
892 /**
893 * @abstract
894 * @return {?}
895 */
896 OnDestroy.prototype.ngOnDestroy = function () { };
897 return OnDestroy;
898 }());
899 /**
900 *
901 * \@whatItDoes Lifecycle hook that is called after a directive's content has been fully
902 * initialized.
903 * \@howToUse
904 * {\@example core/ts/metadata/lifecycle_hooks_spec.ts region='AfterContentInit'}
905 *
906 * \@description
907 * See {\@linkDocs guide/lifecycle-hooks#aftercontent "Lifecycle Hooks Guide"}.
908 *
909 * \@stable
910 * @abstract
911 */
912 var AfterContentInit = (function () {
913 function AfterContentInit() {
914 }
915 /**
916 * @abstract
917 * @return {?}
918 */
919 AfterContentInit.prototype.ngAfterContentInit = function () { };
920 return AfterContentInit;
921 }());
922 /**
923 * \@whatItDoes Lifecycle hook that is called after every check of a directive's content.
924 * \@howToUse
925 * {\@example core/ts/metadata/lifecycle_hooks_spec.ts region='AfterContentChecked'}
926 *
927 * \@description
928 * See {\@linkDocs guide/lifecycle-hooks#aftercontent "Lifecycle Hooks Guide"}.
929 *
930 * \@stable
931 * @abstract
932 */
933 var AfterContentChecked = (function () {
934 function AfterContentChecked() {
935 }
936 /**
937 * @abstract
938 * @return {?}
939 */
940 AfterContentChecked.prototype.ngAfterContentChecked = function () { };
941 return AfterContentChecked;
942 }());
943 /**
944 * \@whatItDoes Lifecycle hook that is called after a component's view has been fully
945 * initialized.
946 * \@howToUse
947 * {\@example core/ts/metadata/lifecycle_hooks_spec.ts region='AfterViewInit'}
948 *
949 * \@description
950 * See {\@linkDocs guide/lifecycle-hooks#afterview "Lifecycle Hooks Guide"}.
951 *
952 * \@stable
953 * @abstract
954 */
955 var AfterViewInit = (function () {
956 function AfterViewInit() {
957 }
958 /**
959 * @abstract
960 * @return {?}
961 */
962 AfterViewInit.prototype.ngAfterViewInit = function () { };
963 return AfterViewInit;
964 }());
965 /**
966 * \@whatItDoes Lifecycle hook that is called after every check of a component's view.
967 * \@howToUse
968 * {\@example core/ts/metadata/lifecycle_hooks_spec.ts region='AfterViewChecked'}
969 *
970 * \@description
971 * See {\@linkDocs guide/lifecycle-hooks#afterview "Lifecycle Hooks Guide"}.
972 *
973 * \@stable
974 * @abstract
975 */
976 var AfterViewChecked = (function () {
977 function AfterViewChecked() {
978 }
979 /**
980 * @abstract
981 * @return {?}
982 */
983 AfterViewChecked.prototype.ngAfterViewChecked = function () { };
984 return AfterViewChecked;
985 }());
986
987 /**
988 * Defines a schema that will allow:
989 * - any non-Angular elements with a `-` in their name,
990 * - any properties on elements with a `-` in their name which is the common rule for custom
991 * elements.
992 *
993 * @stable
994 */
995 var /** @type {?} */ CUSTOM_ELEMENTS_SCHEMA = {
996 name: 'custom-elements'
997 };
998 /**
999 * Defines a schema that will allow any property on any element.
1000 *
1001 * @experimental
1002 */
1003 var /** @type {?} */ NO_ERRORS_SCHEMA = {
1004 name: 'no-errors-schema'
1005 };
1006 /**
1007 * NgModule decorator and metadata.
1008 *
1009 * @stable
1010 * @Annotation
1011 */
1012 var /** @type {?} */ NgModule = (makeDecorator('NgModule', {
1013 providers: undefined,
1014 declarations: undefined,
1015 imports: undefined,
1016 exports: undefined,
1017 entryComponents: undefined,
1018 bootstrap: undefined,
1019 schemas: undefined,
1020 id: undefined,
1021 }));
1022
1023 /**
1024 * @license
1025 * Copyright Google Inc. All Rights Reserved.
1026 *
1027 * Use of this source code is governed by an MIT-style license that can be
1028 * found in the LICENSE file at https://angular.io/license
1029 */
1030 var ViewEncapsulation = {};
1031 ViewEncapsulation.Emulated = 0;
1032 ViewEncapsulation.Native = 1;
1033 ViewEncapsulation.None = 2;
1034 ViewEncapsulation[ViewEncapsulation.Emulated] = "Emulated";
1035 ViewEncapsulation[ViewEncapsulation.Native] = "Native";
1036 ViewEncapsulation[ViewEncapsulation.None] = "None";
1037 /**
1038 * Metadata properties available for configuring Views.
1039 *
1040 * For details on the `\@Component` annotation, see {\@link Component}.
1041 *
1042 * ### Example
1043 *
1044 * ```
1045 * \@Component({
1046 * selector: 'greet',
1047 * template: 'Hello {{name}}!',
1048 * })
1049 * class Greet {
1050 * name: string;
1051 *
1052 * constructor() {
1053 * this.name = 'World';
1054 * }
1055 * }
1056 * ```
1057 *
1058 * @deprecated Use Component instead.
1059 *
1060 * {\@link Component}
1061 */
1062 var ViewMetadata = (function () {
1063 /**
1064 * @param {?=} __0
1065 */
1066 function ViewMetadata(_a) {
1067 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;
1068 this.templateUrl = templateUrl;
1069 this.template = template;
1070 this.styleUrls = styleUrls;
1071 this.styles = styles;
1072 this.encapsulation = encapsulation;
1073 this.animations = animations;
1074 this.interpolation = interpolation;
1075 }
1076 return ViewMetadata;
1077 }());
1078
1079 /**
1080 * \@whatItDoes Represents the version of Angular
1081 *
1082 * \@stable
1083 */
1084 var Version = (function () {
1085 /**
1086 * @param {?} full
1087 */
1088 function Version(full) {
1089 this.full = full;
1090 }
1091 Object.defineProperty(Version.prototype, "major", {
1092 /**
1093 * @return {?}
1094 */
1095 get: function () { return this.full.split('.')[0]; },
1096 enumerable: true,
1097 configurable: true
1098 });
1099 Object.defineProperty(Version.prototype, "minor", {
1100 /**
1101 * @return {?}
1102 */
1103 get: function () { return this.full.split('.')[1]; },
1104 enumerable: true,
1105 configurable: true
1106 });
1107 Object.defineProperty(Version.prototype, "patch", {
1108 /**
1109 * @return {?}
1110 */
1111 get: function () { return this.full.split('.').slice(2).join('.'); },
1112 enumerable: true,
1113 configurable: true
1114 });
1115 return Version;
1116 }());
1117 /**
1118 * @stable
1119 */
1120 var /** @type {?} */ VERSION = new Version('2.4.10');
1121
1122 /**
1123 * Allows to refer to references which are not yet defined.
1124 *
1125 * For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of
1126 * DI is declared,
1127 * but not yet defined. It is also used when the `token` which we use when creating a query is not
1128 * yet defined.
1129 *
1130 * ### Example
1131 * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'}
1132 * \@experimental
1133 * @param {?} forwardRefFn
1134 * @return {?}
1135 */
1136 function forwardRef(forwardRefFn) {
1137 ((forwardRefFn)).__forward_ref__ = forwardRef;
1138 ((forwardRefFn)).toString = function () { return stringify(this()); };
1139 return (((forwardRefFn)));
1140 }
1141 /**
1142 * Lazily retrieves the reference value from a forwardRef.
1143 *
1144 * Acts as the identity function when given a non-forward-ref value.
1145 *
1146 * ### Example ([live demo](http://plnkr.co/edit/GU72mJrk1fiodChcmiDR?p=preview))
1147 *
1148 * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'}
1149 *
1150 * See: {\@link forwardRef}
1151 * \@experimental
1152 * @param {?} type
1153 * @return {?}
1154 */
1155 function resolveForwardRef(type) {
1156 if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') &&
1157 type.__forward_ref__ === forwardRef) {
1158 return ((type))();
1159 }
1160 else {
1161 return type;
1162 }
1163 }
1164
1165 var /** @type {?} */ _THROW_IF_NOT_FOUND = new Object();
1166 var /** @type {?} */ THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
1167 var _NullInjector = (function () {
1168 function _NullInjector() {
1169 }
1170 /**
1171 * @param {?} token
1172 * @param {?=} notFoundValue
1173 * @return {?}
1174 */
1175 _NullInjector.prototype.get = function (token, notFoundValue) {
1176 if (notFoundValue === void 0) { notFoundValue = _THROW_IF_NOT_FOUND; }
1177 if (notFoundValue === _THROW_IF_NOT_FOUND) {
1178 throw new Error("No provider for " + stringify(token) + "!");
1179 }
1180 return notFoundValue;
1181 };
1182 return _NullInjector;
1183 }());
1184 /**
1185 * \@whatItDoes Injector interface
1186 * \@howToUse
1187 * ```
1188 * const injector: Injector = ...;
1189 * injector.get(...);
1190 * ```
1191 *
1192 * \@description
1193 * For more details, see the {\@linkDocs guide/dependency-injection "Dependency Injection Guide"}.
1194 *
1195 * ### Example
1196 *
1197 * {\@example core/di/ts/injector_spec.ts region='Injector'}
1198 *
1199 * `Injector` returns itself when given `Injector` as a token:
1200 * {\@example core/di/ts/injector_spec.ts region='injectInjector'}
1201 *
1202 * \@stable
1203 * @abstract
1204 */
1205 var Injector = (function () {
1206 function Injector() {
1207 }
1208 /**
1209 * Retrieves an instance from the injector based on the provided token.
1210 * If not found:
1211 * - Throws {\@link NoProviderError} if no `notFoundValue` that is not equal to
1212 * Injector.THROW_IF_NOT_FOUND is given
1213 * - Returns the `notFoundValue` otherwise
1214 * @abstract
1215 * @param {?} token
1216 * @param {?=} notFoundValue
1217 * @return {?}
1218 */
1219 Injector.prototype.get = function (token, notFoundValue) { };
1220 Injector.THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
1221 Injector.NULL = new _NullInjector();
1222 return Injector;
1223 }());
1224
1225 var __extends$1 = (this && this.__extends) || function (d, b) {
1226 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
1227 function __() { this.constructor = d; }
1228 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1229 };
1230 /**
1231 * \@stable
1232 */
1233 var BaseError = (function (_super) {
1234 __extends$1(BaseError, _super);
1235 /**
1236 * @param {?} message
1237 */
1238 function BaseError(message) {
1239 _super.call(this, message);
1240 // Errors don't use current this, instead they create a new instance.
1241 // We have to do forward all of our api to the nativeInstance.
1242 // TODO(bradfordcsmith): Remove this hack when
1243 // google/closure-compiler/issues/2102 is fixed.
1244 var nativeError = new Error(message);
1245 this._nativeError = nativeError;
1246 }
1247 Object.defineProperty(BaseError.prototype, "message", {
1248 /**
1249 * @return {?}
1250 */
1251 get: function () { return this._nativeError.message; },
1252 /**
1253 * @param {?} message
1254 * @return {?}
1255 */
1256 set: function (message) { this._nativeError.message = message; },
1257 enumerable: true,
1258 configurable: true
1259 });
1260 Object.defineProperty(BaseError.prototype, "name", {
1261 /**
1262 * @return {?}
1263 */
1264 get: function () { return this._nativeError.name; },
1265 enumerable: true,
1266 configurable: true
1267 });
1268 Object.defineProperty(BaseError.prototype, "stack", {
1269 /**
1270 * @return {?}
1271 */
1272 get: function () { return ((this._nativeError)).stack; },
1273 /**
1274 * @param {?} value
1275 * @return {?}
1276 */
1277 set: function (value) { ((this._nativeError)).stack = value; },
1278 enumerable: true,
1279 configurable: true
1280 });
1281 /**
1282 * @return {?}
1283 */
1284 BaseError.prototype.toString = function () { return this._nativeError.toString(); };
1285 return BaseError;
1286 }(Error));
1287 /**
1288 * \@stable
1289 */
1290 var WrappedError = (function (_super) {
1291 __extends$1(WrappedError, _super);
1292 /**
1293 * @param {?} message
1294 * @param {?} error
1295 */
1296 function WrappedError(message, error) {
1297 _super.call(this, message + " caused by: " + (error instanceof Error ? error.message : error));
1298 this.originalError = error;
1299 }
1300 Object.defineProperty(WrappedError.prototype, "stack", {
1301 /**
1302 * @return {?}
1303 */
1304 get: function () {
1305 return (((this.originalError instanceof Error ? this.originalError : this._nativeError)))
1306 .stack;
1307 },
1308 enumerable: true,
1309 configurable: true
1310 });
1311 return WrappedError;
1312 }(BaseError));
1313
1314 /**
1315 * @license
1316 * Copyright Google Inc. All Rights Reserved.
1317 *
1318 * Use of this source code is governed by an MIT-style license that can be
1319 * found in the LICENSE file at https://angular.io/license
1320 */
1321 var __extends = (this && this.__extends) || function (d, b) {
1322 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
1323 function __() { this.constructor = d; }
1324 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
1325 };
1326 /**
1327 * @param {?} keys
1328 * @return {?}
1329 */
1330 function findFirstClosedCycle(keys) {
1331 var /** @type {?} */ res = [];
1332 for (var /** @type {?} */ i = 0; i < keys.length; ++i) {
1333 if (res.indexOf(keys[i]) > -1) {
1334 res.push(keys[i]);
1335 return res;
1336 }
1337 res.push(keys[i]);
1338 }
1339 return res;
1340 }
1341 /**
1342 * @param {?} keys
1343 * @return {?}
1344 */
1345 function constructResolvingPath(keys) {
1346 if (keys.length > 1) {
1347 var /** @type {?} */ reversed = findFirstClosedCycle(keys.slice().reverse());
1348 var /** @type {?} */ tokenStrs = reversed.map(function (k) { return stringify(k.token); });
1349 return ' (' + tokenStrs.join(' -> ') + ')';
1350 }
1351 return '';
1352 }
1353 /**
1354 * Base class for all errors arising from misconfigured providers.
1355 * \@stable
1356 */
1357 var AbstractProviderError = (function (_super) {
1358 __extends(AbstractProviderError, _super);
1359 /**
1360 * @param {?} injector
1361 * @param {?} key
1362 * @param {?} constructResolvingMessage
1363 */
1364 function AbstractProviderError(injector, key, constructResolvingMessage) {
1365 _super.call(this, 'DI Error');
1366 this.keys = [key];
1367 this.injectors = [injector];
1368 this.constructResolvingMessage = constructResolvingMessage;
1369 this.message = this.constructResolvingMessage(this.keys);
1370 }
1371 /**
1372 * @param {?} injector
1373 * @param {?} key
1374 * @return {?}
1375 */
1376 AbstractProviderError.prototype.addKey = function (injector, key) {
1377 this.injectors.push(injector);
1378 this.keys.push(key);
1379 this.message = this.constructResolvingMessage(this.keys);
1380 };
1381 return AbstractProviderError;
1382 }(BaseError));
1383 /**
1384 * Thrown when trying to retrieve a dependency by key from {\@link Injector}, but the
1385 * {\@link Injector} does not have a {\@link Provider} for the given key.
1386 *
1387 * ### Example ([live demo](http://plnkr.co/edit/vq8D3FRB9aGbnWJqtEPE?p=preview))
1388 *
1389 * ```typescript
1390 * class A {
1391 * constructor(b:B) {}
1392 * }
1393 *
1394 * expect(() => Injector.resolveAndCreate([A])).toThrowError();
1395 * ```
1396 * \@stable
1397 */
1398 var NoProviderError = (function (_super) {
1399 __extends(NoProviderError, _super);
1400 /**
1401 * @param {?} injector
1402 * @param {?} key
1403 */
1404 function NoProviderError(injector, key) {
1405 _super.call(this, injector, key, function (keys) {
1406 var first = stringify(keys[0].token);
1407 return "No provider for " + first + "!" + constructResolvingPath(keys);
1408 });
1409 }
1410 return NoProviderError;
1411 }(AbstractProviderError));
1412 /**
1413 * Thrown when dependencies form a cycle.
1414 *
1415 * ### Example ([live demo](http://plnkr.co/edit/wYQdNos0Tzql3ei1EV9j?p=info))
1416 *
1417 * ```typescript
1418 * var injector = Injector.resolveAndCreate([
1419 * {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]},
1420 * {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]}
1421 * ]);
1422 *
1423 * expect(() => injector.get("one")).toThrowError();
1424 * ```
1425 *
1426 * Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed.
1427 * \@stable
1428 */
1429 var CyclicDependencyError = (function (_super) {
1430 __extends(CyclicDependencyError, _super);
1431 /**
1432 * @param {?} injector
1433 * @param {?} key
1434 */
1435 function CyclicDependencyError(injector, key) {
1436 _super.call(this, injector, key, function (keys) {
1437 return "Cannot instantiate cyclic dependency!" + constructResolvingPath(keys);
1438 });
1439 }
1440 return CyclicDependencyError;
1441 }(AbstractProviderError));
1442 /**
1443 * Thrown when a constructing type returns with an Error.
1444 *
1445 * The `InstantiationError` class contains the original error plus the dependency graph which caused
1446 * this object to be instantiated.
1447 *
1448 * ### Example ([live demo](http://plnkr.co/edit/7aWYdcqTQsP0eNqEdUAf?p=preview))
1449 *
1450 * ```typescript
1451 * class A {
1452 * constructor() {
1453 * throw new Error('message');
1454 * }
1455 * }
1456 *
1457 * var injector = Injector.resolveAndCreate([A]);
1458 * try {
1459 * injector.get(A);
1460 * } catch (e) {
1461 * expect(e instanceof InstantiationError).toBe(true);
1462 * expect(e.originalException.message).toEqual("message");
1463 * expect(e.originalStack).toBeDefined();
1464 * }
1465 * ```
1466 * \@stable
1467 */
1468 var InstantiationError = (function (_super) {
1469 __extends(InstantiationError, _super);
1470 /**
1471 * @param {?} injector
1472 * @param {?} originalException
1473 * @param {?} originalStack
1474 * @param {?} key
1475 */
1476 function InstantiationError(injector, originalException, originalStack, key) {
1477 _super.call(this, 'DI Error', originalException);
1478 this.keys = [key];
1479 this.injectors = [injector];
1480 }
1481 /**
1482 * @param {?} injector
1483 * @param {?} key
1484 * @return {?}
1485 */
1486 InstantiationError.prototype.addKey = function (injector, key) {
1487 this.injectors.push(injector);
1488 this.keys.push(key);
1489 };
1490 Object.defineProperty(InstantiationError.prototype, "message", {
1491 /**
1492 * @return {?}
1493 */
1494 get: function () {
1495 var /** @type {?} */ first = stringify(this.keys[0].token);
1496 return this.originalError.message + ": Error during instantiation of " + first + "!" + constructResolvingPath(this.keys) + ".";
1497 },
1498 enumerable: true,
1499 configurable: true
1500 });
1501 Object.defineProperty(InstantiationError.prototype, "causeKey", {
1502 /**
1503 * @return {?}
1504 */
1505 get: function () { return this.keys[0]; },
1506 enumerable: true,
1507 configurable: true
1508 });
1509 return InstantiationError;
1510 }(WrappedError));
1511 /**
1512 * Thrown when an object other then {\@link Provider} (or `Type`) is passed to {\@link Injector}
1513 * creation.
1514 *
1515 * ### Example ([live demo](http://plnkr.co/edit/YatCFbPAMCL0JSSQ4mvH?p=preview))
1516 *
1517 * ```typescript
1518 * expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError();
1519 * ```
1520 * \@stable
1521 */
1522 var InvalidProviderError = (function (_super) {
1523 __extends(InvalidProviderError, _super);
1524 /**
1525 * @param {?} provider
1526 */
1527 function InvalidProviderError(provider) {
1528 _super.call(this, "Invalid provider - only instances of Provider and Type are allowed, got: " + provider);
1529 }
1530 return InvalidProviderError;
1531 }(BaseError));
1532 /**
1533 * Thrown when the class has no annotation information.
1534 *
1535 * Lack of annotation information prevents the {\@link Injector} from determining which dependencies
1536 * need to be injected into the constructor.
1537 *
1538 * ### Example ([live demo](http://plnkr.co/edit/rHnZtlNS7vJOPQ6pcVkm?p=preview))
1539 *
1540 * ```typescript
1541 * class A {
1542 * constructor(b) {}
1543 * }
1544 *
1545 * expect(() => Injector.resolveAndCreate([A])).toThrowError();
1546 * ```
1547 *
1548 * This error is also thrown when the class not marked with {\@link Injectable} has parameter types.
1549 *
1550 * ```typescript
1551 * class B {}
1552 *
1553 * class A {
1554 * constructor(b:B) {} // no information about the parameter types of A is available at runtime.
1555 * }
1556 *
1557 * expect(() => Injector.resolveAndCreate([A,B])).toThrowError();
1558 * ```
1559 * \@stable
1560 */
1561 var NoAnnotationError = (function (_super) {
1562 __extends(NoAnnotationError, _super);
1563 /**
1564 * @param {?} typeOrFunc
1565 * @param {?} params
1566 */
1567 function NoAnnotationError(typeOrFunc, params) {
1568 _super.call(this, NoAnnotationError._genMessage(typeOrFunc, params));
1569 }
1570 /**
1571 * @param {?} typeOrFunc
1572 * @param {?} params
1573 * @return {?}
1574 */
1575 NoAnnotationError._genMessage = function (typeOrFunc, params) {
1576 var /** @type {?} */ signature = [];
1577 for (var /** @type {?} */ i = 0, /** @type {?} */ ii = params.length; i < ii; i++) {
1578 var /** @type {?} */ parameter = params[i];
1579 if (!parameter || parameter.length == 0) {
1580 signature.push('?');
1581 }
1582 else {
1583 signature.push(parameter.map(stringify).join(' '));
1584 }
1585 }
1586 return 'Cannot resolve all parameters for \'' + stringify(typeOrFunc) + '\'(' +
1587 signature.join(', ') + '). ' +
1588 'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' +
1589 stringify(typeOrFunc) + '\' is decorated with Injectable.';
1590 };
1591 return NoAnnotationError;
1592 }(BaseError));
1593 /**
1594 * Thrown when getting an object by index.
1595 *
1596 * ### Example ([live demo](http://plnkr.co/edit/bRs0SX2OTQiJzqvjgl8P?p=preview))
1597 *
1598 * ```typescript
1599 * class A {}
1600 *
1601 * var injector = Injector.resolveAndCreate([A]);
1602 *
1603 * expect(() => injector.getAt(100)).toThrowError();
1604 * ```
1605 * \@stable
1606 */
1607 var OutOfBoundsError = (function (_super) {
1608 __extends(OutOfBoundsError, _super);
1609 /**
1610 * @param {?} index
1611 */
1612 function OutOfBoundsError(index) {
1613 _super.call(this, "Index " + index + " is out-of-bounds.");
1614 }
1615 return OutOfBoundsError;
1616 }(BaseError));
1617 /**
1618 * Thrown when a multi provider and a regular provider are bound to the same token.
1619 *
1620 * ### Example
1621 *
1622 * ```typescript
1623 * expect(() => Injector.resolveAndCreate([
1624 * { provide: "Strings", useValue: "string1", multi: true},
1625 * { provide: "Strings", useValue: "string2", multi: false}
1626 * ])).toThrowError();
1627 * ```
1628 */
1629 var MixingMultiProvidersWithRegularProvidersError = (function (_super) {
1630 __extends(MixingMultiProvidersWithRegularProvidersError, _super);
1631 /**
1632 * @param {?} provider1
1633 * @param {?} provider2
1634 */
1635 function MixingMultiProvidersWithRegularProvidersError(provider1, provider2) {
1636 _super.call(this, 'Cannot mix multi providers and regular providers, got: ' + provider1.toString() + ' ' +
1637 provider2.toString());
1638 }
1639 return MixingMultiProvidersWithRegularProvidersError;
1640 }(BaseError));
1641
1642 /**
1643 * A unique object used for retrieving items from the {\@link ReflectiveInjector}.
1644 *
1645 * Keys have:
1646 * - a system-wide unique `id`.
1647 * - a `token`.
1648 *
1649 * `Key` is used internally by {\@link ReflectiveInjector} because its system-wide unique `id` allows
1650 * the
1651 * injector to store created objects in a more efficient way.
1652 *
1653 * `Key` should not be created directly. {\@link ReflectiveInjector} creates keys automatically when
1654 * resolving
1655 * providers.
1656 * \@experimental
1657 */
1658 var ReflectiveKey = (function () {
1659 /**
1660 * Private
1661 * @param {?} token
1662 * @param {?} id
1663 */
1664 function ReflectiveKey(token, id) {
1665 this.token = token;
1666 this.id = id;
1667 if (!token) {
1668 throw new Error('Token must be defined!');
1669 }
1670 }
1671 Object.defineProperty(ReflectiveKey.prototype, "displayName", {
1672 /**
1673 * Returns a stringified token.
1674 * @return {?}
1675 */
1676 get: function () { return stringify(this.token); },
1677 enumerable: true,
1678 configurable: true
1679 });
1680 /**
1681 * Retrieves a `Key` for a token.
1682 * @param {?} token
1683 * @return {?}
1684 */
1685 ReflectiveKey.get = function (token) {
1686 return _globalKeyRegistry.get(resolveForwardRef(token));
1687 };
1688 Object.defineProperty(ReflectiveKey, "numberOfKeys", {
1689 /**
1690 * @return {?} the number of keys registered in the system.
1691 */
1692 get: function () { return _globalKeyRegistry.numberOfKeys; },
1693 enumerable: true,
1694 configurable: true
1695 });
1696 return ReflectiveKey;
1697 }());
1698 /**
1699 * \@internal
1700 */
1701 var KeyRegistry = (function () {
1702 function KeyRegistry() {
1703 this._allKeys = new Map();
1704 }
1705 /**
1706 * @param {?} token
1707 * @return {?}
1708 */
1709 KeyRegistry.prototype.get = function (token) {
1710 if (token instanceof ReflectiveKey)
1711 return token;
1712 if (this._allKeys.has(token)) {
1713 return this._allKeys.get(token);
1714 }
1715 var /** @type {?} */ newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys);
1716 this._allKeys.set(token, newKey);
1717 return newKey;
1718 };
1719 Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", {
1720 /**
1721 * @return {?}
1722 */
1723 get: function () { return this._allKeys.size; },
1724 enumerable: true,
1725 configurable: true
1726 });
1727 return KeyRegistry;
1728 }());
1729 var /** @type {?} */ _globalKeyRegistry = new KeyRegistry();
1730
1731 /**
1732 * @license
1733 * Copyright Google Inc. All Rights Reserved.
1734 *
1735 * Use of this source code is governed by an MIT-style license that can be
1736 * found in the LICENSE file at https://angular.io/license
1737 */
1738 /**
1739 * @whatItDoes Represents a type that a Component or other object is instances of.
1740 *
1741 * @description
1742 *
1743 * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
1744 * the `MyCustomComponent` constructor function.
1745 *
1746 * @stable
1747 */
1748 var /** @type {?} */ Type = Function;
1749 /**
1750 * @param {?} v
1751 * @return {?}
1752 */
1753 function isType(v) {
1754 return typeof v === 'function';
1755 }
1756
1757 /**
1758 * Attention: This regex has to hold even if the code is minified!
1759 */
1760 var /** @type {?} */ DELEGATE_CTOR = /^function\s+\S+\(\)\s*{\s*("use strict";)?\s*(return\s+)?\S+\.apply\(this,\s*arguments\)/;
1761 var ReflectionCapabilities = (function () {
1762 /**
1763 * @param {?=} reflect
1764 */
1765 function ReflectionCapabilities(reflect) {
1766 this._reflect = reflect || global$1.Reflect;
1767 }
1768 /**
1769 * @return {?}
1770 */
1771 ReflectionCapabilities.prototype.isReflectionEnabled = function () { return true; };
1772 /**
1773 * @param {?} t
1774 * @return {?}
1775 */
1776 ReflectionCapabilities.prototype.factory = function (t) { return function () {
1777 var args = [];
1778 for (var _i = 0; _i < arguments.length; _i++) {
1779 args[_i - 0] = arguments[_i];
1780 }
1781 return new (t.bind.apply(t, [void 0].concat(args)))();
1782 }; };
1783 /**
1784 * \@internal
1785 * @param {?} paramTypes
1786 * @param {?} paramAnnotations
1787 * @return {?}
1788 */
1789 ReflectionCapabilities.prototype._zipTypesAndAnnotations = function (paramTypes, paramAnnotations) {
1790 var /** @type {?} */ result;
1791 if (typeof paramTypes === 'undefined') {
1792 result = new Array(paramAnnotations.length);
1793 }
1794 else {
1795 result = new Array(paramTypes.length);
1796 }
1797 for (var /** @type {?} */ i = 0; i < result.length; i++) {
1798 // TS outputs Object for parameters without types, while Traceur omits
1799 // the annotations. For now we preserve the Traceur behavior to aid
1800 // migration, but this can be revisited.
1801 if (typeof paramTypes === 'undefined') {
1802 result[i] = [];
1803 }
1804 else if (paramTypes[i] != Object) {
1805 result[i] = [paramTypes[i]];
1806 }
1807 else {
1808 result[i] = [];
1809 }
1810 if (paramAnnotations && isPresent(paramAnnotations[i])) {
1811 result[i] = result[i].concat(paramAnnotations[i]);
1812 }
1813 }
1814 return result;
1815 };
1816 /**
1817 * @param {?} type
1818 * @param {?} parentCtor
1819 * @return {?}
1820 */
1821 ReflectionCapabilities.prototype._ownParameters = function (type, parentCtor) {
1822 // If we have no decorators, we only have function.length as metadata.
1823 // In that case, to detect whether a child class declared an own constructor or not,
1824 // we need to look inside of that constructor to check whether it is
1825 // just calling the parent.
1826 // This also helps to work around for https://github.com/Microsoft/TypeScript/issues/12439
1827 // that sets 'design:paramtypes' to []
1828 // if a class inherits from another class but has no ctor declared itself.
1829 if (DELEGATE_CTOR.exec(type.toString())) {
1830 return null;
1831 }
1832 // Prefer the direct API.
1833 if (((type)).parameters && ((type)).parameters !== parentCtor.parameters) {
1834 return ((type)).parameters;
1835 }
1836 // API of tsickle for lowering decorators to properties on the class.
1837 var /** @type {?} */ tsickleCtorParams = ((type)).ctorParameters;
1838 if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) {
1839 // Newer tsickle uses a function closure
1840 // Retain the non-function case for compatibility with older tsickle
1841 var /** @type {?} */ ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams;
1842 var /** @type {?} */ paramTypes = ctorParameters.map(function (ctorParam) { return ctorParam && ctorParam.type; });
1843 var /** @type {?} */ paramAnnotations = ctorParameters.map(function (ctorParam) {
1844 return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators);
1845 });
1846 return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
1847 }
1848 // API for metadata created by invoking the decorators.
1849 if (isPresent(this._reflect) && isPresent(this._reflect.getOwnMetadata)) {
1850 var /** @type {?} */ paramAnnotations = this._reflect.getOwnMetadata('parameters', type);
1851 var /** @type {?} */ paramTypes = this._reflect.getOwnMetadata('design:paramtypes', type);
1852 if (paramTypes || paramAnnotations) {
1853 return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
1854 }
1855 }
1856 // If a class has no decorators, at least create metadata
1857 // based on function.length.
1858 // Note: We know that this is a real constructor as we checked
1859 // the content of the constructor above.
1860 return new Array(((type.length))).fill(undefined);
1861 };
1862 /**
1863 * @param {?} type
1864 * @return {?}
1865 */
1866 ReflectionCapabilities.prototype.parameters = function (type) {
1867 // Note: only report metadata if we have at least one class decorator
1868 // to stay in sync with the static reflector.
1869 if (!isType(type)) {
1870 return [];
1871 }
1872 var /** @type {?} */ parentCtor = getParentCtor(type);
1873 var /** @type {?} */ parameters = this._ownParameters(type, parentCtor);
1874 if (!parameters && parentCtor !== Object) {
1875 parameters = this.parameters(parentCtor);
1876 }
1877 return parameters || [];
1878 };
1879 /**
1880 * @param {?} typeOrFunc
1881 * @param {?} parentCtor
1882 * @return {?}
1883 */
1884 ReflectionCapabilities.prototype._ownAnnotations = function (typeOrFunc, parentCtor) {
1885 // Prefer the direct API.
1886 if (((typeOrFunc)).annotations && ((typeOrFunc)).annotations !== parentCtor.annotations) {
1887 var /** @type {?} */ annotations = ((typeOrFunc)).annotations;
1888 if (typeof annotations === 'function' && annotations.annotations) {
1889 annotations = annotations.annotations;
1890 }
1891 return annotations;
1892 }
1893 // API of tsickle for lowering decorators to properties on the class.
1894 if (((typeOrFunc)).decorators && ((typeOrFunc)).decorators !== parentCtor.decorators) {
1895 return convertTsickleDecoratorIntoMetadata(((typeOrFunc)).decorators);
1896 }
1897 // API for metadata created by invoking the decorators.
1898 if (this._reflect && this._reflect.getOwnMetadata) {
1899 return this._reflect.getOwnMetadata('annotations', typeOrFunc);
1900 }
1901 };
1902 /**
1903 * @param {?} typeOrFunc
1904 * @return {?}
1905 */
1906 ReflectionCapabilities.prototype.annotations = function (typeOrFunc) {
1907 if (!isType(typeOrFunc)) {
1908 return [];
1909 }
1910 var /** @type {?} */ parentCtor = getParentCtor(typeOrFunc);
1911 var /** @type {?} */ ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || [];
1912 var /** @type {?} */ parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : [];
1913 return parentAnnotations.concat(ownAnnotations);
1914 };
1915 /**
1916 * @param {?} typeOrFunc
1917 * @param {?} parentCtor
1918 * @return {?}
1919 */
1920 ReflectionCapabilities.prototype._ownPropMetadata = function (typeOrFunc, parentCtor) {
1921 // Prefer the direct API.
1922 if (((typeOrFunc)).propMetadata &&
1923 ((typeOrFunc)).propMetadata !== parentCtor.propMetadata) {
1924 var /** @type {?} */ propMetadata = ((typeOrFunc)).propMetadata;
1925 if (typeof propMetadata === 'function' && propMetadata.propMetadata) {
1926 propMetadata = propMetadata.propMetadata;
1927 }
1928 return propMetadata;
1929 }
1930 // API of tsickle for lowering decorators to properties on the class.
1931 if (((typeOrFunc)).propDecorators &&
1932 ((typeOrFunc)).propDecorators !== parentCtor.propDecorators) {
1933 var /** @type {?} */ propDecorators_1 = ((typeOrFunc)).propDecorators;
1934 var /** @type {?} */ propMetadata_1 = ({});
1935 Object.keys(propDecorators_1).forEach(function (prop) {
1936 propMetadata_1[prop] = convertTsickleDecoratorIntoMetadata(propDecorators_1[prop]);
1937 });
1938 return propMetadata_1;
1939 }
1940 // API for metadata created by invoking the decorators.
1941 if (this._reflect && this._reflect.getOwnMetadata) {
1942 return this._reflect.getOwnMetadata('propMetadata', typeOrFunc);
1943 }
1944 };
1945 /**
1946 * @param {?} typeOrFunc
1947 * @return {?}
1948 */
1949 ReflectionCapabilities.prototype.propMetadata = function (typeOrFunc) {
1950 if (!isType(typeOrFunc)) {
1951 return {};
1952 }
1953 var /** @type {?} */ parentCtor = getParentCtor(typeOrFunc);
1954 var /** @type {?} */ propMetadata = {};
1955 if (parentCtor !== Object) {
1956 var /** @type {?} */ parentPropMetadata_1 = this.propMetadata(parentCtor);
1957 Object.keys(parentPropMetadata_1).forEach(function (propName) {
1958 propMetadata[propName] = parentPropMetadata_1[propName];
1959 });
1960 }
1961 var /** @type {?} */ ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);
1962 if (ownPropMetadata) {
1963 Object.keys(ownPropMetadata).forEach(function (propName) {
1964 var /** @type {?} */ decorators = [];
1965 if (propMetadata.hasOwnProperty(propName)) {
1966 decorators.push.apply(decorators, propMetadata[propName]);
1967 }
1968 decorators.push.apply(decorators, ownPropMetadata[propName]);
1969 propMetadata[propName] = decorators;
1970 });
1971 }
1972 return propMetadata;
1973 };
1974 /**
1975 * @param {?} type
1976 * @param {?} lcProperty
1977 * @return {?}
1978 */
1979 ReflectionCapabilities.prototype.hasLifecycleHook = function (type, lcProperty) {
1980 return type instanceof Type && lcProperty in type.prototype;
1981 };
1982 /**
1983 * @param {?} name
1984 * @return {?}
1985 */
1986 ReflectionCapabilities.prototype.getter = function (name) { return ((new Function('o', 'return o.' + name + ';'))); };
1987 /**
1988 * @param {?} name
1989 * @return {?}
1990 */
1991 ReflectionCapabilities.prototype.setter = function (name) {
1992 return ((new Function('o', 'v', 'return o.' + name + ' = v;')));
1993 };
1994 /**
1995 * @param {?} name
1996 * @return {?}
1997 */
1998 ReflectionCapabilities.prototype.method = function (name) {
1999 var /** @type {?} */ functionBody = "if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);";
2000 return ((new Function('o', 'args', functionBody)));
2001 };
2002 /**
2003 * @param {?} type
2004 * @return {?}
2005 */
2006 ReflectionCapabilities.prototype.importUri = function (type) {
2007 // StaticSymbol
2008 if (typeof type === 'object' && type['filePath']) {
2009 return type['filePath'];
2010 }
2011 // Runtime type
2012 return "./" + stringify(type);
2013 };
2014 /**
2015 * @param {?} name
2016 * @param {?} moduleUrl
2017 * @param {?} runtime
2018 * @return {?}
2019 */
2020 ReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, runtime) { return runtime; };
2021 /**
2022 * @param {?} enumIdentifier
2023 * @param {?} name
2024 * @return {?}
2025 */
2026 ReflectionCapabilities.prototype.resolveEnum = function (enumIdentifier, name) { return enumIdentifier[name]; };
2027 return ReflectionCapabilities;
2028 }());
2029 /**
2030 * @param {?} decoratorInvocations
2031 * @return {?}
2032 */
2033 function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
2034 if (!decoratorInvocations) {
2035 return [];
2036 }
2037 return decoratorInvocations.map(function (decoratorInvocation) {
2038 var /** @type {?} */ decoratorType = decoratorInvocation.type;
2039 var /** @type {?} */ annotationCls = decoratorType.annotationCls;
2040 var /** @type {?} */ annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
2041 return new (annotationCls.bind.apply(annotationCls, [void 0].concat(annotationArgs)))();
2042 });
2043 }
2044 /**
2045 * @param {?} ctor
2046 * @return {?}
2047 */
2048 function getParentCtor(ctor) {
2049 var /** @type {?} */ parentProto = Object.getPrototypeOf(ctor.prototype);
2050 var /** @type {?} */ parentCtor = parentProto ? parentProto.constructor : null;
2051 // Note: We always use `Object` as the null value
2052 // to simplify checking later on.
2053 return parentCtor || Object;
2054 }
2055
2056 /**
2057 * Provides read-only access to reflection data about symbols. Used internally by Angular
2058 * to power dependency injection and compilation.
2059 * @abstract
2060 */
2061 var ReflectorReader = (function () {
2062 function ReflectorReader() {
2063 }
2064 /**
2065 * @abstract
2066 * @param {?} typeOrFunc
2067 * @return {?}
2068 */
2069 ReflectorReader.prototype.parameters = function (typeOrFunc) { };
2070 /**
2071 * @abstract
2072 * @param {?} typeOrFunc
2073 * @return {?}
2074 */
2075 ReflectorReader.prototype.annotations = function (typeOrFunc) { };
2076 /**
2077 * @abstract
2078 * @param {?} typeOrFunc
2079 * @return {?}
2080 */
2081 ReflectorReader.prototype.propMetadata = function (typeOrFunc) { };
2082 /**
2083 * @abstract
2084 * @param {?} typeOrFunc
2085 * @return {?}
2086 */
2087 ReflectorReader.prototype.importUri = function (typeOrFunc) { };
2088 /**
2089 * @abstract
2090 * @param {?} name
2091 * @param {?} moduleUrl
2092 * @param {?} runtime
2093 * @return {?}
2094 */
2095 ReflectorReader.prototype.resolveIdentifier = function (name, moduleUrl, runtime) { };
2096 /**
2097 * @abstract
2098 * @param {?} identifier
2099 * @param {?} name
2100 * @return {?}
2101 */
2102 ReflectorReader.prototype.resolveEnum = function (identifier, name) { };
2103 return ReflectorReader;
2104 }());
2105
2106 /**
2107 * @license
2108 * Copyright Google Inc. All Rights Reserved.
2109 *
2110 * Use of this source code is governed by an MIT-style license that can be
2111 * found in the LICENSE file at https://angular.io/license
2112 */
2113 var __extends$2 = (this && this.__extends) || function (d, b) {
2114 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
2115 function __() { this.constructor = d; }
2116 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2117 };
2118 /**
2119 * Provides access to reflection data about symbols. Used internally by Angular
2120 * to power dependency injection and compilation.
2121 */
2122 var Reflector = (function (_super) {
2123 __extends$2(Reflector, _super);
2124 /**
2125 * @param {?} reflectionCapabilities
2126 */
2127 function Reflector(reflectionCapabilities) {
2128 _super.call(this);
2129 this.reflectionCapabilities = reflectionCapabilities;
2130 }
2131 /**
2132 * @param {?} caps
2133 * @return {?}
2134 */
2135 Reflector.prototype.updateCapabilities = function (caps) { this.reflectionCapabilities = caps; };
2136 /**
2137 * @param {?} type
2138 * @return {?}
2139 */
2140 Reflector.prototype.factory = function (type) { return this.reflectionCapabilities.factory(type); };
2141 /**
2142 * @param {?} typeOrFunc
2143 * @return {?}
2144 */
2145 Reflector.prototype.parameters = function (typeOrFunc) {
2146 return this.reflectionCapabilities.parameters(typeOrFunc);
2147 };
2148 /**
2149 * @param {?} typeOrFunc
2150 * @return {?}
2151 */
2152 Reflector.prototype.annotations = function (typeOrFunc) {
2153 return this.reflectionCapabilities.annotations(typeOrFunc);
2154 };
2155 /**
2156 * @param {?} typeOrFunc
2157 * @return {?}
2158 */
2159 Reflector.prototype.propMetadata = function (typeOrFunc) {
2160 return this.reflectionCapabilities.propMetadata(typeOrFunc);
2161 };
2162 /**
2163 * @param {?} type
2164 * @param {?} lcProperty
2165 * @return {?}
2166 */
2167 Reflector.prototype.hasLifecycleHook = function (type, lcProperty) {
2168 return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
2169 };
2170 /**
2171 * @param {?} name
2172 * @return {?}
2173 */
2174 Reflector.prototype.getter = function (name) { return this.reflectionCapabilities.getter(name); };
2175 /**
2176 * @param {?} name
2177 * @return {?}
2178 */
2179 Reflector.prototype.setter = function (name) { return this.reflectionCapabilities.setter(name); };
2180 /**
2181 * @param {?} name
2182 * @return {?}
2183 */
2184 Reflector.prototype.method = function (name) { return this.reflectionCapabilities.method(name); };
2185 /**
2186 * @param {?} type
2187 * @return {?}
2188 */
2189 Reflector.prototype.importUri = function (type) { return this.reflectionCapabilities.importUri(type); };
2190 /**
2191 * @param {?} name
2192 * @param {?} moduleUrl
2193 * @param {?} runtime
2194 * @return {?}
2195 */
2196 Reflector.prototype.resolveIdentifier = function (name, moduleUrl, runtime) {
2197 return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, runtime);
2198 };
2199 /**
2200 * @param {?} identifier
2201 * @param {?} name
2202 * @return {?}
2203 */
2204 Reflector.prototype.resolveEnum = function (identifier, name) {
2205 return this.reflectionCapabilities.resolveEnum(identifier, name);
2206 };
2207 return Reflector;
2208 }(ReflectorReader));
2209
2210 /**
2211 * The {@link Reflector} used internally in Angular to access metadata
2212 * about symbols.
2213 */
2214 var /** @type {?} */ reflector = new Reflector(new ReflectionCapabilities());
2215
2216 /**
2217 * `Dependency` is used by the framework to extend DI.
2218 * This is internal to Angular and should not be used directly.
2219 */
2220 var ReflectiveDependency = (function () {
2221 /**
2222 * @param {?} key
2223 * @param {?} optional
2224 * @param {?} visibility
2225 */
2226 function ReflectiveDependency(key, optional, visibility) {
2227 this.key = key;
2228 this.optional = optional;
2229 this.visibility = visibility;
2230 }
2231 /**
2232 * @param {?} key
2233 * @return {?}
2234 */
2235 ReflectiveDependency.fromKey = function (key) {
2236 return new ReflectiveDependency(key, false, null);
2237 };
2238 return ReflectiveDependency;
2239 }());
2240 var /** @type {?} */ _EMPTY_LIST = [];
2241 var ResolvedReflectiveProvider_ = (function () {
2242 /**
2243 * @param {?} key
2244 * @param {?} resolvedFactories
2245 * @param {?} multiProvider
2246 */
2247 function ResolvedReflectiveProvider_(key, resolvedFactories, multiProvider) {
2248 this.key = key;
2249 this.resolvedFactories = resolvedFactories;
2250 this.multiProvider = multiProvider;
2251 }
2252 Object.defineProperty(ResolvedReflectiveProvider_.prototype, "resolvedFactory", {
2253 /**
2254 * @return {?}
2255 */
2256 get: function () { return this.resolvedFactories[0]; },
2257 enumerable: true,
2258 configurable: true
2259 });
2260 return ResolvedReflectiveProvider_;
2261 }());
2262 /**
2263 * An internal resolved representation of a factory function created by resolving {\@link
2264 * Provider}.
2265 * \@experimental
2266 */
2267 var ResolvedReflectiveFactory = (function () {
2268 /**
2269 * @param {?} factory
2270 * @param {?} dependencies
2271 */
2272 function ResolvedReflectiveFactory(factory, dependencies) {
2273 this.factory = factory;
2274 this.dependencies = dependencies;
2275 }
2276 return ResolvedReflectiveFactory;
2277 }());
2278 /**
2279 * Resolve a single provider.
2280 * @param {?} provider
2281 * @return {?}
2282 */
2283 function resolveReflectiveFactory(provider) {
2284 var /** @type {?} */ factoryFn;
2285 var /** @type {?} */ resolvedDeps;
2286 if (provider.useClass) {
2287 var /** @type {?} */ useClass = resolveForwardRef(provider.useClass);
2288 factoryFn = reflector.factory(useClass);
2289 resolvedDeps = _dependenciesFor(useClass);
2290 }
2291 else if (provider.useExisting) {
2292 factoryFn = function (aliasInstance) { return aliasInstance; };
2293 resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))];
2294 }
2295 else if (provider.useFactory) {
2296 factoryFn = provider.useFactory;
2297 resolvedDeps = constructDependencies(provider.useFactory, provider.deps);
2298 }
2299 else {
2300 factoryFn = function () { return provider.useValue; };
2301 resolvedDeps = _EMPTY_LIST;
2302 }
2303 return new ResolvedReflectiveFactory(factoryFn, resolvedDeps);
2304 }
2305 /**
2306 * Converts the {\@link Provider} into {\@link ResolvedProvider}.
2307 *
2308 * {\@link Injector} internally only uses {\@link ResolvedProvider}, {\@link Provider} contains
2309 * convenience provider syntax.
2310 * @param {?} provider
2311 * @return {?}
2312 */
2313 function resolveReflectiveProvider(provider) {
2314 return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi);
2315 }
2316 /**
2317 * Resolve a list of Providers.
2318 * @param {?} providers
2319 * @return {?}
2320 */
2321 function resolveReflectiveProviders(providers) {
2322 var /** @type {?} */ normalized = _normalizeProviders(providers, []);
2323 var /** @type {?} */ resolved = normalized.map(resolveReflectiveProvider);
2324 var /** @type {?} */ resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map());
2325 return Array.from(resolvedProviderMap.values());
2326 }
2327 /**
2328 * Merges a list of ResolvedProviders into a list where
2329 * each key is contained exactly once and multi providers
2330 * have been merged.
2331 * @param {?} providers
2332 * @param {?} normalizedProvidersMap
2333 * @return {?}
2334 */
2335 function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) {
2336 for (var /** @type {?} */ i = 0; i < providers.length; i++) {
2337 var /** @type {?} */ provider = providers[i];
2338 var /** @type {?} */ existing = normalizedProvidersMap.get(provider.key.id);
2339 if (existing) {
2340 if (provider.multiProvider !== existing.multiProvider) {
2341 throw new MixingMultiProvidersWithRegularProvidersError(existing, provider);
2342 }
2343 if (provider.multiProvider) {
2344 for (var /** @type {?} */ j = 0; j < provider.resolvedFactories.length; j++) {
2345 existing.resolvedFactories.push(provider.resolvedFactories[j]);
2346 }
2347 }
2348 else {
2349 normalizedProvidersMap.set(provider.key.id, provider);
2350 }
2351 }
2352 else {
2353 var /** @type {?} */ resolvedProvider = void 0;
2354 if (provider.multiProvider) {
2355 resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider);
2356 }
2357 else {
2358 resolvedProvider = provider;
2359 }
2360 normalizedProvidersMap.set(provider.key.id, resolvedProvider);
2361 }
2362 }
2363 return normalizedProvidersMap;
2364 }
2365 /**
2366 * @param {?} providers
2367 * @param {?} res
2368 * @return {?}
2369 */
2370 function _normalizeProviders(providers, res) {
2371 providers.forEach(function (b) {
2372 if (b instanceof Type) {
2373 res.push({ provide: b, useClass: b });
2374 }
2375 else if (b && typeof b == 'object' && ((b)).provide !== undefined) {
2376 res.push(/** @type {?} */ (b));
2377 }
2378 else if (b instanceof Array) {
2379 _normalizeProviders(b, res);
2380 }
2381 else {
2382 throw new InvalidProviderError(b);
2383 }
2384 });
2385 return res;
2386 }
2387 /**
2388 * @param {?} typeOrFunc
2389 * @param {?} dependencies
2390 * @return {?}
2391 */
2392 function constructDependencies(typeOrFunc, dependencies) {
2393 if (!dependencies) {
2394 return _dependenciesFor(typeOrFunc);
2395 }
2396 else {
2397 var /** @type {?} */ params_1 = dependencies.map(function (t) { return [t]; });
2398 return dependencies.map(function (t) { return _extractToken(typeOrFunc, t, params_1); });
2399 }
2400 }
2401 /**
2402 * @param {?} typeOrFunc
2403 * @return {?}
2404 */
2405 function _dependenciesFor(typeOrFunc) {
2406 var /** @type {?} */ params = reflector.parameters(typeOrFunc);
2407 if (!params)
2408 return [];
2409 if (params.some(function (p) { return p == null; })) {
2410 throw new NoAnnotationError(typeOrFunc, params);
2411 }
2412 return params.map(function (p) { return _extractToken(typeOrFunc, p, params); });
2413 }
2414 /**
2415 * @param {?} typeOrFunc
2416 * @param {?} metadata
2417 * @param {?} params
2418 * @return {?}
2419 */
2420 function _extractToken(typeOrFunc, metadata, params) {
2421 var /** @type {?} */ token = null;
2422 var /** @type {?} */ optional = false;
2423 if (!Array.isArray(metadata)) {
2424 if (metadata instanceof Inject) {
2425 return _createDependency(metadata.token, optional, null);
2426 }
2427 else {
2428 return _createDependency(metadata, optional, null);
2429 }
2430 }
2431 var /** @type {?} */ visibility = null;
2432 for (var /** @type {?} */ i = 0; i < metadata.length; ++i) {
2433 var /** @type {?} */ paramMetadata = metadata[i];
2434 if (paramMetadata instanceof Type) {
2435 token = paramMetadata;
2436 }
2437 else if (paramMetadata instanceof Inject) {
2438 token = paramMetadata.token;
2439 }
2440 else if (paramMetadata instanceof Optional) {
2441 optional = true;
2442 }
2443 else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) {
2444 visibility = paramMetadata;
2445 }
2446 }
2447 token = resolveForwardRef(token);
2448 if (token != null) {
2449 return _createDependency(token, optional, visibility);
2450 }
2451 else {
2452 throw new NoAnnotationError(typeOrFunc, params);
2453 }
2454 }
2455 /**
2456 * @param {?} token
2457 * @param {?} optional
2458 * @param {?} visibility
2459 * @return {?}
2460 */
2461 function _createDependency(token, optional, visibility) {
2462 return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility);
2463 }
2464
2465 // Threshold for the dynamic version
2466 var /** @type {?} */ UNDEFINED = new Object();
2467 /**
2468 * A ReflectiveDependency injection container used for instantiating objects and resolving
2469 * dependencies.
2470 *
2471 * An `Injector` is a replacement for a `new` operator, which can automatically resolve the
2472 * constructor dependencies.
2473 *
2474 * In typical use, application code asks for the dependencies in the constructor and they are
2475 * resolved by the `Injector`.
2476 *
2477 * ### Example ([live demo](http://plnkr.co/edit/jzjec0?p=preview))
2478 *
2479 * The following example creates an `Injector` configured to create `Engine` and `Car`.
2480 *
2481 * ```typescript
2482 * \@Injectable()
2483 * class Engine {
2484 * }
2485 *
2486 * \@Injectable()
2487 * class Car {
2488 * constructor(public engine:Engine) {}
2489 * }
2490 *
2491 * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
2492 * var car = injector.get(Car);
2493 * expect(car instanceof Car).toBe(true);
2494 * expect(car.engine instanceof Engine).toBe(true);
2495 * ```
2496 *
2497 * Notice, we don't use the `new` operator because we explicitly want to have the `Injector`
2498 * resolve all of the object's dependencies automatically.
2499 *
2500 * \@stable
2501 * @abstract
2502 */
2503 var ReflectiveInjector = (function () {
2504 function ReflectiveInjector() {
2505 }
2506 /**
2507 * Turns an array of provider definitions into an array of resolved providers.
2508 *
2509 * A resolution is a process of flattening multiple nested arrays and converting individual
2510 * providers into an array of {\@link ResolvedReflectiveProvider}s.
2511 *
2512 * ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview))
2513 *
2514 * ```typescript
2515 * \@Injectable()
2516 * class Engine {
2517 * }
2518 *
2519 * \@Injectable()
2520 * class Car {
2521 * constructor(public engine:Engine) {}
2522 * }
2523 *
2524 * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]);
2525 *
2526 * expect(providers.length).toEqual(2);
2527 *
2528 * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true);
2529 * expect(providers[0].key.displayName).toBe("Car");
2530 * expect(providers[0].dependencies.length).toEqual(1);
2531 * expect(providers[0].factory).toBeDefined();
2532 *
2533 * expect(providers[1].key.displayName).toBe("Engine");
2534 * });
2535 * ```
2536 *
2537 * See {\@link ReflectiveInjector#fromResolvedProviders} for more info.
2538 * @param {?} providers
2539 * @return {?}
2540 */
2541 ReflectiveInjector.resolve = function (providers) {
2542 return resolveReflectiveProviders(providers);
2543 };
2544 /**
2545 * Resolves an array of providers and creates an injector from those providers.
2546 *
2547 * The passed-in providers can be an array of `Type`, {\@link Provider},
2548 * or a recursive array of more providers.
2549 *
2550 * ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview))
2551 *
2552 * ```typescript
2553 * \@Injectable()
2554 * class Engine {
2555 * }
2556 *
2557 * \@Injectable()
2558 * class Car {
2559 * constructor(public engine:Engine) {}
2560 * }
2561 *
2562 * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
2563 * expect(injector.get(Car) instanceof Car).toBe(true);
2564 * ```
2565 *
2566 * This function is slower than the corresponding `fromResolvedProviders`
2567 * because it needs to resolve the passed-in providers first.
2568 * See {\@link Injector#resolve} and {\@link Injector#fromResolvedProviders}.
2569 * @param {?} providers
2570 * @param {?=} parent
2571 * @return {?}
2572 */
2573 ReflectiveInjector.resolveAndCreate = function (providers, parent) {
2574 if (parent === void 0) { parent = null; }
2575 var /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
2576 return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
2577 };
2578 /**
2579 * Creates an injector from previously resolved providers.
2580 *
2581 * This API is the recommended way to construct injectors in performance-sensitive parts.
2582 *
2583 * ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview))
2584 *
2585 * ```typescript
2586 * \@Injectable()
2587 * class Engine {
2588 * }
2589 *
2590 * \@Injectable()
2591 * class Car {
2592 * constructor(public engine:Engine) {}
2593 * }
2594 *
2595 * var providers = ReflectiveInjector.resolve([Car, Engine]);
2596 * var injector = ReflectiveInjector.fromResolvedProviders(providers);
2597 * expect(injector.get(Car) instanceof Car).toBe(true);
2598 * ```
2599 * \@experimental
2600 * @param {?} providers
2601 * @param {?=} parent
2602 * @return {?}
2603 */
2604 ReflectiveInjector.fromResolvedProviders = function (providers, parent) {
2605 if (parent === void 0) { parent = null; }
2606 return new ReflectiveInjector_(providers, parent);
2607 };
2608 /**
2609 * Parent of this injector.
2610 *
2611 * <!-- TODO: Add a link to the section of the user guide talking about hierarchical injection.
2612 * -->
2613 *
2614 * ### Example ([live demo](http://plnkr.co/edit/eosMGo?p=preview))
2615 *
2616 * ```typescript
2617 * var parent = ReflectiveInjector.resolveAndCreate([]);
2618 * var child = parent.resolveAndCreateChild([]);
2619 * expect(child.parent).toBe(parent);
2620 * ```
2621 * @abstract
2622 * @return {?}
2623 */
2624 ReflectiveInjector.prototype.parent = function () { };
2625 /**
2626 * Resolves an array of providers and creates a child injector from those providers.
2627 *
2628 * <!-- TODO: Add a link to the section of the user guide talking about hierarchical injection.
2629 * -->
2630 *
2631 * The passed-in providers can be an array of `Type`, {\@link Provider},
2632 * or a recursive array of more providers.
2633 *
2634 * ### Example ([live demo](http://plnkr.co/edit/opB3T4?p=preview))
2635 *
2636 * ```typescript
2637 * class ParentProvider {}
2638 * class ChildProvider {}
2639 *
2640 * var parent = ReflectiveInjector.resolveAndCreate([ParentProvider]);
2641 * var child = parent.resolveAndCreateChild([ChildProvider]);
2642 *
2643 * expect(child.get(ParentProvider) instanceof ParentProvider).toBe(true);
2644 * expect(child.get(ChildProvider) instanceof ChildProvider).toBe(true);
2645 * expect(child.get(ParentProvider)).toBe(parent.get(ParentProvider));
2646 * ```
2647 *
2648 * This function is slower than the corresponding `createChildFromResolved`
2649 * because it needs to resolve the passed-in providers first.
2650 * See {\@link Injector#resolve} and {\@link Injector#createChildFromResolved}.
2651 * @abstract
2652 * @param {?} providers
2653 * @return {?}
2654 */
2655 ReflectiveInjector.prototype.resolveAndCreateChild = function (providers) { };
2656 /**
2657 * Creates a child injector from previously resolved providers.
2658 *
2659 * <!-- TODO: Add a link to the section of the user guide talking about hierarchical injection.
2660 * -->
2661 *
2662 * This API is the recommended way to construct injectors in performance-sensitive parts.
2663 *
2664 * ### Example ([live demo](http://plnkr.co/edit/VhyfjN?p=preview))
2665 *
2666 * ```typescript
2667 * class ParentProvider {}
2668 * class ChildProvider {}
2669 *
2670 * var parentProviders = ReflectiveInjector.resolve([ParentProvider]);
2671 * var childProviders = ReflectiveInjector.resolve([ChildProvider]);
2672 *
2673 * var parent = ReflectiveInjector.fromResolvedProviders(parentProviders);
2674 * var child = parent.createChildFromResolved(childProviders);
2675 *
2676 * expect(child.get(ParentProvider) instanceof ParentProvider).toBe(true);
2677 * expect(child.get(ChildProvider) instanceof ChildProvider).toBe(true);
2678 * expect(child.get(ParentProvider)).toBe(parent.get(ParentProvider));
2679 * ```
2680 * @abstract
2681 * @param {?} providers
2682 * @return {?}
2683 */
2684 ReflectiveInjector.prototype.createChildFromResolved = function (providers) { };
2685 /**
2686 * Resolves a provider and instantiates an object in the context of the injector.
2687 *
2688 * The created object does not get cached by the injector.
2689 *
2690 * ### Example ([live demo](http://plnkr.co/edit/yvVXoB?p=preview))
2691 *
2692 * ```typescript
2693 * \@Injectable()
2694 * class Engine {
2695 * }
2696 *
2697 * \@Injectable()
2698 * class Car {
2699 * constructor(public engine:Engine) {}
2700 * }
2701 *
2702 * var injector = ReflectiveInjector.resolveAndCreate([Engine]);
2703 *
2704 * var car = injector.resolveAndInstantiate(Car);
2705 * expect(car.engine).toBe(injector.get(Engine));
2706 * expect(car).not.toBe(injector.resolveAndInstantiate(Car));
2707 * ```
2708 * @abstract
2709 * @param {?} provider
2710 * @return {?}
2711 */
2712 ReflectiveInjector.prototype.resolveAndInstantiate = function (provider) { };
2713 /**
2714 * Instantiates an object using a resolved provider in the context of the injector.
2715 *
2716 * The created object does not get cached by the injector.
2717 *
2718 * ### Example ([live demo](http://plnkr.co/edit/ptCImQ?p=preview))
2719 *
2720 * ```typescript
2721 * \@Injectable()
2722 * class Engine {
2723 * }
2724 *
2725 * \@Injectable()
2726 * class Car {
2727 * constructor(public engine:Engine) {}
2728 * }
2729 *
2730 * var injector = ReflectiveInjector.resolveAndCreate([Engine]);
2731 * var carProvider = ReflectiveInjector.resolve([Car])[0];
2732 * var car = injector.instantiateResolved(carProvider);
2733 * expect(car.engine).toBe(injector.get(Engine));
2734 * expect(car).not.toBe(injector.instantiateResolved(carProvider));
2735 * ```
2736 * @abstract
2737 * @param {?} provider
2738 * @return {?}
2739 */
2740 ReflectiveInjector.prototype.instantiateResolved = function (provider) { };
2741 /**
2742 * @abstract
2743 * @param {?} token
2744 * @param {?=} notFoundValue
2745 * @return {?}
2746 */
2747 ReflectiveInjector.prototype.get = function (token, notFoundValue) { };
2748 return ReflectiveInjector;
2749 }());
2750 var ReflectiveInjector_ = (function () {
2751 /**
2752 * Private
2753 * @param {?} _providers
2754 * @param {?=} _parent
2755 */
2756 function ReflectiveInjector_(_providers, _parent) {
2757 if (_parent === void 0) { _parent = null; }
2758 /** @internal */
2759 this._constructionCounter = 0;
2760 this._providers = _providers;
2761 this._parent = _parent;
2762 var len = _providers.length;
2763 this.keyIds = new Array(len);
2764 this.objs = new Array(len);
2765 for (var i = 0; i < len; i++) {
2766 this.keyIds[i] = _providers[i].key.id;
2767 this.objs[i] = UNDEFINED;
2768 }
2769 }
2770 /**
2771 * @param {?} token
2772 * @param {?=} notFoundValue
2773 * @return {?}
2774 */
2775 ReflectiveInjector_.prototype.get = function (token, notFoundValue) {
2776 if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; }
2777 return this._getByKey(ReflectiveKey.get(token), null, notFoundValue);
2778 };
2779 Object.defineProperty(ReflectiveInjector_.prototype, "parent", {
2780 /**
2781 * @return {?}
2782 */
2783 get: function () { return this._parent; },
2784 enumerable: true,
2785 configurable: true
2786 });
2787 /**
2788 * @param {?} providers
2789 * @return {?}
2790 */
2791 ReflectiveInjector_.prototype.resolveAndCreateChild = function (providers) {
2792 var /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
2793 return this.createChildFromResolved(ResolvedReflectiveProviders);
2794 };
2795 /**
2796 * @param {?} providers
2797 * @return {?}
2798 */
2799 ReflectiveInjector_.prototype.createChildFromResolved = function (providers) {
2800 var /** @type {?} */ inj = new ReflectiveInjector_(providers);
2801 inj._parent = this;
2802 return inj;
2803 };
2804 /**
2805 * @param {?} provider
2806 * @return {?}
2807 */
2808 ReflectiveInjector_.prototype.resolveAndInstantiate = function (provider) {
2809 return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
2810 };
2811 /**
2812 * @param {?} provider
2813 * @return {?}
2814 */
2815 ReflectiveInjector_.prototype.instantiateResolved = function (provider) {
2816 return this._instantiateProvider(provider);
2817 };
2818 /**
2819 * @param {?} index
2820 * @return {?}
2821 */
2822 ReflectiveInjector_.prototype.getProviderAtIndex = function (index) {
2823 if (index < 0 || index >= this._providers.length) {
2824 throw new OutOfBoundsError(index);
2825 }
2826 return this._providers[index];
2827 };
2828 /**
2829 * \@internal
2830 * @param {?} provider
2831 * @return {?}
2832 */
2833 ReflectiveInjector_.prototype._new = function (provider) {
2834 if (this._constructionCounter++ > this._getMaxNumberOfObjects()) {
2835 throw new CyclicDependencyError(this, provider.key);
2836 }
2837 return this._instantiateProvider(provider);
2838 };
2839 /**
2840 * @return {?}
2841 */
2842 ReflectiveInjector_.prototype._getMaxNumberOfObjects = function () { return this.objs.length; };
2843 /**
2844 * @param {?} provider
2845 * @return {?}
2846 */
2847 ReflectiveInjector_.prototype._instantiateProvider = function (provider) {
2848 if (provider.multiProvider) {
2849 var /** @type {?} */ res = new Array(provider.resolvedFactories.length);
2850 for (var /** @type {?} */ i = 0; i < provider.resolvedFactories.length; ++i) {
2851 res[i] = this._instantiate(provider, provider.resolvedFactories[i]);
2852 }
2853 return res;
2854 }
2855 else {
2856 return this._instantiate(provider, provider.resolvedFactories[0]);
2857 }
2858 };
2859 /**
2860 * @param {?} provider
2861 * @param {?} ResolvedReflectiveFactory
2862 * @return {?}
2863 */
2864 ReflectiveInjector_.prototype._instantiate = function (provider, ResolvedReflectiveFactory) {
2865 var _this = this;
2866 var /** @type {?} */ factory = ResolvedReflectiveFactory.factory;
2867 var /** @type {?} */ deps;
2868 try {
2869 deps =
2870 ResolvedReflectiveFactory.dependencies.map(function (dep) { return _this._getByReflectiveDependency(dep); });
2871 }
2872 catch (e) {
2873 if (e instanceof AbstractProviderError || e instanceof InstantiationError) {
2874 e.addKey(this, provider.key);
2875 }
2876 throw e;
2877 }
2878 var /** @type {?} */ obj;
2879 try {
2880 obj = factory.apply(void 0, deps);
2881 }
2882 catch (e) {
2883 throw new InstantiationError(this, e, e.stack, provider.key);
2884 }
2885 return obj;
2886 };
2887 /**
2888 * @param {?} dep
2889 * @return {?}
2890 */
2891 ReflectiveInjector_.prototype._getByReflectiveDependency = function (dep) {
2892 return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND);
2893 };
2894 /**
2895 * @param {?} key
2896 * @param {?} visibility
2897 * @param {?} notFoundValue
2898 * @return {?}
2899 */
2900 ReflectiveInjector_.prototype._getByKey = function (key, visibility, notFoundValue) {
2901 if (key === INJECTOR_KEY) {
2902 return this;
2903 }
2904 if (visibility instanceof Self) {
2905 return this._getByKeySelf(key, notFoundValue);
2906 }
2907 else {
2908 return this._getByKeyDefault(key, notFoundValue, visibility);
2909 }
2910 };
2911 /**
2912 * @param {?} keyId
2913 * @return {?}
2914 */
2915 ReflectiveInjector_.prototype._getObjByKeyId = function (keyId) {
2916 for (var /** @type {?} */ i = 0; i < this.keyIds.length; i++) {
2917 if (this.keyIds[i] === keyId) {
2918 if (this.objs[i] === UNDEFINED) {
2919 this.objs[i] = this._new(this._providers[i]);
2920 }
2921 return this.objs[i];
2922 }
2923 }
2924 return UNDEFINED;
2925 };
2926 /**
2927 * \@internal
2928 * @param {?} key
2929 * @param {?} notFoundValue
2930 * @return {?}
2931 */
2932 ReflectiveInjector_.prototype._throwOrNull = function (key, notFoundValue) {
2933 if (notFoundValue !== THROW_IF_NOT_FOUND) {
2934 return notFoundValue;
2935 }
2936 else {
2937 throw new NoProviderError(this, key);
2938 }
2939 };
2940 /**
2941 * \@internal
2942 * @param {?} key
2943 * @param {?} notFoundValue
2944 * @return {?}
2945 */
2946 ReflectiveInjector_.prototype._getByKeySelf = function (key, notFoundValue) {
2947 var /** @type {?} */ obj = this._getObjByKeyId(key.id);
2948 return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
2949 };
2950 /**
2951 * \@internal
2952 * @param {?} key
2953 * @param {?} notFoundValue
2954 * @param {?} visibility
2955 * @return {?}
2956 */
2957 ReflectiveInjector_.prototype._getByKeyDefault = function (key, notFoundValue, visibility) {
2958 var /** @type {?} */ inj;
2959 if (visibility instanceof SkipSelf) {
2960 inj = this._parent;
2961 }
2962 else {
2963 inj = this;
2964 }
2965 while (inj instanceof ReflectiveInjector_) {
2966 var /** @type {?} */ inj_ = (inj);
2967 var /** @type {?} */ obj = inj_._getObjByKeyId(key.id);
2968 if (obj !== UNDEFINED)
2969 return obj;
2970 inj = inj_._parent;
2971 }
2972 if (inj !== null) {
2973 return inj.get(key.token, notFoundValue);
2974 }
2975 else {
2976 return this._throwOrNull(key, notFoundValue);
2977 }
2978 };
2979 Object.defineProperty(ReflectiveInjector_.prototype, "displayName", {
2980 /**
2981 * @return {?}
2982 */
2983 get: function () {
2984 var /** @type {?} */ providers = _mapProviders(this, function (b) { return ' "' + b.key.displayName + '" '; })
2985 .join(', ');
2986 return "ReflectiveInjector(providers: [" + providers + "])";
2987 },
2988 enumerable: true,
2989 configurable: true
2990 });
2991 /**
2992 * @return {?}
2993 */
2994 ReflectiveInjector_.prototype.toString = function () { return this.displayName; };
2995 return ReflectiveInjector_;
2996 }());
2997 var /** @type {?} */ INJECTOR_KEY = ReflectiveKey.get(Injector);
2998 /**
2999 * @param {?} injector
3000 * @param {?} fn
3001 * @return {?}
3002 */
3003 function _mapProviders(injector, fn) {
3004 var /** @type {?} */ res = new Array(injector._providers.length);
3005 for (var /** @type {?} */ i = 0; i < injector._providers.length; ++i) {
3006 res[i] = fn(injector.getProviderAtIndex(i));
3007 }
3008 return res;
3009 }
3010
3011 /**
3012 * @license
3013 * Copyright Google Inc. All Rights Reserved.
3014 *
3015 * Use of this source code is governed by an MIT-style license that can be
3016 * found in the LICENSE file at https://angular.io/license
3017 */
3018 /**
3019 * \@whatItDoes Provides a hook for centralized exception handling.
3020 *
3021 * \@description
3022 *
3023 * The default implementation of `ErrorHandler` prints error messages to the `console`. To
3024 * intercept error handling, write a custom exception handler that replaces this default as
3025 * appropriate for your app.
3026 *
3027 * ### Example
3028 *
3029 * ```
3030 * class MyErrorHandler implements ErrorHandler {
3031 * handleError(error) {
3032 * // do something with the exception
3033 * }
3034 * }
3035 *
3036 * \@NgModule({
3037 * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
3038 * })
3039 * class MyModule {}
3040 * ```
3041 *
3042 * \@stable
3043 */
3044 var ErrorHandler = (function () {
3045 /**
3046 * @param {?=} rethrowError
3047 */
3048 function ErrorHandler(rethrowError) {
3049 if (rethrowError === void 0) { rethrowError = true; }
3050 /**
3051 * @internal
3052 */
3053 this._console = console;
3054 this.rethrowError = rethrowError;
3055 }
3056 /**
3057 * @param {?} error
3058 * @return {?}
3059 */
3060 ErrorHandler.prototype.handleError = function (error) {
3061 var /** @type {?} */ originalError = this._findOriginalError(error);
3062 var /** @type {?} */ originalStack = this._findOriginalStack(error);
3063 var /** @type {?} */ context = this._findContext(error);
3064 this._console.error("EXCEPTION: " + this._extractMessage(error));
3065 if (originalError) {
3066 this._console.error("ORIGINAL EXCEPTION: " + this._extractMessage(originalError));
3067 }
3068 if (originalStack) {
3069 this._console.error('ORIGINAL STACKTRACE:');
3070 this._console.error(originalStack);
3071 }
3072 if (context) {
3073 this._console.error('ERROR CONTEXT:');
3074 this._console.error(context);
3075 }
3076 // We rethrow exceptions, so operations like 'bootstrap' will result in an error
3077 // when an error happens. If we do not rethrow, bootstrap will always succeed.
3078 if (this.rethrowError)
3079 throw error;
3080 };
3081 /**
3082 * \@internal
3083 * @param {?} error
3084 * @return {?}
3085 */
3086 ErrorHandler.prototype._extractMessage = function (error) {
3087 return error instanceof Error ? error.message : error.toString();
3088 };
3089 /**
3090 * \@internal
3091 * @param {?} error
3092 * @return {?}
3093 */
3094 ErrorHandler.prototype._findContext = function (error) {
3095 if (error) {
3096 return error.context ? error.context :
3097 this._findContext(((error)).originalError);
3098 }
3099 return null;
3100 };
3101 /**
3102 * \@internal
3103 * @param {?} error
3104 * @return {?}
3105 */
3106 ErrorHandler.prototype._findOriginalError = function (error) {
3107 var /** @type {?} */ e = ((error)).originalError;
3108 while (e && ((e)).originalError) {
3109 e = ((e)).originalError;
3110 }
3111 return e;
3112 };
3113 /**
3114 * \@internal
3115 * @param {?} error
3116 * @return {?}
3117 */
3118 ErrorHandler.prototype._findOriginalStack = function (error) {
3119 if (!(error instanceof Error))
3120 return null;
3121 var /** @type {?} */ e = error;
3122 var /** @type {?} */ stack = e.stack;
3123 while (e instanceof Error && ((e)).originalError) {
3124 e = ((e)).originalError;
3125 if (e instanceof Error && e.stack) {
3126 stack = e.stack;
3127 }
3128 }
3129 return stack;
3130 };
3131 return ErrorHandler;
3132 }());
3133
3134 /**
3135 * Wraps Javascript Objects
3136 */
3137 var StringMapWrapper = (function () {
3138 function StringMapWrapper() {
3139 }
3140 /**
3141 * @param {?} m1
3142 * @param {?} m2
3143 * @return {?}
3144 */
3145 StringMapWrapper.merge = function (m1, m2) {
3146 var /** @type {?} */ m = {};
3147 for (var _i = 0, _a = Object.keys(m1); _i < _a.length; _i++) {
3148 var k = _a[_i];
3149 m[k] = m1[k];
3150 }
3151 for (var _b = 0, _c = Object.keys(m2); _b < _c.length; _b++) {
3152 var k = _c[_b];
3153 m[k] = m2[k];
3154 }
3155 return m;
3156 };
3157 /**
3158 * @param {?} m1
3159 * @param {?} m2
3160 * @return {?}
3161 */
3162 StringMapWrapper.equals = function (m1, m2) {
3163 var /** @type {?} */ k1 = Object.keys(m1);
3164 var /** @type {?} */ k2 = Object.keys(m2);
3165 if (k1.length != k2.length) {
3166 return false;
3167 }
3168 for (var /** @type {?} */ i = 0; i < k1.length; i++) {
3169 var /** @type {?} */ key = k1[i];
3170 if (m1[key] !== m2[key]) {
3171 return false;
3172 }
3173 }
3174 return true;
3175 };
3176 return StringMapWrapper;
3177 }());
3178 var ListWrapper = (function () {
3179 function ListWrapper() {
3180 }
3181 /**
3182 * @param {?} arr
3183 * @param {?} condition
3184 * @return {?}
3185 */
3186 ListWrapper.findLast = function (arr, condition) {
3187 for (var /** @type {?} */ i = arr.length - 1; i >= 0; i--) {
3188 if (condition(arr[i])) {
3189 return arr[i];
3190 }
3191 }
3192 return null;
3193 };
3194 /**
3195 * @param {?} list
3196 * @param {?} items
3197 * @return {?}
3198 */
3199 ListWrapper.removeAll = function (list, items) {
3200 for (var /** @type {?} */ i = 0; i < items.length; ++i) {
3201 var /** @type {?} */ index = list.indexOf(items[i]);
3202 if (index > -1) {
3203 list.splice(index, 1);
3204 }
3205 }
3206 };
3207 /**
3208 * @param {?} list
3209 * @param {?} el
3210 * @return {?}
3211 */
3212 ListWrapper.remove = function (list, el) {
3213 var /** @type {?} */ index = list.indexOf(el);
3214 if (index > -1) {
3215 list.splice(index, 1);
3216 return true;
3217 }
3218 return false;
3219 };
3220 /**
3221 * @param {?} a
3222 * @param {?} b
3223 * @return {?}
3224 */
3225 ListWrapper.equals = function (a, b) {
3226 if (a.length != b.length)
3227 return false;
3228 for (var /** @type {?} */ i = 0; i < a.length; ++i) {
3229 if (a[i] !== b[i])
3230 return false;
3231 }
3232 return true;
3233 };
3234 /**
3235 * @param {?} list
3236 * @return {?}
3237 */
3238 ListWrapper.flatten = function (list) {
3239 return list.reduce(function (flat, item) {
3240 var /** @type {?} */ flatItem = Array.isArray(item) ? ListWrapper.flatten(item) : item;
3241 return ((flat)).concat(flatItem);
3242 }, []);
3243 };
3244 return ListWrapper;
3245 }());
3246 /**
3247 * @param {?} obj
3248 * @return {?}
3249 */
3250 function isListLikeIterable(obj) {
3251 if (!isJsObject(obj))
3252 return false;
3253 return Array.isArray(obj) ||
3254 (!(obj instanceof Map) &&
3255 getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
3256 }
3257 /**
3258 * @param {?} a
3259 * @param {?} b
3260 * @param {?} comparator
3261 * @return {?}
3262 */
3263 function areIterablesEqual(a, b, comparator) {
3264 var /** @type {?} */ iterator1 = a[getSymbolIterator()]();
3265 var /** @type {?} */ iterator2 = b[getSymbolIterator()]();
3266 while (true) {
3267 var /** @type {?} */ item1 = iterator1.next();
3268 var /** @type {?} */ item2 = iterator2.next();
3269 if (item1.done && item2.done)
3270 return true;
3271 if (item1.done || item2.done)
3272 return false;
3273 if (!comparator(item1.value, item2.value))
3274 return false;
3275 }
3276 }
3277 /**
3278 * @param {?} obj
3279 * @param {?} fn
3280 * @return {?}
3281 */
3282 function iterateListLike(obj, fn) {
3283 if (Array.isArray(obj)) {
3284 for (var /** @type {?} */ i = 0; i < obj.length; i++) {
3285 fn(obj[i]);
3286 }
3287 }
3288 else {
3289 var /** @type {?} */ iterator = obj[getSymbolIterator()]();
3290 var /** @type {?} */ item = void 0;
3291 while (!((item = iterator.next()).done)) {
3292 fn(item.value);
3293 }
3294 }
3295 }
3296
3297 /**
3298 * Determine if the argument is shaped like a Promise
3299 * @param {?} obj
3300 * @return {?}
3301 */
3302 function isPromise(obj) {
3303 // allow any Promise/A+ compliant thenable.
3304 // It's up to the caller to ensure that obj.then conforms to the spec
3305 return !!obj && typeof obj.then === 'function';
3306 }
3307 /**
3308 * Determine if the argument is an Observable
3309 * @param {?} obj
3310 * @return {?}
3311 */
3312 function isObservable(obj) {
3313 return !!(obj && obj[rxjs_symbol_observable.$$observable]);
3314 }
3315
3316 /**
3317 * A function that will be executed when an application is initialized.
3318 * @experimental
3319 */
3320 var /** @type {?} */ APP_INITIALIZER = new OpaqueToken('Application Initializer');
3321 /**
3322 * A class that reflects the state of running {\@link APP_INITIALIZER}s.
3323 *
3324 * \@experimental
3325 */
3326 var ApplicationInitStatus = (function () {
3327 /**
3328 * @param {?} appInits
3329 */
3330 function ApplicationInitStatus(appInits) {
3331 var _this = this;
3332 this._done = false;
3333 var asyncInitPromises = [];
3334 if (appInits) {
3335 for (var i = 0; i < appInits.length; i++) {
3336 var initResult = appInits[i]();
3337 if (isPromise(initResult)) {
3338 asyncInitPromises.push(initResult);
3339 }
3340 }
3341 }
3342 this._donePromise = Promise.all(asyncInitPromises).then(function () { _this._done = true; });
3343 if (asyncInitPromises.length === 0) {
3344 this._done = true;
3345 }
3346 }
3347 Object.defineProperty(ApplicationInitStatus.prototype, "done", {
3348 /**
3349 * @return {?}
3350 */
3351 get: function () { return this._done; },
3352 enumerable: true,
3353 configurable: true
3354 });
3355 Object.defineProperty(ApplicationInitStatus.prototype, "donePromise", {
3356 /**
3357 * @return {?}
3358 */
3359 get: function () { return this._donePromise; },
3360 enumerable: true,
3361 configurable: true
3362 });
3363 ApplicationInitStatus.decorators = [
3364 { type: Injectable },
3365 ];
3366 /** @nocollapse */
3367 ApplicationInitStatus.ctorParameters = function () { return [
3368 { type: Array, decorators: [{ type: Inject, args: [APP_INITIALIZER,] }, { type: Optional },] },
3369 ]; };
3370 return ApplicationInitStatus;
3371 }());
3372
3373 /**
3374 * A DI Token representing a unique string id assigned to the application by Angular and used
3375 * primarily for prefixing application attributes and CSS styles when
3376 * {@link ViewEncapsulation#Emulated} is being used.
3377 *
3378 * If you need to avoid randomly generated value to be used as an application id, you can provide
3379 * a custom value via a DI provider <!-- TODO: provider --> configuring the root {@link Injector}
3380 * using this token.
3381 * @experimental
3382 */
3383 var /** @type {?} */ APP_ID = new OpaqueToken('AppId');
3384 /**
3385 * @return {?}
3386 */
3387 function _appIdRandomProviderFactory() {
3388 return "" + _randomChar() + _randomChar() + _randomChar();
3389 }
3390 /**
3391 * Providers that will generate a random APP_ID_TOKEN.
3392 * @experimental
3393 */
3394 var /** @type {?} */ APP_ID_RANDOM_PROVIDER = {
3395 provide: APP_ID,
3396 useFactory: _appIdRandomProviderFactory,
3397 deps: /** @type {?} */ ([]),
3398 };
3399 /**
3400 * @return {?}
3401 */
3402 function _randomChar() {
3403 return String.fromCharCode(97 + Math.floor(Math.random() * 25));
3404 }
3405 /**
3406 * A function that will be executed when a platform is initialized.
3407 * @experimental
3408 */
3409 var /** @type {?} */ PLATFORM_INITIALIZER = new OpaqueToken('Platform Initializer');
3410 /**
3411 * All callbacks provided via this token will be called for every component that is bootstrapped.
3412 * Signature of the callback:
3413 *
3414 * `(componentRef: ComponentRef) => void`.
3415 *
3416 * @experimental
3417 */
3418 var /** @type {?} */ APP_BOOTSTRAP_LISTENER = new OpaqueToken('appBootstrapListener');
3419 /**
3420 * A token which indicates the root directory of the application
3421 * @experimental
3422 */
3423 var /** @type {?} */ PACKAGE_ROOT_URL = new OpaqueToken('Application Packages Root URL');
3424
3425 var Console = (function () {
3426 function Console() {
3427 }
3428 /**
3429 * @param {?} message
3430 * @return {?}
3431 */
3432 Console.prototype.log = function (message) { print(message); };
3433 /**
3434 * @param {?} message
3435 * @return {?}
3436 */
3437 Console.prototype.warn = function (message) { warn(message); };
3438 Console.decorators = [
3439 { type: Injectable },
3440 ];
3441 /** @nocollapse */
3442 Console.ctorParameters = function () { return []; };
3443 return Console;
3444 }());
3445
3446 /**
3447 * @license
3448 * Copyright Google Inc. All Rights Reserved.
3449 *
3450 * Use of this source code is governed by an MIT-style license that can be
3451 * found in the LICENSE file at https://angular.io/license
3452 */
3453 var __extends$4 = (this && this.__extends) || function (d, b) {
3454 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
3455 function __() { this.constructor = d; }
3456 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3457 };
3458 /**
3459 * Indicates that a component is still being loaded in a synchronous compile.
3460 *
3461 * \@stable
3462 */
3463 var ComponentStillLoadingError = (function (_super) {
3464 __extends$4(ComponentStillLoadingError, _super);
3465 /**
3466 * @param {?} compType
3467 */
3468 function ComponentStillLoadingError(compType) {
3469 _super.call(this, "Can't compile synchronously as " + stringify(compType) + " is still being loaded!");
3470 this.compType = compType;
3471 }
3472 return ComponentStillLoadingError;
3473 }(BaseError));
3474 /**
3475 * Combination of NgModuleFactory and ComponentFactorys.
3476 *
3477 * \@experimental
3478 */
3479 var ModuleWithComponentFactories = (function () {
3480 /**
3481 * @param {?} ngModuleFactory
3482 * @param {?} componentFactories
3483 */
3484 function ModuleWithComponentFactories(ngModuleFactory, componentFactories) {
3485 this.ngModuleFactory = ngModuleFactory;
3486 this.componentFactories = componentFactories;
3487 }
3488 return ModuleWithComponentFactories;
3489 }());
3490 /**
3491 * @return {?}
3492 */
3493 function _throwError() {
3494 throw new Error("Runtime compiler is not loaded");
3495 }
3496 /**
3497 * Low-level service for running the angular compiler during runtime
3498 * to create {\@link ComponentFactory}s, which
3499 * can later be used to create and render a Component instance.
3500 *
3501 * Each `\@NgModule` provides an own `Compiler` to its injector,
3502 * that will use the directives/pipes of the ng module for compilation
3503 * of components.
3504 * \@stable
3505 */
3506 var Compiler = (function () {
3507 function Compiler() {
3508 }
3509 /**
3510 * Compiles the given NgModule and all of its components. All templates of the components listed
3511 * in `entryComponents`
3512 * have to be inlined. Otherwise throws a {\@link ComponentStillLoadingError}.
3513 * @param {?} moduleType
3514 * @return {?}
3515 */
3516 Compiler.prototype.compileModuleSync = function (moduleType) { throw _throwError(); };
3517 /**
3518 * Compiles the given NgModule and all of its components
3519 * @param {?} moduleType
3520 * @return {?}
3521 */
3522 Compiler.prototype.compileModuleAsync = function (moduleType) { throw _throwError(); };
3523 /**
3524 * Same as {\@link compileModuleSync} but also creates ComponentFactories for all components.
3525 * @param {?} moduleType
3526 * @return {?}
3527 */
3528 Compiler.prototype.compileModuleAndAllComponentsSync = function (moduleType) {
3529 throw _throwError();
3530 };
3531 /**
3532 * Same as {\@link compileModuleAsync} but also creates ComponentFactories for all components.
3533 * @param {?} moduleType
3534 * @return {?}
3535 */
3536 Compiler.prototype.compileModuleAndAllComponentsAsync = function (moduleType) {
3537 throw _throwError();
3538 };
3539 /**
3540 * Exposes the CSS-style selectors that have been used in `ngContent` directives within
3541 * the template of the given component.
3542 * This is used by the `upgrade` library to compile the appropriate transclude content
3543 * in the Angular 1 wrapper component.
3544 * @param {?} component
3545 * @return {?}
3546 */
3547 Compiler.prototype.getNgContentSelectors = function (component) { throw _throwError(); };
3548 /**
3549 * Clears all caches.
3550 * @return {?}
3551 */
3552 Compiler.prototype.clearCache = function () { };
3553 /**
3554 * Clears the cache for the given component/ngModule.
3555 * @param {?} type
3556 * @return {?}
3557 */
3558 Compiler.prototype.clearCacheFor = function (type) { };
3559 Compiler.decorators = [
3560 { type: Injectable },
3561 ];
3562 /** @nocollapse */
3563 Compiler.ctorParameters = function () { return []; };
3564 return Compiler;
3565 }());
3566 /**
3567 * Token to provide CompilerOptions in the platform injector.
3568 *
3569 * @experimental
3570 */
3571 var /** @type {?} */ COMPILER_OPTIONS = new OpaqueToken('compilerOptions');
3572 /**
3573 * A factory for creating a Compiler
3574 *
3575 * \@experimental
3576 * @abstract
3577 */
3578 var CompilerFactory = (function () {
3579 function CompilerFactory() {
3580 }
3581 /**
3582 * @abstract
3583 * @param {?=} options
3584 * @return {?}
3585 */
3586 CompilerFactory.prototype.createCompiler = function (options) { };
3587 return CompilerFactory;
3588 }());
3589
3590 var ElementRef = (function () {
3591 /**
3592 * @param {?} nativeElement
3593 */
3594 function ElementRef(nativeElement) {
3595 this.nativeElement = nativeElement;
3596 }
3597 return ElementRef;
3598 }());
3599
3600 /**
3601 * @license
3602 * Copyright Google Inc. All Rights Reserved.
3603 *
3604 * Use of this source code is governed by an MIT-style license that can be
3605 * found in the LICENSE file at https://angular.io/license
3606 */
3607 var __extends$6 = (this && this.__extends) || function (d, b) {
3608 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
3609 function __() { this.constructor = d; }
3610 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
3611 };
3612 /**
3613 * Use by directives and components to emit custom Events.
3614 *
3615 * ### Examples
3616 *
3617 * In the following example, `Zippy` alternatively emits `open` and `close` events when its
3618 * title gets clicked:
3619 *
3620 * ```
3621 * \@Component({
3622 * selector: 'zippy',
3623 * template: `
3624 * <div class="zippy">
3625 * <div (click)="toggle()">Toggle</div>
3626 * <div [hidden]="!visible">
3627 * <ng-content></ng-content>
3628 * </div>
3629 * </div>`})
3630 * export class Zippy {
3631 * visible: boolean = true;
3632 * \@Output() open: EventEmitter<any> = new EventEmitter();
3633 * \@Output() close: EventEmitter<any> = new EventEmitter();
3634 *
3635 * toggle() {
3636 * this.visible = !this.visible;
3637 * if (this.visible) {
3638 * this.open.emit(null);
3639 * } else {
3640 * this.close.emit(null);
3641 * }
3642 * }
3643 * }
3644 * ```
3645 *
3646 * The events payload can be accessed by the parameter `$event` on the components output event
3647 * handler:
3648 *
3649 * ```
3650 * <zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy>
3651 * ```
3652 *
3653 * Uses Rx.Observable but provides an adapter to make it work as specified here:
3654 * https://github.com/jhusain/observable-spec
3655 *
3656 * Once a reference implementation of the spec is available, switch to it.
3657 * \@stable
3658 */
3659 var EventEmitter = (function (_super) {
3660 __extends$6(EventEmitter, _super);
3661 /**
3662 * Creates an instance of [EventEmitter], which depending on [isAsync],
3663 * delivers events synchronously or asynchronously.
3664 * @param {?=} isAsync
3665 */
3666 function EventEmitter(isAsync) {
3667 if (isAsync === void 0) { isAsync = false; }
3668 _super.call(this);
3669 this.__isAsync = isAsync;
3670 }
3671 /**
3672 * @param {?=} value
3673 * @return {?}
3674 */
3675 EventEmitter.prototype.emit = function (value) { _super.prototype.next.call(this, value); };
3676 /**
3677 * @param {?=} generatorOrNext
3678 * @param {?=} error
3679 * @param {?=} complete
3680 * @return {?}
3681 */
3682 EventEmitter.prototype.subscribe = function (generatorOrNext, error, complete) {
3683 var /** @type {?} */ schedulerFn;
3684 var /** @type {?} */ errorFn = function (err) { return null; };
3685 var /** @type {?} */ completeFn = function () { return null; };
3686 if (generatorOrNext && typeof generatorOrNext === 'object') {
3687 schedulerFn = this.__isAsync ? function (value) {
3688 setTimeout(function () { return generatorOrNext.next(value); });
3689 } : function (value) { generatorOrNext.next(value); };
3690 if (generatorOrNext.error) {
3691 errorFn = this.__isAsync ? function (err) { setTimeout(function () { return generatorOrNext.error(err); }); } :
3692 function (err) { generatorOrNext.error(err); };
3693 }
3694 if (generatorOrNext.complete) {
3695 completeFn = this.__isAsync ? function () { setTimeout(function () { return generatorOrNext.complete(); }); } :
3696 function () { generatorOrNext.complete(); };
3697 }
3698 }
3699 else {
3700 schedulerFn = this.__isAsync ? function (value) { setTimeout(function () { return generatorOrNext(value); }); } :
3701 function (value) { generatorOrNext(value); };
3702 if (error) {
3703 errorFn =
3704 this.__isAsync ? function (err) { setTimeout(function () { return error(err); }); } : function (err) { error(err); };
3705 }
3706 if (complete) {
3707 completeFn =
3708 this.__isAsync ? function () { setTimeout(function () { return complete(); }); } : function () { complete(); };
3709 }
3710 }
3711 return _super.prototype.subscribe.call(this, schedulerFn, errorFn, completeFn);
3712 };
3713 return EventEmitter;
3714 }(rxjs_Subject.Subject));
3715
3716 /**
3717 * An injectable service for executing work inside or outside of the Angular zone.
3718 *
3719 * The most common use of this service is to optimize performance when starting a work consisting of
3720 * one or more asynchronous tasks that don't require UI updates or error handling to be handled by
3721 * Angular. Such tasks can be kicked off via {\@link runOutsideAngular} and if needed, these tasks
3722 * can reenter the Angular zone via {\@link run}.
3723 *
3724 * <!-- TODO: add/fix links to:
3725 * - docs explaining zones and the use of zones in Angular and change-detection
3726 * - link to runOutsideAngular/run (throughout this file!)
3727 * -->
3728 *
3729 * ### Example
3730 *
3731 * ```
3732 * import {Component, NgZone} from '\@angular/core';
3733 * import {NgIf} from '\@angular/common';
3734 *
3735 * \@Component({
3736 * selector: 'ng-zone-demo'.
3737 * template: `
3738 * <h2>Demo: NgZone</h2>
3739 *
3740 * <p>Progress: {{progress}}%</p>
3741 * <p *ngIf="progress >= 100">Done processing {{label}} of Angular zone!</p>
3742 *
3743 * <button (click)="processWithinAngularZone()">Process within Angular zone</button>
3744 * <button (click)="processOutsideOfAngularZone()">Process outside of Angular zone</button>
3745 * `,
3746 * })
3747 * export class NgZoneDemo {
3748 * progress: number = 0;
3749 * label: string;
3750 *
3751 * constructor(private _ngZone: NgZone) {}
3752 *
3753 * // Loop inside the Angular zone
3754 * // so the UI DOES refresh after each setTimeout cycle
3755 * processWithinAngularZone() {
3756 * this.label = 'inside';
3757 * this.progress = 0;
3758 * this._increaseProgress(() => console.log('Inside Done!'));
3759 * }
3760 *
3761 * // Loop outside of the Angular zone
3762 * // so the UI DOES NOT refresh after each setTimeout cycle
3763 * processOutsideOfAngularZone() {
3764 * this.label = 'outside';
3765 * this.progress = 0;
3766 * this._ngZone.runOutsideAngular(() => {
3767 * this._increaseProgress(() => {
3768 * // reenter the Angular zone and display done
3769 * this._ngZone.run(() => {console.log('Outside Done!') });
3770 * }}));
3771 * }
3772 *
3773 * _increaseProgress(doneCallback: () => void) {
3774 * this.progress += 1;
3775 * console.log(`Current progress: ${this.progress}%`);
3776 *
3777 * if (this.progress < 100) {
3778 * window.setTimeout(() => this._increaseProgress(doneCallback)), 10)
3779 * } else {
3780 * doneCallback();
3781 * }
3782 * }
3783 * }
3784 * ```
3785 *
3786 * \@experimental
3787 */
3788 var NgZone = (function () {
3789 /**
3790 * @param {?} __0
3791 */
3792 function NgZone(_a) {
3793 var _b = _a.enableLongStackTrace, enableLongStackTrace = _b === void 0 ? false : _b;
3794 this._hasPendingMicrotasks = false;
3795 this._hasPendingMacrotasks = false;
3796 this._isStable = true;
3797 this._nesting = 0;
3798 this._onUnstable = new EventEmitter(false);
3799 this._onMicrotaskEmpty = new EventEmitter(false);
3800 this._onStable = new EventEmitter(false);
3801 this._onErrorEvents = new EventEmitter(false);
3802 if (typeof Zone == 'undefined') {
3803 throw new Error('Angular requires Zone.js prolyfill.');
3804 }
3805 Zone.assertZonePatched();
3806 this.outer = this.inner = Zone.current;
3807 if (Zone['wtfZoneSpec']) {
3808 this.inner = this.inner.fork(Zone['wtfZoneSpec']);
3809 }
3810 if (enableLongStackTrace && Zone['longStackTraceZoneSpec']) {
3811 this.inner = this.inner.fork(Zone['longStackTraceZoneSpec']);
3812 }
3813 this.forkInnerZoneWithAngularBehavior();
3814 }
3815 /**
3816 * @return {?}
3817 */
3818 NgZone.isInAngularZone = function () { return Zone.current.get('isAngularZone') === true; };
3819 /**
3820 * @return {?}
3821 */
3822 NgZone.assertInAngularZone = function () {
3823 if (!NgZone.isInAngularZone()) {
3824 throw new Error('Expected to be in Angular Zone, but it is not!');
3825 }
3826 };
3827 /**
3828 * @return {?}
3829 */
3830 NgZone.assertNotInAngularZone = function () {
3831 if (NgZone.isInAngularZone()) {
3832 throw new Error('Expected to not be in Angular Zone, but it is!');
3833 }
3834 };
3835 /**
3836 * Executes the `fn` function synchronously within the Angular zone and returns value returned by
3837 * the function.
3838 *
3839 * Running functions via `run` allows you to reenter Angular zone from a task that was executed
3840 * outside of the Angular zone (typically started via {\@link runOutsideAngular}).
3841 *
3842 * Any future tasks or microtasks scheduled from within this function will continue executing from
3843 * within the Angular zone.
3844 *
3845 * If a synchronous error happens it will be rethrown and not reported via `onError`.
3846 * @param {?} fn
3847 * @return {?}
3848 */
3849 NgZone.prototype.run = function (fn) { return this.inner.run(fn); };
3850 /**
3851 * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
3852 * rethrown.
3853 * @param {?} fn
3854 * @return {?}
3855 */
3856 NgZone.prototype.runGuarded = function (fn) { return this.inner.runGuarded(fn); };
3857 /**
3858 * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
3859 * the function.
3860 *
3861 * Running functions via `runOutsideAngular` allows you to escape Angular's zone and do work that
3862 * doesn't trigger Angular change-detection or is subject to Angular's error handling.
3863 *
3864 * Any future tasks or microtasks scheduled from within this function will continue executing from
3865 * outside of the Angular zone.
3866 *
3867 * Use {\@link run} to reenter the Angular zone and do work that updates the application model.
3868 * @param {?} fn
3869 * @return {?}
3870 */
3871 NgZone.prototype.runOutsideAngular = function (fn) { return this.outer.run(fn); };
3872 Object.defineProperty(NgZone.prototype, "onUnstable", {
3873 /**
3874 * Notifies when code enters Angular Zone. This gets fired first on VM Turn.
3875 * @return {?}
3876 */
3877 get: function () { return this._onUnstable; },
3878 enumerable: true,
3879 configurable: true
3880 });
3881 Object.defineProperty(NgZone.prototype, "onMicrotaskEmpty", {
3882 /**
3883 * Notifies when there is no more microtasks enqueue in the current VM Turn.
3884 * This is a hint for Angular to do change detection, which may enqueue more microtasks.
3885 * For this reason this event can fire multiple times per VM Turn.
3886 * @return {?}
3887 */
3888 get: function () { return this._onMicrotaskEmpty; },
3889 enumerable: true,
3890 configurable: true
3891 });
3892 Object.defineProperty(NgZone.prototype, "onStable", {
3893 /**
3894 * Notifies when the last `onMicrotaskEmpty` has run and there are no more microtasks, which
3895 * implies we are about to relinquish VM turn.
3896 * This event gets called just once.
3897 * @return {?}
3898 */
3899 get: function () { return this._onStable; },
3900 enumerable: true,
3901 configurable: true
3902 });
3903 Object.defineProperty(NgZone.prototype, "onError", {
3904 /**
3905 * Notify that an error has been delivered.
3906 * @return {?}
3907 */
3908 get: function () { return this._onErrorEvents; },
3909 enumerable: true,
3910 configurable: true
3911 });
3912 Object.defineProperty(NgZone.prototype, "isStable", {
3913 /**
3914 * Whether there are no outstanding microtasks or macrotasks.
3915 * @return {?}
3916 */
3917 get: function () { return this._isStable; },
3918 enumerable: true,
3919 configurable: true
3920 });
3921 Object.defineProperty(NgZone.prototype, "hasPendingMicrotasks", {
3922 /**
3923 * @return {?}
3924 */
3925 get: function () { return this._hasPendingMicrotasks; },
3926 enumerable: true,
3927 configurable: true
3928 });
3929 Object.defineProperty(NgZone.prototype, "hasPendingMacrotasks", {
3930 /**
3931 * @return {?}
3932 */
3933 get: function () { return this._hasPendingMacrotasks; },
3934 enumerable: true,
3935 configurable: true
3936 });
3937 /**
3938 * @return {?}
3939 */
3940 NgZone.prototype.checkStable = function () {
3941 var _this = this;
3942 if (this._nesting == 0 && !this._hasPendingMicrotasks && !this._isStable) {
3943 try {
3944 this._nesting++;
3945 this._onMicrotaskEmpty.emit(null);
3946 }
3947 finally {
3948 this._nesting--;
3949 if (!this._hasPendingMicrotasks) {
3950 try {
3951 this.runOutsideAngular(function () { return _this._onStable.emit(null); });
3952 }
3953 finally {
3954 this._isStable = true;
3955 }
3956 }
3957 }
3958 }
3959 };
3960 /**
3961 * @return {?}
3962 */
3963 NgZone.prototype.forkInnerZoneWithAngularBehavior = function () {
3964 var _this = this;
3965 this.inner = this.inner.fork({
3966 name: 'angular',
3967 properties: /** @type {?} */ ({ 'isAngularZone': true }),
3968 onInvokeTask: function (delegate, current, target, task, applyThis, applyArgs) {
3969 try {
3970 _this.onEnter();
3971 return delegate.invokeTask(target, task, applyThis, applyArgs);
3972 }
3973 finally {
3974 _this.onLeave();
3975 }
3976 },
3977 onInvoke: function (delegate, current, target, callback, applyThis, applyArgs, source) {
3978 try {
3979 _this.onEnter();
3980 return delegate.invoke(target, callback, applyThis, applyArgs, source);
3981 }
3982 finally {
3983 _this.onLeave();
3984 }
3985 },
3986 onHasTask: function (delegate, current, target, hasTaskState) {
3987 delegate.hasTask(target, hasTaskState);
3988 if (current === target) {
3989 // We are only interested in hasTask events which originate from our zone
3990 // (A child hasTask event is not interesting to us)
3991 if (hasTaskState.change == 'microTask') {
3992 _this.setHasMicrotask(hasTaskState.microTask);
3993 }
3994 else if (hasTaskState.change == 'macroTask') {
3995 _this.setHasMacrotask(hasTaskState.macroTask);
3996 }
3997 }
3998 },
3999 onHandleError: function (delegate, current, target, error) {
4000 delegate.handleError(target, error);
4001 _this.triggerError(error);
4002 return false;
4003 }
4004 });
4005 };
4006 /**
4007 * @return {?}
4008 */
4009 NgZone.prototype.onEnter = function () {
4010 this._nesting++;
4011 if (this._isStable) {
4012 this._isStable = false;
4013 this._onUnstable.emit(null);
4014 }
4015 };
4016 /**
4017 * @return {?}
4018 */
4019 NgZone.prototype.onLeave = function () {
4020 this._nesting--;
4021 this.checkStable();
4022 };
4023 /**
4024 * @param {?} hasMicrotasks
4025 * @return {?}
4026 */
4027 NgZone.prototype.setHasMicrotask = function (hasMicrotasks) {
4028 this._hasPendingMicrotasks = hasMicrotasks;
4029 this.checkStable();
4030 };
4031 /**
4032 * @param {?} hasMacrotasks
4033 * @return {?}
4034 */
4035 NgZone.prototype.setHasMacrotask = function (hasMacrotasks) { this._hasPendingMacrotasks = hasMacrotasks; };
4036 /**
4037 * @param {?} error
4038 * @return {?}
4039 */
4040 NgZone.prototype.triggerError = function (error) { this._onErrorEvents.emit(error); };
4041 return NgZone;
4042 }());
4043
4044 var AnimationQueue = (function () {
4045 /**
4046 * @param {?} _zone
4047 */
4048 function AnimationQueue(_zone) {
4049 this._zone = _zone;
4050 this.entries = [];
4051 }
4052 /**
4053 * @param {?} player
4054 * @return {?}
4055 */
4056 AnimationQueue.prototype.enqueue = function (player) { this.entries.push(player); };
4057 /**
4058 * @return {?}
4059 */
4060 AnimationQueue.prototype.flush = function () {
4061 var _this = this;
4062 // given that each animation player may set aside
4063 // microtasks and rely on DOM-based events, this
4064 // will cause Angular to run change detection after
4065 // each request. This sidesteps the issue. If a user
4066 // hooks into an animation via (@anim.start) or (@anim.done)
4067 // then those methods will automatically trigger change
4068 // detection by wrapping themselves inside of a zone
4069 if (this.entries.length) {
4070 this._zone.runOutsideAngular(function () {
4071 // this code is wrapped into a single promise such that the
4072 // onStart and onDone player callbacks are triggered outside
4073 // of the digest cycle of animations
4074 Promise.resolve(null).then(function () { return _this._triggerAnimations(); });
4075 });
4076 }
4077 };
4078 /**
4079 * @return {?}
4080 */
4081 AnimationQueue.prototype._triggerAnimations = function () {
4082 NgZone.assertNotInAngularZone();
4083 while (this.entries.length) {
4084 var /** @type {?} */ player = this.entries.shift();
4085 // in the event that an animation throws an error then we do
4086 // not want to re-run animations on any previous animations
4087 // if they have already been kicked off beforehand
4088 if (!player.hasStarted()) {
4089 player.play();
4090 }
4091 }
4092 };
4093 AnimationQueue.decorators = [
4094 { type: Injectable },
4095 ];
4096 /** @nocollapse */
4097 AnimationQueue.ctorParameters = function () { return [
4098 { type: NgZone, },
4099 ]; };
4100 return AnimationQueue;
4101 }());
4102
4103 var DefaultIterableDifferFactory = (function () {
4104 function DefaultIterableDifferFactory() {
4105 }
4106 /**
4107 * @param {?} obj
4108 * @return {?}
4109 */
4110 DefaultIterableDifferFactory.prototype.supports = function (obj) { return isListLikeIterable(obj); };
4111 /**
4112 * @param {?} cdRef
4113 * @param {?=} trackByFn
4114 * @return {?}
4115 */
4116 DefaultIterableDifferFactory.prototype.create = function (cdRef, trackByFn) {
4117 return new DefaultIterableDiffer(trackByFn);
4118 };
4119 return DefaultIterableDifferFactory;
4120 }());
4121 var /** @type {?} */ trackByIdentity = function (index, item) { return item; };
4122 /**
4123 * \@stable
4124 */
4125 var DefaultIterableDiffer = (function () {
4126 /**
4127 * @param {?=} _trackByFn
4128 */
4129 function DefaultIterableDiffer(_trackByFn) {
4130 this._trackByFn = _trackByFn;
4131 this._length = null;
4132 this._collection = null;
4133 this._linkedRecords = null;
4134 this._unlinkedRecords = null;
4135 this._previousItHead = null;
4136 this._itHead = null;
4137 this._itTail = null;
4138 this._additionsHead = null;
4139 this._additionsTail = null;
4140 this._movesHead = null;
4141 this._movesTail = null;
4142 this._removalsHead = null;
4143 this._removalsTail = null;
4144 this._identityChangesHead = null;
4145 this._identityChangesTail = null;
4146 this._trackByFn = this._trackByFn || trackByIdentity;
4147 }
4148 Object.defineProperty(DefaultIterableDiffer.prototype, "collection", {
4149 /**
4150 * @return {?}
4151 */
4152 get: function () { return this._collection; },
4153 enumerable: true,
4154 configurable: true
4155 });
4156 Object.defineProperty(DefaultIterableDiffer.prototype, "length", {
4157 /**
4158 * @return {?}
4159 */
4160 get: function () { return this._length; },
4161 enumerable: true,
4162 configurable: true
4163 });
4164 /**
4165 * @param {?} fn
4166 * @return {?}
4167 */
4168 DefaultIterableDiffer.prototype.forEachItem = function (fn) {
4169 var /** @type {?} */ record;
4170 for (record = this._itHead; record !== null; record = record._next) {
4171 fn(record);
4172 }
4173 };
4174 /**
4175 * @param {?} fn
4176 * @return {?}
4177 */
4178 DefaultIterableDiffer.prototype.forEachOperation = function (fn) {
4179 var /** @type {?} */ nextIt = this._itHead;
4180 var /** @type {?} */ nextRemove = this._removalsHead;
4181 var /** @type {?} */ addRemoveOffset = 0;
4182 var /** @type {?} */ moveOffsets = null;
4183 while (nextIt || nextRemove) {
4184 // Figure out which is the next record to process
4185 // Order: remove, add, move
4186 var /** @type {?} */ record = !nextRemove ||
4187 nextIt &&
4188 nextIt.currentIndex < getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ?
4189 nextIt :
4190 nextRemove;
4191 var /** @type {?} */ adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets);
4192 var /** @type {?} */ currentIndex = record.currentIndex;
4193 // consume the item, and adjust the addRemoveOffset and update moveDistance if necessary
4194 if (record === nextRemove) {
4195 addRemoveOffset--;
4196 nextRemove = nextRemove._nextRemoved;
4197 }
4198 else {
4199 nextIt = nextIt._next;
4200 if (record.previousIndex == null) {
4201 addRemoveOffset++;
4202 }
4203 else {
4204 // INVARIANT: currentIndex < previousIndex
4205 if (!moveOffsets)
4206 moveOffsets = [];
4207 var /** @type {?} */ localMovePreviousIndex = adjPreviousIndex - addRemoveOffset;
4208 var /** @type {?} */ localCurrentIndex = currentIndex - addRemoveOffset;
4209 if (localMovePreviousIndex != localCurrentIndex) {
4210 for (var /** @type {?} */ i = 0; i < localMovePreviousIndex; i++) {
4211 var /** @type {?} */ offset = i < moveOffsets.length ? moveOffsets[i] : (moveOffsets[i] = 0);
4212 var /** @type {?} */ index = offset + i;
4213 if (localCurrentIndex <= index && index < localMovePreviousIndex) {
4214 moveOffsets[i] = offset + 1;
4215 }
4216 }
4217 var /** @type {?} */ previousIndex = record.previousIndex;
4218 moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex;
4219 }
4220 }
4221 }
4222 if (adjPreviousIndex !== currentIndex) {
4223 fn(record, adjPreviousIndex, currentIndex);
4224 }
4225 }
4226 };
4227 /**
4228 * @param {?} fn
4229 * @return {?}
4230 */
4231 DefaultIterableDiffer.prototype.forEachPreviousItem = function (fn) {
4232 var /** @type {?} */ record;
4233 for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
4234 fn(record);
4235 }
4236 };
4237 /**
4238 * @param {?} fn
4239 * @return {?}
4240 */
4241 DefaultIterableDiffer.prototype.forEachAddedItem = function (fn) {
4242 var /** @type {?} */ record;
4243 for (record = this._additionsHead; record !== null; record = record._nextAdded) {
4244 fn(record);
4245 }
4246 };
4247 /**
4248 * @param {?} fn
4249 * @return {?}
4250 */
4251 DefaultIterableDiffer.prototype.forEachMovedItem = function (fn) {
4252 var /** @type {?} */ record;
4253 for (record = this._movesHead; record !== null; record = record._nextMoved) {
4254 fn(record);
4255 }
4256 };
4257 /**
4258 * @param {?} fn
4259 * @return {?}
4260 */
4261 DefaultIterableDiffer.prototype.forEachRemovedItem = function (fn) {
4262 var /** @type {?} */ record;
4263 for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
4264 fn(record);
4265 }
4266 };
4267 /**
4268 * @param {?} fn
4269 * @return {?}
4270 */
4271 DefaultIterableDiffer.prototype.forEachIdentityChange = function (fn) {
4272 var /** @type {?} */ record;
4273 for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) {
4274 fn(record);
4275 }
4276 };
4277 /**
4278 * @param {?} collection
4279 * @return {?}
4280 */
4281 DefaultIterableDiffer.prototype.diff = function (collection) {
4282 if (isBlank(collection))
4283 collection = [];
4284 if (!isListLikeIterable(collection)) {
4285 throw new Error("Error trying to diff '" + collection + "'");
4286 }
4287 if (this.check(collection)) {
4288 return this;
4289 }
4290 else {
4291 return null;
4292 }
4293 };
4294 /**
4295 * @return {?}
4296 */
4297 DefaultIterableDiffer.prototype.onDestroy = function () { };
4298 /**
4299 * @param {?} collection
4300 * @return {?}
4301 */
4302 DefaultIterableDiffer.prototype.check = function (collection) {
4303 var _this = this;
4304 this._reset();
4305 var /** @type {?} */ record = this._itHead;
4306 var /** @type {?} */ mayBeDirty = false;
4307 var /** @type {?} */ index;
4308 var /** @type {?} */ item;
4309 var /** @type {?} */ itemTrackBy;
4310 if (Array.isArray(collection)) {
4311 var /** @type {?} */ list = collection;
4312 this._length = collection.length;
4313 for (var /** @type {?} */ index_1 = 0; index_1 < this._length; index_1++) {
4314 item = list[index_1];
4315 itemTrackBy = this._trackByFn(index_1, item);
4316 if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
4317 record = this._mismatch(record, item, itemTrackBy, index_1);
4318 mayBeDirty = true;
4319 }
4320 else {
4321 if (mayBeDirty) {
4322 // TODO(misko): can we limit this to duplicates only?
4323 record = this._verifyReinsertion(record, item, itemTrackBy, index_1);
4324 }
4325 if (!looseIdentical(record.item, item))
4326 this._addIdentityChange(record, item);
4327 }
4328 record = record._next;
4329 }
4330 }
4331 else {
4332 index = 0;
4333 iterateListLike(collection, function (item /** TODO #9100 */) {
4334 itemTrackBy = _this._trackByFn(index, item);
4335 if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
4336 record = _this._mismatch(record, item, itemTrackBy, index);
4337 mayBeDirty = true;
4338 }
4339 else {
4340 if (mayBeDirty) {
4341 // TODO(misko): can we limit this to duplicates only?
4342 record = _this._verifyReinsertion(record, item, itemTrackBy, index);
4343 }
4344 if (!looseIdentical(record.item, item))
4345 _this._addIdentityChange(record, item);
4346 }
4347 record = record._next;
4348 index++;
4349 });
4350 this._length = index;
4351 }
4352 this._truncate(record);
4353 this._collection = collection;
4354 return this.isDirty;
4355 };
4356 Object.defineProperty(DefaultIterableDiffer.prototype, "isDirty", {
4357 /**
4358 * @return {?}
4359 */
4360 get: function () {
4361 return this._additionsHead !== null || this._movesHead !== null ||
4362 this._removalsHead !== null || this._identityChangesHead !== null;
4363 },
4364 enumerable: true,
4365 configurable: true
4366 });
4367 /**
4368 * Reset the state of the change objects to show no changes. This means set previousKey to
4369 * currentKey, and clear all of the queues (additions, moves, removals).
4370 * Set the previousIndexes of moved and added items to their currentIndexes
4371 * Reset the list of additions, moves and removals
4372 *
4373 * \@internal
4374 * @return {?}
4375 */
4376 DefaultIterableDiffer.prototype._reset = function () {
4377 if (this.isDirty) {
4378 var /** @type {?} */ record = void 0;
4379 var /** @type {?} */ nextRecord = void 0;
4380 for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {
4381 record._nextPrevious = record._next;
4382 }
4383 for (record = this._additionsHead; record !== null; record = record._nextAdded) {
4384 record.previousIndex = record.currentIndex;
4385 }
4386 this._additionsHead = this._additionsTail = null;
4387 for (record = this._movesHead; record !== null; record = nextRecord) {
4388 record.previousIndex = record.currentIndex;
4389 nextRecord = record._nextMoved;
4390 }
4391 this._movesHead = this._movesTail = null;
4392 this._removalsHead = this._removalsTail = null;
4393 this._identityChangesHead = this._identityChangesTail = null;
4394 }
4395 };
4396 /**
4397 * This is the core function which handles differences between collections.
4398 *
4399 * - `record` is the record which we saw at this position last time. If null then it is a new
4400 * item.
4401 * - `item` is the current item in the collection
4402 * - `index` is the position of the item in the collection
4403 *
4404 * \@internal
4405 * @param {?} record
4406 * @param {?} item
4407 * @param {?} itemTrackBy
4408 * @param {?} index
4409 * @return {?}
4410 */
4411 DefaultIterableDiffer.prototype._mismatch = function (record, item, itemTrackBy, index) {
4412 // The previous record after which we will append the current one.
4413 var /** @type {?} */ previousRecord;
4414 if (record === null) {
4415 previousRecord = this._itTail;
4416 }
4417 else {
4418 previousRecord = record._prev;
4419 // Remove the record from the collection since we know it does not match the item.
4420 this._remove(record);
4421 }
4422 // Attempt to see if we have seen the item before.
4423 record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index);
4424 if (record !== null) {
4425 // We have seen this before, we need to move it forward in the collection.
4426 // But first we need to check if identity changed, so we can update in view if necessary
4427 if (!looseIdentical(record.item, item))
4428 this._addIdentityChange(record, item);
4429 this._moveAfter(record, previousRecord, index);
4430 }
4431 else {
4432 // Never seen it, check evicted list.
4433 record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy);
4434 if (record !== null) {
4435 // It is an item which we have evicted earlier: reinsert it back into the list.
4436 // But first we need to check if identity changed, so we can update in view if necessary
4437 if (!looseIdentical(record.item, item))
4438 this._addIdentityChange(record, item);
4439 this._reinsertAfter(record, previousRecord, index);
4440 }
4441 else {
4442 // It is a new item: add it.
4443 record =
4444 this._addAfter(new CollectionChangeRecord(item, itemTrackBy), previousRecord, index);
4445 }
4446 }
4447 return record;
4448 };
4449 /**
4450 * This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
4451 *
4452 * Use case: `[a, a]` => `[b, a, a]`
4453 *
4454 * If we did not have this check then the insertion of `b` would:
4455 * 1) evict first `a`
4456 * 2) insert `b` at `0` index.
4457 * 3) leave `a` at index `1` as is. <-- this is wrong!
4458 * 3) reinsert `a` at index 2. <-- this is wrong!
4459 *
4460 * The correct behavior is:
4461 * 1) evict first `a`
4462 * 2) insert `b` at `0` index.
4463 * 3) reinsert `a` at index 1.
4464 * 3) move `a` at from `1` to `2`.
4465 *
4466 *
4467 * Double check that we have not evicted a duplicate item. We need to check if the item type may
4468 * have already been removed:
4469 * The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
4470 * at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
4471 * better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
4472 * at the end.
4473 *
4474 * \@internal
4475 * @param {?} record
4476 * @param {?} item
4477 * @param {?} itemTrackBy
4478 * @param {?} index
4479 * @return {?}
4480 */
4481 DefaultIterableDiffer.prototype._verifyReinsertion = function (record, item, itemTrackBy, index) {
4482 var /** @type {?} */ reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy);
4483 if (reinsertRecord !== null) {
4484 record = this._reinsertAfter(reinsertRecord, record._prev, index);
4485 }
4486 else if (record.currentIndex != index) {
4487 record.currentIndex = index;
4488 this._addToMoves(record, index);
4489 }
4490 return record;
4491 };
4492 /**
4493 * Get rid of any excess {\@link CollectionChangeRecord}s from the previous collection
4494 *
4495 * - `record` The first excess {\@link CollectionChangeRecord}.
4496 *
4497 * \@internal
4498 * @param {?} record
4499 * @return {?}
4500 */
4501 DefaultIterableDiffer.prototype._truncate = function (record) {
4502 // Anything after that needs to be removed;
4503 while (record !== null) {
4504 var /** @type {?} */ nextRecord = record._next;
4505 this._addToRemovals(this._unlink(record));
4506 record = nextRecord;
4507 }
4508 if (this._unlinkedRecords !== null) {
4509 this._unlinkedRecords.clear();
4510 }
4511 if (this._additionsTail !== null) {
4512 this._additionsTail._nextAdded = null;
4513 }
4514 if (this._movesTail !== null) {
4515 this._movesTail._nextMoved = null;
4516 }
4517 if (this._itTail !== null) {
4518 this._itTail._next = null;
4519 }
4520 if (this._removalsTail !== null) {
4521 this._removalsTail._nextRemoved = null;
4522 }
4523 if (this._identityChangesTail !== null) {
4524 this._identityChangesTail._nextIdentityChange = null;
4525 }
4526 };
4527 /**
4528 * \@internal
4529 * @param {?} record
4530 * @param {?} prevRecord
4531 * @param {?} index
4532 * @return {?}
4533 */
4534 DefaultIterableDiffer.prototype._reinsertAfter = function (record, prevRecord, index) {
4535 if (this._unlinkedRecords !== null) {
4536 this._unlinkedRecords.remove(record);
4537 }
4538 var /** @type {?} */ prev = record._prevRemoved;
4539 var /** @type {?} */ next = record._nextRemoved;
4540 if (prev === null) {
4541 this._removalsHead = next;
4542 }
4543 else {
4544 prev._nextRemoved = next;
4545 }
4546 if (next === null) {
4547 this._removalsTail = prev;
4548 }
4549 else {
4550 next._prevRemoved = prev;
4551 }
4552 this._insertAfter(record, prevRecord, index);
4553 this._addToMoves(record, index);
4554 return record;
4555 };
4556 /**
4557 * \@internal
4558 * @param {?} record
4559 * @param {?} prevRecord
4560 * @param {?} index
4561 * @return {?}
4562 */
4563 DefaultIterableDiffer.prototype._moveAfter = function (record, prevRecord, index) {
4564 this._unlink(record);
4565 this._insertAfter(record, prevRecord, index);
4566 this._addToMoves(record, index);
4567 return record;
4568 };
4569 /**
4570 * \@internal
4571 * @param {?} record
4572 * @param {?} prevRecord
4573 * @param {?} index
4574 * @return {?}
4575 */
4576 DefaultIterableDiffer.prototype._addAfter = function (record, prevRecord, index) {
4577 this._insertAfter(record, prevRecord, index);
4578 if (this._additionsTail === null) {
4579 // todo(vicb)
4580 // assert(this._additionsHead === null);
4581 this._additionsTail = this._additionsHead = record;
4582 }
4583 else {
4584 // todo(vicb)
4585 // assert(_additionsTail._nextAdded === null);
4586 // assert(record._nextAdded === null);
4587 this._additionsTail = this._additionsTail._nextAdded = record;
4588 }
4589 return record;
4590 };
4591 /**
4592 * \@internal
4593 * @param {?} record
4594 * @param {?} prevRecord
4595 * @param {?} index
4596 * @return {?}
4597 */
4598 DefaultIterableDiffer.prototype._insertAfter = function (record, prevRecord, index) {
4599 // todo(vicb)
4600 // assert(record != prevRecord);
4601 // assert(record._next === null);
4602 // assert(record._prev === null);
4603 var /** @type {?} */ next = prevRecord === null ? this._itHead : prevRecord._next;
4604 // todo(vicb)
4605 // assert(next != record);
4606 // assert(prevRecord != record);
4607 record._next = next;
4608 record._prev = prevRecord;
4609 if (next === null) {
4610 this._itTail = record;
4611 }
4612 else {
4613 next._prev = record;
4614 }
4615 if (prevRecord === null) {
4616 this._itHead = record;
4617 }
4618 else {
4619 prevRecord._next = record;
4620 }
4621 if (this._linkedRecords === null) {
4622 this._linkedRecords = new _DuplicateMap();
4623 }
4624 this._linkedRecords.put(record);
4625 record.currentIndex = index;
4626 return record;
4627 };
4628 /**
4629 * \@internal
4630 * @param {?} record
4631 * @return {?}
4632 */
4633 DefaultIterableDiffer.prototype._remove = function (record) {
4634 return this._addToRemovals(this._unlink(record));
4635 };
4636 /**
4637 * \@internal
4638 * @param {?} record
4639 * @return {?}
4640 */
4641 DefaultIterableDiffer.prototype._unlink = function (record) {
4642 if (this._linkedRecords !== null) {
4643 this._linkedRecords.remove(record);
4644 }
4645 var /** @type {?} */ prev = record._prev;
4646 var /** @type {?} */ next = record._next;
4647 // todo(vicb)
4648 // assert((record._prev = null) === null);
4649 // assert((record._next = null) === null);
4650 if (prev === null) {
4651 this._itHead = next;
4652 }
4653 else {
4654 prev._next = next;
4655 }
4656 if (next === null) {
4657 this._itTail = prev;
4658 }
4659 else {
4660 next._prev = prev;
4661 }
4662 return record;
4663 };
4664 /**
4665 * \@internal
4666 * @param {?} record
4667 * @param {?} toIndex
4668 * @return {?}
4669 */
4670 DefaultIterableDiffer.prototype._addToMoves = function (record, toIndex) {
4671 // todo(vicb)
4672 // assert(record._nextMoved === null);
4673 if (record.previousIndex === toIndex) {
4674 return record;
4675 }
4676 if (this._movesTail === null) {
4677 // todo(vicb)
4678 // assert(_movesHead === null);
4679 this._movesTail = this._movesHead = record;
4680 }
4681 else {
4682 // todo(vicb)
4683 // assert(_movesTail._nextMoved === null);
4684 this._movesTail = this._movesTail._nextMoved = record;
4685 }
4686 return record;
4687 };
4688 /**
4689 * \@internal
4690 * @param {?} record
4691 * @return {?}
4692 */
4693 DefaultIterableDiffer.prototype._addToRemovals = function (record) {
4694 if (this._unlinkedRecords === null) {
4695 this._unlinkedRecords = new _DuplicateMap();
4696 }
4697 this._unlinkedRecords.put(record);
4698 record.currentIndex = null;
4699 record._nextRemoved = null;
4700 if (this._removalsTail === null) {
4701 // todo(vicb)
4702 // assert(_removalsHead === null);
4703 this._removalsTail = this._removalsHead = record;
4704 record._prevRemoved = null;
4705 }
4706 else {
4707 // todo(vicb)
4708 // assert(_removalsTail._nextRemoved === null);
4709 // assert(record._nextRemoved === null);
4710 record._prevRemoved = this._removalsTail;
4711 this._removalsTail = this._removalsTail._nextRemoved = record;
4712 }
4713 return record;
4714 };
4715 /**
4716 * \@internal
4717 * @param {?} record
4718 * @param {?} item
4719 * @return {?}
4720 */
4721 DefaultIterableDiffer.prototype._addIdentityChange = function (record, item) {
4722 record.item = item;
4723 if (this._identityChangesTail === null) {
4724 this._identityChangesTail = this._identityChangesHead = record;
4725 }
4726 else {
4727 this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record;
4728 }
4729 return record;
4730 };
4731 /**
4732 * @return {?}
4733 */
4734 DefaultIterableDiffer.prototype.toString = function () {
4735 var /** @type {?} */ list = [];
4736 this.forEachItem(function (record /** TODO #9100 */) { return list.push(record); });
4737 var /** @type {?} */ previous = [];
4738 this.forEachPreviousItem(function (record /** TODO #9100 */) { return previous.push(record); });
4739 var /** @type {?} */ additions = [];
4740 this.forEachAddedItem(function (record /** TODO #9100 */) { return additions.push(record); });
4741 var /** @type {?} */ moves = [];
4742 this.forEachMovedItem(function (record /** TODO #9100 */) { return moves.push(record); });
4743 var /** @type {?} */ removals = [];
4744 this.forEachRemovedItem(function (record /** TODO #9100 */) { return removals.push(record); });
4745 var /** @type {?} */ identityChanges = [];
4746 this.forEachIdentityChange(function (record /** TODO #9100 */) { return identityChanges.push(record); });
4747 return 'collection: ' + list.join(', ') + '\n' +
4748 'previous: ' + previous.join(', ') + '\n' +
4749 'additions: ' + additions.join(', ') + '\n' +
4750 'moves: ' + moves.join(', ') + '\n' +
4751 'removals: ' + removals.join(', ') + '\n' +
4752 'identityChanges: ' + identityChanges.join(', ') + '\n';
4753 };
4754 return DefaultIterableDiffer;
4755 }());
4756 /**
4757 * \@stable
4758 */
4759 var CollectionChangeRecord = (function () {
4760 /**
4761 * @param {?} item
4762 * @param {?} trackById
4763 */
4764 function CollectionChangeRecord(item, trackById) {
4765 this.item = item;
4766 this.trackById = trackById;
4767 this.currentIndex = null;
4768 this.previousIndex = null;
4769 /** @internal */
4770 this._nextPrevious = null;
4771 /** @internal */
4772 this._prev = null;
4773 /** @internal */
4774 this._next = null;
4775 /** @internal */
4776 this._prevDup = null;
4777 /** @internal */
4778 this._nextDup = null;
4779 /** @internal */
4780 this._prevRemoved = null;
4781 /** @internal */
4782 this._nextRemoved = null;
4783 /** @internal */
4784 this._nextAdded = null;
4785 /** @internal */
4786 this._nextMoved = null;
4787 /** @internal */
4788 this._nextIdentityChange = null;
4789 }
4790 /**
4791 * @return {?}
4792 */
4793 CollectionChangeRecord.prototype.toString = function () {
4794 return this.previousIndex === this.currentIndex ? stringify(this.item) :
4795 stringify(this.item) + '[' +
4796 stringify(this.previousIndex) + '->' + stringify(this.currentIndex) + ']';
4797 };
4798 return CollectionChangeRecord;
4799 }());
4800 var _DuplicateItemRecordList = (function () {
4801 function _DuplicateItemRecordList() {
4802 /** @internal */
4803 this._head = null;
4804 /** @internal */
4805 this._tail = null;
4806 }
4807 /**
4808 * Append the record to the list of duplicates.
4809 *
4810 * Note: by design all records in the list of duplicates hold the same value in record.item.
4811 * @param {?} record
4812 * @return {?}
4813 */
4814 _DuplicateItemRecordList.prototype.add = function (record) {
4815 if (this._head === null) {
4816 this._head = this._tail = record;
4817 record._nextDup = null;
4818 record._prevDup = null;
4819 }
4820 else {
4821 // todo(vicb)
4822 // assert(record.item == _head.item ||
4823 // record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN);
4824 this._tail._nextDup = record;
4825 record._prevDup = this._tail;
4826 record._nextDup = null;
4827 this._tail = record;
4828 }
4829 };
4830 /**
4831 * @param {?} trackById
4832 * @param {?} afterIndex
4833 * @return {?}
4834 */
4835 _DuplicateItemRecordList.prototype.get = function (trackById, afterIndex) {
4836 var /** @type {?} */ record;
4837 for (record = this._head; record !== null; record = record._nextDup) {
4838 if ((afterIndex === null || afterIndex < record.currentIndex) &&
4839 looseIdentical(record.trackById, trackById)) {
4840 return record;
4841 }
4842 }
4843 return null;
4844 };
4845 /**
4846 * Remove one {\@link CollectionChangeRecord} from the list of duplicates.
4847 *
4848 * Returns whether the list of duplicates is empty.
4849 * @param {?} record
4850 * @return {?}
4851 */
4852 _DuplicateItemRecordList.prototype.remove = function (record) {
4853 // todo(vicb)
4854 // assert(() {
4855 // // verify that the record being removed is in the list.
4856 // for (CollectionChangeRecord cursor = _head; cursor != null; cursor = cursor._nextDup) {
4857 // if (identical(cursor, record)) return true;
4858 // }
4859 // return false;
4860 //});
4861 var /** @type {?} */ prev = record._prevDup;
4862 var /** @type {?} */ next = record._nextDup;
4863 if (prev === null) {
4864 this._head = next;
4865 }
4866 else {
4867 prev._nextDup = next;
4868 }
4869 if (next === null) {
4870 this._tail = prev;
4871 }
4872 else {
4873 next._prevDup = prev;
4874 }
4875 return this._head === null;
4876 };
4877 return _DuplicateItemRecordList;
4878 }());
4879 var _DuplicateMap = (function () {
4880 function _DuplicateMap() {
4881 this.map = new Map();
4882 }
4883 /**
4884 * @param {?} record
4885 * @return {?}
4886 */
4887 _DuplicateMap.prototype.put = function (record) {
4888 var /** @type {?} */ key = record.trackById;
4889 var /** @type {?} */ duplicates = this.map.get(key);
4890 if (!duplicates) {
4891 duplicates = new _DuplicateItemRecordList();
4892 this.map.set(key, duplicates);
4893 }
4894 duplicates.add(record);
4895 };
4896 /**
4897 * Retrieve the `value` using key. Because the CollectionChangeRecord value may be one which we
4898 * have already iterated over, we use the afterIndex to pretend it is not there.
4899 *
4900 * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
4901 * have any more `a`s needs to return the last `a` not the first or second.
4902 * @param {?} trackById
4903 * @param {?=} afterIndex
4904 * @return {?}
4905 */
4906 _DuplicateMap.prototype.get = function (trackById, afterIndex) {
4907 if (afterIndex === void 0) { afterIndex = null; }
4908 var /** @type {?} */ key = trackById;
4909 var /** @type {?} */ recordList = this.map.get(key);
4910 return recordList ? recordList.get(trackById, afterIndex) : null;
4911 };
4912 /**
4913 * Removes a {\@link CollectionChangeRecord} from the list of duplicates.
4914 *
4915 * The list of duplicates also is removed from the map if it gets empty.
4916 * @param {?} record
4917 * @return {?}
4918 */
4919 _DuplicateMap.prototype.remove = function (record) {
4920 var /** @type {?} */ key = record.trackById;
4921 var /** @type {?} */ recordList = this.map.get(key);
4922 // Remove the list of duplicates when it gets empty
4923 if (recordList.remove(record)) {
4924 this.map.delete(key);
4925 }
4926 return record;
4927 };
4928 Object.defineProperty(_DuplicateMap.prototype, "isEmpty", {
4929 /**
4930 * @return {?}
4931 */
4932 get: function () { return this.map.size === 0; },
4933 enumerable: true,
4934 configurable: true
4935 });
4936 /**
4937 * @return {?}
4938 */
4939 _DuplicateMap.prototype.clear = function () { this.map.clear(); };
4940 /**
4941 * @return {?}
4942 */
4943 _DuplicateMap.prototype.toString = function () { return '_DuplicateMap(' + stringify(this.map) + ')'; };
4944 return _DuplicateMap;
4945 }());
4946 /**
4947 * @param {?} item
4948 * @param {?} addRemoveOffset
4949 * @param {?} moveOffsets
4950 * @return {?}
4951 */
4952 function getPreviousIndex(item, addRemoveOffset, moveOffsets) {
4953 var /** @type {?} */ previousIndex = item.previousIndex;
4954 if (previousIndex === null)
4955 return previousIndex;
4956 var /** @type {?} */ moveOffset = 0;
4957 if (moveOffsets && previousIndex < moveOffsets.length) {
4958 moveOffset = moveOffsets[previousIndex];
4959 }
4960 return previousIndex + addRemoveOffset + moveOffset;
4961 }
4962
4963 var DefaultKeyValueDifferFactory = (function () {
4964 function DefaultKeyValueDifferFactory() {
4965 }
4966 /**
4967 * @param {?} obj
4968 * @return {?}
4969 */
4970 DefaultKeyValueDifferFactory.prototype.supports = function (obj) { return obj instanceof Map || isJsObject(obj); };
4971 /**
4972 * @param {?} cdRef
4973 * @return {?}
4974 */
4975 DefaultKeyValueDifferFactory.prototype.create = function (cdRef) { return new DefaultKeyValueDiffer(); };
4976 return DefaultKeyValueDifferFactory;
4977 }());
4978 var DefaultKeyValueDiffer = (function () {
4979 function DefaultKeyValueDiffer() {
4980 this._records = new Map();
4981 this._mapHead = null;
4982 this._previousMapHead = null;
4983 this._changesHead = null;
4984 this._changesTail = null;
4985 this._additionsHead = null;
4986 this._additionsTail = null;
4987 this._removalsHead = null;
4988 this._removalsTail = null;
4989 }
4990 Object.defineProperty(DefaultKeyValueDiffer.prototype, "isDirty", {
4991 /**
4992 * @return {?}
4993 */
4994 get: function () {
4995 return this._additionsHead !== null || this._changesHead !== null ||
4996 this._removalsHead !== null;
4997 },
4998 enumerable: true,
4999 configurable: true
5000 });
5001 /**
5002 * @param {?} fn
5003 * @return {?}
5004 */
5005 DefaultKeyValueDiffer.prototype.forEachItem = function (fn) {
5006 var /** @type {?} */ record;
5007 for (record = this._mapHead; record !== null; record = record._next) {
5008 fn(record);
5009 }
5010 };
5011 /**
5012 * @param {?} fn
5013 * @return {?}
5014 */
5015 DefaultKeyValueDiffer.prototype.forEachPreviousItem = function (fn) {
5016 var /** @type {?} */ record;
5017 for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
5018 fn(record);
5019 }
5020 };
5021 /**
5022 * @param {?} fn
5023 * @return {?}
5024 */
5025 DefaultKeyValueDiffer.prototype.forEachChangedItem = function (fn) {
5026 var /** @type {?} */ record;
5027 for (record = this._changesHead; record !== null; record = record._nextChanged) {
5028 fn(record);
5029 }
5030 };
5031 /**
5032 * @param {?} fn
5033 * @return {?}
5034 */
5035 DefaultKeyValueDiffer.prototype.forEachAddedItem = function (fn) {
5036 var /** @type {?} */ record;
5037 for (record = this._additionsHead; record !== null; record = record._nextAdded) {
5038 fn(record);
5039 }
5040 };
5041 /**
5042 * @param {?} fn
5043 * @return {?}
5044 */
5045 DefaultKeyValueDiffer.prototype.forEachRemovedItem = function (fn) {
5046 var /** @type {?} */ record;
5047 for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
5048 fn(record);
5049 }
5050 };
5051 /**
5052 * @param {?} map
5053 * @return {?}
5054 */
5055 DefaultKeyValueDiffer.prototype.diff = function (map) {
5056 if (!map) {
5057 map = new Map();
5058 }
5059 else if (!(map instanceof Map || isJsObject(map))) {
5060 throw new Error("Error trying to diff '" + map + "'");
5061 }
5062 return this.check(map) ? this : null;
5063 };
5064 /**
5065 * @return {?}
5066 */
5067 DefaultKeyValueDiffer.prototype.onDestroy = function () { };
5068 /**
5069 * @param {?} map
5070 * @return {?}
5071 */
5072 DefaultKeyValueDiffer.prototype.check = function (map) {
5073 var _this = this;
5074 this._reset();
5075 var /** @type {?} */ records = this._records;
5076 var /** @type {?} */ oldSeqRecord = this._mapHead;
5077 var /** @type {?} */ lastOldSeqRecord = null;
5078 var /** @type {?} */ lastNewSeqRecord = null;
5079 var /** @type {?} */ seqChanged = false;
5080 this._forEach(map, function (value, key) {
5081 var /** @type {?} */ newSeqRecord;
5082 if (oldSeqRecord && key === oldSeqRecord.key) {
5083 newSeqRecord = oldSeqRecord;
5084 _this._maybeAddToChanges(newSeqRecord, value);
5085 }
5086 else {
5087 seqChanged = true;
5088 if (oldSeqRecord !== null) {
5089 _this._removeFromSeq(lastOldSeqRecord, oldSeqRecord);
5090 _this._addToRemovals(oldSeqRecord);
5091 }
5092 if (records.has(key)) {
5093 newSeqRecord = records.get(key);
5094 _this._maybeAddToChanges(newSeqRecord, value);
5095 }
5096 else {
5097 newSeqRecord = new KeyValueChangeRecord(key);
5098 records.set(key, newSeqRecord);
5099 newSeqRecord.currentValue = value;
5100 _this._addToAdditions(newSeqRecord);
5101 }
5102 }
5103 if (seqChanged) {
5104 if (_this._isInRemovals(newSeqRecord)) {
5105 _this._removeFromRemovals(newSeqRecord);
5106 }
5107 if (lastNewSeqRecord == null) {
5108 _this._mapHead = newSeqRecord;
5109 }
5110 else {
5111 lastNewSeqRecord._next = newSeqRecord;
5112 }
5113 }
5114 lastOldSeqRecord = oldSeqRecord;
5115 lastNewSeqRecord = newSeqRecord;
5116 oldSeqRecord = oldSeqRecord && oldSeqRecord._next;
5117 });
5118 this._truncate(lastOldSeqRecord, oldSeqRecord);
5119 return this.isDirty;
5120 };
5121 /**
5122 * \@internal
5123 * @return {?}
5124 */
5125 DefaultKeyValueDiffer.prototype._reset = function () {
5126 if (this.isDirty) {
5127 var /** @type {?} */ record = void 0;
5128 // Record the state of the mapping
5129 for (record = this._previousMapHead = this._mapHead; record !== null; record = record._next) {
5130 record._nextPrevious = record._next;
5131 }
5132 for (record = this._changesHead; record !== null; record = record._nextChanged) {
5133 record.previousValue = record.currentValue;
5134 }
5135 for (record = this._additionsHead; record != null; record = record._nextAdded) {
5136 record.previousValue = record.currentValue;
5137 }
5138 this._changesHead = this._changesTail = null;
5139 this._additionsHead = this._additionsTail = null;
5140 this._removalsHead = this._removalsTail = null;
5141 }
5142 };
5143 /**
5144 * \@internal
5145 * @param {?} lastRecord
5146 * @param {?} record
5147 * @return {?}
5148 */
5149 DefaultKeyValueDiffer.prototype._truncate = function (lastRecord, record) {
5150 while (record !== null) {
5151 if (lastRecord === null) {
5152 this._mapHead = null;
5153 }
5154 else {
5155 lastRecord._next = null;
5156 }
5157 var /** @type {?} */ nextRecord = record._next;
5158 this._addToRemovals(record);
5159 lastRecord = record;
5160 record = nextRecord;
5161 }
5162 for (var /** @type {?} */ rec = this._removalsHead; rec !== null; rec = rec._nextRemoved) {
5163 rec.previousValue = rec.currentValue;
5164 rec.currentValue = null;
5165 this._records.delete(rec.key);
5166 }
5167 };
5168 /**
5169 * @param {?} record
5170 * @param {?} newValue
5171 * @return {?}
5172 */
5173 DefaultKeyValueDiffer.prototype._maybeAddToChanges = function (record, newValue) {
5174 if (!looseIdentical(newValue, record.currentValue)) {
5175 record.previousValue = record.currentValue;
5176 record.currentValue = newValue;
5177 this._addToChanges(record);
5178 }
5179 };
5180 /**
5181 * \@internal
5182 * @param {?} record
5183 * @return {?}
5184 */
5185 DefaultKeyValueDiffer.prototype._isInRemovals = function (record) {
5186 return record === this._removalsHead || record._nextRemoved !== null ||
5187 record._prevRemoved !== null;
5188 };
5189 /**
5190 * \@internal
5191 * @param {?} record
5192 * @return {?}
5193 */
5194 DefaultKeyValueDiffer.prototype._addToRemovals = function (record) {
5195 if (this._removalsHead === null) {
5196 this._removalsHead = this._removalsTail = record;
5197 }
5198 else {
5199 this._removalsTail._nextRemoved = record;
5200 record._prevRemoved = this._removalsTail;
5201 this._removalsTail = record;
5202 }
5203 };
5204 /**
5205 * \@internal
5206 * @param {?} prev
5207 * @param {?} record
5208 * @return {?}
5209 */
5210 DefaultKeyValueDiffer.prototype._removeFromSeq = function (prev, record) {
5211 var /** @type {?} */ next = record._next;
5212 if (prev === null) {
5213 this._mapHead = next;
5214 }
5215 else {
5216 prev._next = next;
5217 }
5218 record._next = null;
5219 };
5220 /**
5221 * \@internal
5222 * @param {?} record
5223 * @return {?}
5224 */
5225 DefaultKeyValueDiffer.prototype._removeFromRemovals = function (record) {
5226 var /** @type {?} */ prev = record._prevRemoved;
5227 var /** @type {?} */ next = record._nextRemoved;
5228 if (prev === null) {
5229 this._removalsHead = next;
5230 }
5231 else {
5232 prev._nextRemoved = next;
5233 }
5234 if (next === null) {
5235 this._removalsTail = prev;
5236 }
5237 else {
5238 next._prevRemoved = prev;
5239 }
5240 record._prevRemoved = record._nextRemoved = null;
5241 };
5242 /**
5243 * \@internal
5244 * @param {?} record
5245 * @return {?}
5246 */
5247 DefaultKeyValueDiffer.prototype._addToAdditions = function (record) {
5248 if (this._additionsHead === null) {
5249 this._additionsHead = this._additionsTail = record;
5250 }
5251 else {
5252 this._additionsTail._nextAdded = record;
5253 this._additionsTail = record;
5254 }
5255 };
5256 /**
5257 * \@internal
5258 * @param {?} record
5259 * @return {?}
5260 */
5261 DefaultKeyValueDiffer.prototype._addToChanges = function (record) {
5262 if (this._changesHead === null) {
5263 this._changesHead = this._changesTail = record;
5264 }
5265 else {
5266 this._changesTail._nextChanged = record;
5267 this._changesTail = record;
5268 }
5269 };
5270 /**
5271 * @return {?}
5272 */
5273 DefaultKeyValueDiffer.prototype.toString = function () {
5274 var /** @type {?} */ items = [];
5275 var /** @type {?} */ previous = [];
5276 var /** @type {?} */ changes = [];
5277 var /** @type {?} */ additions = [];
5278 var /** @type {?} */ removals = [];
5279 var /** @type {?} */ record;
5280 for (record = this._mapHead; record !== null; record = record._next) {
5281 items.push(stringify(record));
5282 }
5283 for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
5284 previous.push(stringify(record));
5285 }
5286 for (record = this._changesHead; record !== null; record = record._nextChanged) {
5287 changes.push(stringify(record));
5288 }
5289 for (record = this._additionsHead; record !== null; record = record._nextAdded) {
5290 additions.push(stringify(record));
5291 }
5292 for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
5293 removals.push(stringify(record));
5294 }
5295 return 'map: ' + items.join(', ') + '\n' +
5296 'previous: ' + previous.join(', ') + '\n' +
5297 'additions: ' + additions.join(', ') + '\n' +
5298 'changes: ' + changes.join(', ') + '\n' +
5299 'removals: ' + removals.join(', ') + '\n';
5300 };
5301 /**
5302 * \@internal
5303 * @param {?} obj
5304 * @param {?} fn
5305 * @return {?}
5306 */
5307 DefaultKeyValueDiffer.prototype._forEach = function (obj, fn) {
5308 if (obj instanceof Map) {
5309 obj.forEach(fn);
5310 }
5311 else {
5312 Object.keys(obj).forEach(function (k) { return fn(obj[k], k); });
5313 }
5314 };
5315 return DefaultKeyValueDiffer;
5316 }());
5317 /**
5318 * \@stable
5319 */
5320 var KeyValueChangeRecord = (function () {
5321 /**
5322 * @param {?} key
5323 */
5324 function KeyValueChangeRecord(key) {
5325 this.key = key;
5326 this.previousValue = null;
5327 this.currentValue = null;
5328 /** @internal */
5329 this._nextPrevious = null;
5330 /** @internal */
5331 this._next = null;
5332 /** @internal */
5333 this._nextAdded = null;
5334 /** @internal */
5335 this._nextRemoved = null;
5336 /** @internal */
5337 this._prevRemoved = null;
5338 /** @internal */
5339 this._nextChanged = null;
5340 }
5341 /**
5342 * @return {?}
5343 */
5344 KeyValueChangeRecord.prototype.toString = function () {
5345 return looseIdentical(this.previousValue, this.currentValue) ?
5346 stringify(this.key) :
5347 (stringify(this.key) + '[' + stringify(this.previousValue) + '->' +
5348 stringify(this.currentValue) + ']');
5349 };
5350 return KeyValueChangeRecord;
5351 }());
5352
5353 /**
5354 * A repository of different iterable diffing strategies used by NgFor, NgClass, and others.
5355 * \@stable
5356 */
5357 var IterableDiffers = (function () {
5358 /**
5359 * @param {?} factories
5360 */
5361 function IterableDiffers(factories) {
5362 this.factories = factories;
5363 }
5364 /**
5365 * @param {?} factories
5366 * @param {?=} parent
5367 * @return {?}
5368 */
5369 IterableDiffers.create = function (factories, parent) {
5370 if (isPresent(parent)) {
5371 var /** @type {?} */ copied = parent.factories.slice();
5372 factories = factories.concat(copied);
5373 return new IterableDiffers(factories);
5374 }
5375 else {
5376 return new IterableDiffers(factories);
5377 }
5378 };
5379 /**
5380 * Takes an array of {\@link IterableDifferFactory} and returns a provider used to extend the
5381 * inherited {\@link IterableDiffers} instance with the provided factories and return a new
5382 * {\@link IterableDiffers} instance.
5383 *
5384 * The following example shows how to extend an existing list of factories,
5385 * which will only be applied to the injector for this component and its children.
5386 * This step is all that's required to make a new {\@link IterableDiffer} available.
5387 *
5388 * ### Example
5389 *
5390 * ```
5391 * \@Component({
5392 * viewProviders: [
5393 * IterableDiffers.extend([new ImmutableListDiffer()])
5394 * ]
5395 * })
5396 * ```
5397 * @param {?} factories
5398 * @return {?}
5399 */
5400 IterableDiffers.extend = function (factories) {
5401 return {
5402 provide: IterableDiffers,
5403 useFactory: function (parent) {
5404 if (!parent) {
5405 // Typically would occur when calling IterableDiffers.extend inside of dependencies passed
5406 // to
5407 // bootstrap(), which would override default pipes instead of extending them.
5408 throw new Error('Cannot extend IterableDiffers without a parent injector');
5409 }
5410 return IterableDiffers.create(factories, parent);
5411 },
5412 // Dependency technically isn't optional, but we can provide a better error message this way.
5413 deps: [[IterableDiffers, new SkipSelf(), new Optional()]]
5414 };
5415 };
5416 /**
5417 * @param {?} iterable
5418 * @return {?}
5419 */
5420 IterableDiffers.prototype.find = function (iterable) {
5421 var /** @type {?} */ factory = this.factories.find(function (f) { return f.supports(iterable); });
5422 if (isPresent(factory)) {
5423 return factory;
5424 }
5425 else {
5426 throw new Error("Cannot find a differ supporting object '" + iterable + "' of type '" + getTypeNameForDebugging(iterable) + "'");
5427 }
5428 };
5429 return IterableDiffers;
5430 }());
5431
5432 /**
5433 * A repository of different Map diffing strategies used by NgClass, NgStyle, and others.
5434 * \@stable
5435 */
5436 var KeyValueDiffers = (function () {
5437 /**
5438 * @param {?} factories
5439 */
5440 function KeyValueDiffers(factories) {
5441 this.factories = factories;
5442 }
5443 /**
5444 * @param {?} factories
5445 * @param {?=} parent
5446 * @return {?}
5447 */
5448 KeyValueDiffers.create = function (factories, parent) {
5449 if (isPresent(parent)) {
5450 var /** @type {?} */ copied = parent.factories.slice();
5451 factories = factories.concat(copied);
5452 return new KeyValueDiffers(factories);
5453 }
5454 else {
5455 return new KeyValueDiffers(factories);
5456 }
5457 };
5458 /**
5459 * Takes an array of {\@link KeyValueDifferFactory} and returns a provider used to extend the
5460 * inherited {\@link KeyValueDiffers} instance with the provided factories and return a new
5461 * {\@link KeyValueDiffers} instance.
5462 *
5463 * The following example shows how to extend an existing list of factories,
5464 * which will only be applied to the injector for this component and its children.
5465 * This step is all that's required to make a new {\@link KeyValueDiffer} available.
5466 *
5467 * ### Example
5468 *
5469 * ```
5470 * \@Component({
5471 * viewProviders: [
5472 * KeyValueDiffers.extend([new ImmutableMapDiffer()])
5473 * ]
5474 * })
5475 * ```
5476 * @param {?} factories
5477 * @return {?}
5478 */
5479 KeyValueDiffers.extend = function (factories) {
5480 return {
5481 provide: KeyValueDiffers,
5482 useFactory: function (parent) {
5483 if (!parent) {
5484 // Typically would occur when calling KeyValueDiffers.extend inside of dependencies passed
5485 // to
5486 // bootstrap(), which would override default pipes instead of extending them.
5487 throw new Error('Cannot extend KeyValueDiffers without a parent injector');
5488 }
5489 return KeyValueDiffers.create(factories, parent);
5490 },
5491 // Dependency technically isn't optional, but we can provide a better error message this way.
5492 deps: [[KeyValueDiffers, new SkipSelf(), new Optional()]]
5493 };
5494 };
5495 /**
5496 * @param {?} kv
5497 * @return {?}
5498 */
5499 KeyValueDiffers.prototype.find = function (kv) {
5500 var /** @type {?} */ factory = this.factories.find(function (f) { return f.supports(kv); });
5501 if (isPresent(factory)) {
5502 return factory;
5503 }
5504 else {
5505 throw new Error("Cannot find a differ supporting object '" + kv + "'");
5506 }
5507 };
5508 return KeyValueDiffers;
5509 }());
5510
5511 var /** @type {?} */ UNINITIALIZED = {
5512 toString: function () { return 'CD_INIT_VALUE'; }
5513 };
5514 /**
5515 * @param {?} a
5516 * @param {?} b
5517 * @return {?}
5518 */
5519 function devModeEqual(a, b) {
5520 if (isListLikeIterable(a) && isListLikeIterable(b)) {
5521 return areIterablesEqual(a, b, devModeEqual);
5522 }
5523 else if (!isListLikeIterable(a) && !isPrimitive(a) && !isListLikeIterable(b) && !isPrimitive(b)) {
5524 return true;
5525 }
5526 else {
5527 return looseIdentical(a, b);
5528 }
5529 }
5530 /**
5531 * Indicates that the result of a {\@link Pipe} transformation has changed even though the
5532 * reference
5533 * has not changed.
5534 *
5535 * The wrapped value will be unwrapped by change detection, and the unwrapped value will be stored.
5536 *
5537 * Example:
5538 *
5539 * ```
5540 * if (this._latestValue === this._latestReturnedValue) {
5541 * return this._latestReturnedValue;
5542 * } else {
5543 * this._latestReturnedValue = this._latestValue;
5544 * return WrappedValue.wrap(this._latestValue); // this will force update
5545 * }
5546 * ```
5547 * \@stable
5548 */
5549 var WrappedValue = (function () {
5550 /**
5551 * @param {?} wrapped
5552 */
5553 function WrappedValue(wrapped) {
5554 this.wrapped = wrapped;
5555 }
5556 /**
5557 * @param {?} value
5558 * @return {?}
5559 */
5560 WrappedValue.wrap = function (value) { return new WrappedValue(value); };
5561 return WrappedValue;
5562 }());
5563 /**
5564 * Helper class for unwrapping WrappedValue s
5565 */
5566 var ValueUnwrapper = (function () {
5567 function ValueUnwrapper() {
5568 this.hasWrappedValue = false;
5569 }
5570 /**
5571 * @param {?} value
5572 * @return {?}
5573 */
5574 ValueUnwrapper.prototype.unwrap = function (value) {
5575 if (value instanceof WrappedValue) {
5576 this.hasWrappedValue = true;
5577 return value.wrapped;
5578 }
5579 return value;
5580 };
5581 /**
5582 * @return {?}
5583 */
5584 ValueUnwrapper.prototype.reset = function () { this.hasWrappedValue = false; };
5585 return ValueUnwrapper;
5586 }());
5587 /**
5588 * Represents a basic change from a previous to a new value.
5589 * \@stable
5590 */
5591 var SimpleChange = (function () {
5592 /**
5593 * @param {?} previousValue
5594 * @param {?} currentValue
5595 */
5596 function SimpleChange(previousValue, currentValue) {
5597 this.previousValue = previousValue;
5598 this.currentValue = currentValue;
5599 }
5600 /**
5601 * Check whether the new value is the first value assigned.
5602 * @return {?}
5603 */
5604 SimpleChange.prototype.isFirstChange = function () { return this.previousValue === UNINITIALIZED; };
5605 return SimpleChange;
5606 }());
5607
5608 /**
5609 * \@stable
5610 * @abstract
5611 */
5612 var ChangeDetectorRef = (function () {
5613 function ChangeDetectorRef() {
5614 }
5615 /**
5616 * Marks all {\@link ChangeDetectionStrategy#OnPush} ancestors as to be checked.
5617 *
5618 * <!-- TODO: Add a link to a chapter on OnPush components -->
5619 *
5620 * ### Example ([live demo](http://plnkr.co/edit/GC512b?p=preview))
5621 *
5622 * ```typescript
5623 * \@Component({
5624 * selector: 'cmp',
5625 * changeDetection: ChangeDetectionStrategy.OnPush,
5626 * template: `Number of ticks: {{numberOfTicks}}`
5627 * })
5628 * class Cmp {
5629 * numberOfTicks = 0;
5630 *
5631 * constructor(ref: ChangeDetectorRef) {
5632 * setInterval(() => {
5633 * this.numberOfTicks ++
5634 * // the following is required, otherwise the view will not be updated
5635 * this.ref.markForCheck();
5636 * }, 1000);
5637 * }
5638 * }
5639 *
5640 * \@Component({
5641 * selector: 'app',
5642 * changeDetection: ChangeDetectionStrategy.OnPush,
5643 * template: `
5644 * <cmp><cmp>
5645 * `,
5646 * })
5647 * class App {
5648 * }
5649 * ```
5650 * @abstract
5651 * @return {?}
5652 */
5653 ChangeDetectorRef.prototype.markForCheck = function () { };
5654 /**
5655 * Detaches the change detector from the change detector tree.
5656 *
5657 * The detached change detector will not be checked until it is reattached.
5658 *
5659 * This can also be used in combination with {\@link ChangeDetectorRef#detectChanges} to implement
5660 * local change
5661 * detection checks.
5662 *
5663 * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
5664 * <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
5665 *
5666 * ### Example
5667 *
5668 * The following example defines a component with a large list of readonly data.
5669 * Imagine the data changes constantly, many times per second. For performance reasons,
5670 * we want to check and update the list every five seconds. We can do that by detaching
5671 * the component's change detector and doing a local check every five seconds.
5672 *
5673 * ```typescript
5674 * class DataProvider {
5675 * // in a real application the returned data will be different every time
5676 * get data() {
5677 * return [1,2,3,4,5];
5678 * }
5679 * }
5680 *
5681 * \@Component({
5682 * selector: 'giant-list',
5683 * template: `
5684 * <li *ngFor="let d of dataProvider.data">Data {{d}}</lig>
5685 * `,
5686 * })
5687 * class GiantList {
5688 * constructor(private ref: ChangeDetectorRef, private dataProvider:DataProvider) {
5689 * ref.detach();
5690 * setInterval(() => {
5691 * this.ref.detectChanges();
5692 * }, 5000);
5693 * }
5694 * }
5695 *
5696 * \@Component({
5697 * selector: 'app',
5698 * providers: [DataProvider],
5699 * template: `
5700 * <giant-list><giant-list>
5701 * `,
5702 * })
5703 * class App {
5704 * }
5705 * ```
5706 * @abstract
5707 * @return {?}
5708 */
5709 ChangeDetectorRef.prototype.detach = function () { };
5710 /**
5711 * Checks the change detector and its children.
5712 *
5713 * This can also be used in combination with {\@link ChangeDetectorRef#detach} to implement local
5714 * change detection
5715 * checks.
5716 *
5717 * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
5718 * <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
5719 *
5720 * ### Example
5721 *
5722 * The following example defines a component with a large list of readonly data.
5723 * Imagine, the data changes constantly, many times per second. For performance reasons,
5724 * we want to check and update the list every five seconds.
5725 *
5726 * We can do that by detaching the component's change detector and doing a local change detection
5727 * check
5728 * every five seconds.
5729 *
5730 * See {\@link ChangeDetectorRef#detach} for more information.
5731 * @abstract
5732 * @return {?}
5733 */
5734 ChangeDetectorRef.prototype.detectChanges = function () { };
5735 /**
5736 * Checks the change detector and its children, and throws if any changes are detected.
5737 *
5738 * This is used in development mode to verify that running change detection doesn't introduce
5739 * other changes.
5740 * @abstract
5741 * @return {?}
5742 */
5743 ChangeDetectorRef.prototype.checkNoChanges = function () { };
5744 /**
5745 * Reattach the change detector to the change detector tree.
5746 *
5747 * This also marks OnPush ancestors as to be checked. This reattached change detector will be
5748 * checked during the next change detection run.
5749 *
5750 * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
5751 *
5752 * ### Example ([live demo](http://plnkr.co/edit/aUhZha?p=preview))
5753 *
5754 * The following example creates a component displaying `live` data. The component will detach
5755 * its change detector from the main change detector tree when the component's live property
5756 * is set to false.
5757 *
5758 * ```typescript
5759 * class DataProvider {
5760 * data = 1;
5761 *
5762 * constructor() {
5763 * setInterval(() => {
5764 * this.data = this.data * 2;
5765 * }, 500);
5766 * }
5767 * }
5768 *
5769 * \@Component({
5770 * selector: 'live-data',
5771 * inputs: ['live'],
5772 * template: 'Data: {{dataProvider.data}}'
5773 * })
5774 * class LiveData {
5775 * constructor(private ref: ChangeDetectorRef, private dataProvider:DataProvider) {}
5776 *
5777 * set live(value) {
5778 * if (value)
5779 * this.ref.reattach();
5780 * else
5781 * this.ref.detach();
5782 * }
5783 * }
5784 *
5785 * \@Component({
5786 * selector: 'app',
5787 * providers: [DataProvider],
5788 * template: `
5789 * Live Update: <input type="checkbox" [(ngModel)]="live">
5790 * <live-data [live]="live"><live-data>
5791 * `,
5792 * })
5793 * class App {
5794 * live = true;
5795 * }
5796 * ```
5797 * @abstract
5798 * @return {?}
5799 */
5800 ChangeDetectorRef.prototype.reattach = function () { };
5801 return ChangeDetectorRef;
5802 }());
5803
5804 /**
5805 * Structural diffing for `Object`s and `Map`s.
5806 */
5807 var /** @type {?} */ keyValDiff = [new DefaultKeyValueDifferFactory()];
5808 /**
5809 * Structural diffing for `Iterable` types such as `Array`s.
5810 */
5811 var /** @type {?} */ iterableDiff = [new DefaultIterableDifferFactory()];
5812 var /** @type {?} */ defaultIterableDiffers = new IterableDiffers(iterableDiff);
5813 var /** @type {?} */ defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
5814
5815 /**
5816 * @license
5817 * Copyright Google Inc. All Rights Reserved.
5818 *
5819 * Use of this source code is governed by an MIT-style license that can be
5820 * found in the LICENSE file at https://angular.io/license
5821 */
5822 var RenderComponentType = (function () {
5823 /**
5824 * @param {?} id
5825 * @param {?} templateUrl
5826 * @param {?} slotCount
5827 * @param {?} encapsulation
5828 * @param {?} styles
5829 * @param {?} animations
5830 */
5831 function RenderComponentType(id, templateUrl, slotCount, encapsulation, styles, animations) {
5832 this.id = id;
5833 this.templateUrl = templateUrl;
5834 this.slotCount = slotCount;
5835 this.encapsulation = encapsulation;
5836 this.styles = styles;
5837 this.animations = animations;
5838 }
5839 return RenderComponentType;
5840 }());
5841 /**
5842 * @abstract
5843 */
5844 var RenderDebugInfo = (function () {
5845 function RenderDebugInfo() {
5846 }
5847 /**
5848 * @abstract
5849 * @return {?}
5850 */
5851 RenderDebugInfo.prototype.injector = function () { };
5852 /**
5853 * @abstract
5854 * @return {?}
5855 */
5856 RenderDebugInfo.prototype.component = function () { };
5857 /**
5858 * @abstract
5859 * @return {?}
5860 */
5861 RenderDebugInfo.prototype.providerTokens = function () { };
5862 /**
5863 * @abstract
5864 * @return {?}
5865 */
5866 RenderDebugInfo.prototype.references = function () { };
5867 /**
5868 * @abstract
5869 * @return {?}
5870 */
5871 RenderDebugInfo.prototype.context = function () { };
5872 /**
5873 * @abstract
5874 * @return {?}
5875 */
5876 RenderDebugInfo.prototype.source = function () { };
5877 return RenderDebugInfo;
5878 }());
5879 /**
5880 * \@experimental
5881 * @abstract
5882 */
5883 var Renderer = (function () {
5884 function Renderer() {
5885 }
5886 /**
5887 * @abstract
5888 * @param {?} selectorOrNode
5889 * @param {?=} debugInfo
5890 * @return {?}
5891 */
5892 Renderer.prototype.selectRootElement = function (selectorOrNode, debugInfo) { };
5893 /**
5894 * @abstract
5895 * @param {?} parentElement
5896 * @param {?} name
5897 * @param {?=} debugInfo
5898 * @return {?}
5899 */
5900 Renderer.prototype.createElement = function (parentElement, name, debugInfo) { };
5901 /**
5902 * @abstract
5903 * @param {?} hostElement
5904 * @return {?}
5905 */
5906 Renderer.prototype.createViewRoot = function (hostElement) { };
5907 /**
5908 * @abstract
5909 * @param {?} parentElement
5910 * @param {?=} debugInfo
5911 * @return {?}
5912 */
5913 Renderer.prototype.createTemplateAnchor = function (parentElement, debugInfo) { };
5914 /**
5915 * @abstract
5916 * @param {?} parentElement
5917 * @param {?} value
5918 * @param {?=} debugInfo
5919 * @return {?}
5920 */
5921 Renderer.prototype.createText = function (parentElement, value, debugInfo) { };
5922 /**
5923 * @abstract
5924 * @param {?} parentElement
5925 * @param {?} nodes
5926 * @return {?}
5927 */
5928 Renderer.prototype.projectNodes = function (parentElement, nodes) { };
5929 /**
5930 * @abstract
5931 * @param {?} node
5932 * @param {?} viewRootNodes
5933 * @return {?}
5934 */
5935 Renderer.prototype.attachViewAfter = function (node, viewRootNodes) { };
5936 /**
5937 * @abstract
5938 * @param {?} viewRootNodes
5939 * @return {?}
5940 */
5941 Renderer.prototype.detachView = function (viewRootNodes) { };
5942 /**
5943 * @abstract
5944 * @param {?} hostElement
5945 * @param {?} viewAllNodes
5946 * @return {?}
5947 */
5948 Renderer.prototype.destroyView = function (hostElement, viewAllNodes) { };
5949 /**
5950 * @abstract
5951 * @param {?} renderElement
5952 * @param {?} name
5953 * @param {?} callback
5954 * @return {?}
5955 */
5956 Renderer.prototype.listen = function (renderElement, name, callback) { };
5957 /**
5958 * @abstract
5959 * @param {?} target
5960 * @param {?} name
5961 * @param {?} callback
5962 * @return {?}
5963 */
5964 Renderer.prototype.listenGlobal = function (target, name, callback) { };
5965 /**
5966 * @abstract
5967 * @param {?} renderElement
5968 * @param {?} propertyName
5969 * @param {?} propertyValue
5970 * @return {?}
5971 */
5972 Renderer.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) { };
5973 /**
5974 * @abstract
5975 * @param {?} renderElement
5976 * @param {?} attributeName
5977 * @param {?} attributeValue
5978 * @return {?}
5979 */
5980 Renderer.prototype.setElementAttribute = function (renderElement, attributeName, attributeValue) { };
5981 /**
5982 * Used only in debug mode to serialize property changes to dom nodes as attributes.
5983 * @abstract
5984 * @param {?} renderElement
5985 * @param {?} propertyName
5986 * @param {?} propertyValue
5987 * @return {?}
5988 */
5989 Renderer.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) { };
5990 /**
5991 * @abstract
5992 * @param {?} renderElement
5993 * @param {?} className
5994 * @param {?} isAdd
5995 * @return {?}
5996 */
5997 Renderer.prototype.setElementClass = function (renderElement, className, isAdd) { };
5998 /**
5999 * @abstract
6000 * @param {?} renderElement
6001 * @param {?} styleName
6002 * @param {?} styleValue
6003 * @return {?}
6004 */
6005 Renderer.prototype.setElementStyle = function (renderElement, styleName, styleValue) { };
6006 /**
6007 * @abstract
6008 * @param {?} renderElement
6009 * @param {?} methodName
6010 * @param {?=} args
6011 * @return {?}
6012 */
6013 Renderer.prototype.invokeElementMethod = function (renderElement, methodName, args) { };
6014 /**
6015 * @abstract
6016 * @param {?} renderNode
6017 * @param {?} text
6018 * @return {?}
6019 */
6020 Renderer.prototype.setText = function (renderNode, text) { };
6021 /**
6022 * @abstract
6023 * @param {?} element
6024 * @param {?} startingStyles
6025 * @param {?} keyframes
6026 * @param {?} duration
6027 * @param {?} delay
6028 * @param {?} easing
6029 * @param {?=} previousPlayers
6030 * @return {?}
6031 */
6032 Renderer.prototype.animate = function (element, startingStyles, keyframes, duration, delay, easing, previousPlayers) { };
6033 return Renderer;
6034 }());
6035 /**
6036 * Injectable service that provides a low-level interface for modifying the UI.
6037 *
6038 * Use this service to bypass Angular's templating and make custom UI changes that can't be
6039 * expressed declaratively. For example if you need to set a property or an attribute whose name is
6040 * not statically known, use {\@link #setElementProperty} or {\@link #setElementAttribute}
6041 * respectively.
6042 *
6043 * If you are implementing a custom renderer, you must implement this interface.
6044 *
6045 * The default Renderer implementation is `DomRenderer`. Also available is `WebWorkerRenderer`.
6046 * \@experimental
6047 * @abstract
6048 */
6049 var RootRenderer = (function () {
6050 function RootRenderer() {
6051 }
6052 /**
6053 * @abstract
6054 * @param {?} componentType
6055 * @return {?}
6056 */
6057 RootRenderer.prototype.renderComponent = function (componentType) { };
6058 return RootRenderer;
6059 }());
6060
6061 var SecurityContext = {};
6062 SecurityContext.NONE = 0;
6063 SecurityContext.HTML = 1;
6064 SecurityContext.STYLE = 2;
6065 SecurityContext.SCRIPT = 3;
6066 SecurityContext.URL = 4;
6067 SecurityContext.RESOURCE_URL = 5;
6068 SecurityContext[SecurityContext.NONE] = "NONE";
6069 SecurityContext[SecurityContext.HTML] = "HTML";
6070 SecurityContext[SecurityContext.STYLE] = "STYLE";
6071 SecurityContext[SecurityContext.SCRIPT] = "SCRIPT";
6072 SecurityContext[SecurityContext.URL] = "URL";
6073 SecurityContext[SecurityContext.RESOURCE_URL] = "RESOURCE_URL";
6074 /**
6075 * Sanitizer is used by the views to sanitize potentially dangerous values.
6076 *
6077 * \@stable
6078 * @abstract
6079 */
6080 var Sanitizer = (function () {
6081 function Sanitizer() {
6082 }
6083 /**
6084 * @abstract
6085 * @param {?} context
6086 * @param {?} value
6087 * @return {?}
6088 */
6089 Sanitizer.prototype.sanitize = function (context, value) { };
6090 return Sanitizer;
6091 }());
6092
6093 /**
6094 * @license
6095 * Copyright Google Inc. All Rights Reserved.
6096 *
6097 * Use of this source code is governed by an MIT-style license that can be
6098 * found in the LICENSE file at https://angular.io/license
6099 */
6100 var __extends$7 = (this && this.__extends) || function (d, b) {
6101 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
6102 function __() { this.constructor = d; }
6103 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
6104 };
6105 /**
6106 * An error thrown if application changes model breaking the top-down data flow.
6107 *
6108 * This exception is only thrown in dev mode.
6109 *
6110 * <!-- TODO: Add a link once the dev mode option is configurable -->
6111 *
6112 * ### Example
6113 *
6114 * ```typescript
6115 * \@Component({
6116 * selector: 'parent',
6117 * template: '<child [prop]="parentProp"></child>',
6118 * })
6119 * class Parent {
6120 * parentProp = 'init';
6121 * }
6122 *
6123 * \@Directive({selector: 'child', inputs: ['prop']})
6124 * class Child {
6125 * constructor(public parent: Parent) {}
6126 *
6127 * set prop(v) {
6128 * // this updates the parent property, which is disallowed during change detection
6129 * // this will result in ExpressionChangedAfterItHasBeenCheckedError
6130 * this.parent.parentProp = 'updated';
6131 * }
6132 * }
6133 * ```
6134 * \@stable
6135 */
6136 var ExpressionChangedAfterItHasBeenCheckedError = (function (_super) {
6137 __extends$7(ExpressionChangedAfterItHasBeenCheckedError, _super);
6138 /**
6139 * @param {?} oldValue
6140 * @param {?} currValue
6141 */
6142 function ExpressionChangedAfterItHasBeenCheckedError(oldValue, currValue) {
6143 var msg = "Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
6144 if (oldValue === UNINITIALIZED) {
6145 msg +=
6146 " It seems like the view has been created after its parent and its children have been dirty checked." +
6147 " Has it been created in a change detection hook ?";
6148 }
6149 _super.call(this, msg);
6150 }
6151 return ExpressionChangedAfterItHasBeenCheckedError;
6152 }(BaseError));
6153 /**
6154 * Thrown when an exception was raised during view creation, change detection or destruction.
6155 *
6156 * This error wraps the original exception to attach additional contextual information that can
6157 * be useful for debugging.
6158 * \@stable
6159 */
6160 var ViewWrappedError = (function (_super) {
6161 __extends$7(ViewWrappedError, _super);
6162 /**
6163 * @param {?} originalError
6164 * @param {?} context
6165 */
6166 function ViewWrappedError(originalError, context) {
6167 _super.call(this, "Error in " + context.source, originalError);
6168 this.context = context;
6169 }
6170 return ViewWrappedError;
6171 }(WrappedError));
6172 /**
6173 * Thrown when a destroyed view is used.
6174 *
6175 * This error indicates a bug in the framework.
6176 *
6177 * This is an internal Angular error.
6178 * \@stable
6179 */
6180 var ViewDestroyedError = (function (_super) {
6181 __extends$7(ViewDestroyedError, _super);
6182 /**
6183 * @param {?} details
6184 */
6185 function ViewDestroyedError(details) {
6186 _super.call(this, "Attempt to use a destroyed view: " + details);
6187 }
6188 return ViewDestroyedError;
6189 }(BaseError));
6190
6191 var ViewUtils = (function () {
6192 /**
6193 * @param {?} _renderer
6194 * @param {?} sanitizer
6195 * @param {?} animationQueue
6196 */
6197 function ViewUtils(_renderer, sanitizer, animationQueue) {
6198 this._renderer = _renderer;
6199 this.animationQueue = animationQueue;
6200 this.sanitizer = sanitizer;
6201 }
6202 /**
6203 * \@internal
6204 * @param {?} renderComponentType
6205 * @return {?}
6206 */
6207 ViewUtils.prototype.renderComponent = function (renderComponentType) {
6208 return this._renderer.renderComponent(renderComponentType);
6209 };
6210 ViewUtils.decorators = [
6211 { type: Injectable },
6212 ];
6213 /** @nocollapse */
6214 ViewUtils.ctorParameters = function () { return [
6215 { type: RootRenderer, },
6216 { type: Sanitizer, },
6217 { type: AnimationQueue, },
6218 ]; };
6219 return ViewUtils;
6220 }());
6221 var /** @type {?} */ nextRenderComponentTypeId = 0;
6222 /**
6223 * @param {?} templateUrl
6224 * @param {?} slotCount
6225 * @param {?} encapsulation
6226 * @param {?} styles
6227 * @param {?} animations
6228 * @return {?}
6229 */
6230 function createRenderComponentType(templateUrl, slotCount, encapsulation, styles, animations) {
6231 return new RenderComponentType("" + nextRenderComponentTypeId++, templateUrl, slotCount, encapsulation, styles, animations);
6232 }
6233 /**
6234 * @param {?} e
6235 * @param {?} array
6236 * @return {?}
6237 */
6238 function addToArray(e, array) {
6239 array.push(e);
6240 }
6241 /**
6242 * @param {?} valueCount
6243 * @param {?} constAndInterp
6244 * @return {?}
6245 */
6246 function interpolate(valueCount, constAndInterp) {
6247 var /** @type {?} */ result = '';
6248 for (var /** @type {?} */ i = 0; i < valueCount * 2; i = i + 2) {
6249 result = result + constAndInterp[i] + _toStringWithNull(constAndInterp[i + 1]);
6250 }
6251 return result + constAndInterp[valueCount * 2];
6252 }
6253 /**
6254 * @param {?} valueCount
6255 * @param {?} c0
6256 * @param {?} a1
6257 * @param {?} c1
6258 * @param {?=} a2
6259 * @param {?=} c2
6260 * @param {?=} a3
6261 * @param {?=} c3
6262 * @param {?=} a4
6263 * @param {?=} c4
6264 * @param {?=} a5
6265 * @param {?=} c5
6266 * @param {?=} a6
6267 * @param {?=} c6
6268 * @param {?=} a7
6269 * @param {?=} c7
6270 * @param {?=} a8
6271 * @param {?=} c8
6272 * @param {?=} a9
6273 * @param {?=} c9
6274 * @return {?}
6275 */
6276 function inlineInterpolate(valueCount, c0, a1, c1, a2, c2, a3, c3, a4, c4, a5, c5, a6, c6, a7, c7, a8, c8, a9, c9) {
6277 switch (valueCount) {
6278 case 1:
6279 return c0 + _toStringWithNull(a1) + c1;
6280 case 2:
6281 return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2;
6282 case 3:
6283 return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
6284 c3;
6285 case 4:
6286 return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
6287 c3 + _toStringWithNull(a4) + c4;
6288 case 5:
6289 return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
6290 c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5;
6291 case 6:
6292 return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
6293 c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6;
6294 case 7:
6295 return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
6296 c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
6297 c6 + _toStringWithNull(a7) + c7;
6298 case 8:
6299 return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
6300 c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
6301 c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8;
6302 case 9:
6303 return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
6304 c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
6305 c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) + c9;
6306 default:
6307 throw new Error("Does not support more than 9 expressions");
6308 }
6309 }
6310 /**
6311 * @param {?} v
6312 * @return {?}
6313 */
6314 function _toStringWithNull(v) {
6315 return v != null ? v.toString() : '';
6316 }
6317 /**
6318 * @param {?} throwOnChange
6319 * @param {?} oldValue
6320 * @param {?} newValue
6321 * @return {?}
6322 */
6323 function checkBinding(throwOnChange, oldValue, newValue) {
6324 if (throwOnChange) {
6325 if (!devModeEqual(oldValue, newValue)) {
6326 throw new ExpressionChangedAfterItHasBeenCheckedError(oldValue, newValue);
6327 }
6328 return false;
6329 }
6330 else {
6331 return !looseIdentical(oldValue, newValue);
6332 }
6333 }
6334 /**
6335 * @param {?} input
6336 * @param {?} value
6337 * @return {?}
6338 */
6339 function castByValue(input, value) {
6340 return (input);
6341 }
6342 var /** @type {?} */ EMPTY_ARRAY = [];
6343 var /** @type {?} */ EMPTY_MAP = {};
6344 /**
6345 * @param {?} fn
6346 * @return {?}
6347 */
6348 function pureProxy1(fn) {
6349 var /** @type {?} */ result;
6350 var /** @type {?} */ v0 = UNINITIALIZED;
6351 return function (p0) {
6352 if (!looseIdentical(v0, p0)) {
6353 v0 = p0;
6354 result = fn(p0);
6355 }
6356 return result;
6357 };
6358 }
6359 /**
6360 * @param {?} fn
6361 * @return {?}
6362 */
6363 function pureProxy2(fn) {
6364 var /** @type {?} */ result;
6365 var /** @type {?} */ v0 = UNINITIALIZED;
6366 var /** @type {?} */ v1 = UNINITIALIZED;
6367 return function (p0, p1) {
6368 if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1)) {
6369 v0 = p0;
6370 v1 = p1;
6371 result = fn(p0, p1);
6372 }
6373 return result;
6374 };
6375 }
6376 /**
6377 * @param {?} fn
6378 * @return {?}
6379 */
6380 function pureProxy3(fn) {
6381 var /** @type {?} */ result;
6382 var /** @type {?} */ v0 = UNINITIALIZED;
6383 var /** @type {?} */ v1 = UNINITIALIZED;
6384 var /** @type {?} */ v2 = UNINITIALIZED;
6385 return function (p0, p1, p2) {
6386 if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2)) {
6387 v0 = p0;
6388 v1 = p1;
6389 v2 = p2;
6390 result = fn(p0, p1, p2);
6391 }
6392 return result;
6393 };
6394 }
6395 /**
6396 * @param {?} fn
6397 * @return {?}
6398 */
6399 function pureProxy4(fn) {
6400 var /** @type {?} */ result;
6401 var /** @type {?} */ v0, /** @type {?} */ v1, /** @type {?} */ v2, /** @type {?} */ v3;
6402 v0 = v1 = v2 = v3 = UNINITIALIZED;
6403 return function (p0, p1, p2, p3) {
6404 if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
6405 !looseIdentical(v3, p3)) {
6406 v0 = p0;
6407 v1 = p1;
6408 v2 = p2;
6409 v3 = p3;
6410 result = fn(p0, p1, p2, p3);
6411 }
6412 return result;
6413 };
6414 }
6415 /**
6416 * @param {?} fn
6417 * @return {?}
6418 */
6419 function pureProxy5(fn) {
6420 var /** @type {?} */ result;
6421 var /** @type {?} */ v0, /** @type {?} */ v1, /** @type {?} */ v2, /** @type {?} */ v3, /** @type {?} */ v4;
6422 v0 = v1 = v2 = v3 = v4 = UNINITIALIZED;
6423 return function (p0, p1, p2, p3, p4) {
6424 if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
6425 !looseIdentical(v3, p3) || !looseIdentical(v4, p4)) {
6426 v0 = p0;
6427 v1 = p1;
6428 v2 = p2;
6429 v3 = p3;
6430 v4 = p4;
6431 result = fn(p0, p1, p2, p3, p4);
6432 }
6433 return result;
6434 };
6435 }
6436 /**
6437 * @param {?} fn
6438 * @return {?}
6439 */
6440 function pureProxy6(fn) {
6441 var /** @type {?} */ result;
6442 var /** @type {?} */ v0, /** @type {?} */ v1, /** @type {?} */ v2, /** @type {?} */ v3, /** @type {?} */ v4, /** @type {?} */ v5;
6443 v0 = v1 = v2 = v3 = v4 = v5 = UNINITIALIZED;
6444 return function (p0, p1, p2, p3, p4, p5) {
6445 if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
6446 !looseIdentical(v3, p3) || !looseIdentical(v4, p4) || !looseIdentical(v5, p5)) {
6447 v0 = p0;
6448 v1 = p1;
6449 v2 = p2;
6450 v3 = p3;
6451 v4 = p4;
6452 v5 = p5;
6453 result = fn(p0, p1, p2, p3, p4, p5);
6454 }
6455 return result;
6456 };
6457 }
6458 /**
6459 * @param {?} fn
6460 * @return {?}
6461 */
6462 function pureProxy7(fn) {
6463 var /** @type {?} */ result;
6464 var /** @type {?} */ v0, /** @type {?} */ v1, /** @type {?} */ v2, /** @type {?} */ v3, /** @type {?} */ v4, /** @type {?} */ v5, /** @type {?} */ v6;
6465 v0 = v1 = v2 = v3 = v4 = v5 = v6 = UNINITIALIZED;
6466 return function (p0, p1, p2, p3, p4, p5, p6) {
6467 if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
6468 !looseIdentical(v3, p3) || !looseIdentical(v4, p4) || !looseIdentical(v5, p5) ||
6469 !looseIdentical(v6, p6)) {
6470 v0 = p0;
6471 v1 = p1;
6472 v2 = p2;
6473 v3 = p3;
6474 v4 = p4;
6475 v5 = p5;
6476 v6 = p6;
6477 result = fn(p0, p1, p2, p3, p4, p5, p6);
6478 }
6479 return result;
6480 };
6481 }
6482 /**
6483 * @param {?} fn
6484 * @return {?}
6485 */
6486 function pureProxy8(fn) {
6487 var /** @type {?} */ result;
6488 var /** @type {?} */ v0, /** @type {?} */ v1, /** @type {?} */ v2, /** @type {?} */ v3, /** @type {?} */ v4, /** @type {?} */ v5, /** @type {?} */ v6, /** @type {?} */ v7;
6489 v0 = v1 = v2 = v3 = v4 = v5 = v6 = v7 = UNINITIALIZED;
6490 return function (p0, p1, p2, p3, p4, p5, p6, p7) {
6491 if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
6492 !looseIdentical(v3, p3) || !looseIdentical(v4, p4) || !looseIdentical(v5, p5) ||
6493 !looseIdentical(v6, p6) || !looseIdentical(v7, p7)) {
6494 v0 = p0;
6495 v1 = p1;
6496 v2 = p2;
6497 v3 = p3;
6498 v4 = p4;
6499 v5 = p5;
6500 v6 = p6;
6501 v7 = p7;
6502 result = fn(p0, p1, p2, p3, p4, p5, p6, p7);
6503 }
6504 return result;
6505 };
6506 }
6507 /**
6508 * @param {?} fn
6509 * @return {?}
6510 */
6511 function pureProxy9(fn) {
6512 var /** @type {?} */ result;
6513 var /** @type {?} */ v0, /** @type {?} */ v1, /** @type {?} */ v2, /** @type {?} */ v3, /** @type {?} */ v4, /** @type {?} */ v5, /** @type {?} */ v6, /** @type {?} */ v7, /** @type {?} */ v8;
6514 v0 = v1 = v2 = v3 = v4 = v5 = v6 = v7 = v8 = UNINITIALIZED;
6515 return function (p0, p1, p2, p3, p4, p5, p6, p7, p8) {
6516 if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
6517 !looseIdentical(v3, p3) || !looseIdentical(v4, p4) || !looseIdentical(v5, p5) ||
6518 !looseIdentical(v6, p6) || !looseIdentical(v7, p7) || !looseIdentical(v8, p8)) {
6519 v0 = p0;
6520 v1 = p1;
6521 v2 = p2;
6522 v3 = p3;
6523 v4 = p4;
6524 v5 = p5;
6525 v6 = p6;
6526 v7 = p7;
6527 v8 = p8;
6528 result = fn(p0, p1, p2, p3, p4, p5, p6, p7, p8);
6529 }
6530 return result;
6531 };
6532 }
6533 /**
6534 * @param {?} fn
6535 * @return {?}
6536 */
6537 function pureProxy10(fn) {
6538 var /** @type {?} */ result;
6539 var /** @type {?} */ v0, /** @type {?} */ v1, /** @type {?} */ v2, /** @type {?} */ v3, /** @type {?} */ v4, /** @type {?} */ v5, /** @type {?} */ v6, /** @type {?} */ v7, /** @type {?} */ v8, /** @type {?} */ v9;
6540 v0 = v1 = v2 = v3 = v4 = v5 = v6 = v7 = v8 = v9 = UNINITIALIZED;
6541 return function (p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) {
6542 if (!looseIdentical(v0, p0) || !looseIdentical(v1, p1) || !looseIdentical(v2, p2) ||
6543 !looseIdentical(v3, p3) || !looseIdentical(v4, p4) || !looseIdentical(v5, p5) ||
6544 !looseIdentical(v6, p6) || !looseIdentical(v7, p7) || !looseIdentical(v8, p8) ||
6545 !looseIdentical(v9, p9)) {
6546 v0 = p0;
6547 v1 = p1;
6548 v2 = p2;
6549 v3 = p3;
6550 v4 = p4;
6551 v5 = p5;
6552 v6 = p6;
6553 v7 = p7;
6554 v8 = p8;
6555 v9 = p9;
6556 result = fn(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9);
6557 }
6558 return result;
6559 };
6560 }
6561 /**
6562 * @param {?} renderer
6563 * @param {?} el
6564 * @param {?} changes
6565 * @return {?}
6566 */
6567 function setBindingDebugInfoForChanges(renderer, el, changes) {
6568 Object.keys(changes).forEach(function (propName) {
6569 setBindingDebugInfo(renderer, el, propName, changes[propName].currentValue);
6570 });
6571 }
6572 /**
6573 * @param {?} renderer
6574 * @param {?} el
6575 * @param {?} propName
6576 * @param {?} value
6577 * @return {?}
6578 */
6579 function setBindingDebugInfo(renderer, el, propName, value) {
6580 try {
6581 renderer.setBindingDebugInfo(el, "ng-reflect-" + camelCaseToDashCase(propName), value ? value.toString() : null);
6582 }
6583 catch (e) {
6584 renderer.setBindingDebugInfo(el, "ng-reflect-" + camelCaseToDashCase(propName), '[ERROR] Exception while trying to serialize the value');
6585 }
6586 }
6587 var /** @type {?} */ CAMEL_CASE_REGEXP = /([A-Z])/g;
6588 /**
6589 * @param {?} input
6590 * @return {?}
6591 */
6592 function camelCaseToDashCase(input) {
6593 return input.replace(CAMEL_CASE_REGEXP, function () {
6594 var m = [];
6595 for (var _i = 0; _i < arguments.length; _i++) {
6596 m[_i - 0] = arguments[_i];
6597 }
6598 return '-' + m[1].toLowerCase();
6599 });
6600 }
6601 /**
6602 * @param {?} renderer
6603 * @param {?} parentElement
6604 * @param {?} name
6605 * @param {?} attrs
6606 * @param {?=} debugInfo
6607 * @return {?}
6608 */
6609 function createRenderElement(renderer, parentElement, name, attrs, debugInfo) {
6610 var /** @type {?} */ el = renderer.createElement(parentElement, name, debugInfo);
6611 for (var /** @type {?} */ i = 0; i < attrs.length; i += 2) {
6612 renderer.setElementAttribute(el, attrs.get(i), attrs.get(i + 1));
6613 }
6614 return el;
6615 }
6616 /**
6617 * @param {?} renderer
6618 * @param {?} elementName
6619 * @param {?} attrs
6620 * @param {?} rootSelectorOrNode
6621 * @param {?=} debugInfo
6622 * @return {?}
6623 */
6624 function selectOrCreateRenderHostElement(renderer, elementName, attrs, rootSelectorOrNode, debugInfo) {
6625 var /** @type {?} */ hostElement;
6626 if (isPresent(rootSelectorOrNode)) {
6627 hostElement = renderer.selectRootElement(rootSelectorOrNode, debugInfo);
6628 for (var /** @type {?} */ i = 0; i < attrs.length; i += 2) {
6629 renderer.setElementAttribute(hostElement, attrs.get(i), attrs.get(i + 1));
6630 }
6631 renderer.setElementAttribute(hostElement, 'ng-version', VERSION.full);
6632 }
6633 else {
6634 hostElement = createRenderElement(renderer, null, elementName, attrs, debugInfo);
6635 }
6636 return hostElement;
6637 }
6638 /**
6639 * @param {?} view
6640 * @param {?} element
6641 * @param {?} eventNamesAndTargets
6642 * @param {?} listener
6643 * @return {?}
6644 */
6645 function subscribeToRenderElement(view, element, eventNamesAndTargets, listener) {
6646 var /** @type {?} */ disposables = createEmptyInlineArray(eventNamesAndTargets.length / 2);
6647 for (var /** @type {?} */ i = 0; i < eventNamesAndTargets.length; i += 2) {
6648 var /** @type {?} */ eventName = eventNamesAndTargets.get(i);
6649 var /** @type {?} */ eventTarget = eventNamesAndTargets.get(i + 1);
6650 var /** @type {?} */ disposable = void 0;
6651 if (eventTarget) {
6652 disposable = view.renderer.listenGlobal(eventTarget, eventName, listener.bind(view, eventTarget + ":" + eventName));
6653 }
6654 else {
6655 disposable = view.renderer.listen(element, eventName, listener.bind(view, eventName));
6656 }
6657 disposables.set(i / 2, disposable);
6658 }
6659 return disposeInlineArray.bind(null, disposables);
6660 }
6661 /**
6662 * @param {?} disposables
6663 * @return {?}
6664 */
6665 function disposeInlineArray(disposables) {
6666 for (var /** @type {?} */ i = 0; i < disposables.length; i++) {
6667 disposables.get(i)();
6668 }
6669 }
6670 /**
6671 * @return {?}
6672 */
6673 function noop() { }
6674 /**
6675 * @param {?} length
6676 * @return {?}
6677 */
6678 function createEmptyInlineArray(length) {
6679 var /** @type {?} */ ctor;
6680 if (length <= 2) {
6681 ctor = InlineArray2;
6682 }
6683 else if (length <= 4) {
6684 ctor = InlineArray4;
6685 }
6686 else if (length <= 8) {
6687 ctor = InlineArray8;
6688 }
6689 else if (length <= 16) {
6690 ctor = InlineArray16;
6691 }
6692 else {
6693 ctor = InlineArrayDynamic;
6694 }
6695 return new ctor(length);
6696 }
6697 var InlineArray0 = (function () {
6698 function InlineArray0() {
6699 this.length = 0;
6700 }
6701 /**
6702 * @param {?} index
6703 * @return {?}
6704 */
6705 InlineArray0.prototype.get = function (index) { return undefined; };
6706 /**
6707 * @param {?} index
6708 * @param {?} value
6709 * @return {?}
6710 */
6711 InlineArray0.prototype.set = function (index, value) { };
6712 return InlineArray0;
6713 }());
6714 var InlineArray2 = (function () {
6715 /**
6716 * @param {?} length
6717 * @param {?=} _v0
6718 * @param {?=} _v1
6719 */
6720 function InlineArray2(length, _v0, _v1) {
6721 this.length = length;
6722 this._v0 = _v0;
6723 this._v1 = _v1;
6724 }
6725 /**
6726 * @param {?} index
6727 * @return {?}
6728 */
6729 InlineArray2.prototype.get = function (index) {
6730 switch (index) {
6731 case 0:
6732 return this._v0;
6733 case 1:
6734 return this._v1;
6735 default:
6736 return undefined;
6737 }
6738 };
6739 /**
6740 * @param {?} index
6741 * @param {?} value
6742 * @return {?}
6743 */
6744 InlineArray2.prototype.set = function (index, value) {
6745 switch (index) {
6746 case 0:
6747 this._v0 = value;
6748 break;
6749 case 1:
6750 this._v1 = value;
6751 break;
6752 }
6753 };
6754 return InlineArray2;
6755 }());
6756 var InlineArray4 = (function () {
6757 /**
6758 * @param {?} length
6759 * @param {?=} _v0
6760 * @param {?=} _v1
6761 * @param {?=} _v2
6762 * @param {?=} _v3
6763 */
6764 function InlineArray4(length, _v0, _v1, _v2, _v3) {
6765 this.length = length;
6766 this._v0 = _v0;
6767 this._v1 = _v1;
6768 this._v2 = _v2;
6769 this._v3 = _v3;
6770 }
6771 /**
6772 * @param {?} index
6773 * @return {?}
6774 */
6775 InlineArray4.prototype.get = function (index) {
6776 switch (index) {
6777 case 0:
6778 return this._v0;
6779 case 1:
6780 return this._v1;
6781 case 2:
6782 return this._v2;
6783 case 3:
6784 return this._v3;
6785 default:
6786 return undefined;
6787 }
6788 };
6789 /**
6790 * @param {?} index
6791 * @param {?} value
6792 * @return {?}
6793 */
6794 InlineArray4.prototype.set = function (index, value) {
6795 switch (index) {
6796 case 0:
6797 this._v0 = value;
6798 break;
6799 case 1:
6800 this._v1 = value;
6801 break;
6802 case 2:
6803 this._v2 = value;
6804 break;
6805 case 3:
6806 this._v3 = value;
6807 break;
6808 }
6809 };
6810 return InlineArray4;
6811 }());
6812 var InlineArray8 = (function () {
6813 /**
6814 * @param {?} length
6815 * @param {?=} _v0
6816 * @param {?=} _v1
6817 * @param {?=} _v2
6818 * @param {?=} _v3
6819 * @param {?=} _v4
6820 * @param {?=} _v5
6821 * @param {?=} _v6
6822 * @param {?=} _v7
6823 */
6824 function InlineArray8(length, _v0, _v1, _v2, _v3, _v4, _v5, _v6, _v7) {
6825 this.length = length;
6826 this._v0 = _v0;
6827 this._v1 = _v1;
6828 this._v2 = _v2;
6829 this._v3 = _v3;
6830 this._v4 = _v4;
6831 this._v5 = _v5;
6832 this._v6 = _v6;
6833 this._v7 = _v7;
6834 }
6835 /**
6836 * @param {?} index
6837 * @return {?}
6838 */
6839 InlineArray8.prototype.get = function (index) {
6840 switch (index) {
6841 case 0:
6842 return this._v0;
6843 case 1:
6844 return this._v1;
6845 case 2:
6846 return this._v2;
6847 case 3:
6848 return this._v3;
6849 case 4:
6850 return this._v4;
6851 case 5:
6852 return this._v5;
6853 case 6:
6854 return this._v6;
6855 case 7:
6856 return this._v7;
6857 default:
6858 return undefined;
6859 }
6860 };
6861 /**
6862 * @param {?} index
6863 * @param {?} value
6864 * @return {?}
6865 */
6866 InlineArray8.prototype.set = function (index, value) {
6867 switch (index) {
6868 case 0:
6869 this._v0 = value;
6870 break;
6871 case 1:
6872 this._v1 = value;
6873 break;
6874 case 2:
6875 this._v2 = value;
6876 break;
6877 case 3:
6878 this._v3 = value;
6879 break;
6880 case 4:
6881 this._v4 = value;
6882 break;
6883 case 5:
6884 this._v5 = value;
6885 break;
6886 case 6:
6887 this._v6 = value;
6888 break;
6889 case 7:
6890 this._v7 = value;
6891 break;
6892 }
6893 };
6894 return InlineArray8;
6895 }());
6896 var InlineArray16 = (function () {
6897 /**
6898 * @param {?} length
6899 * @param {?=} _v0
6900 * @param {?=} _v1
6901 * @param {?=} _v2
6902 * @param {?=} _v3
6903 * @param {?=} _v4
6904 * @param {?=} _v5
6905 * @param {?=} _v6
6906 * @param {?=} _v7
6907 * @param {?=} _v8
6908 * @param {?=} _v9
6909 * @param {?=} _v10
6910 * @param {?=} _v11
6911 * @param {?=} _v12
6912 * @param {?=} _v13
6913 * @param {?=} _v14
6914 * @param {?=} _v15
6915 */
6916 function InlineArray16(length, _v0, _v1, _v2, _v3, _v4, _v5, _v6, _v7, _v8, _v9, _v10, _v11, _v12, _v13, _v14, _v15) {
6917 this.length = length;
6918 this._v0 = _v0;
6919 this._v1 = _v1;
6920 this._v2 = _v2;
6921 this._v3 = _v3;
6922 this._v4 = _v4;
6923 this._v5 = _v5;
6924 this._v6 = _v6;
6925 this._v7 = _v7;
6926 this._v8 = _v8;
6927 this._v9 = _v9;
6928 this._v10 = _v10;
6929 this._v11 = _v11;
6930 this._v12 = _v12;
6931 this._v13 = _v13;
6932 this._v14 = _v14;
6933 this._v15 = _v15;
6934 }
6935 /**
6936 * @param {?} index
6937 * @return {?}
6938 */
6939 InlineArray16.prototype.get = function (index) {
6940 switch (index) {
6941 case 0:
6942 return this._v0;
6943 case 1:
6944 return this._v1;
6945 case 2:
6946 return this._v2;
6947 case 3:
6948 return this._v3;
6949 case 4:
6950 return this._v4;
6951 case 5:
6952 return this._v5;
6953 case 6:
6954 return this._v6;
6955 case 7:
6956 return this._v7;
6957 case 8:
6958 return this._v8;
6959 case 9:
6960 return this._v9;
6961 case 10:
6962 return this._v10;
6963 case 11:
6964 return this._v11;
6965 case 12:
6966 return this._v12;
6967 case 13:
6968 return this._v13;
6969 case 14:
6970 return this._v14;
6971 case 15:
6972 return this._v15;
6973 default:
6974 return undefined;
6975 }
6976 };
6977 /**
6978 * @param {?} index
6979 * @param {?} value
6980 * @return {?}
6981 */
6982 InlineArray16.prototype.set = function (index, value) {
6983 switch (index) {
6984 case 0:
6985 this._v0 = value;
6986 break;
6987 case 1:
6988 this._v1 = value;
6989 break;
6990 case 2:
6991 this._v2 = value;
6992 break;
6993 case 3:
6994 this._v3 = value;
6995 break;
6996 case 4:
6997 this._v4 = value;
6998 break;
6999 case 5:
7000 this._v5 = value;
7001 break;
7002 case 6:
7003 this._v6 = value;
7004 break;
7005 case 7:
7006 this._v7 = value;
7007 break;
7008 case 8:
7009 this._v8 = value;
7010 break;
7011 case 9:
7012 this._v9 = value;
7013 break;
7014 case 10:
7015 this._v10 = value;
7016 break;
7017 case 11:
7018 this._v11 = value;
7019 break;
7020 case 12:
7021 this._v12 = value;
7022 break;
7023 case 13:
7024 this._v13 = value;
7025 break;
7026 case 14:
7027 this._v14 = value;
7028 break;
7029 case 15:
7030 this._v15 = value;
7031 break;
7032 }
7033 };
7034 return InlineArray16;
7035 }());
7036 var InlineArrayDynamic = (function () {
7037 /**
7038 * @param {?} length
7039 * @param {...?} values
7040 */
7041 function InlineArrayDynamic(length) {
7042 var values = [];
7043 for (var _i = 1; _i < arguments.length; _i++) {
7044 values[_i - 1] = arguments[_i];
7045 }
7046 this.length = length;
7047 this._values = values;
7048 }
7049 /**
7050 * @param {?} index
7051 * @return {?}
7052 */
7053 InlineArrayDynamic.prototype.get = function (index) { return this._values[index]; };
7054 /**
7055 * @param {?} index
7056 * @param {?} value
7057 * @return {?}
7058 */
7059 InlineArrayDynamic.prototype.set = function (index, value) { this._values[index] = value; };
7060 return InlineArrayDynamic;
7061 }());
7062 var /** @type {?} */ EMPTY_INLINE_ARRAY = new InlineArray0();
7063
7064
7065 var view_utils = Object.freeze({
7066 ViewUtils: ViewUtils,
7067 createRenderComponentType: createRenderComponentType,
7068 addToArray: addToArray,
7069 interpolate: interpolate,
7070 inlineInterpolate: inlineInterpolate,
7071 checkBinding: checkBinding,
7072 castByValue: castByValue,
7073 EMPTY_ARRAY: EMPTY_ARRAY,
7074 EMPTY_MAP: EMPTY_MAP,
7075 pureProxy1: pureProxy1,
7076 pureProxy2: pureProxy2,
7077 pureProxy3: pureProxy3,
7078 pureProxy4: pureProxy4,
7079 pureProxy5: pureProxy5,
7080 pureProxy6: pureProxy6,
7081 pureProxy7: pureProxy7,
7082 pureProxy8: pureProxy8,
7083 pureProxy9: pureProxy9,
7084 pureProxy10: pureProxy10,
7085 setBindingDebugInfoForChanges: setBindingDebugInfoForChanges,
7086 setBindingDebugInfo: setBindingDebugInfo,
7087 createRenderElement: createRenderElement,
7088 selectOrCreateRenderHostElement: selectOrCreateRenderHostElement,
7089 subscribeToRenderElement: subscribeToRenderElement,
7090 noop: noop,
7091 InlineArray2: InlineArray2,
7092 InlineArray4: InlineArray4,
7093 InlineArray8: InlineArray8,
7094 InlineArray16: InlineArray16,
7095 InlineArrayDynamic: InlineArrayDynamic,
7096 EMPTY_INLINE_ARRAY: EMPTY_INLINE_ARRAY
7097 });
7098
7099 /**
7100 * @license
7101 * Copyright Google Inc. All Rights Reserved.
7102 *
7103 * Use of this source code is governed by an MIT-style license that can be
7104 * found in the LICENSE file at https://angular.io/license
7105 */
7106 var __extends$5 = (this && this.__extends) || function (d, b) {
7107 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
7108 function __() { this.constructor = d; }
7109 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7110 };
7111 /**
7112 * Represents an instance of a Component created via a {\@link ComponentFactory}.
7113 *
7114 * `ComponentRef` provides access to the Component Instance as well other objects related to this
7115 * Component Instance and allows you to destroy the Component Instance via the {\@link #destroy}
7116 * method.
7117 * \@stable
7118 * @abstract
7119 */
7120 var ComponentRef = (function () {
7121 function ComponentRef() {
7122 }
7123 /**
7124 * Location of the Host Element of this Component Instance.
7125 * @abstract
7126 * @return {?}
7127 */
7128 ComponentRef.prototype.location = function () { };
7129 /**
7130 * The injector on which the component instance exists.
7131 * @abstract
7132 * @return {?}
7133 */
7134 ComponentRef.prototype.injector = function () { };
7135 /**
7136 * The instance of the Component.
7137 * @abstract
7138 * @return {?}
7139 */
7140 ComponentRef.prototype.instance = function () { };
7141 /**
7142 * The {\@link ViewRef} of the Host View of this Component instance.
7143 * @abstract
7144 * @return {?}
7145 */
7146 ComponentRef.prototype.hostView = function () { };
7147 /**
7148 * The {\@link ChangeDetectorRef} of the Component instance.
7149 * @abstract
7150 * @return {?}
7151 */
7152 ComponentRef.prototype.changeDetectorRef = function () { };
7153 /**
7154 * The component type.
7155 * @abstract
7156 * @return {?}
7157 */
7158 ComponentRef.prototype.componentType = function () { };
7159 /**
7160 * Destroys the component instance and all of the data structures associated with it.
7161 * @abstract
7162 * @return {?}
7163 */
7164 ComponentRef.prototype.destroy = function () { };
7165 /**
7166 * Allows to register a callback that will be called when the component is destroyed.
7167 * @abstract
7168 * @param {?} callback
7169 * @return {?}
7170 */
7171 ComponentRef.prototype.onDestroy = function (callback) { };
7172 return ComponentRef;
7173 }());
7174 var ComponentRef_ = (function (_super) {
7175 __extends$5(ComponentRef_, _super);
7176 /**
7177 * @param {?} _index
7178 * @param {?} _parentView
7179 * @param {?} _nativeElement
7180 * @param {?} _component
7181 */
7182 function ComponentRef_(_index, _parentView, _nativeElement, _component) {
7183 _super.call(this);
7184 this._index = _index;
7185 this._parentView = _parentView;
7186 this._nativeElement = _nativeElement;
7187 this._component = _component;
7188 }
7189 Object.defineProperty(ComponentRef_.prototype, "location", {
7190 /**
7191 * @return {?}
7192 */
7193 get: function () { return new ElementRef(this._nativeElement); },
7194 enumerable: true,
7195 configurable: true
7196 });
7197 Object.defineProperty(ComponentRef_.prototype, "injector", {
7198 /**
7199 * @return {?}
7200 */
7201 get: function () { return this._parentView.injector(this._index); },
7202 enumerable: true,
7203 configurable: true
7204 });
7205 Object.defineProperty(ComponentRef_.prototype, "instance", {
7206 /**
7207 * @return {?}
7208 */
7209 get: function () { return this._component; },
7210 enumerable: true,
7211 configurable: true
7212 });
7213 ;
7214 Object.defineProperty(ComponentRef_.prototype, "hostView", {
7215 /**
7216 * @return {?}
7217 */
7218 get: function () { return this._parentView.ref; },
7219 enumerable: true,
7220 configurable: true
7221 });
7222 ;
7223 Object.defineProperty(ComponentRef_.prototype, "changeDetectorRef", {
7224 /**
7225 * @return {?}
7226 */
7227 get: function () { return this._parentView.ref; },
7228 enumerable: true,
7229 configurable: true
7230 });
7231 ;
7232 Object.defineProperty(ComponentRef_.prototype, "componentType", {
7233 /**
7234 * @return {?}
7235 */
7236 get: function () { return (this._component.constructor); },
7237 enumerable: true,
7238 configurable: true
7239 });
7240 /**
7241 * @return {?}
7242 */
7243 ComponentRef_.prototype.destroy = function () { this._parentView.detachAndDestroy(); };
7244 /**
7245 * @param {?} callback
7246 * @return {?}
7247 */
7248 ComponentRef_.prototype.onDestroy = function (callback) { this.hostView.onDestroy(callback); };
7249 return ComponentRef_;
7250 }(ComponentRef));
7251 /**
7252 * \@stable
7253 */
7254 var ComponentFactory = (function () {
7255 /**
7256 * @param {?} selector
7257 * @param {?} _viewClass
7258 * @param {?} _componentType
7259 */
7260 function ComponentFactory(selector, _viewClass, _componentType) {
7261 this.selector = selector;
7262 this._viewClass = _viewClass;
7263 this._componentType = _componentType;
7264 }
7265 Object.defineProperty(ComponentFactory.prototype, "componentType", {
7266 /**
7267 * @return {?}
7268 */
7269 get: function () { return this._componentType; },
7270 enumerable: true,
7271 configurable: true
7272 });
7273 /**
7274 * Creates a new component.
7275 * @param {?} injector
7276 * @param {?=} projectableNodes
7277 * @param {?=} rootSelectorOrNode
7278 * @return {?}
7279 */
7280 ComponentFactory.prototype.create = function (injector, projectableNodes, rootSelectorOrNode) {
7281 if (projectableNodes === void 0) { projectableNodes = null; }
7282 if (rootSelectorOrNode === void 0) { rootSelectorOrNode = null; }
7283 var /** @type {?} */ vu = injector.get(ViewUtils);
7284 if (!projectableNodes) {
7285 projectableNodes = [];
7286 }
7287 var /** @type {?} */ hostView = new this._viewClass(vu, null, null, null);
7288 return hostView.createHostView(rootSelectorOrNode, injector, projectableNodes);
7289 };
7290 return ComponentFactory;
7291 }());
7292
7293 /**
7294 * @license
7295 * Copyright Google Inc. All Rights Reserved.
7296 *
7297 * Use of this source code is governed by an MIT-style license that can be
7298 * found in the LICENSE file at https://angular.io/license
7299 */
7300 var __extends$8 = (this && this.__extends) || function (d, b) {
7301 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
7302 function __() { this.constructor = d; }
7303 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7304 };
7305 /**
7306 * \@stable
7307 */
7308 var NoComponentFactoryError = (function (_super) {
7309 __extends$8(NoComponentFactoryError, _super);
7310 /**
7311 * @param {?} component
7312 */
7313 function NoComponentFactoryError(component) {
7314 _super.call(this, "No component factory found for " + stringify(component) + ". Did you add it to @NgModule.entryComponents?");
7315 this.component = component;
7316 }
7317 return NoComponentFactoryError;
7318 }(BaseError));
7319 var _NullComponentFactoryResolver = (function () {
7320 function _NullComponentFactoryResolver() {
7321 }
7322 /**
7323 * @param {?} component
7324 * @return {?}
7325 */
7326 _NullComponentFactoryResolver.prototype.resolveComponentFactory = function (component) {
7327 throw new NoComponentFactoryError(component);
7328 };
7329 return _NullComponentFactoryResolver;
7330 }());
7331 /**
7332 * \@stable
7333 * @abstract
7334 */
7335 var ComponentFactoryResolver = (function () {
7336 function ComponentFactoryResolver() {
7337 }
7338 /**
7339 * @abstract
7340 * @param {?} component
7341 * @return {?}
7342 */
7343 ComponentFactoryResolver.prototype.resolveComponentFactory = function (component) { };
7344 ComponentFactoryResolver.NULL = new _NullComponentFactoryResolver();
7345 return ComponentFactoryResolver;
7346 }());
7347 var CodegenComponentFactoryResolver = (function () {
7348 /**
7349 * @param {?} factories
7350 * @param {?} _parent
7351 */
7352 function CodegenComponentFactoryResolver(factories, _parent) {
7353 this._parent = _parent;
7354 this._factories = new Map();
7355 for (var i = 0; i < factories.length; i++) {
7356 var factory = factories[i];
7357 this._factories.set(factory.componentType, factory);
7358 }
7359 }
7360 /**
7361 * @param {?} component
7362 * @return {?}
7363 */
7364 CodegenComponentFactoryResolver.prototype.resolveComponentFactory = function (component) {
7365 var /** @type {?} */ result = this._factories.get(component);
7366 if (!result) {
7367 result = this._parent.resolveComponentFactory(component);
7368 }
7369 return result;
7370 };
7371 return CodegenComponentFactoryResolver;
7372 }());
7373
7374 var /** @type {?} */ trace;
7375 var /** @type {?} */ events;
7376 /**
7377 * @return {?}
7378 */
7379 function detectWTF() {
7380 var /** @type {?} */ wtf = ((global$1) /** TODO #9100 */)['wtf'];
7381 if (wtf) {
7382 trace = wtf['trace'];
7383 if (trace) {
7384 events = trace['events'];
7385 return true;
7386 }
7387 }
7388 return false;
7389 }
7390 /**
7391 * @param {?} signature
7392 * @param {?=} flags
7393 * @return {?}
7394 */
7395 function createScope(signature, flags) {
7396 if (flags === void 0) { flags = null; }
7397 return events.createScope(signature, flags);
7398 }
7399 /**
7400 * @param {?} scope
7401 * @param {?=} returnValue
7402 * @return {?}
7403 */
7404 function leave(scope, returnValue) {
7405 trace.leaveScope(scope, returnValue);
7406 return returnValue;
7407 }
7408 /**
7409 * @param {?} rangeType
7410 * @param {?} action
7411 * @return {?}
7412 */
7413 function startTimeRange(rangeType, action) {
7414 return trace.beginTimeRange(rangeType, action);
7415 }
7416 /**
7417 * @param {?} range
7418 * @return {?}
7419 */
7420 function endTimeRange(range) {
7421 trace.endTimeRange(range);
7422 }
7423
7424 /**
7425 * True if WTF is enabled.
7426 */
7427 var /** @type {?} */ wtfEnabled = detectWTF();
7428 /**
7429 * @param {?=} arg0
7430 * @param {?=} arg1
7431 * @return {?}
7432 */
7433 function noopScope(arg0, arg1) {
7434 return null;
7435 }
7436 /**
7437 * Create trace scope.
7438 *
7439 * Scopes must be strictly nested and are analogous to stack frames, but
7440 * do not have to follow the stack frames. Instead it is recommended that they follow logical
7441 * nesting. You may want to use
7442 * [Event
7443 * Signatures](http://google.github.io/tracing-framework/instrumenting-code.html#custom-events)
7444 * as they are defined in WTF.
7445 *
7446 * Used to mark scope entry. The return value is used to leave the scope.
7447 *
7448 * var myScope = wtfCreateScope('MyClass#myMethod(ascii someVal)');
7449 *
7450 * someMethod() {
7451 * var s = myScope('Foo'); // 'Foo' gets stored in tracing UI
7452 * // DO SOME WORK HERE
7453 * return wtfLeave(s, 123); // Return value 123
7454 * }
7455 *
7456 * Note, adding try-finally block around the work to ensure that `wtfLeave` gets called can
7457 * negatively impact the performance of your application. For this reason we recommend that
7458 * you don't add them to ensure that `wtfLeave` gets called. In production `wtfLeave` is a noop and
7459 * so try-finally block has no value. When debugging perf issues, skipping `wtfLeave`, do to
7460 * exception, will produce incorrect trace, but presence of exception signifies logic error which
7461 * needs to be fixed before the app should be profiled. Add try-finally only when you expect that
7462 * an exception is expected during normal execution while profiling.
7463 *
7464 * @experimental
7465 */
7466 var /** @type {?} */ wtfCreateScope = wtfEnabled ? createScope : function (signature, flags) { return noopScope; };
7467 /**
7468 * Used to mark end of Scope.
7469 *
7470 * - `scope` to end.
7471 * - `returnValue` (optional) to be passed to the WTF.
7472 *
7473 * Returns the `returnValue for easy chaining.
7474 * @experimental
7475 */
7476 var /** @type {?} */ wtfLeave = wtfEnabled ? leave : function (s, r) { return r; };
7477 /**
7478 * Used to mark Async start. Async are similar to scope but they don't have to be strictly nested.
7479 * The return value is used in the call to [endAsync]. Async ranges only work if WTF has been
7480 * enabled.
7481 *
7482 * someMethod() {
7483 * var s = wtfStartTimeRange('HTTP:GET', 'some.url');
7484 * var future = new Future.delay(5).then((_) {
7485 * wtfEndTimeRange(s);
7486 * });
7487 * }
7488 * @experimental
7489 */
7490 var /** @type {?} */ wtfStartTimeRange = wtfEnabled ? startTimeRange : function (rangeType, action) { return null; };
7491 /**
7492 * Ends a async time range operation.
7493 * [range] is the return value from [wtfStartTimeRange] Async ranges only work if WTF has been
7494 * enabled.
7495 * @experimental
7496 */
7497 var /** @type {?} */ wtfEndTimeRange = wtfEnabled ? endTimeRange : function (r) { return null; };
7498
7499 /**
7500 * The Testability service provides testing hooks that can be accessed from
7501 * the browser and by services such as Protractor. Each bootstrapped Angular
7502 * application on the page will have an instance of Testability.
7503 * \@experimental
7504 */
7505 var Testability = (function () {
7506 /**
7507 * @param {?} _ngZone
7508 */
7509 function Testability(_ngZone) {
7510 this._ngZone = _ngZone;
7511 /** @internal */
7512 this._pendingCount = 0;
7513 /** @internal */
7514 this._isZoneStable = true;
7515 /**
7516 * Whether any work was done since the last 'whenStable' callback. This is
7517 * useful to detect if this could have potentially destabilized another
7518 * component while it is stabilizing.
7519 * @internal
7520 */
7521 this._didWork = false;
7522 /** @internal */
7523 this._callbacks = [];
7524 this._watchAngularEvents();
7525 }
7526 /**
7527 * \@internal
7528 * @return {?}
7529 */
7530 Testability.prototype._watchAngularEvents = function () {
7531 var _this = this;
7532 this._ngZone.onUnstable.subscribe({
7533 next: function () {
7534 _this._didWork = true;
7535 _this._isZoneStable = false;
7536 }
7537 });
7538 this._ngZone.runOutsideAngular(function () {
7539 _this._ngZone.onStable.subscribe({
7540 next: function () {
7541 NgZone.assertNotInAngularZone();
7542 scheduleMicroTask(function () {
7543 _this._isZoneStable = true;
7544 _this._runCallbacksIfReady();
7545 });
7546 }
7547 });
7548 });
7549 };
7550 /**
7551 * @return {?}
7552 */
7553 Testability.prototype.increasePendingRequestCount = function () {
7554 this._pendingCount += 1;
7555 this._didWork = true;
7556 return this._pendingCount;
7557 };
7558 /**
7559 * @return {?}
7560 */
7561 Testability.prototype.decreasePendingRequestCount = function () {
7562 this._pendingCount -= 1;
7563 if (this._pendingCount < 0) {
7564 throw new Error('pending async requests below zero');
7565 }
7566 this._runCallbacksIfReady();
7567 return this._pendingCount;
7568 };
7569 /**
7570 * @return {?}
7571 */
7572 Testability.prototype.isStable = function () {
7573 return this._isZoneStable && this._pendingCount == 0 && !this._ngZone.hasPendingMacrotasks;
7574 };
7575 /**
7576 * \@internal
7577 * @return {?}
7578 */
7579 Testability.prototype._runCallbacksIfReady = function () {
7580 var _this = this;
7581 if (this.isStable()) {
7582 // Schedules the call backs in a new frame so that it is always async.
7583 scheduleMicroTask(function () {
7584 while (_this._callbacks.length !== 0) {
7585 (_this._callbacks.pop())(_this._didWork);
7586 }
7587 _this._didWork = false;
7588 });
7589 }
7590 else {
7591 // Not Ready
7592 this._didWork = true;
7593 }
7594 };
7595 /**
7596 * @param {?} callback
7597 * @return {?}
7598 */
7599 Testability.prototype.whenStable = function (callback) {
7600 this._callbacks.push(callback);
7601 this._runCallbacksIfReady();
7602 };
7603 /**
7604 * @return {?}
7605 */
7606 Testability.prototype.getPendingRequestCount = function () { return this._pendingCount; };
7607 /**
7608 * @deprecated use findProviders
7609 * @param {?} using
7610 * @param {?} provider
7611 * @param {?} exactMatch
7612 * @return {?}
7613 */
7614 Testability.prototype.findBindings = function (using, provider, exactMatch) {
7615 // TODO(juliemr): implement.
7616 return [];
7617 };
7618 /**
7619 * @param {?} using
7620 * @param {?} provider
7621 * @param {?} exactMatch
7622 * @return {?}
7623 */
7624 Testability.prototype.findProviders = function (using, provider, exactMatch) {
7625 // TODO(juliemr): implement.
7626 return [];
7627 };
7628 Testability.decorators = [
7629 { type: Injectable },
7630 ];
7631 /** @nocollapse */
7632 Testability.ctorParameters = function () { return [
7633 { type: NgZone, },
7634 ]; };
7635 return Testability;
7636 }());
7637 /**
7638 * A global registry of {\@link Testability} instances for specific elements.
7639 * \@experimental
7640 */
7641 var TestabilityRegistry = (function () {
7642 function TestabilityRegistry() {
7643 /** @internal */
7644 this._applications = new Map();
7645 _testabilityGetter.addToWindow(this);
7646 }
7647 /**
7648 * @param {?} token
7649 * @param {?} testability
7650 * @return {?}
7651 */
7652 TestabilityRegistry.prototype.registerApplication = function (token, testability) {
7653 this._applications.set(token, testability);
7654 };
7655 /**
7656 * @param {?} elem
7657 * @return {?}
7658 */
7659 TestabilityRegistry.prototype.getTestability = function (elem) { return this._applications.get(elem); };
7660 /**
7661 * @return {?}
7662 */
7663 TestabilityRegistry.prototype.getAllTestabilities = function () { return Array.from(this._applications.values()); };
7664 /**
7665 * @return {?}
7666 */
7667 TestabilityRegistry.prototype.getAllRootElements = function () { return Array.from(this._applications.keys()); };
7668 /**
7669 * @param {?} elem
7670 * @param {?=} findInAncestors
7671 * @return {?}
7672 */
7673 TestabilityRegistry.prototype.findTestabilityInTree = function (elem, findInAncestors) {
7674 if (findInAncestors === void 0) { findInAncestors = true; }
7675 return _testabilityGetter.findTestabilityInTree(this, elem, findInAncestors);
7676 };
7677 TestabilityRegistry.decorators = [
7678 { type: Injectable },
7679 ];
7680 /** @nocollapse */
7681 TestabilityRegistry.ctorParameters = function () { return []; };
7682 return TestabilityRegistry;
7683 }());
7684 var _NoopGetTestability = (function () {
7685 function _NoopGetTestability() {
7686 }
7687 /**
7688 * @param {?} registry
7689 * @return {?}
7690 */
7691 _NoopGetTestability.prototype.addToWindow = function (registry) { };
7692 /**
7693 * @param {?} registry
7694 * @param {?} elem
7695 * @param {?} findInAncestors
7696 * @return {?}
7697 */
7698 _NoopGetTestability.prototype.findTestabilityInTree = function (registry, elem, findInAncestors) {
7699 return null;
7700 };
7701 return _NoopGetTestability;
7702 }());
7703 /**
7704 * Set the {\@link GetTestability} implementation used by the Angular testing framework.
7705 * \@experimental
7706 * @param {?} getter
7707 * @return {?}
7708 */
7709 function setTestabilityGetter(getter) {
7710 _testabilityGetter = getter;
7711 }
7712 var /** @type {?} */ _testabilityGetter = new _NoopGetTestability();
7713
7714 /**
7715 * @license
7716 * Copyright Google Inc. All Rights Reserved.
7717 *
7718 * Use of this source code is governed by an MIT-style license that can be
7719 * found in the LICENSE file at https://angular.io/license
7720 */
7721 var __extends$3 = (this && this.__extends) || function (d, b) {
7722 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
7723 function __() { this.constructor = d; }
7724 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
7725 };
7726 var /** @type {?} */ _devMode = true;
7727 var /** @type {?} */ _runModeLocked = false;
7728 var /** @type {?} */ _platform;
7729 /**
7730 * Disable Angular's development mode, which turns off assertions and other
7731 * checks within the framework.
7732 *
7733 * One important assertion this disables verifies that a change detection pass
7734 * does not result in additional changes to any bindings (also known as
7735 * unidirectional data flow).
7736 *
7737 * \@stable
7738 * @return {?}
7739 */
7740 function enableProdMode() {
7741 if (_runModeLocked) {
7742 throw new Error('Cannot enable prod mode after platform setup.');
7743 }
7744 _devMode = false;
7745 }
7746 /**
7747 * Returns whether Angular is in development mode. After called once,
7748 * the value is locked and won't change any more.
7749 *
7750 * By default, this is true, unless a user calls `enableProdMode` before calling this.
7751 *
7752 * \@experimental APIs related to application bootstrap are currently under review.
7753 * @return {?}
7754 */
7755 function isDevMode() {
7756 _runModeLocked = true;
7757 return _devMode;
7758 }
7759 /**
7760 * A token for third-party components that can register themselves with NgProbe.
7761 *
7762 * \@experimental
7763 */
7764 var NgProbeToken = (function () {
7765 /**
7766 * @param {?} name
7767 * @param {?} token
7768 */
7769 function NgProbeToken(name, token) {
7770 this.name = name;
7771 this.token = token;
7772 }
7773 return NgProbeToken;
7774 }());
7775 /**
7776 * Creates a platform.
7777 * Platforms have to be eagerly created via this function.
7778 *
7779 * \@experimental APIs related to application bootstrap are currently under review.
7780 * @param {?} injector
7781 * @return {?}
7782 */
7783 function createPlatform(injector) {
7784 if (_platform && !_platform.destroyed) {
7785 throw new Error('There can be only one platform. Destroy the previous one to create a new one.');
7786 }
7787 _platform = injector.get(PlatformRef);
7788 var /** @type {?} */ inits = (injector.get(PLATFORM_INITIALIZER, null));
7789 if (inits)
7790 inits.forEach(function (init) { return init(); });
7791 return _platform;
7792 }
7793 /**
7794 * Creates a factory for a platform
7795 *
7796 * \@experimental APIs related to application bootstrap are currently under review.
7797 * @param {?} parentPlatformFactory
7798 * @param {?} name
7799 * @param {?=} providers
7800 * @return {?}
7801 */
7802 function createPlatformFactory(parentPlatformFactory, name, providers) {
7803 if (providers === void 0) { providers = []; }
7804 var /** @type {?} */ marker = new OpaqueToken("Platform: " + name);
7805 return function (extraProviders) {
7806 if (extraProviders === void 0) { extraProviders = []; }
7807 if (!getPlatform()) {
7808 if (parentPlatformFactory) {
7809 parentPlatformFactory(providers.concat(extraProviders).concat({ provide: marker, useValue: true }));
7810 }
7811 else {
7812 createPlatform(ReflectiveInjector.resolveAndCreate(providers.concat(extraProviders).concat({ provide: marker, useValue: true })));
7813 }
7814 }
7815 return assertPlatform(marker);
7816 };
7817 }
7818 /**
7819 * Checks that there currently is a platform
7820 * which contains the given token as a provider.
7821 *
7822 * \@experimental APIs related to application bootstrap are currently under review.
7823 * @param {?} requiredToken
7824 * @return {?}
7825 */
7826 function assertPlatform(requiredToken) {
7827 var /** @type {?} */ platform = getPlatform();
7828 if (!platform) {
7829 throw new Error('No platform exists!');
7830 }
7831 if (!platform.injector.get(requiredToken, null)) {
7832 throw new Error('A platform with a different configuration has been created. Please destroy it first.');
7833 }
7834 return platform;
7835 }
7836 /**
7837 * Destroy the existing platform.
7838 *
7839 * \@experimental APIs related to application bootstrap are currently under review.
7840 * @return {?}
7841 */
7842 function destroyPlatform() {
7843 if (_platform && !_platform.destroyed) {
7844 _platform.destroy();
7845 }
7846 }
7847 /**
7848 * Returns the current platform.
7849 *
7850 * \@experimental APIs related to application bootstrap are currently under review.
7851 * @return {?}
7852 */
7853 function getPlatform() {
7854 return _platform && !_platform.destroyed ? _platform : null;
7855 }
7856 /**
7857 * The Angular platform is the entry point for Angular on a web page. Each page
7858 * has exactly one platform, and services (such as reflection) which are common
7859 * to every Angular application running on the page are bound in its scope.
7860 *
7861 * A page's platform is initialized implicitly when {\@link bootstrap}() is called, or
7862 * explicitly by calling {\@link createPlatform}().
7863 *
7864 * \@stable
7865 * @abstract
7866 */
7867 var PlatformRef = (function () {
7868 function PlatformRef() {
7869 }
7870 /**
7871 * Creates an instance of an `\@NgModule` for the given platform
7872 * for offline compilation.
7873 *
7874 * ## Simple Example
7875 *
7876 * ```typescript
7877 * my_module.ts:
7878 *
7879 * \@NgModule({
7880 * imports: [BrowserModule]
7881 * })
7882 * class MyModule {}
7883 *
7884 * main.ts:
7885 * import {MyModuleNgFactory} from './my_module.ngfactory';
7886 * import {platformBrowser} from '\@angular/platform-browser';
7887 *
7888 * let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
7889 * ```
7890 *
7891 * \@experimental APIs related to application bootstrap are currently under review.
7892 * @abstract
7893 * @param {?} moduleFactory
7894 * @return {?}
7895 */
7896 PlatformRef.prototype.bootstrapModuleFactory = function (moduleFactory) { };
7897 /**
7898 * Creates an instance of an `\@NgModule` for a given platform using the given runtime compiler.
7899 *
7900 * ## Simple Example
7901 *
7902 * ```typescript
7903 * \@NgModule({
7904 * imports: [BrowserModule]
7905 * })
7906 * class MyModule {}
7907 *
7908 * let moduleRef = platformBrowser().bootstrapModule(MyModule);
7909 * ```
7910 * \@stable
7911 * @abstract
7912 * @param {?} moduleType
7913 * @param {?=} compilerOptions
7914 * @return {?}
7915 */
7916 PlatformRef.prototype.bootstrapModule = function (moduleType, compilerOptions) { };
7917 /**
7918 * Register a listener to be called when the platform is disposed.
7919 * @abstract
7920 * @param {?} callback
7921 * @return {?}
7922 */
7923 PlatformRef.prototype.onDestroy = function (callback) { };
7924 /**
7925 * Retrieve the platform {\@link Injector}, which is the parent injector for
7926 * every Angular application on the page and provides singleton providers.
7927 * @abstract
7928 * @return {?}
7929 */
7930 PlatformRef.prototype.injector = function () { };
7931 /**
7932 * Destroy the Angular platform and all Angular applications on the page.
7933 * @abstract
7934 * @return {?}
7935 */
7936 PlatformRef.prototype.destroy = function () { };
7937 /**
7938 * @abstract
7939 * @return {?}
7940 */
7941 PlatformRef.prototype.destroyed = function () { };
7942 return PlatformRef;
7943 }());
7944 /**
7945 * @param {?} errorHandler
7946 * @param {?} callback
7947 * @return {?}
7948 */
7949 function _callAndReportToErrorHandler(errorHandler, callback) {
7950 try {
7951 var /** @type {?} */ result = callback();
7952 if (isPromise(result)) {
7953 return result.catch(function (e) {
7954 errorHandler.handleError(e);
7955 // rethrow as the exception handler might not do it
7956 throw e;
7957 });
7958 }
7959 return result;
7960 }
7961 catch (e) {
7962 errorHandler.handleError(e);
7963 // rethrow as the exception handler might not do it
7964 throw e;
7965 }
7966 }
7967 var PlatformRef_ = (function (_super) {
7968 __extends$3(PlatformRef_, _super);
7969 /**
7970 * @param {?} _injector
7971 */
7972 function PlatformRef_(_injector) {
7973 _super.call(this);
7974 this._injector = _injector;
7975 this._modules = [];
7976 this._destroyListeners = [];
7977 this._destroyed = false;
7978 }
7979 /**
7980 * @param {?} callback
7981 * @return {?}
7982 */
7983 PlatformRef_.prototype.onDestroy = function (callback) { this._destroyListeners.push(callback); };
7984 Object.defineProperty(PlatformRef_.prototype, "injector", {
7985 /**
7986 * @return {?}
7987 */
7988 get: function () { return this._injector; },
7989 enumerable: true,
7990 configurable: true
7991 });
7992 Object.defineProperty(PlatformRef_.prototype, "destroyed", {
7993 /**
7994 * @return {?}
7995 */
7996 get: function () { return this._destroyed; },
7997 enumerable: true,
7998 configurable: true
7999 });
8000 /**
8001 * @return {?}
8002 */
8003 PlatformRef_.prototype.destroy = function () {
8004 if (this._destroyed) {
8005 throw new Error('The platform has already been destroyed!');
8006 }
8007 this._modules.slice().forEach(function (module) { return module.destroy(); });
8008 this._destroyListeners.forEach(function (listener) { return listener(); });
8009 this._destroyed = true;
8010 };
8011 /**
8012 * @param {?} moduleFactory
8013 * @return {?}
8014 */
8015 PlatformRef_.prototype.bootstrapModuleFactory = function (moduleFactory) {
8016 return this._bootstrapModuleFactoryWithZone(moduleFactory, null);
8017 };
8018 /**
8019 * @param {?} moduleFactory
8020 * @param {?} ngZone
8021 * @return {?}
8022 */
8023 PlatformRef_.prototype._bootstrapModuleFactoryWithZone = function (moduleFactory, ngZone) {
8024 var _this = this;
8025 // Note: We need to create the NgZone _before_ we instantiate the module,
8026 // as instantiating the module creates some providers eagerly.
8027 // So we create a mini parent injector that just contains the new NgZone and
8028 // pass that as parent to the NgModuleFactory.
8029 if (!ngZone)
8030 ngZone = new NgZone({ enableLongStackTrace: isDevMode() });
8031 // Attention: Don't use ApplicationRef.run here,
8032 // as we want to be sure that all possible constructor calls are inside `ngZone.run`!
8033 return ngZone.run(function () {
8034 var /** @type {?} */ ngZoneInjector = ReflectiveInjector.resolveAndCreate([{ provide: NgZone, useValue: ngZone }], _this.injector);
8035 var /** @type {?} */ moduleRef = (moduleFactory.create(ngZoneInjector));
8036 var /** @type {?} */ exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
8037 if (!exceptionHandler) {
8038 throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?');
8039 }
8040 moduleRef.onDestroy(function () { return ListWrapper.remove(_this._modules, moduleRef); });
8041 ngZone.onError.subscribe({ next: function (error) { exceptionHandler.handleError(error); } });
8042 return _callAndReportToErrorHandler(exceptionHandler, function () {
8043 var /** @type {?} */ initStatus = moduleRef.injector.get(ApplicationInitStatus);
8044 return initStatus.donePromise.then(function () {
8045 _this._moduleDoBootstrap(moduleRef);
8046 return moduleRef;
8047 });
8048 });
8049 });
8050 };
8051 /**
8052 * @param {?} moduleType
8053 * @param {?=} compilerOptions
8054 * @return {?}
8055 */
8056 PlatformRef_.prototype.bootstrapModule = function (moduleType, compilerOptions) {
8057 if (compilerOptions === void 0) { compilerOptions = []; }
8058 return this._bootstrapModuleWithZone(moduleType, compilerOptions, null);
8059 };
8060 /**
8061 * @param {?} moduleType
8062 * @param {?=} compilerOptions
8063 * @param {?} ngZone
8064 * @param {?=} componentFactoryCallback
8065 * @return {?}
8066 */
8067 PlatformRef_.prototype._bootstrapModuleWithZone = function (moduleType, compilerOptions, ngZone, componentFactoryCallback) {
8068 var _this = this;
8069 if (compilerOptions === void 0) { compilerOptions = []; }
8070 var /** @type {?} */ compilerFactory = this.injector.get(CompilerFactory);
8071 var /** @type {?} */ compiler = compilerFactory.createCompiler(Array.isArray(compilerOptions) ? compilerOptions : [compilerOptions]);
8072 // ugly internal api hack: generate host component factories for all declared components and
8073 // pass the factories into the callback - this is used by UpdateAdapter to get hold of all
8074 // factories.
8075 if (componentFactoryCallback) {
8076 return compiler.compileModuleAndAllComponentsAsync(moduleType)
8077 .then(function (_a) {
8078 var ngModuleFactory = _a.ngModuleFactory, componentFactories = _a.componentFactories;
8079 componentFactoryCallback(componentFactories);
8080 return _this._bootstrapModuleFactoryWithZone(ngModuleFactory, ngZone);
8081 });
8082 }
8083 return compiler.compileModuleAsync(moduleType)
8084 .then(function (moduleFactory) { return _this._bootstrapModuleFactoryWithZone(moduleFactory, ngZone); });
8085 };
8086 /**
8087 * @param {?} moduleRef
8088 * @return {?}
8089 */
8090 PlatformRef_.prototype._moduleDoBootstrap = function (moduleRef) {
8091 var /** @type {?} */ appRef = moduleRef.injector.get(ApplicationRef);
8092 if (moduleRef.bootstrapFactories.length > 0) {
8093 moduleRef.bootstrapFactories.forEach(function (compFactory) { return appRef.bootstrap(compFactory); });
8094 }
8095 else if (moduleRef.instance.ngDoBootstrap) {
8096 moduleRef.instance.ngDoBootstrap(appRef);
8097 }
8098 else {
8099 throw new Error(("The module " + stringify(moduleRef.instance.constructor) + " was bootstrapped, but it does not declare \"@NgModule.bootstrap\" components nor a \"ngDoBootstrap\" method. ") +
8100 "Please define one of these.");
8101 }
8102 this._modules.push(moduleRef);
8103 };
8104 PlatformRef_.decorators = [
8105 { type: Injectable },
8106 ];
8107 /** @nocollapse */
8108 PlatformRef_.ctorParameters = function () { return [
8109 { type: Injector, },
8110 ]; };
8111 return PlatformRef_;
8112 }(PlatformRef));
8113 /**
8114 * A reference to an Angular application running on a page.
8115 *
8116 * For more about Angular applications, see the documentation for {\@link bootstrap}.
8117 *
8118 * \@stable
8119 * @abstract
8120 */
8121 var ApplicationRef = (function () {
8122 function ApplicationRef() {
8123 }
8124 /**
8125 * Bootstrap a new component at the root level of the application.
8126 *
8127 * ### Bootstrap process
8128 *
8129 * When bootstrapping a new root component into an application, Angular mounts the
8130 * specified application component onto DOM elements identified by the [componentType]'s
8131 * selector and kicks off automatic change detection to finish initializing the component.
8132 *
8133 * ### Example
8134 * {\@example core/ts/platform/platform.ts region='longform'}
8135 * @abstract
8136 * @param {?} componentFactory
8137 * @return {?}
8138 */
8139 ApplicationRef.prototype.bootstrap = function (componentFactory) { };
8140 /**
8141 * Invoke this method to explicitly process change detection and its side-effects.
8142 *
8143 * In development mode, `tick()` also performs a second change detection cycle to ensure that no
8144 * further changes are detected. If additional changes are picked up during this second cycle,
8145 * bindings in the app have side-effects that cannot be resolved in a single change detection
8146 * pass.
8147 * In this case, Angular throws an error, since an Angular application can only have one change
8148 * detection pass during which all change detection must complete.
8149 * @abstract
8150 * @return {?}
8151 */
8152 ApplicationRef.prototype.tick = function () { };
8153 /**
8154 * Get a list of component types registered to this application.
8155 * This list is populated even before the component is created.
8156 * @abstract
8157 * @return {?}
8158 */
8159 ApplicationRef.prototype.componentTypes = function () { };
8160 /**
8161 * Get a list of components registered to this application.
8162 * @abstract
8163 * @return {?}
8164 */
8165 ApplicationRef.prototype.components = function () { };
8166 /**
8167 * Attaches a view so that it will be dirty checked.
8168 * The view will be automatically detached when it is destroyed.
8169 * This will throw if the view is already attached to a ViewContainer.
8170 * @abstract
8171 * @param {?} view
8172 * @return {?}
8173 */
8174 ApplicationRef.prototype.attachView = function (view) { };
8175 /**
8176 * Detaches a view from dirty checking again.
8177 * @abstract
8178 * @param {?} view
8179 * @return {?}
8180 */
8181 ApplicationRef.prototype.detachView = function (view) { };
8182 /**
8183 * Returns the number of attached views.
8184 * @abstract
8185 * @return {?}
8186 */
8187 ApplicationRef.prototype.viewCount = function () { };
8188 return ApplicationRef;
8189 }());
8190 var ApplicationRef_ = (function (_super) {
8191 __extends$3(ApplicationRef_, _super);
8192 /**
8193 * @param {?} _zone
8194 * @param {?} _console
8195 * @param {?} _injector
8196 * @param {?} _exceptionHandler
8197 * @param {?} _componentFactoryResolver
8198 * @param {?} _initStatus
8199 * @param {?} _testabilityRegistry
8200 * @param {?} _testability
8201 */
8202 function ApplicationRef_(_zone, _console, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus, _testabilityRegistry, _testability) {
8203 var _this = this;
8204 _super.call(this);
8205 this._zone = _zone;
8206 this._console = _console;
8207 this._injector = _injector;
8208 this._exceptionHandler = _exceptionHandler;
8209 this._componentFactoryResolver = _componentFactoryResolver;
8210 this._initStatus = _initStatus;
8211 this._testabilityRegistry = _testabilityRegistry;
8212 this._testability = _testability;
8213 this._bootstrapListeners = [];
8214 this._rootComponents = [];
8215 this._rootComponentTypes = [];
8216 this._views = [];
8217 this._runningTick = false;
8218 this._enforceNoNewChanges = false;
8219 this._enforceNoNewChanges = isDevMode();
8220 this._zone.onMicrotaskEmpty.subscribe({ next: function () { _this._zone.run(function () { _this.tick(); }); } });
8221 }
8222 /**
8223 * @param {?} viewRef
8224 * @return {?}
8225 */
8226 ApplicationRef_.prototype.attachView = function (viewRef) {
8227 var /** @type {?} */ view = ((viewRef)).internalView;
8228 this._views.push(view);
8229 view.attachToAppRef(this);
8230 };
8231 /**
8232 * @param {?} viewRef
8233 * @return {?}
8234 */
8235 ApplicationRef_.prototype.detachView = function (viewRef) {
8236 var /** @type {?} */ view = ((viewRef)).internalView;
8237 ListWrapper.remove(this._views, view);
8238 view.detach();
8239 };
8240 /**
8241 * @param {?} componentOrFactory
8242 * @return {?}
8243 */
8244 ApplicationRef_.prototype.bootstrap = function (componentOrFactory) {
8245 var _this = this;
8246 if (!this._initStatus.done) {
8247 throw new Error('Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.');
8248 }
8249 var /** @type {?} */ componentFactory;
8250 if (componentOrFactory instanceof ComponentFactory) {
8251 componentFactory = componentOrFactory;
8252 }
8253 else {
8254 componentFactory = this._componentFactoryResolver.resolveComponentFactory(componentOrFactory);
8255 }
8256 this._rootComponentTypes.push(componentFactory.componentType);
8257 var /** @type {?} */ compRef = componentFactory.create(this._injector, [], componentFactory.selector);
8258 compRef.onDestroy(function () { _this._unloadComponent(compRef); });
8259 var /** @type {?} */ testability = compRef.injector.get(Testability, null);
8260 if (testability) {
8261 compRef.injector.get(TestabilityRegistry)
8262 .registerApplication(compRef.location.nativeElement, testability);
8263 }
8264 this._loadComponent(compRef);
8265 if (isDevMode()) {
8266 this._console.log("Angular is running in the development mode. Call enableProdMode() to enable the production mode.");
8267 }
8268 return compRef;
8269 };
8270 /**
8271 * @param {?} componentRef
8272 * @return {?}
8273 */
8274 ApplicationRef_.prototype._loadComponent = function (componentRef) {
8275 this.attachView(componentRef.hostView);
8276 this.tick();
8277 this._rootComponents.push(componentRef);
8278 // Get the listeners lazily to prevent DI cycles.
8279 var /** @type {?} */ listeners = (this._injector.get(APP_BOOTSTRAP_LISTENER, [])
8280 .concat(this._bootstrapListeners));
8281 listeners.forEach(function (listener) { return listener(componentRef); });
8282 };
8283 /**
8284 * @param {?} componentRef
8285 * @return {?}
8286 */
8287 ApplicationRef_.prototype._unloadComponent = function (componentRef) {
8288 this.detachView(componentRef.hostView);
8289 ListWrapper.remove(this._rootComponents, componentRef);
8290 };
8291 /**
8292 * @return {?}
8293 */
8294 ApplicationRef_.prototype.tick = function () {
8295 if (this._runningTick) {
8296 throw new Error('ApplicationRef.tick is called recursively');
8297 }
8298 var /** @type {?} */ scope = ApplicationRef_._tickScope();
8299 try {
8300 this._runningTick = true;
8301 this._views.forEach(function (view) { return view.ref.detectChanges(); });
8302 if (this._enforceNoNewChanges) {
8303 this._views.forEach(function (view) { return view.ref.checkNoChanges(); });
8304 }
8305 }
8306 finally {
8307 this._runningTick = false;
8308 wtfLeave(scope);
8309 }
8310 };
8311 /**
8312 * @return {?}
8313 */
8314 ApplicationRef_.prototype.ngOnDestroy = function () {
8315 // TODO(alxhub): Dispose of the NgZone.
8316 this._views.slice().forEach(function (view) { return view.destroy(); });
8317 };
8318 Object.defineProperty(ApplicationRef_.prototype, "viewCount", {
8319 /**
8320 * @return {?}
8321 */
8322 get: function () { return this._views.length; },
8323 enumerable: true,
8324 configurable: true
8325 });
8326 Object.defineProperty(ApplicationRef_.prototype, "componentTypes", {
8327 /**
8328 * @return {?}
8329 */
8330 get: function () { return this._rootComponentTypes; },
8331 enumerable: true,
8332 configurable: true
8333 });
8334 Object.defineProperty(ApplicationRef_.prototype, "components", {
8335 /**
8336 * @return {?}
8337 */
8338 get: function () { return this._rootComponents; },
8339 enumerable: true,
8340 configurable: true
8341 });
8342 /** @internal */
8343 ApplicationRef_._tickScope = wtfCreateScope('ApplicationRef#tick()');
8344 ApplicationRef_.decorators = [
8345 { type: Injectable },
8346 ];
8347 /** @nocollapse */
8348 ApplicationRef_.ctorParameters = function () { return [
8349 { type: NgZone, },
8350 { type: Console, },
8351 { type: Injector, },
8352 { type: ErrorHandler, },
8353 { type: ComponentFactoryResolver, },
8354 { type: ApplicationInitStatus, },
8355 { type: TestabilityRegistry, decorators: [{ type: Optional },] },
8356 { type: Testability, decorators: [{ type: Optional },] },
8357 ]; };
8358 return ApplicationRef_;
8359 }(ApplicationRef));
8360
8361 /**
8362 * @license
8363 * Copyright Google Inc. All Rights Reserved.
8364 *
8365 * Use of this source code is governed by an MIT-style license that can be
8366 * found in the LICENSE file at https://angular.io/license
8367 */
8368 var __extends$9 = (this && this.__extends) || function (d, b) {
8369 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
8370 function __() { this.constructor = d; }
8371 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
8372 };
8373 /**
8374 * Represents an instance of an NgModule created via a {\@link NgModuleFactory}.
8375 *
8376 * `NgModuleRef` provides access to the NgModule Instance as well other objects related to this
8377 * NgModule Instance.
8378 *
8379 * \@stable
8380 * @abstract
8381 */
8382 var NgModuleRef = (function () {
8383 function NgModuleRef() {
8384 }
8385 /**
8386 * The injector that contains all of the providers of the NgModule.
8387 * @abstract
8388 * @return {?}
8389 */
8390 NgModuleRef.prototype.injector = function () { };
8391 /**
8392 * The ComponentFactoryResolver to get hold of the ComponentFactories
8393 * declared in the `entryComponents` property of the module.
8394 * @abstract
8395 * @return {?}
8396 */
8397 NgModuleRef.prototype.componentFactoryResolver = function () { };
8398 /**
8399 * The NgModule instance.
8400 * @abstract
8401 * @return {?}
8402 */
8403 NgModuleRef.prototype.instance = function () { };
8404 /**
8405 * Destroys the module instance and all of the data structures associated with it.
8406 * @abstract
8407 * @return {?}
8408 */
8409 NgModuleRef.prototype.destroy = function () { };
8410 /**
8411 * Allows to register a callback that will be called when the module is destroyed.
8412 * @abstract
8413 * @param {?} callback
8414 * @return {?}
8415 */
8416 NgModuleRef.prototype.onDestroy = function (callback) { };
8417 return NgModuleRef;
8418 }());
8419 /**
8420 * \@experimental
8421 */
8422 var NgModuleFactory = (function () {
8423 /**
8424 * @param {?} _injectorClass
8425 * @param {?} _moduleType
8426 */
8427 function NgModuleFactory(_injectorClass, _moduleType) {
8428 this._injectorClass = _injectorClass;
8429 this._moduleType = _moduleType;
8430 }
8431 Object.defineProperty(NgModuleFactory.prototype, "moduleType", {
8432 /**
8433 * @return {?}
8434 */
8435 get: function () { return this._moduleType; },
8436 enumerable: true,
8437 configurable: true
8438 });
8439 /**
8440 * @param {?} parentInjector
8441 * @return {?}
8442 */
8443 NgModuleFactory.prototype.create = function (parentInjector) {
8444 if (!parentInjector) {
8445 parentInjector = Injector.NULL;
8446 }
8447 var /** @type {?} */ instance = new this._injectorClass(parentInjector);
8448 instance.create();
8449 return instance;
8450 };
8451 return NgModuleFactory;
8452 }());
8453 var /** @type {?} */ _UNDEFINED = new Object();
8454 /**
8455 * @abstract
8456 */
8457 var NgModuleInjector = (function (_super) {
8458 __extends$9(NgModuleInjector, _super);
8459 /**
8460 * @param {?} parent
8461 * @param {?} factories
8462 * @param {?} bootstrapFactories
8463 */
8464 function NgModuleInjector(parent, factories, bootstrapFactories) {
8465 _super.call(this, factories, parent.get(ComponentFactoryResolver, ComponentFactoryResolver.NULL));
8466 this.parent = parent;
8467 this.bootstrapFactories = bootstrapFactories;
8468 this._destroyListeners = [];
8469 this._destroyed = false;
8470 }
8471 /**
8472 * @return {?}
8473 */
8474 NgModuleInjector.prototype.create = function () { this.instance = this.createInternal(); };
8475 /**
8476 * @abstract
8477 * @return {?}
8478 */
8479 NgModuleInjector.prototype.createInternal = function () { };
8480 /**
8481 * @param {?} token
8482 * @param {?=} notFoundValue
8483 * @return {?}
8484 */
8485 NgModuleInjector.prototype.get = function (token, notFoundValue) {
8486 if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; }
8487 if (token === Injector || token === ComponentFactoryResolver) {
8488 return this;
8489 }
8490 var /** @type {?} */ result = this.getInternal(token, _UNDEFINED);
8491 return result === _UNDEFINED ? this.parent.get(token, notFoundValue) : result;
8492 };
8493 /**
8494 * @abstract
8495 * @param {?} token
8496 * @param {?} notFoundValue
8497 * @return {?}
8498 */
8499 NgModuleInjector.prototype.getInternal = function (token, notFoundValue) { };
8500 Object.defineProperty(NgModuleInjector.prototype, "injector", {
8501 /**
8502 * @return {?}
8503 */
8504 get: function () { return this; },
8505 enumerable: true,
8506 configurable: true
8507 });
8508 Object.defineProperty(NgModuleInjector.prototype, "componentFactoryResolver", {
8509 /**
8510 * @return {?}
8511 */
8512 get: function () { return this; },
8513 enumerable: true,
8514 configurable: true
8515 });
8516 /**
8517 * @return {?}
8518 */
8519 NgModuleInjector.prototype.destroy = function () {
8520 if (this._destroyed) {
8521 throw new Error("The ng module " + stringify(this.instance.constructor) + " has already been destroyed.");
8522 }
8523 this._destroyed = true;
8524 this.destroyInternal();
8525 this._destroyListeners.forEach(function (listener) { return listener(); });
8526 };
8527 /**
8528 * @param {?} callback
8529 * @return {?}
8530 */
8531 NgModuleInjector.prototype.onDestroy = function (callback) { this._destroyListeners.push(callback); };
8532 /**
8533 * @abstract
8534 * @return {?}
8535 */
8536 NgModuleInjector.prototype.destroyInternal = function () { };
8537 return NgModuleInjector;
8538 }(CodegenComponentFactoryResolver));
8539
8540 /**
8541 * @license
8542 * Copyright Google Inc. All Rights Reserved.
8543 *
8544 * Use of this source code is governed by an MIT-style license that can be
8545 * found in the LICENSE file at https://angular.io/license
8546 */
8547 /**
8548 * Used to load ng module factories.
8549 * \@stable
8550 * @abstract
8551 */
8552 var NgModuleFactoryLoader = (function () {
8553 function NgModuleFactoryLoader() {
8554 }
8555 /**
8556 * @abstract
8557 * @param {?} path
8558 * @return {?}
8559 */
8560 NgModuleFactoryLoader.prototype.load = function (path) { };
8561 return NgModuleFactoryLoader;
8562 }());
8563 var /** @type {?} */ moduleFactories = new Map();
8564 /**
8565 * Registers a loaded module. Should only be called from generated NgModuleFactory code.
8566 * \@experimental
8567 * @param {?} id
8568 * @param {?} factory
8569 * @return {?}
8570 */
8571 function registerModuleFactory(id, factory) {
8572 var /** @type {?} */ existing = moduleFactories.get(id);
8573 if (existing) {
8574 throw new Error("Duplicate module registered for " + id + " - " + existing.moduleType.name + " vs " + factory.moduleType.name);
8575 }
8576 moduleFactories.set(id, factory);
8577 }
8578 /**
8579 * Returns the NgModuleFactory with the given id, if it exists and has been loaded.
8580 * Factories for modules that do not specify an `id` cannot be retrieved. Throws if the module
8581 * cannot be found.
8582 * \@experimental
8583 * @param {?} id
8584 * @return {?}
8585 */
8586 function getModuleFactory(id) {
8587 var /** @type {?} */ factory = moduleFactories.get(id);
8588 if (!factory)
8589 throw new Error("No module with ID " + id + " loaded");
8590 return factory;
8591 }
8592
8593 /**
8594 * An unmodifiable list of items that Angular keeps up to date when the state
8595 * of the application changes.
8596 *
8597 * The type of object that {\@link Query} and {\@link ViewQueryMetadata} provide.
8598 *
8599 * Implements an iterable interface, therefore it can be used in both ES6
8600 * javascript `for (var i of items)` loops as well as in Angular templates with
8601 * `*ngFor="let i of myList"`.
8602 *
8603 * Changes can be observed by subscribing to the changes `Observable`.
8604 *
8605 * NOTE: In the future this class will implement an `Observable` interface.
8606 *
8607 * ### Example ([live demo](http://plnkr.co/edit/RX8sJnQYl9FWuSCWme5z?p=preview))
8608 * ```typescript
8609 * \@Component({...})
8610 * class Container {
8611 * \@ViewChildren(Item) items:QueryList<Item>;
8612 * }
8613 * ```
8614 * \@stable
8615 */
8616 var QueryList = (function () {
8617 function QueryList() {
8618 this._dirty = true;
8619 this._results = [];
8620 this._emitter = new EventEmitter();
8621 }
8622 Object.defineProperty(QueryList.prototype, "changes", {
8623 /**
8624 * @return {?}
8625 */
8626 get: function () { return this._emitter; },
8627 enumerable: true,
8628 configurable: true
8629 });
8630 Object.defineProperty(QueryList.prototype, "length", {
8631 /**
8632 * @return {?}
8633 */
8634 get: function () { return this._results.length; },
8635 enumerable: true,
8636 configurable: true
8637 });
8638 Object.defineProperty(QueryList.prototype, "first", {
8639 /**
8640 * @return {?}
8641 */
8642 get: function () { return this._results[0]; },
8643 enumerable: true,
8644 configurable: true
8645 });
8646 Object.defineProperty(QueryList.prototype, "last", {
8647 /**
8648 * @return {?}
8649 */
8650 get: function () { return this._results[this.length - 1]; },
8651 enumerable: true,
8652 configurable: true
8653 });
8654 /**
8655 * See
8656 * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
8657 * @param {?} fn
8658 * @return {?}
8659 */
8660 QueryList.prototype.map = function (fn) { return this._results.map(fn); };
8661 /**
8662 * See
8663 * [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
8664 * @param {?} fn
8665 * @return {?}
8666 */
8667 QueryList.prototype.filter = function (fn) {
8668 return this._results.filter(fn);
8669 };
8670 /**
8671 * See
8672 * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
8673 * @param {?} fn
8674 * @return {?}
8675 */
8676 QueryList.prototype.find = function (fn) { return this._results.find(fn); };
8677 /**
8678 * See
8679 * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
8680 * @param {?} fn
8681 * @param {?} init
8682 * @return {?}
8683 */
8684 QueryList.prototype.reduce = function (fn, init) {
8685 return this._results.reduce(fn, init);
8686 };
8687 /**
8688 * See
8689 * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
8690 * @param {?} fn
8691 * @return {?}
8692 */
8693 QueryList.prototype.forEach = function (fn) { this._results.forEach(fn); };
8694 /**
8695 * See
8696 * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
8697 * @param {?} fn
8698 * @return {?}
8699 */
8700 QueryList.prototype.some = function (fn) {
8701 return this._results.some(fn);
8702 };
8703 /**
8704 * @return {?}
8705 */
8706 QueryList.prototype.toArray = function () { return this._results.slice(); };
8707 /**
8708 * @return {?}
8709 */
8710 QueryList.prototype[getSymbolIterator()] = function () { return ((this._results))[getSymbolIterator()](); };
8711 /**
8712 * @return {?}
8713 */
8714 QueryList.prototype.toString = function () { return this._results.toString(); };
8715 /**
8716 * @param {?} res
8717 * @return {?}
8718 */
8719 QueryList.prototype.reset = function (res) {
8720 this._results = ListWrapper.flatten(res);
8721 this._dirty = false;
8722 };
8723 /**
8724 * @return {?}
8725 */
8726 QueryList.prototype.notifyOnChanges = function () { this._emitter.emit(this); };
8727 /**
8728 * internal
8729 * @return {?}
8730 */
8731 QueryList.prototype.setDirty = function () { this._dirty = true; };
8732 Object.defineProperty(QueryList.prototype, "dirty", {
8733 /**
8734 * internal
8735 * @return {?}
8736 */
8737 get: function () { return this._dirty; },
8738 enumerable: true,
8739 configurable: true
8740 });
8741 return QueryList;
8742 }());
8743
8744 var /** @type {?} */ _SEPARATOR = '#';
8745 var /** @type {?} */ FACTORY_CLASS_SUFFIX = 'NgFactory';
8746 /**
8747 * Configuration for SystemJsNgModuleLoader.
8748 * token.
8749 *
8750 * \@experimental
8751 * @abstract
8752 */
8753 var SystemJsNgModuleLoaderConfig = (function () {
8754 function SystemJsNgModuleLoaderConfig() {
8755 }
8756 return SystemJsNgModuleLoaderConfig;
8757 }());
8758 var /** @type {?} */ DEFAULT_CONFIG = {
8759 factoryPathPrefix: '',
8760 factoryPathSuffix: '.ngfactory',
8761 };
8762 /**
8763 * NgModuleFactoryLoader that uses SystemJS to load NgModuleFactory
8764 * \@experimental
8765 */
8766 var SystemJsNgModuleLoader = (function () {
8767 /**
8768 * @param {?} _compiler
8769 * @param {?=} config
8770 */
8771 function SystemJsNgModuleLoader(_compiler, config) {
8772 this._compiler = _compiler;
8773 this._config = config || DEFAULT_CONFIG;
8774 }
8775 /**
8776 * @param {?} path
8777 * @return {?}
8778 */
8779 SystemJsNgModuleLoader.prototype.load = function (path) {
8780 var /** @type {?} */ offlineMode = this._compiler instanceof Compiler;
8781 return offlineMode ? this.loadFactory(path) : this.loadAndCompile(path);
8782 };
8783 /**
8784 * @param {?} path
8785 * @return {?}
8786 */
8787 SystemJsNgModuleLoader.prototype.loadAndCompile = function (path) {
8788 var _this = this;
8789 var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1];
8790 if (exportName === undefined) {
8791 exportName = 'default';
8792 }
8793 return System.import(module)
8794 .then(function (module) { return module[exportName]; })
8795 .then(function (type) { return checkNotEmpty(type, module, exportName); })
8796 .then(function (type) { return _this._compiler.compileModuleAsync(type); });
8797 };
8798 /**
8799 * @param {?} path
8800 * @return {?}
8801 */
8802 SystemJsNgModuleLoader.prototype.loadFactory = function (path) {
8803 var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1];
8804 var /** @type {?} */ factoryClassSuffix = FACTORY_CLASS_SUFFIX;
8805 if (exportName === undefined) {
8806 exportName = 'default';
8807 factoryClassSuffix = '';
8808 }
8809 return System.import(this._config.factoryPathPrefix + module + this._config.factoryPathSuffix)
8810 .then(function (module) { return module[exportName + factoryClassSuffix]; })
8811 .then(function (factory) { return checkNotEmpty(factory, module, exportName); });
8812 };
8813 SystemJsNgModuleLoader.decorators = [
8814 { type: Injectable },
8815 ];
8816 /** @nocollapse */
8817 SystemJsNgModuleLoader.ctorParameters = function () { return [
8818 { type: Compiler, },
8819 { type: SystemJsNgModuleLoaderConfig, decorators: [{ type: Optional },] },
8820 ]; };
8821 return SystemJsNgModuleLoader;
8822 }());
8823 /**
8824 * @param {?} value
8825 * @param {?} modulePath
8826 * @param {?} exportName
8827 * @return {?}
8828 */
8829 function checkNotEmpty(value, modulePath, exportName) {
8830 if (!value) {
8831 throw new Error("Cannot find '" + exportName + "' in '" + modulePath + "'");
8832 }
8833 return value;
8834 }
8835
8836 /**
8837 * @license
8838 * Copyright Google Inc. All Rights Reserved.
8839 *
8840 * Use of this source code is governed by an MIT-style license that can be
8841 * found in the LICENSE file at https://angular.io/license
8842 */
8843 var __extends$10 = (this && this.__extends) || function (d, b) {
8844 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
8845 function __() { this.constructor = d; }
8846 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
8847 };
8848 /**
8849 * Represents an Embedded Template that can be used to instantiate Embedded Views.
8850 *
8851 * You can access a `TemplateRef`, in two ways. Via a directive placed on a `<template>` element (or
8852 * directive prefixed with `*`) and have the `TemplateRef` for this Embedded View injected into the
8853 * constructor of the directive using the `TemplateRef` Token. Alternatively you can query for the
8854 * `TemplateRef` from a Component or a Directive via {\@link Query}.
8855 *
8856 * To instantiate Embedded Views based on a Template, use
8857 * {\@link ViewContainerRef#createEmbeddedView}, which will create the View and attach it to the
8858 * View Container.
8859 * \@stable
8860 * @abstract
8861 */
8862 var TemplateRef = (function () {
8863 function TemplateRef() {
8864 }
8865 /**
8866 * @abstract
8867 * @return {?}
8868 */
8869 TemplateRef.prototype.elementRef = function () { };
8870 /**
8871 * @abstract
8872 * @param {?} context
8873 * @return {?}
8874 */
8875 TemplateRef.prototype.createEmbeddedView = function (context) { };
8876 return TemplateRef;
8877 }());
8878 var TemplateRef_ = (function (_super) {
8879 __extends$10(TemplateRef_, _super);
8880 /**
8881 * @param {?} _parentView
8882 * @param {?} _nodeIndex
8883 * @param {?} _nativeElement
8884 */
8885 function TemplateRef_(_parentView, _nodeIndex, _nativeElement) {
8886 _super.call(this);
8887 this._parentView = _parentView;
8888 this._nodeIndex = _nodeIndex;
8889 this._nativeElement = _nativeElement;
8890 }
8891 /**
8892 * @param {?} context
8893 * @return {?}
8894 */
8895 TemplateRef_.prototype.createEmbeddedView = function (context) {
8896 var /** @type {?} */ view = this._parentView.createEmbeddedViewInternal(this._nodeIndex);
8897 view.create(context || ({}));
8898 return view.ref;
8899 };
8900 Object.defineProperty(TemplateRef_.prototype, "elementRef", {
8901 /**
8902 * @return {?}
8903 */
8904 get: function () { return new ElementRef(this._nativeElement); },
8905 enumerable: true,
8906 configurable: true
8907 });
8908 return TemplateRef_;
8909 }(TemplateRef));
8910
8911 /**
8912 * Represents a container where one or more Views can be attached.
8913 *
8914 * The container can contain two kinds of Views. Host Views, created by instantiating a
8915 * {\@link Component} via {\@link #createComponent}, and Embedded Views, created by instantiating an
8916 * {\@link TemplateRef Embedded Template} via {\@link #createEmbeddedView}.
8917 *
8918 * The location of the View Container within the containing View is specified by the Anchor
8919 * `element`. Each View Container can have only one Anchor Element and each Anchor Element can only
8920 * have a single View Container.
8921 *
8922 * Root elements of Views attached to this container become siblings of the Anchor Element in
8923 * the Rendered View.
8924 *
8925 * To access a `ViewContainerRef` of an Element, you can either place a {\@link Directive} injected
8926 * with `ViewContainerRef` on the Element, or you obtain it via a {\@link ViewChild} query.
8927 * \@stable
8928 * @abstract
8929 */
8930 var ViewContainerRef = (function () {
8931 function ViewContainerRef() {
8932 }
8933 /**
8934 * Anchor element that specifies the location of this container in the containing View.
8935 * <!-- TODO: rename to anchorElement -->
8936 * @abstract
8937 * @return {?}
8938 */
8939 ViewContainerRef.prototype.element = function () { };
8940 /**
8941 * @abstract
8942 * @return {?}
8943 */
8944 ViewContainerRef.prototype.injector = function () { };
8945 /**
8946 * @abstract
8947 * @return {?}
8948 */
8949 ViewContainerRef.prototype.parentInjector = function () { };
8950 /**
8951 * Destroys all Views in this container.
8952 * @abstract
8953 * @return {?}
8954 */
8955 ViewContainerRef.prototype.clear = function () { };
8956 /**
8957 * Returns the {\@link ViewRef} for the View located in this container at the specified index.
8958 * @abstract
8959 * @param {?} index
8960 * @return {?}
8961 */
8962 ViewContainerRef.prototype.get = function (index) { };
8963 /**
8964 * Returns the number of Views currently attached to this container.
8965 * @abstract
8966 * @return {?}
8967 */
8968 ViewContainerRef.prototype.length = function () { };
8969 /**
8970 * Instantiates an Embedded View based on the {\@link TemplateRef `templateRef`} and inserts it
8971 * into this container at the specified `index`.
8972 *
8973 * If `index` is not specified, the new View will be inserted as the last View in the container.
8974 *
8975 * Returns the {\@link ViewRef} for the newly created View.
8976 * @abstract
8977 * @param {?} templateRef
8978 * @param {?=} context
8979 * @param {?=} index
8980 * @return {?}
8981 */
8982 ViewContainerRef.prototype.createEmbeddedView = function (templateRef, context, index) { };
8983 /**
8984 * Instantiates a single {\@link Component} and inserts its Host View into this container at the
8985 * specified `index`.
8986 *
8987 * The component is instantiated using its {\@link ComponentFactory} which can be
8988 * obtained via {\@link ComponentFactoryResolver#resolveComponentFactory}.
8989 *
8990 * If `index` is not specified, the new View will be inserted as the last View in the container.
8991 *
8992 * You can optionally specify the {\@link Injector} that will be used as parent for the Component.
8993 *
8994 * Returns the {\@link ComponentRef} of the Host View created for the newly instantiated Component.
8995 * @abstract
8996 * @param {?} componentFactory
8997 * @param {?=} index
8998 * @param {?=} injector
8999 * @param {?=} projectableNodes
9000 * @return {?}
9001 */
9002 ViewContainerRef.prototype.createComponent = function (componentFactory, index, injector, projectableNodes) { };
9003 /**
9004 * Inserts a View identified by a {\@link ViewRef} into the container at the specified `index`.
9005 *
9006 * If `index` is not specified, the new View will be inserted as the last View in the container.
9007 *
9008 * Returns the inserted {\@link ViewRef}.
9009 * @abstract
9010 * @param {?} viewRef
9011 * @param {?=} index
9012 * @return {?}
9013 */
9014 ViewContainerRef.prototype.insert = function (viewRef, index) { };
9015 /**
9016 * Moves a View identified by a {\@link ViewRef} into the container at the specified `index`.
9017 *
9018 * Returns the inserted {\@link ViewRef}.
9019 * @abstract
9020 * @param {?} viewRef
9021 * @param {?} currentIndex
9022 * @return {?}
9023 */
9024 ViewContainerRef.prototype.move = function (viewRef, currentIndex) { };
9025 /**
9026 * Returns the index of the View, specified via {\@link ViewRef}, within the current container or
9027 * `-1` if this container doesn't contain the View.
9028 * @abstract
9029 * @param {?} viewRef
9030 * @return {?}
9031 */
9032 ViewContainerRef.prototype.indexOf = function (viewRef) { };
9033 /**
9034 * Destroys a View attached to this container at the specified `index`.
9035 *
9036 * If `index` is not specified, the last View in the container will be removed.
9037 * @abstract
9038 * @param {?=} index
9039 * @return {?}
9040 */
9041 ViewContainerRef.prototype.remove = function (index) { };
9042 /**
9043 * Use along with {\@link #insert} to move a View within the current container.
9044 *
9045 * If the `index` param is omitted, the last {\@link ViewRef} is detached.
9046 * @abstract
9047 * @param {?=} index
9048 * @return {?}
9049 */
9050 ViewContainerRef.prototype.detach = function (index) { };
9051 return ViewContainerRef;
9052 }());
9053 var ViewContainerRef_ = (function () {
9054 /**
9055 * @param {?} _element
9056 */
9057 function ViewContainerRef_(_element) {
9058 this._element = _element;
9059 /** @internal */
9060 this._createComponentInContainerScope = wtfCreateScope('ViewContainerRef#createComponent()');
9061 /** @internal */
9062 this._insertScope = wtfCreateScope('ViewContainerRef#insert()');
9063 /** @internal */
9064 this._removeScope = wtfCreateScope('ViewContainerRef#remove()');
9065 /** @internal */
9066 this._detachScope = wtfCreateScope('ViewContainerRef#detach()');
9067 }
9068 /**
9069 * @param {?} index
9070 * @return {?}
9071 */
9072 ViewContainerRef_.prototype.get = function (index) { return this._element.nestedViews[index].ref; };
9073 Object.defineProperty(ViewContainerRef_.prototype, "length", {
9074 /**
9075 * @return {?}
9076 */
9077 get: function () {
9078 var /** @type {?} */ views = this._element.nestedViews;
9079 return isPresent(views) ? views.length : 0;
9080 },
9081 enumerable: true,
9082 configurable: true
9083 });
9084 Object.defineProperty(ViewContainerRef_.prototype, "element", {
9085 /**
9086 * @return {?}
9087 */
9088 get: function () { return this._element.elementRef; },
9089 enumerable: true,
9090 configurable: true
9091 });
9092 Object.defineProperty(ViewContainerRef_.prototype, "injector", {
9093 /**
9094 * @return {?}
9095 */
9096 get: function () { return this._element.injector; },
9097 enumerable: true,
9098 configurable: true
9099 });
9100 Object.defineProperty(ViewContainerRef_.prototype, "parentInjector", {
9101 /**
9102 * @return {?}
9103 */
9104 get: function () { return this._element.parentInjector; },
9105 enumerable: true,
9106 configurable: true
9107 });
9108 /**
9109 * @param {?} templateRef
9110 * @param {?=} context
9111 * @param {?=} index
9112 * @return {?}
9113 */
9114 ViewContainerRef_.prototype.createEmbeddedView = function (templateRef, context, index) {
9115 if (context === void 0) { context = null; }
9116 if (index === void 0) { index = -1; }
9117 var /** @type {?} */ viewRef = templateRef.createEmbeddedView(context);
9118 this.insert(viewRef, index);
9119 return viewRef;
9120 };
9121 /**
9122 * @param {?} componentFactory
9123 * @param {?=} index
9124 * @param {?=} injector
9125 * @param {?=} projectableNodes
9126 * @return {?}
9127 */
9128 ViewContainerRef_.prototype.createComponent = function (componentFactory, index, injector, projectableNodes) {
9129 if (index === void 0) { index = -1; }
9130 if (injector === void 0) { injector = null; }
9131 if (projectableNodes === void 0) { projectableNodes = null; }
9132 var /** @type {?} */ s = this._createComponentInContainerScope();
9133 var /** @type {?} */ contextInjector = injector || this._element.parentInjector;
9134 var /** @type {?} */ componentRef = componentFactory.create(contextInjector, projectableNodes);
9135 this.insert(componentRef.hostView, index);
9136 return wtfLeave(s, componentRef);
9137 };
9138 /**
9139 * @param {?} viewRef
9140 * @param {?=} index
9141 * @return {?}
9142 */
9143 ViewContainerRef_.prototype.insert = function (viewRef, index) {
9144 if (index === void 0) { index = -1; }
9145 var /** @type {?} */ s = this._insertScope();
9146 if (index == -1)
9147 index = this.length;
9148 var /** @type {?} */ viewRef_ = (viewRef);
9149 this._element.attachView(viewRef_.internalView, index);
9150 return wtfLeave(s, viewRef_);
9151 };
9152 /**
9153 * @param {?} viewRef
9154 * @param {?} currentIndex
9155 * @return {?}
9156 */
9157 ViewContainerRef_.prototype.move = function (viewRef, currentIndex) {
9158 var /** @type {?} */ s = this._insertScope();
9159 if (currentIndex == -1)
9160 return;
9161 var /** @type {?} */ viewRef_ = (viewRef);
9162 this._element.moveView(viewRef_.internalView, currentIndex);
9163 return wtfLeave(s, viewRef_);
9164 };
9165 /**
9166 * @param {?} viewRef
9167 * @return {?}
9168 */
9169 ViewContainerRef_.prototype.indexOf = function (viewRef) {
9170 return this.length ? this._element.nestedViews.indexOf(((viewRef)).internalView) :
9171 -1;
9172 };
9173 /**
9174 * @param {?=} index
9175 * @return {?}
9176 */
9177 ViewContainerRef_.prototype.remove = function (index) {
9178 if (index === void 0) { index = -1; }
9179 var /** @type {?} */ s = this._removeScope();
9180 if (index == -1)
9181 index = this.length - 1;
9182 var /** @type {?} */ view = this._element.detachView(index);
9183 view.destroy();
9184 // view is intentionally not returned to the client.
9185 wtfLeave(s);
9186 };
9187 /**
9188 * @param {?=} index
9189 * @return {?}
9190 */
9191 ViewContainerRef_.prototype.detach = function (index) {
9192 if (index === void 0) { index = -1; }
9193 var /** @type {?} */ s = this._detachScope();
9194 if (index == -1)
9195 index = this.length - 1;
9196 var /** @type {?} */ view = this._element.detachView(index);
9197 return wtfLeave(s, view.ref);
9198 };
9199 /**
9200 * @return {?}
9201 */
9202 ViewContainerRef_.prototype.clear = function () {
9203 for (var /** @type {?} */ i = this.length - 1; i >= 0; i--) {
9204 this.remove(i);
9205 }
9206 };
9207 return ViewContainerRef_;
9208 }());
9209
9210 /**
9211 * @license
9212 * Copyright Google Inc. All Rights Reserved.
9213 *
9214 * Use of this source code is governed by an MIT-style license that can be
9215 * found in the LICENSE file at https://angular.io/license
9216 */
9217 var __extends$11 = (this && this.__extends) || function (d, b) {
9218 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
9219 function __() { this.constructor = d; }
9220 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
9221 };
9222 /**
9223 * \@stable
9224 * @abstract
9225 */
9226 var ViewRef = (function (_super) {
9227 __extends$11(ViewRef, _super);
9228 function ViewRef() {
9229 _super.apply(this, arguments);
9230 }
9231 /**
9232 * Destroys the view and all of the data structures associated with it.
9233 * @abstract
9234 * @return {?}
9235 */
9236 ViewRef.prototype.destroy = function () { };
9237 /**
9238 * @abstract
9239 * @return {?}
9240 */
9241 ViewRef.prototype.destroyed = function () { };
9242 /**
9243 * @abstract
9244 * @param {?} callback
9245 * @return {?}
9246 */
9247 ViewRef.prototype.onDestroy = function (callback) { };
9248 return ViewRef;
9249 }(ChangeDetectorRef));
9250 /**
9251 * Represents an Angular View.
9252 *
9253 * <!-- TODO: move the next two paragraphs to the dev guide -->
9254 * A View is a fundamental building block of the application UI. It is the smallest grouping of
9255 * Elements which are created and destroyed together.
9256 *
9257 * Properties of elements in a View can change, but the structure (number and order) of elements in
9258 * a View cannot. Changing the structure of Elements can only be done by inserting, moving or
9259 * removing nested Views via a {\@link ViewContainerRef}. Each View can contain many View Containers.
9260 * <!-- /TODO -->
9261 *
9262 * ### Example
9263 *
9264 * Given this template...
9265 *
9266 * ```
9267 * Count: {{items.length}}
9268 * <ul>
9269 * <li *ngFor="let item of items">{{item}}</li>
9270 * </ul>
9271 * ```
9272 *
9273 * We have two {\@link TemplateRef}s:
9274 *
9275 * Outer {\@link TemplateRef}:
9276 * ```
9277 * Count: {{items.length}}
9278 * <ul>
9279 * <template ngFor let-item [ngForOf]="items"></template>
9280 * </ul>
9281 * ```
9282 *
9283 * Inner {\@link TemplateRef}:
9284 * ```
9285 * <li>{{item}}</li>
9286 * ```
9287 *
9288 * Notice that the original template is broken down into two separate {\@link TemplateRef}s.
9289 *
9290 * The outer/inner {\@link TemplateRef}s are then assembled into views like so:
9291 *
9292 * ```
9293 * <!-- ViewRef: outer-0 -->
9294 * Count: 2
9295 * <ul>
9296 * <template view-container-ref></template>
9297 * <!-- ViewRef: inner-1 --><li>first</li><!-- /ViewRef: inner-1 -->
9298 * <!-- ViewRef: inner-2 --><li>second</li><!-- /ViewRef: inner-2 -->
9299 * </ul>
9300 * <!-- /ViewRef: outer-0 -->
9301 * ```
9302 * \@experimental
9303 * @abstract
9304 */
9305 var EmbeddedViewRef = (function (_super) {
9306 __extends$11(EmbeddedViewRef, _super);
9307 function EmbeddedViewRef() {
9308 _super.apply(this, arguments);
9309 }
9310 /**
9311 * @abstract
9312 * @return {?}
9313 */
9314 EmbeddedViewRef.prototype.context = function () { };
9315 /**
9316 * @abstract
9317 * @return {?}
9318 */
9319 EmbeddedViewRef.prototype.rootNodes = function () { };
9320 return EmbeddedViewRef;
9321 }(ViewRef));
9322 var ViewRef_ = (function () {
9323 /**
9324 * @param {?} _view
9325 * @param {?} animationQueue
9326 */
9327 function ViewRef_(_view, animationQueue) {
9328 this._view = _view;
9329 this.animationQueue = animationQueue;
9330 this._view = _view;
9331 this._originalMode = this._view.cdMode;
9332 }
9333 Object.defineProperty(ViewRef_.prototype, "internalView", {
9334 /**
9335 * @return {?}
9336 */
9337 get: function () { return this._view; },
9338 enumerable: true,
9339 configurable: true
9340 });
9341 Object.defineProperty(ViewRef_.prototype, "rootNodes", {
9342 /**
9343 * @return {?}
9344 */
9345 get: function () { return this._view.flatRootNodes; },
9346 enumerable: true,
9347 configurable: true
9348 });
9349 Object.defineProperty(ViewRef_.prototype, "context", {
9350 /**
9351 * @return {?}
9352 */
9353 get: function () { return this._view.context; },
9354 enumerable: true,
9355 configurable: true
9356 });
9357 Object.defineProperty(ViewRef_.prototype, "destroyed", {
9358 /**
9359 * @return {?}
9360 */
9361 get: function () { return this._view.destroyed; },
9362 enumerable: true,
9363 configurable: true
9364 });
9365 /**
9366 * @return {?}
9367 */
9368 ViewRef_.prototype.markForCheck = function () { this._view.markPathToRootAsCheckOnce(); };
9369 /**
9370 * @return {?}
9371 */
9372 ViewRef_.prototype.detach = function () { this._view.cdMode = ChangeDetectorStatus.Detached; };
9373 /**
9374 * @return {?}
9375 */
9376 ViewRef_.prototype.detectChanges = function () {
9377 this._view.detectChanges(false);
9378 this.animationQueue.flush();
9379 };
9380 /**
9381 * @return {?}
9382 */
9383 ViewRef_.prototype.checkNoChanges = function () { this._view.detectChanges(true); };
9384 /**
9385 * @return {?}
9386 */
9387 ViewRef_.prototype.reattach = function () {
9388 this._view.cdMode = this._originalMode;
9389 this.markForCheck();
9390 };
9391 /**
9392 * @param {?} callback
9393 * @return {?}
9394 */
9395 ViewRef_.prototype.onDestroy = function (callback) {
9396 if (!this._view.disposables) {
9397 this._view.disposables = [];
9398 }
9399 this._view.disposables.push(callback);
9400 };
9401 /**
9402 * @return {?}
9403 */
9404 ViewRef_.prototype.destroy = function () { this._view.detachAndDestroy(); };
9405 return ViewRef_;
9406 }());
9407
9408 /**
9409 * @license
9410 * Copyright Google Inc. All Rights Reserved.
9411 *
9412 * Use of this source code is governed by an MIT-style license that can be
9413 * found in the LICENSE file at https://angular.io/license
9414 */
9415 var __extends$12 = (this && this.__extends) || function (d, b) {
9416 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
9417 function __() { this.constructor = d; }
9418 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
9419 };
9420 var EventListener = (function () {
9421 /**
9422 * @param {?} name
9423 * @param {?} callback
9424 */
9425 function EventListener(name, callback) {
9426 this.name = name;
9427 this.callback = callback;
9428 }
9429 ;
9430 return EventListener;
9431 }());
9432 /**
9433 * \@experimental All debugging apis are currently experimental.
9434 */
9435 var DebugNode = (function () {
9436 /**
9437 * @param {?} nativeNode
9438 * @param {?} parent
9439 * @param {?} _debugInfo
9440 */
9441 function DebugNode(nativeNode, parent, _debugInfo) {
9442 this._debugInfo = _debugInfo;
9443 this.nativeNode = nativeNode;
9444 if (parent && parent instanceof DebugElement) {
9445 parent.addChild(this);
9446 }
9447 else {
9448 this.parent = null;
9449 }
9450 this.listeners = [];
9451 }
9452 Object.defineProperty(DebugNode.prototype, "injector", {
9453 /**
9454 * @return {?}
9455 */
9456 get: function () { return this._debugInfo ? this._debugInfo.injector : null; },
9457 enumerable: true,
9458 configurable: true
9459 });
9460 Object.defineProperty(DebugNode.prototype, "componentInstance", {
9461 /**
9462 * @return {?}
9463 */
9464 get: function () { return this._debugInfo ? this._debugInfo.component : null; },
9465 enumerable: true,
9466 configurable: true
9467 });
9468 Object.defineProperty(DebugNode.prototype, "context", {
9469 /**
9470 * @return {?}
9471 */
9472 get: function () { return this._debugInfo ? this._debugInfo.context : null; },
9473 enumerable: true,
9474 configurable: true
9475 });
9476 Object.defineProperty(DebugNode.prototype, "references", {
9477 /**
9478 * @return {?}
9479 */
9480 get: function () {
9481 return this._debugInfo ? this._debugInfo.references : null;
9482 },
9483 enumerable: true,
9484 configurable: true
9485 });
9486 Object.defineProperty(DebugNode.prototype, "providerTokens", {
9487 /**
9488 * @return {?}
9489 */
9490 get: function () { return this._debugInfo ? this._debugInfo.providerTokens : null; },
9491 enumerable: true,
9492 configurable: true
9493 });
9494 Object.defineProperty(DebugNode.prototype, "source", {
9495 /**
9496 * @return {?}
9497 */
9498 get: function () { return this._debugInfo ? this._debugInfo.source : null; },
9499 enumerable: true,
9500 configurable: true
9501 });
9502 return DebugNode;
9503 }());
9504 /**
9505 * \@experimental All debugging apis are currently experimental.
9506 */
9507 var DebugElement = (function (_super) {
9508 __extends$12(DebugElement, _super);
9509 /**
9510 * @param {?} nativeNode
9511 * @param {?} parent
9512 * @param {?} _debugInfo
9513 */
9514 function DebugElement(nativeNode, parent, _debugInfo) {
9515 _super.call(this, nativeNode, parent, _debugInfo);
9516 this.properties = {};
9517 this.attributes = {};
9518 this.classes = {};
9519 this.styles = {};
9520 this.childNodes = [];
9521 this.nativeElement = nativeNode;
9522 }
9523 /**
9524 * @param {?} child
9525 * @return {?}
9526 */
9527 DebugElement.prototype.addChild = function (child) {
9528 if (child) {
9529 this.childNodes.push(child);
9530 child.parent = this;
9531 }
9532 };
9533 /**
9534 * @param {?} child
9535 * @return {?}
9536 */
9537 DebugElement.prototype.removeChild = function (child) {
9538 var /** @type {?} */ childIndex = this.childNodes.indexOf(child);
9539 if (childIndex !== -1) {
9540 child.parent = null;
9541 this.childNodes.splice(childIndex, 1);
9542 }
9543 };
9544 /**
9545 * @param {?} child
9546 * @param {?} newChildren
9547 * @return {?}
9548 */
9549 DebugElement.prototype.insertChildrenAfter = function (child, newChildren) {
9550 var /** @type {?} */ siblingIndex = this.childNodes.indexOf(child);
9551 if (siblingIndex !== -1) {
9552 var /** @type {?} */ previousChildren = this.childNodes.slice(0, siblingIndex + 1);
9553 var /** @type {?} */ nextChildren = this.childNodes.slice(siblingIndex + 1);
9554 this.childNodes = previousChildren.concat(newChildren, nextChildren);
9555 for (var /** @type {?} */ i = 0; i < newChildren.length; ++i) {
9556 var /** @type {?} */ newChild = newChildren[i];
9557 if (newChild.parent) {
9558 newChild.parent.removeChild(newChild);
9559 }
9560 newChild.parent = this;
9561 }
9562 }
9563 };
9564 /**
9565 * @param {?} predicate
9566 * @return {?}
9567 */
9568 DebugElement.prototype.query = function (predicate) {
9569 var /** @type {?} */ results = this.queryAll(predicate);
9570 return results[0] || null;
9571 };
9572 /**
9573 * @param {?} predicate
9574 * @return {?}
9575 */
9576 DebugElement.prototype.queryAll = function (predicate) {
9577 var /** @type {?} */ matches = [];
9578 _queryElementChildren(this, predicate, matches);
9579 return matches;
9580 };
9581 /**
9582 * @param {?} predicate
9583 * @return {?}
9584 */
9585 DebugElement.prototype.queryAllNodes = function (predicate) {
9586 var /** @type {?} */ matches = [];
9587 _queryNodeChildren(this, predicate, matches);
9588 return matches;
9589 };
9590 Object.defineProperty(DebugElement.prototype, "children", {
9591 /**
9592 * @return {?}
9593 */
9594 get: function () {
9595 return (this.childNodes.filter(function (node) { return node instanceof DebugElement; }));
9596 },
9597 enumerable: true,
9598 configurable: true
9599 });
9600 /**
9601 * @param {?} eventName
9602 * @param {?} eventObj
9603 * @return {?}
9604 */
9605 DebugElement.prototype.triggerEventHandler = function (eventName, eventObj) {
9606 this.listeners.forEach(function (listener) {
9607 if (listener.name == eventName) {
9608 listener.callback(eventObj);
9609 }
9610 });
9611 };
9612 return DebugElement;
9613 }(DebugNode));
9614 /**
9615 * \@experimental
9616 * @param {?} debugEls
9617 * @return {?}
9618 */
9619 function asNativeElements(debugEls) {
9620 return debugEls.map(function (el) { return el.nativeElement; });
9621 }
9622 /**
9623 * @param {?} element
9624 * @param {?} predicate
9625 * @param {?} matches
9626 * @return {?}
9627 */
9628 function _queryElementChildren(element, predicate, matches) {
9629 element.childNodes.forEach(function (node) {
9630 if (node instanceof DebugElement) {
9631 if (predicate(node)) {
9632 matches.push(node);
9633 }
9634 _queryElementChildren(node, predicate, matches);
9635 }
9636 });
9637 }
9638 /**
9639 * @param {?} parentNode
9640 * @param {?} predicate
9641 * @param {?} matches
9642 * @return {?}
9643 */
9644 function _queryNodeChildren(parentNode, predicate, matches) {
9645 if (parentNode instanceof DebugElement) {
9646 parentNode.childNodes.forEach(function (node) {
9647 if (predicate(node)) {
9648 matches.push(node);
9649 }
9650 if (node instanceof DebugElement) {
9651 _queryNodeChildren(node, predicate, matches);
9652 }
9653 });
9654 }
9655 }
9656 // Need to keep the nodes in a global Map so that multiple angular apps are supported.
9657 var /** @type {?} */ _nativeNodeToDebugNode = new Map();
9658 /**
9659 * \@experimental
9660 * @param {?} nativeNode
9661 * @return {?}
9662 */
9663 function getDebugNode(nativeNode) {
9664 return _nativeNodeToDebugNode.get(nativeNode);
9665 }
9666 /**
9667 * @param {?} node
9668 * @return {?}
9669 */
9670 function indexDebugNode(node) {
9671 _nativeNodeToDebugNode.set(node.nativeNode, node);
9672 }
9673 /**
9674 * @param {?} node
9675 * @return {?}
9676 */
9677 function removeDebugNodeFromIndex(node) {
9678 _nativeNodeToDebugNode.delete(node.nativeNode);
9679 }
9680
9681 /**
9682 * @return {?}
9683 */
9684 function _reflector() {
9685 return reflector;
9686 }
9687 var /** @type {?} */ _CORE_PLATFORM_PROVIDERS = [
9688 PlatformRef_,
9689 { provide: PlatformRef, useExisting: PlatformRef_ },
9690 { provide: Reflector, useFactory: _reflector, deps: [] },
9691 { provide: ReflectorReader, useExisting: Reflector },
9692 TestabilityRegistry,
9693 Console,
9694 ];
9695 /**
9696 * This platform has to be included in any other platform
9697 *
9698 * @experimental
9699 */
9700 var /** @type {?} */ platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
9701
9702 /**
9703 * @experimental i18n support is experimental.
9704 */
9705 var /** @type {?} */ LOCALE_ID = new OpaqueToken('LocaleId');
9706 /**
9707 * @experimental i18n support is experimental.
9708 */
9709 var /** @type {?} */ TRANSLATIONS = new OpaqueToken('Translations');
9710 /**
9711 * @experimental i18n support is experimental.
9712 */
9713 var /** @type {?} */ TRANSLATIONS_FORMAT = new OpaqueToken('TranslationsFormat');
9714
9715 /**
9716 * @return {?}
9717 */
9718 function _iterableDiffersFactory() {
9719 return defaultIterableDiffers;
9720 }
9721 /**
9722 * @return {?}
9723 */
9724 function _keyValueDiffersFactory() {
9725 return defaultKeyValueDiffers;
9726 }
9727 /**
9728 * @param {?=} locale
9729 * @return {?}
9730 */
9731 function _localeFactory(locale) {
9732 return locale || 'en-US';
9733 }
9734 /**
9735 * This module includes the providers of \@angular/core that are needed
9736 * to bootstrap components via `ApplicationRef`.
9737 *
9738 * \@experimental
9739 */
9740 var ApplicationModule = (function () {
9741 function ApplicationModule() {
9742 }
9743 ApplicationModule.decorators = [
9744 { type: NgModule, args: [{
9745 providers: [
9746 ApplicationRef_,
9747 { provide: ApplicationRef, useExisting: ApplicationRef_ },
9748 ApplicationInitStatus,
9749 Compiler,
9750 APP_ID_RANDOM_PROVIDER,
9751 ViewUtils,
9752 AnimationQueue,
9753 { provide: IterableDiffers, useFactory: _iterableDiffersFactory },
9754 { provide: KeyValueDiffers, useFactory: _keyValueDiffersFactory },
9755 {
9756 provide: LOCALE_ID,
9757 useFactory: _localeFactory,
9758 deps: [[new Inject(LOCALE_ID), new Optional(), new SkipSelf()]]
9759 },
9760 ]
9761 },] },
9762 ];
9763 /** @nocollapse */
9764 ApplicationModule.ctorParameters = function () { return []; };
9765 return ApplicationModule;
9766 }());
9767
9768 /**
9769 * @license
9770 * Copyright Google Inc. All Rights Reserved.
9771 *
9772 * Use of this source code is governed by an MIT-style license that can be
9773 * found in the LICENSE file at https://angular.io/license
9774 */
9775 var /** @type {?} */ FILL_STYLE_FLAG = 'true'; // TODO (matsko): change to boolean
9776 var /** @type {?} */ ANY_STATE = '*';
9777 var /** @type {?} */ DEFAULT_STATE = '*';
9778 var /** @type {?} */ EMPTY_STATE = 'void';
9779
9780 var AnimationGroupPlayer = (function () {
9781 /**
9782 * @param {?} _players
9783 */
9784 function AnimationGroupPlayer(_players) {
9785 var _this = this;
9786 this._players = _players;
9787 this._onDoneFns = [];
9788 this._onStartFns = [];
9789 this._finished = false;
9790 this._started = false;
9791 this._destroyed = false;
9792 this.parentPlayer = null;
9793 var count = 0;
9794 var total = this._players.length;
9795 if (total == 0) {
9796 scheduleMicroTask(function () { return _this._onFinish(); });
9797 }
9798 else {
9799 this._players.forEach(function (player) {
9800 player.parentPlayer = _this;
9801 player.onDone(function () {
9802 if (++count >= total) {
9803 _this._onFinish();
9804 }
9805 });
9806 });
9807 }
9808 }
9809 /**
9810 * @return {?}
9811 */
9812 AnimationGroupPlayer.prototype._onFinish = function () {
9813 if (!this._finished) {
9814 this._finished = true;
9815 this._onDoneFns.forEach(function (fn) { return fn(); });
9816 this._onDoneFns = [];
9817 }
9818 };
9819 /**
9820 * @return {?}
9821 */
9822 AnimationGroupPlayer.prototype.init = function () { this._players.forEach(function (player) { return player.init(); }); };
9823 /**
9824 * @param {?} fn
9825 * @return {?}
9826 */
9827 AnimationGroupPlayer.prototype.onStart = function (fn) { this._onStartFns.push(fn); };
9828 /**
9829 * @param {?} fn
9830 * @return {?}
9831 */
9832 AnimationGroupPlayer.prototype.onDone = function (fn) { this._onDoneFns.push(fn); };
9833 /**
9834 * @return {?}
9835 */
9836 AnimationGroupPlayer.prototype.hasStarted = function () { return this._started; };
9837 /**
9838 * @return {?}
9839 */
9840 AnimationGroupPlayer.prototype.play = function () {
9841 if (!isPresent(this.parentPlayer)) {
9842 this.init();
9843 }
9844 if (!this.hasStarted()) {
9845 this._onStartFns.forEach(function (fn) { return fn(); });
9846 this._onStartFns = [];
9847 this._started = true;
9848 }
9849 this._players.forEach(function (player) { return player.play(); });
9850 };
9851 /**
9852 * @return {?}
9853 */
9854 AnimationGroupPlayer.prototype.pause = function () { this._players.forEach(function (player) { return player.pause(); }); };
9855 /**
9856 * @return {?}
9857 */
9858 AnimationGroupPlayer.prototype.restart = function () { this._players.forEach(function (player) { return player.restart(); }); };
9859 /**
9860 * @return {?}
9861 */
9862 AnimationGroupPlayer.prototype.finish = function () {
9863 this._onFinish();
9864 this._players.forEach(function (player) { return player.finish(); });
9865 };
9866 /**
9867 * @return {?}
9868 */
9869 AnimationGroupPlayer.prototype.destroy = function () {
9870 if (!this._destroyed) {
9871 this._onFinish();
9872 this._players.forEach(function (player) { return player.destroy(); });
9873 this._destroyed = true;
9874 }
9875 };
9876 /**
9877 * @return {?}
9878 */
9879 AnimationGroupPlayer.prototype.reset = function () {
9880 this._players.forEach(function (player) { return player.reset(); });
9881 this._destroyed = false;
9882 this._finished = false;
9883 this._started = false;
9884 };
9885 /**
9886 * @param {?} p
9887 * @return {?}
9888 */
9889 AnimationGroupPlayer.prototype.setPosition = function (p) {
9890 this._players.forEach(function (player) { player.setPosition(p); });
9891 };
9892 /**
9893 * @return {?}
9894 */
9895 AnimationGroupPlayer.prototype.getPosition = function () {
9896 var /** @type {?} */ min = 0;
9897 this._players.forEach(function (player) {
9898 var /** @type {?} */ p = player.getPosition();
9899 min = Math.min(p, min);
9900 });
9901 return min;
9902 };
9903 Object.defineProperty(AnimationGroupPlayer.prototype, "players", {
9904 /**
9905 * @return {?}
9906 */
9907 get: function () { return this._players; },
9908 enumerable: true,
9909 configurable: true
9910 });
9911 return AnimationGroupPlayer;
9912 }());
9913
9914 /**
9915 * @license
9916 * Copyright Google Inc. All Rights Reserved.
9917 *
9918 * Use of this source code is governed by an MIT-style license that can be
9919 * found in the LICENSE file at https://angular.io/license
9920 */
9921 /**
9922 * `AnimationKeyframe` consists of a series of styles (contained within {\@link AnimationStyles
9923 * `AnimationStyles`})
9924 * and an offset value indicating when those styles are applied within the `duration/delay/easing`
9925 * timings.
9926 * `AnimationKeyframe` is mostly an internal class which is designed to be used alongside {\@link
9927 * Renderer#animate-anchor `Renderer.animate`}.
9928 *
9929 * \@experimental Animation support is experimental
9930 */
9931 var AnimationKeyframe = (function () {
9932 /**
9933 * @param {?} offset
9934 * @param {?} styles
9935 */
9936 function AnimationKeyframe(offset, styles) {
9937 this.offset = offset;
9938 this.styles = styles;
9939 }
9940 return AnimationKeyframe;
9941 }());
9942
9943 /**
9944 * \@experimental Animation support is experimental.
9945 * @abstract
9946 */
9947 var AnimationPlayer = (function () {
9948 function AnimationPlayer() {
9949 }
9950 /**
9951 * @abstract
9952 * @param {?} fn
9953 * @return {?}
9954 */
9955 AnimationPlayer.prototype.onDone = function (fn) { };
9956 /**
9957 * @abstract
9958 * @param {?} fn
9959 * @return {?}
9960 */
9961 AnimationPlayer.prototype.onStart = function (fn) { };
9962 /**
9963 * @abstract
9964 * @return {?}
9965 */
9966 AnimationPlayer.prototype.init = function () { };
9967 /**
9968 * @abstract
9969 * @return {?}
9970 */
9971 AnimationPlayer.prototype.hasStarted = function () { };
9972 /**
9973 * @abstract
9974 * @return {?}
9975 */
9976 AnimationPlayer.prototype.play = function () { };
9977 /**
9978 * @abstract
9979 * @return {?}
9980 */
9981 AnimationPlayer.prototype.pause = function () { };
9982 /**
9983 * @abstract
9984 * @return {?}
9985 */
9986 AnimationPlayer.prototype.restart = function () { };
9987 /**
9988 * @abstract
9989 * @return {?}
9990 */
9991 AnimationPlayer.prototype.finish = function () { };
9992 /**
9993 * @abstract
9994 * @return {?}
9995 */
9996 AnimationPlayer.prototype.destroy = function () { };
9997 /**
9998 * @abstract
9999 * @return {?}
10000 */
10001 AnimationPlayer.prototype.reset = function () { };
10002 /**
10003 * @abstract
10004 * @param {?} p
10005 * @return {?}
10006 */
10007 AnimationPlayer.prototype.setPosition = function (p) { };
10008 /**
10009 * @abstract
10010 * @return {?}
10011 */
10012 AnimationPlayer.prototype.getPosition = function () { };
10013 Object.defineProperty(AnimationPlayer.prototype, "parentPlayer", {
10014 /**
10015 * @return {?}
10016 */
10017 get: function () { throw new Error('NOT IMPLEMENTED: Base Class'); },
10018 /**
10019 * @param {?} player
10020 * @return {?}
10021 */
10022 set: function (player) { throw new Error('NOT IMPLEMENTED: Base Class'); },
10023 enumerable: true,
10024 configurable: true
10025 });
10026 return AnimationPlayer;
10027 }());
10028 var NoOpAnimationPlayer = (function () {
10029 function NoOpAnimationPlayer() {
10030 var _this = this;
10031 this._onDoneFns = [];
10032 this._onStartFns = [];
10033 this._started = false;
10034 this.parentPlayer = null;
10035 scheduleMicroTask(function () { return _this._onFinish(); });
10036 }
10037 /**
10038 * \@internal
10039 * @return {?}
10040 */
10041 NoOpAnimationPlayer.prototype._onFinish = function () {
10042 this._onDoneFns.forEach(function (fn) { return fn(); });
10043 this._onDoneFns = [];
10044 };
10045 /**
10046 * @param {?} fn
10047 * @return {?}
10048 */
10049 NoOpAnimationPlayer.prototype.onStart = function (fn) { this._onStartFns.push(fn); };
10050 /**
10051 * @param {?} fn
10052 * @return {?}
10053 */
10054 NoOpAnimationPlayer.prototype.onDone = function (fn) { this._onDoneFns.push(fn); };
10055 /**
10056 * @return {?}
10057 */
10058 NoOpAnimationPlayer.prototype.hasStarted = function () { return this._started; };
10059 /**
10060 * @return {?}
10061 */
10062 NoOpAnimationPlayer.prototype.init = function () { };
10063 /**
10064 * @return {?}
10065 */
10066 NoOpAnimationPlayer.prototype.play = function () {
10067 if (!this.hasStarted()) {
10068 this._onStartFns.forEach(function (fn) { return fn(); });
10069 this._onStartFns = [];
10070 }
10071 this._started = true;
10072 };
10073 /**
10074 * @return {?}
10075 */
10076 NoOpAnimationPlayer.prototype.pause = function () { };
10077 /**
10078 * @return {?}
10079 */
10080 NoOpAnimationPlayer.prototype.restart = function () { };
10081 /**
10082 * @return {?}
10083 */
10084 NoOpAnimationPlayer.prototype.finish = function () { this._onFinish(); };
10085 /**
10086 * @return {?}
10087 */
10088 NoOpAnimationPlayer.prototype.destroy = function () { };
10089 /**
10090 * @return {?}
10091 */
10092 NoOpAnimationPlayer.prototype.reset = function () { };
10093 /**
10094 * @param {?} p
10095 * @return {?}
10096 */
10097 NoOpAnimationPlayer.prototype.setPosition = function (p) { };
10098 /**
10099 * @return {?}
10100 */
10101 NoOpAnimationPlayer.prototype.getPosition = function () { return 0; };
10102 return NoOpAnimationPlayer;
10103 }());
10104
10105 var AnimationSequencePlayer = (function () {
10106 /**
10107 * @param {?} _players
10108 */
10109 function AnimationSequencePlayer(_players) {
10110 var _this = this;
10111 this._players = _players;
10112 this._currentIndex = 0;
10113 this._onDoneFns = [];
10114 this._onStartFns = [];
10115 this._finished = false;
10116 this._started = false;
10117 this._destroyed = false;
10118 this.parentPlayer = null;
10119 this._players.forEach(function (player) { player.parentPlayer = _this; });
10120 this._onNext(false);
10121 }
10122 /**
10123 * @param {?} start
10124 * @return {?}
10125 */
10126 AnimationSequencePlayer.prototype._onNext = function (start) {
10127 var _this = this;
10128 if (this._finished)
10129 return;
10130 if (this._players.length == 0) {
10131 this._activePlayer = new NoOpAnimationPlayer();
10132 scheduleMicroTask(function () { return _this._onFinish(); });
10133 }
10134 else if (this._currentIndex >= this._players.length) {
10135 this._activePlayer = new NoOpAnimationPlayer();
10136 this._onFinish();
10137 }
10138 else {
10139 var /** @type {?} */ player = this._players[this._currentIndex++];
10140 player.onDone(function () { return _this._onNext(true); });
10141 this._activePlayer = player;
10142 if (start) {
10143 player.play();
10144 }
10145 }
10146 };
10147 /**
10148 * @return {?}
10149 */
10150 AnimationSequencePlayer.prototype._onFinish = function () {
10151 if (!this._finished) {
10152 this._finished = true;
10153 this._onDoneFns.forEach(function (fn) { return fn(); });
10154 this._onDoneFns = [];
10155 }
10156 };
10157 /**
10158 * @return {?}
10159 */
10160 AnimationSequencePlayer.prototype.init = function () { this._players.forEach(function (player) { return player.init(); }); };
10161 /**
10162 * @param {?} fn
10163 * @return {?}
10164 */
10165 AnimationSequencePlayer.prototype.onStart = function (fn) { this._onStartFns.push(fn); };
10166 /**
10167 * @param {?} fn
10168 * @return {?}
10169 */
10170 AnimationSequencePlayer.prototype.onDone = function (fn) { this._onDoneFns.push(fn); };
10171 /**
10172 * @return {?}
10173 */
10174 AnimationSequencePlayer.prototype.hasStarted = function () { return this._started; };
10175 /**
10176 * @return {?}
10177 */
10178 AnimationSequencePlayer.prototype.play = function () {
10179 if (!isPresent(this.parentPlayer)) {
10180 this.init();
10181 }
10182 if (!this.hasStarted()) {
10183 this._onStartFns.forEach(function (fn) { return fn(); });
10184 this._onStartFns = [];
10185 this._started = true;
10186 }
10187 this._activePlayer.play();
10188 };
10189 /**
10190 * @return {?}
10191 */
10192 AnimationSequencePlayer.prototype.pause = function () { this._activePlayer.pause(); };
10193 /**
10194 * @return {?}
10195 */
10196 AnimationSequencePlayer.prototype.restart = function () {
10197 this.reset();
10198 if (this._players.length > 0) {
10199 this._players[0].restart();
10200 }
10201 };
10202 /**
10203 * @return {?}
10204 */
10205 AnimationSequencePlayer.prototype.reset = function () {
10206 this._players.forEach(function (player) { return player.reset(); });
10207 this._destroyed = false;
10208 this._finished = false;
10209 this._started = false;
10210 };
10211 /**
10212 * @return {?}
10213 */
10214 AnimationSequencePlayer.prototype.finish = function () {
10215 this._onFinish();
10216 this._players.forEach(function (player) { return player.finish(); });
10217 };
10218 /**
10219 * @return {?}
10220 */
10221 AnimationSequencePlayer.prototype.destroy = function () {
10222 if (!this._destroyed) {
10223 this._onFinish();
10224 this._players.forEach(function (player) { return player.destroy(); });
10225 this._destroyed = true;
10226 this._activePlayer = new NoOpAnimationPlayer();
10227 }
10228 };
10229 /**
10230 * @param {?} p
10231 * @return {?}
10232 */
10233 AnimationSequencePlayer.prototype.setPosition = function (p) { this._players[0].setPosition(p); };
10234 /**
10235 * @return {?}
10236 */
10237 AnimationSequencePlayer.prototype.getPosition = function () { return this._players[0].getPosition(); };
10238 Object.defineProperty(AnimationSequencePlayer.prototype, "players", {
10239 /**
10240 * @return {?}
10241 */
10242 get: function () { return this._players; },
10243 enumerable: true,
10244 configurable: true
10245 });
10246 return AnimationSequencePlayer;
10247 }());
10248
10249 /**
10250 * @license
10251 * Copyright Google Inc. All Rights Reserved.
10252 *
10253 * Use of this source code is governed by an MIT-style license that can be
10254 * found in the LICENSE file at https://angular.io/license
10255 */
10256 var __extends$13 = (this && this.__extends) || function (d, b) {
10257 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
10258 function __() { this.constructor = d; }
10259 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
10260 };
10261 /**
10262 * @experimental Animation support is experimental.
10263 */
10264 var /** @type {?} */ AUTO_STYLE = '*';
10265 /**
10266 * Metadata representing the entry of animations.
10267 * Instances of this class are provided via the animation DSL when the {\@link trigger trigger
10268 * animation function} is called.
10269 *
10270 * \@experimental Animation support is experimental.
10271 */
10272 var AnimationEntryMetadata = (function () {
10273 /**
10274 * @param {?} name
10275 * @param {?} definitions
10276 */
10277 function AnimationEntryMetadata(name, definitions) {
10278 this.name = name;
10279 this.definitions = definitions;
10280 }
10281 return AnimationEntryMetadata;
10282 }());
10283 /**
10284 * \@experimental Animation support is experimental.
10285 * @abstract
10286 */
10287 var AnimationStateMetadata = (function () {
10288 function AnimationStateMetadata() {
10289 }
10290 return AnimationStateMetadata;
10291 }());
10292 /**
10293 * Metadata representing the entry of animations.
10294 * Instances of this class are provided via the animation DSL when the {\@link state state animation
10295 * function} is called.
10296 *
10297 * \@experimental Animation support is experimental.
10298 */
10299 var AnimationStateDeclarationMetadata = (function (_super) {
10300 __extends$13(AnimationStateDeclarationMetadata, _super);
10301 /**
10302 * @param {?} stateNameExpr
10303 * @param {?} styles
10304 */
10305 function AnimationStateDeclarationMetadata(stateNameExpr, styles) {
10306 _super.call(this);
10307 this.stateNameExpr = stateNameExpr;
10308 this.styles = styles;
10309 }
10310 return AnimationStateDeclarationMetadata;
10311 }(AnimationStateMetadata));
10312 /**
10313 * Metadata representing the entry of animations.
10314 * Instances of this class are provided via the animation DSL when the
10315 * {\@link transition transition animation function} is called.
10316 *
10317 * \@experimental Animation support is experimental.
10318 */
10319 var AnimationStateTransitionMetadata = (function (_super) {
10320 __extends$13(AnimationStateTransitionMetadata, _super);
10321 /**
10322 * @param {?} stateChangeExpr
10323 * @param {?} steps
10324 */
10325 function AnimationStateTransitionMetadata(stateChangeExpr, steps) {
10326 _super.call(this);
10327 this.stateChangeExpr = stateChangeExpr;
10328 this.steps = steps;
10329 }
10330 return AnimationStateTransitionMetadata;
10331 }(AnimationStateMetadata));
10332 /**
10333 * \@experimental Animation support is experimental.
10334 * @abstract
10335 */
10336 var AnimationMetadata = (function () {
10337 function AnimationMetadata() {
10338 }
10339 return AnimationMetadata;
10340 }());
10341 /**
10342 * Metadata representing the entry of animations.
10343 * Instances of this class are provided via the animation DSL when the {\@link keyframes keyframes
10344 * animation function} is called.
10345 *
10346 * \@experimental Animation support is experimental.
10347 */
10348 var AnimationKeyframesSequenceMetadata = (function (_super) {
10349 __extends$13(AnimationKeyframesSequenceMetadata, _super);
10350 /**
10351 * @param {?} steps
10352 */
10353 function AnimationKeyframesSequenceMetadata(steps) {
10354 _super.call(this);
10355 this.steps = steps;
10356 }
10357 return AnimationKeyframesSequenceMetadata;
10358 }(AnimationMetadata));
10359 /**
10360 * Metadata representing the entry of animations.
10361 * Instances of this class are provided via the animation DSL when the {\@link style style animation
10362 * function} is called.
10363 *
10364 * \@experimental Animation support is experimental.
10365 */
10366 var AnimationStyleMetadata = (function (_super) {
10367 __extends$13(AnimationStyleMetadata, _super);
10368 /**
10369 * @param {?} styles
10370 * @param {?=} offset
10371 */
10372 function AnimationStyleMetadata(styles, offset) {
10373 if (offset === void 0) { offset = null; }
10374 _super.call(this);
10375 this.styles = styles;
10376 this.offset = offset;
10377 }
10378 return AnimationStyleMetadata;
10379 }(AnimationMetadata));
10380 /**
10381 * Metadata representing the entry of animations.
10382 * Instances of this class are provided via the animation DSL when the {\@link animate animate
10383 * animation function} is called.
10384 *
10385 * \@experimental Animation support is experimental.
10386 */
10387 var AnimationAnimateMetadata = (function (_super) {
10388 __extends$13(AnimationAnimateMetadata, _super);
10389 /**
10390 * @param {?} timings
10391 * @param {?} styles
10392 */
10393 function AnimationAnimateMetadata(timings, styles) {
10394 _super.call(this);
10395 this.timings = timings;
10396 this.styles = styles;
10397 }
10398 return AnimationAnimateMetadata;
10399 }(AnimationMetadata));
10400 /**
10401 * \@experimental Animation support is experimental.
10402 * @abstract
10403 */
10404 var AnimationWithStepsMetadata = (function (_super) {
10405 __extends$13(AnimationWithStepsMetadata, _super);
10406 function AnimationWithStepsMetadata() {
10407 _super.call(this);
10408 }
10409 Object.defineProperty(AnimationWithStepsMetadata.prototype, "steps", {
10410 /**
10411 * @return {?}
10412 */
10413 get: function () { throw new Error('NOT IMPLEMENTED: Base Class'); },
10414 enumerable: true,
10415 configurable: true
10416 });
10417 return AnimationWithStepsMetadata;
10418 }(AnimationMetadata));
10419 /**
10420 * Metadata representing the entry of animations.
10421 * Instances of this class are provided via the animation DSL when the {\@link sequence sequence
10422 * animation function} is called.
10423 *
10424 * \@experimental Animation support is experimental.
10425 */
10426 var AnimationSequenceMetadata = (function (_super) {
10427 __extends$13(AnimationSequenceMetadata, _super);
10428 /**
10429 * @param {?} _steps
10430 */
10431 function AnimationSequenceMetadata(_steps) {
10432 _super.call(this);
10433 this._steps = _steps;
10434 }
10435 Object.defineProperty(AnimationSequenceMetadata.prototype, "steps", {
10436 /**
10437 * @return {?}
10438 */
10439 get: function () { return this._steps; },
10440 enumerable: true,
10441 configurable: true
10442 });
10443 return AnimationSequenceMetadata;
10444 }(AnimationWithStepsMetadata));
10445 /**
10446 * Metadata representing the entry of animations.
10447 * Instances of this class are provided via the animation DSL when the {\@link group group animation
10448 * function} is called.
10449 *
10450 * \@experimental Animation support is experimental.
10451 */
10452 var AnimationGroupMetadata = (function (_super) {
10453 __extends$13(AnimationGroupMetadata, _super);
10454 /**
10455 * @param {?} _steps
10456 */
10457 function AnimationGroupMetadata(_steps) {
10458 _super.call(this);
10459 this._steps = _steps;
10460 }
10461 Object.defineProperty(AnimationGroupMetadata.prototype, "steps", {
10462 /**
10463 * @return {?}
10464 */
10465 get: function () { return this._steps; },
10466 enumerable: true,
10467 configurable: true
10468 });
10469 return AnimationGroupMetadata;
10470 }(AnimationWithStepsMetadata));
10471 /**
10472 * `animate` is an animation-specific function that is designed to be used inside of Angular2's
10473 * animation
10474 * DSL language. If this information is new, please navigate to the
10475 * {\@link Component#animations-anchor component animations metadata
10476 * page} to gain a better understanding of how animations in Angular2 are used.
10477 *
10478 * `animate` specifies an animation step that will apply the provided `styles` data for a given
10479 * amount of
10480 * time based on the provided `timing` expression value. Calls to `animate` are expected to be
10481 * used within {\@link sequence an animation sequence}, {\@link group group}, or {\@link transition
10482 * transition}.
10483 *
10484 * ### Usage
10485 *
10486 * The `animate` function accepts two input parameters: `timing` and `styles`:
10487 *
10488 * - `timing` is a string based value that can be a combination of a duration with optional
10489 * delay and easing values. The format for the expression breaks down to `duration delay easing`
10490 * (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000,
10491 * delay=100, easing=ease-out`.
10492 * If a numeric value is provided then that will be used as the `duration` value in millisecond
10493 * form.
10494 * - `styles` is the style input data which can either be a call to {\@link style style} or {\@link
10495 * keyframes keyframes}.
10496 * If left empty then the styles from the destination state will be collected and used (this is
10497 * useful when
10498 * describing an animation step that will complete an animation by {\@link
10499 * transition#the-final-animate-call animating to the final state}).
10500 *
10501 * ```typescript
10502 * // various functions for specifying timing data
10503 * animate(500, style(...))
10504 * animate("1s", style(...))
10505 * animate("100ms 0.5s", style(...))
10506 * animate("5s ease", style(...))
10507 * animate("5s 10ms cubic-bezier(.17,.67,.88,.1)", style(...))
10508 *
10509 * // either style() of keyframes() can be used
10510 * animate(500, style({ background: "red" }))
10511 * animate(500, keyframes([
10512 * style({ background: "blue" })),
10513 * style({ background: "red" }))
10514 * ])
10515 * ```
10516 *
10517 * ### Example ([live demo](http://plnkr.co/edit/Kez8XGWBxWue7qP7nNvF?p=preview))
10518 *
10519 * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
10520 *
10521 * \@experimental Animation support is experimental.
10522 * @param {?} timing
10523 * @param {?=} styles
10524 * @return {?}
10525 */
10526 function animate(timing, styles) {
10527 if (styles === void 0) { styles = null; }
10528 var /** @type {?} */ stylesEntry = styles;
10529 if (!isPresent(stylesEntry)) {
10530 var /** @type {?} */ EMPTY_STYLE = {};
10531 stylesEntry = new AnimationStyleMetadata([EMPTY_STYLE], 1);
10532 }
10533 return new AnimationAnimateMetadata(timing, stylesEntry);
10534 }
10535 /**
10536 * `group` is an animation-specific function that is designed to be used inside of Angular2's
10537 * animation
10538 * DSL language. If this information is new, please navigate to the
10539 * {\@link Component#animations-anchor component animations metadata
10540 * page} to gain a better understanding of how animations in Angular2 are used.
10541 *
10542 * `group` specifies a list of animation steps that are all run in parallel. Grouped animations
10543 * are useful when a series of styles must be animated/closed off
10544 * at different statrting/ending times.
10545 *
10546 * The `group` function can either be used within a {\@link sequence sequence} or a {\@link transition
10547 * transition}
10548 * and it will only continue to the next instruction once all of the inner animation steps
10549 * have completed.
10550 *
10551 * ### Usage
10552 *
10553 * The `steps` data that is passed into the `group` animation function can either consist
10554 * of {\@link style style} or {\@link animate animate} function calls. Each call to `style()` or
10555 * `animate()`
10556 * within a group will be executed instantly (use {\@link keyframes keyframes} or a
10557 * {\@link animate#usage animate() with a delay value} to offset styles to be applied at a later
10558 * time).
10559 *
10560 * ```typescript
10561 * group([
10562 * animate("1s", { background: "black" }))
10563 * animate("2s", { color: "white" }))
10564 * ])
10565 * ```
10566 *
10567 * ### Example ([live demo](http://plnkr.co/edit/Kez8XGWBxWue7qP7nNvF?p=preview))
10568 *
10569 * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
10570 *
10571 * \@experimental Animation support is experimental.
10572 * @param {?} steps
10573 * @return {?}
10574 */
10575 function group(steps) {
10576 return new AnimationGroupMetadata(steps);
10577 }
10578 /**
10579 * `sequence` is an animation-specific function that is designed to be used inside of Angular2's
10580 * animation
10581 * DSL language. If this information is new, please navigate to the
10582 * {\@link Component#animations-anchor component animations metadata
10583 * page} to gain a better understanding of how animations in Angular2 are used.
10584 *
10585 * `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used
10586 * by default when an array is passed as animation data into {\@link transition transition}.)
10587 *
10588 * The `sequence` function can either be used within a {\@link group group} or a {\@link transition
10589 * transition}
10590 * and it will only continue to the next instruction once each of the inner animation steps
10591 * have completed.
10592 *
10593 * To perform animation styling in parallel with other animation steps then
10594 * have a look at the {\@link group group} animation function.
10595 *
10596 * ### Usage
10597 *
10598 * The `steps` data that is passed into the `sequence` animation function can either consist
10599 * of {\@link style style} or {\@link animate animate} function calls. A call to `style()` will apply
10600 * the
10601 * provided styling data immediately while a call to `animate()` will apply its styling
10602 * data over a given time depending on its timing data.
10603 *
10604 * ```typescript
10605 * sequence([
10606 * style({ opacity: 0 })),
10607 * animate("1s", { opacity: 1 }))
10608 * ])
10609 * ```
10610 *
10611 * ### Example ([live demo](http://plnkr.co/edit/Kez8XGWBxWue7qP7nNvF?p=preview))
10612 *
10613 * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
10614 *
10615 * \@experimental Animation support is experimental.
10616 * @param {?} steps
10617 * @return {?}
10618 */
10619 function sequence(steps) {
10620 return new AnimationSequenceMetadata(steps);
10621 }
10622 /**
10623 * `style` is an animation-specific function that is designed to be used inside of Angular2's
10624 * animation
10625 * DSL language. If this information is new, please navigate to the
10626 * {\@link Component#animations-anchor component animations metadata
10627 * page} to gain a better understanding of how animations in Angular2 are used.
10628 *
10629 * `style` declares a key/value object containing CSS properties/styles that can then
10630 * be used for {\@link state animation states}, within an {\@link sequence animation sequence}, or as
10631 * styling data for both {\@link animate animate} and {\@link keyframes keyframes}.
10632 *
10633 * ### Usage
10634 *
10635 * `style` takes in a key/value string map as data and expects one or more CSS property/value
10636 * pairs to be defined.
10637 *
10638 * ```typescript
10639 * // string values are used for css properties
10640 * style({ background: "red", color: "blue" })
10641 *
10642 * // numerical (pixel) values are also supported
10643 * style({ width: 100, height: 0 })
10644 * ```
10645 *
10646 * #### Auto-styles (using `*`)
10647 *
10648 * When an asterix (`*`) character is used as a value then it will be detected from the element
10649 * being animated
10650 * and applied as animation data when the animation starts.
10651 *
10652 * This feature proves useful for a state depending on layout and/or environment factors; in such
10653 * cases
10654 * the styles are calculated just before the animation starts.
10655 *
10656 * ```typescript
10657 * // the steps below will animate from 0 to the
10658 * // actual height of the element
10659 * style({ height: 0 }),
10660 * animate("1s", style({ height: "*" }))
10661 * ```
10662 *
10663 * ### Example ([live demo](http://plnkr.co/edit/Kez8XGWBxWue7qP7nNvF?p=preview))
10664 *
10665 * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
10666 *
10667 * \@experimental Animation support is experimental.
10668 * @param {?} tokens
10669 * @return {?}
10670 */
10671 function style(tokens) {
10672 var /** @type {?} */ input;
10673 var /** @type {?} */ offset = null;
10674 if (typeof tokens === 'string') {
10675 input = [(tokens)];
10676 }
10677 else {
10678 if (Array.isArray(tokens)) {
10679 input = (tokens);
10680 }
10681 else {
10682 input = [(tokens)];
10683 }
10684 input.forEach(function (entry) {
10685 var /** @type {?} */ entryOffset = ((entry) /** TODO #9100 */)['offset'];
10686 if (isPresent(entryOffset)) {
10687 offset = offset == null ? parseFloat(entryOffset) : offset;
10688 }
10689 });
10690 }
10691 return new AnimationStyleMetadata(input, offset);
10692 }
10693 /**
10694 * `state` is an animation-specific function that is designed to be used inside of Angular2's
10695 * animation
10696 * DSL language. If this information is new, please navigate to the
10697 * {\@link Component#animations-anchor component animations metadata
10698 * page} to gain a better understanding of how animations in Angular2 are used.
10699 *
10700 * `state` declares an animation state within the given trigger. When a state is
10701 * active within a component then its associated styles will persist on
10702 * the element that the trigger is attached to (even when the animation ends).
10703 *
10704 * To animate between states, have a look at the animation {\@link transition transition}
10705 * DSL function. To register states to an animation trigger please have a look
10706 * at the {\@link trigger trigger} function.
10707 *
10708 * #### The `void` state
10709 *
10710 * The `void` state value is a reserved word that angular uses to determine when the element is not
10711 * apart
10712 * of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the
10713 * associated element
10714 * is void).
10715 *
10716 * #### The `*` (default) state
10717 *
10718 * The `*` state (when styled) is a fallback state that will be used if
10719 * the state that is being animated is not declared within the trigger.
10720 *
10721 * ### Usage
10722 *
10723 * `state` will declare an animation state with its associated styles
10724 * within the given trigger.
10725 *
10726 * - `stateNameExpr` can be one or more state names separated by commas.
10727 * - `styles` refers to the {\@link style styling data} that will be persisted on the element once
10728 * the state
10729 * has been reached.
10730 *
10731 * ```typescript
10732 * // "void" is a reserved name for a state and is used to represent
10733 * // the state in which an element is detached from from the application.
10734 * state("void", style({ height: 0 }))
10735 *
10736 * // user-defined states
10737 * state("closed", style({ height: 0 }))
10738 * state("open, visible", style({ height: "*" }))
10739 * ```
10740 *
10741 * ### Example ([live demo](http://plnkr.co/edit/Kez8XGWBxWue7qP7nNvF?p=preview))
10742 *
10743 * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
10744 *
10745 * \@experimental Animation support is experimental.
10746 * @param {?} stateNameExpr
10747 * @param {?} styles
10748 * @return {?}
10749 */
10750 function state(stateNameExpr, styles) {
10751 return new AnimationStateDeclarationMetadata(stateNameExpr, styles);
10752 }
10753 /**
10754 * `keyframes` is an animation-specific function that is designed to be used inside of Angular2's
10755 * animation
10756 * DSL language. If this information is new, please navigate to the
10757 * {\@link Component#animations-anchor component animations metadata
10758 * page} to gain a better understanding of how animations in Angular2 are used.
10759 *
10760 * `keyframes` specifies a collection of {\@link style style} entries each optionally characterized
10761 * by an `offset` value.
10762 *
10763 * ### Usage
10764 *
10765 * The `keyframes` animation function is designed to be used alongside the {\@link animate animate}
10766 * animation function. Instead of applying animations from where they are
10767 * currently to their destination, keyframes can describe how each style entry is applied
10768 * and at what point within the animation arc (much like CSS Keyframe Animations do).
10769 *
10770 * For each `style()` entry an `offset` value can be set. Doing so allows to specifiy at
10771 * what percentage of the animate time the styles will be applied.
10772 *
10773 * ```typescript
10774 * // the provided offset values describe when each backgroundColor value is applied.
10775 * animate("5s", keyframes([
10776 * style({ backgroundColor: "red", offset: 0 }),
10777 * style({ backgroundColor: "blue", offset: 0.2 }),
10778 * style({ backgroundColor: "orange", offset: 0.3 }),
10779 * style({ backgroundColor: "black", offset: 1 })
10780 * ]))
10781 * ```
10782 *
10783 * Alternatively, if there are no `offset` values used within the style entries then the offsets
10784 * will
10785 * be calculated automatically.
10786 *
10787 * ```typescript
10788 * animate("5s", keyframes([
10789 * style({ backgroundColor: "red" }) // offset = 0
10790 * style({ backgroundColor: "blue" }) // offset = 0.33
10791 * style({ backgroundColor: "orange" }) // offset = 0.66
10792 * style({ backgroundColor: "black" }) // offset = 1
10793 * ]))
10794 * ```
10795 *
10796 * ### Example ([live demo](http://plnkr.co/edit/Kez8XGWBxWue7qP7nNvF?p=preview))
10797 *
10798 * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
10799 *
10800 * \@experimental Animation support is experimental.
10801 * @param {?} steps
10802 * @return {?}
10803 */
10804 function keyframes(steps) {
10805 return new AnimationKeyframesSequenceMetadata(steps);
10806 }
10807 /**
10808 * `transition` is an animation-specific function that is designed to be used inside of Angular2's
10809 * animation
10810 * DSL language. If this information is new, please navigate to the
10811 * {\@link Component#animations-anchor component animations metadata
10812 * page} to gain a better understanding of how animations in Angular2 are used.
10813 *
10814 * `transition` declares the {\@link sequence sequence of animation steps} that will be run when the
10815 * provided
10816 * `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 => state2`
10817 * which consists
10818 * of two known states (use an asterix (`*`) to refer to a dynamic starting and/or ending state).
10819 *
10820 * Animation transitions are placed within an {\@link trigger animation trigger}. For an transition
10821 * to animate to
10822 * a state value and persist its styles then one or more {\@link state animation states} is expected
10823 * to be defined.
10824 *
10825 * ### Usage
10826 *
10827 * An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on
10828 * what the
10829 * previous state is and what the current state has become. In other words, if a transition is
10830 * defined that
10831 * matches the old/current state criteria then the associated animation will be triggered.
10832 *
10833 * ```typescript
10834 * // all transition/state changes are defined within an animation trigger
10835 * trigger("myAnimationTrigger", [
10836 * // if a state is defined then its styles will be persisted when the
10837 * // animation has fully completed itself
10838 * state("on", style({ background: "green" })),
10839 * state("off", style({ background: "grey" })),
10840 *
10841 * // a transition animation that will be kicked off when the state value
10842 * // bound to "myAnimationTrigger" changes from "on" to "off"
10843 * transition("on => off", animate(500)),
10844 *
10845 * // it is also possible to do run the same animation for both directions
10846 * transition("on <=> off", animate(500)),
10847 *
10848 * // or to define multiple states pairs separated by commas
10849 * transition("on => off, off => void", animate(500)),
10850 *
10851 * // this is a catch-all state change for when an element is inserted into
10852 * // the page and the destination state is unknown
10853 * transition("void => *", [
10854 * style({ opacity: 0 }),
10855 * animate(500)
10856 * ]),
10857 *
10858 * // this will capture a state change between any states
10859 * transition("* => *", animate("1s 0s")),
10860 * ])
10861 * ```
10862 *
10863 * The template associated with this component will make use of the `myAnimationTrigger`
10864 * animation trigger by binding to an element within its template code.
10865 *
10866 * ```html
10867 * <!-- somewhere inside of my-component-tpl.html -->
10868 * <div [\@myAnimationTrigger]="myStatusExp">...</div>
10869 * ```
10870 *
10871 * #### The final `animate` call
10872 *
10873 * If the final step within the transition steps is a call to `animate()` that **only**
10874 * uses a timing value with **no style data** then it will be automatically used as the final
10875 * animation
10876 * arc for the element to animate itself to the final state. This involves an automatic mix of
10877 * adding/removing CSS styles so that the element will be in the exact state it should be for the
10878 * applied state to be presented correctly.
10879 *
10880 * ```
10881 * // start off by hiding the element, but make sure that it animates properly to whatever state
10882 * // is currently active for "myAnimationTrigger"
10883 * transition("void => *", [
10884 * style({ opacity: 0 }),
10885 * animate(500)
10886 * ])
10887 * ```
10888 *
10889 * ### Transition Aliases (`:enter` and `:leave`)
10890 *
10891 * Given that enter (insertion) and leave (removal) animations are so common,
10892 * the `transition` function accepts both `:enter` and `:leave` values which
10893 * are aliases for the `void => *` and `* => void` state changes.
10894 *
10895 * ```
10896 * transition(":enter", [
10897 * style({ opacity: 0 }),
10898 * animate(500, style({ opacity: 1 }))
10899 * ])
10900 * transition(":leave", [
10901 * animate(500, style({ opacity: 0 }))
10902 * ])
10903 * ```
10904 *
10905 * ### Example ([live demo](http://plnkr.co/edit/Kez8XGWBxWue7qP7nNvF?p=preview))
10906 *
10907 * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
10908 *
10909 * \@experimental Animation support is experimental.
10910 * @param {?} stateChangeExpr
10911 * @param {?} steps
10912 * @return {?}
10913 */
10914 function transition(stateChangeExpr, steps) {
10915 var /** @type {?} */ animationData = Array.isArray(steps) ? new AnimationSequenceMetadata(steps) : steps;
10916 return new AnimationStateTransitionMetadata(stateChangeExpr, animationData);
10917 }
10918 /**
10919 * `trigger` is an animation-specific function that is designed to be used inside of Angular2's
10920 * animation
10921 * DSL language. If this information is new, please navigate to the
10922 * {\@link Component#animations-anchor component animations metadata
10923 * page} to gain a better understanding of how animations in Angular2 are used.
10924 *
10925 * `trigger` Creates an animation trigger which will a list of {\@link state state} and {\@link
10926 * transition transition}
10927 * entries that will be evaluated when the expression bound to the trigger changes.
10928 *
10929 * Triggers are registered within the component annotation data under the
10930 * {\@link Component#animations-anchor animations section}. An animation trigger can
10931 * be placed on an element within a template by referencing the name of the
10932 * trigger followed by the expression value that the trigger is bound to
10933 * (in the form of `[\@triggerName]="expression"`.
10934 *
10935 * ### Usage
10936 *
10937 * `trigger` will create an animation trigger reference based on the provided `name` value.
10938 * The provided `animation` value is expected to be an array consisting of {\@link state state} and
10939 * {\@link transition transition}
10940 * declarations.
10941 *
10942 * ```typescript
10943 * \@Component({
10944 * selector: 'my-component',
10945 * templateUrl: 'my-component-tpl.html',
10946 * animations: [
10947 * trigger("myAnimationTrigger", [
10948 * state(...),
10949 * state(...),
10950 * transition(...),
10951 * transition(...)
10952 * ])
10953 * ]
10954 * })
10955 * class MyComponent {
10956 * myStatusExp = "something";
10957 * }
10958 * ```
10959 *
10960 * The template associated with this component will make use of the `myAnimationTrigger`
10961 * animation trigger by binding to an element within its template code.
10962 *
10963 * ```html
10964 * <!-- somewhere inside of my-component-tpl.html -->
10965 * <div [\@myAnimationTrigger]="myStatusExp">...</div>
10966 * ```
10967 *
10968 * ### Example ([live demo](http://plnkr.co/edit/Kez8XGWBxWue7qP7nNvF?p=preview))
10969 *
10970 * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
10971 *
10972 * \@experimental Animation support is experimental.
10973 * @param {?} name
10974 * @param {?} animation
10975 * @return {?}
10976 */
10977 function trigger(name, animation) {
10978 return new AnimationEntryMetadata(name, animation);
10979 }
10980
10981 /**
10982 * @param {?} previousStyles
10983 * @param {?} newStyles
10984 * @param {?=} nullValue
10985 * @return {?}
10986 */
10987 function prepareFinalAnimationStyles(previousStyles, newStyles, nullValue) {
10988 if (nullValue === void 0) { nullValue = null; }
10989 var /** @type {?} */ finalStyles = {};
10990 Object.keys(newStyles).forEach(function (prop) {
10991 var /** @type {?} */ value = newStyles[prop];
10992 finalStyles[prop] = value == AUTO_STYLE ? nullValue : value.toString();
10993 });
10994 Object.keys(previousStyles).forEach(function (prop) {
10995 if (!isPresent(finalStyles[prop])) {
10996 finalStyles[prop] = nullValue;
10997 }
10998 });
10999 return finalStyles;
11000 }
11001 /**
11002 * @param {?} collectedStyles
11003 * @param {?} finalStateStyles
11004 * @param {?} keyframes
11005 * @return {?}
11006 */
11007 function balanceAnimationKeyframes(collectedStyles, finalStateStyles, keyframes) {
11008 var /** @type {?} */ limit = keyframes.length - 1;
11009 var /** @type {?} */ firstKeyframe = keyframes[0];
11010 // phase 1: copy all the styles from the first keyframe into the lookup map
11011 var /** @type {?} */ flatenedFirstKeyframeStyles = flattenStyles(firstKeyframe.styles.styles);
11012 var /** @type {?} */ extraFirstKeyframeStyles = {};
11013 var /** @type {?} */ hasExtraFirstStyles = false;
11014 Object.keys(collectedStyles).forEach(function (prop) {
11015 var /** @type {?} */ value = (collectedStyles[prop]);
11016 // if the style is already defined in the first keyframe then
11017 // we do not replace it.
11018 if (!flatenedFirstKeyframeStyles[prop]) {
11019 flatenedFirstKeyframeStyles[prop] = value;
11020 extraFirstKeyframeStyles[prop] = value;
11021 hasExtraFirstStyles = true;
11022 }
11023 });
11024 var /** @type {?} */ keyframeCollectedStyles = StringMapWrapper.merge({}, flatenedFirstKeyframeStyles);
11025 // phase 2: normalize the final keyframe
11026 var /** @type {?} */ finalKeyframe = keyframes[limit];
11027 finalKeyframe.styles.styles.unshift(finalStateStyles);
11028 var /** @type {?} */ flatenedFinalKeyframeStyles = flattenStyles(finalKeyframe.styles.styles);
11029 var /** @type {?} */ extraFinalKeyframeStyles = {};
11030 var /** @type {?} */ hasExtraFinalStyles = false;
11031 Object.keys(keyframeCollectedStyles).forEach(function (prop) {
11032 if (!isPresent(flatenedFinalKeyframeStyles[prop])) {
11033 extraFinalKeyframeStyles[prop] = AUTO_STYLE;
11034 hasExtraFinalStyles = true;
11035 }
11036 });
11037 if (hasExtraFinalStyles) {
11038 finalKeyframe.styles.styles.push(extraFinalKeyframeStyles);
11039 }
11040 Object.keys(flatenedFinalKeyframeStyles).forEach(function (prop) {
11041 if (!isPresent(flatenedFirstKeyframeStyles[prop])) {
11042 extraFirstKeyframeStyles[prop] = AUTO_STYLE;
11043 hasExtraFirstStyles = true;
11044 }
11045 });
11046 if (hasExtraFirstStyles) {
11047 firstKeyframe.styles.styles.push(extraFirstKeyframeStyles);
11048 }
11049 collectAndResolveStyles(collectedStyles, [finalStateStyles]);
11050 return keyframes;
11051 }
11052 /**
11053 * @param {?} styles
11054 * @return {?}
11055 */
11056 function clearStyles(styles) {
11057 var /** @type {?} */ finalStyles = {};
11058 Object.keys(styles).forEach(function (key) { finalStyles[key] = null; });
11059 return finalStyles;
11060 }
11061 /**
11062 * @param {?} collection
11063 * @param {?} styles
11064 * @return {?}
11065 */
11066 function collectAndResolveStyles(collection, styles) {
11067 return styles.map(function (entry) {
11068 var /** @type {?} */ stylesObj = {};
11069 Object.keys(entry).forEach(function (prop) {
11070 var /** @type {?} */ value = entry[prop];
11071 if (value == FILL_STYLE_FLAG) {
11072 value = collection[prop];
11073 if (!isPresent(value)) {
11074 value = AUTO_STYLE;
11075 }
11076 }
11077 collection[prop] = value;
11078 stylesObj[prop] = value;
11079 });
11080 return stylesObj;
11081 });
11082 }
11083 /**
11084 * @param {?} element
11085 * @param {?} renderer
11086 * @param {?} styles
11087 * @return {?}
11088 */
11089 function renderStyles(element, renderer, styles) {
11090 Object.keys(styles).forEach(function (prop) { renderer.setElementStyle(element, prop, styles[prop]); });
11091 }
11092 /**
11093 * @param {?} styles
11094 * @return {?}
11095 */
11096 function flattenStyles(styles) {
11097 var /** @type {?} */ finalStyles = {};
11098 styles.forEach(function (entry) {
11099 Object.keys(entry).forEach(function (prop) { finalStyles[prop] = (entry[prop]); });
11100 });
11101 return finalStyles;
11102 }
11103
11104 /**
11105 * @license
11106 * Copyright Google Inc. All Rights Reserved.
11107 *
11108 * Use of this source code is governed by an MIT-style license that can be
11109 * found in the LICENSE file at https://angular.io/license
11110 */
11111 /**
11112 * `AnimationStyles` consists of a collection of key/value maps containing CSS-based style data
11113 * that can either be used as initial styling data or apart of a series of keyframes within an
11114 * animation.
11115 * This class is mostly internal, and it is designed to be used alongside
11116 * {\@link AnimationKeyframe `AnimationKeyframe`} and {\@link Renderer#animate-anchor
11117 * `Renderer.animate`}.
11118 *
11119 * \@experimental Animation support is experimental
11120 */
11121 var AnimationStyles = (function () {
11122 /**
11123 * @param {?} styles
11124 */
11125 function AnimationStyles(styles) {
11126 this.styles = styles;
11127 }
11128 return AnimationStyles;
11129 }());
11130
11131 /**
11132 * An instance of this class is returned as an event parameter when an animation
11133 * callback is captured for an animation either during the start or done phase.
11134 *
11135 * ```typescript
11136 * \@Component({
11137 * host: {
11138 * '[\@myAnimationTrigger]': 'someExpression',
11139 * '(\@myAnimationTrigger.start)': 'captureStartEvent($event)',
11140 * '(\@myAnimationTrigger.done)': 'captureDoneEvent($event)',
11141 * },
11142 * animations: [
11143 * trigger("myAnimationTrigger", [
11144 * // ...
11145 * ])
11146 * ]
11147 * })
11148 * class MyComponent {
11149 * someExpression: any = false;
11150 * captureStartEvent(event: AnimationTransitionEvent) {
11151 * // the toState, fromState and totalTime data is accessible from the event variable
11152 * }
11153 *
11154 * captureDoneEvent(event: AnimationTransitionEvent) {
11155 * // the toState, fromState and totalTime data is accessible from the event variable
11156 * }
11157 * }
11158 * ```
11159 *
11160 * \@experimental Animation support is experimental.
11161 */
11162 var AnimationTransitionEvent = (function () {
11163 /**
11164 * @param {?} __0
11165 */
11166 function AnimationTransitionEvent(_a) {
11167 var fromState = _a.fromState, toState = _a.toState, totalTime = _a.totalTime, phaseName = _a.phaseName;
11168 this.fromState = fromState;
11169 this.toState = toState;
11170 this.totalTime = totalTime;
11171 this.phaseName = phaseName;
11172 }
11173 return AnimationTransitionEvent;
11174 }());
11175
11176 var AnimationTransition = (function () {
11177 /**
11178 * @param {?} _player
11179 * @param {?} _fromState
11180 * @param {?} _toState
11181 * @param {?} _totalTime
11182 */
11183 function AnimationTransition(_player, _fromState, _toState, _totalTime) {
11184 this._player = _player;
11185 this._fromState = _fromState;
11186 this._toState = _toState;
11187 this._totalTime = _totalTime;
11188 }
11189 /**
11190 * @param {?} phaseName
11191 * @return {?}
11192 */
11193 AnimationTransition.prototype._createEvent = function (phaseName) {
11194 return new AnimationTransitionEvent({
11195 fromState: this._fromState,
11196 toState: this._toState,
11197 totalTime: this._totalTime,
11198 phaseName: phaseName
11199 });
11200 };
11201 /**
11202 * @param {?} callback
11203 * @return {?}
11204 */
11205 AnimationTransition.prototype.onStart = function (callback) {
11206 var _this = this;
11207 var /** @type {?} */ fn = (Zone.current.wrap(function () { return callback(_this._createEvent('start')); }, 'player.onStart'));
11208 this._player.onStart(fn);
11209 };
11210 /**
11211 * @param {?} callback
11212 * @return {?}
11213 */
11214 AnimationTransition.prototype.onDone = function (callback) {
11215 var _this = this;
11216 var /** @type {?} */ fn = (Zone.current.wrap(function () { return callback(_this._createEvent('done')); }, 'player.onDone'));
11217 this._player.onDone(fn);
11218 };
11219 return AnimationTransition;
11220 }());
11221
11222 var DebugDomRootRenderer = (function () {
11223 /**
11224 * @param {?} _delegate
11225 */
11226 function DebugDomRootRenderer(_delegate) {
11227 this._delegate = _delegate;
11228 }
11229 /**
11230 * @param {?} componentProto
11231 * @return {?}
11232 */
11233 DebugDomRootRenderer.prototype.renderComponent = function (componentProto) {
11234 return new DebugDomRenderer(this._delegate.renderComponent(componentProto));
11235 };
11236 return DebugDomRootRenderer;
11237 }());
11238 var DebugDomRenderer = (function () {
11239 /**
11240 * @param {?} _delegate
11241 */
11242 function DebugDomRenderer(_delegate) {
11243 this._delegate = _delegate;
11244 }
11245 /**
11246 * @param {?} selectorOrNode
11247 * @param {?=} debugInfo
11248 * @return {?}
11249 */
11250 DebugDomRenderer.prototype.selectRootElement = function (selectorOrNode, debugInfo) {
11251 var /** @type {?} */ nativeEl = this._delegate.selectRootElement(selectorOrNode, debugInfo);
11252 var /** @type {?} */ debugEl = new DebugElement(nativeEl, null, debugInfo);
11253 indexDebugNode(debugEl);
11254 return nativeEl;
11255 };
11256 /**
11257 * @param {?} parentElement
11258 * @param {?} name
11259 * @param {?=} debugInfo
11260 * @return {?}
11261 */
11262 DebugDomRenderer.prototype.createElement = function (parentElement, name, debugInfo) {
11263 var /** @type {?} */ nativeEl = this._delegate.createElement(parentElement, name, debugInfo);
11264 var /** @type {?} */ debugEl = new DebugElement(nativeEl, getDebugNode(parentElement), debugInfo);
11265 debugEl.name = name;
11266 indexDebugNode(debugEl);
11267 return nativeEl;
11268 };
11269 /**
11270 * @param {?} hostElement
11271 * @return {?}
11272 */
11273 DebugDomRenderer.prototype.createViewRoot = function (hostElement) { return this._delegate.createViewRoot(hostElement); };
11274 /**
11275 * @param {?} parentElement
11276 * @param {?=} debugInfo
11277 * @return {?}
11278 */
11279 DebugDomRenderer.prototype.createTemplateAnchor = function (parentElement, debugInfo) {
11280 var /** @type {?} */ comment = this._delegate.createTemplateAnchor(parentElement, debugInfo);
11281 var /** @type {?} */ debugEl = new DebugNode(comment, getDebugNode(parentElement), debugInfo);
11282 indexDebugNode(debugEl);
11283 return comment;
11284 };
11285 /**
11286 * @param {?} parentElement
11287 * @param {?} value
11288 * @param {?=} debugInfo
11289 * @return {?}
11290 */
11291 DebugDomRenderer.prototype.createText = function (parentElement, value, debugInfo) {
11292 var /** @type {?} */ text = this._delegate.createText(parentElement, value, debugInfo);
11293 var /** @type {?} */ debugEl = new DebugNode(text, getDebugNode(parentElement), debugInfo);
11294 indexDebugNode(debugEl);
11295 return text;
11296 };
11297 /**
11298 * @param {?} parentElement
11299 * @param {?} nodes
11300 * @return {?}
11301 */
11302 DebugDomRenderer.prototype.projectNodes = function (parentElement, nodes) {
11303 var /** @type {?} */ debugParent = getDebugNode(parentElement);
11304 if (isPresent(debugParent) && debugParent instanceof DebugElement) {
11305 var /** @type {?} */ debugElement_1 = debugParent;
11306 nodes.forEach(function (node) { debugElement_1.addChild(getDebugNode(node)); });
11307 }
11308 this._delegate.projectNodes(parentElement, nodes);
11309 };
11310 /**
11311 * @param {?} node
11312 * @param {?} viewRootNodes
11313 * @return {?}
11314 */
11315 DebugDomRenderer.prototype.attachViewAfter = function (node, viewRootNodes) {
11316 var /** @type {?} */ debugNode = getDebugNode(node);
11317 if (isPresent(debugNode)) {
11318 var /** @type {?} */ debugParent = debugNode.parent;
11319 if (viewRootNodes.length > 0 && isPresent(debugParent)) {
11320 var /** @type {?} */ debugViewRootNodes_1 = [];
11321 viewRootNodes.forEach(function (rootNode) { return debugViewRootNodes_1.push(getDebugNode(rootNode)); });
11322 debugParent.insertChildrenAfter(debugNode, debugViewRootNodes_1);
11323 }
11324 }
11325 this._delegate.attachViewAfter(node, viewRootNodes);
11326 };
11327 /**
11328 * @param {?} viewRootNodes
11329 * @return {?}
11330 */
11331 DebugDomRenderer.prototype.detachView = function (viewRootNodes) {
11332 viewRootNodes.forEach(function (node) {
11333 var /** @type {?} */ debugNode = getDebugNode(node);
11334 if (isPresent(debugNode) && isPresent(debugNode.parent)) {
11335 debugNode.parent.removeChild(debugNode);
11336 }
11337 });
11338 this._delegate.detachView(viewRootNodes);
11339 };
11340 /**
11341 * @param {?} hostElement
11342 * @param {?} viewAllNodes
11343 * @return {?}
11344 */
11345 DebugDomRenderer.prototype.destroyView = function (hostElement, viewAllNodes) {
11346 viewAllNodes = viewAllNodes || [];
11347 viewAllNodes.forEach(function (node) { removeDebugNodeFromIndex(getDebugNode(node)); });
11348 this._delegate.destroyView(hostElement, viewAllNodes);
11349 };
11350 /**
11351 * @param {?} renderElement
11352 * @param {?} name
11353 * @param {?} callback
11354 * @return {?}
11355 */
11356 DebugDomRenderer.prototype.listen = function (renderElement, name, callback) {
11357 var /** @type {?} */ debugEl = getDebugNode(renderElement);
11358 if (isPresent(debugEl)) {
11359 debugEl.listeners.push(new EventListener(name, callback));
11360 }
11361 return this._delegate.listen(renderElement, name, callback);
11362 };
11363 /**
11364 * @param {?} target
11365 * @param {?} name
11366 * @param {?} callback
11367 * @return {?}
11368 */
11369 DebugDomRenderer.prototype.listenGlobal = function (target, name, callback) {
11370 return this._delegate.listenGlobal(target, name, callback);
11371 };
11372 /**
11373 * @param {?} renderElement
11374 * @param {?} propertyName
11375 * @param {?} propertyValue
11376 * @return {?}
11377 */
11378 DebugDomRenderer.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) {
11379 var /** @type {?} */ debugEl = getDebugNode(renderElement);
11380 if (isPresent(debugEl) && debugEl instanceof DebugElement) {
11381 debugEl.properties[propertyName] = propertyValue;
11382 }
11383 this._delegate.setElementProperty(renderElement, propertyName, propertyValue);
11384 };
11385 /**
11386 * @param {?} renderElement
11387 * @param {?} attributeName
11388 * @param {?} attributeValue
11389 * @return {?}
11390 */
11391 DebugDomRenderer.prototype.setElementAttribute = function (renderElement, attributeName, attributeValue) {
11392 var /** @type {?} */ debugEl = getDebugNode(renderElement);
11393 if (isPresent(debugEl) && debugEl instanceof DebugElement) {
11394 debugEl.attributes[attributeName] = attributeValue;
11395 }
11396 this._delegate.setElementAttribute(renderElement, attributeName, attributeValue);
11397 };
11398 /**
11399 * @param {?} renderElement
11400 * @param {?} propertyName
11401 * @param {?} propertyValue
11402 * @return {?}
11403 */
11404 DebugDomRenderer.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) {
11405 this._delegate.setBindingDebugInfo(renderElement, propertyName, propertyValue);
11406 };
11407 /**
11408 * @param {?} renderElement
11409 * @param {?} className
11410 * @param {?} isAdd
11411 * @return {?}
11412 */
11413 DebugDomRenderer.prototype.setElementClass = function (renderElement, className, isAdd) {
11414 var /** @type {?} */ debugEl = getDebugNode(renderElement);
11415 if (isPresent(debugEl) && debugEl instanceof DebugElement) {
11416 debugEl.classes[className] = isAdd;
11417 }
11418 this._delegate.setElementClass(renderElement, className, isAdd);
11419 };
11420 /**
11421 * @param {?} renderElement
11422 * @param {?} styleName
11423 * @param {?} styleValue
11424 * @return {?}
11425 */
11426 DebugDomRenderer.prototype.setElementStyle = function (renderElement, styleName, styleValue) {
11427 var /** @type {?} */ debugEl = getDebugNode(renderElement);
11428 if (isPresent(debugEl) && debugEl instanceof DebugElement) {
11429 debugEl.styles[styleName] = styleValue;
11430 }
11431 this._delegate.setElementStyle(renderElement, styleName, styleValue);
11432 };
11433 /**
11434 * @param {?} renderElement
11435 * @param {?} methodName
11436 * @param {?=} args
11437 * @return {?}
11438 */
11439 DebugDomRenderer.prototype.invokeElementMethod = function (renderElement, methodName, args) {
11440 this._delegate.invokeElementMethod(renderElement, methodName, args);
11441 };
11442 /**
11443 * @param {?} renderNode
11444 * @param {?} text
11445 * @return {?}
11446 */
11447 DebugDomRenderer.prototype.setText = function (renderNode, text) { this._delegate.setText(renderNode, text); };
11448 /**
11449 * @param {?} element
11450 * @param {?} startingStyles
11451 * @param {?} keyframes
11452 * @param {?} duration
11453 * @param {?} delay
11454 * @param {?} easing
11455 * @param {?=} previousPlayers
11456 * @return {?}
11457 */
11458 DebugDomRenderer.prototype.animate = function (element, startingStyles, keyframes, duration, delay, easing, previousPlayers) {
11459 if (previousPlayers === void 0) { previousPlayers = []; }
11460 return this._delegate.animate(element, startingStyles, keyframes, duration, delay, easing, previousPlayers);
11461 };
11462 return DebugDomRenderer;
11463 }());
11464
11465 var ViewType = {};
11466 ViewType.HOST = 0;
11467 ViewType.COMPONENT = 1;
11468 ViewType.EMBEDDED = 2;
11469 ViewType[ViewType.HOST] = "HOST";
11470 ViewType[ViewType.COMPONENT] = "COMPONENT";
11471 ViewType[ViewType.EMBEDDED] = "EMBEDDED";
11472
11473 var StaticNodeDebugInfo = (function () {
11474 /**
11475 * @param {?} providerTokens
11476 * @param {?} componentToken
11477 * @param {?} refTokens
11478 */
11479 function StaticNodeDebugInfo(providerTokens, componentToken, refTokens) {
11480 this.providerTokens = providerTokens;
11481 this.componentToken = componentToken;
11482 this.refTokens = refTokens;
11483 }
11484 return StaticNodeDebugInfo;
11485 }());
11486 var DebugContext = (function () {
11487 /**
11488 * @param {?} _view
11489 * @param {?} _nodeIndex
11490 * @param {?} _tplRow
11491 * @param {?} _tplCol
11492 */
11493 function DebugContext(_view, _nodeIndex, _tplRow, _tplCol) {
11494 this._view = _view;
11495 this._nodeIndex = _nodeIndex;
11496 this._tplRow = _tplRow;
11497 this._tplCol = _tplCol;
11498 }
11499 Object.defineProperty(DebugContext.prototype, "_staticNodeInfo", {
11500 /**
11501 * @return {?}
11502 */
11503 get: function () {
11504 return isPresent(this._nodeIndex) ? this._view.staticNodeDebugInfos[this._nodeIndex] : null;
11505 },
11506 enumerable: true,
11507 configurable: true
11508 });
11509 Object.defineProperty(DebugContext.prototype, "context", {
11510 /**
11511 * @return {?}
11512 */
11513 get: function () { return this._view.context; },
11514 enumerable: true,
11515 configurable: true
11516 });
11517 Object.defineProperty(DebugContext.prototype, "component", {
11518 /**
11519 * @return {?}
11520 */
11521 get: function () {
11522 var /** @type {?} */ staticNodeInfo = this._staticNodeInfo;
11523 if (isPresent(staticNodeInfo) && isPresent(staticNodeInfo.componentToken)) {
11524 return this.injector.get(staticNodeInfo.componentToken);
11525 }
11526 return null;
11527 },
11528 enumerable: true,
11529 configurable: true
11530 });
11531 Object.defineProperty(DebugContext.prototype, "componentRenderElement", {
11532 /**
11533 * @return {?}
11534 */
11535 get: function () {
11536 var /** @type {?} */ componentView = this._view;
11537 while (isPresent(componentView.parentView) && componentView.type !== ViewType.COMPONENT) {
11538 componentView = (componentView.parentView);
11539 }
11540 return componentView.parentElement;
11541 },
11542 enumerable: true,
11543 configurable: true
11544 });
11545 Object.defineProperty(DebugContext.prototype, "injector", {
11546 /**
11547 * @return {?}
11548 */
11549 get: function () { return this._view.injector(this._nodeIndex); },
11550 enumerable: true,
11551 configurable: true
11552 });
11553 Object.defineProperty(DebugContext.prototype, "renderNode", {
11554 /**
11555 * @return {?}
11556 */
11557 get: function () {
11558 if (isPresent(this._nodeIndex) && this._view.allNodes) {
11559 return this._view.allNodes[this._nodeIndex];
11560 }
11561 else {
11562 return null;
11563 }
11564 },
11565 enumerable: true,
11566 configurable: true
11567 });
11568 Object.defineProperty(DebugContext.prototype, "providerTokens", {
11569 /**
11570 * @return {?}
11571 */
11572 get: function () {
11573 var /** @type {?} */ staticNodeInfo = this._staticNodeInfo;
11574 return isPresent(staticNodeInfo) ? staticNodeInfo.providerTokens : null;
11575 },
11576 enumerable: true,
11577 configurable: true
11578 });
11579 Object.defineProperty(DebugContext.prototype, "source", {
11580 /**
11581 * @return {?}
11582 */
11583 get: function () {
11584 return this._view.componentType.templateUrl + ":" + this._tplRow + ":" + this._tplCol;
11585 },
11586 enumerable: true,
11587 configurable: true
11588 });
11589 Object.defineProperty(DebugContext.prototype, "references", {
11590 /**
11591 * @return {?}
11592 */
11593 get: function () {
11594 var _this = this;
11595 var /** @type {?} */ varValues = {};
11596 var /** @type {?} */ staticNodeInfo = this._staticNodeInfo;
11597 if (isPresent(staticNodeInfo)) {
11598 var /** @type {?} */ refs_1 = staticNodeInfo.refTokens;
11599 Object.keys(refs_1).forEach(function (refName) {
11600 var /** @type {?} */ refToken = refs_1[refName];
11601 var /** @type {?} */ varValue;
11602 if (isBlank(refToken)) {
11603 varValue = _this._view.allNodes ? _this._view.allNodes[_this._nodeIndex] : null;
11604 }
11605 else {
11606 varValue = _this._view.injectorGet(refToken, _this._nodeIndex, null);
11607 }
11608 varValues[refName] = varValue;
11609 });
11610 }
11611 return varValues;
11612 },
11613 enumerable: true,
11614 configurable: true
11615 });
11616 return DebugContext;
11617 }());
11618
11619 var ViewAnimationMap = (function () {
11620 function ViewAnimationMap() {
11621 this._map = new Map();
11622 this._allPlayers = [];
11623 }
11624 /**
11625 * @param {?} element
11626 * @param {?} animationName
11627 * @return {?}
11628 */
11629 ViewAnimationMap.prototype.find = function (element, animationName) {
11630 var /** @type {?} */ playersByAnimation = this._map.get(element);
11631 if (isPresent(playersByAnimation)) {
11632 return playersByAnimation[animationName];
11633 }
11634 };
11635 /**
11636 * @param {?} element
11637 * @return {?}
11638 */
11639 ViewAnimationMap.prototype.findAllPlayersByElement = function (element) {
11640 var /** @type {?} */ el = this._map.get(element);
11641 return el ? Object.keys(el).map(function (k) { return el[k]; }) : [];
11642 };
11643 /**
11644 * @param {?} element
11645 * @param {?} animationName
11646 * @param {?} player
11647 * @return {?}
11648 */
11649 ViewAnimationMap.prototype.set = function (element, animationName, player) {
11650 var /** @type {?} */ playersByAnimation = this._map.get(element);
11651 if (!isPresent(playersByAnimation)) {
11652 playersByAnimation = {};
11653 }
11654 var /** @type {?} */ existingEntry = playersByAnimation[animationName];
11655 if (isPresent(existingEntry)) {
11656 this.remove(element, animationName);
11657 }
11658 playersByAnimation[animationName] = player;
11659 this._allPlayers.push(player);
11660 this._map.set(element, playersByAnimation);
11661 };
11662 /**
11663 * @return {?}
11664 */
11665 ViewAnimationMap.prototype.getAllPlayers = function () { return this._allPlayers; };
11666 /**
11667 * @param {?} element
11668 * @param {?} animationName
11669 * @param {?=} targetPlayer
11670 * @return {?}
11671 */
11672 ViewAnimationMap.prototype.remove = function (element, animationName, targetPlayer) {
11673 if (targetPlayer === void 0) { targetPlayer = null; }
11674 var /** @type {?} */ playersByAnimation = this._map.get(element);
11675 if (playersByAnimation) {
11676 var /** @type {?} */ player = playersByAnimation[animationName];
11677 if (!targetPlayer || player === targetPlayer) {
11678 delete playersByAnimation[animationName];
11679 var /** @type {?} */ index = this._allPlayers.indexOf(player);
11680 this._allPlayers.splice(index, 1);
11681 if (Object.keys(playersByAnimation).length === 0) {
11682 this._map.delete(element);
11683 }
11684 }
11685 }
11686 };
11687 return ViewAnimationMap;
11688 }());
11689
11690 var AnimationViewContext = (function () {
11691 /**
11692 * @param {?} _animationQueue
11693 */
11694 function AnimationViewContext(_animationQueue) {
11695 this._animationQueue = _animationQueue;
11696 this._players = new ViewAnimationMap();
11697 }
11698 /**
11699 * @param {?} callback
11700 * @return {?}
11701 */
11702 AnimationViewContext.prototype.onAllActiveAnimationsDone = function (callback) {
11703 var /** @type {?} */ activeAnimationPlayers = this._players.getAllPlayers();
11704 // we check for the length to avoid having GroupAnimationPlayer
11705 // issue an unnecessary microtask when zero players are passed in
11706 if (activeAnimationPlayers.length) {
11707 new AnimationGroupPlayer(activeAnimationPlayers).onDone(function () { return callback(); });
11708 }
11709 else {
11710 callback();
11711 }
11712 };
11713 /**
11714 * @param {?} element
11715 * @param {?} animationName
11716 * @param {?} player
11717 * @return {?}
11718 */
11719 AnimationViewContext.prototype.queueAnimation = function (element, animationName, player) {
11720 var _this = this;
11721 this._animationQueue.enqueue(player);
11722 this._players.set(element, animationName, player);
11723 player.onDone(function () { return _this._players.remove(element, animationName, player); });
11724 };
11725 /**
11726 * @param {?} element
11727 * @param {?=} animationName
11728 * @return {?}
11729 */
11730 AnimationViewContext.prototype.getAnimationPlayers = function (element, animationName) {
11731 if (animationName === void 0) { animationName = null; }
11732 var /** @type {?} */ players = [];
11733 if (animationName) {
11734 var /** @type {?} */ currentPlayer = this._players.find(element, animationName);
11735 if (currentPlayer) {
11736 _recursePlayers(currentPlayer, players);
11737 }
11738 }
11739 else {
11740 this._players.findAllPlayersByElement(element).forEach(function (player) { return _recursePlayers(player, players); });
11741 }
11742 return players;
11743 };
11744 return AnimationViewContext;
11745 }());
11746 /**
11747 * @param {?} player
11748 * @param {?} collectedPlayers
11749 * @return {?}
11750 */
11751 function _recursePlayers(player, collectedPlayers) {
11752 if ((player instanceof AnimationGroupPlayer) || (player instanceof AnimationSequencePlayer)) {
11753 player.players.forEach(function (player) { return _recursePlayers(player, collectedPlayers); });
11754 }
11755 else {
11756 collectedPlayers.push(player);
11757 }
11758 }
11759
11760 /**
11761 * @license
11762 * Copyright Google Inc. All Rights Reserved.
11763 *
11764 * Use of this source code is governed by an MIT-style license that can be
11765 * found in the LICENSE file at https://angular.io/license
11766 */
11767 var __extends$15 = (this && this.__extends) || function (d, b) {
11768 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
11769 function __() { this.constructor = d; }
11770 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
11771 };
11772 var ElementInjector = (function (_super) {
11773 __extends$15(ElementInjector, _super);
11774 /**
11775 * @param {?} _view
11776 * @param {?} _nodeIndex
11777 */
11778 function ElementInjector(_view, _nodeIndex) {
11779 _super.call(this);
11780 this._view = _view;
11781 this._nodeIndex = _nodeIndex;
11782 }
11783 /**
11784 * @param {?} token
11785 * @param {?=} notFoundValue
11786 * @return {?}
11787 */
11788 ElementInjector.prototype.get = function (token, notFoundValue) {
11789 if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; }
11790 return this._view.injectorGet(token, this._nodeIndex, notFoundValue);
11791 };
11792 return ElementInjector;
11793 }(Injector));
11794
11795 /**
11796 * @license
11797 * Copyright Google Inc. All Rights Reserved.
11798 *
11799 * Use of this source code is governed by an MIT-style license that can be
11800 * found in the LICENSE file at https://angular.io/license
11801 */
11802 var __extends$14 = (this && this.__extends) || function (d, b) {
11803 for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
11804 function __() { this.constructor = d; }
11805 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
11806 };
11807 var /** @type {?} */ _scope_check = wtfCreateScope("AppView#check(ascii id)");
11808 /**
11809 * @experimental
11810 */
11811 var /** @type {?} */ EMPTY_CONTEXT = new Object();
11812 var /** @type {?} */ UNDEFINED$1 = new Object();
11813 /**
11814 * Cost of making objects: http://jsperf.com/instantiate-size-of-object
11815 *
11816 * @abstract
11817 */
11818 var AppView = (function () {
11819 /**
11820 * @param {?} clazz
11821 * @param {?} componentType
11822 * @param {?} type
11823 * @param {?} viewUtils
11824 * @param {?} parentView
11825 * @param {?} parentIndex
11826 * @param {?} parentElement
11827 * @param {?} cdMode
11828 * @param {?=} declaredViewContainer
11829 */
11830 function AppView(clazz, componentType, type, viewUtils, parentView, parentIndex, parentElement, cdMode, declaredViewContainer) {
11831 if (declaredViewContainer === void 0) { declaredViewContainer = null; }
11832 this.clazz = clazz;
11833 this.componentType = componentType;
11834 this.type = type;
11835 this.viewUtils = viewUtils;
11836 this.parentView = parentView;
11837 this.parentIndex = parentIndex;
11838 this.parentElement = parentElement;
11839 this.cdMode = cdMode;
11840 this.declaredViewContainer = declaredViewContainer;
11841 this.numberOfChecks = 0;
11842 this.ref = new ViewRef_(this, viewUtils.animationQueue);
11843 if (type === ViewType.COMPONENT || type === ViewType.HOST) {
11844 this.renderer = viewUtils.renderComponent(componentType);
11845 }
11846 else {
11847 this.renderer = parentView.renderer;
11848 }
11849 this._directRenderer = this.renderer.directRenderer;
11850 }
11851 Object.defineProperty(AppView.prototype, "animationContext", {
11852 /**
11853 * @return {?}
11854 */
11855 get: function () {
11856 if (!this._animationContext) {
11857 this._animationContext = new AnimationViewContext(this.viewUtils.animationQueue);
11858 }
11859 return this._animationContext;
11860 },
11861 enumerable: true,
11862 configurable: true
11863 });
11864 Object.defineProperty(AppView.prototype, "destroyed", {
11865 /**
11866 * @return {?}
11867 */
11868 get: function () { return this.cdMode === ChangeDetectorStatus.Destroyed; },
11869 enumerable: true,
11870 configurable: true
11871 });
11872 /**
11873 * @param {?} context
11874 * @return {?}
11875 */
11876 AppView.prototype.create = function (context) {
11877 this.context = context;
11878 return this.createInternal(null);
11879 };
11880 /**
11881 * @param {?} rootSelectorOrNode
11882 * @param {?} hostInjector
11883 * @param {?} projectableNodes
11884 * @return {?}
11885 */
11886 AppView.prototype.createHostView = function (rootSelectorOrNode, hostInjector, projectableNodes) {
11887 this.context = (EMPTY_CONTEXT);
11888 this._hasExternalHostElement = isPresent(rootSelectorOrNode);
11889 this._hostInjector = hostInjector;
11890 this._hostProjectableNodes = projectableNodes;
11891 return this.createInternal(rootSelectorOrNode);
11892 };
11893 /**
11894 * Overwritten by implementations.
11895 * Returns the ComponentRef for the host element for ViewType.HOST.
11896 * @param {?} rootSelectorOrNode
11897 * @return {?}
11898 */
11899 AppView.prototype.createInternal = function (rootSelectorOrNode) { return null; };
11900 /**
11901 * Overwritten by implementations.
11902 * @param {?} templateNodeIndex
11903 * @return {?}
11904 */
11905 AppView.prototype.createEmbeddedViewInternal = function (templateNodeIndex) { return null; };
11906 /**
11907 * @param {?} lastRootNode
11908 * @param {?} allNodes
11909 * @param {?} disposables
11910 * @return {?}
11911 */
11912 AppView.prototype.init = function (lastRootNode, allNodes, disposables) {
11913 this.lastRootNode = lastRootNode;
11914 this.allNodes = allNodes;
11915 this.disposables = disposables;
11916 if (this.type === ViewType.COMPONENT) {
11917 this.dirtyParentQueriesInternal();
11918 }
11919 };
11920 /**
11921 * @param {?} token
11922 * @param {?} nodeIndex
11923 * @param {?=} notFoundValue
11924 * @return {?}
11925 */
11926 AppView.prototype.injectorGet = function (token, nodeIndex, notFoundValue) {
11927 if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; }
11928 var /** @type {?} */ result = UNDEFINED$1;
11929 var /** @type {?} */ view = this;
11930 while (result === UNDEFINED$1) {
11931 if (isPresent(nodeIndex)) {
11932 result = view.injectorGetInternal(token, nodeIndex, UNDEFINED$1);
11933 }
11934 if (result === UNDEFINED$1 && view.type === ViewType.HOST) {
11935 result = view._hostInjector.get(token, notFoundValue);
11936 }
11937 nodeIndex = view.parentIndex;
11938 view = view.parentView;
11939 }
11940 return result;
11941 };
11942 /**
11943 * Overwritten by implementations
11944 * @param {?} token
11945 * @param {?} nodeIndex
11946 * @param {?} notFoundResult
11947 * @return {?}
11948 */
11949 AppView.prototype.injectorGetInternal = function (token, nodeIndex, notFoundResult) {
11950 return notFoundResult;
11951 };
11952 /**
11953 * @param {?} nodeIndex
11954 * @return {?}
11955 */
11956 AppView.prototype.injector = function (nodeIndex) { return new ElementInjector(this, nodeIndex); };
11957 /**
11958 * @return {?}
11959 */
11960 AppView.prototype.detachAndDestroy = function () {
11961 if (this.viewContainer) {
11962 this.viewContainer.detachView(this.viewContainer.nestedViews.indexOf(this));
11963 }
11964 else if (this.appRef) {
11965 this.appRef.detachView(this.ref);
11966 }
11967 else if (this._hasExternalHostElement) {
11968 this.detach();
11969 }
11970 this.destroy();
11971 };
11972 /**
11973 * @return {?}
11974 */
11975 AppView.prototype.destroy = function () {
11976 var _this = this;
11977 if (this.cdMode === ChangeDetectorStatus.Destroyed) {
11978 return;
11979 }
11980 var /** @type {?} */ hostElement = this.type === ViewType.COMPONENT ? this.parentElement : null;
11981 if (this.disposables) {
11982 for (var /** @type {?} */ i = 0; i < this.disposables.length; i++) {
11983 this.disposables[i]();
11984 }
11985 }
11986 this.destroyInternal();
11987 this.dirtyParentQueriesInternal();
11988 if (this._animationContext) {
11989 this._animationContext.onAllActiveAnimationsDone(function () { return _this.renderer.destroyView(hostElement, _this.allNodes); });
11990 }
11991 else {
11992 this.renderer.destroyView(hostElement, this.allNodes);
11993 }
11994 this.cdMode = ChangeDetectorStatus.Destroyed;
11995 };
11996 /**
11997 * Overwritten by implementations
11998 * @return {?}
11999 */
12000 AppView.prototype.destroyInternal = function () { };
12001 /**
12002 * Overwritten by implementations
12003 * @return {?}
12004 */
12005 AppView.prototype.detachInternal = function () { };
12006 /**
12007 * @return {?}
12008 */
12009 AppView.prototype.detach = function () {
12010 var _this = this;
12011 this.detachInternal();
12012 if (this._animationContext) {
12013 this._animationContext.onAllActiveAnimationsDone(function () { return _this._renderDetach(); });
12014 }
12015 else {
12016 this._renderDetach();
12017 }
12018 if (this.declaredViewContainer && this.declaredViewContainer !== this.viewContainer &&
12019 this.declaredViewContainer.projectedViews) {
12020 var /** @type {?} */ projectedViews = this.declaredViewContainer.projectedViews;
12021 var /** @type {?} */ index = projectedViews.indexOf(this);
12022 // perf: pop is faster than splice!
12023 if (index >= projectedViews.length - 1) {
12024 projectedViews.pop();
12025 }
12026 else {
12027 projectedViews.splice(index, 1);
12028 }
12029 }
12030 this.appRef = null;
12031 this.viewContainer = null;
12032 this.dirtyParentQueriesInternal();
12033 };
12034 /**
12035 * @return {?}
12036 */
12037 AppView.prototype._renderDetach = function () {
12038 if (this._directRenderer) {
12039 this.visitRootNodesInternal(this._directRenderer.remove, null);
12040 }
12041 else {
12042 this.renderer.detachView(this.flatRootNodes);
12043 }
12044 };
12045 /**
12046 * @param {?} appRef
12047 * @return {?}
12048 */
12049 AppView.prototype.attachToAppRef = function (appRef) {
12050 if (this.viewContainer) {
12051 throw new Error('This view is already attached to a ViewContainer!');
12052 }
12053 this.appRef = appRef;
12054 this.dirtyParentQueriesInternal();
12055 };
12056 /**
12057 * @param {?} viewContainer
12058 * @param {?} prevView
12059 * @return {?}
12060 */
12061 AppView.prototype.attachAfter = function (viewContainer, prevView) {
12062 if (this.appRef) {
12063 throw new Error('This view is already attached directly to the ApplicationRef!');
12064 }
12065 this._renderAttach(viewContainer, prevView);
12066 this.viewContainer = viewContainer;
12067 if (this.declaredViewContainer && this.declaredViewContainer !== viewContainer) {
12068 if (!this.declaredViewContainer.projectedViews) {
12069 this.declaredViewContainer.projectedViews = [];
12070 }
12071 this.declaredViewContainer.projectedViews.push(this);
12072 }
12073 this.dirtyParentQueriesInternal();
12074 };
12075 /**
12076 * @param {?} viewContainer
12077 * @param {?} prevView
12078 * @return {?}
12079 */
12080 AppView.prototype.moveAfter = function (viewContainer, prevView) {
12081 this._renderAttach(viewContainer, prevView);
12082 this.dirtyParentQueriesInternal();
12083 };
12084 /**
12085 * @param {?} viewContainer
12086 * @param {?} prevView
12087 * @return {?}
12088 */
12089 AppView.prototype._renderAttach = function (viewContainer, prevView) {
12090 var /** @type {?} */ prevNode = prevView ? prevView.lastRootNode : viewContainer.nativeElement;
12091 if (this._directRenderer) {
12092 var /** @type {?} */ nextSibling = this._directRenderer.nextSibling(prevNode);
12093 if (nextSibling) {
12094 this.visitRootNodesInternal(this._directRenderer.insertBefore, nextSibling);
12095 }
12096 else {
12097 var /** @type {?} */ parentElement = this._directRenderer.parentElement(prevNode);
12098 if (parentElement) {
12099 this.visitRootNodesInternal(this._directRenderer.appendChild, parentElement);
12100 }
12101 }
12102 }
12103 else {
12104 this.renderer.attachViewAfter(prevNode, this.flatRootNodes);
12105 }
12106 };
12107 Object.defineProperty(AppView.prototype, "changeDetectorRef", {
12108 /**
12109 * @return {?}
12110 */
12111 get: function () { return this.ref; },
12112 enumerable: true,
12113 configurable: true
12114 });
12115 Object.defineProperty(AppView.prototype, "flatRootNodes", {
12116 /**
12117 * @return {?}
12118 */
12119 get: function () {
12120 var /** @type {?} */ nodes = [];
12121 this.visitRootNodesInternal(addToArray, nodes);
12122 return nodes;
12123 },
12124 enumerable: true,
12125 configurable: true
12126 });
12127 /**
12128 * @param {?} parentElement
12129 * @param {?} ngContentIndex
12130 * @return {?}
12131 */
12132 AppView.prototype.projectNodes = function (parentElement, ngContentIndex) {
12133 if (this._directRenderer) {
12134 this.visitProjectedNodes(ngContentIndex, this._directRenderer.appendChild, parentElement);
12135 }
12136 else {
12137 var /** @type {?} */ nodes = [];
12138 this.visitProjectedNodes(ngContentIndex, addToArray, nodes);
12139 this.renderer.projectNodes(parentElement, nodes);
12140 }
12141 };
12142 /**
12143 * @param {?} ngContentIndex
12144 * @param {?} cb
12145 * @param {?} c
12146 * @return {?}
12147 */
12148 AppView.prototype.visitProjectedNodes = function (ngContentIndex, cb, c) {
12149 switch (this.type) {
12150 case ViewType.EMBEDDED:
12151 this.parentView.visitProjectedNodes(ngContentIndex, cb, c);
12152 break;
12153 case ViewType.COMPONENT:
12154 if (this.parentView.type === ViewType.HOST) {
12155 var /** @type {?} */ nodes = this.parentView._hostProjectableNodes[ngContentIndex] || [];
12156 for (var /** @type {?} */ i = 0; i < nodes.length; i++) {
12157 cb(nodes[i], c);
12158 }
12159 }
12160 else {
12161 this.parentView.visitProjectableNodesInternal(this.parentIndex, ngContentIndex, cb, c);
12162 }
12163 break;
12164 }
12165 };
12166 /**
12167 * Overwritten by implementations
12168 * @param {?} cb
12169 * @param {?} c
12170 * @return {?}
12171 */
12172 AppView.prototype.visitRootNodesInternal = function (cb, c) { };
12173 /**
12174 * Overwritten by implementations
12175 * @param {?} nodeIndex
12176 * @param {?} ngContentIndex
12177 * @param {?} cb
12178 * @param {?} c
12179 * @return {?}
12180 */
12181 AppView.prototype.visitProjectableNodesInternal = function (nodeIndex, ngContentIndex, cb, c) { };
12182 /**
12183 * Overwritten by implementations
12184 * @return {?}
12185 */
12186 AppView.prototype.dirtyParentQueriesInternal = function () { };
12187 /**
12188 * @param {?} throwOnChange
12189 * @return {?}
12190 */
12191 AppView.prototype.internalDetectChanges = function (throwOnChange) {
12192 if (this.cdMode !== ChangeDetectorStatus.Detached) {
12193 this.detectChanges(throwOnChange);
12194 }
12195 };
12196 /**
12197 * @param {?} throwOnChange
12198 * @return {?}
12199 */
12200 AppView.prototype.detectChanges = function (throwOnChange) {
12201 var /** @type {?} */ s = _scope_check(this.clazz);
12202 if (this.cdMode === ChangeDetectorStatus.Checked ||
12203 this.cdMode === ChangeDetectorStatus.Errored)
12204 return;
12205 if (this.cdMode === ChangeDetectorStatus.Destroyed) {
12206 this.throwDestroyedError('detectChanges');
12207 }
12208 this.detectChangesInternal(throwOnChange);
12209 if (this.cdMode === ChangeDetectorStatus.CheckOnce)
12210 this.cdMode = ChangeDetectorStatus.Checked;
12211 this.numberOfChecks++;
12212 wtfLeave(s);
12213 };
12214 /**
12215 * Overwritten by implementations
12216 * @param {?} throwOnChange
12217 * @return {?}
12218 */
12219 AppView.prototype.detectChangesInternal = function (throwOnChange) { };
12220 /**
12221 * @return {?}
12222 */
12223 AppView.prototype.markAsCheckOnce = function () { this.cdMode = ChangeDetectorStatus.CheckOnce; };
12224 /**
12225 * @return {?}
12226 */
12227 AppView.prototype.markPathToRootAsCheckOnce = function () {
12228 var /** @type {?} */ c = this;
12229 while (isPresent(c) && c.cdMode !== ChangeDetectorStatus.Detached) {
12230 if (c.cdMode === ChangeDetectorStatus.Checked) {
12231 c.cdMode = ChangeDetectorStatus.CheckOnce;
12232 }
12233 if (c.type === ViewType.COMPONENT) {
12234 c = c.parentView;
12235 }
12236 else {
12237 c = c.viewContainer ? c.viewContainer.parentView : null;
12238 }
12239 }
12240 };
12241 /**
12242 * @param {?} cb
12243 * @return {?}
12244 */
12245 AppView.prototype.eventHandler = function (cb) {
12246 return cb;
12247 };
12248 /**
12249 * @param {?} details
12250 * @return {?}
12251 */
12252 AppView.prototype.throwDestroyedError = function (details) { throw new ViewDestroyedError(details); };
12253 return AppView;
12254 }());
12255 var DebugAppView = (function (_super) {
12256 __extends$14(DebugAppView, _super);
12257 /**
12258 * @param {?} clazz
12259 * @param {?} componentType
12260 * @param {?} type
12261 * @param {?} viewUtils
12262 * @param {?} parentView
12263 * @param {?} parentIndex
12264 * @param {?} parentNode
12265 * @param {?} cdMode
12266 * @param {?} staticNodeDebugInfos
12267 * @param {?=} declaredViewContainer
12268 */
12269 function DebugAppView(clazz, componentType, type, viewUtils, parentView, parentIndex, parentNode, cdMode, staticNodeDebugInfos, declaredViewContainer) {
12270 if (declaredViewContainer === void 0) { declaredViewContainer = null; }
12271 _super.call(this, clazz, componentType, type, viewUtils, parentView, parentIndex, parentNode, cdMode, declaredViewContainer);
12272 this.staticNodeDebugInfos = staticNodeDebugInfos;
12273 this._currentDebugContext = null;
12274 }
12275 /**
12276 * @param {?} context
12277 * @return {?}
12278 */
12279 DebugAppView.prototype.create = function (context) {
12280 this._resetDebug();
12281 try {
12282 return _super.prototype.create.call(this, context);
12283 }
12284 catch (e) {
12285 this._rethrowWithContext(e);
12286 throw e;
12287 }
12288 };
12289 /**
12290 * @param {?} rootSelectorOrNode
12291 * @param {?} injector
12292 * @param {?=} projectableNodes
12293 * @return {?}
12294 */
12295 DebugAppView.prototype.createHostView = function (rootSelectorOrNode, injector, projectableNodes) {
12296 if (projectableNodes === void 0) { projectableNodes = null; }
12297 this._resetDebug();
12298 try {
12299 return _super.prototype.createHostView.call(this, rootSelectorOrNode, injector, projectableNodes);
12300 }
12301 catch (e) {
12302 this._rethrowWithContext(e);
12303 throw e;
12304 }
12305 };
12306 /**
12307 * @param {?} token
12308 * @param {?} nodeIndex
12309 * @param {?=} notFoundResult
12310 * @return {?}
12311 */
12312 DebugAppView.prototype.injectorGet = function (token, nodeIndex, notFoundResult) {
12313 this._resetDebug();
12314 try {
12315 return _super.prototype.injectorGet.call(this, token, nodeIndex, notFoundResult);
12316 }
12317 catch (e) {
12318 this._rethrowWithContext(e);
12319 throw e;
12320 }
12321 };
12322 /**
12323 * @return {?}
12324 */
12325 DebugAppView.prototype.detach = function () {
12326 this._resetDebug();
12327 try {
12328 _super.prototype.detach.call(this);
12329 }
12330 catch (e) {
12331 this._rethrowWithContext(e);
12332 throw e;
12333 }
12334 };
12335 /**
12336 * @return {?}
12337 */
12338 DebugAppView.prototype.destroy = function () {
12339 this._resetDebug();
12340 try {
12341 _super.prototype.destroy.call(this);
12342 }
12343 catch (e) {
12344 this._rethrowWithContext(e);
12345 throw e;
12346 }
12347 };
12348 /**
12349 * @param {?} throwOnChange
12350 * @return {?}
12351 */
12352 DebugAppView.prototype.detectChanges = function (throwOnChange) {
12353 this._resetDebug();
12354 try {
12355 _super.prototype.detectChanges.call(this, throwOnChange);
12356 }
12357 catch (e) {
12358 this._rethrowWithContext(e);
12359 throw e;
12360 }
12361 };
12362 /**
12363 * @return {?}
12364 */
12365 DebugAppView.prototype._resetDebug = function () { this._currentDebugContext = null; };
12366 /**
12367 * @param {?} nodeIndex
12368 * @param {?} rowNum
12369 * @param {?} colNum
12370 * @return {?}
12371 */
12372 DebugAppView.prototype.debug = function (nodeIndex, rowNum, colNum) {
12373 return this._currentDebugContext = new DebugContext(this, nodeIndex, rowNum, colNum);
12374 };
12375 /**
12376 * @param {?} e
12377 * @return {?}
12378 */
12379 DebugAppView.prototype._rethrowWithContext = function (e) {
12380 if (!(e instanceof ViewWrappedError)) {
12381 if (!(e instanceof ExpressionChangedAfterItHasBeenCheckedError)) {
12382 this.cdMode = ChangeDetectorStatus.Errored;
12383 }
12384 if (isPresent(this._currentDebugContext)) {
12385 throw new ViewWrappedError(e, this._currentDebugContext);
12386 }
12387 }
12388 };
12389 /**
12390 * @param {?} cb
12391 * @return {?}
12392 */
12393 DebugAppView.prototype.eventHandler = function (cb) {
12394 var _this = this;
12395 var /** @type {?} */ superHandler = _super.prototype.eventHandler.call(this, cb);
12396 return function (eventName, event) {
12397 _this._resetDebug();
12398 try {
12399 return superHandler.call(_this, eventName, event);
12400 }
12401 catch (e) {
12402 _this._rethrowWithContext(e);
12403 throw e;
12404 }
12405 };
12406 };
12407 return DebugAppView;
12408 }(AppView));
12409
12410 /**
12411 * A ViewContainer is created for elements that have a ViewContainerRef
12412 * to keep track of the nested views.
12413 */
12414 var ViewContainer = (function () {
12415 /**
12416 * @param {?} index
12417 * @param {?} parentIndex
12418 * @param {?} parentView
12419 * @param {?} nativeElement
12420 */
12421 function ViewContainer(index, parentIndex, parentView, nativeElement) {
12422 this.index = index;
12423 this.parentIndex = parentIndex;
12424 this.parentView = parentView;
12425 this.nativeElement = nativeElement;
12426 }
12427 Object.defineProperty(ViewContainer.prototype, "elementRef", {
12428 /**
12429 * @return {?}
12430 */
12431 get: function () { return new ElementRef(this.nativeElement); },
12432 enumerable: true,
12433 configurable: true
12434 });
12435 Object.defineProperty(ViewContainer.prototype, "vcRef", {
12436 /**
12437 * @return {?}
12438 */
12439 get: function () { return new ViewContainerRef_(this); },
12440 enumerable: true,
12441 configurable: true
12442 });
12443 Object.defineProperty(ViewContainer.prototype, "parentInjector", {
12444 /**
12445 * @return {?}
12446 */
12447 get: function () { return this.parentView.injector(this.parentIndex); },
12448 enumerable: true,
12449 configurable: true
12450 });
12451 Object.defineProperty(ViewContainer.prototype, "injector", {
12452 /**
12453 * @return {?}
12454 */
12455 get: function () { return this.parentView.injector(this.index); },
12456 enumerable: true,
12457 configurable: true
12458 });
12459 /**
12460 * @param {?} throwOnChange
12461 * @return {?}
12462 */
12463 ViewContainer.prototype.detectChangesInNestedViews = function (throwOnChange) {
12464 if (this.nestedViews) {
12465 for (var /** @type {?} */ i = 0; i < this.nestedViews.length; i++) {
12466 this.nestedViews[i].detectChanges(throwOnChange);
12467 }
12468 }
12469 };
12470 /**
12471 * @return {?}
12472 */
12473 ViewContainer.prototype.destroyNestedViews = function () {
12474 if (this.nestedViews) {
12475 for (var /** @type {?} */ i = 0; i < this.nestedViews.length; i++) {
12476 this.nestedViews[i].destroy();
12477 }
12478 }
12479 };
12480 /**
12481 * @param {?} cb
12482 * @param {?} c
12483 * @return {?}
12484 */
12485 ViewContainer.prototype.visitNestedViewRootNodes = function (cb, c) {
12486 if (this.nestedViews) {
12487 for (var /** @type {?} */ i = 0; i < this.nestedViews.length; i++) {
12488 this.nestedViews[i].visitRootNodesInternal(cb, c);
12489 }
12490 }
12491 };
12492 /**
12493 * @param {?} nestedViewClass
12494 * @param {?} callback
12495 * @return {?}
12496 */
12497 ViewContainer.prototype.mapNestedViews = function (nestedViewClass, callback) {
12498 var /** @type {?} */ result = [];
12499 if (this.nestedViews) {
12500 for (var /** @type {?} */ i = 0; i < this.nestedViews.length; i++) {
12501 var /** @type {?} */ nestedView = this.nestedViews[i];
12502 if (nestedView.clazz === nestedViewClass) {
12503 result.push(callback(nestedView));
12504 }
12505 }
12506 }
12507 if (this.projectedViews) {
12508 for (var /** @type {?} */ i = 0; i < this.projectedViews.length; i++) {
12509 var /** @type {?} */ projectedView = this.projectedViews[i];
12510 if (projectedView.clazz === nestedViewClass) {
12511 result.push(callback(projectedView));
12512 }
12513 }
12514 }
12515 return result;
12516 };
12517 /**
12518 * @param {?} view
12519 * @param {?} currentIndex
12520 * @return {?}
12521 */
12522 ViewContainer.prototype.moveView = function (view, currentIndex) {
12523 var /** @type {?} */ previousIndex = this.nestedViews.indexOf(view);
12524 if (view.type === ViewType.COMPONENT) {
12525 throw new Error("Component views can't be moved!");
12526 }
12527 var /** @type {?} */ nestedViews = this.nestedViews;
12528 if (nestedViews == null) {
12529 nestedViews = [];
12530 this.nestedViews = nestedViews;
12531 }
12532 nestedViews.splice(previousIndex, 1);
12533 nestedViews.splice(currentIndex, 0, view);
12534 var /** @type {?} */ prevView = currentIndex > 0 ? nestedViews[currentIndex - 1] : null;
12535 view.moveAfter(this, prevView);
12536 };
12537 /**
12538 * @param {?} view
12539 * @param {?} viewIndex
12540 * @return {?}
12541 */
12542 ViewContainer.prototype.attachView = function (view, viewIndex) {
12543 if (view.type === ViewType.COMPONENT) {
12544 throw new Error("Component views can't be moved!");
12545 }
12546 var /** @type {?} */ nestedViews = this.nestedViews;
12547 if (nestedViews == null) {
12548 nestedViews = [];
12549 this.nestedViews = nestedViews;
12550 }
12551 // perf: array.push is faster than array.splice!
12552 if (viewIndex >= nestedViews.length) {
12553 nestedViews.push(view);
12554 }
12555 else {
12556 nestedViews.splice(viewIndex, 0, view);
12557 }
12558 var /** @type {?} */ prevView = viewIndex > 0 ? nestedViews[viewIndex - 1] : null;
12559 view.attachAfter(this, prevView);
12560 };
12561 /**
12562 * @param {?} viewIndex
12563 * @return {?}
12564 */
12565 ViewContainer.prototype.detachView = function (viewIndex) {
12566 var /** @type {?} */ view = this.nestedViews[viewIndex];
12567 // perf: array.pop is faster than array.splice!
12568 if (viewIndex >= this.nestedViews.length - 1) {
12569 this.nestedViews.pop();
12570 }
12571 else {
12572 this.nestedViews.splice(viewIndex, 1);
12573 }
12574 if (view.type === ViewType.COMPONENT) {
12575 throw new Error("Component views can't be moved!");
12576 }
12577 view.detach();
12578 return view;
12579 };
12580 return ViewContainer;
12581 }());
12582
12583 var /** @type {?} */ __core_private__ = {
12584 isDefaultChangeDetectionStrategy: isDefaultChangeDetectionStrategy,
12585 ChangeDetectorStatus: ChangeDetectorStatus,
12586 constructDependencies: constructDependencies,
12587 LifecycleHooks: LifecycleHooks,
12588 LIFECYCLE_HOOKS_VALUES: LIFECYCLE_HOOKS_VALUES,
12589 ReflectorReader: ReflectorReader,
12590 CodegenComponentFactoryResolver: CodegenComponentFactoryResolver,
12591 ComponentRef_: ComponentRef_,
12592 ViewContainer: ViewContainer,
12593 AppView: AppView,
12594 DebugAppView: DebugAppView,
12595 NgModuleInjector: NgModuleInjector,
12596 registerModuleFactory: registerModuleFactory,
12597 ViewType: ViewType,
12598 view_utils: view_utils,
12599 ViewMetadata: ViewMetadata,
12600 DebugContext: DebugContext,
12601 StaticNodeDebugInfo: StaticNodeDebugInfo,
12602 devModeEqual: devModeEqual,
12603 UNINITIALIZED: UNINITIALIZED,
12604 ValueUnwrapper: ValueUnwrapper,
12605 RenderDebugInfo: RenderDebugInfo,
12606 TemplateRef_: TemplateRef_,
12607 ReflectionCapabilities: ReflectionCapabilities,
12608 makeDecorator: makeDecorator,
12609 DebugDomRootRenderer: DebugDomRootRenderer,
12610 Console: Console,
12611 reflector: reflector,
12612 Reflector: Reflector,
12613 NoOpAnimationPlayer: NoOpAnimationPlayer,
12614 AnimationPlayer: AnimationPlayer,
12615 AnimationSequencePlayer: AnimationSequencePlayer,
12616 AnimationGroupPlayer: AnimationGroupPlayer,
12617 AnimationKeyframe: AnimationKeyframe,
12618 prepareFinalAnimationStyles: prepareFinalAnimationStyles,
12619 balanceAnimationKeyframes: balanceAnimationKeyframes,
12620 flattenStyles: flattenStyles,
12621 clearStyles: clearStyles,
12622 renderStyles: renderStyles,
12623 collectAndResolveStyles: collectAndResolveStyles,
12624 APP_ID_RANDOM_PROVIDER: APP_ID_RANDOM_PROVIDER,
12625 AnimationStyles: AnimationStyles,
12626 ANY_STATE: ANY_STATE,
12627 DEFAULT_STATE: DEFAULT_STATE,
12628 EMPTY_STATE: EMPTY_STATE,
12629 FILL_STYLE_FLAG: FILL_STYLE_FLAG,
12630 ComponentStillLoadingError: ComponentStillLoadingError,
12631 isPromise: isPromise,
12632 isObservable: isObservable,
12633 AnimationTransition: AnimationTransition
12634 };
12635
12636 exports.createPlatform = createPlatform;
12637 exports.assertPlatform = assertPlatform;
12638 exports.destroyPlatform = destroyPlatform;
12639 exports.getPlatform = getPlatform;
12640 exports.PlatformRef = PlatformRef;
12641 exports.ApplicationRef = ApplicationRef;
12642 exports.enableProdMode = enableProdMode;
12643 exports.isDevMode = isDevMode;
12644 exports.createPlatformFactory = createPlatformFactory;
12645 exports.NgProbeToken = NgProbeToken;
12646 exports.APP_ID = APP_ID;
12647 exports.PACKAGE_ROOT_URL = PACKAGE_ROOT_URL;
12648 exports.PLATFORM_INITIALIZER = PLATFORM_INITIALIZER;
12649 exports.APP_BOOTSTRAP_LISTENER = APP_BOOTSTRAP_LISTENER;
12650 exports.APP_INITIALIZER = APP_INITIALIZER;
12651 exports.ApplicationInitStatus = ApplicationInitStatus;
12652 exports.DebugElement = DebugElement;
12653 exports.DebugNode = DebugNode;
12654 exports.asNativeElements = asNativeElements;
12655 exports.getDebugNode = getDebugNode;
12656 exports.Testability = Testability;
12657 exports.TestabilityRegistry = TestabilityRegistry;
12658 exports.setTestabilityGetter = setTestabilityGetter;
12659 exports.TRANSLATIONS = TRANSLATIONS;
12660 exports.TRANSLATIONS_FORMAT = TRANSLATIONS_FORMAT;
12661 exports.LOCALE_ID = LOCALE_ID;
12662 exports.ApplicationModule = ApplicationModule;
12663 exports.wtfCreateScope = wtfCreateScope;
12664 exports.wtfLeave = wtfLeave;
12665 exports.wtfStartTimeRange = wtfStartTimeRange;
12666 exports.wtfEndTimeRange = wtfEndTimeRange;
12667 exports.Type = Type;
12668 exports.EventEmitter = EventEmitter;
12669 exports.ErrorHandler = ErrorHandler;
12670 exports.AnimationTransitionEvent = AnimationTransitionEvent;
12671 exports.AnimationPlayer = AnimationPlayer;
12672 exports.AnimationStyles = AnimationStyles;
12673 exports.AnimationKeyframe = AnimationKeyframe;
12674 exports.Sanitizer = Sanitizer;
12675 exports.SecurityContext = SecurityContext;
12676 exports.ANALYZE_FOR_ENTRY_COMPONENTS = ANALYZE_FOR_ENTRY_COMPONENTS;
12677 exports.Attribute = Attribute;
12678 exports.ContentChild = ContentChild;
12679 exports.ContentChildren = ContentChildren;
12680 exports.Query = Query;
12681 exports.ViewChild = ViewChild;
12682 exports.ViewChildren = ViewChildren;
12683 exports.Component = Component;
12684 exports.Directive = Directive;
12685 exports.HostBinding = HostBinding;
12686 exports.HostListener = HostListener;
12687 exports.Input = Input;
12688 exports.Output = Output;
12689 exports.Pipe = Pipe;
12690 exports.AfterContentChecked = AfterContentChecked;
12691 exports.AfterContentInit = AfterContentInit;
12692 exports.AfterViewChecked = AfterViewChecked;
12693 exports.AfterViewInit = AfterViewInit;
12694 exports.DoCheck = DoCheck;
12695 exports.OnChanges = OnChanges;
12696 exports.OnDestroy = OnDestroy;
12697 exports.OnInit = OnInit;
12698 exports.CUSTOM_ELEMENTS_SCHEMA = CUSTOM_ELEMENTS_SCHEMA;
12699 exports.NO_ERRORS_SCHEMA = NO_ERRORS_SCHEMA;
12700 exports.NgModule = NgModule;
12701 exports.ViewEncapsulation = ViewEncapsulation;
12702 exports.Version = Version;
12703 exports.VERSION = VERSION;
12704 exports.Class = Class;
12705 exports.forwardRef = forwardRef;
12706 exports.resolveForwardRef = resolveForwardRef;
12707 exports.Injector = Injector;
12708 exports.ReflectiveInjector = ReflectiveInjector;
12709 exports.ResolvedReflectiveFactory = ResolvedReflectiveFactory;
12710 exports.ReflectiveKey = ReflectiveKey;
12711 exports.OpaqueToken = OpaqueToken;
12712 exports.Inject = Inject;
12713 exports.Optional = Optional;
12714 exports.Injectable = Injectable;
12715 exports.Self = Self;
12716 exports.SkipSelf = SkipSelf;
12717 exports.Host = Host;
12718 exports.NgZone = NgZone;
12719 exports.RenderComponentType = RenderComponentType;
12720 exports.Renderer = Renderer;
12721 exports.RootRenderer = RootRenderer;
12722 exports.COMPILER_OPTIONS = COMPILER_OPTIONS;
12723 exports.Compiler = Compiler;
12724 exports.CompilerFactory = CompilerFactory;
12725 exports.ModuleWithComponentFactories = ModuleWithComponentFactories;
12726 exports.ComponentFactory = ComponentFactory;
12727 exports.ComponentRef = ComponentRef;
12728 exports.ComponentFactoryResolver = ComponentFactoryResolver;
12729 exports.ElementRef = ElementRef;
12730 exports.NgModuleFactory = NgModuleFactory;
12731 exports.NgModuleRef = NgModuleRef;
12732 exports.NgModuleFactoryLoader = NgModuleFactoryLoader;
12733 exports.getModuleFactory = getModuleFactory;
12734 exports.QueryList = QueryList;
12735 exports.SystemJsNgModuleLoader = SystemJsNgModuleLoader;
12736 exports.SystemJsNgModuleLoaderConfig = SystemJsNgModuleLoaderConfig;
12737 exports.TemplateRef = TemplateRef;
12738 exports.ViewContainerRef = ViewContainerRef;
12739 exports.EmbeddedViewRef = EmbeddedViewRef;
12740 exports.ViewRef = ViewRef;
12741 exports.ChangeDetectionStrategy = ChangeDetectionStrategy;
12742 exports.ChangeDetectorRef = ChangeDetectorRef;
12743 exports.CollectionChangeRecord = CollectionChangeRecord;
12744 exports.DefaultIterableDiffer = DefaultIterableDiffer;
12745 exports.IterableDiffers = IterableDiffers;
12746 exports.KeyValueChangeRecord = KeyValueChangeRecord;
12747 exports.KeyValueDiffers = KeyValueDiffers;
12748 exports.SimpleChange = SimpleChange;
12749 exports.WrappedValue = WrappedValue;
12750 exports.platformCore = platformCore;
12751 exports.__core_private__ = __core_private__;
12752 exports.AUTO_STYLE = AUTO_STYLE;
12753 exports.AnimationEntryMetadata = AnimationEntryMetadata;
12754 exports.AnimationStateMetadata = AnimationStateMetadata;
12755 exports.AnimationStateDeclarationMetadata = AnimationStateDeclarationMetadata;
12756 exports.AnimationStateTransitionMetadata = AnimationStateTransitionMetadata;
12757 exports.AnimationMetadata = AnimationMetadata;
12758 exports.AnimationKeyframesSequenceMetadata = AnimationKeyframesSequenceMetadata;
12759 exports.AnimationStyleMetadata = AnimationStyleMetadata;
12760 exports.AnimationAnimateMetadata = AnimationAnimateMetadata;
12761 exports.AnimationWithStepsMetadata = AnimationWithStepsMetadata;
12762 exports.AnimationSequenceMetadata = AnimationSequenceMetadata;
12763 exports.AnimationGroupMetadata = AnimationGroupMetadata;
12764 exports.animate = animate;
12765 exports.group = group;
12766 exports.sequence = sequence;
12767 exports.style = style;
12768 exports.state = state;
12769 exports.keyframes = keyframes;
12770 exports.transition = transition;
12771 exports.trigger = trigger;
12772
12773}));
\No newline at end of file