webpackJsonp([4],{ /***/ "./node_modules/@angular/common/@angular/common.es5.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/@angular/core.es5.js"); /* unused harmony export NgLocaleLocalization */ /* unused harmony export NgLocalization */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CommonModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return NgClass; }); /* unused harmony export NgFor */ /* unused harmony export NgForOf */ /* unused harmony export NgForOfContext */ /* unused harmony export NgIf */ /* unused harmony export NgIfContext */ /* unused harmony export NgPlural */ /* unused harmony export NgPluralCase */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return NgStyle; }); /* unused harmony export NgSwitch */ /* unused harmony export NgSwitchCase */ /* unused harmony export NgSwitchDefault */ /* unused harmony export NgTemplateOutlet */ /* unused harmony export NgComponentOutlet */ /* unused harmony export AsyncPipe */ /* unused harmony export DatePipe */ /* unused harmony export I18nPluralPipe */ /* unused harmony export I18nSelectPipe */ /* unused harmony export JsonPipe */ /* unused harmony export LowerCasePipe */ /* unused harmony export CurrencyPipe */ /* unused harmony export DecimalPipe */ /* unused harmony export PercentPipe */ /* unused harmony export SlicePipe */ /* unused harmony export UpperCasePipe */ /* unused harmony export TitleCasePipe */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return PLATFORM_BROWSER_ID; }); /* unused harmony export ɵPLATFORM_SERVER_ID */ /* unused harmony export ɵPLATFORM_WORKER_APP_ID */ /* unused harmony export ɵPLATFORM_WORKER_UI_ID */ /* unused harmony export isPlatformBrowser */ /* unused harmony export isPlatformServer */ /* unused harmony export isPlatformWorkerApp */ /* unused harmony export isPlatformWorkerUi */ /* unused harmony export VERSION */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return PlatformLocation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return LOCATION_INITIALIZED; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return LocationStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return APP_BASE_HREF; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return HashLocationStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return PathLocationStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return Location; }); /* unused harmony export ɵa */ /* unused harmony export ɵb */ 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.3 * (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 */ /** * This class should not be used directly by an application developer. Instead, use * {\@link Location}. * * `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform * agnostic. * This means that we can have different implementation of `PlatformLocation` for the different * platforms that angular supports. For example, `\@angular/platform-browser` provides an * implementation specific to the browser environment, while `\@angular/platform-webworker` provides * one suitable for use with web workers. * * The `PlatformLocation` class is used directly by all implementations of {\@link LocationStrategy} * when they need to interact with the DOM apis like pushState, popState, etc... * * {\@link LocationStrategy} in turn is used by the {\@link Location} service which is used directly * by the {\@link Router} in order to navigate between routes. Since all interactions between {\@link * Router} / * {\@link Location} / {\@link LocationStrategy} and DOM apis flow through the `PlatformLocation` * class they are all platform independent. * * \@stable * @abstract */ var PlatformLocation = (function () { function PlatformLocation() { } /** * @abstract * @return {?} */ PlatformLocation.prototype.getBaseHrefFromDOM = function () { }; /** * @abstract * @param {?} fn * @return {?} */ PlatformLocation.prototype.onPopState = function (fn) { }; /** * @abstract * @param {?} fn * @return {?} */ PlatformLocation.prototype.onHashChange = function (fn) { }; /** * @abstract * @return {?} */ PlatformLocation.prototype.pathname = function () { }; /** * @abstract * @return {?} */ PlatformLocation.prototype.search = function () { }; /** * @abstract * @return {?} */ PlatformLocation.prototype.hash = function () { }; /** * @abstract * @param {?} state * @param {?} title * @param {?} url * @return {?} */ PlatformLocation.prototype.replaceState = function (state, title, url) { }; /** * @abstract * @param {?} state * @param {?} title * @param {?} url * @return {?} */ PlatformLocation.prototype.pushState = function (state, title, url) { }; /** * @abstract * @return {?} */ PlatformLocation.prototype.forward = function () { }; /** * @abstract * @return {?} */ PlatformLocation.prototype.back = function () { }; return PlatformLocation; }()); /** * \@whatItDoes indicates when a location is initialized * \@experimental */ var LOCATION_INITIALIZED = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["h" /* InjectionToken */]('Location Initialized'); /** * @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 */ /** * `LocationStrategy` is responsible for representing and reading route state * from the browser's URL. Angular provides two strategies: * {\@link HashLocationStrategy} and {\@link PathLocationStrategy}. * * This is used under the hood of the {\@link Location} service. * * Applications should use the {\@link Router} or {\@link Location} services to * interact with application route state. * * For instance, {\@link HashLocationStrategy} produces URLs like * `http://example.com#/foo`, and {\@link PathLocationStrategy} produces * `http://example.com/foo` as an equivalent URL. * * See these two classes for more. * * \@stable * @abstract */ var LocationStrategy = (function () { function LocationStrategy() { } /** * @abstract * @param {?=} includeHash * @return {?} */ LocationStrategy.prototype.path = function (includeHash) { }; /** * @abstract * @param {?} internal * @return {?} */ LocationStrategy.prototype.prepareExternalUrl = function (internal) { }; /** * @abstract * @param {?} state * @param {?} title * @param {?} url * @param {?} queryParams * @return {?} */ LocationStrategy.prototype.pushState = function (state, title, url, queryParams) { }; /** * @abstract * @param {?} state * @param {?} title * @param {?} url * @param {?} queryParams * @return {?} */ LocationStrategy.prototype.replaceState = function (state, title, url, queryParams) { }; /** * @abstract * @return {?} */ LocationStrategy.prototype.forward = function () { }; /** * @abstract * @return {?} */ LocationStrategy.prototype.back = function () { }; /** * @abstract * @param {?} fn * @return {?} */ LocationStrategy.prototype.onPopState = function (fn) { }; /** * @abstract * @return {?} */ LocationStrategy.prototype.getBaseHref = function () { }; return LocationStrategy; }()); /** * The `APP_BASE_HREF` token represents the base href to be used with the * {\@link PathLocationStrategy}. * * If you're using {\@link PathLocationStrategy}, you must provide a provider to a string * representing the URL prefix that should be preserved when generating and recognizing * URLs. * * ### Example * * ```typescript * import {Component, NgModule} from '\@angular/core'; * import {APP_BASE_HREF} from '\@angular/common'; * * \@NgModule({ * providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}] * }) * class AppModule {} * ``` * * \@stable */ var APP_BASE_HREF = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["h" /* InjectionToken */]('appBaseHref'); /** * @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 `Location` is a service that applications can use to interact with a browser's URL. * \@description * Depending on which {\@link LocationStrategy} is used, `Location` will either persist * to the URL's path or the URL's hash segment. * * Note: it's better to use {\@link Router#navigate} service to trigger route changes. Use * `Location` only if you need to interact with or create normalized URLs outside of * routing. * * `Location` is responsible for normalizing the URL against the application's base href. * A normalized URL is absolute from the URL host, includes the application's base href, and has no * trailing slash: * - `/my/app/user/123` is normalized * - `my/app/user/123` **is not** normalized * - `/my/app/user/123/` **is not** normalized * * ### Example * {\@example common/location/ts/path_location_component.ts region='LocationComponent'} * \@stable */ var Location = (function () { /** * @param {?} platformStrategy */ function Location(platformStrategy) { var _this = this; /** * \@internal */ this._subject = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["H" /* EventEmitter */](); this._platformStrategy = platformStrategy; var browserBaseHref = this._platformStrategy.getBaseHref(); this._baseHref = Location.stripTrailingSlash(_stripIndexHtml(browserBaseHref)); this._platformStrategy.onPopState(function (ev) { _this._subject.emit({ 'url': _this.path(true), 'pop': true, 'type': ev.type, }); }); } /** * @param {?=} includeHash * @return {?} */ Location.prototype.path = function (includeHash) { if (includeHash === void 0) { includeHash = false; } return this.normalize(this._platformStrategy.path(includeHash)); }; /** * Normalizes the given path and compares to the current normalized path. * @param {?} path * @param {?=} query * @return {?} */ Location.prototype.isCurrentPathEqualTo = function (path, query) { if (query === void 0) { query = ''; } return this.path() == this.normalize(path + Location.normalizeQueryParams(query)); }; /** * Given a string representing a URL, returns the normalized URL path without leading or * trailing slashes. * @param {?} url * @return {?} */ Location.prototype.normalize = function (url) { return Location.stripTrailingSlash(_stripBaseHref(this._baseHref, _stripIndexHtml(url))); }; /** * Given a string representing a URL, returns the platform-specific external URL path. * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one * before normalizing. This method will also add a hash if `HashLocationStrategy` is * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use. * @param {?} url * @return {?} */ Location.prototype.prepareExternalUrl = function (url) { if (url && url[0] !== '/') { url = '/' + url; } return this._platformStrategy.prepareExternalUrl(url); }; /** * Changes the browsers URL to the normalized version of the given URL, and pushes a * new item onto the platform's history. * @param {?} path * @param {?=} query * @return {?} */ Location.prototype.go = function (path, query) { if (query === void 0) { query = ''; } this._platformStrategy.pushState(null, '', path, query); }; /** * Changes the browsers URL to the normalized version of the given URL, and replaces * the top item on the platform's history stack. * @param {?} path * @param {?=} query * @return {?} */ Location.prototype.replaceState = function (path, query) { if (query === void 0) { query = ''; } this._platformStrategy.replaceState(null, '', path, query); }; /** * Navigates forward in the platform's history. * @return {?} */ Location.prototype.forward = function () { this._platformStrategy.forward(); }; /** * Navigates back in the platform's history. * @return {?} */ Location.prototype.back = function () { this._platformStrategy.back(); }; /** * Subscribe to the platform's `popState` events. * @param {?} onNext * @param {?=} onThrow * @param {?=} onReturn * @return {?} */ Location.prototype.subscribe = function (onNext, onThrow, onReturn) { return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn }); }; /** * Given a string of url parameters, prepend with '?' if needed, otherwise return parameters as * is. * @param {?} params * @return {?} */ Location.normalizeQueryParams = function (params) { return params && params[0] !== '?' ? '?' + params : params; }; /** * Given 2 parts of a url, join them with a slash if needed. * @param {?} start * @param {?} end * @return {?} */ Location.joinWithSlash = function (start, end) { if (start.length == 0) { return end; } if (end.length == 0) { return start; } var /** @type {?} */ slashes = 0; if (start.endsWith('/')) { slashes++; } if (end.startsWith('/')) { slashes++; } if (slashes == 2) { return start + end.substring(1); } if (slashes == 1) { return start + end; } return start + '/' + end; }; /** * If url has a trailing slash, remove it, otherwise return url as is. * @param {?} url * @return {?} */ Location.stripTrailingSlash = function (url) { return url.replace(/\/$/, ''); }; return Location; }()); Location.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["d" /* Injectable */] }, ]; /** * @nocollapse */ Location.ctorParameters = function () { return [ { type: LocationStrategy, }, ]; }; /** * @param {?} baseHref * @param {?} url * @return {?} */ function _stripBaseHref(baseHref, url) { return baseHref && url.startsWith(baseHref) ? url.substring(baseHref.length) : url; } /** * @param {?} url * @return {?} */ function _stripIndexHtml(url) { return url.replace(/\/index.html$/, ''); } /** * @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 Use URL hash for storing application location data. * \@description * `HashLocationStrategy` is a {\@link LocationStrategy} used to configure the * {\@link Location} service to represent its state in the * [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) * of the browser's URL. * * For instance, if you call `location.go('/foo')`, the browser's URL will become * `example.com#/foo`. * * ### Example * * {\@example common/location/ts/hash_location_component.ts region='LocationComponent'} * * \@stable */ var HashLocationStrategy = (function (_super) { __extends(HashLocationStrategy, _super); /** * @param {?} _platformLocation * @param {?=} _baseHref */ function HashLocationStrategy(_platformLocation, _baseHref) { var _this = _super.call(this) || this; _this._platformLocation = _platformLocation; _this._baseHref = ''; if (_baseHref != null) { _this._baseHref = _baseHref; } return _this; } /** * @param {?} fn * @return {?} */ HashLocationStrategy.prototype.onPopState = function (fn) { this._platformLocation.onPopState(fn); this._platformLocation.onHashChange(fn); }; /** * @return {?} */ HashLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; }; /** * @param {?=} includeHash * @return {?} */ HashLocationStrategy.prototype.path = function (includeHash) { if (includeHash === void 0) { includeHash = false; } // the hash value is always prefixed with a `#` // and if it is empty then it will stay empty var /** @type {?} */ path = this._platformLocation.hash; if (path == null) path = '#'; return path.length > 0 ? path.substring(1) : path; }; /** * @param {?} internal * @return {?} */ HashLocationStrategy.prototype.prepareExternalUrl = function (internal) { var /** @type {?} */ url = Location.joinWithSlash(this._baseHref, internal); return url.length > 0 ? ('#' + url) : url; }; /** * @param {?} state * @param {?} title * @param {?} path * @param {?} queryParams * @return {?} */ HashLocationStrategy.prototype.pushState = function (state, title, path, queryParams) { var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams)); if (url.length == 0) { url = this._platformLocation.pathname; } this._platformLocation.pushState(state, title, url); }; /** * @param {?} state * @param {?} title * @param {?} path * @param {?} queryParams * @return {?} */ HashLocationStrategy.prototype.replaceState = function (state, title, path, queryParams) { var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams)); if (url.length == 0) { url = this._platformLocation.pathname; } this._platformLocation.replaceState(state, title, url); }; /** * @return {?} */ HashLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); }; /** * @return {?} */ HashLocationStrategy.prototype.back = function () { this._platformLocation.back(); }; return HashLocationStrategy; }(LocationStrategy)); HashLocationStrategy.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["d" /* Injectable */] }, ]; /** * @nocollapse */ HashLocationStrategy.ctorParameters = function () { return [ { type: PlatformLocation, }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* Inject */], args: [APP_BASE_HREF,] },] }, ]; }; /** * @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 Use URL for storing application location data. * \@description * `PathLocationStrategy` is a {\@link LocationStrategy} used to configure the * {\@link Location} service to represent its state in the * [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the * browser's URL. * * If you're using `PathLocationStrategy`, you must provide a {\@link APP_BASE_HREF} * or add a base element to the document. This URL prefix that will be preserved * when generating and recognizing URLs. * * For instance, if you provide an `APP_BASE_HREF` of `'/my/app'` and call * `location.go('/foo')`, the browser's URL will become * `example.com/my/app/foo`. * * Similarly, if you add `` to the document and call * `location.go('/foo')`, the browser's URL will become * `example.com/my/app/foo`. * * ### Example * * {\@example common/location/ts/path_location_component.ts region='LocationComponent'} * * \@stable */ var PathLocationStrategy = (function (_super) { __extends(PathLocationStrategy, _super); /** * @param {?} _platformLocation * @param {?=} href */ 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; } /** * @param {?} fn * @return {?} */ PathLocationStrategy.prototype.onPopState = function (fn) { this._platformLocation.onPopState(fn); this._platformLocation.onHashChange(fn); }; /** * @return {?} */ PathLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; }; /** * @param {?} internal * @return {?} */ PathLocationStrategy.prototype.prepareExternalUrl = function (internal) { return Location.joinWithSlash(this._baseHref, internal); }; /** * @param {?=} includeHash * @return {?} */ PathLocationStrategy.prototype.path = function (includeHash) { if (includeHash === void 0) { includeHash = false; } var /** @type {?} */ pathname = this._platformLocation.pathname + Location.normalizeQueryParams(this._platformLocation.search); var /** @type {?} */ hash = this._platformLocation.hash; return hash && includeHash ? "" + pathname + hash : pathname; }; /** * @param {?} state * @param {?} title * @param {?} url * @param {?} queryParams * @return {?} */ PathLocationStrategy.prototype.pushState = function (state, title, url, queryParams) { var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams)); this._platformLocation.pushState(state, title, externalUrl); }; /** * @param {?} state * @param {?} title * @param {?} url * @param {?} queryParams * @return {?} */ PathLocationStrategy.prototype.replaceState = function (state, title, url, queryParams) { var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams)); this._platformLocation.replaceState(state, title, externalUrl); }; /** * @return {?} */ PathLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); }; /** * @return {?} */ PathLocationStrategy.prototype.back = function () { this._platformLocation.back(); }; return PathLocationStrategy; }(LocationStrategy)); PathLocationStrategy.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["d" /* Injectable */] }, ]; /** * @nocollapse */ PathLocationStrategy.ctorParameters = function () { return [ { type: PlatformLocation, }, { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["q" /* Optional */] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* Inject */], args: [APP_BASE_HREF,] },] }, ]; }; /** * @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 * @abstract */ var NgLocalization = (function () { function NgLocalization() { } /** * @abstract * @param {?} value * @return {?} */ NgLocalization.prototype.getPluralCategory = function (value) { }; return NgLocalization; }()); /** * Returns the plural category for a given value. * - "=value" when the case exists, * - the plural category otherwise * * \@internal * @param {?} value * @param {?} cases * @param {?} ngLocalization * @return {?} */ function getPluralCategory(value, cases, ngLocalization) { var /** @type {?} */ key = "=" + value; if (cases.indexOf(key) > -1) { return key; } key = ngLocalization.getPluralCategory(value); if (cases.indexOf(key) > -1) { return key; } if (cases.indexOf('other') > -1) { return 'other'; } throw new Error("No plural message found for value \"" + value + "\""); } /** * Returns the plural case based on the locale * * \@experimental */ var NgLocaleLocalization = (function (_super) { __extends(NgLocaleLocalization, _super); /** * @param {?} locale */ function NgLocaleLocalization(locale) { var _this = _super.call(this) || this; _this.locale = locale; return _this; } /** * @param {?} value * @return {?} */ NgLocaleLocalization.prototype.getPluralCategory = function (value) { var /** @type {?} */ plural = getPluralCase(this.locale, value); switch (plural) { case Plural.Zero: return 'zero'; case Plural.One: return 'one'; case Plural.Two: return 'two'; case Plural.Few: return 'few'; case Plural.Many: return 'many'; default: return 'other'; } }; return NgLocaleLocalization; }(NgLocalization)); NgLocaleLocalization.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["d" /* Injectable */] }, ]; /** * @nocollapse */ NgLocaleLocalization.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["I" /* LOCALE_ID */],] },] }, ]; }; var Plural = {}; Plural.Zero = 0; Plural.One = 1; Plural.Two = 2; Plural.Few = 3; Plural.Many = 4; Plural.Other = 5; Plural[Plural.Zero] = "Zero"; Plural[Plural.One] = "One"; Plural[Plural.Two] = "Two"; Plural[Plural.Few] = "Few"; Plural[Plural.Many] = "Many"; Plural[Plural.Other] = "Other"; /** * Returns the plural case based on the locale * * \@experimental * @param {?} locale * @param {?} nLike * @return {?} */ function getPluralCase(locale, nLike) { // TODO(vicb): lazy compute if (typeof nLike === 'string') { nLike = parseInt(/** @type {?} */ (nLike), 10); } var /** @type {?} */ n = (nLike); var /** @type {?} */ nDecimal = n.toString().replace(/^[^.]*\.?/, ''); var /** @type {?} */ i = Math.floor(Math.abs(n)); var /** @type {?} */ v = nDecimal.length; var /** @type {?} */ f = parseInt(nDecimal, 10); var /** @type {?} */ t = parseInt(n.toString().replace(/^[^.]*\.?|0+$/g, ''), 10) || 0; var /** @type {?} */ lang = locale.split('-')[0].toLowerCase(); switch (lang) { case 'af': case 'asa': case 'az': case 'bem': case 'bez': case 'bg': case 'brx': case 'ce': case 'cgg': case 'chr': case 'ckb': case 'ee': case 'el': case 'eo': case 'es': case 'eu': case 'fo': case 'fur': case 'gsw': case 'ha': case 'haw': case 'hu': case 'jgo': case 'jmc': case 'ka': case 'kk': case 'kkj': case 'kl': case 'ks': case 'ksb': case 'ky': case 'lb': case 'lg': case 'mas': case 'mgo': case 'ml': case 'mn': case 'nb': case 'nd': case 'ne': case 'nn': case 'nnh': case 'nyn': case 'om': case 'or': case 'os': case 'ps': case 'rm': case 'rof': case 'rwk': case 'saq': case 'seh': case 'sn': case 'so': case 'sq': case 'ta': case 'te': case 'teo': case 'tk': case 'tr': case 'ug': case 'uz': case 'vo': case 'vun': case 'wae': case 'xog': if (n === 1) return Plural.One; return Plural.Other; case 'agq': case 'bas': case 'cu': case 'dav': case 'dje': case 'dua': case 'dyo': case 'ebu': case 'ewo': case 'guz': case 'kam': case 'khq': case 'ki': case 'kln': case 'kok': case 'ksf': case 'lrc': case 'lu': case 'luo': case 'luy': case 'mer': case 'mfe': case 'mgh': case 'mua': case 'mzn': case 'nmg': case 'nus': case 'qu': case 'rn': case 'rw': case 'sbp': case 'twq': case 'vai': case 'yav': case 'yue': case 'zgh': case 'ak': case 'ln': case 'mg': case 'pa': case 'ti': if (n === Math.floor(n) && n >= 0 && n <= 1) return Plural.One; return Plural.Other; case 'am': case 'as': case 'bn': case 'fa': case 'gu': case 'hi': case 'kn': case 'mr': case 'zu': if (i === 0 || n === 1) return Plural.One; return Plural.Other; case 'ar': if (n === 0) return Plural.Zero; if (n === 1) return Plural.One; if (n === 2) return Plural.Two; if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10) return Plural.Few; if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99) return Plural.Many; return Plural.Other; case 'ast': case 'ca': case 'de': case 'en': case 'et': case 'fi': case 'fy': case 'gl': case 'it': case 'nl': case 'sv': case 'sw': case 'ur': case 'yi': if (i === 1 && v === 0) return Plural.One; return Plural.Other; case 'be': if (n % 10 === 1 && !(n % 100 === 11)) return Plural.One; if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 4 && !(n % 100 >= 12 && n % 100 <= 14)) return Plural.Few; if (n % 10 === 0 || n % 10 === Math.floor(n % 10) && n % 10 >= 5 && n % 10 <= 9 || n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 14) return Plural.Many; return Plural.Other; case 'br': if (n % 10 === 1 && !(n % 100 === 11 || n % 100 === 71 || n % 100 === 91)) return Plural.One; if (n % 10 === 2 && !(n % 100 === 12 || n % 100 === 72 || n % 100 === 92)) return Plural.Two; if (n % 10 === Math.floor(n % 10) && (n % 10 >= 3 && n % 10 <= 4 || n % 10 === 9) && !(n % 100 >= 10 && n % 100 <= 19 || n % 100 >= 70 && n % 100 <= 79 || n % 100 >= 90 && n % 100 <= 99)) return Plural.Few; if (!(n === 0) && n % 1e6 === 0) return Plural.Many; return Plural.Other; case 'bs': case 'hr': case 'sr': if (v === 0 && i % 10 === 1 && !(i % 100 === 11) || f % 10 === 1 && !(f % 100 === 11)) return Plural.One; if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 && !(i % 100 >= 12 && i % 100 <= 14) || f % 10 === Math.floor(f % 10) && f % 10 >= 2 && f % 10 <= 4 && !(f % 100 >= 12 && f % 100 <= 14)) return Plural.Few; return Plural.Other; case 'cs': case 'sk': if (i === 1 && v === 0) return Plural.One; if (i === Math.floor(i) && i >= 2 && i <= 4 && v === 0) return Plural.Few; if (!(v === 0)) return Plural.Many; return Plural.Other; case 'cy': if (n === 0) return Plural.Zero; if (n === 1) return Plural.One; if (n === 2) return Plural.Two; if (n === 3) return Plural.Few; if (n === 6) return Plural.Many; return Plural.Other; case 'da': if (n === 1 || !(t === 0) && (i === 0 || i === 1)) return Plural.One; return Plural.Other; case 'dsb': case 'hsb': if (v === 0 && i % 100 === 1 || f % 100 === 1) return Plural.One; if (v === 0 && i % 100 === 2 || f % 100 === 2) return Plural.Two; if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || f % 100 === Math.floor(f % 100) && f % 100 >= 3 && f % 100 <= 4) return Plural.Few; return Plural.Other; case 'ff': case 'fr': case 'hy': case 'kab': if (i === 0 || i === 1) return Plural.One; return Plural.Other; case 'fil': if (v === 0 && (i === 1 || i === 2 || i === 3) || v === 0 && !(i % 10 === 4 || i % 10 === 6 || i % 10 === 9) || !(v === 0) && !(f % 10 === 4 || f % 10 === 6 || f % 10 === 9)) return Plural.One; return Plural.Other; case 'ga': if (n === 1) return Plural.One; if (n === 2) return Plural.Two; if (n === Math.floor(n) && n >= 3 && n <= 6) return Plural.Few; if (n === Math.floor(n) && n >= 7 && n <= 10) return Plural.Many; return Plural.Other; case 'gd': if (n === 1 || n === 11) return Plural.One; if (n === 2 || n === 12) return Plural.Two; if (n === Math.floor(n) && (n >= 3 && n <= 10 || n >= 13 && n <= 19)) return Plural.Few; return Plural.Other; case 'gv': if (v === 0 && i % 10 === 1) return Plural.One; if (v === 0 && i % 10 === 2) return Plural.Two; if (v === 0 && (i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80)) return Plural.Few; if (!(v === 0)) return Plural.Many; return Plural.Other; case 'he': if (i === 1 && v === 0) return Plural.One; if (i === 2 && v === 0) return Plural.Two; if (v === 0 && !(n >= 0 && n <= 10) && n % 10 === 0) return Plural.Many; return Plural.Other; case 'is': if (t === 0 && i % 10 === 1 && !(i % 100 === 11) || !(t === 0)) return Plural.One; return Plural.Other; case 'ksh': if (n === 0) return Plural.Zero; if (n === 1) return Plural.One; return Plural.Other; case 'kw': case 'naq': case 'se': case 'smn': if (n === 1) return Plural.One; if (n === 2) return Plural.Two; return Plural.Other; case 'lag': if (n === 0) return Plural.Zero; if ((i === 0 || i === 1) && !(n === 0)) return Plural.One; return Plural.Other; case 'lt': if (n % 10 === 1 && !(n % 100 >= 11 && n % 100 <= 19)) return Plural.One; if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 9 && !(n % 100 >= 11 && n % 100 <= 19)) return Plural.Few; if (!(f === 0)) return Plural.Many; return Plural.Other; case 'lv': case 'prg': if (n % 10 === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19 || v === 2 && f % 100 === Math.floor(f % 100) && f % 100 >= 11 && f % 100 <= 19) return Plural.Zero; if (n % 10 === 1 && !(n % 100 === 11) || v === 2 && f % 10 === 1 && !(f % 100 === 11) || !(v === 2) && f % 10 === 1) return Plural.One; return Plural.Other; case 'mk': if (v === 0 && i % 10 === 1 || f % 10 === 1) return Plural.One; return Plural.Other; case 'mt': if (n === 1) return Plural.One; if (n === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 2 && n % 100 <= 10) return Plural.Few; if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19) return Plural.Many; return Plural.Other; case 'pl': if (i === 1 && v === 0) return Plural.One; if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 && !(i % 100 >= 12 && i % 100 <= 14)) return Plural.Few; if (v === 0 && !(i === 1) && i % 10 === Math.floor(i % 10) && i % 10 >= 0 && i % 10 <= 1 || v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 || v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 12 && i % 100 <= 14) return Plural.Many; return Plural.Other; case 'pt': if (n === Math.floor(n) && n >= 0 && n <= 2 && !(n === 2)) return Plural.One; return Plural.Other; case 'ro': if (i === 1 && v === 0) return Plural.One; if (!(v === 0) || n === 0 || !(n === 1) && n % 100 === Math.floor(n % 100) && n % 100 >= 1 && n % 100 <= 19) return Plural.Few; return Plural.Other; case 'ru': case 'uk': if (v === 0 && i % 10 === 1 && !(i % 100 === 11)) return Plural.One; if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 && !(i % 100 >= 12 && i % 100 <= 14)) return Plural.Few; if (v === 0 && i % 10 === 0 || v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 || v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 11 && i % 100 <= 14) return Plural.Many; return Plural.Other; case 'shi': if (i === 0 || n === 1) return Plural.One; if (n === Math.floor(n) && n >= 2 && n <= 10) return Plural.Few; return Plural.Other; case 'si': if (n === 0 || n === 1 || i === 0 && f === 1) return Plural.One; return Plural.Other; case 'sl': if (v === 0 && i % 100 === 1) return Plural.One; if (v === 0 && i % 100 === 2) return Plural.Two; if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || !(v === 0)) return Plural.Few; return Plural.Other; case 'tzm': if (n === Math.floor(n) && n >= 0 && n <= 1 || n === Math.floor(n) && n >= 11 && n <= 99) return Plural.One; return Plural.Other; default: return Plural.Other; } } /** * @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 */ /** * \@ngModule CommonModule * * \@whatItDoes Adds and removes CSS classes on an HTML element. * * \@howToUse * ``` * ... * * ... * * ... * * ... * * ... * ``` * * \@description * * The CSS classes are updated as follows, depending on the type of the expression evaluation: * - `string` - the CSS classes listed in the string (space delimited) are added, * - `Array` - the CSS classes declared as Array elements are added, * - `Object` - keys are CSS classes that get added when the expression given in the value * evaluates to a truthy value, otherwise they are removed. * * \@stable */ var NgClass = (function () { /** * @param {?} _iterableDiffers * @param {?} _keyValueDiffers * @param {?} _ngEl * @param {?} _renderer */ function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) { this._iterableDiffers = _iterableDiffers; this._keyValueDiffers = _keyValueDiffers; this._ngEl = _ngEl; this._renderer = _renderer; this._initialClasses = []; } Object.defineProperty(NgClass.prototype, "klass", { /** * @param {?} v * @return {?} */ set: function (v) { this._applyInitialClasses(true); this._initialClasses = typeof v === 'string' ? v.split(/\s+/) : []; this._applyInitialClasses(false); this._applyClasses(this._rawClass, false); }, enumerable: true, configurable: true }); Object.defineProperty(NgClass.prototype, "ngClass", { /** * @param {?} v * @return {?} */ set: function (v) { this._cleanupClasses(this._rawClass); this._iterableDiffer = null; this._keyValueDiffer = null; this._rawClass = typeof v === 'string' ? v.split(/\s+/) : v; if (this._rawClass) { if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["J" /* ɵisListLikeIterable */])(this._rawClass)) { this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create(); } else { this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create(); } } }, enumerable: true, configurable: true }); /** * @return {?} */ NgClass.prototype.ngDoCheck = function () { if (this._iterableDiffer) { var /** @type {?} */ iterableChanges = this._iterableDiffer.diff(/** @type {?} */ (this._rawClass)); if (iterableChanges) { this._applyIterableChanges(iterableChanges); } } else if (this._keyValueDiffer) { var /** @type {?} */ keyValueChanges = this._keyValueDiffer.diff(/** @type {?} */ (this._rawClass)); if (keyValueChanges) { this._applyKeyValueChanges(keyValueChanges); } } }; /** * @param {?} rawClassVal * @return {?} */ NgClass.prototype._cleanupClasses = function (rawClassVal) { this._applyClasses(rawClassVal, true); this._applyInitialClasses(false); }; /** * @param {?} changes * @return {?} */ NgClass.prototype._applyKeyValueChanges = function (changes) { var _this = this; changes.forEachAddedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); }); changes.forEachChangedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); }); changes.forEachRemovedItem(function (record) { if (record.previousValue) { _this._toggleClass(record.key, false); } }); }; /** * @param {?} changes * @return {?} */ NgClass.prototype._applyIterableChanges = function (changes) { var _this = this; changes.forEachAddedItem(function (record) { if (typeof record.item === 'string') { _this._toggleClass(record.item, true); } else { throw new Error("NgClass can only toggle CSS classes expressed as strings, got " + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["K" /* ɵstringify */])(record.item)); } }); changes.forEachRemovedItem(function (record) { return _this._toggleClass(record.item, false); }); }; /** * @param {?} isCleanup * @return {?} */ NgClass.prototype._applyInitialClasses = function (isCleanup) { var _this = this; this._initialClasses.forEach(function (klass) { return _this._toggleClass(klass, !isCleanup); }); }; /** * @param {?} rawClassVal * @param {?} isCleanup * @return {?} */ NgClass.prototype._applyClasses = function (rawClassVal, isCleanup) { var _this = this; if (rawClassVal) { if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) { ((rawClassVal)).forEach(function (klass) { return _this._toggleClass(klass, !isCleanup); }); } else { Object.keys(rawClassVal).forEach(function (klass) { if (rawClassVal[klass] != null) _this._toggleClass(klass, !isCleanup); }); } } }; /** * @param {?} klass * @param {?} enabled * @return {?} */ NgClass.prototype._toggleClass = function (klass, enabled) { var _this = this; klass = klass.trim(); if (klass) { klass.split(/\s+/g).forEach(function (klass) { _this._renderer.setElementClass(_this._ngEl.nativeElement, klass, !!enabled); }); } }; return NgClass; }()); NgClass.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["L" /* Directive */], args: [{ selector: '[ngClass]' },] }, ]; /** * @nocollapse */ NgClass.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* IterableDiffers */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* KeyValueDiffers */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* ElementRef */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["P" /* Renderer */], }, ]; }; NgClass.propDecorators = { 'klass': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* Input */], args: ['class',] },], 'ngClass': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* 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 */ /** * Instantiates a single {\@link Component} type and inserts its Host View into current View. * `NgComponentOutlet` provides a declarative approach for dynamic component creation. * * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and * any existing component will get destroyed. * * ### Fine tune control * * You can control the component creation process by using the following optional attributes: * * * `ngComponentOutletInjector`: Optional custom {\@link Injector} that will be used as parent for * the Component. Defaults to the injector of the current view container. * * * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content * section of the component, if exists. * * * `ngComponentOutletNgModuleFactory`: Optional module factory to allow dynamically loading other * module, then load a component from that module. * * ### Syntax * * Simple * ``` * * ``` * * Customized injector/content * ``` * * * ``` * * Customized ngModuleFactory * ``` * * * ``` * ## Example * * {\@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'} * * A more complete example with additional options: * * {\@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'} * A more complete example with ngModuleFactory: * * {\@example common/ngComponentOutlet/ts/module.ts region='NgModuleFactoryExample'} * * \@experimental */ var NgComponentOutlet = (function () { /** * @param {?} _viewContainerRef */ function NgComponentOutlet(_viewContainerRef) { this._viewContainerRef = _viewContainerRef; this._componentRef = null; this._moduleRef = null; } /** * @param {?} changes * @return {?} */ NgComponentOutlet.prototype.ngOnChanges = function (changes) { this._viewContainerRef.clear(); this._componentRef = null; if (this.ngComponentOutlet) { var /** @type {?} */ elInjector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector; if (changes['ngComponentOutletNgModuleFactory']) { if (this._moduleRef) this._moduleRef.destroy(); if (this.ngComponentOutletNgModuleFactory) { var /** @type {?} */ parentModule = elInjector.get(__WEBPACK_IMPORTED_MODULE_0__angular_core__["R" /* NgModuleRef */]); this._moduleRef = this.ngComponentOutletNgModuleFactory.create(parentModule.injector); } else { this._moduleRef = null; } } var /** @type {?} */ componentFactoryResolver = this._moduleRef ? this._moduleRef.componentFactoryResolver : elInjector.get(__WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* ComponentFactoryResolver */]); var /** @type {?} */ componentFactory = componentFactoryResolver.resolveComponentFactory(this.ngComponentOutlet); this._componentRef = this._viewContainerRef.createComponent(componentFactory, this._viewContainerRef.length, elInjector, this.ngComponentOutletContent); } }; /** * @return {?} */ NgComponentOutlet.prototype.ngOnDestroy = function () { if (this._moduleRef) this._moduleRef.destroy(); }; return NgComponentOutlet; }()); NgComponentOutlet.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["L" /* Directive */], args: [{ selector: '[ngComponentOutlet]' },] }, ]; /** * @nocollapse */ NgComponentOutlet.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["T" /* ViewContainerRef */], }, ]; }; NgComponentOutlet.propDecorators = { 'ngComponentOutlet': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* Input */] },], 'ngComponentOutletInjector': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* Input */] },], 'ngComponentOutletContent': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* Input */] },], 'ngComponentOutletNgModuleFactory': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* 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 */ /** * \@stable */ var NgForOfContext = (function () { /** * @param {?} $implicit * @param {?} ngForOf * @param {?} index * @param {?} count */ function NgForOfContext($implicit, ngForOf, index, count) { this.$implicit = $implicit; this.ngForOf = ngForOf; this.index = index; this.count = count; } Object.defineProperty(NgForOfContext.prototype, "first", { /** * @return {?} */ get: function () { return this.index === 0; }, enumerable: true, configurable: true }); Object.defineProperty(NgForOfContext.prototype, "last", { /** * @return {?} */ get: function () { return this.index === this.count - 1; }, enumerable: true, configurable: true }); Object.defineProperty(NgForOfContext.prototype, "even", { /** * @return {?} */ get: function () { return this.index % 2 === 0; }, enumerable: true, configurable: true }); Object.defineProperty(NgForOfContext.prototype, "odd", { /** * @return {?} */ get: function () { return !this.even; }, enumerable: true, configurable: true }); return NgForOfContext; }()); /** * The `NgForOf` directive instantiates a template once per item from an iterable. The context * for each instantiated template inherits from the outer context with the given loop variable * set to the current item from the iterable. * * ### Local Variables * * `NgForOf` provides several exported values that can be aliased to local variables: * * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`). * - `ngForOf: NgIterable`: The value of the iterable expression. Useful when the expression is * more complex then a property access, for example when using the async pipe (`userStreams | * async`). * - `index: number`: The index of the current item in the iterable. * - `first: boolean`: True when the item is the first item in the iterable. * - `last: boolean`: True when the item is the last item in the iterable. * - `even: boolean`: True when the item has an even index in the iterable. * - `odd: boolean`: True when the item has an odd index in the iterable. * * ``` *
  • * {{i}}/{{users.length}}. {{user}} default *
  • * ``` * * ### Change Propagation * * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM: * * * When an item is added, a new instance of the template is added to the DOM. * * When an item is removed, its template instance is removed from the DOM. * * When items are reordered, their respective templates are reordered in the DOM. * * Otherwise, the DOM element for that item will remain the same. * * Angular uses object identity to track insertions and deletions within the iterator and reproduce * those changes in the DOM. This has important implications for animations and any stateful * controls (such as `` elements which accept user input) that are present. Inserted rows can * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state * such as user input. * * It is possible for the identities of elements in the iterator to change while the data does not. * This can happen, for example, if the iterator 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, and Angular will tear down the entire DOM and rebuild it (as if all old * elements were deleted and all new elements inserted). This is an expensive operation and should * be avoided if possible. * * To customize the default tracking algorithm, `NgForOf` supports `trackBy` option. * `trackBy` takes a function which has two arguments: `index` and `item`. * If `trackBy` is given, Angular tracks changes by the return value of the function. * * ### Syntax * * - `
  • ...
  • ` * - `
  • ...
  • ` * * With `` element: * * ``` * *
  • ...
  • *
    * ``` * * ### Example * * See a [live demo](http://plnkr.co/edit/KVuXxDp0qinGDyo307QW?p=preview) for a more detailed * example. * * \@stable */ var NgForOf = (function () { /** * @param {?} _viewContainer * @param {?} _template * @param {?} _differs */ function NgForOf(_viewContainer, _template, _differs) { this._viewContainer = _viewContainer; this._template = _template; this._differs = _differs; this._differ = null; } Object.defineProperty(NgForOf.prototype, "ngForTrackBy", { /** * @return {?} */ get: function () { return this._trackByFn; }, /** * @param {?} fn * @return {?} */ set: function (fn) { if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["u" /* isDevMode */])() && fn != null && typeof fn !== 'function') { // TODO(vicb): use a log service once there is a public one available if ((console) && (console.warn)) { console.warn("trackBy must be a function, but received " + JSON.stringify(fn) + ". " + "See https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html#!#change-propagation for more information."); } } this._trackByFn = fn; }, enumerable: true, configurable: true }); Object.defineProperty(NgForOf.prototype, "ngForTemplate", { /** * @param {?} value * @return {?} */ set: function (value) { // TODO(TS2.1): make TemplateRef>> once we move to TS v2.1 // The current type is too restrictive; a template that just uses index, for example, // should be acceptable. if (value) { this._template = value; } }, enumerable: true, configurable: true }); /** * @param {?} changes * @return {?} */ NgForOf.prototype.ngOnChanges = function (changes) { if ('ngForOf' in changes) { // React on ngForOf changes only once all inputs have been initialized var /** @type {?} */ value = changes['ngForOf'].currentValue; if (!this._differ && value) { try { this._differ = this._differs.find(value).create(this.ngForTrackBy); } catch (e) { throw new Error("Cannot find a differ supporting object '" + value + "' of type '" + getTypeNameForDebugging(value) + "'. NgFor only supports binding to Iterables such as Arrays."); } } } }; /** * @return {?} */ NgForOf.prototype.ngDoCheck = function () { if (this._differ) { var /** @type {?} */ changes = this._differ.diff(this.ngForOf); if (changes) this._applyChanges(changes); } }; /** * @param {?} changes * @return {?} */ NgForOf.prototype._applyChanges = function (changes) { var _this = this; var /** @type {?} */ insertTuples = []; changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) { if (item.previousIndex == null) { var /** @type {?} */ view = _this._viewContainer.createEmbeddedView(_this._template, new NgForOfContext(/** @type {?} */ ((null)), _this.ngForOf, -1, -1), currentIndex); var /** @type {?} */ tuple = new RecordViewTuple(item, view); insertTuples.push(tuple); } else if (currentIndex == null) { _this._viewContainer.remove(adjustedPreviousIndex); } else { var /** @type {?} */ view = ((_this._viewContainer.get(adjustedPreviousIndex))); _this._viewContainer.move(view, currentIndex); var /** @type {?} */ tuple = new RecordViewTuple(item, /** @type {?} */ (view)); insertTuples.push(tuple); } }); for (var /** @type {?} */ i = 0; i < insertTuples.length; i++) { this._perViewChange(insertTuples[i].view, insertTuples[i].record); } for (var /** @type {?} */ i = 0, /** @type {?} */ ilen = this._viewContainer.length; i < ilen; i++) { var /** @type {?} */ viewRef = (this._viewContainer.get(i)); viewRef.context.index = i; viewRef.context.count = ilen; } changes.forEachIdentityChange(function (record) { var /** @type {?} */ viewRef = (_this._viewContainer.get(record.currentIndex)); viewRef.context.$implicit = record.item; }); }; /** * @param {?} view * @param {?} record * @return {?} */ NgForOf.prototype._perViewChange = function (view, record) { view.context.$implicit = record.item; }; return NgForOf; }()); NgForOf.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["L" /* Directive */], args: [{ selector: '[ngFor][ngForOf]' },] }, ]; /** * @nocollapse */ NgForOf.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["T" /* ViewContainerRef */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["U" /* TemplateRef */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["M" /* IterableDiffers */], }, ]; }; NgForOf.propDecorators = { 'ngForOf': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* Input */] },], 'ngForTrackBy': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* Input */] },], 'ngForTemplate': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* Input */] },], }; var RecordViewTuple = (function () { /** * @param {?} record * @param {?} view */ function RecordViewTuple(record, view) { this.record = record; this.view = view; } return RecordViewTuple; }()); /** * @deprecated from v4.0.0 - Use NgForOf instead. */ var NgFor = NgForOf; /** * @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 */ /** * Conditionally includes a template based on the value of an `expression`. * * `ngIf` evaluates the `expression` and then renders the `then` or `else` template in its place * when expression is truthy or falsy respectively. Typically the: * - `then` template is the inline template of `ngIf` unless bound to a different value. * - `else` template is blank unless it is bound. * * ## Most common usage * * The most common usage of the `ngIf` directive is to conditionally show the inline template as * seen in this example: * {\@example common/ngIf/ts/module.ts region='NgIfSimple'} * * ## Showing an alternative template using `else` * * If it is necessary to display a template when the `expression` is falsy use the `else` template * binding as shown. Note that the `else` binding points to a `` labeled `#elseBlock`. * The template can be defined anywhere in the component view but is typically placed right after * `ngIf` for readability. * * {\@example common/ngIf/ts/module.ts region='NgIfElse'} * * ## Using non-inlined `then` template * * Usually the `then` template is the inlined template of the `ngIf`, but it can be changed using * a binding (just like `else`). Because `then` and `else` are bindings, the template references can * change at runtime as shown in this example. * * {\@example common/ngIf/ts/module.ts region='NgIfThenElse'} * * ## Storing conditional result in a variable * * A common pattern is that we need to show a set of properties from the same object. If the * object is undefined, then we have to use the safe-traversal-operator `?.` to guard against * dereferencing a `null` value. This is especially the case when waiting on async data such as * when using the `async` pipe as shown in folowing example: * * ``` * Hello {{ (userStream|async)?.last }}, {{ (userStream|async)?.first }}! * ``` * * There are several inefficiencies in the above example: * - We create multiple subscriptions on `userStream`. One for each `async` pipe, or two in the * example above. * - We cannot display an alternative screen while waiting for the data to arrive asynchronously. * - We have to use the safe-traversal-operator `?.` to access properties, which is cumbersome. * - We have to place the `async` pipe in parenthesis. * * A better way to do this is to use `ngIf` and store the result of the condition in a local * variable as shown in the the example below: * * {\@example common/ngIf/ts/module.ts region='NgIfAs'} * * Notice that: * - We use only one `async` pipe and hence only one subscription gets created. * - `ngIf` stores the result of the `userStream|async` in the local variable `user`. * - The local `user` can then be bound repeatedly in a more efficient way. * - No need to use the safe-traversal-operator `?.` to access properties as `ngIf` will only * display the data if `userStream` returns a value. * - We can display an alternative template while waiting for the data. * * ### Syntax * * Simple form: * - `
    ...
    ` * - `
    ...
    ` * - `
    ...
    ` * * Form with an else block: * ``` *
    ...
    * ... * ``` * * Form with a `then` and `else` block: * ``` *
    * ... * ... * ``` * * Form with storing the value locally: * ``` *
    {{value}}
    * ... * ``` * * \@stable */ var NgIf = (function () { /** * @param {?} _viewContainer * @param {?} templateRef */ function NgIf(_viewContainer, templateRef) { this._viewContainer = _viewContainer; this._context = new NgIfContext(); this._thenTemplateRef = null; this._elseTemplateRef = null; this._thenViewRef = null; this._elseViewRef = null; this._thenTemplateRef = templateRef; } Object.defineProperty(NgIf.prototype, "ngIf", { /** * @param {?} condition * @return {?} */ set: function (condition) { this._context.$implicit = this._context.ngIf = condition; this._updateView(); }, enumerable: true, configurable: true }); Object.defineProperty(NgIf.prototype, "ngIfThen", { /** * @param {?} templateRef * @return {?} */ set: function (templateRef) { this._thenTemplateRef = templateRef; this._thenViewRef = null; // clear previous view if any. this._updateView(); }, enumerable: true, configurable: true }); Object.defineProperty(NgIf.prototype, "ngIfElse", { /** * @param {?} templateRef * @return {?} */ set: function (templateRef) { this._elseTemplateRef = templateRef; this._elseViewRef = null; // clear previous view if any. this._updateView(); }, enumerable: true, configurable: true }); /** * @return {?} */ NgIf.prototype._updateView = function () { if (this._context.$implicit) { if (!this._thenViewRef) { this._viewContainer.clear(); this._elseViewRef = null; if (this._thenTemplateRef) { this._thenViewRef = this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context); } } } else { if (!this._elseViewRef) { this._viewContainer.clear(); this._thenViewRef = null; if (this._elseTemplateRef) { this._elseViewRef = this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context); } } } }; return NgIf; }()); NgIf.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["L" /* Directive */], args: [{ selector: '[ngIf]' },] }, ]; /** * @nocollapse */ NgIf.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["T" /* ViewContainerRef */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["U" /* TemplateRef */], }, ]; }; NgIf.propDecorators = { 'ngIf': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* Input */] },], 'ngIfThen': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* Input */] },], 'ngIfElse': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* Input */] },], }; /** * \@stable */ var NgIfContext = (function () { function NgIfContext() { this.$implicit = null; this.ngIf = null; } return NgIfContext; }()); /** * @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 SwitchView = (function () { /** * @param {?} _viewContainerRef * @param {?} _templateRef */ function SwitchView(_viewContainerRef, _templateRef) { this._viewContainerRef = _viewContainerRef; this._templateRef = _templateRef; this._created = false; } /** * @return {?} */ SwitchView.prototype.create = function () { this._created = true; this._viewContainerRef.createEmbeddedView(this._templateRef); }; /** * @return {?} */ SwitchView.prototype.destroy = function () { this._created = false; this._viewContainerRef.clear(); }; /** * @param {?} created * @return {?} */ SwitchView.prototype.enforceState = function (created) { if (created && !this._created) { this.create(); } else if (!created && this._created) { this.destroy(); } }; return SwitchView; }()); /** * \@ngModule CommonModule * * \@whatItDoes Adds / removes DOM sub-trees when the nest match expressions matches the switch * expression. * * \@howToUse * ``` * * ... * ... * ... * * * * * * ... * * ``` * \@description * * `NgSwitch` stamps out nested views when their match expression value matches the value of the * switch expression. * * In other words: * - you define a container element (where you place the directive with a switch expression on the * `[ngSwitch]="..."` attribute) * - you define inner views inside the `NgSwitch` and place a `*ngSwitchCase` attribute on the view * root elements. * * Elements within `NgSwitch` but outside of a `NgSwitchCase` or `NgSwitchDefault` directives will * be preserved at the location. * * The `ngSwitchCase` directive informs the parent `NgSwitch` of which view to display when the * expression is evaluated. * When no matching expression is found on a `ngSwitchCase` view, the `ngSwitchDefault` view is * stamped out. * * \@stable */ var NgSwitch = (function () { function NgSwitch() { this._defaultUsed = false; this._caseCount = 0; this._lastCaseCheckIndex = 0; this._lastCasesMatched = false; } Object.defineProperty(NgSwitch.prototype, "ngSwitch", { /** * @param {?} newValue * @return {?} */ set: function (newValue) { this._ngSwitch = newValue; if (this._caseCount === 0) { this._updateDefaultCases(true); } }, enumerable: true, configurable: true }); /** * \@internal * @return {?} */ NgSwitch.prototype._addCase = function () { return this._caseCount++; }; /** * \@internal * @param {?} view * @return {?} */ NgSwitch.prototype._addDefault = function (view) { if (!this._defaultViews) { this._defaultViews = []; } this._defaultViews.push(view); }; /** * \@internal * @param {?} value * @return {?} */ NgSwitch.prototype._matchCase = function (value) { var /** @type {?} */ matched = value == this._ngSwitch; this._lastCasesMatched = this._lastCasesMatched || matched; this._lastCaseCheckIndex++; if (this._lastCaseCheckIndex === this._caseCount) { this._updateDefaultCases(!this._lastCasesMatched); this._lastCaseCheckIndex = 0; this._lastCasesMatched = false; } return matched; }; /** * @param {?} useDefault * @return {?} */ NgSwitch.prototype._updateDefaultCases = function (useDefault) { if (this._defaultViews && useDefault !== this._defaultUsed) { this._defaultUsed = useDefault; for (var /** @type {?} */ i = 0; i < this._defaultViews.length; i++) { var /** @type {?} */ defaultView = this._defaultViews[i]; defaultView.enforceState(useDefault); } } }; return NgSwitch; }()); NgSwitch.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["L" /* Directive */], args: [{ selector: '[ngSwitch]' },] }, ]; /** * @nocollapse */ NgSwitch.ctorParameters = function () { return []; }; NgSwitch.propDecorators = { 'ngSwitch': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* Input */] },], }; /** * \@ngModule CommonModule * * \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgSwitch} when the * given expression evaluate to respectively the same/different value as the switch * expression. * * \@howToUse * ``` * * ... * * ``` * \@description * * Insert the sub-tree when the expression evaluates to the same value as the enclosing switch * expression. * * If multiple match expressions match the switch expression value, all of them are displayed. * * See {\@link NgSwitch} for more details and example. * * \@stable */ var NgSwitchCase = (function () { /** * @param {?} viewContainer * @param {?} templateRef * @param {?} ngSwitch */ function NgSwitchCase(viewContainer, templateRef, ngSwitch) { this.ngSwitch = ngSwitch; ngSwitch._addCase(); this._view = new SwitchView(viewContainer, templateRef); } /** * @return {?} */ NgSwitchCase.prototype.ngDoCheck = function () { this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase)); }; return NgSwitchCase; }()); NgSwitchCase.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["L" /* Directive */], args: [{ selector: '[ngSwitchCase]' },] }, ]; /** * @nocollapse */ NgSwitchCase.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["T" /* ViewContainerRef */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["U" /* TemplateRef */], }, { type: NgSwitch, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* Host */] },] }, ]; }; NgSwitchCase.propDecorators = { 'ngSwitchCase': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* Input */] },], }; /** * \@ngModule CommonModule * \@whatItDoes Creates a view that is added to the parent {\@link NgSwitch} when no case expressions * match the * switch expression. * * \@howToUse * ``` * * ... * ... * * ``` * * \@description * * Insert the sub-tree when no case expressions evaluate to the same value as the enclosing switch * expression. * * See {\@link NgSwitch} for more details and example. * * \@stable */ var NgSwitchDefault = (function () { /** * @param {?} viewContainer * @param {?} templateRef * @param {?} ngSwitch */ function NgSwitchDefault(viewContainer, templateRef, ngSwitch) { ngSwitch._addDefault(new SwitchView(viewContainer, templateRef)); } return NgSwitchDefault; }()); NgSwitchDefault.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["L" /* Directive */], args: [{ selector: '[ngSwitchDefault]' },] }, ]; /** * @nocollapse */ NgSwitchDefault.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["T" /* ViewContainerRef */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["U" /* TemplateRef */], }, { type: NgSwitch, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* 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 */ /** * \@ngModule CommonModule * * \@whatItDoes Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization. * * \@howToUse * ``` * * there is nothing * there is one * there are a few * * ``` * * \@description * * Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees * that match the switch expression's pluralization category. * * To use this directive you must provide a container element that sets the `[ngPlural]` attribute * to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their * expression: * - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value * matches the switch expression exactly, * - otherwise, the view will be treated as a "category match", and will only display if exact * value matches aren't found and the value maps to its category for the defined locale. * * See http://cldr.unicode.org/index/cldr-spec/plural-rules * * \@experimental */ var NgPlural = (function () { /** * @param {?} _localization */ function NgPlural(_localization) { this._localization = _localization; this._caseViews = {}; } Object.defineProperty(NgPlural.prototype, "ngPlural", { /** * @param {?} value * @return {?} */ set: function (value) { this._switchValue = value; this._updateView(); }, enumerable: true, configurable: true }); /** * @param {?} value * @param {?} switchView * @return {?} */ NgPlural.prototype.addCase = function (value, switchView) { this._caseViews[value] = switchView; }; /** * @return {?} */ NgPlural.prototype._updateView = function () { this._clearViews(); var /** @type {?} */ cases = Object.keys(this._caseViews); var /** @type {?} */ key = getPluralCategory(this._switchValue, cases, this._localization); this._activateView(this._caseViews[key]); }; /** * @return {?} */ NgPlural.prototype._clearViews = function () { if (this._activeView) this._activeView.destroy(); }; /** * @param {?} view * @return {?} */ NgPlural.prototype._activateView = function (view) { if (view) { this._activeView = view; this._activeView.create(); } }; return NgPlural; }()); NgPlural.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["L" /* Directive */], args: [{ selector: '[ngPlural]' },] }, ]; /** * @nocollapse */ NgPlural.ctorParameters = function () { return [ { type: NgLocalization, }, ]; }; NgPlural.propDecorators = { 'ngPlural': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* Input */] },], }; /** * \@ngModule CommonModule * * \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgPlural} when the * given expression matches the plural expression according to CLDR rules. * * \@howToUse * ``` * * ... * ... * * ``` * * See {\@link NgPlural} for more details and example. * * \@experimental */ var NgPluralCase = (function () { /** * @param {?} value * @param {?} template * @param {?} viewContainer * @param {?} ngPlural */ function NgPluralCase(value, template, viewContainer, ngPlural) { this.value = value; var isANumber = !isNaN(Number(value)); ngPlural.addCase(isANumber ? "=" + value : value, new SwitchView(viewContainer, template)); } return NgPluralCase; }()); NgPluralCase.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["L" /* Directive */], args: [{ selector: '[ngPluralCase]' },] }, ]; /** * @nocollapse */ NgPluralCase.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["W" /* Attribute */], args: ['ngPluralCase',] },] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["U" /* TemplateRef */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["T" /* ViewContainerRef */], }, { type: NgPlural, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["V" /* 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 */ /** * \@ngModule CommonModule * * \@whatItDoes Update an HTML element styles. * * \@howToUse * ``` * ... * * ... * * ... * ``` * * \@description * * The styles are updated according to the value of the expression evaluation: * - keys are style names with an optional `.` suffix (ie 'top.px', 'font-style.em'), * - values are the values assigned to those properties (expressed in the given unit). * * \@stable */ var NgStyle = (function () { /** * @param {?} _differs * @param {?} _ngEl * @param {?} _renderer */ function NgStyle(_differs, _ngEl, _renderer) { this._differs = _differs; this._ngEl = _ngEl; this._renderer = _renderer; } Object.defineProperty(NgStyle.prototype, "ngStyle", { /** * @param {?} v * @return {?} */ set: function (v) { this._ngStyle = v; if (!this._differ && v) { this._differ = this._differs.find(v).create(); } }, enumerable: true, configurable: true }); /** * @return {?} */ NgStyle.prototype.ngDoCheck = function () { if (this._differ) { var /** @type {?} */ changes = this._differ.diff(this._ngStyle); if (changes) { this._applyChanges(changes); } } }; /** * @param {?} changes * @return {?} */ NgStyle.prototype._applyChanges = function (changes) { var _this = this; changes.forEachRemovedItem(function (record) { return _this._setStyle(record.key, null); }); changes.forEachAddedItem(function (record) { return _this._setStyle(record.key, record.currentValue); }); changes.forEachChangedItem(function (record) { return _this._setStyle(record.key, record.currentValue); }); }; /** * @param {?} nameAndUnit * @param {?} value * @return {?} */ NgStyle.prototype._setStyle = function (nameAndUnit, value) { var _a = nameAndUnit.split('.'), name = _a[0], unit = _a[1]; value = value != null && unit ? "" + value + unit : value; this._renderer.setElementStyle(this._ngEl.nativeElement, name, /** @type {?} */ (value)); }; return NgStyle; }()); NgStyle.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["L" /* Directive */], args: [{ selector: '[ngStyle]' },] }, ]; /** * @nocollapse */ NgStyle.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["N" /* KeyValueDiffers */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* ElementRef */], }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["P" /* Renderer */], }, ]; }; NgStyle.propDecorators = { 'ngStyle': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* 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 */ /** * \@ngModule CommonModule * * \@whatItDoes Inserts an embedded view from a prepared `TemplateRef` * * \@howToUse * ``` * * ``` * * \@description * * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`. * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding * by the local template `let` declarations. * * Note: using the key `$implicit` in the context object will set it's value as default. * * ## Example * * {\@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'} * * \@experimental */ var NgTemplateOutlet = (function () { /** * @param {?} _viewContainerRef */ function NgTemplateOutlet(_viewContainerRef) { this._viewContainerRef = _viewContainerRef; } Object.defineProperty(NgTemplateOutlet.prototype, "ngOutletContext", { /** * @deprecated v4.0.0 - Renamed to ngTemplateOutletContext. * @param {?} context * @return {?} */ set: function (context) { this.ngTemplateOutletContext = context; }, enumerable: true, configurable: true }); /** * @param {?} changes * @return {?} */ NgTemplateOutlet.prototype.ngOnChanges = function (changes) { if (this._viewRef) { this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._viewRef)); } if (this.ngTemplateOutlet) { this._viewRef = this._viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, this.ngTemplateOutletContext); } }; return NgTemplateOutlet; }()); NgTemplateOutlet.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["L" /* Directive */], args: [{ selector: '[ngTemplateOutlet]' },] }, ]; /** * @nocollapse */ NgTemplateOutlet.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["T" /* ViewContainerRef */], }, ]; }; NgTemplateOutlet.propDecorators = { 'ngTemplateOutletContext': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* Input */] },], 'ngTemplateOutlet': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* Input */] },], 'ngOutletContext': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Q" /* 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 */ /** * A collection of Angular directives that are likely to be used in each and every Angular * application. */ var COMMON_DIRECTIVES = [ NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase, ]; /** * A collection of deprecated directives that are no longer part of the core module. */ /** * @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 {?} type * @param {?} value * @return {?} */ function invalidPipeArgumentError(type, value) { return Error("InvalidPipeArgument: '" + value + "' for pipe '" + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["K" /* ɵstringify */])(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 ObservableStrategy = (function () { function ObservableStrategy() { } /** * @param {?} async * @param {?} updateLatestValue * @return {?} */ ObservableStrategy.prototype.createSubscription = function (async, updateLatestValue) { return async.subscribe({ next: updateLatestValue, error: function (e) { throw e; } }); }; /** * @param {?} subscription * @return {?} */ ObservableStrategy.prototype.dispose = function (subscription) { subscription.unsubscribe(); }; /** * @param {?} subscription * @return {?} */ ObservableStrategy.prototype.onDestroy = function (subscription) { subscription.unsubscribe(); }; return ObservableStrategy; }()); var PromiseStrategy = (function () { function PromiseStrategy() { } /** * @param {?} async * @param {?} updateLatestValue * @return {?} */ PromiseStrategy.prototype.createSubscription = function (async, updateLatestValue) { return async.then(updateLatestValue, function (e) { throw e; }); }; /** * @param {?} subscription * @return {?} */ PromiseStrategy.prototype.dispose = function (subscription) { }; /** * @param {?} subscription * @return {?} */ PromiseStrategy.prototype.onDestroy = function (subscription) { }; return PromiseStrategy; }()); var _promiseStrategy = new PromiseStrategy(); var _observableStrategy = new ObservableStrategy(); /** * \@ngModule CommonModule * \@whatItDoes Unwraps a value from an asynchronous primitive. * \@howToUse `observable_or_promise_expression | async` * \@description * The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has * emitted. When a new value is emitted, the `async` pipe marks the component to be checked for * changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid * potential memory leaks. * * * ## Examples * * This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the * promise. * * {\@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'} * * It's also possible to use `async` with Observables. The example below binds the `time` Observable * to the view. The Observable continuously updates the view with the current time. * * {\@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'} * * \@stable */ var AsyncPipe = (function () { /** * @param {?} _ref */ function AsyncPipe(_ref) { this._ref = _ref; this._latestValue = null; this._latestReturnedValue = null; this._subscription = null; this._obj = null; this._strategy = ((null)); } /** * @return {?} */ AsyncPipe.prototype.ngOnDestroy = function () { if (this._subscription) { this._dispose(); } }; /** * @param {?} obj * @return {?} */ AsyncPipe.prototype.transform = function (obj) { if (!this._obj) { if (obj) { this._subscribe(obj); } this._latestReturnedValue = this._latestValue; return this._latestValue; } if (obj !== this._obj) { this._dispose(); return this.transform(/** @type {?} */ (obj)); } if (this._latestValue === this._latestReturnedValue) { return this._latestReturnedValue; } this._latestReturnedValue = this._latestValue; return __WEBPACK_IMPORTED_MODULE_0__angular_core__["X" /* WrappedValue */].wrap(this._latestValue); }; /** * @param {?} obj * @return {?} */ AsyncPipe.prototype._subscribe = function (obj) { var _this = this; this._obj = obj; this._strategy = this._selectStrategy(obj); this._subscription = this._strategy.createSubscription(obj, function (value) { return _this._updateLatestValue(obj, value); }); }; /** * @param {?} obj * @return {?} */ AsyncPipe.prototype._selectStrategy = function (obj) { if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Y" /* ɵisPromise */])(obj)) { return _promiseStrategy; } if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["Z" /* ɵisObservable */])(obj)) { return _observableStrategy; } throw invalidPipeArgumentError(AsyncPipe, obj); }; /** * @return {?} */ AsyncPipe.prototype._dispose = function () { this._strategy.dispose(/** @type {?} */ ((this._subscription))); this._latestValue = null; this._latestReturnedValue = null; this._subscription = null; this._obj = null; }; /** * @param {?} async * @param {?} value * @return {?} */ AsyncPipe.prototype._updateLatestValue = function (async, value) { if (async === this._obj) { this._latestValue = value; this._ref.markForCheck(); } }; return AsyncPipe; }()); AsyncPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_0" /* Pipe */], args: [{ name: 'async', pure: false },] }, ]; /** * @nocollapse */ AsyncPipe.ctorParameters = function () { return [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_1" /* 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 */ /** * Transforms text to lowercase. * * {\@example common/pipes/ts/lowerupper_pipe.ts region='LowerUpperPipe' } * * \@stable */ var LowerCasePipe = (function () { function LowerCasePipe() { } /** * @param {?} value * @return {?} */ LowerCasePipe.prototype.transform = function (value) { if (!value) return value; if (typeof value !== 'string') { throw invalidPipeArgumentError(LowerCasePipe, value); } return value.toLowerCase(); }; return LowerCasePipe; }()); LowerCasePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_0" /* Pipe */], args: [{ name: 'lowercase' },] }, ]; /** * @nocollapse */ LowerCasePipe.ctorParameters = function () { return []; }; /** * Helper method to transform a single word to titlecase. * * \@stable * @param {?} word * @return {?} */ function titleCaseWord(word) { if (!word) return word; return word[0].toUpperCase() + word.substr(1).toLowerCase(); } /** * Transforms text to titlecase. * * \@stable */ var TitleCasePipe = (function () { function TitleCasePipe() { } /** * @param {?} value * @return {?} */ TitleCasePipe.prototype.transform = function (value) { if (!value) return value; if (typeof value !== 'string') { throw invalidPipeArgumentError(TitleCasePipe, value); } return value.split(/\b/g).map(function (word) { return titleCaseWord(word); }).join(''); }; return TitleCasePipe; }()); TitleCasePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_0" /* Pipe */], args: [{ name: 'titlecase' },] }, ]; /** * @nocollapse */ TitleCasePipe.ctorParameters = function () { return []; }; /** * Transforms text to uppercase. * * \@stable */ var UpperCasePipe = (function () { function UpperCasePipe() { } /** * @param {?} value * @return {?} */ UpperCasePipe.prototype.transform = function (value) { if (!value) return value; if (typeof value !== 'string') { throw invalidPipeArgumentError(UpperCasePipe, value); } return value.toUpperCase(); }; return UpperCasePipe; }()); UpperCasePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_0" /* Pipe */], args: [{ name: 'uppercase' },] }, ]; /** * @nocollapse */ UpperCasePipe.ctorParameters = function () { return []; }; var NumberFormatStyle = {}; NumberFormatStyle.Decimal = 0; NumberFormatStyle.Percent = 1; NumberFormatStyle.Currency = 2; NumberFormatStyle[NumberFormatStyle.Decimal] = "Decimal"; NumberFormatStyle[NumberFormatStyle.Percent] = "Percent"; NumberFormatStyle[NumberFormatStyle.Currency] = "Currency"; var NumberFormatter = (function () { function NumberFormatter() { } /** * @param {?} num * @param {?} locale * @param {?} style * @param {?=} __3 * @return {?} */ NumberFormatter.format = function (num, locale, style, _a) { var _b = _a === void 0 ? {} : _a, minimumIntegerDigits = _b.minimumIntegerDigits, minimumFractionDigits = _b.minimumFractionDigits, maximumFractionDigits = _b.maximumFractionDigits, currency = _b.currency, _c = _b.currencyAsSymbol, currencyAsSymbol = _c === void 0 ? false : _c; var /** @type {?} */ options = { minimumIntegerDigits: minimumIntegerDigits, minimumFractionDigits: minimumFractionDigits, maximumFractionDigits: maximumFractionDigits, style: NumberFormatStyle[style].toLowerCase() }; if (style == NumberFormatStyle.Currency) { options.currency = typeof currency == 'string' ? currency : undefined; options.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code'; } return new Intl.NumberFormat(locale, options).format(num); }; return NumberFormatter; }()); var DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsazZEwGjJ']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|J+|j+|m+|s+|a|z|Z|G+|w+))(.*)/; var PATTERN_ALIASES = { // Keys are quoted so they do not get renamed during closure compilation. 'yMMMdjms': datePartGetterFactory(combine([ digitCondition('year', 1), nameCondition('month', 3), digitCondition('day', 1), digitCondition('hour', 1), digitCondition('minute', 1), digitCondition('second', 1), ])), 'yMdjm': datePartGetterFactory(combine([ digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1), digitCondition('hour', 1), digitCondition('minute', 1) ])), 'yMMMMEEEEd': datePartGetterFactory(combine([ digitCondition('year', 1), nameCondition('month', 4), nameCondition('weekday', 4), digitCondition('day', 1) ])), 'yMMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 4), digitCondition('day', 1)])), 'yMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 3), digitCondition('day', 1)])), 'yMd': datePartGetterFactory(combine([digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1)])), 'jms': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('second', 1), digitCondition('minute', 1)])), 'jm': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('minute', 1)])) }; var DATE_FORMATS = { // Keys are quoted so they do not get renamed. 'yyyy': datePartGetterFactory(digitCondition('year', 4)), 'yy': datePartGetterFactory(digitCondition('year', 2)), 'y': datePartGetterFactory(digitCondition('year', 1)), 'MMMM': datePartGetterFactory(nameCondition('month', 4)), 'MMM': datePartGetterFactory(nameCondition('month', 3)), 'MM': datePartGetterFactory(digitCondition('month', 2)), 'M': datePartGetterFactory(digitCondition('month', 1)), 'LLLL': datePartGetterFactory(nameCondition('month', 4)), 'L': datePartGetterFactory(nameCondition('month', 1)), 'dd': datePartGetterFactory(digitCondition('day', 2)), 'd': datePartGetterFactory(digitCondition('day', 1)), 'HH': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), false)))), 'H': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), false))), 'hh': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), true)))), 'h': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))), 'jj': datePartGetterFactory(digitCondition('hour', 2)), 'j': datePartGetterFactory(digitCondition('hour', 1)), 'mm': digitModifier(datePartGetterFactory(digitCondition('minute', 2))), 'm': datePartGetterFactory(digitCondition('minute', 1)), 'ss': digitModifier(datePartGetterFactory(digitCondition('second', 2))), 's': datePartGetterFactory(digitCondition('second', 1)), // while ISO 8601 requires fractions to be prefixed with `.` or `,` // we can be just safely rely on using `sss` since we currently don't support single or two digit // fractions 'sss': datePartGetterFactory(digitCondition('second', 3)), 'EEEE': datePartGetterFactory(nameCondition('weekday', 4)), 'EEE': datePartGetterFactory(nameCondition('weekday', 3)), 'EE': datePartGetterFactory(nameCondition('weekday', 2)), 'E': datePartGetterFactory(nameCondition('weekday', 1)), 'a': hourClockExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))), 'Z': timeZoneGetter('short'), 'z': timeZoneGetter('long'), 'ww': datePartGetterFactory({}), // first Thursday of the year. not support ? 'w': datePartGetterFactory({}), // of the year not support ? 'G': datePartGetterFactory(nameCondition('era', 1)), 'GG': datePartGetterFactory(nameCondition('era', 2)), 'GGG': datePartGetterFactory(nameCondition('era', 3)), 'GGGG': datePartGetterFactory(nameCondition('era', 4)) }; /** * @param {?} inner * @return {?} */ function digitModifier(inner) { return function (date, locale) { var /** @type {?} */ result = inner(date, locale); return result.length == 1 ? '0' + result : result; }; } /** * @param {?} inner * @return {?} */ function hourClockExtractor(inner) { return function (date, locale) { return inner(date, locale).split(' ')[1]; }; } /** * @param {?} inner * @return {?} */ function hourExtractor(inner) { return function (date, locale) { return inner(date, locale).split(' ')[0]; }; } /** * @param {?} date * @param {?} locale * @param {?} options * @return {?} */ function intlDateFormat(date, locale, options) { return new Intl.DateTimeFormat(locale, options).format(date).replace(/[\u200e\u200f]/g, ''); } /** * @param {?} timezone * @return {?} */ function timeZoneGetter(timezone) { // To workaround `Intl` API restriction for single timezone let format with 24 hours var /** @type {?} */ options = { hour: '2-digit', hour12: false, timeZoneName: timezone }; return function (date, locale) { var /** @type {?} */ result = intlDateFormat(date, locale, options); // Then extract first 3 letters that related to hours return result ? result.substring(3) : ''; }; } /** * @param {?} options * @param {?} value * @return {?} */ function hour12Modify(options, value) { options.hour12 = value; return options; } /** * @param {?} prop * @param {?} len * @return {?} */ function digitCondition(prop, len) { var /** @type {?} */ result = {}; result[prop] = len === 2 ? '2-digit' : 'numeric'; return result; } /** * @param {?} prop * @param {?} len * @return {?} */ function nameCondition(prop, len) { var /** @type {?} */ result = {}; if (len < 4) { result[prop] = len > 1 ? 'short' : 'narrow'; } else { result[prop] = 'long'; } return result; } /** * @param {?} options * @return {?} */ function combine(options) { return ((Object)).assign.apply(((Object)), [{}].concat(options)); } /** * @param {?} ret * @return {?} */ function datePartGetterFactory(ret) { return function (date, locale) { return intlDateFormat(date, locale, ret); }; } var DATE_FORMATTER_CACHE = new Map(); /** * @param {?} format * @param {?} date * @param {?} locale * @return {?} */ function dateFormatter(format, date, locale) { var /** @type {?} */ fn = PATTERN_ALIASES[format]; if (fn) return fn(date, locale); var /** @type {?} */ cacheKey = format; var /** @type {?} */ parts = DATE_FORMATTER_CACHE.get(cacheKey); if (!parts) { parts = []; var /** @type {?} */ match = void 0; DATE_FORMATS_SPLIT.exec(format); var /** @type {?} */ _format = format; while (_format) { match = DATE_FORMATS_SPLIT.exec(_format); if (match) { parts = parts.concat(match.slice(1)); _format = ((parts.pop())); } else { parts.push(_format); _format = null; } } DATE_FORMATTER_CACHE.set(cacheKey, parts); } return parts.reduce(function (text, part) { var /** @type {?} */ fn = DATE_FORMATS[part]; return text + (fn ? fn(date, locale) : partToTime(part)); }, ''); } /** * @param {?} part * @return {?} */ function partToTime(part) { return part === '\'\'' ? '\'' : part.replace(/(^'|'$)/g, '').replace(/''/g, '\''); } var DateFormatter = (function () { function DateFormatter() { } /** * @param {?} date * @param {?} locale * @param {?} pattern * @return {?} */ DateFormatter.format = function (date, locale, pattern) { return dateFormatter(pattern, date, locale); }; return DateFormatter; }()); /** * @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_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/; /** * @param {?} pipe * @param {?} locale * @param {?} value * @param {?} style * @param {?=} digits * @param {?=} currency * @param {?=} currencyAsSymbol * @return {?} */ function formatNumber(pipe, locale, value, style, digits, currency, currencyAsSymbol) { if (currency === void 0) { currency = null; } if (currencyAsSymbol === void 0) { currencyAsSymbol = false; } if (value == null) return null; // Convert strings to numbers value = typeof value === 'string' && isNumeric(value) ? +value : value; if (typeof value !== 'number') { throw invalidPipeArgumentError(pipe, value); } var /** @type {?} */ minInt = undefined; var /** @type {?} */ minFraction = undefined; var /** @type {?} */ maxFraction = undefined; if (style !== NumberFormatStyle.Currency) { // rely on Intl default for currency minInt = 1; minFraction = 0; maxFraction = 3; } if (digits) { var /** @type {?} */ parts = digits.match(_NUMBER_FORMAT_REGEXP); if (parts === null) { throw new Error(digits + " is not a valid digit info for number pipes"); } if (parts[1] != null) { minInt = parseIntAutoRadix(parts[1]); } if (parts[3] != null) { minFraction = parseIntAutoRadix(parts[3]); } if (parts[5] != null) { maxFraction = parseIntAutoRadix(parts[5]); } } return NumberFormatter.format(/** @type {?} */ (value), locale, style, { minimumIntegerDigits: minInt, minimumFractionDigits: minFraction, maximumFractionDigits: maxFraction, currency: currency, currencyAsSymbol: currencyAsSymbol, }); } /** * \@ngModule CommonModule * \@whatItDoes Formats a number according to locale rules. * \@howToUse `number_expression | number[:digitInfo]` * * Formats a number as text. Group sizing and separator and other locale-specific * configurations are based on the active locale. * * where `expression` is a number: * - `digitInfo` is a `string` which has a following format:
    * {minIntegerDigits}.{minFractionDigits}-{maxFractionDigits} * - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`. * - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`. * - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`. * * For more information on the acceptable range for each of these numbers and other * details see your native internationalization library. * * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers * and may require a polyfill. See {\@linkDocs guide/browser-support} for details. * * ### Example * * {\@example common/pipes/ts/number_pipe.ts region='NumberPipe'} * * \@stable */ var DecimalPipe = (function () { /** * @param {?} _locale */ function DecimalPipe(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} digits * @return {?} */ DecimalPipe.prototype.transform = function (value, digits) { return formatNumber(DecimalPipe, this._locale, value, NumberFormatStyle.Decimal, digits); }; return DecimalPipe; }()); DecimalPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_0" /* Pipe */], args: [{ name: 'number' },] }, ]; /** * @nocollapse */ DecimalPipe.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["I" /* LOCALE_ID */],] },] }, ]; }; /** * \@ngModule CommonModule * \@whatItDoes Formats a number as a percentage according to locale rules. * \@howToUse `number_expression | percent[:digitInfo]` * * \@description * * Formats a number as percentage. * * - `digitInfo` See {\@link DecimalPipe} for detailed description. * * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers * and may require a polyfill. See {\@linkDocs guide/browser-support} for details. * * ### Example * * {\@example common/pipes/ts/number_pipe.ts region='PercentPipe'} * * \@stable */ var PercentPipe = (function () { /** * @param {?} _locale */ function PercentPipe(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} digits * @return {?} */ PercentPipe.prototype.transform = function (value, digits) { return formatNumber(PercentPipe, this._locale, value, NumberFormatStyle.Percent, digits); }; return PercentPipe; }()); PercentPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_0" /* Pipe */], args: [{ name: 'percent' },] }, ]; /** * @nocollapse */ PercentPipe.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["I" /* LOCALE_ID */],] },] }, ]; }; /** * \@ngModule CommonModule * \@whatItDoes Formats a number as currency using locale rules. * \@howToUse `number_expression | currency[:currencyCode[:symbolDisplay[:digitInfo]]]` * \@description * * Use `currency` to format a number as currency. * * - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such * as `USD` for the US dollar and `EUR` for the euro. * - `symbolDisplay` is a boolean indicating whether to use the currency symbol or code. * - `true`: use symbol (e.g. `$`). * - `false`(default): use code (e.g. `USD`). * - `digitInfo` See {\@link DecimalPipe} for detailed description. * * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers * and may require a polyfill. See {\@linkDocs guide/browser-support} for details. * * ### Example * * {\@example common/pipes/ts/number_pipe.ts region='CurrencyPipe'} * * \@stable */ var CurrencyPipe = (function () { /** * @param {?} _locale */ function CurrencyPipe(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} currencyCode * @param {?=} symbolDisplay * @param {?=} digits * @return {?} */ CurrencyPipe.prototype.transform = function (value, currencyCode, symbolDisplay, digits) { if (currencyCode === void 0) { currencyCode = 'USD'; } if (symbolDisplay === void 0) { symbolDisplay = false; } return formatNumber(CurrencyPipe, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay); }; return CurrencyPipe; }()); CurrencyPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_0" /* Pipe */], args: [{ name: 'currency' },] }, ]; /** * @nocollapse */ CurrencyPipe.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["I" /* LOCALE_ID */],] },] }, ]; }; /** * @param {?} text * @return {?} */ function parseIntAutoRadix(text) { var /** @type {?} */ result = parseInt(text); if (isNaN(result)) { throw new Error('Invalid integer literal when parsing ' + text); } return result; } /** * @param {?} value * @return {?} */ function isNumeric(value) { return !isNaN(value - parseFloat(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 */ var ISO8601_DATE_REGEX = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; /** * \@ngModule CommonModule * \@whatItDoes Formats a date according to locale rules. * \@howToUse `date_expression | date[:format]` * \@description * * Where: * - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string * (https://www.w3.org/TR/NOTE-datetime). * - `format` indicates which date/time components to include. The format can be predefined as * shown below or custom as shown in the table. * - `'medium'`: equivalent to `'yMMMdjms'` (e.g. `Sep 3, 2010, 12:05:08 PM` for `en-US`) * - `'short'`: equivalent to `'yMdjm'` (e.g. `9/3/2010, 12:05 PM` for `en-US`) * - `'fullDate'`: equivalent to `'yMMMMEEEEd'` (e.g. `Friday, September 3, 2010` for `en-US`) * - `'longDate'`: equivalent to `'yMMMMd'` (e.g. `September 3, 2010` for `en-US`) * - `'mediumDate'`: equivalent to `'yMMMd'` (e.g. `Sep 3, 2010` for `en-US`) * - `'shortDate'`: equivalent to `'yMd'` (e.g. `9/3/2010` for `en-US`) * - `'mediumTime'`: equivalent to `'jms'` (e.g. `12:05:08 PM` for `en-US`) * - `'shortTime'`: equivalent to `'jm'` (e.g. `12:05 PM` for `en-US`) * * * | Component | Symbol | Narrow | Short Form | Long Form | Numeric | 2-digit | * |-----------|:------:|--------|--------------|-------------------|-----------|-----------| * | era | G | G (A) | GGG (AD) | GGGG (Anno Domini)| - | - | * | year | y | - | - | - | y (2015) | yy (15) | * | month | M | L (S) | MMM (Sep) | MMMM (September) | M (9) | MM (09) | * | day | d | - | - | - | d (3) | dd (03) | * | weekday | E | E (S) | EEE (Sun) | EEEE (Sunday) | - | - | * | hour | j | - | - | - | j (13) | jj (13) | * | hour12 | h | - | - | - | h (1 PM) | hh (01 PM)| * | hour24 | H | - | - | - | H (13) | HH (13) | * | minute | m | - | - | - | m (5) | mm (05) | * | second | s | - | - | - | s (9) | ss (09) | * | timezone | z | - | - | z (Pacific Standard Time)| - | - | * | timezone | Z | - | Z (GMT-8:00) | - | - | - | * | timezone | a | - | a (PM) | - | - | - | * * In javascript, only the components specified will be respected (not the ordering, * punctuations, ...) and details of the formatting will be dependent on the locale. * * Timezone of the formatted text will be the local system timezone of the end-user's machine. * * When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not * applied and the formatted text will have the same day, month and year of the expression. * * WARNINGS: * - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated. * Instead users should treat the date as an immutable object and change the reference when the * pipe needs to re-run (this is to avoid reformatting the date on every change detection run * which would be an expensive operation). * - this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera * browsers. * * ### Examples * * Assuming `dateObj` is (year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11) * in the _local_ time and locale is 'en-US': * * ``` * {{ dateObj | date }} // output is 'Jun 15, 2015' * {{ dateObj | date:'medium' }} // output is 'Jun 15, 2015, 9:43:11 PM' * {{ dateObj | date:'shortTime' }} // output is '9:43 PM' * {{ dateObj | date:'mmss' }} // output is '43:11' * ``` * * {\@example common/pipes/ts/date_pipe.ts region='DatePipe'} * * \@stable */ var DatePipe = (function () { /** * @param {?} _locale */ function DatePipe(_locale) { this._locale = _locale; } /** * @param {?} value * @param {?=} pattern * @return {?} */ DatePipe.prototype.transform = function (value, pattern) { if (pattern === void 0) { pattern = 'mediumDate'; } var /** @type {?} */ date; if (isBlank(value) || value !== value) return null; if (typeof value === 'string') { value = value.trim(); } if (isDate(value)) { date = value; } else if (isNumeric(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 = value.split('-').map(function (val) { return parseInt(val, 10); }), 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 /** @type {?} */ match = void 0; if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) { date = isoStringToDate(match); } else { throw invalidPipeArgumentError(DatePipe, value); } } return DateFormatter.format(date, this._locale, DatePipe._ALIASES[pattern] || pattern); }; return DatePipe; }()); /** * \@internal */ DatePipe._ALIASES = { 'medium': 'yMMMdjms', 'short': 'yMdjm', 'fullDate': 'yMMMMEEEEd', 'longDate': 'yMMMMd', 'mediumDate': 'yMMMd', 'shortDate': 'yMd', 'mediumTime': 'jms', 'shortTime': 'jm' }; DatePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_0" /* Pipe */], args: [{ name: 'date', pure: true },] }, ]; /** * @nocollapse */ DatePipe.ctorParameters = function () { return [ { type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["i" /* Inject */], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["I" /* LOCALE_ID */],] },] }, ]; }; /** * @param {?} obj * @return {?} */ function isBlank(obj) { return obj == null || obj === ''; } /** * @param {?} obj * @return {?} */ function isDate(obj) { return obj instanceof Date && !isNaN(obj.valueOf()); } /** * @param {?} match * @return {?} */ function isoStringToDate(match) { var /** @type {?} */ date = new Date(0); var /** @type {?} */ tzHour = 0; var /** @type {?} */ tzMin = 0; var /** @type {?} */ dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear; var /** @type {?} */ timeSetter = match[8] ? date.setUTCHours : date.setHours; if (match[9]) { tzHour = toInt(match[9] + match[10]); tzMin = toInt(match[9] + match[11]); } dateSetter.call(date, toInt(match[1]), toInt(match[2]) - 1, toInt(match[3])); var /** @type {?} */ h = toInt(match[4] || '0') - tzHour; var /** @type {?} */ m = toInt(match[5] || '0') - tzMin; var /** @type {?} */ s = toInt(match[6] || '0'); var /** @type {?} */ ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000); timeSetter.call(date, h, m, s, ms); return date; } /** * @param {?} str * @return {?} */ function toInt(str) { return parseInt(str, 10); } /** * @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 _INTERPOLATION_REGEXP = /#/g; /** * \@ngModule CommonModule * \@whatItDoes Maps a value to a string that pluralizes the value according to locale rules. * \@howToUse `expression | i18nPlural:mapping` * \@description * * Where: * - `expression` is a number. * - `mapping` is an object that mimics the ICU format, see * http://userguide.icu-project.org/formatparse/messages * * ## Example * * {\@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'} * * \@experimental */ var I18nPluralPipe = (function () { /** * @param {?} _localization */ function I18nPluralPipe(_localization) { this._localization = _localization; } /** * @param {?} value * @param {?} pluralMap * @return {?} */ I18nPluralPipe.prototype.transform = function (value, pluralMap) { if (value == null) return ''; if (typeof pluralMap !== 'object' || pluralMap === null) { throw invalidPipeArgumentError(I18nPluralPipe, pluralMap); } var /** @type {?} */ key = getPluralCategory(value, Object.keys(pluralMap), this._localization); return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString()); }; return I18nPluralPipe; }()); I18nPluralPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_0" /* Pipe */], args: [{ name: 'i18nPlural', pure: true },] }, ]; /** * @nocollapse */ I18nPluralPipe.ctorParameters = function () { return [ { type: NgLocalization, }, ]; }; /** * @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 */ /** * \@ngModule CommonModule * \@whatItDoes Generic selector that displays the string that matches the current value. * \@howToUse `expression | i18nSelect:mapping` * \@description * * Where `mapping` is an object that indicates the text that should be displayed * for different values of the provided `expression`. * If none of the keys of the mapping match the value of the `expression`, then the content * of the `other` key is returned when present, otherwise an empty string is returned. * * ## Example * * {\@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'} * * \@experimental */ var I18nSelectPipe = (function () { function I18nSelectPipe() { } /** * @param {?} value * @param {?} mapping * @return {?} */ I18nSelectPipe.prototype.transform = function (value, mapping) { if (value == null) return ''; if (typeof mapping !== 'object' || typeof value !== 'string') { throw invalidPipeArgumentError(I18nSelectPipe, mapping); } if (mapping.hasOwnProperty(value)) { return mapping[value]; } if (mapping.hasOwnProperty('other')) { return mapping['other']; } return ''; }; return I18nSelectPipe; }()); I18nSelectPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_0" /* Pipe */], args: [{ name: 'i18nSelect', pure: true },] }, ]; /** * @nocollapse */ I18nSelectPipe.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 */ /** * \@ngModule CommonModule * \@whatItDoes Converts value into JSON string. * \@howToUse `expression | json` * \@description * * Converts value into string using `JSON.stringify`. Useful for debugging. * * ### Example * {\@example common/pipes/ts/json_pipe.ts region='JsonPipe'} * * \@stable */ var JsonPipe = (function () { function JsonPipe() { } /** * @param {?} value * @return {?} */ JsonPipe.prototype.transform = function (value) { return JSON.stringify(value, null, 2); }; return JsonPipe; }()); JsonPipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_0" /* Pipe */], args: [{ name: 'json', pure: false },] }, ]; /** * @nocollapse */ JsonPipe.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 */ /** * \@ngModule CommonModule * \@whatItDoes Creates a new List or String containing a subset (slice) of the elements. * \@howToUse `array_or_string_expression | slice:start[:end]` * \@description * * Where the input expression is a `List` or `String`, and: * - `start`: The starting index of the subset to return. * - **a positive integer**: return the item at `start` index and all items after * in the list or string expression. * - **a negative integer**: return the item at `start` index from the end and all items after * in the list or string expression. * - **if positive and greater than the size of the expression**: return an empty list or string. * - **if negative and greater than the size of the expression**: return entire list or string. * - `end`: The ending index of the subset to return. * - **omitted**: return all items until the end. * - **if positive**: return all items before `end` index of the list or string. * - **if negative**: return all items before `end` index from the end of the list or string. * * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()` * and `String.prototype.slice()`. * * When operating on a [List], the returned list is always a copy even when all * the elements are being returned. * * When operating on a blank value, the pipe returns the blank value. * * ## List Example * * This `ngFor` example: * * {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'} * * produces the following: * *
  • b
  • *
  • c
  • * * ## String Examples * * {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'} * * \@stable */ var SlicePipe = (function () { function SlicePipe() { } /** * @param {?} value * @param {?} start * @param {?=} end * @return {?} */ SlicePipe.prototype.transform = function (value, start, end) { if (value == null) return value; if (!this.supports(value)) { throw invalidPipeArgumentError(SlicePipe, value); } return value.slice(start, end); }; /** * @param {?} obj * @return {?} */ SlicePipe.prototype.supports = function (obj) { return typeof obj === 'string' || Array.isArray(obj); }; return SlicePipe; }()); SlicePipe.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_0" /* Pipe */], args: [{ name: 'slice', pure: false },] }, ]; /** * @nocollapse */ SlicePipe.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 */ /** * @module * @description * This module provides a set of common Pipes. */ /** * A collection of Angular pipes that are likely to be used in each and every application. */ var COMMON_PIPES = [ AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, ]; /** * @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 module that includes all the basic Angular directives like {\@link NgIf}, {\@link NgForOf}, ... * * \@stable */ var CommonModule = (function () { function CommonModule() { } return CommonModule; }()); CommonModule.decorators = [ { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["c" /* NgModule */], args: [{ declarations: [COMMON_DIRECTIVES, COMMON_PIPES], exports: [COMMON_DIRECTIVES, COMMON_PIPES], providers: [ { provide: NgLocalization, useClass: NgLocaleLocalization }, ], },] }, ]; /** * @nocollapse */ CommonModule.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 */ var PLATFORM_BROWSER_ID = 'browser'; var PLATFORM_SERVER_ID = 'server'; var PLATFORM_WORKER_APP_ID = 'browserWorkerApp'; var PLATFORM_WORKER_UI_ID = 'browserWorkerUi'; /** * Returns whether a platform id represents a browser platform. * \@experimental * @param {?} platformId * @return {?} */ function isPlatformBrowser(platformId) { return platformId === PLATFORM_BROWSER_ID; } /** * Returns whether a platform id represents a server platform. * \@experimental * @param {?} platformId * @return {?} */ function isPlatformServer(platformId) { return platformId === PLATFORM_SERVER_ID; } /** * Returns whether a platform id represents a web worker app platform. * \@experimental * @param {?} platformId * @return {?} */ function isPlatformWorkerApp(platformId) { return platformId === PLATFORM_WORKER_APP_ID; } /** * Returns whether a platform id represents a web worker UI platform. * \@experimental * @param {?} platformId * @return {?} */ function isPlatformWorkerUi(platformId) { return platformId === PLATFORM_WORKER_UI_ID; } /** * @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_0__angular_core__["f" /* Version */]('4.1.3'); /** * @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. */ /** * @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. */ // This file only reexports content of the `src` folder. Keep it that way. /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=common.es5.js.map /***/ }), /***/ "./node_modules/@angular/compiler/@angular/compiler.es5.js": /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__("./node_modules/@angular/core/@angular/core.es5.js"); /* unused harmony export VERSION */ /* unused harmony export TEMPLATE_TRANSFORMS */ /* unused harmony export CompilerConfig */ /* unused harmony export JitCompiler */ /* unused harmony export DirectiveResolver */ /* unused harmony export PipeResolver */ /* unused harmony export NgModuleResolver */ /* unused harmony export DEFAULT_INTERPOLATION_CONFIG */ /* unused harmony export InterpolationConfig */ /* unused harmony export NgModuleCompiler */ /* unused harmony export ViewCompiler */ /* unused harmony export isSyntaxError */ /* unused harmony export syntaxError */ /* unused harmony export TextAst */ /* unused harmony export BoundTextAst */ /* unused harmony export AttrAst */ /* unused harmony export BoundElementPropertyAst */ /* unused harmony export BoundEventAst */ /* unused harmony export ReferenceAst */ /* unused harmony export VariableAst */ /* unused harmony export ElementAst */ /* unused harmony export EmbeddedTemplateAst */ /* unused harmony export BoundDirectivePropertyAst */ /* unused harmony export DirectiveAst */ /* unused harmony export ProviderAst */ /* unused harmony export ProviderAstType */ /* unused harmony export NgContentAst */ /* unused harmony export PropertyBindingType */ /* unused harmony export templateVisitAll */ /* unused harmony export CompileAnimationEntryMetadata */ /* unused harmony export CompileAnimationStateMetadata */ /* unused harmony export CompileAnimationStateDeclarationMetadata */ /* unused harmony export CompileAnimationStateTransitionMetadata */ /* unused harmony export CompileAnimationMetadata */ /* unused harmony export CompileAnimationKeyframesSequenceMetadata */ /* unused harmony export CompileAnimationStyleMetadata */ /* unused harmony export CompileAnimationAnimateMetadata */ /* unused harmony export CompileAnimationWithStepsMetadata */ /* unused harmony export CompileAnimationSequenceMetadata */ /* unused harmony export CompileAnimationGroupMetadata */ /* unused harmony export identifierName */ /* unused harmony export identifierModuleUrl */ /* unused harmony export viewClassName */ /* unused harmony export rendererTypeName */ /* unused harmony export hostViewClassName */ /* unused harmony export dirWrapperClassName */ /* unused harmony export componentFactoryName */ /* unused harmony export CompileSummaryKind */ /* unused harmony export tokenName */ /* unused harmony export tokenReference */ /* unused harmony export CompileStylesheetMetadata */ /* unused harmony export CompileTemplateMetadata */ /* unused harmony export CompileDirectiveMetadata */ /* unused harmony export createHostComponentMeta */ /* unused harmony export CompilePipeMetadata */ /* unused harmony export CompileNgModuleMetadata */ /* unused harmony export TransitiveCompileNgModuleMetadata */ /* unused harmony export ProviderMeta */ /* unused harmony export flatten */ /* unused harmony export sourceUrl */ /* unused harmony export templateSourceUrl */ /* unused harmony export sharedStylesheetJitUrl */ /* unused harmony export ngModuleJitUrl */ /* unused harmony export templateJitUrl */ /* unused harmony export createAotCompiler */ /* unused harmony export AotCompiler */ /* unused harmony export analyzeNgModules */ /* unused harmony export analyzeAndValidateNgModules */ /* unused harmony export extractProgramSymbols */ /* unused harmony export GeneratedFile */ /* unused harmony export StaticReflector */ /* unused harmony export StaticAndDynamicReflectionCapabilities */ /* unused harmony export StaticSymbol */ /* unused harmony export StaticSymbolCache */ /* unused harmony export ResolvedStaticSymbol */ /* unused harmony export StaticSymbolResolver */ /* unused harmony export unescapeIdentifier */ /* unused harmony export AotSummaryResolver */ /* unused harmony export SummaryResolver */ /* unused harmony export i18nHtmlParserFactory */ /* unused harmony export COMPILER_PROVIDERS */ /* unused harmony export JitCompilerFactory */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return platformCoreDynamic; }); /* unused harmony export createUrlResolverWithoutPackagePrefix */ /* unused harmony export createOfflineCompileUrlResolver */ /* unused harmony export DEFAULT_PACKAGE_URL_PROVIDER */ /* unused harmony export UrlResolver */ /* unused harmony export getUrlScheme */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ResourceLoader; }); /* unused harmony export ElementSchemaRegistry */ /* unused harmony export Extractor */ /* unused harmony export I18NHtmlParser */ /* unused harmony export MessageBundle */ /* unused harmony export Serializer */ /* unused harmony export Xliff */ /* unused harmony export Xliff2 */ /* unused harmony export Xmb */ /* unused harmony export Xtb */ /* unused harmony export DirectiveNormalizer */ /* unused harmony export ParserError */ /* unused harmony export ParseSpan */ /* unused harmony export AST */ /* unused harmony export Quote */ /* unused harmony export EmptyExpr */ /* unused harmony export ImplicitReceiver */ /* unused harmony export Chain */ /* unused harmony export Conditional */ /* unused harmony export PropertyRead */ /* unused harmony export PropertyWrite */ /* unused harmony export SafePropertyRead */ /* unused harmony export KeyedRead */ /* unused harmony export KeyedWrite */ /* unused harmony export BindingPipe */ /* unused harmony export LiteralPrimitive */ /* unused harmony export LiteralArray */ /* unused harmony export LiteralMap */ /* unused harmony export Interpolation */ /* unused harmony export Binary */ /* unused harmony export PrefixNot */ /* unused harmony export MethodCall */ /* unused harmony export SafeMethodCall */ /* unused harmony export FunctionCall */ /* unused harmony export ASTWithSource */ /* unused harmony export TemplateBinding */ /* unused harmony export RecursiveAstVisitor */ /* unused harmony export AstTransformer */ /* unused harmony export TokenType */ /* unused harmony export Lexer */ /* unused harmony export Token */ /* unused harmony export EOF */ /* unused harmony export isIdentifier */ /* unused harmony export isQuote */ /* unused harmony export SplitInterpolation */ /* unused harmony export TemplateBindingParseResult */ /* unused harmony export Parser */ /* unused harmony export _ParseAST */ /* unused harmony export ERROR_COLLECTOR_TOKEN */ /* unused harmony export CompileMetadataResolver */ /* unused harmony export componentModuleUrl */ /* unused harmony export Text */ /* unused harmony export Expansion */ /* unused harmony export ExpansionCase */ /* unused harmony export Attribute */ /* unused harmony export Element */ /* unused harmony export Comment */ /* unused harmony export visitAll */ /* unused harmony export ParseTreeResult */ /* unused harmony export TreeError */ /* unused harmony export HtmlParser */ /* unused harmony export HtmlTagDefinition */ /* unused harmony export getHtmlTagDefinition */ /* unused harmony export TagContentType */ /* unused harmony export splitNsName */ /* unused harmony export isNgContainer */ /* unused harmony export isNgContent */ /* unused harmony export isNgTemplate */ /* unused harmony export getNsPrefix */ /* unused harmony export mergeNsAndName */ /* unused harmony export NAMED_ENTITIES */ /* unused harmony export ImportResolver */ /* unused harmony export debugOutputAstAsTypeScript */ /* unused harmony export TypeScriptEmitter */ /* unused harmony export ParseLocation */ /* unused harmony export ParseSourceFile */ /* unused harmony export ParseSourceSpan */ /* unused harmony export ParseErrorLevel */ /* unused harmony export ParseError */ /* unused harmony export typeSourceSpan */ /* unused harmony export DomElementSchemaRegistry */ /* unused harmony export CssSelector */ /* unused harmony export SelectorMatcher */ /* unused harmony export SelectorListContext */ /* unused harmony export SelectorContext */ /* unused harmony export StylesCompileDependency */ /* unused harmony export StylesCompileResult */ /* unused harmony export CompiledStylesheet */ /* unused harmony export StyleCompiler */ /* unused harmony export TemplateParseError */ /* unused harmony export TemplateParseResult */ /* unused harmony export TemplateParser */ /* unused harmony export splitClasses */ /* unused harmony export createElementCssSelector */ /* unused harmony export removeSummaryDuplicates */ 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.3 * (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 */ /** * @module * @description * Entry point for all public APIs of the common package. */ /** * \@stable */ var VERSION = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["f" /* Version */]('4.1.3'); /** * @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 segment of text within the template. */ var TextAst = (function () { /** * @param {?} value * @param {?} ngContentIndex * @param {?} sourceSpan */ function TextAst(value, ngContentIndex, sourceSpan) { this.value = value; this.ngContentIndex = ngContentIndex; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ TextAst.prototype.visit = function (visitor, context) { return visitor.visitText(this, context); }; return TextAst; }()); /** * A bound expression within the text of a template. */ var BoundTextAst = (function () { /** * @param {?} value * @param {?} ngContentIndex * @param {?} sourceSpan */ function BoundTextAst(value, ngContentIndex, sourceSpan) { this.value = value; this.ngContentIndex = ngContentIndex; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ BoundTextAst.prototype.visit = function (visitor, context) { return visitor.visitBoundText(this, context); }; return BoundTextAst; }()); /** * A plain attribute on an element. */ var AttrAst = (function () { /** * @param {?} name * @param {?} value * @param {?} sourceSpan */ function AttrAst(name, value, sourceSpan) { this.name = name; this.value = value; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ AttrAst.prototype.visit = function (visitor, context) { return visitor.visitAttr(this, context); }; return AttrAst; }()); /** * A binding for an element property (e.g. `[property]="expression"`) or an animation trigger (e.g. * `[\@trigger]="stateExp"`) */ var BoundElementPropertyAst = (function () { /** * @param {?} name * @param {?} type * @param {?} securityContext * @param {?} value * @param {?} unit * @param {?} sourceSpan */ function BoundElementPropertyAst(name, type, securityContext, value, unit, sourceSpan) { this.name = name; this.type = type; this.securityContext = securityContext; this.value = value; this.unit = unit; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ BoundElementPropertyAst.prototype.visit = function (visitor, context) { return visitor.visitElementProperty(this, context); }; Object.defineProperty(BoundElementPropertyAst.prototype, "isAnimation", { /** * @return {?} */ get: function () { return this.type === PropertyBindingType.Animation; }, enumerable: true, configurable: true }); return BoundElementPropertyAst; }()); /** * A binding for an element event (e.g. `(event)="handler()"`) or an animation trigger event (e.g. * `(\@trigger.phase)="callback($event)"`). */ var BoundEventAst = (function () { /** * @param {?} name * @param {?} target * @param {?} phase * @param {?} handler * @param {?} sourceSpan */ function BoundEventAst(name, target, phase, handler, sourceSpan) { this.name = name; this.target = target; this.phase = phase; this.handler = handler; this.sourceSpan = sourceSpan; } /** * @param {?} name * @param {?} target * @param {?} phase * @return {?} */ BoundEventAst.calcFullName = function (name, target, phase) { if (target) { return target + ":" + name; } else if (phase) { return "@" + name + "." + phase; } else { return name; } }; /** * @param {?} visitor * @param {?} context * @return {?} */ BoundEventAst.prototype.visit = function (visitor, context) { return visitor.visitEvent(this, context); }; Object.defineProperty(BoundEventAst.prototype, "fullName", { /** * @return {?} */ get: function () { return BoundEventAst.calcFullName(this.name, this.target, this.phase); }, enumerable: true, configurable: true }); Object.defineProperty(BoundEventAst.prototype, "isAnimation", { /** * @return {?} */ get: function () { return !!this.phase; }, enumerable: true, configurable: true }); return BoundEventAst; }()); /** * A reference declaration on an element (e.g. `let someName="expression"`). */ var ReferenceAst = (function () { /** * @param {?} name * @param {?} value * @param {?} sourceSpan */ function ReferenceAst(name, value, sourceSpan) { this.name = name; this.value = value; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ ReferenceAst.prototype.visit = function (visitor, context) { return visitor.visitReference(this, context); }; return ReferenceAst; }()); /** * A variable declaration on a (e.g. `var-someName="someLocalName"`). */ var VariableAst = (function () { /** * @param {?} name * @param {?} value * @param {?} sourceSpan */ function VariableAst(name, value, sourceSpan) { this.name = name; this.value = value; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ VariableAst.prototype.visit = function (visitor, context) { return visitor.visitVariable(this, context); }; return VariableAst; }()); /** * An element declaration in a template. */ var ElementAst = (function () { /** * @param {?} name * @param {?} attrs * @param {?} inputs * @param {?} outputs * @param {?} references * @param {?} directives * @param {?} providers * @param {?} hasViewContainer * @param {?} queryMatches * @param {?} children * @param {?} ngContentIndex * @param {?} sourceSpan * @param {?} endSourceSpan */ function ElementAst(name, attrs, inputs, outputs, references, directives, providers, hasViewContainer, queryMatches, children, ngContentIndex, sourceSpan, endSourceSpan) { this.name = name; this.attrs = attrs; this.inputs = inputs; this.outputs = outputs; this.references = references; this.directives = directives; this.providers = providers; this.hasViewContainer = hasViewContainer; this.queryMatches = queryMatches; this.children = children; this.ngContentIndex = ngContentIndex; this.sourceSpan = sourceSpan; this.endSourceSpan = endSourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ ElementAst.prototype.visit = function (visitor, context) { return visitor.visitElement(this, context); }; return ElementAst; }()); /** * A `` element included in an Angular template. */ var EmbeddedTemplateAst = (function () { /** * @param {?} attrs * @param {?} outputs * @param {?} references * @param {?} variables * @param {?} directives * @param {?} providers * @param {?} hasViewContainer * @param {?} queryMatches * @param {?} children * @param {?} ngContentIndex * @param {?} sourceSpan */ function EmbeddedTemplateAst(attrs, outputs, references, variables, directives, providers, hasViewContainer, queryMatches, children, ngContentIndex, sourceSpan) { this.attrs = attrs; this.outputs = outputs; this.references = references; this.variables = variables; this.directives = directives; this.providers = providers; this.hasViewContainer = hasViewContainer; this.queryMatches = queryMatches; this.children = children; this.ngContentIndex = ngContentIndex; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ EmbeddedTemplateAst.prototype.visit = function (visitor, context) { return visitor.visitEmbeddedTemplate(this, context); }; return EmbeddedTemplateAst; }()); /** * A directive property with a bound value (e.g. `*ngIf="condition"). */ var BoundDirectivePropertyAst = (function () { /** * @param {?} directiveName * @param {?} templateName * @param {?} value * @param {?} sourceSpan */ function BoundDirectivePropertyAst(directiveName, templateName, value, sourceSpan) { this.directiveName = directiveName; this.templateName = templateName; this.value = value; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ BoundDirectivePropertyAst.prototype.visit = function (visitor, context) { return visitor.visitDirectiveProperty(this, context); }; return BoundDirectivePropertyAst; }()); /** * A directive declared on an element. */ var DirectiveAst = (function () { /** * @param {?} directive * @param {?} inputs * @param {?} hostProperties * @param {?} hostEvents * @param {?} contentQueryStartId * @param {?} sourceSpan */ function DirectiveAst(directive, inputs, hostProperties, hostEvents, contentQueryStartId, sourceSpan) { this.directive = directive; this.inputs = inputs; this.hostProperties = hostProperties; this.hostEvents = hostEvents; this.contentQueryStartId = contentQueryStartId; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ DirectiveAst.prototype.visit = function (visitor, context) { return visitor.visitDirective(this, context); }; return DirectiveAst; }()); /** * A provider declared on an element */ var ProviderAst = (function () { /** * @param {?} token * @param {?} multiProvider * @param {?} eager * @param {?} providers * @param {?} providerType * @param {?} lifecycleHooks * @param {?} sourceSpan */ function ProviderAst(token, multiProvider, eager, providers, providerType, lifecycleHooks, sourceSpan) { this.token = token; this.multiProvider = multiProvider; this.eager = eager; this.providers = providers; this.providerType = providerType; this.lifecycleHooks = lifecycleHooks; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ ProviderAst.prototype.visit = function (visitor, context) { // No visit method in the visitor for now... return null; }; return ProviderAst; }()); var ProviderAstType = {}; ProviderAstType.PublicService = 0; ProviderAstType.PrivateService = 1; ProviderAstType.Component = 2; ProviderAstType.Directive = 3; ProviderAstType.Builtin = 4; ProviderAstType[ProviderAstType.PublicService] = "PublicService"; ProviderAstType[ProviderAstType.PrivateService] = "PrivateService"; ProviderAstType[ProviderAstType.Component] = "Component"; ProviderAstType[ProviderAstType.Directive] = "Directive"; ProviderAstType[ProviderAstType.Builtin] = "Builtin"; /** * Position where content is to be projected (instance of `` in a template). */ var NgContentAst = (function () { /** * @param {?} index * @param {?} ngContentIndex * @param {?} sourceSpan */ function NgContentAst(index, ngContentIndex, sourceSpan) { this.index = index; this.ngContentIndex = ngContentIndex; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ NgContentAst.prototype.visit = function (visitor, context) { return visitor.visitNgContent(this, context); }; return NgContentAst; }()); var PropertyBindingType = {}; PropertyBindingType.Property = 0; PropertyBindingType.Attribute = 1; PropertyBindingType.Class = 2; PropertyBindingType.Style = 3; PropertyBindingType.Animation = 4; PropertyBindingType[PropertyBindingType.Property] = "Property"; PropertyBindingType[PropertyBindingType.Attribute] = "Attribute"; PropertyBindingType[PropertyBindingType.Class] = "Class"; PropertyBindingType[PropertyBindingType.Style] = "Style"; PropertyBindingType[PropertyBindingType.Animation] = "Animation"; /** * Visit every node in a list of {\@link TemplateAst}s with the given {\@link TemplateAstVisitor}. * @param {?} visitor * @param {?} asts * @param {?=} context * @return {?} */ function templateVisitAll(visitor, asts, context) { if (context === void 0) { context = null; } var /** @type {?} */ result = []; var /** @type {?} */ visit = visitor.visit ? function (ast) { return ((visitor.visit))(ast, context) || ast.visit(visitor, context); } : function (ast) { return ast.visit(visitor, context); }; asts.forEach(function (ast) { var /** @type {?} */ astResult = visit(ast); if (astResult) { result.push(astResult); } }); return result; } /** * A token representing the a reference to a static type. * * This token is unique for a filePath and name and can be used as a hash table key. */ var StaticSymbol = (function () { /** * @param {?} filePath * @param {?} name * @param {?} members */ function StaticSymbol(filePath, name, members) { this.filePath = filePath; this.name = name; this.members = members; } /** * @return {?} */ StaticSymbol.prototype.assertNoMembers = function () { if (this.members.length) { throw new Error("Illegal state: symbol without members expected, but got " + JSON.stringify(this) + "."); } }; return StaticSymbol; }()); /** * A cache of static symbol used by the StaticReflector to return the same symbol for the * same symbol values. */ var StaticSymbolCache = (function () { function StaticSymbolCache() { this.cache = new Map(); } /** * @param {?} declarationFile * @param {?} name * @param {?=} members * @return {?} */ StaticSymbolCache.prototype.get = function (declarationFile, name, members) { members = members || []; var /** @type {?} */ memberSuffix = members.length ? "." + members.join('.') : ''; var /** @type {?} */ key = "\"" + declarationFile + "\"." + name + memberSuffix; var /** @type {?} */ result = this.cache.get(key); if (!result) { result = new StaticSymbol(declarationFile, name, members); this.cache.set(key, result); } return result; }; return StaticSymbolCache; }()); var TagContentType = {}; TagContentType.RAW_TEXT = 0; TagContentType.ESCAPABLE_RAW_TEXT = 1; TagContentType.PARSABLE_DATA = 2; TagContentType[TagContentType.RAW_TEXT] = "RAW_TEXT"; TagContentType[TagContentType.ESCAPABLE_RAW_TEXT] = "ESCAPABLE_RAW_TEXT"; TagContentType[TagContentType.PARSABLE_DATA] = "PARSABLE_DATA"; /** * @param {?} elementName * @return {?} */ function splitNsName(elementName) { if (elementName[0] != ':') { return [null, elementName]; } var /** @type {?} */ colonIndex = elementName.indexOf(':', 1); if (colonIndex == -1) { throw new Error("Unsupported format \"" + elementName + "\" expecting \":namespace:name\""); } return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)]; } /** * @param {?} tagName * @return {?} */ function isNgContainer(tagName) { return splitNsName(tagName)[1] === 'ng-container'; } /** * @param {?} tagName * @return {?} */ function isNgContent(tagName) { return splitNsName(tagName)[1] === 'ng-content'; } /** * @param {?} tagName * @return {?} */ function isNgTemplate(tagName) { return splitNsName(tagName)[1] === 'ng-template'; } /** * @param {?} fullName * @return {?} */ function getNsPrefix(fullName) { return fullName === null ? null : splitNsName(fullName)[0]; } /** * @param {?} prefix * @param {?} localName * @return {?} */ function mergeNsAndName(prefix, localName) { return prefix ? ":" + prefix + ":" + localName : localName; } // see http://www.w3.org/TR/html51/syntax.html#named-character-references // see https://html.spec.whatwg.org/multipage/entities.json // This list is not exhaustive to keep the compiler footprint low. // The `{` / `ƫ` syntax should be used when the named character reference does not // exist. var NAMED_ENTITIES = { 'Aacute': '\u00C1', 'aacute': '\u00E1', 'Acirc': '\u00C2', 'acirc': '\u00E2', 'acute': '\u00B4', 'AElig': '\u00C6', 'aelig': '\u00E6', 'Agrave': '\u00C0', 'agrave': '\u00E0', 'alefsym': '\u2135', 'Alpha': '\u0391', 'alpha': '\u03B1', 'amp': '&', 'and': '\u2227', 'ang': '\u2220', 'apos': '\u0027', 'Aring': '\u00C5', 'aring': '\u00E5', 'asymp': '\u2248', 'Atilde': '\u00C3', 'atilde': '\u00E3', 'Auml': '\u00C4', 'auml': '\u00E4', 'bdquo': '\u201E', 'Beta': '\u0392', 'beta': '\u03B2', 'brvbar': '\u00A6', 'bull': '\u2022', 'cap': '\u2229', 'Ccedil': '\u00C7', 'ccedil': '\u00E7', 'cedil': '\u00B8', 'cent': '\u00A2', 'Chi': '\u03A7', 'chi': '\u03C7', 'circ': '\u02C6', 'clubs': '\u2663', 'cong': '\u2245', 'copy': '\u00A9', 'crarr': '\u21B5', 'cup': '\u222A', 'curren': '\u00A4', 'dagger': '\u2020', 'Dagger': '\u2021', 'darr': '\u2193', 'dArr': '\u21D3', 'deg': '\u00B0', 'Delta': '\u0394', 'delta': '\u03B4', 'diams': '\u2666', 'divide': '\u00F7', 'Eacute': '\u00C9', 'eacute': '\u00E9', 'Ecirc': '\u00CA', 'ecirc': '\u00EA', 'Egrave': '\u00C8', 'egrave': '\u00E8', 'empty': '\u2205', 'emsp': '\u2003', 'ensp': '\u2002', 'Epsilon': '\u0395', 'epsilon': '\u03B5', 'equiv': '\u2261', 'Eta': '\u0397', 'eta': '\u03B7', 'ETH': '\u00D0', 'eth': '\u00F0', 'Euml': '\u00CB', 'euml': '\u00EB', 'euro': '\u20AC', 'exist': '\u2203', 'fnof': '\u0192', 'forall': '\u2200', 'frac12': '\u00BD', 'frac14': '\u00BC', 'frac34': '\u00BE', 'frasl': '\u2044', 'Gamma': '\u0393', 'gamma': '\u03B3', 'ge': '\u2265', 'gt': '>', 'harr': '\u2194', 'hArr': '\u21D4', 'hearts': '\u2665', 'hellip': '\u2026', 'Iacute': '\u00CD', 'iacute': '\u00ED', 'Icirc': '\u00CE', 'icirc': '\u00EE', 'iexcl': '\u00A1', 'Igrave': '\u00CC', 'igrave': '\u00EC', 'image': '\u2111', 'infin': '\u221E', 'int': '\u222B', 'Iota': '\u0399', 'iota': '\u03B9', 'iquest': '\u00BF', 'isin': '\u2208', 'Iuml': '\u00CF', 'iuml': '\u00EF', 'Kappa': '\u039A', 'kappa': '\u03BA', 'Lambda': '\u039B', 'lambda': '\u03BB', 'lang': '\u27E8', 'laquo': '\u00AB', 'larr': '\u2190', 'lArr': '\u21D0', 'lceil': '\u2308', 'ldquo': '\u201C', 'le': '\u2264', 'lfloor': '\u230A', 'lowast': '\u2217', 'loz': '\u25CA', 'lrm': '\u200E', 'lsaquo': '\u2039', 'lsquo': '\u2018', 'lt': '<', 'macr': '\u00AF', 'mdash': '\u2014', 'micro': '\u00B5', 'middot': '\u00B7', 'minus': '\u2212', 'Mu': '\u039C', 'mu': '\u03BC', 'nabla': '\u2207', 'nbsp': '\u00A0', 'ndash': '\u2013', 'ne': '\u2260', 'ni': '\u220B', 'not': '\u00AC', 'notin': '\u2209', 'nsub': '\u2284', 'Ntilde': '\u00D1', 'ntilde': '\u00F1', 'Nu': '\u039D', 'nu': '\u03BD', 'Oacute': '\u00D3', 'oacute': '\u00F3', 'Ocirc': '\u00D4', 'ocirc': '\u00F4', 'OElig': '\u0152', 'oelig': '\u0153', 'Ograve': '\u00D2', 'ograve': '\u00F2', 'oline': '\u203E', 'Omega': '\u03A9', 'omega': '\u03C9', 'Omicron': '\u039F', 'omicron': '\u03BF', 'oplus': '\u2295', 'or': '\u2228', 'ordf': '\u00AA', 'ordm': '\u00BA', 'Oslash': '\u00D8', 'oslash': '\u00F8', 'Otilde': '\u00D5', 'otilde': '\u00F5', 'otimes': '\u2297', 'Ouml': '\u00D6', 'ouml': '\u00F6', 'para': '\u00B6', 'permil': '\u2030', 'perp': '\u22A5', 'Phi': '\u03A6', 'phi': '\u03C6', 'Pi': '\u03A0', 'pi': '\u03C0', 'piv': '\u03D6', 'plusmn': '\u00B1', 'pound': '\u00A3', 'prime': '\u2032', 'Prime': '\u2033', 'prod': '\u220F', 'prop': '\u221D', 'Psi': '\u03A8', 'psi': '\u03C8', 'quot': '\u0022', 'radic': '\u221A', 'rang': '\u27E9', 'raquo': '\u00BB', 'rarr': '\u2192', 'rArr': '\u21D2', 'rceil': '\u2309', 'rdquo': '\u201D', 'real': '\u211C', 'reg': '\u00AE', 'rfloor': '\u230B', 'Rho': '\u03A1', 'rho': '\u03C1', 'rlm': '\u200F', 'rsaquo': '\u203A', 'rsquo': '\u2019', 'sbquo': '\u201A', 'Scaron': '\u0160', 'scaron': '\u0161', 'sdot': '\u22C5', 'sect': '\u00A7', 'shy': '\u00AD', 'Sigma': '\u03A3', 'sigma': '\u03C3', 'sigmaf': '\u03C2', 'sim': '\u223C', 'spades': '\u2660', 'sub': '\u2282', 'sube': '\u2286', 'sum': '\u2211', 'sup': '\u2283', 'sup1': '\u00B9', 'sup2': '\u00B2', 'sup3': '\u00B3', 'supe': '\u2287', 'szlig': '\u00DF', 'Tau': '\u03A4', 'tau': '\u03C4', 'there4': '\u2234', 'Theta': '\u0398', 'theta': '\u03B8', 'thetasym': '\u03D1', 'thinsp': '\u2009', 'THORN': '\u00DE', 'thorn': '\u00FE', 'tilde': '\u02DC', 'times': '\u00D7', 'trade': '\u2122', 'Uacute': '\u00DA', 'uacute': '\u00FA', 'uarr': '\u2191', 'uArr': '\u21D1', 'Ucirc': '\u00DB', 'ucirc': '\u00FB', 'Ugrave': '\u00D9', 'ugrave': '\u00F9', 'uml': '\u00A8', 'upsih': '\u03D2', 'Upsilon': '\u03A5', 'upsilon': '\u03C5', 'Uuml': '\u00DC', 'uuml': '\u00FC', 'weierp': '\u2118', 'Xi': '\u039E', 'xi': '\u03BE', 'Yacute': '\u00DD', 'yacute': '\u00FD', 'yen': '\u00A5', 'yuml': '\u00FF', 'Yuml': '\u0178', 'Zeta': '\u0396', 'zeta': '\u03B6', 'zwj': '\u200D', 'zwnj': '\u200C', }; /** * @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 HtmlTagDefinition = (function () { /** * @param {?=} __0 */ function HtmlTagDefinition(_a) { var _b = _a === void 0 ? {} : _a, closedByChildren = _b.closedByChildren, requiredParents = _b.requiredParents, implicitNamespacePrefix = _b.implicitNamespacePrefix, _c = _b.contentType, contentType = _c === void 0 ? TagContentType.PARSABLE_DATA : _c, _d = _b.closedByParent, closedByParent = _d === void 0 ? false : _d, _e = _b.isVoid, isVoid = _e === void 0 ? false : _e, _f = _b.ignoreFirstLf, ignoreFirstLf = _f === void 0 ? false : _f; var _this = this; this.closedByChildren = {}; this.closedByParent = false; this.canSelfClose = false; if (closedByChildren && closedByChildren.length > 0) { closedByChildren.forEach(function (tagName) { return _this.closedByChildren[tagName] = true; }); } this.isVoid = isVoid; this.closedByParent = closedByParent || isVoid; if (requiredParents && requiredParents.length > 0) { this.requiredParents = {}; // The first parent is the list is automatically when none of the listed parents are present this.parentToAdd = requiredParents[0]; requiredParents.forEach(function (tagName) { return _this.requiredParents[tagName] = true; }); } this.implicitNamespacePrefix = implicitNamespacePrefix || null; this.contentType = contentType; this.ignoreFirstLf = ignoreFirstLf; } /** * @param {?} currentParent * @return {?} */ HtmlTagDefinition.prototype.requireExtraParent = function (currentParent) { if (!this.requiredParents) { return false; } if (!currentParent) { return true; } var /** @type {?} */ lcParent = currentParent.toLowerCase(); var /** @type {?} */ isParentTemplate = lcParent === 'template' || currentParent === 'ng-template'; return !isParentTemplate && this.requiredParents[lcParent] != true; }; /** * @param {?} name * @return {?} */ HtmlTagDefinition.prototype.isClosedByChild = function (name) { return this.isVoid || name.toLowerCase() in this.closedByChildren; }; return HtmlTagDefinition; }()); // see http://www.w3.org/TR/html51/syntax.html#optional-tags // This implementation does not fully conform to the HTML5 spec. var TAG_DEFINITIONS = { 'base': new HtmlTagDefinition({ isVoid: true }), 'meta': new HtmlTagDefinition({ isVoid: true }), 'area': new HtmlTagDefinition({ isVoid: true }), 'embed': new HtmlTagDefinition({ isVoid: true }), 'link': new HtmlTagDefinition({ isVoid: true }), 'img': new HtmlTagDefinition({ isVoid: true }), 'input': new HtmlTagDefinition({ isVoid: true }), 'param': new HtmlTagDefinition({ isVoid: true }), 'hr': new HtmlTagDefinition({ isVoid: true }), 'br': new HtmlTagDefinition({ isVoid: true }), 'source': new HtmlTagDefinition({ isVoid: true }), 'track': new HtmlTagDefinition({ isVoid: true }), 'wbr': new HtmlTagDefinition({ isVoid: true }), 'p': new HtmlTagDefinition({ closedByChildren: [ 'address', 'article', 'aside', 'blockquote', 'div', 'dl', 'fieldset', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'main', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul' ], closedByParent: true }), 'thead': new HtmlTagDefinition({ closedByChildren: ['tbody', 'tfoot'] }), 'tbody': new HtmlTagDefinition({ closedByChildren: ['tbody', 'tfoot'], closedByParent: true }), 'tfoot': new HtmlTagDefinition({ closedByChildren: ['tbody'], closedByParent: true }), 'tr': new HtmlTagDefinition({ closedByChildren: ['tr'], requiredParents: ['tbody', 'tfoot', 'thead'], closedByParent: true }), 'td': new HtmlTagDefinition({ closedByChildren: ['td', 'th'], closedByParent: true }), 'th': new HtmlTagDefinition({ closedByChildren: ['td', 'th'], closedByParent: true }), 'col': new HtmlTagDefinition({ requiredParents: ['colgroup'], isVoid: true }), 'svg': new HtmlTagDefinition({ implicitNamespacePrefix: 'svg' }), 'math': new HtmlTagDefinition({ implicitNamespacePrefix: 'math' }), 'li': new HtmlTagDefinition({ closedByChildren: ['li'], closedByParent: true }), 'dt': new HtmlTagDefinition({ closedByChildren: ['dt', 'dd'] }), 'dd': new HtmlTagDefinition({ closedByChildren: ['dt', 'dd'], closedByParent: true }), 'rb': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }), 'rt': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }), 'rtc': new HtmlTagDefinition({ closedByChildren: ['rb', 'rtc', 'rp'], closedByParent: true }), 'rp': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }), 'optgroup': new HtmlTagDefinition({ closedByChildren: ['optgroup'], closedByParent: true }), 'option': new HtmlTagDefinition({ closedByChildren: ['option', 'optgroup'], closedByParent: true }), 'pre': new HtmlTagDefinition({ ignoreFirstLf: true }), 'listing': new HtmlTagDefinition({ ignoreFirstLf: true }), 'style': new HtmlTagDefinition({ contentType: TagContentType.RAW_TEXT }), 'script': new HtmlTagDefinition({ contentType: TagContentType.RAW_TEXT }), 'title': new HtmlTagDefinition({ contentType: TagContentType.ESCAPABLE_RAW_TEXT }), 'textarea': new HtmlTagDefinition({ contentType: TagContentType.ESCAPABLE_RAW_TEXT, ignoreFirstLf: true }), }; var _DEFAULT_TAG_DEFINITION = new HtmlTagDefinition(); /** * @param {?} tagName * @return {?} */ function getHtmlTagDefinition(tagName) { return TAG_DEFINITIONS[tagName.toLowerCase()] || _DEFAULT_TAG_DEFINITION; } /** * @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 _SELECTOR_REGEXP = new RegExp('(\\:not\\()|' + '([-\\w]+)|' + '(?:\\.([-\\w]+))|' + // "-" should appear first in the regexp below as FF31 parses "[.-\w]" as a range '(?:\\[([-.\\w*]+)(?:=([\"\']?)([^\\]\"\']*)\\5)?\\])|' + // "[name="value"]", // "[name='value']" '(\\))|' + '(\\s*,\\s*)', // "," 'g'); /** * A css selector contains an element name, * css classes and attribute/value pairs with the purpose * of selecting subsets out of them. */ var CssSelector = (function () { function CssSelector() { this.element = null; this.classNames = []; this.attrs = []; this.notSelectors = []; } /** * @param {?} selector * @return {?} */ CssSelector.parse = function (selector) { var /** @type {?} */ results = []; var /** @type {?} */ _addResult = function (res, cssSel) { if (cssSel.notSelectors.length > 0 && !cssSel.element && cssSel.classNames.length == 0 && cssSel.attrs.length == 0) { cssSel.element = '*'; } res.push(cssSel); }; var /** @type {?} */ cssSelector = new CssSelector(); var /** @type {?} */ match; var /** @type {?} */ current = cssSelector; var /** @type {?} */ inNot = false; _SELECTOR_REGEXP.lastIndex = 0; while (match = _SELECTOR_REGEXP.exec(selector)) { if (match[1]) { if (inNot) { throw new Error('Nesting :not is not allowed in a selector'); } inNot = true; current = new CssSelector(); cssSelector.notSelectors.push(current); } if (match[2]) { current.setElement(match[2]); } if (match[3]) { current.addClassName(match[3]); } if (match[4]) { current.addAttribute(match[4], match[6]); } if (match[7]) { inNot = false; current = cssSelector; } if (match[8]) { if (inNot) { throw new Error('Multiple selectors in :not are not supported'); } _addResult(results, cssSelector); cssSelector = current = new CssSelector(); } } _addResult(results, cssSelector); return results; }; /** * @return {?} */ CssSelector.prototype.isElementSelector = function () { return this.hasElementSelector() && this.classNames.length == 0 && this.attrs.length == 0 && this.notSelectors.length === 0; }; /** * @return {?} */ CssSelector.prototype.hasElementSelector = function () { return !!this.element; }; /** * @param {?=} element * @return {?} */ CssSelector.prototype.setElement = function (element) { if (element === void 0) { element = null; } this.element = element; }; /** * Gets a template string for an element that matches the selector. * @return {?} */ CssSelector.prototype.getMatchingElementTemplate = function () { var /** @type {?} */ tagName = this.element || 'div'; var /** @type {?} */ classAttr = this.classNames.length > 0 ? " class=\"" + this.classNames.join(' ') + "\"" : ''; var /** @type {?} */ attrs = ''; for (var /** @type {?} */ i = 0; i < this.attrs.length; i += 2) { var /** @type {?} */ attrName = this.attrs[i]; var /** @type {?} */ attrValue = this.attrs[i + 1] !== '' ? "=\"" + this.attrs[i + 1] + "\"" : ''; attrs += " " + attrName + attrValue; } return getHtmlTagDefinition(tagName).isVoid ? "<" + tagName + classAttr + attrs + "/>" : "<" + tagName + classAttr + attrs + ">"; }; /** * @param {?} name * @param {?=} value * @return {?} */ CssSelector.prototype.addAttribute = function (name, value) { if (value === void 0) { value = ''; } this.attrs.push(name, value && value.toLowerCase() || ''); }; /** * @param {?} name * @return {?} */ CssSelector.prototype.addClassName = function (name) { this.classNames.push(name.toLowerCase()); }; /** * @return {?} */ CssSelector.prototype.toString = function () { var /** @type {?} */ res = this.element || ''; if (this.classNames) { this.classNames.forEach(function (klass) { return res += "." + klass; }); } if (this.attrs) { for (var /** @type {?} */ i = 0; i < this.attrs.length; i += 2) { var /** @type {?} */ name = this.attrs[i]; var /** @type {?} */ value = this.attrs[i + 1]; res += "[" + name + (value ? '=' + value : '') + "]"; } } this.notSelectors.forEach(function (notSelector) { return res += ":not(" + notSelector + ")"; }); return res; }; return CssSelector; }()); /** * Reads a list of CssSelectors and allows to calculate which ones * are contained in a given CssSelector. */ var SelectorMatcher = (function () { function SelectorMatcher() { this._elementMap = new Map(); this._elementPartialMap = new Map(); this._classMap = new Map(); this._classPartialMap = new Map(); this._attrValueMap = new Map(); this._attrValuePartialMap = new Map(); this._listContexts = []; } /** * @param {?} notSelectors * @return {?} */ SelectorMatcher.createNotMatcher = function (notSelectors) { var /** @type {?} */ notMatcher = new SelectorMatcher(); notMatcher.addSelectables(notSelectors, null); return notMatcher; }; /** * @param {?} cssSelectors * @param {?=} callbackCtxt * @return {?} */ SelectorMatcher.prototype.addSelectables = function (cssSelectors, callbackCtxt) { var /** @type {?} */ listContext = ((null)); if (cssSelectors.length > 1) { listContext = new SelectorListContext(cssSelectors); this._listContexts.push(listContext); } for (var /** @type {?} */ i = 0; i < cssSelectors.length; i++) { this._addSelectable(cssSelectors[i], callbackCtxt, listContext); } }; /** * Add an object that can be found later on by calling `match`. * @param {?} cssSelector A css selector * @param {?} callbackCtxt An opaque object that will be given to the callback of the `match` function * @param {?} listContext * @return {?} */ SelectorMatcher.prototype._addSelectable = function (cssSelector, callbackCtxt, listContext) { var /** @type {?} */ matcher = this; var /** @type {?} */ element = cssSelector.element; var /** @type {?} */ classNames = cssSelector.classNames; var /** @type {?} */ attrs = cssSelector.attrs; var /** @type {?} */ selectable = new SelectorContext(cssSelector, callbackCtxt, listContext); if (element) { var /** @type {?} */ isTerminal = attrs.length === 0 && classNames.length === 0; if (isTerminal) { this._addTerminal(matcher._elementMap, element, selectable); } else { matcher = this._addPartial(matcher._elementPartialMap, element); } } if (classNames) { for (var /** @type {?} */ i = 0; i < classNames.length; i++) { var /** @type {?} */ isTerminal = attrs.length === 0 && i === classNames.length - 1; var /** @type {?} */ className = classNames[i]; if (isTerminal) { this._addTerminal(matcher._classMap, className, selectable); } else { matcher = this._addPartial(matcher._classPartialMap, className); } } } if (attrs) { for (var /** @type {?} */ i = 0; i < attrs.length; i += 2) { var /** @type {?} */ isTerminal = i === attrs.length - 2; var /** @type {?} */ name = attrs[i]; var /** @type {?} */ value = attrs[i + 1]; if (isTerminal) { var /** @type {?} */ terminalMap = matcher._attrValueMap; var /** @type {?} */ terminalValuesMap = terminalMap.get(name); if (!terminalValuesMap) { terminalValuesMap = new Map(); terminalMap.set(name, terminalValuesMap); } this._addTerminal(terminalValuesMap, value, selectable); } else { var /** @type {?} */ partialMap = matcher._attrValuePartialMap; var /** @type {?} */ partialValuesMap = partialMap.get(name); if (!partialValuesMap) { partialValuesMap = new Map(); partialMap.set(name, partialValuesMap); } matcher = this._addPartial(partialValuesMap, value); } } } }; /** * @param {?} map * @param {?} name * @param {?} selectable * @return {?} */ SelectorMatcher.prototype._addTerminal = function (map, name, selectable) { var /** @type {?} */ terminalList = map.get(name); if (!terminalList) { terminalList = []; map.set(name, terminalList); } terminalList.push(selectable); }; /** * @param {?} map * @param {?} name * @return {?} */ SelectorMatcher.prototype._addPartial = function (map, name) { var /** @type {?} */ matcher = map.get(name); if (!matcher) { matcher = new SelectorMatcher(); map.set(name, matcher); } return matcher; }; /** * Find the objects that have been added via `addSelectable` * whose css selector is contained in the given css selector. * @param {?} cssSelector A css selector * @param {?} matchedCallback This callback will be called with the object handed into `addSelectable` * @return {?} boolean true if a match was found */ SelectorMatcher.prototype.match = function (cssSelector, matchedCallback) { var /** @type {?} */ result = false; var /** @type {?} */ element = ((cssSelector.element)); var /** @type {?} */ classNames = cssSelector.classNames; var /** @type {?} */ attrs = cssSelector.attrs; for (var /** @type {?} */ i = 0; i < this._listContexts.length; i++) { this._listContexts[i].alreadyMatched = false; } result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result; result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) || result; if (classNames) { for (var /** @type {?} */ i = 0; i < classNames.length; i++) { var /** @type {?} */ className = classNames[i]; result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result; result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result; } } if (attrs) { for (var /** @type {?} */ i = 0; i < attrs.length; i += 2) { var /** @type {?} */ name = attrs[i]; var /** @type {?} */ value = attrs[i + 1]; var /** @type {?} */ terminalValuesMap = ((this._attrValueMap.get(name))); if (value) { result = this._matchTerminal(terminalValuesMap, '', cssSelector, matchedCallback) || result; } result = this._matchTerminal(terminalValuesMap, value, cssSelector, matchedCallback) || result; var /** @type {?} */ partialValuesMap = ((this._attrValuePartialMap.get(name))); if (value) { result = this._matchPartial(partialValuesMap, '', cssSelector, matchedCallback) || result; } result = this._matchPartial(partialValuesMap, value, cssSelector, matchedCallback) || result; } } return result; }; /** * \@internal * @param {?} map * @param {?} name * @param {?} cssSelector * @param {?} matchedCallback * @return {?} */ SelectorMatcher.prototype._matchTerminal = function (map, name, cssSelector, matchedCallback) { if (!map || typeof name !== 'string') { return false; } var /** @type {?} */ selectables = map.get(name) || []; var /** @type {?} */ starSelectables = ((map.get('*'))); if (starSelectables) { selectables = selectables.concat(starSelectables); } if (selectables.length === 0) { return false; } var /** @type {?} */ selectable; var /** @type {?} */ result = false; for (var /** @type {?} */ i = 0; i < selectables.length; i++) { selectable = selectables[i]; result = selectable.finalize(cssSelector, matchedCallback) || result; } return result; }; /** * \@internal * @param {?} map * @param {?} name * @param {?} cssSelector * @param {?} matchedCallback * @return {?} */ SelectorMatcher.prototype._matchPartial = function (map, name, cssSelector, matchedCallback) { if (!map || typeof name !== 'string') { return false; } var /** @type {?} */ nestedSelector = map.get(name); if (!nestedSelector) { return false; } // TODO(perf): get rid of recursion and measure again // TODO(perf): don't pass the whole selector into the recursion, // but only the not processed parts return nestedSelector.match(cssSelector, matchedCallback); }; return SelectorMatcher; }()); var SelectorListContext = (function () { /** * @param {?} selectors */ function SelectorListContext(selectors) { this.selectors = selectors; this.alreadyMatched = false; } return SelectorListContext; }()); var SelectorContext = (function () { /** * @param {?} selector * @param {?} cbContext * @param {?} listContext */ function SelectorContext(selector, cbContext, listContext) { this.selector = selector; this.cbContext = cbContext; this.listContext = listContext; this.notSelectors = selector.notSelectors; } /** * @param {?} cssSelector * @param {?} callback * @return {?} */ SelectorContext.prototype.finalize = function (cssSelector, callback) { var /** @type {?} */ result = true; if (this.notSelectors.length > 0 && (!this.listContext || !this.listContext.alreadyMatched)) { var /** @type {?} */ notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors); result = !notMatcher.match(cssSelector, null); } if (result && callback && (!this.listContext || !this.listContext.alreadyMatched)) { if (this.listContext) { this.listContext.alreadyMatched = true; } callback(this.selector, this.cbContext); } return result; }; return SelectorContext; }()); /** * @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 MODULE_SUFFIX = ''; var DASH_CASE_REGEXP = /-+([a-z0-9])/g; /** * @param {?} input * @return {?} */ /** * @param {?} input * @return {?} */ function dashCaseToCamelCase(input) { return input.replace(DASH_CASE_REGEXP, function () { var m = []; for (var _i = 0; _i < arguments.length; _i++) { m[_i] = arguments[_i]; } return m[1].toUpperCase(); }); } /** * @param {?} input * @param {?} defaultValues * @return {?} */ function splitAtColon(input, defaultValues) { return _splitAt(input, ':', defaultValues); } /** * @param {?} input * @param {?} defaultValues * @return {?} */ function splitAtPeriod(input, defaultValues) { return _splitAt(input, '.', defaultValues); } /** * @param {?} input * @param {?} character * @param {?} defaultValues * @return {?} */ function _splitAt(input, character, defaultValues) { var /** @type {?} */ characterIndex = input.indexOf(character); if (characterIndex == -1) return defaultValues; return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()]; } /** * @param {?} value * @param {?} visitor * @param {?} context * @return {?} */ function visitValue(value, visitor, context) { if (Array.isArray(value)) { return visitor.visitArray(/** @type {?} */ (value), context); } if (isStrictStringMap(value)) { return visitor.visitStringMap(/** @type {?} */ (value), context); } if (value == null || typeof value == 'string' || typeof value == 'number' || typeof value == 'boolean') { return visitor.visitPrimitive(value, context); } return visitor.visitOther(value, context); } /** * @param {?} val * @return {?} */ function isDefined(val) { return val !== null && val !== undefined; } /** * @template T * @param {?} val * @return {?} */ function noUndefined(val) { return val === undefined ? ((null)) : val; } var ValueTransformer = (function () { function ValueTransformer() { } /** * @param {?} arr * @param {?} context * @return {?} */ ValueTransformer.prototype.visitArray = function (arr, context) { var _this = this; return arr.map(function (value) { return visitValue(value, _this, context); }); }; /** * @param {?} map * @param {?} context * @return {?} */ ValueTransformer.prototype.visitStringMap = function (map, context) { var _this = this; var /** @type {?} */ result = {}; Object.keys(map).forEach(function (key) { result[key] = visitValue(map[key], _this, context); }); return result; }; /** * @param {?} value * @param {?} context * @return {?} */ ValueTransformer.prototype.visitPrimitive = function (value, context) { return value; }; /** * @param {?} value * @param {?} context * @return {?} */ ValueTransformer.prototype.visitOther = function (value, context) { return value; }; return ValueTransformer; }()); var SyncAsyncResult = (function () { /** * @param {?} syncResult * @param {?=} asyncResult */ function SyncAsyncResult(syncResult, asyncResult) { if (asyncResult === void 0) { asyncResult = null; } this.syncResult = syncResult; this.asyncResult = asyncResult; if (!asyncResult) { this.asyncResult = Promise.resolve(syncResult); } } return SyncAsyncResult; }()); /** * @param {?} msg * @return {?} */ function syntaxError(msg) { var /** @type {?} */ error = Error(msg); ((error))[ERROR_SYNTAX_ERROR] = true; return error; } var ERROR_SYNTAX_ERROR = 'ngSyntaxError'; /** * @param {?} error * @return {?} */ function isSyntaxError(error) { return ((error))[ERROR_SYNTAX_ERROR]; } /** * @param {?} s * @return {?} */ function escapeRegExp(s) { return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); } var STRING_MAP_PROTO = Object.getPrototypeOf({}); /** * @param {?} obj * @return {?} */ function isStrictStringMap(obj) { return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO; } /** * @param {?} str * @return {?} */ function utf8Encode(str) { var /** @type {?} */ encoded = ''; for (var /** @type {?} */ index = 0; index < str.length; index++) { var /** @type {?} */ codePoint = str.charCodeAt(index); // decode surrogate // see https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae if (codePoint >= 0xd800 && codePoint <= 0xdbff && str.length > (index + 1)) { var /** @type {?} */ low = str.charCodeAt(index + 1); if (low >= 0xdc00 && low <= 0xdfff) { index++; codePoint = ((codePoint - 0xd800) << 10) + low - 0xdc00 + 0x10000; } } if (codePoint <= 0x7f) { encoded += String.fromCharCode(codePoint); } else if (codePoint <= 0x7ff) { encoded += String.fromCharCode(((codePoint >> 6) & 0x1F) | 0xc0, (codePoint & 0x3f) | 0x80); } else if (codePoint <= 0xffff) { encoded += String.fromCharCode((codePoint >> 12) | 0xe0, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80); } else if (codePoint <= 0x1fffff) { encoded += String.fromCharCode(((codePoint >> 18) & 0x07) | 0xf0, ((codePoint >> 12) & 0x3f) | 0x80, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80); } } return encoded; } /** * @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 */ // group 0: "[prop] or (event) or @trigger" // group 1: "prop" from "[prop]" // group 2: "event" from "(event)" // group 3: "@trigger" from "@trigger" var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/; var CompileAnimationEntryMetadata = (function () { /** * @param {?=} name * @param {?=} definitions */ function CompileAnimationEntryMetadata(name, definitions) { if (name === void 0) { name = null; } if (definitions === void 0) { definitions = null; } this.name = name; this.definitions = definitions; } return CompileAnimationEntryMetadata; }()); /** * @abstract */ var CompileAnimationStateMetadata = (function () { function CompileAnimationStateMetadata() { } return CompileAnimationStateMetadata; }()); var CompileAnimationStateDeclarationMetadata = (function (_super) { __extends(CompileAnimationStateDeclarationMetadata, _super); /** * @param {?} stateNameExpr * @param {?} styles */ function CompileAnimationStateDeclarationMetadata(stateNameExpr, styles) { var _this = _super.call(this) || this; _this.stateNameExpr = stateNameExpr; _this.styles = styles; return _this; } return CompileAnimationStateDeclarationMetadata; }(CompileAnimationStateMetadata)); var CompileAnimationStateTransitionMetadata = (function (_super) { __extends(CompileAnimationStateTransitionMetadata, _super); /** * @param {?} stateChangeExpr * @param {?} steps */ function CompileAnimationStateTransitionMetadata(stateChangeExpr, steps) { var _this = _super.call(this) || this; _this.stateChangeExpr = stateChangeExpr; _this.steps = steps; return _this; } return CompileAnimationStateTransitionMetadata; }(CompileAnimationStateMetadata)); /** * @abstract */ var CompileAnimationMetadata = (function () { function CompileAnimationMetadata() { } return CompileAnimationMetadata; }()); var CompileAnimationKeyframesSequenceMetadata = (function (_super) { __extends(CompileAnimationKeyframesSequenceMetadata, _super); /** * @param {?=} steps */ function CompileAnimationKeyframesSequenceMetadata(steps) { if (steps === void 0) { steps = []; } var _this = _super.call(this) || this; _this.steps = steps; return _this; } return CompileAnimationKeyframesSequenceMetadata; }(CompileAnimationMetadata)); var CompileAnimationStyleMetadata = (function (_super) { __extends(CompileAnimationStyleMetadata, _super); /** * @param {?} offset * @param {?=} styles */ function CompileAnimationStyleMetadata(offset, styles) { if (styles === void 0) { styles = null; } var _this = _super.call(this) || this; _this.offset = offset; _this.styles = styles; return _this; } return CompileAnimationStyleMetadata; }(CompileAnimationMetadata)); var CompileAnimationAnimateMetadata = (function (_super) { __extends(CompileAnimationAnimateMetadata, _super); /** * @param {?=} timings * @param {?=} styles */ function CompileAnimationAnimateMetadata(timings, styles) { if (timings === void 0) { timings = 0; } if (styles === void 0) { styles = null; } var _this = _super.call(this) || this; _this.timings = timings; _this.styles = styles; return _this; } return CompileAnimationAnimateMetadata; }(CompileAnimationMetadata)); /** * @abstract */ var CompileAnimationWithStepsMetadata = (function (_super) { __extends(CompileAnimationWithStepsMetadata, _super); /** * @param {?=} steps */ function CompileAnimationWithStepsMetadata(steps) { if (steps === void 0) { steps = null; } var _this = _super.call(this) || this; _this.steps = steps; return _this; } return CompileAnimationWithStepsMetadata; }(CompileAnimationMetadata)); var CompileAnimationSequenceMetadata = (function (_super) { __extends(CompileAnimationSequenceMetadata, _super); /** * @param {?=} steps */ function CompileAnimationSequenceMetadata(steps) { if (steps === void 0) { steps = null; } return _super.call(this, steps) || this; } return CompileAnimationSequenceMetadata; }(CompileAnimationWithStepsMetadata)); var CompileAnimationGroupMetadata = (function (_super) { __extends(CompileAnimationGroupMetadata, _super); /** * @param {?=} steps */ function CompileAnimationGroupMetadata(steps) { if (steps === void 0) { steps = null; } return _super.call(this, steps) || this; } return CompileAnimationGroupMetadata; }(CompileAnimationWithStepsMetadata)); /** * @param {?} name * @return {?} */ function _sanitizeIdentifier(name) { return name.replace(/\W/g, '_'); } var _anonymousTypeIndex = 0; /** * @param {?} compileIdentifier * @return {?} */ function identifierName(compileIdentifier) { if (!compileIdentifier || !compileIdentifier.reference) { return null; } var /** @type {?} */ ref = compileIdentifier.reference; if (ref instanceof StaticSymbol) { return ref.name; } if (ref['__anonymousType']) { return ref['__anonymousType']; } var /** @type {?} */ identifier = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["K" /* ɵstringify */])(ref); if (identifier.indexOf('(') >= 0) { // case: anonymous functions! identifier = "anonymous_" + _anonymousTypeIndex++; ref['__anonymousType'] = identifier; } else { identifier = _sanitizeIdentifier(identifier); } return identifier; } /** * @param {?} compileIdentifier * @return {?} */ function identifierModuleUrl(compileIdentifier) { var /** @type {?} */ ref = compileIdentifier.reference; if (ref instanceof StaticSymbol) { return ref.filePath; } return __WEBPACK_IMPORTED_MODULE_0__angular_core__["_23" /* ɵreflector */].importUri(ref); } /** * @param {?} compType * @param {?} embeddedTemplateIndex * @return {?} */ function viewClassName(compType, embeddedTemplateIndex) { return "View_" + identifierName({ reference: compType }) + "_" + embeddedTemplateIndex; } /** * @param {?} compType * @return {?} */ function rendererTypeName(compType) { return "RenderType_" + identifierName({ reference: compType }); } /** * @param {?} compType * @return {?} */ function hostViewClassName(compType) { return "HostView_" + identifierName({ reference: compType }); } /** * @param {?} dirType * @return {?} */ function dirWrapperClassName(dirType) { return "Wrapper_" + identifierName({ reference: dirType }); } /** * @param {?} compType * @return {?} */ function componentFactoryName(compType) { return identifierName({ reference: compType }) + "NgFactory"; } var CompileSummaryKind = {}; CompileSummaryKind.Pipe = 0; CompileSummaryKind.Directive = 1; CompileSummaryKind.NgModule = 2; CompileSummaryKind.Injectable = 3; CompileSummaryKind[CompileSummaryKind.Pipe] = "Pipe"; CompileSummaryKind[CompileSummaryKind.Directive] = "Directive"; CompileSummaryKind[CompileSummaryKind.NgModule] = "NgModule"; CompileSummaryKind[CompileSummaryKind.Injectable] = "Injectable"; /** * @param {?} token * @return {?} */ function tokenName(token) { return token.value != null ? _sanitizeIdentifier(token.value) : identifierName(token.identifier); } /** * @param {?} token * @return {?} */ function tokenReference(token) { if (token.identifier != null) { return token.identifier.reference; } else { return token.value; } } /** * Metadata about a stylesheet */ var CompileStylesheetMetadata = (function () { /** * @param {?=} __0 */ function CompileStylesheetMetadata(_a) { var _b = _a === void 0 ? {} : _a, moduleUrl = _b.moduleUrl, styles = _b.styles, styleUrls = _b.styleUrls; this.moduleUrl = moduleUrl || null; this.styles = _normalizeArray(styles); this.styleUrls = _normalizeArray(styleUrls); } return CompileStylesheetMetadata; }()); /** * Metadata regarding compilation of a template. */ var CompileTemplateMetadata = (function () { /** * @param {?} __0 */ function CompileTemplateMetadata(_a) { var encapsulation = _a.encapsulation, template = _a.template, templateUrl = _a.templateUrl, styles = _a.styles, styleUrls = _a.styleUrls, externalStylesheets = _a.externalStylesheets, animations = _a.animations, ngContentSelectors = _a.ngContentSelectors, interpolation = _a.interpolation, isInline = _a.isInline; this.encapsulation = encapsulation; this.template = template; this.templateUrl = templateUrl; this.styles = _normalizeArray(styles); this.styleUrls = _normalizeArray(styleUrls); this.externalStylesheets = _normalizeArray(externalStylesheets); this.animations = animations ? flatten(animations) : []; this.ngContentSelectors = ngContentSelectors || []; if (interpolation && interpolation.length != 2) { throw new Error("'interpolation' should have a start and an end symbol."); } this.interpolation = interpolation; this.isInline = isInline; } /** * @return {?} */ CompileTemplateMetadata.prototype.toSummary = function () { return { animations: this.animations.map(function (anim) { return anim.name; }), ngContentSelectors: this.ngContentSelectors, encapsulation: this.encapsulation, }; }; return CompileTemplateMetadata; }()); /** * Metadata regarding compilation of a directive. */ var CompileDirectiveMetadata = (function () { /** * @param {?} __0 */ function CompileDirectiveMetadata(_a) { var isHost = _a.isHost, type = _a.type, isComponent = _a.isComponent, selector = _a.selector, exportAs = _a.exportAs, changeDetection = _a.changeDetection, inputs = _a.inputs, outputs = _a.outputs, hostListeners = _a.hostListeners, hostProperties = _a.hostProperties, hostAttributes = _a.hostAttributes, providers = _a.providers, viewProviders = _a.viewProviders, queries = _a.queries, viewQueries = _a.viewQueries, entryComponents = _a.entryComponents, template = _a.template, componentViewType = _a.componentViewType, rendererType = _a.rendererType, componentFactory = _a.componentFactory; this.isHost = !!isHost; this.type = type; this.isComponent = isComponent; this.selector = selector; this.exportAs = exportAs; this.changeDetection = changeDetection; this.inputs = inputs; this.outputs = outputs; this.hostListeners = hostListeners; this.hostProperties = hostProperties; this.hostAttributes = hostAttributes; this.providers = _normalizeArray(providers); this.viewProviders = _normalizeArray(viewProviders); this.queries = _normalizeArray(queries); this.viewQueries = _normalizeArray(viewQueries); this.entryComponents = _normalizeArray(entryComponents); this.template = template; this.componentViewType = componentViewType; this.rendererType = rendererType; this.componentFactory = componentFactory; } /** * @param {?} __0 * @return {?} */ CompileDirectiveMetadata.create = function (_a) { var isHost = _a.isHost, type = _a.type, isComponent = _a.isComponent, selector = _a.selector, exportAs = _a.exportAs, changeDetection = _a.changeDetection, inputs = _a.inputs, outputs = _a.outputs, host = _a.host, providers = _a.providers, viewProviders = _a.viewProviders, queries = _a.queries, viewQueries = _a.viewQueries, entryComponents = _a.entryComponents, template = _a.template, componentViewType = _a.componentViewType, rendererType = _a.rendererType, componentFactory = _a.componentFactory; var /** @type {?} */ hostListeners = {}; var /** @type {?} */ hostProperties = {}; var /** @type {?} */ hostAttributes = {}; if (host != null) { Object.keys(host).forEach(function (key) { var /** @type {?} */ value = host[key]; var /** @type {?} */ matches = key.match(HOST_REG_EXP); if (matches === null) { hostAttributes[key] = value; } else if (matches[1] != null) { hostProperties[matches[1]] = value; } else if (matches[2] != null) { hostListeners[matches[2]] = value; } }); } var /** @type {?} */ inputsMap = {}; if (inputs != null) { inputs.forEach(function (bindConfig) { // canonical syntax: `dirProp: elProp` // if there is no `:`, use dirProp = elProp var /** @type {?} */ parts = splitAtColon(bindConfig, [bindConfig, bindConfig]); inputsMap[parts[0]] = parts[1]; }); } var /** @type {?} */ outputsMap = {}; if (outputs != null) { outputs.forEach(function (bindConfig) { // canonical syntax: `dirProp: elProp` // if there is no `:`, use dirProp = elProp var /** @type {?} */ parts = splitAtColon(bindConfig, [bindConfig, bindConfig]); outputsMap[parts[0]] = parts[1]; }); } return new CompileDirectiveMetadata({ isHost: isHost, type: type, isComponent: !!isComponent, selector: selector, exportAs: exportAs, changeDetection: changeDetection, inputs: inputsMap, outputs: outputsMap, hostListeners: hostListeners, hostProperties: hostProperties, hostAttributes: hostAttributes, providers: providers, viewProviders: viewProviders, queries: queries, viewQueries: viewQueries, entryComponents: entryComponents, template: template, componentViewType: componentViewType, rendererType: rendererType, componentFactory: componentFactory, }); }; /** * @return {?} */ CompileDirectiveMetadata.prototype.toSummary = function () { return { summaryKind: CompileSummaryKind.Directive, type: this.type, isComponent: this.isComponent, selector: this.selector, exportAs: this.exportAs, inputs: this.inputs, outputs: this.outputs, hostListeners: this.hostListeners, hostProperties: this.hostProperties, hostAttributes: this.hostAttributes, providers: this.providers, viewProviders: this.viewProviders, queries: this.queries, viewQueries: this.viewQueries, entryComponents: this.entryComponents, changeDetection: this.changeDetection, template: this.template && this.template.toSummary(), componentViewType: this.componentViewType, rendererType: this.rendererType, componentFactory: this.componentFactory }; }; return CompileDirectiveMetadata; }()); /** * Construct {\@link CompileDirectiveMetadata} from {\@link ComponentTypeMetadata} and a selector. * @param {?} hostTypeReference * @param {?} compMeta * @param {?} hostViewType * @return {?} */ function createHostComponentMeta(hostTypeReference, compMeta, hostViewType) { var /** @type {?} */ template = CssSelector.parse(/** @type {?} */ ((compMeta.selector)))[0].getMatchingElementTemplate(); return CompileDirectiveMetadata.create({ isHost: true, type: { reference: hostTypeReference, diDeps: [], lifecycleHooks: [] }, template: new CompileTemplateMetadata({ encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* ViewEncapsulation */].None, template: template, templateUrl: '', styles: [], styleUrls: [], ngContentSelectors: [], animations: [], isInline: true, externalStylesheets: [], interpolation: null }), exportAs: null, changeDetection: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_6" /* ChangeDetectionStrategy */].Default, inputs: [], outputs: [], host: {}, isComponent: true, selector: '*', providers: [], viewProviders: [], queries: [], viewQueries: [], componentViewType: hostViewType, rendererType: { id: '__Host__', encapsulation: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* ViewEncapsulation */].None, styles: [], data: {} }, entryComponents: [], componentFactory: null }); } var CompilePipeMetadata = (function () { /** * @param {?} __0 */ function CompilePipeMetadata(_a) { var type = _a.type, name = _a.name, pure = _a.pure; this.type = type; this.name = name; this.pure = !!pure; } /** * @return {?} */ CompilePipeMetadata.prototype.toSummary = function () { return { summaryKind: CompileSummaryKind.Pipe, type: this.type, name: this.name, pure: this.pure }; }; return CompilePipeMetadata; }()); /** * Metadata regarding compilation of a module. */ var CompileNgModuleMetadata = (function () { /** * @param {?} __0 */ function CompileNgModuleMetadata(_a) { var type = _a.type, providers = _a.providers, declaredDirectives = _a.declaredDirectives, exportedDirectives = _a.exportedDirectives, declaredPipes = _a.declaredPipes, exportedPipes = _a.exportedPipes, entryComponents = _a.entryComponents, bootstrapComponents = _a.bootstrapComponents, importedModules = _a.importedModules, exportedModules = _a.exportedModules, schemas = _a.schemas, transitiveModule = _a.transitiveModule, id = _a.id; this.type = type || null; this.declaredDirectives = _normalizeArray(declaredDirectives); this.exportedDirectives = _normalizeArray(exportedDirectives); this.declaredPipes = _normalizeArray(declaredPipes); this.exportedPipes = _normalizeArray(exportedPipes); this.providers = _normalizeArray(providers); this.entryComponents = _normalizeArray(entryComponents); this.bootstrapComponents = _normalizeArray(bootstrapComponents); this.importedModules = _normalizeArray(importedModules); this.exportedModules = _normalizeArray(exportedModules); this.schemas = _normalizeArray(schemas); this.id = id || null; this.transitiveModule = transitiveModule || null; } /** * @return {?} */ CompileNgModuleMetadata.prototype.toSummary = function () { var /** @type {?} */ module = ((this.transitiveModule)); return { summaryKind: CompileSummaryKind.NgModule, type: this.type, entryComponents: module.entryComponents, providers: module.providers, modules: module.modules, exportedDirectives: module.exportedDirectives, exportedPipes: module.exportedPipes }; }; return CompileNgModuleMetadata; }()); var TransitiveCompileNgModuleMetadata = (function () { function TransitiveCompileNgModuleMetadata() { this.directivesSet = new Set(); this.directives = []; this.exportedDirectivesSet = new Set(); this.exportedDirectives = []; this.pipesSet = new Set(); this.pipes = []; this.exportedPipesSet = new Set(); this.exportedPipes = []; this.modulesSet = new Set(); this.modules = []; this.entryComponentsSet = new Set(); this.entryComponents = []; this.providers = []; } /** * @param {?} provider * @param {?} module * @return {?} */ TransitiveCompileNgModuleMetadata.prototype.addProvider = function (provider, module) { this.providers.push({ provider: provider, module: module }); }; /** * @param {?} id * @return {?} */ TransitiveCompileNgModuleMetadata.prototype.addDirective = function (id) { if (!this.directivesSet.has(id.reference)) { this.directivesSet.add(id.reference); this.directives.push(id); } }; /** * @param {?} id * @return {?} */ TransitiveCompileNgModuleMetadata.prototype.addExportedDirective = function (id) { if (!this.exportedDirectivesSet.has(id.reference)) { this.exportedDirectivesSet.add(id.reference); this.exportedDirectives.push(id); } }; /** * @param {?} id * @return {?} */ TransitiveCompileNgModuleMetadata.prototype.addPipe = function (id) { if (!this.pipesSet.has(id.reference)) { this.pipesSet.add(id.reference); this.pipes.push(id); } }; /** * @param {?} id * @return {?} */ TransitiveCompileNgModuleMetadata.prototype.addExportedPipe = function (id) { if (!this.exportedPipesSet.has(id.reference)) { this.exportedPipesSet.add(id.reference); this.exportedPipes.push(id); } }; /** * @param {?} id * @return {?} */ TransitiveCompileNgModuleMetadata.prototype.addModule = function (id) { if (!this.modulesSet.has(id.reference)) { this.modulesSet.add(id.reference); this.modules.push(id); } }; /** * @param {?} ec * @return {?} */ TransitiveCompileNgModuleMetadata.prototype.addEntryComponent = function (ec) { if (!this.entryComponentsSet.has(ec.componentType)) { this.entryComponentsSet.add(ec.componentType); this.entryComponents.push(ec); } }; return TransitiveCompileNgModuleMetadata; }()); /** * @param {?} obj * @return {?} */ function _normalizeArray(obj) { return obj || []; } var ProviderMeta = (function () { /** * @param {?} token * @param {?} __1 */ function ProviderMeta(token, _a) { var useClass = _a.useClass, useValue = _a.useValue, useExisting = _a.useExisting, useFactory = _a.useFactory, deps = _a.deps, multi = _a.multi; this.token = token; this.useClass = useClass || null; this.useValue = useValue; this.useExisting = useExisting; this.useFactory = useFactory || null; this.dependencies = deps || null; this.multi = !!multi; } return ProviderMeta; }()); /** * @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); }, []); } /** * @param {?} url * @return {?} */ function sourceUrl(url) { // Note: We need 3 "/" so that ng shows up as a separate domain // in the chrome dev tools. return url.replace(/(\w+:\/\/[\w:-]+)?(\/+)?/, 'ng:///'); } /** * @param {?} ngModuleType * @param {?} compMeta * @param {?} templateMeta * @return {?} */ function templateSourceUrl(ngModuleType, compMeta, templateMeta) { var /** @type {?} */ url; if (templateMeta.isInline) { if (compMeta.type.reference instanceof StaticSymbol) { // Note: a .ts file might contain multiple components with inline templates, // so we need to give them unique urls, as these will be used for sourcemaps. url = compMeta.type.reference.filePath + "." + compMeta.type.reference.name + ".html"; } else { url = identifierName(ngModuleType) + "/" + identifierName(compMeta.type) + ".html"; } } else { url = ((templateMeta.templateUrl)); } // always prepend ng:// to make angular resources easy to find and not clobber // user resources. return sourceUrl(url); } /** * @param {?} meta * @param {?} id * @return {?} */ function sharedStylesheetJitUrl(meta, id) { var /** @type {?} */ pathParts = ((meta.moduleUrl)).split(/\/\\/g); var /** @type {?} */ baseName = pathParts[pathParts.length - 1]; return sourceUrl("css/" + id + baseName + ".ngstyle.js"); } /** * @param {?} moduleMeta * @return {?} */ function ngModuleJitUrl(moduleMeta) { return sourceUrl(identifierName(moduleMeta.type) + "/module.ngfactory.js"); } /** * @param {?} ngModuleType * @param {?} compMeta * @return {?} */ function templateJitUrl(ngModuleType, compMeta) { return sourceUrl(identifierName(ngModuleType) + "/" + identifierName(compMeta.type) + ".ngfactory.js"); } /** * @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 CompilerConfig = (function () { /** * @param {?=} __0 */ function CompilerConfig(_a) { var _b = _a === void 0 ? {} : _a, _c = _b.defaultEncapsulation, defaultEncapsulation = _c === void 0 ? __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* ViewEncapsulation */].Emulated : _c, _d = _b.useJit, useJit = _d === void 0 ? true : _d, missingTranslation = _b.missingTranslation, enableLegacyTemplate = _b.enableLegacyTemplate; this.defaultEncapsulation = defaultEncapsulation; this.useJit = !!useJit; this.missingTranslation = missingTranslation || null; this.enableLegacyTemplate = enableLegacyTemplate !== false; } return CompilerConfig; }()); /** * @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 ParserError = (function () { /** * @param {?} message * @param {?} input * @param {?} errLocation * @param {?=} ctxLocation */ function ParserError(message, input, errLocation, ctxLocation) { this.input = input; this.errLocation = errLocation; this.ctxLocation = ctxLocation; this.message = "Parser Error: " + message + " " + errLocation + " [" + input + "] in " + ctxLocation; } return ParserError; }()); var ParseSpan = (function () { /** * @param {?} start * @param {?} end */ function ParseSpan(start, end) { this.start = start; this.end = end; } return ParseSpan; }()); var AST = (function () { /** * @param {?} span */ function AST(span) { this.span = span; } /** * @param {?} visitor * @param {?=} context * @return {?} */ AST.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return null; }; /** * @return {?} */ AST.prototype.toString = function () { return 'AST'; }; return AST; }()); /** * Represents a quoted expression of the form: * * quote = prefix `:` uninterpretedExpression * prefix = identifier * uninterpretedExpression = arbitrary string * * A quoted expression is meant to be pre-processed by an AST transformer that * converts it into another AST that no longer contains quoted expressions. * It is meant to allow third-party developers to extend Angular template * expression language. The `uninterpretedExpression` part of the quote is * therefore not interpreted by the Angular's own expression parser. */ var Quote = (function (_super) { __extends(Quote, _super); /** * @param {?} span * @param {?} prefix * @param {?} uninterpretedExpression * @param {?} location */ function Quote(span, prefix, uninterpretedExpression, location) { var _this = _super.call(this, span) || this; _this.prefix = prefix; _this.uninterpretedExpression = uninterpretedExpression; _this.location = location; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ Quote.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitQuote(this, context); }; /** * @return {?} */ Quote.prototype.toString = function () { return 'Quote'; }; return Quote; }(AST)); var EmptyExpr = (function (_super) { __extends(EmptyExpr, _super); function EmptyExpr() { return _super !== null && _super.apply(this, arguments) || this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ EmptyExpr.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } // do nothing }; return EmptyExpr; }(AST)); var ImplicitReceiver = (function (_super) { __extends(ImplicitReceiver, _super); function ImplicitReceiver() { return _super !== null && _super.apply(this, arguments) || this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ ImplicitReceiver.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitImplicitReceiver(this, context); }; return ImplicitReceiver; }(AST)); /** * Multiple expressions separated by a semicolon. */ var Chain = (function (_super) { __extends(Chain, _super); /** * @param {?} span * @param {?} expressions */ function Chain(span, expressions) { var _this = _super.call(this, span) || this; _this.expressions = expressions; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ Chain.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitChain(this, context); }; return Chain; }(AST)); var Conditional = (function (_super) { __extends(Conditional, _super); /** * @param {?} span * @param {?} condition * @param {?} trueExp * @param {?} falseExp */ function Conditional(span, condition, trueExp, falseExp) { var _this = _super.call(this, span) || this; _this.condition = condition; _this.trueExp = trueExp; _this.falseExp = falseExp; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ Conditional.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitConditional(this, context); }; return Conditional; }(AST)); var PropertyRead = (function (_super) { __extends(PropertyRead, _super); /** * @param {?} span * @param {?} receiver * @param {?} name */ function PropertyRead(span, receiver, name) { var _this = _super.call(this, span) || this; _this.receiver = receiver; _this.name = name; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ PropertyRead.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitPropertyRead(this, context); }; return PropertyRead; }(AST)); var PropertyWrite = (function (_super) { __extends(PropertyWrite, _super); /** * @param {?} span * @param {?} receiver * @param {?} name * @param {?} value */ function PropertyWrite(span, receiver, name, value) { var _this = _super.call(this, span) || this; _this.receiver = receiver; _this.name = name; _this.value = value; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ PropertyWrite.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitPropertyWrite(this, context); }; return PropertyWrite; }(AST)); var SafePropertyRead = (function (_super) { __extends(SafePropertyRead, _super); /** * @param {?} span * @param {?} receiver * @param {?} name */ function SafePropertyRead(span, receiver, name) { var _this = _super.call(this, span) || this; _this.receiver = receiver; _this.name = name; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ SafePropertyRead.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitSafePropertyRead(this, context); }; return SafePropertyRead; }(AST)); var KeyedRead = (function (_super) { __extends(KeyedRead, _super); /** * @param {?} span * @param {?} obj * @param {?} key */ function KeyedRead(span, obj, key) { var _this = _super.call(this, span) || this; _this.obj = obj; _this.key = key; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ KeyedRead.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitKeyedRead(this, context); }; return KeyedRead; }(AST)); var KeyedWrite = (function (_super) { __extends(KeyedWrite, _super); /** * @param {?} span * @param {?} obj * @param {?} key * @param {?} value */ function KeyedWrite(span, obj, key, value) { var _this = _super.call(this, span) || this; _this.obj = obj; _this.key = key; _this.value = value; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ KeyedWrite.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitKeyedWrite(this, context); }; return KeyedWrite; }(AST)); var BindingPipe = (function (_super) { __extends(BindingPipe, _super); /** * @param {?} span * @param {?} exp * @param {?} name * @param {?} args */ function BindingPipe(span, exp, name, args) { var _this = _super.call(this, span) || this; _this.exp = exp; _this.name = name; _this.args = args; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ BindingPipe.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitPipe(this, context); }; return BindingPipe; }(AST)); var LiteralPrimitive = (function (_super) { __extends(LiteralPrimitive, _super); /** * @param {?} span * @param {?} value */ function LiteralPrimitive(span, value) { var _this = _super.call(this, span) || this; _this.value = value; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ LiteralPrimitive.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitLiteralPrimitive(this, context); }; return LiteralPrimitive; }(AST)); var LiteralArray = (function (_super) { __extends(LiteralArray, _super); /** * @param {?} span * @param {?} expressions */ function LiteralArray(span, expressions) { var _this = _super.call(this, span) || this; _this.expressions = expressions; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ LiteralArray.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitLiteralArray(this, context); }; return LiteralArray; }(AST)); var LiteralMap = (function (_super) { __extends(LiteralMap, _super); /** * @param {?} span * @param {?} keys * @param {?} values */ function LiteralMap(span, keys, values) { var _this = _super.call(this, span) || this; _this.keys = keys; _this.values = values; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ LiteralMap.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitLiteralMap(this, context); }; return LiteralMap; }(AST)); var Interpolation = (function (_super) { __extends(Interpolation, _super); /** * @param {?} span * @param {?} strings * @param {?} expressions */ function Interpolation(span, strings, expressions) { var _this = _super.call(this, span) || this; _this.strings = strings; _this.expressions = expressions; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ Interpolation.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitInterpolation(this, context); }; return Interpolation; }(AST)); var Binary = (function (_super) { __extends(Binary, _super); /** * @param {?} span * @param {?} operation * @param {?} left * @param {?} right */ function Binary(span, operation, left, right) { var _this = _super.call(this, span) || this; _this.operation = operation; _this.left = left; _this.right = right; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ Binary.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitBinary(this, context); }; return Binary; }(AST)); var PrefixNot = (function (_super) { __extends(PrefixNot, _super); /** * @param {?} span * @param {?} expression */ function PrefixNot(span, expression) { var _this = _super.call(this, span) || this; _this.expression = expression; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ PrefixNot.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitPrefixNot(this, context); }; return PrefixNot; }(AST)); var MethodCall = (function (_super) { __extends(MethodCall, _super); /** * @param {?} span * @param {?} receiver * @param {?} name * @param {?} args */ function MethodCall(span, receiver, name, args) { var _this = _super.call(this, span) || this; _this.receiver = receiver; _this.name = name; _this.args = args; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ MethodCall.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitMethodCall(this, context); }; return MethodCall; }(AST)); var SafeMethodCall = (function (_super) { __extends(SafeMethodCall, _super); /** * @param {?} span * @param {?} receiver * @param {?} name * @param {?} args */ function SafeMethodCall(span, receiver, name, args) { var _this = _super.call(this, span) || this; _this.receiver = receiver; _this.name = name; _this.args = args; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ SafeMethodCall.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitSafeMethodCall(this, context); }; return SafeMethodCall; }(AST)); var FunctionCall = (function (_super) { __extends(FunctionCall, _super); /** * @param {?} span * @param {?} target * @param {?} args */ function FunctionCall(span, target, args) { var _this = _super.call(this, span) || this; _this.target = target; _this.args = args; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ FunctionCall.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return visitor.visitFunctionCall(this, context); }; return FunctionCall; }(AST)); var ASTWithSource = (function (_super) { __extends(ASTWithSource, _super); /** * @param {?} ast * @param {?} source * @param {?} location * @param {?} errors */ function ASTWithSource(ast, source, location, errors) { var _this = _super.call(this, new ParseSpan(0, source == null ? 0 : source.length)) || this; _this.ast = ast; _this.source = source; _this.location = location; _this.errors = errors; return _this; } /** * @param {?} visitor * @param {?=} context * @return {?} */ ASTWithSource.prototype.visit = function (visitor, context) { if (context === void 0) { context = null; } return this.ast.visit(visitor, context); }; /** * @return {?} */ ASTWithSource.prototype.toString = function () { return this.source + " in " + this.location; }; return ASTWithSource; }(AST)); var TemplateBinding = (function () { /** * @param {?} span * @param {?} key * @param {?} keyIsVar * @param {?} name * @param {?} expression */ function TemplateBinding(span, key, keyIsVar, name, expression) { this.span = span; this.key = key; this.keyIsVar = keyIsVar; this.name = name; this.expression = expression; } return TemplateBinding; }()); var RecursiveAstVisitor = (function () { function RecursiveAstVisitor() { } /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitBinary = function (ast, context) { ast.left.visit(this); ast.right.visit(this); return null; }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitChain = function (ast, context) { return this.visitAll(ast.expressions, context); }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitConditional = function (ast, context) { ast.condition.visit(this); ast.trueExp.visit(this); ast.falseExp.visit(this); return null; }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitPipe = function (ast, context) { ast.exp.visit(this); this.visitAll(ast.args, context); return null; }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitFunctionCall = function (ast, context) { ((ast.target)).visit(this); this.visitAll(ast.args, context); return null; }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitImplicitReceiver = function (ast, context) { return null; }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitInterpolation = function (ast, context) { return this.visitAll(ast.expressions, context); }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitKeyedRead = function (ast, context) { ast.obj.visit(this); ast.key.visit(this); return null; }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitKeyedWrite = function (ast, context) { ast.obj.visit(this); ast.key.visit(this); ast.value.visit(this); return null; }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitLiteralArray = function (ast, context) { return this.visitAll(ast.expressions, context); }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitLiteralMap = function (ast, context) { return this.visitAll(ast.values, context); }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitLiteralPrimitive = function (ast, context) { return null; }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitMethodCall = function (ast, context) { ast.receiver.visit(this); return this.visitAll(ast.args, context); }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitPrefixNot = function (ast, context) { ast.expression.visit(this); return null; }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitPropertyRead = function (ast, context) { ast.receiver.visit(this); return null; }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitPropertyWrite = function (ast, context) { ast.receiver.visit(this); ast.value.visit(this); return null; }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitSafePropertyRead = function (ast, context) { ast.receiver.visit(this); return null; }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitSafeMethodCall = function (ast, context) { ast.receiver.visit(this); return this.visitAll(ast.args, context); }; /** * @param {?} asts * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitAll = function (asts, context) { var _this = this; asts.forEach(function (ast) { return ast.visit(_this, context); }); return null; }; /** * @param {?} ast * @param {?} context * @return {?} */ RecursiveAstVisitor.prototype.visitQuote = function (ast, context) { return null; }; return RecursiveAstVisitor; }()); var AstTransformer = (function () { function AstTransformer() { } /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitImplicitReceiver = function (ast, context) { return ast; }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitInterpolation = function (ast, context) { return new Interpolation(ast.span, ast.strings, this.visitAll(ast.expressions)); }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitLiteralPrimitive = function (ast, context) { return new LiteralPrimitive(ast.span, ast.value); }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitPropertyRead = function (ast, context) { return new PropertyRead(ast.span, ast.receiver.visit(this), ast.name); }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitPropertyWrite = function (ast, context) { return new PropertyWrite(ast.span, ast.receiver.visit(this), ast.name, ast.value.visit(this)); }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitSafePropertyRead = function (ast, context) { return new SafePropertyRead(ast.span, ast.receiver.visit(this), ast.name); }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitMethodCall = function (ast, context) { return new MethodCall(ast.span, ast.receiver.visit(this), ast.name, this.visitAll(ast.args)); }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitSafeMethodCall = function (ast, context) { return new SafeMethodCall(ast.span, ast.receiver.visit(this), ast.name, this.visitAll(ast.args)); }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitFunctionCall = function (ast, context) { return new FunctionCall(ast.span, /** @type {?} */ ((ast.target)).visit(this), this.visitAll(ast.args)); }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitLiteralArray = function (ast, context) { return new LiteralArray(ast.span, this.visitAll(ast.expressions)); }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitLiteralMap = function (ast, context) { return new LiteralMap(ast.span, ast.keys, this.visitAll(ast.values)); }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitBinary = function (ast, context) { return new Binary(ast.span, ast.operation, ast.left.visit(this), ast.right.visit(this)); }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitPrefixNot = function (ast, context) { return new PrefixNot(ast.span, ast.expression.visit(this)); }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitConditional = function (ast, context) { return new Conditional(ast.span, ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this)); }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitPipe = function (ast, context) { return new BindingPipe(ast.span, ast.exp.visit(this), ast.name, this.visitAll(ast.args)); }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitKeyedRead = function (ast, context) { return new KeyedRead(ast.span, ast.obj.visit(this), ast.key.visit(this)); }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitKeyedWrite = function (ast, context) { return new KeyedWrite(ast.span, ast.obj.visit(this), ast.key.visit(this), ast.value.visit(this)); }; /** * @param {?} asts * @return {?} */ AstTransformer.prototype.visitAll = function (asts) { var /** @type {?} */ res = new Array(asts.length); for (var /** @type {?} */ i = 0; i < asts.length; ++i) { res[i] = asts[i].visit(this); } return res; }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitChain = function (ast, context) { return new Chain(ast.span, this.visitAll(ast.expressions)); }; /** * @param {?} ast * @param {?} context * @return {?} */ AstTransformer.prototype.visitQuote = function (ast, context) { return new Quote(ast.span, ast.prefix, ast.uninterpretedExpression, ast.location); }; return AstTransformer; }()); /** * @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 $EOF = 0; var $TAB = 9; var $LF = 10; var $VTAB = 11; var $FF = 12; var $CR = 13; var $SPACE = 32; var $BANG = 33; var $DQ = 34; var $HASH = 35; var $$ = 36; var $PERCENT = 37; var $AMPERSAND = 38; var $SQ = 39; var $LPAREN = 40; var $RPAREN = 41; var $STAR = 42; var $PLUS = 43; var $COMMA = 44; var $MINUS = 45; var $PERIOD = 46; var $SLASH = 47; var $COLON = 58; var $SEMICOLON = 59; var $LT = 60; var $EQ = 61; var $GT = 62; var $QUESTION = 63; var $0 = 48; var $9 = 57; var $A = 65; var $E = 69; var $F = 70; var $X = 88; var $Z = 90; var $LBRACKET = 91; var $BACKSLASH = 92; var $RBRACKET = 93; var $CARET = 94; var $_ = 95; var $a = 97; var $e = 101; var $f = 102; var $n = 110; var $r = 114; var $t = 116; var $u = 117; var $v = 118; var $x = 120; var $z = 122; var $LBRACE = 123; var $BAR = 124; var $RBRACE = 125; var $NBSP = 160; var $BT = 96; /** * @param {?} code * @return {?} */ function isWhitespace(code) { return (code >= $TAB && code <= $SPACE) || (code == $NBSP); } /** * @param {?} code * @return {?} */ function isDigit(code) { return $0 <= code && code <= $9; } /** * @param {?} code * @return {?} */ function isAsciiLetter(code) { return code >= $a && code <= $z || code >= $A && code <= $Z; } /** * @param {?} code * @return {?} */ function isAsciiHexDigit(code) { return code >= $a && code <= $f || code >= $A && code <= $F || isDigit(code); } /** * A replacement for \@Injectable to be used in the compiler, so that * we don't try to evaluate the metadata in the compiler during AoT. * This decorator is enough to make the compiler work with the ReflectiveInjector though. * \@Annotation * @return {?} */ function CompilerInjectable() { return function (x) { return x; }; } /** * @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 {?} identifier * @param {?} value * @return {?} */ function assertArrayOfStrings(identifier, value) { if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["u" /* isDevMode */])() || value == null) { return; } if (!Array.isArray(value)) { throw new Error("Expected '" + identifier + "' to be an array of strings."); } for (var /** @type {?} */ i = 0; i < value.length; i += 1) { if (typeof value[i] !== 'string') { throw new Error("Expected '" + identifier + "' to be an array of strings."); } } } var INTERPOLATION_BLACKLIST_REGEXPS = [ /^\s*$/, /[<>]/, /^[{}]$/, /&(#|[a-z])/i, /^\/\//, ]; /** * @param {?} identifier * @param {?} value * @return {?} */ function assertInterpolationSymbols(identifier, value) { if (value != null && !(Array.isArray(value) && value.length == 2)) { throw new Error("Expected '" + identifier + "' to be an array, [start, end]."); } else if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["u" /* isDevMode */])() && value != null) { var /** @type {?} */ start_1 = (value[0]); var /** @type {?} */ end_1 = (value[1]); // black list checking INTERPOLATION_BLACKLIST_REGEXPS.forEach(function (regexp) { if (regexp.test(start_1) || regexp.test(end_1)) { throw new Error("['" + start_1 + "', '" + end_1 + "'] contains unusable interpolation symbol."); } }); } } /** * @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 InterpolationConfig = (function () { /** * @param {?} start * @param {?} end */ function InterpolationConfig(start, end) { this.start = start; this.end = end; } /** * @param {?} markers * @return {?} */ InterpolationConfig.fromArray = function (markers) { if (!markers) { return DEFAULT_INTERPOLATION_CONFIG; } assertInterpolationSymbols('interpolation', markers); return new InterpolationConfig(markers[0], markers[1]); }; ; return InterpolationConfig; }()); var DEFAULT_INTERPOLATION_CONFIG = new InterpolationConfig('{{', '}}'); /** * @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 TokenType = {}; TokenType.Character = 0; TokenType.Identifier = 1; TokenType.Keyword = 2; TokenType.String = 3; TokenType.Operator = 4; TokenType.Number = 5; TokenType.Error = 6; TokenType[TokenType.Character] = "Character"; TokenType[TokenType.Identifier] = "Identifier"; TokenType[TokenType.Keyword] = "Keyword"; TokenType[TokenType.String] = "String"; TokenType[TokenType.Operator] = "Operator"; TokenType[TokenType.Number] = "Number"; TokenType[TokenType.Error] = "Error"; var KEYWORDS = ['var', 'let', 'as', 'null', 'undefined', 'true', 'false', 'if', 'else', 'this']; var Lexer = (function () { function Lexer() { } /** * @param {?} text * @return {?} */ Lexer.prototype.tokenize = function (text) { var /** @type {?} */ scanner = new _Scanner(text); var /** @type {?} */ tokens = []; var /** @type {?} */ token = scanner.scanToken(); while (token != null) { tokens.push(token); token = scanner.scanToken(); } return tokens; }; return Lexer; }()); Lexer.decorators = [ { type: CompilerInjectable }, ]; /** * @nocollapse */ Lexer.ctorParameters = function () { return []; }; var Token = (function () { /** * @param {?} index * @param {?} type * @param {?} numValue * @param {?} strValue */ function Token(index, type, numValue, strValue) { this.index = index; this.type = type; this.numValue = numValue; this.strValue = strValue; } /** * @param {?} code * @return {?} */ Token.prototype.isCharacter = function (code) { return this.type == TokenType.Character && this.numValue == code; }; /** * @return {?} */ Token.prototype.isNumber = function () { return this.type == TokenType.Number; }; /** * @return {?} */ Token.prototype.isString = function () { return this.type == TokenType.String; }; /** * @param {?} operater * @return {?} */ Token.prototype.isOperator = function (operater) { return this.type == TokenType.Operator && this.strValue == operater; }; /** * @return {?} */ Token.prototype.isIdentifier = function () { return this.type == TokenType.Identifier; }; /** * @return {?} */ Token.prototype.isKeyword = function () { return this.type == TokenType.Keyword; }; /** * @return {?} */ Token.prototype.isKeywordLet = function () { return this.type == TokenType.Keyword && this.strValue == 'let'; }; /** * @return {?} */ Token.prototype.isKeywordAs = function () { return this.type == TokenType.Keyword && this.strValue == 'as'; }; /** * @return {?} */ Token.prototype.isKeywordNull = function () { return this.type == TokenType.Keyword && this.strValue == 'null'; }; /** * @return {?} */ Token.prototype.isKeywordUndefined = function () { return this.type == TokenType.Keyword && this.strValue == 'undefined'; }; /** * @return {?} */ Token.prototype.isKeywordTrue = function () { return this.type == TokenType.Keyword && this.strValue == 'true'; }; /** * @return {?} */ Token.prototype.isKeywordFalse = function () { return this.type == TokenType.Keyword && this.strValue == 'false'; }; /** * @return {?} */ Token.prototype.isKeywordThis = function () { return this.type == TokenType.Keyword && this.strValue == 'this'; }; /** * @return {?} */ Token.prototype.isError = function () { return this.type == TokenType.Error; }; /** * @return {?} */ Token.prototype.toNumber = function () { return this.type == TokenType.Number ? this.numValue : -1; }; /** * @return {?} */ Token.prototype.toString = function () { switch (this.type) { case TokenType.Character: case TokenType.Identifier: case TokenType.Keyword: case TokenType.Operator: case TokenType.String: case TokenType.Error: return this.strValue; case TokenType.Number: return this.numValue.toString(); default: return null; } }; return Token; }()); /** * @param {?} index * @param {?} code * @return {?} */ function newCharacterToken(index, code) { return new Token(index, TokenType.Character, code, String.fromCharCode(code)); } /** * @param {?} index * @param {?} text * @return {?} */ function newIdentifierToken(index, text) { return new Token(index, TokenType.Identifier, 0, text); } /** * @param {?} index * @param {?} text * @return {?} */ function newKeywordToken(index, text) { return new Token(index, TokenType.Keyword, 0, text); } /** * @param {?} index * @param {?} text * @return {?} */ function newOperatorToken(index, text) { return new Token(index, TokenType.Operator, 0, text); } /** * @param {?} index * @param {?} text * @return {?} */ function newStringToken(index, text) { return new Token(index, TokenType.String, 0, text); } /** * @param {?} index * @param {?} n * @return {?} */ function newNumberToken(index, n) { return new Token(index, TokenType.Number, n, ''); } /** * @param {?} index * @param {?} message * @return {?} */ function newErrorToken(index, message) { return new Token(index, TokenType.Error, 0, message); } var EOF = new Token(-1, TokenType.Character, 0, ''); var _Scanner = (function () { /** * @param {?} input */ function _Scanner(input) { this.input = input; this.peek = 0; this.index = -1; this.length = input.length; this.advance(); } /** * @return {?} */ _Scanner.prototype.advance = function () { this.peek = ++this.index >= this.length ? $EOF : this.input.charCodeAt(this.index); }; /** * @return {?} */ _Scanner.prototype.scanToken = function () { var /** @type {?} */ input = this.input, /** @type {?} */ length = this.length; var /** @type {?} */ peek = this.peek, /** @type {?} */ index = this.index; // Skip whitespace. while (peek <= $SPACE) { if (++index >= length) { peek = $EOF; break; } else { peek = input.charCodeAt(index); } } this.peek = peek; this.index = index; if (index >= length) { return null; } // Handle identifiers and numbers. if (isIdentifierStart(peek)) return this.scanIdentifier(); if (isDigit(peek)) return this.scanNumber(index); var /** @type {?} */ start = index; switch (peek) { case $PERIOD: this.advance(); return isDigit(this.peek) ? this.scanNumber(start) : newCharacterToken(start, $PERIOD); case $LPAREN: case $RPAREN: case $LBRACE: case $RBRACE: case $LBRACKET: case $RBRACKET: case $COMMA: case $COLON: case $SEMICOLON: return this.scanCharacter(start, peek); case $SQ: case $DQ: return this.scanString(); case $HASH: case $PLUS: case $MINUS: case $STAR: case $SLASH: case $PERCENT: case $CARET: return this.scanOperator(start, String.fromCharCode(peek)); case $QUESTION: return this.scanComplexOperator(start, '?', $PERIOD, '.'); case $LT: case $GT: return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, '='); case $BANG: case $EQ: return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, '=', $EQ, '='); case $AMPERSAND: return this.scanComplexOperator(start, '&', $AMPERSAND, '&'); case $BAR: return this.scanComplexOperator(start, '|', $BAR, '|'); case $NBSP: while (isWhitespace(this.peek)) this.advance(); return this.scanToken(); } this.advance(); return this.error("Unexpected character [" + String.fromCharCode(peek) + "]", 0); }; /** * @param {?} start * @param {?} code * @return {?} */ _Scanner.prototype.scanCharacter = function (start, code) { this.advance(); return newCharacterToken(start, code); }; /** * @param {?} start * @param {?} str * @return {?} */ _Scanner.prototype.scanOperator = function (start, str) { this.advance(); return newOperatorToken(start, str); }; /** * Tokenize a 2/3 char long operator * * @param {?} start start index in the expression * @param {?} one first symbol (always part of the operator) * @param {?} twoCode code point for the second symbol * @param {?} two second symbol (part of the operator when the second code point matches) * @param {?=} threeCode code point for the third symbol * @param {?=} three third symbol (part of the operator when provided and matches source expression) * @return {?} */ _Scanner.prototype.scanComplexOperator = function (start, one, twoCode, two, threeCode, three) { this.advance(); var /** @type {?} */ str = one; if (this.peek == twoCode) { this.advance(); str += two; } if (threeCode != null && this.peek == threeCode) { this.advance(); str += three; } return newOperatorToken(start, str); }; /** * @return {?} */ _Scanner.prototype.scanIdentifier = function () { var /** @type {?} */ start = this.index; this.advance(); while (isIdentifierPart(this.peek)) this.advance(); var /** @type {?} */ str = this.input.substring(start, this.index); return KEYWORDS.indexOf(str) > -1 ? newKeywordToken(start, str) : newIdentifierToken(start, str); }; /** * @param {?} start * @return {?} */ _Scanner.prototype.scanNumber = function (start) { var /** @type {?} */ simple = (this.index === start); this.advance(); // Skip initial digit. while (true) { if (isDigit(this.peek)) { } else if (this.peek == $PERIOD) { simple = false; } else if (isExponentStart(this.peek)) { this.advance(); if (isExponentSign(this.peek)) this.advance(); if (!isDigit(this.peek)) return this.error('Invalid exponent', -1); simple = false; } else { break; } this.advance(); } var /** @type {?} */ str = this.input.substring(start, this.index); var /** @type {?} */ value = simple ? parseIntAutoRadix(str) : parseFloat(str); return newNumberToken(start, value); }; /** * @return {?} */ _Scanner.prototype.scanString = function () { var /** @type {?} */ start = this.index; var /** @type {?} */ quote = this.peek; this.advance(); // Skip initial quote. var /** @type {?} */ buffer = ''; var /** @type {?} */ marker = this.index; var /** @type {?} */ input = this.input; while (this.peek != quote) { if (this.peek == $BACKSLASH) { buffer += input.substring(marker, this.index); this.advance(); var /** @type {?} */ unescapedCode = void 0; // Workaround for TS2.1-introduced type strictness this.peek = this.peek; if (this.peek == $u) { // 4 character hex code for unicode character. var /** @type {?} */ hex = input.substring(this.index + 1, this.index + 5); if (/^[0-9a-f]+$/i.test(hex)) { unescapedCode = parseInt(hex, 16); } else { return this.error("Invalid unicode escape [\\u" + hex + "]", 0); } for (var /** @type {?} */ i = 0; i < 5; i++) { this.advance(); } } else { unescapedCode = unescape(this.peek); this.advance(); } buffer += String.fromCharCode(unescapedCode); marker = this.index; } else if (this.peek == $EOF) { return this.error('Unterminated quote', 0); } else { this.advance(); } } var /** @type {?} */ last = input.substring(marker, this.index); this.advance(); // Skip terminating quote. return newStringToken(start, buffer + last); }; /** * @param {?} message * @param {?} offset * @return {?} */ _Scanner.prototype.error = function (message, offset) { var /** @type {?} */ position = this.index + offset; return newErrorToken(position, "Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]"); }; return _Scanner; }()); /** * @param {?} code * @return {?} */ function isIdentifierStart(code) { return ($a <= code && code <= $z) || ($A <= code && code <= $Z) || (code == $_) || (code == $$); } /** * @param {?} input * @return {?} */ function isIdentifier(input) { if (input.length == 0) return false; var /** @type {?} */ scanner = new _Scanner(input); if (!isIdentifierStart(scanner.peek)) return false; scanner.advance(); while (scanner.peek !== $EOF) { if (!isIdentifierPart(scanner.peek)) return false; scanner.advance(); } return true; } /** * @param {?} code * @return {?} */ function isIdentifierPart(code) { return isAsciiLetter(code) || isDigit(code) || (code == $_) || (code == $$); } /** * @param {?} code * @return {?} */ function isExponentStart(code) { return code == $e || code == $E; } /** * @param {?} code * @return {?} */ function isExponentSign(code) { return code == $MINUS || code == $PLUS; } /** * @param {?} code * @return {?} */ function isQuote(code) { return code === $SQ || code === $DQ || code === $BT; } /** * @param {?} code * @return {?} */ function unescape(code) { switch (code) { case $n: return $LF; case $f: return $FF; case $r: return $CR; case $t: return $TAB; case $v: return $VTAB; default: return code; } } /** * @param {?} text * @return {?} */ function parseIntAutoRadix(text) { var /** @type {?} */ result = parseInt(text); if (isNaN(result)) { throw new Error('Invalid integer literal when parsing ' + text); } return result; } /** * @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 SplitInterpolation = (function () { /** * @param {?} strings * @param {?} expressions * @param {?} offsets */ function SplitInterpolation(strings, expressions, offsets) { this.strings = strings; this.expressions = expressions; this.offsets = offsets; } return SplitInterpolation; }()); var TemplateBindingParseResult = (function () { /** * @param {?} templateBindings * @param {?} warnings * @param {?} errors */ function TemplateBindingParseResult(templateBindings, warnings, errors) { this.templateBindings = templateBindings; this.warnings = warnings; this.errors = errors; } return TemplateBindingParseResult; }()); /** * @param {?} config * @return {?} */ function _createInterpolateRegExp(config) { var /** @type {?} */ pattern = escapeRegExp(config.start) + '([\\s\\S]*?)' + escapeRegExp(config.end); return new RegExp(pattern, 'g'); } var Parser = (function () { /** * @param {?} _lexer */ function Parser(_lexer) { this._lexer = _lexer; this.errors = []; } /** * @param {?} input * @param {?} location * @param {?=} interpolationConfig * @return {?} */ Parser.prototype.parseAction = function (input, location, interpolationConfig) { if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; } this._checkNoInterpolation(input, location, interpolationConfig); var /** @type {?} */ sourceToLex = this._stripComments(input); var /** @type {?} */ tokens = this._lexer.tokenize(this._stripComments(input)); var /** @type {?} */ ast = new _ParseAST(input, location, tokens, sourceToLex.length, true, this.errors, input.length - sourceToLex.length) .parseChain(); return new ASTWithSource(ast, input, location, this.errors); }; /** * @param {?} input * @param {?} location * @param {?=} interpolationConfig * @return {?} */ Parser.prototype.parseBinding = function (input, location, interpolationConfig) { if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; } var /** @type {?} */ ast = this._parseBindingAst(input, location, interpolationConfig); return new ASTWithSource(ast, input, location, this.errors); }; /** * @param {?} input * @param {?} location * @param {?=} interpolationConfig * @return {?} */ Parser.prototype.parseSimpleBinding = function (input, location, interpolationConfig) { if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; } var /** @type {?} */ ast = this._parseBindingAst(input, location, interpolationConfig); var /** @type {?} */ errors = SimpleExpressionChecker.check(ast); if (errors.length > 0) { this._reportError("Host binding expression cannot contain " + errors.join(' '), input, location); } return new ASTWithSource(ast, input, location, this.errors); }; /** * @param {?} message * @param {?} input * @param {?} errLocation * @param {?=} ctxLocation * @return {?} */ Parser.prototype._reportError = function (message, input, errLocation, ctxLocation) { this.errors.push(new ParserError(message, input, errLocation, ctxLocation)); }; /** * @param {?} input * @param {?} location * @param {?} interpolationConfig * @return {?} */ Parser.prototype._parseBindingAst = function (input, location, interpolationConfig) { // Quotes expressions use 3rd-party expression language. We don't want to use // our lexer or parser for that, so we check for that ahead of time. var /** @type {?} */ quote = this._parseQuote(input, location); if (quote != null) { return quote; } this._checkNoInterpolation(input, location, interpolationConfig); var /** @type {?} */ sourceToLex = this._stripComments(input); var /** @type {?} */ tokens = this._lexer.tokenize(sourceToLex); return new _ParseAST(input, location, tokens, sourceToLex.length, false, this.errors, input.length - sourceToLex.length) .parseChain(); }; /** * @param {?} input * @param {?} location * @return {?} */ Parser.prototype._parseQuote = function (input, location) { if (input == null) return null; var /** @type {?} */ prefixSeparatorIndex = input.indexOf(':'); if (prefixSeparatorIndex == -1) return null; var /** @type {?} */ prefix = input.substring(0, prefixSeparatorIndex).trim(); if (!isIdentifier(prefix)) return null; var /** @type {?} */ uninterpretedExpression = input.substring(prefixSeparatorIndex + 1); return new Quote(new ParseSpan(0, input.length), prefix, uninterpretedExpression, location); }; /** * @param {?} prefixToken * @param {?} input * @param {?} location * @return {?} */ Parser.prototype.parseTemplateBindings = function (prefixToken, input, location) { var /** @type {?} */ tokens = this._lexer.tokenize(input); if (prefixToken) { // Prefix the tokens with the tokens from prefixToken but have them take no space (0 index). var /** @type {?} */ prefixTokens = this._lexer.tokenize(prefixToken).map(function (t) { t.index = 0; return t; }); tokens.unshift.apply(tokens, prefixTokens); } return new _ParseAST(input, location, tokens, input.length, false, this.errors, 0) .parseTemplateBindings(); }; /** * @param {?} input * @param {?} location * @param {?=} interpolationConfig * @return {?} */ Parser.prototype.parseInterpolation = function (input, location, interpolationConfig) { if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; } var /** @type {?} */ split = this.splitInterpolation(input, location, interpolationConfig); if (split == null) return null; var /** @type {?} */ expressions = []; for (var /** @type {?} */ i = 0; i < split.expressions.length; ++i) { var /** @type {?} */ expressionText = split.expressions[i]; var /** @type {?} */ sourceToLex = this._stripComments(expressionText); var /** @type {?} */ tokens = this._lexer.tokenize(this._stripComments(split.expressions[i])); var /** @type {?} */ ast = new _ParseAST(input, location, tokens, sourceToLex.length, false, this.errors, split.offsets[i] + (expressionText.length - sourceToLex.length)) .parseChain(); expressions.push(ast); } return new ASTWithSource(new Interpolation(new ParseSpan(0, input == null ? 0 : input.length), split.strings, expressions), input, location, this.errors); }; /** * @param {?} input * @param {?} location * @param {?=} interpolationConfig * @return {?} */ Parser.prototype.splitInterpolation = function (input, location, interpolationConfig) { if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; } var /** @type {?} */ regexp = _createInterpolateRegExp(interpolationConfig); var /** @type {?} */ parts = input.split(regexp); if (parts.length <= 1) { return null; } var /** @type {?} */ strings = []; var /** @type {?} */ expressions = []; var /** @type {?} */ offsets = []; var /** @type {?} */ offset = 0; for (var /** @type {?} */ i = 0; i < parts.length; i++) { var /** @type {?} */ part = parts[i]; if (i % 2 === 0) { // fixed string strings.push(part); offset += part.length; } else if (part.trim().length > 0) { offset += interpolationConfig.start.length; expressions.push(part); offsets.push(offset); offset += part.length + interpolationConfig.end.length; } else { this._reportError('Blank expressions are not allowed in interpolated strings', input, "at column " + this._findInterpolationErrorColumn(parts, i, interpolationConfig) + " in", location); expressions.push('$implict'); offsets.push(offset); } } return new SplitInterpolation(strings, expressions, offsets); }; /** * @param {?} input * @param {?} location * @return {?} */ Parser.prototype.wrapLiteralPrimitive = function (input, location) { return new ASTWithSource(new LiteralPrimitive(new ParseSpan(0, input == null ? 0 : input.length), input), input, location, this.errors); }; /** * @param {?} input * @return {?} */ Parser.prototype._stripComments = function (input) { var /** @type {?} */ i = this._commentStart(input); return i != null ? input.substring(0, i).trim() : input; }; /** * @param {?} input * @return {?} */ Parser.prototype._commentStart = function (input) { var /** @type {?} */ outerQuote = null; for (var /** @type {?} */ i = 0; i < input.length - 1; i++) { var /** @type {?} */ char = input.charCodeAt(i); var /** @type {?} */ nextChar = input.charCodeAt(i + 1); if (char === $SLASH && nextChar == $SLASH && outerQuote == null) return i; if (outerQuote === char) { outerQuote = null; } else if (outerQuote == null && isQuote(char)) { outerQuote = char; } } return null; }; /** * @param {?} input * @param {?} location * @param {?} interpolationConfig * @return {?} */ Parser.prototype._checkNoInterpolation = function (input, location, interpolationConfig) { var /** @type {?} */ regexp = _createInterpolateRegExp(interpolationConfig); var /** @type {?} */ parts = input.split(regexp); if (parts.length > 1) { this._reportError("Got interpolation (" + interpolationConfig.start + interpolationConfig.end + ") where expression was expected", input, "at column " + this._findInterpolationErrorColumn(parts, 1, interpolationConfig) + " in", location); } }; /** * @param {?} parts * @param {?} partInErrIdx * @param {?} interpolationConfig * @return {?} */ Parser.prototype._findInterpolationErrorColumn = function (parts, partInErrIdx, interpolationConfig) { var /** @type {?} */ errLocation = ''; for (var /** @type {?} */ j = 0; j < partInErrIdx; j++) { errLocation += j % 2 === 0 ? parts[j] : "" + interpolationConfig.start + parts[j] + interpolationConfig.end; } return errLocation.length; }; return Parser; }()); Parser.decorators = [ { type: CompilerInjectable }, ]; /** * @nocollapse */ Parser.ctorParameters = function () { return [ { type: Lexer, }, ]; }; var _ParseAST = (function () { /** * @param {?} input * @param {?} location * @param {?} tokens * @param {?} inputLength * @param {?} parseAction * @param {?} errors * @param {?} offset */ function _ParseAST(input, location, tokens, inputLength, parseAction, errors, offset) { this.input = input; this.location = location; this.tokens = tokens; this.inputLength = inputLength; this.parseAction = parseAction; this.errors = errors; this.offset = offset; this.rparensExpected = 0; this.rbracketsExpected = 0; this.rbracesExpected = 0; this.index = 0; } /** * @param {?} offset * @return {?} */ _ParseAST.prototype.peek = function (offset) { var /** @type {?} */ i = this.index + offset; return i < this.tokens.length ? this.tokens[i] : EOF; }; Object.defineProperty(_ParseAST.prototype, "next", { /** * @return {?} */ get: function () { return this.peek(0); }, enumerable: true, configurable: true }); Object.defineProperty(_ParseAST.prototype, "inputIndex", { /** * @return {?} */ get: function () { return (this.index < this.tokens.length) ? this.next.index + this.offset : this.inputLength + this.offset; }, enumerable: true, configurable: true }); /** * @param {?} start * @return {?} */ _ParseAST.prototype.span = function (start) { return new ParseSpan(start, this.inputIndex); }; /** * @return {?} */ _ParseAST.prototype.advance = function () { this.index++; }; /** * @param {?} code * @return {?} */ _ParseAST.prototype.optionalCharacter = function (code) { if (this.next.isCharacter(code)) { this.advance(); return true; } else { return false; } }; /** * @return {?} */ _ParseAST.prototype.peekKeywordLet = function () { return this.next.isKeywordLet(); }; /** * @return {?} */ _ParseAST.prototype.peekKeywordAs = function () { return this.next.isKeywordAs(); }; /** * @param {?} code * @return {?} */ _ParseAST.prototype.expectCharacter = function (code) { if (this.optionalCharacter(code)) return; this.error("Missing expected " + String.fromCharCode(code)); }; /** * @param {?} op * @return {?} */ _ParseAST.prototype.optionalOperator = function (op) { if (this.next.isOperator(op)) { this.advance(); return true; } else { return false; } }; /** * @param {?} operator * @return {?} */ _ParseAST.prototype.expectOperator = function (operator) { if (this.optionalOperator(operator)) return; this.error("Missing expected operator " + operator); }; /** * @return {?} */ _ParseAST.prototype.expectIdentifierOrKeyword = function () { var /** @type {?} */ n = this.next; if (!n.isIdentifier() && !n.isKeyword()) { this.error("Unexpected token " + n + ", expected identifier or keyword"); return ''; } this.advance(); return n.toString(); }; /** * @return {?} */ _ParseAST.prototype.expectIdentifierOrKeywordOrString = function () { var /** @type {?} */ n = this.next; if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) { this.error("Unexpected token " + n + ", expected identifier, keyword, or string"); return ''; } this.advance(); return n.toString(); }; /** * @return {?} */ _ParseAST.prototype.parseChain = function () { var /** @type {?} */ exprs = []; var /** @type {?} */ start = this.inputIndex; while (this.index < this.tokens.length) { var /** @type {?} */ expr = this.parsePipe(); exprs.push(expr); if (this.optionalCharacter($SEMICOLON)) { if (!this.parseAction) { this.error('Binding expression cannot contain chained expression'); } while (this.optionalCharacter($SEMICOLON)) { } // read all semicolons } else if (this.index < this.tokens.length) { this.error("Unexpected token '" + this.next + "'"); } } if (exprs.length == 0) return new EmptyExpr(this.span(start)); if (exprs.length == 1) return exprs[0]; return new Chain(this.span(start), exprs); }; /** * @return {?} */ _ParseAST.prototype.parsePipe = function () { var /** @type {?} */ result = this.parseExpression(); if (this.optionalOperator('|')) { if (this.parseAction) { this.error('Cannot have a pipe in an action expression'); } do { var /** @type {?} */ name = ((this.expectIdentifierOrKeyword())); var /** @type {?} */ args = []; while (this.optionalCharacter($COLON)) { args.push(this.parseExpression()); } result = new BindingPipe(this.span(result.span.start), result, name, args); } while (this.optionalOperator('|')); } return result; }; /** * @return {?} */ _ParseAST.prototype.parseExpression = function () { return this.parseConditional(); }; /** * @return {?} */ _ParseAST.prototype.parseConditional = function () { var /** @type {?} */ start = this.inputIndex; var /** @type {?} */ result = this.parseLogicalOr(); if (this.optionalOperator('?')) { var /** @type {?} */ yes = this.parsePipe(); var /** @type {?} */ no = void 0; if (!this.optionalCharacter($COLON)) { var /** @type {?} */ end = this.inputIndex; var /** @type {?} */ expression = this.input.substring(start, end); this.error("Conditional expression " + expression + " requires all 3 expressions"); no = new EmptyExpr(this.span(start)); } else { no = this.parsePipe(); } return new Conditional(this.span(start), result, yes, no); } else { return result; } }; /** * @return {?} */ _ParseAST.prototype.parseLogicalOr = function () { // '||' var /** @type {?} */ result = this.parseLogicalAnd(); while (this.optionalOperator('||')) { var /** @type {?} */ right = this.parseLogicalAnd(); result = new Binary(this.span(result.span.start), '||', result, right); } return result; }; /** * @return {?} */ _ParseAST.prototype.parseLogicalAnd = function () { // '&&' var /** @type {?} */ result = this.parseEquality(); while (this.optionalOperator('&&')) { var /** @type {?} */ right = this.parseEquality(); result = new Binary(this.span(result.span.start), '&&', result, right); } return result; }; /** * @return {?} */ _ParseAST.prototype.parseEquality = function () { // '==','!=','===','!==' var /** @type {?} */ result = this.parseRelational(); while (this.next.type == TokenType.Operator) { var /** @type {?} */ operator = this.next.strValue; switch (operator) { case '==': case '===': case '!=': case '!==': this.advance(); var /** @type {?} */ right = this.parseRelational(); result = new Binary(this.span(result.span.start), operator, result, right); continue; } break; } return result; }; /** * @return {?} */ _ParseAST.prototype.parseRelational = function () { // '<', '>', '<=', '>=' var /** @type {?} */ result = this.parseAdditive(); while (this.next.type == TokenType.Operator) { var /** @type {?} */ operator = this.next.strValue; switch (operator) { case '<': case '>': case '<=': case '>=': this.advance(); var /** @type {?} */ right = this.parseAdditive(); result = new Binary(this.span(result.span.start), operator, result, right); continue; } break; } return result; }; /** * @return {?} */ _ParseAST.prototype.parseAdditive = function () { // '+', '-' var /** @type {?} */ result = this.parseMultiplicative(); while (this.next.type == TokenType.Operator) { var /** @type {?} */ operator = this.next.strValue; switch (operator) { case '+': case '-': this.advance(); var /** @type {?} */ right = this.parseMultiplicative(); result = new Binary(this.span(result.span.start), operator, result, right); continue; } break; } return result; }; /** * @return {?} */ _ParseAST.prototype.parseMultiplicative = function () { // '*', '%', '/' var /** @type {?} */ result = this.parsePrefix(); while (this.next.type == TokenType.Operator) { var /** @type {?} */ operator = this.next.strValue; switch (operator) { case '*': case '%': case '/': this.advance(); var /** @type {?} */ right = this.parsePrefix(); result = new Binary(this.span(result.span.start), operator, result, right); continue; } break; } return result; }; /** * @return {?} */ _ParseAST.prototype.parsePrefix = function () { if (this.next.type == TokenType.Operator) { var /** @type {?} */ start = this.inputIndex; var /** @type {?} */ operator = this.next.strValue; var /** @type {?} */ result = void 0; switch (operator) { case '+': this.advance(); return this.parsePrefix(); case '-': this.advance(); result = this.parsePrefix(); return new Binary(this.span(start), operator, new LiteralPrimitive(new ParseSpan(start, start), 0), result); case '!': this.advance(); result = this.parsePrefix(); return new PrefixNot(this.span(start), result); } } return this.parseCallChain(); }; /** * @return {?} */ _ParseAST.prototype.parseCallChain = function () { var /** @type {?} */ result = this.parsePrimary(); while (true) { if (this.optionalCharacter($PERIOD)) { result = this.parseAccessMemberOrMethodCall(result, false); } else if (this.optionalOperator('?.')) { result = this.parseAccessMemberOrMethodCall(result, true); } else if (this.optionalCharacter($LBRACKET)) { this.rbracketsExpected++; var /** @type {?} */ key = this.parsePipe(); this.rbracketsExpected--; this.expectCharacter($RBRACKET); if (this.optionalOperator('=')) { var /** @type {?} */ value = this.parseConditional(); result = new KeyedWrite(this.span(result.span.start), result, key, value); } else { result = new KeyedRead(this.span(result.span.start), result, key); } } else if (this.optionalCharacter($LPAREN)) { this.rparensExpected++; var /** @type {?} */ args = this.parseCallArguments(); this.rparensExpected--; this.expectCharacter($RPAREN); result = new FunctionCall(this.span(result.span.start), result, args); } else { return result; } } }; /** * @return {?} */ _ParseAST.prototype.parsePrimary = function () { var /** @type {?} */ start = this.inputIndex; if (this.optionalCharacter($LPAREN)) { this.rparensExpected++; var /** @type {?} */ result = this.parsePipe(); this.rparensExpected--; this.expectCharacter($RPAREN); return result; } else if (this.next.isKeywordNull()) { this.advance(); return new LiteralPrimitive(this.span(start), null); } else if (this.next.isKeywordUndefined()) { this.advance(); return new LiteralPrimitive(this.span(start), void 0); } else if (this.next.isKeywordTrue()) { this.advance(); return new LiteralPrimitive(this.span(start), true); } else if (this.next.isKeywordFalse()) { this.advance(); return new LiteralPrimitive(this.span(start), false); } else if (this.next.isKeywordThis()) { this.advance(); return new ImplicitReceiver(this.span(start)); } else if (this.optionalCharacter($LBRACKET)) { this.rbracketsExpected++; var /** @type {?} */ elements = this.parseExpressionList($RBRACKET); this.rbracketsExpected--; this.expectCharacter($RBRACKET); return new LiteralArray(this.span(start), elements); } else if (this.next.isCharacter($LBRACE)) { return this.parseLiteralMap(); } else if (this.next.isIdentifier()) { return this.parseAccessMemberOrMethodCall(new ImplicitReceiver(this.span(start)), false); } else if (this.next.isNumber()) { var /** @type {?} */ value = this.next.toNumber(); this.advance(); return new LiteralPrimitive(this.span(start), value); } else if (this.next.isString()) { var /** @type {?} */ literalValue = this.next.toString(); this.advance(); return new LiteralPrimitive(this.span(start), literalValue); } else if (this.index >= this.tokens.length) { this.error("Unexpected end of expression: " + this.input); return new EmptyExpr(this.span(start)); } else { this.error("Unexpected token " + this.next); return new EmptyExpr(this.span(start)); } }; /** * @param {?} terminator * @return {?} */ _ParseAST.prototype.parseExpressionList = function (terminator) { var /** @type {?} */ result = []; if (!this.next.isCharacter(terminator)) { do { result.push(this.parsePipe()); } while (this.optionalCharacter($COMMA)); } return result; }; /** * @return {?} */ _ParseAST.prototype.parseLiteralMap = function () { var /** @type {?} */ keys = []; var /** @type {?} */ values = []; var /** @type {?} */ start = this.inputIndex; this.expectCharacter($LBRACE); if (!this.optionalCharacter($RBRACE)) { this.rbracesExpected++; do { var /** @type {?} */ key = ((this.expectIdentifierOrKeywordOrString())); keys.push(key); this.expectCharacter($COLON); values.push(this.parsePipe()); } while (this.optionalCharacter($COMMA)); this.rbracesExpected--; this.expectCharacter($RBRACE); } return new LiteralMap(this.span(start), keys, values); }; /** * @param {?} receiver * @param {?=} isSafe * @return {?} */ _ParseAST.prototype.parseAccessMemberOrMethodCall = function (receiver, isSafe) { if (isSafe === void 0) { isSafe = false; } var /** @type {?} */ start = receiver.span.start; var /** @type {?} */ id = ((this.expectIdentifierOrKeyword())); if (this.optionalCharacter($LPAREN)) { this.rparensExpected++; var /** @type {?} */ args = this.parseCallArguments(); this.expectCharacter($RPAREN); this.rparensExpected--; var /** @type {?} */ span = this.span(start); return isSafe ? new SafeMethodCall(span, receiver, id, args) : new MethodCall(span, receiver, id, args); } else { if (isSafe) { if (this.optionalOperator('=')) { this.error('The \'?.\' operator cannot be used in the assignment'); return new EmptyExpr(this.span(start)); } else { return new SafePropertyRead(this.span(start), receiver, id); } } else { if (this.optionalOperator('=')) { if (!this.parseAction) { this.error('Bindings cannot contain assignments'); return new EmptyExpr(this.span(start)); } var /** @type {?} */ value = this.parseConditional(); return new PropertyWrite(this.span(start), receiver, id, value); } else { return new PropertyRead(this.span(start), receiver, id); } } } }; /** * @return {?} */ _ParseAST.prototype.parseCallArguments = function () { if (this.next.isCharacter($RPAREN)) return []; var /** @type {?} */ positionals = []; do { positionals.push(this.parsePipe()); } while (this.optionalCharacter($COMMA)); return (positionals); }; /** * An identifier, a keyword, a string with an optional `-` inbetween. * @return {?} */ _ParseAST.prototype.expectTemplateBindingKey = function () { var /** @type {?} */ result = ''; var /** @type {?} */ operatorFound = false; do { result += this.expectIdentifierOrKeywordOrString(); operatorFound = this.optionalOperator('-'); if (operatorFound) { result += '-'; } } while (operatorFound); return result.toString(); }; /** * @return {?} */ _ParseAST.prototype.parseTemplateBindings = function () { var /** @type {?} */ bindings = []; var /** @type {?} */ prefix = ((null)); var /** @type {?} */ warnings = []; while (this.index < this.tokens.length) { var /** @type {?} */ start = this.inputIndex; var /** @type {?} */ keyIsVar = this.peekKeywordLet(); if (keyIsVar) { this.advance(); } var /** @type {?} */ rawKey = this.expectTemplateBindingKey(); var /** @type {?} */ key = rawKey; if (!keyIsVar) { if (prefix == null) { prefix = key; } else { key = prefix + key[0].toUpperCase() + key.substring(1); } } this.optionalCharacter($COLON); var /** @type {?} */ name = ((null)); var /** @type {?} */ expression = ((null)); if (keyIsVar) { if (this.optionalOperator('=')) { name = this.expectTemplateBindingKey(); } else { name = '\$implicit'; } } else if (this.peekKeywordAs()) { var /** @type {?} */ letStart = this.inputIndex; this.advance(); // consume `as` name = rawKey; key = this.expectTemplateBindingKey(); // read local var name keyIsVar = true; } else if (this.next !== EOF && !this.peekKeywordLet()) { var /** @type {?} */ start_2 = this.inputIndex; var /** @type {?} */ ast = this.parsePipe(); var /** @type {?} */ source = this.input.substring(start_2 - this.offset, this.inputIndex - this.offset); expression = new ASTWithSource(ast, source, this.location, this.errors); } bindings.push(new TemplateBinding(this.span(start), key, keyIsVar, name, expression)); if (this.peekKeywordAs() && !keyIsVar) { var /** @type {?} */ letStart = this.inputIndex; this.advance(); // consume `as` var /** @type {?} */ letName = this.expectTemplateBindingKey(); // read local var name bindings.push(new TemplateBinding(this.span(letStart), letName, true, key, /** @type {?} */ ((null)))); } if (!this.optionalCharacter($SEMICOLON)) { this.optionalCharacter($COMMA); } } return new TemplateBindingParseResult(bindings, warnings, this.errors); }; /** * @param {?} message * @param {?=} index * @return {?} */ _ParseAST.prototype.error = function (message, index) { if (index === void 0) { index = null; } this.errors.push(new ParserError(message, this.input, this.locationText(index), this.location)); this.skip(); }; /** * @param {?=} index * @return {?} */ _ParseAST.prototype.locationText = function (index) { if (index === void 0) { index = null; } if (index == null) index = this.index; return (index < this.tokens.length) ? "at column " + (this.tokens[index].index + 1) + " in" : "at the end of the expression"; }; /** * @return {?} */ _ParseAST.prototype.skip = function () { var /** @type {?} */ n = this.next; while (this.index < this.tokens.length && !n.isCharacter($SEMICOLON) && (this.rparensExpected <= 0 || !n.isCharacter($RPAREN)) && (this.rbracesExpected <= 0 || !n.isCharacter($RBRACE)) && (this.rbracketsExpected <= 0 || !n.isCharacter($RBRACKET))) { if (this.next.isError()) { this.errors.push(new ParserError(/** @type {?} */ ((this.next.toString())), this.input, this.locationText(), this.location)); } this.advance(); n = this.next; } }; return _ParseAST; }()); var SimpleExpressionChecker = (function () { function SimpleExpressionChecker() { this.errors = []; } /** * @param {?} ast * @return {?} */ SimpleExpressionChecker.check = function (ast) { var /** @type {?} */ s = new SimpleExpressionChecker(); ast.visit(s); return s.errors; }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitImplicitReceiver = function (ast, context) { }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitInterpolation = function (ast, context) { }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitLiteralPrimitive = function (ast, context) { }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitPropertyRead = function (ast, context) { }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitPropertyWrite = function (ast, context) { }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitSafePropertyRead = function (ast, context) { }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitMethodCall = function (ast, context) { }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitSafeMethodCall = function (ast, context) { }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitFunctionCall = function (ast, context) { }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitLiteralArray = function (ast, context) { this.visitAll(ast.expressions); }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitLiteralMap = function (ast, context) { this.visitAll(ast.values); }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitBinary = function (ast, context) { }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitPrefixNot = function (ast, context) { }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitConditional = function (ast, context) { }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitPipe = function (ast, context) { this.errors.push('pipes'); }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitKeyedRead = function (ast, context) { }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitKeyedWrite = function (ast, context) { }; /** * @param {?} asts * @return {?} */ SimpleExpressionChecker.prototype.visitAll = function (asts) { var _this = this; return asts.map(function (node) { return node.visit(_this); }); }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitChain = function (ast, context) { }; /** * @param {?} ast * @param {?} context * @return {?} */ SimpleExpressionChecker.prototype.visitQuote = function (ast, context) { }; return SimpleExpressionChecker; }()); /** * @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 ParseLocation = (function () { /** * @param {?} file * @param {?} offset * @param {?} line * @param {?} col */ function ParseLocation(file, offset, line, col) { this.file = file; this.offset = offset; this.line = line; this.col = col; } /** * @return {?} */ ParseLocation.prototype.toString = function () { return this.offset != null ? this.file.url + "@" + this.line + ":" + this.col : this.file.url; }; /** * @param {?} delta * @return {?} */ ParseLocation.prototype.moveBy = function (delta) { var /** @type {?} */ source = this.file.content; var /** @type {?} */ len = source.length; var /** @type {?} */ offset = this.offset; var /** @type {?} */ line = this.line; var /** @type {?} */ col = this.col; while (offset > 0 && delta < 0) { offset--; delta++; var /** @type {?} */ ch = source.charCodeAt(offset); if (ch == $LF) { line--; var /** @type {?} */ priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode($LF)); col = priorLine > 0 ? offset - priorLine : offset; } else { col--; } } while (offset < len && delta > 0) { var /** @type {?} */ ch = source.charCodeAt(offset); offset++; delta--; if (ch == $LF) { line++; col = 0; } else { col++; } } return new ParseLocation(this.file, offset, line, col); }; /** * @param {?} maxChars * @param {?} maxLines * @return {?} */ ParseLocation.prototype.getContext = function (maxChars, maxLines) { var /** @type {?} */ content = this.file.content; var /** @type {?} */ startOffset = this.offset; if (startOffset != null) { if (startOffset > content.length - 1) { startOffset = content.length - 1; } var /** @type {?} */ endOffset = startOffset; var /** @type {?} */ ctxChars = 0; var /** @type {?} */ ctxLines = 0; while (ctxChars < maxChars && startOffset > 0) { startOffset--; ctxChars++; if (content[startOffset] == '\n') { if (++ctxLines == maxLines) { break; } } } ctxChars = 0; ctxLines = 0; while (ctxChars < maxChars && endOffset < content.length - 1) { endOffset++; ctxChars++; if (content[endOffset] == '\n') { if (++ctxLines == maxLines) { break; } } } return { before: content.substring(startOffset, this.offset), after: content.substring(this.offset, endOffset + 1), }; } return null; }; return ParseLocation; }()); var ParseSourceFile = (function () { /** * @param {?} content * @param {?} url */ function ParseSourceFile(content, url) { this.content = content; this.url = url; } return ParseSourceFile; }()); var ParseSourceSpan = (function () { /** * @param {?} start * @param {?} end * @param {?=} details */ function ParseSourceSpan(start, end, details) { if (details === void 0) { details = null; } this.start = start; this.end = end; this.details = details; } /** * @return {?} */ ParseSourceSpan.prototype.toString = function () { return this.start.file.content.substring(this.start.offset, this.end.offset); }; return ParseSourceSpan; }()); var ParseErrorLevel = {}; ParseErrorLevel.WARNING = 0; ParseErrorLevel.ERROR = 1; ParseErrorLevel[ParseErrorLevel.WARNING] = "WARNING"; ParseErrorLevel[ParseErrorLevel.ERROR] = "ERROR"; var ParseError = (function () { /** * @param {?} span * @param {?} msg * @param {?=} level */ function ParseError(span, msg, level) { if (level === void 0) { level = ParseErrorLevel.ERROR; } this.span = span; this.msg = msg; this.level = level; } /** * @return {?} */ ParseError.prototype.toString = function () { var /** @type {?} */ ctx = this.span.start.getContext(100, 3); var /** @type {?} */ contextStr = ctx ? " (\"" + ctx.before + "[" + ParseErrorLevel[this.level] + " ->]" + ctx.after + "\")" : ''; var /** @type {?} */ details = this.span.details ? ", " + this.span.details : ''; return "" + this.msg + contextStr + ": " + this.span.start + details; }; return ParseError; }()); /** * @param {?} kind * @param {?} type * @return {?} */ function typeSourceSpan(kind, type) { var /** @type {?} */ moduleUrl = identifierModuleUrl(type); var /** @type {?} */ sourceFileName = moduleUrl != null ? "in " + kind + " " + identifierName(type) + " in " + moduleUrl : "in " + kind + " " + identifierName(type); var /** @type {?} */ sourceFile = new ParseSourceFile('', sourceFileName); return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -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 */ var Text = (function () { /** * @param {?} value * @param {?} sourceSpan */ function Text(value, sourceSpan) { this.value = value; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ Text.prototype.visit = function (visitor, context) { return visitor.visitText(this, context); }; return Text; }()); var Expansion = (function () { /** * @param {?} switchValue * @param {?} type * @param {?} cases * @param {?} sourceSpan * @param {?} switchValueSourceSpan */ function Expansion(switchValue, type, cases, sourceSpan, switchValueSourceSpan) { this.switchValue = switchValue; this.type = type; this.cases = cases; this.sourceSpan = sourceSpan; this.switchValueSourceSpan = switchValueSourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ Expansion.prototype.visit = function (visitor, context) { return visitor.visitExpansion(this, context); }; return Expansion; }()); var ExpansionCase = (function () { /** * @param {?} value * @param {?} expression * @param {?} sourceSpan * @param {?} valueSourceSpan * @param {?} expSourceSpan */ function ExpansionCase(value, expression, sourceSpan, valueSourceSpan, expSourceSpan) { this.value = value; this.expression = expression; this.sourceSpan = sourceSpan; this.valueSourceSpan = valueSourceSpan; this.expSourceSpan = expSourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ ExpansionCase.prototype.visit = function (visitor, context) { return visitor.visitExpansionCase(this, context); }; return ExpansionCase; }()); var Attribute$1 = (function () { /** * @param {?} name * @param {?} value * @param {?} sourceSpan * @param {?=} valueSpan */ function Attribute$1(name, value, sourceSpan, valueSpan) { this.name = name; this.value = value; this.sourceSpan = sourceSpan; this.valueSpan = valueSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ Attribute$1.prototype.visit = function (visitor, context) { return visitor.visitAttribute(this, context); }; return Attribute$1; }()); var Element = (function () { /** * @param {?} name * @param {?} attrs * @param {?} children * @param {?} sourceSpan * @param {?=} startSourceSpan * @param {?=} endSourceSpan */ function Element(name, attrs, children, sourceSpan, startSourceSpan, endSourceSpan) { if (startSourceSpan === void 0) { startSourceSpan = null; } if (endSourceSpan === void 0) { endSourceSpan = null; } this.name = name; this.attrs = attrs; this.children = children; this.sourceSpan = sourceSpan; this.startSourceSpan = startSourceSpan; this.endSourceSpan = endSourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ Element.prototype.visit = function (visitor, context) { return visitor.visitElement(this, context); }; return Element; }()); var Comment = (function () { /** * @param {?} value * @param {?} sourceSpan */ function Comment(value, sourceSpan) { this.value = value; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?} context * @return {?} */ Comment.prototype.visit = function (visitor, context) { return visitor.visitComment(this, context); }; return Comment; }()); /** * @param {?} visitor * @param {?} nodes * @param {?=} context * @return {?} */ function visitAll(visitor, nodes, context) { if (context === void 0) { context = null; } var /** @type {?} */ result = []; var /** @type {?} */ visit = visitor.visit ? function (ast) { return ((visitor.visit))(ast, context) || ast.visit(visitor, context); } : function (ast) { return ast.visit(visitor, context); }; nodes.forEach(function (ast) { var /** @type {?} */ astResult = visit(ast); if (astResult) { result.push(astResult); } }); return result; } /** * @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 TokenType$1 = {}; TokenType$1.TAG_OPEN_START = 0; TokenType$1.TAG_OPEN_END = 1; TokenType$1.TAG_OPEN_END_VOID = 2; TokenType$1.TAG_CLOSE = 3; TokenType$1.TEXT = 4; TokenType$1.ESCAPABLE_RAW_TEXT = 5; TokenType$1.RAW_TEXT = 6; TokenType$1.COMMENT_START = 7; TokenType$1.COMMENT_END = 8; TokenType$1.CDATA_START = 9; TokenType$1.CDATA_END = 10; TokenType$1.ATTR_NAME = 11; TokenType$1.ATTR_VALUE = 12; TokenType$1.DOC_TYPE = 13; TokenType$1.EXPANSION_FORM_START = 14; TokenType$1.EXPANSION_CASE_VALUE = 15; TokenType$1.EXPANSION_CASE_EXP_START = 16; TokenType$1.EXPANSION_CASE_EXP_END = 17; TokenType$1.EXPANSION_FORM_END = 18; TokenType$1.EOF = 19; TokenType$1[TokenType$1.TAG_OPEN_START] = "TAG_OPEN_START"; TokenType$1[TokenType$1.TAG_OPEN_END] = "TAG_OPEN_END"; TokenType$1[TokenType$1.TAG_OPEN_END_VOID] = "TAG_OPEN_END_VOID"; TokenType$1[TokenType$1.TAG_CLOSE] = "TAG_CLOSE"; TokenType$1[TokenType$1.TEXT] = "TEXT"; TokenType$1[TokenType$1.ESCAPABLE_RAW_TEXT] = "ESCAPABLE_RAW_TEXT"; TokenType$1[TokenType$1.RAW_TEXT] = "RAW_TEXT"; TokenType$1[TokenType$1.COMMENT_START] = "COMMENT_START"; TokenType$1[TokenType$1.COMMENT_END] = "COMMENT_END"; TokenType$1[TokenType$1.CDATA_START] = "CDATA_START"; TokenType$1[TokenType$1.CDATA_END] = "CDATA_END"; TokenType$1[TokenType$1.ATTR_NAME] = "ATTR_NAME"; TokenType$1[TokenType$1.ATTR_VALUE] = "ATTR_VALUE"; TokenType$1[TokenType$1.DOC_TYPE] = "DOC_TYPE"; TokenType$1[TokenType$1.EXPANSION_FORM_START] = "EXPANSION_FORM_START"; TokenType$1[TokenType$1.EXPANSION_CASE_VALUE] = "EXPANSION_CASE_VALUE"; TokenType$1[TokenType$1.EXPANSION_CASE_EXP_START] = "EXPANSION_CASE_EXP_START"; TokenType$1[TokenType$1.EXPANSION_CASE_EXP_END] = "EXPANSION_CASE_EXP_END"; TokenType$1[TokenType$1.EXPANSION_FORM_END] = "EXPANSION_FORM_END"; TokenType$1[TokenType$1.EOF] = "EOF"; var Token$1 = (function () { /** * @param {?} type * @param {?} parts * @param {?} sourceSpan */ function Token$1(type, parts, sourceSpan) { this.type = type; this.parts = parts; this.sourceSpan = sourceSpan; } return Token$1; }()); var TokenError = (function (_super) { __extends(TokenError, _super); /** * @param {?} errorMsg * @param {?} tokenType * @param {?} span */ function TokenError(errorMsg, tokenType, span) { var _this = _super.call(this, span, errorMsg) || this; _this.tokenType = tokenType; return _this; } return TokenError; }(ParseError)); var TokenizeResult = (function () { /** * @param {?} tokens * @param {?} errors */ function TokenizeResult(tokens, errors) { this.tokens = tokens; this.errors = errors; } return TokenizeResult; }()); /** * @param {?} source * @param {?} url * @param {?} getTagDefinition * @param {?=} tokenizeExpansionForms * @param {?=} interpolationConfig * @return {?} */ function tokenize(source, url, getTagDefinition, tokenizeExpansionForms, interpolationConfig) { if (tokenizeExpansionForms === void 0) { tokenizeExpansionForms = false; } if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; } return new _Tokenizer(new ParseSourceFile(source, url), getTagDefinition, tokenizeExpansionForms, interpolationConfig) .tokenize(); } var _CR_OR_CRLF_REGEXP = /\r\n?/g; /** * @param {?} charCode * @return {?} */ function _unexpectedCharacterErrorMsg(charCode) { var /** @type {?} */ char = charCode === $EOF ? 'EOF' : String.fromCharCode(charCode); return "Unexpected character \"" + char + "\""; } /** * @param {?} entitySrc * @return {?} */ function _unknownEntityErrorMsg(entitySrc) { return "Unknown entity \"" + entitySrc + "\" - use the \"&#;\" or \"&#x;\" syntax"; } var _ControlFlowError = (function () { /** * @param {?} error */ function _ControlFlowError(error) { this.error = error; } return _ControlFlowError; }()); var _Tokenizer = (function () { /** * @param {?} _file The html source * @param {?} _getTagDefinition * @param {?} _tokenizeIcu Whether to tokenize ICU messages (considered as text nodes when false) * @param {?=} _interpolationConfig */ function _Tokenizer(_file, _getTagDefinition, _tokenizeIcu, _interpolationConfig) { if (_interpolationConfig === void 0) { _interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; } this._file = _file; this._getTagDefinition = _getTagDefinition; this._tokenizeIcu = _tokenizeIcu; this._interpolationConfig = _interpolationConfig; this._peek = -1; this._nextPeek = -1; this._index = -1; this._line = 0; this._column = -1; this._expansionCaseStack = []; this._inInterpolation = false; this.tokens = []; this.errors = []; this._input = _file.content; this._length = _file.content.length; this._advance(); } /** * @param {?} content * @return {?} */ _Tokenizer.prototype._processCarriageReturns = function (content) { // http://www.w3.org/TR/html5/syntax.html#preprocessing-the-input-stream // In order to keep the original position in the source, we can not // pre-process it. // Instead CRs are processed right before instantiating the tokens. return content.replace(_CR_OR_CRLF_REGEXP, '\n'); }; /** * @return {?} */ _Tokenizer.prototype.tokenize = function () { while (this._peek !== $EOF) { var /** @type {?} */ start = this._getLocation(); try { if (this._attemptCharCode($LT)) { if (this._attemptCharCode($BANG)) { if (this._attemptCharCode($LBRACKET)) { this._consumeCdata(start); } else if (this._attemptCharCode($MINUS)) { this._consumeComment(start); } else { this._consumeDocType(start); } } else if (this._attemptCharCode($SLASH)) { this._consumeTagClose(start); } else { this._consumeTagOpen(start); } } else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) { this._consumeText(); } } catch (e) { if (e instanceof _ControlFlowError) { this.errors.push(e.error); } else { throw e; } } } this._beginToken(TokenType$1.EOF); this._endToken([]); return new TokenizeResult(mergeTextTokens(this.tokens), this.errors); }; /** * \@internal * @return {?} */ _Tokenizer.prototype._tokenizeExpansionForm = function () { if (isExpansionFormStart(this._input, this._index, this._interpolationConfig)) { this._consumeExpansionFormStart(); return true; } if (isExpansionCaseStart(this._peek) && this._isInExpansionForm()) { this._consumeExpansionCaseStart(); return true; } if (this._peek === $RBRACE) { if (this._isInExpansionCase()) { this._consumeExpansionCaseEnd(); return true; } if (this._isInExpansionForm()) { this._consumeExpansionFormEnd(); return true; } } return false; }; /** * @return {?} */ _Tokenizer.prototype._getLocation = function () { return new ParseLocation(this._file, this._index, this._line, this._column); }; /** * @param {?=} start * @param {?=} end * @return {?} */ _Tokenizer.prototype._getSpan = function (start, end) { if (start === void 0) { start = this._getLocation(); } if (end === void 0) { end = this._getLocation(); } return new ParseSourceSpan(start, end); }; /** * @param {?} type * @param {?=} start * @return {?} */ _Tokenizer.prototype._beginToken = function (type, start) { if (start === void 0) { start = this._getLocation(); } this._currentTokenStart = start; this._currentTokenType = type; }; /** * @param {?} parts * @param {?=} end * @return {?} */ _Tokenizer.prototype._endToken = function (parts, end) { if (end === void 0) { end = this._getLocation(); } var /** @type {?} */ token = new Token$1(this._currentTokenType, parts, new ParseSourceSpan(this._currentTokenStart, end)); this.tokens.push(token); this._currentTokenStart = ((null)); this._currentTokenType = ((null)); return token; }; /** * @param {?} msg * @param {?} span * @return {?} */ _Tokenizer.prototype._createError = function (msg, span) { if (this._isInExpansionForm()) { msg += " (Do you have an unescaped \"{\" in your template? Use \"{{ '{' }}\") to escape it.)"; } var /** @type {?} */ error = new TokenError(msg, this._currentTokenType, span); this._currentTokenStart = ((null)); this._currentTokenType = ((null)); return new _ControlFlowError(error); }; /** * @return {?} */ _Tokenizer.prototype._advance = function () { if (this._index >= this._length) { throw this._createError(_unexpectedCharacterErrorMsg($EOF), this._getSpan()); } if (this._peek === $LF) { this._line++; this._column = 0; } else if (this._peek !== $LF && this._peek !== $CR) { this._column++; } this._index++; this._peek = this._index >= this._length ? $EOF : this._input.charCodeAt(this._index); this._nextPeek = this._index + 1 >= this._length ? $EOF : this._input.charCodeAt(this._index + 1); }; /** * @param {?} charCode * @return {?} */ _Tokenizer.prototype._attemptCharCode = function (charCode) { if (this._peek === charCode) { this._advance(); return true; } return false; }; /** * @param {?} charCode * @return {?} */ _Tokenizer.prototype._attemptCharCodeCaseInsensitive = function (charCode) { if (compareCharCodeCaseInsensitive(this._peek, charCode)) { this._advance(); return true; } return false; }; /** * @param {?} charCode * @return {?} */ _Tokenizer.prototype._requireCharCode = function (charCode) { var /** @type {?} */ location = this._getLocation(); if (!this._attemptCharCode(charCode)) { throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(location, location)); } }; /** * @param {?} chars * @return {?} */ _Tokenizer.prototype._attemptStr = function (chars) { var /** @type {?} */ len = chars.length; if (this._index + len > this._length) { return false; } var /** @type {?} */ initialPosition = this._savePosition(); for (var /** @type {?} */ i = 0; i < len; i++) { if (!this._attemptCharCode(chars.charCodeAt(i))) { // If attempting to parse the string fails, we want to reset the parser // to where it was before the attempt this._restorePosition(initialPosition); return false; } } return true; }; /** * @param {?} chars * @return {?} */ _Tokenizer.prototype._attemptStrCaseInsensitive = function (chars) { for (var /** @type {?} */ i = 0; i < chars.length; i++) { if (!this._attemptCharCodeCaseInsensitive(chars.charCodeAt(i))) { return false; } } return true; }; /** * @param {?} chars * @return {?} */ _Tokenizer.prototype._requireStr = function (chars) { var /** @type {?} */ location = this._getLocation(); if (!this._attemptStr(chars)) { throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(location)); } }; /** * @param {?} predicate * @return {?} */ _Tokenizer.prototype._attemptCharCodeUntilFn = function (predicate) { while (!predicate(this._peek)) { this._advance(); } }; /** * @param {?} predicate * @param {?} len * @return {?} */ _Tokenizer.prototype._requireCharCodeUntilFn = function (predicate, len) { var /** @type {?} */ start = this._getLocation(); this._attemptCharCodeUntilFn(predicate); if (this._index - start.offset < len) { throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(start, start)); } }; /** * @param {?} char * @return {?} */ _Tokenizer.prototype._attemptUntilChar = function (char) { while (this._peek !== char) { this._advance(); } }; /** * @param {?} decodeEntities * @return {?} */ _Tokenizer.prototype._readChar = function (decodeEntities) { if (decodeEntities && this._peek === $AMPERSAND) { return this._decodeEntity(); } else { var /** @type {?} */ index = this._index; this._advance(); return this._input[index]; } }; /** * @return {?} */ _Tokenizer.prototype._decodeEntity = function () { var /** @type {?} */ start = this._getLocation(); this._advance(); if (this._attemptCharCode($HASH)) { var /** @type {?} */ isHex = this._attemptCharCode($x) || this._attemptCharCode($X); var /** @type {?} */ numberStart = this._getLocation().offset; this._attemptCharCodeUntilFn(isDigitEntityEnd); if (this._peek != $SEMICOLON) { throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan()); } this._advance(); var /** @type {?} */ strNum = this._input.substring(numberStart, this._index - 1); try { var /** @type {?} */ charCode = parseInt(strNum, isHex ? 16 : 10); return String.fromCharCode(charCode); } catch (e) { var /** @type {?} */ entity = this._input.substring(start.offset + 1, this._index - 1); throw this._createError(_unknownEntityErrorMsg(entity), this._getSpan(start)); } } else { var /** @type {?} */ startPosition = this._savePosition(); this._attemptCharCodeUntilFn(isNamedEntityEnd); if (this._peek != $SEMICOLON) { this._restorePosition(startPosition); return '&'; } this._advance(); var /** @type {?} */ name = this._input.substring(start.offset + 1, this._index - 1); var /** @type {?} */ char = NAMED_ENTITIES[name]; if (!char) { throw this._createError(_unknownEntityErrorMsg(name), this._getSpan(start)); } return char; } }; /** * @param {?} decodeEntities * @param {?} firstCharOfEnd * @param {?} attemptEndRest * @return {?} */ _Tokenizer.prototype._consumeRawText = function (decodeEntities, firstCharOfEnd, attemptEndRest) { var /** @type {?} */ tagCloseStart; var /** @type {?} */ textStart = this._getLocation(); this._beginToken(decodeEntities ? TokenType$1.ESCAPABLE_RAW_TEXT : TokenType$1.RAW_TEXT, textStart); var /** @type {?} */ parts = []; while (true) { tagCloseStart = this._getLocation(); if (this._attemptCharCode(firstCharOfEnd) && attemptEndRest()) { break; } if (this._index > tagCloseStart.offset) { // add the characters consumed by the previous if statement to the output parts.push(this._input.substring(tagCloseStart.offset, this._index)); } while (this._peek !== firstCharOfEnd) { parts.push(this._readChar(decodeEntities)); } } return this._endToken([this._processCarriageReturns(parts.join(''))], tagCloseStart); }; /** * @param {?} start * @return {?} */ _Tokenizer.prototype._consumeComment = function (start) { var _this = this; this._beginToken(TokenType$1.COMMENT_START, start); this._requireCharCode($MINUS); this._endToken([]); var /** @type {?} */ textToken = this._consumeRawText(false, $MINUS, function () { return _this._attemptStr('->'); }); this._beginToken(TokenType$1.COMMENT_END, textToken.sourceSpan.end); this._endToken([]); }; /** * @param {?} start * @return {?} */ _Tokenizer.prototype._consumeCdata = function (start) { var _this = this; this._beginToken(TokenType$1.CDATA_START, start); this._requireStr('CDATA['); this._endToken([]); var /** @type {?} */ textToken = this._consumeRawText(false, $RBRACKET, function () { return _this._attemptStr(']>'); }); this._beginToken(TokenType$1.CDATA_END, textToken.sourceSpan.end); this._endToken([]); }; /** * @param {?} start * @return {?} */ _Tokenizer.prototype._consumeDocType = function (start) { this._beginToken(TokenType$1.DOC_TYPE, start); this._attemptUntilChar($GT); this._advance(); this._endToken([this._input.substring(start.offset + 2, this._index - 1)]); }; /** * @return {?} */ _Tokenizer.prototype._consumePrefixAndName = function () { var /** @type {?} */ nameOrPrefixStart = this._index; var /** @type {?} */ prefix = ((null)); while (this._peek !== $COLON && !isPrefixEnd(this._peek)) { this._advance(); } var /** @type {?} */ nameStart; if (this._peek === $COLON) { this._advance(); prefix = this._input.substring(nameOrPrefixStart, this._index - 1); nameStart = this._index; } else { nameStart = nameOrPrefixStart; } this._requireCharCodeUntilFn(isNameEnd, this._index === nameStart ? 1 : 0); var /** @type {?} */ name = this._input.substring(nameStart, this._index); return [prefix, name]; }; /** * @param {?} start * @return {?} */ _Tokenizer.prototype._consumeTagOpen = function (start) { var /** @type {?} */ savedPos = this._savePosition(); var /** @type {?} */ tagName; var /** @type {?} */ lowercaseTagName; try { if (!isAsciiLetter(this._peek)) { throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan()); } var /** @type {?} */ nameStart = this._index; this._consumeTagOpenStart(start); tagName = this._input.substring(nameStart, this._index); lowercaseTagName = tagName.toLowerCase(); this._attemptCharCodeUntilFn(isNotWhitespace); while (this._peek !== $SLASH && this._peek !== $GT) { this._consumeAttributeName(); this._attemptCharCodeUntilFn(isNotWhitespace); if (this._attemptCharCode($EQ)) { this._attemptCharCodeUntilFn(isNotWhitespace); this._consumeAttributeValue(); } this._attemptCharCodeUntilFn(isNotWhitespace); } this._consumeTagOpenEnd(); } catch (e) { if (e instanceof _ControlFlowError) { // When the start tag is invalid, assume we want a "<" this._restorePosition(savedPos); // Back to back text tokens are merged at the end this._beginToken(TokenType$1.TEXT, start); this._endToken(['<']); return; } throw e; } var /** @type {?} */ contentTokenType = this._getTagDefinition(tagName).contentType; if (contentTokenType === TagContentType.RAW_TEXT) { this._consumeRawTextWithTagClose(lowercaseTagName, false); } else if (contentTokenType === TagContentType.ESCAPABLE_RAW_TEXT) { this._consumeRawTextWithTagClose(lowercaseTagName, true); } }; /** * @param {?} lowercaseTagName * @param {?} decodeEntities * @return {?} */ _Tokenizer.prototype._consumeRawTextWithTagClose = function (lowercaseTagName, decodeEntities) { var _this = this; var /** @type {?} */ textToken = this._consumeRawText(decodeEntities, $LT, function () { if (!_this._attemptCharCode($SLASH)) return false; _this._attemptCharCodeUntilFn(isNotWhitespace); if (!_this._attemptStrCaseInsensitive(lowercaseTagName)) return false; _this._attemptCharCodeUntilFn(isNotWhitespace); return _this._attemptCharCode($GT); }); this._beginToken(TokenType$1.TAG_CLOSE, textToken.sourceSpan.end); this._endToken([/** @type {?} */ ((null)), lowercaseTagName]); }; /** * @param {?} start * @return {?} */ _Tokenizer.prototype._consumeTagOpenStart = function (start) { this._beginToken(TokenType$1.TAG_OPEN_START, start); var /** @type {?} */ parts = this._consumePrefixAndName(); this._endToken(parts); }; /** * @return {?} */ _Tokenizer.prototype._consumeAttributeName = function () { this._beginToken(TokenType$1.ATTR_NAME); var /** @type {?} */ prefixAndName = this._consumePrefixAndName(); this._endToken(prefixAndName); }; /** * @return {?} */ _Tokenizer.prototype._consumeAttributeValue = function () { this._beginToken(TokenType$1.ATTR_VALUE); var /** @type {?} */ value; if (this._peek === $SQ || this._peek === $DQ) { var /** @type {?} */ quoteChar = this._peek; this._advance(); var /** @type {?} */ parts = []; while (this._peek !== quoteChar) { parts.push(this._readChar(true)); } value = parts.join(''); this._advance(); } else { var /** @type {?} */ valueStart = this._index; this._requireCharCodeUntilFn(isNameEnd, 1); value = this._input.substring(valueStart, this._index); } this._endToken([this._processCarriageReturns(value)]); }; /** * @return {?} */ _Tokenizer.prototype._consumeTagOpenEnd = function () { var /** @type {?} */ tokenType = this._attemptCharCode($SLASH) ? TokenType$1.TAG_OPEN_END_VOID : TokenType$1.TAG_OPEN_END; this._beginToken(tokenType); this._requireCharCode($GT); this._endToken([]); }; /** * @param {?} start * @return {?} */ _Tokenizer.prototype._consumeTagClose = function (start) { this._beginToken(TokenType$1.TAG_CLOSE, start); this._attemptCharCodeUntilFn(isNotWhitespace); var /** @type {?} */ prefixAndName = this._consumePrefixAndName(); this._attemptCharCodeUntilFn(isNotWhitespace); this._requireCharCode($GT); this._endToken(prefixAndName); }; /** * @return {?} */ _Tokenizer.prototype._consumeExpansionFormStart = function () { this._beginToken(TokenType$1.EXPANSION_FORM_START, this._getLocation()); this._requireCharCode($LBRACE); this._endToken([]); this._expansionCaseStack.push(TokenType$1.EXPANSION_FORM_START); this._beginToken(TokenType$1.RAW_TEXT, this._getLocation()); var /** @type {?} */ condition = this._readUntil($COMMA); this._endToken([condition], this._getLocation()); this._requireCharCode($COMMA); this._attemptCharCodeUntilFn(isNotWhitespace); this._beginToken(TokenType$1.RAW_TEXT, this._getLocation()); var /** @type {?} */ type = this._readUntil($COMMA); this._endToken([type], this._getLocation()); this._requireCharCode($COMMA); this._attemptCharCodeUntilFn(isNotWhitespace); }; /** * @return {?} */ _Tokenizer.prototype._consumeExpansionCaseStart = function () { this._beginToken(TokenType$1.EXPANSION_CASE_VALUE, this._getLocation()); var /** @type {?} */ value = this._readUntil($LBRACE).trim(); this._endToken([value], this._getLocation()); this._attemptCharCodeUntilFn(isNotWhitespace); this._beginToken(TokenType$1.EXPANSION_CASE_EXP_START, this._getLocation()); this._requireCharCode($LBRACE); this._endToken([], this._getLocation()); this._attemptCharCodeUntilFn(isNotWhitespace); this._expansionCaseStack.push(TokenType$1.EXPANSION_CASE_EXP_START); }; /** * @return {?} */ _Tokenizer.prototype._consumeExpansionCaseEnd = function () { this._beginToken(TokenType$1.EXPANSION_CASE_EXP_END, this._getLocation()); this._requireCharCode($RBRACE); this._endToken([], this._getLocation()); this._attemptCharCodeUntilFn(isNotWhitespace); this._expansionCaseStack.pop(); }; /** * @return {?} */ _Tokenizer.prototype._consumeExpansionFormEnd = function () { this._beginToken(TokenType$1.EXPANSION_FORM_END, this._getLocation()); this._requireCharCode($RBRACE); this._endToken([]); this._expansionCaseStack.pop(); }; /** * @return {?} */ _Tokenizer.prototype._consumeText = function () { var /** @type {?} */ start = this._getLocation(); this._beginToken(TokenType$1.TEXT, start); var /** @type {?} */ parts = []; do { if (this._interpolationConfig && this._attemptStr(this._interpolationConfig.start)) { parts.push(this._interpolationConfig.start); this._inInterpolation = true; } else if (this._interpolationConfig && this._inInterpolation && this._attemptStr(this._interpolationConfig.end)) { parts.push(this._interpolationConfig.end); this._inInterpolation = false; } else { parts.push(this._readChar(true)); } } while (!this._isTextEnd()); this._endToken([this._processCarriageReturns(parts.join(''))]); }; /** * @return {?} */ _Tokenizer.prototype._isTextEnd = function () { if (this._peek === $LT || this._peek === $EOF) { return true; } if (this._tokenizeIcu && !this._inInterpolation) { if (isExpansionFormStart(this._input, this._index, this._interpolationConfig)) { // start of an expansion form return true; } if (this._peek === $RBRACE && this._isInExpansionCase()) { // end of and expansion case return true; } } return false; }; /** * @return {?} */ _Tokenizer.prototype._savePosition = function () { return [this._peek, this._index, this._column, this._line, this.tokens.length]; }; /** * @param {?} char * @return {?} */ _Tokenizer.prototype._readUntil = function (char) { var /** @type {?} */ start = this._index; this._attemptUntilChar(char); return this._input.substring(start, this._index); }; /** * @param {?} position * @return {?} */ _Tokenizer.prototype._restorePosition = function (position) { this._peek = position[0]; this._index = position[1]; this._column = position[2]; this._line = position[3]; var /** @type {?} */ nbTokens = position[4]; if (nbTokens < this.tokens.length) { // remove any extra tokens this.tokens = this.tokens.slice(0, nbTokens); } }; /** * @return {?} */ _Tokenizer.prototype._isInExpansionCase = function () { return this._expansionCaseStack.length > 0 && this._expansionCaseStack[this._expansionCaseStack.length - 1] === TokenType$1.EXPANSION_CASE_EXP_START; }; /** * @return {?} */ _Tokenizer.prototype._isInExpansionForm = function () { return this._expansionCaseStack.length > 0 && this._expansionCaseStack[this._expansionCaseStack.length - 1] === TokenType$1.EXPANSION_FORM_START; }; return _Tokenizer; }()); /** * @param {?} code * @return {?} */ function isNotWhitespace(code) { return !isWhitespace(code) || code === $EOF; } /** * @param {?} code * @return {?} */ function isNameEnd(code) { return isWhitespace(code) || code === $GT || code === $SLASH || code === $SQ || code === $DQ || code === $EQ; } /** * @param {?} code * @return {?} */ function isPrefixEnd(code) { return (code < $a || $z < code) && (code < $A || $Z < code) && (code < $0 || code > $9); } /** * @param {?} code * @return {?} */ function isDigitEntityEnd(code) { return code == $SEMICOLON || code == $EOF || !isAsciiHexDigit(code); } /** * @param {?} code * @return {?} */ function isNamedEntityEnd(code) { return code == $SEMICOLON || code == $EOF || !isAsciiLetter(code); } /** * @param {?} input * @param {?} offset * @param {?} interpolationConfig * @return {?} */ function isExpansionFormStart(input, offset, interpolationConfig) { var /** @type {?} */ isInterpolationStart = interpolationConfig ? input.indexOf(interpolationConfig.start, offset) == offset : false; return input.charCodeAt(offset) == $LBRACE && !isInterpolationStart; } /** * @param {?} peek * @return {?} */ function isExpansionCaseStart(peek) { return peek === $EQ || isAsciiLetter(peek); } /** * @param {?} code1 * @param {?} code2 * @return {?} */ function compareCharCodeCaseInsensitive(code1, code2) { return toUpperCaseCharCode(code1) == toUpperCaseCharCode(code2); } /** * @param {?} code * @return {?} */ function toUpperCaseCharCode(code) { return code >= $a && code <= $z ? code - $a + $A : code; } /** * @param {?} srcTokens * @return {?} */ function mergeTextTokens(srcTokens) { var /** @type {?} */ dstTokens = []; var /** @type {?} */ lastDstToken = undefined; for (var /** @type {?} */ i = 0; i < srcTokens.length; i++) { var /** @type {?} */ token = srcTokens[i]; if (lastDstToken && lastDstToken.type == TokenType$1.TEXT && token.type == TokenType$1.TEXT) { lastDstToken.parts[0] += token.parts[0]; lastDstToken.sourceSpan.end = token.sourceSpan.end; } else { lastDstToken = token; dstTokens.push(lastDstToken); } } return dstTokens; } /** * @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 TreeError = (function (_super) { __extends(TreeError, _super); /** * @param {?} elementName * @param {?} span * @param {?} msg */ function TreeError(elementName, span, msg) { var _this = _super.call(this, span, msg) || this; _this.elementName = elementName; return _this; } /** * @param {?} elementName * @param {?} span * @param {?} msg * @return {?} */ TreeError.create = function (elementName, span, msg) { return new TreeError(elementName, span, msg); }; return TreeError; }(ParseError)); var ParseTreeResult = (function () { /** * @param {?} rootNodes * @param {?} errors */ function ParseTreeResult(rootNodes, errors) { this.rootNodes = rootNodes; this.errors = errors; } return ParseTreeResult; }()); var Parser$1 = (function () { /** * @param {?} getTagDefinition */ function Parser$1(getTagDefinition) { this.getTagDefinition = getTagDefinition; } /** * @param {?} source * @param {?} url * @param {?=} parseExpansionForms * @param {?=} interpolationConfig * @return {?} */ Parser$1.prototype.parse = function (source, url, parseExpansionForms, interpolationConfig) { if (parseExpansionForms === void 0) { parseExpansionForms = false; } if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; } var /** @type {?} */ tokensAndErrors = tokenize(source, url, this.getTagDefinition, parseExpansionForms, interpolationConfig); var /** @type {?} */ treeAndErrors = new _TreeBuilder(tokensAndErrors.tokens, this.getTagDefinition).build(); return new ParseTreeResult(treeAndErrors.rootNodes, ((tokensAndErrors.errors)).concat(treeAndErrors.errors)); }; return Parser$1; }()); var _TreeBuilder = (function () { /** * @param {?} tokens * @param {?} getTagDefinition */ function _TreeBuilder(tokens, getTagDefinition) { this.tokens = tokens; this.getTagDefinition = getTagDefinition; this._index = -1; this._rootNodes = []; this._errors = []; this._elementStack = []; this._advance(); } /** * @return {?} */ _TreeBuilder.prototype.build = function () { while (this._peek.type !== TokenType$1.EOF) { if (this._peek.type === TokenType$1.TAG_OPEN_START) { this._consumeStartTag(this._advance()); } else if (this._peek.type === TokenType$1.TAG_CLOSE) { this._consumeEndTag(this._advance()); } else if (this._peek.type === TokenType$1.CDATA_START) { this._closeVoidElement(); this._consumeCdata(this._advance()); } else if (this._peek.type === TokenType$1.COMMENT_START) { this._closeVoidElement(); this._consumeComment(this._advance()); } else if (this._peek.type === TokenType$1.TEXT || this._peek.type === TokenType$1.RAW_TEXT || this._peek.type === TokenType$1.ESCAPABLE_RAW_TEXT) { this._closeVoidElement(); this._consumeText(this._advance()); } else if (this._peek.type === TokenType$1.EXPANSION_FORM_START) { this._consumeExpansion(this._advance()); } else { // Skip all other tokens... this._advance(); } } return new ParseTreeResult(this._rootNodes, this._errors); }; /** * @return {?} */ _TreeBuilder.prototype._advance = function () { var /** @type {?} */ prev = this._peek; if (this._index < this.tokens.length - 1) { // Note: there is always an EOF token at the end this._index++; } this._peek = this.tokens[this._index]; return prev; }; /** * @param {?} type * @return {?} */ _TreeBuilder.prototype._advanceIf = function (type) { if (this._peek.type === type) { return this._advance(); } return null; }; /** * @param {?} startToken * @return {?} */ _TreeBuilder.prototype._consumeCdata = function (startToken) { this._consumeText(this._advance()); this._advanceIf(TokenType$1.CDATA_END); }; /** * @param {?} token * @return {?} */ _TreeBuilder.prototype._consumeComment = function (token) { var /** @type {?} */ text = this._advanceIf(TokenType$1.RAW_TEXT); this._advanceIf(TokenType$1.COMMENT_END); var /** @type {?} */ value = text != null ? text.parts[0].trim() : null; this._addToParent(new Comment(value, token.sourceSpan)); }; /** * @param {?} token * @return {?} */ _TreeBuilder.prototype._consumeExpansion = function (token) { var /** @type {?} */ switchValue = this._advance(); var /** @type {?} */ type = this._advance(); var /** @type {?} */ cases = []; // read = while (this._peek.type === TokenType$1.EXPANSION_CASE_VALUE) { var /** @type {?} */ expCase = this._parseExpansionCase(); if (!expCase) return; // error cases.push(expCase); } // read the final } if (this._peek.type !== TokenType$1.EXPANSION_FORM_END) { this._errors.push(TreeError.create(null, this._peek.sourceSpan, "Invalid ICU message. Missing '}'.")); return; } var /** @type {?} */ sourceSpan = new ParseSourceSpan(token.sourceSpan.start, this._peek.sourceSpan.end); this._addToParent(new Expansion(switchValue.parts[0], type.parts[0], cases, sourceSpan, switchValue.sourceSpan)); this._advance(); }; /** * @return {?} */ _TreeBuilder.prototype._parseExpansionCase = function () { var /** @type {?} */ value = this._advance(); // read { if (this._peek.type !== TokenType$1.EXPANSION_CASE_EXP_START) { this._errors.push(TreeError.create(null, this._peek.sourceSpan, "Invalid ICU message. Missing '{'.")); return null; } // read until } var /** @type {?} */ start = this._advance(); var /** @type {?} */ exp = this._collectExpansionExpTokens(start); if (!exp) return null; var /** @type {?} */ end = this._advance(); exp.push(new Token$1(TokenType$1.EOF, [], end.sourceSpan)); // parse everything in between { and } var /** @type {?} */ parsedExp = new _TreeBuilder(exp, this.getTagDefinition).build(); if (parsedExp.errors.length > 0) { this._errors = this._errors.concat(/** @type {?} */ (parsedExp.errors)); return null; } var /** @type {?} */ sourceSpan = new ParseSourceSpan(value.sourceSpan.start, end.sourceSpan.end); var /** @type {?} */ expSourceSpan = new ParseSourceSpan(start.sourceSpan.start, end.sourceSpan.end); return new ExpansionCase(value.parts[0], parsedExp.rootNodes, sourceSpan, value.sourceSpan, expSourceSpan); }; /** * @param {?} start * @return {?} */ _TreeBuilder.prototype._collectExpansionExpTokens = function (start) { var /** @type {?} */ exp = []; var /** @type {?} */ expansionFormStack = [TokenType$1.EXPANSION_CASE_EXP_START]; while (true) { if (this._peek.type === TokenType$1.EXPANSION_FORM_START || this._peek.type === TokenType$1.EXPANSION_CASE_EXP_START) { expansionFormStack.push(this._peek.type); } if (this._peek.type === TokenType$1.EXPANSION_CASE_EXP_END) { if (lastOnStack(expansionFormStack, TokenType$1.EXPANSION_CASE_EXP_START)) { expansionFormStack.pop(); if (expansionFormStack.length == 0) return exp; } else { this._errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'.")); return null; } } if (this._peek.type === TokenType$1.EXPANSION_FORM_END) { if (lastOnStack(expansionFormStack, TokenType$1.EXPANSION_FORM_START)) { expansionFormStack.pop(); } else { this._errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'.")); return null; } } if (this._peek.type === TokenType$1.EOF) { this._errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'.")); return null; } exp.push(this._advance()); } }; /** * @param {?} token * @return {?} */ _TreeBuilder.prototype._consumeText = function (token) { var /** @type {?} */ text = token.parts[0]; if (text.length > 0 && text[0] == '\n') { var /** @type {?} */ parent = this._getParentElement(); if (parent != null && parent.children.length == 0 && this.getTagDefinition(parent.name).ignoreFirstLf) { text = text.substring(1); } } if (text.length > 0) { this._addToParent(new Text(text, token.sourceSpan)); } }; /** * @return {?} */ _TreeBuilder.prototype._closeVoidElement = function () { if (this._elementStack.length > 0) { var /** @type {?} */ el = this._elementStack[this._elementStack.length - 1]; if (this.getTagDefinition(el.name).isVoid) { this._elementStack.pop(); } } }; /** * @param {?} startTagToken * @return {?} */ _TreeBuilder.prototype._consumeStartTag = function (startTagToken) { var /** @type {?} */ prefix = startTagToken.parts[0]; var /** @type {?} */ name = startTagToken.parts[1]; var /** @type {?} */ attrs = []; while (this._peek.type === TokenType$1.ATTR_NAME) { attrs.push(this._consumeAttr(this._advance())); } var /** @type {?} */ fullName = this._getElementFullName(prefix, name, this._getParentElement()); var /** @type {?} */ selfClosing = false; // Note: There could have been a tokenizer error // so that we don't get a token for the end tag... if (this._peek.type === TokenType$1.TAG_OPEN_END_VOID) { this._advance(); selfClosing = true; var /** @type {?} */ tagDef = this.getTagDefinition(fullName); if (!(tagDef.canSelfClose || getNsPrefix(fullName) !== null || tagDef.isVoid)) { this._errors.push(TreeError.create(fullName, startTagToken.sourceSpan, "Only void and foreign elements can be self closed \"" + startTagToken.parts[1] + "\"")); } } else if (this._peek.type === TokenType$1.TAG_OPEN_END) { this._advance(); selfClosing = false; } var /** @type {?} */ end = this._peek.sourceSpan.start; var /** @type {?} */ span = new ParseSourceSpan(startTagToken.sourceSpan.start, end); var /** @type {?} */ el = new Element(fullName, attrs, [], span, span, undefined); this._pushElement(el); if (selfClosing) { this._popElement(fullName); el.endSourceSpan = span; } }; /** * @param {?} el * @return {?} */ _TreeBuilder.prototype._pushElement = function (el) { if (this._elementStack.length > 0) { var /** @type {?} */ parentEl = this._elementStack[this._elementStack.length - 1]; if (this.getTagDefinition(parentEl.name).isClosedByChild(el.name)) { this._elementStack.pop(); } } var /** @type {?} */ tagDef = this.getTagDefinition(el.name); var _a = this._getParentElementSkippingContainers(), parent = _a.parent, container = _a.container; if (parent && tagDef.requireExtraParent(parent.name)) { var /** @type {?} */ newParent = new Element(tagDef.parentToAdd, [], [], el.sourceSpan, el.startSourceSpan, el.endSourceSpan); this._insertBeforeContainer(parent, container, newParent); } this._addToParent(el); this._elementStack.push(el); }; /** * @param {?} endTagToken * @return {?} */ _TreeBuilder.prototype._consumeEndTag = function (endTagToken) { var /** @type {?} */ fullName = this._getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this._getParentElement()); if (this._getParentElement()) { ((this._getParentElement())).endSourceSpan = endTagToken.sourceSpan; } if (this.getTagDefinition(fullName).isVoid) { this._errors.push(TreeError.create(fullName, endTagToken.sourceSpan, "Void elements do not have end tags \"" + endTagToken.parts[1] + "\"")); } else if (!this._popElement(fullName)) { var /** @type {?} */ errMsg = "Unexpected closing tag \"" + fullName + "\". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags"; this._errors.push(TreeError.create(fullName, endTagToken.sourceSpan, errMsg)); } }; /** * @param {?} fullName * @return {?} */ _TreeBuilder.prototype._popElement = function (fullName) { for (var /** @type {?} */ stackIndex = this._elementStack.length - 1; stackIndex >= 0; stackIndex--) { var /** @type {?} */ el = this._elementStack[stackIndex]; if (el.name == fullName) { this._elementStack.splice(stackIndex, this._elementStack.length - stackIndex); return true; } if (!this.getTagDefinition(el.name).closedByParent) { return false; } } return false; }; /** * @param {?} attrName * @return {?} */ _TreeBuilder.prototype._consumeAttr = function (attrName) { var /** @type {?} */ fullName = mergeNsAndName(attrName.parts[0], attrName.parts[1]); var /** @type {?} */ end = attrName.sourceSpan.end; var /** @type {?} */ value = ''; var /** @type {?} */ valueSpan = ((undefined)); if (this._peek.type === TokenType$1.ATTR_VALUE) { var /** @type {?} */ valueToken = this._advance(); value = valueToken.parts[0]; end = valueToken.sourceSpan.end; valueSpan = valueToken.sourceSpan; } return new Attribute$1(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, end), valueSpan); }; /** * @return {?} */ _TreeBuilder.prototype._getParentElement = function () { return this._elementStack.length > 0 ? this._elementStack[this._elementStack.length - 1] : null; }; /** * Returns the parent in the DOM and the container. * * `` elements are skipped as they are not rendered as DOM element. * @return {?} */ _TreeBuilder.prototype._getParentElementSkippingContainers = function () { var /** @type {?} */ container = null; for (var /** @type {?} */ i = this._elementStack.length - 1; i >= 0; i--) { if (!isNgContainer(this._elementStack[i].name)) { return { parent: this._elementStack[i], container: container }; } container = this._elementStack[i]; } return { parent: this._elementStack[this._elementStack.length - 1], container: container }; }; /** * @param {?} node * @return {?} */ _TreeBuilder.prototype._addToParent = function (node) { var /** @type {?} */ parent = this._getParentElement(); if (parent != null) { parent.children.push(node); } else { this._rootNodes.push(node); } }; /** * Insert a node between the parent and the container. * When no container is given, the node is appended as a child of the parent. * Also updates the element stack accordingly. * * \@internal * @param {?} parent * @param {?} container * @param {?} node * @return {?} */ _TreeBuilder.prototype._insertBeforeContainer = function (parent, container, node) { if (!container) { this._addToParent(node); this._elementStack.push(node); } else { if (parent) { // replace the container with the new node in the children var /** @type {?} */ index = parent.children.indexOf(container); parent.children[index] = node; } else { this._rootNodes.push(node); } node.children.push(container); this._elementStack.splice(this._elementStack.indexOf(container), 0, node); } }; /** * @param {?} prefix * @param {?} localName * @param {?} parentElement * @return {?} */ _TreeBuilder.prototype._getElementFullName = function (prefix, localName, parentElement) { if (prefix == null) { prefix = ((this.getTagDefinition(localName).implicitNamespacePrefix)); if (prefix == null && parentElement != null) { prefix = getNsPrefix(parentElement.name); } } return mergeNsAndName(prefix, localName); }; return _TreeBuilder; }()); /** * @param {?} stack * @param {?} element * @return {?} */ function lastOnStack(stack, element) { return stack.length > 0 && stack[stack.length - 1] === element; } /** * @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 Message = (function () { /** * @param {?} nodes message AST * @param {?} placeholders maps placeholder names to static content * @param {?} placeholderToMessage maps placeholder names to messages (used for nested ICU messages) * @param {?} meaning * @param {?} description * @param {?} id */ function Message(nodes, placeholders, placeholderToMessage, meaning, description, id) { this.nodes = nodes; this.placeholders = placeholders; this.placeholderToMessage = placeholderToMessage; this.meaning = meaning; this.description = description; this.id = id; if (nodes.length) { this.sources = [{ filePath: nodes[0].sourceSpan.start.file.url, startLine: nodes[0].sourceSpan.start.line + 1, startCol: nodes[0].sourceSpan.start.col + 1, endLine: nodes[nodes.length - 1].sourceSpan.end.line + 1, endCol: nodes[0].sourceSpan.start.col + 1 }]; } else { this.sources = []; } } return Message; }()); var Text$1 = (function () { /** * @param {?} value * @param {?} sourceSpan */ function Text$1(value, sourceSpan) { this.value = value; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?=} context * @return {?} */ Text$1.prototype.visit = function (visitor, context) { return visitor.visitText(this, context); }; return Text$1; }()); var Container = (function () { /** * @param {?} children * @param {?} sourceSpan */ function Container(children, sourceSpan) { this.children = children; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?=} context * @return {?} */ Container.prototype.visit = function (visitor, context) { return visitor.visitContainer(this, context); }; return Container; }()); var Icu = (function () { /** * @param {?} expression * @param {?} type * @param {?} cases * @param {?} sourceSpan */ function Icu(expression, type, cases, sourceSpan) { this.expression = expression; this.type = type; this.cases = cases; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?=} context * @return {?} */ Icu.prototype.visit = function (visitor, context) { return visitor.visitIcu(this, context); }; return Icu; }()); var TagPlaceholder = (function () { /** * @param {?} tag * @param {?} attrs * @param {?} startName * @param {?} closeName * @param {?} children * @param {?} isVoid * @param {?} sourceSpan */ function TagPlaceholder(tag, attrs, startName, closeName, children, isVoid, sourceSpan) { this.tag = tag; this.attrs = attrs; this.startName = startName; this.closeName = closeName; this.children = children; this.isVoid = isVoid; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?=} context * @return {?} */ TagPlaceholder.prototype.visit = function (visitor, context) { return visitor.visitTagPlaceholder(this, context); }; return TagPlaceholder; }()); var Placeholder = (function () { /** * @param {?} value * @param {?} name * @param {?} sourceSpan */ function Placeholder(value, name, sourceSpan) { this.value = value; this.name = name; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?=} context * @return {?} */ Placeholder.prototype.visit = function (visitor, context) { return visitor.visitPlaceholder(this, context); }; return Placeholder; }()); var IcuPlaceholder = (function () { /** * @param {?} value * @param {?} name * @param {?} sourceSpan */ function IcuPlaceholder(value, name, sourceSpan) { this.value = value; this.name = name; this.sourceSpan = sourceSpan; } /** * @param {?} visitor * @param {?=} context * @return {?} */ IcuPlaceholder.prototype.visit = function (visitor, context) { return visitor.visitIcuPlaceholder(this, context); }; return IcuPlaceholder; }()); var CloneVisitor = (function () { function CloneVisitor() { } /** * @param {?} text * @param {?=} context * @return {?} */ CloneVisitor.prototype.visitText = function (text, context) { return new Text$1(text.value, text.sourceSpan); }; /** * @param {?} container * @param {?=} context * @return {?} */ CloneVisitor.prototype.visitContainer = function (container, context) { var _this = this; var /** @type {?} */ children = container.children.map(function (n) { return n.visit(_this, context); }); return new Container(children, container.sourceSpan); }; /** * @param {?} icu * @param {?=} context * @return {?} */ CloneVisitor.prototype.visitIcu = function (icu, context) { var _this = this; var /** @type {?} */ cases = {}; Object.keys(icu.cases).forEach(function (key) { return cases[key] = icu.cases[key].visit(_this, context); }); var /** @type {?} */ msg = new Icu(icu.expression, icu.type, cases, icu.sourceSpan); msg.expressionPlaceholder = icu.expressionPlaceholder; return msg; }; /** * @param {?} ph * @param {?=} context * @return {?} */ CloneVisitor.prototype.visitTagPlaceholder = function (ph, context) { var _this = this; var /** @type {?} */ children = ph.children.map(function (n) { return n.visit(_this, context); }); return new TagPlaceholder(ph.tag, ph.attrs, ph.startName, ph.closeName, children, ph.isVoid, ph.sourceSpan); }; /** * @param {?} ph * @param {?=} context * @return {?} */ CloneVisitor.prototype.visitPlaceholder = function (ph, context) { return new Placeholder(ph.value, ph.name, ph.sourceSpan); }; /** * @param {?} ph * @param {?=} context * @return {?} */ CloneVisitor.prototype.visitIcuPlaceholder = function (ph, context) { return new IcuPlaceholder(ph.value, ph.name, ph.sourceSpan); }; return CloneVisitor; }()); var RecurseVisitor = (function () { function RecurseVisitor() { } /** * @param {?} text * @param {?=} context * @return {?} */ RecurseVisitor.prototype.visitText = function (text, context) { }; ; /** * @param {?} container * @param {?=} context * @return {?} */ RecurseVisitor.prototype.visitContainer = function (container, context) { var _this = this; container.children.forEach(function (child) { return child.visit(_this); }); }; /** * @param {?} icu * @param {?=} context * @return {?} */ RecurseVisitor.prototype.visitIcu = function (icu, context) { var _this = this; Object.keys(icu.cases).forEach(function (k) { icu.cases[k].visit(_this); }); }; /** * @param {?} ph * @param {?=} context * @return {?} */ RecurseVisitor.prototype.visitTagPlaceholder = function (ph, context) { var _this = this; ph.children.forEach(function (child) { return child.visit(_this); }); }; /** * @param {?} ph * @param {?=} context * @return {?} */ RecurseVisitor.prototype.visitPlaceholder = function (ph, context) { }; ; /** * @param {?} ph * @param {?=} context * @return {?} */ RecurseVisitor.prototype.visitIcuPlaceholder = function (ph, context) { }; ; return RecurseVisitor; }()); /** * @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 TAG_TO_PLACEHOLDER_NAMES = { 'A': 'LINK', 'B': 'BOLD_TEXT', 'BR': 'LINE_BREAK', 'EM': 'EMPHASISED_TEXT', 'H1': 'HEADING_LEVEL1', 'H2': 'HEADING_LEVEL2', 'H3': 'HEADING_LEVEL3', 'H4': 'HEADING_LEVEL4', 'H5': 'HEADING_LEVEL5', 'H6': 'HEADING_LEVEL6', 'HR': 'HORIZONTAL_RULE', 'I': 'ITALIC_TEXT', 'LI': 'LIST_ITEM', 'LINK': 'MEDIA_LINK', 'OL': 'ORDERED_LIST', 'P': 'PARAGRAPH', 'Q': 'QUOTATION', 'S': 'STRIKETHROUGH_TEXT', 'SMALL': 'SMALL_TEXT', 'SUB': 'SUBSTRIPT', 'SUP': 'SUPERSCRIPT', 'TBODY': 'TABLE_BODY', 'TD': 'TABLE_CELL', 'TFOOT': 'TABLE_FOOTER', 'TH': 'TABLE_HEADER_CELL', 'THEAD': 'TABLE_HEADER', 'TR': 'TABLE_ROW', 'TT': 'MONOSPACED_TEXT', 'U': 'UNDERLINED_TEXT', 'UL': 'UNORDERED_LIST', }; /** * Creates unique names for placeholder with different content. * * Returns the same placeholder name when the content is identical. * * \@internal */ var PlaceholderRegistry = (function () { function PlaceholderRegistry() { this._placeHolderNameCounts = {}; this._signatureToName = {}; } /** * @param {?} tag * @param {?} attrs * @param {?} isVoid * @return {?} */ PlaceholderRegistry.prototype.getStartTagPlaceholderName = function (tag, attrs, isVoid) { var /** @type {?} */ signature = this._hashTag(tag, attrs, isVoid); if (this._signatureToName[signature]) { return this._signatureToName[signature]; } var /** @type {?} */ upperTag = tag.toUpperCase(); var /** @type {?} */ baseName = TAG_TO_PLACEHOLDER_NAMES[upperTag] || "TAG_" + upperTag; var /** @type {?} */ name = this._generateUniqueName(isVoid ? baseName : "START_" + baseName); this._signatureToName[signature] = name; return name; }; /** * @param {?} tag * @return {?} */ PlaceholderRegistry.prototype.getCloseTagPlaceholderName = function (tag) { var /** @type {?} */ signature = this._hashClosingTag(tag); if (this._signatureToName[signature]) { return this._signatureToName[signature]; } var /** @type {?} */ upperTag = tag.toUpperCase(); var /** @type {?} */ baseName = TAG_TO_PLACEHOLDER_NAMES[upperTag] || "TAG_" + upperTag; var /** @type {?} */ name = this._generateUniqueName("CLOSE_" + baseName); this._signatureToName[signature] = name; return name; }; /** * @param {?} name * @param {?} content * @return {?} */ PlaceholderRegistry.prototype.getPlaceholderName = function (name, content) { var /** @type {?} */ upperName = name.toUpperCase(); var /** @type {?} */ signature = "PH: " + upperName + "=" + content; if (this._signatureToName[signature]) { return this._signatureToName[signature]; } var /** @type {?} */ uniqueName = this._generateUniqueName(upperName); this._signatureToName[signature] = uniqueName; return uniqueName; }; /** * @param {?} name * @return {?} */ PlaceholderRegistry.prototype.getUniquePlaceholder = function (name) { return this._generateUniqueName(name.toUpperCase()); }; /** * @param {?} tag * @param {?} attrs * @param {?} isVoid * @return {?} */ PlaceholderRegistry.prototype._hashTag = function (tag, attrs, isVoid) { var /** @type {?} */ start = "<" + tag; var /** @type {?} */ strAttrs = Object.keys(attrs).sort().map(function (name) { return " " + name + "=" + attrs[name]; }).join(''); var /** @type {?} */ end = isVoid ? '/>' : ">"; return start + strAttrs + end; }; /** * @param {?} tag * @return {?} */ PlaceholderRegistry.prototype._hashClosingTag = function (tag) { return this._hashTag("/" + tag, {}, false); }; /** * @param {?} base * @return {?} */ PlaceholderRegistry.prototype._generateUniqueName = function (base) { var /** @type {?} */ seen = this._placeHolderNameCounts.hasOwnProperty(base); if (!seen) { this._placeHolderNameCounts[base] = 1; return base; } var /** @type {?} */ id = this._placeHolderNameCounts[base]; this._placeHolderNameCounts[base] = id + 1; return base + "_" + id; }; return PlaceholderRegistry; }()); /** * @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 _expParser = new Parser(new Lexer()); /** * Returns a function converting html nodes to an i18n Message given an interpolationConfig * @param {?} interpolationConfig * @return {?} */ function createI18nMessageFactory(interpolationConfig) { var /** @type {?} */ visitor = new _I18nVisitor(_expParser, interpolationConfig); return function (nodes, meaning, description, id) { return visitor.toI18nMessage(nodes, meaning, description, id); }; } var _I18nVisitor = (function () { /** * @param {?} _expressionParser * @param {?} _interpolationConfig */ function _I18nVisitor(_expressionParser, _interpolationConfig) { this._expressionParser = _expressionParser; this._interpolationConfig = _interpolationConfig; } /** * @param {?} nodes * @param {?} meaning * @param {?} description * @param {?} id * @return {?} */ _I18nVisitor.prototype.toI18nMessage = function (nodes, meaning, description, id) { this._isIcu = nodes.length == 1 && nodes[0] instanceof Expansion; this._icuDepth = 0; this._placeholderRegistry = new PlaceholderRegistry(); this._placeholderToContent = {}; this._placeholderToMessage = {}; var /** @type {?} */ i18nodes = visitAll(this, nodes, {}); return new Message(i18nodes, this._placeholderToContent, this._placeholderToMessage, meaning, description, id); }; /** * @param {?} el * @param {?} context * @return {?} */ _I18nVisitor.prototype.visitElement = function (el, context) { var /** @type {?} */ children = visitAll(this, el.children); var /** @type {?} */ attrs = {}; el.attrs.forEach(function (attr) { // Do not visit the attributes, translatable ones are top-level ASTs attrs[attr.name] = attr.value; }); var /** @type {?} */ isVoid = getHtmlTagDefinition(el.name).isVoid; var /** @type {?} */ startPhName = this._placeholderRegistry.getStartTagPlaceholderName(el.name, attrs, isVoid); this._placeholderToContent[startPhName] = ((el.sourceSpan)).toString(); var /** @type {?} */ closePhName = ''; if (!isVoid) { closePhName = this._placeholderRegistry.getCloseTagPlaceholderName(el.name); this._placeholderToContent[closePhName] = ""; } return new TagPlaceholder(el.name, attrs, startPhName, closePhName, children, isVoid, /** @type {?} */ ((el.sourceSpan))); }; /** * @param {?} attribute * @param {?} context * @return {?} */ _I18nVisitor.prototype.visitAttribute = function (attribute, context) { return this._visitTextWithInterpolation(attribute.value, attribute.sourceSpan); }; /** * @param {?} text * @param {?} context * @return {?} */ _I18nVisitor.prototype.visitText = function (text, context) { return this._visitTextWithInterpolation(text.value, /** @type {?} */ ((text.sourceSpan))); }; /** * @param {?} comment * @param {?} context * @return {?} */ _I18nVisitor.prototype.visitComment = function (comment, context) { return null; }; /** * @param {?} icu * @param {?} context * @return {?} */ _I18nVisitor.prototype.visitExpansion = function (icu, context) { var _this = this; this._icuDepth++; var /** @type {?} */ i18nIcuCases = {}; var /** @type {?} */ i18nIcu = new Icu(icu.switchValue, icu.type, i18nIcuCases, icu.sourceSpan); icu.cases.forEach(function (caze) { i18nIcuCases[caze.value] = new Container(caze.expression.map(function (node) { return node.visit(_this, {}); }), caze.expSourceSpan); }); this._icuDepth--; if (this._isIcu || this._icuDepth > 0) { // Returns an ICU node when: // - the message (vs a part of the message) is an ICU message, or // - the ICU message is nested. var /** @type {?} */ expPh = this._placeholderRegistry.getUniquePlaceholder("VAR_" + icu.type); i18nIcu.expressionPlaceholder = expPh; this._placeholderToContent[expPh] = icu.switchValue; return i18nIcu; } // Else returns a placeholder // ICU placeholders should not be replaced with their original content but with the their // translations. We need to create a new visitor (they are not re-entrant) to compute the // message id. // TODO(vicb): add a html.Node -> i18n.Message cache to avoid having to re-create the msg var /** @type {?} */ phName = this._placeholderRegistry.getPlaceholderName('ICU', icu.sourceSpan.toString()); var /** @type {?} */ visitor = new _I18nVisitor(this._expressionParser, this._interpolationConfig); this._placeholderToMessage[phName] = visitor.toI18nMessage([icu], '', '', ''); return new IcuPlaceholder(i18nIcu, phName, icu.sourceSpan); }; /** * @param {?} icuCase * @param {?} context * @return {?} */ _I18nVisitor.prototype.visitExpansionCase = function (icuCase, context) { throw new Error('Unreachable code'); }; /** * @param {?} text * @param {?} sourceSpan * @return {?} */ _I18nVisitor.prototype._visitTextWithInterpolation = function (text, sourceSpan) { var /** @type {?} */ splitInterpolation = this._expressionParser.splitInterpolation(text, sourceSpan.start.toString(), this._interpolationConfig); if (!splitInterpolation) { // No expression, return a single text return new Text$1(text, sourceSpan); } // Return a group of text + expressions var /** @type {?} */ nodes = []; var /** @type {?} */ container = new Container(nodes, sourceSpan); var _a = this._interpolationConfig, sDelimiter = _a.start, eDelimiter = _a.end; for (var /** @type {?} */ i = 0; i < splitInterpolation.strings.length - 1; i++) { var /** @type {?} */ expression = splitInterpolation.expressions[i]; var /** @type {?} */ baseName = _extractPlaceholderName(expression) || 'INTERPOLATION'; var /** @type {?} */ phName = this._placeholderRegistry.getPlaceholderName(baseName, expression); if (splitInterpolation.strings[i].length) { // No need to add empty strings nodes.push(new Text$1(splitInterpolation.strings[i], sourceSpan)); } nodes.push(new Placeholder(expression, phName, sourceSpan)); this._placeholderToContent[phName] = sDelimiter + expression + eDelimiter; } // The last index contains no expression var /** @type {?} */ lastStringIdx = splitInterpolation.strings.length - 1; if (splitInterpolation.strings[lastStringIdx].length) { nodes.push(new Text$1(splitInterpolation.strings[lastStringIdx], sourceSpan)); } return container; }; return _I18nVisitor; }()); var _CUSTOM_PH_EXP = /\/\/[\s\S]*i18n[\s\S]*\([\s\S]*ph[\s\S]*=[\s\S]*("|')([\s\S]*?)\1[\s\S]*\)/g; /** * @param {?} input * @return {?} */ function _extractPlaceholderName(input) { return input.split(_CUSTOM_PH_EXP)[2]; } /** * @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 i18n error. */ var I18nError = (function (_super) { __extends(I18nError, _super); /** * @param {?} span * @param {?} msg */ function I18nError(span, msg) { return _super.call(this, span, msg) || this; } return I18nError; }(ParseError)); /** * @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 _I18N_ATTR = 'i18n'; var _I18N_ATTR_PREFIX = 'i18n-'; var _I18N_COMMENT_PREFIX_REGEXP = /^i18n:?/; var MEANING_SEPARATOR = '|'; var ID_SEPARATOR = '@@'; /** * Extract translatable messages from an html AST * @param {?} nodes * @param {?} interpolationConfig * @param {?} implicitTags * @param {?} implicitAttrs * @return {?} */ function extractMessages(nodes, interpolationConfig, implicitTags, implicitAttrs) { var /** @type {?} */ visitor = new _Visitor(implicitTags, implicitAttrs); return visitor.extract(nodes, interpolationConfig); } /** * @param {?} nodes * @param {?} translations * @param {?} interpolationConfig * @param {?} implicitTags * @param {?} implicitAttrs * @return {?} */ function mergeTranslations(nodes, translations, interpolationConfig, implicitTags, implicitAttrs) { var /** @type {?} */ visitor = new _Visitor(implicitTags, implicitAttrs); return visitor.merge(nodes, translations, interpolationConfig); } var ExtractionResult = (function () { /** * @param {?} messages * @param {?} errors */ function ExtractionResult(messages, errors) { this.messages = messages; this.errors = errors; } return ExtractionResult; }()); var _VisitorMode = {}; _VisitorMode.Extract = 0; _VisitorMode.Merge = 1; _VisitorMode[_VisitorMode.Extract] = "Extract"; _VisitorMode[_VisitorMode.Merge] = "Merge"; /** * This Visitor is used: * 1. to extract all the translatable strings from an html AST (see `extract()`), * 2. to replace the translatable strings with the actual translations (see `merge()`) * * \@internal */ var _Visitor = (function () { /** * @param {?} _implicitTags * @param {?} _implicitAttrs */ function _Visitor(_implicitTags, _implicitAttrs) { this._implicitTags = _implicitTags; this._implicitAttrs = _implicitAttrs; } /** * Extracts the messages from the tree * @param {?} nodes * @param {?} interpolationConfig * @return {?} */ _Visitor.prototype.extract = function (nodes, interpolationConfig) { var _this = this; this._init(_VisitorMode.Extract, interpolationConfig); nodes.forEach(function (node) { return node.visit(_this, null); }); if (this._inI18nBlock) { this._reportError(nodes[nodes.length - 1], 'Unclosed block'); } return new ExtractionResult(this._messages, this._errors); }; /** * Returns a tree where all translatable nodes are translated * @param {?} nodes * @param {?} translations * @param {?} interpolationConfig * @return {?} */ _Visitor.prototype.merge = function (nodes, translations, interpolationConfig) { this._init(_VisitorMode.Merge, interpolationConfig); this._translations = translations; // Construct a single fake root element var /** @type {?} */ wrapper = new Element('wrapper', [], nodes, /** @type {?} */ ((undefined)), undefined, undefined); var /** @type {?} */ translatedNode = wrapper.visit(this, null); if (this._inI18nBlock) { this._reportError(nodes[nodes.length - 1], 'Unclosed block'); } return new ParseTreeResult(translatedNode.children, this._errors); }; /** * @param {?} icuCase * @param {?} context * @return {?} */ _Visitor.prototype.visitExpansionCase = function (icuCase, context) { // Parse cases for translatable html attributes var /** @type {?} */ expression = visitAll(this, icuCase.expression, context); if (this._mode === _VisitorMode.Merge) { return new ExpansionCase(icuCase.value, expression, icuCase.sourceSpan, icuCase.valueSourceSpan, icuCase.expSourceSpan); } }; /** * @param {?} icu * @param {?} context * @return {?} */ _Visitor.prototype.visitExpansion = function (icu, context) { this._mayBeAddBlockChildren(icu); var /** @type {?} */ wasInIcu = this._inIcu; if (!this._inIcu) { // nested ICU messages should not be extracted but top-level translated as a whole if (this._isInTranslatableSection) { this._addMessage([icu]); } this._inIcu = true; } var /** @type {?} */ cases = visitAll(this, icu.cases, context); if (this._mode === _VisitorMode.Merge) { icu = new Expansion(icu.switchValue, icu.type, cases, icu.sourceSpan, icu.switchValueSourceSpan); } this._inIcu = wasInIcu; return icu; }; /** * @param {?} comment * @param {?} context * @return {?} */ _Visitor.prototype.visitComment = function (comment, context) { var /** @type {?} */ isOpening = _isOpeningComment(comment); if (isOpening && this._isInTranslatableSection) { this._reportError(comment, 'Could not start a block inside a translatable section'); return; } var /** @type {?} */ isClosing = _isClosingComment(comment); if (isClosing && !this._inI18nBlock) { this._reportError(comment, 'Trying to close an unopened block'); return; } if (!this._inI18nNode && !this._inIcu) { if (!this._inI18nBlock) { if (isOpening) { this._inI18nBlock = true; this._blockStartDepth = this._depth; this._blockChildren = []; this._blockMeaningAndDesc = ((comment.value)).replace(_I18N_COMMENT_PREFIX_REGEXP, '').trim(); this._openTranslatableSection(comment); } } else { if (isClosing) { if (this._depth == this._blockStartDepth) { this._closeTranslatableSection(comment, this._blockChildren); this._inI18nBlock = false; var /** @type {?} */ message = ((this._addMessage(this._blockChildren, this._blockMeaningAndDesc))); // merge attributes in sections var /** @type {?} */ nodes = this._translateMessage(comment, message); return visitAll(this, nodes); } else { this._reportError(comment, 'I18N blocks should not cross element boundaries'); return; } } } } }; /** * @param {?} text * @param {?} context * @return {?} */ _Visitor.prototype.visitText = function (text, context) { if (this._isInTranslatableSection) { this._mayBeAddBlockChildren(text); } return text; }; /** * @param {?} el * @param {?} context * @return {?} */ _Visitor.prototype.visitElement = function (el, context) { var _this = this; this._mayBeAddBlockChildren(el); this._depth++; var /** @type {?} */ wasInI18nNode = this._inI18nNode; var /** @type {?} */ wasInImplicitNode = this._inImplicitNode; var /** @type {?} */ childNodes = []; var /** @type {?} */ translatedChildNodes = ((undefined)); // Extract: // - top level nodes with the (implicit) "i18n" attribute if not already in a section // - ICU messages var /** @type {?} */ i18nAttr = _getI18nAttr(el); var /** @type {?} */ i18nMeta = i18nAttr ? i18nAttr.value : ''; var /** @type {?} */ isImplicit = this._implicitTags.some(function (tag) { return el.name === tag; }) && !this._inIcu && !this._isInTranslatableSection; var /** @type {?} */ isTopLevelImplicit = !wasInImplicitNode && isImplicit; this._inImplicitNode = wasInImplicitNode || isImplicit; if (!this._isInTranslatableSection && !this._inIcu) { if (i18nAttr || isTopLevelImplicit) { this._inI18nNode = true; var /** @type {?} */ message = ((this._addMessage(el.children, i18nMeta))); translatedChildNodes = this._translateMessage(el, message); } if (this._mode == _VisitorMode.Extract) { var /** @type {?} */ isTranslatable = i18nAttr || isTopLevelImplicit; if (isTranslatable) this._openTranslatableSection(el); visitAll(this, el.children); if (isTranslatable) this._closeTranslatableSection(el, el.children); } } else { if (i18nAttr || isTopLevelImplicit) { this._reportError(el, 'Could not mark an element as translatable inside a translatable section'); } if (this._mode == _VisitorMode.Extract) { // Descend into child nodes for extraction visitAll(this, el.children); } } if (this._mode === _VisitorMode.Merge) { var /** @type {?} */ visitNodes = translatedChildNodes || el.children; visitNodes.forEach(function (child) { var /** @type {?} */ visited = child.visit(_this, context); if (visited && !_this._isInTranslatableSection) { // Do not add the children from translatable sections (= i18n blocks here) // They will be added later in this loop when the block closes (i.e. on ``) childNodes = childNodes.concat(visited); } }); } this._visitAttributesOf(el); this._depth--; this._inI18nNode = wasInI18nNode; this._inImplicitNode = wasInImplicitNode; if (this._mode === _VisitorMode.Merge) { var /** @type {?} */ translatedAttrs = this._translateAttributes(el); return new Element(el.name, translatedAttrs, childNodes, el.sourceSpan, el.startSourceSpan, el.endSourceSpan); } return null; }; /** * @param {?} attribute * @param {?} context * @return {?} */ _Visitor.prototype.visitAttribute = function (attribute, context) { throw new Error('unreachable code'); }; /** * @param {?} mode * @param {?} interpolationConfig * @return {?} */ _Visitor.prototype._init = function (mode, interpolationConfig) { this._mode = mode; this._inI18nBlock = false; this._inI18nNode = false; this._depth = 0; this._inIcu = false; this._msgCountAtSectionStart = undefined; this._errors = []; this._messages = []; this._inImplicitNode = false; this._createI18nMessage = createI18nMessageFactory(interpolationConfig); }; /** * @param {?} el * @return {?} */ _Visitor.prototype._visitAttributesOf = function (el) { var _this = this; var /** @type {?} */ explicitAttrNameToValue = {}; var /** @type {?} */ implicitAttrNames = this._implicitAttrs[el.name] || []; el.attrs.filter(function (attr) { return attr.name.startsWith(_I18N_ATTR_PREFIX); }) .forEach(function (attr) { return explicitAttrNameToValue[attr.name.slice(_I18N_ATTR_PREFIX.length)] = attr.value; }); el.attrs.forEach(function (attr) { if (attr.name in explicitAttrNameToValue) { _this._addMessage([attr], explicitAttrNameToValue[attr.name]); } else if (implicitAttrNames.some(function (name) { return attr.name === name; })) { _this._addMessage([attr]); } }); }; /** * @param {?} ast * @param {?=} msgMeta * @return {?} */ _Visitor.prototype._addMessage = function (ast, msgMeta) { if (ast.length == 0 || ast.length == 1 && ast[0] instanceof Attribute$1 && !((ast[0])).value) { // Do not create empty messages return null; } var _a = _parseMessageMeta(msgMeta), meaning = _a.meaning, description = _a.description, id = _a.id; var /** @type {?} */ message = this._createI18nMessage(ast, meaning, description, id); this._messages.push(message); return message; }; /** * @param {?} el * @param {?} message * @return {?} */ _Visitor.prototype._translateMessage = function (el, message) { if (message && this._mode === _VisitorMode.Merge) { var /** @type {?} */ nodes = this._translations.get(message); if (nodes) { return nodes; } this._reportError(el, "Translation unavailable for message id=\"" + this._translations.digest(message) + "\""); } return []; }; /** * @param {?} el * @return {?} */ _Visitor.prototype._translateAttributes = function (el) { var _this = this; var /** @type {?} */ attributes = el.attrs; var /** @type {?} */ i18nParsedMessageMeta = {}; attributes.forEach(function (attr) { if (attr.name.startsWith(_I18N_ATTR_PREFIX)) { i18nParsedMessageMeta[attr.name.slice(_I18N_ATTR_PREFIX.length)] = _parseMessageMeta(attr.value); } }); var /** @type {?} */ translatedAttributes = []; attributes.forEach(function (attr) { if (attr.name === _I18N_ATTR || attr.name.startsWith(_I18N_ATTR_PREFIX)) { // strip i18n specific attributes return; } if (attr.value && attr.value != '' && i18nParsedMessageMeta.hasOwnProperty(attr.name)) { var _a = i18nParsedMessageMeta[attr.name], meaning = _a.meaning, description = _a.description, id = _a.id; var /** @type {?} */ message = _this._createI18nMessage([attr], meaning, description, id); var /** @type {?} */ nodes = _this._translations.get(message); if (nodes) { if (nodes.length == 0) { translatedAttributes.push(new Attribute$1(attr.name, '', attr.sourceSpan)); } else if (nodes[0] instanceof Text) { var /** @type {?} */ value = ((nodes[0])).value; translatedAttributes.push(new Attribute$1(attr.name, value, attr.sourceSpan)); } else { _this._reportError(el, "Unexpected translation for attribute \"" + attr.name + "\" (id=\"" + (id || _this._translations.digest(message)) + "\")"); } } else { _this._reportError(el, "Translation unavailable for attribute \"" + attr.name + "\" (id=\"" + (id || _this._translations.digest(message)) + "\")"); } } else { translatedAttributes.push(attr); } }); return translatedAttributes; }; /** * Add the node as a child of the block when: * - we are in a block, * - we are not inside a ICU message (those are handled separately), * - the node is a "direct child" of the block * @param {?} node * @return {?} */ _Visitor.prototype._mayBeAddBlockChildren = function (node) { if (this._inI18nBlock && !this._inIcu && this._depth == this._blockStartDepth) { this._blockChildren.push(node); } }; /** * Marks the start of a section, see `_closeTranslatableSection` * @param {?} node * @return {?} */ _Visitor.prototype._openTranslatableSection = function (node) { if (this._isInTranslatableSection) { this._reportError(node, 'Unexpected section start'); } else { this._msgCountAtSectionStart = this._messages.length; } }; Object.defineProperty(_Visitor.prototype, "_isInTranslatableSection", { /** * A translatable section could be: * - the content of translatable element, * - nodes between `` and `` comments * @return {?} */ get: function () { return this._msgCountAtSectionStart !== void 0; }, enumerable: true, configurable: true }); /** * Terminates a section. * * If a section has only one significant children (comments not significant) then we should not * keep the message from this children: * * `

    {ICU message}

    ` would produce two messages: * - one for the

    content with meaning and description, * - another one for the ICU message. * * In this case the last message is discarded as it contains less information (the AST is * otherwise identical). * * Note that we should still keep messages extracted from attributes inside the section (ie in the * ICU message here) * @param {?} node * @param {?} directChildren * @return {?} */ _Visitor.prototype._closeTranslatableSection = function (node, directChildren) { if (!this._isInTranslatableSection) { this._reportError(node, 'Unexpected section end'); return; } var /** @type {?} */ startIndex = this._msgCountAtSectionStart; var /** @type {?} */ significantChildren = directChildren.reduce(function (count, node) { return count + (node instanceof Comment ? 0 : 1); }, 0); if (significantChildren == 1) { for (var /** @type {?} */ i = this._messages.length - 1; i >= startIndex; i--) { var /** @type {?} */ ast = this._messages[i].nodes; if (!(ast.length == 1 && ast[0] instanceof Text$1)) { this._messages.splice(i, 1); break; } } } this._msgCountAtSectionStart = undefined; }; /** * @param {?} node * @param {?} msg * @return {?} */ _Visitor.prototype._reportError = function (node, msg) { this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), msg)); }; return _Visitor; }()); /** * @param {?} n * @return {?} */ function _isOpeningComment(n) { return !!(n instanceof Comment && n.value && n.value.startsWith('i18n')); } /** * @param {?} n * @return {?} */ function _isClosingComment(n) { return !!(n instanceof Comment && n.value && n.value === '/i18n'); } /** * @param {?} p * @return {?} */ function _getI18nAttr(p) { return p.attrs.find(function (attr) { return attr.name === _I18N_ATTR; }) || null; } /** * @param {?=} i18n * @return {?} */ function _parseMessageMeta(i18n) { if (!i18n) return { meaning: '', description: '', id: '' }; var /** @type {?} */ idIndex = i18n.indexOf(ID_SEPARATOR); var /** @type {?} */ descIndex = i18n.indexOf(MEANING_SEPARATOR); var _a = (idIndex > -1) ? [i18n.slice(0, idIndex), i18n.slice(idIndex + 2)] : [i18n, ''], meaningAndDesc = _a[0], id = _a[1]; var _b = (descIndex > -1) ? [meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)] : ['', meaningAndDesc], meaning = _b[0], description = _b[1]; return { meaning: meaning, description: description, id: id }; } /** * @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 XmlTagDefinition = (function () { function XmlTagDefinition() { this.closedByParent = false; this.contentType = TagContentType.PARSABLE_DATA; this.isVoid = false; this.ignoreFirstLf = false; this.canSelfClose = true; } /** * @param {?} currentParent * @return {?} */ XmlTagDefinition.prototype.requireExtraParent = function (currentParent) { return false; }; /** * @param {?} name * @return {?} */ XmlTagDefinition.prototype.isClosedByChild = function (name) { return false; }; return XmlTagDefinition; }()); var _TAG_DEFINITION = new XmlTagDefinition(); /** * @param {?} tagName * @return {?} */ function getXmlTagDefinition(tagName) { return _TAG_DEFINITION; } /** * @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 XmlParser = (function (_super) { __extends(XmlParser, _super); function XmlParser() { return _super.call(this, getXmlTagDefinition) || this; } /** * @param {?} source * @param {?} url * @param {?=} parseExpansionForms * @return {?} */ XmlParser.prototype.parse = function (source, url, parseExpansionForms) { if (parseExpansionForms === void 0) { parseExpansionForms = false; } return _super.prototype.parse.call(this, source, url, parseExpansionForms); }; return XmlParser; }(Parser$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 */ /** * @param {?} message * @return {?} */ function digest(message) { return message.id || sha1(serializeNodes(message.nodes).join('') + ("[" + message.meaning + "]")); } /** * @param {?} message * @return {?} */ function decimalDigest(message) { if (message.id) { return message.id; } var /** @type {?} */ visitor = new _SerializerIgnoreIcuExpVisitor(); var /** @type {?} */ parts = message.nodes.map(function (a) { return a.visit(visitor, null); }); return computeMsgId(parts.join(''), message.meaning); } /** * Serialize the i18n ast to something xml-like in order to generate an UID. * * The visitor is also used in the i18n parser tests * * \@internal */ var _SerializerVisitor = (function () { function _SerializerVisitor() { } /** * @param {?} text * @param {?} context * @return {?} */ _SerializerVisitor.prototype.visitText = function (text, context) { return text.value; }; /** * @param {?} container * @param {?} context * @return {?} */ _SerializerVisitor.prototype.visitContainer = function (container, context) { var _this = this; return "[" + container.children.map(function (child) { return child.visit(_this); }).join(', ') + "]"; }; /** * @param {?} icu * @param {?} context * @return {?} */ _SerializerVisitor.prototype.visitIcu = function (icu, context) { var _this = this; var /** @type {?} */ strCases = Object.keys(icu.cases).map(function (k) { return k + " {" + icu.cases[k].visit(_this) + "}"; }); return "{" + icu.expression + ", " + icu.type + ", " + strCases.join(', ') + "}"; }; /** * @param {?} ph * @param {?} context * @return {?} */ _SerializerVisitor.prototype.visitTagPlaceholder = function (ph, context) { var _this = this; return ph.isVoid ? "" : "" + ph.children.map(function (child) { return child.visit(_this); }).join(', ') + ""; }; /** * @param {?} ph * @param {?} context * @return {?} */ _SerializerVisitor.prototype.visitPlaceholder = function (ph, context) { return ph.value ? "" + ph.value + "" : ""; }; /** * @param {?} ph * @param {?=} context * @return {?} */ _SerializerVisitor.prototype.visitIcuPlaceholder = function (ph, context) { return "" + ph.value.visit(this) + ""; }; return _SerializerVisitor; }()); var serializerVisitor = new _SerializerVisitor(); /** * @param {?} nodes * @return {?} */ function serializeNodes(nodes) { return nodes.map(function (a) { return a.visit(serializerVisitor, null); }); } /** * Serialize the i18n ast to something xml-like in order to generate an UID. * * Ignore the ICU expressions so that message IDs stays identical if only the expression changes. * * \@internal */ var _SerializerIgnoreIcuExpVisitor = (function (_super) { __extends(_SerializerIgnoreIcuExpVisitor, _super); function _SerializerIgnoreIcuExpVisitor() { return _super !== null && _super.apply(this, arguments) || this; } /** * @param {?} icu * @param {?} context * @return {?} */ _SerializerIgnoreIcuExpVisitor.prototype.visitIcu = function (icu, context) { var _this = this; var /** @type {?} */ strCases = Object.keys(icu.cases).map(function (k) { return k + " {" + icu.cases[k].visit(_this) + "}"; }); // Do not take the expression into account return "{" + icu.type + ", " + strCases.join(', ') + "}"; }; return _SerializerIgnoreIcuExpVisitor; }(_SerializerVisitor)); /** * Compute the SHA1 of the given string * * see http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf * * WARNING: this function has not been designed not tested with security in mind. * DO NOT USE IT IN A SECURITY SENSITIVE CONTEXT. * @param {?} str * @return {?} */ function sha1(str) { var /** @type {?} */ utf8 = utf8Encode(str); var /** @type {?} */ words32 = stringToWords32(utf8, Endian.Big); var /** @type {?} */ len = utf8.length * 8; var /** @type {?} */ w = new Array(80); var _a = [0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0], a = _a[0], b = _a[1], c = _a[2], d = _a[3], e = _a[4]; words32[len >> 5] |= 0x80 << (24 - len % 32); words32[((len + 64 >> 9) << 4) + 15] = len; for (var /** @type {?} */ i = 0; i < words32.length; i += 16) { var _b = [a, b, c, d, e], h0 = _b[0], h1 = _b[1], h2 = _b[2], h3 = _b[3], h4 = _b[4]; for (var /** @type {?} */ j = 0; j < 80; j++) { if (j < 16) { w[j] = words32[i + j]; } else { w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1); } var _c = fk(j, b, c, d), f = _c[0], k = _c[1]; var /** @type {?} */ temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32); _d = [d, c, rol32(b, 30), a, temp], e = _d[0], d = _d[1], c = _d[2], b = _d[3], a = _d[4]; } _e = [add32(a, h0), add32(b, h1), add32(c, h2), add32(d, h3), add32(e, h4)], a = _e[0], b = _e[1], c = _e[2], d = _e[3], e = _e[4]; } return byteStringToHexString(words32ToByteString([a, b, c, d, e])); var _d, _e; } /** * @param {?} index * @param {?} b * @param {?} c * @param {?} d * @return {?} */ function fk(index, b, c, d) { if (index < 20) { return [(b & c) | (~b & d), 0x5a827999]; } if (index < 40) { return [b ^ c ^ d, 0x6ed9eba1]; } if (index < 60) { return [(b & c) | (b & d) | (c & d), 0x8f1bbcdc]; } return [b ^ c ^ d, 0xca62c1d6]; } /** * Compute the fingerprint of the given string * * The output is 64 bit number encoded as a decimal string * * based on: * https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/GoogleJsMessageIdGenerator.java * @param {?} str * @return {?} */ function fingerprint(str) { var /** @type {?} */ utf8 = utf8Encode(str); var _a = [hash32(utf8, 0), hash32(utf8, 102072)], hi = _a[0], lo = _a[1]; if (hi == 0 && (lo == 0 || lo == 1)) { hi = hi ^ 0x130f9bef; lo = lo ^ -0x6b5f56d8; } return [hi, lo]; } /** * @param {?} msg * @param {?} meaning * @return {?} */ function computeMsgId(msg, meaning) { var _a = fingerprint(msg), hi = _a[0], lo = _a[1]; if (meaning) { var _b = fingerprint(meaning), him = _b[0], lom = _b[1]; _c = add64(rol64([hi, lo], 1), [him, lom]), hi = _c[0], lo = _c[1]; } return byteStringToDecString(words32ToByteString([hi & 0x7fffffff, lo])); var _c; } /** * @param {?} str * @param {?} c * @return {?} */ function hash32(str, c) { var _a = [0x9e3779b9, 0x9e3779b9], a = _a[0], b = _a[1]; var /** @type {?} */ i; var /** @type {?} */ len = str.length; for (i = 0; i + 12 <= len; i += 12) { a = add32(a, wordAt(str, i, Endian.Little)); b = add32(b, wordAt(str, i + 4, Endian.Little)); c = add32(c, wordAt(str, i + 8, Endian.Little)); _b = mix([a, b, c]), a = _b[0], b = _b[1], c = _b[2]; } a = add32(a, wordAt(str, i, Endian.Little)); b = add32(b, wordAt(str, i + 4, Endian.Little)); // the first byte of c is reserved for the length c = add32(c, len); c = add32(c, wordAt(str, i + 8, Endian.Little) << 8); return mix([a, b, c])[2]; var _b; } /** * @param {?} __0 * @return {?} */ function mix(_a) { var a = _a[0], b = _a[1], c = _a[2]; a = sub32(a, b); a = sub32(a, c); a ^= c >>> 13; b = sub32(b, c); b = sub32(b, a); b ^= a << 8; c = sub32(c, a); c = sub32(c, b); c ^= b >>> 13; a = sub32(a, b); a = sub32(a, c); a ^= c >>> 12; b = sub32(b, c); b = sub32(b, a); b ^= a << 16; c = sub32(c, a); c = sub32(c, b); c ^= b >>> 5; a = sub32(a, b); a = sub32(a, c); a ^= c >>> 3; b = sub32(b, c); b = sub32(b, a); b ^= a << 10; c = sub32(c, a); c = sub32(c, b); c ^= b >>> 15; return [a, b, c]; } var Endian = {}; Endian.Little = 0; Endian.Big = 1; Endian[Endian.Little] = "Little"; Endian[Endian.Big] = "Big"; /** * @param {?} a * @param {?} b * @return {?} */ function add32(a, b) { return add32to64(a, b)[1]; } /** * @param {?} a * @param {?} b * @return {?} */ function add32to64(a, b) { var /** @type {?} */ low = (a & 0xffff) + (b & 0xffff); var /** @type {?} */ high = (a >>> 16) + (b >>> 16) + (low >>> 16); return [high >>> 16, (high << 16) | (low & 0xffff)]; } /** * @param {?} __0 * @param {?} __1 * @return {?} */ function add64(_a, _b) { var ah = _a[0], al = _a[1]; var bh = _b[0], bl = _b[1]; var _c = add32to64(al, bl), carry = _c[0], l = _c[1]; var /** @type {?} */ h = add32(add32(ah, bh), carry); return [h, l]; } /** * @param {?} a * @param {?} b * @return {?} */ function sub32(a, b) { var /** @type {?} */ low = (a & 0xffff) - (b & 0xffff); var /** @type {?} */ high = (a >> 16) - (b >> 16) + (low >> 16); return (high << 16) | (low & 0xffff); } /** * @param {?} a * @param {?} count * @return {?} */ function rol32(a, count) { return (a << count) | (a >>> (32 - count)); } /** * @param {?} __0 * @param {?} count * @return {?} */ function rol64(_a, count) { var hi = _a[0], lo = _a[1]; var /** @type {?} */ h = (hi << count) | (lo >>> (32 - count)); var /** @type {?} */ l = (lo << count) | (hi >>> (32 - count)); return [h, l]; } /** * @param {?} str * @param {?} endian * @return {?} */ function stringToWords32(str, endian) { var /** @type {?} */ words32 = Array((str.length + 3) >>> 2); for (var /** @type {?} */ i = 0; i < words32.length; i++) { words32[i] = wordAt(str, i * 4, endian); } return words32; } /** * @param {?} str * @param {?} index * @return {?} */ function byteAt(str, index) { return index >= str.length ? 0 : str.charCodeAt(index) & 0xff; } /** * @param {?} str * @param {?} index * @param {?} endian * @return {?} */ function wordAt(str, index, endian) { var /** @type {?} */ word = 0; if (endian === Endian.Big) { for (var /** @type {?} */ i = 0; i < 4; i++) { word += byteAt(str, index + i) << (24 - 8 * i); } } else { for (var /** @type {?} */ i = 0; i < 4; i++) { word += byteAt(str, index + i) << 8 * i; } } return word; } /** * @param {?} words32 * @return {?} */ function words32ToByteString(words32) { return words32.reduce(function (str, word) { return str + word32ToByteString(word); }, ''); } /** * @param {?} word * @return {?} */ function word32ToByteString(word) { var /** @type {?} */ str = ''; for (var /** @type {?} */ i = 0; i < 4; i++) { str += String.fromCharCode((word >>> 8 * (3 - i)) & 0xff); } return str; } /** * @param {?} str * @return {?} */ function byteStringToHexString(str) { var /** @type {?} */ hex = ''; for (var /** @type {?} */ i = 0; i < str.length; i++) { var /** @type {?} */ b = byteAt(str, i); hex += (b >>> 4).toString(16) + (b & 0x0f).toString(16); } return hex.toLowerCase(); } /** * @param {?} str * @return {?} */ function byteStringToDecString(str) { var /** @type {?} */ decimal = ''; var /** @type {?} */ toThePower = '1'; for (var /** @type {?} */ i = str.length - 1; i >= 0; i--) { decimal = addBigInt(decimal, numberTimesBigInt(byteAt(str, i), toThePower)); toThePower = numberTimesBigInt(256, toThePower); } return decimal.split('').reverse().join(''); } /** * @param {?} x * @param {?} y * @return {?} */ function addBigInt(x, y) { var /** @type {?} */ sum = ''; var /** @type {?} */ len = Math.max(x.length, y.length); for (var /** @type {?} */ i = 0, /** @type {?} */ carry = 0; i < len || carry; i++) { var /** @type {?} */ tmpSum = carry + +(x[i] || 0) + +(y[i] || 0); if (tmpSum >= 10) { carry = 1; sum += tmpSum - 10; } else { carry = 0; sum += tmpSum; } } return sum; } /** * @param {?} num * @param {?} b * @return {?} */ function numberTimesBigInt(num, b) { var /** @type {?} */ product = ''; var /** @type {?} */ bToThePower = b; for (; num !== 0; num = num >>> 1) { if (num & 1) product = addBigInt(product, bToThePower); bToThePower = addBigInt(bToThePower, bToThePower); } return product; } /** * @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 */ /** * @abstract */ var Serializer = (function () { function Serializer() { } /** * @abstract * @param {?} messages * @param {?} locale * @return {?} */ Serializer.prototype.write = function (messages, locale) { }; /** * @abstract * @param {?} content * @param {?} url * @return {?} */ Serializer.prototype.load = function (content, url) { }; /** * @abstract * @param {?} message * @return {?} */ Serializer.prototype.digest = function (message) { }; /** * @param {?} message * @return {?} */ Serializer.prototype.createNameMapper = function (message) { return null; }; return Serializer; }()); /** * A simple mapper that take a function to transform an internal name to a public name */ var SimplePlaceholderMapper = (function (_super) { __extends(SimplePlaceholderMapper, _super); /** * @param {?} message * @param {?} mapName */ function SimplePlaceholderMapper(message, mapName) { var _this = _super.call(this) || this; _this.mapName = mapName; _this.internalToPublic = {}; _this.publicToNextId = {}; _this.publicToInternal = {}; message.nodes.forEach(function (node) { return node.visit(_this); }); return _this; } /** * @param {?} internalName * @return {?} */ SimplePlaceholderMapper.prototype.toPublicName = function (internalName) { return this.internalToPublic.hasOwnProperty(internalName) ? this.internalToPublic[internalName] : null; }; /** * @param {?} publicName * @return {?} */ SimplePlaceholderMapper.prototype.toInternalName = function (publicName) { return this.publicToInternal.hasOwnProperty(publicName) ? this.publicToInternal[publicName] : null; }; /** * @param {?} text * @param {?=} context * @return {?} */ SimplePlaceholderMapper.prototype.visitText = function (text, context) { return null; }; /** * @param {?} ph * @param {?=} context * @return {?} */ SimplePlaceholderMapper.prototype.visitTagPlaceholder = function (ph, context) { this.visitPlaceholderName(ph.startName); _super.prototype.visitTagPlaceholder.call(this, ph, context); this.visitPlaceholderName(ph.closeName); }; /** * @param {?} ph * @param {?=} context * @return {?} */ SimplePlaceholderMapper.prototype.visitPlaceholder = function (ph, context) { this.visitPlaceholderName(ph.name); }; /** * @param {?} ph * @param {?=} context * @return {?} */ SimplePlaceholderMapper.prototype.visitIcuPlaceholder = function (ph, context) { this.visitPlaceholderName(ph.name); }; /** * @param {?} internalName * @return {?} */ SimplePlaceholderMapper.prototype.visitPlaceholderName = function (internalName) { if (!internalName || this.internalToPublic.hasOwnProperty(internalName)) { return; } var /** @type {?} */ publicName = this.mapName(internalName); if (this.publicToInternal.hasOwnProperty(publicName)) { // Create a new XMB when it has already been used var /** @type {?} */ nextId = this.publicToNextId[publicName]; this.publicToNextId[publicName] = nextId + 1; publicName = publicName + "_" + nextId; } else { this.publicToNextId[publicName] = 1; } this.internalToPublic[internalName] = publicName; this.publicToInternal[publicName] = internalName; }; return SimplePlaceholderMapper; }(RecurseVisitor)); /** * @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 _Visitor$1 = (function () { function _Visitor$1() { } /** * @param {?} tag * @return {?} */ _Visitor$1.prototype.visitTag = function (tag) { var _this = this; var /** @type {?} */ strAttrs = this._serializeAttributes(tag.attrs); if (tag.children.length == 0) { return "<" + tag.name + strAttrs + "/>"; } var /** @type {?} */ strChildren = tag.children.map(function (node) { return node.visit(_this); }); return "<" + tag.name + strAttrs + ">" + strChildren.join('') + ""; }; /** * @param {?} text * @return {?} */ _Visitor$1.prototype.visitText = function (text) { return text.value; }; /** * @param {?} decl * @return {?} */ _Visitor$1.prototype.visitDeclaration = function (decl) { return ""; }; /** * @param {?} attrs * @return {?} */ _Visitor$1.prototype._serializeAttributes = function (attrs) { var /** @type {?} */ strAttrs = Object.keys(attrs).map(function (name) { return name + "=\"" + attrs[name] + "\""; }).join(' '); return strAttrs.length > 0 ? ' ' + strAttrs : ''; }; /** * @param {?} doctype * @return {?} */ _Visitor$1.prototype.visitDoctype = function (doctype) { return ""; }; return _Visitor$1; }()); var _visitor = new _Visitor$1(); /** * @param {?} nodes * @return {?} */ function serialize(nodes) { return nodes.map(function (node) { return node.visit(_visitor); }).join(''); } var Declaration = (function () { /** * @param {?} unescapedAttrs */ function Declaration(unescapedAttrs) { var _this = this; this.attrs = {}; Object.keys(unescapedAttrs).forEach(function (k) { _this.attrs[k] = _escapeXml(unescapedAttrs[k]); }); } /** * @param {?} visitor * @return {?} */ Declaration.prototype.visit = function (visitor) { return visitor.visitDeclaration(this); }; return Declaration; }()); var Doctype = (function () { /** * @param {?} rootTag * @param {?} dtd */ function Doctype(rootTag, dtd) { this.rootTag = rootTag; this.dtd = dtd; } ; /** * @param {?} visitor * @return {?} */ Doctype.prototype.visit = function (visitor) { return visitor.visitDoctype(this); }; return Doctype; }()); var Tag = (function () { /** * @param {?} name * @param {?=} unescapedAttrs * @param {?=} children */ function Tag(name, unescapedAttrs, children) { if (unescapedAttrs === void 0) { unescapedAttrs = {}; } if (children === void 0) { children = []; } var _this = this; this.name = name; this.children = children; this.attrs = {}; Object.keys(unescapedAttrs).forEach(function (k) { _this.attrs[k] = _escapeXml(unescapedAttrs[k]); }); } /** * @param {?} visitor * @return {?} */ Tag.prototype.visit = function (visitor) { return visitor.visitTag(this); }; return Tag; }()); var Text$2 = (function () { /** * @param {?} unescapedValue */ function Text$2(unescapedValue) { this.value = _escapeXml(unescapedValue); } ; /** * @param {?} visitor * @return {?} */ Text$2.prototype.visit = function (visitor) { return visitor.visitText(this); }; return Text$2; }()); var CR = (function (_super) { __extends(CR, _super); /** * @param {?=} ws */ function CR(ws) { if (ws === void 0) { ws = 0; } return _super.call(this, "\n" + new Array(ws + 1).join(' ')) || this; } return CR; }(Text$2)); var _ESCAPED_CHARS = [ [/&/g, '&'], [/"/g, '"'], [/'/g, '''], [//g, '>'], ]; /** * @param {?} text * @return {?} */ function _escapeXml(text) { return _ESCAPED_CHARS.reduce(function (text, entry) { return text.replace(entry[0], entry[1]); }, text); } /** * @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 _VERSION = '1.2'; var _XMLNS = 'urn:oasis:names:tc:xliff:document:1.2'; // TODO(vicb): make this a param (s/_/-/) var _DEFAULT_SOURCE_LANG = 'en'; var _PLACEHOLDER_TAG = 'x'; var _FILE_TAG = 'file'; var _SOURCE_TAG = 'source'; var _TARGET_TAG = 'target'; var _UNIT_TAG = 'trans-unit'; var _CONTEXT_GROUP_TAG = 'context-group'; var _CONTEXT_TAG = 'context'; var Xliff = (function (_super) { __extends(Xliff, _super); function Xliff() { return _super !== null && _super.apply(this, arguments) || this; } /** * @param {?} messages * @param {?} locale * @return {?} */ Xliff.prototype.write = function (messages, locale) { var /** @type {?} */ visitor = new _WriteVisitor(); var /** @type {?} */ transUnits = []; messages.forEach(function (message) { var /** @type {?} */ contextTags = []; message.sources.forEach(function (source) { var /** @type {?} */ contextGroupTag = new Tag(_CONTEXT_GROUP_TAG, { purpose: 'location' }); contextGroupTag.children.push(new CR(10), new Tag(_CONTEXT_TAG, { 'context-type': 'sourcefile' }, [new Text$2(source.filePath)]), new CR(10), new Tag(_CONTEXT_TAG, { 'context-type': 'linenumber' }, [new Text$2("" + source.startLine)]), new CR(8)); contextTags.push(new CR(8), contextGroupTag); }); var /** @type {?} */ transUnit = new Tag(_UNIT_TAG, { id: message.id, datatype: 'html' }); (_a = transUnit.children).push.apply(_a, [new CR(8), new Tag(_SOURCE_TAG, {}, visitor.serialize(message.nodes)), new CR(8), new Tag(_TARGET_TAG)].concat(contextTags)); if (message.description) { transUnit.children.push(new CR(8), new Tag('note', { priority: '1', from: 'description' }, [new Text$2(message.description)])); } if (message.meaning) { transUnit.children.push(new CR(8), new Tag('note', { priority: '1', from: 'meaning' }, [new Text$2(message.meaning)])); } transUnit.children.push(new CR(6)); transUnits.push(new CR(6), transUnit); var _a; }); var /** @type {?} */ body = new Tag('body', {}, transUnits.concat([new CR(4)])); var /** @type {?} */ file = new Tag('file', { 'source-language': locale || _DEFAULT_SOURCE_LANG, datatype: 'plaintext', original: 'ng2.template', }, [new CR(4), body, new CR(2)]); var /** @type {?} */ xliff = new Tag('xliff', { version: _VERSION, xmlns: _XMLNS }, [new CR(2), file, new CR()]); return serialize([ new Declaration({ version: '1.0', encoding: 'UTF-8' }), new CR(), xliff, new CR() ]); }; /** * @param {?} content * @param {?} url * @return {?} */ Xliff.prototype.load = function (content, url) { // xliff to xml nodes var /** @type {?} */ xliffParser = new XliffParser(); var _a = xliffParser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors; // xml nodes to i18n nodes var /** @type {?} */ i18nNodesByMsgId = {}; var /** @type {?} */ converter = new XmlToI18n(); Object.keys(msgIdToHtml).forEach(function (msgId) { var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, e = _a.errors; errors.push.apply(errors, e); i18nNodesByMsgId[msgId] = i18nNodes; }); if (errors.length) { throw new Error("xliff parse errors:\n" + errors.join('\n')); } return { locale: /** @type {?} */ ((locale)), i18nNodesByMsgId: i18nNodesByMsgId }; }; /** * @param {?} message * @return {?} */ Xliff.prototype.digest = function (message) { return digest(message); }; return Xliff; }(Serializer)); var _WriteVisitor = (function () { function _WriteVisitor() { } /** * @param {?} text * @param {?=} context * @return {?} */ _WriteVisitor.prototype.visitText = function (text, context) { return [new Text$2(text.value)]; }; /** * @param {?} container * @param {?=} context * @return {?} */ _WriteVisitor.prototype.visitContainer = function (container, context) { var _this = this; var /** @type {?} */ nodes = []; container.children.forEach(function (node) { return nodes.push.apply(nodes, node.visit(_this)); }); return nodes; }; /** * @param {?} icu * @param {?=} context * @return {?} */ _WriteVisitor.prototype.visitIcu = function (icu, context) { var _this = this; var /** @type {?} */ nodes = [new Text$2("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")]; Object.keys(icu.cases).forEach(function (c) { nodes.push.apply(nodes, [new Text$2(c + " {")].concat(icu.cases[c].visit(_this), [new Text$2("} ")])); }); nodes.push(new Text$2("}")); return nodes; }; /** * @param {?} ph * @param {?=} context * @return {?} */ _WriteVisitor.prototype.visitTagPlaceholder = function (ph, context) { var /** @type {?} */ ctype = getCtypeForTag(ph.tag); var /** @type {?} */ startTagPh = new Tag(_PLACEHOLDER_TAG, { id: ph.startName, ctype: ctype }); if (ph.isVoid) { // void tags have no children nor closing tags return [startTagPh]; } var /** @type {?} */ closeTagPh = new Tag(_PLACEHOLDER_TAG, { id: ph.closeName, ctype: ctype }); return [startTagPh].concat(this.serialize(ph.children), [closeTagPh]); }; /** * @param {?} ph * @param {?=} context * @return {?} */ _WriteVisitor.prototype.visitPlaceholder = function (ph, context) { return [new Tag(_PLACEHOLDER_TAG, { id: ph.name })]; }; /** * @param {?} ph * @param {?=} context * @return {?} */ _WriteVisitor.prototype.visitIcuPlaceholder = function (ph, context) { return [new Tag(_PLACEHOLDER_TAG, { id: ph.name })]; }; /** * @param {?} nodes * @return {?} */ _WriteVisitor.prototype.serialize = function (nodes) { var _this = this; return [].concat.apply([], nodes.map(function (node) { return node.visit(_this); })); }; return _WriteVisitor; }()); var XliffParser = (function () { function XliffParser() { this._locale = null; } /** * @param {?} xliff * @param {?} url * @return {?} */ XliffParser.prototype.parse = function (xliff, url) { this._unitMlString = null; this._msgIdToHtml = {}; var /** @type {?} */ xml = new XmlParser().parse(xliff, url, false); this._errors = xml.errors; visitAll(this, xml.rootNodes, null); return { msgIdToHtml: this._msgIdToHtml, errors: this._errors, locale: this._locale, }; }; /** * @param {?} element * @param {?} context * @return {?} */ XliffParser.prototype.visitElement = function (element, context) { switch (element.name) { case _UNIT_TAG: this._unitMlString = ((null)); var /** @type {?} */ idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; }); if (!idAttr) { this._addError(element, "<" + _UNIT_TAG + "> misses the \"id\" attribute"); } else { var /** @type {?} */ id = idAttr.value; if (this._msgIdToHtml.hasOwnProperty(id)) { this._addError(element, "Duplicated translations for msg " + id); } else { visitAll(this, element.children, null); if (typeof this._unitMlString === 'string') { this._msgIdToHtml[id] = this._unitMlString; } else { this._addError(element, "Message " + id + " misses a translation"); } } } break; case _SOURCE_TAG: // ignore source message break; case _TARGET_TAG: var /** @type {?} */ innerTextStart = ((element.startSourceSpan)).end.offset; var /** @type {?} */ innerTextEnd = ((element.endSourceSpan)).start.offset; var /** @type {?} */ content = ((element.startSourceSpan)).start.file.content; var /** @type {?} */ innerText = content.slice(innerTextStart, innerTextEnd); this._unitMlString = innerText; break; case _FILE_TAG: var /** @type {?} */ localeAttr = element.attrs.find(function (attr) { return attr.name === 'target-language'; }); if (localeAttr) { this._locale = localeAttr.value; } visitAll(this, element.children, null); break; default: // TODO(vicb): assert file structure, xliff version // For now only recurse on unhandled nodes visitAll(this, element.children, null); } }; /** * @param {?} attribute * @param {?} context * @return {?} */ XliffParser.prototype.visitAttribute = function (attribute, context) { }; /** * @param {?} text * @param {?} context * @return {?} */ XliffParser.prototype.visitText = function (text, context) { }; /** * @param {?} comment * @param {?} context * @return {?} */ XliffParser.prototype.visitComment = function (comment, context) { }; /** * @param {?} expansion * @param {?} context * @return {?} */ XliffParser.prototype.visitExpansion = function (expansion, context) { }; /** * @param {?} expansionCase * @param {?} context * @return {?} */ XliffParser.prototype.visitExpansionCase = function (expansionCase, context) { }; /** * @param {?} node * @param {?} message * @return {?} */ XliffParser.prototype._addError = function (node, message) { this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message)); }; return XliffParser; }()); var XmlToI18n = (function () { function XmlToI18n() { } /** * @param {?} message * @param {?} url * @return {?} */ XmlToI18n.prototype.convert = function (message, url) { var /** @type {?} */ xmlIcu = new XmlParser().parse(message, url, true); this._errors = xmlIcu.errors; var /** @type {?} */ i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ? [] : visitAll(this, xmlIcu.rootNodes); return { i18nNodes: i18nNodes, errors: this._errors, }; }; /** * @param {?} text * @param {?} context * @return {?} */ XmlToI18n.prototype.visitText = function (text, context) { return new Text$1(text.value, /** @type {?} */ ((text.sourceSpan))); }; /** * @param {?} el * @param {?} context * @return {?} */ XmlToI18n.prototype.visitElement = function (el, context) { if (el.name === _PLACEHOLDER_TAG) { var /** @type {?} */ nameAttr = el.attrs.find(function (attr) { return attr.name === 'id'; }); if (nameAttr) { return new Placeholder('', nameAttr.value, /** @type {?} */ ((el.sourceSpan))); } this._addError(el, "<" + _PLACEHOLDER_TAG + "> misses the \"id\" attribute"); } else { this._addError(el, "Unexpected tag"); } return null; }; /** * @param {?} icu * @param {?} context * @return {?} */ XmlToI18n.prototype.visitExpansion = function (icu, context) { var /** @type {?} */ caseMap = {}; visitAll(this, icu.cases).forEach(function (c) { caseMap[c.value] = new Container(c.nodes, icu.sourceSpan); }); return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan); }; /** * @param {?} icuCase * @param {?} context * @return {?} */ XmlToI18n.prototype.visitExpansionCase = function (icuCase, context) { return { value: icuCase.value, nodes: visitAll(this, icuCase.expression), }; }; /** * @param {?} comment * @param {?} context * @return {?} */ XmlToI18n.prototype.visitComment = function (comment, context) { }; /** * @param {?} attribute * @param {?} context * @return {?} */ XmlToI18n.prototype.visitAttribute = function (attribute, context) { }; /** * @param {?} node * @param {?} message * @return {?} */ XmlToI18n.prototype._addError = function (node, message) { this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message)); }; return XmlToI18n; }()); /** * @param {?} tag * @return {?} */ function getCtypeForTag(tag) { switch (tag.toLowerCase()) { case 'br': return 'lb'; case 'img': return 'image'; default: return "x-" + tag; } } /** * @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 _VERSION$1 = '2.0'; var _XMLNS$1 = 'urn:oasis:names:tc:xliff:document:2.0'; // TODO(vicb): make this a param (s/_/-/) var _DEFAULT_SOURCE_LANG$1 = 'en'; var _PLACEHOLDER_TAG$1 = 'ph'; var _PLACEHOLDER_SPANNING_TAG = 'pc'; var _XLIFF_TAG = 'xliff'; var _SOURCE_TAG$1 = 'source'; var _TARGET_TAG$1 = 'target'; var _UNIT_TAG$1 = 'unit'; var Xliff2 = (function (_super) { __extends(Xliff2, _super); function Xliff2() { return _super !== null && _super.apply(this, arguments) || this; } /** * @param {?} messages * @param {?} locale * @return {?} */ Xliff2.prototype.write = function (messages, locale) { var /** @type {?} */ visitor = new _WriteVisitor$1(); var /** @type {?} */ units = []; messages.forEach(function (message) { var /** @type {?} */ unit = new Tag(_UNIT_TAG$1, { id: message.id }); if (message.description || message.meaning) { var /** @type {?} */ notes = new Tag('notes'); if (message.description) { notes.children.push(new CR(8), new Tag('note', { category: 'description' }, [new Text$2(message.description)])); } if (message.meaning) { notes.children.push(new CR(8), new Tag('note', { category: 'meaning' }, [new Text$2(message.meaning)])); } notes.children.push(new CR(6)); unit.children.push(new CR(6), notes); } var /** @type {?} */ segment = new Tag('segment'); segment.children.push(new CR(8), new Tag(_SOURCE_TAG$1, {}, visitor.serialize(message.nodes)), new CR(6)); unit.children.push(new CR(6), segment, new CR(4)); units.push(new CR(4), unit); }); var /** @type {?} */ file = new Tag('file', { 'original': 'ng.template', id: 'ngi18n' }, units.concat([new CR(2)])); var /** @type {?} */ xliff = new Tag(_XLIFF_TAG, { version: _VERSION$1, xmlns: _XMLNS$1, srcLang: locale || _DEFAULT_SOURCE_LANG$1 }, [new CR(2), file, new CR()]); return serialize([ new Declaration({ version: '1.0', encoding: 'UTF-8' }), new CR(), xliff, new CR() ]); }; /** * @param {?} content * @param {?} url * @return {?} */ Xliff2.prototype.load = function (content, url) { // xliff to xml nodes var /** @type {?} */ xliff2Parser = new Xliff2Parser(); var _a = xliff2Parser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors; // xml nodes to i18n nodes var /** @type {?} */ i18nNodesByMsgId = {}; var /** @type {?} */ converter = new XmlToI18n$1(); Object.keys(msgIdToHtml).forEach(function (msgId) { var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, e = _a.errors; errors.push.apply(errors, e); i18nNodesByMsgId[msgId] = i18nNodes; }); if (errors.length) { throw new Error("xliff2 parse errors:\n" + errors.join('\n')); } return { locale: /** @type {?} */ ((locale)), i18nNodesByMsgId: i18nNodesByMsgId }; }; /** * @param {?} message * @return {?} */ Xliff2.prototype.digest = function (message) { return decimalDigest(message); }; return Xliff2; }(Serializer)); var _WriteVisitor$1 = (function () { function _WriteVisitor$1() { } /** * @param {?} text * @param {?=} context * @return {?} */ _WriteVisitor$1.prototype.visitText = function (text, context) { return [new Text$2(text.value)]; }; /** * @param {?} container * @param {?=} context * @return {?} */ _WriteVisitor$1.prototype.visitContainer = function (container, context) { var _this = this; var /** @type {?} */ nodes = []; container.children.forEach(function (node) { return nodes.push.apply(nodes, node.visit(_this)); }); return nodes; }; /** * @param {?} icu * @param {?=} context * @return {?} */ _WriteVisitor$1.prototype.visitIcu = function (icu, context) { var _this = this; var /** @type {?} */ nodes = [new Text$2("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")]; Object.keys(icu.cases).forEach(function (c) { nodes.push.apply(nodes, [new Text$2(c + " {")].concat(icu.cases[c].visit(_this), [new Text$2("} ")])); }); nodes.push(new Text$2("}")); return nodes; }; /** * @param {?} ph * @param {?=} context * @return {?} */ _WriteVisitor$1.prototype.visitTagPlaceholder = function (ph, context) { var _this = this; var /** @type {?} */ type = getTypeForTag(ph.tag); if (ph.isVoid) { var /** @type {?} */ tagPh = new Tag(_PLACEHOLDER_TAG$1, { id: (this._nextPlaceholderId++).toString(), equiv: ph.startName, type: type, disp: "<" + ph.tag + "/>", }); return [tagPh]; } var /** @type {?} */ tagPc = new Tag(_PLACEHOLDER_SPANNING_TAG, { id: (this._nextPlaceholderId++).toString(), equivStart: ph.startName, equivEnd: ph.closeName, type: type, dispStart: "<" + ph.tag + ">", dispEnd: "", }); var /** @type {?} */ nodes = [].concat.apply([], ph.children.map(function (node) { return node.visit(_this); })); if (nodes.length) { nodes.forEach(function (node) { return tagPc.children.push(node); }); } else { tagPc.children.push(new Text$2('')); } return [tagPc]; }; /** * @param {?} ph * @param {?=} context * @return {?} */ _WriteVisitor$1.prototype.visitPlaceholder = function (ph, context) { return [new Tag(_PLACEHOLDER_TAG$1, { id: (this._nextPlaceholderId++).toString(), equiv: ph.name, disp: "{{" + ph.value + "}}", })]; }; /** * @param {?} ph * @param {?=} context * @return {?} */ _WriteVisitor$1.prototype.visitIcuPlaceholder = function (ph, context) { return [new Tag(_PLACEHOLDER_TAG$1, { id: (this._nextPlaceholderId++).toString() })]; }; /** * @param {?} nodes * @return {?} */ _WriteVisitor$1.prototype.serialize = function (nodes) { var _this = this; this._nextPlaceholderId = 0; return [].concat.apply([], nodes.map(function (node) { return node.visit(_this); })); }; return _WriteVisitor$1; }()); var Xliff2Parser = (function () { function Xliff2Parser() { this._locale = null; } /** * @param {?} xliff * @param {?} url * @return {?} */ Xliff2Parser.prototype.parse = function (xliff, url) { this._unitMlString = null; this._msgIdToHtml = {}; var /** @type {?} */ xml = new XmlParser().parse(xliff, url, false); this._errors = xml.errors; visitAll(this, xml.rootNodes, null); return { msgIdToHtml: this._msgIdToHtml, errors: this._errors, locale: this._locale, }; }; /** * @param {?} element * @param {?} context * @return {?} */ Xliff2Parser.prototype.visitElement = function (element, context) { switch (element.name) { case _UNIT_TAG$1: this._unitMlString = null; var /** @type {?} */ idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; }); if (!idAttr) { this._addError(element, "<" + _UNIT_TAG$1 + "> misses the \"id\" attribute"); } else { var /** @type {?} */ id = idAttr.value; if (this._msgIdToHtml.hasOwnProperty(id)) { this._addError(element, "Duplicated translations for msg " + id); } else { visitAll(this, element.children, null); if (typeof this._unitMlString === 'string') { this._msgIdToHtml[id] = this._unitMlString; } else { this._addError(element, "Message " + id + " misses a translation"); } } } break; case _SOURCE_TAG$1: // ignore source message break; case _TARGET_TAG$1: var /** @type {?} */ innerTextStart = ((element.startSourceSpan)).end.offset; var /** @type {?} */ innerTextEnd = ((element.endSourceSpan)).start.offset; var /** @type {?} */ content = ((element.startSourceSpan)).start.file.content; var /** @type {?} */ innerText = content.slice(innerTextStart, innerTextEnd); this._unitMlString = innerText; break; case _XLIFF_TAG: var /** @type {?} */ localeAttr = element.attrs.find(function (attr) { return attr.name === 'trgLang'; }); if (localeAttr) { this._locale = localeAttr.value; } var /** @type {?} */ versionAttr = element.attrs.find(function (attr) { return attr.name === 'version'; }); if (versionAttr) { var /** @type {?} */ version = versionAttr.value; if (version !== '2.0') { this._addError(element, "The XLIFF file version " + version + " is not compatible with XLIFF 2.0 serializer"); } else { visitAll(this, element.children, null); } } break; default: visitAll(this, element.children, null); } }; /** * @param {?} attribute * @param {?} context * @return {?} */ Xliff2Parser.prototype.visitAttribute = function (attribute, context) { }; /** * @param {?} text * @param {?} context * @return {?} */ Xliff2Parser.prototype.visitText = function (text, context) { }; /** * @param {?} comment * @param {?} context * @return {?} */ Xliff2Parser.prototype.visitComment = function (comment, context) { }; /** * @param {?} expansion * @param {?} context * @return {?} */ Xliff2Parser.prototype.visitExpansion = function (expansion, context) { }; /** * @param {?} expansionCase * @param {?} context * @return {?} */ Xliff2Parser.prototype.visitExpansionCase = function (expansionCase, context) { }; /** * @param {?} node * @param {?} message * @return {?} */ Xliff2Parser.prototype._addError = function (node, message) { this._errors.push(new I18nError(node.sourceSpan, message)); }; return Xliff2Parser; }()); var XmlToI18n$1 = (function () { function XmlToI18n$1() { } /** * @param {?} message * @param {?} url * @return {?} */ XmlToI18n$1.prototype.convert = function (message, url) { var /** @type {?} */ xmlIcu = new XmlParser().parse(message, url, true); this._errors = xmlIcu.errors; var /** @type {?} */ i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ? [] : [].concat.apply([], visitAll(this, xmlIcu.rootNodes)); return { i18nNodes: i18nNodes, errors: this._errors, }; }; /** * @param {?} text * @param {?} context * @return {?} */ XmlToI18n$1.prototype.visitText = function (text, context) { return new Text$1(text.value, text.sourceSpan); }; /** * @param {?} el * @param {?} context * @return {?} */ XmlToI18n$1.prototype.visitElement = function (el, context) { var _this = this; switch (el.name) { case _PLACEHOLDER_TAG$1: var /** @type {?} */ nameAttr = el.attrs.find(function (attr) { return attr.name === 'equiv'; }); if (nameAttr) { return [new Placeholder('', nameAttr.value, el.sourceSpan)]; } this._addError(el, "<" + _PLACEHOLDER_TAG$1 + "> misses the \"equiv\" attribute"); break; case _PLACEHOLDER_SPANNING_TAG: var /** @type {?} */ startAttr = el.attrs.find(function (attr) { return attr.name === 'equivStart'; }); var /** @type {?} */ endAttr = el.attrs.find(function (attr) { return attr.name === 'equivEnd'; }); if (!startAttr) { this._addError(el, "<" + _PLACEHOLDER_TAG$1 + "> misses the \"equivStart\" attribute"); } else if (!endAttr) { this._addError(el, "<" + _PLACEHOLDER_TAG$1 + "> misses the \"equivEnd\" attribute"); } else { var /** @type {?} */ startId = startAttr.value; var /** @type {?} */ endId = endAttr.value; var /** @type {?} */ nodes = []; return nodes.concat.apply(nodes, [new Placeholder('', startId, el.sourceSpan)].concat(el.children.map(function (node) { return node.visit(_this, null); }), [new Placeholder('', endId, el.sourceSpan)])); } break; default: this._addError(el, "Unexpected tag"); } return null; }; /** * @param {?} icu * @param {?} context * @return {?} */ XmlToI18n$1.prototype.visitExpansion = function (icu, context) { var /** @type {?} */ caseMap = {}; visitAll(this, icu.cases).forEach(function (c) { caseMap[c.value] = new Container(c.nodes, icu.sourceSpan); }); return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan); }; /** * @param {?} icuCase * @param {?} context * @return {?} */ XmlToI18n$1.prototype.visitExpansionCase = function (icuCase, context) { return { value: icuCase.value, nodes: [].concat.apply([], visitAll(this, icuCase.expression)), }; }; /** * @param {?} comment * @param {?} context * @return {?} */ XmlToI18n$1.prototype.visitComment = function (comment, context) { }; /** * @param {?} attribute * @param {?} context * @return {?} */ XmlToI18n$1.prototype.visitAttribute = function (attribute, context) { }; /** * @param {?} node * @param {?} message * @return {?} */ XmlToI18n$1.prototype._addError = function (node, message) { this._errors.push(new I18nError(node.sourceSpan, message)); }; return XmlToI18n$1; }()); /** * @param {?} tag * @return {?} */ function getTypeForTag(tag) { switch (tag.toLowerCase()) { case 'br': case 'b': case 'i': case 'u': return 'fmt'; case 'img': return 'image'; case 'a': return 'link'; default: return 'other'; } } /** * @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 _MESSAGES_TAG = 'messagebundle'; var _MESSAGE_TAG = 'msg'; var _PLACEHOLDER_TAG$2 = 'ph'; var _EXEMPLE_TAG = 'ex'; var _SOURCE_TAG$2 = 'source'; var _DOCTYPE = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"; var Xmb = (function (_super) { __extends(Xmb, _super); function Xmb() { return _super !== null && _super.apply(this, arguments) || this; } /** * @param {?} messages * @param {?} locale * @return {?} */ Xmb.prototype.write = function (messages, locale) { var /** @type {?} */ exampleVisitor = new ExampleVisitor(); var /** @type {?} */ visitor = new _Visitor$2(); var /** @type {?} */ rootNode = new Tag(_MESSAGES_TAG); messages.forEach(function (message) { var /** @type {?} */ attrs = { id: message.id }; if (message.description) { attrs['desc'] = message.description; } if (message.meaning) { attrs['meaning'] = message.meaning; } var /** @type {?} */ sourceTags = []; message.sources.forEach(function (source) { sourceTags.push(new Tag(_SOURCE_TAG$2, {}, [ new Text$2(source.filePath + ":" + source.startLine + (source.endLine !== source.startLine ? ',' + source.endLine : '')) ])); }); rootNode.children.push(new CR(2), new Tag(_MESSAGE_TAG, attrs, sourceTags.concat(visitor.serialize(message.nodes)))); }); rootNode.children.push(new CR()); return serialize([ new Declaration({ version: '1.0', encoding: 'UTF-8' }), new CR(), new Doctype(_MESSAGES_TAG, _DOCTYPE), new CR(), exampleVisitor.addDefaultExamples(rootNode), new CR(), ]); }; /** * @param {?} content * @param {?} url * @return {?} */ Xmb.prototype.load = function (content, url) { throw new Error('Unsupported'); }; /** * @param {?} message * @return {?} */ Xmb.prototype.digest = function (message) { return digest$1(message); }; /** * @param {?} message * @return {?} */ Xmb.prototype.createNameMapper = function (message) { return new SimplePlaceholderMapper(message, toPublicName); }; return Xmb; }(Serializer)); var _Visitor$2 = (function () { function _Visitor$2() { } /** * @param {?} text * @param {?=} context * @return {?} */ _Visitor$2.prototype.visitText = function (text, context) { return [new Text$2(text.value)]; }; /** * @param {?} container * @param {?} context * @return {?} */ _Visitor$2.prototype.visitContainer = function (container, context) { var _this = this; var /** @type {?} */ nodes = []; container.children.forEach(function (node) { return nodes.push.apply(nodes, node.visit(_this)); }); return nodes; }; /** * @param {?} icu * @param {?=} context * @return {?} */ _Visitor$2.prototype.visitIcu = function (icu, context) { var _this = this; var /** @type {?} */ nodes = [new Text$2("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")]; Object.keys(icu.cases).forEach(function (c) { nodes.push.apply(nodes, [new Text$2(c + " {")].concat(icu.cases[c].visit(_this), [new Text$2("} ")])); }); nodes.push(new Text$2("}")); return nodes; }; /** * @param {?} ph * @param {?=} context * @return {?} */ _Visitor$2.prototype.visitTagPlaceholder = function (ph, context) { var /** @type {?} */ startEx = new Tag(_EXEMPLE_TAG, {}, [new Text$2("<" + ph.tag + ">")]); var /** @type {?} */ startTagPh = new Tag(_PLACEHOLDER_TAG$2, { name: ph.startName }, [startEx]); if (ph.isVoid) { // void tags have no children nor closing tags return [startTagPh]; } var /** @type {?} */ closeEx = new Tag(_EXEMPLE_TAG, {}, [new Text$2("")]); var /** @type {?} */ closeTagPh = new Tag(_PLACEHOLDER_TAG$2, { name: ph.closeName }, [closeEx]); return [startTagPh].concat(this.serialize(ph.children), [closeTagPh]); }; /** * @param {?} ph * @param {?=} context * @return {?} */ _Visitor$2.prototype.visitPlaceholder = function (ph, context) { return [new Tag(_PLACEHOLDER_TAG$2, { name: ph.name })]; }; /** * @param {?} ph * @param {?=} context * @return {?} */ _Visitor$2.prototype.visitIcuPlaceholder = function (ph, context) { return [new Tag(_PLACEHOLDER_TAG$2, { name: ph.name })]; }; /** * @param {?} nodes * @return {?} */ _Visitor$2.prototype.serialize = function (nodes) { var _this = this; return [].concat.apply([], nodes.map(function (node) { return node.visit(_this); })); }; return _Visitor$2; }()); /** * @param {?} message * @return {?} */ function digest$1(message) { return decimalDigest(message); } var ExampleVisitor = (function () { function ExampleVisitor() { } /** * @param {?} node * @return {?} */ ExampleVisitor.prototype.addDefaultExamples = function (node) { node.visit(this); return node; }; /** * @param {?} tag * @return {?} */ ExampleVisitor.prototype.visitTag = function (tag) { var _this = this; if (tag.name === _PLACEHOLDER_TAG$2) { if (!tag.children || tag.children.length == 0) { var /** @type {?} */ exText = new Text$2(tag.attrs['name'] || '...'); tag.children = [new Tag(_EXEMPLE_TAG, {}, [exText])]; } } else if (tag.children) { tag.children.forEach(function (node) { return node.visit(_this); }); } }; /** * @param {?} text * @return {?} */ ExampleVisitor.prototype.visitText = function (text) { }; /** * @param {?} decl * @return {?} */ ExampleVisitor.prototype.visitDeclaration = function (decl) { }; /** * @param {?} doctype * @return {?} */ ExampleVisitor.prototype.visitDoctype = function (doctype) { }; return ExampleVisitor; }()); /** * @param {?} internalName * @return {?} */ function toPublicName(internalName) { return internalName.toUpperCase().replace(/[^A-Z0-9_]/g, '_'); } /** * @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 _TRANSLATIONS_TAG = 'translationbundle'; var _TRANSLATION_TAG = 'translation'; var _PLACEHOLDER_TAG$3 = 'ph'; var Xtb = (function (_super) { __extends(Xtb, _super); function Xtb() { return _super !== null && _super.apply(this, arguments) || this; } /** * @param {?} messages * @param {?} locale * @return {?} */ Xtb.prototype.write = function (messages, locale) { throw new Error('Unsupported'); }; /** * @param {?} content * @param {?} url * @return {?} */ Xtb.prototype.load = function (content, url) { // xtb to xml nodes var /** @type {?} */ xtbParser = new XtbParser(); var _a = xtbParser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors; // xml nodes to i18n nodes var /** @type {?} */ i18nNodesByMsgId = {}; var /** @type {?} */ converter = new XmlToI18n$2(); // Because we should be able to load xtb files that rely on features not supported by angular, // we need to delay the conversion of html to i18n nodes so that non angular messages are not // converted Object.keys(msgIdToHtml).forEach(function (msgId) { var /** @type {?} */ valueFn = function () { var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, errors = _a.errors; if (errors.length) { throw new Error("xtb parse errors:\n" + errors.join('\n')); } return i18nNodes; }; createLazyProperty(i18nNodesByMsgId, msgId, valueFn); }); if (errors.length) { throw new Error("xtb parse errors:\n" + errors.join('\n')); } return { locale: /** @type {?} */ ((locale)), i18nNodesByMsgId: i18nNodesByMsgId }; }; /** * @param {?} message * @return {?} */ Xtb.prototype.digest = function (message) { return digest$1(message); }; /** * @param {?} message * @return {?} */ Xtb.prototype.createNameMapper = function (message) { return new SimplePlaceholderMapper(message, toPublicName); }; return Xtb; }(Serializer)); /** * @param {?} messages * @param {?} id * @param {?} valueFn * @return {?} */ function createLazyProperty(messages, id, valueFn) { Object.defineProperty(messages, id, { configurable: true, enumerable: true, get: function () { var /** @type {?} */ value = valueFn(); Object.defineProperty(messages, id, { enumerable: true, value: value }); return value; }, set: function (_) { throw new Error('Could not overwrite an XTB translation'); }, }); } var XtbParser = (function () { function XtbParser() { this._locale = null; } /** * @param {?} xtb * @param {?} url * @return {?} */ XtbParser.prototype.parse = function (xtb, url) { this._bundleDepth = 0; this._msgIdToHtml = {}; // We can not parse the ICU messages at this point as some messages might not originate // from Angular that could not be lex'd. var /** @type {?} */ xml = new XmlParser().parse(xtb, url, false); this._errors = xml.errors; visitAll(this, xml.rootNodes); return { msgIdToHtml: this._msgIdToHtml, errors: this._errors, locale: this._locale, }; }; /** * @param {?} element * @param {?} context * @return {?} */ XtbParser.prototype.visitElement = function (element, context) { switch (element.name) { case _TRANSLATIONS_TAG: this._bundleDepth++; if (this._bundleDepth > 1) { this._addError(element, "<" + _TRANSLATIONS_TAG + "> elements can not be nested"); } var /** @type {?} */ langAttr = element.attrs.find(function (attr) { return attr.name === 'lang'; }); if (langAttr) { this._locale = langAttr.value; } visitAll(this, element.children, null); this._bundleDepth--; break; case _TRANSLATION_TAG: var /** @type {?} */ idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; }); if (!idAttr) { this._addError(element, "<" + _TRANSLATION_TAG + "> misses the \"id\" attribute"); } else { var /** @type {?} */ id = idAttr.value; if (this._msgIdToHtml.hasOwnProperty(id)) { this._addError(element, "Duplicated translations for msg " + id); } else { var /** @type {?} */ innerTextStart = ((element.startSourceSpan)).end.offset; var /** @type {?} */ innerTextEnd = ((element.endSourceSpan)).start.offset; var /** @type {?} */ content = ((element.startSourceSpan)).start.file.content; var /** @type {?} */ innerText = content.slice(/** @type {?} */ ((innerTextStart)), /** @type {?} */ ((innerTextEnd))); this._msgIdToHtml[id] = innerText; } } break; default: this._addError(element, 'Unexpected tag'); } }; /** * @param {?} attribute * @param {?} context * @return {?} */ XtbParser.prototype.visitAttribute = function (attribute, context) { }; /** * @param {?} text * @param {?} context * @return {?} */ XtbParser.prototype.visitText = function (text, context) { }; /** * @param {?} comment * @param {?} context * @return {?} */ XtbParser.prototype.visitComment = function (comment, context) { }; /** * @param {?} expansion * @param {?} context * @return {?} */ XtbParser.prototype.visitExpansion = function (expansion, context) { }; /** * @param {?} expansionCase * @param {?} context * @return {?} */ XtbParser.prototype.visitExpansionCase = function (expansionCase, context) { }; /** * @param {?} node * @param {?} message * @return {?} */ XtbParser.prototype._addError = function (node, message) { this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message)); }; return XtbParser; }()); var XmlToI18n$2 = (function () { function XmlToI18n$2() { } /** * @param {?} message * @param {?} url * @return {?} */ XmlToI18n$2.prototype.convert = function (message, url) { var /** @type {?} */ xmlIcu = new XmlParser().parse(message, url, true); this._errors = xmlIcu.errors; var /** @type {?} */ i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ? [] : visitAll(this, xmlIcu.rootNodes); return { i18nNodes: i18nNodes, errors: this._errors, }; }; /** * @param {?} text * @param {?} context * @return {?} */ XmlToI18n$2.prototype.visitText = function (text, context) { return new Text$1(text.value, /** @type {?} */ ((text.sourceSpan))); }; /** * @param {?} icu * @param {?} context * @return {?} */ XmlToI18n$2.prototype.visitExpansion = function (icu, context) { var /** @type {?} */ caseMap = {}; visitAll(this, icu.cases).forEach(function (c) { caseMap[c.value] = new Container(c.nodes, icu.sourceSpan); }); return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan); }; /** * @param {?} icuCase * @param {?} context * @return {?} */ XmlToI18n$2.prototype.visitExpansionCase = function (icuCase, context) { return { value: icuCase.value, nodes: visitAll(this, icuCase.expression), }; }; /** * @param {?} el * @param {?} context * @return {?} */ XmlToI18n$2.prototype.visitElement = function (el, context) { if (el.name === _PLACEHOLDER_TAG$3) { var /** @type {?} */ nameAttr = el.attrs.find(function (attr) { return attr.name === 'name'; }); if (nameAttr) { return new Placeholder('', nameAttr.value, /** @type {?} */ ((el.sourceSpan))); } this._addError(el, "<" + _PLACEHOLDER_TAG$3 + "> misses the \"name\" attribute"); } else { this._addError(el, "Unexpected tag"); } return null; }; /** * @param {?} comment * @param {?} context * @return {?} */ XmlToI18n$2.prototype.visitComment = function (comment, context) { }; /** * @param {?} attribute * @param {?} context * @return {?} */ XmlToI18n$2.prototype.visitAttribute = function (attribute, context) { }; /** * @param {?} node * @param {?} message * @return {?} */ XmlToI18n$2.prototype._addError = function (node, message) { this._errors.push(new I18nError(/** @type {?} */ ((node.sourceSpan)), message)); }; return XmlToI18n$2; }()); /** * @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 HtmlParser = (function (_super) { __extends(HtmlParser, _super); function HtmlParser() { return _super.call(this, getHtmlTagDefinition) || this; } /** * @param {?} source * @param {?} url * @param {?=} parseExpansionForms * @param {?=} interpolationConfig * @return {?} */ HtmlParser.prototype.parse = function (source, url, parseExpansionForms, interpolationConfig) { if (parseExpansionForms === void 0) { parseExpansionForms = false; } if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; } return _super.prototype.parse.call(this, source, url, parseExpansionForms, interpolationConfig); }; return HtmlParser; }(Parser$1)); HtmlParser.decorators = [ { type: CompilerInjectable }, ]; /** * @nocollapse */ HtmlParser.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 */ /** * A container for translated messages */ var TranslationBundle = (function () { /** * @param {?=} _i18nNodesByMsgId * @param {?=} locale * @param {?=} digest * @param {?=} mapperFactory * @param {?=} missingTranslationStrategy * @param {?=} console */ function TranslationBundle(_i18nNodesByMsgId, locale, digest, mapperFactory, missingTranslationStrategy, console) { if (_i18nNodesByMsgId === void 0) { _i18nNodesByMsgId = {}; } if (missingTranslationStrategy === void 0) { missingTranslationStrategy = __WEBPACK_IMPORTED_MODULE_0__angular_core__["_24" /* MissingTranslationStrategy */].Warning; } this._i18nNodesByMsgId = _i18nNodesByMsgId; this.digest = digest; this.mapperFactory = mapperFactory; this._i18nToHtml = new I18nToHtmlVisitor(_i18nNodesByMsgId, locale, digest, mapperFactory, missingTranslationStrategy, console); } /** * @param {?} content * @param {?} url * @param {?} serializer * @param {?} missingTranslationStrategy * @param {?=} console * @return {?} */ TranslationBundle.load = function (content, url, serializer, missingTranslationStrategy, console) { var _a = serializer.load(content, url), locale = _a.locale, i18nNodesByMsgId = _a.i18nNodesByMsgId; var /** @type {?} */ digestFn = function (m) { return serializer.digest(m); }; var /** @type {?} */ mapperFactory = function (m) { return ((serializer.createNameMapper(m))); }; return new TranslationBundle(i18nNodesByMsgId, locale, digestFn, mapperFactory, missingTranslationStrategy, console); }; /** * @param {?} srcMsg * @return {?} */ TranslationBundle.prototype.get = function (srcMsg) { var /** @type {?} */ html = this._i18nToHtml.convert(srcMsg); if (html.errors.length) { throw new Error(html.errors.join('\n')); } return html.nodes; }; /** * @param {?} srcMsg * @return {?} */ TranslationBundle.prototype.has = function (srcMsg) { return this.digest(srcMsg) in this._i18nNodesByMsgId; }; return TranslationBundle; }()); var I18nToHtmlVisitor = (function () { /** * @param {?=} _i18nNodesByMsgId * @param {?=} _locale * @param {?=} _digest * @param {?=} _mapperFactory * @param {?=} _missingTranslationStrategy * @param {?=} _console */ function I18nToHtmlVisitor(_i18nNodesByMsgId, _locale, _digest, _mapperFactory, _missingTranslationStrategy, _console) { if (_i18nNodesByMsgId === void 0) { _i18nNodesByMsgId = {}; } this._i18nNodesByMsgId = _i18nNodesByMsgId; this._locale = _locale; this._digest = _digest; this._mapperFactory = _mapperFactory; this._missingTranslationStrategy = _missingTranslationStrategy; this._console = _console; this._contextStack = []; this._errors = []; } /** * @param {?} srcMsg * @return {?} */ I18nToHtmlVisitor.prototype.convert = function (srcMsg) { this._contextStack.length = 0; this._errors.length = 0; // i18n to text var /** @type {?} */ text = this._convertToText(srcMsg); // text to html var /** @type {?} */ url = srcMsg.nodes[0].sourceSpan.start.file.url; var /** @type {?} */ html = new HtmlParser().parse(text, url, true); return { nodes: html.rootNodes, errors: this._errors.concat(html.errors), }; }; /** * @param {?} text * @param {?=} context * @return {?} */ I18nToHtmlVisitor.prototype.visitText = function (text, context) { return text.value; }; /** * @param {?} container * @param {?=} context * @return {?} */ I18nToHtmlVisitor.prototype.visitContainer = function (container, context) { var _this = this; return container.children.map(function (n) { return n.visit(_this); }).join(''); }; /** * @param {?} icu * @param {?=} context * @return {?} */ I18nToHtmlVisitor.prototype.visitIcu = function (icu, context) { var _this = this; var /** @type {?} */ cases = Object.keys(icu.cases).map(function (k) { return k + " {" + icu.cases[k].visit(_this) + "}"; }); // TODO(vicb): Once all format switch to using expression placeholders // we should throw when the placeholder is not in the source message var /** @type {?} */ exp = this._srcMsg.placeholders.hasOwnProperty(icu.expression) ? this._srcMsg.placeholders[icu.expression] : icu.expression; return "{" + exp + ", " + icu.type + ", " + cases.join(' ') + "}"; }; /** * @param {?} ph * @param {?=} context * @return {?} */ I18nToHtmlVisitor.prototype.visitPlaceholder = function (ph, context) { var /** @type {?} */ phName = this._mapper(ph.name); if (this._srcMsg.placeholders.hasOwnProperty(phName)) { return this._srcMsg.placeholders[phName]; } if (this._srcMsg.placeholderToMessage.hasOwnProperty(phName)) { return this._convertToText(this._srcMsg.placeholderToMessage[phName]); } this._addError(ph, "Unknown placeholder \"" + ph.name + "\""); return ''; }; /** * @param {?} ph * @param {?=} context * @return {?} */ I18nToHtmlVisitor.prototype.visitTagPlaceholder = function (ph, context) { var _this = this; var /** @type {?} */ tag = "" + ph.tag; var /** @type {?} */ attrs = Object.keys(ph.attrs).map(function (name) { return name + "=\"" + ph.attrs[name] + "\""; }).join(' '); if (ph.isVoid) { return "<" + tag + " " + attrs + "/>"; } var /** @type {?} */ children = ph.children.map(function (c) { return c.visit(_this); }).join(''); return "<" + tag + " " + attrs + ">" + children + ""; }; /** * @param {?} ph * @param {?=} context * @return {?} */ I18nToHtmlVisitor.prototype.visitIcuPlaceholder = function (ph, context) { // An ICU placeholder references the source message to be serialized return this._convertToText(this._srcMsg.placeholderToMessage[ph.name]); }; /** * Convert a source message to a translated text string: * - text nodes are replaced with their translation, * - placeholders are replaced with their content, * - ICU nodes are converted to ICU expressions. * @param {?} srcMsg * @return {?} */ I18nToHtmlVisitor.prototype._convertToText = function (srcMsg) { var _this = this; var /** @type {?} */ id = this._digest(srcMsg); var /** @type {?} */ mapper = this._mapperFactory ? this._mapperFactory(srcMsg) : null; var /** @type {?} */ nodes; this._contextStack.push({ msg: this._srcMsg, mapper: this._mapper }); this._srcMsg = srcMsg; if (this._i18nNodesByMsgId.hasOwnProperty(id)) { // When there is a translation use its nodes as the source // And create a mapper to convert serialized placeholder names to internal names nodes = this._i18nNodesByMsgId[id]; this._mapper = function (name) { return mapper ? ((mapper.toInternalName(name))) : name; }; } else { // When no translation has been found // - report an error / a warning / nothing, // - use the nodes from the original message // - placeholders are already internal and need no mapper if (this._missingTranslationStrategy === __WEBPACK_IMPORTED_MODULE_0__angular_core__["_24" /* MissingTranslationStrategy */].Error) { var /** @type {?} */ ctx = this._locale ? " for locale \"" + this._locale + "\"" : ''; this._addError(srcMsg.nodes[0], "Missing translation for message \"" + id + "\"" + ctx); } else if (this._console && this._missingTranslationStrategy === __WEBPACK_IMPORTED_MODULE_0__angular_core__["_24" /* MissingTranslationStrategy */].Warning) { var /** @type {?} */ ctx = this._locale ? " for locale \"" + this._locale + "\"" : ''; this._console.warn("Missing translation for message \"" + id + "\"" + ctx); } nodes = srcMsg.nodes; this._mapper = function (name) { return name; }; } var /** @type {?} */ text = nodes.map(function (node) { return node.visit(_this); }).join(''); var /** @type {?} */ context = ((this._contextStack.pop())); this._srcMsg = context.msg; this._mapper = context.mapper; return text; }; /** * @param {?} el * @param {?} msg * @return {?} */ I18nToHtmlVisitor.prototype._addError = function (el, msg) { this._errors.push(new I18nError(el.sourceSpan, msg)); }; return I18nToHtmlVisitor; }()); /** * @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 I18NHtmlParser = (function () { /** * @param {?} _htmlParser * @param {?=} translations * @param {?=} translationsFormat * @param {?=} missingTranslation * @param {?=} console */ function I18NHtmlParser(_htmlParser, translations, translationsFormat, missingTranslation, console) { if (missingTranslation === void 0) { missingTranslation = __WEBPACK_IMPORTED_MODULE_0__angular_core__["_24" /* MissingTranslationStrategy */].Warning; } this._htmlParser = _htmlParser; if (translations) { var serializer = createSerializer(translationsFormat); this._translationBundle = TranslationBundle.load(translations, 'i18n', serializer, missingTranslation, console); } } /** * @param {?} source * @param {?} url * @param {?=} parseExpansionForms * @param {?=} interpolationConfig * @return {?} */ I18NHtmlParser.prototype.parse = function (source, url, parseExpansionForms, interpolationConfig) { if (parseExpansionForms === void 0) { parseExpansionForms = false; } if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; } var /** @type {?} */ parseResult = this._htmlParser.parse(source, url, parseExpansionForms, interpolationConfig); if (!this._translationBundle) { // Do not enable i18n when no translation bundle is provided return parseResult; } if (parseResult.errors.length) { return new ParseTreeResult(parseResult.rootNodes, parseResult.errors); } return mergeTranslations(parseResult.rootNodes, this._translationBundle, interpolationConfig, [], {}); }; return I18NHtmlParser; }()); /** * @param {?=} format * @return {?} */ function createSerializer(format) { format = (format || 'xlf').toLowerCase(); switch (format) { case 'xmb': return new Xmb(); case 'xtb': return new Xtb(); case 'xliff2': case 'xlf2': return new Xliff2(); case 'xliff': case 'xlf': default: return new Xliff(); } } /** * @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 CORE = assetUrl('core'); var Identifiers = (function () { function Identifiers() { } return Identifiers; }()); Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS = { name: 'ANALYZE_FOR_ENTRY_COMPONENTS', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_20" /* ANALYZE_FOR_ENTRY_COMPONENTS */] }; Identifiers.ElementRef = { name: 'ElementRef', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["O" /* ElementRef */] }; Identifiers.NgModuleRef = { name: 'NgModuleRef', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["R" /* NgModuleRef */] }; Identifiers.ViewContainerRef = { name: 'ViewContainerRef', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["T" /* ViewContainerRef */] }; Identifiers.ChangeDetectorRef = { name: 'ChangeDetectorRef', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_1" /* ChangeDetectorRef */] }; Identifiers.QueryList = { name: 'QueryList', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_10" /* QueryList */] }; Identifiers.TemplateRef = { name: 'TemplateRef', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["U" /* TemplateRef */] }; Identifiers.CodegenComponentFactoryResolver = { name: 'ɵCodegenComponentFactoryResolver', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_25" /* ɵCodegenComponentFactoryResolver */] }; Identifiers.ComponentFactoryResolver = { name: 'ComponentFactoryResolver', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["S" /* ComponentFactoryResolver */] }; Identifiers.ComponentFactory = { name: 'ComponentFactory', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_26" /* ComponentFactory */] }; Identifiers.ComponentRef = { name: 'ComponentRef', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_27" /* ComponentRef */] }; Identifiers.NgModuleFactory = { name: 'NgModuleFactory', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_13" /* NgModuleFactory */] }; Identifiers.NgModuleInjector = { name: 'ɵNgModuleInjector', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_28" /* ɵNgModuleInjector */], }; Identifiers.RegisterModuleFactoryFn = { name: 'ɵregisterModuleFactory', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_29" /* ɵregisterModuleFactory */], }; Identifiers.Injector = { name: 'Injector', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["l" /* Injector */] }; Identifiers.ViewEncapsulation = { name: 'ViewEncapsulation', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["s" /* ViewEncapsulation */] }; Identifiers.ChangeDetectionStrategy = { name: 'ChangeDetectionStrategy', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_6" /* ChangeDetectionStrategy */] }; Identifiers.SecurityContext = { name: 'SecurityContext', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* SecurityContext */], }; Identifiers.LOCALE_ID = { name: 'LOCALE_ID', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["I" /* LOCALE_ID */] }; Identifiers.TRANSLATIONS_FORMAT = { name: 'TRANSLATIONS_FORMAT', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_30" /* TRANSLATIONS_FORMAT */] }; Identifiers.inlineInterpolate = { name: 'ɵinlineInterpolate', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_31" /* ɵinlineInterpolate */] }; Identifiers.interpolate = { name: 'ɵinterpolate', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_32" /* ɵinterpolate */] }; Identifiers.EMPTY_ARRAY = { name: 'ɵEMPTY_ARRAY', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_33" /* ɵEMPTY_ARRAY */] }; Identifiers.EMPTY_MAP = { name: 'ɵEMPTY_MAP', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_34" /* ɵEMPTY_MAP */] }; Identifiers.Renderer = { name: 'Renderer', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["P" /* Renderer */] }; Identifiers.viewDef = { name: 'ɵvid', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_35" /* ɵvid */] }; Identifiers.elementDef = { name: 'ɵeld', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_36" /* ɵeld */] }; Identifiers.anchorDef = { name: 'ɵand', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_37" /* ɵand */] }; Identifiers.textDef = { name: 'ɵted', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_38" /* ɵted */] }; Identifiers.directiveDef = { name: 'ɵdid', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_39" /* ɵdid */] }; Identifiers.providerDef = { name: 'ɵprd', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_40" /* ɵprd */] }; Identifiers.queryDef = { name: 'ɵqud', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_41" /* ɵqud */] }; Identifiers.pureArrayDef = { name: 'ɵpad', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_42" /* ɵpad */] }; Identifiers.pureObjectDef = { name: 'ɵpod', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_43" /* ɵpod */] }; Identifiers.purePipeDef = { name: 'ɵppd', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_44" /* ɵppd */] }; Identifiers.pipeDef = { name: 'ɵpid', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_45" /* ɵpid */] }; Identifiers.nodeValue = { name: 'ɵnov', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_46" /* ɵnov */] }; Identifiers.ngContentDef = { name: 'ɵncd', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_47" /* ɵncd */] }; Identifiers.unwrapValue = { name: 'ɵunv', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_48" /* ɵunv */] }; Identifiers.createRendererType2 = { name: 'ɵcrt', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_49" /* ɵcrt */] }; Identifiers.RendererType2 = { name: 'RendererType2', moduleUrl: CORE, // type only runtime: null }; Identifiers.ViewDefinition = { name: 'ɵViewDefinition', moduleUrl: CORE, // type only runtime: null }; Identifiers.createComponentFactory = { name: 'ɵccf', moduleUrl: CORE, runtime: __WEBPACK_IMPORTED_MODULE_0__angular_core__["_50" /* ɵccf */] }; /** * @param {?} pkg * @param {?=} path * @param {?=} type * @return {?} */ function assetUrl(pkg, path, type) { if (path === void 0) { path = null; } if (type === void 0) { type = 'src'; } if (path == null) { return "@angular/" + pkg; } else { return "@angular/" + pkg + "/" + type + "/" + path; } } /** * @param {?} identifier * @return {?} */ function resolveIdentifier(identifier) { var /** @type {?} */ name = identifier.name; return __WEBPACK_IMPORTED_MODULE_0__angular_core__["_23" /* ɵreflector */].resolveIdentifier(name, identifier.moduleUrl, null, identifier.runtime); } /** * @param {?} identifier * @return {?} */ function createIdentifier(identifier) { return { reference: resolveIdentifier(identifier) }; } /** * @param {?} identifier * @return {?} */ function identifierToken(identifier) { return { identifier: identifier }; } /** * @param {?} identifier * @return {?} */ function createIdentifierToken(identifier) { return identifierToken(createIdentifier(identifier)); } /** * @param {?} enumType * @param {?} name * @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 */ // http://cldr.unicode.org/index/cldr-spec/plural-rules var PLURAL_CASES = ['zero', 'one', 'two', 'few', 'many', 'other']; /** * Expands special forms into elements. * * For example, * * ``` * { messages.length, plural, * =0 {zero} * =1 {one} * other {more than one} * } * ``` * * will be expanded into * * ``` * * zero * one * more than one * * ``` * @param {?} nodes * @return {?} */ function expandNodes(nodes) { var /** @type {?} */ expander = new _Expander(); return new ExpansionResult(visitAll(expander, nodes), expander.isExpanded, expander.errors); } var ExpansionResult = (function () { /** * @param {?} nodes * @param {?} expanded * @param {?} errors */ function ExpansionResult(nodes, expanded, errors) { this.nodes = nodes; this.expanded = expanded; this.errors = errors; } return ExpansionResult; }()); var ExpansionError = (function (_super) { __extends(ExpansionError, _super); /** * @param {?} span * @param {?} errorMsg */ function ExpansionError(span, errorMsg) { return _super.call(this, span, errorMsg) || this; } return ExpansionError; }(ParseError)); /** * Expand expansion forms (plural, select) to directives * * \@internal */ var _Expander = (function () { function _Expander() { this.isExpanded = false; this.errors = []; } /** * @param {?} element * @param {?} context * @return {?} */ _Expander.prototype.visitElement = function (element, context) { return new Element(element.name, element.attrs, visitAll(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan); }; /** * @param {?} attribute * @param {?} context * @return {?} */ _Expander.prototype.visitAttribute = function (attribute, context) { return attribute; }; /** * @param {?} text * @param {?} context * @return {?} */ _Expander.prototype.visitText = function (text, context) { return text; }; /** * @param {?} comment * @param {?} context * @return {?} */ _Expander.prototype.visitComment = function (comment, context) { return comment; }; /** * @param {?} icu * @param {?} context * @return {?} */ _Expander.prototype.visitExpansion = function (icu, context) { this.isExpanded = true; return icu.type == 'plural' ? _expandPluralForm(icu, this.errors) : _expandDefaultForm(icu, this.errors); }; /** * @param {?} icuCase * @param {?} context * @return {?} */ _Expander.prototype.visitExpansionCase = function (icuCase, context) { throw new Error('Should not be reached'); }; return _Expander; }()); /** * @param {?} ast * @param {?} errors * @return {?} */ function _expandPluralForm(ast, errors) { var /** @type {?} */ children = ast.cases.map(function (c) { if (PLURAL_CASES.indexOf(c.value) == -1 && !c.value.match(/^=\d+$/)) { errors.push(new ExpansionError(c.valueSourceSpan, "Plural cases should be \"=\" or one of " + PLURAL_CASES.join(", "))); } var /** @type {?} */ expansionResult = expandNodes(c.expression); errors.push.apply(errors, expansionResult.errors); return new Element("ng-template", [new Attribute$1('ngPluralCase', "" + c.value, c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan); }); var /** @type {?} */ switchAttr = new Attribute$1('[ngPlural]', ast.switchValue, ast.switchValueSourceSpan); return new Element('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan); } /** * @param {?} ast * @param {?} errors * @return {?} */ function _expandDefaultForm(ast, errors) { var /** @type {?} */ children = ast.cases.map(function (c) { var /** @type {?} */ expansionResult = expandNodes(c.expression); errors.push.apply(errors, expansionResult.errors); if (c.value === 'other') { // other is the default case when no values match return new Element("ng-template", [new Attribute$1('ngSwitchDefault', '', c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan); } return new Element("ng-template", [new Attribute$1('ngSwitchCase', "" + c.value, c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan); }); var /** @type {?} */ switchAttr = new Attribute$1('[ngSwitch]', ast.switchValue, ast.switchValueSourceSpan); return new Element('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan); } /** * @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 ProviderError = (function (_super) { __extends(ProviderError, _super); /** * @param {?} message * @param {?} span */ function ProviderError(message, span) { return _super.call(this, span, message) || this; } return ProviderError; }(ParseError)); var ProviderViewContext = (function () { /** * @param {?} component */ function ProviderViewContext(component) { var _this = this; this.component = component; this.errors = []; this.viewQueries = _getViewQueries(component); this.viewProviders = new Map(); component.viewProviders.forEach(function (provider) { if (_this.viewProviders.get(tokenReference(provider.token)) == null) { _this.viewProviders.set(tokenReference(provider.token), true); } }); } return ProviderViewContext; }()); var ProviderElementContext = (function () { /** * @param {?} viewContext * @param {?} _parent * @param {?} _isViewRoot * @param {?} _directiveAsts * @param {?} attrs * @param {?} refs * @param {?} isTemplate * @param {?} contentQueryStartId * @param {?} _sourceSpan */ function ProviderElementContext(viewContext, _parent, _isViewRoot, _directiveAsts, attrs, refs, isTemplate, contentQueryStartId, _sourceSpan) { var _this = this; this.viewContext = viewContext; this._parent = _parent; this._isViewRoot = _isViewRoot; this._directiveAsts = _directiveAsts; this._sourceSpan = _sourceSpan; this._transformedProviders = new Map(); this._seenProviders = new Map(); this._hasViewContainer = false; this._queriedTokens = new Map(); this._attrs = {}; attrs.forEach(function (attrAst) { return _this._attrs[attrAst.name] = attrAst.value; }); var directivesMeta = _directiveAsts.map(function (directiveAst) { return directiveAst.directive; }); this._allProviders = _resolveProvidersFromDirectives(directivesMeta, _sourceSpan, viewContext.errors); this._contentQueries = _getContentQueries(contentQueryStartId, directivesMeta); Array.from(this._allProviders.values()).forEach(function (provider) { _this._addQueryReadsTo(provider.token, provider.token, _this._queriedTokens); }); if (isTemplate) { var templateRefId = createIdentifierToken(Identifiers.TemplateRef); this._addQueryReadsTo(templateRefId, templateRefId, this._queriedTokens); } refs.forEach(function (refAst) { var defaultQueryValue = refAst.value || createIdentifierToken(Identifiers.ElementRef); _this._addQueryReadsTo({ value: refAst.name }, defaultQueryValue, _this._queriedTokens); }); if (this._queriedTokens.get(resolveIdentifier(Identifiers.ViewContainerRef))) { this._hasViewContainer = true; } // create the providers that we know are eager first Array.from(this._allProviders.values()).forEach(function (provider) { var eager = provider.eager || _this._queriedTokens.get(tokenReference(provider.token)); if (eager) { _this._getOrCreateLocalProvider(provider.providerType, provider.token, true); } }); } /** * @return {?} */ ProviderElementContext.prototype.afterElement = function () { var _this = this; // collect lazy providers Array.from(this._allProviders.values()).forEach(function (provider) { _this._getOrCreateLocalProvider(provider.providerType, provider.token, false); }); }; Object.defineProperty(ProviderElementContext.prototype, "transformProviders", { /** * @return {?} */ get: function () { return Array.from(this._transformedProviders.values()); }, enumerable: true, configurable: true }); Object.defineProperty(ProviderElementContext.prototype, "transformedDirectiveAsts", { /** * @return {?} */ get: function () { var /** @type {?} */ sortedProviderTypes = this.transformProviders.map(function (provider) { return provider.token.identifier; }); var /** @type {?} */ sortedDirectives = this._directiveAsts.slice(); sortedDirectives.sort(function (dir1, dir2) { return sortedProviderTypes.indexOf(dir1.directive.type) - sortedProviderTypes.indexOf(dir2.directive.type); }); return sortedDirectives; }, enumerable: true, configurable: true }); Object.defineProperty(ProviderElementContext.prototype, "transformedHasViewContainer", { /** * @return {?} */ get: function () { return this._hasViewContainer; }, enumerable: true, configurable: true }); Object.defineProperty(ProviderElementContext.prototype, "queryMatches", { /** * @return {?} */ get: function () { var /** @type {?} */ allMatches = []; this._queriedTokens.forEach(function (matches) { allMatches.push.apply(allMatches, matches); }); return allMatches; }, enumerable: true, configurable: true }); /** * @param {?} token * @param {?} defaultValue * @param {?} queryReadTokens * @return {?} */ ProviderElementContext.prototype._addQueryReadsTo = function (token, defaultValue, queryReadTokens) { this._getQueriesFor(token).forEach(function (query) { var /** @type {?} */ queryValue = query.meta.read || defaultValue; var /** @type {?} */ tokenRef = tokenReference(queryValue); var /** @type {?} */ queryMatches = queryReadTokens.get(tokenRef); if (!queryMatches) { queryMatches = []; queryReadTokens.set(tokenRef, queryMatches); } queryMatches.push({ queryId: query.queryId, value: queryValue }); }); }; /** * @param {?} token * @return {?} */ ProviderElementContext.prototype._getQueriesFor = function (token) { var /** @type {?} */ result = []; var /** @type {?} */ currentEl = this; var /** @type {?} */ distance = 0; var /** @type {?} */ queries; while (currentEl !== null) { queries = currentEl._contentQueries.get(tokenReference(token)); if (queries) { result.push.apply(result, queries.filter(function (query) { return query.meta.descendants || distance <= 1; })); } if (currentEl._directiveAsts.length > 0) { distance++; } currentEl = currentEl._parent; } queries = this.viewContext.viewQueries.get(tokenReference(token)); if (queries) { result.push.apply(result, queries); } return result; }; /** * @param {?} requestingProviderType * @param {?} token * @param {?} eager * @return {?} */ ProviderElementContext.prototype._getOrCreateLocalProvider = function (requestingProviderType, token, eager) { var _this = this; var /** @type {?} */ resolvedProvider = this._allProviders.get(tokenReference(token)); if (!resolvedProvider || ((requestingProviderType === ProviderAstType.Directive || requestingProviderType === ProviderAstType.PublicService) && resolvedProvider.providerType === ProviderAstType.PrivateService) || ((requestingProviderType === ProviderAstType.PrivateService || requestingProviderType === ProviderAstType.PublicService) && resolvedProvider.providerType === ProviderAstType.Builtin)) { return null; } var /** @type {?} */ transformedProviderAst = this._transformedProviders.get(tokenReference(token)); if (transformedProviderAst) { return transformedProviderAst; } if (this._seenProviders.get(tokenReference(token)) != null) { this.viewContext.errors.push(new ProviderError("Cannot instantiate cyclic dependency! " + tokenName(token), this._sourceSpan)); return null; } this._seenProviders.set(tokenReference(token), true); var /** @type {?} */ transformedProviders = resolvedProvider.providers.map(function (provider) { var /** @type {?} */ transformedUseValue = provider.useValue; var /** @type {?} */ transformedUseExisting = ((provider.useExisting)); var /** @type {?} */ transformedDeps = ((undefined)); if (provider.useExisting != null) { var /** @type {?} */ existingDiDep = ((_this._getDependency(resolvedProvider.providerType, { token: provider.useExisting }, eager))); if (existingDiDep.token != null) { transformedUseExisting = existingDiDep.token; } else { transformedUseExisting = ((null)); transformedUseValue = existingDiDep.value; } } else if (provider.useFactory) { var /** @type {?} */ deps = provider.deps || provider.useFactory.diDeps; transformedDeps = deps.map(function (dep) { return ((_this._getDependency(resolvedProvider.providerType, dep, eager))); }); } else if (provider.useClass) { var /** @type {?} */ deps = provider.deps || provider.useClass.diDeps; transformedDeps = deps.map(function (dep) { return ((_this._getDependency(resolvedProvider.providerType, dep, eager))); }); } return _transformProvider(provider, { useExisting: transformedUseExisting, useValue: transformedUseValue, deps: transformedDeps }); }); transformedProviderAst = _transformProviderAst(resolvedProvider, { eager: eager, providers: transformedProviders }); this._transformedProviders.set(tokenReference(token), transformedProviderAst); return transformedProviderAst; }; /** * @param {?} requestingProviderType * @param {?} dep * @param {?=} eager * @return {?} */ ProviderElementContext.prototype._getLocalDependency = function (requestingProviderType, dep, eager) { if (eager === void 0) { eager = false; } if (dep.isAttribute) { var /** @type {?} */ attrValue = this._attrs[((dep.token)).value]; return { isValue: true, value: attrValue == null ? null : attrValue }; } if (dep.token != null) { // access builtints if ((requestingProviderType === ProviderAstType.Directive || requestingProviderType === ProviderAstType.Component)) { if (tokenReference(dep.token) === resolveIdentifier(Identifiers.Renderer) || tokenReference(dep.token) === resolveIdentifier(Identifiers.ElementRef) || tokenReference(dep.token) === resolveIdentifier(Identifiers.ChangeDetectorRef) || tokenReference(dep.token) === resolveIdentifier(Identifiers.TemplateRef)) { return dep; } if (tokenReference(dep.token) === resolveIdentifier(Identifiers.ViewContainerRef)) { this._hasViewContainer = true; } } // access the injector if (tokenReference(dep.token) === resolveIdentifier(Identifiers.Injector)) { return dep; } // access providers if (this._getOrCreateLocalProvider(requestingProviderType, dep.token, eager) != null) { return dep; } } return null; }; /** * @param {?} requestingProviderType * @param {?} dep * @param {?=} eager * @return {?} */ ProviderElementContext.prototype._getDependency = function (requestingProviderType, dep, eager) { if (eager === void 0) { eager = false; } var /** @type {?} */ currElement = this; var /** @type {?} */ currEager = eager; var /** @type {?} */ result = null; if (!dep.isSkipSelf) { result = this._getLocalDependency(requestingProviderType, dep, eager); } if (dep.isSelf) { if (!result && dep.isOptional) { result = { isValue: true, value: null }; } } else { // check parent elements while (!result && currElement._parent) { var /** @type {?} */ prevElement = currElement; currElement = currElement._parent; if (prevElement._isViewRoot) { currEager = false; } result = currElement._getLocalDependency(ProviderAstType.PublicService, dep, currEager); } // check @Host restriction if (!result) { if (!dep.isHost || this.viewContext.component.isHost || this.viewContext.component.type.reference === tokenReference(/** @type {?} */ ((dep.token))) || this.viewContext.viewProviders.get(tokenReference(/** @type {?} */ ((dep.token)))) != null) { result = dep; } else { result = dep.isOptional ? result = { isValue: true, value: null } : null; } } } if (!result) { this.viewContext.errors.push(new ProviderError("No provider for " + tokenName(/** @type {?} */ ((dep.token))), this._sourceSpan)); } return result; }; return ProviderElementContext; }()); var NgModuleProviderAnalyzer = (function () { /** * @param {?} ngModule * @param {?} extraProviders * @param {?} sourceSpan */ function NgModuleProviderAnalyzer(ngModule, extraProviders, sourceSpan) { var _this = this; this._transformedProviders = new Map(); this._seenProviders = new Map(); this._errors = []; this._allProviders = new Map(); ngModule.transitiveModule.modules.forEach(function (ngModuleType) { var ngModuleProvider = { token: { identifier: ngModuleType }, useClass: ngModuleType }; _resolveProviders([ngModuleProvider], ProviderAstType.PublicService, true, sourceSpan, _this._errors, _this._allProviders); }); _resolveProviders(ngModule.transitiveModule.providers.map(function (entry) { return entry.provider; }).concat(extraProviders), ProviderAstType.PublicService, false, sourceSpan, this._errors, this._allProviders); } /** * @return {?} */ NgModuleProviderAnalyzer.prototype.parse = function () { var _this = this; Array.from(this._allProviders.values()).forEach(function (provider) { _this._getOrCreateLocalProvider(provider.token, provider.eager); }); if (this._errors.length > 0) { var /** @type {?} */ errorString = this._errors.join('\n'); throw new Error("Provider parse errors:\n" + errorString); } return Array.from(this._transformedProviders.values()); }; /** * @param {?} token * @param {?} eager * @return {?} */ NgModuleProviderAnalyzer.prototype._getOrCreateLocalProvider = function (token, eager) { var _this = this; var /** @type {?} */ resolvedProvider = this._allProviders.get(tokenReference(token)); if (!resolvedProvider) { return null; } var /** @type {?} */ transformedProviderAst = this._transformedProviders.get(tokenReference(token)); if (transformedProviderAst) { return transformedProviderAst; } if (this._seenProviders.get(tokenReference(token)) != null) { this._errors.push(new ProviderError("Cannot instantiate cyclic dependency! " + tokenName(token), resolvedProvider.sourceSpan)); return null; } this._seenProviders.set(tokenReference(token), true); var /** @type {?} */ transformedProviders = resolvedProvider.providers.map(function (provider) { var /** @type {?} */ transformedUseValue = provider.useValue; var /** @type {?} */ transformedUseExisting = ((provider.useExisting)); var /** @type {?} */ transformedDeps = ((undefined)); if (provider.useExisting != null) { var /** @type {?} */ existingDiDep = _this._getDependency({ token: provider.useExisting }, eager, resolvedProvider.sourceSpan); if (existingDiDep.token != null) { transformedUseExisting = existingDiDep.token; } else { transformedUseExisting = ((null)); transformedUseValue = existingDiDep.value; } } else if (provider.useFactory) { var /** @type {?} */ deps = provider.deps || provider.useFactory.diDeps; transformedDeps = deps.map(function (dep) { return _this._getDependency(dep, eager, resolvedProvider.sourceSpan); }); } else if (provider.useClass) { var /** @type {?} */ deps = provider.deps || provider.useClass.diDeps; transformedDeps = deps.map(function (dep) { return _this._getDependency(dep, eager, resolvedProvider.sourceSpan); }); } return _transformProvider(provider, { useExisting: transformedUseExisting, useValue: transformedUseValue, deps: transformedDeps }); }); transformedProviderAst = _transformProviderAst(resolvedProvider, { eager: eager, providers: transformedProviders }); this._transformedProviders.set(tokenReference(token), transformedProviderAst); return transformedProviderAst; }; /** * @param {?} dep * @param {?=} eager * @param {?=} requestorSourceSpan * @return {?} */ NgModuleProviderAnalyzer.prototype._getDependency = function (dep, eager, requestorSourceSpan) { if (eager === void 0) { eager = false; } var /** @type {?} */ foundLocal = false; if (!dep.isSkipSelf && dep.token != null) { // access the injector if (tokenReference(dep.token) === resolveIdentifier(Identifiers.Injector) || tokenReference(dep.token) === resolveIdentifier(Identifiers.ComponentFactoryResolver)) { foundLocal = true; } else if (this._getOrCreateLocalProvider(dep.token, eager) != null) { foundLocal = true; } } var /** @type {?} */ result = dep; if (dep.isSelf && !foundLocal) { if (dep.isOptional) { result = { isValue: true, value: null }; } else { this._errors.push(new ProviderError("No provider for " + tokenName(/** @type {?} */ ((dep.token))), requestorSourceSpan)); } } return result; }; return NgModuleProviderAnalyzer; }()); /** * @param {?} provider * @param {?} __1 * @return {?} */ function _transformProvider(provider, _a) { var useExisting = _a.useExisting, useValue = _a.useValue, deps = _a.deps; return { token: provider.token, useClass: provider.useClass, useExisting: useExisting, useFactory: provider.useFactory, useValue: useValue, deps: deps, multi: provider.multi }; } /** * @param {?} provider * @param {?} __1 * @return {?} */ function _transformProviderAst(provider, _a) { var eager = _a.eager, providers = _a.providers; return new ProviderAst(provider.token, provider.multiProvider, provider.eager || eager, providers, provider.providerType, provider.lifecycleHooks, provider.sourceSpan); } /** * @param {?} directives * @param {?} sourceSpan * @param {?} targetErrors * @return {?} */ function _resolveProvidersFromDirectives(directives, sourceSpan, targetErrors) { var /** @type {?} */ providersByToken = new Map(); directives.forEach(function (directive) { var /** @type {?} */ dirProvider = { token: { identifier: directive.type }, useClass: directive.type }; _resolveProviders([dirProvider], directive.isComponent ? ProviderAstType.Component : ProviderAstType.Directive, true, sourceSpan, targetErrors, providersByToken); }); // Note: directives need to be able to overwrite providers of a component! var /** @type {?} */ directivesWithComponentFirst = directives.filter(function (dir) { return dir.isComponent; }).concat(directives.filter(function (dir) { return !dir.isComponent; })); directivesWithComponentFirst.forEach(function (directive) { _resolveProviders(directive.providers, ProviderAstType.PublicService, false, sourceSpan, targetErrors, providersByToken); _resolveProviders(directive.viewProviders, ProviderAstType.PrivateService, false, sourceSpan, targetErrors, providersByToken); }); return providersByToken; } /** * @param {?} providers * @param {?} providerType * @param {?} eager * @param {?} sourceSpan * @param {?} targetErrors * @param {?} targetProvidersByToken * @return {?} */ function _resolveProviders(providers, providerType, eager, sourceSpan, targetErrors, targetProvidersByToken) { providers.forEach(function (provider) { var /** @type {?} */ resolvedProvider = targetProvidersByToken.get(tokenReference(provider.token)); if (resolvedProvider != null && !!resolvedProvider.multiProvider !== !!provider.multi) { targetErrors.push(new ProviderError("Mixing multi and non multi provider is not possible for token " + tokenName(resolvedProvider.token), sourceSpan)); } if (!resolvedProvider) { var /** @type {?} */ lifecycleHooks = provider.token.identifier && ((provider.token.identifier)).lifecycleHooks ? ((provider.token.identifier)).lifecycleHooks : []; var /** @type {?} */ isUseValue = !(provider.useClass || provider.useExisting || provider.useFactory); resolvedProvider = new ProviderAst(provider.token, !!provider.multi, eager || isUseValue, [provider], providerType, lifecycleHooks, sourceSpan); targetProvidersByToken.set(tokenReference(provider.token), resolvedProvider); } else { if (!provider.multi) { resolvedProvider.providers.length = 0; } resolvedProvider.providers.push(provider); } }); } /** * @param {?} component * @return {?} */ function _getViewQueries(component) { // Note: queries start with id 1 so we can use the number in a Bloom filter! var /** @type {?} */ viewQueryId = 1; var /** @type {?} */ viewQueries = new Map(); if (component.viewQueries) { component.viewQueries.forEach(function (query) { return _addQueryToTokenMap(viewQueries, { meta: query, queryId: viewQueryId++ }); }); } return viewQueries; } /** * @param {?} contentQueryStartId * @param {?} directives * @return {?} */ function _getContentQueries(contentQueryStartId, directives) { var /** @type {?} */ contentQueryId = contentQueryStartId; var /** @type {?} */ contentQueries = new Map(); directives.forEach(function (directive, directiveIndex) { if (directive.queries) { directive.queries.forEach(function (query) { return _addQueryToTokenMap(contentQueries, { meta: query, queryId: contentQueryId++ }); }); } }); return contentQueries; } /** * @param {?} map * @param {?} query * @return {?} */ function _addQueryToTokenMap(map, query) { query.meta.selectors.forEach(function (token) { var /** @type {?} */ entry = map.get(tokenReference(token)); if (!entry) { entry = []; map.set(tokenReference(token), entry); } entry.push(query); }); } /** * @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 */ /** * @abstract */ var ElementSchemaRegistry = (function () { function ElementSchemaRegistry() { } /** * @abstract * @param {?} tagName * @param {?} propName * @param {?} schemaMetas * @return {?} */ ElementSchemaRegistry.prototype.hasProperty = function (tagName, propName, schemaMetas) { }; /** * @abstract * @param {?} tagName * @param {?} schemaMetas * @return {?} */ ElementSchemaRegistry.prototype.hasElement = function (tagName, schemaMetas) { }; /** * @abstract * @param {?} elementName * @param {?} propName * @param {?} isAttribute * @return {?} */ ElementSchemaRegistry.prototype.securityContext = function (elementName, propName, isAttribute) { }; /** * @abstract * @return {?} */ ElementSchemaRegistry.prototype.allKnownElementNames = function () { }; /** * @abstract * @param {?} propName * @return {?} */ ElementSchemaRegistry.prototype.getMappedPropName = function (propName) { }; /** * @abstract * @return {?} */ ElementSchemaRegistry.prototype.getDefaultComponentElementName = function () { }; /** * @abstract * @param {?} name * @return {?} */ ElementSchemaRegistry.prototype.validateProperty = function (name) { }; /** * @abstract * @param {?} name * @return {?} */ ElementSchemaRegistry.prototype.validateAttribute = function (name) { }; /** * @abstract * @param {?} propName * @return {?} */ ElementSchemaRegistry.prototype.normalizeAnimationStyleProperty = function (propName) { }; /** * @abstract * @param {?} camelCaseProp * @param {?} userProvidedProp * @param {?} val * @return {?} */ ElementSchemaRegistry.prototype.normalizeAnimationStyleValue = function (camelCaseProp, userProvidedProp, val) { }; return ElementSchemaRegistry; }()); /** * @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 StyleWithImports = (function () { /** * @param {?} style * @param {?} styleUrls */ function StyleWithImports(style$$1, styleUrls) { this.style = style$$1; this.styleUrls = styleUrls; } return StyleWithImports; }()); /** * @param {?} url * @return {?} */ function isStyleUrlResolvable(url) { if (url == null || url.length === 0 || url[0] == '/') return false; var /** @type {?} */ schemeMatch = url.match(URL_WITH_SCHEMA_REGEXP); return schemeMatch === null || schemeMatch[1] == 'package' || schemeMatch[1] == 'asset'; } /** * Rewrites stylesheets by resolving and removing the \@import urls that * are either relative or don't have a `package:` scheme * @param {?} resolver * @param {?} baseUrl * @param {?} cssText * @return {?} */ function extractStyleUrls(resolver, baseUrl, cssText) { var /** @type {?} */ foundUrls = []; var /** @type {?} */ modifiedCssText = cssText.replace(CSS_COMMENT_REGEXP, '').replace(CSS_IMPORT_REGEXP, function () { var m = []; for (var _i = 0; _i < arguments.length; _i++) { m[_i] = arguments[_i]; } var /** @type {?} */ url = m[1] || m[2]; if (!isStyleUrlResolvable(url)) { // Do not attempt to resolve non-package absolute URLs with URI scheme return m[0]; } foundUrls.push(resolver.resolve(baseUrl, url)); return ''; }); return new StyleWithImports(modifiedCssText, foundUrls); } var CSS_IMPORT_REGEXP = /@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g; var CSS_COMMENT_REGEXP = /\/\*.+?\*\//g; var URL_WITH_SCHEMA_REGEXP = /^([^:/?#]+):/; /** * @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 PROPERTY_PARTS_SEPARATOR = '.'; var ATTRIBUTE_PREFIX = 'attr'; var CLASS_PREFIX = 'class'; var STYLE_PREFIX = 'style'; var ANIMATE_PROP_PREFIX = 'animate-'; var BoundPropertyType = {}; BoundPropertyType.DEFAULT = 0; BoundPropertyType.LITERAL_ATTR = 1; BoundPropertyType.ANIMATION = 2; BoundPropertyType[BoundPropertyType.DEFAULT] = "DEFAULT"; BoundPropertyType[BoundPropertyType.LITERAL_ATTR] = "LITERAL_ATTR"; BoundPropertyType[BoundPropertyType.ANIMATION] = "ANIMATION"; /** * Represents a parsed property. */ var BoundProperty = (function () { /** * @param {?} name * @param {?} expression * @param {?} type * @param {?} sourceSpan */ function BoundProperty(name, expression, type, sourceSpan) { this.name = name; this.expression = expression; this.type = type; this.sourceSpan = sourceSpan; } Object.defineProperty(BoundProperty.prototype, "isLiteral", { /** * @return {?} */ get: function () { return this.type === BoundPropertyType.LITERAL_ATTR; }, enumerable: true, configurable: true }); Object.defineProperty(BoundProperty.prototype, "isAnimation", { /** * @return {?} */ get: function () { return this.type === BoundPropertyType.ANIMATION; }, enumerable: true, configurable: true }); return BoundProperty; }()); /** * Parses bindings in templates and in the directive host area. */ var BindingParser = (function () { /** * @param {?} _exprParser * @param {?} _interpolationConfig * @param {?} _schemaRegistry * @param {?} pipes * @param {?} _targetErrors */ function BindingParser(_exprParser, _interpolationConfig, _schemaRegistry, pipes, _targetErrors) { var _this = this; this._exprParser = _exprParser; this._interpolationConfig = _interpolationConfig; this._schemaRegistry = _schemaRegistry; this._targetErrors = _targetErrors; this.pipesByName = new Map(); this._usedPipes = new Map(); pipes.forEach(function (pipe) { return _this.pipesByName.set(pipe.name, pipe); }); } /** * @return {?} */ BindingParser.prototype.getUsedPipes = function () { return Array.from(this._usedPipes.values()); }; /** * @param {?} dirMeta * @param {?} elementSelector * @param {?} sourceSpan * @return {?} */ BindingParser.prototype.createDirectiveHostPropertyAsts = function (dirMeta, elementSelector, sourceSpan) { var _this = this; if (dirMeta.hostProperties) { var /** @type {?} */ boundProps_1 = []; Object.keys(dirMeta.hostProperties).forEach(function (propName) { var /** @type {?} */ expression = dirMeta.hostProperties[propName]; if (typeof expression === 'string') { _this.parsePropertyBinding(propName, expression, true, sourceSpan, [], boundProps_1); } else { _this._reportError("Value of the host property binding \"" + propName + "\" needs to be a string representing an expression but got \"" + expression + "\" (" + typeof expression + ")", sourceSpan); } }); return boundProps_1.map(function (prop) { return _this.createElementPropertyAst(elementSelector, prop); }); } return null; }; /** * @param {?} dirMeta * @param {?} sourceSpan * @return {?} */ BindingParser.prototype.createDirectiveHostEventAsts = function (dirMeta, sourceSpan) { var _this = this; if (dirMeta.hostListeners) { var /** @type {?} */ targetEventAsts_1 = []; Object.keys(dirMeta.hostListeners).forEach(function (propName) { var /** @type {?} */ expression = dirMeta.hostListeners[propName]; if (typeof expression === 'string') { _this.parseEvent(propName, expression, sourceSpan, [], targetEventAsts_1); } else { _this._reportError("Value of the host listener \"" + propName + "\" needs to be a string representing an expression but got \"" + expression + "\" (" + typeof expression + ")", sourceSpan); } }); return targetEventAsts_1; } return null; }; /** * @param {?} value * @param {?} sourceSpan * @return {?} */ BindingParser.prototype.parseInterpolation = function (value, sourceSpan) { var /** @type {?} */ sourceInfo = sourceSpan.start.toString(); try { var /** @type {?} */ ast = ((this._exprParser.parseInterpolation(value, sourceInfo, this._interpolationConfig))); if (ast) this._reportExpressionParserErrors(ast.errors, sourceSpan); this._checkPipes(ast, sourceSpan); return ast; } catch (e) { this._reportError("" + e, sourceSpan); return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); } }; /** * @param {?} prefixToken * @param {?} value * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetProps * @param {?} targetVars * @return {?} */ BindingParser.prototype.parseInlineTemplateBinding = function (prefixToken, value, sourceSpan, targetMatchableAttrs, targetProps, targetVars) { var /** @type {?} */ bindings = this._parseTemplateBindings(prefixToken, value, sourceSpan); for (var /** @type {?} */ i = 0; i < bindings.length; i++) { var /** @type {?} */ binding = bindings[i]; if (binding.keyIsVar) { targetVars.push(new VariableAst(binding.key, binding.name, sourceSpan)); } else if (binding.expression) { this._parsePropertyAst(binding.key, binding.expression, sourceSpan, targetMatchableAttrs, targetProps); } else { targetMatchableAttrs.push([binding.key, '']); this.parseLiteralAttr(binding.key, null, sourceSpan, targetMatchableAttrs, targetProps); } } }; /** * @param {?} prefixToken * @param {?} value * @param {?} sourceSpan * @return {?} */ BindingParser.prototype._parseTemplateBindings = function (prefixToken, value, sourceSpan) { var _this = this; var /** @type {?} */ sourceInfo = sourceSpan.start.toString(); try { var /** @type {?} */ bindingsResult = this._exprParser.parseTemplateBindings(prefixToken, value, sourceInfo); this._reportExpressionParserErrors(bindingsResult.errors, sourceSpan); bindingsResult.templateBindings.forEach(function (binding) { if (binding.expression) { _this._checkPipes(binding.expression, sourceSpan); } }); bindingsResult.warnings.forEach(function (warning) { _this._reportError(warning, sourceSpan, ParseErrorLevel.WARNING); }); return bindingsResult.templateBindings; } catch (e) { this._reportError("" + e, sourceSpan); return []; } }; /** * @param {?} name * @param {?} value * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetProps * @return {?} */ BindingParser.prototype.parseLiteralAttr = function (name, value, sourceSpan, targetMatchableAttrs, targetProps) { if (_isAnimationLabel(name)) { name = name.substring(1); if (value) { this._reportError("Assigning animation triggers via @prop=\"exp\" attributes with an expression is invalid." + " Use property bindings (e.g. [@prop]=\"exp\") or use an attribute without a value (e.g. @prop) instead.", sourceSpan, ParseErrorLevel.ERROR); } this._parseAnimation(name, value, sourceSpan, targetMatchableAttrs, targetProps); } else { targetProps.push(new BoundProperty(name, this._exprParser.wrapLiteralPrimitive(value, ''), BoundPropertyType.LITERAL_ATTR, sourceSpan)); } }; /** * @param {?} name * @param {?} expression * @param {?} isHost * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetProps * @return {?} */ BindingParser.prototype.parsePropertyBinding = function (name, expression, isHost, sourceSpan, targetMatchableAttrs, targetProps) { var /** @type {?} */ isAnimationProp = false; if (name.startsWith(ANIMATE_PROP_PREFIX)) { isAnimationProp = true; name = name.substring(ANIMATE_PROP_PREFIX.length); } else if (_isAnimationLabel(name)) { isAnimationProp = true; name = name.substring(1); } if (isAnimationProp) { this._parseAnimation(name, expression, sourceSpan, targetMatchableAttrs, targetProps); } else { this._parsePropertyAst(name, this._parseBinding(expression, isHost, sourceSpan), sourceSpan, targetMatchableAttrs, targetProps); } }; /** * @param {?} name * @param {?} value * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetProps * @return {?} */ BindingParser.prototype.parsePropertyInterpolation = function (name, value, sourceSpan, targetMatchableAttrs, targetProps) { var /** @type {?} */ expr = this.parseInterpolation(value, sourceSpan); if (expr) { this._parsePropertyAst(name, expr, sourceSpan, targetMatchableAttrs, targetProps); return true; } return false; }; /** * @param {?} name * @param {?} ast * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetProps * @return {?} */ BindingParser.prototype._parsePropertyAst = function (name, ast, sourceSpan, targetMatchableAttrs, targetProps) { targetMatchableAttrs.push([name, /** @type {?} */ ((ast.source))]); targetProps.push(new BoundProperty(name, ast, BoundPropertyType.DEFAULT, sourceSpan)); }; /** * @param {?} name * @param {?} expression * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetProps * @return {?} */ BindingParser.prototype._parseAnimation = function (name, expression, sourceSpan, targetMatchableAttrs, targetProps) { // This will occur when a @trigger is not paired with an expression. // For animations it is valid to not have an expression since */void // states will be applied by angular when the element is attached/detached var /** @type {?} */ ast = this._parseBinding(expression || 'null', false, sourceSpan); targetMatchableAttrs.push([name, /** @type {?} */ ((ast.source))]); targetProps.push(new BoundProperty(name, ast, BoundPropertyType.ANIMATION, sourceSpan)); }; /** * @param {?} value * @param {?} isHostBinding * @param {?} sourceSpan * @return {?} */ BindingParser.prototype._parseBinding = function (value, isHostBinding, sourceSpan) { var /** @type {?} */ sourceInfo = sourceSpan.start.toString(); try { var /** @type {?} */ ast = isHostBinding ? this._exprParser.parseSimpleBinding(value, sourceInfo, this._interpolationConfig) : this._exprParser.parseBinding(value, sourceInfo, this._interpolationConfig); if (ast) this._reportExpressionParserErrors(ast.errors, sourceSpan); this._checkPipes(ast, sourceSpan); return ast; } catch (e) { this._reportError("" + e, sourceSpan); return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); } }; /** * @param {?} elementSelector * @param {?} boundProp * @return {?} */ BindingParser.prototype.createElementPropertyAst = function (elementSelector, boundProp) { if (boundProp.isAnimation) { return new BoundElementPropertyAst(boundProp.name, PropertyBindingType.Animation, __WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* SecurityContext */].NONE, boundProp.expression, null, boundProp.sourceSpan); } var /** @type {?} */ unit = null; var /** @type {?} */ bindingType = ((undefined)); var /** @type {?} */ boundPropertyName = null; var /** @type {?} */ parts = boundProp.name.split(PROPERTY_PARTS_SEPARATOR); var /** @type {?} */ securityContexts = ((undefined)); // Check check for special cases (prefix style, attr, class) if (parts.length > 1) { if (parts[0] == ATTRIBUTE_PREFIX) { boundPropertyName = parts[1]; this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, true); securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, true); var /** @type {?} */ nsSeparatorIdx = boundPropertyName.indexOf(':'); if (nsSeparatorIdx > -1) { var /** @type {?} */ ns = boundPropertyName.substring(0, nsSeparatorIdx); var /** @type {?} */ name = boundPropertyName.substring(nsSeparatorIdx + 1); boundPropertyName = mergeNsAndName(ns, name); } bindingType = PropertyBindingType.Attribute; } else if (parts[0] == CLASS_PREFIX) { boundPropertyName = parts[1]; bindingType = PropertyBindingType.Class; securityContexts = [__WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* SecurityContext */].NONE]; } else if (parts[0] == STYLE_PREFIX) { unit = parts.length > 2 ? parts[2] : null; boundPropertyName = parts[1]; bindingType = PropertyBindingType.Style; securityContexts = [__WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* SecurityContext */].STYLE]; } } // If not a special case, use the full property name if (boundPropertyName === null) { boundPropertyName = this._schemaRegistry.getMappedPropName(boundProp.name); securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, false); bindingType = PropertyBindingType.Property; this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, false); } return new BoundElementPropertyAst(boundPropertyName, bindingType, securityContexts[0], boundProp.expression, unit, boundProp.sourceSpan); }; /** * @param {?} name * @param {?} expression * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetEvents * @return {?} */ BindingParser.prototype.parseEvent = function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) { if (_isAnimationLabel(name)) { name = name.substr(1); this._parseAnimationEvent(name, expression, sourceSpan, targetEvents); } else { this._parseEvent(name, expression, sourceSpan, targetMatchableAttrs, targetEvents); } }; /** * @param {?} name * @param {?} expression * @param {?} sourceSpan * @param {?} targetEvents * @return {?} */ BindingParser.prototype._parseAnimationEvent = function (name, expression, sourceSpan, targetEvents) { var /** @type {?} */ matches = splitAtPeriod(name, [name, '']); var /** @type {?} */ eventName = matches[0]; var /** @type {?} */ phase = matches[1].toLowerCase(); if (phase) { switch (phase) { case 'start': case 'done': var /** @type {?} */ ast = this._parseAction(expression, sourceSpan); targetEvents.push(new BoundEventAst(eventName, null, phase, ast, sourceSpan)); break; default: this._reportError("The provided animation output phase value \"" + phase + "\" for \"@" + eventName + "\" is not supported (use start or done)", sourceSpan); break; } } else { this._reportError("The animation trigger output event (@" + eventName + ") is missing its phase value name (start or done are currently supported)", sourceSpan); } }; /** * @param {?} name * @param {?} expression * @param {?} sourceSpan * @param {?} targetMatchableAttrs * @param {?} targetEvents * @return {?} */ BindingParser.prototype._parseEvent = function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) { // long format: 'target: eventName' var _a = splitAtColon(name, [/** @type {?} */ ((null)), name]), target = _a[0], eventName = _a[1]; var /** @type {?} */ ast = this._parseAction(expression, sourceSpan); targetMatchableAttrs.push([/** @type {?} */ ((name)), /** @type {?} */ ((ast.source))]); targetEvents.push(new BoundEventAst(eventName, target, null, ast, sourceSpan)); // Don't detect directives for event names for now, // so don't add the event name to the matchableAttrs }; /** * @param {?} value * @param {?} sourceSpan * @return {?} */ BindingParser.prototype._parseAction = function (value, sourceSpan) { var /** @type {?} */ sourceInfo = sourceSpan.start.toString(); try { var /** @type {?} */ ast = this._exprParser.parseAction(value, sourceInfo, this._interpolationConfig); if (ast) { this._reportExpressionParserErrors(ast.errors, sourceSpan); } if (!ast || ast.ast instanceof EmptyExpr) { this._reportError("Empty expressions are not allowed", sourceSpan); return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); } this._checkPipes(ast, sourceSpan); return ast; } catch (e) { this._reportError("" + e, sourceSpan); return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo); } }; /** * @param {?} message * @param {?} sourceSpan * @param {?=} level * @return {?} */ BindingParser.prototype._reportError = function (message, sourceSpan, level) { if (level === void 0) { level = ParseErrorLevel.ERROR; } this._targetErrors.push(new ParseError(sourceSpan, message, level)); }; /** * @param {?} errors * @param {?} sourceSpan * @return {?} */ BindingParser.prototype._reportExpressionParserErrors = function (errors, sourceSpan) { for (var _i = 0, errors_1 = errors; _i < errors_1.length; _i++) { var error = errors_1[_i]; this._reportError(error.message, sourceSpan); } }; /** * @param {?} ast * @param {?} sourceSpan * @return {?} */ BindingParser.prototype._checkPipes = function (ast, sourceSpan) { var _this = this; if (ast) { var /** @type {?} */ collector = new PipeCollector(); ast.visit(collector); collector.pipes.forEach(function (ast, pipeName) { var /** @type {?} */ pipeMeta = _this.pipesByName.get(pipeName); if (!pipeMeta) { _this._reportError("The pipe '" + pipeName + "' could not be found", new ParseSourceSpan(sourceSpan.start.moveBy(ast.span.start), sourceSpan.start.moveBy(ast.span.end))); } else { _this._usedPipes.set(pipeName, pipeMeta); } }); } }; /** * @param {?} propName the name of the property / attribute * @param {?} sourceSpan * @param {?} isAttr true when binding to an attribute * @return {?} */ BindingParser.prototype._validatePropertyOrAttributeName = function (propName, sourceSpan, isAttr) { var /** @type {?} */ report = isAttr ? this._schemaRegistry.validateAttribute(propName) : this._schemaRegistry.validateProperty(propName); if (report.error) { this._reportError(/** @type {?} */ ((report.msg)), sourceSpan, ParseErrorLevel.ERROR); } }; return BindingParser; }()); var PipeCollector = (function (_super) { __extends(PipeCollector, _super); function PipeCollector() { var _this = _super.apply(this, arguments) || this; _this.pipes = new Map(); return _this; } /** * @param {?} ast * @param {?} context * @return {?} */ PipeCollector.prototype.visitPipe = function (ast, context) { this.pipes.set(ast.name, ast); ast.exp.visit(this); this.visitAll(ast.args, context); return null; }; return PipeCollector; }(RecursiveAstVisitor)); /** * @param {?} name * @return {?} */ function _isAnimationLabel(name) { return name[0] == '@'; } /** * @param {?} registry * @param {?} selector * @param {?} propName * @param {?} isAttribute * @return {?} */ function calcPossibleSecurityContexts(registry, selector, propName, isAttribute) { var /** @type {?} */ ctxs = []; CssSelector.parse(selector).forEach(function (selector) { var /** @type {?} */ elementNames = selector.element ? [selector.element] : registry.allKnownElementNames(); var /** @type {?} */ notElementNames = new Set(selector.notSelectors.filter(function (selector) { return selector.isElementSelector(); }) .map(function (selector) { return selector.element; })); var /** @type {?} */ possibleElementNames = elementNames.filter(function (elementName) { return !notElementNames.has(elementName); }); ctxs.push.apply(ctxs, possibleElementNames.map(function (elementName) { return registry.securityContext(elementName, propName, isAttribute); })); }); return ctxs.length === 0 ? [__WEBPACK_IMPORTED_MODULE_0__angular_core__["v" /* SecurityContext */].NONE] : Array.from(new Set(ctxs)).sort(); } /** * @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 NG_CONTENT_SELECT_ATTR = 'select'; var LINK_ELEMENT = 'link'; var LINK_STYLE_REL_ATTR = 'rel'; var LINK_STYLE_HREF_ATTR = 'href'; var LINK_STYLE_REL_VALUE = 'stylesheet'; var STYLE_ELEMENT = 'style'; var SCRIPT_ELEMENT = 'script'; var NG_NON_BINDABLE_ATTR = 'ngNonBindable'; var NG_PROJECT_AS = 'ngProjectAs'; /** * @param {?} ast * @return {?} */ function preparseElement(ast) { var /** @type {?} */ selectAttr = ((null)); var /** @type {?} */ hrefAttr = ((null)); var /** @type {?} */ relAttr = ((null)); var /** @type {?} */ nonBindable = false; var /** @type {?} */ projectAs = ((null)); ast.attrs.forEach(function (attr) { var /** @type {?} */ lcAttrName = attr.name.toLowerCase(); if (lcAttrName == NG_CONTENT_SELECT_ATTR) { selectAttr = attr.value; } else if (lcAttrName == LINK_STYLE_HREF_ATTR) { hrefAttr = attr.value; } else if (lcAttrName == LINK_STYLE_REL_ATTR) { relAttr = attr.value; } else if (attr.name == NG_NON_BINDABLE_ATTR) { nonBindable = true; } else if (attr.name == NG_PROJECT_AS) { if (attr.value.length > 0) { projectAs = attr.value; } } }); selectAttr = normalizeNgContentSelect(selectAttr); var /** @type {?} */ nodeName = ast.name.toLowerCase(); var /** @type {?} */ type = PreparsedElementType.OTHER; if (isNgContent(nodeName)) { type = PreparsedElementType.NG_CONTENT; } else if (nodeName == STYLE_ELEMENT) { type = PreparsedElementType.STYLE; } else if (nodeName == SCRIPT_ELEMENT) { type = PreparsedElementType.SCRIPT; } else if (nodeName == LINK_ELEMENT && relAttr == LINK_STYLE_REL_VALUE) { type = PreparsedElementType.STYLESHEET; } return new PreparsedElement(type, selectAttr, hrefAttr, nonBindable, projectAs); } var PreparsedElementType = {}; PreparsedElementType.NG_CONTENT = 0; PreparsedElementType.STYLE = 1; PreparsedElementType.STYLESHEET = 2; PreparsedElementType.SCRIPT = 3; PreparsedElementType.OTHER = 4; PreparsedElementType[PreparsedElementType.NG_CONTENT] = "NG_CONTENT"; PreparsedElementType[PreparsedElementType.STYLE] = "STYLE"; PreparsedElementType[PreparsedElementType.STYLESHEET] = "STYLESHEET"; PreparsedElementType[PreparsedElementType.SCRIPT] = "SCRIPT"; PreparsedElementType[PreparsedElementType.OTHER] = "OTHER"; var PreparsedElement = (function () { /** * @param {?} type * @param {?} selectAttr * @param {?} hrefAttr * @param {?} nonBindable * @param {?} projectAs */ function PreparsedElement(type, selectAttr, hrefAttr, nonBindable, projectAs) { this.type = type; this.selectAttr = selectAttr; this.hrefAttr = hrefAttr; this.nonBindable = nonBindable; this.projectAs = projectAs; } return PreparsedElement; }()); /** * @param {?} selectAttr * @return {?} */ function normalizeNgContentSelect(selectAttr) { if (selectAttr === null || selectAttr.length === 0) { return '*'; } return selectAttr; } /** * @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 BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/; // Group 1 = "bind-" var KW_BIND_IDX = 1; // Group 2 = "let-" var KW_LET_IDX = 2; // Group 3 = "ref-/#" var KW_REF_IDX = 3; // Group 4 = "on-" var KW_ON_IDX = 4; // Group 5 = "bindon-" var KW_BINDON_IDX = 5; // Group 6 = "@" var KW_AT_IDX = 6; // Group 7 = the identifier after "bind-", "let-", "ref-/#", "on-", "bindon-" or "@" var IDENT_KW_IDX = 7; // Group 8 = identifier inside [()] var IDENT_BANANA_BOX_IDX = 8; // Group 9 = identifier inside [] var IDENT_PROPERTY_IDX = 9; // Group 10 = identifier inside () var IDENT_EVENT_IDX = 10; // deprecated in 4.x var TEMPLATE_ELEMENT = 'template'; // deprecated in 4.x var TEMPLATE_ATTR = 'template'; var TEMPLATE_ATTR_PREFIX = '*'; var CLASS_ATTR = 'class'; var TEXT_CSS_SELECTOR = CssSelector.parse('*')[0]; var TEMPLATE_ELEMENT_DEPRECATION_WARNING = 'The