1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | (function (global, factory) {
|
7 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs/Observable'), require('rxjs/observable/merge'), require('rxjs/operator/share'), require('rxjs/Subject')) :
|
8 | typeof define === 'function' && define.amd ? define(['exports', 'rxjs/Observable', 'rxjs/observable/merge', 'rxjs/operator/share', 'rxjs/Subject'], factory) :
|
9 | (factory((global.ng = global.ng || {}, global.ng.core = global.ng.core || {}),global.Rx,global.Rx.Observable,global.Rx.Observable.prototype,global.Rx));
|
10 | }(this, (function (exports,rxjs_Observable,rxjs_observable_merge,rxjs_operator_share,rxjs_Subject) { 'use strict';
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | var extendStatics = Object.setPrototypeOf ||
|
29 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
30 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
31 |
|
32 | function __extends(d, b) {
|
33 | extendStatics(d, b);
|
34 | function __() { this.constructor = d; }
|
35 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
36 | }
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | var OpaqueToken = (function () {
|
67 | |
68 |
|
69 |
|
70 | function OpaqueToken(_desc) {
|
71 | this._desc = _desc;
|
72 | }
|
73 | |
74 |
|
75 |
|
76 | OpaqueToken.prototype.toString = function () { return "Token " + this._desc; };
|
77 | return OpaqueToken;
|
78 | }());
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 |
|
101 | var InjectionToken = (function (_super) {
|
102 | __extends(InjectionToken, _super);
|
103 | |
104 |
|
105 |
|
106 | function InjectionToken(desc) {
|
107 | return _super.call(this, desc) || this;
|
108 | }
|
109 | |
110 |
|
111 |
|
112 | InjectionToken.prototype.toString = function () { return "InjectionToken " + this._desc; };
|
113 | return InjectionToken;
|
114 | }(OpaqueToken));
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 | var __window = typeof window !== 'undefined' && window;
|
123 | var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
|
124 | self instanceof WorkerGlobalScope && self;
|
125 | var __global = typeof global !== 'undefined' && global;
|
126 | var _global = __window || __global || __self;
|
127 | var _symbolIterator = null;
|
128 |
|
129 |
|
130 |
|
131 | function getSymbolIterator() {
|
132 | if (!_symbolIterator) {
|
133 | var Symbol = _global['Symbol'];
|
134 | if (Symbol && Symbol.iterator) {
|
135 | _symbolIterator = Symbol.iterator;
|
136 | }
|
137 | else {
|
138 |
|
139 | var keys = Object.getOwnPropertyNames(Map.prototype);
|
140 | for (var i = 0; i < keys.length; ++i) {
|
141 | var key = keys[i];
|
142 | if (key !== 'entries' && key !== 'size' &&
|
143 | ((Map)).prototype[key] === Map.prototype['entries']) {
|
144 | _symbolIterator = key;
|
145 | }
|
146 | }
|
147 | }
|
148 | }
|
149 | return _symbolIterator;
|
150 | }
|
151 |
|
152 |
|
153 |
|
154 |
|
155 | function scheduleMicroTask(fn) {
|
156 | Zone.current.scheduleMicroTask('scheduleMicrotask', fn);
|
157 | }
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 | function looseIdentical(a, b) {
|
164 | return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b);
|
165 | }
|
166 |
|
167 |
|
168 |
|
169 |
|
170 | function stringify(token) {
|
171 | if (typeof token === 'string') {
|
172 | return token;
|
173 | }
|
174 | if (token == null) {
|
175 | return '' + token;
|
176 | }
|
177 | if (token.overriddenName) {
|
178 | return "" + token.overriddenName;
|
179 | }
|
180 | if (token.name) {
|
181 | return "" + token.name;
|
182 | }
|
183 | var res = token.toString();
|
184 | if (res == null) {
|
185 | return '' + res;
|
186 | }
|
187 | var newLineIndex = res.indexOf('\n');
|
188 | return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
|
189 | }
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 | var _nextClassId = 0;
|
198 | var Reflect$1 = _global['Reflect'];
|
199 |
|
200 |
|
201 |
|
202 |
|
203 | function extractAnnotation(annotation) {
|
204 | if (typeof annotation === 'function' && annotation.hasOwnProperty('annotation')) {
|
205 |
|
206 | annotation = annotation.annotation;
|
207 | }
|
208 | return annotation;
|
209 | }
|
210 |
|
211 |
|
212 |
|
213 |
|
214 |
|
215 | function applyParams(fnOrArray, key) {
|
216 | if (fnOrArray === Object || fnOrArray === String || fnOrArray === Function ||
|
217 | fnOrArray === Number || fnOrArray === Array) {
|
218 | throw new Error("Can not use native " + stringify(fnOrArray) + " as constructor");
|
219 | }
|
220 | if (typeof fnOrArray === 'function') {
|
221 | return fnOrArray;
|
222 | }
|
223 | if (Array.isArray(fnOrArray)) {
|
224 | var annotations = (fnOrArray);
|
225 | var annoLength = annotations.length - 1;
|
226 | var fn = fnOrArray[annoLength];
|
227 | if (typeof fn !== 'function') {
|
228 | throw new Error("Last position of Class method array must be Function in key " + key + " was '" + stringify(fn) + "'");
|
229 | }
|
230 | if (annoLength != fn.length) {
|
231 | throw new Error("Number of annotations (" + annoLength + ") does not match number of arguments (" + fn.length + ") in the function: " + stringify(fn));
|
232 | }
|
233 | var paramsAnnotations = [];
|
234 | for (var i = 0, ii = annotations.length - 1; i < ii; i++) {
|
235 | var paramAnnotations = [];
|
236 | paramsAnnotations.push(paramAnnotations);
|
237 | var annotation = annotations[i];
|
238 | if (Array.isArray(annotation)) {
|
239 | for (var j = 0; j < annotation.length; j++) {
|
240 | paramAnnotations.push(extractAnnotation(annotation[j]));
|
241 | }
|
242 | }
|
243 | else if (typeof annotation === 'function') {
|
244 | paramAnnotations.push(extractAnnotation(annotation));
|
245 | }
|
246 | else {
|
247 | paramAnnotations.push(annotation);
|
248 | }
|
249 | }
|
250 | Reflect$1.defineMetadata('parameters', paramsAnnotations, fn);
|
251 | return fn;
|
252 | }
|
253 | throw new Error("Only Function or Array is supported in Class definition for key '" + key + "' is '" + stringify(fnOrArray) + "'");
|
254 | }
|
255 |
|
256 |
|
257 |
|
258 |
|
259 |
|
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 |
|
310 |
|
311 |
|
312 |
|
313 |
|
314 |
|
315 |
|
316 |
|
317 |
|
318 |
|
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 |
|
325 |
|
326 |
|
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 |
|
340 | function Class(clsDef) {
|
341 | var constructor = applyParams(clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor');
|
342 | var /** @type {?} */ proto = constructor.prototype;
|
343 | if (clsDef.hasOwnProperty('extends')) {
|
344 | if (typeof clsDef.extends === 'function') {
|
345 | ((constructor)).prototype = proto =
|
346 | Object.create(((clsDef.extends)).prototype);
|
347 | }
|
348 | else {
|
349 | throw new Error("Class definition 'extends' property must be a constructor function was: " + stringify(clsDef.extends));
|
350 | }
|
351 | }
|
352 | for (var key in clsDef) {
|
353 | if (key !== 'extends' && key !== 'prototype' && clsDef.hasOwnProperty(key)) {
|
354 | proto[key] = applyParams(clsDef[key], key);
|
355 | }
|
356 | }
|
357 | if (this && this.annotations instanceof Array) {
|
358 | Reflect$1.defineMetadata('annotations', this.annotations, constructor);
|
359 | }
|
360 | var /** @type {?} */ constructorName = constructor['name'];
|
361 | if (!constructorName || constructorName === 'constructor') {
|
362 | ((constructor))['overriddenName'] = "class" + _nextClassId++;
|
363 | }
|
364 | return (constructor);
|
365 | }
|
366 | /**
|
367 | * @suppress {globalThis}
|
368 | * @param {?} name
|
369 | * @param {?=} props
|
370 | * @param {?=} parentClass
|
371 | * @param {?=} chainFn
|
372 | * @return {?}
|
373 | */
|
374 | function makeDecorator(name, props, parentClass, chainFn) {
|
375 | var metaCtor = makeMetadataCtor(props);
|
376 | |
377 |
|
378 |
|
379 |
|
380 | function DecoratorFactory(objOrType) {
|
381 | if (!(Reflect$1 && Reflect$1.getOwnMetadata)) {
|
382 | throw 'reflect-metadata shim is required when using class decorators';
|
383 | }
|
384 | if (this instanceof DecoratorFactory) {
|
385 | metaCtor.call(this, objOrType);
|
386 | return this;
|
387 | }
|
388 | var annotationInstance = new ((DecoratorFactory))(objOrType);
|
389 | var chainAnnotation = typeof this === 'function' && Array.isArray(this.annotations) ? this.annotations : [];
|
390 | chainAnnotation.push(annotationInstance);
|
391 | var TypeDecorator = (function TypeDecorator(cls) {
|
392 | var annotations = Reflect$1.getOwnMetadata('annotations', cls) || [];
|
393 | annotations.push(annotationInstance);
|
394 | Reflect$1.defineMetadata('annotations', annotations, cls);
|
395 | return cls;
|
396 | });
|
397 | TypeDecorator.annotations = chainAnnotation;
|
398 | TypeDecorator.Class = Class;
|
399 | if (chainFn)
|
400 | chainFn(TypeDecorator);
|
401 | return TypeDecorator;
|
402 | }
|
403 | if (parentClass) {
|
404 | DecoratorFactory.prototype = Object.create(parentClass.prototype);
|
405 | }
|
406 | DecoratorFactory.prototype.toString = function () { return "@" + name; };
|
407 | ((DecoratorFactory)).annotationCls = DecoratorFactory;
|
408 | return DecoratorFactory;
|
409 | }
|
410 |
|
411 |
|
412 |
|
413 |
|
414 | function makeMetadataCtor(props) {
|
415 | return function ctor() {
|
416 | var args = [];
|
417 | for (var _i = 0; _i < arguments.length; _i++) {
|
418 | args[_i] = arguments[_i];
|
419 | }
|
420 | if (props) {
|
421 | var values = props.apply(void 0, args);
|
422 | for (var propName in values) {
|
423 | this[propName] = values[propName];
|
424 | }
|
425 | }
|
426 | };
|
427 | }
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 |
|
434 | function makeParamDecorator(name, props, parentClass) {
|
435 | var metaCtor = makeMetadataCtor(props);
|
436 | |
437 |
|
438 |
|
439 |
|
440 | function ParamDecoratorFactory() {
|
441 | var args = [];
|
442 | for (var _i = 0; _i < arguments.length; _i++) {
|
443 | args[_i] = arguments[_i];
|
444 | }
|
445 | if (this instanceof ParamDecoratorFactory) {
|
446 | metaCtor.apply(this, args);
|
447 | return this;
|
448 | }
|
449 | var annotationInstance = new (((ParamDecoratorFactory)).bind.apply(((ParamDecoratorFactory)), [void 0].concat(args)))();
|
450 | ((ParamDecorator)).annotation = annotationInstance;
|
451 | return ParamDecorator;
|
452 | |
453 |
|
454 |
|
455 |
|
456 |
|
457 |
|
458 | function ParamDecorator(cls, unusedKey, index) {
|
459 | var parameters = Reflect$1.getOwnMetadata('parameters', cls) || [];
|
460 |
|
461 |
|
462 | while (parameters.length <= index) {
|
463 | parameters.push(null);
|
464 | }
|
465 | parameters[index] = parameters[index] || [];
|
466 | ((parameters[index])).push(annotationInstance);
|
467 | Reflect$1.defineMetadata('parameters', parameters, cls);
|
468 | return cls;
|
469 | }
|
470 | }
|
471 | if (parentClass) {
|
472 | ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);
|
473 | }
|
474 | ParamDecoratorFactory.prototype.toString = function () { return "@" + name; };
|
475 | ((ParamDecoratorFactory)).annotationCls = ParamDecoratorFactory;
|
476 | return ParamDecoratorFactory;
|
477 | }
|
478 |
|
479 |
|
480 |
|
481 |
|
482 |
|
483 |
|
484 | function makePropDecorator(name, props, parentClass) {
|
485 | var metaCtor = makeMetadataCtor(props);
|
486 | |
487 |
|
488 |
|
489 |
|
490 | function PropDecoratorFactory() {
|
491 | var args = [];
|
492 | for (var _i = 0; _i < arguments.length; _i++) {
|
493 | args[_i] = arguments[_i];
|
494 | }
|
495 | if (this instanceof PropDecoratorFactory) {
|
496 | metaCtor.apply(this, args);
|
497 | return this;
|
498 | }
|
499 | var decoratorInstance = new (((PropDecoratorFactory)).bind.apply(((PropDecoratorFactory)), [void 0].concat(args)))();
|
500 | return function PropDecorator(target, name) {
|
501 | var meta = Reflect$1.getOwnMetadata('propMetadata', target.constructor) || {};
|
502 | meta[name] = meta.hasOwnProperty(name) && meta[name] || [];
|
503 | meta[name].unshift(decoratorInstance);
|
504 | Reflect$1.defineMetadata('propMetadata', meta, target.constructor);
|
505 | };
|
506 | }
|
507 | if (parentClass) {
|
508 | PropDecoratorFactory.prototype = Object.create(parentClass.prototype);
|
509 | }
|
510 | PropDecoratorFactory.prototype.toString = function () { return "@" + name; };
|
511 | ((PropDecoratorFactory)).annotationCls = PropDecoratorFactory;
|
512 | return PropDecoratorFactory;
|
513 | }
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 |
|
534 |
|
535 |
|
536 |
|
537 |
|
538 |
|
539 |
|
540 |
|
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 | var ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken('AnalyzeForEntryComponents');
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 | var Attribute = makeParamDecorator('Attribute', function (attributeName) { return ({ attributeName: attributeName }); });
|
563 |
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 | var Query = (function () {
|
573 | function Query() {
|
574 | }
|
575 | return Query;
|
576 | }());
|
577 |
|
578 |
|
579 |
|
580 |
|
581 |
|
582 |
|
583 | var ContentChildren = makePropDecorator('ContentChildren', function (selector, data) {
|
584 | if (data === void 0) { data = {}; }
|
585 | return (Object.assign({ selector: selector, first: false, isViewQuery: false, descendants: false }, data));
|
586 | }, Query);
|
587 |
|
588 |
|
589 |
|
590 |
|
591 |
|
592 |
|
593 | var ContentChild = makePropDecorator('ContentChild', function (selector, data) {
|
594 | if (data === void 0) { data = {}; }
|
595 | return (Object.assign({ selector: selector, first: true, isViewQuery: false, descendants: true }, data));
|
596 | }, Query);
|
597 |
|
598 |
|
599 |
|
600 |
|
601 |
|
602 |
|
603 | var ViewChildren = makePropDecorator('ViewChildren', function (selector, data) {
|
604 | if (data === void 0) { data = {}; }
|
605 | return (Object.assign({ selector: selector, first: false, isViewQuery: true, descendants: true }, data));
|
606 | }, Query);
|
607 |
|
608 |
|
609 |
|
610 |
|
611 |
|
612 |
|
613 | var ViewChild = makePropDecorator('ViewChild', function (selector, data) { return (Object.assign({ selector: selector, first: true, isViewQuery: true, descendants: true }, data)); }, Query);
|
614 | var ChangeDetectionStrategy = {};
|
615 | ChangeDetectionStrategy.OnPush = 0;
|
616 | ChangeDetectionStrategy.Default = 1;
|
617 | ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = "OnPush";
|
618 | ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default";
|
619 | var ChangeDetectorStatus = {};
|
620 | ChangeDetectorStatus.CheckOnce = 0;
|
621 | ChangeDetectorStatus.Checked = 1;
|
622 | ChangeDetectorStatus.CheckAlways = 2;
|
623 | ChangeDetectorStatus.Detached = 3;
|
624 | ChangeDetectorStatus.Errored = 4;
|
625 | ChangeDetectorStatus.Destroyed = 5;
|
626 | ChangeDetectorStatus[ChangeDetectorStatus.CheckOnce] = "CheckOnce";
|
627 | ChangeDetectorStatus[ChangeDetectorStatus.Checked] = "Checked";
|
628 | ChangeDetectorStatus[ChangeDetectorStatus.CheckAlways] = "CheckAlways";
|
629 | ChangeDetectorStatus[ChangeDetectorStatus.Detached] = "Detached";
|
630 | ChangeDetectorStatus[ChangeDetectorStatus.Errored] = "Errored";
|
631 | ChangeDetectorStatus[ChangeDetectorStatus.Destroyed] = "Destroyed";
|
632 |
|
633 |
|
634 |
|
635 |
|
636 | function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
|
637 | return changeDetectionStrategy == null ||
|
638 | changeDetectionStrategy === ChangeDetectionStrategy.Default;
|
639 | }
|
640 |
|
641 |
|
642 |
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 | var Directive = makeDecorator('Directive', function (dir) {
|
654 | if (dir === void 0) { dir = {}; }
|
655 | return dir;
|
656 | });
|
657 |
|
658 |
|
659 |
|
660 |
|
661 |
|
662 |
|
663 | var Component = makeDecorator('Component', function (c) {
|
664 | if (c === void 0) { c = {}; }
|
665 | return (Object.assign({ changeDetection: ChangeDetectionStrategy.Default }, c));
|
666 | }, Directive);
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 | var Pipe = makeDecorator('Pipe', function (p) { return (Object.assign({ pure: true }, p)); });
|
674 |
|
675 |
|
676 |
|
677 |
|
678 |
|
679 |
|
680 | var Input = makePropDecorator('Input', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
|
681 |
|
682 |
|
683 |
|
684 |
|
685 |
|
686 |
|
687 | var Output = makePropDecorator('Output', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
|
688 |
|
689 |
|
690 |
|
691 |
|
692 |
|
693 |
|
694 | var HostBinding = makePropDecorator('HostBinding', function (hostPropertyName) { return ({ hostPropertyName: hostPropertyName }); });
|
695 |
|
696 |
|
697 |
|
698 |
|
699 |
|
700 |
|
701 | var HostListener = makePropDecorator('HostListener', function (eventName, args) { return ({ eventName: eventName, args: args }); });
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 | var CUSTOM_ELEMENTS_SCHEMA = {
|
718 | name: 'custom-elements'
|
719 | };
|
720 |
|
721 |
|
722 |
|
723 |
|
724 |
|
725 | var NO_ERRORS_SCHEMA = {
|
726 | name: 'no-errors-schema'
|
727 | };
|
728 |
|
729 |
|
730 |
|
731 |
|
732 |
|
733 |
|
734 | var NgModule = makeDecorator('NgModule', function (ngModule) { return ngModule; });
|
735 | var ViewEncapsulation = {};
|
736 | ViewEncapsulation.Emulated = 0;
|
737 | ViewEncapsulation.Native = 1;
|
738 | ViewEncapsulation.None = 2;
|
739 | ViewEncapsulation[ViewEncapsulation.Emulated] = "Emulated";
|
740 | ViewEncapsulation[ViewEncapsulation.Native] = "Native";
|
741 | ViewEncapsulation[ViewEncapsulation.None] = "None";
|
742 |
|
743 |
|
744 |
|
745 |
|
746 |
|
747 |
|
748 |
|
749 |
|
750 |
|
751 |
|
752 |
|
753 |
|
754 |
|
755 |
|
756 |
|
757 |
|
758 |
|
759 |
|
760 |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 |
|
766 |
|
767 | var ViewMetadata = (function () {
|
768 | |
769 |
|
770 |
|
771 | function ViewMetadata(_a) {
|
772 | var _b = _a === void 0 ? {} : _a, templateUrl = _b.templateUrl, template = _b.template, encapsulation = _b.encapsulation, styles = _b.styles, styleUrls = _b.styleUrls, animations = _b.animations, interpolation = _b.interpolation;
|
773 | this.templateUrl = templateUrl;
|
774 | this.template = template;
|
775 | this.styleUrls = styleUrls;
|
776 | this.styles = styles;
|
777 | this.encapsulation = encapsulation;
|
778 | this.animations = animations;
|
779 | this.interpolation = interpolation;
|
780 | }
|
781 | return ViewMetadata;
|
782 | }());
|
783 |
|
784 |
|
785 |
|
786 |
|
787 |
|
788 |
|
789 |
|
790 |
|
791 |
|
792 |
|
793 |
|
794 |
|
795 | var Version = (function () {
|
796 | |
797 |
|
798 |
|
799 | function Version(full) {
|
800 | this.full = full;
|
801 | }
|
802 | Object.defineProperty(Version.prototype, "major", {
|
803 | |
804 |
|
805 |
|
806 | get: function () { return this.full.split('.')[0]; },
|
807 | enumerable: true,
|
808 | configurable: true
|
809 | });
|
810 | Object.defineProperty(Version.prototype, "minor", {
|
811 | |
812 |
|
813 |
|
814 | get: function () { return this.full.split('.')[1]; },
|
815 | enumerable: true,
|
816 | configurable: true
|
817 | });
|
818 | Object.defineProperty(Version.prototype, "patch", {
|
819 | |
820 |
|
821 |
|
822 | get: function () { return this.full.split('.').slice(2).join('.'); },
|
823 | enumerable: true,
|
824 | configurable: true
|
825 | });
|
826 | return Version;
|
827 | }());
|
828 |
|
829 |
|
830 |
|
831 | var VERSION = new Version('4.2.3');
|
832 |
|
833 |
|
834 |
|
835 |
|
836 |
|
837 |
|
838 |
|
839 |
|
840 |
|
841 |
|
842 |
|
843 |
|
844 |
|
845 | var Inject = makeParamDecorator('Inject', function (token) { return ({ token: token }); });
|
846 |
|
847 |
|
848 |
|
849 |
|
850 |
|
851 |
|
852 | var Optional = makeParamDecorator('Optional');
|
853 |
|
854 |
|
855 |
|
856 |
|
857 |
|
858 |
|
859 | var Injectable = makeDecorator('Injectable');
|
860 |
|
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 | var Self = makeParamDecorator('Self');
|
867 |
|
868 |
|
869 |
|
870 |
|
871 |
|
872 |
|
873 | var SkipSelf = makeParamDecorator('SkipSelf');
|
874 |
|
875 |
|
876 |
|
877 |
|
878 |
|
879 |
|
880 | var Host = makeParamDecorator('Host');
|
881 |
|
882 |
|
883 |
|
884 |
|
885 |
|
886 |
|
887 |
|
888 |
|
889 |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 |
|
895 |
|
896 |
|
897 |
|
898 |
|
899 |
|
900 |
|
901 |
|
902 | function forwardRef(forwardRefFn) {
|
903 | ((forwardRefFn)).__forward_ref__ = forwardRef;
|
904 | ((forwardRefFn)).toString = function () { return stringify(this()); };
|
905 | return (((forwardRefFn)));
|
906 | }
|
907 |
|
908 |
|
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 | function resolveForwardRef(type) {
|
922 | if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') &&
|
923 | type.__forward_ref__ === forwardRef) {
|
924 | return ((type))();
|
925 | }
|
926 | else {
|
927 | return type;
|
928 | }
|
929 | }
|
930 |
|
931 |
|
932 |
|
933 |
|
934 |
|
935 |
|
936 |
|
937 | var _THROW_IF_NOT_FOUND = new Object();
|
938 | var THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
|
939 | var _NullInjector = (function () {
|
940 | function _NullInjector() {
|
941 | }
|
942 | |
943 |
|
944 |
|
945 |
|
946 |
|
947 | _NullInjector.prototype.get = function (token, notFoundValue) {
|
948 | if (notFoundValue === void 0) { notFoundValue = _THROW_IF_NOT_FOUND; }
|
949 | if (notFoundValue === _THROW_IF_NOT_FOUND) {
|
950 | throw new Error("No provider for " + stringify(token) + "!");
|
951 | }
|
952 | return notFoundValue;
|
953 | };
|
954 | return _NullInjector;
|
955 | }());
|
956 |
|
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 | var Injector = (function () {
|
978 | function Injector() {
|
979 | }
|
980 | |
981 |
|
982 |
|
983 |
|
984 |
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 | Injector.prototype.get = function (token, notFoundValue) { };
|
993 | |
994 |
|
995 |
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 |
|
1001 | Injector.prototype.get = function (token, notFoundValue) { };
|
1002 | return Injector;
|
1003 | }());
|
1004 | Injector.THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
|
1005 | Injector.NULL = new _NullInjector();
|
1006 |
|
1007 |
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 | var ERROR_COMPONENT_TYPE = 'ngComponentType';
|
1014 | var ERROR_DEBUG_CONTEXT = 'ngDebugContext';
|
1015 | var ERROR_ORIGINAL_ERROR = 'ngOriginalError';
|
1016 | var ERROR_LOGGER = 'ngErrorLogger';
|
1017 |
|
1018 |
|
1019 |
|
1020 |
|
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 | function getDebugContext(error) {
|
1026 | return ((error))[ERROR_DEBUG_CONTEXT];
|
1027 | }
|
1028 |
|
1029 |
|
1030 |
|
1031 |
|
1032 | function getOriginalError(error) {
|
1033 | return ((error))[ERROR_ORIGINAL_ERROR];
|
1034 | }
|
1035 |
|
1036 |
|
1037 |
|
1038 |
|
1039 | function getErrorLogger(error) {
|
1040 | return ((error))[ERROR_LOGGER] || defaultErrorLogger;
|
1041 | }
|
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 |
|
1047 | function defaultErrorLogger(console) {
|
1048 | var values = [];
|
1049 | for (var _i = 1; _i < arguments.length; _i++) {
|
1050 | values[_i - 1] = arguments[_i];
|
1051 | }
|
1052 | console.error.apply(console, values);
|
1053 | }
|
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 |
|
1085 |
|
1086 |
|
1087 | var ErrorHandler = (function () {
|
1088 | |
1089 |
|
1090 |
|
1091 | function ErrorHandler(
|
1092 | /**
|
1093 | * @deprecated since v4.0 parameter no longer has an effect, as ErrorHandler will never
|
1094 | * rethrow.
|
1095 | */
|
1096 | deprecatedParameter) {
|
1097 | |
1098 |
|
1099 |
|
1100 | this._console = console;
|
1101 | }
|
1102 | |
1103 |
|
1104 |
|
1105 |
|
1106 | ErrorHandler.prototype.handleError = function (error) {
|
1107 | var originalError = this._findOriginalError(error);
|
1108 | var context = this._findContext(error);
|
1109 |
|
1110 |
|
1111 | var errorLogger = getErrorLogger(error);
|
1112 | errorLogger(this._console, "ERROR", error);
|
1113 | if (originalError) {
|
1114 | errorLogger(this._console, "ORIGINAL ERROR", originalError);
|
1115 | }
|
1116 | if (context) {
|
1117 | errorLogger(this._console, 'ERROR CONTEXT', context);
|
1118 | }
|
1119 | };
|
1120 | |
1121 |
|
1122 |
|
1123 |
|
1124 |
|
1125 | ErrorHandler.prototype._findContext = function (error) {
|
1126 | if (error) {
|
1127 | return getDebugContext(error) ? getDebugContext(error) :
|
1128 | this._findContext(getOriginalError(error));
|
1129 | }
|
1130 | return null;
|
1131 | };
|
1132 | |
1133 |
|
1134 |
|
1135 |
|
1136 |
|
1137 | ErrorHandler.prototype._findOriginalError = function (error) {
|
1138 | var e = getOriginalError(error);
|
1139 | while (e && getOriginalError(e)) {
|
1140 | e = getOriginalError(e);
|
1141 | }
|
1142 | return e;
|
1143 | };
|
1144 | return ErrorHandler;
|
1145 | }());
|
1146 |
|
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 | function wrappedError(message, originalError) {
|
1152 | var msg = message + " caused by: " + (originalError instanceof Error ? originalError.message : originalError);
|
1153 | var error = Error(msg);
|
1154 | ((error))[ERROR_ORIGINAL_ERROR] = originalError;
|
1155 | return error;
|
1156 | }
|
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 | function findFirstClosedCycle(keys) {
|
1169 | var res = [];
|
1170 | for (var i = 0; i < keys.length; ++i) {
|
1171 | if (res.indexOf(keys[i]) > -1) {
|
1172 | res.push(keys[i]);
|
1173 | return res;
|
1174 | }
|
1175 | res.push(keys[i]);
|
1176 | }
|
1177 | return res;
|
1178 | }
|
1179 |
|
1180 |
|
1181 |
|
1182 |
|
1183 | function constructResolvingPath(keys) {
|
1184 | if (keys.length > 1) {
|
1185 | var reversed = findFirstClosedCycle(keys.slice().reverse());
|
1186 | var tokenStrs = reversed.map(function (k) { return stringify(k.token); });
|
1187 | return ' (' + tokenStrs.join(' -> ') + ')';
|
1188 | }
|
1189 | return '';
|
1190 | }
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 |
|
1196 |
|
1197 |
|
1198 | function injectionError(injector, key, constructResolvingMessage, originalError) {
|
1199 | var keys = [key];
|
1200 | var errMsg = constructResolvingMessage(keys);
|
1201 | var error = ((originalError ? wrappedError(errMsg, originalError) : Error(errMsg)));
|
1202 | error.addKey = addKey;
|
1203 | error.keys = keys;
|
1204 | error.injectors = [injector];
|
1205 | error.constructResolvingMessage = constructResolvingMessage;
|
1206 | ((error))[ERROR_ORIGINAL_ERROR] = originalError;
|
1207 | return error;
|
1208 | }
|
1209 |
|
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 | function addKey(injector, key) {
|
1216 | this.injectors.push(injector);
|
1217 | this.keys.push(key);
|
1218 |
|
1219 | this.message = this.constructResolvingMessage(this.keys);
|
1220 | }
|
1221 |
|
1222 |
|
1223 |
|
1224 |
|
1225 |
|
1226 |
|
1227 |
|
1228 |
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 |
|
1237 |
|
1238 | function noProviderError(injector, key) {
|
1239 | return injectionError(injector, key, function (keys) {
|
1240 | var first = stringify(keys[0].token);
|
1241 | return "No provider for " + first + "!" + constructResolvingPath(keys);
|
1242 | });
|
1243 | }
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 |
|
1254 |
|
1255 |
|
1256 |
|
1257 |
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 | function cyclicDependencyError(injector, key) {
|
1264 | return injectionError(injector, key, function (keys) {
|
1265 | return "Cannot instantiate cyclic dependency!" + constructResolvingPath(keys);
|
1266 | });
|
1267 | }
|
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 |
|
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 |
|
1291 |
|
1292 |
|
1293 |
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 | function instantiationError(injector, originalException, originalStack, key) {
|
1299 | return injectionError(injector, key, function (keys) {
|
1300 | var first = stringify(keys[0].token);
|
1301 | return originalException.message + ": Error during instantiation of " + first + "!" + constructResolvingPath(keys) + ".";
|
1302 | }, originalException);
|
1303 | }
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 |
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 | function invalidProviderError(provider) {
|
1317 | return Error("Invalid provider - only instances of Provider and Type are allowed, got: " + provider);
|
1318 | }
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 |
|
1329 |
|
1330 |
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 |
|
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 | function noAnnotationError(typeOrFunc, params) {
|
1352 | var signature = [];
|
1353 | for (var i = 0, ii = params.length; i < ii; i++) {
|
1354 | var parameter = params[i];
|
1355 | if (!parameter || parameter.length == 0) {
|
1356 | signature.push('?');
|
1357 | }
|
1358 | else {
|
1359 | signature.push(parameter.map(stringify).join(' '));
|
1360 | }
|
1361 | }
|
1362 | return Error('Cannot resolve all parameters for \'' + stringify(typeOrFunc) + '\'(' +
|
1363 | signature.join(', ') + '). ' +
|
1364 | 'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' +
|
1365 | stringify(typeOrFunc) + '\' is decorated with Injectable.');
|
1366 | }
|
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 |
|
1377 |
|
1378 |
|
1379 |
|
1380 |
|
1381 |
|
1382 |
|
1383 | function outOfBoundsError(index) {
|
1384 | return Error("Index " + index + " is out-of-bounds.");
|
1385 | }
|
1386 |
|
1387 |
|
1388 |
|
1389 |
|
1390 |
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 | function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) {
|
1402 | return Error("Cannot mix multi providers and regular providers, got: " + provider1 + " " + provider2);
|
1403 | }
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 |
|
1412 |
|
1413 |
|
1414 |
|
1415 |
|
1416 |
|
1417 |
|
1418 |
|
1419 |
|
1420 |
|
1421 |
|
1422 |
|
1423 |
|
1424 |
|
1425 |
|
1426 |
|
1427 | var ReflectiveKey = (function () {
|
1428 | |
1429 |
|
1430 |
|
1431 |
|
1432 |
|
1433 | function ReflectiveKey(token, id) {
|
1434 | this.token = token;
|
1435 | this.id = id;
|
1436 | if (!token) {
|
1437 | throw new Error('Token must be defined!');
|
1438 | }
|
1439 | }
|
1440 | Object.defineProperty(ReflectiveKey.prototype, "displayName", {
|
1441 | |
1442 |
|
1443 |
|
1444 |
|
1445 | get: function () { return stringify(this.token); },
|
1446 | enumerable: true,
|
1447 | configurable: true
|
1448 | });
|
1449 | |
1450 |
|
1451 |
|
1452 |
|
1453 |
|
1454 | ReflectiveKey.get = function (token) {
|
1455 | return _globalKeyRegistry.get(resolveForwardRef(token));
|
1456 | };
|
1457 | Object.defineProperty(ReflectiveKey, "numberOfKeys", {
|
1458 | |
1459 |
|
1460 |
|
1461 | get: function () { return _globalKeyRegistry.numberOfKeys; },
|
1462 | enumerable: true,
|
1463 | configurable: true
|
1464 | });
|
1465 | return ReflectiveKey;
|
1466 | }());
|
1467 |
|
1468 |
|
1469 |
|
1470 | var KeyRegistry = (function () {
|
1471 | function KeyRegistry() {
|
1472 | this._allKeys = new Map();
|
1473 | }
|
1474 | |
1475 |
|
1476 |
|
1477 |
|
1478 | KeyRegistry.prototype.get = function (token) {
|
1479 | if (token instanceof ReflectiveKey)
|
1480 | return token;
|
1481 | if (this._allKeys.has(token)) {
|
1482 | return ((this._allKeys.get(token)));
|
1483 | }
|
1484 | var newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys);
|
1485 | this._allKeys.set(token, newKey);
|
1486 | return newKey;
|
1487 | };
|
1488 | Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", {
|
1489 | |
1490 |
|
1491 |
|
1492 | get: function () { return this._allKeys.size; },
|
1493 | enumerable: true,
|
1494 | configurable: true
|
1495 | });
|
1496 | return KeyRegistry;
|
1497 | }());
|
1498 | var _globalKeyRegistry = new KeyRegistry();
|
1499 |
|
1500 |
|
1501 |
|
1502 |
|
1503 |
|
1504 |
|
1505 |
|
1506 |
|
1507 |
|
1508 |
|
1509 | var Type = Function;
|
1510 |
|
1511 |
|
1512 |
|
1513 |
|
1514 | function isType(v) {
|
1515 | return typeof v === 'function';
|
1516 | }
|
1517 |
|
1518 |
|
1519 |
|
1520 |
|
1521 |
|
1522 |
|
1523 |
|
1524 |
|
1525 |
|
1526 |
|
1527 | var DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*arguments\)/;
|
1528 | var ReflectionCapabilities = (function () {
|
1529 | |
1530 |
|
1531 |
|
1532 | function ReflectionCapabilities(reflect) {
|
1533 | this._reflect = reflect || _global['Reflect'];
|
1534 | }
|
1535 | |
1536 |
|
1537 |
|
1538 | ReflectionCapabilities.prototype.isReflectionEnabled = function () { return true; };
|
1539 | |
1540 |
|
1541 |
|
1542 |
|
1543 |
|
1544 | ReflectionCapabilities.prototype.factory = function (t) { return function () {
|
1545 | var args = [];
|
1546 | for (var _i = 0; _i < arguments.length; _i++) {
|
1547 | args[_i] = arguments[_i];
|
1548 | }
|
1549 | return new (t.bind.apply(t, [void 0].concat(args)))();
|
1550 | }; };
|
1551 | |
1552 |
|
1553 |
|
1554 |
|
1555 |
|
1556 |
|
1557 | ReflectionCapabilities.prototype._zipTypesAndAnnotations = function (paramTypes, paramAnnotations) {
|
1558 | var result;
|
1559 | if (typeof paramTypes === 'undefined') {
|
1560 | result = new Array(paramAnnotations.length);
|
1561 | }
|
1562 | else {
|
1563 | result = new Array(paramTypes.length);
|
1564 | }
|
1565 | for (var i = 0; i < result.length; i++) {
|
1566 |
|
1567 |
|
1568 |
|
1569 | if (typeof paramTypes === 'undefined') {
|
1570 | result[i] = [];
|
1571 | }
|
1572 | else if (paramTypes[i] != Object) {
|
1573 | result[i] = [paramTypes[i]];
|
1574 | }
|
1575 | else {
|
1576 | result[i] = [];
|
1577 | }
|
1578 | if (paramAnnotations && paramAnnotations[i] != null) {
|
1579 | result[i] = result[i].concat(paramAnnotations[i]);
|
1580 | }
|
1581 | }
|
1582 | return result;
|
1583 | };
|
1584 | |
1585 |
|
1586 |
|
1587 |
|
1588 |
|
1589 | ReflectionCapabilities.prototype._ownParameters = function (type, parentCtor) {
|
1590 |
|
1591 |
|
1592 |
|
1593 |
|
1594 |
|
1595 |
|
1596 |
|
1597 | if (DELEGATE_CTOR.exec(type.toString())) {
|
1598 | return null;
|
1599 | }
|
1600 |
|
1601 | if (((type)).parameters && ((type)).parameters !== parentCtor.parameters) {
|
1602 | return ((type)).parameters;
|
1603 | }
|
1604 |
|
1605 | var tsickleCtorParams = ((type)).ctorParameters;
|
1606 | if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) {
|
1607 |
|
1608 |
|
1609 | var ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams;
|
1610 | var paramTypes = ctorParameters.map(function (ctorParam) { return ctorParam && ctorParam.type; });
|
1611 | var paramAnnotations = ctorParameters.map(function (ctorParam) { return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators); });
|
1612 | return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
|
1613 | }
|
1614 |
|
1615 | if (this._reflect != null && this._reflect.getOwnMetadata != null) {
|
1616 | var paramAnnotations = this._reflect.getOwnMetadata('parameters', type);
|
1617 | var paramTypes = this._reflect.getOwnMetadata('design:paramtypes', type);
|
1618 | if (paramTypes || paramAnnotations) {
|
1619 | return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
|
1620 | }
|
1621 | }
|
1622 |
|
1623 |
|
1624 |
|
1625 |
|
1626 | return new Array(((type.length))).fill(undefined);
|
1627 | };
|
1628 | |
1629 |
|
1630 |
|
1631 |
|
1632 | ReflectionCapabilities.prototype.parameters = function (type) {
|
1633 |
|
1634 |
|
1635 | if (!isType(type)) {
|
1636 | return [];
|
1637 | }
|
1638 | var parentCtor = getParentCtor(type);
|
1639 | var parameters = this._ownParameters(type, parentCtor);
|
1640 | if (!parameters && parentCtor !== Object) {
|
1641 | parameters = this.parameters(parentCtor);
|
1642 | }
|
1643 | return parameters || [];
|
1644 | };
|
1645 | |
1646 |
|
1647 |
|
1648 |
|
1649 |
|
1650 | ReflectionCapabilities.prototype._ownAnnotations = function (typeOrFunc, parentCtor) {
|
1651 |
|
1652 | if (((typeOrFunc)).annotations && ((typeOrFunc)).annotations !== parentCtor.annotations) {
|
1653 | var annotations = ((typeOrFunc)).annotations;
|
1654 | if (typeof annotations === 'function' && annotations.annotations) {
|
1655 | annotations = annotations.annotations;
|
1656 | }
|
1657 | return annotations;
|
1658 | }
|
1659 |
|
1660 | if (((typeOrFunc)).decorators && ((typeOrFunc)).decorators !== parentCtor.decorators) {
|
1661 | return convertTsickleDecoratorIntoMetadata(((typeOrFunc)).decorators);
|
1662 | }
|
1663 |
|
1664 | if (this._reflect && this._reflect.getOwnMetadata) {
|
1665 | return this._reflect.getOwnMetadata('annotations', typeOrFunc);
|
1666 | }
|
1667 | return null;
|
1668 | };
|
1669 | |
1670 |
|
1671 |
|
1672 |
|
1673 | ReflectionCapabilities.prototype.annotations = function (typeOrFunc) {
|
1674 | if (!isType(typeOrFunc)) {
|
1675 | return [];
|
1676 | }
|
1677 | var parentCtor = getParentCtor(typeOrFunc);
|
1678 | var ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || [];
|
1679 | var parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : [];
|
1680 | return parentAnnotations.concat(ownAnnotations);
|
1681 | };
|
1682 | |
1683 |
|
1684 |
|
1685 |
|
1686 |
|
1687 | ReflectionCapabilities.prototype._ownPropMetadata = function (typeOrFunc, parentCtor) {
|
1688 |
|
1689 | if (((typeOrFunc)).propMetadata &&
|
1690 | ((typeOrFunc)).propMetadata !== parentCtor.propMetadata) {
|
1691 | var propMetadata = ((typeOrFunc)).propMetadata;
|
1692 | if (typeof propMetadata === 'function' && propMetadata.propMetadata) {
|
1693 | propMetadata = propMetadata.propMetadata;
|
1694 | }
|
1695 | return propMetadata;
|
1696 | }
|
1697 |
|
1698 | if (((typeOrFunc)).propDecorators &&
|
1699 | ((typeOrFunc)).propDecorators !== parentCtor.propDecorators) {
|
1700 | var propDecorators_1 = ((typeOrFunc)).propDecorators;
|
1701 | var propMetadata_1 = ({});
|
1702 | Object.keys(propDecorators_1).forEach(function (prop) {
|
1703 | propMetadata_1[prop] = convertTsickleDecoratorIntoMetadata(propDecorators_1[prop]);
|
1704 | });
|
1705 | return propMetadata_1;
|
1706 | }
|
1707 |
|
1708 | if (this._reflect && this._reflect.getOwnMetadata) {
|
1709 | return this._reflect.getOwnMetadata('propMetadata', typeOrFunc);
|
1710 | }
|
1711 | return null;
|
1712 | };
|
1713 | |
1714 |
|
1715 |
|
1716 |
|
1717 | ReflectionCapabilities.prototype.propMetadata = function (typeOrFunc) {
|
1718 | if (!isType(typeOrFunc)) {
|
1719 | return {};
|
1720 | }
|
1721 | var parentCtor = getParentCtor(typeOrFunc);
|
1722 | var propMetadata = {};
|
1723 | if (parentCtor !== Object) {
|
1724 | var parentPropMetadata_1 = this.propMetadata(parentCtor);
|
1725 | Object.keys(parentPropMetadata_1).forEach(function (propName) {
|
1726 | propMetadata[propName] = parentPropMetadata_1[propName];
|
1727 | });
|
1728 | }
|
1729 | var ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);
|
1730 | if (ownPropMetadata) {
|
1731 | Object.keys(ownPropMetadata).forEach(function (propName) {
|
1732 | var decorators = [];
|
1733 | if (propMetadata.hasOwnProperty(propName)) {
|
1734 | decorators.push.apply(decorators, propMetadata[propName]);
|
1735 | }
|
1736 | decorators.push.apply(decorators, ownPropMetadata[propName]);
|
1737 | propMetadata[propName] = decorators;
|
1738 | });
|
1739 | }
|
1740 | return propMetadata;
|
1741 | };
|
1742 | |
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 | ReflectionCapabilities.prototype.hasLifecycleHook = function (type, lcProperty) {
|
1748 | return type instanceof Type && lcProperty in type.prototype;
|
1749 | };
|
1750 | |
1751 |
|
1752 |
|
1753 |
|
1754 | ReflectionCapabilities.prototype.getter = function (name) { return (new Function('o', 'return o.' + name + ';')); };
|
1755 | |
1756 |
|
1757 |
|
1758 |
|
1759 | ReflectionCapabilities.prototype.setter = function (name) {
|
1760 | return (new Function('o', 'v', 'return o.' + name + ' = v;'));
|
1761 | };
|
1762 | |
1763 |
|
1764 |
|
1765 |
|
1766 | ReflectionCapabilities.prototype.method = function (name) {
|
1767 | var functionBody = "if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);";
|
1768 | return (new Function('o', 'args', functionBody));
|
1769 | };
|
1770 | |
1771 |
|
1772 |
|
1773 |
|
1774 | ReflectionCapabilities.prototype.importUri = function (type) {
|
1775 |
|
1776 | if (typeof type === 'object' && type['filePath']) {
|
1777 | return type['filePath'];
|
1778 | }
|
1779 |
|
1780 | return "./" + stringify(type);
|
1781 | };
|
1782 | |
1783 |
|
1784 |
|
1785 |
|
1786 | ReflectionCapabilities.prototype.resourceUri = function (type) { return "./" + stringify(type); };
|
1787 | |
1788 |
|
1789 |
|
1790 |
|
1791 |
|
1792 |
|
1793 |
|
1794 | ReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) {
|
1795 | return runtime;
|
1796 | };
|
1797 | |
1798 |
|
1799 |
|
1800 |
|
1801 |
|
1802 | ReflectionCapabilities.prototype.resolveEnum = function (enumIdentifier, name) { return enumIdentifier[name]; };
|
1803 | return ReflectionCapabilities;
|
1804 | }());
|
1805 |
|
1806 |
|
1807 |
|
1808 |
|
1809 | function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
|
1810 | if (!decoratorInvocations) {
|
1811 | return [];
|
1812 | }
|
1813 | return decoratorInvocations.map(function (decoratorInvocation) {
|
1814 | var decoratorType = decoratorInvocation.type;
|
1815 | var annotationCls = decoratorType.annotationCls;
|
1816 | var annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
|
1817 | return new (annotationCls.bind.apply(annotationCls, [void 0].concat(annotationArgs)))();
|
1818 | });
|
1819 | }
|
1820 |
|
1821 |
|
1822 |
|
1823 |
|
1824 | function getParentCtor(ctor) {
|
1825 | var parentProto = Object.getPrototypeOf(ctor.prototype);
|
1826 | var parentCtor = parentProto ? parentProto.constructor : null;
|
1827 |
|
1828 |
|
1829 | return parentCtor || Object;
|
1830 | }
|
1831 |
|
1832 |
|
1833 |
|
1834 |
|
1835 |
|
1836 |
|
1837 |
|
1838 |
|
1839 |
|
1840 |
|
1841 |
|
1842 | var Reflector = (function () {
|
1843 | |
1844 |
|
1845 |
|
1846 | function Reflector(reflectionCapabilities) {
|
1847 | this.reflectionCapabilities = reflectionCapabilities;
|
1848 | }
|
1849 | |
1850 |
|
1851 |
|
1852 |
|
1853 | Reflector.prototype.updateCapabilities = function (caps) { this.reflectionCapabilities = caps; };
|
1854 | |
1855 |
|
1856 |
|
1857 |
|
1858 | Reflector.prototype.factory = function (type) { return this.reflectionCapabilities.factory(type); };
|
1859 | |
1860 |
|
1861 |
|
1862 |
|
1863 | Reflector.prototype.parameters = function (typeOrFunc) {
|
1864 | return this.reflectionCapabilities.parameters(typeOrFunc);
|
1865 | };
|
1866 | |
1867 |
|
1868 |
|
1869 |
|
1870 | Reflector.prototype.annotations = function (typeOrFunc) {
|
1871 | return this.reflectionCapabilities.annotations(typeOrFunc);
|
1872 | };
|
1873 | |
1874 |
|
1875 |
|
1876 |
|
1877 | Reflector.prototype.propMetadata = function (typeOrFunc) {
|
1878 | return this.reflectionCapabilities.propMetadata(typeOrFunc);
|
1879 | };
|
1880 | |
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 | Reflector.prototype.hasLifecycleHook = function (type, lcProperty) {
|
1886 | return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
|
1887 | };
|
1888 | |
1889 |
|
1890 |
|
1891 |
|
1892 | Reflector.prototype.getter = function (name) { return this.reflectionCapabilities.getter(name); };
|
1893 | |
1894 |
|
1895 |
|
1896 |
|
1897 | Reflector.prototype.setter = function (name) { return this.reflectionCapabilities.setter(name); };
|
1898 | |
1899 |
|
1900 |
|
1901 |
|
1902 | Reflector.prototype.method = function (name) { return this.reflectionCapabilities.method(name); };
|
1903 | |
1904 |
|
1905 |
|
1906 |
|
1907 | Reflector.prototype.importUri = function (type) { return this.reflectionCapabilities.importUri(type); };
|
1908 | |
1909 |
|
1910 |
|
1911 |
|
1912 | Reflector.prototype.resourceUri = function (type) { return this.reflectionCapabilities.resourceUri(type); };
|
1913 | |
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 | Reflector.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) {
|
1921 | return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime);
|
1922 | };
|
1923 | |
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 | Reflector.prototype.resolveEnum = function (identifier, name) {
|
1929 | return this.reflectionCapabilities.resolveEnum(identifier, name);
|
1930 | };
|
1931 | return Reflector;
|
1932 | }());
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 |
|
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 | var reflector = new Reflector(new ReflectionCapabilities());
|
1945 |
|
1946 |
|
1947 |
|
1948 |
|
1949 |
|
1950 |
|
1951 |
|
1952 |
|
1953 |
|
1954 |
|
1955 |
|
1956 | var ReflectiveDependency = (function () {
|
1957 | |
1958 |
|
1959 |
|
1960 |
|
1961 |
|
1962 | function ReflectiveDependency(key, optional, visibility) {
|
1963 | this.key = key;
|
1964 | this.optional = optional;
|
1965 | this.visibility = visibility;
|
1966 | }
|
1967 | |
1968 |
|
1969 |
|
1970 |
|
1971 | ReflectiveDependency.fromKey = function (key) {
|
1972 | return new ReflectiveDependency(key, false, null);
|
1973 | };
|
1974 | return ReflectiveDependency;
|
1975 | }());
|
1976 | var _EMPTY_LIST = [];
|
1977 | var ResolvedReflectiveProvider_ = (function () {
|
1978 | |
1979 |
|
1980 |
|
1981 |
|
1982 |
|
1983 | function ResolvedReflectiveProvider_(key, resolvedFactories, multiProvider) {
|
1984 | this.key = key;
|
1985 | this.resolvedFactories = resolvedFactories;
|
1986 | this.multiProvider = multiProvider;
|
1987 | }
|
1988 | Object.defineProperty(ResolvedReflectiveProvider_.prototype, "resolvedFactory", {
|
1989 | |
1990 |
|
1991 |
|
1992 | get: function () { return this.resolvedFactories[0]; },
|
1993 | enumerable: true,
|
1994 | configurable: true
|
1995 | });
|
1996 | return ResolvedReflectiveProvider_;
|
1997 | }());
|
1998 |
|
1999 |
|
2000 |
|
2001 |
|
2002 |
|
2003 | var ResolvedReflectiveFactory = (function () {
|
2004 | |
2005 |
|
2006 |
|
2007 |
|
2008 | function ResolvedReflectiveFactory(factory, dependencies) {
|
2009 | this.factory = factory;
|
2010 | this.dependencies = dependencies;
|
2011 | }
|
2012 | return ResolvedReflectiveFactory;
|
2013 | }());
|
2014 |
|
2015 |
|
2016 |
|
2017 |
|
2018 |
|
2019 | function resolveReflectiveFactory(provider) {
|
2020 | var factoryFn;
|
2021 | var resolvedDeps;
|
2022 | if (provider.useClass) {
|
2023 | var useClass = resolveForwardRef(provider.useClass);
|
2024 | factoryFn = reflector.factory(useClass);
|
2025 | resolvedDeps = _dependenciesFor(useClass);
|
2026 | }
|
2027 | else if (provider.useExisting) {
|
2028 | factoryFn = function (aliasInstance) { return aliasInstance; };
|
2029 | resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))];
|
2030 | }
|
2031 | else if (provider.useFactory) {
|
2032 | factoryFn = provider.useFactory;
|
2033 | resolvedDeps = constructDependencies(provider.useFactory, provider.deps);
|
2034 | }
|
2035 | else {
|
2036 | factoryFn = function () { return provider.useValue; };
|
2037 | resolvedDeps = _EMPTY_LIST;
|
2038 | }
|
2039 | return new ResolvedReflectiveFactory(factoryFn, resolvedDeps);
|
2040 | }
|
2041 |
|
2042 |
|
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 |
|
2049 | function resolveReflectiveProvider(provider) {
|
2050 | return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false);
|
2051 | }
|
2052 |
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 | function resolveReflectiveProviders(providers) {
|
2058 | var normalized = _normalizeProviders(providers, []);
|
2059 | var resolved = normalized.map(resolveReflectiveProvider);
|
2060 | var resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map());
|
2061 | return Array.from(resolvedProviderMap.values());
|
2062 | }
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 |
|
2070 |
|
2071 | function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) {
|
2072 | for (var i = 0; i < providers.length; i++) {
|
2073 | var provider = providers[i];
|
2074 | var existing = normalizedProvidersMap.get(provider.key.id);
|
2075 | if (existing) {
|
2076 | if (provider.multiProvider !== existing.multiProvider) {
|
2077 | throw mixingMultiProvidersWithRegularProvidersError(existing, provider);
|
2078 | }
|
2079 | if (provider.multiProvider) {
|
2080 | for (var j = 0; j < provider.resolvedFactories.length; j++) {
|
2081 | existing.resolvedFactories.push(provider.resolvedFactories[j]);
|
2082 | }
|
2083 | }
|
2084 | else {
|
2085 | normalizedProvidersMap.set(provider.key.id, provider);
|
2086 | }
|
2087 | }
|
2088 | else {
|
2089 | var resolvedProvider = void 0;
|
2090 | if (provider.multiProvider) {
|
2091 | resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider);
|
2092 | }
|
2093 | else {
|
2094 | resolvedProvider = provider;
|
2095 | }
|
2096 | normalizedProvidersMap.set(provider.key.id, resolvedProvider);
|
2097 | }
|
2098 | }
|
2099 | return normalizedProvidersMap;
|
2100 | }
|
2101 |
|
2102 |
|
2103 |
|
2104 |
|
2105 |
|
2106 | function _normalizeProviders(providers, res) {
|
2107 | providers.forEach(function (b) {
|
2108 | if (b instanceof Type) {
|
2109 | res.push({ provide: b, useClass: b });
|
2110 | }
|
2111 | else if (b && typeof b == 'object' && ((b)).provide !== undefined) {
|
2112 | res.push( (b));
|
2113 | }
|
2114 | else if (b instanceof Array) {
|
2115 | _normalizeProviders(b, res);
|
2116 | }
|
2117 | else {
|
2118 | throw invalidProviderError(b);
|
2119 | }
|
2120 | });
|
2121 | return res;
|
2122 | }
|
2123 |
|
2124 |
|
2125 |
|
2126 |
|
2127 |
|
2128 | function constructDependencies(typeOrFunc, dependencies) {
|
2129 | if (!dependencies) {
|
2130 | return _dependenciesFor(typeOrFunc);
|
2131 | }
|
2132 | else {
|
2133 | var params_1 = dependencies.map(function (t) { return [t]; });
|
2134 | return dependencies.map(function (t) { return _extractToken(typeOrFunc, t, params_1); });
|
2135 | }
|
2136 | }
|
2137 |
|
2138 |
|
2139 |
|
2140 |
|
2141 | function _dependenciesFor(typeOrFunc) {
|
2142 | var params = reflector.parameters(typeOrFunc);
|
2143 | if (!params)
|
2144 | return [];
|
2145 | if (params.some(function (p) { return p == null; })) {
|
2146 | throw noAnnotationError(typeOrFunc, params);
|
2147 | }
|
2148 | return params.map(function (p) { return _extractToken(typeOrFunc, p, params); });
|
2149 | }
|
2150 |
|
2151 |
|
2152 |
|
2153 |
|
2154 |
|
2155 |
|
2156 | function _extractToken(typeOrFunc, metadata, params) {
|
2157 | var token = null;
|
2158 | var optional = false;
|
2159 | if (!Array.isArray(metadata)) {
|
2160 | if (metadata instanceof Inject) {
|
2161 | return _createDependency(metadata.token, optional, null);
|
2162 | }
|
2163 | else {
|
2164 | return _createDependency(metadata, optional, null);
|
2165 | }
|
2166 | }
|
2167 | var visibility = null;
|
2168 | for (var i = 0; i < metadata.length; ++i) {
|
2169 | var paramMetadata = metadata[i];
|
2170 | if (paramMetadata instanceof Type) {
|
2171 | token = paramMetadata;
|
2172 | }
|
2173 | else if (paramMetadata instanceof Inject) {
|
2174 | token = paramMetadata.token;
|
2175 | }
|
2176 | else if (paramMetadata instanceof Optional) {
|
2177 | optional = true;
|
2178 | }
|
2179 | else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) {
|
2180 | visibility = paramMetadata;
|
2181 | }
|
2182 | else if (paramMetadata instanceof InjectionToken) {
|
2183 | token = paramMetadata;
|
2184 | }
|
2185 | }
|
2186 | token = resolveForwardRef(token);
|
2187 | if (token != null) {
|
2188 | return _createDependency(token, optional, visibility);
|
2189 | }
|
2190 | else {
|
2191 | throw noAnnotationError(typeOrFunc, params);
|
2192 | }
|
2193 | }
|
2194 |
|
2195 |
|
2196 |
|
2197 |
|
2198 |
|
2199 |
|
2200 | function _createDependency(token, optional, visibility) {
|
2201 | return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility);
|
2202 | }
|
2203 |
|
2204 |
|
2205 |
|
2206 |
|
2207 |
|
2208 |
|
2209 |
|
2210 |
|
2211 | var UNDEFINED = new Object();
|
2212 |
|
2213 |
|
2214 |
|
2215 |
|
2216 |
|
2217 |
|
2218 |
|
2219 |
|
2220 |
|
2221 |
|
2222 |
|
2223 |
|
2224 |
|
2225 |
|
2226 |
|
2227 |
|
2228 |
|
2229 |
|
2230 |
|
2231 |
|
2232 |
|
2233 |
|
2234 |
|
2235 |
|
2236 |
|
2237 |
|
2238 |
|
2239 |
|
2240 |
|
2241 |
|
2242 |
|
2243 |
|
2244 |
|
2245 |
|
2246 |
|
2247 |
|
2248 | var ReflectiveInjector = (function () {
|
2249 | function ReflectiveInjector() {
|
2250 | }
|
2251 | |
2252 |
|
2253 |
|
2254 |
|
2255 |
|
2256 |
|
2257 |
|
2258 |
|
2259 |
|
2260 |
|
2261 |
|
2262 |
|
2263 |
|
2264 |
|
2265 |
|
2266 |
|
2267 |
|
2268 |
|
2269 |
|
2270 |
|
2271 |
|
2272 |
|
2273 |
|
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 |
|
2279 |
|
2280 |
|
2281 |
|
2282 |
|
2283 |
|
2284 |
|
2285 |
|
2286 | ReflectiveInjector.resolve = function (providers) {
|
2287 | return resolveReflectiveProviders(providers);
|
2288 | };
|
2289 | |
2290 |
|
2291 |
|
2292 |
|
2293 |
|
2294 |
|
2295 |
|
2296 |
|
2297 |
|
2298 |
|
2299 |
|
2300 |
|
2301 |
|
2302 |
|
2303 |
|
2304 |
|
2305 |
|
2306 |
|
2307 |
|
2308 |
|
2309 |
|
2310 |
|
2311 |
|
2312 |
|
2313 |
|
2314 |
|
2315 |
|
2316 |
|
2317 |
|
2318 | ReflectiveInjector.resolveAndCreate = function (providers, parent) {
|
2319 | var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
2320 | return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
|
2321 | };
|
2322 | |
2323 |
|
2324 |
|
2325 |
|
2326 |
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 |
|
2336 |
|
2337 |
|
2338 |
|
2339 |
|
2340 |
|
2341 |
|
2342 |
|
2343 |
|
2344 |
|
2345 |
|
2346 |
|
2347 |
|
2348 | ReflectiveInjector.fromResolvedProviders = function (providers, parent) {
|
2349 | return new ReflectiveInjector_(providers, parent);
|
2350 | };
|
2351 | |
2352 |
|
2353 |
|
2354 |
|
2355 |
|
2356 |
|
2357 |
|
2358 |
|
2359 |
|
2360 |
|
2361 |
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 |
|
2367 | ReflectiveInjector.prototype.parent = function () { };
|
2368 | |
2369 |
|
2370 |
|
2371 |
|
2372 |
|
2373 |
|
2374 |
|
2375 |
|
2376 |
|
2377 |
|
2378 |
|
2379 |
|
2380 |
|
2381 |
|
2382 |
|
2383 |
|
2384 |
|
2385 |
|
2386 |
|
2387 |
|
2388 |
|
2389 |
|
2390 |
|
2391 |
|
2392 |
|
2393 |
|
2394 |
|
2395 |
|
2396 |
|
2397 |
|
2398 | ReflectiveInjector.prototype.resolveAndCreateChild = function (providers) { };
|
2399 | |
2400 |
|
2401 |
|
2402 |
|
2403 |
|
2404 |
|
2405 |
|
2406 |
|
2407 |
|
2408 |
|
2409 |
|
2410 |
|
2411 |
|
2412 |
|
2413 |
|
2414 |
|
2415 |
|
2416 |
|
2417 |
|
2418 |
|
2419 |
|
2420 |
|
2421 |
|
2422 |
|
2423 |
|
2424 |
|
2425 |
|
2426 |
|
2427 | ReflectiveInjector.prototype.createChildFromResolved = function (providers) { };
|
2428 | |
2429 |
|
2430 |
|
2431 |
|
2432 |
|
2433 |
|
2434 |
|
2435 |
|
2436 |
|
2437 |
|
2438 |
|
2439 |
|
2440 |
|
2441 |
|
2442 |
|
2443 |
|
2444 |
|
2445 |
|
2446 |
|
2447 |
|
2448 |
|
2449 |
|
2450 |
|
2451 |
|
2452 |
|
2453 |
|
2454 |
|
2455 | ReflectiveInjector.prototype.resolveAndInstantiate = function (provider) { };
|
2456 | |
2457 |
|
2458 |
|
2459 |
|
2460 |
|
2461 |
|
2462 |
|
2463 |
|
2464 |
|
2465 |
|
2466 |
|
2467 |
|
2468 |
|
2469 |
|
2470 |
|
2471 |
|
2472 |
|
2473 |
|
2474 |
|
2475 |
|
2476 |
|
2477 |
|
2478 |
|
2479 |
|
2480 |
|
2481 |
|
2482 |
|
2483 | ReflectiveInjector.prototype.instantiateResolved = function (provider) { };
|
2484 | |
2485 |
|
2486 |
|
2487 |
|
2488 |
|
2489 |
|
2490 | ReflectiveInjector.prototype.get = function (token, notFoundValue) { };
|
2491 | return ReflectiveInjector;
|
2492 | }());
|
2493 | var ReflectiveInjector_ = (function () {
|
2494 | |
2495 |
|
2496 |
|
2497 |
|
2498 |
|
2499 | function ReflectiveInjector_(_providers, _parent) {
|
2500 | |
2501 |
|
2502 |
|
2503 | this._constructionCounter = 0;
|
2504 | this._providers = _providers;
|
2505 | this._parent = _parent || null;
|
2506 | var len = _providers.length;
|
2507 | this.keyIds = new Array(len);
|
2508 | this.objs = new Array(len);
|
2509 | for (var i = 0; i < len; i++) {
|
2510 | this.keyIds[i] = _providers[i].key.id;
|
2511 | this.objs[i] = UNDEFINED;
|
2512 | }
|
2513 | }
|
2514 | |
2515 |
|
2516 |
|
2517 |
|
2518 |
|
2519 | ReflectiveInjector_.prototype.get = function (token, notFoundValue) {
|
2520 | if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; }
|
2521 | return this._getByKey(ReflectiveKey.get(token), null, notFoundValue);
|
2522 | };
|
2523 | Object.defineProperty(ReflectiveInjector_.prototype, "parent", {
|
2524 | |
2525 |
|
2526 |
|
2527 | get: function () { return this._parent; },
|
2528 | enumerable: true,
|
2529 | configurable: true
|
2530 | });
|
2531 | |
2532 |
|
2533 |
|
2534 |
|
2535 | ReflectiveInjector_.prototype.resolveAndCreateChild = function (providers) {
|
2536 | var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
|
2537 | return this.createChildFromResolved(ResolvedReflectiveProviders);
|
2538 | };
|
2539 | |
2540 |
|
2541 |
|
2542 |
|
2543 | ReflectiveInjector_.prototype.createChildFromResolved = function (providers) {
|
2544 | var inj = new ReflectiveInjector_(providers);
|
2545 | inj._parent = this;
|
2546 | return inj;
|
2547 | };
|
2548 | |
2549 |
|
2550 |
|
2551 |
|
2552 | ReflectiveInjector_.prototype.resolveAndInstantiate = function (provider) {
|
2553 | return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
|
2554 | };
|
2555 | |
2556 |
|
2557 |
|
2558 |
|
2559 | ReflectiveInjector_.prototype.instantiateResolved = function (provider) {
|
2560 | return this._instantiateProvider(provider);
|
2561 | };
|
2562 | |
2563 |
|
2564 |
|
2565 |
|
2566 | ReflectiveInjector_.prototype.getProviderAtIndex = function (index) {
|
2567 | if (index < 0 || index >= this._providers.length) {
|
2568 | throw outOfBoundsError(index);
|
2569 | }
|
2570 | return this._providers[index];
|
2571 | };
|
2572 | |
2573 |
|
2574 |
|
2575 |
|
2576 |
|
2577 | ReflectiveInjector_.prototype._new = function (provider) {
|
2578 | if (this._constructionCounter++ > this._getMaxNumberOfObjects()) {
|
2579 | throw cyclicDependencyError(this, provider.key);
|
2580 | }
|
2581 | return this._instantiateProvider(provider);
|
2582 | };
|
2583 | |
2584 |
|
2585 |
|
2586 | ReflectiveInjector_.prototype._getMaxNumberOfObjects = function () { return this.objs.length; };
|
2587 | |
2588 |
|
2589 |
|
2590 |
|
2591 | ReflectiveInjector_.prototype._instantiateProvider = function (provider) {
|
2592 | if (provider.multiProvider) {
|
2593 | var res = new Array(provider.resolvedFactories.length);
|
2594 | for (var i = 0; i < provider.resolvedFactories.length; ++i) {
|
2595 | res[i] = this._instantiate(provider, provider.resolvedFactories[i]);
|
2596 | }
|
2597 | return res;
|
2598 | }
|
2599 | else {
|
2600 | return this._instantiate(provider, provider.resolvedFactories[0]);
|
2601 | }
|
2602 | };
|
2603 | |
2604 |
|
2605 |
|
2606 |
|
2607 |
|
2608 | ReflectiveInjector_.prototype._instantiate = function (provider, ResolvedReflectiveFactory$$1) {
|
2609 | var _this = this;
|
2610 | var factory = ResolvedReflectiveFactory$$1.factory;
|
2611 | var deps;
|
2612 | try {
|
2613 | deps =
|
2614 | ResolvedReflectiveFactory$$1.dependencies.map(function (dep) { return _this._getByReflectiveDependency(dep); });
|
2615 | }
|
2616 | catch (e) {
|
2617 | if (e.addKey) {
|
2618 | e.addKey(this, provider.key);
|
2619 | }
|
2620 | throw e;
|
2621 | }
|
2622 | var obj;
|
2623 | try {
|
2624 | obj = factory.apply(void 0, deps);
|
2625 | }
|
2626 | catch (e) {
|
2627 | throw instantiationError(this, e, e.stack, provider.key);
|
2628 | }
|
2629 | return obj;
|
2630 | };
|
2631 | |
2632 |
|
2633 |
|
2634 |
|
2635 | ReflectiveInjector_.prototype._getByReflectiveDependency = function (dep) {
|
2636 | return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND);
|
2637 | };
|
2638 | |
2639 |
|
2640 |
|
2641 |
|
2642 |
|
2643 |
|
2644 | ReflectiveInjector_.prototype._getByKey = function (key, visibility, notFoundValue) {
|
2645 | if (key === INJECTOR_KEY) {
|
2646 | return this;
|
2647 | }
|
2648 | if (visibility instanceof Self) {
|
2649 | return this._getByKeySelf(key, notFoundValue);
|
2650 | }
|
2651 | else {
|
2652 | return this._getByKeyDefault(key, notFoundValue, visibility);
|
2653 | }
|
2654 | };
|
2655 | |
2656 |
|
2657 |
|
2658 |
|
2659 | ReflectiveInjector_.prototype._getObjByKeyId = function (keyId) {
|
2660 | for (var i = 0; i < this.keyIds.length; i++) {
|
2661 | if (this.keyIds[i] === keyId) {
|
2662 | if (this.objs[i] === UNDEFINED) {
|
2663 | this.objs[i] = this._new(this._providers[i]);
|
2664 | }
|
2665 | return this.objs[i];
|
2666 | }
|
2667 | }
|
2668 | return UNDEFINED;
|
2669 | };
|
2670 | |
2671 |
|
2672 |
|
2673 |
|
2674 |
|
2675 |
|
2676 | ReflectiveInjector_.prototype._throwOrNull = function (key, notFoundValue) {
|
2677 | if (notFoundValue !== THROW_IF_NOT_FOUND) {
|
2678 | return notFoundValue;
|
2679 | }
|
2680 | else {
|
2681 | throw noProviderError(this, key);
|
2682 | }
|
2683 | };
|
2684 | |
2685 |
|
2686 |
|
2687 |
|
2688 |
|
2689 |
|
2690 | ReflectiveInjector_.prototype._getByKeySelf = function (key, notFoundValue) {
|
2691 | var obj = this._getObjByKeyId(key.id);
|
2692 | return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
|
2693 | };
|
2694 | |
2695 |
|
2696 |
|
2697 |
|
2698 |
|
2699 |
|
2700 |
|
2701 | ReflectiveInjector_.prototype._getByKeyDefault = function (key, notFoundValue, visibility) {
|
2702 | var inj;
|
2703 | if (visibility instanceof SkipSelf) {
|
2704 | inj = this._parent;
|
2705 | }
|
2706 | else {
|
2707 | inj = this;
|
2708 | }
|
2709 | while (inj instanceof ReflectiveInjector_) {
|
2710 | var inj_ = (inj);
|
2711 | var obj = inj_._getObjByKeyId(key.id);
|
2712 | if (obj !== UNDEFINED)
|
2713 | return obj;
|
2714 | inj = inj_._parent;
|
2715 | }
|
2716 | if (inj !== null) {
|
2717 | return inj.get(key.token, notFoundValue);
|
2718 | }
|
2719 | else {
|
2720 | return this._throwOrNull(key, notFoundValue);
|
2721 | }
|
2722 | };
|
2723 | Object.defineProperty(ReflectiveInjector_.prototype, "displayName", {
|
2724 | |
2725 |
|
2726 |
|
2727 | get: function () {
|
2728 | var providers = _mapProviders(this, function (b) { return ' "' + b.key.displayName + '" '; })
|
2729 | .join(', ');
|
2730 | return "ReflectiveInjector(providers: [" + providers + "])";
|
2731 | },
|
2732 | enumerable: true,
|
2733 | configurable: true
|
2734 | });
|
2735 | |
2736 |
|
2737 |
|
2738 | ReflectiveInjector_.prototype.toString = function () { return this.displayName; };
|
2739 | return ReflectiveInjector_;
|
2740 | }());
|
2741 | var INJECTOR_KEY = ReflectiveKey.get(Injector);
|
2742 |
|
2743 |
|
2744 |
|
2745 |
|
2746 |
|
2747 | function _mapProviders(injector, fn) {
|
2748 | var res = new Array(injector._providers.length);
|
2749 | for (var i = 0; i < injector._providers.length; ++i) {
|
2750 | res[i] = fn(injector.getProviderAtIndex(i));
|
2751 | }
|
2752 | return res;
|
2753 | }
|
2754 |
|
2755 |
|
2756 |
|
2757 |
|
2758 |
|
2759 |
|
2760 |
|
2761 |
|
2762 |
|
2763 |
|
2764 |
|
2765 |
|
2766 |
|
2767 |
|
2768 |
|
2769 |
|
2770 |
|
2771 |
|
2772 |
|
2773 |
|
2774 |
|
2775 |
|
2776 |
|
2777 |
|
2778 | function isPromise(obj) {
|
2779 |
|
2780 |
|
2781 | return !!obj && typeof obj.then === 'function';
|
2782 | }
|
2783 |
|
2784 |
|
2785 |
|
2786 |
|
2787 |
|
2788 | function isObservable(obj) {
|
2789 |
|
2790 | return !!obj && typeof obj.subscribe === 'function';
|
2791 | }
|
2792 |
|
2793 |
|
2794 |
|
2795 |
|
2796 |
|
2797 |
|
2798 |
|
2799 |
|
2800 |
|
2801 |
|
2802 |
|
2803 | var APP_INITIALIZER = new InjectionToken('Application Initializer');
|
2804 |
|
2805 |
|
2806 |
|
2807 |
|
2808 |
|
2809 | var ApplicationInitStatus = (function () {
|
2810 | |
2811 |
|
2812 |
|
2813 | function ApplicationInitStatus(appInits) {
|
2814 | var _this = this;
|
2815 | this.appInits = appInits;
|
2816 | this.initialized = false;
|
2817 | this._done = false;
|
2818 | this._donePromise = new Promise(function (res, rej) {
|
2819 | _this.resolve = res;
|
2820 | _this.reject = rej;
|
2821 | });
|
2822 | }
|
2823 | |
2824 |
|
2825 |
|
2826 |
|
2827 | ApplicationInitStatus.prototype.runInitializers = function () {
|
2828 | var _this = this;
|
2829 | if (this.initialized) {
|
2830 | return;
|
2831 | }
|
2832 | var asyncInitPromises = [];
|
2833 | var complete = function () {
|
2834 | _this._done = true;
|
2835 | _this.resolve();
|
2836 | };
|
2837 | if (this.appInits) {
|
2838 | for (var i = 0; i < this.appInits.length; i++) {
|
2839 | var initResult = this.appInits[i]();
|
2840 | if (isPromise(initResult)) {
|
2841 | asyncInitPromises.push(initResult);
|
2842 | }
|
2843 | }
|
2844 | }
|
2845 | Promise.all(asyncInitPromises).then(function () { complete(); }).catch(function (e) { _this.reject(e); });
|
2846 | if (asyncInitPromises.length === 0) {
|
2847 | complete();
|
2848 | }
|
2849 | this.initialized = true;
|
2850 | };
|
2851 | Object.defineProperty(ApplicationInitStatus.prototype, "done", {
|
2852 | |
2853 |
|
2854 |
|
2855 | get: function () { return this._done; },
|
2856 | enumerable: true,
|
2857 | configurable: true
|
2858 | });
|
2859 | Object.defineProperty(ApplicationInitStatus.prototype, "donePromise", {
|
2860 | |
2861 |
|
2862 |
|
2863 | get: function () { return this._donePromise; },
|
2864 | enumerable: true,
|
2865 | configurable: true
|
2866 | });
|
2867 | return ApplicationInitStatus;
|
2868 | }());
|
2869 | ApplicationInitStatus.decorators = [
|
2870 | { type: Injectable },
|
2871 | ];
|
2872 |
|
2873 |
|
2874 |
|
2875 | ApplicationInitStatus.ctorParameters = function () { return [
|
2876 | { type: Array, decorators: [{ type: Inject, args: [APP_INITIALIZER,] }, { type: Optional },] },
|
2877 | ]; };
|
2878 |
|
2879 |
|
2880 |
|
2881 |
|
2882 |
|
2883 |
|
2884 |
|
2885 |
|
2886 |
|
2887 |
|
2888 |
|
2889 |
|
2890 |
|
2891 |
|
2892 |
|
2893 |
|
2894 |
|
2895 | var APP_ID = new InjectionToken('AppId');
|
2896 |
|
2897 |
|
2898 |
|
2899 | function _appIdRandomProviderFactory() {
|
2900 | return "" + _randomChar() + _randomChar() + _randomChar();
|
2901 | }
|
2902 |
|
2903 |
|
2904 |
|
2905 |
|
2906 | var APP_ID_RANDOM_PROVIDER = {
|
2907 | provide: APP_ID,
|
2908 | useFactory: _appIdRandomProviderFactory,
|
2909 | deps: [],
|
2910 | };
|
2911 |
|
2912 |
|
2913 |
|
2914 | function _randomChar() {
|
2915 | return String.fromCharCode(97 + Math.floor(Math.random() * 25));
|
2916 | }
|
2917 |
|
2918 |
|
2919 |
|
2920 |
|
2921 | var PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer');
|
2922 |
|
2923 |
|
2924 |
|
2925 |
|
2926 | var PLATFORM_ID = new InjectionToken('Platform ID');
|
2927 |
|
2928 |
|
2929 |
|
2930 |
|
2931 |
|
2932 |
|
2933 |
|
2934 |
|
2935 | var APP_BOOTSTRAP_LISTENER = new InjectionToken('appBootstrapListener');
|
2936 |
|
2937 |
|
2938 |
|
2939 |
|
2940 | var PACKAGE_ROOT_URL = new InjectionToken('Application Packages Root URL');
|
2941 |
|
2942 |
|
2943 |
|
2944 |
|
2945 |
|
2946 |
|
2947 |
|
2948 | var Console = (function () {
|
2949 | function Console() {
|
2950 | }
|
2951 | |
2952 |
|
2953 |
|
2954 |
|
2955 | Console.prototype.log = function (message) {
|
2956 |
|
2957 | console.log(message);
|
2958 | };
|
2959 | |
2960 |
|
2961 |
|
2962 |
|
2963 | Console.prototype.warn = function (message) {
|
2964 |
|
2965 | console.warn(message);
|
2966 | };
|
2967 | return Console;
|
2968 | }());
|
2969 | Console.decorators = [
|
2970 | { type: Injectable },
|
2971 | ];
|
2972 |
|
2973 |
|
2974 |
|
2975 | Console.ctorParameters = function () { return []; };
|
2976 |
|
2977 |
|
2978 |
|
2979 |
|
2980 |
|
2981 |
|
2982 |
|
2983 |
|
2984 |
|
2985 |
|
2986 |
|
2987 |
|
2988 | var ModuleWithComponentFactories = (function () {
|
2989 | |
2990 |
|
2991 |
|
2992 |
|
2993 | function ModuleWithComponentFactories(ngModuleFactory, componentFactories) {
|
2994 | this.ngModuleFactory = ngModuleFactory;
|
2995 | this.componentFactories = componentFactories;
|
2996 | }
|
2997 | return ModuleWithComponentFactories;
|
2998 | }());
|
2999 |
|
3000 |
|
3001 |
|
3002 | function _throwError() {
|
3003 | throw new Error("Runtime compiler is not loaded");
|
3004 | }
|
3005 |
|
3006 |
|
3007 |
|
3008 |
|
3009 |
|
3010 |
|
3011 |
|
3012 |
|
3013 |
|
3014 |
|
3015 | var Compiler = (function () {
|
3016 | function Compiler() {
|
3017 | }
|
3018 | |
3019 |
|
3020 |
|
3021 |
|
3022 |
|
3023 |
|
3024 |
|
3025 | Compiler.prototype.compileModuleSync = function (moduleType) { throw _throwError(); };
|
3026 | |
3027 |
|
3028 |
|
3029 |
|
3030 |
|
3031 |
|
3032 | Compiler.prototype.compileModuleAsync = function (moduleType) { throw _throwError(); };
|
3033 | |
3034 |
|
3035 |
|
3036 |
|
3037 |
|
3038 |
|
3039 | Compiler.prototype.compileModuleAndAllComponentsSync = function (moduleType) {
|
3040 | throw _throwError();
|
3041 | };
|
3042 | |
3043 |
|
3044 |
|
3045 |
|
3046 |
|
3047 |
|
3048 | Compiler.prototype.compileModuleAndAllComponentsAsync = function (moduleType) {
|
3049 | throw _throwError();
|
3050 | };
|
3051 | |
3052 |
|
3053 |
|
3054 |
|
3055 |
|
3056 |
|
3057 |
|
3058 |
|
3059 |
|
3060 |
|
3061 | Compiler.prototype.getNgContentSelectors = function (component) { throw _throwError(); };
|
3062 | |
3063 |
|
3064 |
|
3065 |
|
3066 | Compiler.prototype.clearCache = function () { };
|
3067 | |
3068 |
|
3069 |
|
3070 |
|
3071 |
|
3072 | Compiler.prototype.clearCacheFor = function (type) { };
|
3073 | return Compiler;
|
3074 | }());
|
3075 | Compiler.decorators = [
|
3076 | { type: Injectable },
|
3077 | ];
|
3078 |
|
3079 |
|
3080 |
|
3081 | Compiler.ctorParameters = function () { return []; };
|
3082 |
|
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 | var COMPILER_OPTIONS = new InjectionToken('compilerOptions');
|
3088 |
|
3089 |
|
3090 |
|
3091 |
|
3092 |
|
3093 |
|
3094 | var CompilerFactory = (function () {
|
3095 | function CompilerFactory() {
|
3096 | }
|
3097 | |
3098 |
|
3099 |
|
3100 |
|
3101 |
|
3102 | CompilerFactory.prototype.createCompiler = function (options) { };
|
3103 | return CompilerFactory;
|
3104 | }());
|
3105 |
|
3106 |
|
3107 |
|
3108 |
|
3109 |
|
3110 |
|
3111 |
|
3112 |
|
3113 |
|
3114 |
|
3115 |
|
3116 |
|
3117 |
|
3118 |
|
3119 |
|
3120 |
|
3121 | var ComponentRef = (function () {
|
3122 | function ComponentRef() {
|
3123 | }
|
3124 | |
3125 |
|
3126 |
|
3127 |
|
3128 |
|
3129 | ComponentRef.prototype.location = function () { };
|
3130 | |
3131 |
|
3132 |
|
3133 |
|
3134 |
|
3135 | ComponentRef.prototype.injector = function () { };
|
3136 | |
3137 |
|
3138 |
|
3139 |
|
3140 |
|
3141 | ComponentRef.prototype.instance = function () { };
|
3142 | |
3143 |
|
3144 |
|
3145 |
|
3146 |
|
3147 | ComponentRef.prototype.hostView = function () { };
|
3148 | |
3149 |
|
3150 |
|
3151 |
|
3152 |
|
3153 | ComponentRef.prototype.changeDetectorRef = function () { };
|
3154 | |
3155 |
|
3156 |
|
3157 |
|
3158 |
|
3159 | ComponentRef.prototype.componentType = function () { };
|
3160 | |
3161 |
|
3162 |
|
3163 |
|
3164 |
|
3165 | ComponentRef.prototype.destroy = function () { };
|
3166 | |
3167 |
|
3168 |
|
3169 |
|
3170 |
|
3171 |
|
3172 | ComponentRef.prototype.onDestroy = function (callback) { };
|
3173 | return ComponentRef;
|
3174 | }());
|
3175 |
|
3176 |
|
3177 |
|
3178 |
|
3179 | var ComponentFactory = (function () {
|
3180 | function ComponentFactory() {
|
3181 | }
|
3182 | |
3183 |
|
3184 |
|
3185 |
|
3186 | ComponentFactory.prototype.selector = function () { };
|
3187 | |
3188 |
|
3189 |
|
3190 |
|
3191 | ComponentFactory.prototype.componentType = function () { };
|
3192 | |
3193 |
|
3194 |
|
3195 |
|
3196 |
|
3197 | ComponentFactory.prototype.ngContentSelectors = function () { };
|
3198 | |
3199 |
|
3200 |
|
3201 |
|
3202 |
|
3203 | ComponentFactory.prototype.inputs = function () { };
|
3204 | |
3205 |
|
3206 |
|
3207 |
|
3208 |
|
3209 | ComponentFactory.prototype.outputs = function () { };
|
3210 | |
3211 |
|
3212 |
|
3213 |
|
3214 |
|
3215 |
|
3216 |
|
3217 |
|
3218 |
|
3219 | ComponentFactory.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) { };
|
3220 | return ComponentFactory;
|
3221 | }());
|
3222 |
|
3223 |
|
3224 |
|
3225 |
|
3226 |
|
3227 |
|
3228 |
|
3229 |
|
3230 |
|
3231 |
|
3232 |
|
3233 | function noComponentFactoryError(component) {
|
3234 | var error = Error("No component factory found for " + stringify(component) + ". Did you add it to @NgModule.entryComponents?");
|
3235 | ((error))[ERROR_COMPONENT] = component;
|
3236 | return error;
|
3237 | }
|
3238 | var ERROR_COMPONENT = 'ngComponent';
|
3239 |
|
3240 |
|
3241 |
|
3242 |
|
3243 | var _NullComponentFactoryResolver = (function () {
|
3244 | function _NullComponentFactoryResolver() {
|
3245 | }
|
3246 | |
3247 |
|
3248 |
|
3249 |
|
3250 |
|
3251 | _NullComponentFactoryResolver.prototype.resolveComponentFactory = function (component) {
|
3252 | throw noComponentFactoryError(component);
|
3253 | };
|
3254 | return _NullComponentFactoryResolver;
|
3255 | }());
|
3256 |
|
3257 |
|
3258 |
|
3259 |
|
3260 | var ComponentFactoryResolver = (function () {
|
3261 | function ComponentFactoryResolver() {
|
3262 | }
|
3263 | |
3264 |
|
3265 |
|
3266 |
|
3267 |
|
3268 |
|
3269 | ComponentFactoryResolver.prototype.resolveComponentFactory = function (component) { };
|
3270 | return ComponentFactoryResolver;
|
3271 | }());
|
3272 | ComponentFactoryResolver.NULL = new _NullComponentFactoryResolver();
|
3273 | var CodegenComponentFactoryResolver = (function () {
|
3274 | |
3275 |
|
3276 |
|
3277 |
|
3278 |
|
3279 | function CodegenComponentFactoryResolver(factories, _parent, _ngModule) {
|
3280 | this._parent = _parent;
|
3281 | this._ngModule = _ngModule;
|
3282 | this._factories = new Map();
|
3283 | for (var i = 0; i < factories.length; i++) {
|
3284 | var factory = factories[i];
|
3285 | this._factories.set(factory.componentType, factory);
|
3286 | }
|
3287 | }
|
3288 | |
3289 |
|
3290 |
|
3291 |
|
3292 |
|
3293 | CodegenComponentFactoryResolver.prototype.resolveComponentFactory = function (component) {
|
3294 | var factory = this._factories.get(component);
|
3295 | if (!factory && this._parent) {
|
3296 | factory = this._parent.resolveComponentFactory(component);
|
3297 | }
|
3298 | if (!factory) {
|
3299 | throw noComponentFactoryError(component);
|
3300 | }
|
3301 | return new ComponentFactoryBoundToModule(factory, this._ngModule);
|
3302 | };
|
3303 | return CodegenComponentFactoryResolver;
|
3304 | }());
|
3305 | var ComponentFactoryBoundToModule = (function (_super) {
|
3306 | __extends(ComponentFactoryBoundToModule, _super);
|
3307 | |
3308 |
|
3309 |
|
3310 |
|
3311 | function ComponentFactoryBoundToModule(factory, ngModule) {
|
3312 | var _this = _super.call(this) || this;
|
3313 | _this.factory = factory;
|
3314 | _this.ngModule = ngModule;
|
3315 | return _this;
|
3316 | }
|
3317 | Object.defineProperty(ComponentFactoryBoundToModule.prototype, "selector", {
|
3318 | |
3319 |
|
3320 |
|
3321 | get: function () { return this.factory.selector; },
|
3322 | enumerable: true,
|
3323 | configurable: true
|
3324 | });
|
3325 | Object.defineProperty(ComponentFactoryBoundToModule.prototype, "componentType", {
|
3326 | |
3327 |
|
3328 |
|
3329 | get: function () { return this.factory.componentType; },
|
3330 | enumerable: true,
|
3331 | configurable: true
|
3332 | });
|
3333 | Object.defineProperty(ComponentFactoryBoundToModule.prototype, "ngContentSelectors", {
|
3334 | |
3335 |
|
3336 |
|
3337 | get: function () { return this.factory.ngContentSelectors; },
|
3338 | enumerable: true,
|
3339 | configurable: true
|
3340 | });
|
3341 | Object.defineProperty(ComponentFactoryBoundToModule.prototype, "inputs", {
|
3342 | |
3343 |
|
3344 |
|
3345 | get: function () { return this.factory.inputs; },
|
3346 | enumerable: true,
|
3347 | configurable: true
|
3348 | });
|
3349 | Object.defineProperty(ComponentFactoryBoundToModule.prototype, "outputs", {
|
3350 | |
3351 |
|
3352 |
|
3353 | get: function () { return this.factory.outputs; },
|
3354 | enumerable: true,
|
3355 | configurable: true
|
3356 | });
|
3357 | |
3358 |
|
3359 |
|
3360 |
|
3361 |
|
3362 |
|
3363 |
|
3364 | ComponentFactoryBoundToModule.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
|
3365 | return this.factory.create(injector, projectableNodes, rootSelectorOrNode, ngModule || this.ngModule);
|
3366 | };
|
3367 | return ComponentFactoryBoundToModule;
|
3368 | }(ComponentFactory));
|
3369 |
|
3370 |
|
3371 |
|
3372 |
|
3373 |
|
3374 |
|
3375 |
|
3376 |
|
3377 |
|
3378 |
|
3379 |
|
3380 |
|
3381 |
|
3382 |
|
3383 |
|
3384 |
|
3385 | var NgModuleRef = (function () {
|
3386 | function NgModuleRef() {
|
3387 | }
|
3388 | |
3389 |
|
3390 |
|
3391 |
|
3392 |
|
3393 | NgModuleRef.prototype.injector = function () { };
|
3394 | |
3395 |
|
3396 |
|
3397 |
|
3398 |
|
3399 |
|
3400 | NgModuleRef.prototype.componentFactoryResolver = function () { };
|
3401 | |
3402 |
|
3403 |
|
3404 |
|
3405 |
|
3406 | NgModuleRef.prototype.instance = function () { };
|
3407 | |
3408 |
|
3409 |
|
3410 |
|
3411 |
|
3412 | NgModuleRef.prototype.destroy = function () { };
|
3413 | |
3414 |
|
3415 |
|
3416 |
|
3417 |
|
3418 |
|
3419 | NgModuleRef.prototype.onDestroy = function (callback) { };
|
3420 | return NgModuleRef;
|
3421 | }());
|
3422 |
|
3423 |
|
3424 |
|
3425 |
|
3426 | var NgModuleFactory = (function () {
|
3427 | function NgModuleFactory() {
|
3428 | }
|
3429 | |
3430 |
|
3431 |
|
3432 |
|
3433 | NgModuleFactory.prototype.moduleType = function () { };
|
3434 | |
3435 |
|
3436 |
|
3437 |
|
3438 |
|
3439 | NgModuleFactory.prototype.create = function (parentInjector) { };
|
3440 | return NgModuleFactory;
|
3441 | }());
|
3442 |
|
3443 |
|
3444 |
|
3445 |
|
3446 |
|
3447 |
|
3448 |
|
3449 | var trace;
|
3450 | var events;
|
3451 |
|
3452 |
|
3453 |
|
3454 | function detectWTF() {
|
3455 | var wtf = ((_global) )['wtf'];
|
3456 | if (wtf) {
|
3457 | trace = wtf['trace'];
|
3458 | if (trace) {
|
3459 | events = trace['events'];
|
3460 | return true;
|
3461 | }
|
3462 | }
|
3463 | return false;
|
3464 | }
|
3465 |
|
3466 |
|
3467 |
|
3468 |
|
3469 |
|
3470 | function createScope$1(signature, flags) {
|
3471 | if (flags === void 0) { flags = null; }
|
3472 | return events.createScope(signature, flags);
|
3473 | }
|
3474 |
|
3475 |
|
3476 |
|
3477 |
|
3478 |
|
3479 |
|
3480 | function leave(scope, returnValue) {
|
3481 | trace.leaveScope(scope, returnValue);
|
3482 | return returnValue;
|
3483 | }
|
3484 |
|
3485 |
|
3486 |
|
3487 |
|
3488 |
|
3489 | function startTimeRange(rangeType, action) {
|
3490 | return trace.beginTimeRange(rangeType, action);
|
3491 | }
|
3492 |
|
3493 |
|
3494 |
|
3495 |
|
3496 | function endTimeRange(range) {
|
3497 | trace.endTimeRange(range);
|
3498 | }
|
3499 |
|
3500 |
|
3501 |
|
3502 |
|
3503 |
|
3504 |
|
3505 |
|
3506 |
|
3507 |
|
3508 |
|
3509 | var wtfEnabled = detectWTF();
|
3510 |
|
3511 |
|
3512 |
|
3513 |
|
3514 |
|
3515 | function noopScope(arg0, arg1) {
|
3516 | return null;
|
3517 | }
|
3518 |
|
3519 |
|
3520 |
|
3521 |
|
3522 |
|
3523 |
|
3524 |
|
3525 |
|
3526 |
|
3527 |
|
3528 |
|
3529 |
|
3530 |
|
3531 |
|
3532 |
|
3533 |
|
3534 |
|
3535 |
|
3536 |
|
3537 |
|
3538 |
|
3539 |
|
3540 |
|
3541 |
|
3542 |
|
3543 |
|
3544 |
|
3545 |
|
3546 |
|
3547 |
|
3548 | var wtfCreateScope = wtfEnabled ? createScope$1 : function (signature, flags) { return noopScope; };
|
3549 |
|
3550 |
|
3551 |
|
3552 |
|
3553 |
|
3554 |
|
3555 |
|
3556 |
|
3557 |
|
3558 | var wtfLeave = wtfEnabled ? leave : function (s, r) { return r; };
|
3559 |
|
3560 |
|
3561 |
|
3562 |
|
3563 |
|
3564 |
|
3565 |
|
3566 |
|
3567 |
|
3568 |
|
3569 |
|
3570 |
|
3571 |
|
3572 | var wtfStartTimeRange = wtfEnabled ? startTimeRange : function (rangeType, action) { return null; };
|
3573 |
|
3574 |
|
3575 |
|
3576 |
|
3577 |
|
3578 |
|
3579 | var wtfEndTimeRange = wtfEnabled ? endTimeRange : function (r) { return null; };
|
3580 |
|
3581 |
|
3582 |
|
3583 |
|
3584 |
|
3585 |
|
3586 |
|
3587 |
|
3588 |
|
3589 |
|
3590 |
|
3591 |
|
3592 |
|
3593 |
|
3594 |
|
3595 |
|
3596 |
|
3597 |
|
3598 |
|
3599 |
|
3600 |
|
3601 |
|
3602 |
|
3603 |
|
3604 |
|
3605 |
|
3606 |
|
3607 |
|
3608 |
|
3609 |
|
3610 |
|
3611 |
|
3612 |
|
3613 |
|
3614 |
|
3615 |
|
3616 |
|
3617 |
|
3618 |
|
3619 |
|
3620 |
|
3621 |
|
3622 |
|
3623 |
|
3624 |
|
3625 |
|
3626 |
|
3627 |
|
3628 |
|
3629 |
|
3630 |
|
3631 |
|
3632 |
|
3633 |
|
3634 | var EventEmitter = (function (_super) {
|
3635 | __extends(EventEmitter, _super);
|
3636 | |
3637 |
|
3638 |
|
3639 |
|
3640 |
|
3641 |
|
3642 |
|
3643 | function EventEmitter(isAsync) {
|
3644 | if (isAsync === void 0) { isAsync = false; }
|
3645 | var _this = _super.call(this) || this;
|
3646 | _this.__isAsync = isAsync;
|
3647 | return _this;
|
3648 | }
|
3649 | |
3650 |
|
3651 |
|
3652 |
|
3653 | EventEmitter.prototype.emit = function (value) { _super.prototype.next.call(this, value); };
|
3654 | |
3655 |
|
3656 |
|
3657 |
|
3658 |
|
3659 |
|
3660 | EventEmitter.prototype.subscribe = function (generatorOrNext, error, complete) {
|
3661 | var schedulerFn;
|
3662 | var errorFn = function (err) { return null; };
|
3663 | var completeFn = function () { return null; };
|
3664 | if (generatorOrNext && typeof generatorOrNext === 'object') {
|
3665 | schedulerFn = this.__isAsync ? function (value) {
|
3666 | setTimeout(function () { return generatorOrNext.next(value); });
|
3667 | } : function (value) { generatorOrNext.next(value); };
|
3668 | if (generatorOrNext.error) {
|
3669 | errorFn = this.__isAsync ? function (err) { setTimeout(function () { return generatorOrNext.error(err); }); } :
|
3670 | function (err) { generatorOrNext.error(err); };
|
3671 | }
|
3672 | if (generatorOrNext.complete) {
|
3673 | completeFn = this.__isAsync ? function () { setTimeout(function () { return generatorOrNext.complete(); }); } :
|
3674 | function () { generatorOrNext.complete(); };
|
3675 | }
|
3676 | }
|
3677 | else {
|
3678 | schedulerFn = this.__isAsync ? function (value) { setTimeout(function () { return generatorOrNext(value); }); } :
|
3679 | function (value) { generatorOrNext(value); };
|
3680 | if (error) {
|
3681 | errorFn =
|
3682 | this.__isAsync ? function (err) { setTimeout(function () { return error(err); }); } : function (err) { error(err); };
|
3683 | }
|
3684 | if (complete) {
|
3685 | completeFn =
|
3686 | this.__isAsync ? function () { setTimeout(function () { return complete(); }); } : function () { complete(); };
|
3687 | }
|
3688 | }
|
3689 | return _super.prototype.subscribe.call(this, schedulerFn, errorFn, completeFn);
|
3690 | };
|
3691 | return EventEmitter;
|
3692 | }(rxjs_Subject.Subject));
|
3693 |
|
3694 |
|
3695 |
|
3696 |
|
3697 |
|
3698 |
|
3699 |
|
3700 |
|
3701 |
|
3702 |
|
3703 |
|
3704 |
|
3705 |
|
3706 |
|
3707 |
|
3708 |
|
3709 |
|
3710 |
|
3711 |
|
3712 |
|
3713 |
|
3714 |
|
3715 |
|
3716 |
|
3717 |
|
3718 |
|
3719 |
|
3720 |
|
3721 |
|
3722 |
|
3723 |
|
3724 |
|
3725 |
|
3726 |
|
3727 |
|
3728 |
|
3729 |
|
3730 |
|
3731 |
|
3732 |
|
3733 |
|
3734 |
|
3735 |
|
3736 |
|
3737 |
|
3738 |
|
3739 |
|
3740 |
|
3741 |
|
3742 |
|
3743 |
|
3744 |
|
3745 |
|
3746 |
|
3747 |
|
3748 |
|
3749 |
|
3750 |
|
3751 |
|
3752 |
|
3753 |
|
3754 |
|
3755 |
|
3756 |
|
3757 |
|
3758 |
|
3759 |
|
3760 |
|
3761 |
|
3762 |
|
3763 |
|
3764 |
|
3765 |
|
3766 |
|
3767 |
|
3768 |
|
3769 |
|
3770 |
|
3771 |
|
3772 | var NgZone = (function () {
|
3773 | |
3774 |
|
3775 |
|
3776 | function NgZone(_a) {
|
3777 | var _b = _a.enableLongStackTrace, enableLongStackTrace = _b === void 0 ? false : _b;
|
3778 | this._hasPendingMicrotasks = false;
|
3779 | this._hasPendingMacrotasks = false;
|
3780 | this._isStable = true;
|
3781 | this._nesting = 0;
|
3782 | this._onUnstable = new EventEmitter(false);
|
3783 | this._onMicrotaskEmpty = new EventEmitter(false);
|
3784 | this._onStable = new EventEmitter(false);
|
3785 | this._onErrorEvents = new EventEmitter(false);
|
3786 | if (typeof Zone == 'undefined') {
|
3787 | throw new Error('Angular requires Zone.js prolyfill.');
|
3788 | }
|
3789 | Zone.assertZonePatched();
|
3790 | this.outer = this.inner = Zone.current;
|
3791 | if (Zone['wtfZoneSpec']) {
|
3792 | this.inner = this.inner.fork(Zone['wtfZoneSpec']);
|
3793 | }
|
3794 | if (enableLongStackTrace && Zone['longStackTraceZoneSpec']) {
|
3795 | this.inner = this.inner.fork(Zone['longStackTraceZoneSpec']);
|
3796 | }
|
3797 | this.forkInnerZoneWithAngularBehavior();
|
3798 | }
|
3799 | |
3800 |
|
3801 |
|
3802 | NgZone.isInAngularZone = function () { return Zone.current.get('isAngularZone') === true; };
|
3803 | |
3804 |
|
3805 |
|
3806 | NgZone.assertInAngularZone = function () {
|
3807 | if (!NgZone.isInAngularZone()) {
|
3808 | throw new Error('Expected to be in Angular Zone, but it is not!');
|
3809 | }
|
3810 | };
|
3811 | |
3812 |
|
3813 |
|
3814 | NgZone.assertNotInAngularZone = function () {
|
3815 | if (NgZone.isInAngularZone()) {
|
3816 | throw new Error('Expected to not be in Angular Zone, but it is!');
|
3817 | }
|
3818 | };
|
3819 | |
3820 |
|
3821 |
|
3822 |
|
3823 |
|
3824 |
|
3825 |
|
3826 |
|
3827 |
|
3828 |
|
3829 |
|
3830 |
|
3831 |
|
3832 |
|
3833 | NgZone.prototype.run = function (fn) { return this.inner.run(fn); };
|
3834 | |
3835 |
|
3836 |
|
3837 |
|
3838 |
|
3839 |
|
3840 | NgZone.prototype.runGuarded = function (fn) { return this.inner.runGuarded(fn); };
|
3841 | |
3842 |
|
3843 |
|
3844 |
|
3845 |
|
3846 |
|
3847 |
|
3848 |
|
3849 |
|
3850 |
|
3851 |
|
3852 |
|
3853 |
|
3854 |
|
3855 |
|
3856 | NgZone.prototype.runOutsideAngular = function (fn) { return this.outer.run(fn); };
|
3857 | Object.defineProperty(NgZone.prototype, "onUnstable", {
|
3858 | |
3859 |
|
3860 |
|
3861 |
|
3862 | get: function () { return this._onUnstable; },
|
3863 | enumerable: true,
|
3864 | configurable: true
|
3865 | });
|
3866 | Object.defineProperty(NgZone.prototype, "onMicrotaskEmpty", {
|
3867 | |
3868 |
|
3869 |
|
3870 |
|
3871 |
|
3872 |
|
3873 | get: function () { return this._onMicrotaskEmpty; },
|
3874 | enumerable: true,
|
3875 | configurable: true
|
3876 | });
|
3877 | Object.defineProperty(NgZone.prototype, "onStable", {
|
3878 | |
3879 |
|
3880 |
|
3881 |
|
3882 |
|
3883 |
|
3884 | get: function () { return this._onStable; },
|
3885 | enumerable: true,
|
3886 | configurable: true
|
3887 | });
|
3888 | Object.defineProperty(NgZone.prototype, "onError", {
|
3889 | |
3890 |
|
3891 |
|
3892 |
|
3893 | get: function () { return this._onErrorEvents; },
|
3894 | enumerable: true,
|
3895 | configurable: true
|
3896 | });
|
3897 | Object.defineProperty(NgZone.prototype, "isStable", {
|
3898 | |
3899 |
|
3900 |
|
3901 |
|
3902 | get: function () { return this._isStable; },
|
3903 | enumerable: true,
|
3904 | configurable: true
|
3905 | });
|
3906 | Object.defineProperty(NgZone.prototype, "hasPendingMicrotasks", {
|
3907 | |
3908 |
|
3909 |
|
3910 | get: function () { return this._hasPendingMicrotasks; },
|
3911 | enumerable: true,
|
3912 | configurable: true
|
3913 | });
|
3914 | Object.defineProperty(NgZone.prototype, "hasPendingMacrotasks", {
|
3915 | |
3916 |
|
3917 |
|
3918 | get: function () { return this._hasPendingMacrotasks; },
|
3919 | enumerable: true,
|
3920 | configurable: true
|
3921 | });
|
3922 | |
3923 |
|
3924 |
|
3925 | NgZone.prototype.checkStable = function () {
|
3926 | var _this = this;
|
3927 | if (this._nesting == 0 && !this._hasPendingMicrotasks && !this._isStable) {
|
3928 | try {
|
3929 | this._nesting++;
|
3930 | this._onMicrotaskEmpty.emit(null);
|
3931 | }
|
3932 | finally {
|
3933 | this._nesting--;
|
3934 | if (!this._hasPendingMicrotasks) {
|
3935 | try {
|
3936 | this.runOutsideAngular(function () { return _this._onStable.emit(null); });
|
3937 | }
|
3938 | finally {
|
3939 | this._isStable = true;
|
3940 | }
|
3941 | }
|
3942 | }
|
3943 | }
|
3944 | };
|
3945 | |
3946 |
|
3947 |
|
3948 | NgZone.prototype.forkInnerZoneWithAngularBehavior = function () {
|
3949 | var _this = this;
|
3950 | this.inner = this.inner.fork({
|
3951 | name: 'angular',
|
3952 | properties: ({ 'isAngularZone': true }),
|
3953 | onInvokeTask: function (delegate, current, target, task, applyThis, applyArgs) {
|
3954 | try {
|
3955 | _this.onEnter();
|
3956 | return delegate.invokeTask(target, task, applyThis, applyArgs);
|
3957 | }
|
3958 | finally {
|
3959 | _this.onLeave();
|
3960 | }
|
3961 | },
|
3962 | onInvoke: function (delegate, current, target, callback, applyThis, applyArgs, source) {
|
3963 | try {
|
3964 | _this.onEnter();
|
3965 | return delegate.invoke(target, callback, applyThis, applyArgs, source);
|
3966 | }
|
3967 | finally {
|
3968 | _this.onLeave();
|
3969 | }
|
3970 | },
|
3971 | onHasTask: function (delegate, current, target, hasTaskState) {
|
3972 | delegate.hasTask(target, hasTaskState);
|
3973 | if (current === target) {
|
3974 |
|
3975 |
|
3976 | if (hasTaskState.change == 'microTask') {
|
3977 | _this.setHasMicrotask(hasTaskState.microTask);
|
3978 | }
|
3979 | else if (hasTaskState.change == 'macroTask') {
|
3980 | _this.setHasMacrotask(hasTaskState.macroTask);
|
3981 | }
|
3982 | }
|
3983 | },
|
3984 | onHandleError: function (delegate, current, target, error) {
|
3985 | delegate.handleError(target, error);
|
3986 | _this.triggerError(error);
|
3987 | return false;
|
3988 | }
|
3989 | });
|
3990 | };
|
3991 | |
3992 |
|
3993 |
|
3994 | NgZone.prototype.onEnter = function () {
|
3995 | this._nesting++;
|
3996 | if (this._isStable) {
|
3997 | this._isStable = false;
|
3998 | this._onUnstable.emit(null);
|
3999 | }
|
4000 | };
|
4001 | |
4002 |
|
4003 |
|
4004 | NgZone.prototype.onLeave = function () {
|
4005 | this._nesting--;
|
4006 | this.checkStable();
|
4007 | };
|
4008 | |
4009 |
|
4010 |
|
4011 |
|
4012 | NgZone.prototype.setHasMicrotask = function (hasMicrotasks) {
|
4013 | this._hasPendingMicrotasks = hasMicrotasks;
|
4014 | this.checkStable();
|
4015 | };
|
4016 | |
4017 |
|
4018 |
|
4019 |
|
4020 | NgZone.prototype.setHasMacrotask = function (hasMacrotasks) { this._hasPendingMacrotasks = hasMacrotasks; };
|
4021 | |
4022 |
|
4023 |
|
4024 |
|
4025 | NgZone.prototype.triggerError = function (error) { this._onErrorEvents.emit(error); };
|
4026 | return NgZone;
|
4027 | }());
|
4028 |
|
4029 |
|
4030 |
|
4031 |
|
4032 |
|
4033 |
|
4034 |
|
4035 |
|
4036 |
|
4037 |
|
4038 |
|
4039 |
|
4040 |
|
4041 | var Testability = (function () {
|
4042 | |
4043 |
|
4044 |
|
4045 | function Testability(_ngZone) {
|
4046 | this._ngZone = _ngZone;
|
4047 | |
4048 |
|
4049 |
|
4050 | this._pendingCount = 0;
|
4051 | |
4052 |
|
4053 |
|
4054 | this._isZoneStable = true;
|
4055 | |
4056 |
|
4057 |
|
4058 |
|
4059 |
|
4060 |
|
4061 | this._didWork = false;
|
4062 | |
4063 |
|
4064 |
|
4065 | this._callbacks = [];
|
4066 | this._watchAngularEvents();
|
4067 | }
|
4068 | |
4069 |
|
4070 |
|
4071 |
|
4072 | Testability.prototype._watchAngularEvents = function () {
|
4073 | var _this = this;
|
4074 | this._ngZone.onUnstable.subscribe({
|
4075 | next: function () {
|
4076 | _this._didWork = true;
|
4077 | _this._isZoneStable = false;
|
4078 | }
|
4079 | });
|
4080 | this._ngZone.runOutsideAngular(function () {
|
4081 | _this._ngZone.onStable.subscribe({
|
4082 | next: function () {
|
4083 | NgZone.assertNotInAngularZone();
|
4084 | scheduleMicroTask(function () {
|
4085 | _this._isZoneStable = true;
|
4086 | _this._runCallbacksIfReady();
|
4087 | });
|
4088 | }
|
4089 | });
|
4090 | });
|
4091 | };
|
4092 | |
4093 |
|
4094 |
|
4095 | Testability.prototype.increasePendingRequestCount = function () {
|
4096 | this._pendingCount += 1;
|
4097 | this._didWork = true;
|
4098 | return this._pendingCount;
|
4099 | };
|
4100 | |
4101 |
|
4102 |
|
4103 | Testability.prototype.decreasePendingRequestCount = function () {
|
4104 | this._pendingCount -= 1;
|
4105 | if (this._pendingCount < 0) {
|
4106 | throw new Error('pending async requests below zero');
|
4107 | }
|
4108 | this._runCallbacksIfReady();
|
4109 | return this._pendingCount;
|
4110 | };
|
4111 | |
4112 |
|
4113 |
|
4114 | Testability.prototype.isStable = function () {
|
4115 | return this._isZoneStable && this._pendingCount == 0 && !this._ngZone.hasPendingMacrotasks;
|
4116 | };
|
4117 | |
4118 |
|
4119 |
|
4120 |
|
4121 | Testability.prototype._runCallbacksIfReady = function () {
|
4122 | var _this = this;
|
4123 | if (this.isStable()) {
|
4124 |
|
4125 | scheduleMicroTask(function () {
|
4126 | while (_this._callbacks.length !== 0) {
|
4127 | (((_this._callbacks.pop())))(_this._didWork);
|
4128 | }
|
4129 | _this._didWork = false;
|
4130 | });
|
4131 | }
|
4132 | else {
|
4133 |
|
4134 | this._didWork = true;
|
4135 | }
|
4136 | };
|
4137 | |
4138 |
|
4139 |
|
4140 |
|
4141 | Testability.prototype.whenStable = function (callback) {
|
4142 | this._callbacks.push(callback);
|
4143 | this._runCallbacksIfReady();
|
4144 | };
|
4145 | |
4146 |
|
4147 |
|
4148 | Testability.prototype.getPendingRequestCount = function () { return this._pendingCount; };
|
4149 | |
4150 |
|
4151 |
|
4152 |
|
4153 |
|
4154 |
|
4155 |
|
4156 | Testability.prototype.findBindings = function (using, provider, exactMatch) {
|
4157 |
|
4158 | return [];
|
4159 | };
|
4160 | |
4161 |
|
4162 |
|
4163 |
|
4164 |
|
4165 |
|
4166 | Testability.prototype.findProviders = function (using, provider, exactMatch) {
|
4167 |
|
4168 | return [];
|
4169 | };
|
4170 | return Testability;
|
4171 | }());
|
4172 | Testability.decorators = [
|
4173 | { type: Injectable },
|
4174 | ];
|
4175 |
|
4176 |
|
4177 |
|
4178 | Testability.ctorParameters = function () { return [
|
4179 | { type: NgZone, },
|
4180 | ]; };
|
4181 |
|
4182 |
|
4183 |
|
4184 |
|
4185 | var TestabilityRegistry = (function () {
|
4186 | function TestabilityRegistry() {
|
4187 | |
4188 |
|
4189 |
|
4190 | this._applications = new Map();
|
4191 | _testabilityGetter.addToWindow(this);
|
4192 | }
|
4193 | |
4194 |
|
4195 |
|
4196 |
|
4197 |
|
4198 | TestabilityRegistry.prototype.registerApplication = function (token, testability) {
|
4199 | this._applications.set(token, testability);
|
4200 | };
|
4201 | |
4202 |
|
4203 |
|
4204 |
|
4205 | TestabilityRegistry.prototype.getTestability = function (elem) { return this._applications.get(elem) || null; };
|
4206 | |
4207 |
|
4208 |
|
4209 | TestabilityRegistry.prototype.getAllTestabilities = function () { return Array.from(this._applications.values()); };
|
4210 | |
4211 |
|
4212 |
|
4213 | TestabilityRegistry.prototype.getAllRootElements = function () { return Array.from(this._applications.keys()); };
|
4214 | |
4215 |
|
4216 |
|
4217 |
|
4218 |
|
4219 | TestabilityRegistry.prototype.findTestabilityInTree = function (elem, findInAncestors) {
|
4220 | if (findInAncestors === void 0) { findInAncestors = true; }
|
4221 | return _testabilityGetter.findTestabilityInTree(this, elem, findInAncestors);
|
4222 | };
|
4223 | return TestabilityRegistry;
|
4224 | }());
|
4225 | TestabilityRegistry.decorators = [
|
4226 | { type: Injectable },
|
4227 | ];
|
4228 |
|
4229 |
|
4230 |
|
4231 | TestabilityRegistry.ctorParameters = function () { return []; };
|
4232 | var _NoopGetTestability = (function () {
|
4233 | function _NoopGetTestability() {
|
4234 | }
|
4235 | |
4236 |
|
4237 |
|
4238 |
|
4239 | _NoopGetTestability.prototype.addToWindow = function (registry) { };
|
4240 | |
4241 |
|
4242 |
|
4243 |
|
4244 |
|
4245 |
|
4246 | _NoopGetTestability.prototype.findTestabilityInTree = function (registry, elem, findInAncestors) {
|
4247 | return null;
|
4248 | };
|
4249 | return _NoopGetTestability;
|
4250 | }());
|
4251 |
|
4252 |
|
4253 |
|
4254 |
|
4255 |
|
4256 |
|
4257 | function setTestabilityGetter(getter) {
|
4258 | _testabilityGetter = getter;
|
4259 | }
|
4260 | var _testabilityGetter = new _NoopGetTestability();
|
4261 |
|
4262 |
|
4263 |
|
4264 |
|
4265 |
|
4266 |
|
4267 |
|
4268 | var _devMode = true;
|
4269 | var _runModeLocked = false;
|
4270 | var _platform;
|
4271 | var ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
|
4272 |
|
4273 |
|
4274 |
|
4275 |
|
4276 |
|
4277 |
|
4278 |
|
4279 |
|
4280 |
|
4281 |
|
4282 |
|
4283 | function enableProdMode() {
|
4284 | if (_runModeLocked) {
|
4285 | throw new Error('Cannot enable prod mode after platform setup.');
|
4286 | }
|
4287 | _devMode = false;
|
4288 | }
|
4289 |
|
4290 |
|
4291 |
|
4292 |
|
4293 |
|
4294 |
|
4295 |
|
4296 |
|
4297 |
|
4298 | function isDevMode() {
|
4299 | _runModeLocked = true;
|
4300 | return _devMode;
|
4301 | }
|
4302 |
|
4303 |
|
4304 |
|
4305 |
|
4306 |
|
4307 | var NgProbeToken = (function () {
|
4308 | |
4309 |
|
4310 |
|
4311 |
|
4312 | function NgProbeToken(name, token) {
|
4313 | this.name = name;
|
4314 | this.token = token;
|
4315 | }
|
4316 | return NgProbeToken;
|
4317 | }());
|
4318 |
|
4319 |
|
4320 |
|
4321 |
|
4322 |
|
4323 |
|
4324 |
|
4325 |
|
4326 | function createPlatform(injector) {
|
4327 | if (_platform && !_platform.destroyed &&
|
4328 | !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
|
4329 | throw new Error('There can be only one platform. Destroy the previous one to create a new one.');
|
4330 | }
|
4331 | _platform = injector.get(PlatformRef);
|
4332 | var inits = injector.get(PLATFORM_INITIALIZER, null);
|
4333 | if (inits)
|
4334 | inits.forEach(function (init) { return init(); });
|
4335 | return _platform;
|
4336 | }
|
4337 |
|
4338 |
|
4339 |
|
4340 |
|
4341 |
|
4342 |
|
4343 |
|
4344 |
|
4345 |
|
4346 | function createPlatformFactory(parentPlatformFactory, name, providers) {
|
4347 | if (providers === void 0) { providers = []; }
|
4348 | var marker = new InjectionToken("Platform: " + name);
|
4349 | return function (extraProviders) {
|
4350 | if (extraProviders === void 0) { extraProviders = []; }
|
4351 | var platform = getPlatform();
|
4352 | if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
|
4353 | if (parentPlatformFactory) {
|
4354 | parentPlatformFactory(providers.concat(extraProviders).concat({ provide: marker, useValue: true }));
|
4355 | }
|
4356 | else {
|
4357 | createPlatform(ReflectiveInjector.resolveAndCreate(providers.concat(extraProviders).concat({ provide: marker, useValue: true })));
|
4358 | }
|
4359 | }
|
4360 | return assertPlatform(marker);
|
4361 | };
|
4362 | }
|
4363 |
|
4364 |
|
4365 |
|
4366 |
|
4367 |
|
4368 |
|
4369 |
|
4370 | function assertPlatform(requiredToken) {
|
4371 | var platform = getPlatform();
|
4372 | if (!platform) {
|
4373 | throw new Error('No platform exists!');
|
4374 | }
|
4375 | if (!platform.injector.get(requiredToken, null)) {
|
4376 | throw new Error('A platform with a different configuration has been created. Please destroy it first.');
|
4377 | }
|
4378 | return platform;
|
4379 | }
|
4380 |
|
4381 |
|
4382 |
|
4383 |
|
4384 |
|
4385 |
|
4386 | function destroyPlatform() {
|
4387 | if (_platform && !_platform.destroyed) {
|
4388 | _platform.destroy();
|
4389 | }
|
4390 | }
|
4391 |
|
4392 |
|
4393 |
|
4394 |
|
4395 |
|
4396 |
|
4397 | function getPlatform() {
|
4398 | return _platform && !_platform.destroyed ? _platform : null;
|
4399 | }
|
4400 |
|
4401 |
|
4402 |
|
4403 |
|
4404 |
|
4405 |
|
4406 |
|
4407 |
|
4408 |
|
4409 |
|
4410 |
|
4411 | var PlatformRef = (function () {
|
4412 | function PlatformRef() {
|
4413 | }
|
4414 | |
4415 |
|
4416 |
|
4417 |
|
4418 |
|
4419 |
|
4420 |
|
4421 |
|
4422 |
|
4423 |
|
4424 |
|
4425 |
|
4426 |
|
4427 |
|
4428 |
|
4429 |
|
4430 |
|
4431 |
|
4432 |
|
4433 |
|
4434 |
|
4435 |
|
4436 |
|
4437 |
|
4438 |
|
4439 |
|
4440 |
|
4441 | PlatformRef.prototype.bootstrapModuleFactory = function (moduleFactory) { };
|
4442 | |
4443 |
|
4444 |
|
4445 |
|
4446 |
|
4447 |
|
4448 |
|
4449 |
|
4450 |
|
4451 |
|
4452 |
|
4453 |
|
4454 |
|
4455 |
|
4456 |
|
4457 |
|
4458 |
|
4459 |
|
4460 |
|
4461 |
|
4462 | PlatformRef.prototype.bootstrapModule = function (moduleType, compilerOptions) { };
|
4463 | |
4464 |
|
4465 |
|
4466 |
|
4467 |
|
4468 |
|
4469 | PlatformRef.prototype.onDestroy = function (callback) { };
|
4470 | |
4471 |
|
4472 |
|
4473 |
|
4474 |
|
4475 |
|
4476 | PlatformRef.prototype.injector = function () { };
|
4477 | |
4478 |
|
4479 |
|
4480 |
|
4481 |
|
4482 | PlatformRef.prototype.destroy = function () { };
|
4483 | |
4484 |
|
4485 |
|
4486 |
|
4487 | PlatformRef.prototype.destroyed = function () { };
|
4488 | return PlatformRef;
|
4489 | }());
|
4490 |
|
4491 |
|
4492 |
|
4493 |
|
4494 |
|
4495 | function _callAndReportToErrorHandler(errorHandler, callback) {
|
4496 | try {
|
4497 | var result = callback();
|
4498 | if (isPromise(result)) {
|
4499 | return result.catch(function (e) {
|
4500 | errorHandler.handleError(e);
|
4501 |
|
4502 | throw e;
|
4503 | });
|
4504 | }
|
4505 | return result;
|
4506 | }
|
4507 | catch (e) {
|
4508 | errorHandler.handleError(e);
|
4509 |
|
4510 | throw e;
|
4511 | }
|
4512 | }
|
4513 |
|
4514 |
|
4515 |
|
4516 |
|
4517 | var PlatformRef_ = (function (_super) {
|
4518 | __extends(PlatformRef_, _super);
|
4519 | |
4520 |
|
4521 |
|
4522 | function PlatformRef_(_injector) {
|
4523 | var _this = _super.call(this) || this;
|
4524 | _this._injector = _injector;
|
4525 | _this._modules = [];
|
4526 | _this._destroyListeners = [];
|
4527 | _this._destroyed = false;
|
4528 | return _this;
|
4529 | }
|
4530 | |
4531 |
|
4532 |
|
4533 |
|
4534 | PlatformRef_.prototype.onDestroy = function (callback) { this._destroyListeners.push(callback); };
|
4535 | Object.defineProperty(PlatformRef_.prototype, "injector", {
|
4536 | |
4537 |
|
4538 |
|
4539 | get: function () { return this._injector; },
|
4540 | enumerable: true,
|
4541 | configurable: true
|
4542 | });
|
4543 | Object.defineProperty(PlatformRef_.prototype, "destroyed", {
|
4544 | |
4545 |
|
4546 |
|
4547 | get: function () { return this._destroyed; },
|
4548 | enumerable: true,
|
4549 | configurable: true
|
4550 | });
|
4551 | |
4552 |
|
4553 |
|
4554 | PlatformRef_.prototype.destroy = function () {
|
4555 | if (this._destroyed) {
|
4556 | throw new Error('The platform has already been destroyed!');
|
4557 | }
|
4558 | this._modules.slice().forEach(function (module) { return module.destroy(); });
|
4559 | this._destroyListeners.forEach(function (listener) { return listener(); });
|
4560 | this._destroyed = true;
|
4561 | };
|
4562 | |
4563 |
|
4564 |
|
4565 |
|
4566 |
|
4567 | PlatformRef_.prototype.bootstrapModuleFactory = function (moduleFactory) {
|
4568 | return this._bootstrapModuleFactoryWithZone(moduleFactory);
|
4569 | };
|
4570 | |
4571 |
|
4572 |
|
4573 |
|
4574 |
|
4575 |
|
4576 | PlatformRef_.prototype._bootstrapModuleFactoryWithZone = function (moduleFactory, ngZone) {
|
4577 | var _this = this;
|
4578 |
|
4579 |
|
4580 |
|
4581 |
|
4582 | if (!ngZone)
|
4583 | ngZone = new NgZone({ enableLongStackTrace: isDevMode() });
|
4584 |
|
4585 |
|
4586 | return ngZone.run(function () {
|
4587 | var ngZoneInjector = ReflectiveInjector.resolveAndCreate([{ provide: NgZone, useValue: ngZone }], _this.injector);
|
4588 | var moduleRef = (moduleFactory.create(ngZoneInjector));
|
4589 | var exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
|
4590 | if (!exceptionHandler) {
|
4591 | throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?');
|
4592 | }
|
4593 | moduleRef.onDestroy(function () { return remove(_this._modules, moduleRef); });
|
4594 | ((ngZone)).onError.subscribe({ next: function (error) { exceptionHandler.handleError(error); } });
|
4595 | return _callAndReportToErrorHandler(exceptionHandler, function () {
|
4596 | var initStatus = moduleRef.injector.get(ApplicationInitStatus);
|
4597 | initStatus.runInitializers();
|
4598 | return initStatus.donePromise.then(function () {
|
4599 | _this._moduleDoBootstrap(moduleRef);
|
4600 | return moduleRef;
|
4601 | });
|
4602 | });
|
4603 | });
|
4604 | };
|
4605 | |
4606 |
|
4607 |
|
4608 |
|
4609 |
|
4610 |
|
4611 | PlatformRef_.prototype.bootstrapModule = function (moduleType, compilerOptions) {
|
4612 | if (compilerOptions === void 0) { compilerOptions = []; }
|
4613 | return this._bootstrapModuleWithZone(moduleType, compilerOptions);
|
4614 | };
|
4615 | |
4616 |
|
4617 |
|
4618 |
|
4619 |
|
4620 |
|
4621 |
|
4622 | PlatformRef_.prototype._bootstrapModuleWithZone = function (moduleType, compilerOptions, ngZone) {
|
4623 | var _this = this;
|
4624 | if (compilerOptions === void 0) { compilerOptions = []; }
|
4625 | var compilerFactory = this.injector.get(CompilerFactory);
|
4626 | var compiler = compilerFactory.createCompiler(Array.isArray(compilerOptions) ? compilerOptions : [compilerOptions]);
|
4627 | return compiler.compileModuleAsync(moduleType)
|
4628 | .then(function (moduleFactory) { return _this._bootstrapModuleFactoryWithZone(moduleFactory, ngZone); });
|
4629 | };
|
4630 | |
4631 |
|
4632 |
|
4633 |
|
4634 | PlatformRef_.prototype._moduleDoBootstrap = function (moduleRef) {
|
4635 | var appRef = (moduleRef.injector.get(ApplicationRef));
|
4636 | if (moduleRef._bootstrapComponents.length > 0) {
|
4637 | moduleRef._bootstrapComponents.forEach(function (f) { return appRef.bootstrap(f); });
|
4638 | }
|
4639 | else if (moduleRef.instance.ngDoBootstrap) {
|
4640 | moduleRef.instance.ngDoBootstrap(appRef);
|
4641 | }
|
4642 | else {
|
4643 | throw new Error("The module " + stringify(moduleRef.instance.constructor) + " was bootstrapped, but it does not declare \"@NgModule.bootstrap\" components nor a \"ngDoBootstrap\" method. " +
|
4644 | "Please define one of these.");
|
4645 | }
|
4646 | this._modules.push(moduleRef);
|
4647 | };
|
4648 | return PlatformRef_;
|
4649 | }(PlatformRef));
|
4650 | PlatformRef_.decorators = [
|
4651 | { type: Injectable },
|
4652 | ];
|
4653 |
|
4654 |
|
4655 |
|
4656 | PlatformRef_.ctorParameters = function () { return [
|
4657 | { type: Injector, },
|
4658 | ]; };
|
4659 |
|
4660 |
|
4661 |
|
4662 |
|
4663 |
|
4664 |
|
4665 | var ApplicationRef = (function () {
|
4666 | function ApplicationRef() {
|
4667 | }
|
4668 | |
4669 |
|
4670 |
|
4671 |
|
4672 |
|
4673 |
|
4674 |
|
4675 |
|
4676 |
|
4677 |
|
4678 |
|
4679 |
|
4680 |
|
4681 |
|
4682 |
|
4683 |
|
4684 |
|
4685 |
|
4686 |
|
4687 |
|
4688 | ApplicationRef.prototype.bootstrap = function (componentFactory, rootSelectorOrNode) { };
|
4689 | |
4690 |
|
4691 |
|
4692 |
|
4693 |
|
4694 |
|
4695 |
|
4696 |
|
4697 |
|
4698 |
|
4699 |
|
4700 |
|
4701 | ApplicationRef.prototype.tick = function () { };
|
4702 | |
4703 |
|
4704 |
|
4705 |
|
4706 |
|
4707 |
|
4708 | ApplicationRef.prototype.componentTypes = function () { };
|
4709 | |
4710 |
|
4711 |
|
4712 |
|
4713 |
|
4714 | ApplicationRef.prototype.components = function () { };
|
4715 | |
4716 |
|
4717 |
|
4718 |
|
4719 |
|
4720 |
|
4721 |
|
4722 |
|
4723 | ApplicationRef.prototype.attachView = function (view) { };
|
4724 | |
4725 |
|
4726 |
|
4727 |
|
4728 |
|
4729 |
|
4730 | ApplicationRef.prototype.detachView = function (view) { };
|
4731 | |
4732 |
|
4733 |
|
4734 |
|
4735 |
|
4736 | ApplicationRef.prototype.viewCount = function () { };
|
4737 | |
4738 |
|
4739 |
|
4740 |
|
4741 |
|
4742 | ApplicationRef.prototype.isStable = function () { };
|
4743 | return ApplicationRef;
|
4744 | }());
|
4745 |
|
4746 |
|
4747 |
|
4748 |
|
4749 | var ApplicationRef_ = (function (_super) {
|
4750 | __extends(ApplicationRef_, _super);
|
4751 | |
4752 |
|
4753 |
|
4754 |
|
4755 |
|
4756 |
|
4757 |
|
4758 |
|
4759 | function ApplicationRef_(_zone, _console, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus) {
|
4760 | var _this = _super.call(this) || this;
|
4761 | _this._zone = _zone;
|
4762 | _this._console = _console;
|
4763 | _this._injector = _injector;
|
4764 | _this._exceptionHandler = _exceptionHandler;
|
4765 | _this._componentFactoryResolver = _componentFactoryResolver;
|
4766 | _this._initStatus = _initStatus;
|
4767 | _this._bootstrapListeners = [];
|
4768 | _this._rootComponents = [];
|
4769 | _this._rootComponentTypes = [];
|
4770 | _this._views = [];
|
4771 | _this._runningTick = false;
|
4772 | _this._enforceNoNewChanges = false;
|
4773 | _this._stable = true;
|
4774 | _this._enforceNoNewChanges = isDevMode();
|
4775 | _this._zone.onMicrotaskEmpty.subscribe({ next: function () { _this._zone.run(function () { _this.tick(); }); } });
|
4776 | var isCurrentlyStable = new rxjs_Observable.Observable(function (observer) {
|
4777 | _this._stable = _this._zone.isStable && !_this._zone.hasPendingMacrotasks &&
|
4778 | !_this._zone.hasPendingMicrotasks;
|
4779 | _this._zone.runOutsideAngular(function () {
|
4780 | observer.next(_this._stable);
|
4781 | observer.complete();
|
4782 | });
|
4783 | });
|
4784 | var isStable = new rxjs_Observable.Observable(function (observer) {
|
4785 | var stableSub = _this._zone.onStable.subscribe(function () {
|
4786 | NgZone.assertNotInAngularZone();
|
4787 |
|
4788 |
|
4789 | scheduleMicroTask(function () {
|
4790 | if (!_this._stable && !_this._zone.hasPendingMacrotasks &&
|
4791 | !_this._zone.hasPendingMicrotasks) {
|
4792 | _this._stable = true;
|
4793 | observer.next(true);
|
4794 | }
|
4795 | });
|
4796 | });
|
4797 | var unstableSub = _this._zone.onUnstable.subscribe(function () {
|
4798 | NgZone.assertInAngularZone();
|
4799 | if (_this._stable) {
|
4800 | _this._stable = false;
|
4801 | _this._zone.runOutsideAngular(function () { observer.next(false); });
|
4802 | }
|
4803 | });
|
4804 | return function () {
|
4805 | stableSub.unsubscribe();
|
4806 | unstableSub.unsubscribe();
|
4807 | };
|
4808 | });
|
4809 | _this._isStable = rxjs_observable_merge.merge(isCurrentlyStable, rxjs_operator_share.share.call(isStable));
|
4810 | return _this;
|
4811 | }
|
4812 | |
4813 |
|
4814 |
|
4815 |
|
4816 | ApplicationRef_.prototype.attachView = function (viewRef) {
|
4817 | var view = ((viewRef));
|
4818 | this._views.push(view);
|
4819 | view.attachToAppRef(this);
|
4820 | };
|
4821 | |
4822 |
|
4823 |
|
4824 |
|
4825 | ApplicationRef_.prototype.detachView = function (viewRef) {
|
4826 | var view = ((viewRef));
|
4827 | remove(this._views, view);
|
4828 | view.detachFromAppRef();
|
4829 | };
|
4830 | |
4831 |
|
4832 |
|
4833 |
|
4834 |
|
4835 |
|
4836 | ApplicationRef_.prototype.bootstrap = function (componentOrFactory, rootSelectorOrNode) {
|
4837 | var _this = this;
|
4838 | if (!this._initStatus.done) {
|
4839 | throw new Error('Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.');
|
4840 | }
|
4841 | var componentFactory;
|
4842 | if (componentOrFactory instanceof ComponentFactory) {
|
4843 | componentFactory = componentOrFactory;
|
4844 | }
|
4845 | else {
|
4846 | componentFactory = ((this._componentFactoryResolver.resolveComponentFactory(componentOrFactory)));
|
4847 | }
|
4848 | this._rootComponentTypes.push(componentFactory.componentType);
|
4849 |
|
4850 | var ngModule = componentFactory instanceof ComponentFactoryBoundToModule ?
|
4851 | null :
|
4852 | this._injector.get(NgModuleRef);
|
4853 | var selectorOrNode = rootSelectorOrNode || componentFactory.selector;
|
4854 | var compRef = componentFactory.create(Injector.NULL, [], selectorOrNode, ngModule);
|
4855 | compRef.onDestroy(function () { _this._unloadComponent(compRef); });
|
4856 | var testability = compRef.injector.get(Testability, null);
|
4857 | if (testability) {
|
4858 | compRef.injector.get(TestabilityRegistry)
|
4859 | .registerApplication(compRef.location.nativeElement, testability);
|
4860 | }
|
4861 | this._loadComponent(compRef);
|
4862 | if (isDevMode()) {
|
4863 | this._console.log("Angular is running in the development mode. Call enableProdMode() to enable the production mode.");
|
4864 | }
|
4865 | return compRef;
|
4866 | };
|
4867 | |
4868 |
|
4869 |
|
4870 |
|
4871 | ApplicationRef_.prototype._loadComponent = function (componentRef) {
|
4872 | this.attachView(componentRef.hostView);
|
4873 | this.tick();
|
4874 | this._rootComponents.push(componentRef);
|
4875 |
|
4876 | var listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []).concat(this._bootstrapListeners);
|
4877 | listeners.forEach(function (listener) { return listener(componentRef); });
|
4878 | };
|
4879 | |
4880 |
|
4881 |
|
4882 |
|
4883 | ApplicationRef_.prototype._unloadComponent = function (componentRef) {
|
4884 | this.detachView(componentRef.hostView);
|
4885 | remove(this._rootComponents, componentRef);
|
4886 | };
|
4887 | |
4888 |
|
4889 |
|
4890 | ApplicationRef_.prototype.tick = function () {
|
4891 | if (this._runningTick) {
|
4892 | throw new Error('ApplicationRef.tick is called recursively');
|
4893 | }
|
4894 | var scope = ApplicationRef_._tickScope();
|
4895 | try {
|
4896 | this._runningTick = true;
|
4897 | this._views.forEach(function (view) { return view.detectChanges(); });
|
4898 | if (this._enforceNoNewChanges) {
|
4899 | this._views.forEach(function (view) { return view.checkNoChanges(); });
|
4900 | }
|
4901 | }
|
4902 | catch (e) {
|
4903 |
|
4904 | this._exceptionHandler.handleError(e);
|
4905 | }
|
4906 | finally {
|
4907 | this._runningTick = false;
|
4908 | wtfLeave(scope);
|
4909 | }
|
4910 | };
|
4911 | |
4912 |
|
4913 |
|
4914 | ApplicationRef_.prototype.ngOnDestroy = function () {
|
4915 |
|
4916 | this._views.slice().forEach(function (view) { return view.destroy(); });
|
4917 | };
|
4918 | Object.defineProperty(ApplicationRef_.prototype, "viewCount", {
|
4919 | |
4920 |
|
4921 |
|
4922 | get: function () { return this._views.length; },
|
4923 | enumerable: true,
|
4924 | configurable: true
|
4925 | });
|
4926 | Object.defineProperty(ApplicationRef_.prototype, "componentTypes", {
|
4927 | |
4928 |
|
4929 |
|
4930 | get: function () { return this._rootComponentTypes; },
|
4931 | enumerable: true,
|
4932 | configurable: true
|
4933 | });
|
4934 | Object.defineProperty(ApplicationRef_.prototype, "components", {
|
4935 | |
4936 |
|
4937 |
|
4938 | get: function () { return this._rootComponents; },
|
4939 | enumerable: true,
|
4940 | configurable: true
|
4941 | });
|
4942 | Object.defineProperty(ApplicationRef_.prototype, "isStable", {
|
4943 | |
4944 |
|
4945 |
|
4946 | get: function () { return this._isStable; },
|
4947 | enumerable: true,
|
4948 | configurable: true
|
4949 | });
|
4950 | return ApplicationRef_;
|
4951 | }(ApplicationRef));
|
4952 |
|
4953 |
|
4954 |
|
4955 | ApplicationRef_._tickScope = wtfCreateScope('ApplicationRef#tick()');
|
4956 | ApplicationRef_.decorators = [
|
4957 | { type: Injectable },
|
4958 | ];
|
4959 |
|
4960 |
|
4961 |
|
4962 | ApplicationRef_.ctorParameters = function () { return [
|
4963 | { type: NgZone, },
|
4964 | { type: Console, },
|
4965 | { type: Injector, },
|
4966 | { type: ErrorHandler, },
|
4967 | { type: ComponentFactoryResolver, },
|
4968 | { type: ApplicationInitStatus, },
|
4969 | ]; };
|
4970 |
|
4971 |
|
4972 |
|
4973 |
|
4974 |
|
4975 |
|
4976 | function remove(list, el) {
|
4977 | var index = list.indexOf(el);
|
4978 | if (index > -1) {
|
4979 | list.splice(index, 1);
|
4980 | }
|
4981 | }
|
4982 |
|
4983 |
|
4984 |
|
4985 |
|
4986 |
|
4987 |
|
4988 |
|
4989 |
|
4990 |
|
4991 |
|
4992 |
|
4993 |
|
4994 |
|
4995 |
|
4996 |
|
4997 |
|
4998 |
|
4999 |
|
5000 | var RenderComponentType = (function () {
|
5001 | |
5002 |
|
5003 |
|
5004 |
|
5005 |
|
5006 |
|
5007 |
|
5008 |
|
5009 | function RenderComponentType(id, templateUrl, slotCount, encapsulation, styles, animations) {
|
5010 | this.id = id;
|
5011 | this.templateUrl = templateUrl;
|
5012 | this.slotCount = slotCount;
|
5013 | this.encapsulation = encapsulation;
|
5014 | this.styles = styles;
|
5015 | this.animations = animations;
|
5016 | }
|
5017 | return RenderComponentType;
|
5018 | }());
|
5019 |
|
5020 |
|
5021 |
|
5022 |
|
5023 | var RenderDebugInfo = (function () {
|
5024 | function RenderDebugInfo() {
|
5025 | }
|
5026 | |
5027 |
|
5028 |
|
5029 |
|
5030 | RenderDebugInfo.prototype.injector = function () { };
|
5031 | |
5032 |
|
5033 |
|
5034 |
|
5035 | RenderDebugInfo.prototype.component = function () { };
|
5036 | |
5037 |
|
5038 |
|
5039 |
|
5040 | RenderDebugInfo.prototype.providerTokens = function () { };
|
5041 | |
5042 |
|
5043 |
|
5044 |
|
5045 | RenderDebugInfo.prototype.references = function () { };
|
5046 | |
5047 |
|
5048 |
|
5049 |
|
5050 | RenderDebugInfo.prototype.context = function () { };
|
5051 | |
5052 |
|
5053 |
|
5054 |
|
5055 | RenderDebugInfo.prototype.source = function () { };
|
5056 | return RenderDebugInfo;
|
5057 | }());
|
5058 |
|
5059 |
|
5060 |
|
5061 |
|
5062 | var Renderer = (function () {
|
5063 | function Renderer() {
|
5064 | }
|
5065 | |
5066 |
|
5067 |
|
5068 |
|
5069 |
|
5070 |
|
5071 | Renderer.prototype.selectRootElement = function (selectorOrNode, debugInfo) { };
|
5072 | |
5073 |
|
5074 |
|
5075 |
|
5076 |
|
5077 |
|
5078 |
|
5079 | Renderer.prototype.createElement = function (parentElement, name, debugInfo) { };
|
5080 | |
5081 |
|
5082 |
|
5083 |
|
5084 |
|
5085 | Renderer.prototype.createViewRoot = function (hostElement) { };
|
5086 | |
5087 |
|
5088 |
|
5089 |
|
5090 |
|
5091 |
|
5092 | Renderer.prototype.createTemplateAnchor = function (parentElement, debugInfo) { };
|
5093 | |
5094 |
|
5095 |
|
5096 |
|
5097 |
|
5098 |
|
5099 |
|
5100 | Renderer.prototype.createText = function (parentElement, value, debugInfo) { };
|
5101 | |
5102 |
|
5103 |
|
5104 |
|
5105 |
|
5106 |
|
5107 | Renderer.prototype.projectNodes = function (parentElement, nodes) { };
|
5108 | |
5109 |
|
5110 |
|
5111 |
|
5112 |
|
5113 |
|
5114 | Renderer.prototype.attachViewAfter = function (node, viewRootNodes) { };
|
5115 | |
5116 |
|
5117 |
|
5118 |
|
5119 |
|
5120 | Renderer.prototype.detachView = function (viewRootNodes) { };
|
5121 | |
5122 |
|
5123 |
|
5124 |
|
5125 |
|
5126 |
|
5127 | Renderer.prototype.destroyView = function (hostElement, viewAllNodes) { };
|
5128 | |
5129 |
|
5130 |
|
5131 |
|
5132 |
|
5133 |
|
5134 |
|
5135 | Renderer.prototype.listen = function (renderElement, name, callback) { };
|
5136 | |
5137 |
|
5138 |
|
5139 |
|
5140 |
|
5141 |
|
5142 |
|
5143 | Renderer.prototype.listenGlobal = function (target, name, callback) { };
|
5144 | |
5145 |
|
5146 |
|
5147 |
|
5148 |
|
5149 |
|
5150 |
|
5151 | Renderer.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) { };
|
5152 | |
5153 |
|
5154 |
|
5155 |
|
5156 |
|
5157 |
|
5158 |
|
5159 | Renderer.prototype.setElementAttribute = function (renderElement, attributeName, attributeValue) { };
|
5160 | |
5161 |
|
5162 |
|
5163 |
|
5164 |
|
5165 |
|
5166 |
|
5167 |
|
5168 | Renderer.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) { };
|
5169 | |
5170 |
|
5171 |
|
5172 |
|
5173 |
|
5174 |
|
5175 |
|
5176 | Renderer.prototype.setElementClass = function (renderElement, className, isAdd) { };
|
5177 | |
5178 |
|
5179 |
|
5180 |
|
5181 |
|
5182 |
|
5183 |
|
5184 | Renderer.prototype.setElementStyle = function (renderElement, styleName, styleValue) { };
|
5185 | |
5186 |
|
5187 |
|
5188 |
|
5189 |
|
5190 |
|
5191 |
|
5192 | Renderer.prototype.invokeElementMethod = function (renderElement, methodName, args) { };
|
5193 | |
5194 |
|
5195 |
|
5196 |
|
5197 |
|
5198 |
|
5199 | Renderer.prototype.setText = function (renderNode, text) { };
|
5200 | |
5201 |
|
5202 |
|
5203 |
|
5204 |
|
5205 |
|
5206 |
|
5207 |
|
5208 |
|
5209 |
|
5210 |
|
5211 | Renderer.prototype.animate = function (element, startingStyles, keyframes, duration, delay, easing, previousPlayers) { };
|
5212 | return Renderer;
|
5213 | }());
|
5214 | var Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
|
5215 |
|
5216 |
|
5217 |
|
5218 |
|
5219 |
|
5220 |
|
5221 |
|
5222 |
|
5223 |
|
5224 |
|
5225 |
|
5226 |
|
5227 |
|
5228 |
|
5229 |
|
5230 |
|
5231 | var RootRenderer = (function () {
|
5232 | function RootRenderer() {
|
5233 | }
|
5234 | |
5235 |
|
5236 |
|
5237 |
|
5238 |
|
5239 | RootRenderer.prototype.renderComponent = function (componentType) { };
|
5240 | return RootRenderer;
|
5241 | }());
|
5242 |
|
5243 |
|
5244 |
|
5245 |
|
5246 | var RendererFactory2 = (function () {
|
5247 | function RendererFactory2() {
|
5248 | }
|
5249 | |
5250 |
|
5251 |
|
5252 |
|
5253 |
|
5254 |
|
5255 | RendererFactory2.prototype.createRenderer = function (hostElement, type) { };
|
5256 | |
5257 |
|
5258 |
|
5259 |
|
5260 | RendererFactory2.prototype.begin = function () { };
|
5261 | |
5262 |
|
5263 |
|
5264 |
|
5265 | RendererFactory2.prototype.end = function () { };
|
5266 | |
5267 |
|
5268 |
|
5269 |
|
5270 | RendererFactory2.prototype.whenRenderingDone = function () { };
|
5271 | return RendererFactory2;
|
5272 | }());
|
5273 | var RendererStyleFlags2 = {};
|
5274 | RendererStyleFlags2.Important = 1;
|
5275 | RendererStyleFlags2.DashCase = 2;
|
5276 | RendererStyleFlags2[RendererStyleFlags2.Important] = "Important";
|
5277 | RendererStyleFlags2[RendererStyleFlags2.DashCase] = "DashCase";
|
5278 |
|
5279 |
|
5280 |
|
5281 |
|
5282 | var Renderer2 = (function () {
|
5283 | function Renderer2() {
|
5284 | }
|
5285 | |
5286 |
|
5287 |
|
5288 |
|
5289 |
|
5290 |
|
5291 | Renderer2.prototype.data = function () { };
|
5292 | |
5293 |
|
5294 |
|
5295 |
|
5296 | Renderer2.prototype.destroy = function () { };
|
5297 | |
5298 |
|
5299 |
|
5300 |
|
5301 |
|
5302 |
|
5303 | Renderer2.prototype.createElement = function (name, namespace) { };
|
5304 | |
5305 |
|
5306 |
|
5307 |
|
5308 |
|
5309 | Renderer2.prototype.createComment = function (value) { };
|
5310 | |
5311 |
|
5312 |
|
5313 |
|
5314 |
|
5315 | Renderer2.prototype.createText = function (value) { };
|
5316 | |
5317 |
|
5318 |
|
5319 |
|
5320 |
|
5321 |
|
5322 | Renderer2.prototype.appendChild = function (parent, newChild) { };
|
5323 | |
5324 |
|
5325 |
|
5326 |
|
5327 |
|
5328 |
|
5329 |
|
5330 | Renderer2.prototype.insertBefore = function (parent, newChild, refChild) { };
|
5331 | |
5332 |
|
5333 |
|
5334 |
|
5335 |
|
5336 |
|
5337 | Renderer2.prototype.removeChild = function (parent, oldChild) { };
|
5338 | |
5339 |
|
5340 |
|
5341 |
|
5342 |
|
5343 | Renderer2.prototype.selectRootElement = function (selectorOrNode) { };
|
5344 | |
5345 |
|
5346 |
|
5347 |
|
5348 |
|
5349 |
|
5350 |
|
5351 |
|
5352 | Renderer2.prototype.parentNode = function (node) { };
|
5353 | |
5354 |
|
5355 |
|
5356 |
|
5357 |
|
5358 |
|
5359 |
|
5360 |
|
5361 | Renderer2.prototype.nextSibling = function (node) { };
|
5362 | |
5363 |
|
5364 |
|
5365 |
|
5366 |
|
5367 |
|
5368 |
|
5369 |
|
5370 | Renderer2.prototype.setAttribute = function (el, name, value, namespace) { };
|
5371 | |
5372 |
|
5373 |
|
5374 |
|
5375 |
|
5376 |
|
5377 |
|
5378 | Renderer2.prototype.removeAttribute = function (el, name, namespace) { };
|
5379 | |
5380 |
|
5381 |
|
5382 |
|
5383 |
|
5384 |
|
5385 | Renderer2.prototype.addClass = function (el, name) { };
|
5386 | |
5387 |
|
5388 |
|
5389 |
|
5390 |
|
5391 |
|
5392 | Renderer2.prototype.removeClass = function (el, name) { };
|
5393 | |
5394 |
|
5395 |
|
5396 |
|
5397 |
|
5398 |
|
5399 |
|
5400 |
|
5401 | Renderer2.prototype.setStyle = function (el, style, value, flags) { };
|
5402 | |
5403 |
|
5404 |
|
5405 |
|
5406 |
|
5407 |
|
5408 |
|
5409 | Renderer2.prototype.removeStyle = function (el, style, flags) { };
|
5410 | |
5411 |
|
5412 |
|
5413 |
|
5414 |
|
5415 |
|
5416 |
|
5417 | Renderer2.prototype.setProperty = function (el, name, value) { };
|
5418 | |
5419 |
|
5420 |
|
5421 |
|
5422 |
|
5423 |
|
5424 | Renderer2.prototype.setValue = function (node, value) { };
|
5425 | |
5426 |
|
5427 |
|
5428 |
|
5429 |
|
5430 |
|
5431 |
|
5432 | Renderer2.prototype.listen = function (target, eventName, callback) { };
|
5433 | return Renderer2;
|
5434 | }());
|
5435 |
|
5436 |
|
5437 |
|
5438 |
|
5439 |
|
5440 |
|
5441 |
|
5442 |
|
5443 | var ElementRef = (function () {
|
5444 | |
5445 |
|
5446 |
|
5447 | function ElementRef(nativeElement) {
|
5448 | this.nativeElement = nativeElement;
|
5449 | }
|
5450 | return ElementRef;
|
5451 | }());
|
5452 |
|
5453 |
|
5454 |
|
5455 |
|
5456 |
|
5457 |
|
5458 |
|
5459 |
|
5460 |
|
5461 |
|
5462 |
|
5463 |
|
5464 | var NgModuleFactoryLoader = (function () {
|
5465 | function NgModuleFactoryLoader() {
|
5466 | }
|
5467 | |
5468 |
|
5469 |
|
5470 |
|
5471 |
|
5472 | NgModuleFactoryLoader.prototype.load = function (path) { };
|
5473 | return NgModuleFactoryLoader;
|
5474 | }());
|
5475 | var moduleFactories = new Map();
|
5476 |
|
5477 |
|
5478 |
|
5479 |
|
5480 |
|
5481 |
|
5482 |
|
5483 | function registerModuleFactory(id, factory) {
|
5484 | var existing = moduleFactories.get(id);
|
5485 | if (existing) {
|
5486 | throw new Error("Duplicate module registered for " + id + " - " + existing.moduleType.name + " vs " + factory.moduleType.name);
|
5487 | }
|
5488 | moduleFactories.set(id, factory);
|
5489 | }
|
5490 |
|
5491 |
|
5492 |
|
5493 |
|
5494 |
|
5495 |
|
5496 |
|
5497 |
|
5498 |
|
5499 |
|
5500 |
|
5501 | function getModuleFactory(id) {
|
5502 | var factory = moduleFactories.get(id);
|
5503 | if (!factory)
|
5504 | throw new Error("No module with ID " + id + " loaded");
|
5505 | return factory;
|
5506 | }
|
5507 |
|
5508 |
|
5509 |
|
5510 |
|
5511 |
|
5512 |
|
5513 |
|
5514 |
|
5515 |
|
5516 |
|
5517 |
|
5518 |
|
5519 |
|
5520 |
|
5521 |
|
5522 |
|
5523 |
|
5524 |
|
5525 |
|
5526 |
|
5527 |
|
5528 |
|
5529 |
|
5530 |
|
5531 |
|
5532 |
|
5533 |
|
5534 |
|
5535 |
|
5536 |
|
5537 |
|
5538 | var QueryList = (function () {
|
5539 | function QueryList() {
|
5540 | this._dirty = true;
|
5541 | this._results = [];
|
5542 | this._emitter = new EventEmitter();
|
5543 | }
|
5544 | Object.defineProperty(QueryList.prototype, "changes", {
|
5545 | |
5546 |
|
5547 |
|
5548 | get: function () { return this._emitter; },
|
5549 | enumerable: true,
|
5550 | configurable: true
|
5551 | });
|
5552 | Object.defineProperty(QueryList.prototype, "length", {
|
5553 | |
5554 |
|
5555 |
|
5556 | get: function () { return this._results.length; },
|
5557 | enumerable: true,
|
5558 | configurable: true
|
5559 | });
|
5560 | Object.defineProperty(QueryList.prototype, "first", {
|
5561 | |
5562 |
|
5563 |
|
5564 | get: function () { return this._results[0]; },
|
5565 | enumerable: true,
|
5566 | configurable: true
|
5567 | });
|
5568 | Object.defineProperty(QueryList.prototype, "last", {
|
5569 | |
5570 |
|
5571 |
|
5572 | get: function () { return this._results[this.length - 1]; },
|
5573 | enumerable: true,
|
5574 | configurable: true
|
5575 | });
|
5576 | |
5577 |
|
5578 |
|
5579 |
|
5580 |
|
5581 |
|
5582 |
|
5583 | QueryList.prototype.map = function (fn) { return this._results.map(fn); };
|
5584 | |
5585 |
|
5586 |
|
5587 |
|
5588 |
|
5589 |
|
5590 | QueryList.prototype.filter = function (fn) {
|
5591 | return this._results.filter(fn);
|
5592 | };
|
5593 | |
5594 |
|
5595 |
|
5596 |
|
5597 |
|
5598 |
|
5599 | QueryList.prototype.find = function (fn) {
|
5600 | return this._results.find(fn);
|
5601 | };
|
5602 | |
5603 |
|
5604 |
|
5605 |
|
5606 |
|
5607 |
|
5608 |
|
5609 |
|
5610 | QueryList.prototype.reduce = function (fn, init) {
|
5611 | return this._results.reduce(fn, init);
|
5612 | };
|
5613 | |
5614 |
|
5615 |
|
5616 |
|
5617 |
|
5618 |
|
5619 | QueryList.prototype.forEach = function (fn) { this._results.forEach(fn); };
|
5620 | |
5621 |
|
5622 |
|
5623 |
|
5624 |
|
5625 |
|
5626 | QueryList.prototype.some = function (fn) {
|
5627 | return this._results.some(fn);
|
5628 | };
|
5629 | |
5630 |
|
5631 |
|
5632 | QueryList.prototype.toArray = function () { return this._results.slice(); };
|
5633 | |
5634 |
|
5635 |
|
5636 | QueryList.prototype[getSymbolIterator()] = function () { return ((this._results))[getSymbolIterator()](); };
|
5637 | |
5638 |
|
5639 |
|
5640 | QueryList.prototype.toString = function () { return this._results.toString(); };
|
5641 | |
5642 |
|
5643 |
|
5644 |
|
5645 | QueryList.prototype.reset = function (res) {
|
5646 | this._results = flatten(res);
|
5647 | this._dirty = false;
|
5648 | };
|
5649 | |
5650 |
|
5651 |
|
5652 | QueryList.prototype.notifyOnChanges = function () { this._emitter.emit(this); };
|
5653 | |
5654 |
|
5655 |
|
5656 |
|
5657 | QueryList.prototype.setDirty = function () { this._dirty = true; };
|
5658 | Object.defineProperty(QueryList.prototype, "dirty", {
|
5659 | |
5660 |
|
5661 |
|
5662 |
|
5663 | get: function () { return this._dirty; },
|
5664 | enumerable: true,
|
5665 | configurable: true
|
5666 | });
|
5667 | return QueryList;
|
5668 | }());
|
5669 |
|
5670 |
|
5671 |
|
5672 |
|
5673 |
|
5674 | function flatten(list) {
|
5675 | return list.reduce(function (flat, item) {
|
5676 | var flatItem = Array.isArray(item) ? flatten(item) : item;
|
5677 | return ((flat)).concat(flatItem);
|
5678 | }, []);
|
5679 | }
|
5680 |
|
5681 |
|
5682 |
|
5683 |
|
5684 |
|
5685 |
|
5686 |
|
5687 | var _SEPARATOR = '#';
|
5688 | var FACTORY_CLASS_SUFFIX = 'NgFactory';
|
5689 |
|
5690 |
|
5691 |
|
5692 |
|
5693 |
|
5694 |
|
5695 |
|
5696 | var SystemJsNgModuleLoaderConfig = (function () {
|
5697 | function SystemJsNgModuleLoaderConfig() {
|
5698 | }
|
5699 | return SystemJsNgModuleLoaderConfig;
|
5700 | }());
|
5701 | var DEFAULT_CONFIG = {
|
5702 | factoryPathPrefix: '',
|
5703 | factoryPathSuffix: '.ngfactory',
|
5704 | };
|
5705 |
|
5706 |
|
5707 |
|
5708 |
|
5709 | var SystemJsNgModuleLoader = (function () {
|
5710 | |
5711 |
|
5712 |
|
5713 |
|
5714 | function SystemJsNgModuleLoader(_compiler, config) {
|
5715 | this._compiler = _compiler;
|
5716 | this._config = config || DEFAULT_CONFIG;
|
5717 | }
|
5718 | |
5719 |
|
5720 |
|
5721 |
|
5722 | SystemJsNgModuleLoader.prototype.load = function (path) {
|
5723 | var offlineMode = this._compiler instanceof Compiler;
|
5724 | return offlineMode ? this.loadFactory(path) : this.loadAndCompile(path);
|
5725 | };
|
5726 | |
5727 |
|
5728 |
|
5729 |
|
5730 | SystemJsNgModuleLoader.prototype.loadAndCompile = function (path) {
|
5731 | var _this = this;
|
5732 | var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1];
|
5733 | if (exportName === undefined) {
|
5734 | exportName = 'default';
|
5735 | }
|
5736 | return System.import(module)
|
5737 | .then(function (module) { return module[exportName]; })
|
5738 | .then(function (type) { return checkNotEmpty(type, module, exportName); })
|
5739 | .then(function (type) { return _this._compiler.compileModuleAsync(type); });
|
5740 | };
|
5741 | |
5742 |
|
5743 |
|
5744 |
|
5745 | SystemJsNgModuleLoader.prototype.loadFactory = function (path) {
|
5746 | var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1];
|
5747 | var factoryClassSuffix = FACTORY_CLASS_SUFFIX;
|
5748 | if (exportName === undefined) {
|
5749 | exportName = 'default';
|
5750 | factoryClassSuffix = '';
|
5751 | }
|
5752 | return System.import(this._config.factoryPathPrefix + module + this._config.factoryPathSuffix)
|
5753 | .then(function (module) { return module[exportName + factoryClassSuffix]; })
|
5754 | .then(function (factory) { return checkNotEmpty(factory, module, exportName); });
|
5755 | };
|
5756 | return SystemJsNgModuleLoader;
|
5757 | }());
|
5758 | SystemJsNgModuleLoader.decorators = [
|
5759 | { type: Injectable },
|
5760 | ];
|
5761 |
|
5762 |
|
5763 |
|
5764 | SystemJsNgModuleLoader.ctorParameters = function () { return [
|
5765 | { type: Compiler, },
|
5766 | { type: SystemJsNgModuleLoaderConfig, decorators: [{ type: Optional },] },
|
5767 | ]; };
|
5768 |
|
5769 |
|
5770 |
|
5771 |
|
5772 |
|
5773 |
|
5774 | function checkNotEmpty(value, modulePath, exportName) {
|
5775 | if (!value) {
|
5776 | throw new Error("Cannot find '" + exportName + "' in '" + modulePath + "'");
|
5777 | }
|
5778 | return value;
|
5779 | }
|
5780 |
|
5781 |
|
5782 |
|
5783 |
|
5784 |
|
5785 |
|
5786 |
|
5787 |
|
5788 |
|
5789 |
|
5790 |
|
5791 |
|
5792 |
|
5793 |
|
5794 |
|
5795 |
|
5796 |
|
5797 |
|
5798 |
|
5799 |
|
5800 |
|
5801 | var TemplateRef = (function () {
|
5802 | function TemplateRef() {
|
5803 | }
|
5804 | |
5805 |
|
5806 |
|
5807 |
|
5808 | TemplateRef.prototype.elementRef = function () { };
|
5809 | |
5810 |
|
5811 |
|
5812 |
|
5813 |
|
5814 | TemplateRef.prototype.createEmbeddedView = function (context) { };
|
5815 | return TemplateRef;
|
5816 | }());
|
5817 |
|
5818 |
|
5819 |
|
5820 |
|
5821 |
|
5822 |
|
5823 |
|
5824 |
|
5825 |
|
5826 |
|
5827 |
|
5828 |
|
5829 |
|
5830 |
|
5831 |
|
5832 |
|
5833 |
|
5834 |
|
5835 |
|
5836 |
|
5837 |
|
5838 |
|
5839 |
|
5840 |
|
5841 |
|
5842 |
|
5843 | var ViewContainerRef = (function () {
|
5844 | function ViewContainerRef() {
|
5845 | }
|
5846 | |
5847 |
|
5848 |
|
5849 |
|
5850 |
|
5851 |
|
5852 | ViewContainerRef.prototype.element = function () { };
|
5853 | |
5854 |
|
5855 |
|
5856 |
|
5857 | ViewContainerRef.prototype.injector = function () { };
|
5858 | |
5859 |
|
5860 |
|
5861 |
|
5862 | ViewContainerRef.prototype.parentInjector = function () { };
|
5863 | |
5864 |
|
5865 |
|
5866 |
|
5867 |
|
5868 | ViewContainerRef.prototype.clear = function () { };
|
5869 | |
5870 |
|
5871 |
|
5872 |
|
5873 |
|
5874 |
|
5875 | ViewContainerRef.prototype.get = function (index) { };
|
5876 | |
5877 |
|
5878 |
|
5879 |
|
5880 |
|
5881 | ViewContainerRef.prototype.length = function () { };
|
5882 | |
5883 |
|
5884 |
|
5885 |
|
5886 |
|
5887 |
|
5888 |
|
5889 |
|
5890 |
|
5891 |
|
5892 |
|
5893 |
|
5894 |
|
5895 |
|
5896 | ViewContainerRef.prototype.createEmbeddedView = function (templateRef, context, index) { };
|
5897 | |
5898 |
|
5899 |
|
5900 |
|
5901 |
|
5902 |
|
5903 |
|
5904 |
|
5905 |
|
5906 |
|
5907 |
|
5908 |
|
5909 |
|
5910 |
|
5911 |
|
5912 |
|
5913 |
|
5914 |
|
5915 |
|
5916 |
|
5917 |
|
5918 | ViewContainerRef.prototype.createComponent = function (componentFactory, index, injector, projectableNodes, ngModule) { };
|
5919 | |
5920 |
|
5921 |
|
5922 |
|
5923 |
|
5924 |
|
5925 |
|
5926 |
|
5927 |
|
5928 |
|
5929 |
|
5930 | ViewContainerRef.prototype.insert = function (viewRef, index) { };
|
5931 | |
5932 |
|
5933 |
|
5934 |
|
5935 |
|
5936 |
|
5937 |
|
5938 |
|
5939 |
|
5940 | ViewContainerRef.prototype.move = function (viewRef, currentIndex) { };
|
5941 | |
5942 |
|
5943 |
|
5944 |
|
5945 |
|
5946 |
|
5947 |
|
5948 | ViewContainerRef.prototype.indexOf = function (viewRef) { };
|
5949 | |
5950 |
|
5951 |
|
5952 |
|
5953 |
|
5954 |
|
5955 |
|
5956 |
|
5957 | ViewContainerRef.prototype.remove = function (index) { };
|
5958 | |
5959 |
|
5960 |
|
5961 |
|
5962 |
|
5963 |
|
5964 |
|
5965 |
|
5966 | ViewContainerRef.prototype.detach = function (index) { };
|
5967 | return ViewContainerRef;
|
5968 | }());
|
5969 |
|
5970 |
|
5971 |
|
5972 |
|
5973 | var ChangeDetectorRef = (function () {
|
5974 | function ChangeDetectorRef() {
|
5975 | }
|
5976 | |
5977 |
|
5978 |
|
5979 |
|
5980 |
|
5981 |
|
5982 |
|
5983 |
|
5984 |
|
5985 |
|
5986 |
|
5987 |
|
5988 |
|
5989 |
|
5990 |
|
5991 |
|
5992 |
|
5993 |
|
5994 |
|
5995 |
|
5996 |
|
5997 |
|
5998 |
|
5999 |
|
6000 |
|
6001 |
|
6002 |
|
6003 |
|
6004 |
|
6005 |
|
6006 |
|
6007 |
|
6008 |
|
6009 |
|
6010 |
|
6011 |
|
6012 |
|
6013 |
|
6014 | ChangeDetectorRef.prototype.markForCheck = function () { };
|
6015 | |
6016 |
|
6017 |
|
6018 |
|
6019 |
|
6020 |
|
6021 |
|
6022 |
|
6023 |
|
6024 |
|
6025 |
|
6026 |
|
6027 |
|
6028 |
|
6029 |
|
6030 |
|
6031 |
|
6032 |
|
6033 |
|
6034 |
|
6035 |
|
6036 |
|
6037 |
|
6038 |
|
6039 |
|
6040 |
|
6041 |
|
6042 |
|
6043 |
|
6044 |
|
6045 |
|
6046 |
|
6047 |
|
6048 |
|
6049 |
|
6050 |
|
6051 |
|
6052 |
|
6053 |
|
6054 |
|
6055 |
|
6056 |
|
6057 |
|
6058 |
|
6059 |
|
6060 |
|
6061 |
|
6062 |
|
6063 |
|
6064 |
|
6065 |
|
6066 |
|
6067 |
|
6068 |
|
6069 |
|
6070 | ChangeDetectorRef.prototype.detach = function () { };
|
6071 | |
6072 |
|
6073 |
|
6074 |
|
6075 |
|
6076 |
|
6077 |
|
6078 |
|
6079 |
|
6080 |
|
6081 |
|
6082 |
|
6083 |
|
6084 |
|
6085 |
|
6086 |
|
6087 |
|
6088 |
|
6089 |
|
6090 |
|
6091 |
|
6092 |
|
6093 |
|
6094 |
|
6095 | ChangeDetectorRef.prototype.detectChanges = function () { };
|
6096 | |
6097 |
|
6098 |
|
6099 |
|
6100 |
|
6101 |
|
6102 |
|
6103 |
|
6104 | ChangeDetectorRef.prototype.checkNoChanges = function () { };
|
6105 | |
6106 |
|
6107 |
|
6108 |
|
6109 |
|
6110 |
|
6111 |
|
6112 |
|
6113 |
|
6114 |
|
6115 |
|
6116 |
|
6117 |
|
6118 |
|
6119 |
|
6120 |
|
6121 |
|
6122 |
|
6123 |
|
6124 |
|
6125 |
|
6126 |
|
6127 |
|
6128 |
|
6129 |
|
6130 |
|
6131 |
|
6132 |
|
6133 |
|
6134 |
|
6135 |
|
6136 |
|
6137 |
|
6138 |
|
6139 |
|
6140 |
|
6141 |
|
6142 |
|
6143 |
|
6144 |
|
6145 |
|
6146 |
|
6147 |
|
6148 |
|
6149 |
|
6150 |
|
6151 |
|
6152 |
|
6153 |
|
6154 |
|
6155 |
|
6156 |
|
6157 |
|
6158 |
|
6159 |
|
6160 |
|
6161 | ChangeDetectorRef.prototype.reattach = function () { };
|
6162 | return ChangeDetectorRef;
|
6163 | }());
|
6164 |
|
6165 |
|
6166 |
|
6167 |
|
6168 |
|
6169 |
|
6170 |
|
6171 |
|
6172 |
|
6173 |
|
6174 |
|
6175 | var ViewRef = (function (_super) {
|
6176 | __extends(ViewRef, _super);
|
6177 | function ViewRef() {
|
6178 | return _super !== null && _super.apply(this, arguments) || this;
|
6179 | }
|
6180 | |
6181 |
|
6182 |
|
6183 |
|
6184 |
|
6185 | ViewRef.prototype.destroy = function () { };
|
6186 | |
6187 |
|
6188 |
|
6189 |
|
6190 | ViewRef.prototype.destroyed = function () { };
|
6191 | |
6192 |
|
6193 |
|
6194 |
|
6195 |
|
6196 | ViewRef.prototype.onDestroy = function (callback) { };
|
6197 | return ViewRef;
|
6198 | }(ChangeDetectorRef));
|
6199 |
|
6200 |
|
6201 |
|
6202 |
|
6203 |
|
6204 |
|
6205 |
|
6206 |
|
6207 |
|
6208 |
|
6209 |
|
6210 |
|
6211 |
|
6212 |
|
6213 |
|
6214 |
|
6215 |
|
6216 |
|
6217 |
|
6218 |
|
6219 |
|
6220 |
|
6221 |
|
6222 |
|
6223 |
|
6224 |
|
6225 |
|
6226 |
|
6227 |
|
6228 |
|
6229 |
|
6230 |
|
6231 |
|
6232 |
|
6233 |
|
6234 |
|
6235 |
|
6236 |
|
6237 |
|
6238 |
|
6239 |
|
6240 |
|
6241 |
|
6242 |
|
6243 |
|
6244 |
|
6245 |
|
6246 |
|
6247 |
|
6248 |
|
6249 |
|
6250 |
|
6251 |
|
6252 |
|
6253 |
|
6254 | var EmbeddedViewRef = (function (_super) {
|
6255 | __extends(EmbeddedViewRef, _super);
|
6256 | function EmbeddedViewRef() {
|
6257 | return _super !== null && _super.apply(this, arguments) || this;
|
6258 | }
|
6259 | |
6260 |
|
6261 |
|
6262 |
|
6263 | EmbeddedViewRef.prototype.context = function () { };
|
6264 | |
6265 |
|
6266 |
|
6267 |
|
6268 | EmbeddedViewRef.prototype.rootNodes = function () { };
|
6269 | return EmbeddedViewRef;
|
6270 | }(ViewRef));
|
6271 |
|
6272 |
|
6273 |
|
6274 |
|
6275 |
|
6276 |
|
6277 |
|
6278 |
|
6279 |
|
6280 |
|
6281 |
|
6282 |
|
6283 |
|
6284 |
|
6285 |
|
6286 | var EventListener = (function () {
|
6287 | |
6288 |
|
6289 |
|
6290 |
|
6291 | function EventListener(name, callback) {
|
6292 | this.name = name;
|
6293 | this.callback = callback;
|
6294 | }
|
6295 |
|
6296 | return EventListener;
|
6297 | }());
|
6298 |
|
6299 |
|
6300 |
|
6301 | var DebugNode = (function () {
|
6302 | |
6303 |
|
6304 |
|
6305 |
|
6306 |
|
6307 | function DebugNode(nativeNode, parent, _debugContext) {
|
6308 | this._debugContext = _debugContext;
|
6309 | this.nativeNode = nativeNode;
|
6310 | if (parent && parent instanceof DebugElement) {
|
6311 | parent.addChild(this);
|
6312 | }
|
6313 | else {
|
6314 | this.parent = null;
|
6315 | }
|
6316 | this.listeners = [];
|
6317 | }
|
6318 | Object.defineProperty(DebugNode.prototype, "injector", {
|
6319 | |
6320 |
|
6321 |
|
6322 | get: function () { return this._debugContext.injector; },
|
6323 | enumerable: true,
|
6324 | configurable: true
|
6325 | });
|
6326 | Object.defineProperty(DebugNode.prototype, "componentInstance", {
|
6327 | |
6328 |
|
6329 |
|
6330 | get: function () { return this._debugContext.component; },
|
6331 | enumerable: true,
|
6332 | configurable: true
|
6333 | });
|
6334 | Object.defineProperty(DebugNode.prototype, "context", {
|
6335 | |
6336 |
|
6337 |
|
6338 | get: function () { return this._debugContext.context; },
|
6339 | enumerable: true,
|
6340 | configurable: true
|
6341 | });
|
6342 | Object.defineProperty(DebugNode.prototype, "references", {
|
6343 | |
6344 |
|
6345 |
|
6346 | get: function () { return this._debugContext.references; },
|
6347 | enumerable: true,
|
6348 | configurable: true
|
6349 | });
|
6350 | Object.defineProperty(DebugNode.prototype, "providerTokens", {
|
6351 | |
6352 |
|
6353 |
|
6354 | get: function () { return this._debugContext.providerTokens; },
|
6355 | enumerable: true,
|
6356 | configurable: true
|
6357 | });
|
6358 | Object.defineProperty(DebugNode.prototype, "source", {
|
6359 | |
6360 |
|
6361 |
|
6362 |
|
6363 | get: function () { return 'Deprecated since v4'; },
|
6364 | enumerable: true,
|
6365 | configurable: true
|
6366 | });
|
6367 | return DebugNode;
|
6368 | }());
|
6369 |
|
6370 |
|
6371 |
|
6372 | var DebugElement = (function (_super) {
|
6373 | __extends(DebugElement, _super);
|
6374 | |
6375 |
|
6376 |
|
6377 |
|
6378 |
|
6379 | function DebugElement(nativeNode, parent, _debugContext) {
|
6380 | var _this = _super.call(this, nativeNode, parent, _debugContext) || this;
|
6381 | _this.properties = {};
|
6382 | _this.attributes = {};
|
6383 | _this.classes = {};
|
6384 | _this.styles = {};
|
6385 | _this.childNodes = [];
|
6386 | _this.nativeElement = nativeNode;
|
6387 | return _this;
|
6388 | }
|
6389 | |
6390 |
|
6391 |
|
6392 |
|
6393 | DebugElement.prototype.addChild = function (child) {
|
6394 | if (child) {
|
6395 | this.childNodes.push(child);
|
6396 | child.parent = this;
|
6397 | }
|
6398 | };
|
6399 | |
6400 |
|
6401 |
|
6402 |
|
6403 | DebugElement.prototype.removeChild = function (child) {
|
6404 | var childIndex = this.childNodes.indexOf(child);
|
6405 | if (childIndex !== -1) {
|
6406 | child.parent = null;
|
6407 | this.childNodes.splice(childIndex, 1);
|
6408 | }
|
6409 | };
|
6410 | |
6411 |
|
6412 |
|
6413 |
|
6414 |
|
6415 | DebugElement.prototype.insertChildrenAfter = function (child, newChildren) {
|
6416 | var _this = this;
|
6417 | var siblingIndex = this.childNodes.indexOf(child);
|
6418 | if (siblingIndex !== -1) {
|
6419 | (_a = this.childNodes).splice.apply(_a, [siblingIndex + 1, 0].concat(newChildren));
|
6420 | newChildren.forEach(function (c) {
|
6421 | if (c.parent) {
|
6422 | c.parent.removeChild(c);
|
6423 | }
|
6424 | c.parent = _this;
|
6425 | });
|
6426 | }
|
6427 | var _a;
|
6428 | };
|
6429 | |
6430 |
|
6431 |
|
6432 |
|
6433 |
|
6434 | DebugElement.prototype.insertBefore = function (refChild, newChild) {
|
6435 | var refIndex = this.childNodes.indexOf(refChild);
|
6436 | if (refIndex === -1) {
|
6437 | this.addChild(newChild);
|
6438 | }
|
6439 | else {
|
6440 | if (newChild.parent) {
|
6441 | newChild.parent.removeChild(newChild);
|
6442 | }
|
6443 | newChild.parent = this;
|
6444 | this.childNodes.splice(refIndex, 0, newChild);
|
6445 | }
|
6446 | };
|
6447 | |
6448 |
|
6449 |
|
6450 |
|
6451 | DebugElement.prototype.query = function (predicate) {
|
6452 | var results = this.queryAll(predicate);
|
6453 | return results[0] || null;
|
6454 | };
|
6455 | |
6456 |
|
6457 |
|
6458 |
|
6459 | DebugElement.prototype.queryAll = function (predicate) {
|
6460 | var matches = [];
|
6461 | _queryElementChildren(this, predicate, matches);
|
6462 | return matches;
|
6463 | };
|
6464 | |
6465 |
|
6466 |
|
6467 |
|
6468 | DebugElement.prototype.queryAllNodes = function (predicate) {
|
6469 | var matches = [];
|
6470 | _queryNodeChildren(this, predicate, matches);
|
6471 | return matches;
|
6472 | };
|
6473 | Object.defineProperty(DebugElement.prototype, "children", {
|
6474 | |
6475 |
|
6476 |
|
6477 | get: function () {
|
6478 | return (this.childNodes.filter(function (node) { return node instanceof DebugElement; }));
|
6479 | },
|
6480 | enumerable: true,
|
6481 | configurable: true
|
6482 | });
|
6483 | |
6484 |
|
6485 |
|
6486 |
|
6487 |
|
6488 | DebugElement.prototype.triggerEventHandler = function (eventName, eventObj) {
|
6489 | this.listeners.forEach(function (listener) {
|
6490 | if (listener.name == eventName) {
|
6491 | listener.callback(eventObj);
|
6492 | }
|
6493 | });
|
6494 | };
|
6495 | return DebugElement;
|
6496 | }(DebugNode));
|
6497 |
|
6498 |
|
6499 |
|
6500 |
|
6501 |
|
6502 | function asNativeElements(debugEls) {
|
6503 | return debugEls.map(function (el) { return el.nativeElement; });
|
6504 | }
|
6505 |
|
6506 |
|
6507 |
|
6508 |
|
6509 |
|
6510 |
|
6511 | function _queryElementChildren(element, predicate, matches) {
|
6512 | element.childNodes.forEach(function (node) {
|
6513 | if (node instanceof DebugElement) {
|
6514 | if (predicate(node)) {
|
6515 | matches.push(node);
|
6516 | }
|
6517 | _queryElementChildren(node, predicate, matches);
|
6518 | }
|
6519 | });
|
6520 | }
|
6521 |
|
6522 |
|
6523 |
|
6524 |
|
6525 |
|
6526 |
|
6527 | function _queryNodeChildren(parentNode, predicate, matches) {
|
6528 | if (parentNode instanceof DebugElement) {
|
6529 | parentNode.childNodes.forEach(function (node) {
|
6530 | if (predicate(node)) {
|
6531 | matches.push(node);
|
6532 | }
|
6533 | if (node instanceof DebugElement) {
|
6534 | _queryNodeChildren(node, predicate, matches);
|
6535 | }
|
6536 | });
|
6537 | }
|
6538 | }
|
6539 |
|
6540 | var _nativeNodeToDebugNode = new Map();
|
6541 |
|
6542 |
|
6543 |
|
6544 |
|
6545 |
|
6546 | function getDebugNode(nativeNode) {
|
6547 | return _nativeNodeToDebugNode.get(nativeNode) || null;
|
6548 | }
|
6549 |
|
6550 |
|
6551 |
|
6552 |
|
6553 |
|
6554 |
|
6555 |
|
6556 | function indexDebugNode(node) {
|
6557 | _nativeNodeToDebugNode.set(node.nativeNode, node);
|
6558 | }
|
6559 |
|
6560 |
|
6561 |
|
6562 |
|
6563 | function removeDebugNodeFromIndex(node) {
|
6564 | _nativeNodeToDebugNode.delete(node.nativeNode);
|
6565 | }
|
6566 |
|
6567 |
|
6568 |
|
6569 |
|
6570 |
|
6571 |
|
6572 |
|
6573 |
|
6574 |
|
6575 |
|
6576 |
|
6577 |
|
6578 | function devModeEqual(a, b) {
|
6579 | var isListLikeIterableA = isListLikeIterable(a);
|
6580 | var isListLikeIterableB = isListLikeIterable(b);
|
6581 | if (isListLikeIterableA && isListLikeIterableB) {
|
6582 | return areIterablesEqual(a, b, devModeEqual);
|
6583 | }
|
6584 | else {
|
6585 | var isAObject = a && (typeof a === 'object' || typeof a === 'function');
|
6586 | var isBObject = b && (typeof b === 'object' || typeof b === 'function');
|
6587 | if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
|
6588 | return true;
|
6589 | }
|
6590 | else {
|
6591 | return looseIdentical(a, b);
|
6592 | }
|
6593 | }
|
6594 | }
|
6595 |
|
6596 |
|
6597 |
|
6598 |
|
6599 |
|
6600 |
|
6601 |
|
6602 |
|
6603 |
|
6604 |
|
6605 |
|
6606 |
|
6607 |
|
6608 |
|
6609 |
|
6610 |
|
6611 |
|
6612 |
|
6613 |
|
6614 | var WrappedValue = (function () {
|
6615 | |
6616 |
|
6617 |
|
6618 | function WrappedValue(wrapped) {
|
6619 | this.wrapped = wrapped;
|
6620 | }
|
6621 | |
6622 |
|
6623 |
|
6624 |
|
6625 | WrappedValue.wrap = function (value) { return new WrappedValue(value); };
|
6626 | return WrappedValue;
|
6627 | }());
|
6628 |
|
6629 |
|
6630 |
|
6631 | var ValueUnwrapper = (function () {
|
6632 | function ValueUnwrapper() {
|
6633 | this.hasWrappedValue = false;
|
6634 | }
|
6635 | |
6636 |
|
6637 |
|
6638 |
|
6639 | ValueUnwrapper.prototype.unwrap = function (value) {
|
6640 | if (value instanceof WrappedValue) {
|
6641 | this.hasWrappedValue = true;
|
6642 | return value.wrapped;
|
6643 | }
|
6644 | return value;
|
6645 | };
|
6646 | |
6647 |
|
6648 |
|
6649 | ValueUnwrapper.prototype.reset = function () { this.hasWrappedValue = false; };
|
6650 | return ValueUnwrapper;
|
6651 | }());
|
6652 |
|
6653 |
|
6654 |
|
6655 |
|
6656 | var SimpleChange = (function () {
|
6657 | |
6658 |
|
6659 |
|
6660 |
|
6661 |
|
6662 | function SimpleChange(previousValue, currentValue, firstChange) {
|
6663 | this.previousValue = previousValue;
|
6664 | this.currentValue = currentValue;
|
6665 | this.firstChange = firstChange;
|
6666 | }
|
6667 | |
6668 |
|
6669 |
|
6670 |
|
6671 | SimpleChange.prototype.isFirstChange = function () { return this.firstChange; };
|
6672 | return SimpleChange;
|
6673 | }());
|
6674 |
|
6675 |
|
6676 |
|
6677 |
|
6678 | function isListLikeIterable(obj) {
|
6679 | if (!isJsObject(obj))
|
6680 | return false;
|
6681 | return Array.isArray(obj) ||
|
6682 | (!(obj instanceof Map) &&
|
6683 | getSymbolIterator() in obj);
|
6684 | }
|
6685 |
|
6686 |
|
6687 |
|
6688 |
|
6689 |
|
6690 |
|
6691 | function areIterablesEqual(a, b, comparator) {
|
6692 | var iterator1 = a[getSymbolIterator()]();
|
6693 | var iterator2 = b[getSymbolIterator()]();
|
6694 | while (true) {
|
6695 | var item1 = iterator1.next();
|
6696 | var item2 = iterator2.next();
|
6697 | if (item1.done && item2.done)
|
6698 | return true;
|
6699 | if (item1.done || item2.done)
|
6700 | return false;
|
6701 | if (!comparator(item1.value, item2.value))
|
6702 | return false;
|
6703 | }
|
6704 | }
|
6705 |
|
6706 |
|
6707 |
|
6708 |
|
6709 |
|
6710 | function iterateListLike(obj, fn) {
|
6711 | if (Array.isArray(obj)) {
|
6712 | for (var i = 0; i < obj.length; i++) {
|
6713 | fn(obj[i]);
|
6714 | }
|
6715 | }
|
6716 | else {
|
6717 | var iterator = obj[getSymbolIterator()]();
|
6718 | var item = void 0;
|
6719 | while (!((item = iterator.next()).done)) {
|
6720 | fn(item.value);
|
6721 | }
|
6722 | }
|
6723 | }
|
6724 |
|
6725 |
|
6726 |
|
6727 |
|
6728 | function isJsObject(o) {
|
6729 | return o !== null && (typeof o === 'function' || typeof o === 'object');
|
6730 | }
|
6731 |
|
6732 |
|
6733 |
|
6734 |
|
6735 |
|
6736 |
|
6737 |
|
6738 | var DefaultIterableDifferFactory = (function () {
|
6739 | function DefaultIterableDifferFactory() {
|
6740 | }
|
6741 | |
6742 |
|
6743 |
|
6744 |
|
6745 | DefaultIterableDifferFactory.prototype.supports = function (obj) { return isListLikeIterable(obj); };
|
6746 | |
6747 |
|
6748 |
|
6749 |
|
6750 |
|
6751 |
|
6752 |
|
6753 | DefaultIterableDifferFactory.prototype.create = function (cdRefOrTrackBy, trackByFn) {
|
6754 | return new DefaultIterableDiffer(trackByFn || (cdRefOrTrackBy));
|
6755 | };
|
6756 | return DefaultIterableDifferFactory;
|
6757 | }());
|
6758 | var trackByIdentity = function (index, item) { return item; };
|
6759 |
|
6760 |
|
6761 |
|
6762 | var DefaultIterableDiffer = (function () {
|
6763 | |
6764 |
|
6765 |
|
6766 | function DefaultIterableDiffer(trackByFn) {
|
6767 | this._length = 0;
|
6768 | this._collection = null;
|
6769 | this._linkedRecords = null;
|
6770 | this._unlinkedRecords = null;
|
6771 | this._previousItHead = null;
|
6772 | this._itHead = null;
|
6773 | this._itTail = null;
|
6774 | this._additionsHead = null;
|
6775 | this._additionsTail = null;
|
6776 | this._movesHead = null;
|
6777 | this._movesTail = null;
|
6778 | this._removalsHead = null;
|
6779 | this._removalsTail = null;
|
6780 | this._identityChangesHead = null;
|
6781 | this._identityChangesTail = null;
|
6782 | this._trackByFn = trackByFn || trackByIdentity;
|
6783 | }
|
6784 | Object.defineProperty(DefaultIterableDiffer.prototype, "collection", {
|
6785 | |
6786 |
|
6787 |
|
6788 | get: function () { return this._collection; },
|
6789 | enumerable: true,
|
6790 | configurable: true
|
6791 | });
|
6792 | Object.defineProperty(DefaultIterableDiffer.prototype, "length", {
|
6793 | |
6794 |
|
6795 |
|
6796 | get: function () { return this._length; },
|
6797 | enumerable: true,
|
6798 | configurable: true
|
6799 | });
|
6800 | |
6801 |
|
6802 |
|
6803 |
|
6804 | DefaultIterableDiffer.prototype.forEachItem = function (fn) {
|
6805 | var record;
|
6806 | for (record = this._itHead; record !== null; record = record._next) {
|
6807 | fn(record);
|
6808 | }
|
6809 | };
|
6810 | |
6811 |
|
6812 |
|
6813 |
|
6814 | DefaultIterableDiffer.prototype.forEachOperation = function (fn) {
|
6815 | var nextIt = this._itHead;
|
6816 | var nextRemove = this._removalsHead;
|
6817 | var addRemoveOffset = 0;
|
6818 | var moveOffsets = null;
|
6819 | while (nextIt || nextRemove) {
|
6820 |
|
6821 |
|
6822 | var record = !nextRemove ||
|
6823 | nextIt && ((nextIt.currentIndex)) <
|
6824 | getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ? ((nextIt)) :
|
6825 | nextRemove;
|
6826 | var adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets);
|
6827 | var currentIndex = record.currentIndex;
|
6828 |
|
6829 | if (record === nextRemove) {
|
6830 | addRemoveOffset--;
|
6831 | nextRemove = nextRemove._nextRemoved;
|
6832 | }
|
6833 | else {
|
6834 | nextIt = ((nextIt))._next;
|
6835 | if (record.previousIndex == null) {
|
6836 | addRemoveOffset++;
|
6837 | }
|
6838 | else {
|
6839 |
|
6840 | if (!moveOffsets)
|
6841 | moveOffsets = [];
|
6842 | var localMovePreviousIndex = adjPreviousIndex - addRemoveOffset;
|
6843 | var localCurrentIndex = ((currentIndex)) - addRemoveOffset;
|
6844 | if (localMovePreviousIndex != localCurrentIndex) {
|
6845 | for (var i = 0; i < localMovePreviousIndex; i++) {
|
6846 | var offset = i < moveOffsets.length ? moveOffsets[i] : (moveOffsets[i] = 0);
|
6847 | var index = offset + i;
|
6848 | if (localCurrentIndex <= index && index < localMovePreviousIndex) {
|
6849 | moveOffsets[i] = offset + 1;
|
6850 | }
|
6851 | }
|
6852 | var previousIndex = record.previousIndex;
|
6853 | moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex;
|
6854 | }
|
6855 | }
|
6856 | }
|
6857 | if (adjPreviousIndex !== currentIndex) {
|
6858 | fn(record, adjPreviousIndex, currentIndex);
|
6859 | }
|
6860 | }
|
6861 | };
|
6862 | |
6863 |
|
6864 |
|
6865 |
|
6866 | DefaultIterableDiffer.prototype.forEachPreviousItem = function (fn) {
|
6867 | var record;
|
6868 | for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
|
6869 | fn(record);
|
6870 | }
|
6871 | };
|
6872 | |
6873 |
|
6874 |
|
6875 |
|
6876 | DefaultIterableDiffer.prototype.forEachAddedItem = function (fn) {
|
6877 | var record;
|
6878 | for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
6879 | fn(record);
|
6880 | }
|
6881 | };
|
6882 | |
6883 |
|
6884 |
|
6885 |
|
6886 | DefaultIterableDiffer.prototype.forEachMovedItem = function (fn) {
|
6887 | var record;
|
6888 | for (record = this._movesHead; record !== null; record = record._nextMoved) {
|
6889 | fn(record);
|
6890 | }
|
6891 | };
|
6892 | |
6893 |
|
6894 |
|
6895 |
|
6896 | DefaultIterableDiffer.prototype.forEachRemovedItem = function (fn) {
|
6897 | var record;
|
6898 | for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
|
6899 | fn(record);
|
6900 | }
|
6901 | };
|
6902 | |
6903 |
|
6904 |
|
6905 |
|
6906 | DefaultIterableDiffer.prototype.forEachIdentityChange = function (fn) {
|
6907 | var record;
|
6908 | for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) {
|
6909 | fn(record);
|
6910 | }
|
6911 | };
|
6912 | |
6913 |
|
6914 |
|
6915 |
|
6916 | DefaultIterableDiffer.prototype.diff = function (collection) {
|
6917 | if (collection == null)
|
6918 | collection = [];
|
6919 | if (!isListLikeIterable(collection)) {
|
6920 | throw new Error("Error trying to diff '" + stringify(collection) + "'. Only arrays and iterables are allowed");
|
6921 | }
|
6922 | if (this.check(collection)) {
|
6923 | return this;
|
6924 | }
|
6925 | else {
|
6926 | return null;
|
6927 | }
|
6928 | };
|
6929 | |
6930 |
|
6931 |
|
6932 | DefaultIterableDiffer.prototype.onDestroy = function () { };
|
6933 | |
6934 |
|
6935 |
|
6936 |
|
6937 | DefaultIterableDiffer.prototype.check = function (collection) {
|
6938 | var _this = this;
|
6939 | this._reset();
|
6940 | var record = this._itHead;
|
6941 | var mayBeDirty = false;
|
6942 | var index;
|
6943 | var item;
|
6944 | var itemTrackBy;
|
6945 | if (Array.isArray(collection)) {
|
6946 | this._length = collection.length;
|
6947 | for (var index_1 = 0; index_1 < this._length; index_1++) {
|
6948 | item = collection[index_1];
|
6949 | itemTrackBy = this._trackByFn(index_1, item);
|
6950 | if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
|
6951 | record = this._mismatch(record, item, itemTrackBy, index_1);
|
6952 | mayBeDirty = true;
|
6953 | }
|
6954 | else {
|
6955 | if (mayBeDirty) {
|
6956 |
|
6957 | record = this._verifyReinsertion(record, item, itemTrackBy, index_1);
|
6958 | }
|
6959 | if (!looseIdentical(record.item, item))
|
6960 | this._addIdentityChange(record, item);
|
6961 | }
|
6962 | record = record._next;
|
6963 | }
|
6964 | }
|
6965 | else {
|
6966 | index = 0;
|
6967 | iterateListLike(collection, function (item) {
|
6968 | itemTrackBy = _this._trackByFn(index, item);
|
6969 | if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
|
6970 | record = _this._mismatch(record, item, itemTrackBy, index);
|
6971 | mayBeDirty = true;
|
6972 | }
|
6973 | else {
|
6974 | if (mayBeDirty) {
|
6975 |
|
6976 | record = _this._verifyReinsertion(record, item, itemTrackBy, index);
|
6977 | }
|
6978 | if (!looseIdentical(record.item, item))
|
6979 | _this._addIdentityChange(record, item);
|
6980 | }
|
6981 | record = record._next;
|
6982 | index++;
|
6983 | });
|
6984 | this._length = index;
|
6985 | }
|
6986 | this._truncate(record);
|
6987 | this._collection = collection;
|
6988 | return this.isDirty;
|
6989 | };
|
6990 | Object.defineProperty(DefaultIterableDiffer.prototype, "isDirty", {
|
6991 | |
6992 |
|
6993 |
|
6994 | get: function () {
|
6995 | return this._additionsHead !== null || this._movesHead !== null ||
|
6996 | this._removalsHead !== null || this._identityChangesHead !== null;
|
6997 | },
|
6998 | enumerable: true,
|
6999 | configurable: true
|
7000 | });
|
7001 | |
7002 |
|
7003 |
|
7004 |
|
7005 |
|
7006 |
|
7007 |
|
7008 |
|
7009 |
|
7010 | DefaultIterableDiffer.prototype._reset = function () {
|
7011 | if (this.isDirty) {
|
7012 | var record = void 0;
|
7013 | var nextRecord = void 0;
|
7014 | for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {
|
7015 | record._nextPrevious = record._next;
|
7016 | }
|
7017 | for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
7018 | record.previousIndex = record.currentIndex;
|
7019 | }
|
7020 | this._additionsHead = this._additionsTail = null;
|
7021 | for (record = this._movesHead; record !== null; record = nextRecord) {
|
7022 | record.previousIndex = record.currentIndex;
|
7023 | nextRecord = record._nextMoved;
|
7024 | }
|
7025 | this._movesHead = this._movesTail = null;
|
7026 | this._removalsHead = this._removalsTail = null;
|
7027 | this._identityChangesHead = this._identityChangesTail = null;
|
7028 |
|
7029 |
|
7030 | }
|
7031 | };
|
7032 | |
7033 |
|
7034 |
|
7035 |
|
7036 |
|
7037 |
|
7038 |
|
7039 |
|
7040 |
|
7041 |
|
7042 |
|
7043 |
|
7044 |
|
7045 |
|
7046 |
|
7047 | DefaultIterableDiffer.prototype._mismatch = function (record, item, itemTrackBy, index) {
|
7048 |
|
7049 | var previousRecord;
|
7050 | if (record === null) {
|
7051 | previousRecord = ((this._itTail));
|
7052 | }
|
7053 | else {
|
7054 | previousRecord = ((record._prev));
|
7055 |
|
7056 | this._remove(record);
|
7057 | }
|
7058 |
|
7059 | record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index);
|
7060 | if (record !== null) {
|
7061 |
|
7062 |
|
7063 | if (!looseIdentical(record.item, item))
|
7064 | this._addIdentityChange(record, item);
|
7065 | this._moveAfter(record, previousRecord, index);
|
7066 | }
|
7067 | else {
|
7068 |
|
7069 | record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
|
7070 | if (record !== null) {
|
7071 |
|
7072 |
|
7073 | if (!looseIdentical(record.item, item))
|
7074 | this._addIdentityChange(record, item);
|
7075 | this._reinsertAfter(record, previousRecord, index);
|
7076 | }
|
7077 | else {
|
7078 |
|
7079 | record =
|
7080 | this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index);
|
7081 | }
|
7082 | }
|
7083 | return record;
|
7084 | };
|
7085 | |
7086 |
|
7087 |
|
7088 |
|
7089 |
|
7090 |
|
7091 |
|
7092 |
|
7093 |
|
7094 |
|
7095 |
|
7096 |
|
7097 |
|
7098 |
|
7099 |
|
7100 |
|
7101 |
|
7102 |
|
7103 |
|
7104 |
|
7105 |
|
7106 |
|
7107 |
|
7108 |
|
7109 |
|
7110 |
|
7111 |
|
7112 |
|
7113 |
|
7114 |
|
7115 |
|
7116 |
|
7117 | DefaultIterableDiffer.prototype._verifyReinsertion = function (record, item, itemTrackBy, index) {
|
7118 | var reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
|
7119 | if (reinsertRecord !== null) {
|
7120 | record = this._reinsertAfter(reinsertRecord, ((record._prev)), index);
|
7121 | }
|
7122 | else if (record.currentIndex != index) {
|
7123 | record.currentIndex = index;
|
7124 | this._addToMoves(record, index);
|
7125 | }
|
7126 | return record;
|
7127 | };
|
7128 | |
7129 |
|
7130 |
|
7131 |
|
7132 |
|
7133 |
|
7134 |
|
7135 |
|
7136 |
|
7137 | DefaultIterableDiffer.prototype._truncate = function (record) {
|
7138 |
|
7139 | while (record !== null) {
|
7140 | var nextRecord = record._next;
|
7141 | this._addToRemovals(this._unlink(record));
|
7142 | record = nextRecord;
|
7143 | }
|
7144 | if (this._unlinkedRecords !== null) {
|
7145 | this._unlinkedRecords.clear();
|
7146 | }
|
7147 | if (this._additionsTail !== null) {
|
7148 | this._additionsTail._nextAdded = null;
|
7149 | }
|
7150 | if (this._movesTail !== null) {
|
7151 | this._movesTail._nextMoved = null;
|
7152 | }
|
7153 | if (this._itTail !== null) {
|
7154 | this._itTail._next = null;
|
7155 | }
|
7156 | if (this._removalsTail !== null) {
|
7157 | this._removalsTail._nextRemoved = null;
|
7158 | }
|
7159 | if (this._identityChangesTail !== null) {
|
7160 | this._identityChangesTail._nextIdentityChange = null;
|
7161 | }
|
7162 | };
|
7163 | |
7164 |
|
7165 |
|
7166 |
|
7167 |
|
7168 |
|
7169 |
|
7170 | DefaultIterableDiffer.prototype._reinsertAfter = function (record, prevRecord, index) {
|
7171 | if (this._unlinkedRecords !== null) {
|
7172 | this._unlinkedRecords.remove(record);
|
7173 | }
|
7174 | var prev = record._prevRemoved;
|
7175 | var next = record._nextRemoved;
|
7176 | if (prev === null) {
|
7177 | this._removalsHead = next;
|
7178 | }
|
7179 | else {
|
7180 | prev._nextRemoved = next;
|
7181 | }
|
7182 | if (next === null) {
|
7183 | this._removalsTail = prev;
|
7184 | }
|
7185 | else {
|
7186 | next._prevRemoved = prev;
|
7187 | }
|
7188 | this._insertAfter(record, prevRecord, index);
|
7189 | this._addToMoves(record, index);
|
7190 | return record;
|
7191 | };
|
7192 | |
7193 |
|
7194 |
|
7195 |
|
7196 |
|
7197 |
|
7198 |
|
7199 | DefaultIterableDiffer.prototype._moveAfter = function (record, prevRecord, index) {
|
7200 | this._unlink(record);
|
7201 | this._insertAfter(record, prevRecord, index);
|
7202 | this._addToMoves(record, index);
|
7203 | return record;
|
7204 | };
|
7205 | |
7206 |
|
7207 |
|
7208 |
|
7209 |
|
7210 |
|
7211 |
|
7212 | DefaultIterableDiffer.prototype._addAfter = function (record, prevRecord, index) {
|
7213 | this._insertAfter(record, prevRecord, index);
|
7214 | if (this._additionsTail === null) {
|
7215 |
|
7216 |
|
7217 | this._additionsTail = this._additionsHead = record;
|
7218 | }
|
7219 | else {
|
7220 |
|
7221 |
|
7222 |
|
7223 | this._additionsTail = this._additionsTail._nextAdded = record;
|
7224 | }
|
7225 | return record;
|
7226 | };
|
7227 | |
7228 |
|
7229 |
|
7230 |
|
7231 |
|
7232 |
|
7233 |
|
7234 | DefaultIterableDiffer.prototype._insertAfter = function (record, prevRecord, index) {
|
7235 |
|
7236 |
|
7237 |
|
7238 |
|
7239 | var next = prevRecord === null ? this._itHead : prevRecord._next;
|
7240 |
|
7241 |
|
7242 |
|
7243 | record._next = next;
|
7244 | record._prev = prevRecord;
|
7245 | if (next === null) {
|
7246 | this._itTail = record;
|
7247 | }
|
7248 | else {
|
7249 | next._prev = record;
|
7250 | }
|
7251 | if (prevRecord === null) {
|
7252 | this._itHead = record;
|
7253 | }
|
7254 | else {
|
7255 | prevRecord._next = record;
|
7256 | }
|
7257 | if (this._linkedRecords === null) {
|
7258 | this._linkedRecords = new _DuplicateMap();
|
7259 | }
|
7260 | this._linkedRecords.put(record);
|
7261 | record.currentIndex = index;
|
7262 | return record;
|
7263 | };
|
7264 | |
7265 |
|
7266 |
|
7267 |
|
7268 |
|
7269 | DefaultIterableDiffer.prototype._remove = function (record) {
|
7270 | return this._addToRemovals(this._unlink(record));
|
7271 | };
|
7272 | |
7273 |
|
7274 |
|
7275 |
|
7276 |
|
7277 | DefaultIterableDiffer.prototype._unlink = function (record) {
|
7278 | if (this._linkedRecords !== null) {
|
7279 | this._linkedRecords.remove(record);
|
7280 | }
|
7281 | var prev = record._prev;
|
7282 | var next = record._next;
|
7283 |
|
7284 |
|
7285 |
|
7286 | if (prev === null) {
|
7287 | this._itHead = next;
|
7288 | }
|
7289 | else {
|
7290 | prev._next = next;
|
7291 | }
|
7292 | if (next === null) {
|
7293 | this._itTail = prev;
|
7294 | }
|
7295 | else {
|
7296 | next._prev = prev;
|
7297 | }
|
7298 | return record;
|
7299 | };
|
7300 | |
7301 |
|
7302 |
|
7303 |
|
7304 |
|
7305 |
|
7306 | DefaultIterableDiffer.prototype._addToMoves = function (record, toIndex) {
|
7307 |
|
7308 |
|
7309 | if (record.previousIndex === toIndex) {
|
7310 | return record;
|
7311 | }
|
7312 | if (this._movesTail === null) {
|
7313 |
|
7314 |
|
7315 | this._movesTail = this._movesHead = record;
|
7316 | }
|
7317 | else {
|
7318 |
|
7319 |
|
7320 | this._movesTail = this._movesTail._nextMoved = record;
|
7321 | }
|
7322 | return record;
|
7323 | };
|
7324 | |
7325 |
|
7326 |
|
7327 |
|
7328 | DefaultIterableDiffer.prototype._addToRemovals = function (record) {
|
7329 | if (this._unlinkedRecords === null) {
|
7330 | this._unlinkedRecords = new _DuplicateMap();
|
7331 | }
|
7332 | this._unlinkedRecords.put(record);
|
7333 | record.currentIndex = null;
|
7334 | record._nextRemoved = null;
|
7335 | if (this._removalsTail === null) {
|
7336 |
|
7337 |
|
7338 | this._removalsTail = this._removalsHead = record;
|
7339 | record._prevRemoved = null;
|
7340 | }
|
7341 | else {
|
7342 |
|
7343 |
|
7344 |
|
7345 | record._prevRemoved = this._removalsTail;
|
7346 | this._removalsTail = this._removalsTail._nextRemoved = record;
|
7347 | }
|
7348 | return record;
|
7349 | };
|
7350 | |
7351 |
|
7352 |
|
7353 |
|
7354 |
|
7355 |
|
7356 | DefaultIterableDiffer.prototype._addIdentityChange = function (record, item) {
|
7357 | record.item = item;
|
7358 | if (this._identityChangesTail === null) {
|
7359 | this._identityChangesTail = this._identityChangesHead = record;
|
7360 | }
|
7361 | else {
|
7362 | this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record;
|
7363 | }
|
7364 | return record;
|
7365 | };
|
7366 | |
7367 |
|
7368 |
|
7369 | DefaultIterableDiffer.prototype.toString = function () {
|
7370 | var list = [];
|
7371 | this.forEachItem(function (record) { return list.push(record); });
|
7372 | var previous = [];
|
7373 | this.forEachPreviousItem(function (record) { return previous.push(record); });
|
7374 | var additions = [];
|
7375 | this.forEachAddedItem(function (record) { return additions.push(record); });
|
7376 | var moves = [];
|
7377 | this.forEachMovedItem(function (record) { return moves.push(record); });
|
7378 | var removals = [];
|
7379 | this.forEachRemovedItem(function (record) { return removals.push(record); });
|
7380 | var identityChanges = [];
|
7381 | this.forEachIdentityChange(function (record) { return identityChanges.push(record); });
|
7382 | return 'collection: ' + list.join(', ') + '\n' +
|
7383 | 'previous: ' + previous.join(', ') + '\n' +
|
7384 | 'additions: ' + additions.join(', ') + '\n' +
|
7385 | 'moves: ' + moves.join(', ') + '\n' +
|
7386 | 'removals: ' + removals.join(', ') + '\n' +
|
7387 | 'identityChanges: ' + identityChanges.join(', ') + '\n';
|
7388 | };
|
7389 | return DefaultIterableDiffer;
|
7390 | }());
|
7391 |
|
7392 |
|
7393 |
|
7394 | var IterableChangeRecord_ = (function () {
|
7395 | |
7396 |
|
7397 |
|
7398 |
|
7399 | function IterableChangeRecord_(item, trackById) {
|
7400 | this.item = item;
|
7401 | this.trackById = trackById;
|
7402 | this.currentIndex = null;
|
7403 | this.previousIndex = null;
|
7404 | |
7405 |
|
7406 |
|
7407 | this._nextPrevious = null;
|
7408 | |
7409 |
|
7410 |
|
7411 | this._prev = null;
|
7412 | |
7413 |
|
7414 |
|
7415 | this._next = null;
|
7416 | |
7417 |
|
7418 |
|
7419 | this._prevDup = null;
|
7420 | |
7421 |
|
7422 |
|
7423 | this._nextDup = null;
|
7424 | |
7425 |
|
7426 |
|
7427 | this._prevRemoved = null;
|
7428 | |
7429 |
|
7430 |
|
7431 | this._nextRemoved = null;
|
7432 | |
7433 |
|
7434 |
|
7435 | this._nextAdded = null;
|
7436 | |
7437 |
|
7438 |
|
7439 | this._nextMoved = null;
|
7440 | |
7441 |
|
7442 |
|
7443 | this._nextIdentityChange = null;
|
7444 | }
|
7445 | |
7446 |
|
7447 |
|
7448 | IterableChangeRecord_.prototype.toString = function () {
|
7449 | return this.previousIndex === this.currentIndex ? stringify(this.item) :
|
7450 | stringify(this.item) + '[' +
|
7451 | stringify(this.previousIndex) + '->' + stringify(this.currentIndex) + ']';
|
7452 | };
|
7453 | return IterableChangeRecord_;
|
7454 | }());
|
7455 | var _DuplicateItemRecordList = (function () {
|
7456 | function _DuplicateItemRecordList() {
|
7457 | |
7458 |
|
7459 |
|
7460 | this._head = null;
|
7461 | |
7462 |
|
7463 |
|
7464 | this._tail = null;
|
7465 | }
|
7466 | |
7467 |
|
7468 |
|
7469 |
|
7470 |
|
7471 |
|
7472 |
|
7473 | _DuplicateItemRecordList.prototype.add = function (record) {
|
7474 | if (this._head === null) {
|
7475 | this._head = this._tail = record;
|
7476 | record._nextDup = null;
|
7477 | record._prevDup = null;
|
7478 | }
|
7479 | else {
|
7480 | ((
|
7481 |
|
7482 |
|
7483 |
|
7484 | this._tail))._nextDup = record;
|
7485 | record._prevDup = this._tail;
|
7486 | record._nextDup = null;
|
7487 | this._tail = record;
|
7488 | }
|
7489 | };
|
7490 | |
7491 |
|
7492 |
|
7493 |
|
7494 |
|
7495 | _DuplicateItemRecordList.prototype.get = function (trackById, afterIndex) {
|
7496 | var record;
|
7497 | for (record = this._head; record !== null; record = record._nextDup) {
|
7498 | if ((afterIndex === null || afterIndex < ((record.currentIndex))) &&
|
7499 | looseIdentical(record.trackById, trackById)) {
|
7500 | return record;
|
7501 | }
|
7502 | }
|
7503 | return null;
|
7504 | };
|
7505 | |
7506 |
|
7507 |
|
7508 |
|
7509 |
|
7510 |
|
7511 |
|
7512 | _DuplicateItemRecordList.prototype.remove = function (record) {
|
7513 |
|
7514 |
|
7515 |
|
7516 |
|
7517 |
|
7518 |
|
7519 |
|
7520 |
|
7521 | var prev = record._prevDup;
|
7522 | var next = record._nextDup;
|
7523 | if (prev === null) {
|
7524 | this._head = next;
|
7525 | }
|
7526 | else {
|
7527 | prev._nextDup = next;
|
7528 | }
|
7529 | if (next === null) {
|
7530 | this._tail = prev;
|
7531 | }
|
7532 | else {
|
7533 | next._prevDup = prev;
|
7534 | }
|
7535 | return this._head === null;
|
7536 | };
|
7537 | return _DuplicateItemRecordList;
|
7538 | }());
|
7539 | var _DuplicateMap = (function () {
|
7540 | function _DuplicateMap() {
|
7541 | this.map = new Map();
|
7542 | }
|
7543 | |
7544 |
|
7545 |
|
7546 |
|
7547 | _DuplicateMap.prototype.put = function (record) {
|
7548 | var key = record.trackById;
|
7549 | var duplicates = this.map.get(key);
|
7550 | if (!duplicates) {
|
7551 | duplicates = new _DuplicateItemRecordList();
|
7552 | this.map.set(key, duplicates);
|
7553 | }
|
7554 | duplicates.add(record);
|
7555 | };
|
7556 | |
7557 |
|
7558 |
|
7559 |
|
7560 |
|
7561 |
|
7562 |
|
7563 |
|
7564 |
|
7565 |
|
7566 | _DuplicateMap.prototype.get = function (trackById, afterIndex) {
|
7567 | var key = trackById;
|
7568 | var recordList = this.map.get(key);
|
7569 | return recordList ? recordList.get(trackById, afterIndex) : null;
|
7570 | };
|
7571 | |
7572 |
|
7573 |
|
7574 |
|
7575 |
|
7576 |
|
7577 |
|
7578 | _DuplicateMap.prototype.remove = function (record) {
|
7579 | var key = record.trackById;
|
7580 | var recordList = ((this.map.get(key)));
|
7581 |
|
7582 | if (recordList.remove(record)) {
|
7583 | this.map.delete(key);
|
7584 | }
|
7585 | return record;
|
7586 | };
|
7587 | Object.defineProperty(_DuplicateMap.prototype, "isEmpty", {
|
7588 | |
7589 |
|
7590 |
|
7591 | get: function () { return this.map.size === 0; },
|
7592 | enumerable: true,
|
7593 | configurable: true
|
7594 | });
|
7595 | |
7596 |
|
7597 |
|
7598 | _DuplicateMap.prototype.clear = function () { this.map.clear(); };
|
7599 | |
7600 |
|
7601 |
|
7602 | _DuplicateMap.prototype.toString = function () { return '_DuplicateMap(' + stringify(this.map) + ')'; };
|
7603 | return _DuplicateMap;
|
7604 | }());
|
7605 |
|
7606 |
|
7607 |
|
7608 |
|
7609 |
|
7610 |
|
7611 | function getPreviousIndex(item, addRemoveOffset, moveOffsets) {
|
7612 | var previousIndex = item.previousIndex;
|
7613 | if (previousIndex === null)
|
7614 | return previousIndex;
|
7615 | var moveOffset = 0;
|
7616 | if (moveOffsets && previousIndex < moveOffsets.length) {
|
7617 | moveOffset = moveOffsets[previousIndex];
|
7618 | }
|
7619 | return previousIndex + addRemoveOffset + moveOffset;
|
7620 | }
|
7621 |
|
7622 |
|
7623 |
|
7624 |
|
7625 |
|
7626 |
|
7627 |
|
7628 | var DefaultKeyValueDifferFactory = (function () {
|
7629 | function DefaultKeyValueDifferFactory() {
|
7630 | }
|
7631 | |
7632 |
|
7633 |
|
7634 |
|
7635 | DefaultKeyValueDifferFactory.prototype.supports = function (obj) { return obj instanceof Map || isJsObject(obj); };
|
7636 | |
7637 |
|
7638 |
|
7639 |
|
7640 |
|
7641 |
|
7642 | DefaultKeyValueDifferFactory.prototype.create = function (cd) {
|
7643 | return new DefaultKeyValueDiffer();
|
7644 | };
|
7645 | return DefaultKeyValueDifferFactory;
|
7646 | }());
|
7647 | var DefaultKeyValueDiffer = (function () {
|
7648 | function DefaultKeyValueDiffer() {
|
7649 | this._records = new Map();
|
7650 | this._mapHead = null;
|
7651 | this._appendAfter = null;
|
7652 | this._previousMapHead = null;
|
7653 | this._changesHead = null;
|
7654 | this._changesTail = null;
|
7655 | this._additionsHead = null;
|
7656 | this._additionsTail = null;
|
7657 | this._removalsHead = null;
|
7658 | this._removalsTail = null;
|
7659 | }
|
7660 | Object.defineProperty(DefaultKeyValueDiffer.prototype, "isDirty", {
|
7661 | |
7662 |
|
7663 |
|
7664 | get: function () {
|
7665 | return this._additionsHead !== null || this._changesHead !== null ||
|
7666 | this._removalsHead !== null;
|
7667 | },
|
7668 | enumerable: true,
|
7669 | configurable: true
|
7670 | });
|
7671 | |
7672 |
|
7673 |
|
7674 |
|
7675 | DefaultKeyValueDiffer.prototype.forEachItem = function (fn) {
|
7676 | var record;
|
7677 | for (record = this._mapHead; record !== null; record = record._next) {
|
7678 | fn(record);
|
7679 | }
|
7680 | };
|
7681 | |
7682 |
|
7683 |
|
7684 |
|
7685 | DefaultKeyValueDiffer.prototype.forEachPreviousItem = function (fn) {
|
7686 | var record;
|
7687 | for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
|
7688 | fn(record);
|
7689 | }
|
7690 | };
|
7691 | |
7692 |
|
7693 |
|
7694 |
|
7695 | DefaultKeyValueDiffer.prototype.forEachChangedItem = function (fn) {
|
7696 | var record;
|
7697 | for (record = this._changesHead; record !== null; record = record._nextChanged) {
|
7698 | fn(record);
|
7699 | }
|
7700 | };
|
7701 | |
7702 |
|
7703 |
|
7704 |
|
7705 | DefaultKeyValueDiffer.prototype.forEachAddedItem = function (fn) {
|
7706 | var record;
|
7707 | for (record = this._additionsHead; record !== null; record = record._nextAdded) {
|
7708 | fn(record);
|
7709 | }
|
7710 | };
|
7711 | |
7712 |
|
7713 |
|
7714 |
|
7715 | DefaultKeyValueDiffer.prototype.forEachRemovedItem = function (fn) {
|
7716 | var record;
|
7717 | for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
|
7718 | fn(record);
|
7719 | }
|
7720 | };
|
7721 | |
7722 |
|
7723 |
|
7724 |
|
7725 | DefaultKeyValueDiffer.prototype.diff = function (map) {
|
7726 | if (!map) {
|
7727 | map = new Map();
|
7728 | }
|
7729 | else if (!(map instanceof Map || isJsObject(map))) {
|
7730 | throw new Error("Error trying to diff '" + stringify(map) + "'. Only maps and objects are allowed");
|
7731 | }
|
7732 | return this.check(map) ? this : null;
|
7733 | };
|
7734 | |
7735 |
|
7736 |
|
7737 | DefaultKeyValueDiffer.prototype.onDestroy = function () { };
|
7738 | |
7739 |
|
7740 |
|
7741 |
|
7742 |
|
7743 |
|
7744 | DefaultKeyValueDiffer.prototype.check = function (map) {
|
7745 | var _this = this;
|
7746 | this._reset();
|
7747 | var insertBefore = this._mapHead;
|
7748 | this._appendAfter = null;
|
7749 | this._forEach(map, function (value, key) {
|
7750 | if (insertBefore && insertBefore.key === key) {
|
7751 | _this._maybeAddToChanges(insertBefore, value);
|
7752 | _this._appendAfter = insertBefore;
|
7753 | insertBefore = insertBefore._next;
|
7754 | }
|
7755 | else {
|
7756 | var record = _this._getOrCreateRecordForKey(key, value);
|
7757 | insertBefore = _this._insertBeforeOrAppend(insertBefore, record);
|
7758 | }
|
7759 | });
|
7760 |
|
7761 | if (insertBefore) {
|
7762 | if (insertBefore._prev) {
|
7763 | insertBefore._prev._next = null;
|
7764 | }
|
7765 | this._removalsHead = insertBefore;
|
7766 | for (var record = insertBefore; record !== null; record = record._nextRemoved) {
|
7767 | if (record === this._mapHead) {
|
7768 | this._mapHead = null;
|
7769 | }
|
7770 | this._records.delete(record.key);
|
7771 | record._nextRemoved = record._next;
|
7772 | record.previousValue = record.currentValue;
|
7773 | record.currentValue = null;
|
7774 | record._prev = null;
|
7775 | record._next = null;
|
7776 | }
|
7777 | }
|
7778 |
|
7779 | if (this._changesTail)
|
7780 | this._changesTail._nextChanged = null;
|
7781 | if (this._additionsTail)
|
7782 | this._additionsTail._nextAdded = null;
|
7783 | return this.isDirty;
|
7784 | };
|
7785 | |
7786 |
|
7787 |
|
7788 |
|
7789 |
|
7790 |
|
7791 |
|
7792 |
|
7793 |
|
7794 |
|
7795 |
|
7796 | DefaultKeyValueDiffer.prototype._insertBeforeOrAppend = function (before, record) {
|
7797 | if (before) {
|
7798 | var prev = before._prev;
|
7799 | record._next = before;
|
7800 | record._prev = prev;
|
7801 | before._prev = record;
|
7802 | if (prev) {
|
7803 | prev._next = record;
|
7804 | }
|
7805 | if (before === this._mapHead) {
|
7806 | this._mapHead = record;
|
7807 | }
|
7808 | this._appendAfter = before;
|
7809 | return before;
|
7810 | }
|
7811 | if (this._appendAfter) {
|
7812 | this._appendAfter._next = record;
|
7813 | record._prev = this._appendAfter;
|
7814 | }
|
7815 | else {
|
7816 | this._mapHead = record;
|
7817 | }
|
7818 | this._appendAfter = record;
|
7819 | return null;
|
7820 | };
|
7821 | |
7822 |
|
7823 |
|
7824 |
|
7825 |
|
7826 | DefaultKeyValueDiffer.prototype._getOrCreateRecordForKey = function (key, value) {
|
7827 | if (this._records.has(key)) {
|
7828 | var record_1 = ((this._records.get(key)));
|
7829 | this._maybeAddToChanges(record_1, value);
|
7830 | var prev = record_1._prev;
|
7831 | var next = record_1._next;
|
7832 | if (prev) {
|
7833 | prev._next = next;
|
7834 | }
|
7835 | if (next) {
|
7836 | next._prev = prev;
|
7837 | }
|
7838 | record_1._next = null;
|
7839 | record_1._prev = null;
|
7840 | return record_1;
|
7841 | }
|
7842 | var record = new KeyValueChangeRecord_(key);
|
7843 | this._records.set(key, record);
|
7844 | record.currentValue = value;
|
7845 | this._addToAdditions(record);
|
7846 | return record;
|
7847 | };
|
7848 | |
7849 |
|
7850 |
|
7851 |
|
7852 | DefaultKeyValueDiffer.prototype._reset = function () {
|
7853 | if (this.isDirty) {
|
7854 | var record = void 0;
|
7855 |
|
7856 | this._previousMapHead = this._mapHead;
|
7857 | for (record = this._previousMapHead; record !== null; record = record._next) {
|
7858 | record._nextPrevious = record._next;
|
7859 | }
|
7860 |
|
7861 |
|
7862 | for (record = this._changesHead; record !== null; record = record._nextChanged) {
|
7863 | record.previousValue = record.currentValue;
|
7864 | }
|
7865 | for (record = this._additionsHead; record != null; record = record._nextAdded) {
|
7866 | record.previousValue = record.currentValue;
|
7867 | }
|
7868 | this._changesHead = this._changesTail = null;
|
7869 | this._additionsHead = this._additionsTail = null;
|
7870 | this._removalsHead = null;
|
7871 | }
|
7872 | };
|
7873 | |
7874 |
|
7875 |
|
7876 |
|
7877 |
|
7878 | DefaultKeyValueDiffer.prototype._maybeAddToChanges = function (record, newValue) {
|
7879 | if (!looseIdentical(newValue, record.currentValue)) {
|
7880 | record.previousValue = record.currentValue;
|
7881 | record.currentValue = newValue;
|
7882 | this._addToChanges(record);
|
7883 | }
|
7884 | };
|
7885 | |
7886 |
|
7887 |
|
7888 |
|
7889 | DefaultKeyValueDiffer.prototype._addToAdditions = function (record) {
|
7890 | if (this._additionsHead === null) {
|
7891 | this._additionsHead = this._additionsTail = record;
|
7892 | }
|
7893 | else {
|
7894 | ((this._additionsTail))._nextAdded = record;
|
7895 | this._additionsTail = record;
|
7896 | }
|
7897 | };
|
7898 | |
7899 |
|
7900 |
|
7901 |
|
7902 | DefaultKeyValueDiffer.prototype._addToChanges = function (record) {
|
7903 | if (this._changesHead === null) {
|
7904 | this._changesHead = this._changesTail = record;
|
7905 | }
|
7906 | else {
|
7907 | ((this._changesTail))._nextChanged = record;
|
7908 | this._changesTail = record;
|
7909 | }
|
7910 | };
|
7911 | |
7912 |
|
7913 |
|
7914 | DefaultKeyValueDiffer.prototype.toString = function () {
|
7915 | var items = [];
|
7916 | var previous = [];
|
7917 | var changes = [];
|
7918 | var additions = [];
|
7919 | var removals = [];
|
7920 | this.forEachItem(function (r) { return items.push(stringify(r)); });
|
7921 | this.forEachPreviousItem(function (r) { return previous.push(stringify(r)); });
|
7922 | this.forEachChangedItem(function (r) { return changes.push(stringify(r)); });
|
7923 | this.forEachAddedItem(function (r) { return additions.push(stringify(r)); });
|
7924 | this.forEachRemovedItem(function (r) { return removals.push(stringify(r)); });
|
7925 | return 'map: ' + items.join(', ') + '\n' +
|
7926 | 'previous: ' + previous.join(', ') + '\n' +
|
7927 | 'additions: ' + additions.join(', ') + '\n' +
|
7928 | 'changes: ' + changes.join(', ') + '\n' +
|
7929 | 'removals: ' + removals.join(', ') + '\n';
|
7930 | };
|
7931 | |
7932 |
|
7933 |
|
7934 |
|
7935 |
|
7936 |
|
7937 |
|
7938 | DefaultKeyValueDiffer.prototype._forEach = function (obj, fn) {
|
7939 | if (obj instanceof Map) {
|
7940 | obj.forEach(fn);
|
7941 | }
|
7942 | else {
|
7943 | Object.keys(obj).forEach(function (k) { return fn(obj[k], k); });
|
7944 | }
|
7945 | };
|
7946 | return DefaultKeyValueDiffer;
|
7947 | }());
|
7948 |
|
7949 |
|
7950 |
|
7951 | var KeyValueChangeRecord_ = (function () {
|
7952 | |
7953 |
|
7954 |
|
7955 | function KeyValueChangeRecord_(key) {
|
7956 | this.key = key;
|
7957 | this.previousValue = null;
|
7958 | this.currentValue = null;
|
7959 | |
7960 |
|
7961 |
|
7962 | this._nextPrevious = null;
|
7963 | |
7964 |
|
7965 |
|
7966 | this._next = null;
|
7967 | |
7968 |
|
7969 |
|
7970 | this._prev = null;
|
7971 | |
7972 |
|
7973 |
|
7974 | this._nextAdded = null;
|
7975 | |
7976 |
|
7977 |
|
7978 | this._nextRemoved = null;
|
7979 | |
7980 |
|
7981 |
|
7982 | this._nextChanged = null;
|
7983 | }
|
7984 | |
7985 |
|
7986 |
|
7987 | KeyValueChangeRecord_.prototype.toString = function () {
|
7988 | return looseIdentical(this.previousValue, this.currentValue) ?
|
7989 | stringify(this.key) :
|
7990 | (stringify(this.key) + '[' + stringify(this.previousValue) + '->' +
|
7991 | stringify(this.currentValue) + ']');
|
7992 | };
|
7993 | return KeyValueChangeRecord_;
|
7994 | }());
|
7995 |
|
7996 |
|
7997 |
|
7998 |
|
7999 |
|
8000 |
|
8001 |
|
8002 |
|
8003 |
|
8004 |
|
8005 |
|
8006 | var IterableDiffers = (function () {
|
8007 | |
8008 |
|
8009 |
|
8010 | function IterableDiffers(factories) {
|
8011 | this.factories = factories;
|
8012 | }
|
8013 | |
8014 |
|
8015 |
|
8016 |
|
8017 |
|
8018 | IterableDiffers.create = function (factories, parent) {
|
8019 | if (parent != null) {
|
8020 | var copied = parent.factories.slice();
|
8021 | factories = factories.concat(copied);
|
8022 | return new IterableDiffers(factories);
|
8023 | }
|
8024 | else {
|
8025 | return new IterableDiffers(factories);
|
8026 | }
|
8027 | };
|
8028 | |
8029 |
|
8030 |
|
8031 |
|
8032 |
|
8033 |
|
8034 |
|
8035 |
|
8036 |
|
8037 |
|
8038 |
|
8039 |
|
8040 |
|
8041 |
|
8042 |
|
8043 |
|
8044 |
|
8045 |
|
8046 |
|
8047 |
|
8048 |
|
8049 | IterableDiffers.extend = function (factories) {
|
8050 | return {
|
8051 | provide: IterableDiffers,
|
8052 | useFactory: function (parent) {
|
8053 | if (!parent) {
|
8054 |
|
8055 |
|
8056 |
|
8057 | throw new Error('Cannot extend IterableDiffers without a parent injector');
|
8058 | }
|
8059 | return IterableDiffers.create(factories, parent);
|
8060 | },
|
8061 |
|
8062 | deps: [[IterableDiffers, new SkipSelf(), new Optional()]]
|
8063 | };
|
8064 | };
|
8065 | |
8066 |
|
8067 |
|
8068 |
|
8069 | IterableDiffers.prototype.find = function (iterable) {
|
8070 | var factory = this.factories.find(function (f) { return f.supports(iterable); });
|
8071 | if (factory != null) {
|
8072 | return factory;
|
8073 | }
|
8074 | else {
|
8075 | throw new Error("Cannot find a differ supporting object '" + iterable + "' of type '" + getTypeNameForDebugging(iterable) + "'");
|
8076 | }
|
8077 | };
|
8078 | return IterableDiffers;
|
8079 | }());
|
8080 |
|
8081 |
|
8082 |
|
8083 |
|
8084 | function getTypeNameForDebugging(type) {
|
8085 | return type['name'] || typeof type;
|
8086 | }
|
8087 |
|
8088 |
|
8089 |
|
8090 |
|
8091 |
|
8092 |
|
8093 |
|
8094 |
|
8095 |
|
8096 |
|
8097 |
|
8098 | var KeyValueDiffers = (function () {
|
8099 | |
8100 |
|
8101 |
|
8102 | function KeyValueDiffers(factories) {
|
8103 | this.factories = factories;
|
8104 | }
|
8105 | |
8106 |
|
8107 |
|
8108 |
|
8109 |
|
8110 |
|
8111 | KeyValueDiffers.create = function (factories, parent) {
|
8112 | if (parent) {
|
8113 | var copied = parent.factories.slice();
|
8114 | factories = factories.concat(copied);
|
8115 | }
|
8116 | return new KeyValueDiffers(factories);
|
8117 | };
|
8118 | |
8119 |
|
8120 |
|
8121 |
|
8122 |
|
8123 |
|
8124 |
|
8125 |
|
8126 |
|
8127 |
|
8128 |
|
8129 |
|
8130 |
|
8131 |
|
8132 |
|
8133 |
|
8134 |
|
8135 |
|
8136 |
|
8137 |
|
8138 |
|
8139 |
|
8140 | KeyValueDiffers.extend = function (factories) {
|
8141 | return {
|
8142 | provide: KeyValueDiffers,
|
8143 | useFactory: function (parent) {
|
8144 | if (!parent) {
|
8145 |
|
8146 |
|
8147 | throw new Error('Cannot extend KeyValueDiffers without a parent injector');
|
8148 | }
|
8149 | return KeyValueDiffers.create(factories, parent);
|
8150 | },
|
8151 |
|
8152 | deps: [[KeyValueDiffers, new SkipSelf(), new Optional()]]
|
8153 | };
|
8154 | };
|
8155 | |
8156 |
|
8157 |
|
8158 |
|
8159 | KeyValueDiffers.prototype.find = function (kv) {
|
8160 | var factory = this.factories.find(function (f) { return f.supports(kv); });
|
8161 | if (factory) {
|
8162 | return factory;
|
8163 | }
|
8164 | throw new Error("Cannot find a differ supporting object '" + kv + "'");
|
8165 | };
|
8166 | return KeyValueDiffers;
|
8167 | }());
|
8168 |
|
8169 |
|
8170 |
|
8171 |
|
8172 |
|
8173 |
|
8174 |
|
8175 |
|
8176 |
|
8177 |
|
8178 | var keyValDiff = [new DefaultKeyValueDifferFactory()];
|
8179 |
|
8180 |
|
8181 |
|
8182 | var iterableDiff = [new DefaultIterableDifferFactory()];
|
8183 | var defaultIterableDiffers = new IterableDiffers(iterableDiff);
|
8184 | var defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
|
8185 |
|
8186 |
|
8187 |
|
8188 |
|
8189 |
|
8190 |
|
8191 |
|
8192 |
|
8193 |
|
8194 |
|
8195 |
|
8196 |
|
8197 |
|
8198 |
|
8199 |
|
8200 |
|
8201 |
|
8202 |
|
8203 |
|
8204 |
|
8205 |
|
8206 |
|
8207 | function _reflector() {
|
8208 | return reflector;
|
8209 | }
|
8210 | var _CORE_PLATFORM_PROVIDERS = [
|
8211 |
|
8212 | { provide: PLATFORM_ID, useValue: 'unknown' },
|
8213 | PlatformRef_,
|
8214 | { provide: PlatformRef, useExisting: PlatformRef_ },
|
8215 | { provide: Reflector, useFactory: _reflector, deps: [] },
|
8216 | TestabilityRegistry,
|
8217 | Console,
|
8218 | ];
|
8219 |
|
8220 |
|
8221 |
|
8222 |
|
8223 |
|
8224 | var platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
|
8225 |
|
8226 |
|
8227 |
|
8228 |
|
8229 |
|
8230 |
|
8231 |
|
8232 |
|
8233 |
|
8234 |
|
8235 | var LOCALE_ID = new InjectionToken('LocaleId');
|
8236 |
|
8237 |
|
8238 |
|
8239 | var TRANSLATIONS = new InjectionToken('Translations');
|
8240 |
|
8241 |
|
8242 |
|
8243 | var TRANSLATIONS_FORMAT = new InjectionToken('TranslationsFormat');
|
8244 | var MissingTranslationStrategy = {};
|
8245 | MissingTranslationStrategy.Error = 0;
|
8246 | MissingTranslationStrategy.Warning = 1;
|
8247 | MissingTranslationStrategy.Ignore = 2;
|
8248 | MissingTranslationStrategy[MissingTranslationStrategy.Error] = "Error";
|
8249 | MissingTranslationStrategy[MissingTranslationStrategy.Warning] = "Warning";
|
8250 | MissingTranslationStrategy[MissingTranslationStrategy.Ignore] = "Ignore";
|
8251 |
|
8252 |
|
8253 |
|
8254 |
|
8255 |
|
8256 |
|
8257 |
|
8258 |
|
8259 |
|
8260 |
|
8261 | function _iterableDiffersFactory() {
|
8262 | return defaultIterableDiffers;
|
8263 | }
|
8264 |
|
8265 |
|
8266 |
|
8267 | function _keyValueDiffersFactory() {
|
8268 | return defaultKeyValueDiffers;
|
8269 | }
|
8270 |
|
8271 |
|
8272 |
|
8273 |
|
8274 | function _localeFactory(locale) {
|
8275 | return locale || 'en-US';
|
8276 | }
|
8277 |
|
8278 |
|
8279 |
|
8280 |
|
8281 |
|
8282 |
|
8283 | var ApplicationModule = (function () {
|
8284 | |
8285 |
|
8286 |
|
8287 | function ApplicationModule(appRef) {
|
8288 | }
|
8289 | return ApplicationModule;
|
8290 | }());
|
8291 | ApplicationModule.decorators = [
|
8292 | { type: NgModule, args: [{
|
8293 | providers: [
|
8294 | ApplicationRef_,
|
8295 | { provide: ApplicationRef, useExisting: ApplicationRef_ },
|
8296 | ApplicationInitStatus,
|
8297 | Compiler,
|
8298 | APP_ID_RANDOM_PROVIDER,
|
8299 | { provide: IterableDiffers, useFactory: _iterableDiffersFactory },
|
8300 | { provide: KeyValueDiffers, useFactory: _keyValueDiffersFactory },
|
8301 | {
|
8302 | provide: LOCALE_ID,
|
8303 | useFactory: _localeFactory,
|
8304 | deps: [[new Inject(LOCALE_ID), new Optional(), new SkipSelf()]]
|
8305 | },
|
8306 | ]
|
8307 | },] },
|
8308 | ];
|
8309 |
|
8310 |
|
8311 |
|
8312 | ApplicationModule.ctorParameters = function () { return [
|
8313 | { type: ApplicationRef, },
|
8314 | ]; };
|
8315 | var SecurityContext = {};
|
8316 | SecurityContext.NONE = 0;
|
8317 | SecurityContext.HTML = 1;
|
8318 | SecurityContext.STYLE = 2;
|
8319 | SecurityContext.SCRIPT = 3;
|
8320 | SecurityContext.URL = 4;
|
8321 | SecurityContext.RESOURCE_URL = 5;
|
8322 | SecurityContext[SecurityContext.NONE] = "NONE";
|
8323 | SecurityContext[SecurityContext.HTML] = "HTML";
|
8324 | SecurityContext[SecurityContext.STYLE] = "STYLE";
|
8325 | SecurityContext[SecurityContext.SCRIPT] = "SCRIPT";
|
8326 | SecurityContext[SecurityContext.URL] = "URL";
|
8327 | SecurityContext[SecurityContext.RESOURCE_URL] = "RESOURCE_URL";
|
8328 |
|
8329 |
|
8330 |
|
8331 |
|
8332 |
|
8333 |
|
8334 | var Sanitizer = (function () {
|
8335 | function Sanitizer() {
|
8336 | }
|
8337 | |
8338 |
|
8339 |
|
8340 |
|
8341 |
|
8342 |
|
8343 | Sanitizer.prototype.sanitize = function (context, value) { };
|
8344 | return Sanitizer;
|
8345 | }());
|
8346 |
|
8347 |
|
8348 |
|
8349 |
|
8350 |
|
8351 |
|
8352 |
|
8353 |
|
8354 |
|
8355 |
|
8356 |
|
8357 |
|
8358 |
|
8359 |
|
8360 |
|
8361 |
|
8362 |
|
8363 |
|
8364 |
|
8365 |
|
8366 |
|
8367 |
|
8368 |
|
8369 |
|
8370 | function asTextData(view, index) {
|
8371 | return (view.nodes[index]);
|
8372 | }
|
8373 |
|
8374 |
|
8375 |
|
8376 |
|
8377 |
|
8378 |
|
8379 | function asElementData(view, index) {
|
8380 | return (view.nodes[index]);
|
8381 | }
|
8382 |
|
8383 |
|
8384 |
|
8385 |
|
8386 |
|
8387 |
|
8388 | function asProviderData(view, index) {
|
8389 | return (view.nodes[index]);
|
8390 | }
|
8391 |
|
8392 |
|
8393 |
|
8394 |
|
8395 |
|
8396 |
|
8397 | function asPureExpressionData(view, index) {
|
8398 | return (view.nodes[index]);
|
8399 | }
|
8400 |
|
8401 |
|
8402 |
|
8403 |
|
8404 |
|
8405 |
|
8406 | function asQueryList(view, index) {
|
8407 | return (view.nodes[index]);
|
8408 | }
|
8409 |
|
8410 |
|
8411 |
|
8412 | var DebugContext = (function () {
|
8413 | function DebugContext() {
|
8414 | }
|
8415 | |
8416 |
|
8417 |
|
8418 |
|
8419 | DebugContext.prototype.view = function () { };
|
8420 | |
8421 |
|
8422 |
|
8423 |
|
8424 | DebugContext.prototype.nodeIndex = function () { };
|
8425 | |
8426 |
|
8427 |
|
8428 |
|
8429 | DebugContext.prototype.injector = function () { };
|
8430 | |
8431 |
|
8432 |
|
8433 |
|
8434 | DebugContext.prototype.component = function () { };
|
8435 | |
8436 |
|
8437 |
|
8438 |
|
8439 | DebugContext.prototype.providerTokens = function () { };
|
8440 | |
8441 |
|
8442 |
|
8443 |
|
8444 | DebugContext.prototype.references = function () { };
|
8445 | |
8446 |
|
8447 |
|
8448 |
|
8449 | DebugContext.prototype.context = function () { };
|
8450 | |
8451 |
|
8452 |
|
8453 |
|
8454 | DebugContext.prototype.componentRenderElement = function () { };
|
8455 | |
8456 |
|
8457 |
|
8458 |
|
8459 | DebugContext.prototype.renderNode = function () { };
|
8460 | |
8461 |
|
8462 |
|
8463 |
|
8464 |
|
8465 |
|
8466 | DebugContext.prototype.logError = function (console) {
|
8467 | var values = [];
|
8468 | for (var _i = 1; _i < arguments.length; _i++) {
|
8469 | values[_i - 1] = arguments[_i];
|
8470 | }
|
8471 | };
|
8472 | return DebugContext;
|
8473 | }());
|
8474 |
|
8475 |
|
8476 |
|
8477 |
|
8478 | var Services = {
|
8479 | setCurrentNode: undefined,
|
8480 | createRootView: undefined,
|
8481 | createEmbeddedView: undefined,
|
8482 | createComponentView: undefined,
|
8483 | createNgModuleRef: undefined,
|
8484 | overrideProvider: undefined,
|
8485 | clearProviderOverrides: undefined,
|
8486 | checkAndUpdateView: undefined,
|
8487 | checkNoChangesView: undefined,
|
8488 | destroyView: undefined,
|
8489 | resolveDep: undefined,
|
8490 | createDebugContext: undefined,
|
8491 | handleEvent: undefined,
|
8492 | updateDirectives: undefined,
|
8493 | updateRenderer: undefined,
|
8494 | dirtyParentQueries: undefined,
|
8495 | };
|
8496 |
|
8497 |
|
8498 |
|
8499 |
|
8500 |
|
8501 |
|
8502 |
|
8503 |
|
8504 |
|
8505 |
|
8506 |
|
8507 |
|
8508 |
|
8509 |
|
8510 | function expressionChangedAfterItHasBeenCheckedError(context, oldValue, currValue, isFirstCheck) {
|
8511 | var msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
|
8512 | if (isFirstCheck) {
|
8513 | msg +=
|
8514 | " It seems like the view has been created after its parent and its children have been dirty checked." +
|
8515 | " Has it been created in a change detection hook ?";
|
8516 | }
|
8517 | return viewDebugError(msg, context);
|
8518 | }
|
8519 |
|
8520 |
|
8521 |
|
8522 |
|
8523 |
|
8524 | function viewWrappedDebugError(err, context) {
|
8525 | if (!(err instanceof Error)) {
|
8526 |
|
8527 |
|
8528 | err = new Error(err.toString());
|
8529 | }
|
8530 | _addDebugContext(err, context);
|
8531 | return err;
|
8532 | }
|
8533 |
|
8534 |
|
8535 |
|
8536 |
|
8537 |
|
8538 | function viewDebugError(msg, context) {
|
8539 | var err = new Error(msg);
|
8540 | _addDebugContext(err, context);
|
8541 | return err;
|
8542 | }
|
8543 |
|
8544 |
|
8545 |
|
8546 |
|
8547 |
|
8548 | function _addDebugContext(err, context) {
|
8549 | ((err))[ERROR_DEBUG_CONTEXT] = context;
|
8550 | ((err))[ERROR_LOGGER] = context.logError.bind(context);
|
8551 | }
|
8552 |
|
8553 |
|
8554 |
|
8555 |
|
8556 | function isViewDebugError(err) {
|
8557 | return !!getDebugContext(err);
|
8558 | }
|
8559 |
|
8560 |
|
8561 |
|
8562 |
|
8563 | function viewDestroyedError(action) {
|
8564 | return new Error("ViewDestroyedError: Attempt to use a destroyed view: " + action);
|
8565 | }
|
8566 |
|
8567 |
|
8568 |
|
8569 |
|
8570 |
|
8571 |
|
8572 |
|
8573 | var NOOP = function () { };
|
8574 | var _tokenKeyCache = new Map();
|
8575 |
|
8576 |
|
8577 |
|
8578 |
|
8579 | function tokenKey(token) {
|
8580 | var key = _tokenKeyCache.get(token);
|
8581 | if (!key) {
|
8582 | key = stringify(token) + '_' + _tokenKeyCache.size;
|
8583 | _tokenKeyCache.set(token, key);
|
8584 | }
|
8585 | return key;
|
8586 | }
|
8587 |
|
8588 |
|
8589 |
|
8590 |
|
8591 |
|
8592 |
|
8593 |
|
8594 | function unwrapValue(view, nodeIdx, bindingIdx, value) {
|
8595 | if (value instanceof WrappedValue) {
|
8596 | value = value.wrapped;
|
8597 | var globalBindingIdx = view.def.nodes[nodeIdx].bindingIndex + bindingIdx;
|
8598 | var oldValue = view.oldValues[globalBindingIdx];
|
8599 | if (oldValue instanceof WrappedValue) {
|
8600 | oldValue = oldValue.wrapped;
|
8601 | }
|
8602 | view.oldValues[globalBindingIdx] = new WrappedValue(oldValue);
|
8603 | }
|
8604 | return value;
|
8605 | }
|
8606 | var UNDEFINED_RENDERER_TYPE_ID = '$$undefined';
|
8607 | var EMPTY_RENDERER_TYPE_ID = '$$empty';
|
8608 |
|
8609 |
|
8610 |
|
8611 |
|
8612 | function createRendererType2(values) {
|
8613 | return {
|
8614 | id: UNDEFINED_RENDERER_TYPE_ID,
|
8615 | styles: values.styles,
|
8616 | encapsulation: values.encapsulation,
|
8617 | data: values.data
|
8618 | };
|
8619 | }
|
8620 | var _renderCompCount = 0;
|
8621 |
|
8622 |
|
8623 |
|
8624 |
|
8625 | function resolveRendererType2(type) {
|
8626 | if (type && type.id === UNDEFINED_RENDERER_TYPE_ID) {
|
8627 |
|
8628 | var isFilled = ((type.encapsulation != null && type.encapsulation !== ViewEncapsulation.None) ||
|
8629 | type.styles.length || Object.keys(type.data).length);
|
8630 | if (isFilled) {
|
8631 | type.id = "c" + _renderCompCount++;
|
8632 | }
|
8633 | else {
|
8634 | type.id = EMPTY_RENDERER_TYPE_ID;
|
8635 | }
|
8636 | }
|
8637 | if (type && type.id === EMPTY_RENDERER_TYPE_ID) {
|
8638 | type = null;
|
8639 | }
|
8640 | return type || null;
|
8641 | }
|
8642 |
|
8643 |
|
8644 |
|
8645 |
|
8646 |
|
8647 |
|
8648 |
|
8649 | function checkBinding(view, def, bindingIdx, value) {
|
8650 | var oldValues = view.oldValues;
|
8651 | if ((view.state & 2 ) ||
|
8652 | !looseIdentical(oldValues[def.bindingIndex + bindingIdx], value)) {
|
8653 | return true;
|
8654 | }
|
8655 | return false;
|
8656 | }
|
8657 |
|
8658 |
|
8659 |
|
8660 |
|
8661 |
|
8662 |
|
8663 |
|
8664 | function checkAndUpdateBinding(view, def, bindingIdx, value) {
|
8665 | if (checkBinding(view, def, bindingIdx, value)) {
|
8666 | view.oldValues[def.bindingIndex + bindingIdx] = value;
|
8667 | return true;
|
8668 | }
|
8669 | return false;
|
8670 | }
|
8671 |
|
8672 |
|
8673 |
|
8674 |
|
8675 |
|
8676 |
|
8677 |
|
8678 | function checkBindingNoChanges(view, def, bindingIdx, value) {
|
8679 | var oldValue = view.oldValues[def.bindingIndex + bindingIdx];
|
8680 | if ((view.state & 1 ) || !devModeEqual(oldValue, value)) {
|
8681 | throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, def.index), oldValue, value, (view.state & 1 ) !== 0);
|
8682 | }
|
8683 | }
|
8684 |
|
8685 |
|
8686 |
|
8687 |
|
8688 | function markParentViewsForCheck(view) {
|
8689 | var currView = view;
|
8690 | while (currView) {
|
8691 | if (currView.def.flags & 2 ) {
|
8692 | currView.state |= 8 ;
|
8693 | }
|
8694 | currView = currView.viewContainerParent || currView.parent;
|
8695 | }
|
8696 | }
|
8697 |
|
8698 |
|
8699 |
|
8700 |
|
8701 |
|
8702 | function markParentViewsForCheckProjectedViews(view, endView) {
|
8703 | var currView = view;
|
8704 | while (currView && currView !== endView) {
|
8705 | currView.state |= 64 ;
|
8706 | currView = currView.viewContainerParent || currView.parent;
|
8707 | }
|
8708 | }
|
8709 |
|
8710 |
|
8711 |
|
8712 |
|
8713 |
|
8714 |
|
8715 |
|
8716 | function dispatchEvent(view, nodeIndex, eventName, event) {
|
8717 | var nodeDef = view.def.nodes[nodeIndex];
|
8718 | var startView = nodeDef.flags & 33554432 ? asElementData(view, nodeIndex).componentView : view;
|
8719 | markParentViewsForCheck(startView);
|
8720 | return Services.handleEvent(view, nodeIndex, eventName, event);
|
8721 | }
|
8722 |
|
8723 |
|
8724 |
|
8725 |
|
8726 | function declaredViewContainer(view) {
|
8727 | if (view.parent) {
|
8728 | var parentView = view.parent;
|
8729 | return asElementData(parentView, ((view.parentNodeDef)).index);
|
8730 | }
|
8731 | return null;
|
8732 | }
|
8733 |
|
8734 |
|
8735 |
|
8736 |
|
8737 |
|
8738 |
|
8739 |
|
8740 | function viewParentEl(view) {
|
8741 | var parentView = view.parent;
|
8742 | if (parentView) {
|
8743 | return ((view.parentNodeDef)).parent;
|
8744 | }
|
8745 | else {
|
8746 | return null;
|
8747 | }
|
8748 | }
|
8749 |
|
8750 |
|
8751 |
|
8752 |
|
8753 |
|
8754 | function renderNode(view, def) {
|
8755 | switch (def.flags & 201347067 ) {
|
8756 | case 1 :
|
8757 | return asElementData(view, def.index).renderElement;
|
8758 | case 2 :
|
8759 | return asTextData(view, def.index).renderText;
|
8760 | }
|
8761 | }
|
8762 |
|
8763 |
|
8764 |
|
8765 |
|
8766 |
|
8767 | function elementEventFullName(target, name) {
|
8768 | return target ? target + ":" + name : name;
|
8769 | }
|
8770 |
|
8771 |
|
8772 |
|
8773 |
|
8774 | function isComponentView(view) {
|
8775 | return !!view.parent && !!(((view.parentNodeDef)).flags & 32768 );
|
8776 | }
|
8777 |
|
8778 |
|
8779 |
|
8780 |
|
8781 | function isEmbeddedView(view) {
|
8782 | return !!view.parent && !(((view.parentNodeDef)).flags & 32768 );
|
8783 | }
|
8784 |
|
8785 |
|
8786 |
|
8787 |
|
8788 | function filterQueryId(queryId) {
|
8789 | return 1 << (queryId % 32);
|
8790 | }
|
8791 |
|
8792 |
|
8793 |
|
8794 |
|
8795 | function splitMatchedQueriesDsl(matchedQueriesDsl) {
|
8796 | var matchedQueries = {};
|
8797 | var matchedQueryIds = 0;
|
8798 | var references = {};
|
8799 | if (matchedQueriesDsl) {
|
8800 | matchedQueriesDsl.forEach(function (_a) {
|
8801 | var queryId = _a[0], valueType = _a[1];
|
8802 | if (typeof queryId === 'number') {
|
8803 | matchedQueries[queryId] = valueType;
|
8804 | matchedQueryIds |= filterQueryId(queryId);
|
8805 | }
|
8806 | else {
|
8807 | references[queryId] = valueType;
|
8808 | }
|
8809 | });
|
8810 | }
|
8811 | return { matchedQueries: matchedQueries, references: references, matchedQueryIds: matchedQueryIds };
|
8812 | }
|
8813 |
|
8814 |
|
8815 |
|
8816 |
|
8817 | function splitDepsDsl(deps) {
|
8818 | return deps.map(function (value) {
|
8819 | var token;
|
8820 | var flags;
|
8821 | if (Array.isArray(value)) {
|
8822 | flags = value[0], token = value[1];
|
8823 | }
|
8824 | else {
|
8825 | flags = 0 ;
|
8826 | token = value;
|
8827 | }
|
8828 | return { flags: flags, token: token, tokenKey: tokenKey(token) };
|
8829 | });
|
8830 | }
|
8831 |
|
8832 |
|
8833 |
|
8834 |
|
8835 |
|
8836 |
|
8837 | function getParentRenderElement(view, renderHost, def) {
|
8838 | var renderParent = def.renderParent;
|
8839 | if (renderParent) {
|
8840 | if ((renderParent.flags & 1 ) === 0 ||
|
8841 | (renderParent.flags & 33554432 ) === 0 ||
|
8842 | (((renderParent.element)).componentRendererType && ((((renderParent.element)).componentRendererType)).encapsulation ===
|
8843 | ViewEncapsulation.Native)) {
|
8844 |
|
8845 |
|
8846 | return asElementData(view, ((def.renderParent)).index).renderElement;
|
8847 | }
|
8848 | }
|
8849 | else {
|
8850 | return renderHost;
|
8851 | }
|
8852 | }
|
8853 | var DEFINITION_CACHE = new WeakMap();
|
8854 |
|
8855 |
|
8856 |
|
8857 |
|
8858 |
|
8859 | function resolveDefinition(factory) {
|
8860 | var value = (((DEFINITION_CACHE.get(factory))));
|
8861 | if (!value) {
|
8862 | value = factory(function () { return NOOP; });
|
8863 | value.factory = factory;
|
8864 | DEFINITION_CACHE.set(factory, value);
|
8865 | }
|
8866 | return value;
|
8867 | }
|
8868 |
|
8869 |
|
8870 |
|
8871 |
|
8872 | function rootRenderNodes(view) {
|
8873 | var renderNodes = [];
|
8874 | visitRootRenderNodes(view, 0 , undefined, undefined, renderNodes);
|
8875 | return renderNodes;
|
8876 | }
|
8877 |
|
8878 |
|
8879 |
|
8880 |
|
8881 |
|
8882 |
|
8883 |
|
8884 |
|
8885 | function visitRootRenderNodes(view, action, parentNode, nextSibling, target) {
|
8886 |
|
8887 | if (action === 3 ) {
|
8888 | parentNode = view.renderer.parentNode(renderNode(view, ((view.def.lastRenderRootNode))));
|
8889 | }
|
8890 | visitSiblingRenderNodes(view, action, 0, view.def.nodes.length - 1, parentNode, nextSibling, target);
|
8891 | }
|
8892 |
|
8893 |
|
8894 |
|
8895 |
|
8896 |
|
8897 |
|
8898 |
|
8899 |
|
8900 |
|
8901 |
|
8902 | function visitSiblingRenderNodes(view, action, startIndex, endIndex, parentNode, nextSibling, target) {
|
8903 | for (var i = startIndex; i <= endIndex; i++) {
|
8904 | var nodeDef = view.def.nodes[i];
|
8905 | if (nodeDef.flags & (1 | 2 | 8 )) {
|
8906 | visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target);
|
8907 | }
|
8908 |
|
8909 | i += nodeDef.childCount;
|
8910 | }
|
8911 | }
|
8912 |
|
8913 |
|
8914 |
|
8915 |
|
8916 |
|
8917 |
|
8918 |
|
8919 |
|
8920 |
|
8921 | function visitProjectedRenderNodes(view, ngContentIndex, action, parentNode, nextSibling, target) {
|
8922 | var compView = view;
|
8923 | while (compView && !isComponentView(compView)) {
|
8924 | compView = compView.parent;
|
8925 | }
|
8926 | var hostView = ((compView)).parent;
|
8927 | var hostElDef = viewParentEl( ((compView)));
|
8928 | var startIndex = ((hostElDef)).index + 1;
|
8929 | var endIndex = ((hostElDef)).index + ((hostElDef)).childCount;
|
8930 | for (var i = startIndex; i <= endIndex; i++) {
|
8931 | var nodeDef = ((hostView)).def.nodes[i];
|
8932 | if (nodeDef.ngContentIndex === ngContentIndex) {
|
8933 | visitRenderNode( ((hostView)), nodeDef, action, parentNode, nextSibling, target);
|
8934 | }
|
8935 |
|
8936 | i += nodeDef.childCount;
|
8937 | }
|
8938 | if (!((hostView)).parent) {
|
8939 |
|
8940 | var projectedNodes = view.root.projectableNodes[ngContentIndex];
|
8941 | if (projectedNodes) {
|
8942 | for (var i = 0; i < projectedNodes.length; i++) {
|
8943 | execRenderNodeAction(view, projectedNodes[i], action, parentNode, nextSibling, target);
|
8944 | }
|
8945 | }
|
8946 | }
|
8947 | }
|
8948 |
|
8949 |
|
8950 |
|
8951 |
|
8952 |
|
8953 |
|
8954 |
|
8955 |
|
8956 |
|
8957 | function visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target) {
|
8958 | if (nodeDef.flags & 8 ) {
|
8959 | visitProjectedRenderNodes(view, ((nodeDef.ngContent)).index, action, parentNode, nextSibling, target);
|
8960 | }
|
8961 | else {
|
8962 | var rn = renderNode(view, nodeDef);
|
8963 | if (action === 3 && (nodeDef.flags & 33554432 ) &&
|
8964 | (nodeDef.bindingFlags & 48 )) {
|
8965 |
|
8966 | if (nodeDef.bindingFlags & (16 )) {
|
8967 | execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
|
8968 | }
|
8969 | if (nodeDef.bindingFlags & (32 )) {
|
8970 | var compView = asElementData(view, nodeDef.index).componentView;
|
8971 | execRenderNodeAction(compView, rn, action, parentNode, nextSibling, target);
|
8972 | }
|
8973 | }
|
8974 | else {
|
8975 | execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
|
8976 | }
|
8977 | if (nodeDef.flags & 16777216 ) {
|
8978 | var embeddedViews = ((asElementData(view, nodeDef.index).viewContainer))._embeddedViews;
|
8979 | for (var k = 0; k < embeddedViews.length; k++) {
|
8980 | visitRootRenderNodes(embeddedViews[k], action, parentNode, nextSibling, target);
|
8981 | }
|
8982 | }
|
8983 | if (nodeDef.flags & 1 && !((nodeDef.element)).name) {
|
8984 | visitSiblingRenderNodes(view, action, nodeDef.index + 1, nodeDef.index + nodeDef.childCount, parentNode, nextSibling, target);
|
8985 | }
|
8986 | }
|
8987 | }
|
8988 |
|
8989 |
|
8990 |
|
8991 |
|
8992 |
|
8993 |
|
8994 |
|
8995 |
|
8996 |
|
8997 | function execRenderNodeAction(view, renderNode, action, parentNode, nextSibling, target) {
|
8998 | var renderer = view.renderer;
|
8999 | switch (action) {
|
9000 | case 1 :
|
9001 | renderer.appendChild(parentNode, renderNode);
|
9002 | break;
|
9003 | case 2 :
|
9004 | renderer.insertBefore(parentNode, renderNode, nextSibling);
|
9005 | break;
|
9006 | case 3 :
|
9007 | renderer.removeChild(parentNode, renderNode);
|
9008 | break;
|
9009 | case 0 :
|
9010 | ((target)).push(renderNode);
|
9011 | break;
|
9012 | }
|
9013 | }
|
9014 | var NS_PREFIX_RE = /^:([^:]+):(.+)$/;
|
9015 |
|
9016 |
|
9017 |
|
9018 |
|
9019 | function splitNamespace(name) {
|
9020 | if (name[0] === ':') {
|
9021 | var match = ((name.match(NS_PREFIX_RE)));
|
9022 | return [match[1], match[2]];
|
9023 | }
|
9024 | return ['', name];
|
9025 | }
|
9026 |
|
9027 |
|
9028 |
|
9029 |
|
9030 | function calcBindingFlags(bindings) {
|
9031 | var flags = 0;
|
9032 | for (var i = 0; i < bindings.length; i++) {
|
9033 | flags |= bindings[i].flags;
|
9034 | }
|
9035 | return flags;
|
9036 | }
|
9037 |
|
9038 |
|
9039 |
|
9040 |
|
9041 |
|
9042 | function interpolate(valueCount, constAndInterp) {
|
9043 | var result = '';
|
9044 | for (var i = 0; i < valueCount * 2; i = i + 2) {
|
9045 | result = result + constAndInterp[i] + _toStringWithNull(constAndInterp[i + 1]);
|
9046 | }
|
9047 | return result + constAndInterp[valueCount * 2];
|
9048 | }
|
9049 |
|
9050 |
|
9051 |
|
9052 |
|
9053 |
|
9054 |
|
9055 |
|
9056 |
|
9057 |
|
9058 |
|
9059 |
|
9060 |
|
9061 |
|
9062 |
|
9063 |
|
9064 |
|
9065 |
|
9066 |
|
9067 |
|
9068 |
|
9069 |
|
9070 |
|
9071 |
|
9072 | function inlineInterpolate(valueCount, c0, a1, c1, a2, c2, a3, c3, a4, c4, a5, c5, a6, c6, a7, c7, a8, c8, a9, c9) {
|
9073 | switch (valueCount) {
|
9074 | case 1:
|
9075 | return c0 + _toStringWithNull(a1) + c1;
|
9076 | case 2:
|
9077 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2;
|
9078 | case 3:
|
9079 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9080 | c3;
|
9081 | case 4:
|
9082 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9083 | c3 + _toStringWithNull(a4) + c4;
|
9084 | case 5:
|
9085 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9086 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5;
|
9087 | case 6:
|
9088 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9089 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6;
|
9090 | case 7:
|
9091 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9092 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
9093 | c6 + _toStringWithNull(a7) + c7;
|
9094 | case 8:
|
9095 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9096 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
9097 | c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8;
|
9098 | case 9:
|
9099 | return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
|
9100 | c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
|
9101 | c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) + c9;
|
9102 | default:
|
9103 | throw new Error("Does not support more than 9 expressions");
|
9104 | }
|
9105 | }
|
9106 |
|
9107 |
|
9108 |
|
9109 |
|
9110 | function _toStringWithNull(v) {
|
9111 | return v != null ? v.toString() : '';
|
9112 | }
|
9113 | var EMPTY_ARRAY = [];
|
9114 | var EMPTY_MAP = {};
|
9115 |
|
9116 |
|
9117 |
|
9118 |
|
9119 |
|
9120 |
|
9121 |
|
9122 |
|
9123 |
|
9124 |
|
9125 |
|
9126 |
|
9127 |
|
9128 |
|
9129 |
|
9130 |
|
9131 | function anchorDef(flags, matchedQueriesDsl, ngContentIndex, childCount, handleEvent, templateFactory) {
|
9132 | flags |= 1 ;
|
9133 | var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
|
9134 | var template = templateFactory ? resolveDefinition(templateFactory) : null;
|
9135 | return {
|
9136 |
|
9137 | index: -1,
|
9138 | parent: null,
|
9139 | renderParent: null,
|
9140 | bindingIndex: -1,
|
9141 | outputIndex: -1,
|
9142 |
|
9143 | flags: flags,
|
9144 | childFlags: 0,
|
9145 | directChildFlags: 0,
|
9146 | childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount,
|
9147 | bindings: [],
|
9148 | bindingFlags: 0,
|
9149 | outputs: [],
|
9150 | element: {
|
9151 | ns: null,
|
9152 | name: null,
|
9153 | attrs: null, template: template,
|
9154 | componentProvider: null,
|
9155 | componentView: null,
|
9156 | componentRendererType: null,
|
9157 | publicProviders: null,
|
9158 | allProviders: null,
|
9159 | handleEvent: handleEvent || NOOP
|
9160 | },
|
9161 | provider: null,
|
9162 | text: null,
|
9163 | query: null,
|
9164 | ngContent: null
|
9165 | };
|
9166 | }
|
9167 |
|
9168 |
|
9169 |
|
9170 |
|
9171 |
|
9172 |
|
9173 |
|
9174 |
|
9175 |
|
9176 |
|
9177 |
|
9178 |
|
9179 |
|
9180 |
|
9181 | function elementDef(flags, matchedQueriesDsl, ngContentIndex, childCount, namespaceAndName, fixedAttrs, bindings, outputs, handleEvent, componentView, componentRendererType) {
|
9182 | if (fixedAttrs === void 0) { fixedAttrs = []; }
|
9183 | if (!handleEvent) {
|
9184 | handleEvent = NOOP;
|
9185 | }
|
9186 | var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
|
9187 | var ns = ((null));
|
9188 | var name = ((null));
|
9189 | if (namespaceAndName) {
|
9190 | _b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1];
|
9191 | }
|
9192 | bindings = bindings || [];
|
9193 | var bindingDefs = new Array(bindings.length);
|
9194 | for (var i = 0; i < bindings.length; i++) {
|
9195 | var _c = bindings[i], bindingFlags = _c[0], namespaceAndName_1 = _c[1], suffixOrSecurityContext = _c[2];
|
9196 | var _d = splitNamespace(namespaceAndName_1), ns_1 = _d[0], name_1 = _d[1];
|
9197 | var securityContext = ((undefined));
|
9198 | var suffix = ((undefined));
|
9199 | switch (bindingFlags & 15 ) {
|
9200 | case 4 :
|
9201 | suffix = (suffixOrSecurityContext);
|
9202 | break;
|
9203 | case 1 :
|
9204 | case 8 :
|
9205 | securityContext = (suffixOrSecurityContext);
|
9206 | break;
|
9207 | }
|
9208 | bindingDefs[i] =
|
9209 | { flags: bindingFlags, ns: ns_1, name: name_1, nonMinifiedName: name_1, securityContext: securityContext, suffix: suffix };
|
9210 | }
|
9211 | outputs = outputs || [];
|
9212 | var outputDefs = new Array(outputs.length);
|
9213 | for (var i = 0; i < outputs.length; i++) {
|
9214 | var _e = outputs[i], target = _e[0], eventName = _e[1];
|
9215 | outputDefs[i] = {
|
9216 | type: 0 ,
|
9217 | target: (target), eventName: eventName,
|
9218 | propName: null
|
9219 | };
|
9220 | }
|
9221 | fixedAttrs = fixedAttrs || [];
|
9222 | var attrs = (fixedAttrs.map(function (_a) {
|
9223 | var namespaceAndName = _a[0], value = _a[1];
|
9224 | var _b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1];
|
9225 | return [ns, name, value];
|
9226 | }));
|
9227 | componentRendererType = resolveRendererType2(componentRendererType);
|
9228 | if (componentView) {
|
9229 | flags |= 33554432 ;
|
9230 | }
|
9231 | flags |= 1 ;
|
9232 | return {
|
9233 |
|
9234 | index: -1,
|
9235 | parent: null,
|
9236 | renderParent: null,
|
9237 | bindingIndex: -1,
|
9238 | outputIndex: -1,
|
9239 |
|
9240 | flags: flags,
|
9241 | childFlags: 0,
|
9242 | directChildFlags: 0,
|
9243 | childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount,
|
9244 | bindings: bindingDefs,
|
9245 | bindingFlags: calcBindingFlags(bindingDefs),
|
9246 | outputs: outputDefs,
|
9247 | element: {
|
9248 | ns: ns,
|
9249 | name: name,
|
9250 | attrs: attrs,
|
9251 | template: null,
|
9252 |
|
9253 | componentProvider: null,
|
9254 | componentView: componentView || null,
|
9255 | componentRendererType: componentRendererType,
|
9256 | publicProviders: null,
|
9257 | allProviders: null,
|
9258 | handleEvent: handleEvent || NOOP,
|
9259 | },
|
9260 | provider: null,
|
9261 | text: null,
|
9262 | query: null,
|
9263 | ngContent: null
|
9264 | };
|
9265 | var _b;
|
9266 | }
|
9267 |
|
9268 |
|
9269 |
|
9270 |
|
9271 |
|
9272 |
|
9273 | function createElement(view, renderHost, def) {
|
9274 | var elDef = ((def.element));
|
9275 | var rootSelectorOrNode = view.root.selectorOrNode;
|
9276 | var renderer = view.renderer;
|
9277 | var el;
|
9278 | if (view.parent || !rootSelectorOrNode) {
|
9279 | if (elDef.name) {
|
9280 | el = renderer.createElement(elDef.name, elDef.ns);
|
9281 | }
|
9282 | else {
|
9283 | el = renderer.createComment('');
|
9284 | }
|
9285 | var parentEl = getParentRenderElement(view, renderHost, def);
|
9286 | if (parentEl) {
|
9287 | renderer.appendChild(parentEl, el);
|
9288 | }
|
9289 | }
|
9290 | else {
|
9291 | el = renderer.selectRootElement(rootSelectorOrNode);
|
9292 | }
|
9293 | if (elDef.attrs) {
|
9294 | for (var i = 0; i < elDef.attrs.length; i++) {
|
9295 | var _a = elDef.attrs[i], ns = _a[0], name = _a[1], value = _a[2];
|
9296 | renderer.setAttribute(el, name, value, ns);
|
9297 | }
|
9298 | }
|
9299 | return el;
|
9300 | }
|
9301 |
|
9302 |
|
9303 |
|
9304 |
|
9305 |
|
9306 |
|
9307 |
|
9308 | function listenToElementOutputs(view, compView, def, el) {
|
9309 | for (var i = 0; i < def.outputs.length; i++) {
|
9310 | var output = def.outputs[i];
|
9311 | var handleEventClosure = renderEventHandlerClosure(view, def.index, elementEventFullName(output.target, output.eventName));
|
9312 | var listenTarget = output.target;
|
9313 | var listenerView = view;
|
9314 | if (output.target === 'component') {
|
9315 | listenTarget = null;
|
9316 | listenerView = compView;
|
9317 | }
|
9318 | var disposable = (listenerView.renderer.listen(listenTarget || el, output.eventName, handleEventClosure));
|
9319 | ((view.disposables))[def.outputIndex + i] = disposable;
|
9320 | }
|
9321 | }
|
9322 |
|
9323 |
|
9324 |
|
9325 |
|
9326 |
|
9327 |
|
9328 | function renderEventHandlerClosure(view, index, eventName) {
|
9329 | return function (event) {
|
9330 | try {
|
9331 | return dispatchEvent(view, index, eventName, event);
|
9332 | }
|
9333 | catch (e) {
|
9334 |
|
9335 | view.root.errorHandler.handleError(e);
|
9336 | }
|
9337 | };
|
9338 | }
|
9339 |
|
9340 |
|
9341 |
|
9342 |
|
9343 |
|
9344 |
|
9345 |
|
9346 |
|
9347 |
|
9348 |
|
9349 |
|
9350 |
|
9351 |
|
9352 |
|
9353 |
|
9354 | function checkAndUpdateElementInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
9355 | var bindLen = def.bindings.length;
|
9356 | var changed = false;
|
9357 | if (bindLen > 0 && checkAndUpdateElementValue(view, def, 0, v0))
|
9358 | changed = true;
|
9359 | if (bindLen > 1 && checkAndUpdateElementValue(view, def, 1, v1))
|
9360 | changed = true;
|
9361 | if (bindLen > 2 && checkAndUpdateElementValue(view, def, 2, v2))
|
9362 | changed = true;
|
9363 | if (bindLen > 3 && checkAndUpdateElementValue(view, def, 3, v3))
|
9364 | changed = true;
|
9365 | if (bindLen > 4 && checkAndUpdateElementValue(view, def, 4, v4))
|
9366 | changed = true;
|
9367 | if (bindLen > 5 && checkAndUpdateElementValue(view, def, 5, v5))
|
9368 | changed = true;
|
9369 | if (bindLen > 6 && checkAndUpdateElementValue(view, def, 6, v6))
|
9370 | changed = true;
|
9371 | if (bindLen > 7 && checkAndUpdateElementValue(view, def, 7, v7))
|
9372 | changed = true;
|
9373 | if (bindLen > 8 && checkAndUpdateElementValue(view, def, 8, v8))
|
9374 | changed = true;
|
9375 | if (bindLen > 9 && checkAndUpdateElementValue(view, def, 9, v9))
|
9376 | changed = true;
|
9377 | return changed;
|
9378 | }
|
9379 |
|
9380 |
|
9381 |
|
9382 |
|
9383 |
|
9384 |
|
9385 | function checkAndUpdateElementDynamic(view, def, values) {
|
9386 | var changed = false;
|
9387 | for (var i = 0; i < values.length; i++) {
|
9388 | if (checkAndUpdateElementValue(view, def, i, values[i]))
|
9389 | changed = true;
|
9390 | }
|
9391 | return changed;
|
9392 | }
|
9393 |
|
9394 |
|
9395 |
|
9396 |
|
9397 |
|
9398 |
|
9399 |
|
9400 | function checkAndUpdateElementValue(view, def, bindingIdx, value) {
|
9401 | if (!checkAndUpdateBinding(view, def, bindingIdx, value)) {
|
9402 | return false;
|
9403 | }
|
9404 | var binding = def.bindings[bindingIdx];
|
9405 | var elData = asElementData(view, def.index);
|
9406 | var renderNode$$1 = elData.renderElement;
|
9407 | var name = ((binding.name));
|
9408 | switch (binding.flags & 15 ) {
|
9409 | case 1 :
|
9410 | setElementAttribute(view, binding, renderNode$$1, binding.ns, name, value);
|
9411 | break;
|
9412 | case 2 :
|
9413 | setElementClass(view, renderNode$$1, name, value);
|
9414 | break;
|
9415 | case 4 :
|
9416 | setElementStyle(view, binding, renderNode$$1, name, value);
|
9417 | break;
|
9418 | case 8 :
|
9419 | var bindView = (def.flags & 33554432 &&
|
9420 | binding.flags & 32 ) ?
|
9421 | elData.componentView :
|
9422 | view;
|
9423 | setElementProperty(bindView, binding, renderNode$$1, name, value);
|
9424 | break;
|
9425 | }
|
9426 | return true;
|
9427 | }
|
9428 |
|
9429 |
|
9430 |
|
9431 |
|
9432 |
|
9433 |
|
9434 |
|
9435 |
|
9436 |
|
9437 | function setElementAttribute(view, binding, renderNode$$1, ns, name, value) {
|
9438 | var securityContext = binding.securityContext;
|
9439 | var renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
|
9440 | renderValue = renderValue != null ? renderValue.toString() : null;
|
9441 | var renderer = view.renderer;
|
9442 | if (value != null) {
|
9443 | renderer.setAttribute(renderNode$$1, name, renderValue, ns);
|
9444 | }
|
9445 | else {
|
9446 | renderer.removeAttribute(renderNode$$1, name, ns);
|
9447 | }
|
9448 | }
|
9449 |
|
9450 |
|
9451 |
|
9452 |
|
9453 |
|
9454 |
|
9455 |
|
9456 | function setElementClass(view, renderNode$$1, name, value) {
|
9457 | var renderer = view.renderer;
|
9458 | if (value) {
|
9459 | renderer.addClass(renderNode$$1, name);
|
9460 | }
|
9461 | else {
|
9462 | renderer.removeClass(renderNode$$1, name);
|
9463 | }
|
9464 | }
|
9465 |
|
9466 |
|
9467 |
|
9468 |
|
9469 |
|
9470 |
|
9471 |
|
9472 |
|
9473 | function setElementStyle(view, binding, renderNode$$1, name, value) {
|
9474 | var renderValue = view.root.sanitizer.sanitize(SecurityContext.STYLE, (value));
|
9475 | if (renderValue != null) {
|
9476 | renderValue = renderValue.toString();
|
9477 | var unit = binding.suffix;
|
9478 | if (unit != null) {
|
9479 | renderValue = renderValue + unit;
|
9480 | }
|
9481 | }
|
9482 | else {
|
9483 | renderValue = null;
|
9484 | }
|
9485 | var renderer = view.renderer;
|
9486 | if (renderValue != null) {
|
9487 | renderer.setStyle(renderNode$$1, name, renderValue);
|
9488 | }
|
9489 | else {
|
9490 | renderer.removeStyle(renderNode$$1, name);
|
9491 | }
|
9492 | }
|
9493 |
|
9494 |
|
9495 |
|
9496 |
|
9497 |
|
9498 |
|
9499 |
|
9500 |
|
9501 | function setElementProperty(view, binding, renderNode$$1, name, value) {
|
9502 | var securityContext = binding.securityContext;
|
9503 | var renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
|
9504 | view.renderer.setProperty(renderNode$$1, name, renderValue);
|
9505 | }
|
9506 |
|
9507 |
|
9508 |
|
9509 |
|
9510 |
|
9511 |
|
9512 |
|
9513 | var NOT_CREATED$1 = new Object();
|
9514 | var InjectorRefTokenKey$1 = tokenKey(Injector);
|
9515 | var NgModuleRefTokenKey = tokenKey(NgModuleRef);
|
9516 |
|
9517 |
|
9518 |
|
9519 |
|
9520 |
|
9521 |
|
9522 |
|
9523 | function moduleProvideDef(flags, token, value, deps) {
|
9524 | var depDefs = splitDepsDsl(deps);
|
9525 | return {
|
9526 |
|
9527 | index: -1,
|
9528 | deps: depDefs, flags: flags, token: token, value: value
|
9529 | };
|
9530 | }
|
9531 |
|
9532 |
|
9533 |
|
9534 |
|
9535 | function moduleDef(providers) {
|
9536 | var providersByKey = {};
|
9537 | for (var i = 0; i < providers.length; i++) {
|
9538 | var provider = providers[i];
|
9539 | provider.index = i;
|
9540 | providersByKey[tokenKey(provider.token)] = provider;
|
9541 | }
|
9542 | return {
|
9543 |
|
9544 | factory: null,
|
9545 | providersByKey: providersByKey,
|
9546 | providers: providers
|
9547 | };
|
9548 | }
|
9549 |
|
9550 |
|
9551 |
|
9552 |
|
9553 | function initNgModule(data) {
|
9554 | var def = data._def;
|
9555 | var providers = data._providers = new Array(def.providers.length);
|
9556 | for (var i = 0; i < def.providers.length; i++) {
|
9557 | var provDef = def.providers[i];
|
9558 | providers[i] = provDef.flags & 4096 ? NOT_CREATED$1 :
|
9559 | _createProviderInstance$1(data, provDef);
|
9560 | }
|
9561 | }
|
9562 |
|
9563 |
|
9564 |
|
9565 |
|
9566 |
|
9567 |
|
9568 | function resolveNgModuleDep(data, depDef, notFoundValue) {
|
9569 | if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
|
9570 | if (depDef.flags & 8 ) {
|
9571 | return depDef.token;
|
9572 | }
|
9573 | if (depDef.flags & 2 ) {
|
9574 | notFoundValue = null;
|
9575 | }
|
9576 | if (depDef.flags & 1 ) {
|
9577 | return data._parent.get(depDef.token, notFoundValue);
|
9578 | }
|
9579 | var tokenKey$$1 = depDef.tokenKey;
|
9580 | switch (tokenKey$$1) {
|
9581 | case InjectorRefTokenKey$1:
|
9582 | case NgModuleRefTokenKey:
|
9583 | return data;
|
9584 | }
|
9585 | var providerDef = data._def.providersByKey[tokenKey$$1];
|
9586 | if (providerDef) {
|
9587 | var providerInstance = data._providers[providerDef.index];
|
9588 | if (providerInstance === NOT_CREATED$1) {
|
9589 | providerInstance = data._providers[providerDef.index] =
|
9590 | _createProviderInstance$1(data, providerDef);
|
9591 | }
|
9592 | return providerInstance;
|
9593 | }
|
9594 | return data._parent.get(depDef.token, notFoundValue);
|
9595 | }
|
9596 |
|
9597 |
|
9598 |
|
9599 |
|
9600 |
|
9601 | function _createProviderInstance$1(ngModule, providerDef) {
|
9602 | var injectable;
|
9603 | switch (providerDef.flags & 201347067 ) {
|
9604 | case 512 :
|
9605 | injectable = _createClass(ngModule, providerDef.value, providerDef.deps);
|
9606 | break;
|
9607 | case 1024 :
|
9608 | injectable = _callFactory(ngModule, providerDef.value, providerDef.deps);
|
9609 | break;
|
9610 | case 2048 :
|
9611 | injectable = resolveNgModuleDep(ngModule, providerDef.deps[0]);
|
9612 | break;
|
9613 | case 256 :
|
9614 | injectable = providerDef.value;
|
9615 | break;
|
9616 | }
|
9617 | return injectable;
|
9618 | }
|
9619 |
|
9620 |
|
9621 |
|
9622 |
|
9623 |
|
9624 |
|
9625 | function _createClass(ngModule, ctor, deps) {
|
9626 | var len = deps.length;
|
9627 | var injectable;
|
9628 | switch (len) {
|
9629 | case 0:
|
9630 | injectable = new ctor();
|
9631 | break;
|
9632 | case 1:
|
9633 | injectable = new ctor(resolveNgModuleDep(ngModule, deps[0]));
|
9634 | break;
|
9635 | case 2:
|
9636 | injectable =
|
9637 | new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
|
9638 | break;
|
9639 | case 3:
|
9640 | injectable = new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
|
9641 | break;
|
9642 | default:
|
9643 | var depValues = new Array(len);
|
9644 | for (var i = 0; i < len; i++) {
|
9645 | depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
|
9646 | }
|
9647 | injectable = new (ctor.bind.apply(ctor, [void 0].concat(depValues)))();
|
9648 | }
|
9649 | return injectable;
|
9650 | }
|
9651 |
|
9652 |
|
9653 |
|
9654 |
|
9655 |
|
9656 |
|
9657 | function _callFactory(ngModule, factory, deps) {
|
9658 | var len = deps.length;
|
9659 | var injectable;
|
9660 | switch (len) {
|
9661 | case 0:
|
9662 | injectable = factory();
|
9663 | break;
|
9664 | case 1:
|
9665 | injectable = factory(resolveNgModuleDep(ngModule, deps[0]));
|
9666 | break;
|
9667 | case 2:
|
9668 | injectable =
|
9669 | factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
|
9670 | break;
|
9671 | case 3:
|
9672 | injectable = factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
|
9673 | break;
|
9674 | default:
|
9675 | var depValues = Array(len);
|
9676 | for (var i = 0; i < len; i++) {
|
9677 | depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
|
9678 | }
|
9679 | injectable = factory.apply(void 0, depValues);
|
9680 | }
|
9681 | return injectable;
|
9682 | }
|
9683 |
|
9684 |
|
9685 |
|
9686 |
|
9687 |
|
9688 | function callNgModuleLifecycle(ngModule, lifecycles) {
|
9689 | var def = ngModule._def;
|
9690 | for (var i = 0; i < def.providers.length; i++) {
|
9691 | var provDef = def.providers[i];
|
9692 | if (provDef.flags & 131072 ) {
|
9693 | var instance = ngModule._providers[i];
|
9694 | if (instance && instance !== NOT_CREATED$1) {
|
9695 | instance.ngOnDestroy();
|
9696 | }
|
9697 | }
|
9698 | }
|
9699 | }
|
9700 |
|
9701 |
|
9702 |
|
9703 |
|
9704 |
|
9705 |
|
9706 |
|
9707 |
|
9708 |
|
9709 |
|
9710 |
|
9711 |
|
9712 |
|
9713 |
|
9714 | function attachEmbeddedView(parentView, elementData, viewIndex, view) {
|
9715 | var embeddedViews = ((elementData.viewContainer))._embeddedViews;
|
9716 | if (viewIndex === null || viewIndex === undefined) {
|
9717 | viewIndex = embeddedViews.length;
|
9718 | }
|
9719 | view.viewContainerParent = parentView;
|
9720 | addToArray(embeddedViews, ((viewIndex)), view);
|
9721 | attachProjectedView(elementData, view);
|
9722 | Services.dirtyParentQueries(view);
|
9723 | var prevView = ((viewIndex)) > 0 ? embeddedViews[((viewIndex)) - 1] : null;
|
9724 | renderAttachEmbeddedView(elementData, prevView, view);
|
9725 | }
|
9726 |
|
9727 |
|
9728 |
|
9729 |
|
9730 |
|
9731 | function attachProjectedView(vcElementData, view) {
|
9732 | var dvcElementData = declaredViewContainer(view);
|
9733 | if (!dvcElementData || dvcElementData === vcElementData ||
|
9734 | view.state & 16 ) {
|
9735 | return;
|
9736 | }
|
9737 |
|
9738 |
|
9739 |
|
9740 |
|
9741 |
|
9742 |
|
9743 |
|
9744 | view.state |= 16 ;
|
9745 | var projectedViews = dvcElementData.template._projectedViews;
|
9746 | if (!projectedViews) {
|
9747 | projectedViews = dvcElementData.template._projectedViews = [];
|
9748 | }
|
9749 | projectedViews.push(view);
|
9750 |
|
9751 |
|
9752 | markNodeAsProjectedTemplate( ((view.parent)).def, ((view.parentNodeDef)));
|
9753 | }
|
9754 |
|
9755 |
|
9756 |
|
9757 |
|
9758 |
|
9759 | function markNodeAsProjectedTemplate(viewDef, nodeDef) {
|
9760 | if (nodeDef.flags & 4 ) {
|
9761 | return;
|
9762 | }
|
9763 | viewDef.nodeFlags |= 4 ;
|
9764 | nodeDef.flags |= 4 ;
|
9765 | var parentNodeDef = nodeDef.parent;
|
9766 | while (parentNodeDef) {
|
9767 | parentNodeDef.childFlags |= 4 ;
|
9768 | parentNodeDef = parentNodeDef.parent;
|
9769 | }
|
9770 | }
|
9771 |
|
9772 |
|
9773 |
|
9774 |
|
9775 |
|
9776 | function detachEmbeddedView(elementData, viewIndex) {
|
9777 | var embeddedViews = ((elementData.viewContainer))._embeddedViews;
|
9778 | if (viewIndex == null || viewIndex >= embeddedViews.length) {
|
9779 | viewIndex = embeddedViews.length - 1;
|
9780 | }
|
9781 | if (viewIndex < 0) {
|
9782 | return null;
|
9783 | }
|
9784 | var view = embeddedViews[viewIndex];
|
9785 | view.viewContainerParent = null;
|
9786 | removeFromArray(embeddedViews, viewIndex);
|
9787 |
|
9788 | Services.dirtyParentQueries(view);
|
9789 | renderDetachView(view);
|
9790 | return view;
|
9791 | }
|
9792 |
|
9793 |
|
9794 |
|
9795 |
|
9796 | function detachProjectedView(view) {
|
9797 | if (!(view.state & 16 )) {
|
9798 | return;
|
9799 | }
|
9800 | var dvcElementData = declaredViewContainer(view);
|
9801 | if (dvcElementData) {
|
9802 | var projectedViews = dvcElementData.template._projectedViews;
|
9803 | if (projectedViews) {
|
9804 | removeFromArray(projectedViews, projectedViews.indexOf(view));
|
9805 | Services.dirtyParentQueries(view);
|
9806 | }
|
9807 | }
|
9808 | }
|
9809 |
|
9810 |
|
9811 |
|
9812 |
|
9813 |
|
9814 |
|
9815 | function moveEmbeddedView(elementData, oldViewIndex, newViewIndex) {
|
9816 | var embeddedViews = ((elementData.viewContainer))._embeddedViews;
|
9817 | var view = embeddedViews[oldViewIndex];
|
9818 | removeFromArray(embeddedViews, oldViewIndex);
|
9819 | if (newViewIndex == null) {
|
9820 | newViewIndex = embeddedViews.length;
|
9821 | }
|
9822 | addToArray(embeddedViews, newViewIndex, view);
|
9823 |
|
9824 |
|
9825 | Services.dirtyParentQueries(view);
|
9826 | renderDetachView(view);
|
9827 | var prevView = newViewIndex > 0 ? embeddedViews[newViewIndex - 1] : null;
|
9828 | renderAttachEmbeddedView(elementData, prevView, view);
|
9829 | return view;
|
9830 | }
|
9831 |
|
9832 |
|
9833 |
|
9834 |
|
9835 |
|
9836 |
|
9837 | function renderAttachEmbeddedView(elementData, prevView, view) {
|
9838 | var prevRenderNode = prevView ? renderNode(prevView, ((prevView.def.lastRenderRootNode))) :
|
9839 | elementData.renderElement;
|
9840 | var parentNode = view.renderer.parentNode(prevRenderNode);
|
9841 | var nextSibling = view.renderer.nextSibling(prevRenderNode);
|
9842 |
|
9843 |
|
9844 | visitRootRenderNodes(view, 2 , parentNode, nextSibling, undefined);
|
9845 | }
|
9846 |
|
9847 |
|
9848 |
|
9849 |
|
9850 | function renderDetachView(view) {
|
9851 | visitRootRenderNodes(view, 3 , null, null, undefined);
|
9852 | }
|
9853 |
|
9854 |
|
9855 |
|
9856 |
|
9857 |
|
9858 |
|
9859 | function addToArray(arr, index, value) {
|
9860 |
|
9861 | if (index >= arr.length) {
|
9862 | arr.push(value);
|
9863 | }
|
9864 | else {
|
9865 | arr.splice(index, 0, value);
|
9866 | }
|
9867 | }
|
9868 |
|
9869 |
|
9870 |
|
9871 |
|
9872 |
|
9873 | function removeFromArray(arr, index) {
|
9874 |
|
9875 | if (index >= arr.length - 1) {
|
9876 | arr.pop();
|
9877 | }
|
9878 | else {
|
9879 | arr.splice(index, 1);
|
9880 | }
|
9881 | }
|
9882 |
|
9883 |
|
9884 |
|
9885 |
|
9886 |
|
9887 |
|
9888 |
|
9889 | var EMPTY_CONTEXT = new Object();
|
9890 |
|
9891 |
|
9892 |
|
9893 |
|
9894 |
|
9895 |
|
9896 |
|
9897 |
|
9898 |
|
9899 | function createComponentFactory(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors) {
|
9900 | return new ComponentFactory_(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors);
|
9901 | }
|
9902 |
|
9903 |
|
9904 |
|
9905 |
|
9906 | function getComponentViewDefinitionFactory(componentFactory) {
|
9907 | return ((componentFactory)).viewDefFactory;
|
9908 | }
|
9909 | var ComponentFactory_ = (function (_super) {
|
9910 | __extends(ComponentFactory_, _super);
|
9911 | |
9912 |
|
9913 |
|
9914 |
|
9915 |
|
9916 |
|
9917 |
|
9918 |
|
9919 | function ComponentFactory_(selector, componentType, viewDefFactory, _inputs, _outputs, ngContentSelectors) {
|
9920 | var _this =
|
9921 |
|
9922 |
|
9923 | _super.call(this) || this;
|
9924 | _this.selector = selector;
|
9925 | _this.componentType = componentType;
|
9926 | _this._inputs = _inputs;
|
9927 | _this._outputs = _outputs;
|
9928 | _this.ngContentSelectors = ngContentSelectors;
|
9929 | _this.viewDefFactory = viewDefFactory;
|
9930 | return _this;
|
9931 | }
|
9932 | Object.defineProperty(ComponentFactory_.prototype, "inputs", {
|
9933 | |
9934 |
|
9935 |
|
9936 | get: function () {
|
9937 | var inputsArr = [];
|
9938 | var inputs = ((this._inputs));
|
9939 | for (var propName in inputs) {
|
9940 | var templateName = inputs[propName];
|
9941 | inputsArr.push({ propName: propName, templateName: templateName });
|
9942 | }
|
9943 | return inputsArr;
|
9944 | },
|
9945 | enumerable: true,
|
9946 | configurable: true
|
9947 | });
|
9948 | Object.defineProperty(ComponentFactory_.prototype, "outputs", {
|
9949 | |
9950 |
|
9951 |
|
9952 | get: function () {
|
9953 | var outputsArr = [];
|
9954 | for (var propName in this._outputs) {
|
9955 | var templateName = this._outputs[propName];
|
9956 | outputsArr.push({ propName: propName, templateName: templateName });
|
9957 | }
|
9958 | return outputsArr;
|
9959 | },
|
9960 | enumerable: true,
|
9961 | configurable: true
|
9962 | });
|
9963 | |
9964 |
|
9965 |
|
9966 |
|
9967 |
|
9968 |
|
9969 |
|
9970 |
|
9971 | ComponentFactory_.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
|
9972 | if (!ngModule) {
|
9973 | throw new Error('ngModule should be provided');
|
9974 | }
|
9975 | var viewDef = resolveDefinition(this.viewDefFactory);
|
9976 | var componentNodeIndex = ((((viewDef.nodes[0].element)).componentProvider)).index;
|
9977 | var view = Services.createRootView(injector, projectableNodes || [], rootSelectorOrNode, viewDef, ngModule, EMPTY_CONTEXT);
|
9978 | var component = asProviderData(view, componentNodeIndex).instance;
|
9979 | if (rootSelectorOrNode) {
|
9980 | view.renderer.setAttribute(asElementData(view, 0).renderElement, 'ng-version', VERSION.full);
|
9981 | }
|
9982 | return new ComponentRef_(view, new ViewRef_(view), component);
|
9983 | };
|
9984 | return ComponentFactory_;
|
9985 | }(ComponentFactory));
|
9986 | var ComponentRef_ = (function (_super) {
|
9987 | __extends(ComponentRef_, _super);
|
9988 | |
9989 |
|
9990 |
|
9991 |
|
9992 |
|
9993 | function ComponentRef_(_view, _viewRef, _component) {
|
9994 | var _this = _super.call(this) || this;
|
9995 | _this._view = _view;
|
9996 | _this._viewRef = _viewRef;
|
9997 | _this._component = _component;
|
9998 | _this._elDef = _this._view.def.nodes[0];
|
9999 | return _this;
|
10000 | }
|
10001 | Object.defineProperty(ComponentRef_.prototype, "location", {
|
10002 | |
10003 |
|
10004 |
|
10005 | get: function () {
|
10006 | return new ElementRef(asElementData(this._view, this._elDef.index).renderElement);
|
10007 | },
|
10008 | enumerable: true,
|
10009 | configurable: true
|
10010 | });
|
10011 | Object.defineProperty(ComponentRef_.prototype, "injector", {
|
10012 | |
10013 |
|
10014 |
|
10015 | get: function () { return new Injector_(this._view, this._elDef); },
|
10016 | enumerable: true,
|
10017 | configurable: true
|
10018 | });
|
10019 | Object.defineProperty(ComponentRef_.prototype, "instance", {
|
10020 | |
10021 |
|
10022 |
|
10023 | get: function () { return this._component; },
|
10024 | enumerable: true,
|
10025 | configurable: true
|
10026 | });
|
10027 |
|
10028 | Object.defineProperty(ComponentRef_.prototype, "hostView", {
|
10029 | |
10030 |
|
10031 |
|
10032 | get: function () { return this._viewRef; },
|
10033 | enumerable: true,
|
10034 | configurable: true
|
10035 | });
|
10036 |
|
10037 | Object.defineProperty(ComponentRef_.prototype, "changeDetectorRef", {
|
10038 | |
10039 |
|
10040 |
|
10041 | get: function () { return this._viewRef; },
|
10042 | enumerable: true,
|
10043 | configurable: true
|
10044 | });
|
10045 |
|
10046 | Object.defineProperty(ComponentRef_.prototype, "componentType", {
|
10047 | |
10048 |
|
10049 |
|
10050 | get: function () { return (this._component.constructor); },
|
10051 | enumerable: true,
|
10052 | configurable: true
|
10053 | });
|
10054 | |
10055 |
|
10056 |
|
10057 | ComponentRef_.prototype.destroy = function () { this._viewRef.destroy(); };
|
10058 | |
10059 |
|
10060 |
|
10061 |
|
10062 | ComponentRef_.prototype.onDestroy = function (callback) { this._viewRef.onDestroy(callback); };
|
10063 | return ComponentRef_;
|
10064 | }(ComponentRef));
|
10065 |
|
10066 |
|
10067 |
|
10068 |
|
10069 |
|
10070 |
|
10071 | function createViewContainerData(view, elDef, elData) {
|
10072 | return new ViewContainerRef_(view, elDef, elData);
|
10073 | }
|
10074 | var ViewContainerRef_ = (function () {
|
10075 | |
10076 |
|
10077 |
|
10078 |
|
10079 |
|
10080 | function ViewContainerRef_(_view, _elDef, _data) {
|
10081 | this._view = _view;
|
10082 | this._elDef = _elDef;
|
10083 | this._data = _data;
|
10084 | |
10085 |
|
10086 |
|
10087 | this._embeddedViews = [];
|
10088 | }
|
10089 | Object.defineProperty(ViewContainerRef_.prototype, "element", {
|
10090 | |
10091 |
|
10092 |
|
10093 | get: function () { return new ElementRef(this._data.renderElement); },
|
10094 | enumerable: true,
|
10095 | configurable: true
|
10096 | });
|
10097 | Object.defineProperty(ViewContainerRef_.prototype, "injector", {
|
10098 | |
10099 |
|
10100 |
|
10101 | get: function () { return new Injector_(this._view, this._elDef); },
|
10102 | enumerable: true,
|
10103 | configurable: true
|
10104 | });
|
10105 | Object.defineProperty(ViewContainerRef_.prototype, "parentInjector", {
|
10106 | |
10107 |
|
10108 |
|
10109 | get: function () {
|
10110 | var view = this._view;
|
10111 | var elDef = this._elDef.parent;
|
10112 | while (!elDef && view) {
|
10113 | elDef = viewParentEl(view);
|
10114 | view = ((view.parent));
|
10115 | }
|
10116 | return view ? new Injector_(view, elDef) : new Injector_(this._view, null);
|
10117 | },
|
10118 | enumerable: true,
|
10119 | configurable: true
|
10120 | });
|
10121 | |
10122 |
|
10123 |
|
10124 | ViewContainerRef_.prototype.clear = function () {
|
10125 | var len = this._embeddedViews.length;
|
10126 | for (var i = len - 1; i >= 0; i--) {
|
10127 | var view = ((detachEmbeddedView(this._data, i)));
|
10128 | Services.destroyView(view);
|
10129 | }
|
10130 | };
|
10131 | |
10132 |
|
10133 |
|
10134 |
|
10135 | ViewContainerRef_.prototype.get = function (index) {
|
10136 | var view = this._embeddedViews[index];
|
10137 | if (view) {
|
10138 | var ref = new ViewRef_(view);
|
10139 | ref.attachToViewContainerRef(this);
|
10140 | return ref;
|
10141 | }
|
10142 | return null;
|
10143 | };
|
10144 | Object.defineProperty(ViewContainerRef_.prototype, "length", {
|
10145 | |
10146 |
|
10147 |
|
10148 | get: function () { return this._embeddedViews.length; },
|
10149 | enumerable: true,
|
10150 | configurable: true
|
10151 | });
|
10152 |
|
10153 | |
10154 |
|
10155 |
|
10156 |
|
10157 |
|
10158 |
|
10159 |
|
10160 | ViewContainerRef_.prototype.createEmbeddedView = function (templateRef, context, index) {
|
10161 | var viewRef = templateRef.createEmbeddedView(context || ({}));
|
10162 | this.insert(viewRef, index);
|
10163 | return viewRef;
|
10164 | };
|
10165 | |
10166 |
|
10167 |
|
10168 |
|
10169 |
|
10170 |
|
10171 |
|
10172 |
|
10173 |
|
10174 | ViewContainerRef_.prototype.createComponent = function (componentFactory, index, injector, projectableNodes, ngModuleRef) {
|
10175 | var contextInjector = injector || this.parentInjector;
|
10176 | if (!ngModuleRef && !(componentFactory instanceof ComponentFactoryBoundToModule)) {
|
10177 | ngModuleRef = contextInjector.get(NgModuleRef);
|
10178 | }
|
10179 | var componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef);
|
10180 | this.insert(componentRef.hostView, index);
|
10181 | return componentRef;
|
10182 | };
|
10183 | |
10184 |
|
10185 |
|
10186 |
|
10187 |
|
10188 | ViewContainerRef_.prototype.insert = function (viewRef, index) {
|
10189 | var viewRef_ = (viewRef);
|
10190 | var viewData = viewRef_._view;
|
10191 | attachEmbeddedView(this._view, this._data, index, viewData);
|
10192 | viewRef_.attachToViewContainerRef(this);
|
10193 | return viewRef;
|
10194 | };
|
10195 | |
10196 |
|
10197 |
|
10198 |
|
10199 |
|
10200 | ViewContainerRef_.prototype.move = function (viewRef, currentIndex) {
|
10201 | var previousIndex = this._embeddedViews.indexOf(viewRef._view);
|
10202 | moveEmbeddedView(this._data, previousIndex, currentIndex);
|
10203 | return viewRef;
|
10204 | };
|
10205 | |
10206 |
|
10207 |
|
10208 |
|
10209 | ViewContainerRef_.prototype.indexOf = function (viewRef) {
|
10210 | return this._embeddedViews.indexOf(((viewRef))._view);
|
10211 | };
|
10212 | |
10213 |
|
10214 |
|
10215 |
|
10216 | ViewContainerRef_.prototype.remove = function (index) {
|
10217 | var viewData = detachEmbeddedView(this._data, index);
|
10218 | if (viewData) {
|
10219 | Services.destroyView(viewData);
|
10220 | }
|
10221 | };
|
10222 | |
10223 |
|
10224 |
|
10225 |
|
10226 | ViewContainerRef_.prototype.detach = function (index) {
|
10227 | var view = detachEmbeddedView(this._data, index);
|
10228 | return view ? new ViewRef_(view) : null;
|
10229 | };
|
10230 | return ViewContainerRef_;
|
10231 | }());
|
10232 |
|
10233 |
|
10234 |
|
10235 |
|
10236 | function createChangeDetectorRef(view) {
|
10237 | return new ViewRef_(view);
|
10238 | }
|
10239 | var ViewRef_ = (function () {
|
10240 | |
10241 |
|
10242 |
|
10243 | function ViewRef_(_view) {
|
10244 | this._view = _view;
|
10245 | this._viewContainerRef = null;
|
10246 | this._appRef = null;
|
10247 | }
|
10248 | Object.defineProperty(ViewRef_.prototype, "rootNodes", {
|
10249 | |
10250 |
|
10251 |
|
10252 | get: function () { return rootRenderNodes(this._view); },
|
10253 | enumerable: true,
|
10254 | configurable: true
|
10255 | });
|
10256 | Object.defineProperty(ViewRef_.prototype, "context", {
|
10257 | |
10258 |
|
10259 |
|
10260 | get: function () { return this._view.context; },
|
10261 | enumerable: true,
|
10262 | configurable: true
|
10263 | });
|
10264 | Object.defineProperty(ViewRef_.prototype, "destroyed", {
|
10265 | |
10266 |
|
10267 |
|
10268 | get: function () { return (this._view.state & 128 ) !== 0; },
|
10269 | enumerable: true,
|
10270 | configurable: true
|
10271 | });
|
10272 | |
10273 |
|
10274 |
|
10275 | ViewRef_.prototype.markForCheck = function () { markParentViewsForCheck(this._view); };
|
10276 | |
10277 |
|
10278 |
|
10279 | ViewRef_.prototype.detach = function () { this._view.state &= ~4 ; };
|
10280 | |
10281 |
|
10282 |
|
10283 | ViewRef_.prototype.detectChanges = function () {
|
10284 | var fs = this._view.root.rendererFactory;
|
10285 | if (fs.begin) {
|
10286 | fs.begin();
|
10287 | }
|
10288 | Services.checkAndUpdateView(this._view);
|
10289 | if (fs.end) {
|
10290 | fs.end();
|
10291 | }
|
10292 | };
|
10293 | |
10294 |
|
10295 |
|
10296 | ViewRef_.prototype.checkNoChanges = function () { Services.checkNoChangesView(this._view); };
|
10297 | |
10298 |
|
10299 |
|
10300 | ViewRef_.prototype.reattach = function () { this._view.state |= 4 ; };
|
10301 | |
10302 |
|
10303 |
|
10304 |
|
10305 | ViewRef_.prototype.onDestroy = function (callback) {
|
10306 | if (!this._view.disposables) {
|
10307 | this._view.disposables = [];
|
10308 | }
|
10309 | this._view.disposables.push( (callback));
|
10310 | };
|
10311 | |
10312 |
|
10313 |
|
10314 | ViewRef_.prototype.destroy = function () {
|
10315 | if (this._appRef) {
|
10316 | this._appRef.detachView(this);
|
10317 | }
|
10318 | else if (this._viewContainerRef) {
|
10319 | this._viewContainerRef.detach(this._viewContainerRef.indexOf(this));
|
10320 | }
|
10321 | Services.destroyView(this._view);
|
10322 | };
|
10323 | |
10324 |
|
10325 |
|
10326 | ViewRef_.prototype.detachFromAppRef = function () {
|
10327 | this._appRef = null;
|
10328 | renderDetachView(this._view);
|
10329 | Services.dirtyParentQueries(this._view);
|
10330 | };
|
10331 | |
10332 |
|
10333 |
|
10334 |
|
10335 | ViewRef_.prototype.attachToAppRef = function (appRef) {
|
10336 | if (this._viewContainerRef) {
|
10337 | throw new Error('This view is already attached to a ViewContainer!');
|
10338 | }
|
10339 | this._appRef = appRef;
|
10340 | };
|
10341 | |
10342 |
|
10343 |
|
10344 |
|
10345 | ViewRef_.prototype.attachToViewContainerRef = function (vcRef) {
|
10346 | if (this._appRef) {
|
10347 | throw new Error('This view is already attached directly to the ApplicationRef!');
|
10348 | }
|
10349 | this._viewContainerRef = vcRef;
|
10350 | };
|
10351 | return ViewRef_;
|
10352 | }());
|
10353 |
|
10354 |
|
10355 |
|
10356 |
|
10357 |
|
10358 | function createTemplateData(view, def) {
|
10359 | return new TemplateRef_(view, def);
|
10360 | }
|
10361 | var TemplateRef_ = (function (_super) {
|
10362 | __extends(TemplateRef_, _super);
|
10363 | |
10364 |
|
10365 |
|
10366 |
|
10367 | function TemplateRef_(_parentView, _def) {
|
10368 | var _this = _super.call(this) || this;
|
10369 | _this._parentView = _parentView;
|
10370 | _this._def = _def;
|
10371 | return _this;
|
10372 | }
|
10373 | |
10374 |
|
10375 |
|
10376 |
|
10377 | TemplateRef_.prototype.createEmbeddedView = function (context) {
|
10378 | return new ViewRef_(Services.createEmbeddedView(this._parentView, this._def, ((((this._def.element)).template)), context));
|
10379 | };
|
10380 | Object.defineProperty(TemplateRef_.prototype, "elementRef", {
|
10381 | |
10382 |
|
10383 |
|
10384 | get: function () {
|
10385 | return new ElementRef(asElementData(this._parentView, this._def.index).renderElement);
|
10386 | },
|
10387 | enumerable: true,
|
10388 | configurable: true
|
10389 | });
|
10390 | return TemplateRef_;
|
10391 | }(TemplateRef));
|
10392 |
|
10393 |
|
10394 |
|
10395 |
|
10396 |
|
10397 | function createInjector(view, elDef) {
|
10398 | return new Injector_(view, elDef);
|
10399 | }
|
10400 | var Injector_ = (function () {
|
10401 | |
10402 |
|
10403 |
|
10404 |
|
10405 | function Injector_(view, elDef) {
|
10406 | this.view = view;
|
10407 | this.elDef = elDef;
|
10408 | }
|
10409 | |
10410 |
|
10411 |
|
10412 |
|
10413 |
|
10414 | Injector_.prototype.get = function (token, notFoundValue) {
|
10415 | if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
|
10416 | var allowPrivateServices = this.elDef ? (this.elDef.flags & 33554432 ) !== 0 : false;
|
10417 | return Services.resolveDep(this.view, this.elDef, allowPrivateServices, { flags: 0 , token: token, tokenKey: tokenKey(token) }, notFoundValue);
|
10418 | };
|
10419 | return Injector_;
|
10420 | }());
|
10421 |
|
10422 |
|
10423 |
|
10424 |
|
10425 |
|
10426 | function nodeValue(view, index) {
|
10427 | var def = view.def.nodes[index];
|
10428 | if (def.flags & 1 ) {
|
10429 | var elData = asElementData(view, def.index);
|
10430 | return ((def.element)).template ? elData.template : elData.renderElement;
|
10431 | }
|
10432 | else if (def.flags & 2 ) {
|
10433 | return asTextData(view, def.index).renderText;
|
10434 | }
|
10435 | else if (def.flags & (20224 | 16 )) {
|
10436 | return asProviderData(view, def.index).instance;
|
10437 | }
|
10438 | throw new Error("Illegal state: read nodeValue for node index " + index);
|
10439 | }
|
10440 |
|
10441 |
|
10442 |
|
10443 |
|
10444 | function createRendererV1(view) {
|
10445 | return new RendererAdapter(view.renderer);
|
10446 | }
|
10447 | var RendererAdapter = (function () {
|
10448 | |
10449 |
|
10450 |
|
10451 | function RendererAdapter(delegate) {
|
10452 | this.delegate = delegate;
|
10453 | }
|
10454 | |
10455 |
|
10456 |
|
10457 |
|
10458 | RendererAdapter.prototype.selectRootElement = function (selectorOrNode) {
|
10459 | return this.delegate.selectRootElement(selectorOrNode);
|
10460 | };
|
10461 | |
10462 |
|
10463 |
|
10464 |
|
10465 |
|
10466 | RendererAdapter.prototype.createElement = function (parent, namespaceAndName) {
|
10467 | var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1];
|
10468 | var el = this.delegate.createElement(name, ns);
|
10469 | if (parent) {
|
10470 | this.delegate.appendChild(parent, el);
|
10471 | }
|
10472 | return el;
|
10473 | };
|
10474 | |
10475 |
|
10476 |
|
10477 |
|
10478 | RendererAdapter.prototype.createViewRoot = function (hostElement) { return hostElement; };
|
10479 | |
10480 |
|
10481 |
|
10482 |
|
10483 | RendererAdapter.prototype.createTemplateAnchor = function (parentElement) {
|
10484 | var comment = this.delegate.createComment('');
|
10485 | if (parentElement) {
|
10486 | this.delegate.appendChild(parentElement, comment);
|
10487 | }
|
10488 | return comment;
|
10489 | };
|
10490 | |
10491 |
|
10492 |
|
10493 |
|
10494 |
|
10495 | RendererAdapter.prototype.createText = function (parentElement, value) {
|
10496 | var node = this.delegate.createText(value);
|
10497 | if (parentElement) {
|
10498 | this.delegate.appendChild(parentElement, node);
|
10499 | }
|
10500 | return node;
|
10501 | };
|
10502 | |
10503 |
|
10504 |
|
10505 |
|
10506 |
|
10507 | RendererAdapter.prototype.projectNodes = function (parentElement, nodes) {
|
10508 | for (var i = 0; i < nodes.length; i++) {
|
10509 | this.delegate.appendChild(parentElement, nodes[i]);
|
10510 | }
|
10511 | };
|
10512 | |
10513 |
|
10514 |
|
10515 |
|
10516 |
|
10517 | RendererAdapter.prototype.attachViewAfter = function (node, viewRootNodes) {
|
10518 | var parentElement = this.delegate.parentNode(node);
|
10519 | var nextSibling = this.delegate.nextSibling(node);
|
10520 | for (var i = 0; i < viewRootNodes.length; i++) {
|
10521 | this.delegate.insertBefore(parentElement, viewRootNodes[i], nextSibling);
|
10522 | }
|
10523 | };
|
10524 | |
10525 |
|
10526 |
|
10527 |
|
10528 | RendererAdapter.prototype.detachView = function (viewRootNodes) {
|
10529 | for (var i = 0; i < viewRootNodes.length; i++) {
|
10530 | var node = viewRootNodes[i];
|
10531 | var parentElement = this.delegate.parentNode(node);
|
10532 | this.delegate.removeChild(parentElement, node);
|
10533 | }
|
10534 | };
|
10535 | |
10536 |
|
10537 |
|
10538 |
|
10539 |
|
10540 | RendererAdapter.prototype.destroyView = function (hostElement, viewAllNodes) {
|
10541 | for (var i = 0; i < viewAllNodes.length; i++) {
|
10542 | ((this.delegate.destroyNode))(viewAllNodes[i]);
|
10543 | }
|
10544 | };
|
10545 | |
10546 |
|
10547 |
|
10548 |
|
10549 |
|
10550 |
|
10551 | RendererAdapter.prototype.listen = function (renderElement, name, callback) {
|
10552 | return this.delegate.listen(renderElement, name, (callback));
|
10553 | };
|
10554 | |
10555 |
|
10556 |
|
10557 |
|
10558 |
|
10559 |
|
10560 | RendererAdapter.prototype.listenGlobal = function (target, name, callback) {
|
10561 | return this.delegate.listen(target, name, (callback));
|
10562 | };
|
10563 | |
10564 |
|
10565 |
|
10566 |
|
10567 |
|
10568 |
|
10569 | RendererAdapter.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) {
|
10570 | this.delegate.setProperty(renderElement, propertyName, propertyValue);
|
10571 | };
|
10572 | |
10573 |
|
10574 |
|
10575 |
|
10576 |
|
10577 |
|
10578 | RendererAdapter.prototype.setElementAttribute = function (renderElement, namespaceAndName, attributeValue) {
|
10579 | var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1];
|
10580 | if (attributeValue != null) {
|
10581 | this.delegate.setAttribute(renderElement, name, attributeValue, ns);
|
10582 | }
|
10583 | else {
|
10584 | this.delegate.removeAttribute(renderElement, name, ns);
|
10585 | }
|
10586 | };
|
10587 | |
10588 |
|
10589 |
|
10590 |
|
10591 |
|
10592 |
|
10593 | RendererAdapter.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) { };
|
10594 | |
10595 |
|
10596 |
|
10597 |
|
10598 |
|
10599 |
|
10600 | RendererAdapter.prototype.setElementClass = function (renderElement, className, isAdd) {
|
10601 | if (isAdd) {
|
10602 | this.delegate.addClass(renderElement, className);
|
10603 | }
|
10604 | else {
|
10605 | this.delegate.removeClass(renderElement, className);
|
10606 | }
|
10607 | };
|
10608 | |
10609 |
|
10610 |
|
10611 |
|
10612 |
|
10613 |
|
10614 | RendererAdapter.prototype.setElementStyle = function (renderElement, styleName, styleValue) {
|
10615 | if (styleValue != null) {
|
10616 | this.delegate.setStyle(renderElement, styleName, styleValue);
|
10617 | }
|
10618 | else {
|
10619 | this.delegate.removeStyle(renderElement, styleName);
|
10620 | }
|
10621 | };
|
10622 | |
10623 |
|
10624 |
|
10625 |
|
10626 |
|
10627 |
|
10628 | RendererAdapter.prototype.invokeElementMethod = function (renderElement, methodName, args) {
|
10629 | ((renderElement))[methodName].apply(renderElement, args);
|
10630 | };
|
10631 | |
10632 |
|
10633 |
|
10634 |
|
10635 |
|
10636 | RendererAdapter.prototype.setText = function (renderNode$$1, text) { this.delegate.setValue(renderNode$$1, text); };
|
10637 | |
10638 |
|
10639 |
|
10640 | RendererAdapter.prototype.animate = function () { throw new Error('Renderer.animate is no longer supported!'); };
|
10641 | return RendererAdapter;
|
10642 | }());
|
10643 |
|
10644 |
|
10645 |
|
10646 |
|
10647 |
|
10648 |
|
10649 |
|
10650 | function createNgModuleRef(moduleType, parent, bootstrapComponents, def) {
|
10651 | return new NgModuleRef_(moduleType, parent, bootstrapComponents, def);
|
10652 | }
|
10653 | var NgModuleRef_ = (function () {
|
10654 | |
10655 |
|
10656 |
|
10657 |
|
10658 |
|
10659 |
|
10660 | function NgModuleRef_(_moduleType, _parent, _bootstrapComponents, _def) {
|
10661 | this._moduleType = _moduleType;
|
10662 | this._parent = _parent;
|
10663 | this._bootstrapComponents = _bootstrapComponents;
|
10664 | this._def = _def;
|
10665 | this._destroyListeners = [];
|
10666 | this._destroyed = false;
|
10667 | initNgModule(this);
|
10668 | }
|
10669 | |
10670 |
|
10671 |
|
10672 |
|
10673 |
|
10674 | NgModuleRef_.prototype.get = function (token, notFoundValue) {
|
10675 | if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
|
10676 | return resolveNgModuleDep(this, { token: token, tokenKey: tokenKey(token), flags: 0 }, notFoundValue);
|
10677 | };
|
10678 | Object.defineProperty(NgModuleRef_.prototype, "instance", {
|
10679 | |
10680 |
|
10681 |
|
10682 | get: function () { return this.get(this._moduleType); },
|
10683 | enumerable: true,
|
10684 | configurable: true
|
10685 | });
|
10686 | Object.defineProperty(NgModuleRef_.prototype, "componentFactoryResolver", {
|
10687 | |
10688 |
|
10689 |
|
10690 | get: function () { return this.get(ComponentFactoryResolver); },
|
10691 | enumerable: true,
|
10692 | configurable: true
|
10693 | });
|
10694 | Object.defineProperty(NgModuleRef_.prototype, "injector", {
|
10695 | |
10696 |
|
10697 |
|
10698 | get: function () { return this; },
|
10699 | enumerable: true,
|
10700 | configurable: true
|
10701 | });
|
10702 | |
10703 |
|
10704 |
|
10705 | NgModuleRef_.prototype.destroy = function () {
|
10706 | if (this._destroyed) {
|
10707 | throw new Error("The ng module " + stringify(this.instance.constructor) + " has already been destroyed.");
|
10708 | }
|
10709 | this._destroyed = true;
|
10710 | callNgModuleLifecycle(this, 131072 );
|
10711 | this._destroyListeners.forEach(function (listener) { return listener(); });
|
10712 | };
|
10713 | |
10714 |
|
10715 |
|
10716 |
|
10717 | NgModuleRef_.prototype.onDestroy = function (callback) { this._destroyListeners.push(callback); };
|
10718 | return NgModuleRef_;
|
10719 | }());
|
10720 |
|
10721 |
|
10722 |
|
10723 |
|
10724 |
|
10725 |
|
10726 |
|
10727 | var RendererV1TokenKey = tokenKey(Renderer);
|
10728 | var Renderer2TokenKey = tokenKey(Renderer2);
|
10729 | var ElementRefTokenKey = tokenKey(ElementRef);
|
10730 | var ViewContainerRefTokenKey = tokenKey(ViewContainerRef);
|
10731 | var TemplateRefTokenKey = tokenKey(TemplateRef);
|
10732 | var ChangeDetectorRefTokenKey = tokenKey(ChangeDetectorRef);
|
10733 | var InjectorRefTokenKey = tokenKey(Injector);
|
10734 | var NOT_CREATED = new Object();
|
10735 |
|
10736 |
|
10737 |
|
10738 |
|
10739 |
|
10740 |
|
10741 |
|
10742 |
|
10743 |
|
10744 |
|
10745 | function directiveDef(flags, matchedQueries, childCount, ctor, deps, props, outputs) {
|
10746 | var bindings = [];
|
10747 | if (props) {
|
10748 | for (var prop in props) {
|
10749 | var _a = props[prop], bindingIndex = _a[0], nonMinifiedName = _a[1];
|
10750 | bindings[bindingIndex] = {
|
10751 | flags: 8 ,
|
10752 | name: prop, nonMinifiedName: nonMinifiedName,
|
10753 | ns: null,
|
10754 | securityContext: null,
|
10755 | suffix: null
|
10756 | };
|
10757 | }
|
10758 | }
|
10759 | var outputDefs = [];
|
10760 | if (outputs) {
|
10761 | for (var propName in outputs) {
|
10762 | outputDefs.push({ type: 1 , propName: propName, target: null, eventName: outputs[propName] });
|
10763 | }
|
10764 | }
|
10765 | flags |= 16384 ;
|
10766 | return _def(flags, matchedQueries, childCount, ctor, ctor, deps, bindings, outputDefs);
|
10767 | }
|
10768 |
|
10769 |
|
10770 |
|
10771 |
|
10772 |
|
10773 |
|
10774 | function pipeDef(flags, ctor, deps) {
|
10775 | flags |= 16 ;
|
10776 | return _def(flags, null, 0, ctor, ctor, deps);
|
10777 | }
|
10778 |
|
10779 |
|
10780 |
|
10781 |
|
10782 |
|
10783 |
|
10784 |
|
10785 |
|
10786 | function providerDef(flags, matchedQueries, token, value, deps) {
|
10787 | return _def(flags, matchedQueries, 0, token, value, deps);
|
10788 | }
|
10789 |
|
10790 |
|
10791 |
|
10792 |
|
10793 |
|
10794 |
|
10795 |
|
10796 |
|
10797 |
|
10798 |
|
10799 |
|
10800 | function _def(flags, matchedQueriesDsl, childCount, token, value, deps, bindings, outputs) {
|
10801 | var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
|
10802 | if (!outputs) {
|
10803 | outputs = [];
|
10804 | }
|
10805 | if (!bindings) {
|
10806 | bindings = [];
|
10807 | }
|
10808 | var depDefs = splitDepsDsl(deps);
|
10809 | return {
|
10810 |
|
10811 | index: -1,
|
10812 | parent: null,
|
10813 | renderParent: null,
|
10814 | bindingIndex: -1,
|
10815 | outputIndex: -1,
|
10816 |
|
10817 | flags: flags,
|
10818 | childFlags: 0,
|
10819 | directChildFlags: 0,
|
10820 | childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references,
|
10821 | ngContentIndex: -1, childCount: childCount, bindings: bindings,
|
10822 | bindingFlags: calcBindingFlags(bindings), outputs: outputs,
|
10823 | element: null,
|
10824 | provider: { token: token, value: value, deps: depDefs },
|
10825 | text: null,
|
10826 | query: null,
|
10827 | ngContent: null
|
10828 | };
|
10829 | }
|
10830 |
|
10831 |
|
10832 |
|
10833 |
|
10834 |
|
10835 | function createProviderInstance(view, def) {
|
10836 | return def.flags & 4096 ? NOT_CREATED : _createProviderInstance(view, def);
|
10837 | }
|
10838 |
|
10839 |
|
10840 |
|
10841 |
|
10842 |
|
10843 | function createPipeInstance(view, def) {
|
10844 |
|
10845 | var compView = view;
|
10846 | while (compView.parent && !isComponentView(compView)) {
|
10847 | compView = compView.parent;
|
10848 | }
|
10849 |
|
10850 | var allowPrivateServices = true;
|
10851 |
|
10852 | return createClass( ((compView.parent)), ((viewParentEl(compView))), allowPrivateServices, ((def.provider)).value, ((def.provider)).deps);
|
10853 | }
|
10854 |
|
10855 |
|
10856 |
|
10857 |
|
10858 |
|
10859 | function createDirectiveInstance(view, def) {
|
10860 |
|
10861 | var allowPrivateServices = (def.flags & 32768 ) > 0;
|
10862 |
|
10863 | var instance = createClass(view, ((def.parent)), allowPrivateServices, ((def.provider)).value, ((def.provider)).deps);
|
10864 | if (def.outputs.length) {
|
10865 | for (var i = 0; i < def.outputs.length; i++) {
|
10866 | var output = def.outputs[i];
|
10867 | var subscription = instance[((output.propName))].subscribe(eventHandlerClosure(view, ((def.parent)).index, output.eventName));
|
10868 | ((view.disposables))[def.outputIndex + i] = subscription.unsubscribe.bind(subscription);
|
10869 | }
|
10870 | }
|
10871 | return instance;
|
10872 | }
|
10873 |
|
10874 |
|
10875 |
|
10876 |
|
10877 |
|
10878 |
|
10879 | function eventHandlerClosure(view, index, eventName) {
|
10880 | return function (event) {
|
10881 | try {
|
10882 | return dispatchEvent(view, index, eventName, event);
|
10883 | }
|
10884 | catch (e) {
|
10885 |
|
10886 | view.root.errorHandler.handleError(e);
|
10887 | }
|
10888 | };
|
10889 | }
|
10890 |
|
10891 |
|
10892 |
|
10893 |
|
10894 |
|
10895 |
|
10896 |
|
10897 |
|
10898 |
|
10899 |
|
10900 |
|
10901 |
|
10902 |
|
10903 |
|
10904 |
|
10905 | function checkAndUpdateDirectiveInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
10906 | var providerData = asProviderData(view, def.index);
|
10907 | var directive = providerData.instance;
|
10908 | var changed = false;
|
10909 | var changes = ((undefined));
|
10910 | var bindLen = def.bindings.length;
|
10911 | if (bindLen > 0 && checkBinding(view, def, 0, v0)) {
|
10912 | changed = true;
|
10913 | changes = updateProp(view, providerData, def, 0, v0, changes);
|
10914 | }
|
10915 | if (bindLen > 1 && checkBinding(view, def, 1, v1)) {
|
10916 | changed = true;
|
10917 | changes = updateProp(view, providerData, def, 1, v1, changes);
|
10918 | }
|
10919 | if (bindLen > 2 && checkBinding(view, def, 2, v2)) {
|
10920 | changed = true;
|
10921 | changes = updateProp(view, providerData, def, 2, v2, changes);
|
10922 | }
|
10923 | if (bindLen > 3 && checkBinding(view, def, 3, v3)) {
|
10924 | changed = true;
|
10925 | changes = updateProp(view, providerData, def, 3, v3, changes);
|
10926 | }
|
10927 | if (bindLen > 4 && checkBinding(view, def, 4, v4)) {
|
10928 | changed = true;
|
10929 | changes = updateProp(view, providerData, def, 4, v4, changes);
|
10930 | }
|
10931 | if (bindLen > 5 && checkBinding(view, def, 5, v5)) {
|
10932 | changed = true;
|
10933 | changes = updateProp(view, providerData, def, 5, v5, changes);
|
10934 | }
|
10935 | if (bindLen > 6 && checkBinding(view, def, 6, v6)) {
|
10936 | changed = true;
|
10937 | changes = updateProp(view, providerData, def, 6, v6, changes);
|
10938 | }
|
10939 | if (bindLen > 7 && checkBinding(view, def, 7, v7)) {
|
10940 | changed = true;
|
10941 | changes = updateProp(view, providerData, def, 7, v7, changes);
|
10942 | }
|
10943 | if (bindLen > 8 && checkBinding(view, def, 8, v8)) {
|
10944 | changed = true;
|
10945 | changes = updateProp(view, providerData, def, 8, v8, changes);
|
10946 | }
|
10947 | if (bindLen > 9 && checkBinding(view, def, 9, v9)) {
|
10948 | changed = true;
|
10949 | changes = updateProp(view, providerData, def, 9, v9, changes);
|
10950 | }
|
10951 | if (changes) {
|
10952 | directive.ngOnChanges(changes);
|
10953 | }
|
10954 | if ((view.state & 2 ) && (def.flags & 65536 )) {
|
10955 | directive.ngOnInit();
|
10956 | }
|
10957 | if (def.flags & 262144 ) {
|
10958 | directive.ngDoCheck();
|
10959 | }
|
10960 | return changed;
|
10961 | }
|
10962 |
|
10963 |
|
10964 |
|
10965 |
|
10966 |
|
10967 |
|
10968 | function checkAndUpdateDirectiveDynamic(view, def, values) {
|
10969 | var providerData = asProviderData(view, def.index);
|
10970 | var directive = providerData.instance;
|
10971 | var changed = false;
|
10972 | var changes = ((undefined));
|
10973 | for (var i = 0; i < values.length; i++) {
|
10974 | if (checkBinding(view, def, i, values[i])) {
|
10975 | changed = true;
|
10976 | changes = updateProp(view, providerData, def, i, values[i], changes);
|
10977 | }
|
10978 | }
|
10979 | if (changes) {
|
10980 | directive.ngOnChanges(changes);
|
10981 | }
|
10982 | if ((view.state & 2 ) && (def.flags & 65536 )) {
|
10983 | directive.ngOnInit();
|
10984 | }
|
10985 | if (def.flags & 262144 ) {
|
10986 | directive.ngDoCheck();
|
10987 | }
|
10988 | return changed;
|
10989 | }
|
10990 |
|
10991 |
|
10992 |
|
10993 |
|
10994 |
|
10995 | function _createProviderInstance(view, def) {
|
10996 |
|
10997 | var allowPrivateServices = (def.flags & 8192 ) > 0;
|
10998 | var providerDef = def.provider;
|
10999 | var injectable;
|
11000 | switch (def.flags & 201347067 ) {
|
11001 | case 512 :
|
11002 | injectable = createClass(view, ((def.parent)), allowPrivateServices, ((providerDef)).value, ((providerDef)).deps);
|
11003 | break;
|
11004 | case 1024 :
|
11005 | injectable = callFactory(view, ((def.parent)), allowPrivateServices, ((providerDef)).value, ((providerDef)).deps);
|
11006 | break;
|
11007 | case 2048 :
|
11008 | injectable = resolveDep(view, ((def.parent)), allowPrivateServices, ((providerDef)).deps[0]);
|
11009 | break;
|
11010 | case 256 :
|
11011 | injectable = ((providerDef)).value;
|
11012 | break;
|
11013 | }
|
11014 | return injectable;
|
11015 | }
|
11016 |
|
11017 |
|
11018 |
|
11019 |
|
11020 |
|
11021 |
|
11022 |
|
11023 |
|
11024 | function createClass(view, elDef, allowPrivateServices, ctor, deps) {
|
11025 | var len = deps.length;
|
11026 | var injectable;
|
11027 | switch (len) {
|
11028 | case 0:
|
11029 | injectable = new ctor();
|
11030 | break;
|
11031 | case 1:
|
11032 | injectable = new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]));
|
11033 | break;
|
11034 | case 2:
|
11035 | injectable = new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
|
11036 | break;
|
11037 | case 3:
|
11038 | injectable = new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
|
11039 | break;
|
11040 | default:
|
11041 | var depValues = new Array(len);
|
11042 | for (var i = 0; i < len; i++) {
|
11043 | depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
|
11044 | }
|
11045 | injectable = new (ctor.bind.apply(ctor, [void 0].concat(depValues)))();
|
11046 | }
|
11047 | return injectable;
|
11048 | }
|
11049 |
|
11050 |
|
11051 |
|
11052 |
|
11053 |
|
11054 |
|
11055 |
|
11056 |
|
11057 | function callFactory(view, elDef, allowPrivateServices, factory, deps) {
|
11058 | var len = deps.length;
|
11059 | var injectable;
|
11060 | switch (len) {
|
11061 | case 0:
|
11062 | injectable = factory();
|
11063 | break;
|
11064 | case 1:
|
11065 | injectable = factory(resolveDep(view, elDef, allowPrivateServices, deps[0]));
|
11066 | break;
|
11067 | case 2:
|
11068 | injectable = factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
|
11069 | break;
|
11070 | case 3:
|
11071 | injectable = factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
|
11072 | break;
|
11073 | default:
|
11074 | var depValues = Array(len);
|
11075 | for (var i = 0; i < len; i++) {
|
11076 | depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
|
11077 | }
|
11078 | injectable = factory.apply(void 0, depValues);
|
11079 | }
|
11080 | return injectable;
|
11081 | }
|
11082 |
|
11083 |
|
11084 |
|
11085 |
|
11086 |
|
11087 |
|
11088 |
|
11089 |
|
11090 |
|
11091 |
|
11092 |
|
11093 |
|
11094 |
|
11095 |
|
11096 |
|
11097 |
|
11098 |
|
11099 | var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
|
11100 |
|
11101 |
|
11102 |
|
11103 |
|
11104 |
|
11105 |
|
11106 |
|
11107 |
|
11108 | function resolveDep(view, elDef, allowPrivateServices, depDef, notFoundValue) {
|
11109 | if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
|
11110 | if (depDef.flags & 8 ) {
|
11111 | return depDef.token;
|
11112 | }
|
11113 | var startView = view;
|
11114 | if (depDef.flags & 2 ) {
|
11115 | notFoundValue = null;
|
11116 | }
|
11117 | var tokenKey$$1 = depDef.tokenKey;
|
11118 | if (tokenKey$$1 === ChangeDetectorRefTokenKey) {
|
11119 |
|
11120 |
|
11121 | allowPrivateServices = !!(elDef && ((elDef.element)).componentView);
|
11122 | }
|
11123 | if (elDef && (depDef.flags & 1 )) {
|
11124 | allowPrivateServices = false;
|
11125 | elDef = ((elDef.parent));
|
11126 | }
|
11127 | while (view) {
|
11128 | if (elDef) {
|
11129 | switch (tokenKey$$1) {
|
11130 | case RendererV1TokenKey: {
|
11131 | var compView = findCompView(view, elDef, allowPrivateServices);
|
11132 | return createRendererV1(compView);
|
11133 | }
|
11134 | case Renderer2TokenKey: {
|
11135 | var compView = findCompView(view, elDef, allowPrivateServices);
|
11136 | return compView.renderer;
|
11137 | }
|
11138 | case ElementRefTokenKey:
|
11139 | return new ElementRef(asElementData(view, elDef.index).renderElement);
|
11140 | case ViewContainerRefTokenKey:
|
11141 | return asElementData(view, elDef.index).viewContainer;
|
11142 | case TemplateRefTokenKey: {
|
11143 | if (((elDef.element)).template) {
|
11144 | return asElementData(view, elDef.index).template;
|
11145 | }
|
11146 | break;
|
11147 | }
|
11148 | case ChangeDetectorRefTokenKey: {
|
11149 | var cdView = findCompView(view, elDef, allowPrivateServices);
|
11150 | return createChangeDetectorRef(cdView);
|
11151 | }
|
11152 | case InjectorRefTokenKey:
|
11153 | return createInjector(view, elDef);
|
11154 | default:
|
11155 | var providerDef_1 = (((allowPrivateServices ? ((elDef.element)).allProviders : ((elDef.element)).publicProviders)))[tokenKey$$1];
|
11156 | if (providerDef_1) {
|
11157 | var providerData = asProviderData(view, providerDef_1.index);
|
11158 | if (providerData.instance === NOT_CREATED) {
|
11159 | providerData.instance = _createProviderInstance(view, providerDef_1);
|
11160 | }
|
11161 | return providerData.instance;
|
11162 | }
|
11163 | }
|
11164 | }
|
11165 | allowPrivateServices = isComponentView(view);
|
11166 | elDef = ((viewParentEl(view)));
|
11167 | view = ((view.parent));
|
11168 | }
|
11169 | var value = startView.root.injector.get(depDef.token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR);
|
11170 | if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
|
11171 | notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
|
11172 |
|
11173 |
|
11174 |
|
11175 |
|
11176 |
|
11177 | return value;
|
11178 | }
|
11179 | return startView.root.ngModule.injector.get(depDef.token, notFoundValue);
|
11180 | }
|
11181 |
|
11182 |
|
11183 |
|
11184 |
|
11185 |
|
11186 |
|
11187 | function findCompView(view, elDef, allowPrivateServices) {
|
11188 | var compView;
|
11189 | if (allowPrivateServices) {
|
11190 | compView = asElementData(view, elDef.index).componentView;
|
11191 | }
|
11192 | else {
|
11193 | compView = view;
|
11194 | while (compView.parent && !isComponentView(compView)) {
|
11195 | compView = compView.parent;
|
11196 | }
|
11197 | }
|
11198 | return compView;
|
11199 | }
|
11200 |
|
11201 |
|
11202 |
|
11203 |
|
11204 |
|
11205 |
|
11206 |
|
11207 |
|
11208 |
|
11209 | function updateProp(view, providerData, def, bindingIdx, value, changes) {
|
11210 | if (def.flags & 32768 ) {
|
11211 | var compView = asElementData(view, ((def.parent)).index).componentView;
|
11212 | if (compView.def.flags & 2 ) {
|
11213 | compView.state |= 8 ;
|
11214 | }
|
11215 | }
|
11216 | var binding = def.bindings[bindingIdx];
|
11217 | var propName = ((binding.name));
|
11218 |
|
11219 |
|
11220 |
|
11221 | providerData.instance[propName] = value;
|
11222 | if (def.flags & 524288 ) {
|
11223 | changes = changes || {};
|
11224 | var oldValue = view.oldValues[def.bindingIndex + bindingIdx];
|
11225 | if (oldValue instanceof WrappedValue) {
|
11226 | oldValue = oldValue.wrapped;
|
11227 | }
|
11228 | var binding_1 = def.bindings[bindingIdx];
|
11229 | changes[((binding_1.nonMinifiedName))] =
|
11230 | new SimpleChange(oldValue, value, (view.state & 2 ) !== 0);
|
11231 | }
|
11232 | view.oldValues[def.bindingIndex + bindingIdx] = value;
|
11233 | return changes;
|
11234 | }
|
11235 |
|
11236 |
|
11237 |
|
11238 |
|
11239 |
|
11240 | function callLifecycleHooksChildrenFirst(view, lifecycles) {
|
11241 | if (!(view.def.nodeFlags & lifecycles)) {
|
11242 | return;
|
11243 | }
|
11244 | var nodes = view.def.nodes;
|
11245 | for (var i = 0; i < nodes.length; i++) {
|
11246 | var nodeDef = nodes[i];
|
11247 | var parent = nodeDef.parent;
|
11248 | if (!parent && nodeDef.flags & lifecycles) {
|
11249 |
|
11250 | callProviderLifecycles(view, i, nodeDef.flags & lifecycles);
|
11251 | }
|
11252 | if ((nodeDef.childFlags & lifecycles) === 0) {
|
11253 |
|
11254 | i += nodeDef.childCount;
|
11255 | }
|
11256 | while (parent && (parent.flags & 1 ) &&
|
11257 | i === parent.index + parent.childCount) {
|
11258 |
|
11259 | if (parent.directChildFlags & lifecycles) {
|
11260 | callElementProvidersLifecycles(view, parent, lifecycles);
|
11261 | }
|
11262 | parent = parent.parent;
|
11263 | }
|
11264 | }
|
11265 | }
|
11266 |
|
11267 |
|
11268 |
|
11269 |
|
11270 |
|
11271 |
|
11272 | function callElementProvidersLifecycles(view, elDef, lifecycles) {
|
11273 | for (var i = elDef.index + 1; i <= elDef.index + elDef.childCount; i++) {
|
11274 | var nodeDef = view.def.nodes[i];
|
11275 | if (nodeDef.flags & lifecycles) {
|
11276 | callProviderLifecycles(view, i, nodeDef.flags & lifecycles);
|
11277 | }
|
11278 |
|
11279 | i += nodeDef.childCount;
|
11280 | }
|
11281 | }
|
11282 |
|
11283 |
|
11284 |
|
11285 |
|
11286 |
|
11287 |
|
11288 | function callProviderLifecycles(view, index, lifecycles) {
|
11289 | var provider = asProviderData(view, index).instance;
|
11290 | if (provider === NOT_CREATED) {
|
11291 | return;
|
11292 | }
|
11293 | Services.setCurrentNode(view, index);
|
11294 | if (lifecycles & 1048576 ) {
|
11295 | provider.ngAfterContentInit();
|
11296 | }
|
11297 | if (lifecycles & 2097152 ) {
|
11298 | provider.ngAfterContentChecked();
|
11299 | }
|
11300 | if (lifecycles & 4194304 ) {
|
11301 | provider.ngAfterViewInit();
|
11302 | }
|
11303 | if (lifecycles & 8388608 ) {
|
11304 | provider.ngAfterViewChecked();
|
11305 | }
|
11306 | if (lifecycles & 131072 ) {
|
11307 | provider.ngOnDestroy();
|
11308 | }
|
11309 | }
|
11310 |
|
11311 |
|
11312 |
|
11313 |
|
11314 |
|
11315 |
|
11316 |
|
11317 |
|
11318 |
|
11319 |
|
11320 |
|
11321 |
|
11322 |
|
11323 | function queryDef(flags, id, bindings) {
|
11324 | var bindingDefs = [];
|
11325 | for (var propName in bindings) {
|
11326 | var bindingType = bindings[propName];
|
11327 | bindingDefs.push({ propName: propName, bindingType: bindingType });
|
11328 | }
|
11329 | return {
|
11330 |
|
11331 | index: -1,
|
11332 | parent: null,
|
11333 | renderParent: null,
|
11334 | bindingIndex: -1,
|
11335 | outputIndex: -1,
|
11336 |
|
11337 | flags: flags,
|
11338 | childFlags: 0,
|
11339 | directChildFlags: 0,
|
11340 | childMatchedQueries: 0,
|
11341 | ngContentIndex: -1,
|
11342 | matchedQueries: {},
|
11343 | matchedQueryIds: 0,
|
11344 | references: {},
|
11345 | childCount: 0,
|
11346 | bindings: [],
|
11347 | bindingFlags: 0,
|
11348 | outputs: [],
|
11349 | element: null,
|
11350 | provider: null,
|
11351 | text: null,
|
11352 | query: { id: id, filterId: filterQueryId(id), bindings: bindingDefs },
|
11353 | ngContent: null
|
11354 | };
|
11355 | }
|
11356 |
|
11357 |
|
11358 |
|
11359 | function createQuery() {
|
11360 | return new QueryList();
|
11361 | }
|
11362 |
|
11363 |
|
11364 |
|
11365 |
|
11366 | function dirtyParentQueries(view) {
|
11367 | var queryIds = view.def.nodeMatchedQueries;
|
11368 | while (view.parent && isEmbeddedView(view)) {
|
11369 | var tplDef = ((view.parentNodeDef));
|
11370 | view = view.parent;
|
11371 |
|
11372 | var end = tplDef.index + tplDef.childCount;
|
11373 | for (var i = 0; i <= end; i++) {
|
11374 | var nodeDef = view.def.nodes[i];
|
11375 | if ((nodeDef.flags & 67108864 ) &&
|
11376 | (nodeDef.flags & 536870912 ) &&
|
11377 | (((nodeDef.query)).filterId & queryIds) === ((nodeDef.query)).filterId) {
|
11378 | asQueryList(view, i).setDirty();
|
11379 | }
|
11380 | if ((nodeDef.flags & 1 && i + nodeDef.childCount < tplDef.index) ||
|
11381 | !(nodeDef.childFlags & 67108864 ) ||
|
11382 | !(nodeDef.childFlags & 536870912 )) {
|
11383 |
|
11384 | i += nodeDef.childCount;
|
11385 | }
|
11386 | }
|
11387 | }
|
11388 |
|
11389 | if (view.def.nodeFlags & 134217728 ) {
|
11390 | for (var i = 0; i < view.def.nodes.length; i++) {
|
11391 | var nodeDef = view.def.nodes[i];
|
11392 | if ((nodeDef.flags & 134217728 ) && (nodeDef.flags & 536870912 )) {
|
11393 | asQueryList(view, i).setDirty();
|
11394 | }
|
11395 |
|
11396 | i += nodeDef.childCount;
|
11397 | }
|
11398 | }
|
11399 | }
|
11400 |
|
11401 |
|
11402 |
|
11403 |
|
11404 |
|
11405 | function checkAndUpdateQuery(view, nodeDef) {
|
11406 | var queryList = asQueryList(view, nodeDef.index);
|
11407 | if (!queryList.dirty) {
|
11408 | return;
|
11409 | }
|
11410 | var directiveInstance;
|
11411 | var newValues = ((undefined));
|
11412 | if (nodeDef.flags & 67108864 ) {
|
11413 | var elementDef_1 = ((((nodeDef.parent)).parent));
|
11414 | newValues = calcQueryValues(view, elementDef_1.index, elementDef_1.index + elementDef_1.childCount, ((nodeDef.query)), []);
|
11415 | directiveInstance = asProviderData(view, ((nodeDef.parent)).index).instance;
|
11416 | }
|
11417 | else if (nodeDef.flags & 134217728 ) {
|
11418 | newValues = calcQueryValues(view, 0, view.def.nodes.length - 1, ((nodeDef.query)), []);
|
11419 | directiveInstance = view.component;
|
11420 | }
|
11421 | queryList.reset(newValues);
|
11422 | var bindings = ((nodeDef.query)).bindings;
|
11423 | var notify = false;
|
11424 | for (var i = 0; i < bindings.length; i++) {
|
11425 | var binding = bindings[i];
|
11426 | var boundValue = void 0;
|
11427 | switch (binding.bindingType) {
|
11428 | case 0 :
|
11429 | boundValue = queryList.first;
|
11430 | break;
|
11431 | case 1 :
|
11432 | boundValue = queryList;
|
11433 | notify = true;
|
11434 | break;
|
11435 | }
|
11436 | directiveInstance[binding.propName] = boundValue;
|
11437 | }
|
11438 | if (notify) {
|
11439 | queryList.notifyOnChanges();
|
11440 | }
|
11441 | }
|
11442 |
|
11443 |
|
11444 |
|
11445 |
|
11446 |
|
11447 |
|
11448 |
|
11449 |
|
11450 | function calcQueryValues(view, startIndex, endIndex, queryDef, values) {
|
11451 | for (var i = startIndex; i <= endIndex; i++) {
|
11452 | var nodeDef = view.def.nodes[i];
|
11453 | var valueType = nodeDef.matchedQueries[queryDef.id];
|
11454 | if (valueType != null) {
|
11455 | values.push(getQueryValue(view, nodeDef, valueType));
|
11456 | }
|
11457 | if (nodeDef.flags & 1 && ((nodeDef.element)).template &&
|
11458 | (((((nodeDef.element)).template)).nodeMatchedQueries & queryDef.filterId) ===
|
11459 | queryDef.filterId) {
|
11460 |
|
11461 | var elementData = asElementData(view, i);
|
11462 | if (nodeDef.flags & 16777216 ) {
|
11463 | var embeddedViews = ((elementData.viewContainer))._embeddedViews;
|
11464 | for (var k = 0; k < embeddedViews.length; k++) {
|
11465 | var embeddedView = embeddedViews[k];
|
11466 | var dvc = declaredViewContainer(embeddedView);
|
11467 | if (dvc && dvc === elementData) {
|
11468 | calcQueryValues(embeddedView, 0, embeddedView.def.nodes.length - 1, queryDef, values);
|
11469 | }
|
11470 | }
|
11471 | }
|
11472 | var projectedViews = elementData.template._projectedViews;
|
11473 | if (projectedViews) {
|
11474 | for (var k = 0; k < projectedViews.length; k++) {
|
11475 | var projectedView = projectedViews[k];
|
11476 | calcQueryValues(projectedView, 0, projectedView.def.nodes.length - 1, queryDef, values);
|
11477 | }
|
11478 | }
|
11479 | }
|
11480 | if ((nodeDef.childMatchedQueries & queryDef.filterId) !== queryDef.filterId) {
|
11481 |
|
11482 | i += nodeDef.childCount;
|
11483 | }
|
11484 | }
|
11485 | return values;
|
11486 | }
|
11487 |
|
11488 |
|
11489 |
|
11490 |
|
11491 |
|
11492 |
|
11493 | function getQueryValue(view, nodeDef, queryValueType) {
|
11494 | if (queryValueType != null) {
|
11495 |
|
11496 | var value = void 0;
|
11497 | switch (queryValueType) {
|
11498 | case 1 :
|
11499 | value = asElementData(view, nodeDef.index).renderElement;
|
11500 | break;
|
11501 | case 0 :
|
11502 | value = new ElementRef(asElementData(view, nodeDef.index).renderElement);
|
11503 | break;
|
11504 | case 2 :
|
11505 | value = asElementData(view, nodeDef.index).template;
|
11506 | break;
|
11507 | case 3 :
|
11508 | value = asElementData(view, nodeDef.index).viewContainer;
|
11509 | break;
|
11510 | case 4 :
|
11511 | value = asProviderData(view, nodeDef.index).instance;
|
11512 | break;
|
11513 | }
|
11514 | return value;
|
11515 | }
|
11516 | }
|
11517 |
|
11518 |
|
11519 |
|
11520 |
|
11521 |
|
11522 |
|
11523 |
|
11524 |
|
11525 |
|
11526 |
|
11527 |
|
11528 |
|
11529 | function ngContentDef(ngContentIndex, index) {
|
11530 | return {
|
11531 |
|
11532 | index: -1,
|
11533 | parent: null,
|
11534 | renderParent: null,
|
11535 | bindingIndex: -1,
|
11536 | outputIndex: -1,
|
11537 |
|
11538 | flags: 8 ,
|
11539 | childFlags: 0,
|
11540 | directChildFlags: 0,
|
11541 | childMatchedQueries: 0,
|
11542 | matchedQueries: {},
|
11543 | matchedQueryIds: 0,
|
11544 | references: {}, ngContentIndex: ngContentIndex,
|
11545 | childCount: 0,
|
11546 | bindings: [],
|
11547 | bindingFlags: 0,
|
11548 | outputs: [],
|
11549 | element: null,
|
11550 | provider: null,
|
11551 | text: null,
|
11552 | query: null,
|
11553 | ngContent: { index: index }
|
11554 | };
|
11555 | }
|
11556 |
|
11557 |
|
11558 |
|
11559 |
|
11560 |
|
11561 |
|
11562 | function appendNgContent(view, renderHost, def) {
|
11563 | var parentEl = getParentRenderElement(view, renderHost, def);
|
11564 | if (!parentEl) {
|
11565 |
|
11566 | return;
|
11567 | }
|
11568 | var ngContentIndex = ((def.ngContent)).index;
|
11569 | visitProjectedRenderNodes(view, ngContentIndex, 1 , parentEl, null, undefined);
|
11570 | }
|
11571 |
|
11572 |
|
11573 |
|
11574 |
|
11575 |
|
11576 |
|
11577 |
|
11578 |
|
11579 |
|
11580 |
|
11581 |
|
11582 | function purePipeDef(argCount) {
|
11583 |
|
11584 | return _pureExpressionDef(128 , new Array(argCount + 1));
|
11585 | }
|
11586 |
|
11587 |
|
11588 |
|
11589 |
|
11590 | function pureArrayDef(argCount) {
|
11591 | return _pureExpressionDef(32 , new Array(argCount));
|
11592 | }
|
11593 |
|
11594 |
|
11595 |
|
11596 |
|
11597 | function pureObjectDef(propertyNames) {
|
11598 | return _pureExpressionDef(64 , propertyNames);
|
11599 | }
|
11600 |
|
11601 |
|
11602 |
|
11603 |
|
11604 |
|
11605 | function _pureExpressionDef(flags, propertyNames) {
|
11606 | var bindings = new Array(propertyNames.length);
|
11607 | for (var i = 0; i < propertyNames.length; i++) {
|
11608 | var prop = propertyNames[i];
|
11609 | bindings[i] = {
|
11610 | flags: 8 ,
|
11611 | name: prop,
|
11612 | ns: null,
|
11613 | nonMinifiedName: prop,
|
11614 | securityContext: null,
|
11615 | suffix: null
|
11616 | };
|
11617 | }
|
11618 | return {
|
11619 |
|
11620 | index: -1,
|
11621 | parent: null,
|
11622 | renderParent: null,
|
11623 | bindingIndex: -1,
|
11624 | outputIndex: -1,
|
11625 |
|
11626 | flags: flags,
|
11627 | childFlags: 0,
|
11628 | directChildFlags: 0,
|
11629 | childMatchedQueries: 0,
|
11630 | matchedQueries: {},
|
11631 | matchedQueryIds: 0,
|
11632 | references: {},
|
11633 | ngContentIndex: -1,
|
11634 | childCount: 0, bindings: bindings,
|
11635 | bindingFlags: calcBindingFlags(bindings),
|
11636 | outputs: [],
|
11637 | element: null,
|
11638 | provider: null,
|
11639 | text: null,
|
11640 | query: null,
|
11641 | ngContent: null
|
11642 | };
|
11643 | }
|
11644 |
|
11645 |
|
11646 |
|
11647 |
|
11648 |
|
11649 | function createPureExpression(view, def) {
|
11650 | return { value: undefined };
|
11651 | }
|
11652 |
|
11653 |
|
11654 |
|
11655 |
|
11656 |
|
11657 |
|
11658 |
|
11659 |
|
11660 |
|
11661 |
|
11662 |
|
11663 |
|
11664 |
|
11665 |
|
11666 |
|
11667 | function checkAndUpdatePureExpressionInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
11668 | var bindings = def.bindings;
|
11669 | var changed = false;
|
11670 | var bindLen = bindings.length;
|
11671 | if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
|
11672 | changed = true;
|
11673 | if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
|
11674 | changed = true;
|
11675 | if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
|
11676 | changed = true;
|
11677 | if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
|
11678 | changed = true;
|
11679 | if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
|
11680 | changed = true;
|
11681 | if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
|
11682 | changed = true;
|
11683 | if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
|
11684 | changed = true;
|
11685 | if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
|
11686 | changed = true;
|
11687 | if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
|
11688 | changed = true;
|
11689 | if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
|
11690 | changed = true;
|
11691 | if (changed) {
|
11692 | var data = asPureExpressionData(view, def.index);
|
11693 | var value = void 0;
|
11694 | switch (def.flags & 201347067 ) {
|
11695 | case 32 :
|
11696 | value = new Array(bindings.length);
|
11697 | if (bindLen > 0)
|
11698 | value[0] = v0;
|
11699 | if (bindLen > 1)
|
11700 | value[1] = v1;
|
11701 | if (bindLen > 2)
|
11702 | value[2] = v2;
|
11703 | if (bindLen > 3)
|
11704 | value[3] = v3;
|
11705 | if (bindLen > 4)
|
11706 | value[4] = v4;
|
11707 | if (bindLen > 5)
|
11708 | value[5] = v5;
|
11709 | if (bindLen > 6)
|
11710 | value[6] = v6;
|
11711 | if (bindLen > 7)
|
11712 | value[7] = v7;
|
11713 | if (bindLen > 8)
|
11714 | value[8] = v8;
|
11715 | if (bindLen > 9)
|
11716 | value[9] = v9;
|
11717 | break;
|
11718 | case 64 :
|
11719 | value = {};
|
11720 | if (bindLen > 0)
|
11721 | value[((bindings[0].name))] = v0;
|
11722 | if (bindLen > 1)
|
11723 | value[((bindings[1].name))] = v1;
|
11724 | if (bindLen > 2)
|
11725 | value[((bindings[2].name))] = v2;
|
11726 | if (bindLen > 3)
|
11727 | value[((bindings[3].name))] = v3;
|
11728 | if (bindLen > 4)
|
11729 | value[((bindings[4].name))] = v4;
|
11730 | if (bindLen > 5)
|
11731 | value[((bindings[5].name))] = v5;
|
11732 | if (bindLen > 6)
|
11733 | value[((bindings[6].name))] = v6;
|
11734 | if (bindLen > 7)
|
11735 | value[((bindings[7].name))] = v7;
|
11736 | if (bindLen > 8)
|
11737 | value[((bindings[8].name))] = v8;
|
11738 | if (bindLen > 9)
|
11739 | value[((bindings[9].name))] = v9;
|
11740 | break;
|
11741 | case 128 :
|
11742 | var pipe = v0;
|
11743 | switch (bindLen) {
|
11744 | case 1:
|
11745 | value = pipe.transform(v0);
|
11746 | break;
|
11747 | case 2:
|
11748 | value = pipe.transform(v1);
|
11749 | break;
|
11750 | case 3:
|
11751 | value = pipe.transform(v1, v2);
|
11752 | break;
|
11753 | case 4:
|
11754 | value = pipe.transform(v1, v2, v3);
|
11755 | break;
|
11756 | case 5:
|
11757 | value = pipe.transform(v1, v2, v3, v4);
|
11758 | break;
|
11759 | case 6:
|
11760 | value = pipe.transform(v1, v2, v3, v4, v5);
|
11761 | break;
|
11762 | case 7:
|
11763 | value = pipe.transform(v1, v2, v3, v4, v5, v6);
|
11764 | break;
|
11765 | case 8:
|
11766 | value = pipe.transform(v1, v2, v3, v4, v5, v6, v7);
|
11767 | break;
|
11768 | case 9:
|
11769 | value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8);
|
11770 | break;
|
11771 | case 10:
|
11772 | value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
11773 | break;
|
11774 | }
|
11775 | break;
|
11776 | }
|
11777 | data.value = value;
|
11778 | }
|
11779 | return changed;
|
11780 | }
|
11781 |
|
11782 |
|
11783 |
|
11784 |
|
11785 |
|
11786 |
|
11787 | function checkAndUpdatePureExpressionDynamic(view, def, values) {
|
11788 | var bindings = def.bindings;
|
11789 | var changed = false;
|
11790 | for (var i = 0; i < values.length; i++) {
|
11791 |
|
11792 |
|
11793 | if (checkAndUpdateBinding(view, def, i, values[i])) {
|
11794 | changed = true;
|
11795 | }
|
11796 | }
|
11797 | if (changed) {
|
11798 | var data = asPureExpressionData(view, def.index);
|
11799 | var value = void 0;
|
11800 | switch (def.flags & 201347067 ) {
|
11801 | case 32 :
|
11802 | value = values;
|
11803 | break;
|
11804 | case 64 :
|
11805 | value = {};
|
11806 | for (var i = 0; i < values.length; i++) {
|
11807 | value[((bindings[i].name))] = values[i];
|
11808 | }
|
11809 | break;
|
11810 | case 128 :
|
11811 | var pipe = values[0];
|
11812 | var params = values.slice(1);
|
11813 | value = pipe.transform.apply(pipe, params);
|
11814 | break;
|
11815 | }
|
11816 | data.value = value;
|
11817 | }
|
11818 | return changed;
|
11819 | }
|
11820 |
|
11821 |
|
11822 |
|
11823 |
|
11824 |
|
11825 |
|
11826 |
|
11827 |
|
11828 |
|
11829 |
|
11830 |
|
11831 |
|
11832 | function textDef(ngContentIndex, constants) {
|
11833 | var bindings = new Array(constants.length - 1);
|
11834 | for (var i = 1; i < constants.length; i++) {
|
11835 | bindings[i - 1] = {
|
11836 | flags: 8 ,
|
11837 | name: null,
|
11838 | ns: null,
|
11839 | nonMinifiedName: null,
|
11840 | securityContext: null,
|
11841 | suffix: constants[i]
|
11842 | };
|
11843 | }
|
11844 | var flags = 2;
|
11845 | return {
|
11846 |
|
11847 | index: -1,
|
11848 | parent: null,
|
11849 | renderParent: null,
|
11850 | bindingIndex: -1,
|
11851 | outputIndex: -1,
|
11852 |
|
11853 | flags: flags,
|
11854 | childFlags: 0,
|
11855 | directChildFlags: 0,
|
11856 | childMatchedQueries: 0,
|
11857 | matchedQueries: {},
|
11858 | matchedQueryIds: 0,
|
11859 | references: {}, ngContentIndex: ngContentIndex,
|
11860 | childCount: 0, bindings: bindings,
|
11861 | bindingFlags: calcBindingFlags(bindings),
|
11862 | outputs: [],
|
11863 | element: null,
|
11864 | provider: null,
|
11865 | text: { prefix: constants[0] },
|
11866 | query: null,
|
11867 | ngContent: null
|
11868 | };
|
11869 | }
|
11870 |
|
11871 |
|
11872 |
|
11873 |
|
11874 |
|
11875 |
|
11876 | function createText(view, renderHost, def) {
|
11877 | var renderNode$$1;
|
11878 | var renderer = view.renderer;
|
11879 | renderNode$$1 = renderer.createText( ((def.text)).prefix);
|
11880 | var parentEl = getParentRenderElement(view, renderHost, def);
|
11881 | if (parentEl) {
|
11882 | renderer.appendChild(parentEl, renderNode$$1);
|
11883 | }
|
11884 | return { renderText: renderNode$$1 };
|
11885 | }
|
11886 |
|
11887 |
|
11888 |
|
11889 |
|
11890 |
|
11891 |
|
11892 |
|
11893 |
|
11894 |
|
11895 |
|
11896 |
|
11897 |
|
11898 |
|
11899 |
|
11900 |
|
11901 | function checkAndUpdateTextInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
11902 | var changed = false;
|
11903 | var bindings = def.bindings;
|
11904 | var bindLen = bindings.length;
|
11905 | if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
|
11906 | changed = true;
|
11907 | if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
|
11908 | changed = true;
|
11909 | if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
|
11910 | changed = true;
|
11911 | if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
|
11912 | changed = true;
|
11913 | if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
|
11914 | changed = true;
|
11915 | if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
|
11916 | changed = true;
|
11917 | if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
|
11918 | changed = true;
|
11919 | if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
|
11920 | changed = true;
|
11921 | if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
|
11922 | changed = true;
|
11923 | if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
|
11924 | changed = true;
|
11925 | if (changed) {
|
11926 | var value = ((def.text)).prefix;
|
11927 | if (bindLen > 0)
|
11928 | value += _addInterpolationPart(v0, bindings[0]);
|
11929 | if (bindLen > 1)
|
11930 | value += _addInterpolationPart(v1, bindings[1]);
|
11931 | if (bindLen > 2)
|
11932 | value += _addInterpolationPart(v2, bindings[2]);
|
11933 | if (bindLen > 3)
|
11934 | value += _addInterpolationPart(v3, bindings[3]);
|
11935 | if (bindLen > 4)
|
11936 | value += _addInterpolationPart(v4, bindings[4]);
|
11937 | if (bindLen > 5)
|
11938 | value += _addInterpolationPart(v5, bindings[5]);
|
11939 | if (bindLen > 6)
|
11940 | value += _addInterpolationPart(v6, bindings[6]);
|
11941 | if (bindLen > 7)
|
11942 | value += _addInterpolationPart(v7, bindings[7]);
|
11943 | if (bindLen > 8)
|
11944 | value += _addInterpolationPart(v8, bindings[8]);
|
11945 | if (bindLen > 9)
|
11946 | value += _addInterpolationPart(v9, bindings[9]);
|
11947 | var renderNode$$1 = asTextData(view, def.index).renderText;
|
11948 | view.renderer.setValue(renderNode$$1, value);
|
11949 | }
|
11950 | return changed;
|
11951 | }
|
11952 |
|
11953 |
|
11954 |
|
11955 |
|
11956 |
|
11957 |
|
11958 | function checkAndUpdateTextDynamic(view, def, values) {
|
11959 | var bindings = def.bindings;
|
11960 | var changed = false;
|
11961 | for (var i = 0; i < values.length; i++) {
|
11962 |
|
11963 |
|
11964 | if (checkAndUpdateBinding(view, def, i, values[i])) {
|
11965 | changed = true;
|
11966 | }
|
11967 | }
|
11968 | if (changed) {
|
11969 | var value = '';
|
11970 | for (var i = 0; i < values.length; i++) {
|
11971 | value = value + _addInterpolationPart(values[i], bindings[i]);
|
11972 | }
|
11973 | value = ((def.text)).prefix + value;
|
11974 | var renderNode$$1 = asTextData(view, def.index).renderText;
|
11975 | view.renderer.setValue(renderNode$$1, value);
|
11976 | }
|
11977 | return changed;
|
11978 | }
|
11979 |
|
11980 |
|
11981 |
|
11982 |
|
11983 |
|
11984 | function _addInterpolationPart(value, binding) {
|
11985 | var valueStr = value != null ? value.toString() : '';
|
11986 | return valueStr + binding.suffix;
|
11987 | }
|
11988 |
|
11989 |
|
11990 |
|
11991 |
|
11992 |
|
11993 |
|
11994 |
|
11995 |
|
11996 |
|
11997 |
|
11998 |
|
11999 |
|
12000 |
|
12001 |
|
12002 | function viewDef(flags, nodes, updateDirectives, updateRenderer) {
|
12003 |
|
12004 | var viewBindingCount = 0;
|
12005 | var viewDisposableCount = 0;
|
12006 | var viewNodeFlags = 0;
|
12007 | var viewRootNodeFlags = 0;
|
12008 | var viewMatchedQueries = 0;
|
12009 | var currentParent = null;
|
12010 | var currentElementHasPublicProviders = false;
|
12011 | var currentElementHasPrivateProviders = false;
|
12012 | var lastRenderRootNode = null;
|
12013 | for (var i = 0; i < nodes.length; i++) {
|
12014 | while (currentParent && i > currentParent.index + currentParent.childCount) {
|
12015 | var newParent = currentParent.parent;
|
12016 | if (newParent) {
|
12017 | newParent.childFlags |= ((currentParent.childFlags));
|
12018 | newParent.childMatchedQueries |= currentParent.childMatchedQueries;
|
12019 | }
|
12020 | currentParent = newParent;
|
12021 | }
|
12022 | var node = nodes[i];
|
12023 | node.index = i;
|
12024 | node.parent = currentParent;
|
12025 | node.bindingIndex = viewBindingCount;
|
12026 | node.outputIndex = viewDisposableCount;
|
12027 |
|
12028 | var currentRenderParent = void 0;
|
12029 | if (currentParent && currentParent.flags & 1 &&
|
12030 | !((currentParent.element)).name) {
|
12031 | currentRenderParent = currentParent.renderParent;
|
12032 | }
|
12033 | else {
|
12034 | currentRenderParent = currentParent;
|
12035 | }
|
12036 | node.renderParent = currentRenderParent;
|
12037 | if (node.element) {
|
12038 | var elDef = node.element;
|
12039 | elDef.publicProviders =
|
12040 | currentParent ? ((currentParent.element)).publicProviders : Object.create(null);
|
12041 | elDef.allProviders = elDef.publicProviders;
|
12042 |
|
12043 | currentElementHasPublicProviders = false;
|
12044 | currentElementHasPrivateProviders = false;
|
12045 | }
|
12046 | validateNode(currentParent, node, nodes.length);
|
12047 | viewNodeFlags |= node.flags;
|
12048 | viewMatchedQueries |= node.matchedQueryIds;
|
12049 | if (node.element && node.element.template) {
|
12050 | viewMatchedQueries |= node.element.template.nodeMatchedQueries;
|
12051 | }
|
12052 | if (currentParent) {
|
12053 | currentParent.childFlags |= node.flags;
|
12054 | currentParent.directChildFlags |= node.flags;
|
12055 | currentParent.childMatchedQueries |= node.matchedQueryIds;
|
12056 | if (node.element && node.element.template) {
|
12057 | currentParent.childMatchedQueries |= node.element.template.nodeMatchedQueries;
|
12058 | }
|
12059 | }
|
12060 | else {
|
12061 | viewRootNodeFlags |= node.flags;
|
12062 | }
|
12063 | viewBindingCount += node.bindings.length;
|
12064 | viewDisposableCount += node.outputs.length;
|
12065 | if (!currentRenderParent && (node.flags & 3 )) {
|
12066 | lastRenderRootNode = node;
|
12067 | }
|
12068 | if (node.flags & 20224 ) {
|
12069 | if (!currentElementHasPublicProviders) {
|
12070 | currentElementHasPublicProviders = true;
|
12071 | ((((
|
12072 |
|
12073 | currentParent)).element)).publicProviders =
|
12074 | Object.create( ((((currentParent)).element)).publicProviders);
|
12075 | ((((currentParent)).element)).allProviders = ((((currentParent)).element)).publicProviders;
|
12076 | }
|
12077 | var isPrivateService = (node.flags & 8192 ) !== 0;
|
12078 | var isComponent = (node.flags & 32768 ) !== 0;
|
12079 | if (!isPrivateService || isComponent) {
|
12080 | ((((((currentParent)).element)).publicProviders))[tokenKey( ((node.provider)).token)] = node;
|
12081 | }
|
12082 | else {
|
12083 | if (!currentElementHasPrivateProviders) {
|
12084 | currentElementHasPrivateProviders = true;
|
12085 | ((((
|
12086 |
|
12087 | currentParent)).element)).allProviders =
|
12088 | Object.create( ((((currentParent)).element)).publicProviders);
|
12089 | }
|
12090 | ((((((currentParent)).element)).allProviders))[tokenKey( ((node.provider)).token)] = node;
|
12091 | }
|
12092 | if (isComponent) {
|
12093 | ((((currentParent)).element)).componentProvider = node;
|
12094 | }
|
12095 | }
|
12096 | if (node.childCount) {
|
12097 | currentParent = node;
|
12098 | }
|
12099 | }
|
12100 | while (currentParent) {
|
12101 | var newParent = currentParent.parent;
|
12102 | if (newParent) {
|
12103 | newParent.childFlags |= currentParent.childFlags;
|
12104 | newParent.childMatchedQueries |= currentParent.childMatchedQueries;
|
12105 | }
|
12106 | currentParent = newParent;
|
12107 | }
|
12108 | var handleEvent = function (view, nodeIndex, eventName, event) { return ((((nodes[nodeIndex].element)).handleEvent))(view, eventName, event); };
|
12109 | return {
|
12110 |
|
12111 | factory: null,
|
12112 | nodeFlags: viewNodeFlags,
|
12113 | rootNodeFlags: viewRootNodeFlags,
|
12114 | nodeMatchedQueries: viewMatchedQueries, flags: flags,
|
12115 | nodes: nodes,
|
12116 | updateDirectives: updateDirectives || NOOP,
|
12117 | updateRenderer: updateRenderer || NOOP,
|
12118 | handleEvent: handleEvent || NOOP,
|
12119 | bindingCount: viewBindingCount,
|
12120 | outputCount: viewDisposableCount, lastRenderRootNode: lastRenderRootNode
|
12121 | };
|
12122 | }
|
12123 |
|
12124 |
|
12125 |
|
12126 |
|
12127 |
|
12128 |
|
12129 | function validateNode(parent, node, nodeCount) {
|
12130 | var template = node.element && node.element.template;
|
12131 | if (template) {
|
12132 | if (!template.lastRenderRootNode) {
|
12133 | throw new Error("Illegal State: Embedded templates without nodes are not allowed!");
|
12134 | }
|
12135 | if (template.lastRenderRootNode &&
|
12136 | template.lastRenderRootNode.flags & 16777216 ) {
|
12137 | throw new Error("Illegal State: Last root node of a template can't have embedded views, at index " + node.index + "!");
|
12138 | }
|
12139 | }
|
12140 | if (node.flags & 20224 ) {
|
12141 | var parentFlags = parent ? parent.flags : 0;
|
12142 | if ((parentFlags & 1 ) === 0) {
|
12143 | throw new Error("Illegal State: Provider/Directive nodes need to be children of elements or anchors, at index " + node.index + "!");
|
12144 | }
|
12145 | }
|
12146 | if (node.query) {
|
12147 | if (node.flags & 67108864 &&
|
12148 | (!parent || (parent.flags & 16384 ) === 0)) {
|
12149 | throw new Error("Illegal State: Content Query nodes need to be children of directives, at index " + node.index + "!");
|
12150 | }
|
12151 | if (node.flags & 134217728 && parent) {
|
12152 | throw new Error("Illegal State: View Query nodes have to be top level nodes, at index " + node.index + "!");
|
12153 | }
|
12154 | }
|
12155 | if (node.childCount) {
|
12156 | var parentEnd = parent ? parent.index + parent.childCount : nodeCount - 1;
|
12157 | if (node.index <= parentEnd && node.index + node.childCount > parentEnd) {
|
12158 | throw new Error("Illegal State: childCount of node leads outside of parent, at index " + node.index + "!");
|
12159 | }
|
12160 | }
|
12161 | }
|
12162 |
|
12163 |
|
12164 |
|
12165 |
|
12166 |
|
12167 |
|
12168 |
|
12169 | function createEmbeddedView(parent, anchorDef$$1, viewDef, context) {
|
12170 |
|
12171 |
|
12172 | var view = createView(parent.root, parent.renderer, parent, anchorDef$$1, viewDef);
|
12173 | initView(view, parent.component, context);
|
12174 | createViewNodes(view);
|
12175 | return view;
|
12176 | }
|
12177 |
|
12178 |
|
12179 |
|
12180 |
|
12181 |
|
12182 |
|
12183 | function createRootView(root, def, context) {
|
12184 | var view = createView(root, root.renderer, null, null, def);
|
12185 | initView(view, context, context);
|
12186 | createViewNodes(view);
|
12187 | return view;
|
12188 | }
|
12189 |
|
12190 |
|
12191 |
|
12192 |
|
12193 |
|
12194 |
|
12195 |
|
12196 | function createComponentView(parentView, nodeDef, viewDef, hostElement) {
|
12197 | var rendererType = ((nodeDef.element)).componentRendererType;
|
12198 | var compRenderer;
|
12199 | if (!rendererType) {
|
12200 | compRenderer = parentView.root.renderer;
|
12201 | }
|
12202 | else {
|
12203 | compRenderer = parentView.root.rendererFactory.createRenderer(hostElement, rendererType);
|
12204 | }
|
12205 | return createView(parentView.root, compRenderer, parentView, ((nodeDef.element)).componentProvider, viewDef);
|
12206 | }
|
12207 |
|
12208 |
|
12209 |
|
12210 |
|
12211 |
|
12212 |
|
12213 |
|
12214 |
|
12215 | function createView(root, renderer, parent, parentNodeDef, def) {
|
12216 | var nodes = new Array(def.nodes.length);
|
12217 | var disposables = def.outputCount ? new Array(def.outputCount) : null;
|
12218 | var view = {
|
12219 | def: def,
|
12220 | parent: parent,
|
12221 | viewContainerParent: null, parentNodeDef: parentNodeDef,
|
12222 | context: null,
|
12223 | component: null, nodes: nodes,
|
12224 | state: 13 , root: root, renderer: renderer,
|
12225 | oldValues: new Array(def.bindingCount), disposables: disposables
|
12226 | };
|
12227 | return view;
|
12228 | }
|
12229 |
|
12230 |
|
12231 |
|
12232 |
|
12233 |
|
12234 |
|
12235 | function initView(view, component, context) {
|
12236 | view.component = component;
|
12237 | view.context = context;
|
12238 | }
|
12239 |
|
12240 |
|
12241 |
|
12242 |
|
12243 | function createViewNodes(view) {
|
12244 | var renderHost;
|
12245 | if (isComponentView(view)) {
|
12246 | var hostDef = view.parentNodeDef;
|
12247 | renderHost = asElementData( ((view.parent)), ((((hostDef)).parent)).index).renderElement;
|
12248 | }
|
12249 | var def = view.def;
|
12250 | var nodes = view.nodes;
|
12251 | for (var i = 0; i < def.nodes.length; i++) {
|
12252 | var nodeDef = def.nodes[i];
|
12253 | Services.setCurrentNode(view, i);
|
12254 | var nodeData = void 0;
|
12255 | switch (nodeDef.flags & 201347067 ) {
|
12256 | case 1 :
|
12257 | var el = (createElement(view, renderHost, nodeDef));
|
12258 | var componentView = ((undefined));
|
12259 | if (nodeDef.flags & 33554432 ) {
|
12260 | var compViewDef = resolveDefinition( ((((nodeDef.element)).componentView)));
|
12261 | componentView = Services.createComponentView(view, nodeDef, compViewDef, el);
|
12262 | }
|
12263 | listenToElementOutputs(view, componentView, nodeDef, el);
|
12264 | nodeData = ({
|
12265 | renderElement: el,
|
12266 | componentView: componentView,
|
12267 | viewContainer: null,
|
12268 | template: ((nodeDef.element)).template ? createTemplateData(view, nodeDef) : undefined
|
12269 | });
|
12270 | if (nodeDef.flags & 16777216 ) {
|
12271 | nodeData.viewContainer = createViewContainerData(view, nodeDef, nodeData);
|
12272 | }
|
12273 | break;
|
12274 | case 2 :
|
12275 | nodeData = (createText(view, renderHost, nodeDef));
|
12276 | break;
|
12277 | case 512 :
|
12278 | case 1024 :
|
12279 | case 2048 :
|
12280 | case 256 : {
|
12281 | var instance = createProviderInstance(view, nodeDef);
|
12282 | nodeData = ({ instance: instance });
|
12283 | break;
|
12284 | }
|
12285 | case 16 : {
|
12286 | var instance = createPipeInstance(view, nodeDef);
|
12287 | nodeData = ({ instance: instance });
|
12288 | break;
|
12289 | }
|
12290 | case 16384 : {
|
12291 | var instance = createDirectiveInstance(view, nodeDef);
|
12292 | nodeData = ({ instance: instance });
|
12293 | if (nodeDef.flags & 32768 ) {
|
12294 | var compView = asElementData(view, ((nodeDef.parent)).index).componentView;
|
12295 | initView(compView, instance, instance);
|
12296 | }
|
12297 | break;
|
12298 | }
|
12299 | case 32 :
|
12300 | case 64 :
|
12301 | case 128 :
|
12302 | nodeData = (createPureExpression(view, nodeDef));
|
12303 | break;
|
12304 | case 67108864 :
|
12305 | case 134217728 :
|
12306 | nodeData = (createQuery());
|
12307 | break;
|
12308 | case 8 :
|
12309 | appendNgContent(view, renderHost, nodeDef);
|
12310 |
|
12311 | nodeData = undefined;
|
12312 | break;
|
12313 | }
|
12314 | nodes[i] = nodeData;
|
12315 | }
|
12316 |
|
12317 |
|
12318 | execComponentViewsAction(view, ViewAction.CreateViewNodes);
|
12319 |
|
12320 | execQueriesAction(view, 67108864 | 134217728 , 268435456 , 0 );
|
12321 | }
|
12322 |
|
12323 |
|
12324 |
|
12325 |
|
12326 | function checkNoChangesView(view) {
|
12327 | markProjectedViewsForCheck(view);
|
12328 | Services.updateDirectives(view, 1 );
|
12329 | execEmbeddedViewsAction(view, ViewAction.CheckNoChanges);
|
12330 | Services.updateRenderer(view, 1 );
|
12331 | execComponentViewsAction(view, ViewAction.CheckNoChanges);
|
12332 |
|
12333 |
|
12334 | view.state &= ~(64 | 32 );
|
12335 | }
|
12336 |
|
12337 |
|
12338 |
|
12339 |
|
12340 | function checkAndUpdateView(view) {
|
12341 | if (view.state & 1 ) {
|
12342 | view.state &= ~1 ;
|
12343 | view.state |= 2 ;
|
12344 | }
|
12345 | else {
|
12346 | view.state &= ~2 ;
|
12347 | }
|
12348 | markProjectedViewsForCheck(view);
|
12349 | Services.updateDirectives(view, 0 );
|
12350 | execEmbeddedViewsAction(view, ViewAction.CheckAndUpdate);
|
12351 | execQueriesAction(view, 67108864 , 536870912 , 0 );
|
12352 | callLifecycleHooksChildrenFirst(view, 2097152 |
|
12353 | (view.state & 2 ? 1048576 : 0));
|
12354 | Services.updateRenderer(view, 0 );
|
12355 | execComponentViewsAction(view, ViewAction.CheckAndUpdate);
|
12356 | execQueriesAction(view, 134217728 , 536870912 , 0 );
|
12357 | callLifecycleHooksChildrenFirst(view, 8388608 |
|
12358 | (view.state & 2 ? 4194304 : 0));
|
12359 | if (view.def.flags & 2 ) {
|
12360 | view.state &= ~8 ;
|
12361 | }
|
12362 | view.state &= ~(64 | 32 );
|
12363 | }
|
12364 |
|
12365 |
|
12366 |
|
12367 |
|
12368 |
|
12369 |
|
12370 |
|
12371 |
|
12372 |
|
12373 |
|
12374 |
|
12375 |
|
12376 |
|
12377 |
|
12378 |
|
12379 |
|
12380 | function checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
12381 | if (argStyle === 0 ) {
|
12382 | return checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12383 | }
|
12384 | else {
|
12385 | return checkAndUpdateNodeDynamic(view, nodeDef, v0);
|
12386 | }
|
12387 | }
|
12388 |
|
12389 |
|
12390 |
|
12391 |
|
12392 | function markProjectedViewsForCheck(view) {
|
12393 | var def = view.def;
|
12394 | if (!(def.nodeFlags & 4 )) {
|
12395 | return;
|
12396 | }
|
12397 | for (var i = 0; i < def.nodes.length; i++) {
|
12398 | var nodeDef = def.nodes[i];
|
12399 | if (nodeDef.flags & 4 ) {
|
12400 | var projectedViews = asElementData(view, i).template._projectedViews;
|
12401 | if (projectedViews) {
|
12402 | for (var i_1 = 0; i_1 < projectedViews.length; i_1++) {
|
12403 | var projectedView = projectedViews[i_1];
|
12404 | projectedView.state |= 32 ;
|
12405 | markParentViewsForCheckProjectedViews(projectedView, view);
|
12406 | }
|
12407 | }
|
12408 | }
|
12409 | else if ((nodeDef.childFlags & 4 ) === 0) {
|
12410 |
|
12411 |
|
12412 |
|
12413 | i += nodeDef.childCount;
|
12414 | }
|
12415 | }
|
12416 | }
|
12417 |
|
12418 |
|
12419 |
|
12420 |
|
12421 |
|
12422 |
|
12423 |
|
12424 |
|
12425 |
|
12426 |
|
12427 |
|
12428 |
|
12429 |
|
12430 |
|
12431 |
|
12432 | function checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
12433 | var changed = false;
|
12434 | switch (nodeDef.flags & 201347067 ) {
|
12435 | case 1 :
|
12436 | changed = checkAndUpdateElementInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12437 | break;
|
12438 | case 2 :
|
12439 | changed = checkAndUpdateTextInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12440 | break;
|
12441 | case 16384 :
|
12442 | changed =
|
12443 | checkAndUpdateDirectiveInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12444 | break;
|
12445 | case 32 :
|
12446 | case 64 :
|
12447 | case 128 :
|
12448 | changed =
|
12449 | checkAndUpdatePureExpressionInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12450 | break;
|
12451 | }
|
12452 | return changed;
|
12453 | }
|
12454 |
|
12455 |
|
12456 |
|
12457 |
|
12458 |
|
12459 |
|
12460 | function checkAndUpdateNodeDynamic(view, nodeDef, values) {
|
12461 | var changed = false;
|
12462 | switch (nodeDef.flags & 201347067 ) {
|
12463 | case 1 :
|
12464 | changed = checkAndUpdateElementDynamic(view, nodeDef, values);
|
12465 | break;
|
12466 | case 2 :
|
12467 | changed = checkAndUpdateTextDynamic(view, nodeDef, values);
|
12468 | break;
|
12469 | case 16384 :
|
12470 | changed = checkAndUpdateDirectiveDynamic(view, nodeDef, values);
|
12471 | break;
|
12472 | case 32 :
|
12473 | case 64 :
|
12474 | case 128 :
|
12475 | changed = checkAndUpdatePureExpressionDynamic(view, nodeDef, values);
|
12476 | break;
|
12477 | }
|
12478 | if (changed) {
|
12479 |
|
12480 |
|
12481 | var bindLen = nodeDef.bindings.length;
|
12482 | var bindingStart = nodeDef.bindingIndex;
|
12483 | var oldValues = view.oldValues;
|
12484 | for (var i = 0; i < bindLen; i++) {
|
12485 | oldValues[bindingStart + i] = values[i];
|
12486 | }
|
12487 | }
|
12488 | return changed;
|
12489 | }
|
12490 |
|
12491 |
|
12492 |
|
12493 |
|
12494 |
|
12495 |
|
12496 |
|
12497 |
|
12498 |
|
12499 |
|
12500 |
|
12501 |
|
12502 |
|
12503 |
|
12504 |
|
12505 |
|
12506 | function checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
12507 | if (argStyle === 0 ) {
|
12508 | checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
12509 | }
|
12510 | else {
|
12511 | checkNoChangesNodeDynamic(view, nodeDef, v0);
|
12512 | }
|
12513 |
|
12514 | return false;
|
12515 | }
|
12516 |
|
12517 |
|
12518 |
|
12519 |
|
12520 |
|
12521 |
|
12522 |
|
12523 |
|
12524 |
|
12525 |
|
12526 |
|
12527 |
|
12528 |
|
12529 |
|
12530 |
|
12531 | function checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
12532 | var bindLen = nodeDef.bindings.length;
|
12533 | if (bindLen > 0)
|
12534 | checkBindingNoChanges(view, nodeDef, 0, v0);
|
12535 | if (bindLen > 1)
|
12536 | checkBindingNoChanges(view, nodeDef, 1, v1);
|
12537 | if (bindLen > 2)
|
12538 | checkBindingNoChanges(view, nodeDef, 2, v2);
|
12539 | if (bindLen > 3)
|
12540 | checkBindingNoChanges(view, nodeDef, 3, v3);
|
12541 | if (bindLen > 4)
|
12542 | checkBindingNoChanges(view, nodeDef, 4, v4);
|
12543 | if (bindLen > 5)
|
12544 | checkBindingNoChanges(view, nodeDef, 5, v5);
|
12545 | if (bindLen > 6)
|
12546 | checkBindingNoChanges(view, nodeDef, 6, v6);
|
12547 | if (bindLen > 7)
|
12548 | checkBindingNoChanges(view, nodeDef, 7, v7);
|
12549 | if (bindLen > 8)
|
12550 | checkBindingNoChanges(view, nodeDef, 8, v8);
|
12551 | if (bindLen > 9)
|
12552 | checkBindingNoChanges(view, nodeDef, 9, v9);
|
12553 | }
|
12554 |
|
12555 |
|
12556 |
|
12557 |
|
12558 |
|
12559 |
|
12560 | function checkNoChangesNodeDynamic(view, nodeDef, values) {
|
12561 | for (var i = 0; i < values.length; i++) {
|
12562 | checkBindingNoChanges(view, nodeDef, i, values[i]);
|
12563 | }
|
12564 | }
|
12565 |
|
12566 |
|
12567 |
|
12568 |
|
12569 |
|
12570 | function checkNoChangesQuery(view, nodeDef) {
|
12571 | var queryList = asQueryList(view, nodeDef.index);
|
12572 | if (queryList.dirty) {
|
12573 | throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, nodeDef.index), "Query " + ((nodeDef.query)).id + " not dirty", "Query " + ((nodeDef.query)).id + " dirty", (view.state & 1 ) !== 0);
|
12574 | }
|
12575 | }
|
12576 |
|
12577 |
|
12578 |
|
12579 |
|
12580 | function destroyView(view) {
|
12581 | if (view.state & 128 ) {
|
12582 | return;
|
12583 | }
|
12584 | execEmbeddedViewsAction(view, ViewAction.Destroy);
|
12585 | execComponentViewsAction(view, ViewAction.Destroy);
|
12586 | callLifecycleHooksChildrenFirst(view, 131072 );
|
12587 | if (view.disposables) {
|
12588 | for (var i = 0; i < view.disposables.length; i++) {
|
12589 | view.disposables[i]();
|
12590 | }
|
12591 | }
|
12592 | detachProjectedView(view);
|
12593 | if (view.renderer.destroyNode) {
|
12594 | destroyViewNodes(view);
|
12595 | }
|
12596 | if (isComponentView(view)) {
|
12597 | view.renderer.destroy();
|
12598 | }
|
12599 | view.state |= 128 ;
|
12600 | }
|
12601 |
|
12602 |
|
12603 |
|
12604 |
|
12605 | function destroyViewNodes(view) {
|
12606 | var len = view.def.nodes.length;
|
12607 | for (var i = 0; i < len; i++) {
|
12608 | var def = view.def.nodes[i];
|
12609 | if (def.flags & 1 ) {
|
12610 | ((view.renderer.destroyNode))(asElementData(view, i).renderElement);
|
12611 | }
|
12612 | else if (def.flags & 2 ) {
|
12613 | ((view.renderer.destroyNode))(asTextData(view, i).renderText);
|
12614 | }
|
12615 | }
|
12616 | }
|
12617 | var ViewAction = {};
|
12618 | ViewAction.CreateViewNodes = 0;
|
12619 | ViewAction.CheckNoChanges = 1;
|
12620 | ViewAction.CheckNoChangesProjectedViews = 2;
|
12621 | ViewAction.CheckAndUpdate = 3;
|
12622 | ViewAction.CheckAndUpdateProjectedViews = 4;
|
12623 | ViewAction.Destroy = 5;
|
12624 | ViewAction[ViewAction.CreateViewNodes] = "CreateViewNodes";
|
12625 | ViewAction[ViewAction.CheckNoChanges] = "CheckNoChanges";
|
12626 | ViewAction[ViewAction.CheckNoChangesProjectedViews] = "CheckNoChangesProjectedViews";
|
12627 | ViewAction[ViewAction.CheckAndUpdate] = "CheckAndUpdate";
|
12628 | ViewAction[ViewAction.CheckAndUpdateProjectedViews] = "CheckAndUpdateProjectedViews";
|
12629 | ViewAction[ViewAction.Destroy] = "Destroy";
|
12630 |
|
12631 |
|
12632 |
|
12633 |
|
12634 |
|
12635 | function execComponentViewsAction(view, action) {
|
12636 | var def = view.def;
|
12637 | if (!(def.nodeFlags & 33554432 )) {
|
12638 | return;
|
12639 | }
|
12640 | for (var i = 0; i < def.nodes.length; i++) {
|
12641 | var nodeDef = def.nodes[i];
|
12642 | if (nodeDef.flags & 33554432 ) {
|
12643 |
|
12644 | callViewAction(asElementData(view, i).componentView, action);
|
12645 | }
|
12646 | else if ((nodeDef.childFlags & 33554432 ) === 0) {
|
12647 |
|
12648 |
|
12649 |
|
12650 | i += nodeDef.childCount;
|
12651 | }
|
12652 | }
|
12653 | }
|
12654 |
|
12655 |
|
12656 |
|
12657 |
|
12658 |
|
12659 | function execEmbeddedViewsAction(view, action) {
|
12660 | var def = view.def;
|
12661 | if (!(def.nodeFlags & 16777216 )) {
|
12662 | return;
|
12663 | }
|
12664 | for (var i = 0; i < def.nodes.length; i++) {
|
12665 | var nodeDef = def.nodes[i];
|
12666 | if (nodeDef.flags & 16777216 ) {
|
12667 |
|
12668 | var embeddedViews = ((asElementData(view, i).viewContainer))._embeddedViews;
|
12669 | for (var k = 0; k < embeddedViews.length; k++) {
|
12670 | callViewAction(embeddedViews[k], action);
|
12671 | }
|
12672 | }
|
12673 | else if ((nodeDef.childFlags & 16777216 ) === 0) {
|
12674 |
|
12675 |
|
12676 |
|
12677 | i += nodeDef.childCount;
|
12678 | }
|
12679 | }
|
12680 | }
|
12681 |
|
12682 |
|
12683 |
|
12684 |
|
12685 |
|
12686 | function callViewAction(view, action) {
|
12687 | var viewState = view.state;
|
12688 | switch (action) {
|
12689 | case ViewAction.CheckNoChanges:
|
12690 | if ((viewState & 128 ) === 0) {
|
12691 | if ((viewState & 12 ) === 12 ) {
|
12692 | checkNoChangesView(view);
|
12693 | }
|
12694 | else if (viewState & 64 ) {
|
12695 | execProjectedViewsAction(view, ViewAction.CheckNoChangesProjectedViews);
|
12696 | }
|
12697 | }
|
12698 | break;
|
12699 | case ViewAction.CheckNoChangesProjectedViews:
|
12700 | if ((viewState & 128 ) === 0) {
|
12701 | if (viewState & 32 ) {
|
12702 | checkNoChangesView(view);
|
12703 | }
|
12704 | else if (viewState & 64 ) {
|
12705 | execProjectedViewsAction(view, action);
|
12706 | }
|
12707 | }
|
12708 | break;
|
12709 | case ViewAction.CheckAndUpdate:
|
12710 | if ((viewState & 128 ) === 0) {
|
12711 | if ((viewState & 12 ) === 12 ) {
|
12712 | checkAndUpdateView(view);
|
12713 | }
|
12714 | else if (viewState & 64 ) {
|
12715 | execProjectedViewsAction(view, ViewAction.CheckAndUpdateProjectedViews);
|
12716 | }
|
12717 | }
|
12718 | break;
|
12719 | case ViewAction.CheckAndUpdateProjectedViews:
|
12720 | if ((viewState & 128 ) === 0) {
|
12721 | if (viewState & 32 ) {
|
12722 | checkAndUpdateView(view);
|
12723 | }
|
12724 | else if (viewState & 64 ) {
|
12725 | execProjectedViewsAction(view, action);
|
12726 | }
|
12727 | }
|
12728 | break;
|
12729 | case ViewAction.Destroy:
|
12730 |
|
12731 |
|
12732 | destroyView(view);
|
12733 | break;
|
12734 | case ViewAction.CreateViewNodes:
|
12735 | createViewNodes(view);
|
12736 | break;
|
12737 | }
|
12738 | }
|
12739 |
|
12740 |
|
12741 |
|
12742 |
|
12743 |
|
12744 | function execProjectedViewsAction(view, action) {
|
12745 | execEmbeddedViewsAction(view, action);
|
12746 | execComponentViewsAction(view, action);
|
12747 | }
|
12748 |
|
12749 |
|
12750 |
|
12751 |
|
12752 |
|
12753 |
|
12754 |
|
12755 | function execQueriesAction(view, queryFlags, staticDynamicQueryFlag, checkType) {
|
12756 | if (!(view.def.nodeFlags & queryFlags) || !(view.def.nodeFlags & staticDynamicQueryFlag)) {
|
12757 | return;
|
12758 | }
|
12759 | var nodeCount = view.def.nodes.length;
|
12760 | for (var i = 0; i < nodeCount; i++) {
|
12761 | var nodeDef = view.def.nodes[i];
|
12762 | if ((nodeDef.flags & queryFlags) && (nodeDef.flags & staticDynamicQueryFlag)) {
|
12763 | Services.setCurrentNode(view, nodeDef.index);
|
12764 | switch (checkType) {
|
12765 | case 0 :
|
12766 | checkAndUpdateQuery(view, nodeDef);
|
12767 | break;
|
12768 | case 1 :
|
12769 | checkNoChangesQuery(view, nodeDef);
|
12770 | break;
|
12771 | }
|
12772 | }
|
12773 | if (!(nodeDef.childFlags & queryFlags) || !(nodeDef.childFlags & staticDynamicQueryFlag)) {
|
12774 |
|
12775 |
|
12776 | i += nodeDef.childCount;
|
12777 | }
|
12778 | }
|
12779 | }
|
12780 |
|
12781 |
|
12782 |
|
12783 |
|
12784 |
|
12785 |
|
12786 |
|
12787 | var initialized = false;
|
12788 |
|
12789 |
|
12790 |
|
12791 | function initServicesIfNeeded() {
|
12792 | if (initialized) {
|
12793 | return;
|
12794 | }
|
12795 | initialized = true;
|
12796 | var services = isDevMode() ? createDebugServices() : createProdServices();
|
12797 | Services.setCurrentNode = services.setCurrentNode;
|
12798 | Services.createRootView = services.createRootView;
|
12799 | Services.createEmbeddedView = services.createEmbeddedView;
|
12800 | Services.createComponentView = services.createComponentView;
|
12801 | Services.createNgModuleRef = services.createNgModuleRef;
|
12802 | Services.overrideProvider = services.overrideProvider;
|
12803 | Services.clearProviderOverrides = services.clearProviderOverrides;
|
12804 | Services.checkAndUpdateView = services.checkAndUpdateView;
|
12805 | Services.checkNoChangesView = services.checkNoChangesView;
|
12806 | Services.destroyView = services.destroyView;
|
12807 | Services.resolveDep = resolveDep;
|
12808 | Services.createDebugContext = services.createDebugContext;
|
12809 | Services.handleEvent = services.handleEvent;
|
12810 | Services.updateDirectives = services.updateDirectives;
|
12811 | Services.updateRenderer = services.updateRenderer;
|
12812 | Services.dirtyParentQueries = dirtyParentQueries;
|
12813 | }
|
12814 |
|
12815 |
|
12816 |
|
12817 | function createProdServices() {
|
12818 | return {
|
12819 | setCurrentNode: function () { },
|
12820 | createRootView: createProdRootView,
|
12821 | createEmbeddedView: createEmbeddedView,
|
12822 | createComponentView: createComponentView,
|
12823 | createNgModuleRef: createNgModuleRef,
|
12824 | overrideProvider: NOOP,
|
12825 | clearProviderOverrides: NOOP,
|
12826 | checkAndUpdateView: checkAndUpdateView,
|
12827 | checkNoChangesView: checkNoChangesView,
|
12828 | destroyView: destroyView,
|
12829 | createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); },
|
12830 | handleEvent: function (view, nodeIndex, eventName, event) { return view.def.handleEvent(view, nodeIndex, eventName, event); },
|
12831 | updateDirectives: function (view, checkType) { return view.def.updateDirectives(checkType === 0 ? prodCheckAndUpdateNode :
|
12832 | prodCheckNoChangesNode, view); },
|
12833 | updateRenderer: function (view, checkType) { return view.def.updateRenderer(checkType === 0 ? prodCheckAndUpdateNode :
|
12834 | prodCheckNoChangesNode, view); },
|
12835 | };
|
12836 | }
|
12837 |
|
12838 |
|
12839 |
|
12840 | function createDebugServices() {
|
12841 | return {
|
12842 | setCurrentNode: debugSetCurrentNode,
|
12843 | createRootView: debugCreateRootView,
|
12844 | createEmbeddedView: debugCreateEmbeddedView,
|
12845 | createComponentView: debugCreateComponentView,
|
12846 | createNgModuleRef: debugCreateNgModuleRef,
|
12847 | overrideProvider: debugOverrideProvider,
|
12848 | clearProviderOverrides: debugClearProviderOverrides,
|
12849 | checkAndUpdateView: debugCheckAndUpdateView,
|
12850 | checkNoChangesView: debugCheckNoChangesView,
|
12851 | destroyView: debugDestroyView,
|
12852 | createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); },
|
12853 | handleEvent: debugHandleEvent,
|
12854 | updateDirectives: debugUpdateDirectives,
|
12855 | updateRenderer: debugUpdateRenderer,
|
12856 | };
|
12857 | }
|
12858 |
|
12859 |
|
12860 |
|
12861 |
|
12862 |
|
12863 |
|
12864 |
|
12865 |
|
12866 |
|
12867 | function createProdRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
|
12868 | var rendererFactory = ngModule.injector.get(RendererFactory2);
|
12869 | return createRootView(createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode), def, context);
|
12870 | }
|
12871 |
|
12872 |
|
12873 |
|
12874 |
|
12875 |
|
12876 |
|
12877 |
|
12878 |
|
12879 |
|
12880 | function debugCreateRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
|
12881 | var rendererFactory = ngModule.injector.get(RendererFactory2);
|
12882 | var root = createRootData(elInjector, ngModule, new DebugRendererFactory2(rendererFactory), projectableNodes, rootSelectorOrNode);
|
12883 | var defWithOverride = applyProviderOverridesToView(def);
|
12884 | return callWithDebugContext(DebugAction.create, createRootView, null, [root, defWithOverride, context]);
|
12885 | }
|
12886 |
|
12887 |
|
12888 |
|
12889 |
|
12890 |
|
12891 |
|
12892 |
|
12893 |
|
12894 | function createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode) {
|
12895 | var sanitizer = ngModule.injector.get(Sanitizer);
|
12896 | var errorHandler = ngModule.injector.get(ErrorHandler);
|
12897 | var renderer = rendererFactory.createRenderer(null, null);
|
12898 | return {
|
12899 | ngModule: ngModule,
|
12900 | injector: elInjector, projectableNodes: projectableNodes,
|
12901 | selectorOrNode: rootSelectorOrNode, sanitizer: sanitizer, rendererFactory: rendererFactory, renderer: renderer, errorHandler: errorHandler
|
12902 | };
|
12903 | }
|
12904 |
|
12905 |
|
12906 |
|
12907 |
|
12908 |
|
12909 |
|
12910 |
|
12911 | function debugCreateEmbeddedView(parentView, anchorDef, viewDef$$1, context) {
|
12912 | var defWithOverride = applyProviderOverridesToView(viewDef$$1);
|
12913 | return callWithDebugContext(DebugAction.create, createEmbeddedView, null, [parentView, anchorDef, defWithOverride, context]);
|
12914 | }
|
12915 |
|
12916 |
|
12917 |
|
12918 |
|
12919 |
|
12920 |
|
12921 |
|
12922 | function debugCreateComponentView(parentView, nodeDef, viewDef$$1, hostElement) {
|
12923 | var defWithOverride = applyProviderOverridesToView(viewDef$$1);
|
12924 | return callWithDebugContext(DebugAction.create, createComponentView, null, [parentView, nodeDef, defWithOverride, hostElement]);
|
12925 | }
|
12926 |
|
12927 |
|
12928 |
|
12929 |
|
12930 |
|
12931 |
|
12932 |
|
12933 | function debugCreateNgModuleRef(moduleType, parentInjector, bootstrapComponents, def) {
|
12934 | var defWithOverride = applyProviderOverridesToNgModule(def);
|
12935 | return createNgModuleRef(moduleType, parentInjector, bootstrapComponents, defWithOverride);
|
12936 | }
|
12937 | var providerOverrides = new Map();
|
12938 |
|
12939 |
|
12940 |
|
12941 |
|
12942 | function debugOverrideProvider(override) {
|
12943 | providerOverrides.set(override.token, override);
|
12944 | }
|
12945 |
|
12946 |
|
12947 |
|
12948 | function debugClearProviderOverrides() {
|
12949 | providerOverrides.clear();
|
12950 | }
|
12951 |
|
12952 |
|
12953 |
|
12954 |
|
12955 | function applyProviderOverridesToView(def) {
|
12956 | if (providerOverrides.size === 0) {
|
12957 | return def;
|
12958 | }
|
12959 | var elementIndicesWithOverwrittenProviders = findElementIndicesWithOverwrittenProviders(def);
|
12960 | if (elementIndicesWithOverwrittenProviders.length === 0) {
|
12961 | return def;
|
12962 | }
|
12963 |
|
12964 |
|
12965 | def = ((def.factory))(function () { return NOOP; });
|
12966 | for (var i = 0; i < elementIndicesWithOverwrittenProviders.length; i++) {
|
12967 | applyProviderOverridesToElement(def, elementIndicesWithOverwrittenProviders[i]);
|
12968 | }
|
12969 | return def;
|
12970 | |
12971 |
|
12972 |
|
12973 |
|
12974 | function findElementIndicesWithOverwrittenProviders(def) {
|
12975 | var elIndicesWithOverwrittenProviders = [];
|
12976 | var lastElementDef = null;
|
12977 | for (var i = 0; i < def.nodes.length; i++) {
|
12978 | var nodeDef = def.nodes[i];
|
12979 | if (nodeDef.flags & 1 ) {
|
12980 | lastElementDef = nodeDef;
|
12981 | }
|
12982 | if (lastElementDef && nodeDef.flags & 3840 &&
|
12983 | providerOverrides.has( ((nodeDef.provider)).token)) {
|
12984 | elIndicesWithOverwrittenProviders.push( ((lastElementDef)).index);
|
12985 | lastElementDef = null;
|
12986 | }
|
12987 | }
|
12988 | return elIndicesWithOverwrittenProviders;
|
12989 | }
|
12990 | |
12991 |
|
12992 |
|
12993 |
|
12994 |
|
12995 | function applyProviderOverridesToElement(viewDef$$1, elIndex) {
|
12996 | for (var i = elIndex + 1; i < viewDef$$1.nodes.length; i++) {
|
12997 | var nodeDef = viewDef$$1.nodes[i];
|
12998 | if (nodeDef.flags & 1 ) {
|
12999 |
|
13000 | return;
|
13001 | }
|
13002 | if (nodeDef.flags & 3840 ) {
|
13003 |
|
13004 |
|
13005 | nodeDef.flags |= 4096 ;
|
13006 | var provider = ((nodeDef.provider));
|
13007 | var override = providerOverrides.get(provider.token);
|
13008 | if (override) {
|
13009 | nodeDef.flags = (nodeDef.flags & ~3840 ) | override.flags;
|
13010 | provider.deps = splitDepsDsl(override.deps);
|
13011 | provider.value = override.value;
|
13012 | }
|
13013 | }
|
13014 | }
|
13015 | }
|
13016 | }
|
13017 |
|
13018 |
|
13019 |
|
13020 |
|
13021 | function applyProviderOverridesToNgModule(def) {
|
13022 | if (providerOverrides.size === 0 || !hasOverrrides(def)) {
|
13023 | return def;
|
13024 | }
|
13025 |
|
13026 |
|
13027 | def = ((def.factory))(function () { return NOOP; });
|
13028 | applyProviderOverrides(def);
|
13029 | return def;
|
13030 | |
13031 |
|
13032 |
|
13033 |
|
13034 | function hasOverrrides(def) {
|
13035 | return def.providers.some(function (node) { return !!(node.flags & 3840 ) && providerOverrides.has(node.token); });
|
13036 | }
|
13037 | |
13038 |
|
13039 |
|
13040 |
|
13041 | function applyProviderOverrides(def) {
|
13042 | for (var i = 0; i < def.providers.length; i++) {
|
13043 | var provider = def.providers[i];
|
13044 |
|
13045 |
|
13046 | provider.flags |= 4096 ;
|
13047 | var override = providerOverrides.get(provider.token);
|
13048 | if (override) {
|
13049 | provider.flags = (provider.flags & ~3840 ) | override.flags;
|
13050 | provider.deps = splitDepsDsl(override.deps);
|
13051 | provider.value = override.value;
|
13052 | }
|
13053 | }
|
13054 | }
|
13055 | }
|
13056 |
|
13057 |
|
13058 |
|
13059 |
|
13060 |
|
13061 |
|
13062 |
|
13063 |
|
13064 |
|
13065 |
|
13066 |
|
13067 |
|
13068 |
|
13069 |
|
13070 |
|
13071 |
|
13072 | function prodCheckAndUpdateNode(view, nodeIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
13073 | var nodeDef = view.def.nodes[nodeIndex];
|
13074 | checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
13075 | return (nodeDef.flags & 224 ) ?
|
13076 | asPureExpressionData(view, nodeIndex).value :
|
13077 | undefined;
|
13078 | }
|
13079 |
|
13080 |
|
13081 |
|
13082 |
|
13083 |
|
13084 |
|
13085 |
|
13086 |
|
13087 |
|
13088 |
|
13089 |
|
13090 |
|
13091 |
|
13092 |
|
13093 |
|
13094 |
|
13095 | function prodCheckNoChangesNode(view, nodeIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
|
13096 | var nodeDef = view.def.nodes[nodeIndex];
|
13097 | checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
|
13098 | return (nodeDef.flags & 224 ) ?
|
13099 | asPureExpressionData(view, nodeIndex).value :
|
13100 | undefined;
|
13101 | }
|
13102 |
|
13103 |
|
13104 |
|
13105 |
|
13106 | function debugCheckAndUpdateView(view) {
|
13107 | return callWithDebugContext(DebugAction.detectChanges, checkAndUpdateView, null, [view]);
|
13108 | }
|
13109 |
|
13110 |
|
13111 |
|
13112 |
|
13113 | function debugCheckNoChangesView(view) {
|
13114 | return callWithDebugContext(DebugAction.checkNoChanges, checkNoChangesView, null, [view]);
|
13115 | }
|
13116 |
|
13117 |
|
13118 |
|
13119 |
|
13120 | function debugDestroyView(view) {
|
13121 | return callWithDebugContext(DebugAction.destroy, destroyView, null, [view]);
|
13122 | }
|
13123 | var DebugAction = {};
|
13124 | DebugAction.create = 0;
|
13125 | DebugAction.detectChanges = 1;
|
13126 | DebugAction.checkNoChanges = 2;
|
13127 | DebugAction.destroy = 3;
|
13128 | DebugAction.handleEvent = 4;
|
13129 | DebugAction[DebugAction.create] = "create";
|
13130 | DebugAction[DebugAction.detectChanges] = "detectChanges";
|
13131 | DebugAction[DebugAction.checkNoChanges] = "checkNoChanges";
|
13132 | DebugAction[DebugAction.destroy] = "destroy";
|
13133 | DebugAction[DebugAction.handleEvent] = "handleEvent";
|
13134 | var _currentAction;
|
13135 | var _currentView;
|
13136 | var _currentNodeIndex;
|
13137 |
|
13138 |
|
13139 |
|
13140 |
|
13141 |
|
13142 | function debugSetCurrentNode(view, nodeIndex) {
|
13143 | _currentView = view;
|
13144 | _currentNodeIndex = nodeIndex;
|
13145 | }
|
13146 |
|
13147 |
|
13148 |
|
13149 |
|
13150 |
|
13151 |
|
13152 |
|
13153 | function debugHandleEvent(view, nodeIndex, eventName, event) {
|
13154 | debugSetCurrentNode(view, nodeIndex);
|
13155 | return callWithDebugContext(DebugAction.handleEvent, view.def.handleEvent, null, [view, nodeIndex, eventName, event]);
|
13156 | }
|
13157 |
|
13158 |
|
13159 |
|
13160 |
|
13161 |
|
13162 | function debugUpdateDirectives(view, checkType) {
|
13163 | if (view.state & 128 ) {
|
13164 | throw viewDestroyedError(DebugAction[_currentAction]);
|
13165 | }
|
13166 | debugSetCurrentNode(view, nextDirectiveWithBinding(view, 0));
|
13167 | return view.def.updateDirectives(debugCheckDirectivesFn, view);
|
13168 | |
13169 |
|
13170 |
|
13171 |
|
13172 |
|
13173 |
|
13174 |
|
13175 | function debugCheckDirectivesFn(view, nodeIndex, argStyle) {
|
13176 | var values = [];
|
13177 | for (var _i = 3; _i < arguments.length; _i++) {
|
13178 | values[_i - 3] = arguments[_i];
|
13179 | }
|
13180 | var nodeDef = view.def.nodes[nodeIndex];
|
13181 | if (checkType === 0 ) {
|
13182 | debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
|
13183 | }
|
13184 | else {
|
13185 | debugCheckNoChangesNode(view, nodeDef, argStyle, values);
|
13186 | }
|
13187 | if (nodeDef.flags & 16384 ) {
|
13188 | debugSetCurrentNode(view, nextDirectiveWithBinding(view, nodeIndex));
|
13189 | }
|
13190 | return (nodeDef.flags & 224 ) ?
|
13191 | asPureExpressionData(view, nodeDef.index).value :
|
13192 | undefined;
|
13193 | }
|
13194 | }
|
13195 |
|
13196 |
|
13197 |
|
13198 |
|
13199 |
|
13200 | function debugUpdateRenderer(view, checkType) {
|
13201 | if (view.state & 128 ) {
|
13202 | throw viewDestroyedError(DebugAction[_currentAction]);
|
13203 | }
|
13204 | debugSetCurrentNode(view, nextRenderNodeWithBinding(view, 0));
|
13205 | return view.def.updateRenderer(debugCheckRenderNodeFn, view);
|
13206 | |
13207 |
|
13208 |
|
13209 |
|
13210 |
|
13211 |
|
13212 |
|
13213 | function debugCheckRenderNodeFn(view, nodeIndex, argStyle) {
|
13214 | var values = [];
|
13215 | for (var _i = 3; _i < arguments.length; _i++) {
|
13216 | values[_i - 3] = arguments[_i];
|
13217 | }
|
13218 | var nodeDef = view.def.nodes[nodeIndex];
|
13219 | if (checkType === 0 ) {
|
13220 | debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
|
13221 | }
|
13222 | else {
|
13223 | debugCheckNoChangesNode(view, nodeDef, argStyle, values);
|
13224 | }
|
13225 | if (nodeDef.flags & 3 ) {
|
13226 | debugSetCurrentNode(view, nextRenderNodeWithBinding(view, nodeIndex));
|
13227 | }
|
13228 | return (nodeDef.flags & 224 ) ?
|
13229 | asPureExpressionData(view, nodeDef.index).value :
|
13230 | undefined;
|
13231 | }
|
13232 | }
|
13233 |
|
13234 |
|
13235 |
|
13236 |
|
13237 |
|
13238 |
|
13239 |
|
13240 | function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) {
|
13241 | var changed = ((checkAndUpdateNode)).apply(void 0, [view, nodeDef, argStyle].concat(givenValues));
|
13242 | if (changed) {
|
13243 | var values = argStyle === 1 ? givenValues[0] : givenValues;
|
13244 | if (nodeDef.flags & 16384 ) {
|
13245 | var bindingValues = {};
|
13246 | for (var i = 0; i < nodeDef.bindings.length; i++) {
|
13247 | var binding = nodeDef.bindings[i];
|
13248 | var value = values[i];
|
13249 | if (binding.flags & 8 ) {
|
13250 | bindingValues[normalizeDebugBindingName( ((binding.nonMinifiedName)))] =
|
13251 | normalizeDebugBindingValue(value);
|
13252 | }
|
13253 | }
|
13254 | var elDef = ((nodeDef.parent));
|
13255 | var el = asElementData(view, elDef.index).renderElement;
|
13256 | if (!((elDef.element)).name) {
|
13257 |
|
13258 | view.renderer.setValue(el, "bindings=" + JSON.stringify(bindingValues, null, 2));
|
13259 | }
|
13260 | else {
|
13261 |
|
13262 | for (var attr in bindingValues) {
|
13263 | var value = bindingValues[attr];
|
13264 | if (value != null) {
|
13265 | view.renderer.setAttribute(el, attr, value);
|
13266 | }
|
13267 | else {
|
13268 | view.renderer.removeAttribute(el, attr);
|
13269 | }
|
13270 | }
|
13271 | }
|
13272 | }
|
13273 | }
|
13274 | }
|
13275 |
|
13276 |
|
13277 |
|
13278 |
|
13279 |
|
13280 |
|
13281 |
|
13282 | function debugCheckNoChangesNode(view, nodeDef, argStyle, values) {
|
13283 | ((checkNoChangesNode)).apply(void 0, [view, nodeDef, argStyle].concat(values));
|
13284 | }
|
13285 |
|
13286 |
|
13287 |
|
13288 |
|
13289 | function normalizeDebugBindingName(name) {
|
13290 |
|
13291 | name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
|
13292 | return "ng-reflect-" + name;
|
13293 | }
|
13294 | var CAMEL_CASE_REGEXP = /([A-Z])/g;
|
13295 |
|
13296 |
|
13297 |
|
13298 |
|
13299 | function camelCaseToDashCase(input) {
|
13300 | return input.replace(CAMEL_CASE_REGEXP, function () {
|
13301 | var m = [];
|
13302 | for (var _i = 0; _i < arguments.length; _i++) {
|
13303 | m[_i] = arguments[_i];
|
13304 | }
|
13305 | return '-' + m[1].toLowerCase();
|
13306 | });
|
13307 | }
|
13308 |
|
13309 |
|
13310 |
|
13311 |
|
13312 | function normalizeDebugBindingValue(value) {
|
13313 | try {
|
13314 |
|
13315 | return value != null ? value.toString().slice(0, 30) : value;
|
13316 | }
|
13317 | catch (e) {
|
13318 | return '[ERROR] Exception while trying to serialize the value';
|
13319 | }
|
13320 | }
|
13321 |
|
13322 |
|
13323 |
|
13324 |
|
13325 |
|
13326 | function nextDirectiveWithBinding(view, nodeIndex) {
|
13327 | for (var i = nodeIndex; i < view.def.nodes.length; i++) {
|
13328 | var nodeDef = view.def.nodes[i];
|
13329 | if (nodeDef.flags & 16384 && nodeDef.bindings && nodeDef.bindings.length) {
|
13330 | return i;
|
13331 | }
|
13332 | }
|
13333 | return null;
|
13334 | }
|
13335 |
|
13336 |
|
13337 |
|
13338 |
|
13339 |
|
13340 | function nextRenderNodeWithBinding(view, nodeIndex) {
|
13341 | for (var i = nodeIndex; i < view.def.nodes.length; i++) {
|
13342 | var nodeDef = view.def.nodes[i];
|
13343 | if ((nodeDef.flags & 3 ) && nodeDef.bindings && nodeDef.bindings.length) {
|
13344 | return i;
|
13345 | }
|
13346 | }
|
13347 | return null;
|
13348 | }
|
13349 | var DebugContext_ = (function () {
|
13350 | |
13351 |
|
13352 |
|
13353 |
|
13354 | function DebugContext_(view, nodeIndex) {
|
13355 | this.view = view;
|
13356 | this.nodeIndex = nodeIndex;
|
13357 | if (nodeIndex == null) {
|
13358 | this.nodeIndex = nodeIndex = 0;
|
13359 | }
|
13360 | this.nodeDef = view.def.nodes[nodeIndex];
|
13361 | var elDef = this.nodeDef;
|
13362 | var elView = view;
|
13363 | while (elDef && (elDef.flags & 1 ) === 0) {
|
13364 | elDef = elDef.parent;
|
13365 | }
|
13366 | if (!elDef) {
|
13367 | while (!elDef && elView) {
|
13368 | elDef = viewParentEl(elView);
|
13369 | elView = elView.parent;
|
13370 | }
|
13371 | }
|
13372 | this.elDef = elDef;
|
13373 | this.elView = elView;
|
13374 | }
|
13375 | Object.defineProperty(DebugContext_.prototype, "elOrCompView", {
|
13376 | |
13377 |
|
13378 |
|
13379 | get: function () {
|
13380 |
|
13381 | return asElementData(this.elView, this.elDef.index).componentView || this.view;
|
13382 | },
|
13383 | enumerable: true,
|
13384 | configurable: true
|
13385 | });
|
13386 | Object.defineProperty(DebugContext_.prototype, "injector", {
|
13387 | |
13388 |
|
13389 |
|
13390 | get: function () { return createInjector(this.elView, this.elDef); },
|
13391 | enumerable: true,
|
13392 | configurable: true
|
13393 | });
|
13394 | Object.defineProperty(DebugContext_.prototype, "component", {
|
13395 | |
13396 |
|
13397 |
|
13398 | get: function () { return this.elOrCompView.component; },
|
13399 | enumerable: true,
|
13400 | configurable: true
|
13401 | });
|
13402 | Object.defineProperty(DebugContext_.prototype, "context", {
|
13403 | |
13404 |
|
13405 |
|
13406 | get: function () { return this.elOrCompView.context; },
|
13407 | enumerable: true,
|
13408 | configurable: true
|
13409 | });
|
13410 | Object.defineProperty(DebugContext_.prototype, "providerTokens", {
|
13411 | |
13412 |
|
13413 |
|
13414 | get: function () {
|
13415 | var tokens = [];
|
13416 | if (this.elDef) {
|
13417 | for (var i = this.elDef.index + 1; i <= this.elDef.index + this.elDef.childCount; i++) {
|
13418 | var childDef = this.elView.def.nodes[i];
|
13419 | if (childDef.flags & 20224 ) {
|
13420 | tokens.push( ((childDef.provider)).token);
|
13421 | }
|
13422 | i += childDef.childCount;
|
13423 | }
|
13424 | }
|
13425 | return tokens;
|
13426 | },
|
13427 | enumerable: true,
|
13428 | configurable: true
|
13429 | });
|
13430 | Object.defineProperty(DebugContext_.prototype, "references", {
|
13431 | |
13432 |
|
13433 |
|
13434 | get: function () {
|
13435 | var references = {};
|
13436 | if (this.elDef) {
|
13437 | collectReferences(this.elView, this.elDef, references);
|
13438 | for (var i = this.elDef.index + 1; i <= this.elDef.index + this.elDef.childCount; i++) {
|
13439 | var childDef = this.elView.def.nodes[i];
|
13440 | if (childDef.flags & 20224 ) {
|
13441 | collectReferences(this.elView, childDef, references);
|
13442 | }
|
13443 | i += childDef.childCount;
|
13444 | }
|
13445 | }
|
13446 | return references;
|
13447 | },
|
13448 | enumerable: true,
|
13449 | configurable: true
|
13450 | });
|
13451 | Object.defineProperty(DebugContext_.prototype, "componentRenderElement", {
|
13452 | |
13453 |
|
13454 |
|
13455 | get: function () {
|
13456 | var elData = findHostElement(this.elOrCompView);
|
13457 | return elData ? elData.renderElement : undefined;
|
13458 | },
|
13459 | enumerable: true,
|
13460 | configurable: true
|
13461 | });
|
13462 | Object.defineProperty(DebugContext_.prototype, "renderNode", {
|
13463 | |
13464 |
|
13465 |
|
13466 | get: function () {
|
13467 | return this.nodeDef.flags & 2 ? renderNode(this.view, this.nodeDef) :
|
13468 | renderNode(this.elView, this.elDef);
|
13469 | },
|
13470 | enumerable: true,
|
13471 | configurable: true
|
13472 | });
|
13473 | |
13474 |
|
13475 |
|
13476 |
|
13477 |
|
13478 | DebugContext_.prototype.logError = function (console) {
|
13479 | var values = [];
|
13480 | for (var _i = 1; _i < arguments.length; _i++) {
|
13481 | values[_i - 1] = arguments[_i];
|
13482 | }
|
13483 | var logViewDef;
|
13484 | var logNodeIndex;
|
13485 | if (this.nodeDef.flags & 2 ) {
|
13486 | logViewDef = this.view.def;
|
13487 | logNodeIndex = this.nodeDef.index;
|
13488 | }
|
13489 | else {
|
13490 | logViewDef = this.elView.def;
|
13491 | logNodeIndex = this.elDef.index;
|
13492 | }
|
13493 |
|
13494 |
|
13495 | var renderNodeIndex = getRenderNodeIndex(logViewDef, logNodeIndex);
|
13496 | var currRenderNodeIndex = -1;
|
13497 | var nodeLogger = function () {
|
13498 | currRenderNodeIndex++;
|
13499 | if (currRenderNodeIndex === renderNodeIndex) {
|
13500 | return (_a = console.error).bind.apply(_a, [console].concat(values));
|
13501 | }
|
13502 | else {
|
13503 | return NOOP;
|
13504 | }
|
13505 | var _a;
|
13506 | };
|
13507 | ((logViewDef.factory))(nodeLogger);
|
13508 | if (currRenderNodeIndex < renderNodeIndex) {
|
13509 | console.error('Illegal state: the ViewDefinitionFactory did not call the logger!');
|
13510 | console.error.apply(console, values);
|
13511 | }
|
13512 | };
|
13513 | return DebugContext_;
|
13514 | }());
|
13515 |
|
13516 |
|
13517 |
|
13518 |
|
13519 |
|
13520 | function getRenderNodeIndex(viewDef$$1, nodeIndex) {
|
13521 | var renderNodeIndex = -1;
|
13522 | for (var i = 0; i <= nodeIndex; i++) {
|
13523 | var nodeDef = viewDef$$1.nodes[i];
|
13524 | if (nodeDef.flags & 3 ) {
|
13525 | renderNodeIndex++;
|
13526 | }
|
13527 | }
|
13528 | return renderNodeIndex;
|
13529 | }
|
13530 |
|
13531 |
|
13532 |
|
13533 |
|
13534 | function findHostElement(view) {
|
13535 | while (view && !isComponentView(view)) {
|
13536 | view = ((view.parent));
|
13537 | }
|
13538 | if (view.parent) {
|
13539 | return asElementData(view.parent, ((viewParentEl(view))).index);
|
13540 | }
|
13541 | return null;
|
13542 | }
|
13543 |
|
13544 |
|
13545 |
|
13546 |
|
13547 |
|
13548 |
|
13549 | function collectReferences(view, nodeDef, references) {
|
13550 | for (var refName in nodeDef.references) {
|
13551 | references[refName] = getQueryValue(view, nodeDef, nodeDef.references[refName]);
|
13552 | }
|
13553 | }
|
13554 |
|
13555 |
|
13556 |
|
13557 |
|
13558 |
|
13559 |
|
13560 |
|
13561 | function callWithDebugContext(action, fn, self, args) {
|
13562 | var oldAction = _currentAction;
|
13563 | var oldView = _currentView;
|
13564 | var oldNodeIndex = _currentNodeIndex;
|
13565 | try {
|
13566 | _currentAction = action;
|
13567 | var result = fn.apply(self, args);
|
13568 | _currentView = oldView;
|
13569 | _currentNodeIndex = oldNodeIndex;
|
13570 | _currentAction = oldAction;
|
13571 | return result;
|
13572 | }
|
13573 | catch (e) {
|
13574 | if (isViewDebugError(e) || !_currentView) {
|
13575 | throw e;
|
13576 | }
|
13577 | throw viewWrappedDebugError(e, ((getCurrentDebugContext())));
|
13578 | }
|
13579 | }
|
13580 |
|
13581 |
|
13582 |
|
13583 | function getCurrentDebugContext() {
|
13584 | return _currentView ? new DebugContext_(_currentView, _currentNodeIndex) : null;
|
13585 | }
|
13586 | var DebugRendererFactory2 = (function () {
|
13587 | |
13588 |
|
13589 |
|
13590 | function DebugRendererFactory2(delegate) {
|
13591 | this.delegate = delegate;
|
13592 | }
|
13593 | |
13594 |
|
13595 |
|
13596 |
|
13597 |
|
13598 | DebugRendererFactory2.prototype.createRenderer = function (element, renderData) {
|
13599 | return new DebugRenderer2(this.delegate.createRenderer(element, renderData));
|
13600 | };
|
13601 | |
13602 |
|
13603 |
|
13604 | DebugRendererFactory2.prototype.begin = function () {
|
13605 | if (this.delegate.begin) {
|
13606 | this.delegate.begin();
|
13607 | }
|
13608 | };
|
13609 | |
13610 |
|
13611 |
|
13612 | DebugRendererFactory2.prototype.end = function () {
|
13613 | if (this.delegate.end) {
|
13614 | this.delegate.end();
|
13615 | }
|
13616 | };
|
13617 | |
13618 |
|
13619 |
|
13620 | DebugRendererFactory2.prototype.whenRenderingDone = function () {
|
13621 | if (this.delegate.whenRenderingDone) {
|
13622 | return this.delegate.whenRenderingDone();
|
13623 | }
|
13624 | return Promise.resolve(null);
|
13625 | };
|
13626 | return DebugRendererFactory2;
|
13627 | }());
|
13628 | var DebugRenderer2 = (function () {
|
13629 | |
13630 |
|
13631 |
|
13632 | function DebugRenderer2(delegate) {
|
13633 | this.delegate = delegate;
|
13634 | }
|
13635 | Object.defineProperty(DebugRenderer2.prototype, "data", {
|
13636 | |
13637 |
|
13638 |
|
13639 | get: function () { return this.delegate.data; },
|
13640 | enumerable: true,
|
13641 | configurable: true
|
13642 | });
|
13643 | |
13644 |
|
13645 |
|
13646 |
|
13647 | DebugRenderer2.prototype.destroyNode = function (node) {
|
13648 | removeDebugNodeFromIndex( ((getDebugNode(node))));
|
13649 | if (this.delegate.destroyNode) {
|
13650 | this.delegate.destroyNode(node);
|
13651 | }
|
13652 | };
|
13653 | |
13654 |
|
13655 |
|
13656 | DebugRenderer2.prototype.destroy = function () { this.delegate.destroy(); };
|
13657 | |
13658 |
|
13659 |
|
13660 |
|
13661 |
|
13662 | DebugRenderer2.prototype.createElement = function (name, namespace) {
|
13663 | var el = this.delegate.createElement(name, namespace);
|
13664 | var debugCtx = getCurrentDebugContext();
|
13665 | if (debugCtx) {
|
13666 | var debugEl = new DebugElement(el, null, debugCtx);
|
13667 | debugEl.name = name;
|
13668 | indexDebugNode(debugEl);
|
13669 | }
|
13670 | return el;
|
13671 | };
|
13672 | |
13673 |
|
13674 |
|
13675 |
|
13676 | DebugRenderer2.prototype.createComment = function (value) {
|
13677 | var comment = this.delegate.createComment(value);
|
13678 | var debugCtx = getCurrentDebugContext();
|
13679 | if (debugCtx) {
|
13680 | indexDebugNode(new DebugNode(comment, null, debugCtx));
|
13681 | }
|
13682 | return comment;
|
13683 | };
|
13684 | |
13685 |
|
13686 |
|
13687 |
|
13688 | DebugRenderer2.prototype.createText = function (value) {
|
13689 | var text = this.delegate.createText(value);
|
13690 | var debugCtx = getCurrentDebugContext();
|
13691 | if (debugCtx) {
|
13692 | indexDebugNode(new DebugNode(text, null, debugCtx));
|
13693 | }
|
13694 | return text;
|
13695 | };
|
13696 | |
13697 |
|
13698 |
|
13699 |
|
13700 |
|
13701 | DebugRenderer2.prototype.appendChild = function (parent, newChild) {
|
13702 | var debugEl = getDebugNode(parent);
|
13703 | var debugChildEl = getDebugNode(newChild);
|
13704 | if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
|
13705 | debugEl.addChild(debugChildEl);
|
13706 | }
|
13707 | this.delegate.appendChild(parent, newChild);
|
13708 | };
|
13709 | |
13710 |
|
13711 |
|
13712 |
|
13713 |
|
13714 |
|
13715 | DebugRenderer2.prototype.insertBefore = function (parent, newChild, refChild) {
|
13716 | var debugEl = getDebugNode(parent);
|
13717 | var debugChildEl = getDebugNode(newChild);
|
13718 | var debugRefEl = ((getDebugNode(refChild)));
|
13719 | if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
|
13720 | debugEl.insertBefore(debugRefEl, debugChildEl);
|
13721 | }
|
13722 | this.delegate.insertBefore(parent, newChild, refChild);
|
13723 | };
|
13724 | |
13725 |
|
13726 |
|
13727 |
|
13728 |
|
13729 | DebugRenderer2.prototype.removeChild = function (parent, oldChild) {
|
13730 | var debugEl = getDebugNode(parent);
|
13731 | var debugChildEl = getDebugNode(oldChild);
|
13732 | if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
|
13733 | debugEl.removeChild(debugChildEl);
|
13734 | }
|
13735 | this.delegate.removeChild(parent, oldChild);
|
13736 | };
|
13737 | |
13738 |
|
13739 |
|
13740 |
|
13741 | DebugRenderer2.prototype.selectRootElement = function (selectorOrNode) {
|
13742 | var el = this.delegate.selectRootElement(selectorOrNode);
|
13743 | var debugCtx = getCurrentDebugContext();
|
13744 | if (debugCtx) {
|
13745 | indexDebugNode(new DebugElement(el, null, debugCtx));
|
13746 | }
|
13747 | return el;
|
13748 | };
|
13749 | |
13750 |
|
13751 |
|
13752 |
|
13753 |
|
13754 |
|
13755 |
|
13756 | DebugRenderer2.prototype.setAttribute = function (el, name, value, namespace) {
|
13757 | var debugEl = getDebugNode(el);
|
13758 | if (debugEl && debugEl instanceof DebugElement) {
|
13759 | var fullName = namespace ? namespace + ':' + name : name;
|
13760 | debugEl.attributes[fullName] = value;
|
13761 | }
|
13762 | this.delegate.setAttribute(el, name, value, namespace);
|
13763 | };
|
13764 | |
13765 |
|
13766 |
|
13767 |
|
13768 |
|
13769 |
|
13770 | DebugRenderer2.prototype.removeAttribute = function (el, name, namespace) {
|
13771 | var debugEl = getDebugNode(el);
|
13772 | if (debugEl && debugEl instanceof DebugElement) {
|
13773 | var fullName = namespace ? namespace + ':' + name : name;
|
13774 | debugEl.attributes[fullName] = null;
|
13775 | }
|
13776 | this.delegate.removeAttribute(el, name, namespace);
|
13777 | };
|
13778 | |
13779 |
|
13780 |
|
13781 |
|
13782 |
|
13783 | DebugRenderer2.prototype.addClass = function (el, name) {
|
13784 | var debugEl = getDebugNode(el);
|
13785 | if (debugEl && debugEl instanceof DebugElement) {
|
13786 | debugEl.classes[name] = true;
|
13787 | }
|
13788 | this.delegate.addClass(el, name);
|
13789 | };
|
13790 | |
13791 |
|
13792 |
|
13793 |
|
13794 |
|
13795 | DebugRenderer2.prototype.removeClass = function (el, name) {
|
13796 | var debugEl = getDebugNode(el);
|
13797 | if (debugEl && debugEl instanceof DebugElement) {
|
13798 | debugEl.classes[name] = false;
|
13799 | }
|
13800 | this.delegate.removeClass(el, name);
|
13801 | };
|
13802 | |
13803 |
|
13804 |
|
13805 |
|
13806 |
|
13807 |
|
13808 |
|
13809 | DebugRenderer2.prototype.setStyle = function (el, style, value, flags) {
|
13810 | var debugEl = getDebugNode(el);
|
13811 | if (debugEl && debugEl instanceof DebugElement) {
|
13812 | debugEl.styles[style] = value;
|
13813 | }
|
13814 | this.delegate.setStyle(el, style, value, flags);
|
13815 | };
|
13816 | |
13817 |
|
13818 |
|
13819 |
|
13820 |
|
13821 |
|
13822 | DebugRenderer2.prototype.removeStyle = function (el, style, flags) {
|
13823 | var debugEl = getDebugNode(el);
|
13824 | if (debugEl && debugEl instanceof DebugElement) {
|
13825 | debugEl.styles[style] = null;
|
13826 | }
|
13827 | this.delegate.removeStyle(el, style, flags);
|
13828 | };
|
13829 | |
13830 |
|
13831 |
|
13832 |
|
13833 |
|
13834 |
|
13835 | DebugRenderer2.prototype.setProperty = function (el, name, value) {
|
13836 | var debugEl = getDebugNode(el);
|
13837 | if (debugEl && debugEl instanceof DebugElement) {
|
13838 | debugEl.properties[name] = value;
|
13839 | }
|
13840 | this.delegate.setProperty(el, name, value);
|
13841 | };
|
13842 | |
13843 |
|
13844 |
|
13845 |
|
13846 |
|
13847 |
|
13848 | DebugRenderer2.prototype.listen = function (target, eventName, callback) {
|
13849 | if (typeof target !== 'string') {
|
13850 | var debugEl = getDebugNode(target);
|
13851 | if (debugEl) {
|
13852 | debugEl.listeners.push(new EventListener(eventName, callback));
|
13853 | }
|
13854 | }
|
13855 | return this.delegate.listen(target, eventName, callback);
|
13856 | };
|
13857 | |
13858 |
|
13859 |
|
13860 |
|
13861 | DebugRenderer2.prototype.parentNode = function (node) { return this.delegate.parentNode(node); };
|
13862 | |
13863 |
|
13864 |
|
13865 |
|
13866 | DebugRenderer2.prototype.nextSibling = function (node) { return this.delegate.nextSibling(node); };
|
13867 | |
13868 |
|
13869 |
|
13870 |
|
13871 |
|
13872 | DebugRenderer2.prototype.setValue = function (node, value) { return this.delegate.setValue(node, value); };
|
13873 | return DebugRenderer2;
|
13874 | }());
|
13875 |
|
13876 |
|
13877 |
|
13878 |
|
13879 |
|
13880 |
|
13881 |
|
13882 |
|
13883 |
|
13884 |
|
13885 |
|
13886 | function overrideProvider(override) {
|
13887 | initServicesIfNeeded();
|
13888 | return Services.overrideProvider(override);
|
13889 | }
|
13890 |
|
13891 |
|
13892 |
|
13893 | function clearProviderOverrides() {
|
13894 | initServicesIfNeeded();
|
13895 | return Services.clearProviderOverrides();
|
13896 | }
|
13897 |
|
13898 |
|
13899 |
|
13900 |
|
13901 |
|
13902 |
|
13903 | function createNgModuleFactory(ngModuleType, bootstrapComponents, defFactory) {
|
13904 | return new NgModuleFactory_(ngModuleType, bootstrapComponents, defFactory);
|
13905 | }
|
13906 | var NgModuleFactory_ = (function (_super) {
|
13907 | __extends(NgModuleFactory_, _super);
|
13908 | |
13909 |
|
13910 |
|
13911 |
|
13912 |
|
13913 | function NgModuleFactory_(moduleType, _bootstrapComponents, _ngModuleDefFactory) {
|
13914 | var _this =
|
13915 |
|
13916 |
|
13917 | _super.call(this) || this;
|
13918 | _this.moduleType = moduleType;
|
13919 | _this._bootstrapComponents = _bootstrapComponents;
|
13920 | _this._ngModuleDefFactory = _ngModuleDefFactory;
|
13921 | return _this;
|
13922 | }
|
13923 | |
13924 |
|
13925 |
|
13926 |
|
13927 | NgModuleFactory_.prototype.create = function (parentInjector) {
|
13928 | initServicesIfNeeded();
|
13929 | var def = resolveDefinition(this._ngModuleDefFactory);
|
13930 | return Services.createNgModuleRef(this.moduleType, parentInjector || Injector.NULL, this._bootstrapComponents, def);
|
13931 | };
|
13932 | return NgModuleFactory_;
|
13933 | }(NgModuleFactory));
|
13934 |
|
13935 |
|
13936 |
|
13937 |
|
13938 |
|
13939 |
|
13940 |
|
13941 |
|
13942 |
|
13943 |
|
13944 |
|
13945 |
|
13946 |
|
13947 |
|
13948 |
|
13949 |
|
13950 |
|
13951 |
|
13952 |
|
13953 |
|
13954 |
|
13955 |
|
13956 |
|
13957 |
|
13958 |
|
13959 |
|
13960 |
|
13961 |
|
13962 |
|
13963 |
|
13964 |
|
13965 |
|
13966 |
|
13967 |
|
13968 |
|
13969 |
|
13970 |
|
13971 |
|
13972 |
|
13973 |
|
13974 |
|
13975 |
|
13976 |
|
13977 |
|
13978 |
|
13979 |
|
13980 |
|
13981 |
|
13982 |
|
13983 |
|
13984 |
|
13985 |
|
13986 |
|
13987 |
|
13988 |
|
13989 |
|
13990 |
|
13991 |
|
13992 |
|
13993 |
|
13994 |
|
13995 |
|
13996 |
|
13997 |
|
13998 |
|
13999 |
|
14000 |
|
14001 |
|
14002 |
|
14003 |
|
14004 |
|
14005 |
|
14006 |
|
14007 |
|
14008 |
|
14009 |
|
14010 |
|
14011 |
|
14012 | function trigger$1(name, definitions) {
|
14013 | return { type: 7 , name: name, definitions: definitions, options: {} };
|
14014 | }
|
14015 |
|
14016 |
|
14017 |
|
14018 |
|
14019 |
|
14020 |
|
14021 |
|
14022 |
|
14023 |
|
14024 |
|
14025 |
|
14026 |
|
14027 |
|
14028 |
|
14029 |
|
14030 |
|
14031 |
|
14032 |
|
14033 |
|
14034 |
|
14035 |
|
14036 |
|
14037 |
|
14038 |
|
14039 |
|
14040 |
|
14041 |
|
14042 |
|
14043 |
|
14044 |
|
14045 |
|
14046 |
|
14047 |
|
14048 |
|
14049 |
|
14050 |
|
14051 |
|
14052 |
|
14053 |
|
14054 |
|
14055 |
|
14056 |
|
14057 |
|
14058 |
|
14059 |
|
14060 |
|
14061 |
|
14062 |
|
14063 | function animate$1(timings, styles) {
|
14064 | if (styles === void 0) { styles = null; }
|
14065 | return { type: 4 , styles: styles, timings: timings };
|
14066 | }
|
14067 |
|
14068 |
|
14069 |
|
14070 |
|
14071 |
|
14072 |
|
14073 |
|
14074 |
|
14075 |
|
14076 |
|
14077 |
|
14078 |
|
14079 |
|
14080 |
|
14081 |
|
14082 |
|
14083 |
|
14084 |
|
14085 |
|
14086 |
|
14087 |
|
14088 |
|
14089 |
|
14090 |
|
14091 |
|
14092 |
|
14093 |
|
14094 |
|
14095 |
|
14096 |
|
14097 |
|
14098 |
|
14099 |
|
14100 |
|
14101 | function group$1(steps, options) {
|
14102 | if (options === void 0) { options = null; }
|
14103 | return { type: 3 , steps: steps, options: options };
|
14104 | }
|
14105 |
|
14106 |
|
14107 |
|
14108 |
|
14109 |
|
14110 |
|
14111 |
|
14112 |
|
14113 |
|
14114 |
|
14115 |
|
14116 |
|
14117 |
|
14118 |
|
14119 |
|
14120 |
|
14121 |
|
14122 |
|
14123 |
|
14124 |
|
14125 |
|
14126 |
|
14127 |
|
14128 |
|
14129 |
|
14130 |
|
14131 |
|
14132 |
|
14133 |
|
14134 |
|
14135 |
|
14136 |
|
14137 |
|
14138 |
|
14139 |
|
14140 |
|
14141 |
|
14142 | function sequence$1(steps, options) {
|
14143 | if (options === void 0) { options = null; }
|
14144 | return { type: 2 , steps: steps, options: options };
|
14145 | }
|
14146 |
|
14147 |
|
14148 |
|
14149 |
|
14150 |
|
14151 |
|
14152 |
|
14153 |
|
14154 |
|
14155 |
|
14156 |
|
14157 |
|
14158 |
|
14159 |
|
14160 |
|
14161 |
|
14162 |
|
14163 |
|
14164 |
|
14165 |
|
14166 |
|
14167 |
|
14168 |
|
14169 |
|
14170 |
|
14171 |
|
14172 |
|
14173 |
|
14174 |
|
14175 |
|
14176 |
|
14177 |
|
14178 |
|
14179 |
|
14180 |
|
14181 |
|
14182 |
|
14183 |
|
14184 |
|
14185 |
|
14186 |
|
14187 |
|
14188 |
|
14189 |
|
14190 | function style$1(tokens) {
|
14191 | return { type: 6 , styles: tokens, offset: null };
|
14192 | }
|
14193 |
|
14194 |
|
14195 |
|
14196 |
|
14197 |
|
14198 |
|
14199 |
|
14200 |
|
14201 |
|
14202 |
|
14203 |
|
14204 |
|
14205 |
|
14206 |
|
14207 |
|
14208 |
|
14209 |
|
14210 |
|
14211 |
|
14212 |
|
14213 |
|
14214 |
|
14215 |
|
14216 |
|
14217 |
|
14218 |
|
14219 |
|
14220 |
|
14221 |
|
14222 |
|
14223 |
|
14224 |
|
14225 |
|
14226 |
|
14227 |
|
14228 |
|
14229 |
|
14230 |
|
14231 |
|
14232 |
|
14233 |
|
14234 |
|
14235 |
|
14236 |
|
14237 |
|
14238 |
|
14239 |
|
14240 |
|
14241 |
|
14242 |
|
14243 |
|
14244 | function state$1(name, styles) {
|
14245 | return { type: 0 , name: name, styles: styles };
|
14246 | }
|
14247 |
|
14248 |
|
14249 |
|
14250 |
|
14251 |
|
14252 |
|
14253 |
|
14254 |
|
14255 |
|
14256 |
|
14257 |
|
14258 |
|
14259 |
|
14260 |
|
14261 |
|
14262 |
|
14263 |
|
14264 |
|
14265 |
|
14266 |
|
14267 |
|
14268 |
|
14269 |
|
14270 |
|
14271 |
|
14272 |
|
14273 |
|
14274 |
|
14275 |
|
14276 |
|
14277 |
|
14278 |
|
14279 |
|
14280 |
|
14281 |
|
14282 |
|
14283 |
|
14284 |
|
14285 |
|
14286 |
|
14287 |
|
14288 |
|
14289 |
|
14290 |
|
14291 |
|
14292 |
|
14293 |
|
14294 | function keyframes$1(steps) {
|
14295 | return { type: 5 , steps: steps };
|
14296 | }
|
14297 |
|
14298 |
|
14299 |
|
14300 |
|
14301 |
|
14302 |
|
14303 |
|
14304 |
|
14305 |
|
14306 |
|
14307 |
|
14308 |
|
14309 |
|
14310 |
|
14311 |
|
14312 |
|
14313 |
|
14314 |
|
14315 |
|
14316 |
|
14317 |
|
14318 |
|
14319 |
|
14320 |
|
14321 |
|
14322 |
|
14323 |
|
14324 |
|
14325 |
|
14326 |
|
14327 |
|
14328 |
|
14329 |
|
14330 |
|
14331 |
|
14332 |
|
14333 |
|
14334 |
|
14335 |
|
14336 |
|
14337 |
|
14338 |
|
14339 |
|
14340 |
|
14341 |
|
14342 |
|
14343 |
|
14344 |
|
14345 |
|
14346 |
|
14347 |
|
14348 |
|
14349 |
|
14350 |
|
14351 |
|
14352 |
|
14353 |
|
14354 |
|
14355 |
|
14356 |
|
14357 |
|
14358 |
|
14359 |
|
14360 |
|
14361 |
|
14362 |
|
14363 |
|
14364 |
|
14365 |
|
14366 |
|
14367 |
|
14368 |
|
14369 |
|
14370 |
|
14371 |
|
14372 |
|
14373 |
|
14374 |
|
14375 |
|
14376 |
|
14377 |
|
14378 |
|
14379 |
|
14380 |
|
14381 |
|
14382 |
|
14383 |
|
14384 |
|
14385 |
|
14386 |
|
14387 |
|
14388 |
|
14389 |
|
14390 |
|
14391 |
|
14392 |
|
14393 |
|
14394 |
|
14395 |
|
14396 |
|
14397 |
|
14398 |
|
14399 |
|
14400 |
|
14401 |
|
14402 |
|
14403 |
|
14404 |
|
14405 |
|
14406 |
|
14407 |
|
14408 | function transition$1(stateChangeExpr, steps, options) {
|
14409 | if (options === void 0) { options = null; }
|
14410 | return { type: 1 , expr: stateChangeExpr, animation: steps, options: options };
|
14411 | }
|
14412 |
|
14413 |
|
14414 |
|
14415 |
|
14416 |
|
14417 |
|
14418 |
|
14419 |
|
14420 |
|
14421 |
|
14422 |
|
14423 |
|
14424 |
|
14425 |
|
14426 |
|
14427 |
|
14428 |
|
14429 |
|
14430 |
|
14431 |
|
14432 |
|
14433 |
|
14434 |
|
14435 |
|
14436 |
|
14437 |
|
14438 |
|
14439 |
|
14440 |
|
14441 |
|
14442 |
|
14443 |
|
14444 |
|
14445 |
|
14446 |
|
14447 |
|
14448 |
|
14449 |
|
14450 |
|
14451 |
|
14452 |
|
14453 |
|
14454 |
|
14455 |
|
14456 |
|
14457 |
|
14458 |
|
14459 |
|
14460 |
|
14461 |
|
14462 |
|
14463 |
|
14464 |
|
14465 |
|
14466 |
|
14467 |
|
14468 |
|
14469 |
|
14470 |
|
14471 |
|
14472 |
|
14473 |
|
14474 |
|
14475 |
|
14476 |
|
14477 |
|
14478 |
|
14479 |
|
14480 |
|
14481 |
|
14482 |
|
14483 |
|
14484 |
|
14485 |
|
14486 |
|
14487 |
|
14488 |
|
14489 |
|
14490 |
|
14491 |
|
14492 |
|
14493 |
|
14494 |
|
14495 |
|
14496 |
|
14497 |
|
14498 |
|
14499 |
|
14500 |
|
14501 |
|
14502 |
|
14503 |
|
14504 |
|
14505 |
|
14506 |
|
14507 |
|
14508 |
|
14509 |
|
14510 |
|
14511 |
|
14512 |
|
14513 |
|
14514 |
|
14515 |
|
14516 |
|
14517 |
|
14518 |
|
14519 |
|
14520 |
|
14521 |
|
14522 |
|
14523 |
|
14524 |
|
14525 |
|
14526 |
|
14527 |
|
14528 |
|
14529 |
|
14530 |
|
14531 |
|
14532 |
|
14533 |
|
14534 |
|
14535 |
|
14536 |
|
14537 |
|
14538 |
|
14539 |
|
14540 |
|
14541 |
|
14542 |
|
14543 |
|
14544 |
|
14545 |
|
14546 |
|
14547 |
|
14548 |
|
14549 |
|
14550 |
|
14551 |
|
14552 |
|
14553 |
|
14554 |
|
14555 |
|
14556 |
|
14557 |
|
14558 |
|
14559 |
|
14560 |
|
14561 |
|
14562 |
|
14563 |
|
14564 |
|
14565 |
|
14566 |
|
14567 |
|
14568 |
|
14569 |
|
14570 |
|
14571 |
|
14572 |
|
14573 |
|
14574 |
|
14575 |
|
14576 |
|
14577 |
|
14578 |
|
14579 |
|
14580 |
|
14581 |
|
14582 |
|
14583 |
|
14584 |
|
14585 |
|
14586 |
|
14587 |
|
14588 |
|
14589 |
|
14590 |
|
14591 |
|
14592 |
|
14593 |
|
14594 |
|
14595 |
|
14596 |
|
14597 |
|
14598 |
|
14599 |
|
14600 |
|
14601 |
|
14602 |
|
14603 |
|
14604 |
|
14605 |
|
14606 |
|
14607 |
|
14608 |
|
14609 |
|
14610 |
|
14611 |
|
14612 |
|
14613 |
|
14614 |
|
14615 |
|
14616 |
|
14617 |
|
14618 |
|
14619 |
|
14620 |
|
14621 |
|
14622 |
|
14623 |
|
14624 |
|
14625 |
|
14626 |
|
14627 |
|
14628 |
|
14629 |
|
14630 |
|
14631 |
|
14632 |
|
14633 |
|
14634 |
|
14635 |
|
14636 |
|
14637 |
|
14638 |
|
14639 |
|
14640 |
|
14641 |
|
14642 |
|
14643 |
|
14644 |
|
14645 |
|
14646 |
|
14647 |
|
14648 |
|
14649 |
|
14650 |
|
14651 |
|
14652 |
|
14653 |
|
14654 |
|
14655 |
|
14656 |
|
14657 |
|
14658 |
|
14659 |
|
14660 |
|
14661 |
|
14662 |
|
14663 |
|
14664 |
|
14665 |
|
14666 |
|
14667 |
|
14668 |
|
14669 |
|
14670 |
|
14671 |
|
14672 |
|
14673 |
|
14674 |
|
14675 |
|
14676 |
|
14677 |
|
14678 |
|
14679 |
|
14680 |
|
14681 |
|
14682 |
|
14683 |
|
14684 |
|
14685 |
|
14686 |
|
14687 |
|
14688 |
|
14689 |
|
14690 |
|
14691 |
|
14692 |
|
14693 |
|
14694 |
|
14695 |
|
14696 |
|
14697 |
|
14698 |
|
14699 |
|
14700 |
|
14701 |
|
14702 |
|
14703 |
|
14704 |
|
14705 |
|
14706 |
|
14707 |
|
14708 |
|
14709 |
|
14710 |
|
14711 |
|
14712 |
|
14713 |
|
14714 |
|
14715 |
|
14716 |
|
14717 |
|
14718 |
|
14719 |
|
14720 |
|
14721 |
|
14722 |
|
14723 |
|
14724 |
|
14725 |
|
14726 |
|
14727 |
|
14728 |
|
14729 |
|
14730 |
|
14731 |
|
14732 |
|
14733 |
|
14734 |
|
14735 |
|
14736 |
|
14737 |
|
14738 |
|
14739 |
|
14740 |
|
14741 |
|
14742 |
|
14743 |
|
14744 |
|
14745 |
|
14746 | var AUTO_STYLE$$1 = '*';
|
14747 |
|
14748 |
|
14749 |
|
14750 |
|
14751 |
|
14752 |
|
14753 | function trigger$$1(name, definitions) {
|
14754 | return trigger$1(name, definitions);
|
14755 | }
|
14756 |
|
14757 |
|
14758 |
|
14759 |
|
14760 |
|
14761 |
|
14762 | function animate$$1(timings, styles) {
|
14763 | return animate$1(timings, styles);
|
14764 | }
|
14765 |
|
14766 |
|
14767 |
|
14768 |
|
14769 |
|
14770 | function group$$1(steps) {
|
14771 | return group$1(steps);
|
14772 | }
|
14773 |
|
14774 |
|
14775 |
|
14776 |
|
14777 |
|
14778 | function sequence$$1(steps) {
|
14779 | return sequence$1(steps);
|
14780 | }
|
14781 |
|
14782 |
|
14783 |
|
14784 |
|
14785 |
|
14786 | function style$$1(tokens) {
|
14787 | return style$1(tokens);
|
14788 | }
|
14789 |
|
14790 |
|
14791 |
|
14792 |
|
14793 |
|
14794 |
|
14795 | function state$$1(name, styles) {
|
14796 | return state$1(name, styles);
|
14797 | }
|
14798 |
|
14799 |
|
14800 |
|
14801 |
|
14802 |
|
14803 | function keyframes$$1(steps) {
|
14804 | return keyframes$1(steps);
|
14805 | }
|
14806 |
|
14807 |
|
14808 |
|
14809 |
|
14810 |
|
14811 |
|
14812 | function transition$$1(stateChangeExpr, steps) {
|
14813 | return transition$1(stateChangeExpr, steps);
|
14814 | }
|
14815 |
|
14816 | exports.Class = Class;
|
14817 | exports.createPlatform = createPlatform;
|
14818 | exports.assertPlatform = assertPlatform;
|
14819 | exports.destroyPlatform = destroyPlatform;
|
14820 | exports.getPlatform = getPlatform;
|
14821 | exports.PlatformRef = PlatformRef;
|
14822 | exports.ApplicationRef = ApplicationRef;
|
14823 | exports.enableProdMode = enableProdMode;
|
14824 | exports.isDevMode = isDevMode;
|
14825 | exports.createPlatformFactory = createPlatformFactory;
|
14826 | exports.NgProbeToken = NgProbeToken;
|
14827 | exports.APP_ID = APP_ID;
|
14828 | exports.PACKAGE_ROOT_URL = PACKAGE_ROOT_URL;
|
14829 | exports.PLATFORM_INITIALIZER = PLATFORM_INITIALIZER;
|
14830 | exports.PLATFORM_ID = PLATFORM_ID;
|
14831 | exports.APP_BOOTSTRAP_LISTENER = APP_BOOTSTRAP_LISTENER;
|
14832 | exports.APP_INITIALIZER = APP_INITIALIZER;
|
14833 | exports.ApplicationInitStatus = ApplicationInitStatus;
|
14834 | exports.DebugElement = DebugElement;
|
14835 | exports.DebugNode = DebugNode;
|
14836 | exports.asNativeElements = asNativeElements;
|
14837 | exports.getDebugNode = getDebugNode;
|
14838 | exports.Testability = Testability;
|
14839 | exports.TestabilityRegistry = TestabilityRegistry;
|
14840 | exports.setTestabilityGetter = setTestabilityGetter;
|
14841 | exports.TRANSLATIONS = TRANSLATIONS;
|
14842 | exports.TRANSLATIONS_FORMAT = TRANSLATIONS_FORMAT;
|
14843 | exports.LOCALE_ID = LOCALE_ID;
|
14844 | exports.MissingTranslationStrategy = MissingTranslationStrategy;
|
14845 | exports.ApplicationModule = ApplicationModule;
|
14846 | exports.wtfCreateScope = wtfCreateScope;
|
14847 | exports.wtfLeave = wtfLeave;
|
14848 | exports.wtfStartTimeRange = wtfStartTimeRange;
|
14849 | exports.wtfEndTimeRange = wtfEndTimeRange;
|
14850 | exports.Type = Type;
|
14851 | exports.EventEmitter = EventEmitter;
|
14852 | exports.ErrorHandler = ErrorHandler;
|
14853 | exports.Sanitizer = Sanitizer;
|
14854 | exports.SecurityContext = SecurityContext;
|
14855 | exports.ANALYZE_FOR_ENTRY_COMPONENTS = ANALYZE_FOR_ENTRY_COMPONENTS;
|
14856 | exports.Attribute = Attribute;
|
14857 | exports.ContentChild = ContentChild;
|
14858 | exports.ContentChildren = ContentChildren;
|
14859 | exports.Query = Query;
|
14860 | exports.ViewChild = ViewChild;
|
14861 | exports.ViewChildren = ViewChildren;
|
14862 | exports.Component = Component;
|
14863 | exports.Directive = Directive;
|
14864 | exports.HostBinding = HostBinding;
|
14865 | exports.HostListener = HostListener;
|
14866 | exports.Input = Input;
|
14867 | exports.Output = Output;
|
14868 | exports.Pipe = Pipe;
|
14869 | exports.CUSTOM_ELEMENTS_SCHEMA = CUSTOM_ELEMENTS_SCHEMA;
|
14870 | exports.NO_ERRORS_SCHEMA = NO_ERRORS_SCHEMA;
|
14871 | exports.NgModule = NgModule;
|
14872 | exports.ViewEncapsulation = ViewEncapsulation;
|
14873 | exports.Version = Version;
|
14874 | exports.VERSION = VERSION;
|
14875 | exports.forwardRef = forwardRef;
|
14876 | exports.resolveForwardRef = resolveForwardRef;
|
14877 | exports.Injector = Injector;
|
14878 | exports.ReflectiveInjector = ReflectiveInjector;
|
14879 | exports.ResolvedReflectiveFactory = ResolvedReflectiveFactory;
|
14880 | exports.ReflectiveKey = ReflectiveKey;
|
14881 | exports.InjectionToken = InjectionToken;
|
14882 | exports.OpaqueToken = OpaqueToken;
|
14883 | exports.Inject = Inject;
|
14884 | exports.Optional = Optional;
|
14885 | exports.Injectable = Injectable;
|
14886 | exports.Self = Self;
|
14887 | exports.SkipSelf = SkipSelf;
|
14888 | exports.Host = Host;
|
14889 | exports.NgZone = NgZone;
|
14890 | exports.RenderComponentType = RenderComponentType;
|
14891 | exports.Renderer = Renderer;
|
14892 | exports.Renderer2 = Renderer2;
|
14893 | exports.RendererFactory2 = RendererFactory2;
|
14894 | exports.RendererStyleFlags2 = RendererStyleFlags2;
|
14895 | exports.RootRenderer = RootRenderer;
|
14896 | exports.COMPILER_OPTIONS = COMPILER_OPTIONS;
|
14897 | exports.Compiler = Compiler;
|
14898 | exports.CompilerFactory = CompilerFactory;
|
14899 | exports.ModuleWithComponentFactories = ModuleWithComponentFactories;
|
14900 | exports.ComponentFactory = ComponentFactory;
|
14901 | exports.ComponentRef = ComponentRef;
|
14902 | exports.ComponentFactoryResolver = ComponentFactoryResolver;
|
14903 | exports.ElementRef = ElementRef;
|
14904 | exports.NgModuleFactory = NgModuleFactory;
|
14905 | exports.NgModuleRef = NgModuleRef;
|
14906 | exports.NgModuleFactoryLoader = NgModuleFactoryLoader;
|
14907 | exports.getModuleFactory = getModuleFactory;
|
14908 | exports.QueryList = QueryList;
|
14909 | exports.SystemJsNgModuleLoader = SystemJsNgModuleLoader;
|
14910 | exports.SystemJsNgModuleLoaderConfig = SystemJsNgModuleLoaderConfig;
|
14911 | exports.TemplateRef = TemplateRef;
|
14912 | exports.ViewContainerRef = ViewContainerRef;
|
14913 | exports.EmbeddedViewRef = EmbeddedViewRef;
|
14914 | exports.ViewRef = ViewRef;
|
14915 | exports.ChangeDetectionStrategy = ChangeDetectionStrategy;
|
14916 | exports.ChangeDetectorRef = ChangeDetectorRef;
|
14917 | exports.DefaultIterableDiffer = DefaultIterableDiffer;
|
14918 | exports.IterableDiffers = IterableDiffers;
|
14919 | exports.KeyValueDiffers = KeyValueDiffers;
|
14920 | exports.SimpleChange = SimpleChange;
|
14921 | exports.WrappedValue = WrappedValue;
|
14922 | exports.platformCore = platformCore;
|
14923 | exports.ɵALLOW_MULTIPLE_PLATFORMS = ALLOW_MULTIPLE_PLATFORMS;
|
14924 | exports.ɵAPP_ID_RANDOM_PROVIDER = APP_ID_RANDOM_PROVIDER;
|
14925 | exports.ɵValueUnwrapper = ValueUnwrapper;
|
14926 | exports.ɵdevModeEqual = devModeEqual;
|
14927 | exports.ɵisListLikeIterable = isListLikeIterable;
|
14928 | exports.ɵChangeDetectorStatus = ChangeDetectorStatus;
|
14929 | exports.ɵisDefaultChangeDetectionStrategy = isDefaultChangeDetectionStrategy;
|
14930 | exports.ɵConsole = Console;
|
14931 | exports.ɵERROR_COMPONENT_TYPE = ERROR_COMPONENT_TYPE;
|
14932 | exports.ɵComponentFactory = ComponentFactory;
|
14933 | exports.ɵCodegenComponentFactoryResolver = CodegenComponentFactoryResolver;
|
14934 | exports.ɵViewMetadata = ViewMetadata;
|
14935 | exports.ɵReflectionCapabilities = ReflectionCapabilities;
|
14936 | exports.ɵRenderDebugInfo = RenderDebugInfo;
|
14937 | exports.ɵglobal = _global;
|
14938 | exports.ɵlooseIdentical = looseIdentical;
|
14939 | exports.ɵstringify = stringify;
|
14940 | exports.ɵmakeDecorator = makeDecorator;
|
14941 | exports.ɵisObservable = isObservable;
|
14942 | exports.ɵisPromise = isPromise;
|
14943 | exports.ɵclearProviderOverrides = clearProviderOverrides;
|
14944 | exports.ɵoverrideProvider = overrideProvider;
|
14945 | exports.ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR;
|
14946 | exports.ɵregisterModuleFactory = registerModuleFactory;
|
14947 | exports.ɵEMPTY_ARRAY = EMPTY_ARRAY;
|
14948 | exports.ɵEMPTY_MAP = EMPTY_MAP;
|
14949 | exports.ɵand = anchorDef;
|
14950 | exports.ɵccf = createComponentFactory;
|
14951 | exports.ɵcmf = createNgModuleFactory;
|
14952 | exports.ɵcrt = createRendererType2;
|
14953 | exports.ɵdid = directiveDef;
|
14954 | exports.ɵeld = elementDef;
|
14955 | exports.ɵelementEventFullName = elementEventFullName;
|
14956 | exports.ɵgetComponentViewDefinitionFactory = getComponentViewDefinitionFactory;
|
14957 | exports.ɵinlineInterpolate = inlineInterpolate;
|
14958 | exports.ɵinterpolate = interpolate;
|
14959 | exports.ɵmod = moduleDef;
|
14960 | exports.ɵmpd = moduleProvideDef;
|
14961 | exports.ɵncd = ngContentDef;
|
14962 | exports.ɵnov = nodeValue;
|
14963 | exports.ɵpid = pipeDef;
|
14964 | exports.ɵprd = providerDef;
|
14965 | exports.ɵpad = pureArrayDef;
|
14966 | exports.ɵpod = pureObjectDef;
|
14967 | exports.ɵppd = purePipeDef;
|
14968 | exports.ɵqud = queryDef;
|
14969 | exports.ɵted = textDef;
|
14970 | exports.ɵunv = unwrapValue;
|
14971 | exports.ɵvid = viewDef;
|
14972 | exports.AUTO_STYLE = AUTO_STYLE$$1;
|
14973 | exports.trigger = trigger$$1;
|
14974 | exports.animate = animate$$1;
|
14975 | exports.group = group$$1;
|
14976 | exports.sequence = sequence$$1;
|
14977 | exports.style = style$$1;
|
14978 | exports.state = state$$1;
|
14979 | exports.keyframes = keyframes$$1;
|
14980 | exports.transition = transition$$1;
|
14981 | exports.ɵx = animate$1;
|
14982 | exports.ɵy = group$1;
|
14983 | exports.ɵbc = keyframes$1;
|
14984 | exports.ɵz = sequence$1;
|
14985 | exports.ɵbb = state$1;
|
14986 | exports.ɵba = style$1;
|
14987 | exports.ɵbd = transition$1;
|
14988 | exports.ɵw = trigger$1;
|
14989 | exports.ɵk = _iterableDiffersFactory;
|
14990 | exports.ɵl = _keyValueDiffersFactory;
|
14991 | exports.ɵm = _localeFactory;
|
14992 | exports.ɵe = ApplicationRef_;
|
14993 | exports.ɵf = _appIdRandomProviderFactory;
|
14994 | exports.ɵg = defaultIterableDiffers;
|
14995 | exports.ɵh = defaultKeyValueDiffers;
|
14996 | exports.ɵi = DefaultIterableDifferFactory;
|
14997 | exports.ɵj = DefaultKeyValueDifferFactory;
|
14998 | exports.ɵb = ReflectiveInjector_;
|
14999 | exports.ɵc = ReflectiveDependency;
|
15000 | exports.ɵd = resolveReflectiveProviders;
|
15001 | exports.ɵn = wtfEnabled;
|
15002 | exports.ɵp = createScope$1;
|
15003 | exports.ɵo = detectWTF;
|
15004 | exports.ɵs = endTimeRange;
|
15005 | exports.ɵq = leave;
|
15006 | exports.ɵr = startTimeRange;
|
15007 | exports.ɵa = makeParamDecorator;
|
15008 | exports.ɵt = _def;
|
15009 | exports.ɵu = DebugContext;
|
15010 |
|
15011 | Object.defineProperty(exports, '__esModule', { value: true });
|
15012 |
|
15013 | })));
|
15014 |
|