var BrowserModule = /** @class */ (function () { function BrowserModule(parentModule) { if (parentModule) { throw new Error("BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead."); } } BrowserModule_1 = BrowserModule; /** * Configures a browser-based app to transition from a server-rendered app, if * one is present on the page. * * @param params An object containing an identifier for the app to transition. * The ID must match between the client and server versions of the app. * @returns The reconfigured `BrowserModule` to import into the app's root `AppModule`. */ BrowserModule.withServerTransition = function (params) { return { ngModule: BrowserModule_1, providers: [ { provide: APP_ID, useValue: params.appId }, { provide: TRANSITION_ID, useExisting: APP_ID }, SERVER_TRANSITION_PROVIDERS, ], }; }; var BrowserModule_1; BrowserModule = BrowserModule_1 = tslib_1.__decorate([ NgModule({ providers: BROWSER_MODULE_PROVIDERS, exports: [CommonModule, ApplicationModule] }), tslib_1.__param(0, Optional()), tslib_1.__param(0, SkipSelf()), tslib_1.__param(0, Inject(BrowserModule_1)), tslib_1.__metadata("design:paramtypes", [Object]) ], BrowserModule); return BrowserModule; }());
var HttpXsrfCookieExtractor = /** @class */ (function () { function HttpXsrfCookieExtractor(doc, platform, cookieName) { this.doc = doc; this.platform = platform; this.cookieName = cookieName; this.lastCookieString = ''; this.lastToken = null; /** * @internal for testing */ this.parseCount = 0; } HttpXsrfCookieExtractor.prototype.getToken = function () { if (this.platform === 'server') { return null; } var cookieString = this.doc.cookie || ''; if (cookieString !== this.lastCookieString) { this.parseCount++; this.lastToken = parseCookieValue(cookieString, this.cookieName); this.lastCookieString = cookieString; } return this.lastToken; }; HttpXsrfCookieExtractor = tslib_1.__decorate([ Injectable(), tslib_1.__param(0, Inject(DOCUMENT)), tslib_1.__param(1, Inject(PLATFORM_ID)), tslib_1.__param(2, Inject(XSRF_COOKIE_NAME)), tslib_1.__metadata("design:paramtypes", [Object, String, String]) ], HttpXsrfCookieExtractor); return HttpXsrfCookieExtractor; }());
var FormGroupName = /** @class */ (function (_super) { tslib_1.__extends(FormGroupName, _super); function FormGroupName(parent, validators, asyncValidators) { var _this = _super.call(this) || this; _this._parent = parent; _this._validators = validators; _this._asyncValidators = asyncValidators; return _this; } /** @internal */ FormGroupName.prototype._checkParentType = function () { if (_hasInvalidParent(this._parent)) { ReactiveErrors.groupParentException(); } }; tslib_1.__decorate([ Input('formGroupName'), tslib_1.__metadata("design:type", String) ], FormGroupName.prototype, "name", void 0); FormGroupName = tslib_1.__decorate([ Directive({ selector: '[formGroupName]', providers: [formGroupNameProvider] }), tslib_1.__param(0, Optional()), tslib_1.__param(0, Host()), tslib_1.__param(0, SkipSelf()), tslib_1.__param(1, Optional()), tslib_1.__param(1, Self()), tslib_1.__param(1, Inject(NG_VALIDATORS)), tslib_1.__param(2, Optional()), tslib_1.__param(2, Self()), tslib_1.__param(2, Inject(NG_ASYNC_VALIDATORS)), tslib_1.__metadata("design:paramtypes", [ControlContainer, Array, Array]) ], FormGroupName); return FormGroupName; }(AbstractFormGroupDirective));
var DomSharedStylesHost = /** @class */ (function (_super) { tslib_1.__extends(DomSharedStylesHost, _super); function DomSharedStylesHost(_doc) { var _this = _super.call(this) || this; _this._doc = _doc; _this._hostNodes = new Set(); _this._styleNodes = new Set(); _this._hostNodes.add(_doc.head); return _this; } DomSharedStylesHost.prototype._addStylesToHost = function (styles, host) { var _this = this; styles.forEach(function (style) { var styleEl = _this._doc.createElement('style'); styleEl.textContent = style; _this._styleNodes.add(host.appendChild(styleEl)); }); }; DomSharedStylesHost.prototype.addHost = function (hostNode) { this._addStylesToHost(this._stylesSet, hostNode); this._hostNodes.add(hostNode); }; DomSharedStylesHost.prototype.removeHost = function (hostNode) { this._hostNodes.delete(hostNode); }; DomSharedStylesHost.prototype.onStylesAdded = function (additions) { var _this = this; this._hostNodes.forEach(function (hostNode) { return _this._addStylesToHost(additions, hostNode); }); }; DomSharedStylesHost.prototype.ngOnDestroy = function () { this._styleNodes.forEach(function (styleNode) { return getDOM().remove(styleNode); }); }; DomSharedStylesHost = tslib_1.__decorate([ Injectable(), tslib_1.__param(0, Inject(DOCUMENT)), tslib_1.__metadata("design:paramtypes", [Object]) ], DomSharedStylesHost); return DomSharedStylesHost; }(SharedStylesHost));
var BrowserAnimationBuilder = /** @class */ (function (_super) { tslib_1.__extends(BrowserAnimationBuilder, _super); function BrowserAnimationBuilder(rootRenderer, doc) { var _this = _super.call(this) || this; _this._nextAnimationId = 0; var typeData = { id: '0', encapsulation: ViewEncapsulation.None, styles: [], data: { animation: [] } }; _this._renderer = rootRenderer.createRenderer(doc.body, typeData); return _this; } BrowserAnimationBuilder.prototype.build = function (animation) { var id = this._nextAnimationId.toString(); this._nextAnimationId++; var entry = Array.isArray(animation) ? sequence(animation) : animation; issueAnimationCommand(this._renderer, null, id, 'register', [entry]); return new BrowserAnimationFactory(id, this._renderer); }; BrowserAnimationBuilder = tslib_1.__decorate([ Injectable(), tslib_1.__param(1, Inject(DOCUMENT)), tslib_1.__metadata("design:paramtypes", [RendererFactory2, Object]) ], BrowserAnimationBuilder); return BrowserAnimationBuilder; }(AnimationBuilder));
var HttpXsrfInterceptor = /** @class */ (function () { function HttpXsrfInterceptor(tokenService, headerName) { this.tokenService = tokenService; this.headerName = headerName; } HttpXsrfInterceptor.prototype.intercept = function (req, next) { var lcUrl = req.url.toLowerCase(); // Skip both non-mutating requests and absolute URLs. // Non-mutating requests don't require a token, and absolute URLs require special handling // anyway as the cookie set // on our origin is not the same as the token expected by another origin. if (req.method === 'GET' || req.method === 'HEAD' || lcUrl.startsWith('http://') || lcUrl.startsWith('https://')) { return next.handle(req); } var token = this.tokenService.getToken(); // Be careful not to overwrite an existing header of the same name. if (token !== null && !req.headers.has(this.headerName)) { req = req.clone({ headers: req.headers.set(this.headerName, token) }); } return next.handle(req); }; HttpXsrfInterceptor = tslib_1.__decorate([ Injectable(), tslib_1.__param(1, Inject(XSRF_HEADER_NAME)), tslib_1.__metadata("design:paramtypes", [HttpXsrfTokenExtractor, String]) ], HttpXsrfInterceptor); return HttpXsrfInterceptor; }());
var PathLocationStrategy = /** @class */ (function (_super) { tslib_1.__extends(PathLocationStrategy, _super); function PathLocationStrategy(_platformLocation, href) { var _this = _super.call(this) || this; _this._platformLocation = _platformLocation; if (href == null) { href = _this._platformLocation.getBaseHrefFromDOM(); } if (href == null) { throw new Error("No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document."); } _this._baseHref = href; return _this; } PathLocationStrategy.prototype.onPopState = function (fn) { this._platformLocation.onPopState(fn); this._platformLocation.onHashChange(fn); }; PathLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; }; PathLocationStrategy.prototype.prepareExternalUrl = function (internal) { return Location.joinWithSlash(this._baseHref, internal); }; PathLocationStrategy.prototype.path = function (includeHash) { if (includeHash === void 0) { includeHash = false; } var pathname = this._platformLocation.pathname + Location.normalizeQueryParams(this._platformLocation.search); var hash = this._platformLocation.hash; return hash && includeHash ? "" + pathname + hash : pathname; }; PathLocationStrategy.prototype.pushState = function (state, title, url, queryParams) { var externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams)); this._platformLocation.pushState(state, title, externalUrl); }; PathLocationStrategy.prototype.replaceState = function (state, title, url, queryParams) { var externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams)); this._platformLocation.replaceState(state, title, externalUrl); }; PathLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); }; PathLocationStrategy.prototype.back = function () { this._platformLocation.back(); }; PathLocationStrategy = tslib_1.__decorate([ Injectable(), tslib_1.__param(1, Optional()), tslib_1.__param(1, Inject(APP_BASE_HREF)), tslib_1.__metadata("design:paramtypes", [PlatformLocation, String]) ], PathLocationStrategy); return PathLocationStrategy; }(LocationStrategy));
var NgControlStatus = /** @class */ (function (_super) { tslib_1.__extends(NgControlStatus, _super); function NgControlStatus(cd) { return _super.call(this, cd) || this; } NgControlStatus = tslib_1.__decorate([ Directive({ selector: '[formControlName],[ngModel],[formControl]', host: ngControlStatusHost }), tslib_1.__param(0, Self()), tslib_1.__metadata("design:paramtypes", [NgControl]) ], NgControlStatus); return NgControlStatus; }(AbstractControlStatus));
var InjectableAnimationEngine = /** @class */ (function (_super) { tslib_1.__extends(InjectableAnimationEngine, _super); function InjectableAnimationEngine(doc, driver, normalizer) { return _super.call(this, doc.body, driver, normalizer) || this; } InjectableAnimationEngine = tslib_1.__decorate([ Injectable(), tslib_1.__param(0, Inject(DOCUMENT)), tslib_1.__metadata("design:paramtypes", [Object, AnimationDriver, AnimationStyleNormalizer]) ], InjectableAnimationEngine); return InjectableAnimationEngine; }(AnimationEngine));
var NgControlStatusGroup = /** @class */ (function (_super) { tslib_1.__extends(NgControlStatusGroup, _super); function NgControlStatusGroup(cd) { return _super.call(this, cd) || this; } NgControlStatusGroup = tslib_1.__decorate([ Directive({ selector: '[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]', host: ngControlStatusHost }), tslib_1.__param(0, Self()), tslib_1.__metadata("design:paramtypes", [ControlContainer]) ], NgControlStatusGroup); return NgControlStatusGroup; }(AbstractControlStatus));
var DeprecatedDecimalPipe = /** @class */ (function () { function DeprecatedDecimalPipe(_locale) { this._locale = _locale; } DeprecatedDecimalPipe_1 = DeprecatedDecimalPipe; DeprecatedDecimalPipe.prototype.transform = function (value, digits) { return formatNumber(DeprecatedDecimalPipe_1, this._locale, value, NumberFormatStyle.Decimal, digits); }; var DeprecatedDecimalPipe_1; DeprecatedDecimalPipe = DeprecatedDecimalPipe_1 = tslib_1.__decorate([ Pipe({ name: 'number' }), tslib_1.__param(0, Inject(LOCALE_ID)), tslib_1.__metadata("design:paramtypes", [String]) ], DeprecatedDecimalPipe); return DeprecatedDecimalPipe; }());
var DeprecatedCurrencyPipe = /** @class */ (function () { function DeprecatedCurrencyPipe(_locale) { this._locale = _locale; } DeprecatedCurrencyPipe_1 = DeprecatedCurrencyPipe; DeprecatedCurrencyPipe.prototype.transform = function (value, currencyCode, symbolDisplay, digits) { if (currencyCode === void 0) { currencyCode = 'USD'; } if (symbolDisplay === void 0) { symbolDisplay = false; } return formatNumber(DeprecatedCurrencyPipe_1, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay); }; var DeprecatedCurrencyPipe_1; DeprecatedCurrencyPipe = DeprecatedCurrencyPipe_1 = tslib_1.__decorate([ Pipe({ name: 'currency' }), tslib_1.__param(0, Inject(LOCALE_ID)), tslib_1.__metadata("design:paramtypes", [String]) ], DeprecatedCurrencyPipe); return DeprecatedCurrencyPipe; }());
var ServerRendererFactory2 = /** @class */ (function () { function ServerRendererFactory2(eventManager, ngZone, document, sharedStylesHost) { this.eventManager = eventManager; this.ngZone = ngZone; this.document = document; this.sharedStylesHost = sharedStylesHost; this.rendererByCompId = new Map(); this.schema = DEFAULT_SCHEMA; this.defaultRenderer = new DefaultServerRenderer2(eventManager, document, ngZone, this.schema); } ServerRendererFactory2.prototype.createRenderer = function (element, type) { if (!element || !type) { return this.defaultRenderer; } switch (type.encapsulation) { case ViewEncapsulation.Native: case ViewEncapsulation.Emulated: { var renderer = this.rendererByCompId.get(type.id); if (!renderer) { renderer = new EmulatedEncapsulationServerRenderer2(this.eventManager, this.document, this.ngZone, this.sharedStylesHost, this.schema, type); this.rendererByCompId.set(type.id, renderer); } renderer.applyToHost(element); return renderer; } default: { if (!this.rendererByCompId.has(type.id)) { var styles = flattenStyles(type.id, type.styles, []); this.sharedStylesHost.addStyles(styles); this.rendererByCompId.set(type.id, this.defaultRenderer); } return this.defaultRenderer; } } }; ServerRendererFactory2.prototype.begin = function () { }; ServerRendererFactory2.prototype.end = function () { }; ServerRendererFactory2 = tslib_1.__decorate([ Injectable(), tslib_1.__param(2, Inject(DOCUMENT)), tslib_1.__metadata("design:paramtypes", [EventManager, NgZone, Object, SharedStylesHost]) ], ServerRendererFactory2); return ServerRendererFactory2; }());
var PercentPipe = /** @class */ (function () { function PercentPipe(_locale) { this._locale = _locale; } PercentPipe_1 = PercentPipe; /** * * @param value The number to be formatted as a percentage. * @param digitsInfo Decimal representation options, specified by a string * in the following format:<br> * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>. * - `minIntegerDigits`: The minimum number of integer digits before the decimal point. * Default is `1`. * - `minFractionDigits`: The minimum number of digits after the decimal point. * Default is `0`. * - `maxFractionDigits`: The maximum number of digits after the decimal point. * Default is `0`. * @param locale A locale code for the locale format rules to use. * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default. * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app). */ PercentPipe.prototype.transform = function (value, digitsInfo, locale) { if (isEmpty(value)) return null; locale = locale || this._locale; try { var num = strToNumber(value); return formatPercent(num, locale, digitsInfo); } catch (error) { throw invalidPipeArgumentError(PercentPipe_1, error.message); } }; var PercentPipe_1; PercentPipe = PercentPipe_1 = tslib_1.__decorate([ Injectable(), Pipe({ name: 'percent' }), tslib_1.__param(0, Inject(LOCALE_ID)), tslib_1.__metadata("design:paramtypes", [String]) ], PercentPipe); return PercentPipe; }());
var SystemJsNgModuleLoader = /** @class */ (function () { function SystemJsNgModuleLoader(_compiler, config) { this._compiler = _compiler; this._config = config || DEFAULT_CONFIG; } SystemJsNgModuleLoader.prototype.load = function (path) { var offlineMode = this._compiler instanceof Compiler; return offlineMode ? this.loadFactory(path) : this.loadAndCompile(path); }; SystemJsNgModuleLoader.prototype.loadAndCompile = function (path) { var _this = this; var _a = tslib_1.__read(path.split(_SEPARATOR), 2), module = _a[0], exportName = _a[1]; if (exportName === undefined) { exportName = 'default'; } return System.import(module) .then(function (module) { return module[exportName]; }) .then(function (type) { return checkNotEmpty(type, module, exportName); }) .then(function (type) { return _this._compiler.compileModuleAsync(type); }); }; SystemJsNgModuleLoader.prototype.loadFactory = function (path) { var _a = tslib_1.__read(path.split(_SEPARATOR), 2), module = _a[0], exportName = _a[1]; var factoryClassSuffix = FACTORY_CLASS_SUFFIX; if (exportName === undefined) { exportName = 'default'; factoryClassSuffix = ''; } return System.import(this._config.factoryPathPrefix + module + this._config.factoryPathSuffix) .then(function (module) { return module[exportName + factoryClassSuffix]; }) .then(function (factory) { return checkNotEmpty(factory, module, exportName); }); }; SystemJsNgModuleLoader = tslib_1.__decorate([ Injectable(), tslib_1.__param(1, Optional()), tslib_1.__metadata("design:paramtypes", [Compiler, SystemJsNgModuleLoaderConfig]) ], SystemJsNgModuleLoader); return SystemJsNgModuleLoader; }());
var DOMTestComponentRenderer = /** @class */ (function (_super) { __extends(DOMTestComponentRenderer, _super); function DOMTestComponentRenderer(_doc) { var _this = _super.call(this) || this; _this._doc = _doc; return _this; } DOMTestComponentRenderer.prototype.insertRootElement = function (rootElId) { var rootEl = ɵgetDOM().firstChild(ɵgetDOM().content(ɵgetDOM().createTemplate("<div id=\"" + rootElId + "\"></div>"))); // TODO(juliemr): can/should this be optional? var oldRoots = ɵgetDOM().querySelectorAll(this._doc, '[id^=root]'); for (var i = 0; i < oldRoots.length; i++) { ɵgetDOM().remove(oldRoots[i]); } ɵgetDOM().appendChild(this._doc.body, rootEl); }; DOMTestComponentRenderer = __decorate([ Injectable(), __param(0, Inject(DOCUMENT)), __metadata("design:paramtypes", [Object]) ], DOMTestComponentRenderer); return DOMTestComponentRenderer; }(TestComponentRenderer));
var DatePipe = /** @class */ (function () { function DatePipe(locale) { this.locale = locale; } DatePipe_1 = DatePipe; /** * @param value The date expression: a `Date` object, a number * (milliseconds since UTC epoch), or an ISO string (https://www.w3.org/TR/NOTE-datetime). * @param format The date/time components to include, using predefined options or a * custom format string. * @param timezone A timezone offset (such as `'+0430'`), or a standard * UTC/GMT or continental US timezone abbreviation. Default is * the local system timezone of the end-user's machine. * @param locale A locale code for the locale format rules to use. * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default. * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app). * @returns A date string in the desired format. */ DatePipe.prototype.transform = function (value, format, timezone, locale) { if (format === void 0) { format = 'mediumDate'; } if (value == null || value === '' || value !== value) return null; try { return formatDate(value, format, locale || this.locale, timezone); } catch (error) { throw invalidPipeArgumentError(DatePipe_1, error.message); } }; var DatePipe_1; DatePipe = DatePipe_1 = tslib_1.__decorate([ Pipe({ name: 'date', pure: true }), tslib_1.__param(0, Inject(LOCALE_ID)), tslib_1.__metadata("design:paramtypes", [String]) ], DatePipe); return DatePipe; }());
var KeyEventsPlugin = /** @class */ (function (_super) { tslib_1.__extends(KeyEventsPlugin, _super); /** * Initializes an instance of the browser plug-in. * @param doc The document in which key events will be detected. */ function KeyEventsPlugin(doc) { return _super.call(this, doc) || this; } KeyEventsPlugin_1 = KeyEventsPlugin; /** * Reports whether a named key event is supported. * @param eventName The event name to query. * @return True if the named key event is supported. */ KeyEventsPlugin.prototype.supports = function (eventName) { return KeyEventsPlugin_1.parseEventName(eventName) != null; }; /** * Registers a handler for a specific element and key event. * @param element The HTML element to receive event notifications. * @param eventName The name of the key event to listen for. * @param handler A function to call when the notification occurs. Receives the * event object as an argument. * @returns The key event that was registered. */ KeyEventsPlugin.prototype.addEventListener = function (element, eventName, handler) { var parsedEvent = KeyEventsPlugin_1.parseEventName(eventName); var outsideHandler = KeyEventsPlugin_1.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone()); return this.manager.getZone().runOutsideAngular(function () { return getDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler); }); }; KeyEventsPlugin.parseEventName = function (eventName) { var parts = eventName.toLowerCase().split('.'); var domEventName = parts.shift(); if ((parts.length === 0) || !(domEventName === 'keydown' || domEventName === 'keyup')) { return null; } var key = KeyEventsPlugin_1._normalizeKey(parts.pop()); var fullKey = ''; MODIFIER_KEYS.forEach(function (modifierName) { var index = parts.indexOf(modifierName); if (index > -1) { parts.splice(index, 1); fullKey += modifierName + '.'; } }); fullKey += key; if (parts.length != 0 || key.length === 0) { // returning null instead of throwing to let another plugin process the event return null; } var result = {}; result['domEventName'] = domEventName; result['fullKey'] = fullKey; return result; }; KeyEventsPlugin.getEventFullKey = function (event) { var fullKey = ''; var key = getDOM().getEventKey(event); key = key.toLowerCase(); if (key === ' ') { key = 'space'; // for readability } else if (key === '.') { key = 'dot'; // because '.' is used as a separator in event names } MODIFIER_KEYS.forEach(function (modifierName) { if (modifierName != key) { var modifierGetter = MODIFIER_KEY_GETTERS[modifierName]; if (modifierGetter(event)) { fullKey += modifierName + '.'; } } }); fullKey += key; return fullKey; }; /** * Configures a handler callback for a key event. * @param fullKey The event name that combines all simultaneous keystrokes. * @param handler The function that responds to the key event. * @param zone The zone in which the event occurred. * @returns A callback function. */ KeyEventsPlugin.eventCallback = function (fullKey, handler, zone) { return function (event /** TODO #9100 */) { if (KeyEventsPlugin_1.getEventFullKey(event) === fullKey) { zone.runGuarded(function () { return handler(event); }); } }; }; /** @internal */ KeyEventsPlugin._normalizeKey = function (keyName) { // TODO: switch to a Map if the mapping grows too much switch (keyName) { case 'esc': return 'escape'; default: return keyName; } }; var KeyEventsPlugin_1; KeyEventsPlugin = KeyEventsPlugin_1 = tslib_1.__decorate([ Injectable(), tslib_1.__param(0, Inject(DOCUMENT)), tslib_1.__metadata("design:paramtypes", [Object]) ], KeyEventsPlugin); return KeyEventsPlugin; }(EventManagerPlugin));
var DeprecatedDatePipe = /** @class */ (function () { function DeprecatedDatePipe(_locale) { this._locale = _locale; } DeprecatedDatePipe_1 = DeprecatedDatePipe; DeprecatedDatePipe.prototype.transform = function (value, pattern) { if (pattern === void 0) { pattern = 'mediumDate'; } if (value == null || value === '' || value !== value) return null; var date; if (typeof value === 'string') { value = value.trim(); } if (isDate(value)) { date = value; } else if (!isNaN(value - parseFloat(value))) { date = new Date(parseFloat(value)); } else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) { /** * For ISO Strings without time the day, month and year must be extracted from the ISO String * before Date creation to avoid time offset and errors in the new Date. * If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new * date, some browsers (e.g. IE 9) will throw an invalid Date error * If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the * timeoffset * is applied * Note: ISO months are 0 for January, 1 for February, ... */ var _a = tslib_1.__read(value.split('-').map(function (val) { return parseInt(val, 10); }), 3), y = _a[0], m = _a[1], d = _a[2]; date = new Date(y, m - 1, d); } else { date = new Date(value); } if (!isDate(date)) { var match = void 0; if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) { date = isoStringToDate(match); } else { throw invalidPipeArgumentError(DeprecatedDatePipe_1, value); } } return DateFormatter.format(date, this._locale, DeprecatedDatePipe_1._ALIASES[pattern] || pattern); }; var DeprecatedDatePipe_1; /** @internal */ DeprecatedDatePipe._ALIASES = { 'medium': 'yMMMdjms', 'short': 'yMdjm', 'fullDate': 'yMMMMEEEEd', 'longDate': 'yMMMMd', 'mediumDate': 'yMMMd', 'shortDate': 'yMd', 'mediumTime': 'jms', 'shortTime': 'jm' }; DeprecatedDatePipe = DeprecatedDatePipe_1 = tslib_1.__decorate([ Pipe({ name: 'date', pure: true }), tslib_1.__param(0, Inject(LOCALE_ID)), tslib_1.__metadata("design:paramtypes", [String]) ], DeprecatedDatePipe); return DeprecatedDatePipe; }());
var JsonpClientBackend = /** @class */ (function () { function JsonpClientBackend(callbackMap, document) { this.callbackMap = callbackMap; this.document = document; } /** * Get the name of the next callback method, by incrementing the global `nextRequestId`. */ JsonpClientBackend.prototype.nextCallback = function () { return "ng_jsonp_callback_" + nextRequestId++; }; /** * Process a JSONP request and return an event stream of the results. */ JsonpClientBackend.prototype.handle = function (req) { var _this = this; // Firstly, check both the method and response type. If either doesn't match // then the request was improperly routed here and cannot be handled. if (req.method !== 'JSONP') { throw new Error(JSONP_ERR_WRONG_METHOD); } else if (req.responseType !== 'json') { throw new Error(JSONP_ERR_WRONG_RESPONSE_TYPE); } // Everything else happens inside the Observable boundary. return new Observable(function (observer) { // The first step to make a request is to generate the callback name, and replace the // callback placeholder in the URL with the name. Care has to be taken here to ensure // a trailing &, if matched, gets inserted back into the URL in the correct place. var callback = _this.nextCallback(); var url = req.urlWithParams.replace(/=JSONP_CALLBACK(&|$)/, "=" + callback + "$1"); // Construct the <script> tag and point it at the URL. var node = _this.document.createElement('script'); node.src = url; // A JSONP request requires waiting for multiple callbacks. These variables // are closed over and track state across those callbacks. // The response object, if one has been received, or null otherwise. var body = null; // Whether the response callback has been called. var finished = false; // Whether the request has been cancelled (and thus any other callbacks) // should be ignored. var cancelled = false; // Set the response callback in this.callbackMap (which will be the window // object in the browser. The script being loaded via the <script> tag will // eventually call this callback. _this.callbackMap[callback] = function (data) { // Data has been received from the JSONP script. Firstly, delete this callback. delete _this.callbackMap[callback]; // Next, make sure the request wasn't cancelled in the meantime. if (cancelled) { return; } // Set state to indicate data was received. body = data; finished = true; }; // cleanup() is a utility closure that removes the <script> from the page and // the response callback from the window. This logic is used in both the // success, error, and cancellation paths, so it's extracted out for convenience. var cleanup = function () { // Remove the <script> tag if it's still on the page. if (node.parentNode) { node.parentNode.removeChild(node); } // Remove the response callback from the callbackMap (window object in the // browser). delete _this.callbackMap[callback]; }; // onLoad() is the success callback which runs after the response callback // if the JSONP script loads successfully. The event itself is unimportant. // If something went wrong, onLoad() may run without the response callback // having been invoked. var onLoad = function (event) { // Do nothing if the request has been cancelled. if (cancelled) { return; } // Cleanup the page. cleanup(); // Check whether the response callback has run. if (!finished) { // It hasn't, something went wrong with the request. Return an error via // the Observable error path. All JSONP errors have status 0. observer.error(new HttpErrorResponse({ url: url, status: 0, statusText: 'JSONP Error', error: new Error(JSONP_ERR_NO_CALLBACK), })); return; } // Success. body either contains the response body or null if none was // returned. observer.next(new HttpResponse({ body: body, status: 200, statusText: 'OK', url: url, })); // Complete the stream, the response is over. observer.complete(); }; // onError() is the error callback, which runs if the script returned generates // a Javascript error. It emits the error via the Observable error channel as // a HttpErrorResponse. var onError = function (error) { // If the request was already cancelled, no need to emit anything. if (cancelled) { return; } cleanup(); // Wrap the error in a HttpErrorResponse. observer.error(new HttpErrorResponse({ error: error, status: 0, statusText: 'JSONP Error', url: url, })); }; // Subscribe to both the success (load) and error events on the <script> tag, // and add it to the page. node.addEventListener('load', onLoad); node.addEventListener('error', onError); _this.document.body.appendChild(node); // The request has now been successfully sent. observer.next({ type: HttpEventType.Sent }); // Cancellation handler. return function () { // Track the cancellation so event listeners won't do anything even if already scheduled. cancelled = true; // Remove the event listeners so they won't run if the events later fire. node.removeEventListener('load', onLoad); node.removeEventListener('error', onError); // And finally, clean up the page. cleanup(); }; }); }; JsonpClientBackend = tslib_1.__decorate([ Injectable(), tslib_1.__param(1, Inject(DOCUMENT)), tslib_1.__metadata("design:paramtypes", [JsonpCallbackContext, Object]) ], JsonpClientBackend); return JsonpClientBackend; }());
var HammerGesturesPlugin = /** @class */ (function (_super) { tslib_1.__extends(HammerGesturesPlugin, _super); function HammerGesturesPlugin(doc, _config, console, loader) { var _this = _super.call(this, doc) || this; _this._config = _config; _this.console = console; _this.loader = loader; return _this; } HammerGesturesPlugin.prototype.supports = function (eventName) { if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) { return false; } if (!window.Hammer && !this.loader) { this.console.warn("The \"" + eventName + "\" event cannot be bound because Hammer.JS is not " + "loaded and no custom loader has been specified."); return false; } return true; }; HammerGesturesPlugin.prototype.addEventListener = function (element, eventName, handler) { var _this = this; var zone = this.manager.getZone(); eventName = eventName.toLowerCase(); // If Hammer is not present but a loader is specified, we defer adding the event listener // until Hammer is loaded. if (!window.Hammer && this.loader) { // This `addEventListener` method returns a function to remove the added listener. // Until Hammer is loaded, the returned function needs to *cancel* the registration rather // than remove anything. var cancelRegistration_1 = false; var deregister_1 = function () { cancelRegistration_1 = true; }; this.loader() .then(function () { // If Hammer isn't actually loaded when the custom loader resolves, give up. if (!window.Hammer) { _this.console.warn("The custom HAMMER_LOADER completed, but Hammer.JS is not present."); deregister_1 = function () { }; return; } if (!cancelRegistration_1) { // Now that Hammer is loaded and the listener is being loaded for real, // the deregistration function changes from canceling registration to removal. deregister_1 = _this.addEventListener(element, eventName, handler); } }) .catch(function () { _this.console.warn("The \"" + eventName + "\" event cannot be bound because the custom " + "Hammer.JS loader failed."); deregister_1 = function () { }; }); // Return a function that *executes* `deregister` (and not `deregister` itself) so that we // can change the behavior of `deregister` once the listener is added. Using a closure in // this way allows us to avoid any additional data structures to track listener removal. return function () { deregister_1(); }; } return zone.runOutsideAngular(function () { // Creating the manager bind events, must be done outside of angular var mc = _this._config.buildHammer(element); var callback = function (eventObj) { zone.runGuarded(function () { handler(eventObj); }); }; mc.on(eventName, callback); return function () { mc.off(eventName, callback); // destroy mc to prevent memory leak if (typeof mc.destroy === 'function') { mc.destroy(); } }; }); }; HammerGesturesPlugin.prototype.isCustomEvent = function (eventName) { return this._config.events.indexOf(eventName) > -1; }; HammerGesturesPlugin = tslib_1.__decorate([ Injectable(), tslib_1.__param(0, Inject(DOCUMENT)), tslib_1.__param(1, Inject(HAMMER_GESTURE_CONFIG)), tslib_1.__param(3, Optional()), tslib_1.__param(3, Inject(HAMMER_LOADER)), tslib_1.__metadata("design:paramtypes", [Object, HammerGestureConfig, Console, Object]) ], HammerGesturesPlugin); return HammerGesturesPlugin; }(EventManagerPlugin));
var EventManager = /** @class */ (function () { /** * Initializes an instance of the event-manager service. */ function EventManager(plugins, _zone) { var _this = this; this._zone = _zone; this._eventNameToPlugin = new Map(); plugins.forEach(function (p) { return p.manager = _this; }); this._plugins = plugins.slice().reverse(); } /** * Registers a handler for a specific element and event. * * @param element The HTML element to receive event notifications. * @param eventName The name of the event to listen for. * @param handler A function to call when the notification occurs. Receives the * event object as an argument. * @returns A callback function that can be used to remove the handler. */ EventManager.prototype.addEventListener = function (element, eventName, handler) { var plugin = this._findPluginFor(eventName); return plugin.addEventListener(element, eventName, handler); }; /** * Registers a global handler for an event in a target view. * * @param target A target for global event notifications. One of "window", "document", or "body". * @param eventName The name of the event to listen for. * @param handler A function to call when the notification occurs. Receives the * event object as an argument. * @returns A callback function that can be used to remove the handler. */ EventManager.prototype.addGlobalEventListener = function (target, eventName, handler) { var plugin = this._findPluginFor(eventName); return plugin.addGlobalEventListener(target, eventName, handler); }; /** * Retrieves the compilation zone in which event listeners are registered. */ EventManager.prototype.getZone = function () { return this._zone; }; /** @internal */ EventManager.prototype._findPluginFor = function (eventName) { var plugin = this._eventNameToPlugin.get(eventName); if (plugin) { return plugin; } var plugins = this._plugins; for (var i = 0; i < plugins.length; i++) { var plugin_1 = plugins[i]; if (plugin_1.supports(eventName)) { this._eventNameToPlugin.set(eventName, plugin_1); return plugin_1; } } throw new Error("No event manager plugin found for event " + eventName); }; EventManager = tslib_1.__decorate([ Injectable(), tslib_1.__param(0, Inject(EVENT_MANAGER_PLUGINS)), tslib_1.__metadata("design:paramtypes", [Array, NgZone]) ], EventManager); return EventManager; }());
var BrowserPlatformLocation = /** @class */ (function (_super) { tslib_1.__extends(BrowserPlatformLocation, _super); function BrowserPlatformLocation(_doc) { var _this = _super.call(this) || this; _this._doc = _doc; _this._init(); return _this; } // This is moved to its own method so that `MockPlatformLocationStrategy` can overwrite it /** @internal */ BrowserPlatformLocation.prototype._init = function () { this.location = getDOM().getLocation(); this._history = getDOM().getHistory(); }; BrowserPlatformLocation.prototype.getBaseHrefFromDOM = function () { return getDOM().getBaseHref(this._doc); }; BrowserPlatformLocation.prototype.onPopState = function (fn) { getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('popstate', fn, false); }; BrowserPlatformLocation.prototype.onHashChange = function (fn) { getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('hashchange', fn, false); }; Object.defineProperty(BrowserPlatformLocation.prototype, "pathname", { get: function () { return this.location.pathname; }, set: function (newPath) { this.location.pathname = newPath; }, enumerable: true, configurable: true }); Object.defineProperty(BrowserPlatformLocation.prototype, "search", { get: function () { return this.location.search; }, enumerable: true, configurable: true }); Object.defineProperty(BrowserPlatformLocation.prototype, "hash", { get: function () { return this.location.hash; }, enumerable: true, configurable: true }); BrowserPlatformLocation.prototype.pushState = function (state, title, url) { if (supportsState()) { this._history.pushState(state, title, url); } else { this.location.hash = url; } }; BrowserPlatformLocation.prototype.replaceState = function (state, title, url) { if (supportsState()) { this._history.replaceState(state, title, url); } else { this.location.hash = url; } }; BrowserPlatformLocation.prototype.forward = function () { this._history.forward(); }; BrowserPlatformLocation.prototype.back = function () { this._history.back(); }; BrowserPlatformLocation = tslib_1.__decorate([ Injectable(), tslib_1.__param(0, Inject(DOCUMENT)), tslib_1.__metadata("design:paramtypes", [Object]) ], BrowserPlatformLocation); return BrowserPlatformLocation; }(PlatformLocation));
var RouterLink = /** @class */ (function () { function RouterLink(router, route, tabIndex, renderer, el) { this.router = router; this.route = route; this.commands = []; if (tabIndex == null) { renderer.setAttribute(el.nativeElement, 'tabindex', '0'); } } Object.defineProperty(RouterLink.prototype, "routerLink", { 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. */ set: function (value) { if (isDevMode() && console && console.warn) { console.warn('preserveQueryParams is deprecated!, use queryParamsHandling instead.'); } this.preserve = value; }, enumerable: true, configurable: true }); RouterLink.prototype.onClick = function () { var extras = { skipLocationChange: attrBoolValue(this.skipLocationChange), replaceUrl: attrBoolValue(this.replaceUrl), }; this.router.navigateByUrl(this.urlTree, extras); return true; }; Object.defineProperty(RouterLink.prototype, "urlTree", { 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 }); tslib_1.__decorate([ Input(), tslib_1.__metadata("design:type", Object) ], RouterLink.prototype, "queryParams", void 0); tslib_1.__decorate([ Input(), tslib_1.__metadata("design:type", String) ], RouterLink.prototype, "fragment", void 0); tslib_1.__decorate([ Input(), tslib_1.__metadata("design:type", String) ], RouterLink.prototype, "queryParamsHandling", void 0); tslib_1.__decorate([ Input(), tslib_1.__metadata("design:type", Boolean) ], RouterLink.prototype, "preserveFragment", void 0); tslib_1.__decorate([ Input(), tslib_1.__metadata("design:type", Boolean) ], RouterLink.prototype, "skipLocationChange", void 0); tslib_1.__decorate([ Input(), tslib_1.__metadata("design:type", Boolean) ], RouterLink.prototype, "replaceUrl", void 0); tslib_1.__decorate([ Input(), tslib_1.__metadata("design:type", Object), tslib_1.__metadata("design:paramtypes", [Object]) ], RouterLink.prototype, "routerLink", null); tslib_1.__decorate([ Input(), tslib_1.__metadata("design:type", Boolean), tslib_1.__metadata("design:paramtypes", [Boolean]) ], RouterLink.prototype, "preserveQueryParams", null); tslib_1.__decorate([ HostListener('click'), tslib_1.__metadata("design:type", Function), tslib_1.__metadata("design:paramtypes", []), tslib_1.__metadata("design:returntype", Boolean) ], RouterLink.prototype, "onClick", null); RouterLink = tslib_1.__decorate([ Directive({ selector: ':not(a)[routerLink]' }), tslib_1.__param(2, Attribute('tabindex')), tslib_1.__metadata("design:paramtypes", [Router, ActivatedRoute, String, Renderer2, ElementRef]) ], RouterLink); return RouterLink; }());
var Meta = /** @class */ (function () { function Meta(_doc) { this._doc = _doc; this._dom = getDOM(); } Meta.prototype.addTag = function (tag, forceCreation) { if (forceCreation === void 0) { forceCreation = false; } if (!tag) return null; return this._getOrCreateElement(tag, forceCreation); }; Meta.prototype.addTags = function (tags, forceCreation) { var _this = this; if (forceCreation === void 0) { forceCreation = false; } if (!tags) return []; return tags.reduce(function (result, tag) { if (tag) { result.push(_this._getOrCreateElement(tag, forceCreation)); } return result; }, []); }; Meta.prototype.getTag = function (attrSelector) { if (!attrSelector) return null; return this._dom.querySelector(this._doc, "meta[" + attrSelector + "]") || null; }; Meta.prototype.getTags = function (attrSelector) { if (!attrSelector) return []; var list /*NodeList*/ = this._dom.querySelectorAll(this._doc, "meta[" + attrSelector + "]"); return list ? [].slice.call(list) : []; }; Meta.prototype.updateTag = function (tag, selector) { if (!tag) return null; selector = selector || this._parseSelector(tag); var meta = this.getTag(selector); if (meta) { return this._setMetaElementAttributes(tag, meta); } return this._getOrCreateElement(tag, true); }; Meta.prototype.removeTag = function (attrSelector) { this.removeTagElement(this.getTag(attrSelector)); }; Meta.prototype.removeTagElement = function (meta) { if (meta) { this._dom.remove(meta); } }; Meta.prototype._getOrCreateElement = function (meta, forceCreation) { if (forceCreation === void 0) { forceCreation = false; } if (!forceCreation) { var selector = this._parseSelector(meta); var elem = this.getTag(selector); // It's allowed to have multiple elements with the same name so it's not enough to // just check that element with the same name already present on the page. We also need to // check if element has tag attributes if (elem && this._containsAttributes(meta, elem)) return elem; } var element = this._dom.createElement('meta'); this._setMetaElementAttributes(meta, element); var head = this._dom.getElementsByTagName(this._doc, 'head')[0]; this._dom.appendChild(head, element); return element; }; Meta.prototype._setMetaElementAttributes = function (tag, el) { var _this = this; Object.keys(tag).forEach(function (prop) { return _this._dom.setAttribute(el, prop, tag[prop]); }); return el; }; Meta.prototype._parseSelector = function (tag) { var attr = tag.name ? 'name' : 'property'; return attr + "=\"" + tag[attr] + "\""; }; Meta.prototype._containsAttributes = function (tag, elem) { var _this = this; return Object.keys(tag).every(function (key) { return _this._dom.getAttribute(elem, key) === tag[key]; }); }; Meta.ngInjectableDef = i0.ɵɵdefineInjectable({ factory: createMeta, token: Meta, providedIn: "root" }); Meta = tslib_1.__decorate([ Injectable({ providedIn: 'root', useFactory: createMeta, deps: [] }), tslib_1.__param(0, Inject(DOCUMENT)), tslib_1.__metadata("design:paramtypes", [Object]) ], Meta); return Meta; }());
var FormArrayName = /** @class */ (function (_super) { tslib_1.__extends(FormArrayName, _super); function FormArrayName(parent, validators, asyncValidators) { var _this = _super.call(this) || this; _this._parent = parent; _this._validators = validators; _this._asyncValidators = asyncValidators; return _this; } /** * @description * A lifecycle method called when the directive's inputs are initialized. For internal use only. * * @throws If the directive does not have a valid parent. */ FormArrayName.prototype.ngOnInit = function () { this._checkParentType(); this.formDirective.addFormArray(this); }; /** * @description * A lifecycle method called before the directive's instance is destroyed. For internal use only. */ FormArrayName.prototype.ngOnDestroy = function () { if (this.formDirective) { this.formDirective.removeFormArray(this); } }; Object.defineProperty(FormArrayName.prototype, "control", { /** * @description * The `FormArray` bound to this directive. */ get: function () { return this.formDirective.getFormArray(this); }, enumerable: true, configurable: true }); Object.defineProperty(FormArrayName.prototype, "formDirective", { /** * @description * The top-level directive for this group if present, otherwise null. */ get: function () { return this._parent ? this._parent.formDirective : null; }, enumerable: true, configurable: true }); Object.defineProperty(FormArrayName.prototype, "path", { /** * @description * Returns an array that represents the path from the top-level form to this control. * Each index is the string name of the control on that level. */ get: function () { return controlPath(this.name, this._parent); }, enumerable: true, configurable: true }); Object.defineProperty(FormArrayName.prototype, "validator", { /** * @description * Synchronous validator function composed of all the synchronous validators registered with this * directive. */ get: function () { return composeValidators(this._validators); }, enumerable: true, configurable: true }); Object.defineProperty(FormArrayName.prototype, "asyncValidator", { /** * @description * Async validator function composed of all the async validators registered with this directive. */ get: function () { return composeAsyncValidators(this._asyncValidators); }, enumerable: true, configurable: true }); FormArrayName.prototype._checkParentType = function () { if (_hasInvalidParent(this._parent)) { ReactiveErrors.arrayParentException(); } }; tslib_1.__decorate([ Input('formArrayName'), tslib_1.__metadata("design:type", String) ], FormArrayName.prototype, "name", void 0); FormArrayName = tslib_1.__decorate([ Directive({ selector: '[formArrayName]', providers: [formArrayNameProvider] }), tslib_1.__param(0, Optional()), tslib_1.__param(0, Host()), tslib_1.__param(0, SkipSelf()), tslib_1.__param(1, Optional()), tslib_1.__param(1, Self()), tslib_1.__param(1, Inject(NG_VALIDATORS)), tslib_1.__param(2, Optional()), tslib_1.__param(2, Self()), tslib_1.__param(2, Inject(NG_ASYNC_VALIDATORS)), tslib_1.__metadata("design:paramtypes", [ControlContainer, Array, Array]) ], FormArrayName); return FormArrayName; }(ControlContainer));
var DomEventsPlugin = /** @class */ (function (_super) { tslib_1.__extends(DomEventsPlugin, _super); function DomEventsPlugin(doc, ngZone, platformId) { var _this = _super.call(this, doc) || this; _this.ngZone = ngZone; if (!platformId || !isPlatformServer(platformId)) { _this.patchEvent(); } return _this; } DomEventsPlugin.prototype.patchEvent = function () { if (typeof Event === 'undefined' || !Event || !Event.prototype) { return; } if (Event.prototype[stopMethodSymbol]) { // already patched by zone.js return; } var delegate = Event.prototype[stopMethodSymbol] = Event.prototype.stopImmediatePropagation; Event.prototype.stopImmediatePropagation = function () { if (this) { this[stopSymbol] = true; } // should call native delegate in case // in some environment part of the application // will not use the patched Event delegate && delegate.apply(this, arguments); }; }; // This plugin should come last in the list of plugins, because it accepts all // events. DomEventsPlugin.prototype.supports = function (eventName) { return true; }; DomEventsPlugin.prototype.addEventListener = function (element, eventName, handler) { var _this = this; /** * This code is about to add a listener to the DOM. If Zone.js is present, than * `addEventListener` has been patched. The patched code adds overhead in both * memory and speed (3x slower) than native. For this reason if we detect that * Zone.js is present we use a simple version of zone aware addEventListener instead. * The result is faster registration and the zone will be restored. * But ZoneSpec.onScheduleTask, ZoneSpec.onInvokeTask, ZoneSpec.onCancelTask * will not be invoked * We also do manual zone restoration in element.ts renderEventHandlerClosure method. * * NOTE: it is possible that the element is from different iframe, and so we * have to check before we execute the method. */ var self = this; var zoneJsLoaded = element[ADD_EVENT_LISTENER]; var callback = handler; // if zonejs is loaded and current zone is not ngZone // we keep Zone.current on target for later restoration. if (zoneJsLoaded && (!NgZone.isInAngularZone() || isBlackListedEvent(eventName))) { var symbolName = symbolNames[eventName]; if (!symbolName) { symbolName = symbolNames[eventName] = __symbol__(ANGULAR + eventName + FALSE); } var taskDatas = element[symbolName]; var globalListenerRegistered = taskDatas && taskDatas.length > 0; if (!taskDatas) { taskDatas = element[symbolName] = []; } var zone = isBlackListedEvent(eventName) ? Zone.root : Zone.current; if (taskDatas.length === 0) { taskDatas.push({ zone: zone, handler: callback }); } else { var callbackRegistered = false; for (var i = 0; i < taskDatas.length; i++) { if (taskDatas[i].handler === callback) { callbackRegistered = true; break; } } if (!callbackRegistered) { taskDatas.push({ zone: zone, handler: callback }); } } if (!globalListenerRegistered) { element[ADD_EVENT_LISTENER](eventName, globalListener, false); } } else { element[NATIVE_ADD_LISTENER](eventName, callback, false); } return function () { return _this.removeEventListener(element, eventName, callback); }; }; DomEventsPlugin.prototype.removeEventListener = function (target, eventName, callback) { var underlyingRemove = target[REMOVE_EVENT_LISTENER]; // zone.js not loaded, use native removeEventListener if (!underlyingRemove) { return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]); } var symbolName = symbolNames[eventName]; var taskDatas = symbolName && target[symbolName]; if (!taskDatas) { // addEventListener not using patched version // just call native removeEventListener return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]); } // fix issue 20532, should be able to remove // listener which was added inside of ngZone var found = false; for (var i = 0; i < taskDatas.length; i++) { // remove listener from taskDatas if the callback equals if (taskDatas[i].handler === callback) { found = true; taskDatas.splice(i, 1); break; } } if (found) { if (taskDatas.length === 0) { // all listeners are removed, we can remove the globalListener from target underlyingRemove.apply(target, [eventName, globalListener, false]); } } else { // not found in taskDatas, the callback may be added inside of ngZone // use native remove listener to remove the callback target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]); } }; DomEventsPlugin = tslib_1.__decorate([ Injectable(), tslib_1.__param(0, Inject(DOCUMENT)), tslib_1.__param(2, Optional()), tslib_1.__param(2, Inject(PLATFORM_ID)), tslib_1.__metadata("design:paramtypes", [Object, NgZone, Object]) ], DomEventsPlugin); return DomEventsPlugin; }(EventManagerPlugin));
var NgModel = /** @class */ (function (_super) { tslib_1.__extends(NgModel, _super); function NgModel(parent, validators, asyncValidators, valueAccessors) { var _this = _super.call(this) || this; _this.control = new FormControl(); /** @internal */ _this._registered = false; /** * @description * Event emitter for producing the `ngModelChange` event after * the view model updates. */ _this.update = new EventEmitter(); _this._parent = parent; _this._rawValidators = validators || []; _this._rawAsyncValidators = asyncValidators || []; _this.valueAccessor = selectValueAccessor(_this, valueAccessors); return _this; } /** * @description * A lifecycle method called when the directive's inputs change. For internal use * only. * * @param changes A object of key/value pairs for the set of changed inputs. */ NgModel.prototype.ngOnChanges = function (changes) { this._checkForErrors(); if (!this._registered) this._setUpControl(); if ('isDisabled' in changes) { this._updateDisabled(changes); } if (isPropertyUpdated(changes, this.viewModel)) { this._updateValue(this.model); this.viewModel = this.model; } }; /** * @description * Lifecycle method called before the directive's instance is destroyed. For internal * use only. */ NgModel.prototype.ngOnDestroy = function () { this.formDirective && this.formDirective.removeControl(this); }; Object.defineProperty(NgModel.prototype, "path", { /** * @description * Returns an array that represents the path from the top-level form to this control. * Each index is the string name of the control on that level. */ get: function () { return this._parent ? controlPath(this.name, this._parent) : [this.name]; }, enumerable: true, configurable: true }); Object.defineProperty(NgModel.prototype, "formDirective", { /** * @description * The top-level directive for this control if present, otherwise null. */ get: function () { return this._parent ? this._parent.formDirective : null; }, enumerable: true, configurable: true }); Object.defineProperty(NgModel.prototype, "validator", { /** * @description * Synchronous validator function composed of all the synchronous validators * registered with this directive. */ get: function () { return composeValidators(this._rawValidators); }, enumerable: true, configurable: true }); Object.defineProperty(NgModel.prototype, "asyncValidator", { /** * @description * Async validator function composed of all the async validators registered with this * directive. */ get: function () { return composeAsyncValidators(this._rawAsyncValidators); }, enumerable: true, configurable: true }); /** * @description * Sets the new value for the view model and emits an `ngModelChange` event. * * @param newValue The new value emitted by `ngModelChange`. */ NgModel.prototype.viewToModelUpdate = function (newValue) { this.viewModel = newValue; this.update.emit(newValue); }; NgModel.prototype._setUpControl = function () { this._setUpdateStrategy(); this._isStandalone() ? this._setUpStandalone() : this.formDirective.addControl(this); this._registered = true; }; NgModel.prototype._setUpdateStrategy = function () { if (this.options && this.options.updateOn != null) { this.control._updateOn = this.options.updateOn; } }; NgModel.prototype._isStandalone = function () { return !this._parent || !!(this.options && this.options.standalone); }; NgModel.prototype._setUpStandalone = function () { setUpControl(this.control, this); this.control.updateValueAndValidity({ emitEvent: false }); }; NgModel.prototype._checkForErrors = function () { if (!this._isStandalone()) { this._checkParentType(); } this._checkName(); }; NgModel.prototype._checkParentType = function () { if (!(this._parent instanceof NgModelGroup) && this._parent instanceof AbstractFormGroupDirective) { TemplateDrivenErrors.formGroupNameException(); } else if (!(this._parent instanceof NgModelGroup) && !(this._parent instanceof NgForm)) { TemplateDrivenErrors.modelParentException(); } }; NgModel.prototype._checkName = function () { if (this.options && this.options.name) this.name = this.options.name; if (!this._isStandalone() && !this.name) { TemplateDrivenErrors.missingNameException(); } }; NgModel.prototype._updateValue = function (value) { var _this = this; resolvedPromise.then(function () { _this.control.setValue(value, { emitViewToModelChange: false }); }); }; NgModel.prototype._updateDisabled = function (changes) { var _this = this; var disabledValue = changes['isDisabled'].currentValue; var isDisabled = disabledValue === '' || (disabledValue && disabledValue !== 'false'); resolvedPromise.then(function () { if (isDisabled && !_this.control.disabled) { _this.control.disable(); } else if (!isDisabled && _this.control.disabled) { _this.control.enable(); } }); }; tslib_1.__decorate([ Input(), tslib_1.__metadata("design:type", String) ], NgModel.prototype, "name", void 0); tslib_1.__decorate([ Input('disabled'), tslib_1.__metadata("design:type", Boolean) ], NgModel.prototype, "isDisabled", void 0); tslib_1.__decorate([ Input('ngModel'), tslib_1.__metadata("design:type", Object) ], NgModel.prototype, "model", void 0); tslib_1.__decorate([ Input('ngModelOptions'), tslib_1.__metadata("design:type", Object) ], NgModel.prototype, "options", void 0); tslib_1.__decorate([ Output('ngModelChange'), tslib_1.__metadata("design:type", Object) ], NgModel.prototype, "update", void 0); NgModel = tslib_1.__decorate([ Directive({ selector: '[ngModel]:not([formControlName]):not([formControl])', providers: [formControlBinding], exportAs: 'ngModel' }), tslib_1.__param(0, Optional()), tslib_1.__param(0, Host()), tslib_1.__param(1, Optional()), tslib_1.__param(1, Self()), tslib_1.__param(1, Inject(NG_VALIDATORS)), tslib_1.__param(2, Optional()), tslib_1.__param(2, Self()), tslib_1.__param(2, Inject(NG_ASYNC_VALIDATORS)), tslib_1.__param(3, Optional()), tslib_1.__param(3, Self()), tslib_1.__param(3, Inject(NG_VALUE_ACCESSOR)), tslib_1.__metadata("design:paramtypes", [ControlContainer, Array, Array, Array]) ], NgModel); return NgModel; }(NgControl));
var NgSelectOption = /** @class */ (function () { function NgSelectOption(_element, _renderer, _select) { this._element = _element; this._renderer = _renderer; this._select = _select; if (this._select) this.id = this._select._registerOption(); } Object.defineProperty(NgSelectOption.prototype, "ngValue", { /** * @description * Tracks the value bound to the option element. Unlike the value binding, * ngValue supports binding to objects. */ set: function (value) { if (this._select == null) return; this._select._optionMap.set(this.id, value); this._setElementValue(_buildValueString(this.id, value)); this._select.writeValue(this._select.value); }, enumerable: true, configurable: true }); Object.defineProperty(NgSelectOption.prototype, "value", { /** * @description * Tracks simple string values bound to the option element. * For objects, use the `ngValue` input binding. */ set: function (value) { this._setElementValue(value); if (this._select) this._select.writeValue(this._select.value); }, enumerable: true, configurable: true }); /** @internal */ NgSelectOption.prototype._setElementValue = function (value) { this._renderer.setProperty(this._element.nativeElement, 'value', value); }; /** * @description * Lifecycle method called before the directive's instance is destroyed. For internal use only. */ NgSelectOption.prototype.ngOnDestroy = function () { if (this._select) { this._select._optionMap.delete(this.id); this._select.writeValue(this._select.value); } }; tslib_1.__decorate([ Input('ngValue'), tslib_1.__metadata("design:type", Object), tslib_1.__metadata("design:paramtypes", [Object]) ], NgSelectOption.prototype, "ngValue", null); tslib_1.__decorate([ Input('value'), tslib_1.__metadata("design:type", Object), tslib_1.__metadata("design:paramtypes", [Object]) ], NgSelectOption.prototype, "value", null); NgSelectOption = tslib_1.__decorate([ Directive({ selector: 'option' }), tslib_1.__param(2, Optional()), tslib_1.__param(2, Host()), tslib_1.__metadata("design:paramtypes", [ElementRef, Renderer2, SelectControlValueAccessor]) ], NgSelectOption); return NgSelectOption; }());
var FormArrayName = /** @class */ (function (_super) { tslib_1.__extends(FormArrayName, _super); function FormArrayName(parent, validators, asyncValidators) { var _this = _super.call(this) || this; _this._parent = parent; _this._validators = validators; _this._asyncValidators = asyncValidators; return _this; } FormArrayName.prototype.ngOnInit = function () { this._checkParentType(); this.formDirective.addFormArray(this); }; FormArrayName.prototype.ngOnDestroy = function () { if (this.formDirective) { this.formDirective.removeFormArray(this); } }; Object.defineProperty(FormArrayName.prototype, "control", { get: function () { return this.formDirective.getFormArray(this); }, enumerable: true, configurable: true }); Object.defineProperty(FormArrayName.prototype, "formDirective", { get: function () { return this._parent ? this._parent.formDirective : null; }, enumerable: true, configurable: true }); Object.defineProperty(FormArrayName.prototype, "path", { get: function () { return controlPath(this.name, this._parent); }, enumerable: true, configurable: true }); Object.defineProperty(FormArrayName.prototype, "validator", { get: function () { return composeValidators(this._validators); }, enumerable: true, configurable: true }); Object.defineProperty(FormArrayName.prototype, "asyncValidator", { get: function () { return composeAsyncValidators(this._asyncValidators); }, enumerable: true, configurable: true }); FormArrayName.prototype._checkParentType = function () { if (_hasInvalidParent(this._parent)) { ReactiveErrors.arrayParentException(); } }; tslib_1.__decorate([ Input('formArrayName'), tslib_1.__metadata("design:type", String) ], FormArrayName.prototype, "name", void 0); FormArrayName = tslib_1.__decorate([ Directive({ selector: '[formArrayName]', providers: [formArrayNameProvider] }), tslib_1.__param(0, Optional()), tslib_1.__param(0, Host()), tslib_1.__param(0, SkipSelf()), tslib_1.__param(1, Optional()), tslib_1.__param(1, Self()), tslib_1.__param(1, Inject(NG_VALIDATORS)), tslib_1.__param(2, Optional()), tslib_1.__param(2, Self()), tslib_1.__param(2, Inject(NG_ASYNC_VALIDATORS)), tslib_1.__metadata("design:paramtypes", [ControlContainer, Array, Array]) ], FormArrayName); return FormArrayName; }(ControlContainer));