webpackJsonp([4,5],[ /* 0 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var root_1 = __webpack_require__(16); var toSubscriber_1 = __webpack_require__(327); var observable_1 = __webpack_require__(80); /** * A representation of any set of values over any amount of time. This the most basic building block * of RxJS. * * @class Observable */ var Observable = (function () { /** * @constructor * @param {Function} subscribe the function that is called when the Observable is * initially subscribed to. This function is given a Subscriber, to which new values * can be `next`ed, or an `error` method can be called to raise an error, or * `complete` can be called to notify of a successful completion. */ function Observable(subscribe) { this._isScalar = false; if (subscribe) { this._subscribe = subscribe; } } /** * Creates a new Observable, with this Observable as the source, and the passed * operator defined as the new observable's operator. * @method lift * @param {Operator} operator the operator defining the operation to take on the observable * @return {Observable} a new observable with the Operator applied */ Observable.prototype.lift = function (operator) { var observable = new Observable(); observable.source = this; observable.operator = operator; return observable; }; Observable.prototype.subscribe = function (observerOrNext, error, complete) { var operator = this.operator; var sink = toSubscriber_1.toSubscriber(observerOrNext, error, complete); if (operator) { operator.call(sink, this.source); } else { sink.add(this._trySubscribe(sink)); } if (sink.syncErrorThrowable) { sink.syncErrorThrowable = false; if (sink.syncErrorThrown) { throw sink.syncErrorValue; } } return sink; }; Observable.prototype._trySubscribe = function (sink) { try { return this._subscribe(sink); } catch (err) { sink.syncErrorThrown = true; sink.syncErrorValue = err; sink.error(err); } }; /** * @method forEach * @param {Function} next a handler for each value emitted by the observable * @param {PromiseConstructor} [PromiseCtor] a constructor function used to instantiate the Promise * @return {Promise} a promise that either resolves on observable completion or * rejects with the handled error */ Observable.prototype.forEach = function (next, PromiseCtor) { var _this = this; if (!PromiseCtor) { if (root_1.root.Rx && root_1.root.Rx.config && root_1.root.Rx.config.Promise) { PromiseCtor = root_1.root.Rx.config.Promise; } else if (root_1.root.Promise) { PromiseCtor = root_1.root.Promise; } } if (!PromiseCtor) { throw new Error('no Promise impl found'); } return new PromiseCtor(function (resolve, reject) { // Must be declared in a separate statement to avoid a RefernceError when // accessing subscription below in the closure due to Temporal Dead Zone. var subscription; subscription = _this.subscribe(function (value) { if (subscription) { // if there is a subscription, then we can surmise // the next handling is asynchronous. Any errors thrown // need to be rejected explicitly and unsubscribe must be // called manually try { next(value); } catch (err) { reject(err); subscription.unsubscribe(); } } else { // if there is NO subscription, then we're getting a nexted // value synchronously during subscription. We can just call it. // If it errors, Observable's `subscribe` will ensure the // unsubscription logic is called, then synchronously rethrow the error. // After that, Promise will trap the error and send it // down the rejection path. next(value); } }, reject, resolve); }); }; Observable.prototype._subscribe = function (subscriber) { return this.source.subscribe(subscriber); }; /** * An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable * @method Symbol.observable * @return {Observable} this instance of the observable */ Observable.prototype[observable_1.observable] = function () { return this; }; // HACK: Since TypeScript inherits static properties too, we have to // fight against TypeScript here so Subject can have a different static create signature /** * Creates a new cold Observable by calling the Observable constructor * @static true * @owner Observable * @method create * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor * @return {Observable} a new cold observable */ Observable.create = function (subscribe) { return new Observable(subscribe); }; return Observable; }()); exports.Observable = Observable; //# sourceMappingURL=Observable.js.map /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_rxjs_Observable__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_rxjs_Observable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_rxjs_Observable__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_observable_merge__ = __webpack_require__(109); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_observable_merge___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_rxjs_observable_merge__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_operator_share__ = __webpack_require__(319); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_operator_share___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_operator_share__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__); /* unused harmony export Class */ /* unused harmony export createPlatform */ /* unused harmony export assertPlatform */ /* unused harmony export destroyPlatform */ /* unused harmony export getPlatform */ /* unused harmony export PlatformRef */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "y", function() { return ApplicationRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return enableProdMode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "E", function() { return isDevMode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "J", function() { return createPlatformFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "B", function() { return NgProbeToken; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "M", function() { return APP_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_48", function() { return PACKAGE_ROOT_URL; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "H", function() { return PLATFORM_INITIALIZER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "G", function() { return PLATFORM_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_14", function() { return APP_BOOTSTRAP_LISTENER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return APP_INITIALIZER; }); /* unused harmony export ApplicationInitStatus */ /* unused harmony export DebugElement */ /* unused harmony export DebugNode */ /* unused harmony export asNativeElements */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "A", function() { return getDebugNode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "O", function() { return Testability; }); /* unused harmony export TestabilityRegistry */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return setTestabilityGetter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_73", function() { return TRANSLATIONS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_26", function() { return TRANSLATIONS_FORMAT; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Q", function() { return LOCALE_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_19", function() { return MissingTranslationStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "P", function() { return ApplicationModule; }); /* unused harmony export wtfCreateScope */ /* unused harmony export wtfLeave */ /* unused harmony export wtfStartTimeRange */ /* unused harmony export wtfEndTimeRange */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_54", function() { return Type; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return EventEmitter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "L", function() { return ErrorHandler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I", function() { return Sanitizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "F", function() { return SecurityContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_13", function() { return ANALYZE_FOR_ENTRY_COMPONENTS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Z", function() { return Attribute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_60", function() { return ContentChild; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_8", function() { return ContentChildren; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_50", function() { return Query; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_15", function() { return ViewChild; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_61", function() { return ViewChildren; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_3", function() { return Component; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return Directive; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_7", function() { return HostBinding; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_6", function() { return HostListener; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return Input; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return Output; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_1", function() { return Pipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_57", function() { return CUSTOM_ELEMENTS_SCHEMA; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_56", function() { return NO_ERRORS_SCHEMA; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return NgModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "C", function() { return ViewEncapsulation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return Version; }); /* unused harmony export VERSION */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return forwardRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_49", function() { return resolveForwardRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return Injector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_9", function() { return ReflectiveInjector; }); /* unused harmony export ResolvedReflectiveFactory */ /* unused harmony export ReflectiveKey */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return InjectionToken; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_16", function() { return OpaqueToken; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return Inject; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return Optional; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return Injectable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return Self; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return SkipSelf; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return Host; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "z", function() { return NgZone; }); /* unused harmony export RenderComponentType */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return Renderer; }); /* unused harmony export Renderer2 */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "N", function() { return RendererFactory2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "D", function() { return RendererStyleFlags2; }); /* unused harmony export RootRenderer */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_17", function() { return COMPILER_OPTIONS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_11", function() { return Compiler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_74", function() { return CompilerFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_70", function() { return ModuleWithComponentFactories; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_22", function() { return ComponentFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_23", function() { return ComponentRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "W", function() { return ComponentFactoryResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return ElementRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_5", function() { return NgModuleFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "V", function() { return NgModuleRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_10", function() { return NgModuleFactoryLoader; }); /* unused harmony export getModuleFactory */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_20", function() { return QueryList; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_12", function() { return SystemJsNgModuleLoader; }); /* unused harmony export SystemJsNgModuleLoaderConfig */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Y", function() { return TemplateRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "X", function() { return ViewContainerRef; }); /* unused harmony export EmbeddedViewRef */ /* unused harmony export ViewRef */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_4", function() { return ChangeDetectionStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_2", function() { return ChangeDetectorRef; }); /* unused harmony export DefaultIterableDiffer */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "T", function() { return IterableDiffers; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "U", function() { return KeyValueDiffers; }); /* unused harmony export SimpleChange */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_0", function() { return WrappedValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "K", function() { return platformCore; }); /* unused harmony export ɵALLOW_MULTIPLE_PLATFORMS */ /* unused harmony export ɵAPP_ID_RANDOM_PROVIDER */ /* unused harmony export ɵValueUnwrapper */ /* unused harmony export ɵdevModeEqual */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R", function() { return isListLikeIterable; }); /* unused harmony export ɵChangeDetectorStatus */ /* unused harmony export ɵisDefaultChangeDetectionStrategy */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_47", function() { return Console; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_55", function() { return ERROR_COMPONENT_TYPE; }); /* unused harmony export ɵComponentFactory */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_21", function() { return CodegenComponentFactoryResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_53", function() { return LIFECYCLE_HOOKS_VALUES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_52", function() { return LifecycleHooks; }); /* unused harmony export ɵViewMetadata */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_72", function() { return Reflector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_18", function() { return reflector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_59", function() { return ReflectionCapabilities; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_51", function() { return ReflectorReader; }); /* unused harmony export ɵRenderDebugInfo */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return _global; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return looseIdentical; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "S", function() { return stringify; }); /* unused harmony export ɵmakeDecorator */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return isObservable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return isPromise; }); /* unused harmony export ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_24", function() { return NgModuleInjector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_25", function() { return registerModuleFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_29", function() { return EMPTY_ARRAY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_30", function() { return EMPTY_MAP; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_33", function() { return anchorDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_46", function() { return createComponentFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_45", function() { return createRendererType2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_35", function() { return directiveDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_32", function() { return elementDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_58", function() { return elementEventFullName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_71", function() { return getComponentViewDefinitionFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_27", function() { return inlineInterpolate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_28", function() { return interpolate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_43", function() { return ngContentDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_42", function() { return nodeValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_41", function() { return pipeDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_36", function() { return providerDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_38", function() { return pureArrayDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_39", function() { return pureObjectDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_40", function() { return purePipeDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_37", function() { return queryDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_34", function() { return textDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_44", function() { return unwrapValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_31", function() { return viewDef; }); /* unused harmony export AUTO_STYLE */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_62", function() { return trigger$$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_66", function() { return animate$$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_69", function() { return group$$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_68", function() { return sequence$$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_65", function() { return style$$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_63", function() { return state$$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_67", function() { return keyframes$$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_64", function() { return transition$$1; }); /* unused harmony export ɵba */ /* unused harmony export ɵbb */ /* unused harmony export ɵbf */ /* unused harmony export ɵbc */ /* unused harmony export ɵbe */ /* unused harmony export ɵbd */ /* unused harmony export ɵbg */ /* unused harmony export ɵz */ /* unused harmony export ɵo */ /* unused harmony export ɵl */ /* unused harmony export ɵm */ /* unused harmony export ɵn */ /* unused harmony export ɵf */ /* unused harmony export ɵg */ /* unused harmony export ɵh */ /* unused harmony export ɵi */ /* unused harmony export ɵj */ /* unused harmony export ɵk */ /* unused harmony export ɵc */ /* unused harmony export ɵd */ /* unused harmony export ɵe */ /* unused harmony export ɵp */ /* unused harmony export ɵr */ /* unused harmony export ɵq */ /* unused harmony export ɵu */ /* unused harmony export ɵs */ /* unused harmony export ɵt */ /* unused harmony export ɵa */ /* unused harmony export ɵb */ /* unused harmony export ɵw */ /* unused harmony export ɵx */ var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; /** * @license Angular v4.1.1 * (c) 2010-2017 Google, Inc. https://angular.io/ * License: MIT */ /** * Creates a token that can be used in a DI Provider. * * ### Example ([live demo](http://plnkr.co/edit/Ys9ezXpj2Mnoy3Uc8KBp?p=preview)) * * ```typescript * var t = new OpaqueToken("value"); * * var injector = Injector.resolveAndCreate([ * {provide: t, useValue: "bindingValue"} * ]); * * expect(injector.get(t)).toEqual("bindingValue"); * ``` * * Using an `OpaqueToken` is preferable to using strings as tokens because of possible collisions * caused by multiple providers using the same string as two different tokens. * * Using an `OpaqueToken` is preferable to using an `Object` as tokens because it provides better * error messages. * @deprecated since v4.0.0 because it does not support type information, use `InjectionToken` * instead. */ var OpaqueToken = (function () { /** * @param {?} _desc */ function OpaqueToken(_desc) { this._desc = _desc; } /** * @return {?} */ OpaqueToken.prototype.toString = function () { return "Token " + this._desc; }; return OpaqueToken; }()); /** * Creates a token that can be used in a DI Provider. * * Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a * runtime representation) such as when injecting an interface, callable type, array or * parametrized type. * * `InjectionToken` is parameterized on `T` which is the type of object which will be returned by * the `Injector`. This provides additional level of type safety. * * ``` * interface MyInterface {...} * var myInterface = injector.get(new InjectionToken('SomeToken')); * // myInterface is inferred to be MyInterface. * ``` * * ### Example * * {\@example core/di/ts/injector_spec.ts region='InjectionToken'} * * \@stable */ var InjectionToken = (function (_super) { __extends(InjectionToken, _super); /** * @param {?} desc */ function InjectionToken(desc) { return _super.call(this, desc) || this; } /** * @return {?} */ InjectionToken.prototype.toString = function () { return "InjectionToken " + this._desc; }; return InjectionToken; }(OpaqueToken)); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var __window = typeof window !== 'undefined' && window; var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope && self; var __global = typeof global !== 'undefined' && global; var _global = __window || __global || __self; var _symbolIterator = null; /** * @return {?} */ function getSymbolIterator() { if (!_symbolIterator) { var /** @type {?} */ Symbol = _global['Symbol']; if (Symbol && Symbol.iterator) { _symbolIterator = Symbol.iterator; } else { // es6-shim specific logic var /** @type {?} */ keys = Object.getOwnPropertyNames(Map.prototype); for (var /** @type {?} */ i = 0; i < keys.length; ++i) { var /** @type {?} */ key = keys[i]; if (key !== 'entries' && key !== 'size' && ((Map)).prototype[key] === Map.prototype['entries']) { _symbolIterator = key; } } } } return _symbolIterator; } /** * @param {?} fn * @return {?} */ function scheduleMicroTask(fn) { Zone.current.scheduleMicroTask('scheduleMicrotask', fn); } /** * @param {?} a * @param {?} b * @return {?} */ function looseIdentical(a, b) { return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b); } /** * @param {?} token * @return {?} */ function stringify(token) { if (typeof token === 'string') { return token; } if (token == null) { return '' + token; } if (token.overriddenName) { return "" + token.overriddenName; } if (token.name) { return "" + token.name; } var /** @type {?} */ res = token.toString(); if (res == null) { return '' + res; } var /** @type {?} */ newLineIndex = res.indexOf('\n'); return newLineIndex === -1 ? res : res.substring(0, newLineIndex); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var _nextClassId = 0; var Reflect = _global['Reflect']; /** * @param {?} annotation * @return {?} */ function extractAnnotation(annotation) { if (typeof annotation === 'function' && annotation.hasOwnProperty('annotation')) { // it is a decorator, extract annotation annotation = annotation.annotation; } return annotation; } /** * @param {?} fnOrArray * @param {?} key * @return {?} */ function applyParams(fnOrArray, key) { if (fnOrArray === Object || fnOrArray === String || fnOrArray === Function || fnOrArray === Number || fnOrArray === Array) { throw new Error("Can not use native " + stringify(fnOrArray) + " as constructor"); } if (typeof fnOrArray === 'function') { return fnOrArray; } if (Array.isArray(fnOrArray)) { var /** @type {?} */ annotations = (fnOrArray); var /** @type {?} */ annoLength = annotations.length - 1; var /** @type {?} */ fn = fnOrArray[annoLength]; if (typeof fn !== 'function') { throw new Error("Last position of Class method array must be Function in key " + key + " was '" + stringify(fn) + "'"); } if (annoLength != fn.length) { throw new Error("Number of annotations (" + annoLength + ") does not match number of arguments (" + fn.length + ") in the function: " + stringify(fn)); } var /** @type {?} */ paramsAnnotations = []; for (var /** @type {?} */ i = 0, /** @type {?} */ ii = annotations.length - 1; i < ii; i++) { var /** @type {?} */ paramAnnotations = []; paramsAnnotations.push(paramAnnotations); var /** @type {?} */ annotation = annotations[i]; if (Array.isArray(annotation)) { for (var /** @type {?} */ j = 0; j < annotation.length; j++) { paramAnnotations.push(extractAnnotation(annotation[j])); } } else if (typeof annotation === 'function') { paramAnnotations.push(extractAnnotation(annotation)); } else { paramAnnotations.push(annotation); } } Reflect.defineMetadata('parameters', paramsAnnotations, fn); return fn; } throw new Error("Only Function or Array is supported in Class definition for key '" + key + "' is '" + stringify(fnOrArray) + "'"); } /** * Provides a way for expressing ES6 classes with parameter annotations in ES5. * * ## Basic Example * * ``` * var Greeter = ng.Class({ * constructor: function(name) { * this.name = name; * }, * * greet: function() { * alert('Hello ' + this.name + '!'); * } * }); * ``` * * is equivalent to ES6: * * ``` * class Greeter { * constructor(name) { * this.name = name; * } * * greet() { * alert('Hello ' + this.name + '!'); * } * } * ``` * * or equivalent to ES5: * * ``` * var Greeter = function (name) { * this.name = name; * } * * Greeter.prototype.greet = function () { * alert('Hello ' + this.name + '!'); * } * ``` * * ### Example with parameter annotations * * ``` * var MyService = ng.Class({ * constructor: [String, [new Optional(), Service], function(name, myService) { * ... * }] * }); * ``` * * is equivalent to ES6: * * ``` * class MyService { * constructor(name: string, \@Optional() myService: Service) { * ... * } * } * ``` * * ### Example with inheritance * * ``` * var Shape = ng.Class({ * constructor: (color) { * this.color = color; * } * }); * * var Square = ng.Class({ * extends: Shape, * constructor: function(color, size) { * Shape.call(this, color); * this.size = size; * } * }); * ``` * @suppress {globalThis} * \@stable * @param {?} clsDef * @return {?} */ function Class(clsDef) { var /** @type {?} */ constructor = applyParams(clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor'); var /** @type {?} */ proto = constructor.prototype; if (clsDef.hasOwnProperty('extends')) { if (typeof clsDef.extends === 'function') { ((constructor)).prototype = proto = Object.create(((clsDef.extends)).prototype); } else { throw new Error("Class definition 'extends' property must be a constructor function was: " + stringify(clsDef.extends)); } } for (var /** @type {?} */ key in clsDef) { if (key !== 'extends' && key !== 'prototype' && clsDef.hasOwnProperty(key)) { proto[key] = applyParams(clsDef[key], key); } } if (this && this.annotations instanceof Array) { Reflect.defineMetadata('annotations', this.annotations, constructor); } var /** @type {?} */ constructorName = constructor['name']; if (!constructorName || constructorName === 'constructor') { ((constructor))['overriddenName'] = "class" + _nextClassId++; } return (constructor); } /** * @suppress {globalThis} * @param {?} name * @param {?} props * @param {?=} parentClass * @param {?=} chainFn * @return {?} */ function makeDecorator(name, props, parentClass, chainFn) { var /** @type {?} */ metaCtor = makeMetadataCtor([props]); /** * @param {?} objOrType * @return {?} */ function DecoratorFactory(objOrType) { if (!(Reflect && Reflect.getOwnMetadata)) { throw 'reflect-metadata shim is required when using class decorators'; } if (this instanceof DecoratorFactory) { metaCtor.call(this, objOrType); return this; } var /** @type {?} */ annotationInstance = new ((DecoratorFactory))(objOrType); var /** @type {?} */ chainAnnotation = typeof this === 'function' && Array.isArray(this.annotations) ? this.annotations : []; chainAnnotation.push(annotationInstance); var /** @type {?} */ TypeDecorator = (function TypeDecorator(cls) { var /** @type {?} */ annotations = Reflect.getOwnMetadata('annotations', cls) || []; annotations.push(annotationInstance); Reflect.defineMetadata('annotations', annotations, cls); return cls; }); TypeDecorator.annotations = chainAnnotation; TypeDecorator.Class = Class; if (chainFn) chainFn(TypeDecorator); return TypeDecorator; } if (parentClass) { DecoratorFactory.prototype = Object.create(parentClass.prototype); } DecoratorFactory.prototype.toString = function () { return "@" + name; }; ((DecoratorFactory)).annotationCls = DecoratorFactory; return DecoratorFactory; } /** * @param {?} props * @return {?} */ function makeMetadataCtor(props) { return function ctor() { var _this = this; var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } props.forEach(function (prop, i) { var /** @type {?} */ argVal = args[i]; if (Array.isArray(prop)) { // plain parameter _this[prop[0]] = argVal === undefined ? prop[1] : argVal; } else { for (var /** @type {?} */ propName in prop) { _this[propName] = argVal && argVal.hasOwnProperty(propName) ? argVal[propName] : prop[propName]; } } }); }; } /** * @param {?} name * @param {?} props * @param {?=} parentClass * @return {?} */ function makeParamDecorator(name, props, parentClass) { var /** @type {?} */ metaCtor = makeMetadataCtor(props); /** * @param {...?} args * @return {?} */ function ParamDecoratorFactory() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (this instanceof ParamDecoratorFactory) { metaCtor.apply(this, args); return this; } var /** @type {?} */ annotationInstance = new (((ParamDecoratorFactory)).bind.apply(((ParamDecoratorFactory)), [void 0].concat(args)))(); ((ParamDecorator)).annotation = annotationInstance; return ParamDecorator; /** * @param {?} cls * @param {?} unusedKey * @param {?} index * @return {?} */ function ParamDecorator(cls, unusedKey, index) { var /** @type {?} */ parameters = Reflect.getOwnMetadata('parameters', cls) || []; // there might be gaps if some in between parameters do not have annotations. // we pad with nulls. while (parameters.length <= index) { parameters.push(null); } parameters[index] = parameters[index] || []; /** @type {?} */ ((parameters[index])).push(annotationInstance); Reflect.defineMetadata('parameters', parameters, cls); return cls; } } if (parentClass) { ParamDecoratorFactory.prototype = Object.create(parentClass.prototype); } ParamDecoratorFactory.prototype.toString = function () { return "@" + name; }; ((ParamDecoratorFactory)).annotationCls = ParamDecoratorFactory; return ParamDecoratorFactory; } /** * @param {?} name * @param {?} props * @param {?=} parentClass * @return {?} */ function makePropDecorator(name, props, parentClass) { var /** @type {?} */ metaCtor = makeMetadataCtor(props); /** * @param {...?} args * @return {?} */ function PropDecoratorFactory() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } if (this instanceof PropDecoratorFactory) { metaCtor.apply(this, args); return this; } var /** @type {?} */ decoratorInstance = new (((PropDecoratorFactory)).bind.apply(((PropDecoratorFactory)), [void 0].concat(args)))(); return function PropDecorator(target, name) { var /** @type {?} */ meta = Reflect.getOwnMetadata('propMetadata', target.constructor) || {}; meta[name] = meta.hasOwnProperty(name) && meta[name] || []; meta[name].unshift(decoratorInstance); Reflect.defineMetadata('propMetadata', meta, target.constructor); }; } if (parentClass) { PropDecoratorFactory.prototype = Object.create(parentClass.prototype); } PropDecoratorFactory.prototype.toString = function () { return "@" + name; }; ((PropDecoratorFactory)).annotationCls = PropDecoratorFactory; return PropDecoratorFactory; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * This token can be used to create a virtual provider that will populate the * `entryComponents` fields of components and ng modules based on its `useValue`. * All components that are referenced in the `useValue` value (either directly * or in a nested array or map) will be added to the `entryComponents` property. * * ### Example * The following example shows how the router can populate the `entryComponents` * field of an NgModule based on the router configuration which refers * to components. * * ```typescript * // helper function inside the router * function provideRoutes(routes) { * return [ * {provide: ROUTES, useValue: routes}, * {provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: routes, multi: true} * ]; * } * * // user code * let routes = [ * {path: '/root', component: RootComp}, * {path: '/teams', component: TeamsComp} * ]; * * \@NgModule({ * providers: [provideRoutes(routes)] * }) * class ModuleWithRoutes {} * ``` * * \@experimental */ var ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken('AnalyzeForEntryComponents'); /** * Attribute decorator and metadata. * * \@stable * \@Annotation */ var Attribute = makeParamDecorator('Attribute', [['attributeName', undefined]]); /** * Base class for query metadata. * * See {\@link ContentChildren}, {\@link ContentChild}, {\@link ViewChildren}, {\@link ViewChild} for * more information. * * \@stable * @abstract */ var Query = (function () { function Query() { } return Query; }()); /** * ContentChildren decorator and metadata. * * \@stable * \@Annotation */ var ContentChildren = makePropDecorator('ContentChildren', [ ['selector', undefined], { first: false, isViewQuery: false, descendants: false, read: undefined, } ], Query); /** * ContentChild decorator and metadata. * * \@stable * \@Annotation */ var ContentChild = makePropDecorator('ContentChild', [ ['selector', undefined], { first: true, isViewQuery: false, descendants: true, read: undefined, } ], Query); /** * ViewChildren decorator and metadata. * * \@stable * \@Annotation */ var ViewChildren = makePropDecorator('ViewChildren', [ ['selector', undefined], { first: false, isViewQuery: true, descendants: true, read: undefined, } ], Query); /** * ViewChild decorator and metadata. * * \@stable * \@Annotation */ var ViewChild = makePropDecorator('ViewChild', [ ['selector', undefined], { first: true, isViewQuery: true, descendants: true, read: undefined, } ], Query); var ChangeDetectionStrategy = {}; ChangeDetectionStrategy.OnPush = 0; ChangeDetectionStrategy.Default = 1; ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = "OnPush"; ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default"; var ChangeDetectorStatus = {}; ChangeDetectorStatus.CheckOnce = 0; ChangeDetectorStatus.Checked = 1; ChangeDetectorStatus.CheckAlways = 2; ChangeDetectorStatus.Detached = 3; ChangeDetectorStatus.Errored = 4; ChangeDetectorStatus.Destroyed = 5; ChangeDetectorStatus[ChangeDetectorStatus.CheckOnce] = "CheckOnce"; ChangeDetectorStatus[ChangeDetectorStatus.Checked] = "Checked"; ChangeDetectorStatus[ChangeDetectorStatus.CheckAlways] = "CheckAlways"; ChangeDetectorStatus[ChangeDetectorStatus.Detached] = "Detached"; ChangeDetectorStatus[ChangeDetectorStatus.Errored] = "Errored"; ChangeDetectorStatus[ChangeDetectorStatus.Destroyed] = "Destroyed"; /** * @param {?} changeDetectionStrategy * @return {?} */ function isDefaultChangeDetectionStrategy(changeDetectionStrategy) { return changeDetectionStrategy == null || changeDetectionStrategy === ChangeDetectionStrategy.Default; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Directive decorator and metadata. * * \@stable * \@Annotation */ var Directive = makeDecorator('Directive', { selector: undefined, inputs: undefined, outputs: undefined, host: undefined, providers: undefined, exportAs: undefined, queries: undefined }); /** * Component decorator and metadata. * * \@stable * \@Annotation */ var Component = makeDecorator('Component', { selector: undefined, inputs: undefined, outputs: undefined, host: undefined, exportAs: undefined, moduleId: undefined, providers: undefined, viewProviders: undefined, changeDetection: ChangeDetectionStrategy.Default, queries: undefined, templateUrl: undefined, template: undefined, styleUrls: undefined, styles: undefined, animations: undefined, encapsulation: undefined, interpolation: undefined, entryComponents: undefined }, Directive); /** * Pipe decorator and metadata. * * \@stable * \@Annotation */ var Pipe = makeDecorator('Pipe', { name: undefined, pure: true, }); /** * Input decorator and metadata. * * \@stable * \@Annotation */ var Input = makePropDecorator('Input', [['bindingPropertyName', undefined]]); /** * Output decorator and metadata. * * \@stable * \@Annotation */ var Output = makePropDecorator('Output', [['bindingPropertyName', undefined]]); /** * HostBinding decorator and metadata. * * \@stable * \@Annotation */ var HostBinding = makePropDecorator('HostBinding', [['hostPropertyName', undefined]]); /** * HostListener decorator and metadata. * * \@stable * \@Annotation */ var HostListener = makePropDecorator('HostListener', [['eventName', undefined], ['args', []]]); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Defines a schema that will allow: * - any non-Angular elements with a `-` in their name, * - any properties on elements with a `-` in their name which is the common rule for custom * elements. * * \@stable */ var CUSTOM_ELEMENTS_SCHEMA = { name: 'custom-elements' }; /** * Defines a schema that will allow any property on any element. * * \@experimental */ var NO_ERRORS_SCHEMA = { name: 'no-errors-schema' }; /** * NgModule decorator and metadata. * * \@stable * \@Annotation */ var NgModule = makeDecorator('NgModule', { providers: undefined, declarations: undefined, imports: undefined, exports: undefined, entryComponents: undefined, bootstrap: undefined, schemas: undefined, id: undefined, }); var ViewEncapsulation = {}; ViewEncapsulation.Emulated = 0; ViewEncapsulation.Native = 1; ViewEncapsulation.None = 2; ViewEncapsulation[ViewEncapsulation.Emulated] = "Emulated"; ViewEncapsulation[ViewEncapsulation.Native] = "Native"; ViewEncapsulation[ViewEncapsulation.None] = "None"; /** * Metadata properties available for configuring Views. * * For details on the `\@Component` annotation, see {\@link Component}. * * ### Example * * ``` * \@Component({ * selector: 'greet', * template: 'Hello {{name}}!', * }) * class Greet { * name: string; * * constructor() { * this.name = 'World'; * } * } * ``` * * @deprecated Use Component instead. * * {\@link Component} */ var ViewMetadata = (function () { /** * @param {?=} __0 */ function ViewMetadata(_a) { 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; this.templateUrl = templateUrl; this.template = template; this.styleUrls = styleUrls; this.styles = styles; this.encapsulation = encapsulation; this.animations = animations; this.interpolation = interpolation; } return ViewMetadata; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Represents the version of Angular * * \@stable */ var Version = (function () { /** * @param {?} full */ function Version(full) { this.full = full; } Object.defineProperty(Version.prototype, "major", { /** * @return {?} */ get: function () { return this.full.split('.')[0]; }, enumerable: true, configurable: true }); Object.defineProperty(Version.prototype, "minor", { /** * @return {?} */ get: function () { return this.full.split('.')[1]; }, enumerable: true, configurable: true }); Object.defineProperty(Version.prototype, "patch", { /** * @return {?} */ get: function () { return this.full.split('.').slice(2).join('.'); }, enumerable: true, configurable: true }); return Version; }()); /** * \@stable */ var VERSION = new Version('4.1.1'); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Inject decorator and metadata. * * \@stable * \@Annotation */ var Inject = makeParamDecorator('Inject', [['token', undefined]]); /** * Optional decorator and metadata. * * \@stable * \@Annotation */ var Optional = makeParamDecorator('Optional', []); /** * Injectable decorator and metadata. * * \@stable * \@Annotation */ var Injectable = makeDecorator('Injectable', []); /** * Self decorator and metadata. * * \@stable * \@Annotation */ var Self = makeParamDecorator('Self', []); /** * SkipSelf decorator and metadata. * * \@stable * \@Annotation */ var SkipSelf = makeParamDecorator('SkipSelf', []); /** * Host decorator and metadata. * * \@stable * \@Annotation */ var Host = makeParamDecorator('Host', []); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Allows to refer to references which are not yet defined. * * For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of * DI is declared, * but not yet defined. It is also used when the `token` which we use when creating a query is not * yet defined. * * ### Example * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'} * \@experimental * @param {?} forwardRefFn * @return {?} */ function forwardRef(forwardRefFn) { ((forwardRefFn)).__forward_ref__ = forwardRef; ((forwardRefFn)).toString = function () { return stringify(this()); }; return (((forwardRefFn))); } /** * Lazily retrieves the reference value from a forwardRef. * * Acts as the identity function when given a non-forward-ref value. * * ### Example ([live demo](http://plnkr.co/edit/GU72mJrk1fiodChcmiDR?p=preview)) * * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'} * * See: {\@link forwardRef} * \@experimental * @param {?} type * @return {?} */ function resolveForwardRef(type) { if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') && type.__forward_ref__ === forwardRef) { return ((type))(); } else { return type; } } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var _THROW_IF_NOT_FOUND = new Object(); var THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND; var _NullInjector = (function () { function _NullInjector() { } /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ _NullInjector.prototype.get = function (token, notFoundValue) { if (notFoundValue === void 0) { notFoundValue = _THROW_IF_NOT_FOUND; } if (notFoundValue === _THROW_IF_NOT_FOUND) { throw new Error("No provider for " + stringify(token) + "!"); } return notFoundValue; }; return _NullInjector; }()); /** * \@whatItDoes Injector interface * \@howToUse * ``` * const injector: Injector = ...; * injector.get(...); * ``` * * \@description * For more details, see the {\@linkDocs guide/dependency-injection "Dependency Injection Guide"}. * * ### Example * * {\@example core/di/ts/injector_spec.ts region='Injector'} * * `Injector` returns itself when given `Injector` as a token: * {\@example core/di/ts/injector_spec.ts region='injectInjector'} * * \@stable * @abstract */ var Injector = (function () { function Injector() { } /** * Retrieves an instance from the injector based on the provided token. * If not found: * - Throws an error if no `notFoundValue` that is not equal to * Injector.THROW_IF_NOT_FOUND is given * - Returns the `notFoundValue` otherwise * @abstract * @template T * @param {?} token * @param {?=} notFoundValue * @return {?} */ Injector.prototype.get = function (token, notFoundValue) { }; /** * @deprecated from v4.0.0 use Type or InjectionToken * @suppress {duplicate} * @abstract * @param {?} token * @param {?=} notFoundValue * @return {?} */ Injector.prototype.get = function (token, notFoundValue) { }; return Injector; }()); Injector.THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND; Injector.NULL = new _NullInjector(); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var ERROR_COMPONENT_TYPE = 'ngComponentType'; var ERROR_DEBUG_CONTEXT = 'ngDebugContext'; var ERROR_ORIGINAL_ERROR = 'ngOriginalError'; var ERROR_LOGGER = 'ngErrorLogger'; /** * @param {?} error * @return {?} */ /** * @param {?} error * @return {?} */ function getDebugContext(error) { return ((error))[ERROR_DEBUG_CONTEXT]; } /** * @param {?} error * @return {?} */ function getOriginalError(error) { return ((error))[ERROR_ORIGINAL_ERROR]; } /** * @param {?} error * @return {?} */ function getErrorLogger(error) { return ((error))[ERROR_LOGGER] || defaultErrorLogger; } /** * @param {?} console * @param {...?} values * @return {?} */ function defaultErrorLogger(console) { var values = []; for (var _i = 1; _i < arguments.length; _i++) { values[_i - 1] = arguments[_i]; } console.error.apply(console, values); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Provides a hook for centralized exception handling. * * \@description * * The default implementation of `ErrorHandler` prints error messages to the `console`. To * intercept error handling, write a custom exception handler that replaces this default as * appropriate for your app. * * ### Example * * ``` * class MyErrorHandler implements ErrorHandler { * handleError(error) { * // do something with the exception * } * } * * \@NgModule({ * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}] * }) * class MyModule {} * ``` * * \@stable */ var ErrorHandler = (function () { /** * @param {?=} deprecatedParameter */ function ErrorHandler( /** * @deprecated since v4.0 parameter no longer has an effect, as ErrorHandler will never * rethrow. */ deprecatedParameter) { /** * \@internal */ this._console = console; } /** * @param {?} error * @return {?} */ ErrorHandler.prototype.handleError = function (error) { var /** @type {?} */ originalError = this._findOriginalError(error); var /** @type {?} */ context = this._findContext(error); // Note: Browser consoles show the place from where console.error was called. // We can use this to give users additional information about the error. var /** @type {?} */ errorLogger = getErrorLogger(error); errorLogger(this._console, "ERROR", error); if (originalError) { errorLogger(this._console, "ORIGINAL ERROR", originalError); } if (context) { errorLogger(this._console, 'ERROR CONTEXT', context); } }; /** * \@internal * @param {?} error * @return {?} */ ErrorHandler.prototype._findContext = function (error) { if (error) { return getDebugContext(error) ? getDebugContext(error) : this._findContext(getOriginalError(error)); } return null; }; /** * \@internal * @param {?} error * @return {?} */ ErrorHandler.prototype._findOriginalError = function (error) { var /** @type {?} */ e = getOriginalError(error); while (e && getOriginalError(e)) { e = getOriginalError(e); } return e; }; return ErrorHandler; }()); /** * @param {?} message * @param {?} originalError * @return {?} */ function wrappedError(message, originalError) { var /** @type {?} */ msg = message + " caused by: " + (originalError instanceof Error ? originalError.message : originalError); var /** @type {?} */ error = Error(msg); ((error))[ERROR_ORIGINAL_ERROR] = originalError; return error; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} keys * @return {?} */ function findFirstClosedCycle(keys) { var /** @type {?} */ res = []; for (var /** @type {?} */ i = 0; i < keys.length; ++i) { if (res.indexOf(keys[i]) > -1) { res.push(keys[i]); return res; } res.push(keys[i]); } return res; } /** * @param {?} keys * @return {?} */ function constructResolvingPath(keys) { if (keys.length > 1) { var /** @type {?} */ reversed = findFirstClosedCycle(keys.slice().reverse()); var /** @type {?} */ tokenStrs = reversed.map(function (k) { return stringify(k.token); }); return ' (' + tokenStrs.join(' -> ') + ')'; } return ''; } /** * @param {?} injector * @param {?} key * @param {?} constructResolvingMessage * @param {?=} originalError * @return {?} */ function injectionError(injector, key, constructResolvingMessage, originalError) { var /** @type {?} */ error = ((originalError ? wrappedError('', originalError) : Error())); error.addKey = addKey; error.keys = [key]; error.injectors = [injector]; error.constructResolvingMessage = constructResolvingMessage; error.message = error.constructResolvingMessage(); ((error))[ERROR_ORIGINAL_ERROR] = originalError; return error; } /** * @this {?} * @param {?} injector * @param {?} key * @return {?} */ function addKey(injector, key) { this.injectors.push(injector); this.keys.push(key); this.message = this.constructResolvingMessage(); } /** * Thrown when trying to retrieve a dependency by key from {\@link Injector}, but the * {\@link Injector} does not have a {\@link Provider} for the given key. * * ### Example ([live demo](http://plnkr.co/edit/vq8D3FRB9aGbnWJqtEPE?p=preview)) * * ```typescript * class A { * constructor(b:B) {} * } * * expect(() => Injector.resolveAndCreate([A])).toThrowError(); * ``` * @param {?} injector * @param {?} key * @return {?} */ function noProviderError(injector, key) { return injectionError(injector, key, function () { var /** @type {?} */ first = stringify(this.keys[0].token); return "No provider for " + first + "!" + constructResolvingPath(this.keys); }); } /** * Thrown when dependencies form a cycle. * * ### Example ([live demo](http://plnkr.co/edit/wYQdNos0Tzql3ei1EV9j?p=info)) * * ```typescript * var injector = Injector.resolveAndCreate([ * {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]}, * {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]} * ]); * * expect(() => injector.get("one")).toThrowError(); * ``` * * Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed. * @param {?} injector * @param {?} key * @return {?} */ function cyclicDependencyError(injector, key) { return injectionError(injector, key, function () { return "Cannot instantiate cyclic dependency!" + constructResolvingPath(this.keys); }); } /** * Thrown when a constructing type returns with an Error. * * The `InstantiationError` class contains the original error plus the dependency graph which caused * this object to be instantiated. * * ### Example ([live demo](http://plnkr.co/edit/7aWYdcqTQsP0eNqEdUAf?p=preview)) * * ```typescript * class A { * constructor() { * throw new Error('message'); * } * } * * var injector = Injector.resolveAndCreate([A]); * try { * injector.get(A); * } catch (e) { * expect(e instanceof InstantiationError).toBe(true); * expect(e.originalException.message).toEqual("message"); * expect(e.originalStack).toBeDefined(); * } * ``` * @param {?} injector * @param {?} originalException * @param {?} originalStack * @param {?} key * @return {?} */ function instantiationError(injector, originalException, originalStack, key) { return injectionError(injector, key, function () { var /** @type {?} */ first = stringify(this.keys[0].token); return getOriginalError(this).message + ": Error during instantiation of " + first + "!" + constructResolvingPath(this.keys) + "."; }, originalException); } /** * Thrown when an object other then {\@link Provider} (or `Type`) is passed to {\@link Injector} * creation. * * ### Example ([live demo](http://plnkr.co/edit/YatCFbPAMCL0JSSQ4mvH?p=preview)) * * ```typescript * expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError(); * ``` * @param {?} provider * @return {?} */ function invalidProviderError(provider) { return Error("Invalid provider - only instances of Provider and Type are allowed, got: " + provider); } /** * Thrown when the class has no annotation information. * * Lack of annotation information prevents the {\@link Injector} from determining which dependencies * need to be injected into the constructor. * * ### Example ([live demo](http://plnkr.co/edit/rHnZtlNS7vJOPQ6pcVkm?p=preview)) * * ```typescript * class A { * constructor(b) {} * } * * expect(() => Injector.resolveAndCreate([A])).toThrowError(); * ``` * * This error is also thrown when the class not marked with {\@link Injectable} has parameter types. * * ```typescript * class B {} * * class A { * constructor(b:B) {} // no information about the parameter types of A is available at runtime. * } * * expect(() => Injector.resolveAndCreate([A,B])).toThrowError(); * ``` * \@stable * @param {?} typeOrFunc * @param {?} params * @return {?} */ function noAnnotationError(typeOrFunc, params) { var /** @type {?} */ signature = []; for (var /** @type {?} */ i = 0, /** @type {?} */ ii = params.length; i < ii; i++) { var /** @type {?} */ parameter = params[i]; if (!parameter || parameter.length == 0) { signature.push('?'); } else { signature.push(parameter.map(stringify).join(' ')); } } return Error('Cannot resolve all parameters for \'' + stringify(typeOrFunc) + '\'(' + signature.join(', ') + '). ' + 'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' + stringify(typeOrFunc) + '\' is decorated with Injectable.'); } /** * Thrown when getting an object by index. * * ### Example ([live demo](http://plnkr.co/edit/bRs0SX2OTQiJzqvjgl8P?p=preview)) * * ```typescript * class A {} * * var injector = Injector.resolveAndCreate([A]); * * expect(() => injector.getAt(100)).toThrowError(); * ``` * \@stable * @param {?} index * @return {?} */ function outOfBoundsError(index) { return Error("Index " + index + " is out-of-bounds."); } /** * Thrown when a multi provider and a regular provider are bound to the same token. * * ### Example * * ```typescript * expect(() => Injector.resolveAndCreate([ * { provide: "Strings", useValue: "string1", multi: true}, * { provide: "Strings", useValue: "string2", multi: false} * ])).toThrowError(); * ``` * @param {?} provider1 * @param {?} provider2 * @return {?} */ function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) { return Error("Cannot mix multi providers and regular providers, got: " + provider1 + " " + provider2); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A unique object used for retrieving items from the {\@link ReflectiveInjector}. * * Keys have: * - a system-wide unique `id`. * - a `token`. * * `Key` is used internally by {\@link ReflectiveInjector} because its system-wide unique `id` allows * the * injector to store created objects in a more efficient way. * * `Key` should not be created directly. {\@link ReflectiveInjector} creates keys automatically when * resolving * providers. * \@experimental */ var ReflectiveKey = (function () { /** * Private * @param {?} token * @param {?} id */ function ReflectiveKey(token, id) { this.token = token; this.id = id; if (!token) { throw new Error('Token must be defined!'); } } Object.defineProperty(ReflectiveKey.prototype, "displayName", { /** * Returns a stringified token. * @return {?} */ get: function () { return stringify(this.token); }, enumerable: true, configurable: true }); /** * Retrieves a `Key` for a token. * @param {?} token * @return {?} */ ReflectiveKey.get = function (token) { return _globalKeyRegistry.get(resolveForwardRef(token)); }; Object.defineProperty(ReflectiveKey, "numberOfKeys", { /** * @return {?} the number of keys registered in the system. */ get: function () { return _globalKeyRegistry.numberOfKeys; }, enumerable: true, configurable: true }); return ReflectiveKey; }()); /** * \@internal */ var KeyRegistry = (function () { function KeyRegistry() { this._allKeys = new Map(); } /** * @param {?} token * @return {?} */ KeyRegistry.prototype.get = function (token) { if (token instanceof ReflectiveKey) return token; if (this._allKeys.has(token)) { return ((this._allKeys.get(token))); } var /** @type {?} */ newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys); this._allKeys.set(token, newKey); return newKey; }; Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", { /** * @return {?} */ get: function () { return this._allKeys.size; }, enumerable: true, configurable: true }); return KeyRegistry; }()); var _globalKeyRegistry = new KeyRegistry(); /** * \@whatItDoes Represents a type that a Component or other object is instances of. * * \@description * * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by * the `MyCustomComponent` constructor function. * * \@stable */ var Type = Function; /** * @param {?} v * @return {?} */ function isType(v) { return typeof v === 'function'; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Attention: This regex has to hold even if the code is minified! */ var DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*arguments\)/; var ReflectionCapabilities = (function () { /** * @param {?=} reflect */ function ReflectionCapabilities(reflect) { this._reflect = reflect || _global['Reflect']; } /** * @return {?} */ ReflectionCapabilities.prototype.isReflectionEnabled = function () { return true; }; /** * @template T * @param {?} t * @return {?} */ ReflectionCapabilities.prototype.factory = function (t) { return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return new (t.bind.apply(t, [void 0].concat(args)))(); }; }; /** * \@internal * @param {?} paramTypes * @param {?} paramAnnotations * @return {?} */ ReflectionCapabilities.prototype._zipTypesAndAnnotations = function (paramTypes, paramAnnotations) { var /** @type {?} */ result; if (typeof paramTypes === 'undefined') { result = new Array(paramAnnotations.length); } else { result = new Array(paramTypes.length); } for (var /** @type {?} */ i = 0; i < result.length; i++) { // TS outputs Object for parameters without types, while Traceur omits // the annotations. For now we preserve the Traceur behavior to aid // migration, but this can be revisited. if (typeof paramTypes === 'undefined') { result[i] = []; } else if (paramTypes[i] != Object) { result[i] = [paramTypes[i]]; } else { result[i] = []; } if (paramAnnotations && paramAnnotations[i] != null) { result[i] = result[i].concat(paramAnnotations[i]); } } return result; }; /** * @param {?} type * @param {?} parentCtor * @return {?} */ ReflectionCapabilities.prototype._ownParameters = function (type, parentCtor) { // If we have no decorators, we only have function.length as metadata. // In that case, to detect whether a child class declared an own constructor or not, // we need to look inside of that constructor to check whether it is // just calling the parent. // This also helps to work around for https://github.com/Microsoft/TypeScript/issues/12439 // that sets 'design:paramtypes' to [] // if a class inherits from another class but has no ctor declared itself. if (DELEGATE_CTOR.exec(type.toString())) { return null; } // Prefer the direct API. if (((type)).parameters && ((type)).parameters !== parentCtor.parameters) { return ((type)).parameters; } // API of tsickle for lowering decorators to properties on the class. var /** @type {?} */ tsickleCtorParams = ((type)).ctorParameters; if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) { // Newer tsickle uses a function closure // Retain the non-function case for compatibility with older tsickle var /** @type {?} */ ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams; var /** @type {?} */ paramTypes = ctorParameters.map(function (ctorParam) { return ctorParam && ctorParam.type; }); var /** @type {?} */ paramAnnotations = ctorParameters.map(function (ctorParam) { return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators); }); return this._zipTypesAndAnnotations(paramTypes, paramAnnotations); } // API for metadata created by invoking the decorators. if (this._reflect != null && this._reflect.getOwnMetadata != null) { var /** @type {?} */ paramAnnotations = this._reflect.getOwnMetadata('parameters', type); var /** @type {?} */ paramTypes = this._reflect.getOwnMetadata('design:paramtypes', type); if (paramTypes || paramAnnotations) { return this._zipTypesAndAnnotations(paramTypes, paramAnnotations); } } // If a class has no decorators, at least create metadata // based on function.length. // Note: We know that this is a real constructor as we checked // the content of the constructor above. return new Array(((type.length))).fill(undefined); }; /** * @param {?} type * @return {?} */ ReflectionCapabilities.prototype.parameters = function (type) { // Note: only report metadata if we have at least one class decorator // to stay in sync with the static reflector. if (!isType(type)) { return []; } var /** @type {?} */ parentCtor = getParentCtor(type); var /** @type {?} */ parameters = this._ownParameters(type, parentCtor); if (!parameters && parentCtor !== Object) { parameters = this.parameters(parentCtor); } return parameters || []; }; /** * @param {?} typeOrFunc * @param {?} parentCtor * @return {?} */ ReflectionCapabilities.prototype._ownAnnotations = function (typeOrFunc, parentCtor) { // Prefer the direct API. if (((typeOrFunc)).annotations && ((typeOrFunc)).annotations !== parentCtor.annotations) { var /** @type {?} */ annotations = ((typeOrFunc)).annotations; if (typeof annotations === 'function' && annotations.annotations) { annotations = annotations.annotations; } return annotations; } // API of tsickle for lowering decorators to properties on the class. if (((typeOrFunc)).decorators && ((typeOrFunc)).decorators !== parentCtor.decorators) { return convertTsickleDecoratorIntoMetadata(((typeOrFunc)).decorators); } // API for metadata created by invoking the decorators. if (this._reflect && this._reflect.getOwnMetadata) { return this._reflect.getOwnMetadata('annotations', typeOrFunc); } return null; }; /** * @param {?} typeOrFunc * @return {?} */ ReflectionCapabilities.prototype.annotations = function (typeOrFunc) { if (!isType(typeOrFunc)) { return []; } var /** @type {?} */ parentCtor = getParentCtor(typeOrFunc); var /** @type {?} */ ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || []; var /** @type {?} */ parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : []; return parentAnnotations.concat(ownAnnotations); }; /** * @param {?} typeOrFunc * @param {?} parentCtor * @return {?} */ ReflectionCapabilities.prototype._ownPropMetadata = function (typeOrFunc, parentCtor) { // Prefer the direct API. if (((typeOrFunc)).propMetadata && ((typeOrFunc)).propMetadata !== parentCtor.propMetadata) { var /** @type {?} */ propMetadata = ((typeOrFunc)).propMetadata; if (typeof propMetadata === 'function' && propMetadata.propMetadata) { propMetadata = propMetadata.propMetadata; } return propMetadata; } // API of tsickle for lowering decorators to properties on the class. if (((typeOrFunc)).propDecorators && ((typeOrFunc)).propDecorators !== parentCtor.propDecorators) { var /** @type {?} */ propDecorators_1 = ((typeOrFunc)).propDecorators; var /** @type {?} */ propMetadata_1 = ({}); Object.keys(propDecorators_1).forEach(function (prop) { propMetadata_1[prop] = convertTsickleDecoratorIntoMetadata(propDecorators_1[prop]); }); return propMetadata_1; } // API for metadata created by invoking the decorators. if (this._reflect && this._reflect.getOwnMetadata) { return this._reflect.getOwnMetadata('propMetadata', typeOrFunc); } return null; }; /** * @param {?} typeOrFunc * @return {?} */ ReflectionCapabilities.prototype.propMetadata = function (typeOrFunc) { if (!isType(typeOrFunc)) { return {}; } var /** @type {?} */ parentCtor = getParentCtor(typeOrFunc); var /** @type {?} */ propMetadata = {}; if (parentCtor !== Object) { var /** @type {?} */ parentPropMetadata_1 = this.propMetadata(parentCtor); Object.keys(parentPropMetadata_1).forEach(function (propName) { propMetadata[propName] = parentPropMetadata_1[propName]; }); } var /** @type {?} */ ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor); if (ownPropMetadata) { Object.keys(ownPropMetadata).forEach(function (propName) { var /** @type {?} */ decorators = []; if (propMetadata.hasOwnProperty(propName)) { decorators.push.apply(decorators, propMetadata[propName]); } decorators.push.apply(decorators, ownPropMetadata[propName]); propMetadata[propName] = decorators; }); } return propMetadata; }; /** * @param {?} type * @param {?} lcProperty * @return {?} */ ReflectionCapabilities.prototype.hasLifecycleHook = function (type, lcProperty) { return type instanceof Type && lcProperty in type.prototype; }; /** * @param {?} name * @return {?} */ ReflectionCapabilities.prototype.getter = function (name) { return (new Function('o', 'return o.' + name + ';')); }; /** * @param {?} name * @return {?} */ ReflectionCapabilities.prototype.setter = function (name) { return (new Function('o', 'v', 'return o.' + name + ' = v;')); }; /** * @param {?} name * @return {?} */ ReflectionCapabilities.prototype.method = function (name) { var /** @type {?} */ functionBody = "if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);"; return (new Function('o', 'args', functionBody)); }; /** * @param {?} type * @return {?} */ ReflectionCapabilities.prototype.importUri = function (type) { // StaticSymbol if (typeof type === 'object' && type['filePath']) { return type['filePath']; } // Runtime type return "./" + stringify(type); }; /** * @param {?} type * @return {?} */ ReflectionCapabilities.prototype.resourceUri = function (type) { return "./" + stringify(type); }; /** * @param {?} name * @param {?} moduleUrl * @param {?} members * @param {?} runtime * @return {?} */ ReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) { return runtime; }; /** * @param {?} enumIdentifier * @param {?} name * @return {?} */ ReflectionCapabilities.prototype.resolveEnum = function (enumIdentifier, name) { return enumIdentifier[name]; }; return ReflectionCapabilities; }()); /** * @param {?} decoratorInvocations * @return {?} */ function convertTsickleDecoratorIntoMetadata(decoratorInvocations) { if (!decoratorInvocations) { return []; } return decoratorInvocations.map(function (decoratorInvocation) { var /** @type {?} */ decoratorType = decoratorInvocation.type; var /** @type {?} */ annotationCls = decoratorType.annotationCls; var /** @type {?} */ annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : []; return new (annotationCls.bind.apply(annotationCls, [void 0].concat(annotationArgs)))(); }); } /** * @param {?} ctor * @return {?} */ function getParentCtor(ctor) { var /** @type {?} */ parentProto = Object.getPrototypeOf(ctor.prototype); var /** @type {?} */ parentCtor = parentProto ? parentProto.constructor : null; // Note: We always use `Object` as the null value // to simplify checking later on. return parentCtor || Object; } /** * Provides read-only access to reflection data about symbols. Used internally by Angular * to power dependency injection and compilation. * @abstract */ var ReflectorReader = (function () { function ReflectorReader() { } /** * @abstract * @param {?} typeOrFunc * @return {?} */ ReflectorReader.prototype.parameters = function (typeOrFunc) { }; /** * @abstract * @param {?} typeOrFunc * @return {?} */ ReflectorReader.prototype.annotations = function (typeOrFunc) { }; /** * @abstract * @param {?} typeOrFunc * @return {?} */ ReflectorReader.prototype.propMetadata = function (typeOrFunc) { }; /** * @abstract * @param {?} typeOrFunc * @return {?} */ ReflectorReader.prototype.importUri = function (typeOrFunc) { }; /** * @abstract * @param {?} typeOrFunc * @return {?} */ ReflectorReader.prototype.resourceUri = function (typeOrFunc) { }; /** * @abstract * @param {?} name * @param {?} moduleUrl * @param {?} members * @param {?} runtime * @return {?} */ ReflectorReader.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) { }; /** * @abstract * @param {?} identifier * @param {?} name * @return {?} */ ReflectorReader.prototype.resolveEnum = function (identifier, name) { }; return ReflectorReader; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Provides access to reflection data about symbols. Used internally by Angular * to power dependency injection and compilation. */ var Reflector = (function (_super) { __extends(Reflector, _super); /** * @param {?} reflectionCapabilities */ function Reflector(reflectionCapabilities) { var _this = _super.call(this) || this; _this.reflectionCapabilities = reflectionCapabilities; return _this; } /** * @param {?} caps * @return {?} */ Reflector.prototype.updateCapabilities = function (caps) { this.reflectionCapabilities = caps; }; /** * @param {?} type * @return {?} */ Reflector.prototype.factory = function (type) { return this.reflectionCapabilities.factory(type); }; /** * @param {?} typeOrFunc * @return {?} */ Reflector.prototype.parameters = function (typeOrFunc) { return this.reflectionCapabilities.parameters(typeOrFunc); }; /** * @param {?} typeOrFunc * @return {?} */ Reflector.prototype.annotations = function (typeOrFunc) { return this.reflectionCapabilities.annotations(typeOrFunc); }; /** * @param {?} typeOrFunc * @return {?} */ Reflector.prototype.propMetadata = function (typeOrFunc) { return this.reflectionCapabilities.propMetadata(typeOrFunc); }; /** * @param {?} type * @param {?} lcProperty * @return {?} */ Reflector.prototype.hasLifecycleHook = function (type, lcProperty) { return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty); }; /** * @param {?} name * @return {?} */ Reflector.prototype.getter = function (name) { return this.reflectionCapabilities.getter(name); }; /** * @param {?} name * @return {?} */ Reflector.prototype.setter = function (name) { return this.reflectionCapabilities.setter(name); }; /** * @param {?} name * @return {?} */ Reflector.prototype.method = function (name) { return this.reflectionCapabilities.method(name); }; /** * @param {?} type * @return {?} */ Reflector.prototype.importUri = function (type) { return this.reflectionCapabilities.importUri(type); }; /** * @param {?} type * @return {?} */ Reflector.prototype.resourceUri = function (type) { return this.reflectionCapabilities.resourceUri(type); }; /** * @param {?} name * @param {?} moduleUrl * @param {?} members * @param {?} runtime * @return {?} */ Reflector.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) { return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime); }; /** * @param {?} identifier * @param {?} name * @return {?} */ Reflector.prototype.resolveEnum = function (identifier, name) { return this.reflectionCapabilities.resolveEnum(identifier, name); }; return Reflector; }(ReflectorReader)); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * The {@link Reflector} used internally in Angular to access metadata * about symbols. */ var reflector = new Reflector(new ReflectionCapabilities()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * `Dependency` is used by the framework to extend DI. * This is internal to Angular and should not be used directly. */ var ReflectiveDependency = (function () { /** * @param {?} key * @param {?} optional * @param {?} visibility */ function ReflectiveDependency(key, optional, visibility) { this.key = key; this.optional = optional; this.visibility = visibility; } /** * @param {?} key * @return {?} */ ReflectiveDependency.fromKey = function (key) { return new ReflectiveDependency(key, false, null); }; return ReflectiveDependency; }()); var _EMPTY_LIST = []; var ResolvedReflectiveProvider_ = (function () { /** * @param {?} key * @param {?} resolvedFactories * @param {?} multiProvider */ function ResolvedReflectiveProvider_(key, resolvedFactories, multiProvider) { this.key = key; this.resolvedFactories = resolvedFactories; this.multiProvider = multiProvider; } Object.defineProperty(ResolvedReflectiveProvider_.prototype, "resolvedFactory", { /** * @return {?} */ get: function () { return this.resolvedFactories[0]; }, enumerable: true, configurable: true }); return ResolvedReflectiveProvider_; }()); /** * An internal resolved representation of a factory function created by resolving {\@link * Provider}. * \@experimental */ var ResolvedReflectiveFactory = (function () { /** * @param {?} factory * @param {?} dependencies */ function ResolvedReflectiveFactory(factory, dependencies) { this.factory = factory; this.dependencies = dependencies; } return ResolvedReflectiveFactory; }()); /** * Resolve a single provider. * @param {?} provider * @return {?} */ function resolveReflectiveFactory(provider) { var /** @type {?} */ factoryFn; var /** @type {?} */ resolvedDeps; if (provider.useClass) { var /** @type {?} */ useClass = resolveForwardRef(provider.useClass); factoryFn = reflector.factory(useClass); resolvedDeps = _dependenciesFor(useClass); } else if (provider.useExisting) { factoryFn = function (aliasInstance) { return aliasInstance; }; resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))]; } else if (provider.useFactory) { factoryFn = provider.useFactory; resolvedDeps = constructDependencies(provider.useFactory, provider.deps); } else { factoryFn = function () { return provider.useValue; }; resolvedDeps = _EMPTY_LIST; } return new ResolvedReflectiveFactory(factoryFn, resolvedDeps); } /** * Converts the {\@link Provider} into {\@link ResolvedProvider}. * * {\@link Injector} internally only uses {\@link ResolvedProvider}, {\@link Provider} contains * convenience provider syntax. * @param {?} provider * @return {?} */ function resolveReflectiveProvider(provider) { return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false); } /** * Resolve a list of Providers. * @param {?} providers * @return {?} */ function resolveReflectiveProviders(providers) { var /** @type {?} */ normalized = _normalizeProviders(providers, []); var /** @type {?} */ resolved = normalized.map(resolveReflectiveProvider); var /** @type {?} */ resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map()); return Array.from(resolvedProviderMap.values()); } /** * Merges a list of ResolvedProviders into a list where * each key is contained exactly once and multi providers * have been merged. * @param {?} providers * @param {?} normalizedProvidersMap * @return {?} */ function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) { for (var /** @type {?} */ i = 0; i < providers.length; i++) { var /** @type {?} */ provider = providers[i]; var /** @type {?} */ existing = normalizedProvidersMap.get(provider.key.id); if (existing) { if (provider.multiProvider !== existing.multiProvider) { throw mixingMultiProvidersWithRegularProvidersError(existing, provider); } if (provider.multiProvider) { for (var /** @type {?} */ j = 0; j < provider.resolvedFactories.length; j++) { existing.resolvedFactories.push(provider.resolvedFactories[j]); } } else { normalizedProvidersMap.set(provider.key.id, provider); } } else { var /** @type {?} */ resolvedProvider = void 0; if (provider.multiProvider) { resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider); } else { resolvedProvider = provider; } normalizedProvidersMap.set(provider.key.id, resolvedProvider); } } return normalizedProvidersMap; } /** * @param {?} providers * @param {?} res * @return {?} */ function _normalizeProviders(providers, res) { providers.forEach(function (b) { if (b instanceof Type) { res.push({ provide: b, useClass: b }); } else if (b && typeof b == 'object' && ((b)).provide !== undefined) { res.push(/** @type {?} */ (b)); } else if (b instanceof Array) { _normalizeProviders(b, res); } else { throw invalidProviderError(b); } }); return res; } /** * @param {?} typeOrFunc * @param {?=} dependencies * @return {?} */ function constructDependencies(typeOrFunc, dependencies) { if (!dependencies) { return _dependenciesFor(typeOrFunc); } else { var /** @type {?} */ params_1 = dependencies.map(function (t) { return [t]; }); return dependencies.map(function (t) { return _extractToken(typeOrFunc, t, params_1); }); } } /** * @param {?} typeOrFunc * @return {?} */ function _dependenciesFor(typeOrFunc) { var /** @type {?} */ params = reflector.parameters(typeOrFunc); if (!params) return []; if (params.some(function (p) { return p == null; })) { throw noAnnotationError(typeOrFunc, params); } return params.map(function (p) { return _extractToken(typeOrFunc, p, params); }); } /** * @param {?} typeOrFunc * @param {?} metadata * @param {?} params * @return {?} */ function _extractToken(typeOrFunc, metadata, params) { var /** @type {?} */ token = null; var /** @type {?} */ optional = false; if (!Array.isArray(metadata)) { if (metadata instanceof Inject) { return _createDependency(metadata['token'], optional, null); } else { return _createDependency(metadata, optional, null); } } var /** @type {?} */ visibility = null; for (var /** @type {?} */ i = 0; i < metadata.length; ++i) { var /** @type {?} */ paramMetadata = metadata[i]; if (paramMetadata instanceof Type) { token = paramMetadata; } else if (paramMetadata instanceof Inject) { token = paramMetadata['token']; } else if (paramMetadata instanceof Optional) { optional = true; } else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) { visibility = paramMetadata; } else if (paramMetadata instanceof InjectionToken) { token = paramMetadata; } } token = resolveForwardRef(token); if (token != null) { return _createDependency(token, optional, visibility); } else { throw noAnnotationError(typeOrFunc, params); } } /** * @param {?} token * @param {?} optional * @param {?} visibility * @return {?} */ function _createDependency(token, optional, visibility) { return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // Threshold for the dynamic version var UNDEFINED = new Object(); /** * A ReflectiveDependency injection container used for instantiating objects and resolving * dependencies. * * An `Injector` is a replacement for a `new` operator, which can automatically resolve the * constructor dependencies. * * In typical use, application code asks for the dependencies in the constructor and they are * resolved by the `Injector`. * * ### Example ([live demo](http://plnkr.co/edit/jzjec0?p=preview)) * * The following example creates an `Injector` configured to create `Engine` and `Car`. * * ```typescript * \@Injectable() * class Engine { * } * * \@Injectable() * class Car { * constructor(public engine:Engine) {} * } * * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]); * var car = injector.get(Car); * expect(car instanceof Car).toBe(true); * expect(car.engine instanceof Engine).toBe(true); * ``` * * Notice, we don't use the `new` operator because we explicitly want to have the `Injector` * resolve all of the object's dependencies automatically. * * \@stable * @abstract */ var ReflectiveInjector = (function () { function ReflectiveInjector() { } /** * Turns an array of provider definitions into an array of resolved providers. * * A resolution is a process of flattening multiple nested arrays and converting individual * providers into an array of {\@link ResolvedReflectiveProvider}s. * * ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview)) * * ```typescript * \@Injectable() * class Engine { * } * * \@Injectable() * class Car { * constructor(public engine:Engine) {} * } * * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]); * * expect(providers.length).toEqual(2); * * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true); * expect(providers[0].key.displayName).toBe("Car"); * expect(providers[0].dependencies.length).toEqual(1); * expect(providers[0].factory).toBeDefined(); * * expect(providers[1].key.displayName).toBe("Engine"); * }); * ``` * * See {\@link ReflectiveInjector#fromResolvedProviders} for more info. * @param {?} providers * @return {?} */ ReflectiveInjector.resolve = function (providers) { return resolveReflectiveProviders(providers); }; /** * Resolves an array of providers and creates an injector from those providers. * * The passed-in providers can be an array of `Type`, {\@link Provider}, * or a recursive array of more providers. * * ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview)) * * ```typescript * \@Injectable() * class Engine { * } * * \@Injectable() * class Car { * constructor(public engine:Engine) {} * } * * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]); * expect(injector.get(Car) instanceof Car).toBe(true); * ``` * * This function is slower than the corresponding `fromResolvedProviders` * because it needs to resolve the passed-in providers first. * See {\@link Injector#resolve} and {\@link Injector#fromResolvedProviders}. * @param {?} providers * @param {?=} parent * @return {?} */ ReflectiveInjector.resolveAndCreate = function (providers, parent) { var /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers); return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent); }; /** * Creates an injector from previously resolved providers. * * This API is the recommended way to construct injectors in performance-sensitive parts. * * ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview)) * * ```typescript * \@Injectable() * class Engine { * } * * \@Injectable() * class Car { * constructor(public engine:Engine) {} * } * * var providers = ReflectiveInjector.resolve([Car, Engine]); * var injector = ReflectiveInjector.fromResolvedProviders(providers); * expect(injector.get(Car) instanceof Car).toBe(true); * ``` * \@experimental * @param {?} providers * @param {?=} parent * @return {?} */ ReflectiveInjector.fromResolvedProviders = function (providers, parent) { return new ReflectiveInjector_(providers, parent); }; /** * Parent of this injector. * * * * ### Example ([live demo](http://plnkr.co/edit/eosMGo?p=preview)) * * ```typescript * var parent = ReflectiveInjector.resolveAndCreate([]); * var child = parent.resolveAndCreateChild([]); * expect(child.parent).toBe(parent); * ``` * @abstract * @return {?} */ ReflectiveInjector.prototype.parent = function () { }; /** * Resolves an array of providers and creates a child injector from those providers. * * * * The passed-in providers can be an array of `Type`, {\@link Provider}, * or a recursive array of more providers. * * ### Example ([live demo](http://plnkr.co/edit/opB3T4?p=preview)) * * ```typescript * class ParentProvider {} * class ChildProvider {} * * var parent = ReflectiveInjector.resolveAndCreate([ParentProvider]); * var child = parent.resolveAndCreateChild([ChildProvider]); * * expect(child.get(ParentProvider) instanceof ParentProvider).toBe(true); * expect(child.get(ChildProvider) instanceof ChildProvider).toBe(true); * expect(child.get(ParentProvider)).toBe(parent.get(ParentProvider)); * ``` * * This function is slower than the corresponding `createChildFromResolved` * because it needs to resolve the passed-in providers first. * See {\@link Injector#resolve} and {\@link Injector#createChildFromResolved}. * @abstract * @param {?} providers * @return {?} */ ReflectiveInjector.prototype.resolveAndCreateChild = function (providers) { }; /** * Creates a child injector from previously resolved providers. * * * * This API is the recommended way to construct injectors in performance-sensitive parts. * * ### Example ([live demo](http://plnkr.co/edit/VhyfjN?p=preview)) * * ```typescript * class ParentProvider {} * class ChildProvider {} * * var parentProviders = ReflectiveInjector.resolve([ParentProvider]); * var childProviders = ReflectiveInjector.resolve([ChildProvider]); * * var parent = ReflectiveInjector.fromResolvedProviders(parentProviders); * var child = parent.createChildFromResolved(childProviders); * * expect(child.get(ParentProvider) instanceof ParentProvider).toBe(true); * expect(child.get(ChildProvider) instanceof ChildProvider).toBe(true); * expect(child.get(ParentProvider)).toBe(parent.get(ParentProvider)); * ``` * @abstract * @param {?} providers * @return {?} */ ReflectiveInjector.prototype.createChildFromResolved = function (providers) { }; /** * Resolves a provider and instantiates an object in the context of the injector. * * The created object does not get cached by the injector. * * ### Example ([live demo](http://plnkr.co/edit/yvVXoB?p=preview)) * * ```typescript * \@Injectable() * class Engine { * } * * \@Injectable() * class Car { * constructor(public engine:Engine) {} * } * * var injector = ReflectiveInjector.resolveAndCreate([Engine]); * * var car = injector.resolveAndInstantiate(Car); * expect(car.engine).toBe(injector.get(Engine)); * expect(car).not.toBe(injector.resolveAndInstantiate(Car)); * ``` * @abstract * @param {?} provider * @return {?} */ ReflectiveInjector.prototype.resolveAndInstantiate = function (provider) { }; /** * Instantiates an object using a resolved provider in the context of the injector. * * The created object does not get cached by the injector. * * ### Example ([live demo](http://plnkr.co/edit/ptCImQ?p=preview)) * * ```typescript * \@Injectable() * class Engine { * } * * \@Injectable() * class Car { * constructor(public engine:Engine) {} * } * * var injector = ReflectiveInjector.resolveAndCreate([Engine]); * var carProvider = ReflectiveInjector.resolve([Car])[0]; * var car = injector.instantiateResolved(carProvider); * expect(car.engine).toBe(injector.get(Engine)); * expect(car).not.toBe(injector.instantiateResolved(carProvider)); * ``` * @abstract * @param {?} provider * @return {?} */ ReflectiveInjector.prototype.instantiateResolved = function (provider) { }; /** * @abstract * @param {?} token * @param {?=} notFoundValue * @return {?} */ ReflectiveInjector.prototype.get = function (token, notFoundValue) { }; return ReflectiveInjector; }()); var ReflectiveInjector_ = (function () { /** * Private * @param {?} _providers * @param {?=} _parent */ function ReflectiveInjector_(_providers, _parent) { /** * \@internal */ this._constructionCounter = 0; this._providers = _providers; this._parent = _parent || null; var len = _providers.length; this.keyIds = new Array(len); this.objs = new Array(len); for (var i = 0; i < len; i++) { this.keyIds[i] = _providers[i].key.id; this.objs[i] = UNDEFINED; } } /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ ReflectiveInjector_.prototype.get = function (token, notFoundValue) { if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; } return this._getByKey(ReflectiveKey.get(token), null, notFoundValue); }; Object.defineProperty(ReflectiveInjector_.prototype, "parent", { /** * @return {?} */ get: function () { return this._parent; }, enumerable: true, configurable: true }); /** * @param {?} providers * @return {?} */ ReflectiveInjector_.prototype.resolveAndCreateChild = function (providers) { var /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers); return this.createChildFromResolved(ResolvedReflectiveProviders); }; /** * @param {?} providers * @return {?} */ ReflectiveInjector_.prototype.createChildFromResolved = function (providers) { var /** @type {?} */ inj = new ReflectiveInjector_(providers); inj._parent = this; return inj; }; /** * @param {?} provider * @return {?} */ ReflectiveInjector_.prototype.resolveAndInstantiate = function (provider) { return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]); }; /** * @param {?} provider * @return {?} */ ReflectiveInjector_.prototype.instantiateResolved = function (provider) { return this._instantiateProvider(provider); }; /** * @param {?} index * @return {?} */ ReflectiveInjector_.prototype.getProviderAtIndex = function (index) { if (index < 0 || index >= this._providers.length) { throw outOfBoundsError(index); } return this._providers[index]; }; /** * \@internal * @param {?} provider * @return {?} */ ReflectiveInjector_.prototype._new = function (provider) { if (this._constructionCounter++ > this._getMaxNumberOfObjects()) { throw cyclicDependencyError(this, provider.key); } return this._instantiateProvider(provider); }; /** * @return {?} */ ReflectiveInjector_.prototype._getMaxNumberOfObjects = function () { return this.objs.length; }; /** * @param {?} provider * @return {?} */ ReflectiveInjector_.prototype._instantiateProvider = function (provider) { if (provider.multiProvider) { var /** @type {?} */ res = new Array(provider.resolvedFactories.length); for (var /** @type {?} */ i = 0; i < provider.resolvedFactories.length; ++i) { res[i] = this._instantiate(provider, provider.resolvedFactories[i]); } return res; } else { return this._instantiate(provider, provider.resolvedFactories[0]); } }; /** * @param {?} provider * @param {?} ResolvedReflectiveFactory * @return {?} */ ReflectiveInjector_.prototype._instantiate = function (provider, ResolvedReflectiveFactory$$1) { var _this = this; var /** @type {?} */ factory = ResolvedReflectiveFactory$$1.factory; var /** @type {?} */ deps; try { deps = ResolvedReflectiveFactory$$1.dependencies.map(function (dep) { return _this._getByReflectiveDependency(dep); }); } catch (e) { if (e.addKey) { e.addKey(this, provider.key); } throw e; } var /** @type {?} */ obj; try { obj = factory.apply(void 0, deps); } catch (e) { throw instantiationError(this, e, e.stack, provider.key); } return obj; }; /** * @param {?} dep * @return {?} */ ReflectiveInjector_.prototype._getByReflectiveDependency = function (dep) { return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND); }; /** * @param {?} key * @param {?} visibility * @param {?} notFoundValue * @return {?} */ ReflectiveInjector_.prototype._getByKey = function (key, visibility, notFoundValue) { if (key === INJECTOR_KEY) { return this; } if (visibility instanceof Self) { return this._getByKeySelf(key, notFoundValue); } else { return this._getByKeyDefault(key, notFoundValue, visibility); } }; /** * @param {?} keyId * @return {?} */ ReflectiveInjector_.prototype._getObjByKeyId = function (keyId) { for (var /** @type {?} */ i = 0; i < this.keyIds.length; i++) { if (this.keyIds[i] === keyId) { if (this.objs[i] === UNDEFINED) { this.objs[i] = this._new(this._providers[i]); } return this.objs[i]; } } return UNDEFINED; }; /** * \@internal * @param {?} key * @param {?} notFoundValue * @return {?} */ ReflectiveInjector_.prototype._throwOrNull = function (key, notFoundValue) { if (notFoundValue !== THROW_IF_NOT_FOUND) { return notFoundValue; } else { throw noProviderError(this, key); } }; /** * \@internal * @param {?} key * @param {?} notFoundValue * @return {?} */ ReflectiveInjector_.prototype._getByKeySelf = function (key, notFoundValue) { var /** @type {?} */ obj = this._getObjByKeyId(key.id); return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue); }; /** * \@internal * @param {?} key * @param {?} notFoundValue * @param {?} visibility * @return {?} */ ReflectiveInjector_.prototype._getByKeyDefault = function (key, notFoundValue, visibility) { var /** @type {?} */ inj; if (visibility instanceof SkipSelf) { inj = this._parent; } else { inj = this; } while (inj instanceof ReflectiveInjector_) { var /** @type {?} */ inj_ = (inj); var /** @type {?} */ obj = inj_._getObjByKeyId(key.id); if (obj !== UNDEFINED) return obj; inj = inj_._parent; } if (inj !== null) { return inj.get(key.token, notFoundValue); } else { return this._throwOrNull(key, notFoundValue); } }; Object.defineProperty(ReflectiveInjector_.prototype, "displayName", { /** * @return {?} */ get: function () { var /** @type {?} */ providers = _mapProviders(this, function (b) { return ' "' + b.key.displayName + '" '; }) .join(', '); return "ReflectiveInjector(providers: [" + providers + "])"; }, enumerable: true, configurable: true }); /** * @return {?} */ ReflectiveInjector_.prototype.toString = function () { return this.displayName; }; return ReflectiveInjector_; }()); var INJECTOR_KEY = ReflectiveKey.get(Injector); /** * @param {?} injector * @param {?} fn * @return {?} */ function _mapProviders(injector, fn) { var /** @type {?} */ res = new Array(injector._providers.length); for (var /** @type {?} */ i = 0; i < injector._providers.length; ++i) { res[i] = fn(injector.getProviderAtIndex(i)); } return res; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * The `di` module provides dependency injection container services. */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Determine if the argument is shaped like a Promise * @param {?} obj * @return {?} */ function isPromise(obj) { // allow any Promise/A+ compliant thenable. // It's up to the caller to ensure that obj.then conforms to the spec return !!obj && typeof obj.then === 'function'; } /** * Determine if the argument is an Observable * @param {?} obj * @return {?} */ function isObservable(obj) { // TODO use Symbol.observable when https://github.com/ReactiveX/rxjs/issues/2415 will be resolved return !!obj && typeof obj.subscribe === 'function'; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A function that will be executed when an application is initialized. * \@experimental */ var APP_INITIALIZER = new InjectionToken('Application Initializer'); /** * A class that reflects the state of running {\@link APP_INITIALIZER}s. * * \@experimental */ var ApplicationInitStatus = (function () { /** * @param {?} appInits */ function ApplicationInitStatus(appInits) { var _this = this; this._done = false; var asyncInitPromises = []; if (appInits) { for (var i = 0; i < appInits.length; i++) { var initResult = appInits[i](); if (isPromise(initResult)) { asyncInitPromises.push(initResult); } } } this._donePromise = Promise.all(asyncInitPromises).then(function () { _this._done = true; }); if (asyncInitPromises.length === 0) { this._done = true; } } Object.defineProperty(ApplicationInitStatus.prototype, "done", { /** * @return {?} */ get: function () { return this._done; }, enumerable: true, configurable: true }); Object.defineProperty(ApplicationInitStatus.prototype, "donePromise", { /** * @return {?} */ get: function () { return this._donePromise; }, enumerable: true, configurable: true }); return ApplicationInitStatus; }()); ApplicationInitStatus.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ ApplicationInitStatus.ctorParameters = function () { return [ { type: Array, decorators: [{ type: Inject, args: [APP_INITIALIZER,] }, { type: Optional },] }, ]; }; /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A DI Token representing a unique string id assigned to the application by Angular and used * primarily for prefixing application attributes and CSS styles when * {\@link ViewEncapsulation#Emulated} is being used. * * If you need to avoid randomly generated value to be used as an application id, you can provide * a custom value via a DI provider configuring the root {\@link Injector} * using this token. * \@experimental */ var APP_ID = new InjectionToken('AppId'); /** * @return {?} */ function _appIdRandomProviderFactory() { return "" + _randomChar() + _randomChar() + _randomChar(); } /** * Providers that will generate a random APP_ID_TOKEN. * \@experimental */ var APP_ID_RANDOM_PROVIDER = { provide: APP_ID, useFactory: _appIdRandomProviderFactory, deps: [], }; /** * @return {?} */ function _randomChar() { return String.fromCharCode(97 + Math.floor(Math.random() * 25)); } /** * A function that will be executed when a platform is initialized. * \@experimental */ var PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer'); /** * A token that indicates an opaque platform id. * \@experimental */ var PLATFORM_ID = new InjectionToken('Platform ID'); /** * All callbacks provided via this token will be called for every component that is bootstrapped. * Signature of the callback: * * `(componentRef: ComponentRef) => void`. * * \@experimental */ var APP_BOOTSTRAP_LISTENER = new InjectionToken('appBootstrapListener'); /** * A token which indicates the root directory of the application * \@experimental */ var PACKAGE_ROOT_URL = new InjectionToken('Application Packages Root URL'); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var Console = (function () { function Console() { } /** * @param {?} message * @return {?} */ Console.prototype.log = function (message) { // tslint:disable-next-line:no-console console.log(message); }; /** * @param {?} message * @return {?} */ Console.prototype.warn = function (message) { // tslint:disable-next-line:no-console console.warn(message); }; return Console; }()); Console.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ Console.ctorParameters = function () { return []; }; /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Combination of NgModuleFactory and ComponentFactorys. * * \@experimental */ var ModuleWithComponentFactories = (function () { /** * @param {?} ngModuleFactory * @param {?} componentFactories */ function ModuleWithComponentFactories(ngModuleFactory, componentFactories) { this.ngModuleFactory = ngModuleFactory; this.componentFactories = componentFactories; } return ModuleWithComponentFactories; }()); /** * @return {?} */ function _throwError() { throw new Error("Runtime compiler is not loaded"); } /** * Low-level service for running the angular compiler during runtime * to create {\@link ComponentFactory}s, which * can later be used to create and render a Component instance. * * Each `\@NgModule` provides an own `Compiler` to its injector, * that will use the directives/pipes of the ng module for compilation * of components. * \@stable */ var Compiler = (function () { function Compiler() { } /** * Compiles the given NgModule and all of its components. All templates of the components listed * in `entryComponents` have to be inlined. * @template T * @param {?} moduleType * @return {?} */ Compiler.prototype.compileModuleSync = function (moduleType) { throw _throwError(); }; /** * Compiles the given NgModule and all of its components * @template T * @param {?} moduleType * @return {?} */ Compiler.prototype.compileModuleAsync = function (moduleType) { throw _throwError(); }; /** * Same as {\@link #compileModuleSync} but also creates ComponentFactories for all components. * @template T * @param {?} moduleType * @return {?} */ Compiler.prototype.compileModuleAndAllComponentsSync = function (moduleType) { throw _throwError(); }; /** * Same as {\@link #compileModuleAsync} but also creates ComponentFactories for all components. * @template T * @param {?} moduleType * @return {?} */ Compiler.prototype.compileModuleAndAllComponentsAsync = function (moduleType) { throw _throwError(); }; /** * Exposes the CSS-style selectors that have been used in `ngContent` directives within * the template of the given component. * This is used by the `upgrade` library to compile the appropriate transclude content * in the AngularJS wrapper component. * * @deprecated since v4. Use ComponentFactory.ngContentSelectors instead. * @param {?} component * @return {?} */ Compiler.prototype.getNgContentSelectors = function (component) { throw _throwError(); }; /** * Clears all caches. * @return {?} */ Compiler.prototype.clearCache = function () { }; /** * Clears the cache for the given component/ngModule. * @param {?} type * @return {?} */ Compiler.prototype.clearCacheFor = function (type) { }; return Compiler; }()); Compiler.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ Compiler.ctorParameters = function () { return []; }; /** * Token to provide CompilerOptions in the platform injector. * * \@experimental */ var COMPILER_OPTIONS = new InjectionToken('compilerOptions'); /** * A factory for creating a Compiler * * \@experimental * @abstract */ var CompilerFactory = (function () { function CompilerFactory() { } /** * @abstract * @param {?=} options * @return {?} */ CompilerFactory.prototype.createCompiler = function (options) { }; return CompilerFactory; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Represents an instance of a Component created via a {\@link ComponentFactory}. * * `ComponentRef` provides access to the Component Instance as well other objects related to this * Component Instance and allows you to destroy the Component Instance via the {\@link #destroy} * method. * \@stable * @abstract */ var ComponentRef = (function () { function ComponentRef() { } /** * Location of the Host Element of this Component Instance. * @abstract * @return {?} */ ComponentRef.prototype.location = function () { }; /** * The injector on which the component instance exists. * @abstract * @return {?} */ ComponentRef.prototype.injector = function () { }; /** * The instance of the Component. * @abstract * @return {?} */ ComponentRef.prototype.instance = function () { }; /** * The {\@link ViewRef} of the Host View of this Component instance. * @abstract * @return {?} */ ComponentRef.prototype.hostView = function () { }; /** * The {\@link ChangeDetectorRef} of the Component instance. * @abstract * @return {?} */ ComponentRef.prototype.changeDetectorRef = function () { }; /** * The component type. * @abstract * @return {?} */ ComponentRef.prototype.componentType = function () { }; /** * Destroys the component instance and all of the data structures associated with it. * @abstract * @return {?} */ ComponentRef.prototype.destroy = function () { }; /** * Allows to register a callback that will be called when the component is destroyed. * @abstract * @param {?} callback * @return {?} */ ComponentRef.prototype.onDestroy = function (callback) { }; return ComponentRef; }()); /** * \@stable * @abstract */ var ComponentFactory = (function () { function ComponentFactory() { } /** * @abstract * @return {?} */ ComponentFactory.prototype.selector = function () { }; /** * @abstract * @return {?} */ ComponentFactory.prototype.componentType = function () { }; /** * selector for all elements in the component. * @abstract * @return {?} */ ComponentFactory.prototype.ngContentSelectors = function () { }; /** * the inputs of the component. * @abstract * @return {?} */ ComponentFactory.prototype.inputs = function () { }; /** * the outputs of the component. * @abstract * @return {?} */ ComponentFactory.prototype.outputs = function () { }; /** * Creates a new component. * @abstract * @param {?} injector * @param {?=} projectableNodes * @param {?=} rootSelectorOrNode * @param {?=} ngModule * @return {?} */ ComponentFactory.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) { }; return ComponentFactory; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} component * @return {?} */ function noComponentFactoryError(component) { var /** @type {?} */ error = Error("No component factory found for " + stringify(component) + ". Did you add it to @NgModule.entryComponents?"); ((error))[ERROR_COMPONENT] = component; return error; } var ERROR_COMPONENT = 'ngComponent'; /** * @param {?} error * @return {?} */ var _NullComponentFactoryResolver = (function () { function _NullComponentFactoryResolver() { } /** * @template T * @param {?} component * @return {?} */ _NullComponentFactoryResolver.prototype.resolveComponentFactory = function (component) { throw noComponentFactoryError(component); }; return _NullComponentFactoryResolver; }()); /** * \@stable * @abstract */ var ComponentFactoryResolver = (function () { function ComponentFactoryResolver() { } /** * @abstract * @template T * @param {?} component * @return {?} */ ComponentFactoryResolver.prototype.resolveComponentFactory = function (component) { }; return ComponentFactoryResolver; }()); ComponentFactoryResolver.NULL = new _NullComponentFactoryResolver(); var CodegenComponentFactoryResolver = (function () { /** * @param {?} factories * @param {?} _parent * @param {?} _ngModule */ function CodegenComponentFactoryResolver(factories, _parent, _ngModule) { this._parent = _parent; this._ngModule = _ngModule; this._factories = new Map(); for (var i = 0; i < factories.length; i++) { var factory = factories[i]; this._factories.set(factory.componentType, factory); } } /** * @template T * @param {?} component * @return {?} */ CodegenComponentFactoryResolver.prototype.resolveComponentFactory = function (component) { var /** @type {?} */ factory = this._factories.get(component) || this._parent.resolveComponentFactory(component); return new ComponentFactoryBoundToModule(factory, this._ngModule); }; return CodegenComponentFactoryResolver; }()); var ComponentFactoryBoundToModule = (function (_super) { __extends(ComponentFactoryBoundToModule, _super); /** * @param {?} factory * @param {?} ngModule */ function ComponentFactoryBoundToModule(factory, ngModule) { var _this = _super.call(this) || this; _this.factory = factory; _this.ngModule = ngModule; return _this; } Object.defineProperty(ComponentFactoryBoundToModule.prototype, "selector", { /** * @return {?} */ get: function () { return this.factory.selector; }, enumerable: true, configurable: true }); Object.defineProperty(ComponentFactoryBoundToModule.prototype, "componentType", { /** * @return {?} */ get: function () { return this.factory.componentType; }, enumerable: true, configurable: true }); Object.defineProperty(ComponentFactoryBoundToModule.prototype, "ngContentSelectors", { /** * @return {?} */ get: function () { return this.factory.ngContentSelectors; }, enumerable: true, configurable: true }); Object.defineProperty(ComponentFactoryBoundToModule.prototype, "inputs", { /** * @return {?} */ get: function () { return this.factory.inputs; }, enumerable: true, configurable: true }); Object.defineProperty(ComponentFactoryBoundToModule.prototype, "outputs", { /** * @return {?} */ get: function () { return this.factory.outputs; }, enumerable: true, configurable: true }); /** * @param {?} injector * @param {?=} projectableNodes * @param {?=} rootSelectorOrNode * @param {?=} ngModule * @return {?} */ ComponentFactoryBoundToModule.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) { return this.factory.create(injector, projectableNodes, rootSelectorOrNode, ngModule || this.ngModule); }; return ComponentFactoryBoundToModule; }(ComponentFactory)); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Represents an instance of an NgModule created via a {\@link NgModuleFactory}. * * `NgModuleRef` provides access to the NgModule Instance as well other objects related to this * NgModule Instance. * * \@stable * @abstract */ var NgModuleRef = (function () { function NgModuleRef() { } /** * The injector that contains all of the providers of the NgModule. * @abstract * @return {?} */ NgModuleRef.prototype.injector = function () { }; /** * The ComponentFactoryResolver to get hold of the ComponentFactories * declared in the `entryComponents` property of the module. * @abstract * @return {?} */ NgModuleRef.prototype.componentFactoryResolver = function () { }; /** * The NgModule instance. * @abstract * @return {?} */ NgModuleRef.prototype.instance = function () { }; /** * Destroys the module instance and all of the data structures associated with it. * @abstract * @return {?} */ NgModuleRef.prototype.destroy = function () { }; /** * Allows to register a callback that will be called when the module is destroyed. * @abstract * @param {?} callback * @return {?} */ NgModuleRef.prototype.onDestroy = function (callback) { }; return NgModuleRef; }()); /** * \@experimental */ var NgModuleFactory = (function () { /** * @param {?} _injectorClass * @param {?} _moduleType */ function NgModuleFactory(_injectorClass, _moduleType) { this._injectorClass = _injectorClass; this._moduleType = _moduleType; } Object.defineProperty(NgModuleFactory.prototype, "moduleType", { /** * @return {?} */ get: function () { return this._moduleType; }, enumerable: true, configurable: true }); /** * @param {?} parentInjector * @return {?} */ NgModuleFactory.prototype.create = function (parentInjector) { var /** @type {?} */ instance = new this._injectorClass(parentInjector || Injector.NULL); instance.create(); return instance; }; return NgModuleFactory; }()); var _UNDEFINED = new Object(); /** * @abstract */ var NgModuleInjector = (function () { /** * @param {?} parent * @param {?} factories * @param {?} bootstrapFactories */ function NgModuleInjector(parent, factories, bootstrapFactories) { var _this = this; this.parent = parent; this._destroyListeners = []; this._destroyed = false; this.bootstrapFactories = bootstrapFactories.map(function (f) { return new ComponentFactoryBoundToModule(f, _this); }); this._cmpFactoryResolver = new CodegenComponentFactoryResolver(factories, parent.get(ComponentFactoryResolver, ComponentFactoryResolver.NULL), this); } /** * @return {?} */ NgModuleInjector.prototype.create = function () { this.instance = this.createInternal(); }; /** * @abstract * @return {?} */ NgModuleInjector.prototype.createInternal = function () { }; /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ NgModuleInjector.prototype.get = function (token, notFoundValue) { if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; } if (token === Injector || token === NgModuleRef) { return this; } if (token === ComponentFactoryResolver) { return this._cmpFactoryResolver; } var /** @type {?} */ result = this.getInternal(token, _UNDEFINED); return result === _UNDEFINED ? this.parent.get(token, notFoundValue) : result; }; /** * @abstract * @param {?} token * @param {?} notFoundValue * @return {?} */ NgModuleInjector.prototype.getInternal = function (token, notFoundValue) { }; Object.defineProperty(NgModuleInjector.prototype, "injector", { /** * @return {?} */ get: function () { return this; }, enumerable: true, configurable: true }); Object.defineProperty(NgModuleInjector.prototype, "componentFactoryResolver", { /** * @return {?} */ get: function () { return this._cmpFactoryResolver; }, enumerable: true, configurable: true }); /** * @return {?} */ NgModuleInjector.prototype.destroy = function () { if (this._destroyed) { throw new Error("The ng module " + stringify(this.instance.constructor) + " has already been destroyed."); } this._destroyed = true; this.destroyInternal(); this._destroyListeners.forEach(function (listener) { return listener(); }); }; /** * @param {?} callback * @return {?} */ NgModuleInjector.prototype.onDestroy = function (callback) { this._destroyListeners.push(callback); }; /** * @abstract * @return {?} */ NgModuleInjector.prototype.destroyInternal = function () { }; return NgModuleInjector; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var trace; var events; /** * @return {?} */ function detectWTF() { var /** @type {?} */ wtf = ((_global) /** TODO #9100 */)['wtf']; if (wtf) { trace = wtf['trace']; if (trace) { events = trace['events']; return true; } } return false; } /** * @param {?} signature * @param {?=} flags * @return {?} */ function createScope$1(signature, flags) { if (flags === void 0) { flags = null; } return events.createScope(signature, flags); } /** * @template T * @param {?} scope * @param {?=} returnValue * @return {?} */ function leave(scope, returnValue) { trace.leaveScope(scope, returnValue); return returnValue; } /** * @param {?} rangeType * @param {?} action * @return {?} */ function startTimeRange(rangeType, action) { return trace.beginTimeRange(rangeType, action); } /** * @param {?} range * @return {?} */ function endTimeRange(range) { trace.endTimeRange(range); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * True if WTF is enabled. */ var wtfEnabled = detectWTF(); /** * @param {?=} arg0 * @param {?=} arg1 * @return {?} */ function noopScope(arg0, arg1) { return null; } /** * Create trace scope. * * Scopes must be strictly nested and are analogous to stack frames, but * do not have to follow the stack frames. Instead it is recommended that they follow logical * nesting. You may want to use * [Event * Signatures](http://google.github.io/tracing-framework/instrumenting-code.html#custom-events) * as they are defined in WTF. * * Used to mark scope entry. The return value is used to leave the scope. * * var myScope = wtfCreateScope('MyClass#myMethod(ascii someVal)'); * * someMethod() { * var s = myScope('Foo'); // 'Foo' gets stored in tracing UI * // DO SOME WORK HERE * return wtfLeave(s, 123); // Return value 123 * } * * Note, adding try-finally block around the work to ensure that `wtfLeave` gets called can * negatively impact the performance of your application. For this reason we recommend that * you don't add them to ensure that `wtfLeave` gets called. In production `wtfLeave` is a noop and * so try-finally block has no value. When debugging perf issues, skipping `wtfLeave`, do to * exception, will produce incorrect trace, but presence of exception signifies logic error which * needs to be fixed before the app should be profiled. Add try-finally only when you expect that * an exception is expected during normal execution while profiling. * * \@experimental */ var wtfCreateScope = wtfEnabled ? createScope$1 : function (signature, flags) { return noopScope; }; /** * Used to mark end of Scope. * * - `scope` to end. * - `returnValue` (optional) to be passed to the WTF. * * Returns the `returnValue for easy chaining. * \@experimental */ var wtfLeave = wtfEnabled ? leave : function (s, r) { return r; }; /** * Used to mark Async start. Async are similar to scope but they don't have to be strictly nested. * The return value is used in the call to [endAsync]. Async ranges only work if WTF has been * enabled. * * someMethod() { * var s = wtfStartTimeRange('HTTP:GET', 'some.url'); * var future = new Future.delay(5).then((_) { * wtfEndTimeRange(s); * }); * } * \@experimental */ var wtfStartTimeRange = wtfEnabled ? startTimeRange : function (rangeType, action) { return null; }; /** * Ends a async time range operation. * [range] is the return value from [wtfStartTimeRange] Async ranges only work if WTF has been * enabled. * \@experimental */ var wtfEndTimeRange = wtfEnabled ? endTimeRange : function (r) { return null; }; /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Use by directives and components to emit custom Events. * * ### Examples * * In the following example, `Zippy` alternatively emits `open` and `close` events when its * title gets clicked: * * ``` * \@Component({ * selector: 'zippy', * template: ` *
*
Toggle
*
* *
*
`}) * export class Zippy { * visible: boolean = true; * \@Output() open: EventEmitter = new EventEmitter(); * \@Output() close: EventEmitter = new EventEmitter(); * * toggle() { * this.visible = !this.visible; * if (this.visible) { * this.open.emit(null); * } else { * this.close.emit(null); * } * } * } * ``` * * The events payload can be accessed by the parameter `$event` on the components output event * handler: * * ``` * * ``` * * Uses Rx.Observable but provides an adapter to make it work as specified here: * https://github.com/jhusain/observable-spec * * Once a reference implementation of the spec is available, switch to it. * \@stable */ var EventEmitter = (function (_super) { __extends(EventEmitter, _super); /** * Creates an instance of [EventEmitter], which depending on [isAsync], * delivers events synchronously or asynchronously. * @param {?=} isAsync */ function EventEmitter(isAsync) { if (isAsync === void 0) { isAsync = false; } var _this = _super.call(this) || this; _this.__isAsync = isAsync; return _this; } /** * @param {?=} value * @return {?} */ EventEmitter.prototype.emit = function (value) { _super.prototype.next.call(this, value); }; /** * @param {?=} generatorOrNext * @param {?=} error * @param {?=} complete * @return {?} */ EventEmitter.prototype.subscribe = function (generatorOrNext, error, complete) { var /** @type {?} */ schedulerFn; var /** @type {?} */ errorFn = function (err) { return null; }; var /** @type {?} */ completeFn = function () { return null; }; if (generatorOrNext && typeof generatorOrNext === 'object') { schedulerFn = this.__isAsync ? function (value) { setTimeout(function () { return generatorOrNext.next(value); }); } : function (value) { generatorOrNext.next(value); }; if (generatorOrNext.error) { errorFn = this.__isAsync ? function (err) { setTimeout(function () { return generatorOrNext.error(err); }); } : function (err) { generatorOrNext.error(err); }; } if (generatorOrNext.complete) { completeFn = this.__isAsync ? function () { setTimeout(function () { return generatorOrNext.complete(); }); } : function () { generatorOrNext.complete(); }; } } else { schedulerFn = this.__isAsync ? function (value) { setTimeout(function () { return generatorOrNext(value); }); } : function (value) { generatorOrNext(value); }; if (error) { errorFn = this.__isAsync ? function (err) { setTimeout(function () { return error(err); }); } : function (err) { error(err); }; } if (complete) { completeFn = this.__isAsync ? function () { setTimeout(function () { return complete(); }); } : function () { complete(); }; } } return _super.prototype.subscribe.call(this, schedulerFn, errorFn, completeFn); }; return EventEmitter; }(__WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__["Subject"])); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * An injectable service for executing work inside or outside of the Angular zone. * * The most common use of this service is to optimize performance when starting a work consisting of * one or more asynchronous tasks that don't require UI updates or error handling to be handled by * Angular. Such tasks can be kicked off via {\@link #runOutsideAngular} and if needed, these tasks * can reenter the Angular zone via {\@link #run}. * * * * ### Example * * ``` * import {Component, NgZone} from '\@angular/core'; * import {NgIf} from '\@angular/common'; * * \@Component({ * selector: 'ng-zone-demo'. * template: ` *

Demo: NgZone

* *

Progress: {{progress}}%

*

Done processing {{label}} of Angular zone!

* * * * `, * }) * export class NgZoneDemo { * progress: number = 0; * label: string; * * constructor(private _ngZone: NgZone) {} * * // Loop inside the Angular zone * // so the UI DOES refresh after each setTimeout cycle * processWithinAngularZone() { * this.label = 'inside'; * this.progress = 0; * this._increaseProgress(() => console.log('Inside Done!')); * } * * // Loop outside of the Angular zone * // so the UI DOES NOT refresh after each setTimeout cycle * processOutsideOfAngularZone() { * this.label = 'outside'; * this.progress = 0; * this._ngZone.runOutsideAngular(() => { * this._increaseProgress(() => { * // reenter the Angular zone and display done * this._ngZone.run(() => {console.log('Outside Done!') }); * }})); * } * * _increaseProgress(doneCallback: () => void) { * this.progress += 1; * console.log(`Current progress: ${this.progress}%`); * * if (this.progress < 100) { * window.setTimeout(() => this._increaseProgress(doneCallback)), 10) * } else { * doneCallback(); * } * } * } * ``` * * \@experimental */ var NgZone = (function () { /** * @param {?} __0 */ function NgZone(_a) { var _b = _a.enableLongStackTrace, enableLongStackTrace = _b === void 0 ? false : _b; this._hasPendingMicrotasks = false; this._hasPendingMacrotasks = false; this._isStable = true; this._nesting = 0; this._onUnstable = new EventEmitter(false); this._onMicrotaskEmpty = new EventEmitter(false); this._onStable = new EventEmitter(false); this._onErrorEvents = new EventEmitter(false); if (typeof Zone == 'undefined') { throw new Error('Angular requires Zone.js prolyfill.'); } Zone.assertZonePatched(); this.outer = this.inner = Zone.current; if (Zone['wtfZoneSpec']) { this.inner = this.inner.fork(Zone['wtfZoneSpec']); } if (enableLongStackTrace && Zone['longStackTraceZoneSpec']) { this.inner = this.inner.fork(Zone['longStackTraceZoneSpec']); } this.forkInnerZoneWithAngularBehavior(); } /** * @return {?} */ NgZone.isInAngularZone = function () { return Zone.current.get('isAngularZone') === true; }; /** * @return {?} */ NgZone.assertInAngularZone = function () { if (!NgZone.isInAngularZone()) { throw new Error('Expected to be in Angular Zone, but it is not!'); } }; /** * @return {?} */ NgZone.assertNotInAngularZone = function () { if (NgZone.isInAngularZone()) { throw new Error('Expected to not be in Angular Zone, but it is!'); } }; /** * Executes the `fn` function synchronously within the Angular zone and returns value returned by * the function. * * Running functions via `run` allows you to reenter Angular zone from a task that was executed * outside of the Angular zone (typically started via {\@link #runOutsideAngular}). * * Any future tasks or microtasks scheduled from within this function will continue executing from * within the Angular zone. * * If a synchronous error happens it will be rethrown and not reported via `onError`. * @param {?} fn * @return {?} */ NgZone.prototype.run = function (fn) { return this.inner.run(fn); }; /** * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not * rethrown. * @param {?} fn * @return {?} */ NgZone.prototype.runGuarded = function (fn) { return this.inner.runGuarded(fn); }; /** * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by * the function. * * Running functions via {\@link #runOutsideAngular} allows you to escape Angular's zone and do * work that * doesn't trigger Angular change-detection or is subject to Angular's error handling. * * Any future tasks or microtasks scheduled from within this function will continue executing from * outside of the Angular zone. * * Use {\@link #run} to reenter the Angular zone and do work that updates the application model. * @param {?} fn * @return {?} */ NgZone.prototype.runOutsideAngular = function (fn) { return this.outer.run(fn); }; Object.defineProperty(NgZone.prototype, "onUnstable", { /** * Notifies when code enters Angular Zone. This gets fired first on VM Turn. * @return {?} */ get: function () { return this._onUnstable; }, enumerable: true, configurable: true }); Object.defineProperty(NgZone.prototype, "onMicrotaskEmpty", { /** * Notifies when there is no more microtasks enqueue in the current VM Turn. * This is a hint for Angular to do change detection, which may enqueue more microtasks. * For this reason this event can fire multiple times per VM Turn. * @return {?} */ get: function () { return this._onMicrotaskEmpty; }, enumerable: true, configurable: true }); Object.defineProperty(NgZone.prototype, "onStable", { /** * Notifies when the last `onMicrotaskEmpty` has run and there are no more microtasks, which * implies we are about to relinquish VM turn. * This event gets called just once. * @return {?} */ get: function () { return this._onStable; }, enumerable: true, configurable: true }); Object.defineProperty(NgZone.prototype, "onError", { /** * Notify that an error has been delivered. * @return {?} */ get: function () { return this._onErrorEvents; }, enumerable: true, configurable: true }); Object.defineProperty(NgZone.prototype, "isStable", { /** * Whether there are no outstanding microtasks or macrotasks. * @return {?} */ get: function () { return this._isStable; }, enumerable: true, configurable: true }); Object.defineProperty(NgZone.prototype, "hasPendingMicrotasks", { /** * @return {?} */ get: function () { return this._hasPendingMicrotasks; }, enumerable: true, configurable: true }); Object.defineProperty(NgZone.prototype, "hasPendingMacrotasks", { /** * @return {?} */ get: function () { return this._hasPendingMacrotasks; }, enumerable: true, configurable: true }); /** * @return {?} */ NgZone.prototype.checkStable = function () { var _this = this; if (this._nesting == 0 && !this._hasPendingMicrotasks && !this._isStable) { try { this._nesting++; this._onMicrotaskEmpty.emit(null); } finally { this._nesting--; if (!this._hasPendingMicrotasks) { try { this.runOutsideAngular(function () { return _this._onStable.emit(null); }); } finally { this._isStable = true; } } } } }; /** * @return {?} */ NgZone.prototype.forkInnerZoneWithAngularBehavior = function () { var _this = this; this.inner = this.inner.fork({ name: 'angular', properties: /** @type {?} */ ({ 'isAngularZone': true }), onInvokeTask: function (delegate, current, target, task, applyThis, applyArgs) { try { _this.onEnter(); return delegate.invokeTask(target, task, applyThis, applyArgs); } finally { _this.onLeave(); } }, onInvoke: function (delegate, current, target, callback, applyThis, applyArgs, source) { try { _this.onEnter(); return delegate.invoke(target, callback, applyThis, applyArgs, source); } finally { _this.onLeave(); } }, onHasTask: function (delegate, current, target, hasTaskState) { delegate.hasTask(target, hasTaskState); if (current === target) { // We are only interested in hasTask events which originate from our zone // (A child hasTask event is not interesting to us) if (hasTaskState.change == 'microTask') { _this.setHasMicrotask(hasTaskState.microTask); } else if (hasTaskState.change == 'macroTask') { _this.setHasMacrotask(hasTaskState.macroTask); } } }, onHandleError: function (delegate, current, target, error) { delegate.handleError(target, error); _this.triggerError(error); return false; } }); }; /** * @return {?} */ NgZone.prototype.onEnter = function () { this._nesting++; if (this._isStable) { this._isStable = false; this._onUnstable.emit(null); } }; /** * @return {?} */ NgZone.prototype.onLeave = function () { this._nesting--; this.checkStable(); }; /** * @param {?} hasMicrotasks * @return {?} */ NgZone.prototype.setHasMicrotask = function (hasMicrotasks) { this._hasPendingMicrotasks = hasMicrotasks; this.checkStable(); }; /** * @param {?} hasMacrotasks * @return {?} */ NgZone.prototype.setHasMacrotask = function (hasMacrotasks) { this._hasPendingMacrotasks = hasMacrotasks; }; /** * @param {?} error * @return {?} */ NgZone.prototype.triggerError = function (error) { this._onErrorEvents.emit(error); }; return NgZone; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * The Testability service provides testing hooks that can be accessed from * the browser and by services such as Protractor. Each bootstrapped Angular * application on the page will have an instance of Testability. * \@experimental */ var Testability = (function () { /** * @param {?} _ngZone */ function Testability(_ngZone) { this._ngZone = _ngZone; /** * \@internal */ this._pendingCount = 0; /** * \@internal */ this._isZoneStable = true; /** * Whether any work was done since the last 'whenStable' callback. This is * useful to detect if this could have potentially destabilized another * component while it is stabilizing. * \@internal */ this._didWork = false; /** * \@internal */ this._callbacks = []; this._watchAngularEvents(); } /** * \@internal * @return {?} */ Testability.prototype._watchAngularEvents = function () { var _this = this; this._ngZone.onUnstable.subscribe({ next: function () { _this._didWork = true; _this._isZoneStable = false; } }); this._ngZone.runOutsideAngular(function () { _this._ngZone.onStable.subscribe({ next: function () { NgZone.assertNotInAngularZone(); scheduleMicroTask(function () { _this._isZoneStable = true; _this._runCallbacksIfReady(); }); } }); }); }; /** * @return {?} */ Testability.prototype.increasePendingRequestCount = function () { this._pendingCount += 1; this._didWork = true; return this._pendingCount; }; /** * @return {?} */ Testability.prototype.decreasePendingRequestCount = function () { this._pendingCount -= 1; if (this._pendingCount < 0) { throw new Error('pending async requests below zero'); } this._runCallbacksIfReady(); return this._pendingCount; }; /** * @return {?} */ Testability.prototype.isStable = function () { return this._isZoneStable && this._pendingCount == 0 && !this._ngZone.hasPendingMacrotasks; }; /** * \@internal * @return {?} */ Testability.prototype._runCallbacksIfReady = function () { var _this = this; if (this.isStable()) { // Schedules the call backs in a new frame so that it is always async. scheduleMicroTask(function () { while (_this._callbacks.length !== 0) { (((_this._callbacks.pop())))(_this._didWork); } _this._didWork = false; }); } else { // Not Ready this._didWork = true; } }; /** * @param {?} callback * @return {?} */ Testability.prototype.whenStable = function (callback) { this._callbacks.push(callback); this._runCallbacksIfReady(); }; /** * @return {?} */ Testability.prototype.getPendingRequestCount = function () { return this._pendingCount; }; /** * @deprecated use findProviders * @param {?} using * @param {?} provider * @param {?} exactMatch * @return {?} */ Testability.prototype.findBindings = function (using, provider, exactMatch) { // TODO(juliemr): implement. return []; }; /** * @param {?} using * @param {?} provider * @param {?} exactMatch * @return {?} */ Testability.prototype.findProviders = function (using, provider, exactMatch) { // TODO(juliemr): implement. return []; }; return Testability; }()); Testability.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ Testability.ctorParameters = function () { return [ { type: NgZone, }, ]; }; /** * A global registry of {\@link Testability} instances for specific elements. * \@experimental */ var TestabilityRegistry = (function () { function TestabilityRegistry() { /** * \@internal */ this._applications = new Map(); _testabilityGetter.addToWindow(this); } /** * @param {?} token * @param {?} testability * @return {?} */ TestabilityRegistry.prototype.registerApplication = function (token, testability) { this._applications.set(token, testability); }; /** * @param {?} elem * @return {?} */ TestabilityRegistry.prototype.getTestability = function (elem) { return this._applications.get(elem) || null; }; /** * @return {?} */ TestabilityRegistry.prototype.getAllTestabilities = function () { return Array.from(this._applications.values()); }; /** * @return {?} */ TestabilityRegistry.prototype.getAllRootElements = function () { return Array.from(this._applications.keys()); }; /** * @param {?} elem * @param {?=} findInAncestors * @return {?} */ TestabilityRegistry.prototype.findTestabilityInTree = function (elem, findInAncestors) { if (findInAncestors === void 0) { findInAncestors = true; } return _testabilityGetter.findTestabilityInTree(this, elem, findInAncestors); }; return TestabilityRegistry; }()); TestabilityRegistry.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ TestabilityRegistry.ctorParameters = function () { return []; }; var _NoopGetTestability = (function () { function _NoopGetTestability() { } /** * @param {?} registry * @return {?} */ _NoopGetTestability.prototype.addToWindow = function (registry) { }; /** * @param {?} registry * @param {?} elem * @param {?} findInAncestors * @return {?} */ _NoopGetTestability.prototype.findTestabilityInTree = function (registry, elem, findInAncestors) { return null; }; return _NoopGetTestability; }()); /** * Set the {\@link GetTestability} implementation used by the Angular testing framework. * \@experimental * @param {?} getter * @return {?} */ function setTestabilityGetter(getter) { _testabilityGetter = getter; } var _testabilityGetter = new _NoopGetTestability(); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var _devMode = true; var _runModeLocked = false; var _platform; var ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken'); /** * Disable Angular's development mode, which turns off assertions and other * checks within the framework. * * One important assertion this disables verifies that a change detection pass * does not result in additional changes to any bindings (also known as * unidirectional data flow). * * \@stable * @return {?} */ function enableProdMode() { if (_runModeLocked) { throw new Error('Cannot enable prod mode after platform setup.'); } _devMode = false; } /** * Returns whether Angular is in development mode. After called once, * the value is locked and won't change any more. * * By default, this is true, unless a user calls `enableProdMode` before calling this. * * \@experimental APIs related to application bootstrap are currently under review. * @return {?} */ function isDevMode() { _runModeLocked = true; return _devMode; } /** * A token for third-party components that can register themselves with NgProbe. * * \@experimental */ var NgProbeToken = (function () { /** * @param {?} name * @param {?} token */ function NgProbeToken(name, token) { this.name = name; this.token = token; } return NgProbeToken; }()); /** * Creates a platform. * Platforms have to be eagerly created via this function. * * \@experimental APIs related to application bootstrap are currently under review. * @param {?} injector * @return {?} */ function createPlatform(injector) { if (_platform && !_platform.destroyed && !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) { throw new Error('There can be only one platform. Destroy the previous one to create a new one.'); } _platform = injector.get(PlatformRef); var /** @type {?} */ inits = injector.get(PLATFORM_INITIALIZER, null); if (inits) inits.forEach(function (init) { return init(); }); return _platform; } /** * Creates a factory for a platform * * \@experimental APIs related to application bootstrap are currently under review. * @param {?} parentPlatformFactory * @param {?} name * @param {?=} providers * @return {?} */ function createPlatformFactory(parentPlatformFactory, name, providers) { if (providers === void 0) { providers = []; } var /** @type {?} */ marker = new InjectionToken("Platform: " + name); return function (extraProviders) { if (extraProviders === void 0) { extraProviders = []; } var /** @type {?} */ platform = getPlatform(); if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) { if (parentPlatformFactory) { parentPlatformFactory(providers.concat(extraProviders).concat({ provide: marker, useValue: true })); } else { createPlatform(ReflectiveInjector.resolveAndCreate(providers.concat(extraProviders).concat({ provide: marker, useValue: true }))); } } return assertPlatform(marker); }; } /** * Checks that there currently is a platform which contains the given token as a provider. * * \@experimental APIs related to application bootstrap are currently under review. * @param {?} requiredToken * @return {?} */ function assertPlatform(requiredToken) { var /** @type {?} */ platform = getPlatform(); if (!platform) { throw new Error('No platform exists!'); } if (!platform.injector.get(requiredToken, null)) { throw new Error('A platform with a different configuration has been created. Please destroy it first.'); } return platform; } /** * Destroy the existing platform. * * \@experimental APIs related to application bootstrap are currently under review. * @return {?} */ function destroyPlatform() { if (_platform && !_platform.destroyed) { _platform.destroy(); } } /** * Returns the current platform. * * \@experimental APIs related to application bootstrap are currently under review. * @return {?} */ function getPlatform() { return _platform && !_platform.destroyed ? _platform : null; } /** * The Angular platform is the entry point for Angular on a web page. Each page * has exactly one platform, and services (such as reflection) which are common * to every Angular application running on the page are bound in its scope. * * A page's platform is initialized implicitly when a platform is created via a platform factory * (e.g. {\@link platformBrowser}), or explicitly by calling the {\@link createPlatform} function. * * \@stable * @abstract */ var PlatformRef = (function () { function PlatformRef() { } /** * Creates an instance of an `\@NgModule` for the given platform * for offline compilation. * * ## Simple Example * * ```typescript * my_module.ts: * * \@NgModule({ * imports: [BrowserModule] * }) * class MyModule {} * * main.ts: * import {MyModuleNgFactory} from './my_module.ngfactory'; * import {platformBrowser} from '\@angular/platform-browser'; * * let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory); * ``` * * \@experimental APIs related to application bootstrap are currently under review. * @abstract * @template M * @param {?} moduleFactory * @return {?} */ PlatformRef.prototype.bootstrapModuleFactory = function (moduleFactory) { }; /** * Creates an instance of an `\@NgModule` for a given platform using the given runtime compiler. * * ## Simple Example * * ```typescript * \@NgModule({ * imports: [BrowserModule] * }) * class MyModule {} * * let moduleRef = platformBrowser().bootstrapModule(MyModule); * ``` * \@stable * @abstract * @template M * @param {?} moduleType * @param {?=} compilerOptions * @return {?} */ PlatformRef.prototype.bootstrapModule = function (moduleType, compilerOptions) { }; /** * Register a listener to be called when the platform is disposed. * @abstract * @param {?} callback * @return {?} */ PlatformRef.prototype.onDestroy = function (callback) { }; /** * Retrieve the platform {\@link Injector}, which is the parent injector for * every Angular application on the page and provides singleton providers. * @abstract * @return {?} */ PlatformRef.prototype.injector = function () { }; /** * Destroy the Angular platform and all Angular applications on the page. * @abstract * @return {?} */ PlatformRef.prototype.destroy = function () { }; /** * @abstract * @return {?} */ PlatformRef.prototype.destroyed = function () { }; return PlatformRef; }()); /** * @param {?} errorHandler * @param {?} callback * @return {?} */ function _callAndReportToErrorHandler(errorHandler, callback) { try { var /** @type {?} */ result = callback(); if (isPromise(result)) { return result.catch(function (e) { errorHandler.handleError(e); // rethrow as the exception handler might not do it throw e; }); } return result; } catch (e) { errorHandler.handleError(e); // rethrow as the exception handler might not do it throw e; } } /** * workaround https://github.com/angular/tsickle/issues/350 * @suppress {checkTypes} */ var PlatformRef_ = (function (_super) { __extends(PlatformRef_, _super); /** * @param {?} _injector */ function PlatformRef_(_injector) { var _this = _super.call(this) || this; _this._injector = _injector; _this._modules = []; _this._destroyListeners = []; _this._destroyed = false; return _this; } /** * @param {?} callback * @return {?} */ PlatformRef_.prototype.onDestroy = function (callback) { this._destroyListeners.push(callback); }; Object.defineProperty(PlatformRef_.prototype, "injector", { /** * @return {?} */ get: function () { return this._injector; }, enumerable: true, configurable: true }); Object.defineProperty(PlatformRef_.prototype, "destroyed", { /** * @return {?} */ get: function () { return this._destroyed; }, enumerable: true, configurable: true }); /** * @return {?} */ PlatformRef_.prototype.destroy = function () { if (this._destroyed) { throw new Error('The platform has already been destroyed!'); } this._modules.slice().forEach(function (module) { return module.destroy(); }); this._destroyListeners.forEach(function (listener) { return listener(); }); this._destroyed = true; }; /** * @template M * @param {?} moduleFactory * @return {?} */ PlatformRef_.prototype.bootstrapModuleFactory = function (moduleFactory) { return this._bootstrapModuleFactoryWithZone(moduleFactory); }; /** * @template M * @param {?} moduleFactory * @param {?=} ngZone * @return {?} */ PlatformRef_.prototype._bootstrapModuleFactoryWithZone = function (moduleFactory, ngZone) { var _this = this; // Note: We need to create the NgZone _before_ we instantiate the module, // as instantiating the module creates some providers eagerly. // So we create a mini parent injector that just contains the new NgZone and // pass that as parent to the NgModuleFactory. if (!ngZone) ngZone = new NgZone({ enableLongStackTrace: isDevMode() }); // Attention: Don't use ApplicationRef.run here, // as we want to be sure that all possible constructor calls are inside `ngZone.run`! return ngZone.run(function () { var /** @type {?} */ ngZoneInjector = ReflectiveInjector.resolveAndCreate([{ provide: NgZone, useValue: ngZone }], _this.injector); var /** @type {?} */ moduleRef = (moduleFactory.create(ngZoneInjector)); var /** @type {?} */ exceptionHandler = moduleRef.injector.get(ErrorHandler, null); if (!exceptionHandler) { throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?'); } moduleRef.onDestroy(function () { return remove(_this._modules, moduleRef); }); /** @type {?} */ ((ngZone)).onError.subscribe({ next: function (error) { exceptionHandler.handleError(error); } }); return _callAndReportToErrorHandler(exceptionHandler, function () { var /** @type {?} */ initStatus = moduleRef.injector.get(ApplicationInitStatus); return initStatus.donePromise.then(function () { _this._moduleDoBootstrap(moduleRef); return moduleRef; }); }); }); }; /** * @template M * @param {?} moduleType * @param {?=} compilerOptions * @return {?} */ PlatformRef_.prototype.bootstrapModule = function (moduleType, compilerOptions) { if (compilerOptions === void 0) { compilerOptions = []; } return this._bootstrapModuleWithZone(moduleType, compilerOptions); }; /** * @template M * @param {?} moduleType * @param {?=} compilerOptions * @param {?=} ngZone * @return {?} */ PlatformRef_.prototype._bootstrapModuleWithZone = function (moduleType, compilerOptions, ngZone) { var _this = this; if (compilerOptions === void 0) { compilerOptions = []; } var /** @type {?} */ compilerFactory = this.injector.get(CompilerFactory); var /** @type {?} */ compiler = compilerFactory.createCompiler(Array.isArray(compilerOptions) ? compilerOptions : [compilerOptions]); return compiler.compileModuleAsync(moduleType) .then(function (moduleFactory) { return _this._bootstrapModuleFactoryWithZone(moduleFactory, ngZone); }); }; /** * @param {?} moduleRef * @return {?} */ PlatformRef_.prototype._moduleDoBootstrap = function (moduleRef) { var /** @type {?} */ appRef = moduleRef.injector.get(ApplicationRef); if (moduleRef.bootstrapFactories.length > 0) { moduleRef.bootstrapFactories.forEach(function (f) { return appRef.bootstrap(f); }); } else if (moduleRef.instance.ngDoBootstrap) { moduleRef.instance.ngDoBootstrap(appRef); } else { throw new Error("The module " + stringify(moduleRef.instance.constructor) + " was bootstrapped, but it does not declare \"@NgModule.bootstrap\" components nor a \"ngDoBootstrap\" method. " + "Please define one of these."); } this._modules.push(moduleRef); }; return PlatformRef_; }(PlatformRef)); PlatformRef_.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ PlatformRef_.ctorParameters = function () { return [ { type: Injector, }, ]; }; /** * A reference to an Angular application running on a page. * * \@stable * @abstract */ var ApplicationRef = (function () { function ApplicationRef() { } /** * Bootstrap a new component at the root level of the application. * * ### Bootstrap process * * When bootstrapping a new root component into an application, Angular mounts the * specified application component onto DOM elements identified by the [componentType]'s * selector and kicks off automatic change detection to finish initializing the component. * * ### Example * {\@example core/ts/platform/platform.ts region='longform'} * @abstract * @template C * @param {?} componentFactory * @return {?} */ ApplicationRef.prototype.bootstrap = function (componentFactory) { }; /** * Invoke this method to explicitly process change detection and its side-effects. * * In development mode, `tick()` also performs a second change detection cycle to ensure that no * further changes are detected. If additional changes are picked up during this second cycle, * bindings in the app have side-effects that cannot be resolved in a single change detection * pass. * In this case, Angular throws an error, since an Angular application can only have one change * detection pass during which all change detection must complete. * @abstract * @return {?} */ ApplicationRef.prototype.tick = function () { }; /** * Get a list of component types registered to this application. * This list is populated even before the component is created. * @abstract * @return {?} */ ApplicationRef.prototype.componentTypes = function () { }; /** * Get a list of components registered to this application. * @abstract * @return {?} */ ApplicationRef.prototype.components = function () { }; /** * Attaches a view so that it will be dirty checked. * The view will be automatically detached when it is destroyed. * This will throw if the view is already attached to a ViewContainer. * @abstract * @param {?} view * @return {?} */ ApplicationRef.prototype.attachView = function (view) { }; /** * Detaches a view from dirty checking again. * @abstract * @param {?} view * @return {?} */ ApplicationRef.prototype.detachView = function (view) { }; /** * Returns the number of attached views. * @abstract * @return {?} */ ApplicationRef.prototype.viewCount = function () { }; /** * Returns an Observable that indicates when the application is stable or unstable. * @abstract * @return {?} */ ApplicationRef.prototype.isStable = function () { }; return ApplicationRef; }()); /** * workaround https://github.com/angular/tsickle/issues/350 * @suppress {checkTypes} */ var ApplicationRef_ = (function (_super) { __extends(ApplicationRef_, _super); /** * @param {?} _zone * @param {?} _console * @param {?} _injector * @param {?} _exceptionHandler * @param {?} _componentFactoryResolver * @param {?} _initStatus */ function ApplicationRef_(_zone, _console, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus) { var _this = _super.call(this) || this; _this._zone = _zone; _this._console = _console; _this._injector = _injector; _this._exceptionHandler = _exceptionHandler; _this._componentFactoryResolver = _componentFactoryResolver; _this._initStatus = _initStatus; _this._bootstrapListeners = []; _this._rootComponents = []; _this._rootComponentTypes = []; _this._views = []; _this._runningTick = false; _this._enforceNoNewChanges = false; _this._stable = true; _this._enforceNoNewChanges = isDevMode(); _this._zone.onMicrotaskEmpty.subscribe({ next: function () { _this._zone.run(function () { _this.tick(); }); } }); var isCurrentlyStable = new __WEBPACK_IMPORTED_MODULE_0_rxjs_Observable__["Observable"](function (observer) { _this._stable = _this._zone.isStable && !_this._zone.hasPendingMacrotasks && !_this._zone.hasPendingMicrotasks; _this._zone.runOutsideAngular(function () { observer.next(_this._stable); observer.complete(); }); }); var isStable = new __WEBPACK_IMPORTED_MODULE_0_rxjs_Observable__["Observable"](function (observer) { var stableSub = _this._zone.onStable.subscribe(function () { NgZone.assertNotInAngularZone(); // Check whether there are no pending macro/micro tasks in the next tick // to allow for NgZone to update the state. scheduleMicroTask(function () { if (!_this._stable && !_this._zone.hasPendingMacrotasks && !_this._zone.hasPendingMicrotasks) { _this._stable = true; observer.next(true); } }); }); var unstableSub = _this._zone.onUnstable.subscribe(function () { NgZone.assertInAngularZone(); if (_this._stable) { _this._stable = false; _this._zone.runOutsideAngular(function () { observer.next(false); }); } }); return function () { stableSub.unsubscribe(); unstableSub.unsubscribe(); }; }); _this._isStable = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_rxjs_observable_merge__["merge"])(isCurrentlyStable, __WEBPACK_IMPORTED_MODULE_2_rxjs_operator_share__["share"].call(isStable)); return _this; } /** * @param {?} viewRef * @return {?} */ ApplicationRef_.prototype.attachView = function (viewRef) { var /** @type {?} */ view = ((viewRef)); this._views.push(view); view.attachToAppRef(this); }; /** * @param {?} viewRef * @return {?} */ ApplicationRef_.prototype.detachView = function (viewRef) { var /** @type {?} */ view = ((viewRef)); remove(this._views, view); view.detachFromAppRef(); }; /** * @template C * @param {?} componentOrFactory * @return {?} */ ApplicationRef_.prototype.bootstrap = function (componentOrFactory) { var _this = this; if (!this._initStatus.done) { throw new Error('Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.'); } var /** @type {?} */ componentFactory; if (componentOrFactory instanceof ComponentFactory) { componentFactory = componentOrFactory; } else { componentFactory = ((this._componentFactoryResolver.resolveComponentFactory(componentOrFactory))); } this._rootComponentTypes.push(componentFactory.componentType); // Create a factory associated with the current module if it's not bound to some other var /** @type {?} */ ngModule = componentFactory instanceof ComponentFactoryBoundToModule ? null : this._injector.get(NgModuleRef); var /** @type {?} */ compRef = componentFactory.create(Injector.NULL, [], componentFactory.selector, ngModule); compRef.onDestroy(function () { _this._unloadComponent(compRef); }); var /** @type {?} */ testability = compRef.injector.get(Testability, null); if (testability) { compRef.injector.get(TestabilityRegistry) .registerApplication(compRef.location.nativeElement, testability); } this._loadComponent(compRef); if (isDevMode()) { this._console.log("Angular is running in the development mode. Call enableProdMode() to enable the production mode."); } return compRef; }; /** * @param {?} componentRef * @return {?} */ ApplicationRef_.prototype._loadComponent = function (componentRef) { this.attachView(componentRef.hostView); this.tick(); this._rootComponents.push(componentRef); // Get the listeners lazily to prevent DI cycles. var /** @type {?} */ listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []).concat(this._bootstrapListeners); listeners.forEach(function (listener) { return listener(componentRef); }); }; /** * @param {?} componentRef * @return {?} */ ApplicationRef_.prototype._unloadComponent = function (componentRef) { this.detachView(componentRef.hostView); remove(this._rootComponents, componentRef); }; /** * @return {?} */ ApplicationRef_.prototype.tick = function () { if (this._runningTick) { throw new Error('ApplicationRef.tick is called recursively'); } var /** @type {?} */ scope = ApplicationRef_._tickScope(); try { this._runningTick = true; this._views.forEach(function (view) { return view.detectChanges(); }); if (this._enforceNoNewChanges) { this._views.forEach(function (view) { return view.checkNoChanges(); }); } } catch (e) { // Attention: Don't rethrow as it could cancel subscriptions to Observables! this._exceptionHandler.handleError(e); } finally { this._runningTick = false; wtfLeave(scope); } }; /** * @return {?} */ ApplicationRef_.prototype.ngOnDestroy = function () { // TODO(alxhub): Dispose of the NgZone. this._views.slice().forEach(function (view) { return view.destroy(); }); }; Object.defineProperty(ApplicationRef_.prototype, "viewCount", { /** * @return {?} */ get: function () { return this._views.length; }, enumerable: true, configurable: true }); Object.defineProperty(ApplicationRef_.prototype, "componentTypes", { /** * @return {?} */ get: function () { return this._rootComponentTypes; }, enumerable: true, configurable: true }); Object.defineProperty(ApplicationRef_.prototype, "components", { /** * @return {?} */ get: function () { return this._rootComponents; }, enumerable: true, configurable: true }); Object.defineProperty(ApplicationRef_.prototype, "isStable", { /** * @return {?} */ get: function () { return this._isStable; }, enumerable: true, configurable: true }); return ApplicationRef_; }(ApplicationRef)); /** * \@internal */ ApplicationRef_._tickScope = wtfCreateScope('ApplicationRef#tick()'); ApplicationRef_.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ ApplicationRef_.ctorParameters = function () { return [ { type: NgZone, }, { type: Console, }, { type: Injector, }, { type: ErrorHandler, }, { type: ComponentFactoryResolver, }, { type: ApplicationInitStatus, }, ]; }; /** * @template T * @param {?} list * @param {?} el * @return {?} */ function remove(list, el) { var /** @type {?} */ index = list.indexOf(el); if (index > -1) { list.splice(index, 1); } } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // Public API for Zone /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @deprecated Use `RendererType2` (and `Renderer2`) instead. */ var RenderComponentType = (function () { /** * @param {?} id * @param {?} templateUrl * @param {?} slotCount * @param {?} encapsulation * @param {?} styles * @param {?} animations */ function RenderComponentType(id, templateUrl, slotCount, encapsulation, styles, animations) { this.id = id; this.templateUrl = templateUrl; this.slotCount = slotCount; this.encapsulation = encapsulation; this.styles = styles; this.animations = animations; } return RenderComponentType; }()); /** * @deprecated Debug info is handeled internally in the view engine now. * @abstract */ var RenderDebugInfo = (function () { function RenderDebugInfo() { } /** * @abstract * @return {?} */ RenderDebugInfo.prototype.injector = function () { }; /** * @abstract * @return {?} */ RenderDebugInfo.prototype.component = function () { }; /** * @abstract * @return {?} */ RenderDebugInfo.prototype.providerTokens = function () { }; /** * @abstract * @return {?} */ RenderDebugInfo.prototype.references = function () { }; /** * @abstract * @return {?} */ RenderDebugInfo.prototype.context = function () { }; /** * @abstract * @return {?} */ RenderDebugInfo.prototype.source = function () { }; return RenderDebugInfo; }()); /** * @deprecated Use the `Renderer2` instead. * @abstract */ var Renderer = (function () { function Renderer() { } /** * @abstract * @param {?} selectorOrNode * @param {?=} debugInfo * @return {?} */ Renderer.prototype.selectRootElement = function (selectorOrNode, debugInfo) { }; /** * @abstract * @param {?} parentElement * @param {?} name * @param {?=} debugInfo * @return {?} */ Renderer.prototype.createElement = function (parentElement, name, debugInfo) { }; /** * @abstract * @param {?} hostElement * @return {?} */ Renderer.prototype.createViewRoot = function (hostElement) { }; /** * @abstract * @param {?} parentElement * @param {?=} debugInfo * @return {?} */ Renderer.prototype.createTemplateAnchor = function (parentElement, debugInfo) { }; /** * @abstract * @param {?} parentElement * @param {?} value * @param {?=} debugInfo * @return {?} */ Renderer.prototype.createText = function (parentElement, value, debugInfo) { }; /** * @abstract * @param {?} parentElement * @param {?} nodes * @return {?} */ Renderer.prototype.projectNodes = function (parentElement, nodes) { }; /** * @abstract * @param {?} node * @param {?} viewRootNodes * @return {?} */ Renderer.prototype.attachViewAfter = function (node, viewRootNodes) { }; /** * @abstract * @param {?} viewRootNodes * @return {?} */ Renderer.prototype.detachView = function (viewRootNodes) { }; /** * @abstract * @param {?} hostElement * @param {?} viewAllNodes * @return {?} */ Renderer.prototype.destroyView = function (hostElement, viewAllNodes) { }; /** * @abstract * @param {?} renderElement * @param {?} name * @param {?} callback * @return {?} */ Renderer.prototype.listen = function (renderElement, name, callback) { }; /** * @abstract * @param {?} target * @param {?} name * @param {?} callback * @return {?} */ Renderer.prototype.listenGlobal = function (target, name, callback) { }; /** * @abstract * @param {?} renderElement * @param {?} propertyName * @param {?} propertyValue * @return {?} */ Renderer.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) { }; /** * @abstract * @param {?} renderElement * @param {?} attributeName * @param {?} attributeValue * @return {?} */ Renderer.prototype.setElementAttribute = function (renderElement, attributeName, attributeValue) { }; /** * Used only in debug mode to serialize property changes to dom nodes as attributes. * @abstract * @param {?} renderElement * @param {?} propertyName * @param {?} propertyValue * @return {?} */ Renderer.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) { }; /** * @abstract * @param {?} renderElement * @param {?} className * @param {?} isAdd * @return {?} */ Renderer.prototype.setElementClass = function (renderElement, className, isAdd) { }; /** * @abstract * @param {?} renderElement * @param {?} styleName * @param {?} styleValue * @return {?} */ Renderer.prototype.setElementStyle = function (renderElement, styleName, styleValue) { }; /** * @abstract * @param {?} renderElement * @param {?} methodName * @param {?=} args * @return {?} */ Renderer.prototype.invokeElementMethod = function (renderElement, methodName, args) { }; /** * @abstract * @param {?} renderNode * @param {?} text * @return {?} */ Renderer.prototype.setText = function (renderNode, text) { }; /** * @abstract * @param {?} element * @param {?} startingStyles * @param {?} keyframes * @param {?} duration * @param {?} delay * @param {?} easing * @param {?=} previousPlayers * @return {?} */ Renderer.prototype.animate = function (element, startingStyles, keyframes, duration, delay, easing, previousPlayers) { }; return Renderer; }()); var Renderer2Interceptor = new InjectionToken('Renderer2Interceptor'); /** * Injectable service that provides a low-level interface for modifying the UI. * * Use this service to bypass Angular's templating and make custom UI changes that can't be * expressed declaratively. For example if you need to set a property or an attribute whose name is * not statically known, use {\@link #setElementProperty} or {\@link #setElementAttribute} * respectively. * * If you are implementing a custom renderer, you must implement this interface. * * The default Renderer implementation is `DomRenderer`. Also available is `WebWorkerRenderer`. * * @deprecated Use `RendererFactory2` instead. * @abstract */ var RootRenderer = (function () { function RootRenderer() { } /** * @abstract * @param {?} componentType * @return {?} */ RootRenderer.prototype.renderComponent = function (componentType) { }; return RootRenderer; }()); /** * \@experimental * @abstract */ var RendererFactory2 = (function () { function RendererFactory2() { } /** * @abstract * @param {?} hostElement * @param {?} type * @return {?} */ RendererFactory2.prototype.createRenderer = function (hostElement, type) { }; return RendererFactory2; }()); var RendererStyleFlags2 = {}; RendererStyleFlags2.Important = 1; RendererStyleFlags2.DashCase = 2; RendererStyleFlags2[RendererStyleFlags2.Important] = "Important"; RendererStyleFlags2[RendererStyleFlags2.DashCase] = "DashCase"; /** * \@experimental * @abstract */ var Renderer2 = (function () { function Renderer2() { } /** * This field can be used to store arbitrary data on this renderer instance. * This is useful for renderers that delegate to other renderers. * @abstract * @return {?} */ Renderer2.prototype.data = function () { }; /** * @abstract * @return {?} */ Renderer2.prototype.destroy = function () { }; /** * @abstract * @param {?} name * @param {?=} namespace * @return {?} */ Renderer2.prototype.createElement = function (name, namespace) { }; /** * @abstract * @param {?} value * @return {?} */ Renderer2.prototype.createComment = function (value) { }; /** * @abstract * @param {?} value * @return {?} */ Renderer2.prototype.createText = function (value) { }; /** * @abstract * @param {?} parent * @param {?} newChild * @return {?} */ Renderer2.prototype.appendChild = function (parent, newChild) { }; /** * @abstract * @param {?} parent * @param {?} newChild * @param {?} refChild * @return {?} */ Renderer2.prototype.insertBefore = function (parent, newChild, refChild) { }; /** * @abstract * @param {?} parent * @param {?} oldChild * @return {?} */ Renderer2.prototype.removeChild = function (parent, oldChild) { }; /** * @abstract * @param {?} selectorOrNode * @return {?} */ Renderer2.prototype.selectRootElement = function (selectorOrNode) { }; /** * Attention: On WebWorkers, this will always return a value, * as we are asking for a result synchronously. I.e. * the caller can't rely on checking whether this is null or not. * @abstract * @param {?} node * @return {?} */ Renderer2.prototype.parentNode = function (node) { }; /** * Attention: On WebWorkers, this will always return a value, * as we are asking for a result synchronously. I.e. * the caller can't rely on checking whether this is null or not. * @abstract * @param {?} node * @return {?} */ Renderer2.prototype.nextSibling = function (node) { }; /** * @abstract * @param {?} el * @param {?} name * @param {?} value * @param {?=} namespace * @return {?} */ Renderer2.prototype.setAttribute = function (el, name, value, namespace) { }; /** * @abstract * @param {?} el * @param {?} name * @param {?=} namespace * @return {?} */ Renderer2.prototype.removeAttribute = function (el, name, namespace) { }; /** * @abstract * @param {?} el * @param {?} name * @return {?} */ Renderer2.prototype.addClass = function (el, name) { }; /** * @abstract * @param {?} el * @param {?} name * @return {?} */ Renderer2.prototype.removeClass = function (el, name) { }; /** * @abstract * @param {?} el * @param {?} style * @param {?} value * @param {?=} flags * @return {?} */ Renderer2.prototype.setStyle = function (el, style, value, flags) { }; /** * @abstract * @param {?} el * @param {?} style * @param {?=} flags * @return {?} */ Renderer2.prototype.removeStyle = function (el, style, flags) { }; /** * @abstract * @param {?} el * @param {?} name * @param {?} value * @return {?} */ Renderer2.prototype.setProperty = function (el, name, value) { }; /** * @abstract * @param {?} node * @param {?} value * @return {?} */ Renderer2.prototype.setValue = function (node, value) { }; /** * @abstract * @param {?} target * @param {?} eventName * @param {?} callback * @return {?} */ Renderer2.prototype.listen = function (target, eventName, callback) { }; return Renderer2; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // Public API for render var ElementRef = (function () { /** * @param {?} nativeElement */ function ElementRef(nativeElement) { this.nativeElement = nativeElement; } return ElementRef; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Used to load ng module factories. * \@stable * @abstract */ var NgModuleFactoryLoader = (function () { function NgModuleFactoryLoader() { } /** * @abstract * @param {?} path * @return {?} */ NgModuleFactoryLoader.prototype.load = function (path) { }; return NgModuleFactoryLoader; }()); var moduleFactories = new Map(); /** * Registers a loaded module. Should only be called from generated NgModuleFactory code. * \@experimental * @param {?} id * @param {?} factory * @return {?} */ function registerModuleFactory(id, factory) { var /** @type {?} */ existing = moduleFactories.get(id); if (existing) { throw new Error("Duplicate module registered for " + id + " - " + existing.moduleType.name + " vs " + factory.moduleType.name); } moduleFactories.set(id, factory); } /** * @return {?} */ /** * Returns the NgModuleFactory with the given id, if it exists and has been loaded. * Factories for modules that do not specify an `id` cannot be retrieved. Throws if the module * cannot be found. * \@experimental * @param {?} id * @return {?} */ function getModuleFactory(id) { var /** @type {?} */ factory = moduleFactories.get(id); if (!factory) throw new Error("No module with ID " + id + " loaded"); return factory; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * An unmodifiable list of items that Angular keeps up to date when the state * of the application changes. * * The type of object that {\@link ViewChildren}, {\@link ContentChildren}, and {\@link QueryList} * provide. * * Implements an iterable interface, therefore it can be used in both ES6 * javascript `for (var i of items)` loops as well as in Angular templates with * `*ngFor="let i of myList"`. * * Changes can be observed by subscribing to the changes `Observable`. * * NOTE: In the future this class will implement an `Observable` interface. * * ### Example ([live demo](http://plnkr.co/edit/RX8sJnQYl9FWuSCWme5z?p=preview)) * ```typescript * \@Component({...}) * class Container { * \@ViewChildren(Item) items:QueryList; * } * ``` * \@stable */ var QueryList = (function () { function QueryList() { this._dirty = true; this._results = []; this._emitter = new EventEmitter(); } Object.defineProperty(QueryList.prototype, "changes", { /** * @return {?} */ get: function () { return this._emitter; }, enumerable: true, configurable: true }); Object.defineProperty(QueryList.prototype, "length", { /** * @return {?} */ get: function () { return this._results.length; }, enumerable: true, configurable: true }); Object.defineProperty(QueryList.prototype, "first", { /** * @return {?} */ get: function () { return this._results[0]; }, enumerable: true, configurable: true }); Object.defineProperty(QueryList.prototype, "last", { /** * @return {?} */ get: function () { return this._results[this.length - 1]; }, enumerable: true, configurable: true }); /** * See * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) * @template U * @param {?} fn * @return {?} */ QueryList.prototype.map = function (fn) { return this._results.map(fn); }; /** * See * [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) * @param {?} fn * @return {?} */ QueryList.prototype.filter = function (fn) { return this._results.filter(fn); }; /** * See * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) * @param {?} fn * @return {?} */ QueryList.prototype.find = function (fn) { return this._results.find(fn); }; /** * See * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) * @template U * @param {?} fn * @param {?} init * @return {?} */ QueryList.prototype.reduce = function (fn, init) { return this._results.reduce(fn, init); }; /** * See * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) * @param {?} fn * @return {?} */ QueryList.prototype.forEach = function (fn) { this._results.forEach(fn); }; /** * See * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) * @param {?} fn * @return {?} */ QueryList.prototype.some = function (fn) { return this._results.some(fn); }; /** * @return {?} */ QueryList.prototype.toArray = function () { return this._results.slice(); }; /** * @return {?} */ QueryList.prototype[getSymbolIterator()] = function () { return ((this._results))[getSymbolIterator()](); }; /** * @return {?} */ QueryList.prototype.toString = function () { return this._results.toString(); }; /** * @param {?} res * @return {?} */ QueryList.prototype.reset = function (res) { this._results = flatten(res); this._dirty = false; }; /** * @return {?} */ QueryList.prototype.notifyOnChanges = function () { this._emitter.emit(this); }; /** * internal * @return {?} */ QueryList.prototype.setDirty = function () { this._dirty = true; }; Object.defineProperty(QueryList.prototype, "dirty", { /** * internal * @return {?} */ get: function () { return this._dirty; }, enumerable: true, configurable: true }); return QueryList; }()); /** * @template T * @param {?} list * @return {?} */ function flatten(list) { return list.reduce(function (flat, item) { var /** @type {?} */ flatItem = Array.isArray(item) ? flatten(item) : item; return ((flat)).concat(flatItem); }, []); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var _SEPARATOR = '#'; var FACTORY_CLASS_SUFFIX = 'NgFactory'; /** * Configuration for SystemJsNgModuleLoader. * token. * * \@experimental * @abstract */ var SystemJsNgModuleLoaderConfig = (function () { function SystemJsNgModuleLoaderConfig() { } return SystemJsNgModuleLoaderConfig; }()); var DEFAULT_CONFIG = { factoryPathPrefix: '', factoryPathSuffix: '.ngfactory', }; /** * NgModuleFactoryLoader that uses SystemJS to load NgModuleFactory * \@experimental */ var SystemJsNgModuleLoader = (function () { /** * @param {?} _compiler * @param {?=} config */ function SystemJsNgModuleLoader(_compiler, config) { this._compiler = _compiler; this._config = config || DEFAULT_CONFIG; } /** * @param {?} path * @return {?} */ SystemJsNgModuleLoader.prototype.load = function (path) { var /** @type {?} */ offlineMode = this._compiler instanceof Compiler; return offlineMode ? this.loadFactory(path) : this.loadAndCompile(path); }; /** * @param {?} path * @return {?} */ SystemJsNgModuleLoader.prototype.loadAndCompile = function (path) { var _this = this; var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1]; if (exportName === undefined) { exportName = 'default'; } return __webpack_require__(120)(module) .then(function (module) { return module[exportName]; }) .then(function (type) { return checkNotEmpty(type, module, exportName); }) .then(function (type) { return _this._compiler.compileModuleAsync(type); }); }; /** * @param {?} path * @return {?} */ SystemJsNgModuleLoader.prototype.loadFactory = function (path) { var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1]; var /** @type {?} */ factoryClassSuffix = FACTORY_CLASS_SUFFIX; if (exportName === undefined) { exportName = 'default'; factoryClassSuffix = ''; } return __webpack_require__(120)(this._config.factoryPathPrefix + module + this._config.factoryPathSuffix) .then(function (module) { return module[exportName + factoryClassSuffix]; }) .then(function (factory) { return checkNotEmpty(factory, module, exportName); }); }; return SystemJsNgModuleLoader; }()); SystemJsNgModuleLoader.decorators = [ { type: Injectable }, ]; /** * @nocollapse */ SystemJsNgModuleLoader.ctorParameters = function () { return [ { type: Compiler, }, { type: SystemJsNgModuleLoaderConfig, decorators: [{ type: Optional },] }, ]; }; /** * @param {?} value * @param {?} modulePath * @param {?} exportName * @return {?} */ function checkNotEmpty(value, modulePath, exportName) { if (!value) { throw new Error("Cannot find '" + exportName + "' in '" + modulePath + "'"); } return value; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Represents an Embedded Template that can be used to instantiate Embedded Views. * * You can access a `TemplateRef`, in two ways. Via a directive placed on a `` element * (or directive prefixed with `*`) and have the `TemplateRef` for this Embedded View injected into * the constructor of the directive using the `TemplateRef` Token. Alternatively you can query for * the `TemplateRef` from a Component or a Directive via {\@link Query}. * * To instantiate Embedded Views based on a Template, use * {\@link ViewContainerRef#createEmbeddedView}, which will create the View and attach it to the * View Container. * \@stable * @abstract */ var TemplateRef = (function () { function TemplateRef() { } /** * @abstract * @return {?} */ TemplateRef.prototype.elementRef = function () { }; /** * @abstract * @param {?} context * @return {?} */ TemplateRef.prototype.createEmbeddedView = function (context) { }; return TemplateRef; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Represents a container where one or more Views can be attached. * * The container can contain two kinds of Views. Host Views, created by instantiating a * {\@link Component} via {\@link #createComponent}, and Embedded Views, created by instantiating an * {\@link TemplateRef Embedded Template} via {\@link #createEmbeddedView}. * * The location of the View Container within the containing View is specified by the Anchor * `element`. Each View Container can have only one Anchor Element and each Anchor Element can only * have a single View Container. * * Root elements of Views attached to this container become siblings of the Anchor Element in * the Rendered View. * * To access a `ViewContainerRef` of an Element, you can either place a {\@link Directive} injected * with `ViewContainerRef` on the Element, or you obtain it via a {\@link ViewChild} query. * \@stable * @abstract */ var ViewContainerRef = (function () { function ViewContainerRef() { } /** * Anchor element that specifies the location of this container in the containing View. * * @abstract * @return {?} */ ViewContainerRef.prototype.element = function () { }; /** * @abstract * @return {?} */ ViewContainerRef.prototype.injector = function () { }; /** * @abstract * @return {?} */ ViewContainerRef.prototype.parentInjector = function () { }; /** * Destroys all Views in this container. * @abstract * @return {?} */ ViewContainerRef.prototype.clear = function () { }; /** * Returns the {\@link ViewRef} for the View located in this container at the specified index. * @abstract * @param {?} index * @return {?} */ ViewContainerRef.prototype.get = function (index) { }; /** * Returns the number of Views currently attached to this container. * @abstract * @return {?} */ ViewContainerRef.prototype.length = function () { }; /** * Instantiates an Embedded View based on the {\@link TemplateRef `templateRef`} and inserts it * into this container at the specified `index`. * * If `index` is not specified, the new View will be inserted as the last View in the container. * * Returns the {\@link ViewRef} for the newly created View. * @abstract * @template C * @param {?} templateRef * @param {?=} context * @param {?=} index * @return {?} */ ViewContainerRef.prototype.createEmbeddedView = function (templateRef, context, index) { }; /** * Instantiates a single {\@link Component} and inserts its Host View into this container at the * specified `index`. * * The component is instantiated using its {\@link ComponentFactory} which can be * obtained via {\@link ComponentFactoryResolver#resolveComponentFactory}. * * If `index` is not specified, the new View will be inserted as the last View in the container. * * You can optionally specify the {\@link Injector} that will be used as parent for the Component. * * Returns the {\@link ComponentRef} of the Host View created for the newly instantiated Component. * @abstract * @template C * @param {?} componentFactory * @param {?=} index * @param {?=} injector * @param {?=} projectableNodes * @param {?=} ngModule * @return {?} */ ViewContainerRef.prototype.createComponent = function (componentFactory, index, injector, projectableNodes, ngModule) { }; /** * Inserts a View identified by a {\@link ViewRef} into the container at the specified `index`. * * If `index` is not specified, the new View will be inserted as the last View in the container. * * Returns the inserted {\@link ViewRef}. * @abstract * @param {?} viewRef * @param {?=} index * @return {?} */ ViewContainerRef.prototype.insert = function (viewRef, index) { }; /** * Moves a View identified by a {\@link ViewRef} into the container at the specified `index`. * * Returns the inserted {\@link ViewRef}. * @abstract * @param {?} viewRef * @param {?} currentIndex * @return {?} */ ViewContainerRef.prototype.move = function (viewRef, currentIndex) { }; /** * Returns the index of the View, specified via {\@link ViewRef}, within the current container or * `-1` if this container doesn't contain the View. * @abstract * @param {?} viewRef * @return {?} */ ViewContainerRef.prototype.indexOf = function (viewRef) { }; /** * Destroys a View attached to this container at the specified `index`. * * If `index` is not specified, the last View in the container will be removed. * @abstract * @param {?=} index * @return {?} */ ViewContainerRef.prototype.remove = function (index) { }; /** * Use along with {\@link #insert} to move a View within the current container. * * If the `index` param is omitted, the last {\@link ViewRef} is detached. * @abstract * @param {?=} index * @return {?} */ ViewContainerRef.prototype.detach = function (index) { }; return ViewContainerRef; }()); /** * \@stable * @abstract */ var ChangeDetectorRef = (function () { function ChangeDetectorRef() { } /** * Marks all {\@link ChangeDetectionStrategy#OnPush} ancestors as to be checked. * * * * ### Example ([live demo](http://plnkr.co/edit/GC512b?p=preview)) * * ```typescript * \@Component({ * selector: 'cmp', * changeDetection: ChangeDetectionStrategy.OnPush, * template: `Number of ticks: {{numberOfTicks}}` * }) * class Cmp { * numberOfTicks = 0; * * constructor(ref: ChangeDetectorRef) { * setInterval(() => { * this.numberOfTicks ++ * // the following is required, otherwise the view will not be updated * this.ref.markForCheck(); * }, 1000); * } * } * * \@Component({ * selector: 'app', * changeDetection: ChangeDetectionStrategy.OnPush, * template: ` * * `, * }) * class App { * } * ``` * @abstract * @return {?} */ ChangeDetectorRef.prototype.markForCheck = function () { }; /** * Detaches the change detector from the change detector tree. * * The detached change detector will not be checked until it is reattached. * * This can also be used in combination with {\@link ChangeDetectorRef#detectChanges} to implement * local change * detection checks. * * * * * ### Example * * The following example defines a component with a large list of readonly data. * Imagine the data changes constantly, many times per second. For performance reasons, * we want to check and update the list every five seconds. We can do that by detaching * the component's change detector and doing a local check every five seconds. * * ```typescript * class DataProvider { * // in a real application the returned data will be different every time * get data() { * return [1,2,3,4,5]; * } * } * * \@Component({ * selector: 'giant-list', * template: ` *
  • Data {{d}} * `, * }) * class GiantList { * constructor(private ref: ChangeDetectorRef, private dataProvider:DataProvider) { * ref.detach(); * setInterval(() => { * this.ref.detectChanges(); * }, 5000); * } * } * * \@Component({ * selector: 'app', * providers: [DataProvider], * template: ` * * `, * }) * class App { * } * ``` * @abstract * @return {?} */ ChangeDetectorRef.prototype.detach = function () { }; /** * Checks the change detector and its children. * * This can also be used in combination with {\@link ChangeDetectorRef#detach} to implement local * change detection * checks. * * * * * ### Example * * The following example defines a component with a large list of readonly data. * Imagine, the data changes constantly, many times per second. For performance reasons, * we want to check and update the list every five seconds. * * We can do that by detaching the component's change detector and doing a local change detection * check * every five seconds. * * See {\@link ChangeDetectorRef#detach} for more information. * @abstract * @return {?} */ ChangeDetectorRef.prototype.detectChanges = function () { }; /** * Checks the change detector and its children, and throws if any changes are detected. * * This is used in development mode to verify that running change detection doesn't introduce * other changes. * @abstract * @return {?} */ ChangeDetectorRef.prototype.checkNoChanges = function () { }; /** * Reattach the change detector to the change detector tree. * * This also marks OnPush ancestors as to be checked. This reattached change detector will be * checked during the next change detection run. * * * * ### Example ([live demo](http://plnkr.co/edit/aUhZha?p=preview)) * * The following example creates a component displaying `live` data. The component will detach * its change detector from the main change detector tree when the component's live property * is set to false. * * ```typescript * class DataProvider { * data = 1; * * constructor() { * setInterval(() => { * this.data = this.data * 2; * }, 500); * } * } * * \@Component({ * selector: 'live-data', * inputs: ['live'], * template: 'Data: {{dataProvider.data}}' * }) * class LiveData { * constructor(private ref: ChangeDetectorRef, private dataProvider:DataProvider) {} * * set live(value) { * if (value) * this.ref.reattach(); * else * this.ref.detach(); * } * } * * \@Component({ * selector: 'app', * providers: [DataProvider], * template: ` * Live Update: * * `, * }) * class App { * live = true; * } * ``` * @abstract * @return {?} */ ChangeDetectorRef.prototype.reattach = function () { }; return ChangeDetectorRef; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@stable * @abstract */ var ViewRef = (function (_super) { __extends(ViewRef, _super); function ViewRef() { return _super !== null && _super.apply(this, arguments) || this; } /** * Destroys the view and all of the data structures associated with it. * @abstract * @return {?} */ ViewRef.prototype.destroy = function () { }; /** * @abstract * @return {?} */ ViewRef.prototype.destroyed = function () { }; /** * @abstract * @param {?} callback * @return {?} */ ViewRef.prototype.onDestroy = function (callback) { }; return ViewRef; }(ChangeDetectorRef)); /** * Represents an Angular View. * * * A View is a fundamental building block of the application UI. It is the smallest grouping of * Elements which are created and destroyed together. * * Properties of elements in a View can change, but the structure (number and order) of elements in * a View cannot. Changing the structure of Elements can only be done by inserting, moving or * removing nested Views via a {\@link ViewContainerRef}. Each View can contain many View Containers. * * * ### Example * * Given this template... * * ``` * Count: {{items.length}} *
      *
    • {{item}}
    • *
    * ``` * * We have two {\@link TemplateRef}s: * * Outer {\@link TemplateRef}: * ``` * Count: {{items.length}} *
      * *
    * ``` * * Inner {\@link TemplateRef}: * ``` *
  • {{item}}
  • * ``` * * Notice that the original template is broken down into two separate {\@link TemplateRef}s. * * The outer/inner {\@link TemplateRef}s are then assembled into views like so: * * ``` * * Count: 2 *
      * *
    • first
    • *
    • second
    • *
    * * ``` * \@experimental * @abstract */ var EmbeddedViewRef = (function (_super) { __extends(EmbeddedViewRef, _super); function EmbeddedViewRef() { return _super !== null && _super.apply(this, arguments) || this; } /** * @abstract * @return {?} */ EmbeddedViewRef.prototype.context = function () { }; /** * @abstract * @return {?} */ EmbeddedViewRef.prototype.rootNodes = function () { }; return EmbeddedViewRef; }(ViewRef)); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // Public API for compiler /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var EventListener = (function () { /** * @param {?} name * @param {?} callback */ function EventListener(name, callback) { this.name = name; this.callback = callback; } ; return EventListener; }()); /** * \@experimental All debugging apis are currently experimental. */ var DebugNode = (function () { /** * @param {?} nativeNode * @param {?} parent * @param {?} _debugContext */ function DebugNode(nativeNode, parent, _debugContext) { this._debugContext = _debugContext; this.nativeNode = nativeNode; if (parent && parent instanceof DebugElement) { parent.addChild(this); } else { this.parent = null; } this.listeners = []; } Object.defineProperty(DebugNode.prototype, "injector", { /** * @return {?} */ get: function () { return this._debugContext.injector; }, enumerable: true, configurable: true }); Object.defineProperty(DebugNode.prototype, "componentInstance", { /** * @return {?} */ get: function () { return this._debugContext.component; }, enumerable: true, configurable: true }); Object.defineProperty(DebugNode.prototype, "context", { /** * @return {?} */ get: function () { return this._debugContext.context; }, enumerable: true, configurable: true }); Object.defineProperty(DebugNode.prototype, "references", { /** * @return {?} */ get: function () { return this._debugContext.references; }, enumerable: true, configurable: true }); Object.defineProperty(DebugNode.prototype, "providerTokens", { /** * @return {?} */ get: function () { return this._debugContext.providerTokens; }, enumerable: true, configurable: true }); Object.defineProperty(DebugNode.prototype, "source", { /** * @deprecated since v4 * @return {?} */ get: function () { return 'Deprecated since v4'; }, enumerable: true, configurable: true }); return DebugNode; }()); /** * \@experimental All debugging apis are currently experimental. */ var DebugElement = (function (_super) { __extends(DebugElement, _super); /** * @param {?} nativeNode * @param {?} parent * @param {?} _debugContext */ function DebugElement(nativeNode, parent, _debugContext) { var _this = _super.call(this, nativeNode, parent, _debugContext) || this; _this.properties = {}; _this.attributes = {}; _this.classes = {}; _this.styles = {}; _this.childNodes = []; _this.nativeElement = nativeNode; return _this; } /** * @param {?} child * @return {?} */ DebugElement.prototype.addChild = function (child) { if (child) { this.childNodes.push(child); child.parent = this; } }; /** * @param {?} child * @return {?} */ DebugElement.prototype.removeChild = function (child) { var /** @type {?} */ childIndex = this.childNodes.indexOf(child); if (childIndex !== -1) { child.parent = null; this.childNodes.splice(childIndex, 1); } }; /** * @param {?} child * @param {?} newChildren * @return {?} */ DebugElement.prototype.insertChildrenAfter = function (child, newChildren) { var _this = this; var /** @type {?} */ siblingIndex = this.childNodes.indexOf(child); if (siblingIndex !== -1) { (_a = this.childNodes).splice.apply(_a, [siblingIndex + 1, 0].concat(newChildren)); newChildren.forEach(function (c) { if (c.parent) { c.parent.removeChild(c); } c.parent = _this; }); } var _a; }; /** * @param {?} refChild * @param {?} newChild * @return {?} */ DebugElement.prototype.insertBefore = function (refChild, newChild) { var /** @type {?} */ refIndex = this.childNodes.indexOf(refChild); if (refIndex === -1) { this.addChild(newChild); } else { if (newChild.parent) { newChild.parent.removeChild(newChild); } newChild.parent = this; this.childNodes.splice(refIndex, 0, newChild); } }; /** * @param {?} predicate * @return {?} */ DebugElement.prototype.query = function (predicate) { var /** @type {?} */ results = this.queryAll(predicate); return results[0] || null; }; /** * @param {?} predicate * @return {?} */ DebugElement.prototype.queryAll = function (predicate) { var /** @type {?} */ matches = []; _queryElementChildren(this, predicate, matches); return matches; }; /** * @param {?} predicate * @return {?} */ DebugElement.prototype.queryAllNodes = function (predicate) { var /** @type {?} */ matches = []; _queryNodeChildren(this, predicate, matches); return matches; }; Object.defineProperty(DebugElement.prototype, "children", { /** * @return {?} */ get: function () { return (this.childNodes.filter(function (node) { return node instanceof DebugElement; })); }, enumerable: true, configurable: true }); /** * @param {?} eventName * @param {?} eventObj * @return {?} */ DebugElement.prototype.triggerEventHandler = function (eventName, eventObj) { this.listeners.forEach(function (listener) { if (listener.name == eventName) { listener.callback(eventObj); } }); }; return DebugElement; }(DebugNode)); /** * \@experimental * @param {?} debugEls * @return {?} */ function asNativeElements(debugEls) { return debugEls.map(function (el) { return el.nativeElement; }); } /** * @param {?} element * @param {?} predicate * @param {?} matches * @return {?} */ function _queryElementChildren(element, predicate, matches) { element.childNodes.forEach(function (node) { if (node instanceof DebugElement) { if (predicate(node)) { matches.push(node); } _queryElementChildren(node, predicate, matches); } }); } /** * @param {?} parentNode * @param {?} predicate * @param {?} matches * @return {?} */ function _queryNodeChildren(parentNode, predicate, matches) { if (parentNode instanceof DebugElement) { parentNode.childNodes.forEach(function (node) { if (predicate(node)) { matches.push(node); } if (node instanceof DebugElement) { _queryNodeChildren(node, predicate, matches); } }); } } // Need to keep the nodes in a global Map so that multiple angular apps are supported. var _nativeNodeToDebugNode = new Map(); /** * \@experimental * @param {?} nativeNode * @return {?} */ function getDebugNode(nativeNode) { return _nativeNodeToDebugNode.get(nativeNode) || null; } /** * @return {?} */ /** * @param {?} node * @return {?} */ function indexDebugNode(node) { _nativeNodeToDebugNode.set(node.nativeNode, node); } /** * @param {?} node * @return {?} */ function removeDebugNodeFromIndex(node) { _nativeNodeToDebugNode.delete(node.nativeNode); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} a * @param {?} b * @return {?} */ function devModeEqual(a, b) { var /** @type {?} */ isListLikeIterableA = isListLikeIterable(a); var /** @type {?} */ isListLikeIterableB = isListLikeIterable(b); if (isListLikeIterableA && isListLikeIterableB) { return areIterablesEqual(a, b, devModeEqual); } else { var /** @type {?} */ isAObject = a && (typeof a === 'object' || typeof a === 'function'); var /** @type {?} */ isBObject = b && (typeof b === 'object' || typeof b === 'function'); if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) { return true; } else { return looseIdentical(a, b); } } } /** * Indicates that the result of a {\@link Pipe} transformation has changed even though the * reference * has not changed. * * The wrapped value will be unwrapped by change detection, and the unwrapped value will be stored. * * Example: * * ``` * if (this._latestValue === this._latestReturnedValue) { * return this._latestReturnedValue; * } else { * this._latestReturnedValue = this._latestValue; * return WrappedValue.wrap(this._latestValue); // this will force update * } * ``` * \@stable */ var WrappedValue = (function () { /** * @param {?} wrapped */ function WrappedValue(wrapped) { this.wrapped = wrapped; } /** * @param {?} value * @return {?} */ WrappedValue.wrap = function (value) { return new WrappedValue(value); }; return WrappedValue; }()); /** * Helper class for unwrapping WrappedValue s */ var ValueUnwrapper = (function () { function ValueUnwrapper() { this.hasWrappedValue = false; } /** * @param {?} value * @return {?} */ ValueUnwrapper.prototype.unwrap = function (value) { if (value instanceof WrappedValue) { this.hasWrappedValue = true; return value.wrapped; } return value; }; /** * @return {?} */ ValueUnwrapper.prototype.reset = function () { this.hasWrappedValue = false; }; return ValueUnwrapper; }()); /** * Represents a basic change from a previous to a new value. * \@stable */ var SimpleChange = (function () { /** * @param {?} previousValue * @param {?} currentValue * @param {?} firstChange */ function SimpleChange(previousValue, currentValue, firstChange) { this.previousValue = previousValue; this.currentValue = currentValue; this.firstChange = firstChange; } /** * Check whether the new value is the first value assigned. * @return {?} */ SimpleChange.prototype.isFirstChange = function () { return this.firstChange; }; return SimpleChange; }()); /** * @param {?} obj * @return {?} */ function isListLikeIterable(obj) { if (!isJsObject(obj)) return false; return Array.isArray(obj) || (!(obj instanceof Map) && getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop } /** * @param {?} a * @param {?} b * @param {?} comparator * @return {?} */ function areIterablesEqual(a, b, comparator) { var /** @type {?} */ iterator1 = a[getSymbolIterator()](); var /** @type {?} */ iterator2 = b[getSymbolIterator()](); while (true) { var /** @type {?} */ item1 = iterator1.next(); var /** @type {?} */ item2 = iterator2.next(); if (item1.done && item2.done) return true; if (item1.done || item2.done) return false; if (!comparator(item1.value, item2.value)) return false; } } /** * @param {?} obj * @param {?} fn * @return {?} */ function iterateListLike(obj, fn) { if (Array.isArray(obj)) { for (var /** @type {?} */ i = 0; i < obj.length; i++) { fn(obj[i]); } } else { var /** @type {?} */ iterator = obj[getSymbolIterator()](); var /** @type {?} */ item = void 0; while (!((item = iterator.next()).done)) { fn(item.value); } } } /** * @param {?} o * @return {?} */ function isJsObject(o) { return o !== null && (typeof o === 'function' || typeof o === 'object'); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var DefaultIterableDifferFactory = (function () { function DefaultIterableDifferFactory() { } /** * @param {?} obj * @return {?} */ DefaultIterableDifferFactory.prototype.supports = function (obj) { return isListLikeIterable(obj); }; /** * @deprecated v4.0.0 - ChangeDetectorRef is not used and is no longer a parameter * @template V * @param {?=} cdRefOrTrackBy * @param {?=} trackByFn * @return {?} */ DefaultIterableDifferFactory.prototype.create = function (cdRefOrTrackBy, trackByFn) { return new DefaultIterableDiffer(trackByFn || (cdRefOrTrackBy)); }; return DefaultIterableDifferFactory; }()); var trackByIdentity = function (index, item) { return item; }; /** * @deprecated v4.0.0 - Should not be part of public API. */ var DefaultIterableDiffer = (function () { /** * @param {?=} trackByFn */ function DefaultIterableDiffer(trackByFn) { this._length = 0; this._collection = null; this._linkedRecords = null; this._unlinkedRecords = null; this._previousItHead = null; this._itHead = null; this._itTail = null; this._additionsHead = null; this._additionsTail = null; this._movesHead = null; this._movesTail = null; this._removalsHead = null; this._removalsTail = null; this._identityChangesHead = null; this._identityChangesTail = null; this._trackByFn = trackByFn || trackByIdentity; } Object.defineProperty(DefaultIterableDiffer.prototype, "collection", { /** * @return {?} */ get: function () { return this._collection; }, enumerable: true, configurable: true }); Object.defineProperty(DefaultIterableDiffer.prototype, "length", { /** * @return {?} */ get: function () { return this._length; }, enumerable: true, configurable: true }); /** * @param {?} fn * @return {?} */ DefaultIterableDiffer.prototype.forEachItem = function (fn) { var /** @type {?} */ record; for (record = this._itHead; record !== null; record = record._next) { fn(record); } }; /** * @param {?} fn * @return {?} */ DefaultIterableDiffer.prototype.forEachOperation = function (fn) { var /** @type {?} */ nextIt = this._itHead; var /** @type {?} */ nextRemove = this._removalsHead; var /** @type {?} */ addRemoveOffset = 0; var /** @type {?} */ moveOffsets = null; while (nextIt || nextRemove) { // Figure out which is the next record to process // Order: remove, add, move var /** @type {?} */ record = !nextRemove || nextIt && ((nextIt.currentIndex)) < getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ? ((nextIt)) : nextRemove; var /** @type {?} */ adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets); var /** @type {?} */ currentIndex = record.currentIndex; // consume the item, and adjust the addRemoveOffset and update moveDistance if necessary if (record === nextRemove) { addRemoveOffset--; nextRemove = nextRemove._nextRemoved; } else { nextIt = ((nextIt))._next; if (record.previousIndex == null) { addRemoveOffset++; } else { // INVARIANT: currentIndex < previousIndex if (!moveOffsets) moveOffsets = []; var /** @type {?} */ localMovePreviousIndex = adjPreviousIndex - addRemoveOffset; var /** @type {?} */ localCurrentIndex = ((currentIndex)) - addRemoveOffset; if (localMovePreviousIndex != localCurrentIndex) { for (var /** @type {?} */ i = 0; i < localMovePreviousIndex; i++) { var /** @type {?} */ offset = i < moveOffsets.length ? moveOffsets[i] : (moveOffsets[i] = 0); var /** @type {?} */ index = offset + i; if (localCurrentIndex <= index && index < localMovePreviousIndex) { moveOffsets[i] = offset + 1; } } var /** @type {?} */ previousIndex = record.previousIndex; moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex; } } } if (adjPreviousIndex !== currentIndex) { fn(record, adjPreviousIndex, currentIndex); } } }; /** * @param {?} fn * @return {?} */ DefaultIterableDiffer.prototype.forEachPreviousItem = function (fn) { var /** @type {?} */ record; for (record = this._previousItHead; record !== null; record = record._nextPrevious) { fn(record); } }; /** * @param {?} fn * @return {?} */ DefaultIterableDiffer.prototype.forEachAddedItem = function (fn) { var /** @type {?} */ record; for (record = this._additionsHead; record !== null; record = record._nextAdded) { fn(record); } }; /** * @param {?} fn * @return {?} */ DefaultIterableDiffer.prototype.forEachMovedItem = function (fn) { var /** @type {?} */ record; for (record = this._movesHead; record !== null; record = record._nextMoved) { fn(record); } }; /** * @param {?} fn * @return {?} */ DefaultIterableDiffer.prototype.forEachRemovedItem = function (fn) { var /** @type {?} */ record; for (record = this._removalsHead; record !== null; record = record._nextRemoved) { fn(record); } }; /** * @param {?} fn * @return {?} */ DefaultIterableDiffer.prototype.forEachIdentityChange = function (fn) { var /** @type {?} */ record; for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) { fn(record); } }; /** * @param {?} collection * @return {?} */ DefaultIterableDiffer.prototype.diff = function (collection) { if (collection == null) collection = []; if (!isListLikeIterable(collection)) { throw new Error("Error trying to diff '" + stringify(collection) + "'. Only arrays and iterables are allowed"); } if (this.check(collection)) { return this; } else { return null; } }; /** * @return {?} */ DefaultIterableDiffer.prototype.onDestroy = function () { }; /** * @param {?} collection * @return {?} */ DefaultIterableDiffer.prototype.check = function (collection) { var _this = this; this._reset(); var /** @type {?} */ record = this._itHead; var /** @type {?} */ mayBeDirty = false; var /** @type {?} */ index; var /** @type {?} */ item; var /** @type {?} */ itemTrackBy; if (Array.isArray(collection)) { this._length = collection.length; for (var /** @type {?} */ index_1 = 0; index_1 < this._length; index_1++) { item = collection[index_1]; itemTrackBy = this._trackByFn(index_1, item); if (record === null || !looseIdentical(record.trackById, itemTrackBy)) { record = this._mismatch(record, item, itemTrackBy, index_1); mayBeDirty = true; } else { if (mayBeDirty) { // TODO(misko): can we limit this to duplicates only? record = this._verifyReinsertion(record, item, itemTrackBy, index_1); } if (!looseIdentical(record.item, item)) this._addIdentityChange(record, item); } record = record._next; } } else { index = 0; iterateListLike(collection, function (item) { itemTrackBy = _this._trackByFn(index, item); if (record === null || !looseIdentical(record.trackById, itemTrackBy)) { record = _this._mismatch(record, item, itemTrackBy, index); mayBeDirty = true; } else { if (mayBeDirty) { // TODO(misko): can we limit this to duplicates only? record = _this._verifyReinsertion(record, item, itemTrackBy, index); } if (!looseIdentical(record.item, item)) _this._addIdentityChange(record, item); } record = record._next; index++; }); this._length = index; } this._truncate(record); this._collection = collection; return this.isDirty; }; Object.defineProperty(DefaultIterableDiffer.prototype, "isDirty", { /** * @return {?} */ get: function () { return this._additionsHead !== null || this._movesHead !== null || this._removalsHead !== null || this._identityChangesHead !== null; }, enumerable: true, configurable: true }); /** * Reset the state of the change objects to show no changes. This means set previousKey to * currentKey, and clear all of the queues (additions, moves, removals). * Set the previousIndexes of moved and added items to their currentIndexes * Reset the list of additions, moves and removals * * \@internal * @return {?} */ DefaultIterableDiffer.prototype._reset = function () { if (this.isDirty) { var /** @type {?} */ record = void 0; var /** @type {?} */ nextRecord = void 0; for (record = this._previousItHead = this._itHead; record !== null; record = record._next) { record._nextPrevious = record._next; } for (record = this._additionsHead; record !== null; record = record._nextAdded) { record.previousIndex = record.currentIndex; } this._additionsHead = this._additionsTail = null; for (record = this._movesHead; record !== null; record = nextRecord) { record.previousIndex = record.currentIndex; nextRecord = record._nextMoved; } this._movesHead = this._movesTail = null; this._removalsHead = this._removalsTail = null; this._identityChangesHead = this._identityChangesTail = null; } }; /** * This is the core function which handles differences between collections. * * - `record` is the record which we saw at this position last time. If null then it is a new * item. * - `item` is the current item in the collection * - `index` is the position of the item in the collection * * \@internal * @param {?} record * @param {?} item * @param {?} itemTrackBy * @param {?} index * @return {?} */ DefaultIterableDiffer.prototype._mismatch = function (record, item, itemTrackBy, index) { // The previous record after which we will append the current one. var /** @type {?} */ previousRecord; if (record === null) { previousRecord = ((this._itTail)); } else { previousRecord = ((record._prev)); // Remove the record from the collection since we know it does not match the item. this._remove(record); } // Attempt to see if we have seen the item before. record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index); if (record !== null) { // We have seen this before, we need to move it forward in the collection. // But first we need to check if identity changed, so we can update in view if necessary if (!looseIdentical(record.item, item)) this._addIdentityChange(record, item); this._moveAfter(record, previousRecord, index); } else { // Never seen it, check evicted list. record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null); if (record !== null) { // It is an item which we have evicted earlier: reinsert it back into the list. // But first we need to check if identity changed, so we can update in view if necessary if (!looseIdentical(record.item, item)) this._addIdentityChange(record, item); this._reinsertAfter(record, previousRecord, index); } else { // It is a new item: add it. record = this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index); } } return record; }; /** * This check is only needed if an array contains duplicates. (Short circuit of nothing dirty) * * Use case: `[a, a]` => `[b, a, a]` * * If we did not have this check then the insertion of `b` would: * 1) evict first `a` * 2) insert `b` at `0` index. * 3) leave `a` at index `1` as is. <-- this is wrong! * 3) reinsert `a` at index 2. <-- this is wrong! * * The correct behavior is: * 1) evict first `a` * 2) insert `b` at `0` index. * 3) reinsert `a` at index 1. * 3) move `a` at from `1` to `2`. * * * Double check that we have not evicted a duplicate item. We need to check if the item type may * have already been removed: * The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted * at the end. Which will show up as the two 'a's switching position. This is incorrect, since a * better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a' * at the end. * * \@internal * @param {?} record * @param {?} item * @param {?} itemTrackBy * @param {?} index * @return {?} */ DefaultIterableDiffer.prototype._verifyReinsertion = function (record, item, itemTrackBy, index) { var /** @type {?} */ reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null); if (reinsertRecord !== null) { record = this._reinsertAfter(reinsertRecord, /** @type {?} */ ((record._prev)), index); } else if (record.currentIndex != index) { record.currentIndex = index; this._addToMoves(record, index); } return record; }; /** * Get rid of any excess {\@link IterableChangeRecord_}s from the previous collection * * - `record` The first excess {\@link IterableChangeRecord_}. * * \@internal * @param {?} record * @return {?} */ DefaultIterableDiffer.prototype._truncate = function (record) { // Anything after that needs to be removed; while (record !== null) { var /** @type {?} */ nextRecord = record._next; this._addToRemovals(this._unlink(record)); record = nextRecord; } if (this._unlinkedRecords !== null) { this._unlinkedRecords.clear(); } if (this._additionsTail !== null) { this._additionsTail._nextAdded = null; } if (this._movesTail !== null) { this._movesTail._nextMoved = null; } if (this._itTail !== null) { this._itTail._next = null; } if (this._removalsTail !== null) { this._removalsTail._nextRemoved = null; } if (this._identityChangesTail !== null) { this._identityChangesTail._nextIdentityChange = null; } }; /** * \@internal * @param {?} record * @param {?} prevRecord * @param {?} index * @return {?} */ DefaultIterableDiffer.prototype._reinsertAfter = function (record, prevRecord, index) { if (this._unlinkedRecords !== null) { this._unlinkedRecords.remove(record); } var /** @type {?} */ prev = record._prevRemoved; var /** @type {?} */ next = record._nextRemoved; if (prev === null) { this._removalsHead = next; } else { prev._nextRemoved = next; } if (next === null) { this._removalsTail = prev; } else { next._prevRemoved = prev; } this._insertAfter(record, prevRecord, index); this._addToMoves(record, index); return record; }; /** * \@internal * @param {?} record * @param {?} prevRecord * @param {?} index * @return {?} */ DefaultIterableDiffer.prototype._moveAfter = function (record, prevRecord, index) { this._unlink(record); this._insertAfter(record, prevRecord, index); this._addToMoves(record, index); return record; }; /** * \@internal * @param {?} record * @param {?} prevRecord * @param {?} index * @return {?} */ DefaultIterableDiffer.prototype._addAfter = function (record, prevRecord, index) { this._insertAfter(record, prevRecord, index); if (this._additionsTail === null) { // todo(vicb) // assert(this._additionsHead === null); this._additionsTail = this._additionsHead = record; } else { // todo(vicb) // assert(_additionsTail._nextAdded === null); // assert(record._nextAdded === null); this._additionsTail = this._additionsTail._nextAdded = record; } return record; }; /** * \@internal * @param {?} record * @param {?} prevRecord * @param {?} index * @return {?} */ DefaultIterableDiffer.prototype._insertAfter = function (record, prevRecord, index) { // todo(vicb) // assert(record != prevRecord); // assert(record._next === null); // assert(record._prev === null); var /** @type {?} */ next = prevRecord === null ? this._itHead : prevRecord._next; // todo(vicb) // assert(next != record); // assert(prevRecord != record); record._next = next; record._prev = prevRecord; if (next === null) { this._itTail = record; } else { next._prev = record; } if (prevRecord === null) { this._itHead = record; } else { prevRecord._next = record; } if (this._linkedRecords === null) { this._linkedRecords = new _DuplicateMap(); } this._linkedRecords.put(record); record.currentIndex = index; return record; }; /** * \@internal * @param {?} record * @return {?} */ DefaultIterableDiffer.prototype._remove = function (record) { return this._addToRemovals(this._unlink(record)); }; /** * \@internal * @param {?} record * @return {?} */ DefaultIterableDiffer.prototype._unlink = function (record) { if (this._linkedRecords !== null) { this._linkedRecords.remove(record); } var /** @type {?} */ prev = record._prev; var /** @type {?} */ next = record._next; // todo(vicb) // assert((record._prev = null) === null); // assert((record._next = null) === null); if (prev === null) { this._itHead = next; } else { prev._next = next; } if (next === null) { this._itTail = prev; } else { next._prev = prev; } return record; }; /** * \@internal * @param {?} record * @param {?} toIndex * @return {?} */ DefaultIterableDiffer.prototype._addToMoves = function (record, toIndex) { // todo(vicb) // assert(record._nextMoved === null); if (record.previousIndex === toIndex) { return record; } if (this._movesTail === null) { // todo(vicb) // assert(_movesHead === null); this._movesTail = this._movesHead = record; } else { // todo(vicb) // assert(_movesTail._nextMoved === null); this._movesTail = this._movesTail._nextMoved = record; } return record; }; /** * @param {?} record * @return {?} */ DefaultIterableDiffer.prototype._addToRemovals = function (record) { if (this._unlinkedRecords === null) { this._unlinkedRecords = new _DuplicateMap(); } this._unlinkedRecords.put(record); record.currentIndex = null; record._nextRemoved = null; if (this._removalsTail === null) { // todo(vicb) // assert(_removalsHead === null); this._removalsTail = this._removalsHead = record; record._prevRemoved = null; } else { // todo(vicb) // assert(_removalsTail._nextRemoved === null); // assert(record._nextRemoved === null); record._prevRemoved = this._removalsTail; this._removalsTail = this._removalsTail._nextRemoved = record; } return record; }; /** * \@internal * @param {?} record * @param {?} item * @return {?} */ DefaultIterableDiffer.prototype._addIdentityChange = function (record, item) { record.item = item; if (this._identityChangesTail === null) { this._identityChangesTail = this._identityChangesHead = record; } else { this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record; } return record; }; /** * @return {?} */ DefaultIterableDiffer.prototype.toString = function () { var /** @type {?} */ list = []; this.forEachItem(function (record) { return list.push(record); }); var /** @type {?} */ previous = []; this.forEachPreviousItem(function (record) { return previous.push(record); }); var /** @type {?} */ additions = []; this.forEachAddedItem(function (record) { return additions.push(record); }); var /** @type {?} */ moves = []; this.forEachMovedItem(function (record) { return moves.push(record); }); var /** @type {?} */ removals = []; this.forEachRemovedItem(function (record) { return removals.push(record); }); var /** @type {?} */ identityChanges = []; this.forEachIdentityChange(function (record) { return identityChanges.push(record); }); return 'collection: ' + list.join(', ') + '\n' + 'previous: ' + previous.join(', ') + '\n' + 'additions: ' + additions.join(', ') + '\n' + 'moves: ' + moves.join(', ') + '\n' + 'removals: ' + removals.join(', ') + '\n' + 'identityChanges: ' + identityChanges.join(', ') + '\n'; }; return DefaultIterableDiffer; }()); /** * \@stable */ var IterableChangeRecord_ = (function () { /** * @param {?} item * @param {?} trackById */ function IterableChangeRecord_(item, trackById) { this.item = item; this.trackById = trackById; this.currentIndex = null; this.previousIndex = null; /** * \@internal */ this._nextPrevious = null; /** * \@internal */ this._prev = null; /** * \@internal */ this._next = null; /** * \@internal */ this._prevDup = null; /** * \@internal */ this._nextDup = null; /** * \@internal */ this._prevRemoved = null; /** * \@internal */ this._nextRemoved = null; /** * \@internal */ this._nextAdded = null; /** * \@internal */ this._nextMoved = null; /** * \@internal */ this._nextIdentityChange = null; } /** * @return {?} */ IterableChangeRecord_.prototype.toString = function () { return this.previousIndex === this.currentIndex ? stringify(this.item) : stringify(this.item) + '[' + stringify(this.previousIndex) + '->' + stringify(this.currentIndex) + ']'; }; return IterableChangeRecord_; }()); var _DuplicateItemRecordList = (function () { function _DuplicateItemRecordList() { /** * \@internal */ this._head = null; /** * \@internal */ this._tail = null; } /** * Append the record to the list of duplicates. * * Note: by design all records in the list of duplicates hold the same value in record.item. * @param {?} record * @return {?} */ _DuplicateItemRecordList.prototype.add = function (record) { if (this._head === null) { this._head = this._tail = record; record._nextDup = null; record._prevDup = null; } else { (( // todo(vicb) // assert(record.item == _head.item || // record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN); this._tail))._nextDup = record; record._prevDup = this._tail; record._nextDup = null; this._tail = record; } }; /** * @param {?} trackById * @param {?} afterIndex * @return {?} */ _DuplicateItemRecordList.prototype.get = function (trackById, afterIndex) { var /** @type {?} */ record; for (record = this._head; record !== null; record = record._nextDup) { if ((afterIndex === null || afterIndex < record.currentIndex) && looseIdentical(record.trackById, trackById)) { return record; } } return null; }; /** * Remove one {\@link IterableChangeRecord_} from the list of duplicates. * * Returns whether the list of duplicates is empty. * @param {?} record * @return {?} */ _DuplicateItemRecordList.prototype.remove = function (record) { // todo(vicb) // assert(() { // // verify that the record being removed is in the list. // for (IterableChangeRecord_ cursor = _head; cursor != null; cursor = cursor._nextDup) { // if (identical(cursor, record)) return true; // } // return false; //}); var /** @type {?} */ prev = record._prevDup; var /** @type {?} */ next = record._nextDup; if (prev === null) { this._head = next; } else { prev._nextDup = next; } if (next === null) { this._tail = prev; } else { next._prevDup = prev; } return this._head === null; }; return _DuplicateItemRecordList; }()); var _DuplicateMap = (function () { function _DuplicateMap() { this.map = new Map(); } /** * @param {?} record * @return {?} */ _DuplicateMap.prototype.put = function (record) { var /** @type {?} */ key = record.trackById; var /** @type {?} */ duplicates = this.map.get(key); if (!duplicates) { duplicates = new _DuplicateItemRecordList(); this.map.set(key, duplicates); } duplicates.add(record); }; /** * Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we * have already iterated over, we use the afterIndex to pretend it is not there. * * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we * have any more `a`s needs to return the last `a` not the first or second. * @param {?} trackById * @param {?} afterIndex * @return {?} */ _DuplicateMap.prototype.get = function (trackById, afterIndex) { var /** @type {?} */ key = trackById; var /** @type {?} */ recordList = this.map.get(key); return recordList ? recordList.get(trackById, afterIndex) : null; }; /** * Removes a {\@link IterableChangeRecord_} from the list of duplicates. * * The list of duplicates also is removed from the map if it gets empty. * @param {?} record * @return {?} */ _DuplicateMap.prototype.remove = function (record) { var /** @type {?} */ key = record.trackById; var /** @type {?} */ recordList = ((this.map.get(key))); // Remove the list of duplicates when it gets empty if (recordList.remove(record)) { this.map.delete(key); } return record; }; Object.defineProperty(_DuplicateMap.prototype, "isEmpty", { /** * @return {?} */ get: function () { return this.map.size === 0; }, enumerable: true, configurable: true }); /** * @return {?} */ _DuplicateMap.prototype.clear = function () { this.map.clear(); }; /** * @return {?} */ _DuplicateMap.prototype.toString = function () { return '_DuplicateMap(' + stringify(this.map) + ')'; }; return _DuplicateMap; }()); /** * @param {?} item * @param {?} addRemoveOffset * @param {?} moveOffsets * @return {?} */ function getPreviousIndex(item, addRemoveOffset, moveOffsets) { var /** @type {?} */ previousIndex = item.previousIndex; if (previousIndex === null) return previousIndex; var /** @type {?} */ moveOffset = 0; if (moveOffsets && previousIndex < moveOffsets.length) { moveOffset = moveOffsets[previousIndex]; } return previousIndex + addRemoveOffset + moveOffset; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var DefaultKeyValueDifferFactory = (function () { function DefaultKeyValueDifferFactory() { } /** * @param {?} obj * @return {?} */ DefaultKeyValueDifferFactory.prototype.supports = function (obj) { return obj instanceof Map || isJsObject(obj); }; /** * @deprecated v4.0.0 - ChangeDetectorRef is not used and is no longer a parameter * @template K, V * @param {?=} cd * @return {?} */ DefaultKeyValueDifferFactory.prototype.create = function (cd) { return new DefaultKeyValueDiffer(); }; return DefaultKeyValueDifferFactory; }()); var DefaultKeyValueDiffer = (function () { function DefaultKeyValueDiffer() { this._records = new Map(); this._mapHead = null; this._appendAfter = null; this._previousMapHead = null; this._changesHead = null; this._changesTail = null; this._additionsHead = null; this._additionsTail = null; this._removalsHead = null; this._removalsTail = null; } Object.defineProperty(DefaultKeyValueDiffer.prototype, "isDirty", { /** * @return {?} */ get: function () { return this._additionsHead !== null || this._changesHead !== null || this._removalsHead !== null; }, enumerable: true, configurable: true }); /** * @param {?} fn * @return {?} */ DefaultKeyValueDiffer.prototype.forEachItem = function (fn) { var /** @type {?} */ record; for (record = this._mapHead; record !== null; record = record._next) { fn(record); } }; /** * @param {?} fn * @return {?} */ DefaultKeyValueDiffer.prototype.forEachPreviousItem = function (fn) { var /** @type {?} */ record; for (record = this._previousMapHead; record !== null; record = record._nextPrevious) { fn(record); } }; /** * @param {?} fn * @return {?} */ DefaultKeyValueDiffer.prototype.forEachChangedItem = function (fn) { var /** @type {?} */ record; for (record = this._changesHead; record !== null; record = record._nextChanged) { fn(record); } }; /** * @param {?} fn * @return {?} */ DefaultKeyValueDiffer.prototype.forEachAddedItem = function (fn) { var /** @type {?} */ record; for (record = this._additionsHead; record !== null; record = record._nextAdded) { fn(record); } }; /** * @param {?} fn * @return {?} */ DefaultKeyValueDiffer.prototype.forEachRemovedItem = function (fn) { var /** @type {?} */ record; for (record = this._removalsHead; record !== null; record = record._nextRemoved) { fn(record); } }; /** * @param {?=} map * @return {?} */ DefaultKeyValueDiffer.prototype.diff = function (map) { if (!map) { map = new Map(); } else if (!(map instanceof Map || isJsObject(map))) { throw new Error("Error trying to diff '" + stringify(map) + "'. Only maps and objects are allowed"); } return this.check(map) ? this : null; }; /** * @return {?} */ DefaultKeyValueDiffer.prototype.onDestroy = function () { }; /** * Check the current state of the map vs the previous. * The algorithm is optimised for when the keys do no change. * @param {?} map * @return {?} */ DefaultKeyValueDiffer.prototype.check = function (map) { var _this = this; this._reset(); var /** @type {?} */ insertBefore = this._mapHead; this._appendAfter = null; this._forEach(map, function (value, key) { if (insertBefore && insertBefore.key === key) { _this._maybeAddToChanges(insertBefore, value); _this._appendAfter = insertBefore; insertBefore = insertBefore._next; } else { var /** @type {?} */ record = _this._getOrCreateRecordForKey(key, value); insertBefore = _this._insertBeforeOrAppend(insertBefore, record); } }); // Items remaining at the end of the list have been deleted if (insertBefore) { if (insertBefore._prev) { insertBefore._prev._next = null; } this._removalsHead = insertBefore; for (var /** @type {?} */ record = insertBefore; record !== null; record = record._nextRemoved) { if (record === this._mapHead) { this._mapHead = null; } this._records.delete(record.key); record._nextRemoved = record._next; record.previousValue = record.currentValue; record.currentValue = null; record._prev = null; record._next = null; } } // Make sure tails have no next records from previous runs if (this._changesTail) this._changesTail._nextChanged = null; if (this._additionsTail) this._additionsTail._nextAdded = null; return this.isDirty; }; /** * Inserts a record before `before` or append at the end of the list when `before` is null. * * Notes: * - This method appends at `this._appendAfter`, * - This method updates `this._appendAfter`, * - The return value is the new value for the insertion pointer. * @param {?} before * @param {?} record * @return {?} */ DefaultKeyValueDiffer.prototype._insertBeforeOrAppend = function (before, record) { if (before) { var /** @type {?} */ prev = before._prev; record._next = before; record._prev = prev; before._prev = record; if (prev) { prev._next = record; } if (before === this._mapHead) { this._mapHead = record; } this._appendAfter = before; return before; } if (this._appendAfter) { this._appendAfter._next = record; record._prev = this._appendAfter; } else { this._mapHead = record; } this._appendAfter = record; return null; }; /** * @param {?} key * @param {?} value * @return {?} */ DefaultKeyValueDiffer.prototype._getOrCreateRecordForKey = function (key, value) { if (this._records.has(key)) { var /** @type {?} */ record_1 = ((this._records.get(key))); this._maybeAddToChanges(record_1, value); var /** @type {?} */ prev = record_1._prev; var /** @type {?} */ next = record_1._next; if (prev) { prev._next = next; } if (next) { next._prev = prev; } record_1._next = null; record_1._prev = null; return record_1; } var /** @type {?} */ record = new KeyValueChangeRecord_(key); this._records.set(key, record); record.currentValue = value; this._addToAdditions(record); return record; }; /** * \@internal * @return {?} */ DefaultKeyValueDiffer.prototype._reset = function () { if (this.isDirty) { var /** @type {?} */ record = void 0; // let `_previousMapHead` contain the state of the map before the changes this._previousMapHead = this._mapHead; for (record = this._previousMapHead; record !== null; record = record._next) { record._nextPrevious = record._next; } // Update `record.previousValue` with the value of the item before the changes // We need to update all changed items (that's those which have been added and changed) for (record = this._changesHead; record !== null; record = record._nextChanged) { record.previousValue = record.currentValue; } for (record = this._additionsHead; record != null; record = record._nextAdded) { record.previousValue = record.currentValue; } this._changesHead = this._changesTail = null; this._additionsHead = this._additionsTail = null; this._removalsHead = null; } }; /** * @param {?} record * @param {?} newValue * @return {?} */ DefaultKeyValueDiffer.prototype._maybeAddToChanges = function (record, newValue) { if (!looseIdentical(newValue, record.currentValue)) { record.previousValue = record.currentValue; record.currentValue = newValue; this._addToChanges(record); } }; /** * @param {?} record * @return {?} */ DefaultKeyValueDiffer.prototype._addToAdditions = function (record) { if (this._additionsHead === null) { this._additionsHead = this._additionsTail = record; } else { ((this._additionsTail))._nextAdded = record; this._additionsTail = record; } }; /** * @param {?} record * @return {?} */ DefaultKeyValueDiffer.prototype._addToChanges = function (record) { if (this._changesHead === null) { this._changesHead = this._changesTail = record; } else { ((this._changesTail))._nextChanged = record; this._changesTail = record; } }; /** * @return {?} */ DefaultKeyValueDiffer.prototype.toString = function () { var /** @type {?} */ items = []; var /** @type {?} */ previous = []; var /** @type {?} */ changes = []; var /** @type {?} */ additions = []; var /** @type {?} */ removals = []; this.forEachItem(function (r) { return items.push(stringify(r)); }); this.forEachPreviousItem(function (r) { return previous.push(stringify(r)); }); this.forEachChangedItem(function (r) { return changes.push(stringify(r)); }); this.forEachAddedItem(function (r) { return additions.push(stringify(r)); }); this.forEachRemovedItem(function (r) { return removals.push(stringify(r)); }); return 'map: ' + items.join(', ') + '\n' + 'previous: ' + previous.join(', ') + '\n' + 'additions: ' + additions.join(', ') + '\n' + 'changes: ' + changes.join(', ') + '\n' + 'removals: ' + removals.join(', ') + '\n'; }; /** * \@internal * @template K, V * @param {?} obj * @param {?} fn * @return {?} */ DefaultKeyValueDiffer.prototype._forEach = function (obj, fn) { if (obj instanceof Map) { obj.forEach(fn); } else { Object.keys(obj).forEach(function (k) { return fn(obj[k], k); }); } }; return DefaultKeyValueDiffer; }()); /** * \@stable */ var KeyValueChangeRecord_ = (function () { /** * @param {?} key */ function KeyValueChangeRecord_(key) { this.key = key; this.previousValue = null; this.currentValue = null; /** * \@internal */ this._nextPrevious = null; /** * \@internal */ this._next = null; /** * \@internal */ this._prev = null; /** * \@internal */ this._nextAdded = null; /** * \@internal */ this._nextRemoved = null; /** * \@internal */ this._nextChanged = null; } /** * @return {?} */ KeyValueChangeRecord_.prototype.toString = function () { return looseIdentical(this.previousValue, this.currentValue) ? stringify(this.key) : (stringify(this.key) + '[' + stringify(this.previousValue) + '->' + stringify(this.currentValue) + ']'); }; return KeyValueChangeRecord_; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A repository of different iterable diffing strategies used by NgFor, NgClass, and others. * \@stable */ var IterableDiffers = (function () { /** * @param {?} factories */ function IterableDiffers(factories) { this.factories = factories; } /** * @param {?} factories * @param {?=} parent * @return {?} */ IterableDiffers.create = function (factories, parent) { if (parent != null) { var /** @type {?} */ copied = parent.factories.slice(); factories = factories.concat(copied); return new IterableDiffers(factories); } else { return new IterableDiffers(factories); } }; /** * Takes an array of {\@link IterableDifferFactory} and returns a provider used to extend the * inherited {\@link IterableDiffers} instance with the provided factories and return a new * {\@link IterableDiffers} instance. * * The following example shows how to extend an existing list of factories, * which will only be applied to the injector for this component and its children. * This step is all that's required to make a new {\@link IterableDiffer} available. * * ### Example * * ``` * \@Component({ * viewProviders: [ * IterableDiffers.extend([new ImmutableListDiffer()]) * ] * }) * ``` * @param {?} factories * @return {?} */ IterableDiffers.extend = function (factories) { return { provide: IterableDiffers, useFactory: function (parent) { if (!parent) { // Typically would occur when calling IterableDiffers.extend inside of dependencies passed // to // bootstrap(), which would override default pipes instead of extending them. throw new Error('Cannot extend IterableDiffers without a parent injector'); } return IterableDiffers.create(factories, parent); }, // Dependency technically isn't optional, but we can provide a better error message this way. deps: [[IterableDiffers, new SkipSelf(), new Optional()]] }; }; /** * @param {?} iterable * @return {?} */ IterableDiffers.prototype.find = function (iterable) { var /** @type {?} */ factory = this.factories.find(function (f) { return f.supports(iterable); }); if (factory != null) { return factory; } else { throw new Error("Cannot find a differ supporting object '" + iterable + "' of type '" + getTypeNameForDebugging(iterable) + "'"); } }; return IterableDiffers; }()); /** * @param {?} type * @return {?} */ function getTypeNameForDebugging(type) { return type['name'] || typeof type; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A repository of different Map diffing strategies used by NgClass, NgStyle, and others. * \@stable */ var KeyValueDiffers = (function () { /** * @param {?} factories */ function KeyValueDiffers(factories) { this.factories = factories; } /** * @template S * @param {?} factories * @param {?=} parent * @return {?} */ KeyValueDiffers.create = function (factories, parent) { if (parent) { var /** @type {?} */ copied = parent.factories.slice(); factories = factories.concat(copied); } return new KeyValueDiffers(factories); }; /** * Takes an array of {\@link KeyValueDifferFactory} and returns a provider used to extend the * inherited {\@link KeyValueDiffers} instance with the provided factories and return a new * {\@link KeyValueDiffers} instance. * * The following example shows how to extend an existing list of factories, * which will only be applied to the injector for this component and its children. * This step is all that's required to make a new {\@link KeyValueDiffer} available. * * ### Example * * ``` * \@Component({ * viewProviders: [ * KeyValueDiffers.extend([new ImmutableMapDiffer()]) * ] * }) * ``` * @template S * @param {?} factories * @return {?} */ KeyValueDiffers.extend = function (factories) { return { provide: KeyValueDiffers, useFactory: function (parent) { if (!parent) { // Typically would occur when calling KeyValueDiffers.extend inside of dependencies passed // to bootstrap(), which would override default pipes instead of extending them. throw new Error('Cannot extend KeyValueDiffers without a parent injector'); } return KeyValueDiffers.create(factories, parent); }, // Dependency technically isn't optional, but we can provide a better error message this way. deps: [[KeyValueDiffers, new SkipSelf(), new Optional()]] }; }; /** * @param {?} kv * @return {?} */ KeyValueDiffers.prototype.find = function (kv) { var /** @type {?} */ factory = this.factories.find(function (f) { return f.supports(kv); }); if (factory) { return factory; } throw new Error("Cannot find a differ supporting object '" + kv + "'"); }; return KeyValueDiffers; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Structural diffing for `Object`s and `Map`s. */ var keyValDiff = [new DefaultKeyValueDifferFactory()]; /** * Structural diffing for `Iterable` types such as `Array`s. */ var iterableDiff = [new DefaultIterableDifferFactory()]; var defaultIterableDiffers = new IterableDiffers(iterableDiff); var defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Change detection enables data binding in Angular. */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @return {?} */ function _reflector() { return reflector; } var _CORE_PLATFORM_PROVIDERS = [ // Set a default platform name for platforms that don't set it explicitly. { provide: PLATFORM_ID, useValue: 'unknown' }, PlatformRef_, { provide: PlatformRef, useExisting: PlatformRef_ }, { provide: Reflector, useFactory: _reflector, deps: [] }, { provide: ReflectorReader, useExisting: Reflector }, TestabilityRegistry, Console, ]; /** * This platform has to be included in any other platform * * \@experimental */ var platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@experimental i18n support is experimental. */ var LOCALE_ID = new InjectionToken('LocaleId'); /** * \@experimental i18n support is experimental. */ var TRANSLATIONS = new InjectionToken('Translations'); /** * \@experimental i18n support is experimental. */ var TRANSLATIONS_FORMAT = new InjectionToken('TranslationsFormat'); var MissingTranslationStrategy = {}; MissingTranslationStrategy.Error = 0; MissingTranslationStrategy.Warning = 1; MissingTranslationStrategy.Ignore = 2; MissingTranslationStrategy[MissingTranslationStrategy.Error] = "Error"; MissingTranslationStrategy[MissingTranslationStrategy.Warning] = "Warning"; MissingTranslationStrategy[MissingTranslationStrategy.Ignore] = "Ignore"; var SecurityContext = {}; SecurityContext.NONE = 0; SecurityContext.HTML = 1; SecurityContext.STYLE = 2; SecurityContext.SCRIPT = 3; SecurityContext.URL = 4; SecurityContext.RESOURCE_URL = 5; SecurityContext[SecurityContext.NONE] = "NONE"; SecurityContext[SecurityContext.HTML] = "HTML"; SecurityContext[SecurityContext.STYLE] = "STYLE"; SecurityContext[SecurityContext.SCRIPT] = "SCRIPT"; SecurityContext[SecurityContext.URL] = "URL"; SecurityContext[SecurityContext.RESOURCE_URL] = "RESOURCE_URL"; /** * Sanitizer is used by the views to sanitize potentially dangerous values. * * \@stable * @abstract */ var Sanitizer = (function () { function Sanitizer() { } /** * @abstract * @param {?} context * @param {?} value * @return {?} */ Sanitizer.prototype.sanitize = function (context, value) { }; return Sanitizer; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Node instance data. * * We have a separate type per NodeType to save memory * (TextData | ElementData | ProviderData | PureExpressionData | QueryList) * * To keep our code monomorphic, * we prohibit using `NodeData` directly but enforce the use of accessors (`asElementData`, ...). * This way, no usage site can get a `NodeData` from view.nodes and then use it for different * purposes. */ /** * Accessor for view.nodes, enforcing that every usage site stays monomorphic. * @param {?} view * @param {?} index * @return {?} */ function asTextData(view, index) { return (view.nodes[index]); } /** * Accessor for view.nodes, enforcing that every usage site stays monomorphic. * @param {?} view * @param {?} index * @return {?} */ function asElementData(view, index) { return (view.nodes[index]); } /** * Accessor for view.nodes, enforcing that every usage site stays monomorphic. * @param {?} view * @param {?} index * @return {?} */ function asProviderData(view, index) { return (view.nodes[index]); } /** * Accessor for view.nodes, enforcing that every usage site stays monomorphic. * @param {?} view * @param {?} index * @return {?} */ function asPureExpressionData(view, index) { return (view.nodes[index]); } /** * Accessor for view.nodes, enforcing that every usage site stays monomorphic. * @param {?} view * @param {?} index * @return {?} */ function asQueryList(view, index) { return (view.nodes[index]); } /** * @abstract */ var DebugContext = (function () { function DebugContext() { } /** * @abstract * @return {?} */ DebugContext.prototype.view = function () { }; /** * @abstract * @return {?} */ DebugContext.prototype.nodeIndex = function () { }; /** * @abstract * @return {?} */ DebugContext.prototype.injector = function () { }; /** * @abstract * @return {?} */ DebugContext.prototype.component = function () { }; /** * @abstract * @return {?} */ DebugContext.prototype.providerTokens = function () { }; /** * @abstract * @return {?} */ DebugContext.prototype.references = function () { }; /** * @abstract * @return {?} */ DebugContext.prototype.context = function () { }; /** * @abstract * @return {?} */ DebugContext.prototype.componentRenderElement = function () { }; /** * @abstract * @return {?} */ DebugContext.prototype.renderNode = function () { }; /** * @abstract * @param {?} console * @param {...?} values * @return {?} */ DebugContext.prototype.logError = function (console) { var values = []; for (var _i = 1; _i < arguments.length; _i++) { values[_i - 1] = arguments[_i]; } }; return DebugContext; }()); /** * This object is used to prevent cycles in the source files and to have a place where * debug mode can hook it. It is lazily filled when `isDevMode` is known. */ var Services = { setCurrentNode: /** @type {?} */ ((undefined)), createRootView: /** @type {?} */ ((undefined)), createEmbeddedView: /** @type {?} */ ((undefined)), checkAndUpdateView: /** @type {?} */ ((undefined)), checkNoChangesView: /** @type {?} */ ((undefined)), destroyView: /** @type {?} */ ((undefined)), resolveDep: /** @type {?} */ ((undefined)), createDebugContext: /** @type {?} */ ((undefined)), handleEvent: /** @type {?} */ ((undefined)), updateDirectives: /** @type {?} */ ((undefined)), updateRenderer: /** @type {?} */ ((undefined)), dirtyParentQueries: /** @type {?} */ ((undefined)), }; /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} context * @param {?} oldValue * @param {?} currValue * @param {?} isFirstCheck * @return {?} */ function expressionChangedAfterItHasBeenCheckedError(context, oldValue, currValue, isFirstCheck) { var /** @type {?} */ msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'."; if (isFirstCheck) { msg += " It seems like the view has been created after its parent and its children have been dirty checked." + " Has it been created in a change detection hook ?"; } return viewDebugError(msg, context); } /** * @param {?} err * @param {?} context * @return {?} */ function viewWrappedDebugError(err, context) { if (!(err instanceof Error)) { // errors that are not Error instances don't have a stack, // so it is ok to wrap them into a new Error object... err = new Error(err.toString()); } _addDebugContext(err, context); return err; } /** * @param {?} msg * @param {?} context * @return {?} */ function viewDebugError(msg, context) { var /** @type {?} */ err = new Error(msg); _addDebugContext(err, context); return err; } /** * @param {?} err * @param {?} context * @return {?} */ function _addDebugContext(err, context) { ((err))[ERROR_DEBUG_CONTEXT] = context; ((err))[ERROR_LOGGER] = context.logError.bind(context); } /** * @param {?} err * @return {?} */ function isViewDebugError(err) { return !!getDebugContext(err); } /** * @param {?} action * @return {?} */ function viewDestroyedError(action) { return new Error("ViewDestroyedError: Attempt to use a destroyed view: " + action); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var NOOP = function () { }; var _tokenKeyCache = new Map(); /** * @param {?} token * @return {?} */ function tokenKey(token) { var /** @type {?} */ key = _tokenKeyCache.get(token); if (!key) { key = stringify(token) + '_' + _tokenKeyCache.size; _tokenKeyCache.set(token, key); } return key; } /** * @param {?} view * @param {?} nodeIdx * @param {?} bindingIdx * @param {?} value * @return {?} */ function unwrapValue(view, nodeIdx, bindingIdx, value) { if (value instanceof WrappedValue) { value = value.wrapped; var /** @type {?} */ globalBindingIdx = view.def.nodes[nodeIdx].bindingIndex + bindingIdx; var /** @type {?} */ oldValue = view.oldValues[globalBindingIdx]; if (oldValue instanceof WrappedValue) { oldValue = oldValue.wrapped; } view.oldValues[globalBindingIdx] = new WrappedValue(oldValue); } return value; } var UNDEFINED_RENDERER_TYPE_ID = '$$undefined'; var EMPTY_RENDERER_TYPE_ID = '$$empty'; /** * @param {?} values * @return {?} */ function createRendererType2(values) { return { id: UNDEFINED_RENDERER_TYPE_ID, styles: values.styles, encapsulation: values.encapsulation, data: values.data }; } var _renderCompCount = 0; /** * @param {?=} type * @return {?} */ function resolveRendererType2(type) { if (type && type.id === UNDEFINED_RENDERER_TYPE_ID) { // first time we see this RendererType2. Initialize it... var /** @type {?} */ isFilled = ((type.encapsulation != null && type.encapsulation !== ViewEncapsulation.None) || type.styles.length || Object.keys(type.data).length); if (isFilled) { type.id = "c" + _renderCompCount++; } else { type.id = EMPTY_RENDERER_TYPE_ID; } } if (type && type.id === EMPTY_RENDERER_TYPE_ID) { type = null; } return type || null; } /** * @param {?} view * @param {?} def * @param {?} bindingIdx * @param {?} value * @return {?} */ function checkBinding(view, def, bindingIdx, value) { var /** @type {?} */ oldValues = view.oldValues; if ((view.state & 2 /* FirstCheck */) || !looseIdentical(oldValues[def.bindingIndex + bindingIdx], value)) { return true; } return false; } /** * @param {?} view * @param {?} def * @param {?} bindingIdx * @param {?} value * @return {?} */ function checkAndUpdateBinding(view, def, bindingIdx, value) { if (checkBinding(view, def, bindingIdx, value)) { view.oldValues[def.bindingIndex + bindingIdx] = value; return true; } return false; } /** * @param {?} view * @param {?} def * @param {?} bindingIdx * @param {?} value * @return {?} */ function checkBindingNoChanges(view, def, bindingIdx, value) { var /** @type {?} */ oldValue = view.oldValues[def.bindingIndex + bindingIdx]; if ((view.state & 1 /* BeforeFirstCheck */) || !devModeEqual(oldValue, value)) { throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, def.index), oldValue, value, (view.state & 1 /* BeforeFirstCheck */) !== 0); } } /** * @param {?} view * @return {?} */ function markParentViewsForCheck(view) { var /** @type {?} */ currView = view; while (currView) { if (currView.def.flags & 2 /* OnPush */) { currView.state |= 8 /* ChecksEnabled */; } currView = currView.viewContainerParent || currView.parent; } } /** * @param {?} view * @param {?} nodeIndex * @param {?} eventName * @param {?} event * @return {?} */ function dispatchEvent(view, nodeIndex, eventName, event) { var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex]; var /** @type {?} */ startView = nodeDef.flags & 16777216 /* ComponentView */ ? asElementData(view, nodeIndex).componentView : view; markParentViewsForCheck(startView); return Services.handleEvent(view, nodeIndex, eventName, event); } /** * @param {?} view * @return {?} */ function declaredViewContainer(view) { if (view.parent) { var /** @type {?} */ parentView = view.parent; return asElementData(parentView, /** @type {?} */ ((view.parentNodeDef)).index); } return null; } /** * for component views, this is the host element. * for embedded views, this is the index of the parent node * that contains the view container. * @param {?} view * @return {?} */ function viewParentEl(view) { var /** @type {?} */ parentView = view.parent; if (parentView) { return ((view.parentNodeDef)).parent; } else { return null; } } /** * @param {?} view * @param {?} def * @return {?} */ function renderNode(view, def) { switch (def.flags & 100673535 /* Types */) { case 1 /* TypeElement */: return asElementData(view, def.index).renderElement; case 2 /* TypeText */: return asTextData(view, def.index).renderText; } } /** * @param {?} target * @param {?} name * @return {?} */ function elementEventFullName(target, name) { return target ? target + ":" + name : name; } /** * @param {?} view * @return {?} */ function isComponentView(view) { return !!view.parent && !!(((view.parentNodeDef)).flags & 16384 /* Component */); } /** * @param {?} view * @return {?} */ function isEmbeddedView(view) { return !!view.parent && !(((view.parentNodeDef)).flags & 16384 /* Component */); } /** * @param {?} queryId * @return {?} */ function filterQueryId(queryId) { return 1 << (queryId % 32); } /** * @param {?} matchedQueriesDsl * @return {?} */ function splitMatchedQueriesDsl(matchedQueriesDsl) { var /** @type {?} */ matchedQueries = {}; var /** @type {?} */ matchedQueryIds = 0; var /** @type {?} */ references = {}; if (matchedQueriesDsl) { matchedQueriesDsl.forEach(function (_a) { var queryId = _a[0], valueType = _a[1]; if (typeof queryId === 'number') { matchedQueries[queryId] = valueType; matchedQueryIds |= filterQueryId(queryId); } else { references[queryId] = valueType; } }); } return { matchedQueries: matchedQueries, references: references, matchedQueryIds: matchedQueryIds }; } /** * @param {?} view * @param {?} renderHost * @param {?} def * @return {?} */ function getParentRenderElement(view, renderHost, def) { var /** @type {?} */ renderParent = def.renderParent; if (renderParent) { if ((renderParent.flags & 1 /* TypeElement */) === 0 || (renderParent.flags & 16777216 /* ComponentView */) === 0 || (((renderParent.element)).componentRendererType && ((((renderParent.element)).componentRendererType)).encapsulation === ViewEncapsulation.Native)) { // only children of non components, or children of components with native encapsulation should // be attached. return asElementData(view, /** @type {?} */ ((def.renderParent)).index).renderElement; } } else { return renderHost; } } var VIEW_DEFINITION_CACHE = new WeakMap(); /** * @param {?} factory * @return {?} */ function resolveViewDefinition(factory) { var /** @type {?} */ value = ((VIEW_DEFINITION_CACHE.get(factory))); if (!value) { value = factory(function () { return NOOP; }); value.factory = factory; VIEW_DEFINITION_CACHE.set(factory, value); } return value; } /** * @param {?} view * @return {?} */ function rootRenderNodes(view) { var /** @type {?} */ renderNodes = []; visitRootRenderNodes(view, 0 /* Collect */, undefined, undefined, renderNodes); return renderNodes; } /** * @param {?} view * @param {?} action * @param {?} parentNode * @param {?} nextSibling * @param {?=} target * @return {?} */ function visitRootRenderNodes(view, action, parentNode, nextSibling, target) { // We need to re-compute the parent node in case the nodes have been moved around manually if (action === 3 /* RemoveChild */) { parentNode = view.renderer.parentNode(renderNode(view, /** @type {?} */ ((view.def.lastRenderRootNode)))); } visitSiblingRenderNodes(view, action, 0, view.def.nodes.length - 1, parentNode, nextSibling, target); } /** * @param {?} view * @param {?} action * @param {?} startIndex * @param {?} endIndex * @param {?} parentNode * @param {?} nextSibling * @param {?=} target * @return {?} */ function visitSiblingRenderNodes(view, action, startIndex, endIndex, parentNode, nextSibling, target) { for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) { var /** @type {?} */ nodeDef = view.def.nodes[i]; if (nodeDef.flags & (1 /* TypeElement */ | 2 /* TypeText */ | 4 /* TypeNgContent */)) { visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target); } // jump to next sibling i += nodeDef.childCount; } } /** * @param {?} view * @param {?} ngContentIndex * @param {?} action * @param {?} parentNode * @param {?} nextSibling * @param {?=} target * @return {?} */ function visitProjectedRenderNodes(view, ngContentIndex, action, parentNode, nextSibling, target) { var /** @type {?} */ compView = view; while (compView && !isComponentView(compView)) { compView = compView.parent; } var /** @type {?} */ hostView = ((compView)).parent; var /** @type {?} */ hostElDef = viewParentEl(/** @type {?} */ ((compView))); var /** @type {?} */ startIndex = ((hostElDef)).index + 1; var /** @type {?} */ endIndex = ((hostElDef)).index + ((hostElDef)).childCount; for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) { var /** @type {?} */ nodeDef = ((hostView)).def.nodes[i]; if (nodeDef.ngContentIndex === ngContentIndex) { visitRenderNode(/** @type {?} */ ((hostView)), nodeDef, action, parentNode, nextSibling, target); } // jump to next sibling i += nodeDef.childCount; } if (!((hostView)).parent) { // a root view var /** @type {?} */ projectedNodes = view.root.projectableNodes[ngContentIndex]; if (projectedNodes) { for (var /** @type {?} */ i = 0; i < projectedNodes.length; i++) { execRenderNodeAction(view, projectedNodes[i], action, parentNode, nextSibling, target); } } } } /** * @param {?} view * @param {?} nodeDef * @param {?} action * @param {?} parentNode * @param {?} nextSibling * @param {?=} target * @return {?} */ function visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target) { if (nodeDef.flags & 4 /* TypeNgContent */) { visitProjectedRenderNodes(view, /** @type {?} */ ((nodeDef.ngContent)).index, action, parentNode, nextSibling, target); } else { var /** @type {?} */ rn = renderNode(view, nodeDef); if (action === 3 /* RemoveChild */ && (nodeDef.flags & 16777216 /* ComponentView */) && (nodeDef.bindingFlags & 48 /* CatSyntheticProperty */)) { // Note: we might need to do both actions. if (nodeDef.bindingFlags & (16 /* SyntheticProperty */)) { execRenderNodeAction(view, rn, action, parentNode, nextSibling, target); } if (nodeDef.bindingFlags & (32 /* SyntheticHostProperty */)) { var /** @type {?} */ compView = asElementData(view, nodeDef.index).componentView; execRenderNodeAction(compView, rn, action, parentNode, nextSibling, target); } } else { execRenderNodeAction(view, rn, action, parentNode, nextSibling, target); } if (nodeDef.flags & 8388608 /* EmbeddedViews */) { var /** @type {?} */ embeddedViews = ((asElementData(view, nodeDef.index).viewContainer))._embeddedViews; for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) { visitRootRenderNodes(embeddedViews[k], action, parentNode, nextSibling, target); } } if (nodeDef.flags & 1 /* TypeElement */ && !((nodeDef.element)).name) { visitSiblingRenderNodes(view, action, nodeDef.index + 1, nodeDef.index + nodeDef.childCount, parentNode, nextSibling, target); } } } /** * @param {?} view * @param {?} renderNode * @param {?} action * @param {?} parentNode * @param {?} nextSibling * @param {?=} target * @return {?} */ function execRenderNodeAction(view, renderNode, action, parentNode, nextSibling, target) { var /** @type {?} */ renderer = view.renderer; switch (action) { case 1 /* AppendChild */: renderer.appendChild(parentNode, renderNode); break; case 2 /* InsertBefore */: renderer.insertBefore(parentNode, renderNode, nextSibling); break; case 3 /* RemoveChild */: renderer.removeChild(parentNode, renderNode); break; case 0 /* Collect */: ((target)).push(renderNode); break; } } var NS_PREFIX_RE = /^:([^:]+):(.+)$/; /** * @param {?} name * @return {?} */ function splitNamespace(name) { if (name[0] === ':') { var /** @type {?} */ match = ((name.match(NS_PREFIX_RE))); return [match[1], match[2]]; } return ['', name]; } /** * @param {?} bindings * @return {?} */ function calcBindingFlags(bindings) { var /** @type {?} */ flags = 0; for (var /** @type {?} */ i = 0; i < bindings.length; i++) { flags |= bindings[i].flags; } return flags; } /** * @param {?} valueCount * @param {?} constAndInterp * @return {?} */ function interpolate(valueCount, constAndInterp) { var /** @type {?} */ result = ''; for (var /** @type {?} */ i = 0; i < valueCount * 2; i = i + 2) { result = result + constAndInterp[i] + _toStringWithNull(constAndInterp[i + 1]); } return result + constAndInterp[valueCount * 2]; } /** * @param {?} valueCount * @param {?} c0 * @param {?} a1 * @param {?} c1 * @param {?=} a2 * @param {?=} c2 * @param {?=} a3 * @param {?=} c3 * @param {?=} a4 * @param {?=} c4 * @param {?=} a5 * @param {?=} c5 * @param {?=} a6 * @param {?=} c6 * @param {?=} a7 * @param {?=} c7 * @param {?=} a8 * @param {?=} c8 * @param {?=} a9 * @param {?=} c9 * @return {?} */ function inlineInterpolate(valueCount, c0, a1, c1, a2, c2, a3, c3, a4, c4, a5, c5, a6, c6, a7, c7, a8, c8, a9, c9) { switch (valueCount) { case 1: return c0 + _toStringWithNull(a1) + c1; case 2: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2; case 3: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3; case 4: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4; case 5: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5; case 6: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6; case 7: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6 + _toStringWithNull(a7) + c7; case 8: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8; case 9: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) + c9; default: throw new Error("Does not support more than 9 expressions"); } } /** * @param {?} v * @return {?} */ function _toStringWithNull(v) { return v != null ? v.toString() : ''; } var EMPTY_ARRAY = []; var EMPTY_MAP = {}; /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} flags * @param {?} matchedQueriesDsl * @param {?} ngContentIndex * @param {?} childCount * @param {?=} handleEvent * @param {?=} templateFactory * @return {?} */ function anchorDef(flags, matchedQueriesDsl, ngContentIndex, childCount, handleEvent, templateFactory) { flags |= 1 /* TypeElement */; var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds; var /** @type {?} */ template = templateFactory ? resolveViewDefinition(templateFactory) : null; return { // will bet set by the view definition index: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values flags: flags, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount, bindings: [], bindingFlags: 0, outputs: [], element: { ns: null, name: null, attrs: null, template: template, componentProvider: null, componentView: null, componentRendererType: null, publicProviders: null, allProviders: null, handleEvent: handleEvent || NOOP }, provider: null, text: null, query: null, ngContent: null }; } /** * @param {?} flags * @param {?} matchedQueriesDsl * @param {?} ngContentIndex * @param {?} childCount * @param {?} namespaceAndName * @param {?=} fixedAttrs * @param {?=} bindings * @param {?=} outputs * @param {?=} handleEvent * @param {?=} componentView * @param {?=} componentRendererType * @return {?} */ function elementDef(flags, matchedQueriesDsl, ngContentIndex, childCount, namespaceAndName, fixedAttrs, bindings, outputs, handleEvent, componentView, componentRendererType) { if (fixedAttrs === void 0) { fixedAttrs = []; } if (!handleEvent) { handleEvent = NOOP; } var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds; var /** @type {?} */ ns = ((null)); var /** @type {?} */ name = ((null)); if (namespaceAndName) { _b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1]; } bindings = bindings || []; var /** @type {?} */ bindingDefs = new Array(bindings.length); for (var /** @type {?} */ i = 0; i < bindings.length; i++) { var _c = bindings[i], bindingFlags = _c[0], namespaceAndName_1 = _c[1], suffixOrSecurityContext = _c[2]; var _d = splitNamespace(namespaceAndName_1), ns_1 = _d[0], name_1 = _d[1]; var /** @type {?} */ securityContext = ((undefined)); var /** @type {?} */ suffix = ((undefined)); switch (bindingFlags & 15 /* Types */) { case 4 /* TypeElementStyle */: suffix = (suffixOrSecurityContext); break; case 1 /* TypeElementAttribute */: case 8 /* TypeProperty */: securityContext = (suffixOrSecurityContext); break; } bindingDefs[i] = { flags: bindingFlags, ns: ns_1, name: name_1, nonMinifiedName: name_1, securityContext: securityContext, suffix: suffix }; } outputs = outputs || []; var /** @type {?} */ outputDefs = new Array(outputs.length); for (var /** @type {?} */ i = 0; i < outputs.length; i++) { var _e = outputs[i], target = _e[0], eventName = _e[1]; outputDefs[i] = { type: 0 /* ElementOutput */, target: /** @type {?} */ (target), eventName: eventName, propName: null }; } fixedAttrs = fixedAttrs || []; var /** @type {?} */ attrs = (fixedAttrs.map(function (_a) { var namespaceAndName = _a[0], value = _a[1]; var _b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1]; return [ns, name, value]; })); componentRendererType = resolveRendererType2(componentRendererType); if (componentView) { flags |= 16777216 /* ComponentView */; } flags |= 1 /* TypeElement */; return { // will bet set by the view definition index: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values flags: flags, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount, bindings: bindingDefs, bindingFlags: calcBindingFlags(bindingDefs), outputs: outputDefs, element: { ns: ns, name: name, attrs: attrs, template: null, // will bet set by the view definition componentProvider: null, componentView: componentView || null, componentRendererType: componentRendererType, publicProviders: null, allProviders: null, handleEvent: handleEvent || NOOP, }, provider: null, text: null, query: null, ngContent: null }; var _b; } /** * @param {?} view * @param {?} renderHost * @param {?} def * @return {?} */ function createElement(view, renderHost, def) { var /** @type {?} */ elDef = ((def.element)); var /** @type {?} */ rootSelectorOrNode = view.root.selectorOrNode; var /** @type {?} */ renderer = view.renderer; var /** @type {?} */ el; if (view.parent || !rootSelectorOrNode) { if (elDef.name) { el = renderer.createElement(elDef.name, elDef.ns); } else { el = renderer.createComment(''); } var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def); if (parentEl) { renderer.appendChild(parentEl, el); } } else { el = renderer.selectRootElement(rootSelectorOrNode); } if (elDef.attrs) { for (var /** @type {?} */ i = 0; i < elDef.attrs.length; i++) { var _a = elDef.attrs[i], ns = _a[0], name = _a[1], value = _a[2]; renderer.setAttribute(el, name, value, ns); } } return el; } /** * @param {?} view * @param {?} compView * @param {?} def * @param {?} el * @return {?} */ function listenToElementOutputs(view, compView, def, el) { for (var /** @type {?} */ i = 0; i < def.outputs.length; i++) { var /** @type {?} */ output = def.outputs[i]; var /** @type {?} */ handleEventClosure = renderEventHandlerClosure(view, def.index, elementEventFullName(output.target, output.eventName)); var /** @type {?} */ listenTarget = output.target; var /** @type {?} */ listenerView = view; if (output.target === 'component') { listenTarget = null; listenerView = compView; } var /** @type {?} */ disposable = (listenerView.renderer.listen(listenTarget || el, output.eventName, handleEventClosure)); /** @type {?} */ ((view.disposables))[def.outputIndex + i] = disposable; } } /** * @param {?} view * @param {?} index * @param {?} eventName * @return {?} */ function renderEventHandlerClosure(view, index, eventName) { return function (event) { try { return dispatchEvent(view, index, eventName, event); } catch (e) { // Attention: Don't rethrow, to keep in sync with directive events. view.root.errorHandler.handleError(e); } }; } /** * @param {?} view * @param {?} def * @param {?} v0 * @param {?} v1 * @param {?} v2 * @param {?} v3 * @param {?} v4 * @param {?} v5 * @param {?} v6 * @param {?} v7 * @param {?} v8 * @param {?} v9 * @return {?} */ function checkAndUpdateElementInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { var /** @type {?} */ bindLen = def.bindings.length; var /** @type {?} */ changed = false; if (bindLen > 0 && checkAndUpdateElementValue(view, def, 0, v0)) changed = true; if (bindLen > 1 && checkAndUpdateElementValue(view, def, 1, v1)) changed = true; if (bindLen > 2 && checkAndUpdateElementValue(view, def, 2, v2)) changed = true; if (bindLen > 3 && checkAndUpdateElementValue(view, def, 3, v3)) changed = true; if (bindLen > 4 && checkAndUpdateElementValue(view, def, 4, v4)) changed = true; if (bindLen > 5 && checkAndUpdateElementValue(view, def, 5, v5)) changed = true; if (bindLen > 6 && checkAndUpdateElementValue(view, def, 6, v6)) changed = true; if (bindLen > 7 && checkAndUpdateElementValue(view, def, 7, v7)) changed = true; if (bindLen > 8 && checkAndUpdateElementValue(view, def, 8, v8)) changed = true; if (bindLen > 9 && checkAndUpdateElementValue(view, def, 9, v9)) changed = true; return changed; } /** * @param {?} view * @param {?} def * @param {?} values * @return {?} */ function checkAndUpdateElementDynamic(view, def, values) { var /** @type {?} */ changed = false; for (var /** @type {?} */ i = 0; i < values.length; i++) { if (checkAndUpdateElementValue(view, def, i, values[i])) changed = true; } return changed; } /** * @param {?} view * @param {?} def * @param {?} bindingIdx * @param {?} value * @return {?} */ function checkAndUpdateElementValue(view, def, bindingIdx, value) { if (!checkAndUpdateBinding(view, def, bindingIdx, value)) { return false; } var /** @type {?} */ binding = def.bindings[bindingIdx]; var /** @type {?} */ elData = asElementData(view, def.index); var /** @type {?} */ renderNode$$1 = elData.renderElement; var /** @type {?} */ name = ((binding.name)); switch (binding.flags & 15 /* Types */) { case 1 /* TypeElementAttribute */: setElementAttribute(view, binding, renderNode$$1, binding.ns, name, value); break; case 2 /* TypeElementClass */: setElementClass(view, renderNode$$1, name, value); break; case 4 /* TypeElementStyle */: setElementStyle(view, binding, renderNode$$1, name, value); break; case 8 /* TypeProperty */: var /** @type {?} */ bindView = (def.flags & 16777216 /* ComponentView */ && binding.flags & 32 /* SyntheticHostProperty */) ? elData.componentView : view; setElementProperty(bindView, binding, renderNode$$1, name, value); break; } return true; } /** * @param {?} view * @param {?} binding * @param {?} renderNode * @param {?} ns * @param {?} name * @param {?} value * @return {?} */ function setElementAttribute(view, binding, renderNode$$1, ns, name, value) { var /** @type {?} */ securityContext = binding.securityContext; var /** @type {?} */ renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value; renderValue = renderValue != null ? renderValue.toString() : null; var /** @type {?} */ renderer = view.renderer; if (value != null) { renderer.setAttribute(renderNode$$1, name, renderValue, ns); } else { renderer.removeAttribute(renderNode$$1, name, ns); } } /** * @param {?} view * @param {?} renderNode * @param {?} name * @param {?} value * @return {?} */ function setElementClass(view, renderNode$$1, name, value) { var /** @type {?} */ renderer = view.renderer; if (value) { renderer.addClass(renderNode$$1, name); } else { renderer.removeClass(renderNode$$1, name); } } /** * @param {?} view * @param {?} binding * @param {?} renderNode * @param {?} name * @param {?} value * @return {?} */ function setElementStyle(view, binding, renderNode$$1, name, value) { var /** @type {?} */ renderValue = view.root.sanitizer.sanitize(SecurityContext.STYLE, /** @type {?} */ (value)); if (renderValue != null) { renderValue = renderValue.toString(); var /** @type {?} */ unit = binding.suffix; if (unit != null) { renderValue = renderValue + unit; } } else { renderValue = null; } var /** @type {?} */ renderer = view.renderer; if (renderValue != null) { renderer.setStyle(renderNode$$1, name, renderValue); } else { renderer.removeStyle(renderNode$$1, name); } } /** * @param {?} view * @param {?} binding * @param {?} renderNode * @param {?} name * @param {?} value * @return {?} */ function setElementProperty(view, binding, renderNode$$1, name, value) { var /** @type {?} */ securityContext = binding.securityContext; var /** @type {?} */ renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value; view.renderer.setProperty(renderNode$$1, name, renderValue); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} ngContentIndex * @param {?} index * @return {?} */ function ngContentDef(ngContentIndex, index) { return { // will bet set by the view definition index: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values flags: 4 /* TypeNgContent */, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: {}, matchedQueryIds: 0, references: {}, ngContentIndex: ngContentIndex, childCount: 0, bindings: [], bindingFlags: 0, outputs: [], element: null, provider: null, text: null, query: null, ngContent: { index: index } }; } /** * @param {?} view * @param {?} renderHost * @param {?} def * @return {?} */ function appendNgContent(view, renderHost, def) { var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def); if (!parentEl) { // Nothing to do if there is no parent element. return; } var /** @type {?} */ ngContentIndex = ((def.ngContent)).index; visitProjectedRenderNodes(view, ngContentIndex, 1 /* AppendChild */, parentEl, null, undefined); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} parentView * @param {?} elementData * @param {?} viewIndex * @param {?} view * @return {?} */ function attachEmbeddedView(parentView, elementData, viewIndex, view) { var /** @type {?} */ embeddedViews = ((elementData.viewContainer))._embeddedViews; if (viewIndex === null || viewIndex === undefined) { viewIndex = embeddedViews.length; } view.viewContainerParent = parentView; addToArray(embeddedViews, /** @type {?} */ ((viewIndex)), view); var /** @type {?} */ dvcElementData = declaredViewContainer(view); if (dvcElementData && dvcElementData !== elementData) { var /** @type {?} */ projectedViews = dvcElementData.template._projectedViews; if (!projectedViews) { projectedViews = dvcElementData.template._projectedViews = []; } projectedViews.push(view); } Services.dirtyParentQueries(view); var /** @type {?} */ prevView = ((viewIndex)) > 0 ? embeddedViews[((viewIndex)) - 1] : null; renderAttachEmbeddedView(elementData, prevView, view); } /** * @param {?} elementData * @param {?=} viewIndex * @return {?} */ function detachEmbeddedView(elementData, viewIndex) { var /** @type {?} */ embeddedViews = ((elementData.viewContainer))._embeddedViews; if (viewIndex == null || viewIndex >= embeddedViews.length) { viewIndex = embeddedViews.length - 1; } if (viewIndex < 0) { return null; } var /** @type {?} */ view = embeddedViews[viewIndex]; view.viewContainerParent = null; removeFromArray(embeddedViews, viewIndex); var /** @type {?} */ dvcElementData = declaredViewContainer(view); if (dvcElementData && dvcElementData !== elementData) { var /** @type {?} */ projectedViews = dvcElementData.template._projectedViews; removeFromArray(projectedViews, projectedViews.indexOf(view)); } Services.dirtyParentQueries(view); renderDetachView(view); return view; } /** * @param {?} elementData * @param {?} oldViewIndex * @param {?} newViewIndex * @return {?} */ function moveEmbeddedView(elementData, oldViewIndex, newViewIndex) { var /** @type {?} */ embeddedViews = ((elementData.viewContainer))._embeddedViews; var /** @type {?} */ view = embeddedViews[oldViewIndex]; removeFromArray(embeddedViews, oldViewIndex); if (newViewIndex == null) { newViewIndex = embeddedViews.length; } addToArray(embeddedViews, newViewIndex, view); // Note: Don't need to change projectedViews as the order in there // as always invalid... Services.dirtyParentQueries(view); renderDetachView(view); var /** @type {?} */ prevView = newViewIndex > 0 ? embeddedViews[newViewIndex - 1] : null; renderAttachEmbeddedView(elementData, prevView, view); return view; } /** * @param {?} elementData * @param {?} prevView * @param {?} view * @return {?} */ function renderAttachEmbeddedView(elementData, prevView, view) { var /** @type {?} */ prevRenderNode = prevView ? renderNode(prevView, /** @type {?} */ ((prevView.def.lastRenderRootNode))) : elementData.renderElement; var /** @type {?} */ parentNode = view.renderer.parentNode(prevRenderNode); var /** @type {?} */ nextSibling = view.renderer.nextSibling(prevRenderNode); // Note: We can't check if `nextSibling` is present, as on WebWorkers it will always be! // However, browsers automatically do `appendChild` when there is no `nextSibling`. visitRootRenderNodes(view, 2 /* InsertBefore */, parentNode, nextSibling, undefined); } /** * @param {?} view * @return {?} */ function renderDetachView(view) { visitRootRenderNodes(view, 3 /* RemoveChild */, null, null, undefined); } /** * @param {?} arr * @param {?} index * @param {?} value * @return {?} */ function addToArray(arr, index, value) { // perf: array.push is faster than array.splice! if (index >= arr.length) { arr.push(value); } else { arr.splice(index, 0, value); } } /** * @param {?} arr * @param {?} index * @return {?} */ function removeFromArray(arr, index) { // perf: array.pop is faster than array.splice! if (index >= arr.length - 1) { arr.pop(); } else { arr.splice(index, 1); } } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var EMPTY_CONTEXT = new Object(); /** * @param {?} selector * @param {?} componentType * @param {?} viewDefFactory * @param {?} inputs * @param {?} outputs * @param {?} ngContentSelectors * @return {?} */ function createComponentFactory(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors) { return new ComponentFactory_(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors); } /** * @param {?} componentFactory * @return {?} */ function getComponentViewDefinitionFactory(componentFactory) { return ((componentFactory)).viewDefFactory; } var ComponentFactory_ = (function (_super) { __extends(ComponentFactory_, _super); /** * @param {?} selector * @param {?} componentType * @param {?} viewDefFactory * @param {?} _inputs * @param {?} _outputs * @param {?} ngContentSelectors */ function ComponentFactory_(selector, componentType, viewDefFactory, _inputs, _outputs, ngContentSelectors) { var _this = // Attention: this ctor is called as top level function. // Putting any logic in here will destroy closure tree shaking! _super.call(this) || this; _this.selector = selector; _this.componentType = componentType; _this._inputs = _inputs; _this._outputs = _outputs; _this.ngContentSelectors = ngContentSelectors; _this.viewDefFactory = viewDefFactory; return _this; } Object.defineProperty(ComponentFactory_.prototype, "inputs", { /** * @return {?} */ get: function () { var /** @type {?} */ inputsArr = []; var /** @type {?} */ inputs = ((this._inputs)); for (var /** @type {?} */ propName in inputs) { var /** @type {?} */ templateName = inputs[propName]; inputsArr.push({ propName: propName, templateName: templateName }); } return inputsArr; }, enumerable: true, configurable: true }); Object.defineProperty(ComponentFactory_.prototype, "outputs", { /** * @return {?} */ get: function () { var /** @type {?} */ outputsArr = []; for (var /** @type {?} */ propName in this._outputs) { var /** @type {?} */ templateName = this._outputs[propName]; outputsArr.push({ propName: propName, templateName: templateName }); } return outputsArr; }, enumerable: true, configurable: true }); /** * Creates a new component. * @param {?} injector * @param {?=} projectableNodes * @param {?=} rootSelectorOrNode * @param {?=} ngModule * @return {?} */ ComponentFactory_.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) { if (!ngModule) { throw new Error('ngModule should be provided'); } var /** @type {?} */ viewDef = resolveViewDefinition(this.viewDefFactory); var /** @type {?} */ componentNodeIndex = ((((viewDef.nodes[0].element)).componentProvider)).index; var /** @type {?} */ view = Services.createRootView(injector, projectableNodes || [], rootSelectorOrNode, viewDef, ngModule, EMPTY_CONTEXT); var /** @type {?} */ component = asProviderData(view, componentNodeIndex).instance; if (rootSelectorOrNode) { view.renderer.setAttribute(asElementData(view, 0).renderElement, 'ng-version', VERSION.full); } return new ComponentRef_(view, new ViewRef_(view), component); }; return ComponentFactory_; }(ComponentFactory)); var ComponentRef_ = (function (_super) { __extends(ComponentRef_, _super); /** * @param {?} _view * @param {?} _viewRef * @param {?} _component */ function ComponentRef_(_view, _viewRef, _component) { var _this = _super.call(this) || this; _this._view = _view; _this._viewRef = _viewRef; _this._component = _component; _this._elDef = _this._view.def.nodes[0]; return _this; } Object.defineProperty(ComponentRef_.prototype, "location", { /** * @return {?} */ get: function () { return new ElementRef(asElementData(this._view, this._elDef.index).renderElement); }, enumerable: true, configurable: true }); Object.defineProperty(ComponentRef_.prototype, "injector", { /** * @return {?} */ get: function () { return new Injector_(this._view, this._elDef); }, enumerable: true, configurable: true }); Object.defineProperty(ComponentRef_.prototype, "instance", { /** * @return {?} */ get: function () { return this._component; }, enumerable: true, configurable: true }); ; Object.defineProperty(ComponentRef_.prototype, "hostView", { /** * @return {?} */ get: function () { return this._viewRef; }, enumerable: true, configurable: true }); ; Object.defineProperty(ComponentRef_.prototype, "changeDetectorRef", { /** * @return {?} */ get: function () { return this._viewRef; }, enumerable: true, configurable: true }); ; Object.defineProperty(ComponentRef_.prototype, "componentType", { /** * @return {?} */ get: function () { return (this._component.constructor); }, enumerable: true, configurable: true }); /** * @return {?} */ ComponentRef_.prototype.destroy = function () { this._viewRef.destroy(); }; /** * @param {?} callback * @return {?} */ ComponentRef_.prototype.onDestroy = function (callback) { this._viewRef.onDestroy(callback); }; return ComponentRef_; }(ComponentRef)); /** * @param {?} view * @param {?} elDef * @param {?} elData * @return {?} */ function createViewContainerData(view, elDef, elData) { return new ViewContainerRef_(view, elDef, elData); } var ViewContainerRef_ = (function () { /** * @param {?} _view * @param {?} _elDef * @param {?} _data */ function ViewContainerRef_(_view, _elDef, _data) { this._view = _view; this._elDef = _elDef; this._data = _data; /** * \@internal */ this._embeddedViews = []; } Object.defineProperty(ViewContainerRef_.prototype, "element", { /** * @return {?} */ get: function () { return new ElementRef(this._data.renderElement); }, enumerable: true, configurable: true }); Object.defineProperty(ViewContainerRef_.prototype, "injector", { /** * @return {?} */ get: function () { return new Injector_(this._view, this._elDef); }, enumerable: true, configurable: true }); Object.defineProperty(ViewContainerRef_.prototype, "parentInjector", { /** * @return {?} */ get: function () { var /** @type {?} */ view = this._view; var /** @type {?} */ elDef = this._elDef.parent; while (!elDef && view) { elDef = viewParentEl(view); view = ((view.parent)); } return view ? new Injector_(view, elDef) : new Injector_(this._view, null); }, enumerable: true, configurable: true }); /** * @return {?} */ ViewContainerRef_.prototype.clear = function () { var /** @type {?} */ len = this._embeddedViews.length; for (var /** @type {?} */ i = len - 1; i >= 0; i--) { var /** @type {?} */ view = ((detachEmbeddedView(this._data, i))); Services.destroyView(view); } }; /** * @param {?} index * @return {?} */ ViewContainerRef_.prototype.get = function (index) { var /** @type {?} */ view = this._embeddedViews[index]; if (view) { var /** @type {?} */ ref = new ViewRef_(view); ref.attachToViewContainerRef(this); return ref; } return null; }; Object.defineProperty(ViewContainerRef_.prototype, "length", { /** * @return {?} */ get: function () { return this._embeddedViews.length; }, enumerable: true, configurable: true }); ; /** * @template C * @param {?} templateRef * @param {?=} context * @param {?=} index * @return {?} */ ViewContainerRef_.prototype.createEmbeddedView = function (templateRef, context, index) { var /** @type {?} */ viewRef = templateRef.createEmbeddedView(context || ({})); this.insert(viewRef, index); return viewRef; }; /** * @template C * @param {?} componentFactory * @param {?=} index * @param {?=} injector * @param {?=} projectableNodes * @param {?=} ngModuleRef * @return {?} */ ViewContainerRef_.prototype.createComponent = function (componentFactory, index, injector, projectableNodes, ngModuleRef) { var /** @type {?} */ contextInjector = injector || this.parentInjector; if (!ngModuleRef && !(componentFactory instanceof ComponentFactoryBoundToModule)) { ngModuleRef = contextInjector.get(NgModuleRef); } var /** @type {?} */ componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef); this.insert(componentRef.hostView, index); return componentRef; }; /** * @param {?} viewRef * @param {?=} index * @return {?} */ ViewContainerRef_.prototype.insert = function (viewRef, index) { var /** @type {?} */ viewRef_ = (viewRef); var /** @type {?} */ viewData = viewRef_._view; attachEmbeddedView(this._view, this._data, index, viewData); viewRef_.attachToViewContainerRef(this); return viewRef; }; /** * @param {?} viewRef * @param {?} currentIndex * @return {?} */ ViewContainerRef_.prototype.move = function (viewRef, currentIndex) { var /** @type {?} */ previousIndex = this._embeddedViews.indexOf(viewRef._view); moveEmbeddedView(this._data, previousIndex, currentIndex); return viewRef; }; /** * @param {?} viewRef * @return {?} */ ViewContainerRef_.prototype.indexOf = function (viewRef) { return this._embeddedViews.indexOf(((viewRef))._view); }; /** * @param {?=} index * @return {?} */ ViewContainerRef_.prototype.remove = function (index) { var /** @type {?} */ viewData = detachEmbeddedView(this._data, index); if (viewData) { Services.destroyView(viewData); } }; /** * @param {?=} index * @return {?} */ ViewContainerRef_.prototype.detach = function (index) { var /** @type {?} */ view = detachEmbeddedView(this._data, index); return view ? new ViewRef_(view) : null; }; return ViewContainerRef_; }()); /** * @param {?} view * @return {?} */ function createChangeDetectorRef(view) { return new ViewRef_(view); } var ViewRef_ = (function () { /** * @param {?} _view */ function ViewRef_(_view) { this._view = _view; this._viewContainerRef = null; this._appRef = null; } Object.defineProperty(ViewRef_.prototype, "rootNodes", { /** * @return {?} */ get: function () { return rootRenderNodes(this._view); }, enumerable: true, configurable: true }); Object.defineProperty(ViewRef_.prototype, "context", { /** * @return {?} */ get: function () { return this._view.context; }, enumerable: true, configurable: true }); Object.defineProperty(ViewRef_.prototype, "destroyed", { /** * @return {?} */ get: function () { return (this._view.state & 16 /* Destroyed */) !== 0; }, enumerable: true, configurable: true }); /** * @return {?} */ ViewRef_.prototype.markForCheck = function () { markParentViewsForCheck(this._view); }; /** * @return {?} */ ViewRef_.prototype.detach = function () { this._view.state &= ~4 /* Attached */; }; /** * @return {?} */ ViewRef_.prototype.detectChanges = function () { Services.checkAndUpdateView(this._view); }; /** * @return {?} */ ViewRef_.prototype.checkNoChanges = function () { Services.checkNoChangesView(this._view); }; /** * @return {?} */ ViewRef_.prototype.reattach = function () { this._view.state |= 4 /* Attached */; }; /** * @param {?} callback * @return {?} */ ViewRef_.prototype.onDestroy = function (callback) { if (!this._view.disposables) { this._view.disposables = []; } this._view.disposables.push(/** @type {?} */ (callback)); }; /** * @return {?} */ ViewRef_.prototype.destroy = function () { if (this._appRef) { this._appRef.detachView(this); } else if (this._viewContainerRef) { this._viewContainerRef.detach(this._viewContainerRef.indexOf(this)); } Services.destroyView(this._view); }; /** * @return {?} */ ViewRef_.prototype.detachFromAppRef = function () { this._appRef = null; renderDetachView(this._view); Services.dirtyParentQueries(this._view); }; /** * @param {?} appRef * @return {?} */ ViewRef_.prototype.attachToAppRef = function (appRef) { if (this._viewContainerRef) { throw new Error('This view is already attached to a ViewContainer!'); } this._appRef = appRef; }; /** * @param {?} vcRef * @return {?} */ ViewRef_.prototype.attachToViewContainerRef = function (vcRef) { if (this._appRef) { throw new Error('This view is already attached directly to the ApplicationRef!'); } this._viewContainerRef = vcRef; }; return ViewRef_; }()); /** * @param {?} view * @param {?} def * @return {?} */ function createTemplateData(view, def) { return new TemplateRef_(view, def); } var TemplateRef_ = (function (_super) { __extends(TemplateRef_, _super); /** * @param {?} _parentView * @param {?} _def */ function TemplateRef_(_parentView, _def) { var _this = _super.call(this) || this; _this._parentView = _parentView; _this._def = _def; return _this; } /** * @param {?} context * @return {?} */ TemplateRef_.prototype.createEmbeddedView = function (context) { return new ViewRef_(Services.createEmbeddedView(this._parentView, this._def, context)); }; Object.defineProperty(TemplateRef_.prototype, "elementRef", { /** * @return {?} */ get: function () { return new ElementRef(asElementData(this._parentView, this._def.index).renderElement); }, enumerable: true, configurable: true }); return TemplateRef_; }(TemplateRef)); /** * @param {?} view * @param {?} elDef * @return {?} */ function createInjector(view, elDef) { return new Injector_(view, elDef); } var Injector_ = (function () { /** * @param {?} view * @param {?} elDef */ function Injector_(view, elDef) { this.view = view; this.elDef = elDef; } /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ Injector_.prototype.get = function (token, notFoundValue) { if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; } var /** @type {?} */ allowPrivateServices = this.elDef ? (this.elDef.flags & 16777216 /* ComponentView */) !== 0 : false; return Services.resolveDep(this.view, this.elDef, allowPrivateServices, { flags: 0 /* None */, token: token, tokenKey: tokenKey(token) }, notFoundValue); }; return Injector_; }()); /** * @param {?} view * @param {?} index * @return {?} */ function nodeValue(view, index) { var /** @type {?} */ def = view.def.nodes[index]; if (def.flags & 1 /* TypeElement */) { var /** @type {?} */ elData = asElementData(view, def.index); return ((def.element)).template ? elData.template : elData.renderElement; } else if (def.flags & 2 /* TypeText */) { return asTextData(view, def.index).renderText; } else if (def.flags & (10112 /* CatProvider */ | 8 /* TypePipe */)) { return asProviderData(view, def.index).instance; } throw new Error("Illegal state: read nodeValue for node index " + index); } /** * @param {?} view * @return {?} */ function createRendererV1(view) { return new RendererAdapter(view.renderer); } var RendererAdapter = (function () { /** * @param {?} delegate */ function RendererAdapter(delegate) { this.delegate = delegate; } /** * @param {?} selectorOrNode * @return {?} */ RendererAdapter.prototype.selectRootElement = function (selectorOrNode) { return this.delegate.selectRootElement(selectorOrNode); }; /** * @param {?} parent * @param {?} namespaceAndName * @return {?} */ RendererAdapter.prototype.createElement = function (parent, namespaceAndName) { var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1]; var /** @type {?} */ el = this.delegate.createElement(name, ns); if (parent) { this.delegate.appendChild(parent, el); } return el; }; /** * @param {?} hostElement * @return {?} */ RendererAdapter.prototype.createViewRoot = function (hostElement) { return hostElement; }; /** * @param {?} parentElement * @return {?} */ RendererAdapter.prototype.createTemplateAnchor = function (parentElement) { var /** @type {?} */ comment = this.delegate.createComment(''); if (parentElement) { this.delegate.appendChild(parentElement, comment); } return comment; }; /** * @param {?} parentElement * @param {?} value * @return {?} */ RendererAdapter.prototype.createText = function (parentElement, value) { var /** @type {?} */ node = this.delegate.createText(value); if (parentElement) { this.delegate.appendChild(parentElement, node); } return node; }; /** * @param {?} parentElement * @param {?} nodes * @return {?} */ RendererAdapter.prototype.projectNodes = function (parentElement, nodes) { for (var /** @type {?} */ i = 0; i < nodes.length; i++) { this.delegate.appendChild(parentElement, nodes[i]); } }; /** * @param {?} node * @param {?} viewRootNodes * @return {?} */ RendererAdapter.prototype.attachViewAfter = function (node, viewRootNodes) { var /** @type {?} */ parentElement = this.delegate.parentNode(node); var /** @type {?} */ nextSibling = this.delegate.nextSibling(node); for (var /** @type {?} */ i = 0; i < viewRootNodes.length; i++) { this.delegate.insertBefore(parentElement, viewRootNodes[i], nextSibling); } }; /** * @param {?} viewRootNodes * @return {?} */ RendererAdapter.prototype.detachView = function (viewRootNodes) { for (var /** @type {?} */ i = 0; i < viewRootNodes.length; i++) { var /** @type {?} */ node = viewRootNodes[i]; var /** @type {?} */ parentElement = this.delegate.parentNode(node); this.delegate.removeChild(parentElement, node); } }; /** * @param {?} hostElement * @param {?} viewAllNodes * @return {?} */ RendererAdapter.prototype.destroyView = function (hostElement, viewAllNodes) { for (var /** @type {?} */ i = 0; i < viewAllNodes.length; i++) { ((this.delegate.destroyNode))(viewAllNodes[i]); } }; /** * @param {?} renderElement * @param {?} name * @param {?} callback * @return {?} */ RendererAdapter.prototype.listen = function (renderElement, name, callback) { return this.delegate.listen(renderElement, name, /** @type {?} */ (callback)); }; /** * @param {?} target * @param {?} name * @param {?} callback * @return {?} */ RendererAdapter.prototype.listenGlobal = function (target, name, callback) { return this.delegate.listen(target, name, /** @type {?} */ (callback)); }; /** * @param {?} renderElement * @param {?} propertyName * @param {?} propertyValue * @return {?} */ RendererAdapter.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) { this.delegate.setProperty(renderElement, propertyName, propertyValue); }; /** * @param {?} renderElement * @param {?} namespaceAndName * @param {?} attributeValue * @return {?} */ RendererAdapter.prototype.setElementAttribute = function (renderElement, namespaceAndName, attributeValue) { var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1]; if (attributeValue != null) { this.delegate.setAttribute(renderElement, name, attributeValue, ns); } else { this.delegate.removeAttribute(renderElement, name, ns); } }; /** * @param {?} renderElement * @param {?} propertyName * @param {?} propertyValue * @return {?} */ RendererAdapter.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) { }; /** * @param {?} renderElement * @param {?} className * @param {?} isAdd * @return {?} */ RendererAdapter.prototype.setElementClass = function (renderElement, className, isAdd) { if (isAdd) { this.delegate.addClass(renderElement, className); } else { this.delegate.removeClass(renderElement, className); } }; /** * @param {?} renderElement * @param {?} styleName * @param {?} styleValue * @return {?} */ RendererAdapter.prototype.setElementStyle = function (renderElement, styleName, styleValue) { if (styleValue != null) { this.delegate.setStyle(renderElement, styleName, styleValue); } else { this.delegate.removeStyle(renderElement, styleName); } }; /** * @param {?} renderElement * @param {?} methodName * @param {?} args * @return {?} */ RendererAdapter.prototype.invokeElementMethod = function (renderElement, methodName, args) { ((renderElement))[methodName].apply(renderElement, args); }; /** * @param {?} renderNode * @param {?} text * @return {?} */ RendererAdapter.prototype.setText = function (renderNode$$1, text) { this.delegate.setValue(renderNode$$1, text); }; /** * @return {?} */ RendererAdapter.prototype.animate = function () { throw new Error('Renderer.animate is no longer supported!'); }; return RendererAdapter; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var RendererV1TokenKey = tokenKey(Renderer); var Renderer2TokenKey = tokenKey(Renderer2); var ElementRefTokenKey = tokenKey(ElementRef); var ViewContainerRefTokenKey = tokenKey(ViewContainerRef); var TemplateRefTokenKey = tokenKey(TemplateRef); var ChangeDetectorRefTokenKey = tokenKey(ChangeDetectorRef); var InjectorRefTokenKey = tokenKey(Injector); var NOT_CREATED = new Object(); /** * @param {?} flags * @param {?} matchedQueries * @param {?} childCount * @param {?} ctor * @param {?} deps * @param {?=} props * @param {?=} outputs * @return {?} */ function directiveDef(flags, matchedQueries, childCount, ctor, deps, props, outputs) { var /** @type {?} */ bindings = []; if (props) { for (var /** @type {?} */ prop in props) { var _a = props[prop], bindingIndex = _a[0], nonMinifiedName = _a[1]; bindings[bindingIndex] = { flags: 8 /* TypeProperty */, name: prop, nonMinifiedName: nonMinifiedName, ns: null, securityContext: null, suffix: null }; } } var /** @type {?} */ outputDefs = []; if (outputs) { for (var /** @type {?} */ propName in outputs) { outputDefs.push({ type: 1 /* DirectiveOutput */, propName: propName, target: null, eventName: outputs[propName] }); } } flags |= 8192 /* TypeDirective */; return _def(flags, matchedQueries, childCount, ctor, ctor, deps, bindings, outputDefs); } /** * @param {?} flags * @param {?} ctor * @param {?} deps * @return {?} */ function pipeDef(flags, ctor, deps) { flags |= 8 /* TypePipe */; return _def(flags, null, 0, ctor, ctor, deps); } /** * @param {?} flags * @param {?} matchedQueries * @param {?} token * @param {?} value * @param {?} deps * @return {?} */ function providerDef(flags, matchedQueries, token, value, deps) { return _def(flags, matchedQueries, 0, token, value, deps); } /** * @param {?} flags * @param {?} matchedQueriesDsl * @param {?} childCount * @param {?} token * @param {?} value * @param {?} deps * @param {?=} bindings * @param {?=} outputs * @return {?} */ function _def(flags, matchedQueriesDsl, childCount, token, value, deps, bindings, outputs) { var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds; if (!outputs) { outputs = []; } if (!bindings) { bindings = []; } var /** @type {?} */ depDefs = deps.map(function (value) { var /** @type {?} */ token; var /** @type {?} */ flags; if (Array.isArray(value)) { flags = value[0], token = value[1]; } else { flags = 0 /* None */; token = value; } return { flags: flags, token: token, tokenKey: tokenKey(token) }; }); return { // will bet set by the view definition index: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values flags: flags, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: -1, childCount: childCount, bindings: bindings, bindingFlags: calcBindingFlags(bindings), outputs: outputs, element: null, provider: { token: token, tokenKey: tokenKey(token), value: value, deps: depDefs }, text: null, query: null, ngContent: null }; } /** * @param {?} view * @param {?} def * @return {?} */ function createProviderInstance(view, def) { return def.flags & 2048 /* LazyProvider */ ? NOT_CREATED : _createProviderInstance(view, def); } /** * @param {?} view * @param {?} def * @return {?} */ function createPipeInstance(view, def) { // deps are looked up from component. var /** @type {?} */ compView = view; while (compView.parent && !isComponentView(compView)) { compView = compView.parent; } // pipes can see the private services of the component var /** @type {?} */ allowPrivateServices = true; // pipes are always eager and classes! return createClass(/** @type {?} */ ((compView.parent)), /** @type {?} */ ((viewParentEl(compView))), allowPrivateServices, /** @type {?} */ ((def.provider)).value, /** @type {?} */ ((def.provider)).deps); } /** * @param {?} view * @param {?} def * @return {?} */ function createDirectiveInstance(view, def) { // components can see other private services, other directives can't. var /** @type {?} */ allowPrivateServices = (def.flags & 16384 /* Component */) > 0; // directives are always eager and classes! var /** @type {?} */ instance = createClass(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((def.provider)).value, /** @type {?} */ ((def.provider)).deps); if (def.outputs.length) { for (var /** @type {?} */ i = 0; i < def.outputs.length; i++) { var /** @type {?} */ output = def.outputs[i]; var /** @type {?} */ subscription = instance[((output.propName))].subscribe(eventHandlerClosure(view, /** @type {?} */ ((def.parent)).index, output.eventName)); /** @type {?} */ ((view.disposables))[def.outputIndex + i] = subscription.unsubscribe.bind(subscription); } } return instance; } /** * @param {?} view * @param {?} index * @param {?} eventName * @return {?} */ function eventHandlerClosure(view, index, eventName) { return function (event) { try { return dispatchEvent(view, index, eventName, event); } catch (e) { // Attention: Don't rethrow, as it would cancel Observable subscriptions! view.root.errorHandler.handleError(e); } }; } /** * @param {?} view * @param {?} def * @param {?} v0 * @param {?} v1 * @param {?} v2 * @param {?} v3 * @param {?} v4 * @param {?} v5 * @param {?} v6 * @param {?} v7 * @param {?} v8 * @param {?} v9 * @return {?} */ function checkAndUpdateDirectiveInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { var /** @type {?} */ providerData = asProviderData(view, def.index); var /** @type {?} */ directive = providerData.instance; var /** @type {?} */ changed = false; var /** @type {?} */ changes = ((undefined)); var /** @type {?} */ bindLen = def.bindings.length; if (bindLen > 0 && checkBinding(view, def, 0, v0)) { changed = true; changes = updateProp(view, providerData, def, 0, v0, changes); } if (bindLen > 1 && checkBinding(view, def, 1, v1)) { changed = true; changes = updateProp(view, providerData, def, 1, v1, changes); } if (bindLen > 2 && checkBinding(view, def, 2, v2)) { changed = true; changes = updateProp(view, providerData, def, 2, v2, changes); } if (bindLen > 3 && checkBinding(view, def, 3, v3)) { changed = true; changes = updateProp(view, providerData, def, 3, v3, changes); } if (bindLen > 4 && checkBinding(view, def, 4, v4)) { changed = true; changes = updateProp(view, providerData, def, 4, v4, changes); } if (bindLen > 5 && checkBinding(view, def, 5, v5)) { changed = true; changes = updateProp(view, providerData, def, 5, v5, changes); } if (bindLen > 6 && checkBinding(view, def, 6, v6)) { changed = true; changes = updateProp(view, providerData, def, 6, v6, changes); } if (bindLen > 7 && checkBinding(view, def, 7, v7)) { changed = true; changes = updateProp(view, providerData, def, 7, v7, changes); } if (bindLen > 8 && checkBinding(view, def, 8, v8)) { changed = true; changes = updateProp(view, providerData, def, 8, v8, changes); } if (bindLen > 9 && checkBinding(view, def, 9, v9)) { changed = true; changes = updateProp(view, providerData, def, 9, v9, changes); } if (changes) { directive.ngOnChanges(changes); } if ((view.state & 2 /* FirstCheck */) && (def.flags & 32768 /* OnInit */)) { directive.ngOnInit(); } if (def.flags & 131072 /* DoCheck */) { directive.ngDoCheck(); } return changed; } /** * @param {?} view * @param {?} def * @param {?} values * @return {?} */ function checkAndUpdateDirectiveDynamic(view, def, values) { var /** @type {?} */ providerData = asProviderData(view, def.index); var /** @type {?} */ directive = providerData.instance; var /** @type {?} */ changed = false; var /** @type {?} */ changes = ((undefined)); for (var /** @type {?} */ i = 0; i < values.length; i++) { if (checkBinding(view, def, i, values[i])) { changed = true; changes = updateProp(view, providerData, def, i, values[i], changes); } } if (changes) { directive.ngOnChanges(changes); } if ((view.state & 2 /* FirstCheck */) && (def.flags & 32768 /* OnInit */)) { directive.ngOnInit(); } if (def.flags & 131072 /* DoCheck */) { directive.ngDoCheck(); } return changed; } /** * @param {?} view * @param {?} def * @return {?} */ function _createProviderInstance(view, def) { // private services can see other private services var /** @type {?} */ allowPrivateServices = (def.flags & 4096 /* PrivateProvider */) > 0; var /** @type {?} */ providerDef = def.provider; var /** @type {?} */ injectable; switch (def.flags & 100673535 /* Types */) { case 256 /* TypeClassProvider */: injectable = createClass(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).value, /** @type {?} */ ((providerDef)).deps); break; case 512 /* TypeFactoryProvider */: injectable = callFactory(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).value, /** @type {?} */ ((providerDef)).deps); break; case 1024 /* TypeUseExistingProvider */: injectable = resolveDep(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).deps[0]); break; case 128 /* TypeValueProvider */: injectable = ((providerDef)).value; break; } return injectable; } /** * @param {?} view * @param {?} elDef * @param {?} allowPrivateServices * @param {?} ctor * @param {?} deps * @return {?} */ function createClass(view, elDef, allowPrivateServices, ctor, deps) { var /** @type {?} */ len = deps.length; var /** @type {?} */ injectable; switch (len) { case 0: injectable = new ctor(); break; case 1: injectable = new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0])); break; case 2: injectable = new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1])); break; case 3: injectable = new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2])); break; default: var /** @type {?} */ depValues = new Array(len); for (var /** @type {?} */ i = 0; i < len; i++) { depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]); } injectable = new (ctor.bind.apply(ctor, [void 0].concat(depValues)))(); } return injectable; } /** * @param {?} view * @param {?} elDef * @param {?} allowPrivateServices * @param {?} factory * @param {?} deps * @return {?} */ function callFactory(view, elDef, allowPrivateServices, factory, deps) { var /** @type {?} */ len = deps.length; var /** @type {?} */ injectable; switch (len) { case 0: injectable = factory(); break; case 1: injectable = factory(resolveDep(view, elDef, allowPrivateServices, deps[0])); break; case 2: injectable = factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1])); break; case 3: injectable = factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2])); break; default: var /** @type {?} */ depValues = Array(len); for (var /** @type {?} */ i = 0; i < len; i++) { depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]); } injectable = factory.apply(void 0, depValues); } return injectable; } // This default value is when checking the hierarchy for a token. // // It means both: // - the token is not provided by the current injector, // - only the element injectors should be checked (ie do not check module injectors // // mod1 // / // el1 mod2 // \ / // el2 // // When requesting el2.injector.get(token), we should check in the following order and return the // first found value: // - el2.injector.get(token, default) // - el1.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) -> do not check the module // - mod2.injector.get(token, default) var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {}; /** * @param {?} view * @param {?} elDef * @param {?} allowPrivateServices * @param {?} depDef * @param {?=} notFoundValue * @return {?} */ function resolveDep(view, elDef, allowPrivateServices, depDef, notFoundValue) { if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; } if (depDef.flags & 8 /* Value */) { return depDef.token; } var /** @type {?} */ startView = view; if (depDef.flags & 2 /* Optional */) { notFoundValue = null; } var /** @type {?} */ tokenKey$$1 = depDef.tokenKey; if (tokenKey$$1 === ChangeDetectorRefTokenKey) { // directives on the same element as a component should be able to control the change detector // of that component as well. allowPrivateServices = !!(elDef && ((elDef.element)).componentView); } if (elDef && (depDef.flags & 1 /* SkipSelf */)) { allowPrivateServices = false; elDef = ((elDef.parent)); } while (view) { if (elDef) { switch (tokenKey$$1) { case RendererV1TokenKey: { var /** @type {?} */ compView = findCompView(view, elDef, allowPrivateServices); return createRendererV1(compView); } case Renderer2TokenKey: { var /** @type {?} */ compView = findCompView(view, elDef, allowPrivateServices); return compView.renderer; } case ElementRefTokenKey: return new ElementRef(asElementData(view, elDef.index).renderElement); case ViewContainerRefTokenKey: return asElementData(view, elDef.index).viewContainer; case TemplateRefTokenKey: { if (((elDef.element)).template) { return asElementData(view, elDef.index).template; } break; } case ChangeDetectorRefTokenKey: { var /** @type {?} */ cdView = findCompView(view, elDef, allowPrivateServices); return createChangeDetectorRef(cdView); } case InjectorRefTokenKey: return createInjector(view, elDef); default: var /** @type {?} */ providerDef_1 = (((allowPrivateServices ? ((elDef.element)).allProviders : ((elDef.element)).publicProviders)))[tokenKey$$1]; if (providerDef_1) { var /** @type {?} */ providerData = asProviderData(view, providerDef_1.index); if (providerData.instance === NOT_CREATED) { providerData.instance = _createProviderInstance(view, providerDef_1); } return providerData.instance; } } } allowPrivateServices = isComponentView(view); elDef = ((viewParentEl(view))); view = ((view.parent)); } var /** @type {?} */ value = startView.root.injector.get(depDef.token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR); if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR || notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) { // Return the value from the root element injector when // - it provides it // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) // - the module injector should not be checked // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) return value; } return startView.root.ngModule.injector.get(depDef.token, notFoundValue); } /** * @param {?} view * @param {?} elDef * @param {?} allowPrivateServices * @return {?} */ function findCompView(view, elDef, allowPrivateServices) { var /** @type {?} */ compView; if (allowPrivateServices) { compView = asElementData(view, elDef.index).componentView; } else { compView = view; while (compView.parent && !isComponentView(compView)) { compView = compView.parent; } } return compView; } /** * @param {?} view * @param {?} providerData * @param {?} def * @param {?} bindingIdx * @param {?} value * @param {?} changes * @return {?} */ function updateProp(view, providerData, def, bindingIdx, value, changes) { if (def.flags & 16384 /* Component */) { var /** @type {?} */ compView = asElementData(view, /** @type {?} */ ((def.parent)).index).componentView; if (compView.def.flags & 2 /* OnPush */) { compView.state |= 8 /* ChecksEnabled */; } } var /** @type {?} */ binding = def.bindings[bindingIdx]; var /** @type {?} */ propName = ((binding.name)); // Note: This is still safe with Closure Compiler as // the user passed in the property name as an object has to `providerDef`, // so Closure Compiler will have renamed the property correctly already. providerData.instance[propName] = value; if (def.flags & 262144 /* OnChanges */) { changes = changes || {}; var /** @type {?} */ oldValue = view.oldValues[def.bindingIndex + bindingIdx]; if (oldValue instanceof WrappedValue) { oldValue = oldValue.wrapped; } var /** @type {?} */ binding_1 = def.bindings[bindingIdx]; changes[((binding_1.nonMinifiedName))] = new SimpleChange(oldValue, value, (view.state & 2 /* FirstCheck */) !== 0); } view.oldValues[def.bindingIndex + bindingIdx] = value; return changes; } /** * @param {?} view * @param {?} lifecycles * @return {?} */ function callLifecycleHooksChildrenFirst(view, lifecycles) { if (!(view.def.nodeFlags & lifecycles)) { return; } var /** @type {?} */ nodes = view.def.nodes; for (var /** @type {?} */ i = 0; i < nodes.length; i++) { var /** @type {?} */ nodeDef = nodes[i]; var /** @type {?} */ parent = nodeDef.parent; if (!parent && nodeDef.flags & lifecycles) { // matching root node (e.g. a pipe) callProviderLifecycles(view, i, nodeDef.flags & lifecycles); } if ((nodeDef.childFlags & lifecycles) === 0) { // no child matches one of the lifecycles i += nodeDef.childCount; } while (parent && (parent.flags & 1 /* TypeElement */) && i === parent.index + parent.childCount) { // last child of an element if (parent.directChildFlags & lifecycles) { callElementProvidersLifecycles(view, parent, lifecycles); } parent = parent.parent; } } } /** * @param {?} view * @param {?} elDef * @param {?} lifecycles * @return {?} */ function callElementProvidersLifecycles(view, elDef, lifecycles) { for (var /** @type {?} */ i = elDef.index + 1; i <= elDef.index + elDef.childCount; i++) { var /** @type {?} */ nodeDef = view.def.nodes[i]; if (nodeDef.flags & lifecycles) { callProviderLifecycles(view, i, nodeDef.flags & lifecycles); } // only visit direct children i += nodeDef.childCount; } } /** * @param {?} view * @param {?} index * @param {?} lifecycles * @return {?} */ function callProviderLifecycles(view, index, lifecycles) { var /** @type {?} */ provider = asProviderData(view, index).instance; if (provider === NOT_CREATED) { return; } Services.setCurrentNode(view, index); if (lifecycles & 524288 /* AfterContentInit */) { provider.ngAfterContentInit(); } if (lifecycles & 1048576 /* AfterContentChecked */) { provider.ngAfterContentChecked(); } if (lifecycles & 2097152 /* AfterViewInit */) { provider.ngAfterViewInit(); } if (lifecycles & 4194304 /* AfterViewChecked */) { provider.ngAfterViewChecked(); } if (lifecycles & 65536 /* OnDestroy */) { provider.ngOnDestroy(); } } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} argCount * @return {?} */ function purePipeDef(argCount) { // argCount + 1 to include the pipe as first arg return _pureExpressionDef(64 /* TypePurePipe */, new Array(argCount + 1)); } /** * @param {?} argCount * @return {?} */ function pureArrayDef(argCount) { return _pureExpressionDef(16 /* TypePureArray */, new Array(argCount)); } /** * @param {?} propertyNames * @return {?} */ function pureObjectDef(propertyNames) { return _pureExpressionDef(32 /* TypePureObject */, propertyNames); } /** * @param {?} flags * @param {?} propertyNames * @return {?} */ function _pureExpressionDef(flags, propertyNames) { var /** @type {?} */ bindings = new Array(propertyNames.length); for (var /** @type {?} */ i = 0; i < propertyNames.length; i++) { var /** @type {?} */ prop = propertyNames[i]; bindings[i] = { flags: 8 /* TypeProperty */, name: prop, ns: null, nonMinifiedName: prop, securityContext: null, suffix: null }; } return { // will bet set by the view definition index: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values flags: flags, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: {}, matchedQueryIds: 0, references: {}, ngContentIndex: -1, childCount: 0, bindings: bindings, bindingFlags: calcBindingFlags(bindings), outputs: [], element: null, provider: null, text: null, query: null, ngContent: null }; } /** * @param {?} view * @param {?} def * @return {?} */ function createPureExpression(view, def) { return { value: undefined }; } /** * @param {?} view * @param {?} def * @param {?} v0 * @param {?} v1 * @param {?} v2 * @param {?} v3 * @param {?} v4 * @param {?} v5 * @param {?} v6 * @param {?} v7 * @param {?} v8 * @param {?} v9 * @return {?} */ function checkAndUpdatePureExpressionInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { var /** @type {?} */ bindings = def.bindings; var /** @type {?} */ changed = false; var /** @type {?} */ bindLen = bindings.length; if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0)) changed = true; if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1)) changed = true; if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2)) changed = true; if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3)) changed = true; if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4)) changed = true; if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5)) changed = true; if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6)) changed = true; if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7)) changed = true; if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8)) changed = true; if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9)) changed = true; if (changed) { var /** @type {?} */ data = asPureExpressionData(view, def.index); var /** @type {?} */ value = void 0; switch (def.flags & 100673535 /* Types */) { case 16 /* TypePureArray */: value = new Array(bindings.length); if (bindLen > 0) value[0] = v0; if (bindLen > 1) value[1] = v1; if (bindLen > 2) value[2] = v2; if (bindLen > 3) value[3] = v3; if (bindLen > 4) value[4] = v4; if (bindLen > 5) value[5] = v5; if (bindLen > 6) value[6] = v6; if (bindLen > 7) value[7] = v7; if (bindLen > 8) value[8] = v8; if (bindLen > 9) value[9] = v9; break; case 32 /* TypePureObject */: value = {}; if (bindLen > 0) value[((bindings[0].name))] = v0; if (bindLen > 1) value[((bindings[1].name))] = v1; if (bindLen > 2) value[((bindings[2].name))] = v2; if (bindLen > 3) value[((bindings[3].name))] = v3; if (bindLen > 4) value[((bindings[4].name))] = v4; if (bindLen > 5) value[((bindings[5].name))] = v5; if (bindLen > 6) value[((bindings[6].name))] = v6; if (bindLen > 7) value[((bindings[7].name))] = v7; if (bindLen > 8) value[((bindings[8].name))] = v8; if (bindLen > 9) value[((bindings[9].name))] = v9; break; case 64 /* TypePurePipe */: var /** @type {?} */ pipe = v0; switch (bindLen) { case 1: value = pipe.transform(v0); break; case 2: value = pipe.transform(v1); break; case 3: value = pipe.transform(v1, v2); break; case 4: value = pipe.transform(v1, v2, v3); break; case 5: value = pipe.transform(v1, v2, v3, v4); break; case 6: value = pipe.transform(v1, v2, v3, v4, v5); break; case 7: value = pipe.transform(v1, v2, v3, v4, v5, v6); break; case 8: value = pipe.transform(v1, v2, v3, v4, v5, v6, v7); break; case 9: value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8); break; case 10: value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8, v9); break; } break; } data.value = value; } return changed; } /** * @param {?} view * @param {?} def * @param {?} values * @return {?} */ function checkAndUpdatePureExpressionDynamic(view, def, values) { var /** @type {?} */ bindings = def.bindings; var /** @type {?} */ changed = false; for (var /** @type {?} */ i = 0; i < values.length; i++) { // Note: We need to loop over all values, so that // the old values are updates as well! if (checkAndUpdateBinding(view, def, i, values[i])) { changed = true; } } if (changed) { var /** @type {?} */ data = asPureExpressionData(view, def.index); var /** @type {?} */ value = void 0; switch (def.flags & 100673535 /* Types */) { case 16 /* TypePureArray */: value = values; break; case 32 /* TypePureObject */: value = {}; for (var /** @type {?} */ i = 0; i < values.length; i++) { value[((bindings[i].name))] = values[i]; } break; case 64 /* TypePurePipe */: var /** @type {?} */ pipe = values[0]; var /** @type {?} */ params = values.slice(1); value = pipe.transform.apply(pipe, params); break; } data.value = value; } return changed; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} flags * @param {?} id * @param {?} bindings * @return {?} */ function queryDef(flags, id, bindings) { var /** @type {?} */ bindingDefs = []; for (var /** @type {?} */ propName in bindings) { var /** @type {?} */ bindingType = bindings[propName]; bindingDefs.push({ propName: propName, bindingType: bindingType }); } return { // will bet set by the view definition index: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values flags: flags, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, ngContentIndex: -1, matchedQueries: {}, matchedQueryIds: 0, references: {}, childCount: 0, bindings: [], bindingFlags: 0, outputs: [], element: null, provider: null, text: null, query: { id: id, filterId: filterQueryId(id), bindings: bindingDefs }, ngContent: null }; } /** * @return {?} */ function createQuery() { return new QueryList(); } /** * @param {?} view * @return {?} */ function dirtyParentQueries(view) { var /** @type {?} */ queryIds = view.def.nodeMatchedQueries; while (view.parent && isEmbeddedView(view)) { var /** @type {?} */ tplDef = ((view.parentNodeDef)); view = view.parent; // content queries var /** @type {?} */ end = tplDef.index + tplDef.childCount; for (var /** @type {?} */ i = 0; i <= end; i++) { var /** @type {?} */ nodeDef = view.def.nodes[i]; if ((nodeDef.flags & 33554432 /* TypeContentQuery */) && (nodeDef.flags & 268435456 /* DynamicQuery */) && (((nodeDef.query)).filterId & queryIds) === ((nodeDef.query)).filterId) { asQueryList(view, i).setDirty(); } if ((nodeDef.flags & 1 /* TypeElement */ && i + nodeDef.childCount < tplDef.index) || !(nodeDef.childFlags & 33554432 /* TypeContentQuery */) || !(nodeDef.childFlags & 268435456 /* DynamicQuery */)) { // skip elements that don't contain the template element or no query. i += nodeDef.childCount; } } } // view queries if (view.def.nodeFlags & 67108864 /* TypeViewQuery */) { for (var /** @type {?} */ i = 0; i < view.def.nodes.length; i++) { var /** @type {?} */ nodeDef = view.def.nodes[i]; if ((nodeDef.flags & 67108864 /* TypeViewQuery */) && (nodeDef.flags & 268435456 /* DynamicQuery */)) { asQueryList(view, i).setDirty(); } // only visit the root nodes i += nodeDef.childCount; } } } /** * @param {?} view * @param {?} nodeDef * @return {?} */ function checkAndUpdateQuery(view, nodeDef) { var /** @type {?} */ queryList = asQueryList(view, nodeDef.index); if (!queryList.dirty) { return; } var /** @type {?} */ directiveInstance; var /** @type {?} */ newValues = ((undefined)); if (nodeDef.flags & 33554432 /* TypeContentQuery */) { var /** @type {?} */ elementDef_1 = ((((nodeDef.parent)).parent)); newValues = calcQueryValues(view, elementDef_1.index, elementDef_1.index + elementDef_1.childCount, /** @type {?} */ ((nodeDef.query)), []); directiveInstance = asProviderData(view, /** @type {?} */ ((nodeDef.parent)).index).instance; } else if (nodeDef.flags & 67108864 /* TypeViewQuery */) { newValues = calcQueryValues(view, 0, view.def.nodes.length - 1, /** @type {?} */ ((nodeDef.query)), []); directiveInstance = view.component; } queryList.reset(newValues); var /** @type {?} */ bindings = ((nodeDef.query)).bindings; var /** @type {?} */ notify = false; for (var /** @type {?} */ i = 0; i < bindings.length; i++) { var /** @type {?} */ binding = bindings[i]; var /** @type {?} */ boundValue = void 0; switch (binding.bindingType) { case 0 /* First */: boundValue = queryList.first; break; case 1 /* All */: boundValue = queryList; notify = true; break; } directiveInstance[binding.propName] = boundValue; } if (notify) { queryList.notifyOnChanges(); } } /** * @param {?} view * @param {?} startIndex * @param {?} endIndex * @param {?} queryDef * @param {?} values * @return {?} */ function calcQueryValues(view, startIndex, endIndex, queryDef, values) { for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) { var /** @type {?} */ nodeDef = view.def.nodes[i]; var /** @type {?} */ valueType = nodeDef.matchedQueries[queryDef.id]; if (valueType != null) { values.push(getQueryValue(view, nodeDef, valueType)); } if (nodeDef.flags & 1 /* TypeElement */ && ((nodeDef.element)).template && (((((nodeDef.element)).template)).nodeMatchedQueries & queryDef.filterId) === queryDef.filterId) { // check embedded views that were attached at the place of their template. var /** @type {?} */ elementData = asElementData(view, i); if (nodeDef.flags & 8388608 /* EmbeddedViews */) { var /** @type {?} */ embeddedViews = ((elementData.viewContainer))._embeddedViews; for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) { var /** @type {?} */ embeddedView = embeddedViews[k]; var /** @type {?} */ dvc = declaredViewContainer(embeddedView); if (dvc && dvc === elementData) { calcQueryValues(embeddedView, 0, embeddedView.def.nodes.length - 1, queryDef, values); } } } var /** @type {?} */ projectedViews = elementData.template._projectedViews; if (projectedViews) { for (var /** @type {?} */ k = 0; k < projectedViews.length; k++) { var /** @type {?} */ projectedView = projectedViews[k]; calcQueryValues(projectedView, 0, projectedView.def.nodes.length - 1, queryDef, values); } } } if ((nodeDef.childMatchedQueries & queryDef.filterId) !== queryDef.filterId) { // if no child matches the query, skip the children. i += nodeDef.childCount; } } return values; } /** * @param {?} view * @param {?} nodeDef * @param {?} queryValueType * @return {?} */ function getQueryValue(view, nodeDef, queryValueType) { if (queryValueType != null) { // a match var /** @type {?} */ value = void 0; switch (queryValueType) { case 1 /* RenderElement */: value = asElementData(view, nodeDef.index).renderElement; break; case 0 /* ElementRef */: value = new ElementRef(asElementData(view, nodeDef.index).renderElement); break; case 2 /* TemplateRef */: value = asElementData(view, nodeDef.index).template; break; case 3 /* ViewContainerRef */: value = asElementData(view, nodeDef.index).viewContainer; break; case 4 /* Provider */: value = asProviderData(view, nodeDef.index).instance; break; } return value; } } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} ngContentIndex * @param {?} constants * @return {?} */ function textDef(ngContentIndex, constants) { var /** @type {?} */ bindings = new Array(constants.length - 1); for (var /** @type {?} */ i = 1; i < constants.length; i++) { bindings[i - 1] = { flags: 8 /* TypeProperty */, name: null, ns: null, nonMinifiedName: null, securityContext: null, suffix: constants[i] }; } var /** @type {?} */ flags = 2; return { // will bet set by the view definition index: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values flags: flags, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: {}, matchedQueryIds: 0, references: {}, ngContentIndex: ngContentIndex, childCount: 0, bindings: bindings, bindingFlags: calcBindingFlags(bindings), outputs: [], element: null, provider: null, text: { prefix: constants[0] }, query: null, ngContent: null }; } /** * @param {?} view * @param {?} renderHost * @param {?} def * @return {?} */ function createText(view, renderHost, def) { var /** @type {?} */ renderNode$$1; var /** @type {?} */ renderer = view.renderer; renderNode$$1 = renderer.createText(/** @type {?} */ ((def.text)).prefix); var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def); if (parentEl) { renderer.appendChild(parentEl, renderNode$$1); } return { renderText: renderNode$$1 }; } /** * @param {?} view * @param {?} def * @param {?} v0 * @param {?} v1 * @param {?} v2 * @param {?} v3 * @param {?} v4 * @param {?} v5 * @param {?} v6 * @param {?} v7 * @param {?} v8 * @param {?} v9 * @return {?} */ function checkAndUpdateTextInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { var /** @type {?} */ changed = false; var /** @type {?} */ bindings = def.bindings; var /** @type {?} */ bindLen = bindings.length; if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0)) changed = true; if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1)) changed = true; if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2)) changed = true; if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3)) changed = true; if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4)) changed = true; if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5)) changed = true; if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6)) changed = true; if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7)) changed = true; if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8)) changed = true; if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9)) changed = true; if (changed) { var /** @type {?} */ value = ((def.text)).prefix; if (bindLen > 0) value += _addInterpolationPart(v0, bindings[0]); if (bindLen > 1) value += _addInterpolationPart(v1, bindings[1]); if (bindLen > 2) value += _addInterpolationPart(v2, bindings[2]); if (bindLen > 3) value += _addInterpolationPart(v3, bindings[3]); if (bindLen > 4) value += _addInterpolationPart(v4, bindings[4]); if (bindLen > 5) value += _addInterpolationPart(v5, bindings[5]); if (bindLen > 6) value += _addInterpolationPart(v6, bindings[6]); if (bindLen > 7) value += _addInterpolationPart(v7, bindings[7]); if (bindLen > 8) value += _addInterpolationPart(v8, bindings[8]); if (bindLen > 9) value += _addInterpolationPart(v9, bindings[9]); var /** @type {?} */ renderNode$$1 = asTextData(view, def.index).renderText; view.renderer.setValue(renderNode$$1, value); } return changed; } /** * @param {?} view * @param {?} def * @param {?} values * @return {?} */ function checkAndUpdateTextDynamic(view, def, values) { var /** @type {?} */ bindings = def.bindings; var /** @type {?} */ changed = false; for (var /** @type {?} */ i = 0; i < values.length; i++) { // Note: We need to loop over all values, so that // the old values are updates as well! if (checkAndUpdateBinding(view, def, i, values[i])) { changed = true; } } if (changed) { var /** @type {?} */ value = ''; for (var /** @type {?} */ i = 0; i < values.length; i++) { value = value + _addInterpolationPart(values[i], bindings[i]); } value = ((def.text)).prefix + value; var /** @type {?} */ renderNode$$1 = asTextData(view, def.index).renderText; view.renderer.setValue(renderNode$$1, value); } return changed; } /** * @param {?} value * @param {?} binding * @return {?} */ function _addInterpolationPart(value, binding) { var /** @type {?} */ valueStr = value != null ? value.toString() : ''; return valueStr + binding.suffix; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} flags * @param {?} nodes * @param {?=} updateDirectives * @param {?=} updateRenderer * @return {?} */ function viewDef(flags, nodes, updateDirectives, updateRenderer) { // clone nodes and set auto calculated values var /** @type {?} */ viewBindingCount = 0; var /** @type {?} */ viewDisposableCount = 0; var /** @type {?} */ viewNodeFlags = 0; var /** @type {?} */ viewRootNodeFlags = 0; var /** @type {?} */ viewMatchedQueries = 0; var /** @type {?} */ currentParent = null; var /** @type {?} */ currentElementHasPublicProviders = false; var /** @type {?} */ currentElementHasPrivateProviders = false; var /** @type {?} */ lastRenderRootNode = null; for (var /** @type {?} */ i = 0; i < nodes.length; i++) { while (currentParent && i > currentParent.index + currentParent.childCount) { var /** @type {?} */ newParent = currentParent.parent; if (newParent) { newParent.childFlags |= ((currentParent.childFlags)); newParent.childMatchedQueries |= currentParent.childMatchedQueries; } currentParent = newParent; } var /** @type {?} */ node = nodes[i]; node.index = i; node.parent = currentParent; node.bindingIndex = viewBindingCount; node.outputIndex = viewDisposableCount; // renderParent needs to account for ng-container! var /** @type {?} */ currentRenderParent = void 0; if (currentParent && currentParent.flags & 1 /* TypeElement */ && !((currentParent.element)).name) { currentRenderParent = currentParent.renderParent; } else { currentRenderParent = currentParent; } node.renderParent = currentRenderParent; if (node.element) { var /** @type {?} */ elDef = node.element; elDef.publicProviders = currentParent ? ((currentParent.element)).publicProviders : Object.create(null); elDef.allProviders = elDef.publicProviders; // Note: We assume that all providers of an element are before any child element! currentElementHasPublicProviders = false; currentElementHasPrivateProviders = false; } validateNode(currentParent, node, nodes.length); viewNodeFlags |= node.flags; viewMatchedQueries |= node.matchedQueryIds; if (node.element && node.element.template) { viewMatchedQueries |= node.element.template.nodeMatchedQueries; } if (currentParent) { currentParent.childFlags |= node.flags; currentParent.directChildFlags |= node.flags; currentParent.childMatchedQueries |= node.matchedQueryIds; if (node.element && node.element.template) { currentParent.childMatchedQueries |= node.element.template.nodeMatchedQueries; } } else { viewRootNodeFlags |= node.flags; } viewBindingCount += node.bindings.length; viewDisposableCount += node.outputs.length; if (!currentRenderParent && (node.flags & 3 /* CatRenderNode */)) { lastRenderRootNode = node; } if (node.flags & 10112 /* CatProvider */) { if (!currentElementHasPublicProviders) { currentElementHasPublicProviders = true; /** @type {?} */ (((( // Use prototypical inheritance to not get O(n^2) complexity... currentParent)).element)).publicProviders = Object.create(/** @type {?} */ ((((currentParent)).element)).publicProviders); /** @type {?} */ ((((currentParent)).element)).allProviders = ((((currentParent)).element)).publicProviders; } var /** @type {?} */ isPrivateService = (node.flags & 4096 /* PrivateProvider */) !== 0; var /** @type {?} */ isComponent = (node.flags & 16384 /* Component */) !== 0; if (!isPrivateService || isComponent) { ((((((currentParent)).element)).publicProviders))[((node.provider)).tokenKey] = node; } else { if (!currentElementHasPrivateProviders) { currentElementHasPrivateProviders = true; /** @type {?} */ (((( // Use protoyypical inheritance to not get O(n^2) complexity... currentParent)).element)).allProviders = Object.create(/** @type {?} */ ((((currentParent)).element)).publicProviders); } /** @type {?} */ ((((((currentParent)).element)).allProviders))[((node.provider)).tokenKey] = node; } if (isComponent) { ((((currentParent)).element)).componentProvider = node; } } if (node.childCount) { currentParent = node; } } while (currentParent) { var /** @type {?} */ newParent = currentParent.parent; if (newParent) { newParent.childFlags |= currentParent.childFlags; newParent.childMatchedQueries |= currentParent.childMatchedQueries; } currentParent = newParent; } var /** @type {?} */ handleEvent = function (view, nodeIndex, eventName, event) { return ((((nodes[nodeIndex].element)).handleEvent))(view, eventName, event); }; return { // Will be filled later... factory: null, nodeFlags: viewNodeFlags, rootNodeFlags: viewRootNodeFlags, nodeMatchedQueries: viewMatchedQueries, flags: flags, nodes: nodes, updateDirectives: updateDirectives || NOOP, updateRenderer: updateRenderer || NOOP, handleEvent: handleEvent || NOOP, bindingCount: viewBindingCount, outputCount: viewDisposableCount, lastRenderRootNode: lastRenderRootNode }; } /** * @param {?} parent * @param {?} node * @param {?} nodeCount * @return {?} */ function validateNode(parent, node, nodeCount) { var /** @type {?} */ template = node.element && node.element.template; if (template) { if (!template.lastRenderRootNode) { throw new Error("Illegal State: Embedded templates without nodes are not allowed!"); } if (template.lastRenderRootNode && template.lastRenderRootNode.flags & 8388608 /* EmbeddedViews */) { throw new Error("Illegal State: Last root node of a template can't have embedded views, at index " + node.index + "!"); } } if (node.flags & 10112 /* CatProvider */) { var /** @type {?} */ parentFlags = parent ? parent.flags : 0; if ((parentFlags & 1 /* TypeElement */) === 0) { throw new Error("Illegal State: Provider/Directive nodes need to be children of elements or anchors, at index " + node.index + "!"); } } if (node.query) { if (node.flags & 33554432 /* TypeContentQuery */ && (!parent || (parent.flags & 8192 /* TypeDirective */) === 0)) { throw new Error("Illegal State: Content Query nodes need to be children of directives, at index " + node.index + "!"); } if (node.flags & 67108864 /* TypeViewQuery */ && parent) { throw new Error("Illegal State: View Query nodes have to be top level nodes, at index " + node.index + "!"); } } if (node.childCount) { var /** @type {?} */ parentEnd = parent ? parent.index + parent.childCount : nodeCount - 1; if (node.index <= parentEnd && node.index + node.childCount > parentEnd) { throw new Error("Illegal State: childCount of node leads outside of parent, at index " + node.index + "!"); } } } /** * @param {?} parent * @param {?} anchorDef * @param {?=} context * @return {?} */ function createEmbeddedView(parent, anchorDef$$1, context) { // embedded views are seen as siblings to the anchor, so we need // to get the parent of the anchor and use it as parentIndex. var /** @type {?} */ view = createView(parent.root, parent.renderer, parent, anchorDef$$1, /** @type {?} */ ((((anchorDef$$1.element)).template))); initView(view, parent.component, context); createViewNodes(view); return view; } /** * @param {?} root * @param {?} def * @param {?=} context * @return {?} */ function createRootView(root, def, context) { var /** @type {?} */ view = createView(root, root.renderer, null, null, def); initView(view, context, context); createViewNodes(view); return view; } /** * @param {?} root * @param {?} renderer * @param {?} parent * @param {?} parentNodeDef * @param {?} def * @return {?} */ function createView(root, renderer, parent, parentNodeDef, def) { var /** @type {?} */ nodes = new Array(def.nodes.length); var /** @type {?} */ disposables = def.outputCount ? new Array(def.outputCount) : null; var /** @type {?} */ view = { def: def, parent: parent, viewContainerParent: null, parentNodeDef: parentNodeDef, context: null, component: null, nodes: nodes, state: 13 /* CatInit */, root: root, renderer: renderer, oldValues: new Array(def.bindingCount), disposables: disposables }; return view; } /** * @param {?} view * @param {?} component * @param {?} context * @return {?} */ function initView(view, component, context) { view.component = component; view.context = context; } /** * @param {?} view * @return {?} */ function createViewNodes(view) { var /** @type {?} */ renderHost; if (isComponentView(view)) { var /** @type {?} */ hostDef = view.parentNodeDef; renderHost = asElementData(/** @type {?} */ ((view.parent)), /** @type {?} */ ((((hostDef)).parent)).index).renderElement; } var /** @type {?} */ def = view.def; var /** @type {?} */ nodes = view.nodes; for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) { var /** @type {?} */ nodeDef = def.nodes[i]; Services.setCurrentNode(view, i); var /** @type {?} */ nodeData = void 0; switch (nodeDef.flags & 100673535 /* Types */) { case 1 /* TypeElement */: var /** @type {?} */ el = (createElement(view, renderHost, nodeDef)); var /** @type {?} */ componentView = ((undefined)); if (nodeDef.flags & 16777216 /* ComponentView */) { var /** @type {?} */ compViewDef = resolveViewDefinition(/** @type {?} */ ((((nodeDef.element)).componentView))); var /** @type {?} */ rendererType = ((nodeDef.element)).componentRendererType; var /** @type {?} */ compRenderer = void 0; if (!rendererType) { compRenderer = view.root.renderer; } else { compRenderer = view.root.rendererFactory.createRenderer(el, rendererType); } componentView = createView(view.root, compRenderer, view, /** @type {?} */ ((nodeDef.element)).componentProvider, compViewDef); } listenToElementOutputs(view, componentView, nodeDef, el); nodeData = ({ renderElement: el, componentView: componentView, viewContainer: null, template: /** @type {?} */ ((nodeDef.element)).template ? createTemplateData(view, nodeDef) : undefined }); if (nodeDef.flags & 8388608 /* EmbeddedViews */) { nodeData.viewContainer = createViewContainerData(view, nodeDef, nodeData); } break; case 2 /* TypeText */: nodeData = (createText(view, renderHost, nodeDef)); break; case 256 /* TypeClassProvider */: case 512 /* TypeFactoryProvider */: case 1024 /* TypeUseExistingProvider */: case 128 /* TypeValueProvider */: { var /** @type {?} */ instance = createProviderInstance(view, nodeDef); nodeData = ({ instance: instance }); break; } case 8 /* TypePipe */: { var /** @type {?} */ instance = createPipeInstance(view, nodeDef); nodeData = ({ instance: instance }); break; } case 8192 /* TypeDirective */: { var /** @type {?} */ instance = createDirectiveInstance(view, nodeDef); nodeData = ({ instance: instance }); if (nodeDef.flags & 16384 /* Component */) { var /** @type {?} */ compView = asElementData(view, /** @type {?} */ ((nodeDef.parent)).index).componentView; initView(compView, instance, instance); } break; } case 16 /* TypePureArray */: case 32 /* TypePureObject */: case 64 /* TypePurePipe */: nodeData = (createPureExpression(view, nodeDef)); break; case 33554432 /* TypeContentQuery */: case 67108864 /* TypeViewQuery */: nodeData = (createQuery()); break; case 4 /* TypeNgContent */: appendNgContent(view, renderHost, nodeDef); // no runtime data needed for NgContent... nodeData = undefined; break; } nodes[i] = nodeData; } // Create the ViewData.nodes of component views after we created everything else, // so that e.g. ng-content works execComponentViewsAction(view, ViewAction.CreateViewNodes); // fill static content and view queries execQueriesAction(view, 33554432 /* TypeContentQuery */ | 67108864 /* TypeViewQuery */, 134217728 /* StaticQuery */, 0 /* CheckAndUpdate */); } /** * @param {?} view * @return {?} */ function checkNoChangesView(view) { Services.updateDirectives(view, 1 /* CheckNoChanges */); execEmbeddedViewsAction(view, ViewAction.CheckNoChanges); Services.updateRenderer(view, 1 /* CheckNoChanges */); execComponentViewsAction(view, ViewAction.CheckNoChanges); // Note: We don't check queries for changes as we didn't do this in v2.x. // TODO(tbosch): investigate if we can enable the check again in v5.x with a nicer error message. } /** * @param {?} view * @return {?} */ function checkAndUpdateView(view) { if (view.state & 1 /* BeforeFirstCheck */) { view.state &= ~1 /* BeforeFirstCheck */; view.state |= 2 /* FirstCheck */; } else { view.state &= ~2 /* FirstCheck */; } Services.updateDirectives(view, 0 /* CheckAndUpdate */); execEmbeddedViewsAction(view, ViewAction.CheckAndUpdate); execQueriesAction(view, 33554432 /* TypeContentQuery */, 268435456 /* DynamicQuery */, 0 /* CheckAndUpdate */); callLifecycleHooksChildrenFirst(view, 1048576 /* AfterContentChecked */ | (view.state & 2 /* FirstCheck */ ? 524288 /* AfterContentInit */ : 0)); Services.updateRenderer(view, 0 /* CheckAndUpdate */); execComponentViewsAction(view, ViewAction.CheckAndUpdate); execQueriesAction(view, 67108864 /* TypeViewQuery */, 268435456 /* DynamicQuery */, 0 /* CheckAndUpdate */); callLifecycleHooksChildrenFirst(view, 4194304 /* AfterViewChecked */ | (view.state & 2 /* FirstCheck */ ? 2097152 /* AfterViewInit */ : 0)); if (view.def.flags & 2 /* OnPush */) { view.state &= ~8 /* ChecksEnabled */; } } /** * @param {?} view * @param {?} nodeDef * @param {?} argStyle * @param {?=} v0 * @param {?=} v1 * @param {?=} v2 * @param {?=} v3 * @param {?=} v4 * @param {?=} v5 * @param {?=} v6 * @param {?=} v7 * @param {?=} v8 * @param {?=} v9 * @return {?} */ function checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { if (argStyle === 0 /* Inline */) { return checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); } else { return checkAndUpdateNodeDynamic(view, nodeDef, v0); } } /** * @param {?} view * @param {?} nodeDef * @param {?=} v0 * @param {?=} v1 * @param {?=} v2 * @param {?=} v3 * @param {?=} v4 * @param {?=} v5 * @param {?=} v6 * @param {?=} v7 * @param {?=} v8 * @param {?=} v9 * @return {?} */ function checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { var /** @type {?} */ changed = false; switch (nodeDef.flags & 100673535 /* Types */) { case 1 /* TypeElement */: changed = checkAndUpdateElementInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); break; case 2 /* TypeText */: changed = checkAndUpdateTextInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); break; case 8192 /* TypeDirective */: changed = checkAndUpdateDirectiveInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); break; case 16 /* TypePureArray */: case 32 /* TypePureObject */: case 64 /* TypePurePipe */: changed = checkAndUpdatePureExpressionInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); break; } return changed; } /** * @param {?} view * @param {?} nodeDef * @param {?} values * @return {?} */ function checkAndUpdateNodeDynamic(view, nodeDef, values) { var /** @type {?} */ changed = false; switch (nodeDef.flags & 100673535 /* Types */) { case 1 /* TypeElement */: changed = checkAndUpdateElementDynamic(view, nodeDef, values); break; case 2 /* TypeText */: changed = checkAndUpdateTextDynamic(view, nodeDef, values); break; case 8192 /* TypeDirective */: changed = checkAndUpdateDirectiveDynamic(view, nodeDef, values); break; case 16 /* TypePureArray */: case 32 /* TypePureObject */: case 64 /* TypePurePipe */: changed = checkAndUpdatePureExpressionDynamic(view, nodeDef, values); break; } if (changed) { // Update oldValues after all bindings have been updated, // as a setter for a property might update other properties. var /** @type {?} */ bindLen = nodeDef.bindings.length; var /** @type {?} */ bindingStart = nodeDef.bindingIndex; var /** @type {?} */ oldValues = view.oldValues; for (var /** @type {?} */ i = 0; i < bindLen; i++) { oldValues[bindingStart + i] = values[i]; } } return changed; } /** * @param {?} view * @param {?} nodeDef * @param {?} argStyle * @param {?=} v0 * @param {?=} v1 * @param {?=} v2 * @param {?=} v3 * @param {?=} v4 * @param {?=} v5 * @param {?=} v6 * @param {?=} v7 * @param {?=} v8 * @param {?=} v9 * @return {?} */ function checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { if (argStyle === 0 /* Inline */) { checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); } else { checkNoChangesNodeDynamic(view, nodeDef, v0); } // Returning false is ok here as we would have thrown in case of a change. return false; } /** * @param {?} view * @param {?} nodeDef * @param {?} v0 * @param {?} v1 * @param {?} v2 * @param {?} v3 * @param {?} v4 * @param {?} v5 * @param {?} v6 * @param {?} v7 * @param {?} v8 * @param {?} v9 * @return {?} */ function checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { var /** @type {?} */ bindLen = nodeDef.bindings.length; if (bindLen > 0) checkBindingNoChanges(view, nodeDef, 0, v0); if (bindLen > 1) checkBindingNoChanges(view, nodeDef, 1, v1); if (bindLen > 2) checkBindingNoChanges(view, nodeDef, 2, v2); if (bindLen > 3) checkBindingNoChanges(view, nodeDef, 3, v3); if (bindLen > 4) checkBindingNoChanges(view, nodeDef, 4, v4); if (bindLen > 5) checkBindingNoChanges(view, nodeDef, 5, v5); if (bindLen > 6) checkBindingNoChanges(view, nodeDef, 6, v6); if (bindLen > 7) checkBindingNoChanges(view, nodeDef, 7, v7); if (bindLen > 8) checkBindingNoChanges(view, nodeDef, 8, v8); if (bindLen > 9) checkBindingNoChanges(view, nodeDef, 9, v9); } /** * @param {?} view * @param {?} nodeDef * @param {?} values * @return {?} */ function checkNoChangesNodeDynamic(view, nodeDef, values) { for (var /** @type {?} */ i = 0; i < values.length; i++) { checkBindingNoChanges(view, nodeDef, i, values[i]); } } /** * @param {?} view * @param {?} nodeDef * @return {?} */ function checkNoChangesQuery(view, nodeDef) { var /** @type {?} */ queryList = asQueryList(view, nodeDef.index); if (queryList.dirty) { throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, nodeDef.index), "Query " + ((nodeDef.query)).id + " not dirty", "Query " + ((nodeDef.query)).id + " dirty", (view.state & 1 /* BeforeFirstCheck */) !== 0); } } /** * @param {?} view * @return {?} */ function destroyView(view) { if (view.state & 16 /* Destroyed */) { return; } execEmbeddedViewsAction(view, ViewAction.Destroy); execComponentViewsAction(view, ViewAction.Destroy); callLifecycleHooksChildrenFirst(view, 65536 /* OnDestroy */); if (view.disposables) { for (var /** @type {?} */ i = 0; i < view.disposables.length; i++) { view.disposables[i](); } } if (view.renderer.destroyNode) { destroyViewNodes(view); } if (isComponentView(view)) { view.renderer.destroy(); } view.state |= 16 /* Destroyed */; } /** * @param {?} view * @return {?} */ function destroyViewNodes(view) { var /** @type {?} */ len = view.def.nodes.length; for (var /** @type {?} */ i = 0; i < len; i++) { var /** @type {?} */ def = view.def.nodes[i]; if (def.flags & 1 /* TypeElement */) { ((view.renderer.destroyNode))(asElementData(view, i).renderElement); } else if (def.flags & 2 /* TypeText */) { ((view.renderer.destroyNode))(asTextData(view, i).renderText); } } } var ViewAction = {}; ViewAction.CreateViewNodes = 0; ViewAction.CheckNoChanges = 1; ViewAction.CheckAndUpdate = 2; ViewAction.Destroy = 3; ViewAction[ViewAction.CreateViewNodes] = "CreateViewNodes"; ViewAction[ViewAction.CheckNoChanges] = "CheckNoChanges"; ViewAction[ViewAction.CheckAndUpdate] = "CheckAndUpdate"; ViewAction[ViewAction.Destroy] = "Destroy"; /** * @param {?} view * @param {?} action * @return {?} */ function execComponentViewsAction(view, action) { var /** @type {?} */ def = view.def; if (!(def.nodeFlags & 16777216 /* ComponentView */)) { return; } for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) { var /** @type {?} */ nodeDef = def.nodes[i]; if (nodeDef.flags & 16777216 /* ComponentView */) { // a leaf callViewAction(asElementData(view, i).componentView, action); } else if ((nodeDef.childFlags & 16777216 /* ComponentView */) === 0) { // a parent with leafs // no child is a component, // then skip the children i += nodeDef.childCount; } } } /** * @param {?} view * @param {?} action * @return {?} */ function execEmbeddedViewsAction(view, action) { var /** @type {?} */ def = view.def; if (!(def.nodeFlags & 8388608 /* EmbeddedViews */)) { return; } for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) { var /** @type {?} */ nodeDef = def.nodes[i]; if (nodeDef.flags & 8388608 /* EmbeddedViews */) { // a leaf var /** @type {?} */ embeddedViews = ((asElementData(view, i).viewContainer))._embeddedViews; for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) { callViewAction(embeddedViews[k], action); } } else if ((nodeDef.childFlags & 8388608 /* EmbeddedViews */) === 0) { // a parent with leafs // no child is a component, // then skip the children i += nodeDef.childCount; } } } /** * @param {?} view * @param {?} action * @return {?} */ function callViewAction(view, action) { var /** @type {?} */ viewState = view.state; switch (action) { case ViewAction.CheckNoChanges: if ((viewState & 12 /* CatDetectChanges */) === 12 /* CatDetectChanges */ && (viewState & 16 /* Destroyed */) === 0) { checkNoChangesView(view); } break; case ViewAction.CheckAndUpdate: if ((viewState & 12 /* CatDetectChanges */) === 12 /* CatDetectChanges */ && (viewState & 16 /* Destroyed */) === 0) { checkAndUpdateView(view); } break; case ViewAction.Destroy: destroyView(view); break; case ViewAction.CreateViewNodes: createViewNodes(view); break; } } /** * @param {?} view * @param {?} queryFlags * @param {?} staticDynamicQueryFlag * @param {?} checkType * @return {?} */ function execQueriesAction(view, queryFlags, staticDynamicQueryFlag, checkType) { if (!(view.def.nodeFlags & queryFlags) || !(view.def.nodeFlags & staticDynamicQueryFlag)) { return; } var /** @type {?} */ nodeCount = view.def.nodes.length; for (var /** @type {?} */ i = 0; i < nodeCount; i++) { var /** @type {?} */ nodeDef = view.def.nodes[i]; if ((nodeDef.flags & queryFlags) && (nodeDef.flags & staticDynamicQueryFlag)) { Services.setCurrentNode(view, nodeDef.index); switch (checkType) { case 0 /* CheckAndUpdate */: checkAndUpdateQuery(view, nodeDef); break; case 1 /* CheckNoChanges */: checkNoChangesQuery(view, nodeDef); break; } } if (!(nodeDef.childFlags & queryFlags) || !(nodeDef.childFlags & staticDynamicQueryFlag)) { // no child has a matching query // then skip the children i += nodeDef.childCount; } } } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var initialized = false; /** * @return {?} */ function initServicesIfNeeded() { if (initialized) { return; } initialized = true; var /** @type {?} */ services = isDevMode() ? createDebugServices() : createProdServices(); Services.setCurrentNode = services.setCurrentNode; Services.createRootView = services.createRootView; Services.createEmbeddedView = services.createEmbeddedView; Services.checkAndUpdateView = services.checkAndUpdateView; Services.checkNoChangesView = services.checkNoChangesView; Services.destroyView = services.destroyView; Services.resolveDep = resolveDep; Services.createDebugContext = services.createDebugContext; Services.handleEvent = services.handleEvent; Services.updateDirectives = services.updateDirectives; Services.updateRenderer = services.updateRenderer; Services.dirtyParentQueries = dirtyParentQueries; } /** * @return {?} */ function createProdServices() { return { setCurrentNode: function () { }, createRootView: createProdRootView, createEmbeddedView: createEmbeddedView, checkAndUpdateView: checkAndUpdateView, checkNoChangesView: checkNoChangesView, destroyView: destroyView, createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); }, handleEvent: function (view, nodeIndex, eventName, event) { return view.def.handleEvent(view, nodeIndex, eventName, event); }, updateDirectives: function (view, checkType) { return view.def.updateDirectives(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode : prodCheckNoChangesNode, view); }, updateRenderer: function (view, checkType) { return view.def.updateRenderer(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode : prodCheckNoChangesNode, view); }, }; } /** * @return {?} */ function createDebugServices() { return { setCurrentNode: debugSetCurrentNode, createRootView: debugCreateRootView, createEmbeddedView: debugCreateEmbeddedView, checkAndUpdateView: debugCheckAndUpdateView, checkNoChangesView: debugCheckNoChangesView, destroyView: debugDestroyView, createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); }, handleEvent: debugHandleEvent, updateDirectives: debugUpdateDirectives, updateRenderer: debugUpdateRenderer }; } /** * @param {?} elInjector * @param {?} projectableNodes * @param {?} rootSelectorOrNode * @param {?} def * @param {?} ngModule * @param {?=} context * @return {?} */ function createProdRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) { var /** @type {?} */ rendererFactory = ngModule.injector.get(RendererFactory2); return createRootView(createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode), def, context); } /** * @param {?} elInjector * @param {?} projectableNodes * @param {?} rootSelectorOrNode * @param {?} def * @param {?} ngModule * @param {?=} context * @return {?} */ function debugCreateRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) { var /** @type {?} */ rendererFactory = ngModule.injector.get(RendererFactory2); var /** @type {?} */ root = createRootData(elInjector, ngModule, new DebugRendererFactory2(rendererFactory), projectableNodes, rootSelectorOrNode); return callWithDebugContext(DebugAction.create, createRootView, null, [root, def, context]); } /** * @param {?} elInjector * @param {?} ngModule * @param {?} rendererFactory * @param {?} projectableNodes * @param {?} rootSelectorOrNode * @return {?} */ function createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode) { var /** @type {?} */ sanitizer = ngModule.injector.get(Sanitizer); var /** @type {?} */ errorHandler = ngModule.injector.get(ErrorHandler); var /** @type {?} */ renderer = rendererFactory.createRenderer(null, null); return { ngModule: ngModule, injector: elInjector, projectableNodes: projectableNodes, selectorOrNode: rootSelectorOrNode, sanitizer: sanitizer, rendererFactory: rendererFactory, renderer: renderer, errorHandler: errorHandler }; } /** * @param {?} view * @param {?} nodeIndex * @param {?} argStyle * @param {?=} v0 * @param {?=} v1 * @param {?=} v2 * @param {?=} v3 * @param {?=} v4 * @param {?=} v5 * @param {?=} v6 * @param {?=} v7 * @param {?=} v8 * @param {?=} v9 * @return {?} */ function prodCheckAndUpdateNode(view, nodeIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex]; checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); return (nodeDef.flags & 112 /* CatPureExpression */) ? asPureExpressionData(view, nodeIndex).value : undefined; } /** * @param {?} view * @param {?} nodeIndex * @param {?} argStyle * @param {?=} v0 * @param {?=} v1 * @param {?=} v2 * @param {?=} v3 * @param {?=} v4 * @param {?=} v5 * @param {?=} v6 * @param {?=} v7 * @param {?=} v8 * @param {?=} v9 * @return {?} */ function prodCheckNoChangesNode(view, nodeIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex]; checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); return (nodeDef.flags & 112 /* CatPureExpression */) ? asPureExpressionData(view, nodeIndex).value : undefined; } /** * @param {?} parent * @param {?} anchorDef * @param {?=} context * @return {?} */ function debugCreateEmbeddedView(parent, anchorDef, context) { return callWithDebugContext(DebugAction.create, createEmbeddedView, null, [parent, anchorDef, context]); } /** * @param {?} view * @return {?} */ function debugCheckAndUpdateView(view) { return callWithDebugContext(DebugAction.detectChanges, checkAndUpdateView, null, [view]); } /** * @param {?} view * @return {?} */ function debugCheckNoChangesView(view) { return callWithDebugContext(DebugAction.checkNoChanges, checkNoChangesView, null, [view]); } /** * @param {?} view * @return {?} */ function debugDestroyView(view) { return callWithDebugContext(DebugAction.destroy, destroyView, null, [view]); } var DebugAction = {}; DebugAction.create = 0; DebugAction.detectChanges = 1; DebugAction.checkNoChanges = 2; DebugAction.destroy = 3; DebugAction.handleEvent = 4; DebugAction[DebugAction.create] = "create"; DebugAction[DebugAction.detectChanges] = "detectChanges"; DebugAction[DebugAction.checkNoChanges] = "checkNoChanges"; DebugAction[DebugAction.destroy] = "destroy"; DebugAction[DebugAction.handleEvent] = "handleEvent"; var _currentAction; var _currentView; var _currentNodeIndex; /** * @param {?} view * @param {?} nodeIndex * @return {?} */ function debugSetCurrentNode(view, nodeIndex) { _currentView = view; _currentNodeIndex = nodeIndex; } /** * @param {?} view * @param {?} nodeIndex * @param {?} eventName * @param {?} event * @return {?} */ function debugHandleEvent(view, nodeIndex, eventName, event) { debugSetCurrentNode(view, nodeIndex); return callWithDebugContext(DebugAction.handleEvent, view.def.handleEvent, null, [view, nodeIndex, eventName, event]); } /** * @param {?} view * @param {?} checkType * @return {?} */ function debugUpdateDirectives(view, checkType) { if (view.state & 16 /* Destroyed */) { throw viewDestroyedError(DebugAction[_currentAction]); } debugSetCurrentNode(view, nextDirectiveWithBinding(view, 0)); return view.def.updateDirectives(debugCheckDirectivesFn, view); /** * @param {?} view * @param {?} nodeIndex * @param {?} argStyle * @param {...?} values * @return {?} */ function debugCheckDirectivesFn(view, nodeIndex, argStyle) { var values = []; for (var _i = 3; _i < arguments.length; _i++) { values[_i - 3] = arguments[_i]; } var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex]; if (checkType === 0 /* CheckAndUpdate */) { debugCheckAndUpdateNode(view, nodeDef, argStyle, values); } else { debugCheckNoChangesNode(view, nodeDef, argStyle, values); } if (nodeDef.flags & 8192 /* TypeDirective */) { debugSetCurrentNode(view, nextDirectiveWithBinding(view, nodeIndex)); } return (nodeDef.flags & 112 /* CatPureExpression */) ? asPureExpressionData(view, nodeDef.index).value : undefined; } } /** * @param {?} view * @param {?} checkType * @return {?} */ function debugUpdateRenderer(view, checkType) { if (view.state & 16 /* Destroyed */) { throw viewDestroyedError(DebugAction[_currentAction]); } debugSetCurrentNode(view, nextRenderNodeWithBinding(view, 0)); return view.def.updateRenderer(debugCheckRenderNodeFn, view); /** * @param {?} view * @param {?} nodeIndex * @param {?} argStyle * @param {...?} values * @return {?} */ function debugCheckRenderNodeFn(view, nodeIndex, argStyle) { var values = []; for (var _i = 3; _i < arguments.length; _i++) { values[_i - 3] = arguments[_i]; } var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex]; if (checkType === 0 /* CheckAndUpdate */) { debugCheckAndUpdateNode(view, nodeDef, argStyle, values); } else { debugCheckNoChangesNode(view, nodeDef, argStyle, values); } if (nodeDef.flags & 3 /* CatRenderNode */) { debugSetCurrentNode(view, nextRenderNodeWithBinding(view, nodeIndex)); } return (nodeDef.flags & 112 /* CatPureExpression */) ? asPureExpressionData(view, nodeDef.index).value : undefined; } } /** * @param {?} view * @param {?} nodeDef * @param {?} argStyle * @param {?} givenValues * @return {?} */ function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) { var /** @type {?} */ changed = ((checkAndUpdateNode)).apply(void 0, [view, nodeDef, argStyle].concat(givenValues)); if (changed) { var /** @type {?} */ values = argStyle === 1 /* Dynamic */ ? givenValues[0] : givenValues; if (nodeDef.flags & 8192 /* TypeDirective */) { var /** @type {?} */ bindingValues = {}; for (var /** @type {?} */ i = 0; i < nodeDef.bindings.length; i++) { var /** @type {?} */ binding = nodeDef.bindings[i]; var /** @type {?} */ value = values[i]; if (binding.flags & 8 /* TypeProperty */) { bindingValues[normalizeDebugBindingName(/** @type {?} */ ((binding.nonMinifiedName)))] = normalizeDebugBindingValue(value); } } var /** @type {?} */ elDef = ((nodeDef.parent)); var /** @type {?} */ el = asElementData(view, elDef.index).renderElement; if (!((elDef.element)).name) { // a comment. view.renderer.setValue(el, "bindings=" + JSON.stringify(bindingValues, null, 2)); } else { // a regular element. for (var /** @type {?} */ attr in bindingValues) { var /** @type {?} */ value = bindingValues[attr]; if (value != null) { view.renderer.setAttribute(el, attr, value); } else { view.renderer.removeAttribute(el, attr); } } } } } } /** * @param {?} view * @param {?} nodeDef * @param {?} argStyle * @param {?} values * @return {?} */ function debugCheckNoChangesNode(view, nodeDef, argStyle, values) { ((checkNoChangesNode)).apply(void 0, [view, nodeDef, argStyle].concat(values)); } /** * @param {?} name * @return {?} */ function normalizeDebugBindingName(name) { // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers name = camelCaseToDashCase(name.replace(/[$@]/g, '_')); return "ng-reflect-" + name; } var CAMEL_CASE_REGEXP = /([A-Z])/g; /** * @param {?} input * @return {?} */ function camelCaseToDashCase(input) { return input.replace(CAMEL_CASE_REGEXP, function () { var m = []; for (var _i = 0; _i < arguments.length; _i++) { m[_i] = arguments[_i]; } return '-' + m[1].toLowerCase(); }); } /** * @param {?} value * @return {?} */ function normalizeDebugBindingValue(value) { try { // Limit the size of the value as otherwise the DOM just gets polluted. return value != null ? value.toString().slice(0, 30) : value; } catch (e) { return '[ERROR] Exception while trying to serialize the value'; } } /** * @param {?} view * @param {?} nodeIndex * @return {?} */ function nextDirectiveWithBinding(view, nodeIndex) { for (var /** @type {?} */ i = nodeIndex; i < view.def.nodes.length; i++) { var /** @type {?} */ nodeDef = view.def.nodes[i]; if (nodeDef.flags & 8192 /* TypeDirective */ && nodeDef.bindings && nodeDef.bindings.length) { return i; } } return null; } /** * @param {?} view * @param {?} nodeIndex * @return {?} */ function nextRenderNodeWithBinding(view, nodeIndex) { for (var /** @type {?} */ i = nodeIndex; i < view.def.nodes.length; i++) { var /** @type {?} */ nodeDef = view.def.nodes[i]; if ((nodeDef.flags & 3 /* CatRenderNode */) && nodeDef.bindings && nodeDef.bindings.length) { return i; } } return null; } var DebugContext_ = (function () { /** * @param {?} view * @param {?} nodeIndex */ function DebugContext_(view, nodeIndex) { this.view = view; this.nodeIndex = nodeIndex; if (nodeIndex == null) { this.nodeIndex = nodeIndex = 0; } this.nodeDef = view.def.nodes[nodeIndex]; var elDef = this.nodeDef; var elView = view; while (elDef && (elDef.flags & 1 /* TypeElement */) === 0) { elDef = elDef.parent; } if (!elDef) { while (!elDef && elView) { elDef = viewParentEl(elView); elView = elView.parent; } } this.elDef = elDef; this.elView = elView; } Object.defineProperty(DebugContext_.prototype, "elOrCompView", { /** * @return {?} */ get: function () { // Has to be done lazily as we use the DebugContext also during creation of elements... return asElementData(this.elView, this.elDef.index).componentView || this.view; }, enumerable: true, configurable: true }); Object.defineProperty(DebugContext_.prototype, "injector", { /** * @return {?} */ get: function () { return createInjector(this.elView, this.elDef); }, enumerable: true, configurable: true }); Object.defineProperty(DebugContext_.prototype, "component", { /** * @return {?} */ get: function () { return this.elOrCompView.component; }, enumerable: true, configurable: true }); Object.defineProperty(DebugContext_.prototype, "context", { /** * @return {?} */ get: function () { return this.elOrCompView.context; }, enumerable: true, configurable: true }); Object.defineProperty(DebugContext_.prototype, "providerTokens", { /** * @return {?} */ get: function () { var /** @type {?} */ tokens = []; if (this.elDef) { for (var /** @type {?} */ i = this.elDef.index + 1; i <= this.elDef.index + this.elDef.childCount; i++) { var /** @type {?} */ childDef = this.elView.def.nodes[i]; if (childDef.flags & 10112 /* CatProvider */) { tokens.push(/** @type {?} */ ((childDef.provider)).token); } i += childDef.childCount; } } return tokens; }, enumerable: true, configurable: true }); Object.defineProperty(DebugContext_.prototype, "references", { /** * @return {?} */ get: function () { var /** @type {?} */ references = {}; if (this.elDef) { collectReferences(this.elView, this.elDef, references); for (var /** @type {?} */ i = this.elDef.index + 1; i <= this.elDef.index + this.elDef.childCount; i++) { var /** @type {?} */ childDef = this.elView.def.nodes[i]; if (childDef.flags & 10112 /* CatProvider */) { collectReferences(this.elView, childDef, references); } i += childDef.childCount; } } return references; }, enumerable: true, configurable: true }); Object.defineProperty(DebugContext_.prototype, "componentRenderElement", { /** * @return {?} */ get: function () { var /** @type {?} */ elData = findHostElement(this.elOrCompView); return elData ? elData.renderElement : undefined; }, enumerable: true, configurable: true }); Object.defineProperty(DebugContext_.prototype, "renderNode", { /** * @return {?} */ get: function () { return this.nodeDef.flags & 2 /* TypeText */ ? renderNode(this.view, this.nodeDef) : renderNode(this.elView, this.elDef); }, enumerable: true, configurable: true }); /** * @param {?} console * @param {...?} values * @return {?} */ DebugContext_.prototype.logError = function (console) { var values = []; for (var _i = 1; _i < arguments.length; _i++) { values[_i - 1] = arguments[_i]; } var /** @type {?} */ logViewDef; var /** @type {?} */ logNodeIndex; if (this.nodeDef.flags & 2 /* TypeText */) { logViewDef = this.view.def; logNodeIndex = this.nodeDef.index; } else { logViewDef = this.elView.def; logNodeIndex = this.elDef.index; } // Note: we only generate a log function for text and element nodes // to make the generated code as small as possible. var /** @type {?} */ renderNodeIndex = getRenderNodeIndex(logViewDef, logNodeIndex); var /** @type {?} */ currRenderNodeIndex = -1; var /** @type {?} */ nodeLogger = function () { currRenderNodeIndex++; if (currRenderNodeIndex === renderNodeIndex) { return (_a = console.error).bind.apply(_a, [console].concat(values)); } else { return NOOP; } var _a; }; /** @type {?} */ ((logViewDef.factory))(nodeLogger); if (currRenderNodeIndex < renderNodeIndex) { console.error('Illegal state: the ViewDefinitionFactory did not call the logger!'); console.error.apply(console, values); } }; return DebugContext_; }()); /** * @param {?} viewDef * @param {?} nodeIndex * @return {?} */ function getRenderNodeIndex(viewDef$$1, nodeIndex) { var /** @type {?} */ renderNodeIndex = -1; for (var /** @type {?} */ i = 0; i <= nodeIndex; i++) { var /** @type {?} */ nodeDef = viewDef$$1.nodes[i]; if (nodeDef.flags & 3 /* CatRenderNode */) { renderNodeIndex++; } } return renderNodeIndex; } /** * @param {?} view * @return {?} */ function findHostElement(view) { while (view && !isComponentView(view)) { view = ((view.parent)); } if (view.parent) { return asElementData(view.parent, /** @type {?} */ ((viewParentEl(view))).index); } return null; } /** * @param {?} view * @param {?} nodeDef * @param {?} references * @return {?} */ function collectReferences(view, nodeDef, references) { for (var /** @type {?} */ refName in nodeDef.references) { references[refName] = getQueryValue(view, nodeDef, nodeDef.references[refName]); } } /** * @param {?} action * @param {?} fn * @param {?} self * @param {?} args * @return {?} */ function callWithDebugContext(action, fn, self, args) { var /** @type {?} */ oldAction = _currentAction; var /** @type {?} */ oldView = _currentView; var /** @type {?} */ oldNodeIndex = _currentNodeIndex; try { _currentAction = action; var /** @type {?} */ result = fn.apply(self, args); _currentView = oldView; _currentNodeIndex = oldNodeIndex; _currentAction = oldAction; return result; } catch (e) { if (isViewDebugError(e) || !_currentView) { throw e; } throw viewWrappedDebugError(e, /** @type {?} */ ((getCurrentDebugContext()))); } } /** * @return {?} */ function getCurrentDebugContext() { return _currentView ? new DebugContext_(_currentView, _currentNodeIndex) : null; } var DebugRendererFactory2 = (function () { /** * @param {?} delegate */ function DebugRendererFactory2(delegate) { this.delegate = delegate; } /** * @param {?} element * @param {?} renderData * @return {?} */ DebugRendererFactory2.prototype.createRenderer = function (element, renderData) { return new DebugRenderer2(this.delegate.createRenderer(element, renderData)); }; return DebugRendererFactory2; }()); var DebugRenderer2 = (function () { /** * @param {?} delegate */ function DebugRenderer2(delegate) { this.delegate = delegate; } Object.defineProperty(DebugRenderer2.prototype, "data", { /** * @return {?} */ get: function () { return this.delegate.data; }, enumerable: true, configurable: true }); /** * @param {?} node * @return {?} */ DebugRenderer2.prototype.destroyNode = function (node) { removeDebugNodeFromIndex(/** @type {?} */ ((getDebugNode(node)))); if (this.delegate.destroyNode) { this.delegate.destroyNode(node); } }; /** * @return {?} */ DebugRenderer2.prototype.destroy = function () { this.delegate.destroy(); }; /** * @param {?} name * @param {?=} namespace * @return {?} */ DebugRenderer2.prototype.createElement = function (name, namespace) { var /** @type {?} */ el = this.delegate.createElement(name, namespace); var /** @type {?} */ debugCtx = getCurrentDebugContext(); if (debugCtx) { var /** @type {?} */ debugEl = new DebugElement(el, null, debugCtx); debugEl.name = name; indexDebugNode(debugEl); } return el; }; /** * @param {?} value * @return {?} */ DebugRenderer2.prototype.createComment = function (value) { var /** @type {?} */ comment = this.delegate.createComment(value); var /** @type {?} */ debugCtx = getCurrentDebugContext(); if (debugCtx) { indexDebugNode(new DebugNode(comment, null, debugCtx)); } return comment; }; /** * @param {?} value * @return {?} */ DebugRenderer2.prototype.createText = function (value) { var /** @type {?} */ text = this.delegate.createText(value); var /** @type {?} */ debugCtx = getCurrentDebugContext(); if (debugCtx) { indexDebugNode(new DebugNode(text, null, debugCtx)); } return text; }; /** * @param {?} parent * @param {?} newChild * @return {?} */ DebugRenderer2.prototype.appendChild = function (parent, newChild) { var /** @type {?} */ debugEl = getDebugNode(parent); var /** @type {?} */ debugChildEl = getDebugNode(newChild); if (debugEl && debugChildEl && debugEl instanceof DebugElement) { debugEl.addChild(debugChildEl); } this.delegate.appendChild(parent, newChild); }; /** * @param {?} parent * @param {?} newChild * @param {?} refChild * @return {?} */ DebugRenderer2.prototype.insertBefore = function (parent, newChild, refChild) { var /** @type {?} */ debugEl = getDebugNode(parent); var /** @type {?} */ debugChildEl = getDebugNode(newChild); var /** @type {?} */ debugRefEl = ((getDebugNode(refChild))); if (debugEl && debugChildEl && debugEl instanceof DebugElement) { debugEl.insertBefore(debugRefEl, debugChildEl); } this.delegate.insertBefore(parent, newChild, refChild); }; /** * @param {?} parent * @param {?} oldChild * @return {?} */ DebugRenderer2.prototype.removeChild = function (parent, oldChild) { var /** @type {?} */ debugEl = getDebugNode(parent); var /** @type {?} */ debugChildEl = getDebugNode(oldChild); if (debugEl && debugChildEl && debugEl instanceof DebugElement) { debugEl.removeChild(debugChildEl); } this.delegate.removeChild(parent, oldChild); }; /** * @param {?} selectorOrNode * @return {?} */ DebugRenderer2.prototype.selectRootElement = function (selectorOrNode) { var /** @type {?} */ el = this.delegate.selectRootElement(selectorOrNode); var /** @type {?} */ debugCtx = getCurrentDebugContext(); if (debugCtx) { indexDebugNode(new DebugElement(el, null, debugCtx)); } return el; }; /** * @param {?} el * @param {?} name * @param {?} value * @param {?=} namespace * @return {?} */ DebugRenderer2.prototype.setAttribute = function (el, name, value, namespace) { var /** @type {?} */ debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement) { var /** @type {?} */ fullName = namespace ? namespace + ':' + name : name; debugEl.attributes[fullName] = value; } this.delegate.setAttribute(el, name, value, namespace); }; /** * @param {?} el * @param {?} name * @param {?=} namespace * @return {?} */ DebugRenderer2.prototype.removeAttribute = function (el, name, namespace) { var /** @type {?} */ debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement) { var /** @type {?} */ fullName = namespace ? namespace + ':' + name : name; debugEl.attributes[fullName] = null; } this.delegate.removeAttribute(el, name, namespace); }; /** * @param {?} el * @param {?} name * @return {?} */ DebugRenderer2.prototype.addClass = function (el, name) { var /** @type {?} */ debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement) { debugEl.classes[name] = true; } this.delegate.addClass(el, name); }; /** * @param {?} el * @param {?} name * @return {?} */ DebugRenderer2.prototype.removeClass = function (el, name) { var /** @type {?} */ debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement) { debugEl.classes[name] = false; } this.delegate.removeClass(el, name); }; /** * @param {?} el * @param {?} style * @param {?} value * @param {?} flags * @return {?} */ DebugRenderer2.prototype.setStyle = function (el, style, value, flags) { var /** @type {?} */ debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement) { debugEl.styles[style] = value; } this.delegate.setStyle(el, style, value, flags); }; /** * @param {?} el * @param {?} style * @param {?} flags * @return {?} */ DebugRenderer2.prototype.removeStyle = function (el, style, flags) { var /** @type {?} */ debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement) { debugEl.styles[style] = null; } this.delegate.removeStyle(el, style, flags); }; /** * @param {?} el * @param {?} name * @param {?} value * @return {?} */ DebugRenderer2.prototype.setProperty = function (el, name, value) { var /** @type {?} */ debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement) { debugEl.properties[name] = value; } this.delegate.setProperty(el, name, value); }; /** * @param {?} target * @param {?} eventName * @param {?} callback * @return {?} */ DebugRenderer2.prototype.listen = function (target, eventName, callback) { if (typeof target !== 'string') { var /** @type {?} */ debugEl = getDebugNode(target); if (debugEl) { debugEl.listeners.push(new EventListener(eventName, callback)); } } return this.delegate.listen(target, eventName, callback); }; /** * @param {?} node * @return {?} */ DebugRenderer2.prototype.parentNode = function (node) { return this.delegate.parentNode(node); }; /** * @param {?} node * @return {?} */ DebugRenderer2.prototype.nextSibling = function (node) { return this.delegate.nextSibling(node); }; /** * @param {?} node * @param {?} value * @return {?} */ DebugRenderer2.prototype.setValue = function (node, value) { return this.delegate.setValue(node, value); }; return DebugRenderer2; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @return {?} */ function _iterableDiffersFactory() { return defaultIterableDiffers; } /** * @return {?} */ function _keyValueDiffersFactory() { return defaultKeyValueDiffers; } /** * @param {?=} locale * @return {?} */ function _localeFactory(locale) { return locale || 'en-US'; } /** * @return {?} */ function _initViewEngine() { initServicesIfNeeded(); } /** * This module includes the providers of \@angular/core that are needed * to bootstrap components via `ApplicationRef`. * * \@experimental */ var ApplicationModule = (function () { /** * @param {?} appRef */ function ApplicationModule(appRef) { } return ApplicationModule; }()); ApplicationModule.decorators = [ { type: NgModule, args: [{ providers: [ ApplicationRef_, { provide: ApplicationRef, useExisting: ApplicationRef_ }, ApplicationInitStatus, Compiler, APP_ID_RANDOM_PROVIDER, { provide: IterableDiffers, useFactory: _iterableDiffersFactory }, { provide: KeyValueDiffers, useFactory: _keyValueDiffersFactory }, { provide: LOCALE_ID, useFactory: _localeFactory, deps: [[new Inject(LOCALE_ID), new Optional(), new SkipSelf()]] }, { provide: APP_INITIALIZER, useValue: _initViewEngine, multi: true }, ] },] }, ]; /** * @nocollapse */ ApplicationModule.ctorParameters = function () { return [ { type: ApplicationRef, }, ]; }; /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var LifecycleHooks = {}; LifecycleHooks.OnInit = 0; LifecycleHooks.OnDestroy = 1; LifecycleHooks.DoCheck = 2; LifecycleHooks.OnChanges = 3; LifecycleHooks.AfterContentInit = 4; LifecycleHooks.AfterContentChecked = 5; LifecycleHooks.AfterViewInit = 6; LifecycleHooks.AfterViewChecked = 7; LifecycleHooks[LifecycleHooks.OnInit] = "OnInit"; LifecycleHooks[LifecycleHooks.OnDestroy] = "OnDestroy"; LifecycleHooks[LifecycleHooks.DoCheck] = "DoCheck"; LifecycleHooks[LifecycleHooks.OnChanges] = "OnChanges"; LifecycleHooks[LifecycleHooks.AfterContentInit] = "AfterContentInit"; LifecycleHooks[LifecycleHooks.AfterContentChecked] = "AfterContentChecked"; LifecycleHooks[LifecycleHooks.AfterViewInit] = "AfterViewInit"; LifecycleHooks[LifecycleHooks.AfterViewChecked] = "AfterViewChecked"; var LIFECYCLE_HOOKS_VALUES = [ LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges, LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit, LifecycleHooks.AfterViewChecked ]; /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@experimental Animation support is experimental. */ /** * `trigger` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations-anchor component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `trigger` Creates an animation trigger which will a list of {\@link state state} and {\@link * transition transition} entries that will be evaluated when the expression bound to the trigger * changes. * * Triggers are registered within the component annotation data under the {\@link * Component#animations-anchor animations section}. An animation trigger can be placed on an element * within a template by referencing the name of the trigger followed by the expression value that the * trigger is bound to (in the form of `[\@triggerName]="expression"`. * * ### Usage * * `trigger` will create an animation trigger reference based on the provided `name` value. The * provided `animation` value is expected to be an array consisting of {\@link state state} and {\@link * transition transition} declarations. * * ```typescript * \@Component({ * selector: 'my-component', * templateUrl: 'my-component-tpl.html', * animations: [ * trigger("myAnimationTrigger", [ * state(...), * state(...), * transition(...), * transition(...) * ]) * ] * }) * class MyComponent { * myStatusExp = "something"; * } * ``` * * The template associated with this component will make use of the `myAnimationTrigger` animation * trigger by binding to an element within its template code. * * ```html * *
    ...
    * tools/gulp-tasks/validate-commit-message.js ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} name * @param {?} definitions * @return {?} */ function trigger$1(name, definitions) { return { name: name, definitions: definitions }; } /** * `animate` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations-anchor component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `animate` specifies an animation step that will apply the provided `styles` data for a given * amount of time based on the provided `timing` expression value. Calls to `animate` are expected * to be used within {\@link sequence an animation sequence}, {\@link group group}, or {\@link * transition transition}. * * ### Usage * * The `animate` function accepts two input parameters: `timing` and `styles`: * * - `timing` is a string based value that can be a combination of a duration with optional delay * and easing values. The format for the expression breaks down to `duration delay easing` * (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000, * delay=100, easing=ease-out`. If a numeric value is provided then that will be used as the * `duration` value in millisecond form. * - `styles` is the style input data which can either be a call to {\@link style style} or {\@link * keyframes keyframes}. If left empty then the styles from the destination state will be collected * and used (this is useful when describing an animation step that will complete an animation by * {\@link transition#the-final-animate-call animating to the final state}). * * ```typescript * // various functions for specifying timing data * animate(500, style(...)) * animate("1s", style(...)) * animate("100ms 0.5s", style(...)) * animate("5s ease", style(...)) * animate("5s 10ms cubic-bezier(.17,.67,.88,.1)", style(...)) * * // either style() of keyframes() can be used * animate(500, style({ background: "red" })) * animate(500, keyframes([ * style({ background: "blue" })), * style({ background: "red" })) * ]) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} timings * @param {?=} styles * @return {?} */ function animate$1(timings, styles) { if (styles === void 0) { styles = null; } return { type: 4 /* Animate */, styles: styles, timings: timings }; } /** * `group` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations-anchor component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `group` specifies a list of animation steps that are all run in parallel. Grouped animations are * useful when a series of styles must be animated/closed off at different statrting/ending times. * * The `group` function can either be used within a {\@link sequence sequence} or a {\@link transition * transition} and it will only continue to the next instruction once all of the inner animation * steps have completed. * * ### Usage * * The `steps` data that is passed into the `group` animation function can either consist of {\@link * style style} or {\@link animate animate} function calls. Each call to `style()` or `animate()` * within a group will be executed instantly (use {\@link keyframes keyframes} or a {\@link * animate#usage animate() with a delay value} to offset styles to be applied at a later time). * * ```typescript * group([ * animate("1s", { background: "black" })) * animate("2s", { color: "white" })) * ]) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} steps * @return {?} */ function group$1(steps) { return { type: 3 /* Group */, steps: steps }; } /** * `sequence` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations-anchor component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used by * default when an array is passed as animation data into {\@link transition transition}.) * * The `sequence` function can either be used within a {\@link group group} or a {\@link transition * transition} and it will only continue to the next instruction once each of the inner animation * steps have completed. * * To perform animation styling in parallel with other animation steps then have a look at the * {\@link group group} animation function. * * ### Usage * * The `steps` data that is passed into the `sequence` animation function can either consist of * {\@link style style} or {\@link animate animate} function calls. A call to `style()` will apply the * provided styling data immediately while a call to `animate()` will apply its styling data over a * given time depending on its timing data. * * ```typescript * sequence([ * style({ opacity: 0 })), * animate("1s", { opacity: 1 })) * ]) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} steps * @return {?} */ function sequence$1(steps) { return { type: 2 /* Sequence */, steps: steps }; } /** * `style` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations-anchor component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `style` declares a key/value object containing CSS properties/styles that can then be used for * {\@link state animation states}, within an {\@link sequence animation sequence}, or as styling data * for both {\@link animate animate} and {\@link keyframes keyframes}. * * ### Usage * * `style` takes in a key/value string map as data and expects one or more CSS property/value pairs * to be defined. * * ```typescript * // string values are used for css properties * style({ background: "red", color: "blue" }) * * // numerical (pixel) values are also supported * style({ width: 100, height: 0 }) * ``` * * #### Auto-styles (using `*`) * * When an asterix (`*`) character is used as a value then it will be detected from the element * being animated and applied as animation data when the animation starts. * * This feature proves useful for a state depending on layout and/or environment factors; in such * cases the styles are calculated just before the animation starts. * * ```typescript * // the steps below will animate from 0 to the * // actual height of the element * style({ height: 0 }), * animate("1s", style({ height: "*" })) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} tokens * @return {?} */ function style$1(tokens) { return { type: 6 /* Style */, styles: tokens }; } /** * `state` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations-anchor component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `state` declares an animation state within the given trigger. When a state is active within a * component then its associated styles will persist on the element that the trigger is attached to * (even when the animation ends). * * To animate between states, have a look at the animation {\@link transition transition} DSL * function. To register states to an animation trigger please have a look at the {\@link trigger * trigger} function. * * #### The `void` state * * The `void` state value is a reserved word that angular uses to determine when the element is not * apart of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the * associated element is void). * * #### The `*` (default) state * * The `*` state (when styled) is a fallback state that will be used if the state that is being * animated is not declared within the trigger. * * ### Usage * * `state` will declare an animation state with its associated styles * within the given trigger. * * - `stateNameExpr` can be one or more state names separated by commas. * - `styles` refers to the {\@link style styling data} that will be persisted on the element once * the state has been reached. * * ```typescript * // "void" is a reserved name for a state and is used to represent * // the state in which an element is detached from from the application. * state("void", style({ height: 0 })) * * // user-defined states * state("closed", style({ height: 0 })) * state("open, visible", style({ height: "*" })) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} name * @param {?} styles * @return {?} */ function state$1(name, styles) { return { type: 0 /* State */, name: name, styles: styles }; } /** * `keyframes` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations-anchor component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `keyframes` specifies a collection of {\@link style style} entries each optionally characterized * by an `offset` value. * * ### Usage * * The `keyframes` animation function is designed to be used alongside the {\@link animate animate} * animation function. Instead of applying animations from where they are currently to their * destination, keyframes can describe how each style entry is applied and at what point within the * animation arc (much like CSS Keyframe Animations do). * * For each `style()` entry an `offset` value can be set. Doing so allows to specifiy at what * percentage of the animate time the styles will be applied. * * ```typescript * // the provided offset values describe when each backgroundColor value is applied. * animate("5s", keyframes([ * style({ backgroundColor: "red", offset: 0 }), * style({ backgroundColor: "blue", offset: 0.2 }), * style({ backgroundColor: "orange", offset: 0.3 }), * style({ backgroundColor: "black", offset: 1 }) * ])) * ``` * * Alternatively, if there are no `offset` values used within the style entries then the offsets * will be calculated automatically. * * ```typescript * animate("5s", keyframes([ * style({ backgroundColor: "red" }) // offset = 0 * style({ backgroundColor: "blue" }) // offset = 0.33 * style({ backgroundColor: "orange" }) // offset = 0.66 * style({ backgroundColor: "black" }) // offset = 1 * ])) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} steps * @return {?} */ function keyframes$1(steps) { return { type: 5 /* KeyframeSequence */, steps: steps }; } /** * `transition` is an animation-specific function that is designed to be used inside of Angular's * animation DSL language. If this information is new, please navigate to the {\@link * Component#animations-anchor component animations metadata page} to gain a better understanding of * how animations in Angular are used. * * `transition` declares the {\@link sequence sequence of animation steps} that will be run when the * provided `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 => * state2` which consists of two known states (use an asterix (`*`) to refer to a dynamic starting * and/or ending state). * * A function can also be provided as the `stateChangeExpr` argument for a transition and this * function will be executed each time a state change occurs. If the value returned within the * function is true then the associated animation will be run. * * Animation transitions are placed within an {\@link trigger animation trigger}. For an transition * to animate to a state value and persist its styles then one or more {\@link state animation * states} is expected to be defined. * * ### Usage * * An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on * what the previous state is and what the current state has become. In other words, if a transition * is defined that matches the old/current state criteria then the associated animation will be * triggered. * * ```typescript * // all transition/state changes are defined within an animation trigger * trigger("myAnimationTrigger", [ * // if a state is defined then its styles will be persisted when the * // animation has fully completed itself * state("on", style({ background: "green" })), * state("off", style({ background: "grey" })), * * // a transition animation that will be kicked off when the state value * // bound to "myAnimationTrigger" changes from "on" to "off" * transition("on => off", animate(500)), * * // it is also possible to do run the same animation for both directions * transition("on <=> off", animate(500)), * * // or to define multiple states pairs separated by commas * transition("on => off, off => void", animate(500)), * * // this is a catch-all state change for when an element is inserted into * // the page and the destination state is unknown * transition("void => *", [ * style({ opacity: 0 }), * animate(500) * ]), * * // this will capture a state change between any states * transition("* => *", animate("1s 0s")), * * // you can also go full out and include a function * transition((fromState, toState) => { * // when `true` then it will allow the animation below to be invoked * return fromState == "off" && toState == "on"; * }, animate("1s 0s")) * ]) * ``` * * The template associated with this component will make use of the `myAnimationTrigger` animation * trigger by binding to an element within its template code. * * ```html * *
    ...
    * ``` * * #### The final `animate` call * * If the final step within the transition steps is a call to `animate()` that **only** uses a * timing value with **no style data** then it will be automatically used as the final animation arc * for the element to animate itself to the final state. This involves an automatic mix of * adding/removing CSS styles so that the element will be in the exact state it should be for the * applied state to be presented correctly. * * ``` * // start off by hiding the element, but make sure that it animates properly to whatever state * // is currently active for "myAnimationTrigger" * transition("void => *", [ * style({ opacity: 0 }), * animate(500) * ]) * ``` * * ### Transition Aliases (`:enter` and `:leave`) * * Given that enter (insertion) and leave (removal) animations are so common, the `transition` * function accepts both `:enter` and `:leave` values which are aliases for the `void => *` and `* * => void` state changes. * * ``` * transition(":enter", [ * style({ opacity: 0 }), * animate(500, style({ opacity: 1 })) * ]) * transition(":leave", [ * animate(500, style({ opacity: 0 })) * ]) * ``` * * {\@example core/animation/ts/dsl/animation_example.ts region='Component'} * * \@experimental Animation support is experimental. * @param {?} stateChangeExpr * @param {?} steps * @return {?} */ function transition$1(stateChangeExpr, steps) { return { type: 1 /* Transition */, expr: stateChangeExpr, animation: steps }; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! */ var AUTO_STYLE$$1 = '*'; /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @param {?} name * @param {?} definitions * @return {?} */ function trigger$$1(name, definitions) { return trigger$1(name, definitions); } /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @param {?} timings * @param {?=} styles * @return {?} */ function animate$$1(timings, styles) { return animate$1(timings, styles); } /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @param {?} steps * @return {?} */ function group$$1(steps) { return group$1(steps); } /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @param {?} steps * @return {?} */ function sequence$$1(steps) { return sequence$1(steps); } /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @param {?} tokens * @return {?} */ function style$$1(tokens) { return style$1(tokens); } /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @param {?} name * @param {?} styles * @return {?} */ function state$$1(name, styles) { return state$1(name, styles); } /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @param {?} steps * @return {?} */ function keyframes$$1(steps) { return keyframes$1(steps); } /** * @deprecated This symbol has moved. Please Import from \@angular/animations instead! * @param {?} stateChangeExpr * @param {?} steps * @return {?} */ function transition$$1(stateChangeExpr, steps) { return transition$1(stateChangeExpr, steps); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point from which you should import all public core APIs. */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all public APIs of the core package. */ // This file only reexports content of the `src` folder. Keep it that way. /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=core.es5.js.map /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(21))) /***/ }), /* 2 */, /* 3 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(Buffer) {/* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ // css base code, injected by the css-loader module.exports = function(useSourceMap) { var list = []; // return the list of modules as css string list.toString = function toString() { return this.map(function (item) { var content = cssWithMappingToString(item, useSourceMap); if(item[2]) { return "@media " + item[2] + "{" + content + "}"; } else { return content; } }).join(""); }; // import a list of modules into the list list.i = function(modules, mediaQuery) { if(typeof modules === "string") modules = [[null, modules, ""]]; var alreadyImportedModules = {}; for(var i = 0; i < this.length; i++) { var id = this[i][0]; if(typeof id === "number") alreadyImportedModules[id] = true; } for(i = 0; i < modules.length; i++) { var item = modules[i]; // skip already imported module // this implementation is not 100% perfect for weird media query combinations // when a module is imported multiple times with different media queries. // I hope this will never occur (Hey this way we have smaller bundles) if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) { if(mediaQuery && !item[2]) { item[2] = mediaQuery; } else if(mediaQuery) { item[2] = "(" + item[2] + ") and (" + mediaQuery + ")"; } list.push(item); } } }; return list; }; function cssWithMappingToString(item, useSourceMap) { var content = item[1] || ''; var cssMapping = item[3]; if (!cssMapping) { return content; } if (useSourceMap) { var sourceMapping = toComment(cssMapping); var sourceURLs = cssMapping.sources.map(function (source) { return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */' }); return [content].concat(sourceURLs).concat([sourceMapping]).join('\n'); } return [content].join('\n'); } // Adapted from convert-source-map (MIT) function toComment(sourceMap) { var base64 = new Buffer(JSON.stringify(sourceMap)).toString('base64'); var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64; return '/*# ' + data + ' */'; } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(55).Buffer)) /***/ }), /* 4 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_common__ = __webpack_require__(17); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__ = __webpack_require__(36); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rxjs_observable_from__ = __webpack_require__(107); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_rxjs_observable_from___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_from__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__ = __webpack_require__(110); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_concatMap__ = __webpack_require__(305); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_concatMap___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_rxjs_operator_concatMap__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_every__ = __webpack_require__(310); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_every___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_rxjs_operator_every__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_rxjs_operator_first__ = __webpack_require__(311); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_rxjs_operator_first___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8_rxjs_operator_first__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__ = __webpack_require__(76); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__ = __webpack_require__(78); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_rxjs_operator_reduce__ = __webpack_require__(316); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_rxjs_operator_reduce___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_11_rxjs_operator_reduce__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12_rxjs_Observable__ = __webpack_require__(0); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12_rxjs_Observable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_12_rxjs_Observable__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13_rxjs_operator_catch__ = __webpack_require__(303); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13_rxjs_operator_catch___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_13_rxjs_operator_catch__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14_rxjs_operator_concatAll__ = __webpack_require__(304); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14_rxjs_operator_concatAll___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_14_rxjs_operator_concatAll__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15_rxjs_util_EmptyError__ = __webpack_require__(82); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15_rxjs_util_EmptyError___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_15_rxjs_util_EmptyError__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16_rxjs_observable_fromPromise__ = __webpack_require__(108); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16_rxjs_observable_fromPromise___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_16_rxjs_observable_fromPromise__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17_rxjs_operator_last__ = __webpack_require__(312); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17_rxjs_operator_last___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_17_rxjs_operator_last__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18_rxjs_operator_mergeAll__ = __webpack_require__(77); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18_rxjs_operator_mergeAll___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_18_rxjs_operator_mergeAll__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__angular_platform_browser__ = __webpack_require__(22); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_20_rxjs_operator_filter__ = __webpack_require__(111); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_20_rxjs_operator_filter___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_20_rxjs_operator_filter__); /* unused harmony export RouterLink */ /* unused harmony export RouterLinkWithHref */ /* unused harmony export RouterLinkActive */ /* unused harmony export RouterOutlet */ /* unused harmony export NavigationCancel */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return NavigationEnd; }); /* unused harmony export NavigationError */ /* unused harmony export NavigationStart */ /* unused harmony export RouteConfigLoadEnd */ /* unused harmony export RouteConfigLoadStart */ /* unused harmony export RoutesRecognized */ /* unused harmony export RouteReuseStrategy */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Router; }); /* unused harmony export ROUTES */ /* unused harmony export ROUTER_CONFIGURATION */ /* unused harmony export ROUTER_INITIALIZER */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return RouterModule; }); /* unused harmony export provideRoutes */ /* unused harmony export RouterOutletMap */ /* unused harmony export NoPreloading */ /* unused harmony export PreloadAllModules */ /* unused harmony export PreloadingStrategy */ /* unused harmony export RouterPreloader */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ActivatedRoute; }); /* unused harmony export ActivatedRouteSnapshot */ /* unused harmony export RouterState */ /* unused harmony export RouterStateSnapshot */ /* unused harmony export PRIMARY_OUTLET */ /* unused harmony export convertToParamMap */ /* unused harmony export UrlHandlingStrategy */ /* unused harmony export DefaultUrlSerializer */ /* unused harmony export UrlSegment */ /* unused harmony export UrlSegmentGroup */ /* unused harmony export UrlSerializer */ /* unused harmony export UrlTree */ /* unused harmony export VERSION */ /* unused harmony export ɵROUTER_PROVIDERS */ /* unused harmony export ɵflatten */ /* unused harmony export ɵa */ /* unused harmony export ɵg */ /* unused harmony export ɵh */ /* unused harmony export ɵi */ /* unused harmony export ɵd */ /* unused harmony export ɵc */ /* unused harmony export ɵj */ /* unused harmony export ɵf */ /* unused harmony export ɵb */ /* unused harmony export ɵe */ /* unused harmony export ɵk */ /* unused harmony export ɵl */ var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; /** * @license Angular v4.1.1 * (c) 2010-2017 Google, Inc. https://angular.io/ * License: MIT */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Represents an event triggered when a navigation starts. * * \@stable */ var NavigationStart = (function () { /** * @param {?} id * @param {?} url */ function NavigationStart(id, url) { this.id = id; this.url = url; } /** * \@docsNotRequired * @return {?} */ NavigationStart.prototype.toString = function () { return "NavigationStart(id: " + this.id + ", url: '" + this.url + "')"; }; return NavigationStart; }()); /** * \@whatItDoes Represents an event triggered when a navigation ends successfully. * * \@stable */ var NavigationEnd = (function () { /** * @param {?} id * @param {?} url * @param {?} urlAfterRedirects */ function NavigationEnd(id, url, urlAfterRedirects) { this.id = id; this.url = url; this.urlAfterRedirects = urlAfterRedirects; } /** * \@docsNotRequired * @return {?} */ NavigationEnd.prototype.toString = function () { return "NavigationEnd(id: " + this.id + ", url: '" + this.url + "', urlAfterRedirects: '" + this.urlAfterRedirects + "')"; }; return NavigationEnd; }()); /** * \@whatItDoes Represents an event triggered when a navigation is canceled. * * \@stable */ var NavigationCancel = (function () { /** * @param {?} id * @param {?} url * @param {?} reason */ function NavigationCancel(id, url, reason) { this.id = id; this.url = url; this.reason = reason; } /** * \@docsNotRequired * @return {?} */ NavigationCancel.prototype.toString = function () { return "NavigationCancel(id: " + this.id + ", url: '" + this.url + "')"; }; return NavigationCancel; }()); /** * \@whatItDoes Represents an event triggered when a navigation fails due to an unexpected error. * * \@stable */ var NavigationError = (function () { /** * @param {?} id * @param {?} url * @param {?} error */ function NavigationError(id, url, error) { this.id = id; this.url = url; this.error = error; } /** * \@docsNotRequired * @return {?} */ NavigationError.prototype.toString = function () { return "NavigationError(id: " + this.id + ", url: '" + this.url + "', error: " + this.error + ")"; }; return NavigationError; }()); /** * \@whatItDoes Represents an event triggered when routes are recognized. * * \@stable */ var RoutesRecognized = (function () { /** * @param {?} id * @param {?} url * @param {?} urlAfterRedirects * @param {?} state */ function RoutesRecognized(id, url, urlAfterRedirects, state) { this.id = id; this.url = url; this.urlAfterRedirects = urlAfterRedirects; this.state = state; } /** * \@docsNotRequired * @return {?} */ RoutesRecognized.prototype.toString = function () { return "RoutesRecognized(id: " + this.id + ", url: '" + this.url + "', urlAfterRedirects: '" + this.urlAfterRedirects + "', state: " + this.state + ")"; }; return RoutesRecognized; }()); /** * \@whatItDoes Represents an event triggered before lazy loading a route config. * * \@experimental */ var RouteConfigLoadStart = (function () { /** * @param {?} route */ function RouteConfigLoadStart(route) { this.route = route; } /** * @return {?} */ RouteConfigLoadStart.prototype.toString = function () { return "RouteConfigLoadStart(path: " + this.route.path + ")"; }; return RouteConfigLoadStart; }()); /** * \@whatItDoes Represents an event triggered when a route has been lazy loaded. * * \@experimental */ var RouteConfigLoadEnd = (function () { /** * @param {?} route */ function RouteConfigLoadEnd(route) { this.route = route; } /** * @return {?} */ RouteConfigLoadEnd.prototype.toString = function () { return "RouteConfigLoadEnd(path: " + this.route.path + ")"; }; return RouteConfigLoadEnd; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Name of the primary outlet. * * \@stable */ var PRIMARY_OUTLET = 'primary'; var ParamsAsMap = (function () { /** * @param {?} params */ function ParamsAsMap(params) { this.params = params || {}; } /** * @param {?} name * @return {?} */ ParamsAsMap.prototype.has = function (name) { return this.params.hasOwnProperty(name); }; /** * @param {?} name * @return {?} */ ParamsAsMap.prototype.get = function (name) { if (this.has(name)) { var /** @type {?} */ v = this.params[name]; return Array.isArray(v) ? v[0] : v; } return null; }; /** * @param {?} name * @return {?} */ ParamsAsMap.prototype.getAll = function (name) { if (this.has(name)) { var /** @type {?} */ v = this.params[name]; return Array.isArray(v) ? v : [v]; } return []; }; Object.defineProperty(ParamsAsMap.prototype, "keys", { /** * @return {?} */ get: function () { return Object.keys(this.params); }, enumerable: true, configurable: true }); return ParamsAsMap; }()); /** * Convert a {\@link Params} instance to a {\@link ParamMap}. * * \@stable * @param {?} params * @return {?} */ function convertToParamMap(params) { return new ParamsAsMap(params); } var NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError'; /** * @param {?} message * @return {?} */ function navigationCancelingError(message) { var /** @type {?} */ error = Error('NavigationCancelingError: ' + message); ((error))[NAVIGATION_CANCELING_ERROR] = true; return error; } /** * @param {?} error * @return {?} */ function isNavigationCancelingError(error) { return ((error))[NAVIGATION_CANCELING_ERROR]; } /** * @param {?} segments * @param {?} segmentGroup * @param {?} route * @return {?} */ function defaultUrlMatcher(segments, segmentGroup, route) { var /** @type {?} */ parts = ((route.path)).split('/'); if (parts.length > segments.length) { // The actual URL is shorter than the config, no match return null; } if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || parts.length < segments.length)) { // The config is longer than the actual URL but we are looking for a full match, return null return null; } var /** @type {?} */ posParams = {}; // Check each config part against the actual URL for (var /** @type {?} */ index = 0; index < parts.length; index++) { var /** @type {?} */ part = parts[index]; var /** @type {?} */ segment = segments[index]; var /** @type {?} */ isParameter = part.startsWith(':'); if (isParameter) { posParams[part.substring(1)] = segment; } else if (part !== segment.path) { // The actual URL part does not match the config, no match return null; } } return { consumed: segments.slice(0, parts.length), posParams: posParams }; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var LoadedRouterConfig = (function () { /** * @param {?} routes * @param {?} module */ function LoadedRouterConfig(routes, module) { this.routes = routes; this.module = module; } return LoadedRouterConfig; }()); /** * @param {?} config * @param {?=} parentPath * @return {?} */ function validateConfig(config, parentPath) { if (parentPath === void 0) { parentPath = ''; } // forEach doesn't iterate undefined values for (var /** @type {?} */ i = 0; i < config.length; i++) { var /** @type {?} */ route = config[i]; var /** @type {?} */ fullPath = getFullPath(parentPath, route); validateNode(route, fullPath); } } /** * @param {?} route * @param {?} fullPath * @return {?} */ function validateNode(route, fullPath) { if (!route) { throw new Error("\n Invalid configuration of route '" + fullPath + "': Encountered undefined route.\n The reason might be an extra comma.\n\n Example:\n const routes: Routes = [\n { path: '', redirectTo: '/dashboard', pathMatch: 'full' },\n { path: 'dashboard', component: DashboardComponent },, << two commas\n { path: 'detail/:id', component: HeroDetailComponent }\n ];\n "); } if (Array.isArray(route)) { throw new Error("Invalid configuration of route '" + fullPath + "': Array cannot be specified"); } if (!route.component && (route.outlet && route.outlet !== PRIMARY_OUTLET)) { throw new Error("Invalid configuration of route '" + fullPath + "': a componentless route cannot have a named outlet set"); } if (route.redirectTo && route.children) { throw new Error("Invalid configuration of route '" + fullPath + "': redirectTo and children cannot be used together"); } if (route.redirectTo && route.loadChildren) { throw new Error("Invalid configuration of route '" + fullPath + "': redirectTo and loadChildren cannot be used together"); } if (route.children && route.loadChildren) { throw new Error("Invalid configuration of route '" + fullPath + "': children and loadChildren cannot be used together"); } if (route.redirectTo && route.component) { throw new Error("Invalid configuration of route '" + fullPath + "': redirectTo and component cannot be used together"); } if (route.path && route.matcher) { throw new Error("Invalid configuration of route '" + fullPath + "': path and matcher cannot be used together"); } if (route.redirectTo === void 0 && !route.component && !route.children && !route.loadChildren) { throw new Error("Invalid configuration of route '" + fullPath + "'. One of the following must be provided: component, redirectTo, children or loadChildren"); } if (route.path === void 0 && route.matcher === void 0) { throw new Error("Invalid configuration of route '" + fullPath + "': routes must have either a path or a matcher specified"); } if (typeof route.path === 'string' && route.path.charAt(0) === '/') { throw new Error("Invalid configuration of route '" + fullPath + "': path cannot start with a slash"); } if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) { var /** @type {?} */ exp = "The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'."; throw new Error("Invalid configuration of route '{path: \"" + fullPath + "\", redirectTo: \"" + route.redirectTo + "\"}': please provide 'pathMatch'. " + exp); } if (route.pathMatch !== void 0 && route.pathMatch !== 'full' && route.pathMatch !== 'prefix') { throw new Error("Invalid configuration of route '" + fullPath + "': pathMatch can only be set to 'prefix' or 'full'"); } if (route.children) { validateConfig(route.children, fullPath); } } /** * @param {?} parentPath * @param {?} currentRoute * @return {?} */ function getFullPath(parentPath, currentRoute) { if (!currentRoute) { return parentPath; } if (!parentPath && !currentRoute.path) { return ''; } else if (parentPath && !currentRoute.path) { return parentPath + "/"; } else if (!parentPath && currentRoute.path) { return currentRoute.path; } else { return parentPath + "/" + currentRoute.path; } } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} a * @param {?} b * @return {?} */ function shallowEqualArrays(a, b) { if (a.length !== b.length) return false; for (var /** @type {?} */ i = 0; i < a.length; ++i) { if (!shallowEqual(a[i], b[i])) return false; } return true; } /** * @param {?} a * @param {?} b * @return {?} */ function shallowEqual(a, b) { var /** @type {?} */ k1 = Object.keys(a); var /** @type {?} */ k2 = Object.keys(b); if (k1.length != k2.length) { return false; } var /** @type {?} */ key; for (var /** @type {?} */ i = 0; i < k1.length; i++) { key = k1[i]; if (a[key] !== b[key]) { return false; } } return true; } /** * @template T * @param {?} arr * @return {?} */ function flatten(arr) { return Array.prototype.concat.apply([], arr); } /** * @template T * @param {?} a * @return {?} */ function last$1(a) { return a.length > 0 ? a[a.length - 1] : null; } /** * @param {?} bools * @return {?} */ /** * @template K, V * @param {?} map * @param {?} callback * @return {?} */ function forEach(map$$1, callback) { for (var /** @type {?} */ prop in map$$1) { if (map$$1.hasOwnProperty(prop)) { callback(map$$1[prop], prop); } } } /** * @template A, B * @param {?} obj * @param {?} fn * @return {?} */ function waitForMap(obj, fn) { if (Object.keys(obj).length === 0) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])({}); } var /** @type {?} */ waitHead = []; var /** @type {?} */ waitTail = []; var /** @type {?} */ res = {}; forEach(obj, function (a, k) { var /** @type {?} */ mapped = __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(fn(k, a), function (r) { return res[k] = r; }); if (k === PRIMARY_OUTLET) { waitHead.push(mapped); } else { waitTail.push(mapped); } }); var /** @type {?} */ concat$ = __WEBPACK_IMPORTED_MODULE_14_rxjs_operator_concatAll__["concatAll"].call(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"].apply(void 0, waitHead.concat(waitTail))); var /** @type {?} */ last$ = __WEBPACK_IMPORTED_MODULE_17_rxjs_operator_last__["last"].call(concat$); return __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(last$, function () { return res; }); } /** * @param {?} observables * @return {?} */ function andObservables(observables) { var /** @type {?} */ merged$ = __WEBPACK_IMPORTED_MODULE_18_rxjs_operator_mergeAll__["mergeAll"].call(observables); return __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_every__["every"].call(merged$, function (result) { return result === true; }); } /** * @template T * @param {?} value * @return {?} */ function wrapIntoObservable(value) { if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__angular_core__["g" /* ɵisObservable */])(value)) { return value; } if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__angular_core__["f" /* ɵisPromise */])(value)) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_16_rxjs_observable_fromPromise__["fromPromise"])(value); } return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(value); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @return {?} */ function createEmptyUrlTree() { return new UrlTree(new UrlSegmentGroup([], {}), {}, null); } /** * @param {?} container * @param {?} containee * @param {?} exact * @return {?} */ function containsTree(container, containee, exact) { if (exact) { return equalQueryParams(container.queryParams, containee.queryParams) && equalSegmentGroups(container.root, containee.root); } return containsQueryParams(container.queryParams, containee.queryParams) && containsSegmentGroup(container.root, containee.root); } /** * @param {?} container * @param {?} containee * @return {?} */ function equalQueryParams(container, containee) { return shallowEqual(container, containee); } /** * @param {?} container * @param {?} containee * @return {?} */ function equalSegmentGroups(container, containee) { if (!equalPath(container.segments, containee.segments)) return false; if (container.numberOfChildren !== containee.numberOfChildren) return false; for (var /** @type {?} */ c in containee.children) { if (!container.children[c]) return false; if (!equalSegmentGroups(container.children[c], containee.children[c])) return false; } return true; } /** * @param {?} container * @param {?} containee * @return {?} */ function containsQueryParams(container, containee) { return Object.keys(containee).length <= Object.keys(container).length && Object.keys(containee).every(function (key) { return containee[key] === container[key]; }); } /** * @param {?} container * @param {?} containee * @return {?} */ function containsSegmentGroup(container, containee) { return containsSegmentGroupHelper(container, containee, containee.segments); } /** * @param {?} container * @param {?} containee * @param {?} containeePaths * @return {?} */ function containsSegmentGroupHelper(container, containee, containeePaths) { if (container.segments.length > containeePaths.length) { var /** @type {?} */ current = container.segments.slice(0, containeePaths.length); if (!equalPath(current, containeePaths)) return false; if (containee.hasChildren()) return false; return true; } else if (container.segments.length === containeePaths.length) { if (!equalPath(container.segments, containeePaths)) return false; for (var /** @type {?} */ c in containee.children) { if (!container.children[c]) return false; if (!containsSegmentGroup(container.children[c], containee.children[c])) return false; } return true; } else { var /** @type {?} */ current = containeePaths.slice(0, container.segments.length); var /** @type {?} */ next = containeePaths.slice(container.segments.length); if (!equalPath(container.segments, current)) return false; if (!container.children[PRIMARY_OUTLET]) return false; return containsSegmentGroupHelper(container.children[PRIMARY_OUTLET], containee, next); } } /** * \@whatItDoes Represents the parsed URL. * * \@howToUse * * ``` * \@Component({templateUrl:'template.html'}) * class MyComponent { * constructor(router: Router) { * const tree: UrlTree = * router.parseUrl('/team/33/(user/victor//support:help)?debug=true#fragment'); * const f = tree.fragment; // return 'fragment' * const q = tree.queryParams; // returns {debug: 'true'} * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET]; * const s: UrlSegment[] = g.segments; // returns 2 segments 'team' and '33' * g.children[PRIMARY_OUTLET].segments; // returns 2 segments 'user' and 'victor' * g.children['support'].segments; // return 1 segment 'help' * } * } * ``` * * \@description * * Since a router state is a tree, and the URL is nothing but a serialized state, the URL is a * serialized tree. * UrlTree is a data structure that provides a lot of affordances in dealing with URLs * * \@stable */ var UrlTree = (function () { /** * \@internal * @param {?} root * @param {?} queryParams * @param {?} fragment */ function UrlTree(root, queryParams, fragment) { this.root = root; this.queryParams = queryParams; this.fragment = fragment; } Object.defineProperty(UrlTree.prototype, "queryParamMap", { /** * @return {?} */ get: function () { if (!this._queryParamMap) { this._queryParamMap = convertToParamMap(this.queryParams); } return this._queryParamMap; }, enumerable: true, configurable: true }); /** * \@docsNotRequired * @return {?} */ UrlTree.prototype.toString = function () { return DEFAULT_SERIALIZER.serialize(this); }; return UrlTree; }()); /** * \@whatItDoes Represents the parsed URL segment group. * * See {\@link UrlTree} for more information. * * \@stable */ var UrlSegmentGroup = (function () { /** * @param {?} segments * @param {?} children */ function UrlSegmentGroup(segments, children) { var _this = this; this.segments = segments; this.children = children; /** The parent node in the url tree */ this.parent = null; forEach(children, function (v, k) { return v.parent = _this; }); } /** * Wether the segment has child segments * @return {?} */ UrlSegmentGroup.prototype.hasChildren = function () { return this.numberOfChildren > 0; }; Object.defineProperty(UrlSegmentGroup.prototype, "numberOfChildren", { /** * Number of child segments * @return {?} */ get: function () { return Object.keys(this.children).length; }, enumerable: true, configurable: true }); /** * \@docsNotRequired * @return {?} */ UrlSegmentGroup.prototype.toString = function () { return serializePaths(this); }; return UrlSegmentGroup; }()); /** * \@whatItDoes Represents a single URL segment. * * \@howToUse * * ``` * \@Component({templateUrl:'template.html'}) * class MyComponent { * constructor(router: Router) { * const tree: UrlTree = router.parseUrl('/team;id=33'); * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET]; * const s: UrlSegment[] = g.segments; * s[0].path; // returns 'team' * s[0].parameters; // returns {id: 33} * } * } * ``` * * \@description * * A UrlSegment is a part of a URL between the two slashes. It contains a path and the matrix * parameters associated with the segment. * * \@stable */ var UrlSegment = (function () { /** * @param {?} path * @param {?} parameters */ function UrlSegment(path, parameters) { this.path = path; this.parameters = parameters; } Object.defineProperty(UrlSegment.prototype, "parameterMap", { /** * @return {?} */ get: function () { if (!this._parameterMap) { this._parameterMap = convertToParamMap(this.parameters); } return this._parameterMap; }, enumerable: true, configurable: true }); /** * \@docsNotRequired * @return {?} */ UrlSegment.prototype.toString = function () { return serializePath(this); }; return UrlSegment; }()); /** * @param {?} as * @param {?} bs * @return {?} */ function equalSegments(as, bs) { return equalPath(as, bs) && as.every(function (a, i) { return shallowEqual(a.parameters, bs[i].parameters); }); } /** * @param {?} as * @param {?} bs * @return {?} */ function equalPath(as, bs) { if (as.length !== bs.length) return false; return as.every(function (a, i) { return a.path === bs[i].path; }); } /** * @template T * @param {?} segment * @param {?} fn * @return {?} */ function mapChildrenIntoArray(segment, fn) { var /** @type {?} */ res = []; forEach(segment.children, function (child, childOutlet) { if (childOutlet === PRIMARY_OUTLET) { res = res.concat(fn(child, childOutlet)); } }); forEach(segment.children, function (child, childOutlet) { if (childOutlet !== PRIMARY_OUTLET) { res = res.concat(fn(child, childOutlet)); } }); return res; } /** * \@whatItDoes Serializes and deserializes a URL string into a URL tree. * * \@description The url serialization strategy is customizable. You can * make all URLs case insensitive by providing a custom UrlSerializer. * * See {\@link DefaultUrlSerializer} for an example of a URL serializer. * * \@stable * @abstract */ var UrlSerializer = (function () { function UrlSerializer() { } /** * Parse a url into a {\@link UrlTree} * @abstract * @param {?} url * @return {?} */ UrlSerializer.prototype.parse = function (url) { }; /** * Converts a {\@link UrlTree} into a url * @abstract * @param {?} tree * @return {?} */ UrlSerializer.prototype.serialize = function (tree) { }; return UrlSerializer; }()); /** * \@whatItDoes A default implementation of the {\@link UrlSerializer}. * * \@description * * Example URLs: * * ``` * /inbox/33(popup:compose) * /inbox/33;open=true/messages/44 * ``` * * DefaultUrlSerializer uses parentheses to serialize secondary segments (e.g., popup:compose), the * colon syntax to specify the outlet, and the ';parameter=value' syntax (e.g., open=true) to * specify route specific parameters. * * \@stable */ var DefaultUrlSerializer = (function () { function DefaultUrlSerializer() { } /** * Parses a url into a {\@link UrlTree} * @param {?} url * @return {?} */ DefaultUrlSerializer.prototype.parse = function (url) { var /** @type {?} */ p = new UrlParser(url); return new UrlTree(p.parseRootSegment(), p.parseQueryParams(), p.parseFragment()); }; /** * Converts a {\@link UrlTree} into a url * @param {?} tree * @return {?} */ DefaultUrlSerializer.prototype.serialize = function (tree) { var /** @type {?} */ segment = "/" + serializeSegment(tree.root, true); var /** @type {?} */ query = serializeQueryParams(tree.queryParams); var /** @type {?} */ fragment = typeof tree.fragment === "string" ? "#" + encodeURI(/** @type {?} */ ((tree.fragment))) : ''; return "" + segment + query + fragment; }; return DefaultUrlSerializer; }()); var DEFAULT_SERIALIZER = new DefaultUrlSerializer(); /** * @param {?} segment * @return {?} */ function serializePaths(segment) { return segment.segments.map(function (p) { return serializePath(p); }).join('/'); } /** * @param {?} segment * @param {?} root * @return {?} */ function serializeSegment(segment, root) { if (!segment.hasChildren()) { return serializePaths(segment); } if (root) { var /** @type {?} */ primary = segment.children[PRIMARY_OUTLET] ? serializeSegment(segment.children[PRIMARY_OUTLET], false) : ''; var /** @type {?} */ children_1 = []; forEach(segment.children, function (v, k) { if (k !== PRIMARY_OUTLET) { children_1.push(k + ":" + serializeSegment(v, false)); } }); return children_1.length > 0 ? primary + "(" + children_1.join('//') + ")" : primary; } else { var /** @type {?} */ children = mapChildrenIntoArray(segment, function (v, k) { if (k === PRIMARY_OUTLET) { return [serializeSegment(segment.children[PRIMARY_OUTLET], false)]; } return [k + ":" + serializeSegment(v, false)]; }); return serializePaths(segment) + "/(" + children.join('//') + ")"; } } /** * @param {?} s * @return {?} */ function encode(s) { return encodeURIComponent(s); } /** * @param {?} s * @return {?} */ function decode(s) { return decodeURIComponent(s); } /** * @param {?} path * @return {?} */ function serializePath(path) { return "" + encode(path.path) + serializeParams(path.parameters); } /** * @param {?} params * @return {?} */ function serializeParams(params) { return Object.keys(params).map(function (key) { return ";" + encode(key) + "=" + encode(params[key]); }).join(''); } /** * @param {?} params * @return {?} */ function serializeQueryParams(params) { var /** @type {?} */ strParams = Object.keys(params).map(function (name) { var /** @type {?} */ value = params[name]; return Array.isArray(value) ? value.map(function (v) { return encode(name) + "=" + encode(v); }).join('&') : encode(name) + "=" + encode(value); }); return strParams.length ? "?" + strParams.join("&") : ''; } var SEGMENT_RE = /^[^\/()?;=&#]+/; /** * @param {?} str * @return {?} */ function matchSegments(str) { var /** @type {?} */ match = str.match(SEGMENT_RE); return match ? match[0] : ''; } var QUERY_PARAM_RE = /^[^=?&#]+/; /** * @param {?} str * @return {?} */ function matchQueryParams(str) { var /** @type {?} */ match = str.match(QUERY_PARAM_RE); return match ? match[0] : ''; } var QUERY_PARAM_VALUE_RE = /^[^?&#]+/; /** * @param {?} str * @return {?} */ function matchUrlQueryParamValue(str) { var /** @type {?} */ match = str.match(QUERY_PARAM_VALUE_RE); return match ? match[0] : ''; } var UrlParser = (function () { /** * @param {?} url */ function UrlParser(url) { this.url = url; this.remaining = url; } /** * @return {?} */ UrlParser.prototype.parseRootSegment = function () { this.consumeOptional('/'); if (this.remaining === '' || this.peekStartsWith('?') || this.peekStartsWith('#')) { return new UrlSegmentGroup([], {}); } // The root segment group never has segments return new UrlSegmentGroup([], this.parseChildren()); }; /** * @return {?} */ UrlParser.prototype.parseQueryParams = function () { var /** @type {?} */ params = {}; if (this.consumeOptional('?')) { do { this.parseQueryParam(params); } while (this.consumeOptional('&')); } return params; }; /** * @return {?} */ UrlParser.prototype.parseFragment = function () { return this.consumeOptional('#') ? decodeURI(this.remaining) : null; }; /** * @return {?} */ UrlParser.prototype.parseChildren = function () { if (this.remaining === '') { return {}; } this.consumeOptional('/'); var /** @type {?} */ segments = []; if (!this.peekStartsWith('(')) { segments.push(this.parseSegment()); } while (this.peekStartsWith('/') && !this.peekStartsWith('//') && !this.peekStartsWith('/(')) { this.capture('/'); segments.push(this.parseSegment()); } var /** @type {?} */ children = {}; if (this.peekStartsWith('/(')) { this.capture('/'); children = this.parseParens(true); } var /** @type {?} */ res = {}; if (this.peekStartsWith('(')) { res = this.parseParens(false); } if (segments.length > 0 || Object.keys(children).length > 0) { res[PRIMARY_OUTLET] = new UrlSegmentGroup(segments, children); } return res; }; /** * @return {?} */ UrlParser.prototype.parseSegment = function () { var /** @type {?} */ path = matchSegments(this.remaining); if (path === '' && this.peekStartsWith(';')) { throw new Error("Empty path url segment cannot have parameters: '" + this.remaining + "'."); } this.capture(path); return new UrlSegment(decode(path), this.parseMatrixParams()); }; /** * @return {?} */ UrlParser.prototype.parseMatrixParams = function () { var /** @type {?} */ params = {}; while (this.consumeOptional(';')) { this.parseParam(params); } return params; }; /** * @param {?} params * @return {?} */ UrlParser.prototype.parseParam = function (params) { var /** @type {?} */ key = matchSegments(this.remaining); if (!key) { return; } this.capture(key); var /** @type {?} */ value = ''; if (this.consumeOptional('=')) { var /** @type {?} */ valueMatch = matchSegments(this.remaining); if (valueMatch) { value = valueMatch; this.capture(value); } } params[decode(key)] = decode(value); }; /** * @param {?} params * @return {?} */ UrlParser.prototype.parseQueryParam = function (params) { var /** @type {?} */ key = matchQueryParams(this.remaining); if (!key) { return; } this.capture(key); var /** @type {?} */ value = ''; if (this.consumeOptional('=')) { var /** @type {?} */ valueMatch = matchUrlQueryParamValue(this.remaining); if (valueMatch) { value = valueMatch; this.capture(value); } } var /** @type {?} */ decodedKey = decode(key); var /** @type {?} */ decodedVal = decode(value); if (params.hasOwnProperty(decodedKey)) { // Append to existing values var /** @type {?} */ currentVal = params[decodedKey]; if (!Array.isArray(currentVal)) { currentVal = [currentVal]; params[decodedKey] = currentVal; } currentVal.push(decodedVal); } else { // Create a new value params[decodedKey] = decodedVal; } }; /** * @param {?} allowPrimary * @return {?} */ UrlParser.prototype.parseParens = function (allowPrimary) { var /** @type {?} */ segments = {}; this.capture('('); while (!this.consumeOptional(')') && this.remaining.length > 0) { var /** @type {?} */ path = matchSegments(this.remaining); var /** @type {?} */ next = this.remaining[path.length]; // if is is not one of these characters, then the segment was unescaped // or the group was not closed if (next !== '/' && next !== ')' && next !== ';') { throw new Error("Cannot parse url '" + this.url + "'"); } var /** @type {?} */ outletName = ((undefined)); if (path.indexOf(':') > -1) { outletName = path.substr(0, path.indexOf(':')); this.capture(outletName); this.capture(':'); } else if (allowPrimary) { outletName = PRIMARY_OUTLET; } var /** @type {?} */ children = this.parseChildren(); segments[outletName] = Object.keys(children).length === 1 ? children[PRIMARY_OUTLET] : new UrlSegmentGroup([], children); this.consumeOptional('//'); } return segments; }; /** * @param {?} str * @return {?} */ UrlParser.prototype.peekStartsWith = function (str) { return this.remaining.startsWith(str); }; /** * @param {?} str * @return {?} */ UrlParser.prototype.consumeOptional = function (str) { if (this.peekStartsWith(str)) { this.remaining = this.remaining.substring(str.length); return true; } return false; }; /** * @param {?} str * @return {?} */ UrlParser.prototype.capture = function (str) { if (!this.consumeOptional(str)) { throw new Error("Expected \"" + str + "\"."); } }; return UrlParser; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var __assign$1 = (undefined && undefined.__assign) || Object.assign || function (t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; var NoMatch = (function () { /** * @param {?=} segmentGroup */ function NoMatch(segmentGroup) { this.segmentGroup = segmentGroup || null; } return NoMatch; }()); var AbsoluteRedirect = (function () { /** * @param {?} urlTree */ function AbsoluteRedirect(urlTree) { this.urlTree = urlTree; } return AbsoluteRedirect; }()); /** * @param {?} segmentGroup * @return {?} */ function noMatch(segmentGroup) { return new __WEBPACK_IMPORTED_MODULE_12_rxjs_Observable__["Observable"](function (obs) { return obs.error(new NoMatch(segmentGroup)); }); } /** * @param {?} newTree * @return {?} */ function absoluteRedirect(newTree) { return new __WEBPACK_IMPORTED_MODULE_12_rxjs_Observable__["Observable"](function (obs) { return obs.error(new AbsoluteRedirect(newTree)); }); } /** * @param {?} redirectTo * @return {?} */ function namedOutletsRedirect(redirectTo) { return new __WEBPACK_IMPORTED_MODULE_12_rxjs_Observable__["Observable"](function (obs) { return obs.error(new Error("Only absolute redirects can have named outlets. redirectTo: '" + redirectTo + "'")); }); } /** * @param {?} route * @return {?} */ function canLoadFails(route) { return new __WEBPACK_IMPORTED_MODULE_12_rxjs_Observable__["Observable"](function (obs) { return obs.error(navigationCancelingError("Cannot load children because the guard of the route \"path: '" + route.path + "'\" returned false")); }); } /** * Returns the `UrlTree` with the redirection applied. * * Lazy modules are loaded along the way. * @param {?} moduleInjector * @param {?} configLoader * @param {?} urlSerializer * @param {?} urlTree * @param {?} config * @return {?} */ function applyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config) { return new ApplyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config).apply(); } var ApplyRedirects = (function () { /** * @param {?} moduleInjector * @param {?} configLoader * @param {?} urlSerializer * @param {?} urlTree * @param {?} config */ function ApplyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config) { this.configLoader = configLoader; this.urlSerializer = urlSerializer; this.urlTree = urlTree; this.config = config; this.allowRedirects = true; this.ngModule = moduleInjector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* NgModuleRef */]); } /** * @return {?} */ ApplyRedirects.prototype.apply = function () { var _this = this; var /** @type {?} */ expanded$ = this.expandSegmentGroup(this.ngModule, this.config, this.urlTree.root, PRIMARY_OUTLET); var /** @type {?} */ urlTrees$ = __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(expanded$, function (rootSegmentGroup) { return _this.createUrlTree(rootSegmentGroup, _this.urlTree.queryParams, /** @type {?} */ ((_this.urlTree.fragment))); }); return __WEBPACK_IMPORTED_MODULE_13_rxjs_operator_catch__["_catch"].call(urlTrees$, function (e) { if (e instanceof AbsoluteRedirect) { // after an absolute redirect we do not apply any more redirects! _this.allowRedirects = false; // we need to run matching, so we can fetch all lazy-loaded modules return _this.match(e.urlTree); } if (e instanceof NoMatch) { throw _this.noMatchError(e); } throw e; }); }; /** * @param {?} tree * @return {?} */ ApplyRedirects.prototype.match = function (tree) { var _this = this; var /** @type {?} */ expanded$ = this.expandSegmentGroup(this.ngModule, this.config, tree.root, PRIMARY_OUTLET); var /** @type {?} */ mapped$ = __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(expanded$, function (rootSegmentGroup) { return _this.createUrlTree(rootSegmentGroup, tree.queryParams, /** @type {?} */ ((tree.fragment))); }); return __WEBPACK_IMPORTED_MODULE_13_rxjs_operator_catch__["_catch"].call(mapped$, function (e) { if (e instanceof NoMatch) { throw _this.noMatchError(e); } throw e; }); }; /** * @param {?} e * @return {?} */ ApplyRedirects.prototype.noMatchError = function (e) { return new Error("Cannot match any routes. URL Segment: '" + e.segmentGroup + "'"); }; /** * @param {?} rootCandidate * @param {?} queryParams * @param {?} fragment * @return {?} */ ApplyRedirects.prototype.createUrlTree = function (rootCandidate, queryParams, fragment) { var /** @type {?} */ root = rootCandidate.segments.length > 0 ? new UrlSegmentGroup([], (_a = {}, _a[PRIMARY_OUTLET] = rootCandidate, _a)) : rootCandidate; return new UrlTree(root, queryParams, fragment); var _a; }; /** * @param {?} ngModule * @param {?} routes * @param {?} segmentGroup * @param {?} outlet * @return {?} */ ApplyRedirects.prototype.expandSegmentGroup = function (ngModule, routes, segmentGroup, outlet) { if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) { return __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(this.expandChildren(ngModule, routes, segmentGroup), function (children) { return new UrlSegmentGroup([], children); }); } return this.expandSegment(ngModule, segmentGroup, routes, segmentGroup.segments, outlet, true); }; /** * @param {?} ngModule * @param {?} routes * @param {?} segmentGroup * @return {?} */ ApplyRedirects.prototype.expandChildren = function (ngModule, routes, segmentGroup) { var _this = this; return waitForMap(segmentGroup.children, function (childOutlet, child) { return _this.expandSegmentGroup(ngModule, routes, child, childOutlet); }); }; /** * @param {?} ngModule * @param {?} segmentGroup * @param {?} routes * @param {?} segments * @param {?} outlet * @param {?} allowRedirects * @return {?} */ ApplyRedirects.prototype.expandSegment = function (ngModule, segmentGroup, routes, segments, outlet, allowRedirects) { var _this = this; var /** @type {?} */ routes$ = __WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"].apply(void 0, routes); var /** @type {?} */ processedRoutes$ = __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(routes$, function (r) { var /** @type {?} */ expanded$ = _this.expandSegmentAgainstRoute(ngModule, segmentGroup, routes, r, segments, outlet, allowRedirects); return __WEBPACK_IMPORTED_MODULE_13_rxjs_operator_catch__["_catch"].call(expanded$, function (e) { if (e instanceof NoMatch) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(null); } throw e; }); }); var /** @type {?} */ concattedProcessedRoutes$ = __WEBPACK_IMPORTED_MODULE_14_rxjs_operator_concatAll__["concatAll"].call(processedRoutes$); var /** @type {?} */ first$ = __WEBPACK_IMPORTED_MODULE_8_rxjs_operator_first__["first"].call(concattedProcessedRoutes$, function (s) { return !!s; }); return __WEBPACK_IMPORTED_MODULE_13_rxjs_operator_catch__["_catch"].call(first$, function (e, _) { if (e instanceof __WEBPACK_IMPORTED_MODULE_15_rxjs_util_EmptyError__["EmptyError"]) { if (_this.noLeftoversInUrl(segmentGroup, segments, outlet)) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(new UrlSegmentGroup([], {})); } throw new NoMatch(segmentGroup); } throw e; }); }; /** * @param {?} segmentGroup * @param {?} segments * @param {?} outlet * @return {?} */ ApplyRedirects.prototype.noLeftoversInUrl = function (segmentGroup, segments, outlet) { return segments.length === 0 && !segmentGroup.children[outlet]; }; /** * @param {?} ngModule * @param {?} segmentGroup * @param {?} routes * @param {?} route * @param {?} paths * @param {?} outlet * @param {?} allowRedirects * @return {?} */ ApplyRedirects.prototype.expandSegmentAgainstRoute = function (ngModule, segmentGroup, routes, route, paths, outlet, allowRedirects) { if (getOutlet$1(route) !== outlet) { return noMatch(segmentGroup); } if (route.redirectTo === undefined) { return this.matchSegmentAgainstRoute(ngModule, segmentGroup, route, paths); } if (allowRedirects && this.allowRedirects) { return this.expandSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, paths, outlet); } return noMatch(segmentGroup); }; /** * @param {?} ngModule * @param {?} segmentGroup * @param {?} routes * @param {?} route * @param {?} segments * @param {?} outlet * @return {?} */ ApplyRedirects.prototype.expandSegmentAgainstRouteUsingRedirect = function (ngModule, segmentGroup, routes, route, segments, outlet) { if (route.path === '**') { return this.expandWildCardWithParamsAgainstRouteUsingRedirect(ngModule, routes, route, outlet); } return this.expandRegularSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, segments, outlet); }; /** * @param {?} ngModule * @param {?} routes * @param {?} route * @param {?} outlet * @return {?} */ ApplyRedirects.prototype.expandWildCardWithParamsAgainstRouteUsingRedirect = function (ngModule, routes, route, outlet) { var _this = this; var /** @type {?} */ newTree = this.applyRedirectCommands([], /** @type {?} */ ((route.redirectTo)), {}); if (((route.redirectTo)).startsWith('/')) { return absoluteRedirect(newTree); } return __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__["mergeMap"].call(this.lineralizeSegments(route, newTree), function (newSegments) { var /** @type {?} */ group = new UrlSegmentGroup(newSegments, {}); return _this.expandSegment(ngModule, group, routes, newSegments, outlet, false); }); }; /** * @param {?} ngModule * @param {?} segmentGroup * @param {?} routes * @param {?} route * @param {?} segments * @param {?} outlet * @return {?} */ ApplyRedirects.prototype.expandRegularSegmentAgainstRouteUsingRedirect = function (ngModule, segmentGroup, routes, route, segments, outlet) { var _this = this; var _a = match(segmentGroup, route, segments), matched = _a.matched, consumedSegments = _a.consumedSegments, lastChild = _a.lastChild, positionalParamSegments = _a.positionalParamSegments; if (!matched) return noMatch(segmentGroup); var /** @type {?} */ newTree = this.applyRedirectCommands(consumedSegments, /** @type {?} */ ((route.redirectTo)), /** @type {?} */ (positionalParamSegments)); if (((route.redirectTo)).startsWith('/')) { return absoluteRedirect(newTree); } return __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__["mergeMap"].call(this.lineralizeSegments(route, newTree), function (newSegments) { return _this.expandSegment(ngModule, segmentGroup, routes, newSegments.concat(segments.slice(lastChild)), outlet, false); }); }; /** * @param {?} ngModule * @param {?} rawSegmentGroup * @param {?} route * @param {?} segments * @return {?} */ ApplyRedirects.prototype.matchSegmentAgainstRoute = function (ngModule, rawSegmentGroup, route, segments) { var _this = this; if (route.path === '**') { if (route.loadChildren) { return __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(this.configLoader.load(ngModule.injector, route), function (cfg) { route._loadedConfig = cfg; return new UrlSegmentGroup(segments, {}); }); } return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(new UrlSegmentGroup(segments, {})); } var _a = match(rawSegmentGroup, route, segments), matched = _a.matched, consumedSegments = _a.consumedSegments, lastChild = _a.lastChild; if (!matched) return noMatch(rawSegmentGroup); var /** @type {?} */ rawSlicedSegments = segments.slice(lastChild); var /** @type {?} */ childConfig$ = this.getChildConfig(ngModule, route); return __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__["mergeMap"].call(childConfig$, function (routerConfig) { var /** @type {?} */ childModule = routerConfig.module; var /** @type {?} */ childConfig = routerConfig.routes; var _a = split(rawSegmentGroup, consumedSegments, rawSlicedSegments, childConfig), segmentGroup = _a.segmentGroup, slicedSegments = _a.slicedSegments; if (slicedSegments.length === 0 && segmentGroup.hasChildren()) { var /** @type {?} */ expanded$_1 = _this.expandChildren(childModule, childConfig, segmentGroup); return __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(expanded$_1, function (children) { return new UrlSegmentGroup(consumedSegments, children); }); } if (childConfig.length === 0 && slicedSegments.length === 0) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(new UrlSegmentGroup(consumedSegments, {})); } var /** @type {?} */ expanded$ = _this.expandSegment(childModule, segmentGroup, childConfig, slicedSegments, PRIMARY_OUTLET, true); return __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(expanded$, function (cs) { return new UrlSegmentGroup(consumedSegments.concat(cs.segments), cs.children); }); }); }; /** * @param {?} ngModule * @param {?} route * @return {?} */ ApplyRedirects.prototype.getChildConfig = function (ngModule, route) { var _this = this; if (route.children) { // The children belong to the same module return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(new LoadedRouterConfig(route.children, ngModule)); } if (route.loadChildren) { // lazy children belong to the loaded module if (route._loadedConfig !== undefined) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(route._loadedConfig); } return __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__["mergeMap"].call(runCanLoadGuard(ngModule.injector, route), function (shouldLoad) { if (shouldLoad) { return __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(_this.configLoader.load(ngModule.injector, route), function (cfg) { route._loadedConfig = cfg; return cfg; }); } return canLoadFails(route); }); } return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(new LoadedRouterConfig([], ngModule)); }; /** * @param {?} route * @param {?} urlTree * @return {?} */ ApplyRedirects.prototype.lineralizeSegments = function (route, urlTree) { var /** @type {?} */ res = []; var /** @type {?} */ c = urlTree.root; while (true) { res = res.concat(c.segments); if (c.numberOfChildren === 0) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(res); } if (c.numberOfChildren > 1 || !c.children[PRIMARY_OUTLET]) { return namedOutletsRedirect(/** @type {?} */ ((route.redirectTo))); } c = c.children[PRIMARY_OUTLET]; } }; /** * @param {?} segments * @param {?} redirectTo * @param {?} posParams * @return {?} */ ApplyRedirects.prototype.applyRedirectCommands = function (segments, redirectTo, posParams) { return this.applyRedirectCreatreUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams); }; /** * @param {?} redirectTo * @param {?} urlTree * @param {?} segments * @param {?} posParams * @return {?} */ ApplyRedirects.prototype.applyRedirectCreatreUrlTree = function (redirectTo, urlTree, segments, posParams) { var /** @type {?} */ newRoot = this.createSegmentGroup(redirectTo, urlTree.root, segments, posParams); return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment); }; /** * @param {?} redirectToParams * @param {?} actualParams * @return {?} */ ApplyRedirects.prototype.createQueryParams = function (redirectToParams, actualParams) { var /** @type {?} */ res = {}; forEach(redirectToParams, function (v, k) { res[k] = v.startsWith(':') ? actualParams[v.substring(1)] : v; }); return res; }; /** * @param {?} redirectTo * @param {?} group * @param {?} segments * @param {?} posParams * @return {?} */ ApplyRedirects.prototype.createSegmentGroup = function (redirectTo, group, segments, posParams) { var _this = this; var /** @type {?} */ updatedSegments = this.createSegments(redirectTo, group.segments, segments, posParams); var /** @type {?} */ children = {}; forEach(group.children, function (child, name) { children[name] = _this.createSegmentGroup(redirectTo, child, segments, posParams); }); return new UrlSegmentGroup(updatedSegments, children); }; /** * @param {?} redirectTo * @param {?} redirectToSegments * @param {?} actualSegments * @param {?} posParams * @return {?} */ ApplyRedirects.prototype.createSegments = function (redirectTo, redirectToSegments, actualSegments, posParams) { var _this = this; return redirectToSegments.map(function (s) { return s.path.startsWith(':') ? _this.findPosParam(redirectTo, s, posParams) : _this.findOrReturn(s, actualSegments); }); }; /** * @param {?} redirectTo * @param {?} redirectToUrlSegment * @param {?} posParams * @return {?} */ ApplyRedirects.prototype.findPosParam = function (redirectTo, redirectToUrlSegment, posParams) { var /** @type {?} */ pos = posParams[redirectToUrlSegment.path.substring(1)]; if (!pos) throw new Error("Cannot redirect to '" + redirectTo + "'. Cannot find '" + redirectToUrlSegment.path + "'."); return pos; }; /** * @param {?} redirectToUrlSegment * @param {?} actualSegments * @return {?} */ ApplyRedirects.prototype.findOrReturn = function (redirectToUrlSegment, actualSegments) { var /** @type {?} */ idx = 0; for (var _i = 0, actualSegments_1 = actualSegments; _i < actualSegments_1.length; _i++) { var s = actualSegments_1[_i]; if (s.path === redirectToUrlSegment.path) { actualSegments.splice(idx); return s; } idx++; } return redirectToUrlSegment; }; return ApplyRedirects; }()); /** * @param {?} moduleInjector * @param {?} route * @return {?} */ function runCanLoadGuard(moduleInjector, route) { var /** @type {?} */ canLoad = route.canLoad; if (!canLoad || canLoad.length === 0) return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(true); var /** @type {?} */ obs = __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_from__["from"])(canLoad), function (injectionToken) { var /** @type {?} */ guard = moduleInjector.get(injectionToken); return wrapIntoObservable(guard.canLoad ? guard.canLoad(route) : guard(route)); }); return andObservables(obs); } /** * @param {?} segmentGroup * @param {?} route * @param {?} segments * @return {?} */ function match(segmentGroup, route, segments) { if (route.path === '') { if ((route.pathMatch === 'full') && (segmentGroup.hasChildren() || segments.length > 0)) { return { matched: false, consumedSegments: [], lastChild: 0, positionalParamSegments: {} }; } return { matched: true, consumedSegments: [], lastChild: 0, positionalParamSegments: {} }; } var /** @type {?} */ matcher = route.matcher || defaultUrlMatcher; var /** @type {?} */ res = matcher(segments, segmentGroup, route); if (!res) { return { matched: false, consumedSegments: /** @type {?} */ ([]), lastChild: 0, positionalParamSegments: {}, }; } return { matched: true, consumedSegments: /** @type {?} */ ((res.consumed)), lastChild: /** @type {?} */ ((res.consumed.length)), positionalParamSegments: /** @type {?} */ ((res.posParams)), }; } /** * @param {?} segmentGroup * @param {?} consumedSegments * @param {?} slicedSegments * @param {?} config * @return {?} */ function split(segmentGroup, consumedSegments, slicedSegments, config) { if (slicedSegments.length > 0 && containsEmptyPathRedirectsWithNamedOutlets(segmentGroup, slicedSegments, config)) { var /** @type {?} */ s = new UrlSegmentGroup(consumedSegments, createChildrenForEmptySegments(config, new UrlSegmentGroup(slicedSegments, segmentGroup.children))); return { segmentGroup: mergeTrivialChildren(s), slicedSegments: [] }; } if (slicedSegments.length === 0 && containsEmptyPathRedirects(segmentGroup, slicedSegments, config)) { var /** @type {?} */ s = new UrlSegmentGroup(segmentGroup.segments, addEmptySegmentsToChildrenIfNeeded(segmentGroup, slicedSegments, config, segmentGroup.children)); return { segmentGroup: mergeTrivialChildren(s), slicedSegments: slicedSegments }; } return { segmentGroup: segmentGroup, slicedSegments: slicedSegments }; } /** * @param {?} s * @return {?} */ function mergeTrivialChildren(s) { if (s.numberOfChildren === 1 && s.children[PRIMARY_OUTLET]) { var /** @type {?} */ c = s.children[PRIMARY_OUTLET]; return new UrlSegmentGroup(s.segments.concat(c.segments), c.children); } return s; } /** * @param {?} segmentGroup * @param {?} slicedSegments * @param {?} routes * @param {?} children * @return {?} */ function addEmptySegmentsToChildrenIfNeeded(segmentGroup, slicedSegments, routes, children) { var /** @type {?} */ res = {}; for (var _i = 0, routes_1 = routes; _i < routes_1.length; _i++) { var r = routes_1[_i]; if (isEmptyPathRedirect(segmentGroup, slicedSegments, r) && !children[getOutlet$1(r)]) { res[getOutlet$1(r)] = new UrlSegmentGroup([], {}); } } return __assign$1({}, children, res); } /** * @param {?} routes * @param {?} primarySegmentGroup * @return {?} */ function createChildrenForEmptySegments(routes, primarySegmentGroup) { var /** @type {?} */ res = {}; res[PRIMARY_OUTLET] = primarySegmentGroup; for (var _i = 0, routes_2 = routes; _i < routes_2.length; _i++) { var r = routes_2[_i]; if (r.path === '' && getOutlet$1(r) !== PRIMARY_OUTLET) { res[getOutlet$1(r)] = new UrlSegmentGroup([], {}); } } return res; } /** * @param {?} segmentGroup * @param {?} segments * @param {?} routes * @return {?} */ function containsEmptyPathRedirectsWithNamedOutlets(segmentGroup, segments, routes) { return routes.some(function (r) { return isEmptyPathRedirect(segmentGroup, segments, r) && getOutlet$1(r) !== PRIMARY_OUTLET; }); } /** * @param {?} segmentGroup * @param {?} segments * @param {?} routes * @return {?} */ function containsEmptyPathRedirects(segmentGroup, segments, routes) { return routes.some(function (r) { return isEmptyPathRedirect(segmentGroup, segments, r); }); } /** * @param {?} segmentGroup * @param {?} segments * @param {?} r * @return {?} */ function isEmptyPathRedirect(segmentGroup, segments, r) { if ((segmentGroup.hasChildren() || segments.length > 0) && r.pathMatch === 'full') { return false; } return r.path === '' && r.redirectTo !== undefined; } /** * @param {?} route * @return {?} */ function getOutlet$1(route) { return route.outlet || PRIMARY_OUTLET; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var Tree = (function () { /** * @param {?} root */ function Tree(root) { this._root = root; } Object.defineProperty(Tree.prototype, "root", { /** * @return {?} */ get: function () { return this._root.value; }, enumerable: true, configurable: true }); /** * \@internal * @param {?} t * @return {?} */ Tree.prototype.parent = function (t) { var /** @type {?} */ p = this.pathFromRoot(t); return p.length > 1 ? p[p.length - 2] : null; }; /** * \@internal * @param {?} t * @return {?} */ Tree.prototype.children = function (t) { var /** @type {?} */ n = findNode(t, this._root); return n ? n.children.map(function (t) { return t.value; }) : []; }; /** * \@internal * @param {?} t * @return {?} */ Tree.prototype.firstChild = function (t) { var /** @type {?} */ n = findNode(t, this._root); return n && n.children.length > 0 ? n.children[0].value : null; }; /** * \@internal * @param {?} t * @return {?} */ Tree.prototype.siblings = function (t) { var /** @type {?} */ p = findPath(t, this._root, []); if (p.length < 2) return []; var /** @type {?} */ c = p[p.length - 2].children.map(function (c) { return c.value; }); return c.filter(function (cc) { return cc !== t; }); }; /** * \@internal * @param {?} t * @return {?} */ Tree.prototype.pathFromRoot = function (t) { return findPath(t, this._root, []).map(function (s) { return s.value; }); }; return Tree; }()); /** * @template T * @param {?} expected * @param {?} c * @return {?} */ function findNode(expected, c) { if (expected === c.value) return c; for (var _i = 0, _a = c.children; _i < _a.length; _i++) { var cc = _a[_i]; var /** @type {?} */ r = findNode(expected, cc); if (r) return r; } return null; } /** * @template T * @param {?} expected * @param {?} c * @param {?} collected * @return {?} */ function findPath(expected, c, collected) { collected.push(c); if (expected === c.value) return collected; for (var _i = 0, _a = c.children; _i < _a.length; _i++) { var cc = _a[_i]; var /** @type {?} */ cloned = collected.slice(0); var /** @type {?} */ r = findPath(expected, cc, cloned); if (r.length > 0) return r; } return []; } var TreeNode = (function () { /** * @param {?} value * @param {?} children */ function TreeNode(value, children) { this.value = value; this.children = children; } /** * @return {?} */ TreeNode.prototype.toString = function () { return "TreeNode(" + this.value + ")"; }; return TreeNode; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var __assign$2 = (undefined && undefined.__assign) || Object.assign || function (t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; /** * \@whatItDoes Represents the state of the router. * * \@howToUse * * ``` * \@Component({templateUrl:'template.html'}) * class MyComponent { * constructor(router: Router) { * const state: RouterState = router.routerState; * const root: ActivatedRoute = state.root; * const child = root.firstChild; * const id: Observable = child.params.map(p => p.id); * //... * } * } * ``` * * \@description * RouterState is a tree of activated routes. Every node in this tree knows about the "consumed" URL * segments, the extracted parameters, and the resolved data. * * See {\@link ActivatedRoute} for more information. * * \@stable */ var RouterState = (function (_super) { __extends(RouterState, _super); /** * \@internal * @param {?} root * @param {?} snapshot */ function RouterState(root, snapshot) { var _this = _super.call(this, root) || this; _this.snapshot = snapshot; setRouterStateSnapshot(_this, root); return _this; } /** * @return {?} */ RouterState.prototype.toString = function () { return this.snapshot.toString(); }; return RouterState; }(Tree)); /** * @param {?} urlTree * @param {?} rootComponent * @return {?} */ function createEmptyState(urlTree, rootComponent) { var /** @type {?} */ snapshot = createEmptyStateSnapshot(urlTree, rootComponent); var /** @type {?} */ emptyUrl = new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"]([new UrlSegment('', {})]); var /** @type {?} */ emptyParams = new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"]({}); var /** @type {?} */ emptyData = new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"]({}); var /** @type {?} */ emptyQueryParams = new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"]({}); var /** @type {?} */ fragment = new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"](''); var /** @type {?} */ activated = new ActivatedRoute(emptyUrl, emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, snapshot.root); activated.snapshot = snapshot.root; return new RouterState(new TreeNode(activated, []), snapshot); } /** * @param {?} urlTree * @param {?} rootComponent * @return {?} */ function createEmptyStateSnapshot(urlTree, rootComponent) { var /** @type {?} */ emptyParams = {}; var /** @type {?} */ emptyData = {}; var /** @type {?} */ emptyQueryParams = {}; var /** @type {?} */ fragment = ''; var /** @type {?} */ activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, urlTree.root, -1, {}); return new RouterStateSnapshot('', new TreeNode(activated, [])); } /** * \@whatItDoes Contains the information about a route associated with a component loaded in an * outlet. * An `ActivatedRoute` can also be used to traverse the router state tree. * * \@howToUse * * ``` * \@Component({...}) * class MyComponent { * constructor(route: ActivatedRoute) { * const id: Observable = route.params.map(p => p.id); * const url: Observable = route.url.map(segments => segments.join('')); * // route.data includes both `data` and `resolve` * const user = route.data.map(d => d.user); * } * } * ``` * * \@stable */ var ActivatedRoute = (function () { /** * \@internal * @param {?} url * @param {?} params * @param {?} queryParams * @param {?} fragment * @param {?} data * @param {?} outlet * @param {?} component * @param {?} futureSnapshot */ function ActivatedRoute(url, params, queryParams, fragment, data, outlet, component, futureSnapshot) { this.url = url; this.params = params; this.queryParams = queryParams; this.fragment = fragment; this.data = data; this.outlet = outlet; this.component = component; this._futureSnapshot = futureSnapshot; } Object.defineProperty(ActivatedRoute.prototype, "routeConfig", { /** * The configuration used to match this route * @return {?} */ get: function () { return this._futureSnapshot.routeConfig; }, enumerable: true, configurable: true }); Object.defineProperty(ActivatedRoute.prototype, "root", { /** * The root of the router state * @return {?} */ get: function () { return this._routerState.root; }, enumerable: true, configurable: true }); Object.defineProperty(ActivatedRoute.prototype, "parent", { /** * The parent of this route in the router state tree * @return {?} */ get: function () { return this._routerState.parent(this); }, enumerable: true, configurable: true }); Object.defineProperty(ActivatedRoute.prototype, "firstChild", { /** * The first child of this route in the router state tree * @return {?} */ get: function () { return this._routerState.firstChild(this); }, enumerable: true, configurable: true }); Object.defineProperty(ActivatedRoute.prototype, "children", { /** * The children of this route in the router state tree * @return {?} */ get: function () { return this._routerState.children(this); }, enumerable: true, configurable: true }); Object.defineProperty(ActivatedRoute.prototype, "pathFromRoot", { /** * The path from the root of the router state tree to this route * @return {?} */ get: function () { return this._routerState.pathFromRoot(this); }, enumerable: true, configurable: true }); Object.defineProperty(ActivatedRoute.prototype, "paramMap", { /** * @return {?} */ get: function () { if (!this._paramMap) { this._paramMap = __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(this.params, function (p) { return convertToParamMap(p); }); } return this._paramMap; }, enumerable: true, configurable: true }); Object.defineProperty(ActivatedRoute.prototype, "queryParamMap", { /** * @return {?} */ get: function () { if (!this._queryParamMap) { this._queryParamMap = __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(this.queryParams, function (p) { return convertToParamMap(p); }); } return this._queryParamMap; }, enumerable: true, configurable: true }); /** * @return {?} */ ActivatedRoute.prototype.toString = function () { return this.snapshot ? this.snapshot.toString() : "Future(" + this._futureSnapshot + ")"; }; return ActivatedRoute; }()); /** * \@internal * @param {?} route * @return {?} */ function inheritedParamsDataResolve(route) { var /** @type {?} */ pathToRoot = route.pathFromRoot; var /** @type {?} */ inhertingStartingFrom = pathToRoot.length - 1; while (inhertingStartingFrom >= 1) { var /** @type {?} */ current = pathToRoot[inhertingStartingFrom]; var /** @type {?} */ parent = pathToRoot[inhertingStartingFrom - 1]; // current route is an empty path => inherits its parent's params and data if (current.routeConfig && current.routeConfig.path === '') { inhertingStartingFrom--; } else if (!parent.component) { inhertingStartingFrom--; } else { break; } } return pathToRoot.slice(inhertingStartingFrom).reduce(function (res, curr) { var /** @type {?} */ params = __assign$2({}, res.params, curr.params); var /** @type {?} */ data = __assign$2({}, res.data, curr.data); var /** @type {?} */ resolve = __assign$2({}, res.resolve, curr._resolvedData); return { params: params, data: data, resolve: resolve }; }, /** @type {?} */ ({ params: {}, data: {}, resolve: {} })); } /** * \@whatItDoes Contains the information about a route associated with a component loaded in an * outlet * at a particular moment in time. ActivatedRouteSnapshot can also be used to traverse the router * state tree. * * \@howToUse * * ``` * \@Component({templateUrl:'./my-component.html'}) * class MyComponent { * constructor(route: ActivatedRoute) { * const id: string = route.snapshot.params.id; * const url: string = route.snapshot.url.join(''); * const user = route.snapshot.data.user; * } * } * ``` * * \@stable */ var ActivatedRouteSnapshot = (function () { /** * \@internal * @param {?} url * @param {?} params * @param {?} queryParams * @param {?} fragment * @param {?} data * @param {?} outlet * @param {?} component * @param {?} routeConfig * @param {?} urlSegment * @param {?} lastPathIndex * @param {?} resolve */ function ActivatedRouteSnapshot(url, params, queryParams, fragment, data, outlet, component, routeConfig, urlSegment, lastPathIndex, resolve) { this.url = url; this.params = params; this.queryParams = queryParams; this.fragment = fragment; this.data = data; this.outlet = outlet; this.component = component; this._routeConfig = routeConfig; this._urlSegment = urlSegment; this._lastPathIndex = lastPathIndex; this._resolve = resolve; } Object.defineProperty(ActivatedRouteSnapshot.prototype, "routeConfig", { /** * The configuration used to match this route * @return {?} */ get: function () { return this._routeConfig; }, enumerable: true, configurable: true }); Object.defineProperty(ActivatedRouteSnapshot.prototype, "root", { /** * The root of the router state * @return {?} */ get: function () { return this._routerState.root; }, enumerable: true, configurable: true }); Object.defineProperty(ActivatedRouteSnapshot.prototype, "parent", { /** * The parent of this route in the router state tree * @return {?} */ get: function () { return this._routerState.parent(this); }, enumerable: true, configurable: true }); Object.defineProperty(ActivatedRouteSnapshot.prototype, "firstChild", { /** * The first child of this route in the router state tree * @return {?} */ get: function () { return this._routerState.firstChild(this); }, enumerable: true, configurable: true }); Object.defineProperty(ActivatedRouteSnapshot.prototype, "children", { /** * The children of this route in the router state tree * @return {?} */ get: function () { return this._routerState.children(this); }, enumerable: true, configurable: true }); Object.defineProperty(ActivatedRouteSnapshot.prototype, "pathFromRoot", { /** * The path from the root of the router state tree to this route * @return {?} */ get: function () { return this._routerState.pathFromRoot(this); }, enumerable: true, configurable: true }); Object.defineProperty(ActivatedRouteSnapshot.prototype, "paramMap", { /** * @return {?} */ get: function () { if (!this._paramMap) { this._paramMap = convertToParamMap(this.params); } return this._paramMap; }, enumerable: true, configurable: true }); Object.defineProperty(ActivatedRouteSnapshot.prototype, "queryParamMap", { /** * @return {?} */ get: function () { if (!this._queryParamMap) { this._queryParamMap = convertToParamMap(this.queryParams); } return this._queryParamMap; }, enumerable: true, configurable: true }); /** * @return {?} */ ActivatedRouteSnapshot.prototype.toString = function () { var /** @type {?} */ url = this.url.map(function (segment) { return segment.toString(); }).join('/'); var /** @type {?} */ matched = this._routeConfig ? this._routeConfig.path : ''; return "Route(url:'" + url + "', path:'" + matched + "')"; }; return ActivatedRouteSnapshot; }()); /** * \@whatItDoes Represents the state of the router at a moment in time. * * \@howToUse * * ``` * \@Component({templateUrl:'template.html'}) * class MyComponent { * constructor(router: Router) { * const state: RouterState = router.routerState; * const snapshot: RouterStateSnapshot = state.snapshot; * const root: ActivatedRouteSnapshot = snapshot.root; * const child = root.firstChild; * const id: Observable = child.params.map(p => p.id); * //... * } * } * ``` * * \@description * RouterStateSnapshot is a tree of activated route snapshots. Every node in this tree knows about * the "consumed" URL segments, the extracted parameters, and the resolved data. * * \@stable */ var RouterStateSnapshot = (function (_super) { __extends(RouterStateSnapshot, _super); /** * \@internal * @param {?} url * @param {?} root */ function RouterStateSnapshot(url, root) { var _this = _super.call(this, root) || this; _this.url = url; setRouterStateSnapshot(_this, root); return _this; } /** * @return {?} */ RouterStateSnapshot.prototype.toString = function () { return serializeNode(this._root); }; return RouterStateSnapshot; }(Tree)); /** * @template U, T * @param {?} state * @param {?} node * @return {?} */ function setRouterStateSnapshot(state, node) { node.value._routerState = state; node.children.forEach(function (c) { return setRouterStateSnapshot(state, c); }); } /** * @param {?} node * @return {?} */ function serializeNode(node) { var /** @type {?} */ c = node.children.length > 0 ? " { " + node.children.map(serializeNode).join(", ") + " } " : ''; return "" + node.value + c; } /** * The expectation is that the activate route is created with the right set of parameters. * So we push new values into the observables only when they are not the initial values. * And we detect that by checking if the snapshot field is set. * @param {?} route * @return {?} */ function advanceActivatedRoute(route) { if (route.snapshot) { var /** @type {?} */ currentSnapshot = route.snapshot; route.snapshot = route._futureSnapshot; if (!shallowEqual(currentSnapshot.queryParams, route._futureSnapshot.queryParams)) { ((route.queryParams)).next(route._futureSnapshot.queryParams); } if (currentSnapshot.fragment !== route._futureSnapshot.fragment) { ((route.fragment)).next(route._futureSnapshot.fragment); } if (!shallowEqual(currentSnapshot.params, route._futureSnapshot.params)) { ((route.params)).next(route._futureSnapshot.params); } if (!shallowEqualArrays(currentSnapshot.url, route._futureSnapshot.url)) { ((route.url)).next(route._futureSnapshot.url); } if (!shallowEqual(currentSnapshot.data, route._futureSnapshot.data)) { ((route.data)).next(route._futureSnapshot.data); } } else { route.snapshot = route._futureSnapshot; // this is for resolved data ((route.data)).next(route._futureSnapshot.data); } } /** * @param {?} a * @param {?} b * @return {?} */ function equalParamsAndUrlSegments(a, b) { var /** @type {?} */ equalUrlParams = shallowEqual(a.params, b.params) && equalSegments(a.url, b.url); var /** @type {?} */ parentsMismatch = !a.parent !== !b.parent; return equalUrlParams && !parentsMismatch && (!a.parent || equalParamsAndUrlSegments(a.parent, /** @type {?} */ ((b.parent)))); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} routeReuseStrategy * @param {?} curr * @param {?} prevState * @return {?} */ function createRouterState(routeReuseStrategy, curr, prevState) { var /** @type {?} */ root = createNode(routeReuseStrategy, curr._root, prevState ? prevState._root : undefined); return new RouterState(root, curr); } /** * @param {?} routeReuseStrategy * @param {?} curr * @param {?=} prevState * @return {?} */ function createNode(routeReuseStrategy, curr, prevState) { // reuse an activated route that is currently displayed on the screen if (prevState && routeReuseStrategy.shouldReuseRoute(curr.value, prevState.value.snapshot)) { var /** @type {?} */ value = prevState.value; value._futureSnapshot = curr.value; var /** @type {?} */ children = createOrReuseChildren(routeReuseStrategy, curr, prevState); return new TreeNode(value, children); } else if (routeReuseStrategy.retrieve(curr.value)) { var /** @type {?} */ tree_1 = ((routeReuseStrategy.retrieve(curr.value))).route; setFutureSnapshotsOfActivatedRoutes(curr, tree_1); return tree_1; } else { var /** @type {?} */ value = createActivatedRoute(curr.value); var /** @type {?} */ children = curr.children.map(function (c) { return createNode(routeReuseStrategy, c); }); return new TreeNode(value, children); } } /** * @param {?} curr * @param {?} result * @return {?} */ function setFutureSnapshotsOfActivatedRoutes(curr, result) { if (curr.value.routeConfig !== result.value.routeConfig) { throw new Error('Cannot reattach ActivatedRouteSnapshot created from a different route'); } if (curr.children.length !== result.children.length) { throw new Error('Cannot reattach ActivatedRouteSnapshot with a different number of children'); } result.value._futureSnapshot = curr.value; for (var /** @type {?} */ i = 0; i < curr.children.length; ++i) { setFutureSnapshotsOfActivatedRoutes(curr.children[i], result.children[i]); } } /** * @param {?} routeReuseStrategy * @param {?} curr * @param {?} prevState * @return {?} */ function createOrReuseChildren(routeReuseStrategy, curr, prevState) { return curr.children.map(function (child) { for (var _i = 0, _a = prevState.children; _i < _a.length; _i++) { var p = _a[_i]; if (routeReuseStrategy.shouldReuseRoute(p.value.snapshot, child.value)) { return createNode(routeReuseStrategy, child, p); } } return createNode(routeReuseStrategy, child); }); } /** * @param {?} c * @return {?} */ function createActivatedRoute(c) { return new ActivatedRoute(new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"](c.url), new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"](c.params), new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"](c.queryParams), new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"](c.fragment), new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"](c.data), c.outlet, c.component, c); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} route * @param {?} urlTree * @param {?} commands * @param {?} queryParams * @param {?} fragment * @return {?} */ function createUrlTree(route, urlTree, commands, queryParams, fragment) { if (commands.length === 0) { return tree(urlTree.root, urlTree.root, urlTree, queryParams, fragment); } var /** @type {?} */ nav = computeNavigation(commands); if (nav.toRoot()) { return tree(urlTree.root, new UrlSegmentGroup([], {}), urlTree, queryParams, fragment); } var /** @type {?} */ startingPosition = findStartingPosition(nav, urlTree, route); var /** @type {?} */ segmentGroup = startingPosition.processChildren ? updateSegmentGroupChildren(startingPosition.segmentGroup, startingPosition.index, nav.commands) : updateSegmentGroup(startingPosition.segmentGroup, startingPosition.index, nav.commands); return tree(startingPosition.segmentGroup, segmentGroup, urlTree, queryParams, fragment); } /** * @param {?} command * @return {?} */ function isMatrixParams(command) { return typeof command === 'object' && command != null && !command.outlets && !command.segmentPath; } /** * @param {?} oldSegmentGroup * @param {?} newSegmentGroup * @param {?} urlTree * @param {?} queryParams * @param {?} fragment * @return {?} */ function tree(oldSegmentGroup, newSegmentGroup, urlTree, queryParams, fragment) { var /** @type {?} */ qp = {}; if (queryParams) { forEach(queryParams, function (value, name) { qp[name] = Array.isArray(value) ? value.map(function (v) { return "" + v; }) : "" + value; }); } if (urlTree.root === oldSegmentGroup) { return new UrlTree(newSegmentGroup, qp, fragment); } return new UrlTree(replaceSegment(urlTree.root, oldSegmentGroup, newSegmentGroup), qp, fragment); } /** * @param {?} current * @param {?} oldSegment * @param {?} newSegment * @return {?} */ function replaceSegment(current, oldSegment, newSegment) { var /** @type {?} */ children = {}; forEach(current.children, function (c, outletName) { if (c === oldSegment) { children[outletName] = newSegment; } else { children[outletName] = replaceSegment(c, oldSegment, newSegment); } }); return new UrlSegmentGroup(current.segments, children); } var Navigation = (function () { /** * @param {?} isAbsolute * @param {?} numberOfDoubleDots * @param {?} commands */ function Navigation(isAbsolute, numberOfDoubleDots, commands) { this.isAbsolute = isAbsolute; this.numberOfDoubleDots = numberOfDoubleDots; this.commands = commands; if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) { throw new Error('Root segment cannot have matrix parameters'); } var cmdWithOutlet = commands.find(function (c) { return typeof c === 'object' && c != null && c.outlets; }); if (cmdWithOutlet && cmdWithOutlet !== last$1(commands)) { throw new Error('{outlets:{}} has to be the last command'); } } /** * @return {?} */ Navigation.prototype.toRoot = function () { return this.isAbsolute && this.commands.length === 1 && this.commands[0] == '/'; }; return Navigation; }()); /** * Transforms commands to a normalized `Navigation` * @param {?} commands * @return {?} */ function computeNavigation(commands) { if ((typeof commands[0] === 'string') && commands.length === 1 && commands[0] === '/') { return new Navigation(true, 0, commands); } var /** @type {?} */ numberOfDoubleDots = 0; var /** @type {?} */ isAbsolute = false; var /** @type {?} */ res = commands.reduce(function (res, cmd, cmdIdx) { if (typeof cmd === 'object' && cmd != null) { if (cmd.outlets) { var /** @type {?} */ outlets_1 = {}; forEach(cmd.outlets, function (commands, name) { outlets_1[name] = typeof commands === 'string' ? commands.split('/') : commands; }); return res.concat([{ outlets: outlets_1 }]); } if (cmd.segmentPath) { return res.concat([cmd.segmentPath]); } } if (!(typeof cmd === 'string')) { return res.concat([cmd]); } if (cmdIdx === 0) { cmd.split('/').forEach(function (urlPart, partIndex) { if (partIndex == 0 && urlPart === '.') { } else if (partIndex == 0 && urlPart === '') { isAbsolute = true; } else if (urlPart === '..') { numberOfDoubleDots++; } else if (urlPart != '') { res.push(urlPart); } }); return res; } return res.concat([cmd]); }, []); return new Navigation(isAbsolute, numberOfDoubleDots, res); } var Position = (function () { /** * @param {?} segmentGroup * @param {?} processChildren * @param {?} index */ function Position(segmentGroup, processChildren, index) { this.segmentGroup = segmentGroup; this.processChildren = processChildren; this.index = index; } return Position; }()); /** * @param {?} nav * @param {?} tree * @param {?} route * @return {?} */ function findStartingPosition(nav, tree, route) { if (nav.isAbsolute) { return new Position(tree.root, true, 0); } if (route.snapshot._lastPathIndex === -1) { return new Position(route.snapshot._urlSegment, true, 0); } var /** @type {?} */ modifier = isMatrixParams(nav.commands[0]) ? 0 : 1; var /** @type {?} */ index = route.snapshot._lastPathIndex + modifier; return createPositionApplyingDoubleDots(route.snapshot._urlSegment, index, nav.numberOfDoubleDots); } /** * @param {?} group * @param {?} index * @param {?} numberOfDoubleDots * @return {?} */ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) { var /** @type {?} */ g = group; var /** @type {?} */ ci = index; var /** @type {?} */ dd = numberOfDoubleDots; while (dd > ci) { dd -= ci; g = ((g.parent)); if (!g) { throw new Error('Invalid number of \'../\''); } ci = g.segments.length; } return new Position(g, false, ci - dd); } /** * @param {?} command * @return {?} */ function getPath(command) { if (typeof command === 'object' && command != null && command.outlets) { return command.outlets[PRIMARY_OUTLET]; } return "" + command; } /** * @param {?} commands * @return {?} */ function getOutlets(commands) { if (!(typeof commands[0] === 'object')) return _a = {}, _a[PRIMARY_OUTLET] = commands, _a; if (commands[0].outlets === undefined) return _b = {}, _b[PRIMARY_OUTLET] = commands, _b; return commands[0].outlets; var _a, _b; } /** * @param {?} segmentGroup * @param {?} startIndex * @param {?} commands * @return {?} */ function updateSegmentGroup(segmentGroup, startIndex, commands) { if (!segmentGroup) { segmentGroup = new UrlSegmentGroup([], {}); } if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) { return updateSegmentGroupChildren(segmentGroup, startIndex, commands); } var /** @type {?} */ m = prefixedWith(segmentGroup, startIndex, commands); var /** @type {?} */ slicedCommands = commands.slice(m.commandIndex); if (m.match && m.pathIndex < segmentGroup.segments.length) { var /** @type {?} */ g = new UrlSegmentGroup(segmentGroup.segments.slice(0, m.pathIndex), {}); g.children[PRIMARY_OUTLET] = new UrlSegmentGroup(segmentGroup.segments.slice(m.pathIndex), segmentGroup.children); return updateSegmentGroupChildren(g, 0, slicedCommands); } else if (m.match && slicedCommands.length === 0) { return new UrlSegmentGroup(segmentGroup.segments, {}); } else if (m.match && !segmentGroup.hasChildren()) { return createNewSegmentGroup(segmentGroup, startIndex, commands); } else if (m.match) { return updateSegmentGroupChildren(segmentGroup, 0, slicedCommands); } else { return createNewSegmentGroup(segmentGroup, startIndex, commands); } } /** * @param {?} segmentGroup * @param {?} startIndex * @param {?} commands * @return {?} */ function updateSegmentGroupChildren(segmentGroup, startIndex, commands) { if (commands.length === 0) { return new UrlSegmentGroup(segmentGroup.segments, {}); } else { var /** @type {?} */ outlets_2 = getOutlets(commands); var /** @type {?} */ children_2 = {}; forEach(outlets_2, function (commands, outlet) { if (commands !== null) { children_2[outlet] = updateSegmentGroup(segmentGroup.children[outlet], startIndex, commands); } }); forEach(segmentGroup.children, function (child, childOutlet) { if (outlets_2[childOutlet] === undefined) { children_2[childOutlet] = child; } }); return new UrlSegmentGroup(segmentGroup.segments, children_2); } } /** * @param {?} segmentGroup * @param {?} startIndex * @param {?} commands * @return {?} */ function prefixedWith(segmentGroup, startIndex, commands) { var /** @type {?} */ currentCommandIndex = 0; var /** @type {?} */ currentPathIndex = startIndex; var /** @type {?} */ noMatch = { match: false, pathIndex: 0, commandIndex: 0 }; while (currentPathIndex < segmentGroup.segments.length) { if (currentCommandIndex >= commands.length) return noMatch; var /** @type {?} */ path = segmentGroup.segments[currentPathIndex]; var /** @type {?} */ curr = getPath(commands[currentCommandIndex]); var /** @type {?} */ next = currentCommandIndex < commands.length - 1 ? commands[currentCommandIndex + 1] : null; if (currentPathIndex > 0 && curr === undefined) break; if (curr && next && (typeof next === 'object') && next.outlets === undefined) { if (!compare(curr, next, path)) return noMatch; currentCommandIndex += 2; } else { if (!compare(curr, {}, path)) return noMatch; currentCommandIndex++; } currentPathIndex++; } return { match: true, pathIndex: currentPathIndex, commandIndex: currentCommandIndex }; } /** * @param {?} segmentGroup * @param {?} startIndex * @param {?} commands * @return {?} */ function createNewSegmentGroup(segmentGroup, startIndex, commands) { var /** @type {?} */ paths = segmentGroup.segments.slice(0, startIndex); var /** @type {?} */ i = 0; while (i < commands.length) { if (typeof commands[i] === 'object' && commands[i].outlets !== undefined) { var /** @type {?} */ children = createNewSegmentChildren(commands[i].outlets); return new UrlSegmentGroup(paths, children); } // if we start with an object literal, we need to reuse the path part from the segment if (i === 0 && isMatrixParams(commands[0])) { var /** @type {?} */ p = segmentGroup.segments[startIndex]; paths.push(new UrlSegment(p.path, commands[0])); i++; continue; } var /** @type {?} */ curr = getPath(commands[i]); var /** @type {?} */ next = (i < commands.length - 1) ? commands[i + 1] : null; if (curr && next && isMatrixParams(next)) { paths.push(new UrlSegment(curr, stringify(next))); i += 2; } else { paths.push(new UrlSegment(curr, {})); i++; } } return new UrlSegmentGroup(paths, {}); } /** * @param {?} outlets * @return {?} */ function createNewSegmentChildren(outlets) { var /** @type {?} */ children = {}; forEach(outlets, function (commands, outlet) { if (commands !== null) { children[outlet] = createNewSegmentGroup(new UrlSegmentGroup([], {}), 0, commands); } }); return children; } /** * @param {?} params * @return {?} */ function stringify(params) { var /** @type {?} */ res = {}; forEach(params, function (v, k) { return res[k] = "" + v; }); return res; } /** * @param {?} path * @param {?} params * @param {?} segment * @return {?} */ function compare(path, params, segment) { return path == segment.path && shallowEqual(params, segment.parameters); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var __assign$3 = (undefined && undefined.__assign) || Object.assign || function (t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; var NoMatch$1 = (function () { function NoMatch$1() { } return NoMatch$1; }()); /** * @param {?} rootComponentType * @param {?} config * @param {?} urlTree * @param {?} url * @return {?} */ function recognize(rootComponentType, config, urlTree, url) { return new Recognizer(rootComponentType, config, urlTree, url).recognize(); } var Recognizer = (function () { /** * @param {?} rootComponentType * @param {?} config * @param {?} urlTree * @param {?} url */ function Recognizer(rootComponentType, config, urlTree, url) { this.rootComponentType = rootComponentType; this.config = config; this.urlTree = urlTree; this.url = url; } /** * @return {?} */ Recognizer.prototype.recognize = function () { try { var /** @type {?} */ rootSegmentGroup = split$1(this.urlTree.root, [], [], this.config).segmentGroup; var /** @type {?} */ children = this.processSegmentGroup(this.config, rootSegmentGroup, PRIMARY_OUTLET); var /** @type {?} */ root = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze(this.urlTree.queryParams), /** @type {?} */ ((this.urlTree.fragment)), {}, PRIMARY_OUTLET, this.rootComponentType, null, this.urlTree.root, -1, {}); var /** @type {?} */ rootNode = new TreeNode(root, children); var /** @type {?} */ routeState = new RouterStateSnapshot(this.url, rootNode); this.inheriteParamsAndData(routeState._root); return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(routeState); } catch (e) { return new __WEBPACK_IMPORTED_MODULE_12_rxjs_Observable__["Observable"](function (obs) { return obs.error(e); }); } }; /** * @param {?} routeNode * @return {?} */ Recognizer.prototype.inheriteParamsAndData = function (routeNode) { var _this = this; var /** @type {?} */ route = routeNode.value; var /** @type {?} */ i = inheritedParamsDataResolve(route); route.params = Object.freeze(i.params); route.data = Object.freeze(i.data); routeNode.children.forEach(function (n) { return _this.inheriteParamsAndData(n); }); }; /** * @param {?} config * @param {?} segmentGroup * @param {?} outlet * @return {?} */ Recognizer.prototype.processSegmentGroup = function (config, segmentGroup, outlet) { if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) { return this.processChildren(config, segmentGroup); } return this.processSegment(config, segmentGroup, segmentGroup.segments, outlet); }; /** * @param {?} config * @param {?} segmentGroup * @return {?} */ Recognizer.prototype.processChildren = function (config, segmentGroup) { var _this = this; var /** @type {?} */ children = mapChildrenIntoArray(segmentGroup, function (child, childOutlet) { return _this.processSegmentGroup(config, child, childOutlet); }); checkOutletNameUniqueness(children); sortActivatedRouteSnapshots(children); return children; }; /** * @param {?} config * @param {?} segmentGroup * @param {?} segments * @param {?} outlet * @return {?} */ Recognizer.prototype.processSegment = function (config, segmentGroup, segments, outlet) { for (var _i = 0, config_1 = config; _i < config_1.length; _i++) { var r = config_1[_i]; try { return this.processSegmentAgainstRoute(r, segmentGroup, segments, outlet); } catch (e) { if (!(e instanceof NoMatch$1)) throw e; } } if (this.noLeftoversInUrl(segmentGroup, segments, outlet)) { return []; } throw new NoMatch$1(); }; /** * @param {?} segmentGroup * @param {?} segments * @param {?} outlet * @return {?} */ Recognizer.prototype.noLeftoversInUrl = function (segmentGroup, segments, outlet) { return segments.length === 0 && !segmentGroup.children[outlet]; }; /** * @param {?} route * @param {?} rawSegment * @param {?} segments * @param {?} outlet * @return {?} */ Recognizer.prototype.processSegmentAgainstRoute = function (route, rawSegment, segments, outlet) { if (route.redirectTo) throw new NoMatch$1(); if ((route.outlet || PRIMARY_OUTLET) !== outlet) throw new NoMatch$1(); if (route.path === '**') { var /** @type {?} */ params = segments.length > 0 ? ((last$1(segments))).parameters : {}; var /** @type {?} */ snapshot_1 = new ActivatedRouteSnapshot(segments, params, Object.freeze(this.urlTree.queryParams), /** @type {?} */ ((this.urlTree.fragment)), getData(route), outlet, /** @type {?} */ ((route.component)), route, getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + segments.length, getResolve(route)); return [new TreeNode(snapshot_1, [])]; } var _a = match$1(rawSegment, route, segments), consumedSegments = _a.consumedSegments, parameters = _a.parameters, lastChild = _a.lastChild; var /** @type {?} */ rawSlicedSegments = segments.slice(lastChild); var /** @type {?} */ childConfig = getChildConfig(route); var _b = split$1(rawSegment, consumedSegments, rawSlicedSegments, childConfig), segmentGroup = _b.segmentGroup, slicedSegments = _b.slicedSegments; var /** @type {?} */ snapshot = new ActivatedRouteSnapshot(consumedSegments, parameters, Object.freeze(this.urlTree.queryParams), /** @type {?} */ ((this.urlTree.fragment)), getData(route), outlet, /** @type {?} */ ((route.component)), route, getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + consumedSegments.length, getResolve(route)); if (slicedSegments.length === 0 && segmentGroup.hasChildren()) { var /** @type {?} */ children_3 = this.processChildren(childConfig, segmentGroup); return [new TreeNode(snapshot, children_3)]; } if (childConfig.length === 0 && slicedSegments.length === 0) { return [new TreeNode(snapshot, [])]; } var /** @type {?} */ children = this.processSegment(childConfig, segmentGroup, slicedSegments, PRIMARY_OUTLET); return [new TreeNode(snapshot, children)]; }; return Recognizer; }()); /** * @param {?} nodes * @return {?} */ function sortActivatedRouteSnapshots(nodes) { nodes.sort(function (a, b) { if (a.value.outlet === PRIMARY_OUTLET) return -1; if (b.value.outlet === PRIMARY_OUTLET) return 1; return a.value.outlet.localeCompare(b.value.outlet); }); } /** * @param {?} route * @return {?} */ function getChildConfig(route) { if (route.children) { return route.children; } if (route.loadChildren) { return ((route._loadedConfig)).routes; } return []; } /** * @param {?} segmentGroup * @param {?} route * @param {?} segments * @return {?} */ function match$1(segmentGroup, route, segments) { if (route.path === '') { if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || segments.length > 0)) { throw new NoMatch$1(); } return { consumedSegments: [], lastChild: 0, parameters: {} }; } var /** @type {?} */ matcher = route.matcher || defaultUrlMatcher; var /** @type {?} */ res = matcher(segments, segmentGroup, route); if (!res) throw new NoMatch$1(); var /** @type {?} */ posParams = {}; forEach(/** @type {?} */ ((res.posParams)), function (v, k) { posParams[k] = v.path; }); var /** @type {?} */ parameters = __assign$3({}, posParams, res.consumed[res.consumed.length - 1].parameters); return { consumedSegments: res.consumed, lastChild: res.consumed.length, parameters: parameters }; } /** * @param {?} nodes * @return {?} */ function checkOutletNameUniqueness(nodes) { var /** @type {?} */ names = {}; nodes.forEach(function (n) { var /** @type {?} */ routeWithSameOutletName = names[n.value.outlet]; if (routeWithSameOutletName) { var /** @type {?} */ p = routeWithSameOutletName.url.map(function (s) { return s.toString(); }).join('/'); var /** @type {?} */ c = n.value.url.map(function (s) { return s.toString(); }).join('/'); throw new Error("Two segments cannot have the same outlet name: '" + p + "' and '" + c + "'."); } names[n.value.outlet] = n.value; }); } /** * @param {?} segmentGroup * @return {?} */ function getSourceSegmentGroup(segmentGroup) { var /** @type {?} */ s = segmentGroup; while (s._sourceSegment) { s = s._sourceSegment; } return s; } /** * @param {?} segmentGroup * @return {?} */ function getPathIndexShift(segmentGroup) { var /** @type {?} */ s = segmentGroup; var /** @type {?} */ res = (s._segmentIndexShift ? s._segmentIndexShift : 0); while (s._sourceSegment) { s = s._sourceSegment; res += (s._segmentIndexShift ? s._segmentIndexShift : 0); } return res - 1; } /** * @param {?} segmentGroup * @param {?} consumedSegments * @param {?} slicedSegments * @param {?} config * @return {?} */ function split$1(segmentGroup, consumedSegments, slicedSegments, config) { if (slicedSegments.length > 0 && containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, config)) { var /** @type {?} */ s_1 = new UrlSegmentGroup(consumedSegments, createChildrenForEmptyPaths(segmentGroup, consumedSegments, config, new UrlSegmentGroup(slicedSegments, segmentGroup.children))); s_1._sourceSegment = segmentGroup; s_1._segmentIndexShift = consumedSegments.length; return { segmentGroup: s_1, slicedSegments: [] }; } if (slicedSegments.length === 0 && containsEmptyPathMatches(segmentGroup, slicedSegments, config)) { var /** @type {?} */ s_2 = new UrlSegmentGroup(segmentGroup.segments, addEmptyPathsToChildrenIfNeeded(segmentGroup, slicedSegments, config, segmentGroup.children)); s_2._sourceSegment = segmentGroup; s_2._segmentIndexShift = consumedSegments.length; return { segmentGroup: s_2, slicedSegments: slicedSegments }; } var /** @type {?} */ s = new UrlSegmentGroup(segmentGroup.segments, segmentGroup.children); s._sourceSegment = segmentGroup; s._segmentIndexShift = consumedSegments.length; return { segmentGroup: s, slicedSegments: slicedSegments }; } /** * @param {?} segmentGroup * @param {?} slicedSegments * @param {?} routes * @param {?} children * @return {?} */ function addEmptyPathsToChildrenIfNeeded(segmentGroup, slicedSegments, routes, children) { var /** @type {?} */ res = {}; for (var _i = 0, routes_3 = routes; _i < routes_3.length; _i++) { var r = routes_3[_i]; if (emptyPathMatch(segmentGroup, slicedSegments, r) && !children[getOutlet$2(r)]) { var /** @type {?} */ s = new UrlSegmentGroup([], {}); s._sourceSegment = segmentGroup; s._segmentIndexShift = segmentGroup.segments.length; res[getOutlet$2(r)] = s; } } return __assign$3({}, children, res); } /** * @param {?} segmentGroup * @param {?} consumedSegments * @param {?} routes * @param {?} primarySegment * @return {?} */ function createChildrenForEmptyPaths(segmentGroup, consumedSegments, routes, primarySegment) { var /** @type {?} */ res = {}; res[PRIMARY_OUTLET] = primarySegment; primarySegment._sourceSegment = segmentGroup; primarySegment._segmentIndexShift = consumedSegments.length; for (var _i = 0, routes_4 = routes; _i < routes_4.length; _i++) { var r = routes_4[_i]; if (r.path === '' && getOutlet$2(r) !== PRIMARY_OUTLET) { var /** @type {?} */ s = new UrlSegmentGroup([], {}); s._sourceSegment = segmentGroup; s._segmentIndexShift = consumedSegments.length; res[getOutlet$2(r)] = s; } } return res; } /** * @param {?} segmentGroup * @param {?} slicedSegments * @param {?} routes * @return {?} */ function containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, routes) { return routes.some(function (r) { return emptyPathMatch(segmentGroup, slicedSegments, r) && getOutlet$2(r) !== PRIMARY_OUTLET; }); } /** * @param {?} segmentGroup * @param {?} slicedSegments * @param {?} routes * @return {?} */ function containsEmptyPathMatches(segmentGroup, slicedSegments, routes) { return routes.some(function (r) { return emptyPathMatch(segmentGroup, slicedSegments, r); }); } /** * @param {?} segmentGroup * @param {?} slicedSegments * @param {?} r * @return {?} */ function emptyPathMatch(segmentGroup, slicedSegments, r) { if ((segmentGroup.hasChildren() || slicedSegments.length > 0) && r.pathMatch === 'full') { return false; } return r.path === '' && r.redirectTo === undefined; } /** * @param {?} route * @return {?} */ function getOutlet$2(route) { return route.outlet || PRIMARY_OUTLET; } /** * @param {?} route * @return {?} */ function getData(route) { return route.data || {}; } /** * @param {?} route * @return {?} */ function getResolve(route) { return route.resolve || {}; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@docsNotRequired * \@experimental */ var ROUTES = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["e" /* InjectionToken */]('ROUTES'); var RouterConfigLoader = (function () { /** * @param {?} loader * @param {?} compiler * @param {?=} onLoadStartListener * @param {?=} onLoadEndListener */ function RouterConfigLoader(loader, compiler, onLoadStartListener, onLoadEndListener) { this.loader = loader; this.compiler = compiler; this.onLoadStartListener = onLoadStartListener; this.onLoadEndListener = onLoadEndListener; } /** * @param {?} parentInjector * @param {?} route * @return {?} */ RouterConfigLoader.prototype.load = function (parentInjector, route) { var _this = this; if (this.onLoadStartListener) { this.onLoadStartListener(route); } var /** @type {?} */ moduleFactory$ = this.loadModuleFactory(/** @type {?} */ ((route.loadChildren))); return __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(moduleFactory$, function (factory) { if (_this.onLoadEndListener) { _this.onLoadEndListener(route); } var /** @type {?} */ module = factory.create(parentInjector); return new LoadedRouterConfig(flatten(module.injector.get(ROUTES)), module); }); }; /** * @param {?} loadChildren * @return {?} */ RouterConfigLoader.prototype.loadModuleFactory = function (loadChildren) { var _this = this; if (typeof loadChildren === 'string') { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_16_rxjs_observable_fromPromise__["fromPromise"])(this.loader.load(loadChildren)); } else { return __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__["mergeMap"].call(wrapIntoObservable(loadChildren()), function (t) { if (t instanceof __WEBPACK_IMPORTED_MODULE_1__angular_core__["_5" /* NgModuleFactory */]) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(t); } else { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_16_rxjs_observable_fromPromise__["fromPromise"])(_this.compiler.compileModuleAsync(t)); } }); } }; return RouterConfigLoader; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Contains all the router outlets created in a component. * * \@stable */ var RouterOutletMap = (function () { function RouterOutletMap() { /** * \@internal */ this._outlets = {}; } /** * Adds an outlet to this map. * @param {?} name * @param {?} outlet * @return {?} */ RouterOutletMap.prototype.registerOutlet = function (name, outlet) { this._outlets[name] = outlet; }; /** * Removes an outlet from this map. * @param {?} name * @return {?} */ RouterOutletMap.prototype.removeOutlet = function (name) { this._outlets[name] = ((undefined)); }; return RouterOutletMap; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Provides a way to migrate AngularJS applications to Angular. * * \@experimental * @abstract */ var UrlHandlingStrategy = (function () { function UrlHandlingStrategy() { } /** * Tells the router if this URL should be processed. * * When it returns true, the router will execute the regular navigation. * When it returns false, the router will set the router state to an empty state. * As a result, all the active components will be destroyed. * * @abstract * @param {?} url * @return {?} */ UrlHandlingStrategy.prototype.shouldProcessUrl = function (url) { }; /** * Extracts the part of the URL that should be handled by the router. * The rest of the URL will remain untouched. * @abstract * @param {?} url * @return {?} */ UrlHandlingStrategy.prototype.extract = function (url) { }; /** * Merges the URL fragment with the rest of the URL. * @abstract * @param {?} newUrlPart * @param {?} rawUrl * @return {?} */ UrlHandlingStrategy.prototype.merge = function (newUrlPart, rawUrl) { }; return UrlHandlingStrategy; }()); /** * \@experimental */ var DefaultUrlHandlingStrategy = (function () { function DefaultUrlHandlingStrategy() { } /** * @param {?} url * @return {?} */ DefaultUrlHandlingStrategy.prototype.shouldProcessUrl = function (url) { return true; }; /** * @param {?} url * @return {?} */ DefaultUrlHandlingStrategy.prototype.extract = function (url) { return url; }; /** * @param {?} newUrlPart * @param {?} wholeUrl * @return {?} */ DefaultUrlHandlingStrategy.prototype.merge = function (newUrlPart, wholeUrl) { return newUrlPart; }; return DefaultUrlHandlingStrategy; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var __assign = (undefined && undefined.__assign) || Object.assign || function (t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; /** * @param {?} error * @return {?} */ function defaultErrorHandler(error) { throw error; } /** * \@internal * @param {?} snapshot * @return {?} */ function defaultRouterHook(snapshot) { return (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(null)); } /** * Does not detach any subtrees. Reuses routes as long as their route config is the same. */ var DefaultRouteReuseStrategy = (function () { function DefaultRouteReuseStrategy() { } /** * @param {?} route * @return {?} */ DefaultRouteReuseStrategy.prototype.shouldDetach = function (route) { return false; }; /** * @param {?} route * @param {?} detachedTree * @return {?} */ DefaultRouteReuseStrategy.prototype.store = function (route, detachedTree) { }; /** * @param {?} route * @return {?} */ DefaultRouteReuseStrategy.prototype.shouldAttach = function (route) { return false; }; /** * @param {?} route * @return {?} */ DefaultRouteReuseStrategy.prototype.retrieve = function (route) { return null; }; /** * @param {?} future * @param {?} curr * @return {?} */ DefaultRouteReuseStrategy.prototype.shouldReuseRoute = function (future, curr) { return future.routeConfig === curr.routeConfig; }; return DefaultRouteReuseStrategy; }()); /** * \@whatItDoes Provides the navigation and url manipulation capabilities. * * See {\@link Routes} for more details and examples. * * \@ngModule RouterModule * * \@stable */ var Router = (function () { /** * @param {?} rootComponentType * @param {?} urlSerializer * @param {?} outletMap * @param {?} location * @param {?} injector * @param {?} loader * @param {?} compiler * @param {?} config */ function Router(rootComponentType, urlSerializer, outletMap, location, injector, loader, compiler, config) { var _this = this; this.rootComponentType = rootComponentType; this.urlSerializer = urlSerializer; this.outletMap = outletMap; this.location = location; this.config = config; this.navigations = new __WEBPACK_IMPORTED_MODULE_2_rxjs_BehaviorSubject__["BehaviorSubject"](/** @type {?} */ ((null))); this.routerEvents = new __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__["Subject"](); this.navigationId = 0; /** * Error handler that is invoked when a navigation errors. * * See {@link ErrorHandler} for more information. */ this.errorHandler = defaultErrorHandler; /** * Indicates if at least one navigation happened. */ this.navigated = false; /** * Used by RouterModule. This allows us to * pause the navigation either before preactivation or after it. * \@internal */ this.hooks = { beforePreactivation: defaultRouterHook, afterPreactivation: defaultRouterHook }; /** * Extracts and merges URLs. Used for AngularJS to Angular migrations. */ this.urlHandlingStrategy = new DefaultUrlHandlingStrategy(); this.routeReuseStrategy = new DefaultRouteReuseStrategy(); var onLoadStart = function (r) { return _this.triggerEvent(new RouteConfigLoadStart(r)); }; var onLoadEnd = function (r) { return _this.triggerEvent(new RouteConfigLoadEnd(r)); }; this.ngModule = injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* NgModuleRef */]); this.resetConfig(config); this.currentUrlTree = createEmptyUrlTree(); this.rawUrlTree = this.currentUrlTree; this.configLoader = new RouterConfigLoader(loader, compiler, onLoadStart, onLoadEnd); this.currentRouterState = createEmptyState(this.currentUrlTree, this.rootComponentType); this.processNavigations(); } /** * \@internal * TODO: this should be removed once the constructor of the router made internal * @param {?} rootComponentType * @return {?} */ Router.prototype.resetRootComponentType = function (rootComponentType) { this.rootComponentType = rootComponentType; // TODO: vsavkin router 4.0 should make the root component set to null // this will simplify the lifecycle of the router. this.currentRouterState.root.component = this.rootComponentType; }; /** * Sets up the location change listener and performs the initial navigation. * @return {?} */ Router.prototype.initialNavigation = function () { this.setUpLocationChangeListener(); if (this.navigationId === 0) { this.navigateByUrl(this.location.path(true), { replaceUrl: true }); } }; /** * Sets up the location change listener. * @return {?} */ Router.prototype.setUpLocationChangeListener = function () { var _this = this; // Zone.current.wrap is needed because of the issue with RxJS scheduler, // which does not work properly with zone.js in IE and Safari if (!this.locationSubscription) { this.locationSubscription = (this.location.subscribe(Zone.current.wrap(function (change) { var /** @type {?} */ rawUrlTree = _this.urlSerializer.parse(change['url']); var /** @type {?} */ source = change['type'] === 'popstate' ? 'popstate' : 'hashchange'; setTimeout(function () { _this.scheduleNavigation(rawUrlTree, source, { replaceUrl: true }); }, 0); }))); } }; Object.defineProperty(Router.prototype, "routerState", { /** * The current route state * @return {?} */ get: function () { return this.currentRouterState; }, enumerable: true, configurable: true }); Object.defineProperty(Router.prototype, "url", { /** * The current url * @return {?} */ get: function () { return this.serializeUrl(this.currentUrlTree); }, enumerable: true, configurable: true }); Object.defineProperty(Router.prototype, "events", { /** * An observable of router events * @return {?} */ get: function () { return this.routerEvents; }, enumerable: true, configurable: true }); /** * \@internal * @param {?} e * @return {?} */ Router.prototype.triggerEvent = function (e) { this.routerEvents.next(e); }; /** * Resets the configuration used for navigation and generating links. * * ### Usage * * ``` * router.resetConfig([ * { path: 'team/:id', component: TeamCmp, children: [ * { path: 'simple', component: SimpleCmp }, * { path: 'user/:name', component: UserCmp } * ]} * ]); * ``` * @param {?} config * @return {?} */ Router.prototype.resetConfig = function (config) { validateConfig(config); this.config = config; }; /** * \@docsNotRequired * @return {?} */ Router.prototype.ngOnDestroy = function () { this.dispose(); }; /** * Disposes of the router * @return {?} */ Router.prototype.dispose = function () { if (this.locationSubscription) { this.locationSubscription.unsubscribe(); this.locationSubscription = ((null)); } }; /** * Applies an array of commands to the current url tree and creates a new url tree. * * When given an activate route, applies the given commands starting from the route. * When not given a route, applies the given command starting from the root. * * ### Usage * * ``` * // create /team/33/user/11 * router.createUrlTree(['/team', 33, 'user', 11]); * * // create /team/33;expand=true/user/11 * router.createUrlTree(['/team', 33, {expand: true}, 'user', 11]); * * // you can collapse static segments like this (this works only with the first passed-in value): * router.createUrlTree(['/team/33/user', userId]); * * // If the first segment can contain slashes, and you do not want the router to split it, you * // can do the following: * * router.createUrlTree([{segmentPath: '/one/two'}]); * * // create /team/33/(user/11//right:chat) * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: 'chat'}}]); * * // remove the right secondary node * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: null}}]); * * // assuming the current url is `/team/33/user/11` and the route points to `user/11` * * // navigate to /team/33/user/11/details * router.createUrlTree(['details'], {relativeTo: route}); * * // navigate to /team/33/user/22 * router.createUrlTree(['../22'], {relativeTo: route}); * * // navigate to /team/44/user/22 * router.createUrlTree(['../../team/44/user/22'], {relativeTo: route}); * ``` * @param {?} commands * @param {?=} __1 * @return {?} */ Router.prototype.createUrlTree = function (commands, _a) { var _b = _a === void 0 ? {} : _a, relativeTo = _b.relativeTo, queryParams = _b.queryParams, fragment = _b.fragment, preserveQueryParams = _b.preserveQueryParams, queryParamsHandling = _b.queryParamsHandling, preserveFragment = _b.preserveFragment; if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__angular_core__["E" /* isDevMode */])() && preserveQueryParams && (console) && (console.warn)) { console.warn('preserveQueryParams is deprecated, use queryParamsHandling instead.'); } var /** @type {?} */ a = relativeTo || this.routerState.root; var /** @type {?} */ f = preserveFragment ? this.currentUrlTree.fragment : fragment; var /** @type {?} */ q = null; if (queryParamsHandling) { switch (queryParamsHandling) { case 'merge': q = __assign({}, this.currentUrlTree.queryParams, queryParams); break; case 'preserve': q = this.currentUrlTree.queryParams; break; default: q = queryParams || null; } } else { q = preserveQueryParams ? this.currentUrlTree.queryParams : queryParams || null; } return createUrlTree(a, this.currentUrlTree, commands, /** @type {?} */ ((q)), /** @type {?} */ ((f))); }; /** * Navigate based on the provided url. This navigation is always absolute. * * Returns a promise that: * - resolves to 'true' when navigation succeeds, * - resolves to 'false' when navigation fails, * - is rejected when an error happens. * * ### Usage * * ``` * router.navigateByUrl("/team/33/user/11"); * * // Navigate without updating the URL * router.navigateByUrl("/team/33/user/11", { skipLocationChange: true }); * ``` * * In opposite to `navigate`, `navigateByUrl` takes a whole URL * and does not apply any delta to the current one. * @param {?} url * @param {?=} extras * @return {?} */ Router.prototype.navigateByUrl = function (url, extras) { if (extras === void 0) { extras = { skipLocationChange: false }; } var /** @type {?} */ urlTree = url instanceof UrlTree ? url : this.parseUrl(url); var /** @type {?} */ mergedTree = this.urlHandlingStrategy.merge(urlTree, this.rawUrlTree); return this.scheduleNavigation(mergedTree, 'imperative', extras); }; /** * Navigate based on the provided array of commands and a starting point. * If no starting route is provided, the navigation is absolute. * * Returns a promise that: * - resolves to 'true' when navigation succeeds, * - resolves to 'false' when navigation fails, * - is rejected when an error happens. * * ### Usage * * ``` * router.navigate(['team', 33, 'user', 11], {relativeTo: route}); * * // Navigate without updating the URL * router.navigate(['team', 33, 'user', 11], {relativeTo: route, skipLocationChange: true}); * ``` * * In opposite to `navigateByUrl`, `navigate` always takes a delta that is applied to the current * URL. * @param {?} commands * @param {?=} extras * @return {?} */ Router.prototype.navigate = function (commands, extras) { if (extras === void 0) { extras = { skipLocationChange: false }; } validateCommands(commands); if (typeof extras.queryParams === 'object' && extras.queryParams !== null) { extras.queryParams = this.removeEmptyProps(extras.queryParams); } return this.navigateByUrl(this.createUrlTree(commands, extras), extras); }; /** * Serializes a {\@link UrlTree} into a string * @param {?} url * @return {?} */ Router.prototype.serializeUrl = function (url) { return this.urlSerializer.serialize(url); }; /** * Parses a string into a {\@link UrlTree} * @param {?} url * @return {?} */ Router.prototype.parseUrl = function (url) { return this.urlSerializer.parse(url); }; /** * Returns whether the url is activated * @param {?} url * @param {?} exact * @return {?} */ Router.prototype.isActive = function (url, exact) { if (url instanceof UrlTree) { return containsTree(this.currentUrlTree, url, exact); } else { var /** @type {?} */ urlTree = this.urlSerializer.parse(url); return containsTree(this.currentUrlTree, urlTree, exact); } }; /** * @param {?} params * @return {?} */ Router.prototype.removeEmptyProps = function (params) { return Object.keys(params).reduce(function (result, key) { var /** @type {?} */ value = params[key]; if (value !== null && value !== undefined) { result[key] = value; } return result; }, {}); }; /** * @return {?} */ Router.prototype.processNavigations = function () { var _this = this; __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_concatMap__["concatMap"] .call(this.navigations, function (nav) { if (nav) { _this.executeScheduledNavigation(nav); // a failed navigation should not stop the router from processing // further navigations => the catch return nav.promise.catch(function () { }); } else { return (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(null)); } }) .subscribe(function () { }); }; /** * @param {?} rawUrl * @param {?} source * @param {?} extras * @return {?} */ Router.prototype.scheduleNavigation = function (rawUrl, source, extras) { var /** @type {?} */ lastNavigation = this.navigations.value; // If the user triggers a navigation imperatively (e.g., by using navigateByUrl), // and that navigation results in 'replaceState' that leads to the same URL, // we should skip those. if (lastNavigation && source !== 'imperative' && lastNavigation.source === 'imperative' && lastNavigation.rawUrl.toString() === rawUrl.toString()) { return Promise.resolve(true); // return value is not used } // Because of a bug in IE and Edge, the location class fires two events (popstate and // hashchange) every single time. The second one should be ignored. Otherwise, the URL will // flicker. if (lastNavigation && source == 'hashchange' && lastNavigation.source === 'popstate' && lastNavigation.rawUrl.toString() === rawUrl.toString()) { return Promise.resolve(true); // return value is not used } var /** @type {?} */ resolve = null; var /** @type {?} */ reject = null; var /** @type {?} */ promise = new Promise(function (res, rej) { resolve = res; reject = rej; }); var /** @type {?} */ id = ++this.navigationId; this.navigations.next({ id: id, source: source, rawUrl: rawUrl, extras: extras, resolve: resolve, reject: reject, promise: promise }); // Make sure that the error is propagated even though `processNavigations` catch // handler does not rethrow return promise.catch(function (e) { return Promise.reject(e); }); }; /** * @param {?} __0 * @return {?} */ Router.prototype.executeScheduledNavigation = function (_a) { var _this = this; var id = _a.id, rawUrl = _a.rawUrl, extras = _a.extras, resolve = _a.resolve, reject = _a.reject; var /** @type {?} */ url = this.urlHandlingStrategy.extract(rawUrl); var /** @type {?} */ urlTransition = !this.navigated || url.toString() !== this.currentUrlTree.toString(); if (urlTransition && this.urlHandlingStrategy.shouldProcessUrl(rawUrl)) { this.routerEvents.next(new NavigationStart(id, this.serializeUrl(url))); Promise.resolve() .then(function (_) { return _this.runNavigate(url, rawUrl, !!extras.skipLocationChange, !!extras.replaceUrl, id, null); }) .then(resolve, reject); } else if (urlTransition && this.rawUrlTree && this.urlHandlingStrategy.shouldProcessUrl(this.rawUrlTree)) { this.routerEvents.next(new NavigationStart(id, this.serializeUrl(url))); Promise.resolve() .then(function (_) { return _this.runNavigate(url, rawUrl, false, false, id, createEmptyState(url, _this.rootComponentType).snapshot); }) .then(resolve, reject); } else { this.rawUrlTree = rawUrl; resolve(null); } }; /** * @param {?} url * @param {?} rawUrl * @param {?} shouldPreventPushState * @param {?} shouldReplaceUrl * @param {?} id * @param {?} precreatedState * @return {?} */ Router.prototype.runNavigate = function (url, rawUrl, shouldPreventPushState, shouldReplaceUrl, id, precreatedState) { var _this = this; if (id !== this.navigationId) { this.location.go(this.urlSerializer.serialize(this.currentUrlTree)); this.routerEvents.next(new NavigationCancel(id, this.serializeUrl(url), "Navigation ID " + id + " is not equal to the current navigation id " + this.navigationId)); return Promise.resolve(false); } return new Promise(function (resolvePromise, rejectPromise) { // create an observable of the url and route state snapshot // this operation do not result in any side effects var /** @type {?} */ urlAndSnapshot$; if (!precreatedState) { var /** @type {?} */ moduleInjector = _this.ngModule.injector; var /** @type {?} */ redirectsApplied$ = applyRedirects(moduleInjector, _this.configLoader, _this.urlSerializer, url, _this.config); urlAndSnapshot$ = __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__["mergeMap"].call(redirectsApplied$, function (appliedUrl) { return __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(recognize(_this.rootComponentType, _this.config, appliedUrl, _this.serializeUrl(appliedUrl)), function (snapshot) { _this.routerEvents.next(new RoutesRecognized(id, _this.serializeUrl(url), _this.serializeUrl(appliedUrl), snapshot)); return { appliedUrl: appliedUrl, snapshot: snapshot }; }); }); } else { urlAndSnapshot$ = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])({ appliedUrl: url, snapshot: precreatedState }); } var /** @type {?} */ beforePreactivationDone$ = __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__["mergeMap"].call(urlAndSnapshot$, function (p) { return __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(_this.hooks.beforePreactivation(p.snapshot), function () { return p; }); }); // run preactivation: guards and data resolvers var /** @type {?} */ preActivation; var /** @type {?} */ preactivationTraverse$ = __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(beforePreactivationDone$, function (_a) { var appliedUrl = _a.appliedUrl, snapshot = _a.snapshot; var /** @type {?} */ moduleInjector = _this.ngModule.injector; preActivation = new PreActivation(snapshot, _this.currentRouterState.snapshot, moduleInjector); preActivation.traverse(_this.outletMap); return { appliedUrl: appliedUrl, snapshot: snapshot }; }); var /** @type {?} */ preactivationCheckGuards$ = __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__["mergeMap"].call(preactivationTraverse$, function (_a) { var appliedUrl = _a.appliedUrl, snapshot = _a.snapshot; if (_this.navigationId !== id) return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(false); return __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(preActivation.checkGuards(), function (shouldActivate) { return { appliedUrl: appliedUrl, snapshot: snapshot, shouldActivate: shouldActivate }; }); }); var /** @type {?} */ preactivationResolveData$ = __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__["mergeMap"].call(preactivationCheckGuards$, function (p) { if (_this.navigationId !== id) return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(false); if (p.shouldActivate) { return __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(preActivation.resolveData(), function () { return p; }); } else { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(p); } }); var /** @type {?} */ preactivationDone$ = __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__["mergeMap"].call(preactivationResolveData$, function (p) { return __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(_this.hooks.afterPreactivation(p.snapshot), function () { return p; }); }); // create router state // this operation has side effects => route state is being affected var /** @type {?} */ routerState$ = __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(preactivationDone$, function (_a) { var appliedUrl = _a.appliedUrl, snapshot = _a.snapshot, shouldActivate = _a.shouldActivate; if (shouldActivate) { var /** @type {?} */ state = createRouterState(_this.routeReuseStrategy, snapshot, _this.currentRouterState); return { appliedUrl: appliedUrl, state: state, shouldActivate: shouldActivate }; } else { return { appliedUrl: appliedUrl, state: null, shouldActivate: shouldActivate }; } }); // applied the new router state // this operation has side effects var /** @type {?} */ navigationIsSuccessful; var /** @type {?} */ storedState = _this.currentRouterState; var /** @type {?} */ storedUrl = _this.currentUrlTree; routerState$ .forEach(function (_a) { var appliedUrl = _a.appliedUrl, state = _a.state, shouldActivate = _a.shouldActivate; if (!shouldActivate || id !== _this.navigationId) { navigationIsSuccessful = false; return; } _this.currentUrlTree = appliedUrl; _this.rawUrlTree = _this.urlHandlingStrategy.merge(_this.currentUrlTree, rawUrl); _this.currentRouterState = state; if (!shouldPreventPushState) { var /** @type {?} */ path = _this.urlSerializer.serialize(_this.rawUrlTree); if (_this.location.isCurrentPathEqualTo(path) || shouldReplaceUrl) { _this.location.replaceState(path); } else { _this.location.go(path); } } new ActivateRoutes(_this.routeReuseStrategy, state, storedState) .activate(_this.outletMap); navigationIsSuccessful = true; }) .then(function () { if (navigationIsSuccessful) { _this.navigated = true; _this.routerEvents.next(new NavigationEnd(id, _this.serializeUrl(url), _this.serializeUrl(_this.currentUrlTree))); resolvePromise(true); } else { _this.resetUrlToCurrentUrlTree(); _this.routerEvents.next(new NavigationCancel(id, _this.serializeUrl(url), '')); resolvePromise(false); } }, function (e) { if (isNavigationCancelingError(e)) { _this.resetUrlToCurrentUrlTree(); _this.navigated = true; _this.routerEvents.next(new NavigationCancel(id, _this.serializeUrl(url), e.message)); resolvePromise(false); } else { _this.routerEvents.next(new NavigationError(id, _this.serializeUrl(url), e)); try { resolvePromise(_this.errorHandler(e)); } catch (ee) { rejectPromise(ee); } } _this.currentRouterState = storedState; _this.currentUrlTree = storedUrl; _this.rawUrlTree = _this.urlHandlingStrategy.merge(_this.currentUrlTree, rawUrl); _this.location.replaceState(_this.serializeUrl(_this.rawUrlTree)); }); }); }; /** * @return {?} */ Router.prototype.resetUrlToCurrentUrlTree = function () { var /** @type {?} */ path = this.urlSerializer.serialize(this.rawUrlTree); this.location.replaceState(path); }; return Router; }()); var CanActivate = (function () { /** * @param {?} path */ function CanActivate(path) { this.path = path; } Object.defineProperty(CanActivate.prototype, "route", { /** * @return {?} */ get: function () { return this.path[this.path.length - 1]; }, enumerable: true, configurable: true }); return CanActivate; }()); var CanDeactivate = (function () { /** * @param {?} component * @param {?} route */ function CanDeactivate(component, route) { this.component = component; this.route = route; } return CanDeactivate; }()); var PreActivation = (function () { /** * @param {?} future * @param {?} curr * @param {?} moduleInjector */ function PreActivation(future, curr, moduleInjector) { this.future = future; this.curr = curr; this.moduleInjector = moduleInjector; this.canActivateChecks = []; this.canDeactivateChecks = []; } /** * @param {?} parentOutletMap * @return {?} */ PreActivation.prototype.traverse = function (parentOutletMap) { var /** @type {?} */ futureRoot = this.future._root; var /** @type {?} */ currRoot = this.curr ? this.curr._root : null; this.traverseChildRoutes(futureRoot, currRoot, parentOutletMap, [futureRoot.value]); }; /** * @return {?} */ PreActivation.prototype.checkGuards = function () { var _this = this; if (this.canDeactivateChecks.length === 0 && this.canActivateChecks.length === 0) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(true); } var /** @type {?} */ canDeactivate$ = this.runCanDeactivateChecks(); return __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__["mergeMap"].call(canDeactivate$, function (canDeactivate) { return canDeactivate ? _this.runCanActivateChecks() : __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(false); }); }; /** * @return {?} */ PreActivation.prototype.resolveData = function () { var _this = this; if (this.canActivateChecks.length === 0) return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(null); var /** @type {?} */ checks$ = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_from__["from"])(this.canActivateChecks); var /** @type {?} */ runningChecks$ = __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_concatMap__["concatMap"].call(checks$, function (check) { return _this.runResolve(check.route); }); return __WEBPACK_IMPORTED_MODULE_11_rxjs_operator_reduce__["reduce"].call(runningChecks$, function (_, __) { return _; }); }; /** * @param {?} futureNode * @param {?} currNode * @param {?} outletMap * @param {?} futurePath * @return {?} */ PreActivation.prototype.traverseChildRoutes = function (futureNode, currNode, outletMap, futurePath) { var _this = this; var /** @type {?} */ prevChildren = nodeChildrenAsMap(currNode); futureNode.children.forEach(function (c) { _this.traverseRoutes(c, prevChildren[c.value.outlet], outletMap, futurePath.concat([c.value])); delete prevChildren[c.value.outlet]; }); forEach(prevChildren, function (v, k) { return _this.deactiveRouteAndItsChildren(v, /** @type {?} */ ((outletMap))._outlets[k]); }); }; /** * @param {?} futureNode * @param {?} currNode * @param {?} parentOutletMap * @param {?} futurePath * @return {?} */ PreActivation.prototype.traverseRoutes = function (futureNode, currNode, parentOutletMap, futurePath) { var /** @type {?} */ future = futureNode.value; var /** @type {?} */ curr = currNode ? currNode.value : null; var /** @type {?} */ outlet = parentOutletMap ? parentOutletMap._outlets[futureNode.value.outlet] : null; // reusing the node if (curr && future._routeConfig === curr._routeConfig) { if (this.shouldRunGuardsAndResolvers(curr, future, /** @type {?} */ ((future._routeConfig)).runGuardsAndResolvers)) { this.canActivateChecks.push(new CanActivate(futurePath)); this.canDeactivateChecks.push(new CanDeactivate(/** @type {?} */ ((outlet)).component, curr)); } else { // we need to set the data future.data = curr.data; future._resolvedData = curr._resolvedData; } // If we have a component, we need to go through an outlet. if (future.component) { this.traverseChildRoutes(futureNode, currNode, outlet ? outlet.outletMap : null, futurePath); } else { this.traverseChildRoutes(futureNode, currNode, parentOutletMap, futurePath); } } else { if (curr) { this.deactiveRouteAndItsChildren(currNode, outlet); } this.canActivateChecks.push(new CanActivate(futurePath)); // If we have a component, we need to go through an outlet. if (future.component) { this.traverseChildRoutes(futureNode, null, outlet ? outlet.outletMap : null, futurePath); } else { this.traverseChildRoutes(futureNode, null, parentOutletMap, futurePath); } } }; /** * @param {?} curr * @param {?} future * @param {?} mode * @return {?} */ PreActivation.prototype.shouldRunGuardsAndResolvers = function (curr, future, mode) { switch (mode) { case 'always': return true; case 'paramsOrQueryParamsChange': return !equalParamsAndUrlSegments(curr, future) || !shallowEqual(curr.queryParams, future.queryParams); case 'paramsChange': default: return !equalParamsAndUrlSegments(curr, future); } }; /** * @param {?} route * @param {?} outlet * @return {?} */ PreActivation.prototype.deactiveRouteAndItsChildren = function (route, outlet) { var _this = this; var /** @type {?} */ prevChildren = nodeChildrenAsMap(route); var /** @type {?} */ r = route.value; forEach(prevChildren, function (v, k) { if (!r.component) { _this.deactiveRouteAndItsChildren(v, outlet); } else if (!!outlet) { _this.deactiveRouteAndItsChildren(v, outlet.outletMap._outlets[k]); } else { _this.deactiveRouteAndItsChildren(v, null); } }); if (!r.component) { this.canDeactivateChecks.push(new CanDeactivate(null, r)); } else if (outlet && outlet.isActivated) { this.canDeactivateChecks.push(new CanDeactivate(outlet.component, r)); } else { this.canDeactivateChecks.push(new CanDeactivate(null, r)); } }; /** * @return {?} */ PreActivation.prototype.runCanDeactivateChecks = function () { var _this = this; var /** @type {?} */ checks$ = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_from__["from"])(this.canDeactivateChecks); var /** @type {?} */ runningChecks$ = __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__["mergeMap"].call(checks$, function (check) { return _this.runCanDeactivate(check.component, check.route); }); return __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_every__["every"].call(runningChecks$, function (result) { return result === true; }); }; /** * @return {?} */ PreActivation.prototype.runCanActivateChecks = function () { var _this = this; var /** @type {?} */ checks$ = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_from__["from"])(this.canActivateChecks); var /** @type {?} */ runningChecks$ = __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__["mergeMap"].call(checks$, function (check) { return andObservables(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_from__["from"])([_this.runCanActivateChild(check.path), _this.runCanActivate(check.route)])); }); return __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_every__["every"].call(runningChecks$, function (result) { return result === true; }); }; /** * @param {?} future * @return {?} */ PreActivation.prototype.runCanActivate = function (future) { var _this = this; var /** @type {?} */ canActivate = future._routeConfig ? future._routeConfig.canActivate : null; if (!canActivate || canActivate.length === 0) return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(true); var /** @type {?} */ obs = __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_from__["from"])(canActivate), function (c) { var /** @type {?} */ guard = _this.getToken(c, future); var /** @type {?} */ observable; if (guard.canActivate) { observable = wrapIntoObservable(guard.canActivate(future, _this.future)); } else { observable = wrapIntoObservable(guard(future, _this.future)); } return __WEBPACK_IMPORTED_MODULE_8_rxjs_operator_first__["first"].call(observable); }); return andObservables(obs); }; /** * @param {?} path * @return {?} */ PreActivation.prototype.runCanActivateChild = function (path) { var _this = this; var /** @type {?} */ future = path[path.length - 1]; var /** @type {?} */ canActivateChildGuards = path.slice(0, path.length - 1) .reverse() .map(function (p) { return _this.extractCanActivateChild(p); }) .filter(function (_) { return _ !== null; }); return andObservables(__WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_from__["from"])(canActivateChildGuards), function (d) { var /** @type {?} */ obs = __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_from__["from"])(d.guards), function (c) { var /** @type {?} */ guard = _this.getToken(c, d.node); var /** @type {?} */ observable; if (guard.canActivateChild) { observable = wrapIntoObservable(guard.canActivateChild(future, _this.future)); } else { observable = wrapIntoObservable(guard(future, _this.future)); } return __WEBPACK_IMPORTED_MODULE_8_rxjs_operator_first__["first"].call(observable); }); return andObservables(obs); })); }; /** * @param {?} p * @return {?} */ PreActivation.prototype.extractCanActivateChild = function (p) { var /** @type {?} */ canActivateChild = p._routeConfig ? p._routeConfig.canActivateChild : null; if (!canActivateChild || canActivateChild.length === 0) return null; return { node: p, guards: canActivateChild }; }; /** * @param {?} component * @param {?} curr * @return {?} */ PreActivation.prototype.runCanDeactivate = function (component, curr) { var _this = this; var /** @type {?} */ canDeactivate = curr && curr._routeConfig ? curr._routeConfig.canDeactivate : null; if (!canDeactivate || canDeactivate.length === 0) return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(true); var /** @type {?} */ canDeactivate$ = __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__["mergeMap"].call(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_from__["from"])(canDeactivate), function (c) { var /** @type {?} */ guard = _this.getToken(c, curr); var /** @type {?} */ observable; if (guard.canDeactivate) { observable = wrapIntoObservable(guard.canDeactivate(component, curr, _this.curr, _this.future)); } else { observable = wrapIntoObservable(guard(component, curr, _this.curr, _this.future)); } return __WEBPACK_IMPORTED_MODULE_8_rxjs_operator_first__["first"].call(observable); }); return __WEBPACK_IMPORTED_MODULE_7_rxjs_operator_every__["every"].call(canDeactivate$, function (result) { return result === true; }); }; /** * @param {?} future * @return {?} */ PreActivation.prototype.runResolve = function (future) { var /** @type {?} */ resolve = future._resolve; return __WEBPACK_IMPORTED_MODULE_9_rxjs_operator_map__["map"].call(this.resolveNode(resolve, future), function (resolvedData) { future._resolvedData = resolvedData; future.data = __assign({}, future.data, inheritedParamsDataResolve(future).resolve); return null; }); }; /** * @param {?} resolve * @param {?} future * @return {?} */ PreActivation.prototype.resolveNode = function (resolve, future) { var _this = this; return waitForMap(resolve, function (k, v) { var /** @type {?} */ resolver = _this.getToken(v, future); return resolver.resolve ? wrapIntoObservable(resolver.resolve(future, _this.future)) : wrapIntoObservable(resolver(future, _this.future)); }); }; /** * @param {?} token * @param {?} snapshot * @return {?} */ PreActivation.prototype.getToken = function (token, snapshot) { var /** @type {?} */ config = closestLoadedConfig(snapshot); var /** @type {?} */ injector = config ? config.module.injector : this.moduleInjector; return injector.get(token); }; return PreActivation; }()); var ActivateRoutes = (function () { /** * @param {?} routeReuseStrategy * @param {?} futureState * @param {?} currState */ function ActivateRoutes(routeReuseStrategy, futureState, currState) { this.routeReuseStrategy = routeReuseStrategy; this.futureState = futureState; this.currState = currState; } /** * @param {?} parentOutletMap * @return {?} */ ActivateRoutes.prototype.activate = function (parentOutletMap) { var /** @type {?} */ futureRoot = this.futureState._root; var /** @type {?} */ currRoot = this.currState ? this.currState._root : null; this.deactivateChildRoutes(futureRoot, currRoot, parentOutletMap); advanceActivatedRoute(this.futureState.root); this.activateChildRoutes(futureRoot, currRoot, parentOutletMap); }; /** * @param {?} futureNode * @param {?} currNode * @param {?} outletMap * @return {?} */ ActivateRoutes.prototype.deactivateChildRoutes = function (futureNode, currNode, outletMap) { var _this = this; var /** @type {?} */ prevChildren = nodeChildrenAsMap(currNode); futureNode.children.forEach(function (c) { _this.deactivateRoutes(c, prevChildren[c.value.outlet], outletMap); delete prevChildren[c.value.outlet]; }); forEach(prevChildren, function (v, k) { return _this.deactiveRouteAndItsChildren(v, outletMap); }); }; /** * @param {?} futureNode * @param {?} currNode * @param {?} outletMap * @return {?} */ ActivateRoutes.prototype.activateChildRoutes = function (futureNode, currNode, outletMap) { var _this = this; var /** @type {?} */ prevChildren = nodeChildrenAsMap(currNode); futureNode.children.forEach(function (c) { _this.activateRoutes(c, prevChildren[c.value.outlet], outletMap); }); }; /** * @param {?} futureNode * @param {?} currNode * @param {?} parentOutletMap * @return {?} */ ActivateRoutes.prototype.deactivateRoutes = function (futureNode, currNode, parentOutletMap) { var /** @type {?} */ future = futureNode.value; var /** @type {?} */ curr = currNode ? currNode.value : null; // reusing the node if (future === curr) { // If we have a normal route, we need to go through an outlet. if (future.component) { var /** @type {?} */ outlet = getOutlet(parentOutletMap, future); this.deactivateChildRoutes(futureNode, currNode, outlet.outletMap); } else { this.deactivateChildRoutes(futureNode, currNode, parentOutletMap); } } else { if (curr) { this.deactiveRouteAndItsChildren(currNode, parentOutletMap); } } }; /** * @param {?} futureNode * @param {?} currNode * @param {?} parentOutletMap * @return {?} */ ActivateRoutes.prototype.activateRoutes = function (futureNode, currNode, parentOutletMap) { var /** @type {?} */ future = futureNode.value; var /** @type {?} */ curr = currNode ? currNode.value : null; // reusing the node if (future === curr) { // advance the route to push the parameters advanceActivatedRoute(future); // If we have a normal route, we need to go through an outlet. if (future.component) { var /** @type {?} */ outlet = getOutlet(parentOutletMap, future); this.activateChildRoutes(futureNode, currNode, outlet.outletMap); } else { this.activateChildRoutes(futureNode, currNode, parentOutletMap); } } else { // if we have a normal route, we need to advance the route // and place the component into the outlet. After that recurse. if (future.component) { advanceActivatedRoute(future); var /** @type {?} */ outlet = getOutlet(parentOutletMap, futureNode.value); if (this.routeReuseStrategy.shouldAttach(future.snapshot)) { var /** @type {?} */ stored = ((this.routeReuseStrategy.retrieve(future.snapshot))); this.routeReuseStrategy.store(future.snapshot, null); outlet.attach(stored.componentRef, stored.route.value); advanceActivatedRouteNodeAndItsChildren(stored.route); } else { var /** @type {?} */ outletMap = new RouterOutletMap(); this.placeComponentIntoOutlet(outletMap, future, outlet); this.activateChildRoutes(futureNode, null, outletMap); } } else { advanceActivatedRoute(future); this.activateChildRoutes(futureNode, null, parentOutletMap); } } }; /** * @param {?} outletMap * @param {?} future * @param {?} outlet * @return {?} */ ActivateRoutes.prototype.placeComponentIntoOutlet = function (outletMap, future, outlet) { var /** @type {?} */ config = parentLoadedConfig(future.snapshot); var /** @type {?} */ cmpFactoryResolver = config ? config.module.componentFactoryResolver : null; outlet.activateWith(future, cmpFactoryResolver, outletMap); }; /** * @param {?} route * @param {?} parentOutletMap * @return {?} */ ActivateRoutes.prototype.deactiveRouteAndItsChildren = function (route, parentOutletMap) { if (this.routeReuseStrategy.shouldDetach(route.value.snapshot)) { this.detachAndStoreRouteSubtree(route, parentOutletMap); } else { this.deactiveRouteAndOutlet(route, parentOutletMap); } }; /** * @param {?} route * @param {?} parentOutletMap * @return {?} */ ActivateRoutes.prototype.detachAndStoreRouteSubtree = function (route, parentOutletMap) { var /** @type {?} */ outlet = getOutlet(parentOutletMap, route.value); var /** @type {?} */ componentRef = outlet.detach(); this.routeReuseStrategy.store(route.value.snapshot, { componentRef: componentRef, route: route }); }; /** * @param {?} route * @param {?} parentOutletMap * @return {?} */ ActivateRoutes.prototype.deactiveRouteAndOutlet = function (route, parentOutletMap) { var _this = this; var /** @type {?} */ prevChildren = nodeChildrenAsMap(route); var /** @type {?} */ outlet = null; // getOutlet throws when cannot find the right outlet, // which can happen if an outlet was in an NgIf and was removed try { outlet = getOutlet(parentOutletMap, route.value); } catch (e) { return; } var /** @type {?} */ childOutletMap = outlet.outletMap; forEach(prevChildren, function (v, k) { if (route.value.component) { _this.deactiveRouteAndItsChildren(v, childOutletMap); } else { _this.deactiveRouteAndItsChildren(v, parentOutletMap); } }); if (outlet && outlet.isActivated) { outlet.deactivate(); } }; return ActivateRoutes; }()); /** * @param {?} node * @return {?} */ function advanceActivatedRouteNodeAndItsChildren(node) { advanceActivatedRoute(node.value); node.children.forEach(advanceActivatedRouteNodeAndItsChildren); } /** * @param {?} snapshot * @return {?} */ function parentLoadedConfig(snapshot) { for (var /** @type {?} */ s = snapshot.parent; s; s = s.parent) { var /** @type {?} */ route = s._routeConfig; if (route && route._loadedConfig) return route._loadedConfig; if (route && route.component) return null; } return null; } /** * @param {?} snapshot * @return {?} */ function closestLoadedConfig(snapshot) { if (!snapshot) return null; for (var /** @type {?} */ s = snapshot.parent; s; s = s.parent) { var /** @type {?} */ route = s._routeConfig; if (route && route._loadedConfig) return route._loadedConfig; } return null; } /** * @template T * @param {?} node * @return {?} */ function nodeChildrenAsMap(node) { var /** @type {?} */ map$$1 = {}; if (node) { node.children.forEach(function (child) { return map$$1[child.value.outlet] = child; }); } return map$$1; } /** * @param {?} outletMap * @param {?} route * @return {?} */ function getOutlet(outletMap, route) { var /** @type {?} */ outlet = outletMap._outlets[route.outlet]; if (!outlet) { var /** @type {?} */ componentName = ((route.component)).name; if (route.outlet === PRIMARY_OUTLET) { throw new Error("Cannot find primary outlet to load '" + componentName + "'"); } else { throw new Error("Cannot find the outlet " + route.outlet + " to load '" + componentName + "'"); } } return outlet; } /** * @param {?} commands * @return {?} */ function validateCommands(commands) { for (var /** @type {?} */ i = 0; i < commands.length; i++) { var /** @type {?} */ cmd = commands[i]; if (cmd == null) { throw new Error("The requested path contains " + cmd + " segment at index " + i); } } } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Lets you link to specific parts of your app. * * \@howToUse * * Consider the following route configuration: * `[{ path: 'user/:name', component: UserCmp }]` * * When linking to this `user/:name` route, you can write: * `link to user component` * * \@description * * The RouterLink directives let you link to specific parts of your app. * * When the link is static, you can use the directive as follows: * `link to user component` * * If you use dynamic values to generate the link, you can pass an array of path * segments, followed by the params for each segment. * * For instance `['/team', teamId, 'user', userName, {details: true}]` * means that we want to generate a link to `/team/11/user/bob;details=true`. * * Multiple static segments can be merged into one * (e.g., `['/team/11/user', userName, {details: true}]`). * * The first segment name can be prepended with `/`, `./`, or `../`: * * If the first segment begins with `/`, the router will look up the route from the root of the * app. * * If the first segment begins with `./`, or doesn't begin with a slash, the router will * instead look in the children of the current activated route. * * And if the first segment begins with `../`, the router will go up one level. * * You can set query params and fragment as follows: * * ``` * * link to user component * * ``` * RouterLink will use these to generate this link: `/user/bob#education?debug=true`. * * (Deprecated in v4.0.0 use `queryParamsHandling` instead) You can also tell the * directive to preserve the current query params and fragment: * * ``` * * link to user component * * ``` * * You can tell the directive to how to handle queryParams, available options are: * - 'merge' merge the queryParams into the current queryParams * - 'preserve' prserve the current queryParams * - default / '' use the queryParams only * same options for {\@link NavigationExtras.queryParamsHandling} * * ``` * * link to user component * * ``` * * The router link directive always treats the provided input as a delta to the current url. * * For instance, if the current url is `/user/(box//aux:team)`. * * Then the following link `Jim` will generate the link * `/user/(jim//aux:team)`. * * \@ngModule RouterModule * * See {\@link Router.createUrlTree} for more information. * * \@stable */ var RouterLink = (function () { /** * @param {?} router * @param {?} route * @param {?} tabIndex * @param {?} renderer * @param {?} el */ function RouterLink(router, route, tabIndex, renderer, el) { this.router = router; this.route = route; this.commands = []; if (tabIndex == null) { renderer.setElementAttribute(el.nativeElement, 'tabindex', '0'); } } Object.defineProperty(RouterLink.prototype, "routerLink", { /** * @param {?} commands * @return {?} */ set: function (commands) { if (commands != null) { this.commands = Array.isArray(commands) ? commands : [commands]; } else { this.commands = []; } }, enumerable: true, configurable: true }); Object.defineProperty(RouterLink.prototype, "preserveQueryParams", { /** * @deprecated 4.0.0 use `queryParamsHandling` instead. * @param {?} value * @return {?} */ set: function (value) { if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__angular_core__["E" /* isDevMode */])() && (console) && (console.warn)) { console.warn('preserveQueryParams is deprecated!, use queryParamsHandling instead.'); } this.preserve = value; }, enumerable: true, configurable: true }); /** * @return {?} */ RouterLink.prototype.onClick = function () { var /** @type {?} */ extras = { skipLocationChange: attrBoolValue(this.skipLocationChange), replaceUrl: attrBoolValue(this.replaceUrl), }; this.router.navigateByUrl(this.urlTree, extras); return true; }; Object.defineProperty(RouterLink.prototype, "urlTree", { /** * @return {?} */ get: function () { return this.router.createUrlTree(this.commands, { relativeTo: this.route, queryParams: this.queryParams, fragment: this.fragment, preserveQueryParams: attrBoolValue(this.preserve), queryParamsHandling: this.queryParamsHandling, preserveFragment: attrBoolValue(this.preserveFragment), }); }, enumerable: true, configurable: true }); return RouterLink; }()); RouterLink.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["c" /* Directive */], args: [{ selector: ':not(a)[routerLink]' },] }, ]; /** * @nocollapse */ RouterLink.ctorParameters = function () { return [ { type: Router, }, { type: ActivatedRoute, }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Z" /* Attribute */], args: ['tabindex',] },] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["h" /* Renderer */], }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["i" /* ElementRef */], }, ]; }; RouterLink.propDecorators = { 'queryParams': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'fragment': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'queryParamsHandling': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'preserveFragment': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'skipLocationChange': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'replaceUrl': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'routerLink': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'preserveQueryParams': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'onClick': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_6" /* HostListener */], args: ['click',] },], }; /** * \@whatItDoes Lets you link to specific parts of your app. * * See {\@link RouterLink} for more information. * * \@ngModule RouterModule * * \@stable */ var RouterLinkWithHref = (function () { /** * @param {?} router * @param {?} route * @param {?} locationStrategy */ function RouterLinkWithHref(router, route, locationStrategy) { var _this = this; this.router = router; this.route = route; this.locationStrategy = locationStrategy; this.commands = []; this.subscription = router.events.subscribe(function (s) { if (s instanceof NavigationEnd) { _this.updateTargetUrlAndHref(); } }); } Object.defineProperty(RouterLinkWithHref.prototype, "routerLink", { /** * @param {?} commands * @return {?} */ set: function (commands) { if (commands != null) { this.commands = Array.isArray(commands) ? commands : [commands]; } else { this.commands = []; } }, enumerable: true, configurable: true }); Object.defineProperty(RouterLinkWithHref.prototype, "preserveQueryParams", { /** * @param {?} value * @return {?} */ set: function (value) { if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__angular_core__["E" /* isDevMode */])() && (console) && (console.warn)) { console.warn('preserveQueryParams is deprecated, use queryParamsHandling instead.'); } this.preserve = value; }, enumerable: true, configurable: true }); /** * @param {?} changes * @return {?} */ RouterLinkWithHref.prototype.ngOnChanges = function (changes) { this.updateTargetUrlAndHref(); }; /** * @return {?} */ RouterLinkWithHref.prototype.ngOnDestroy = function () { this.subscription.unsubscribe(); }; /** * @param {?} button * @param {?} ctrlKey * @param {?} metaKey * @return {?} */ RouterLinkWithHref.prototype.onClick = function (button, ctrlKey, metaKey) { if (button !== 0 || ctrlKey || metaKey) { return true; } if (typeof this.target === 'string' && this.target != '_self') { return true; } var /** @type {?} */ extras = { skipLocationChange: attrBoolValue(this.skipLocationChange), replaceUrl: attrBoolValue(this.replaceUrl), }; this.router.navigateByUrl(this.urlTree, extras); return false; }; /** * @return {?} */ RouterLinkWithHref.prototype.updateTargetUrlAndHref = function () { this.href = this.locationStrategy.prepareExternalUrl(this.router.serializeUrl(this.urlTree)); }; Object.defineProperty(RouterLinkWithHref.prototype, "urlTree", { /** * @return {?} */ get: function () { return this.router.createUrlTree(this.commands, { relativeTo: this.route, queryParams: this.queryParams, fragment: this.fragment, preserveQueryParams: attrBoolValue(this.preserve), queryParamsHandling: this.queryParamsHandling, preserveFragment: attrBoolValue(this.preserveFragment), }); }, enumerable: true, configurable: true }); return RouterLinkWithHref; }()); RouterLinkWithHref.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["c" /* Directive */], args: [{ selector: 'a[routerLink]' },] }, ]; /** * @nocollapse */ RouterLinkWithHref.ctorParameters = function () { return [ { type: Router, }, { type: ActivatedRoute, }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_common__["d" /* LocationStrategy */], }, ]; }; RouterLinkWithHref.propDecorators = { 'target': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_7" /* HostBinding */], args: ['attr.target',] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'queryParams': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'fragment': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'queryParamsHandling': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'preserveFragment': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'skipLocationChange': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'replaceUrl': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'href': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_7" /* HostBinding */] },], 'routerLink': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'preserveQueryParams': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'onClick': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_6" /* HostListener */], args: ['click', ['$event.button', '$event.ctrlKey', '$event.metaKey'],] },], }; /** * @param {?} s * @return {?} */ function attrBoolValue(s) { return s === '' || !!s; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Lets you add a CSS class to an element when the link's route becomes active. * * \@howToUse * * ``` * Bob * ``` * * \@description * * The RouterLinkActive directive lets you add a CSS class to an element when the link's route * becomes active. * * Consider the following example: * * ``` * Bob * ``` * * When the url is either '/user' or '/user/bob', the active-link class will * be added to the `a` tag. If the url changes, the class will be removed. * * You can set more than one class, as follows: * * ``` * Bob * Bob * ``` * * You can configure RouterLinkActive by passing `exact: true`. This will add the classes * only when the url matches the link exactly. * * ``` * Bob * ``` * * You can assign the RouterLinkActive instance to a template variable and directly check * the `isActive` status. * ``` * * Bob {{ rla.isActive ? '(already open)' : ''}} * * ``` * * Finally, you can apply the RouterLinkActive directive to an ancestor of a RouterLink. * * ``` *
    * Jim * Bob *
    * ``` * * This will set the active-link class on the div tag if the url is either '/user/jim' or * '/user/bob'. * * \@ngModule RouterModule * * \@stable */ var RouterLinkActive = (function () { /** * @param {?} router * @param {?} element * @param {?} renderer * @param {?} cdr */ function RouterLinkActive(router, element, renderer, cdr) { var _this = this; this.router = router; this.element = element; this.renderer = renderer; this.cdr = cdr; this.classes = []; this.active = false; this.routerLinkActiveOptions = { exact: false }; this.subscription = router.events.subscribe(function (s) { if (s instanceof NavigationEnd) { _this.update(); } }); } Object.defineProperty(RouterLinkActive.prototype, "isActive", { /** * @return {?} */ get: function () { return this.active; }, enumerable: true, configurable: true }); /** * @return {?} */ RouterLinkActive.prototype.ngAfterContentInit = function () { var _this = this; this.links.changes.subscribe(function (_) { return _this.update(); }); this.linksWithHrefs.changes.subscribe(function (_) { return _this.update(); }); this.update(); }; Object.defineProperty(RouterLinkActive.prototype, "routerLinkActive", { /** * @param {?} data * @return {?} */ set: function (data) { var /** @type {?} */ classes = Array.isArray(data) ? data : data.split(' '); this.classes = classes.filter(function (c) { return !!c; }); }, enumerable: true, configurable: true }); /** * @param {?} changes * @return {?} */ RouterLinkActive.prototype.ngOnChanges = function (changes) { this.update(); }; /** * @return {?} */ RouterLinkActive.prototype.ngOnDestroy = function () { this.subscription.unsubscribe(); }; /** * @return {?} */ RouterLinkActive.prototype.update = function () { var _this = this; if (!this.links || !this.linksWithHrefs || !this.router.navigated) return; var /** @type {?} */ hasActiveLinks = this.hasActiveLinks(); // react only when status has changed to prevent unnecessary dom updates if (this.active !== hasActiveLinks) { this.classes.forEach(function (c) { return _this.renderer.setElementClass(_this.element.nativeElement, c, hasActiveLinks); }); Promise.resolve(hasActiveLinks).then(function (active) { return _this.active = active; }); } }; /** * @param {?} router * @return {?} */ RouterLinkActive.prototype.isLinkActive = function (router) { var _this = this; return function (link) { return router.isActive(link.urlTree, _this.routerLinkActiveOptions.exact); }; }; /** * @return {?} */ RouterLinkActive.prototype.hasActiveLinks = function () { return this.links.some(this.isLinkActive(this.router)) || this.linksWithHrefs.some(this.isLinkActive(this.router)); }; return RouterLinkActive; }()); RouterLinkActive.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["c" /* Directive */], args: [{ selector: '[routerLinkActive]', exportAs: 'routerLinkActive', },] }, ]; /** * @nocollapse */ RouterLinkActive.ctorParameters = function () { return [ { type: Router, }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["i" /* ElementRef */], }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["h" /* Renderer */], }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_2" /* ChangeDetectorRef */], }, ]; }; RouterLinkActive.propDecorators = { 'links': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_8" /* ContentChildren */], args: [RouterLink, { descendants: true },] },], 'linksWithHrefs': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_8" /* ContentChildren */], args: [RouterLinkWithHref, { descendants: true },] },], 'routerLinkActiveOptions': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], 'routerLinkActive': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["n" /* Input */] },], }; /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Acts as a placeholder that Angular dynamically fills based on the current router * state. * * \@howToUse * * ``` * * * * ``` * * A router outlet will emit an activate event any time a new component is being instantiated, * and a deactivate event when it is being destroyed. * * ``` * * ``` * \@ngModule RouterModule * * \@stable */ var RouterOutlet = (function () { /** * @param {?} parentOutletMap * @param {?} location * @param {?} resolver * @param {?} name */ function RouterOutlet(parentOutletMap, location, resolver, name) { this.parentOutletMap = parentOutletMap; this.location = location; this.resolver = resolver; this.name = name; this.activateEvents = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["r" /* EventEmitter */](); this.deactivateEvents = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["r" /* EventEmitter */](); parentOutletMap.registerOutlet(name ? name : PRIMARY_OUTLET, this); } /** * @return {?} */ RouterOutlet.prototype.ngOnDestroy = function () { this.parentOutletMap.removeOutlet(this.name ? this.name : PRIMARY_OUTLET); }; Object.defineProperty(RouterOutlet.prototype, "locationInjector", { /** * @deprecated since v4 * * @return {?} */ get: function () { return this.location.injector; }, enumerable: true, configurable: true }); Object.defineProperty(RouterOutlet.prototype, "locationFactoryResolver", { /** * @deprecated since v4 * * @return {?} */ get: function () { return this.resolver; }, enumerable: true, configurable: true }); Object.defineProperty(RouterOutlet.prototype, "isActivated", { /** * @return {?} */ get: function () { return !!this.activated; }, enumerable: true, configurable: true }); Object.defineProperty(RouterOutlet.prototype, "component", { /** * @return {?} */ get: function () { if (!this.activated) throw new Error('Outlet is not activated'); return this.activated.instance; }, enumerable: true, configurable: true }); Object.defineProperty(RouterOutlet.prototype, "activatedRoute", { /** * @return {?} */ get: function () { if (!this.activated) throw new Error('Outlet is not activated'); return this._activatedRoute; }, enumerable: true, configurable: true }); /** * @return {?} */ RouterOutlet.prototype.detach = function () { if (!this.activated) throw new Error('Outlet is not activated'); this.location.detach(); var /** @type {?} */ r = this.activated; this.activated = ((null)); this._activatedRoute = ((null)); return r; }; /** * @param {?} ref * @param {?} activatedRoute * @return {?} */ RouterOutlet.prototype.attach = function (ref, activatedRoute) { this.activated = ref; this._activatedRoute = activatedRoute; this.location.insert(ref.hostView); }; /** * @return {?} */ RouterOutlet.prototype.deactivate = function () { if (this.activated) { var /** @type {?} */ c = this.component; this.activated.destroy(); this.activated = ((null)); this._activatedRoute = ((null)); this.deactivateEvents.emit(c); } }; /** * @deprecated since v4, use {\@link #activateWith} * @param {?} activatedRoute * @param {?} resolver * @param {?} injector * @param {?} providers * @param {?} outletMap * @return {?} */ RouterOutlet.prototype.activate = function (activatedRoute, resolver, injector, providers, outletMap) { if (this.isActivated) { throw new Error('Cannot activate an already activated outlet'); } this.outletMap = outletMap; this._activatedRoute = activatedRoute; var /** @type {?} */ snapshot = activatedRoute._futureSnapshot; var /** @type {?} */ component = (((snapshot._routeConfig)).component); var /** @type {?} */ factory = ((resolver.resolveComponentFactory(component))); var /** @type {?} */ inj = __WEBPACK_IMPORTED_MODULE_1__angular_core__["_9" /* ReflectiveInjector */].fromResolvedProviders(providers, injector); this.activated = this.location.createComponent(factory, this.location.length, inj, []); this.activated.changeDetectorRef.detectChanges(); this.activateEvents.emit(this.activated.instance); }; /** * @param {?} activatedRoute * @param {?} resolver * @param {?} outletMap * @return {?} */ RouterOutlet.prototype.activateWith = function (activatedRoute, resolver, outletMap) { if (this.isActivated) { throw new Error('Cannot activate an already activated outlet'); } this.outletMap = outletMap; this._activatedRoute = activatedRoute; var /** @type {?} */ snapshot = activatedRoute._futureSnapshot; var /** @type {?} */ component = (((snapshot._routeConfig)).component); resolver = resolver || this.resolver; var /** @type {?} */ factory = ((resolver.resolveComponentFactory(component))); var /** @type {?} */ injector = new OutletInjector(activatedRoute, outletMap, this.location.injector); this.activated = this.location.createComponent(factory, this.location.length, injector, []); this.activated.changeDetectorRef.detectChanges(); this.activateEvents.emit(this.activated.instance); }; return RouterOutlet; }()); RouterOutlet.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["c" /* Directive */], args: [{ selector: 'router-outlet' },] }, ]; /** * @nocollapse */ RouterOutlet.ctorParameters = function () { return [ { type: RouterOutletMap, }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["X" /* ViewContainerRef */], }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["W" /* ComponentFactoryResolver */], }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Z" /* Attribute */], args: ['name',] },] }, ]; }; RouterOutlet.propDecorators = { 'activateEvents': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["t" /* Output */], args: ['activate',] },], 'deactivateEvents': [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["t" /* Output */], args: ['deactivate',] },], }; var OutletInjector = (function () { /** * @param {?} route * @param {?} map * @param {?} parent */ function OutletInjector(route, map$$1, parent) { this.route = route; this.map = map$$1; this.parent = parent; } /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ OutletInjector.prototype.get = function (token, notFoundValue) { if (token === ActivatedRoute) { return this.route; } if (token === RouterOutletMap) { return this.map; } return this.parent.get(token, notFoundValue); }; return OutletInjector; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Provides a way to customize when activated routes get reused. * * \@experimental * @abstract */ var RouteReuseStrategy = (function () { function RouteReuseStrategy() { } /** * Determines if this route (and its subtree) should be detached to be reused later * @abstract * @param {?} route * @return {?} */ RouteReuseStrategy.prototype.shouldDetach = function (route) { }; /** * Stores the detached route * @abstract * @param {?} route * @param {?} handle * @return {?} */ RouteReuseStrategy.prototype.store = function (route, handle) { }; /** * Determines if this route (and its subtree) should be reattached * @abstract * @param {?} route * @return {?} */ RouteReuseStrategy.prototype.shouldAttach = function (route) { }; /** * Retrieves the previously stored route * @abstract * @param {?} route * @return {?} */ RouteReuseStrategy.prototype.retrieve = function (route) { }; /** * Determines if a route should be reused * @abstract * @param {?} future * @param {?} curr * @return {?} */ RouteReuseStrategy.prototype.shouldReuseRoute = function (future, curr) { }; return RouteReuseStrategy; }()); /** *@license *Copyright Google Inc. All Rights Reserved. * *Use of this source code is governed by an MIT-style license that can be *found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Provides a preloading strategy. * * \@experimental * @abstract */ var PreloadingStrategy = (function () { function PreloadingStrategy() { } /** * @abstract * @param {?} route * @param {?} fn * @return {?} */ PreloadingStrategy.prototype.preload = function (route, fn) { }; return PreloadingStrategy; }()); /** * \@whatItDoes Provides a preloading strategy that preloads all modules as quickly as possible. * * \@howToUse * * ``` * RouteModule.forRoot(ROUTES, {preloadingStrategy: PreloadAllModules}) * ``` * * \@experimental */ var PreloadAllModules = (function () { function PreloadAllModules() { } /** * @param {?} route * @param {?} fn * @return {?} */ PreloadAllModules.prototype.preload = function (route, fn) { return __WEBPACK_IMPORTED_MODULE_13_rxjs_operator_catch__["_catch"].call(fn(), function () { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(null); }); }; return PreloadAllModules; }()); /** * \@whatItDoes Provides a preloading strategy that does not preload any modules. * * \@description * * This strategy is enabled by default. * * \@experimental */ var NoPreloading = (function () { function NoPreloading() { } /** * @param {?} route * @param {?} fn * @return {?} */ NoPreloading.prototype.preload = function (route, fn) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(null); }; return NoPreloading; }()); /** * The preloader optimistically loads all router configurations to * make navigations into lazily-loaded sections of the application faster. * * The preloader runs in the background. When the router bootstraps, the preloader * starts listening to all navigation events. After every such event, the preloader * will check if any configurations can be loaded lazily. * * If a route is protected by `canLoad` guards, the preloaded will not load it. * * \@stable */ var RouterPreloader = (function () { /** * @param {?} router * @param {?} moduleLoader * @param {?} compiler * @param {?} injector * @param {?} preloadingStrategy */ function RouterPreloader(router, moduleLoader, compiler, injector, preloadingStrategy) { this.router = router; this.injector = injector; this.preloadingStrategy = preloadingStrategy; var onStartLoad = function (r) { return router.triggerEvent(new RouteConfigLoadStart(r)); }; var onEndLoad = function (r) { return router.triggerEvent(new RouteConfigLoadEnd(r)); }; this.loader = new RouterConfigLoader(moduleLoader, compiler, onStartLoad, onEndLoad); } ; /** * @return {?} */ RouterPreloader.prototype.setUpPreloading = function () { var _this = this; var /** @type {?} */ navigations$ = __WEBPACK_IMPORTED_MODULE_20_rxjs_operator_filter__["filter"].call(this.router.events, function (e) { return e instanceof NavigationEnd; }); this.subscription = __WEBPACK_IMPORTED_MODULE_6_rxjs_operator_concatMap__["concatMap"].call(navigations$, function () { return _this.preload(); }).subscribe(function () { }); }; /** * @return {?} */ RouterPreloader.prototype.preload = function () { var /** @type {?} */ ngModule = this.injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["V" /* NgModuleRef */]); return this.processRoutes(ngModule, this.router.config); }; /** * @return {?} */ RouterPreloader.prototype.ngOnDestroy = function () { this.subscription.unsubscribe(); }; /** * @param {?} ngModule * @param {?} routes * @return {?} */ RouterPreloader.prototype.processRoutes = function (ngModule, routes) { var /** @type {?} */ res = []; for (var _i = 0, routes_5 = routes; _i < routes_5.length; _i++) { var route = routes_5[_i]; // we already have the config loaded, just recurse if (route.loadChildren && !route.canLoad && route._loadedConfig) { var /** @type {?} */ childConfig = route._loadedConfig; res.push(this.processRoutes(childConfig.module, childConfig.routes)); } else if (route.loadChildren && !route.canLoad) { res.push(this.preloadConfig(ngModule, route)); } else if (route.children) { res.push(this.processRoutes(ngModule, route.children)); } } return __WEBPACK_IMPORTED_MODULE_18_rxjs_operator_mergeAll__["mergeAll"].call(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4_rxjs_observable_from__["from"])(res)); }; /** * @param {?} ngModule * @param {?} route * @return {?} */ RouterPreloader.prototype.preloadConfig = function (ngModule, route) { var _this = this; return this.preloadingStrategy.preload(route, function () { var /** @type {?} */ loaded$ = _this.loader.load(ngModule.injector, route); return __WEBPACK_IMPORTED_MODULE_10_rxjs_operator_mergeMap__["mergeMap"].call(loaded$, function (config) { route._loadedConfig = config; return _this.processRoutes(config.module, config.routes); }); }); }; return RouterPreloader; }()); RouterPreloader.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["l" /* Injectable */] }, ]; /** * @nocollapse */ RouterPreloader.ctorParameters = function () { return [ { type: Router, }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_10" /* NgModuleFactoryLoader */], }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_11" /* Compiler */], }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["m" /* Injector */], }, { type: PreloadingStrategy, }, ]; }; /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * \@whatItDoes Contains a list of directives * \@stable */ var ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive]; /** * \@whatItDoes Is used in DI to configure the router. * \@stable */ var ROUTER_CONFIGURATION = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["e" /* InjectionToken */]('ROUTER_CONFIGURATION'); /** * \@docsNotRequired */ var ROUTER_FORROOT_GUARD = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["e" /* InjectionToken */]('ROUTER_FORROOT_GUARD'); var ROUTER_PROVIDERS = [ __WEBPACK_IMPORTED_MODULE_0__angular_common__["e" /* Location */], { provide: UrlSerializer, useClass: DefaultUrlSerializer }, { provide: Router, useFactory: setupRouter, deps: [ __WEBPACK_IMPORTED_MODULE_1__angular_core__["y" /* ApplicationRef */], UrlSerializer, RouterOutletMap, __WEBPACK_IMPORTED_MODULE_0__angular_common__["e" /* Location */], __WEBPACK_IMPORTED_MODULE_1__angular_core__["m" /* Injector */], __WEBPACK_IMPORTED_MODULE_1__angular_core__["_10" /* NgModuleFactoryLoader */], __WEBPACK_IMPORTED_MODULE_1__angular_core__["_11" /* Compiler */], ROUTES, ROUTER_CONFIGURATION, [UrlHandlingStrategy, new __WEBPACK_IMPORTED_MODULE_1__angular_core__["j" /* Optional */]()], [RouteReuseStrategy, new __WEBPACK_IMPORTED_MODULE_1__angular_core__["j" /* Optional */]()] ] }, RouterOutletMap, { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] }, { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_10" /* NgModuleFactoryLoader */], useClass: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_12" /* SystemJsNgModuleLoader */] }, RouterPreloader, NoPreloading, PreloadAllModules, { provide: ROUTER_CONFIGURATION, useValue: { enableTracing: false } }, ]; /** * @return {?} */ function routerNgProbeToken() { return new __WEBPACK_IMPORTED_MODULE_1__angular_core__["B" /* NgProbeToken */]('Router', Router); } /** * \@whatItDoes Adds router directives and providers. * * \@howToUse * * RouterModule can be imported multiple times: once per lazily-loaded bundle. * Since the router deals with a global shared resource--location, we cannot have * more than one router service active. * * That is why there are two ways to create the module: `RouterModule.forRoot` and * `RouterModule.forChild`. * * * `forRoot` creates a module that contains all the directives, the given routes, and the router * service itself. * * `forChild` creates a module that contains all the directives and the given routes, but does not * include the router service. * * When registered at the root, the module should be used as follows * * ``` * \@NgModule({ * imports: [RouterModule.forRoot(ROUTES)] * }) * class MyNgModule {} * ``` * * For submodules and lazy loaded submodules the module should be used as follows: * * ``` * \@NgModule({ * imports: [RouterModule.forChild(ROUTES)] * }) * class MyNgModule {} * ``` * * \@description * * Managing state transitions is one of the hardest parts of building applications. This is * especially true on the web, where you also need to ensure that the state is reflected in the URL. * In addition, we often want to split applications into multiple bundles and load them on demand. * Doing this transparently is not trivial. * * The Angular router solves these problems. Using the router, you can declaratively specify * application states, manage state transitions while taking care of the URL, and load bundles on * demand. * * [Read this developer guide](https://angular.io/docs/ts/latest/guide/router.html) to get an * overview of how the router should be used. * * \@stable */ var RouterModule = (function () { /** * @param {?} guard * @param {?} router */ function RouterModule(guard, router) { } /** * Creates a module with all the router providers and directives. It also optionally sets up an * application listener to perform an initial navigation. * * Options: * * `enableTracing` makes the router log all its internal events to the console. * * `useHash` enables the location strategy that uses the URL fragment instead of the history * API. * * `initialNavigation` disables the initial navigation. * * `errorHandler` provides a custom error handler. * @param {?} routes * @param {?=} config * @return {?} */ RouterModule.forRoot = function (routes, config) { return { ngModule: RouterModule, providers: [ ROUTER_PROVIDERS, provideRoutes(routes), { provide: ROUTER_FORROOT_GUARD, useFactory: provideForRootGuard, deps: [[Router, new __WEBPACK_IMPORTED_MODULE_1__angular_core__["j" /* Optional */](), new __WEBPACK_IMPORTED_MODULE_1__angular_core__["s" /* SkipSelf */]()]] }, { provide: ROUTER_CONFIGURATION, useValue: config ? config : {} }, { provide: __WEBPACK_IMPORTED_MODULE_0__angular_common__["d" /* LocationStrategy */], useFactory: provideLocationStrategy, deps: [ __WEBPACK_IMPORTED_MODULE_0__angular_common__["a" /* PlatformLocation */], [new __WEBPACK_IMPORTED_MODULE_1__angular_core__["k" /* Inject */](__WEBPACK_IMPORTED_MODULE_0__angular_common__["f" /* APP_BASE_HREF */]), new __WEBPACK_IMPORTED_MODULE_1__angular_core__["j" /* Optional */]()], ROUTER_CONFIGURATION ] }, { provide: PreloadingStrategy, useExisting: config && config.preloadingStrategy ? config.preloadingStrategy : NoPreloading }, { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["B" /* NgProbeToken */], multi: true, useFactory: routerNgProbeToken }, provideRouterInitializer(), ], }; }; /** * Creates a module with all the router directives and a provider registering routes. * @param {?} routes * @return {?} */ RouterModule.forChild = function (routes) { return { ngModule: RouterModule, providers: [provideRoutes(routes)] }; }; return RouterModule; }()); RouterModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["b" /* NgModule */], args: [{ declarations: ROUTER_DIRECTIVES, exports: ROUTER_DIRECTIVES },] }, ]; /** * @nocollapse */ RouterModule.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["j" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["k" /* Inject */], args: [ROUTER_FORROOT_GUARD,] },] }, { type: Router, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["j" /* Optional */] },] }, ]; }; /** * @param {?} platformLocationStrategy * @param {?} baseHref * @param {?=} options * @return {?} */ function provideLocationStrategy(platformLocationStrategy, baseHref, options) { if (options === void 0) { options = {}; } return options.useHash ? new __WEBPACK_IMPORTED_MODULE_0__angular_common__["g" /* HashLocationStrategy */](platformLocationStrategy, baseHref) : new __WEBPACK_IMPORTED_MODULE_0__angular_common__["h" /* PathLocationStrategy */](platformLocationStrategy, baseHref); } /** * @param {?} router * @return {?} */ function provideForRootGuard(router) { if (router) { throw new Error("RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead."); } return 'guarded'; } /** * \@whatItDoes Registers routes. * * \@howToUse * * ``` * \@NgModule({ * imports: [RouterModule.forChild(ROUTES)], * providers: [provideRoutes(EXTRA_ROUTES)] * }) * class MyNgModule {} * ``` * * \@stable * @param {?} routes * @return {?} */ function provideRoutes(routes) { return [ { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_13" /* ANALYZE_FOR_ENTRY_COMPONENTS */], multi: true, useValue: routes }, { provide: ROUTES, multi: true, useValue: routes }, ]; } /** * @param {?} ref * @param {?} urlSerializer * @param {?} outletMap * @param {?} location * @param {?} injector * @param {?} loader * @param {?} compiler * @param {?} config * @param {?=} opts * @param {?=} urlHandlingStrategy * @param {?=} routeReuseStrategy * @return {?} */ function setupRouter(ref, urlSerializer, outletMap, location, injector, loader, compiler, config, opts, urlHandlingStrategy, routeReuseStrategy) { if (opts === void 0) { opts = {}; } var /** @type {?} */ router = new Router(null, urlSerializer, outletMap, location, injector, loader, compiler, flatten(config)); if (urlHandlingStrategy) { router.urlHandlingStrategy = urlHandlingStrategy; } if (routeReuseStrategy) { router.routeReuseStrategy = routeReuseStrategy; } if (opts.errorHandler) { router.errorHandler = opts.errorHandler; } if (opts.enableTracing) { var /** @type {?} */ dom_1 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_19__angular_platform_browser__["c" /* ɵgetDOM */])(); router.events.subscribe(function (e) { dom_1.logGroup("Router Event: " + ((e.constructor)).name); dom_1.log(e.toString()); dom_1.log(e); dom_1.logGroupEnd(); }); } return router; } /** * @param {?} router * @return {?} */ function rootRoute(router) { return router.routerState.root; } /** * To initialize the router properly we need to do in two steps: * * We need to start the navigation in a APP_INITIALIZER to block the bootstrap if * a resolver or a guards executes asynchronously. Second, we need to actually run * activation in a BOOTSTRAP_LISTENER. We utilize the afterPreactivation * hook provided by the router to do that. * * The router navigation starts, reaches the point when preactivation is done, and then * pauses. It waits for the hook to be resolved. We then resolve it only in a bootstrap listener. */ var RouterInitializer = (function () { /** * @param {?} injector */ function RouterInitializer(injector) { this.injector = injector; this.initNavigation = false; this.resultOfPreactivationDone = new __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__["Subject"](); } /** * @return {?} */ RouterInitializer.prototype.appInitializer = function () { var _this = this; var /** @type {?} */ p = this.injector.get(__WEBPACK_IMPORTED_MODULE_0__angular_common__["i" /* LOCATION_INITIALIZED */], Promise.resolve(null)); return p.then(function () { var /** @type {?} */ resolve = ((null)); var /** @type {?} */ res = new Promise(function (r) { return resolve = r; }); var /** @type {?} */ router = _this.injector.get(Router); var /** @type {?} */ opts = _this.injector.get(ROUTER_CONFIGURATION); if (_this.isLegacyDisabled(opts) || _this.isLegacyEnabled(opts)) { resolve(true); } else if (opts.initialNavigation === 'disabled') { router.setUpLocationChangeListener(); resolve(true); } else if (opts.initialNavigation === 'enabled') { router.hooks.afterPreactivation = function () { // only the initial navigation should be delayed if (!_this.initNavigation) { _this.initNavigation = true; resolve(true); return _this.resultOfPreactivationDone; } else { return (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5_rxjs_observable_of__["of"])(null)); } }; router.initialNavigation(); } else { throw new Error("Invalid initialNavigation options: '" + opts.initialNavigation + "'"); } return res; }); }; /** * @param {?} bootstrappedComponentRef * @return {?} */ RouterInitializer.prototype.bootstrapListener = function (bootstrappedComponentRef) { var /** @type {?} */ opts = this.injector.get(ROUTER_CONFIGURATION); var /** @type {?} */ preloader = this.injector.get(RouterPreloader); var /** @type {?} */ router = this.injector.get(Router); var /** @type {?} */ ref = this.injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["y" /* ApplicationRef */]); if (bootstrappedComponentRef !== ref.components[0]) { return; } if (this.isLegacyEnabled(opts)) { router.initialNavigation(); } else if (this.isLegacyDisabled(opts)) { router.setUpLocationChangeListener(); } preloader.setUpPreloading(); router.resetRootComponentType(ref.componentTypes[0]); this.resultOfPreactivationDone.next(/** @type {?} */ ((null))); this.resultOfPreactivationDone.complete(); }; /** * @param {?} opts * @return {?} */ RouterInitializer.prototype.isLegacyEnabled = function (opts) { return opts.initialNavigation === 'legacy_enabled' || opts.initialNavigation === true || opts.initialNavigation === undefined; }; /** * @param {?} opts * @return {?} */ RouterInitializer.prototype.isLegacyDisabled = function (opts) { return opts.initialNavigation === 'legacy_disabled' || opts.initialNavigation === false; }; return RouterInitializer; }()); RouterInitializer.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["l" /* Injectable */] }, ]; /** * @nocollapse */ RouterInitializer.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["m" /* Injector */], }, ]; }; /** * @param {?} r * @return {?} */ function getAppInitializer(r) { return r.appInitializer.bind(r); } /** * @param {?} r * @return {?} */ function getBootstrapListener(r) { return r.bootstrapListener.bind(r); } /** * A token for the router initializer that will be called after the app is bootstrapped. * * \@experimental */ var ROUTER_INITIALIZER = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["e" /* InjectionToken */]('Router Initializer'); /** * @return {?} */ function provideRouterInitializer() { return [ RouterInitializer, { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["w" /* APP_INITIALIZER */], multi: true, useFactory: getAppInitializer, deps: [RouterInitializer] }, { provide: ROUTER_INITIALIZER, useFactory: getBootstrapListener, deps: [RouterInitializer] }, { provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["_14" /* APP_BOOTSTRAP_LISTENER */], multi: true, useExisting: ROUTER_INITIALIZER }, ]; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all public APIs of the common package. */ /** * \@stable */ var VERSION = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["u" /* Version */]('4.1.1'); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @module * @description * Entry point for all public APIs of the router package. */ // This file only reexports content of the `src` folder. Keep it that way. /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=router.es5.js.map /***/ }), /* 5 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var isFunction_1 = __webpack_require__(83); var Subscription_1 = __webpack_require__(26); var Observer_1 = __webpack_require__(103); var rxSubscriber_1 = __webpack_require__(81); /** * Implements the {@link Observer} interface and extends the * {@link Subscription} class. While the {@link Observer} is the public API for * consuming the values of an {@link Observable}, all Observers get converted to * a Subscriber, in order to provide Subscription-like capabilities such as * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for * implementing operators, but it is rarely used as a public API. * * @class Subscriber */ var Subscriber = (function (_super) { __extends(Subscriber, _super); /** * @param {Observer|function(value: T): void} [destinationOrNext] A partially * defined Observer or a `next` callback function. * @param {function(e: ?any): void} [error] The `error` callback of an * Observer. * @param {function(): void} [complete] The `complete` callback of an * Observer. */ function Subscriber(destinationOrNext, error, complete) { _super.call(this); this.syncErrorValue = null; this.syncErrorThrown = false; this.syncErrorThrowable = false; this.isStopped = false; switch (arguments.length) { case 0: this.destination = Observer_1.empty; break; case 1: if (!destinationOrNext) { this.destination = Observer_1.empty; break; } if (typeof destinationOrNext === 'object') { if (destinationOrNext instanceof Subscriber) { this.destination = destinationOrNext; this.destination.add(this); } else { this.syncErrorThrowable = true; this.destination = new SafeSubscriber(this, destinationOrNext); } break; } default: this.syncErrorThrowable = true; this.destination = new SafeSubscriber(this, destinationOrNext, error, complete); break; } } Subscriber.prototype[rxSubscriber_1.rxSubscriber] = function () { return this; }; /** * A static factory for a Subscriber, given a (potentially partial) definition * of an Observer. * @param {function(x: ?T): void} [next] The `next` callback of an Observer. * @param {function(e: ?any): void} [error] The `error` callback of an * Observer. * @param {function(): void} [complete] The `complete` callback of an * Observer. * @return {Subscriber} A Subscriber wrapping the (partially defined) * Observer represented by the given arguments. */ Subscriber.create = function (next, error, complete) { var subscriber = new Subscriber(next, error, complete); subscriber.syncErrorThrowable = false; return subscriber; }; /** * The {@link Observer} callback to receive notifications of type `next` from * the Observable, with a value. The Observable may call this method 0 or more * times. * @param {T} [value] The `next` value. * @return {void} */ Subscriber.prototype.next = function (value) { if (!this.isStopped) { this._next(value); } }; /** * The {@link Observer} callback to receive notifications of type `error` from * the Observable, with an attached {@link Error}. Notifies the Observer that * the Observable has experienced an error condition. * @param {any} [err] The `error` exception. * @return {void} */ Subscriber.prototype.error = function (err) { if (!this.isStopped) { this.isStopped = true; this._error(err); } }; /** * The {@link Observer} callback to receive a valueless notification of type * `complete` from the Observable. Notifies the Observer that the Observable * has finished sending push-based notifications. * @return {void} */ Subscriber.prototype.complete = function () { if (!this.isStopped) { this.isStopped = true; this._complete(); } }; Subscriber.prototype.unsubscribe = function () { if (this.closed) { return; } this.isStopped = true; _super.prototype.unsubscribe.call(this); }; Subscriber.prototype._next = function (value) { this.destination.next(value); }; Subscriber.prototype._error = function (err) { this.destination.error(err); this.unsubscribe(); }; Subscriber.prototype._complete = function () { this.destination.complete(); this.unsubscribe(); }; Subscriber.prototype._unsubscribeAndRecycle = function () { var _a = this, _parent = _a._parent, _parents = _a._parents; this._parent = null; this._parents = null; this.unsubscribe(); this.closed = false; this.isStopped = false; this._parent = _parent; this._parents = _parents; return this; }; return Subscriber; }(Subscription_1.Subscription)); exports.Subscriber = Subscriber; /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var SafeSubscriber = (function (_super) { __extends(SafeSubscriber, _super); function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) { _super.call(this); this._parentSubscriber = _parentSubscriber; var next; var context = this; if (isFunction_1.isFunction(observerOrNext)) { next = observerOrNext; } else if (observerOrNext) { next = observerOrNext.next; error = observerOrNext.error; complete = observerOrNext.complete; if (observerOrNext !== Observer_1.empty) { context = Object.create(observerOrNext); if (isFunction_1.isFunction(context.unsubscribe)) { this.add(context.unsubscribe.bind(context)); } context.unsubscribe = this.unsubscribe.bind(this); } } this._context = context; this._next = next; this._error = error; this._complete = complete; } SafeSubscriber.prototype.next = function (value) { if (!this.isStopped && this._next) { var _parentSubscriber = this._parentSubscriber; if (!_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(this._next, value); } else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) { this.unsubscribe(); } } }; SafeSubscriber.prototype.error = function (err) { if (!this.isStopped) { var _parentSubscriber = this._parentSubscriber; if (this._error) { if (!_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(this._error, err); this.unsubscribe(); } else { this.__tryOrSetError(_parentSubscriber, this._error, err); this.unsubscribe(); } } else if (!_parentSubscriber.syncErrorThrowable) { this.unsubscribe(); throw err; } else { _parentSubscriber.syncErrorValue = err; _parentSubscriber.syncErrorThrown = true; this.unsubscribe(); } } }; SafeSubscriber.prototype.complete = function () { if (!this.isStopped) { var _parentSubscriber = this._parentSubscriber; if (this._complete) { if (!_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(this._complete); this.unsubscribe(); } else { this.__tryOrSetError(_parentSubscriber, this._complete); this.unsubscribe(); } } else { this.unsubscribe(); } } }; SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) { try { fn.call(this._context, value); } catch (err) { this.unsubscribe(); throw err; } }; SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) { try { fn.call(this._context, value); } catch (err) { parent.syncErrorValue = err; parent.syncErrorThrown = true; return true; } return false; }; SafeSubscriber.prototype._unsubscribe = function () { var _parentSubscriber = this._parentSubscriber; this._context = null; this._parentSubscriber = null; _parentSubscriber.unsubscribe(); }; return SafeSubscriber; }(Subscriber)); //# sourceMappingURL=Subscriber.js.map /***/ }), /* 6 */, /* 7 */, /* 8 */, /* 9 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_observable_forkJoin__ = __webpack_require__(296); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_observable_forkJoin___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_rxjs_observable_forkJoin__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_observable_fromPromise__ = __webpack_require__(108); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_observable_fromPromise___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_observable_fromPromise__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_map__ = __webpack_require__(76); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_map___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_rxjs_operator_map__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__angular_platform_browser__ = __webpack_require__(22); /* unused harmony export AbstractControlDirective */ /* unused harmony export AbstractFormGroupDirective */ /* unused harmony export CheckboxControlValueAccessor */ /* unused harmony export ControlContainer */ /* unused harmony export NG_VALUE_ACCESSOR */ /* unused harmony export COMPOSITION_BUFFER_MODE */ /* unused harmony export DefaultValueAccessor */ /* unused harmony export NgControl */ /* unused harmony export NgControlStatus */ /* unused harmony export NgControlStatusGroup */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return NgForm; }); /* unused harmony export NgModel */ /* unused harmony export NgModelGroup */ /* unused harmony export RadioControlValueAccessor */ /* unused harmony export FormControlDirective */ /* unused harmony export FormControlName */ /* unused harmony export FormGroupDirective */ /* unused harmony export FormArrayName */ /* unused harmony export FormGroupName */ /* unused harmony export NgSelectOption */ /* unused harmony export SelectControlValueAccessor */ /* unused harmony export SelectMultipleControlValueAccessor */ /* unused harmony export CheckboxRequiredValidator */ /* unused harmony export EmailValidator */ /* unused harmony export MaxLengthValidator */ /* unused harmony export MinLengthValidator */ /* unused harmony export PatternValidator */ /* unused harmony export RequiredValidator */ /* unused harmony export FormBuilder */ /* unused harmony export AbstractControl */ /* unused harmony export FormArray */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return FormControl; }); /* unused harmony export FormGroup */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return NG_ASYNC_VALIDATORS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return NG_VALIDATORS; }); /* unused harmony export Validators */ /* unused harmony export VERSION */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FormsModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ReactiveFormsModule; }); /* unused harmony export ɵba */ /* unused harmony export ɵz */ /* unused harmony export ɵx */ /* unused harmony export ɵy */ /* unused harmony export ɵa */ /* unused harmony export ɵb */ /* unused harmony export ɵc */ /* unused harmony export ɵd */ /* unused harmony export ɵe */ /* unused harmony export ɵf */ /* unused harmony export ɵg */ /* unused harmony export ɵbf */ /* unused harmony export ɵbb */ /* unused harmony export ɵbc */ /* unused harmony export ɵh */ /* unused harmony export ɵi */ /* unused harmony export ɵbd */ /* unused harmony export ɵbe */ /* unused harmony export ɵj */ /* unused harmony export ɵk */ /* unused harmony export ɵl */ /* unused harmony export ɵn */ /* unused harmony export ɵm */ /* unused harmony export ɵo */ /* unused harmony export ɵq */ /* unused harmony export ɵp */ /* unused harmony export ɵs */ /* unused harmony export ɵt */ /* unused harmony export ɵv */ /* unused harmony export ɵu */ /* unused harmony export ɵw */ /* unused harmony export ɵr */ var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; /** * @license Angular v4.1.1 * (c) 2010-2017 Google, Inc. https://angular.io/ * License: MIT */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Base class for control directives. * * Only used internally in the forms module. * * \@stable * @abstract */ var AbstractControlDirective = (function () { function AbstractControlDirective() { } /** * @abstract * @return {?} */ AbstractControlDirective.prototype.control = function () { }; Object.defineProperty(AbstractControlDirective.prototype, "value", { /** * @return {?} */ get: function () { return this.control ? this.control.value : null; }, enumerable: true, configurable: true }); Object.defineProperty(AbstractControlDirective.prototype, "valid", { /** * @return {?} */ get: function () { return this.control ? this.control.valid : null; }, enumerable: true, configurable: true }); Object.defineProperty(AbstractControlDirective.prototype, "invalid", { /** * @return {?} */ get: function () { return this.control ? this.control.invalid : null; }, enumerable: true, configurable: true }); Object.defineProperty(AbstractControlDirective.prototype, "pending", { /** * @return {?} */ get: function () { return this.control ? this.control.pending : null; }, enumerable: true, configurable: true }); Object.defineProperty(AbstractControlDirective.prototype, "errors", { /** * @return {?} */ get: function () { return this.control ? this.control.errors : null; }, enumerable: true, configurable: true }); Object.defineProperty(AbstractControlDirective.prototype, "pristine", { /** * @return {?} */ get: function () { return this.control ? this.control.pristine : null; }, enumerable: true, configurable: true }); Object.defineProperty(AbstractControlDirective.prototype, "dirty", { /** * @return {?} */ get: function () { return this.control ? this.control.dirty : null; }, enumerable: true, configurable: true }); Object.defineProperty(AbstractControlDirective.prototype, "touched", { /** * @return {?} */ get: function () { return this.control ? this.control.touched : null; }, enumerable: true, configurable: true }); Object.defineProperty(AbstractControlDirective.prototype, "untouched", { /** * @return {?} */ get: function () { return this.control ? this.control.untouched : null; }, enumerable: true, configurable: true }); Object.defineProperty(AbstractControlDirective.prototype, "disabled", { /** * @return {?} */ get: function () { return this.control ? this.control.disabled : null; }, enumerable: true, configurable: true }); Object.defineProperty(AbstractControlDirective.prototype, "enabled", { /** * @return {?} */ get: function () { return this.control ? this.control.enabled : null; }, enumerable: true, configurable: true }); Object.defineProperty(AbstractControlDirective.prototype, "statusChanges", { /** * @return {?} */ get: function () { return this.control ? this.control.statusChanges : null; }, enumerable: true, configurable: true }); Object.defineProperty(AbstractControlDirective.prototype, "valueChanges", { /** * @return {?} */ get: function () { return this.control ? this.control.valueChanges : null; }, enumerable: true, configurable: true }); Object.defineProperty(AbstractControlDirective.prototype, "path", { /** * @return {?} */ get: function () { return null; }, enumerable: true, configurable: true }); /** * @param {?=} value * @return {?} */ AbstractControlDirective.prototype.reset = function (value) { if (value === void 0) { value = undefined; } if (this.control) this.control.reset(value); }; /** * @param {?} errorCode * @param {?=} path * @return {?} */ AbstractControlDirective.prototype.hasError = function (errorCode, path) { return this.control ? this.control.hasError(errorCode, path) : false; }; /** * @param {?} errorCode * @param {?=} path * @return {?} */ AbstractControlDirective.prototype.getError = function (errorCode, path) { return this.control ? this.control.getError(errorCode, path) : null; }; return AbstractControlDirective; }()); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * A directive that contains multiple {\@link NgControl}s. * * Only used by the forms module. * * \@stable * @abstract */ var ControlContainer = (function (_super) { __extends(ControlContainer, _super); function ControlContainer() { return _super !== null && _super.apply(this, arguments) || this; } Object.defineProperty(ControlContainer.prototype, "formDirective", { /** * Get the form to which this container belongs. * @return {?} */ get: function () { return null; }, enumerable: true, configurable: true }); Object.defineProperty(ControlContainer.prototype, "path", { /** * Get the path to this container. * @return {?} */ get: function () { return null; }, enumerable: true, configurable: true }); return ControlContainer; }(AbstractControlDirective)); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var __assign = (undefined && undefined.__assign) || Object.assign || function (t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; /** * @param {?} value * @return {?} */ function isEmptyInputValue(value) { // we don't check for string here so it also works with arrays return value == null || value.length === 0; } /** * Providers for validators to be used for {\@link FormControl}s in a form. * * Provide this using `multi: true` to add validators. * * \@stable */ var NG_VALIDATORS = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["e" /* InjectionToken */]('NgValidators'); /** * Providers for asynchronous validators to be used for {\@link FormControl}s * in a form. * * Provide this using `multi: true` to add validators. * * See {\@link NG_VALIDATORS} for more details. * * \@stable */ var NG_ASYNC_VALIDATORS = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["e" /* InjectionToken */]('NgAsyncValidators'); var EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/; /** * Provides a set of validators used by form controls. * * A validator is a function that processes a {\@link FormControl} or collection of * controls and returns a map of errors. A null map means that validation has passed. * * ### Example * * ```typescript * var loginControl = new FormControl("", Validators.required) * ``` * * \@stable */ var Validators = (function () { function Validators() { } /** * Validator that requires controls to have a non-empty value. * @param {?} control * @return {?} */ Validators.required = function (control) { return isEmptyInputValue(control.value) ? { 'required': true } : null; }; /** * Validator that requires control value to be true. * @param {?} control * @return {?} */ Validators.requiredTrue = function (control) { return control.value === true ? null : { 'required': true }; }; /** * Validator that performs email validation. * @param {?} control * @return {?} */ Validators.email = function (control) { return EMAIL_REGEXP.test(control.value) ? null : { 'email': true }; }; /** * Validator that requires controls to have a value of a minimum length. * @param {?} minLength * @return {?} */ Validators.minLength = function (minLength) { return function (control) { if (isEmptyInputValue(control.value)) { return null; // don't validate empty values to allow optional controls } var /** @type {?} */ length = control.value ? control.value.length : 0; return length < minLength ? { 'minlength': { 'requiredLength': minLength, 'actualLength': length } } : null; }; }; /** * Validator that requires controls to have a value of a maximum length. * @param {?} maxLength * @return {?} */ Validators.maxLength = function (maxLength) { return function (control) { var /** @type {?} */ length = control.value ? control.value.length : 0; return length > maxLength ? { 'maxlength': { 'requiredLength': maxLength, 'actualLength': length } } : null; }; }; /** * Validator that requires a control to match a regex to its value. * @param {?} pattern * @return {?} */ Validators.pattern = function (pattern) { if (!pattern) return Validators.nullValidator; var /** @type {?} */ regex; var /** @type {?} */ regexStr; if (typeof pattern === 'string') { regexStr = "^" + pattern + "$"; regex = new RegExp(regexStr); } else { regexStr = pattern.toString(); regex = pattern; } return function (control) { if (isEmptyInputValue(control.value)) { return null; // don't validate empty values to allow optional controls } var /** @type {?} */ value = control.value; return regex.test(value) ? null : { 'pattern': { 'requiredPattern': regexStr, 'actualValue': value } }; }; }; /** * No-op validator. * @param {?} c * @return {?} */ Validators.nullValidator = function (c) { return null; }; /** * @param {?} validators * @return {?} */ Validators.compose = function (validators) { if (!validators) return null; var /** @type {?} */ presentValidators = (validators.filter(isPresent)); if (presentValidators.length == 0) return null; return function (control) { return _mergeErrors(_executeValidators(control, presentValidators)); }; }; /** * @param {?} validators * @return {?} */ Validators.composeAsync = function (validators) { if (!validators) return null; var /** @type {?} */ presentValidators = (validators.filter(isPresent)); if (presentValidators.length == 0) return null; return function (control) { var /** @type {?} */ observables = _executeAsyncValidators(control, presentValidators).map(toObservable); return __WEBPACK_IMPORTED_MODULE_3_rxjs_operator_map__["map"].call(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_rxjs_observable_forkJoin__["forkJoin"])(observables), _mergeErrors); }; }; return Validators; }()); /** * @param {?} o * @return {?} */ function isPresent(o) { return o != null; } /** * @param {?} r * @return {?} */ function toObservable(r) { var /** @type {?} */ obs = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["f" /* ɵisPromise */])(r) ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2_rxjs_observable_fromPromise__["fromPromise"])(r) : r; if (!(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["g" /* ɵisObservable */])(obs))) { throw new Error("Expected validator to return Promise or Observable."); } return obs; } /** * @param {?} control * @param {?} validators * @return {?} */ function _executeValidators(control, validators) { return validators.map(function (v) { return v(control); }); } /** * @param {?} control * @param {?} validators * @return {?} */ function _executeAsyncValidators(control, validators) { return validators.map(function (v) { return v(control); }); } /** * @param {?} arrayOfErrors * @return {?} */ function _mergeErrors(arrayOfErrors) { var /** @type {?} */ res = arrayOfErrors.reduce(function (res, errors) { return errors != null ? __assign({}, /** @type {?} */ ((res)), errors) : ((res)); }, {}); return Object.keys(res).length === 0 ? null : res; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Used to provide a {\@link ControlValueAccessor} for form controls. * * See {\@link DefaultValueAccessor} for how to implement one. * \@stable */ var NG_VALUE_ACCESSOR = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["e" /* InjectionToken */]('NgValueAccessor'); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var CHECKBOX_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["d" /* forwardRef */])(function () { return CheckboxControlValueAccessor; }), multi: true, }; /** * The accessor for writing a value and listening to changes on a checkbox input element. * * ### Example * ``` * * ``` * * \@stable */ var CheckboxControlValueAccessor = (function () { /** * @param {?} _renderer * @param {?} _elementRef */ function CheckboxControlValueAccessor(_renderer, _elementRef) { this._renderer = _renderer; this._elementRef = _elementRef; this.onChange = function (_) { }; this.onTouched = function () { }; } /** * @param {?} value * @return {?} */ CheckboxControlValueAccessor.prototype.writeValue = function (value) { this._renderer.setElementProperty(this._elementRef.nativeElement, 'checked', value); }; /** * @param {?} fn * @return {?} */ CheckboxControlValueAccessor.prototype.registerOnChange = function (fn) { this.onChange = fn; }; /** * @param {?} fn * @return {?} */ CheckboxControlValueAccessor.prototype.registerOnTouched = function (fn) { this.onTouched = fn; }; /** * @param {?} isDisabled * @return {?} */ CheckboxControlValueAccessor.prototype.setDisabledState = function (isDisabled) { this._renderer.setElementProperty(this._elementRef.nativeElement, 'disabled', isDisabled); }; return CheckboxControlValueAccessor; }()); CheckboxControlValueAccessor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["c" /* Directive */], args: [{ selector: 'input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]', host: { '(change)': 'onChange($event.target.checked)', '(blur)': 'onTouched()' }, providers: [CHECKBOX_VALUE_ACCESSOR] },] }, ]; /** * @nocollapse */ CheckboxControlValueAccessor.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["h" /* Renderer */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ElementRef */], }, ]; }; /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var DEFAULT_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["d" /* forwardRef */])(function () { return DefaultValueAccessor; }), multi: true }; /** * We must check whether the agent is Android because composition events * behave differently between iOS and Android. * @return {?} */ function _isAndroid() { var /** @type {?} */ userAgent = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__angular_platform_browser__["c" /* ɵgetDOM */])() ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__angular_platform_browser__["c" /* ɵgetDOM */])().getUserAgent() : ''; return /android (\d+)/.test(userAgent.toLowerCase()); } /** * Turn this mode on if you want form directives to buffer IME input until compositionend * \@experimental */ var COMPOSITION_BUFFER_MODE = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["e" /* InjectionToken */]('CompositionEventMode'); /** * The default accessor for writing a value and listening to changes that is used by the * {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName} directives. * * ### Example * ``` * * ``` * * \@stable */ var DefaultValueAccessor = (function () { /** * @param {?} _renderer * @param {?} _elementRef * @param {?} _compositionMode */ function DefaultValueAccessor(_renderer, _elementRef, _compositionMode) { this._renderer = _renderer; this._elementRef = _elementRef; this._compositionMode = _compositionMode; this.onChange = function (_) { }; this.onTouched = function () { }; this._composing = false; if (this._compositionMode == null) { this._compositionMode = !_isAndroid(); } } /** * @param {?} value * @return {?} */ DefaultValueAccessor.prototype.writeValue = function (value) { var /** @type {?} */ normalizedValue = value == null ? '' : value; this._renderer.setElementProperty(this._elementRef.nativeElement, 'value', normalizedValue); }; /** * @param {?} fn * @return {?} */ DefaultValueAccessor.prototype.registerOnChange = function (fn) { this.onChange = fn; }; /** * @param {?} fn * @return {?} */ DefaultValueAccessor.prototype.registerOnTouched = function (fn) { this.onTouched = fn; }; /** * @param {?} isDisabled * @return {?} */ DefaultValueAccessor.prototype.setDisabledState = function (isDisabled) { this._renderer.setElementProperty(this._elementRef.nativeElement, 'disabled', isDisabled); }; /** * @param {?} value * @return {?} */ DefaultValueAccessor.prototype._handleInput = function (value) { if (!this._compositionMode || (this._compositionMode && !this._composing)) { this.onChange(value); } }; /** * @return {?} */ DefaultValueAccessor.prototype._compositionStart = function () { this._composing = true; }; /** * @param {?} value * @return {?} */ DefaultValueAccessor.prototype._compositionEnd = function (value) { this._composing = false; this._compositionMode && this.onChange(value); }; return DefaultValueAccessor; }()); DefaultValueAccessor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["c" /* Directive */], args: [{ selector: 'input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]', // TODO: vsavkin replace the above selector with the one below it once // https://github.com/angular/angular/issues/3011 is implemented // selector: '[ngModel],[formControl],[formControlName]', host: { '(input)': '_handleInput($event.target.value)', '(blur)': 'onTouched()', '(compositionstart)': '_compositionStart()', '(compositionend)': '_compositionEnd($event.target.value)' }, providers: [DEFAULT_VALUE_ACCESSOR] },] }, ]; /** * @nocollapse */ DefaultValueAccessor.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["h" /* Renderer */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ElementRef */], }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["j" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["k" /* Inject */], args: [COMPOSITION_BUFFER_MODE,] },] }, ]; }; /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} validator * @return {?} */ function normalizeValidator(validator) { if (((validator)).validate) { return function (c) { return ((validator)).validate(c); }; } else { return (validator); } } /** * @param {?} validator * @return {?} */ function normalizeAsyncValidator(validator) { if (((validator)).validate) { return function (c) { return ((validator)).validate(c); }; } else { return (validator); } } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var NUMBER_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["d" /* forwardRef */])(function () { return NumberValueAccessor; }), multi: true }; /** * The accessor for writing a number value and listening to changes that is used by the * {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName} directives. * * ### Example * ``` * * ``` */ var NumberValueAccessor = (function () { /** * @param {?} _renderer * @param {?} _elementRef */ function NumberValueAccessor(_renderer, _elementRef) { this._renderer = _renderer; this._elementRef = _elementRef; this.onChange = function (_) { }; this.onTouched = function () { }; } /** * @param {?} value * @return {?} */ NumberValueAccessor.prototype.writeValue = function (value) { // The value needs to be normalized for IE9, otherwise it is set to 'null' when null var /** @type {?} */ normalizedValue = value == null ? '' : value; this._renderer.setElementProperty(this._elementRef.nativeElement, 'value', normalizedValue); }; /** * @param {?} fn * @return {?} */ NumberValueAccessor.prototype.registerOnChange = function (fn) { this.onChange = function (value) { fn(value == '' ? null : parseFloat(value)); }; }; /** * @param {?} fn * @return {?} */ NumberValueAccessor.prototype.registerOnTouched = function (fn) { this.onTouched = fn; }; /** * @param {?} isDisabled * @return {?} */ NumberValueAccessor.prototype.setDisabledState = function (isDisabled) { this._renderer.setElementProperty(this._elementRef.nativeElement, 'disabled', isDisabled); }; return NumberValueAccessor; }()); NumberValueAccessor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["c" /* Directive */], args: [{ selector: 'input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]', host: { '(change)': 'onChange($event.target.value)', '(input)': 'onChange($event.target.value)', '(blur)': 'onTouched()' }, providers: [NUMBER_VALUE_ACCESSOR] },] }, ]; /** * @nocollapse */ NumberValueAccessor.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["h" /* Renderer */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ElementRef */], }, ]; }; /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @return {?} */ function unimplemented() { throw new Error('unimplemented'); } /** * A base class that all control directive extend. * It binds a {\@link FormControl} object to a DOM element. * * Used internally by Angular forms. * * \@stable * @abstract */ var NgControl = (function (_super) { __extends(NgControl, _super); function NgControl() { var _this = _super.apply(this, arguments) || this; /** * \@internal */ _this._parent = null; _this.name = null; _this.valueAccessor = null; /** * \@internal */ _this._rawValidators = []; /** * \@internal */ _this._rawAsyncValidators = []; return _this; } Object.defineProperty(NgControl.prototype, "validator", { /** * @return {?} */ get: function () { return (unimplemented()); }, enumerable: true, configurable: true }); Object.defineProperty(NgControl.prototype, "asyncValidator", { /** * @return {?} */ get: function () { return (unimplemented()); }, enumerable: true, configurable: true }); /** * @abstract * @param {?} newValue * @return {?} */ NgControl.prototype.viewToModelUpdate = function (newValue) { }; return NgControl; }(AbstractControlDirective)); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var RADIO_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["d" /* forwardRef */])(function () { return RadioControlValueAccessor; }), multi: true }; /** * Internal class used by Angular to uncheck radio buttons with the matching name. */ var RadioControlRegistry = (function () { function RadioControlRegistry() { this._accessors = []; } /** * @param {?} control * @param {?} accessor * @return {?} */ RadioControlRegistry.prototype.add = function (control, accessor) { this._accessors.push([control, accessor]); }; /** * @param {?} accessor * @return {?} */ RadioControlRegistry.prototype.remove = function (accessor) { for (var /** @type {?} */ i = this._accessors.length - 1; i >= 0; --i) { if (this._accessors[i][1] === accessor) { this._accessors.splice(i, 1); return; } } }; /** * @param {?} accessor * @return {?} */ RadioControlRegistry.prototype.select = function (accessor) { var _this = this; this._accessors.forEach(function (c) { if (_this._isSameGroup(c, accessor) && c[1] !== accessor) { c[1].fireUncheck(accessor.value); } }); }; /** * @param {?} controlPair * @param {?} accessor * @return {?} */ RadioControlRegistry.prototype._isSameGroup = function (controlPair, accessor) { if (!controlPair[0].control) return false; return controlPair[0]._parent === accessor._control._parent && controlPair[1].name === accessor.name; }; return RadioControlRegistry; }()); RadioControlRegistry.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["l" /* Injectable */] }, ]; /** * @nocollapse */ RadioControlRegistry.ctorParameters = function () { return []; }; /** * \@whatItDoes Writes radio control values and listens to radio control changes. * * Used by {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName} * to keep the view synced with the {\@link FormControl} model. * * \@howToUse * * If you have imported the {\@link FormsModule} or the {\@link ReactiveFormsModule}, this * value accessor will be active on any radio control that has a form directive. You do * **not** need to add a special selector to activate it. * * ### How to use radio buttons with form directives * * To use radio buttons in a template-driven form, you'll want to ensure that radio buttons * in the same group have the same `name` attribute. Radio buttons with different `name` * attributes do not affect each other. * * {\@example forms/ts/radioButtons/radio_button_example.ts region='TemplateDriven'} * * When using radio buttons in a reactive form, radio buttons in the same group should have the * same `formControlName`. You can also add a `name` attribute, but it's optional. * * {\@example forms/ts/reactiveRadioButtons/reactive_radio_button_example.ts region='Reactive'} * * * **npm package**: `\@angular/forms` * * \@stable */ var RadioControlValueAccessor = (function () { /** * @param {?} _renderer * @param {?} _elementRef * @param {?} _registry * @param {?} _injector */ function RadioControlValueAccessor(_renderer, _elementRef, _registry, _injector) { this._renderer = _renderer; this._elementRef = _elementRef; this._registry = _registry; this._injector = _injector; this.onChange = function () { }; this.onTouched = function () { }; } /** * @return {?} */ RadioControlValueAccessor.prototype.ngOnInit = function () { this._control = this._injector.get(NgControl); this._checkName(); this._registry.add(this._control, this); }; /** * @return {?} */ RadioControlValueAccessor.prototype.ngOnDestroy = function () { this._registry.remove(this); }; /** * @param {?} value * @return {?} */ RadioControlValueAccessor.prototype.writeValue = function (value) { this._state = value === this.value; this._renderer.setElementProperty(this._elementRef.nativeElement, 'checked', this._state); }; /** * @param {?} fn * @return {?} */ RadioControlValueAccessor.prototype.registerOnChange = function (fn) { var _this = this; this._fn = fn; this.onChange = function () { fn(_this.value); _this._registry.select(_this); }; }; /** * @param {?} value * @return {?} */ RadioControlValueAccessor.prototype.fireUncheck = function (value) { this.writeValue(value); }; /** * @param {?} fn * @return {?} */ RadioControlValueAccessor.prototype.registerOnTouched = function (fn) { this.onTouched = fn; }; /** * @param {?} isDisabled * @return {?} */ RadioControlValueAccessor.prototype.setDisabledState = function (isDisabled) { this._renderer.setElementProperty(this._elementRef.nativeElement, 'disabled', isDisabled); }; /** * @return {?} */ RadioControlValueAccessor.prototype._checkName = function () { if (this.name && this.formControlName && this.name !== this.formControlName) { this._throwNameError(); } if (!this.name && this.formControlName) this.name = this.formControlName; }; /** * @return {?} */ RadioControlValueAccessor.prototype._throwNameError = function () { throw new Error("\n If you define both a name and a formControlName attribute on your radio button, their values\n must match. Ex: \n "); }; return RadioControlValueAccessor; }()); RadioControlValueAccessor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["c" /* Directive */], args: [{ selector: 'input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]', host: { '(change)': 'onChange()', '(blur)': 'onTouched()' }, providers: [RADIO_VALUE_ACCESSOR] },] }, ]; /** * @nocollapse */ RadioControlValueAccessor.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["h" /* Renderer */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ElementRef */], }, { type: RadioControlRegistry, }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["m" /* Injector */], }, ]; }; RadioControlValueAccessor.propDecorators = { 'name': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["n" /* Input */] },], 'formControlName': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["n" /* Input */] },], 'value': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["n" /* Input */] },], }; /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var RANGE_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["d" /* forwardRef */])(function () { return RangeValueAccessor; }), multi: true }; /** * The accessor for writing a range value and listening to changes that is used by the * {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName} directives. * * ### Example * ``` * * ``` */ var RangeValueAccessor = (function () { /** * @param {?} _renderer * @param {?} _elementRef */ function RangeValueAccessor(_renderer, _elementRef) { this._renderer = _renderer; this._elementRef = _elementRef; this.onChange = function (_) { }; this.onTouched = function () { }; } /** * @param {?} value * @return {?} */ RangeValueAccessor.prototype.writeValue = function (value) { this._renderer.setElementProperty(this._elementRef.nativeElement, 'value', parseFloat(value)); }; /** * @param {?} fn * @return {?} */ RangeValueAccessor.prototype.registerOnChange = function (fn) { this.onChange = function (value) { fn(value == '' ? null : parseFloat(value)); }; }; /** * @param {?} fn * @return {?} */ RangeValueAccessor.prototype.registerOnTouched = function (fn) { this.onTouched = fn; }; /** * @param {?} isDisabled * @return {?} */ RangeValueAccessor.prototype.setDisabledState = function (isDisabled) { this._renderer.setElementProperty(this._elementRef.nativeElement, 'disabled', isDisabled); }; return RangeValueAccessor; }()); RangeValueAccessor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["c" /* Directive */], args: [{ selector: 'input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]', host: { '(change)': 'onChange($event.target.value)', '(input)': 'onChange($event.target.value)', '(blur)': 'onTouched()' }, providers: [RANGE_VALUE_ACCESSOR] },] }, ]; /** * @nocollapse */ RangeValueAccessor.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["h" /* Renderer */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ElementRef */], }, ]; }; /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var SELECT_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["d" /* forwardRef */])(function () { return SelectControlValueAccessor; }), multi: true }; /** * @param {?} id * @param {?} value * @return {?} */ function _buildValueString(id, value) { if (id == null) return "" + value; if (value && typeof value === 'object') value = 'Object'; return (id + ": " + value).slice(0, 50); } /** * @param {?} valueString * @return {?} */ function _extractId(valueString) { return valueString.split(':')[0]; } /** * \@whatItDoes Writes values and listens to changes on a select element. * * Used by {\@link NgModel}, {\@link FormControlDirective}, and {\@link FormControlName} * to keep the view synced with the {\@link FormControl} model. * * \@howToUse * * If you have imported the {\@link FormsModule} or the {\@link ReactiveFormsModule}, this * value accessor will be active on any select control that has a form directive. You do * **not** need to add a special selector to activate it. * * ### How to use select controls with form directives * * To use a select in a template-driven form, simply add an `ngModel` and a `name` * attribute to the main `` tag. Like in the former example, you have the * choice of binding to the `value` or `ngValue` property on the select's options. * * {\@example forms/ts/reactiveSelectControl/reactive_select_control_example.ts region='Component'} * * ### Caveat: Option selection * * Angular uses object identity to select option. It's possible for the identities of items * to change while the data does not. This can happen, for example, if the items are produced * from an RPC to the server, and that RPC is re-run. Even if the data hasn't changed, the * second response will produce objects with different identities. * * To customize the default option comparison algorithm, ` * * * * compareFn(c1: Country, c2: Country): boolean { * return c1 && c2 ? c1.id === c2.id : c1 === c2; * } * ``` * * Note: We listen to the 'change' event because 'input' events aren't fired * for selects in Firefox and IE: * https://bugzilla.mozilla.org/show_bug.cgi?id=1024350 * https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/4660045/ * * * **npm package**: `\@angular/forms` * * \@stable */ var SelectControlValueAccessor = (function () { /** * @param {?} _renderer * @param {?} _elementRef */ function SelectControlValueAccessor(_renderer, _elementRef) { this._renderer = _renderer; this._elementRef = _elementRef; /** * \@internal */ this._optionMap = new Map(); /** * \@internal */ this._idCounter = 0; this.onChange = function (_) { }; this.onTouched = function () { }; this._compareWith = __WEBPACK_IMPORTED_MODULE_0__angular_core__["o" /* ɵlooseIdentical */]; } Object.defineProperty(SelectControlValueAccessor.prototype, "compareWith", { /** * @param {?} fn * @return {?} */ set: function (fn) { if (typeof fn !== 'function') { throw new Error("compareWith must be a function, but received " + JSON.stringify(fn)); } this._compareWith = fn; }, enumerable: true, configurable: true }); /** * @param {?} value * @return {?} */ SelectControlValueAccessor.prototype.writeValue = function (value) { this.value = value; var /** @type {?} */ id = this._getOptionId(value); if (id == null) { this._renderer.setElementProperty(this._elementRef.nativeElement, 'selectedIndex', -1); } var /** @type {?} */ valueString = _buildValueString(id, value); this._renderer.setElementProperty(this._elementRef.nativeElement, 'value', valueString); }; /** * @param {?} fn * @return {?} */ SelectControlValueAccessor.prototype.registerOnChange = function (fn) { var _this = this; this.onChange = function (valueString) { _this.value = valueString; fn(_this._getOptionValue(valueString)); }; }; /** * @param {?} fn * @return {?} */ SelectControlValueAccessor.prototype.registerOnTouched = function (fn) { this.onTouched = fn; }; /** * @param {?} isDisabled * @return {?} */ SelectControlValueAccessor.prototype.setDisabledState = function (isDisabled) { this._renderer.setElementProperty(this._elementRef.nativeElement, 'disabled', isDisabled); }; /** * \@internal * @return {?} */ SelectControlValueAccessor.prototype._registerOption = function () { return (this._idCounter++).toString(); }; /** * \@internal * @param {?} value * @return {?} */ SelectControlValueAccessor.prototype._getOptionId = function (value) { for (var _i = 0, _a = Array.from(this._optionMap.keys()); _i < _a.length; _i++) { var id = _a[_i]; if (this._compareWith(this._optionMap.get(id), value)) return id; } return null; }; /** * \@internal * @param {?} valueString * @return {?} */ SelectControlValueAccessor.prototype._getOptionValue = function (valueString) { var /** @type {?} */ id = _extractId(valueString); return this._optionMap.has(id) ? this._optionMap.get(id) : valueString; }; return SelectControlValueAccessor; }()); SelectControlValueAccessor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["c" /* Directive */], args: [{ selector: 'select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]', host: { '(change)': 'onChange($event.target.value)', '(blur)': 'onTouched()' }, providers: [SELECT_VALUE_ACCESSOR] },] }, ]; /** * @nocollapse */ SelectControlValueAccessor.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["h" /* Renderer */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ElementRef */], }, ]; }; SelectControlValueAccessor.propDecorators = { 'compareWith': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["n" /* Input */] },], }; /** * \@whatItDoes Marks ` * * * compareFn(c1: Country, c2: Country): boolean { * return c1 && c2 ? c1.id === c2.id : c1 === c2; * } * ``` * * \@stable */ var SelectMultipleControlValueAccessor = (function () { /** * @param {?} _renderer * @param {?} _elementRef */ function SelectMultipleControlValueAccessor(_renderer, _elementRef) { this._renderer = _renderer; this._elementRef = _elementRef; /** * \@internal */ this._optionMap = new Map(); /** * \@internal */ this._idCounter = 0; this.onChange = function (_) { }; this.onTouched = function () { }; this._compareWith = __WEBPACK_IMPORTED_MODULE_0__angular_core__["o" /* ɵlooseIdentical */]; } Object.defineProperty(SelectMultipleControlValueAccessor.prototype, "compareWith", { /** * @param {?} fn * @return {?} */ set: function (fn) { if (typeof fn !== 'function') { throw new Error("compareWith must be a function, but received " + JSON.stringify(fn)); } this._compareWith = fn; }, enumerable: true, configurable: true }); /** * @param {?} value * @return {?} */ SelectMultipleControlValueAccessor.prototype.writeValue = function (value) { var _this = this; this.value = value; var /** @type {?} */ optionSelectedStateSetter; if (Array.isArray(value)) { // convert values to ids var /** @type {?} */ ids_1 = value.map(function (v) { return _this._getOptionId(v); }); optionSelectedStateSetter = function (opt, o) { opt._setSelected(ids_1.indexOf(o.toString()) > -1); }; } else { optionSelectedStateSetter = function (opt, o) { opt._setSelected(false); }; } this._optionMap.forEach(optionSelectedStateSetter); }; /** * @param {?} fn * @return {?} */ SelectMultipleControlValueAccessor.prototype.registerOnChange = function (fn) { var _this = this; this.onChange = function (_) { var /** @type {?} */ selected = []; if (_.hasOwnProperty('selectedOptions')) { var /** @type {?} */ options = _.selectedOptions; for (var /** @type {?} */ i = 0; i < options.length; i++) { var /** @type {?} */ opt = options.item(i); var /** @type {?} */ val = _this._getOptionValue(opt.value); selected.push(val); } } else { var /** @type {?} */ options = (_.options); for (var /** @type {?} */ i = 0; i < options.length; i++) { var /** @type {?} */ opt = options.item(i); if (opt.selected) { var /** @type {?} */ val = _this._getOptionValue(opt.value); selected.push(val); } } } _this.value = selected; fn(selected); }; }; /** * @param {?} fn * @return {?} */ SelectMultipleControlValueAccessor.prototype.registerOnTouched = function (fn) { this.onTouched = fn; }; /** * @param {?} isDisabled * @return {?} */ SelectMultipleControlValueAccessor.prototype.setDisabledState = function (isDisabled) { this._renderer.setElementProperty(this._elementRef.nativeElement, 'disabled', isDisabled); }; /** * \@internal * @param {?} value * @return {?} */ SelectMultipleControlValueAccessor.prototype._registerOption = function (value) { var /** @type {?} */ id = (this._idCounter++).toString(); this._optionMap.set(id, value); return id; }; /** * \@internal * @param {?} value * @return {?} */ SelectMultipleControlValueAccessor.prototype._getOptionId = function (value) { for (var _i = 0, _a = Array.from(this._optionMap.keys()); _i < _a.length; _i++) { var id = _a[_i]; if (this._compareWith(/** @type {?} */ ((this._optionMap.get(id)))._value, value)) return id; } return null; }; /** * \@internal * @param {?} valueString * @return {?} */ SelectMultipleControlValueAccessor.prototype._getOptionValue = function (valueString) { var /** @type {?} */ id = _extractId$1(valueString); return this._optionMap.has(id) ? ((this._optionMap.get(id)))._value : valueString; }; return SelectMultipleControlValueAccessor; }()); SelectMultipleControlValueAccessor.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["c" /* Directive */], args: [{ selector: 'select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]', host: { '(change)': 'onChange($event.target)', '(blur)': 'onTouched()' }, providers: [SELECT_MULTIPLE_VALUE_ACCESSOR] },] }, ]; /** * @nocollapse */ SelectMultipleControlValueAccessor.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["h" /* Renderer */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* ElementRef */], }, ]; }; SelectMultipleControlValueAccessor.propDecorators = { 'compareWith': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["n" /* Input */] },], }; /** * Marks `