Mr.Combet Webshell
Your IP :
216.73.216.136
Server IP :
103.233.58.157
Server :
Windows NT WIN-4PGF72KEHKB 10.0 build 17763 (Windows Server 2016) AMD64
Server Software :
Microsoft-IIS/10.0
PHP Version :
7.3.25
Add File :
Submit
Add Directory :
Submit
Dir :
C:
/
inetpub
/
wwwroot
/
ActionAidAPI
/
ClientApp
/
dist
/
View File Name :
vendor-es5.js
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); } function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _createForOfIteratorHelper(o) { if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) { var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var it, normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } (window["webpackJsonp"] = window["webpackJsonp"] || []).push([["vendor"], { /***/ "./node_modules/@angular/common/fesm2015/common.js": /*!*********************************************************!*\ !*** ./node_modules/@angular/common/fesm2015/common.js ***! \*********************************************************/ /*! exports provided: ɵangular_packages_common_common_c, ɵangular_packages_common_common_h, ɵangular_packages_common_common_g, ɵangular_packages_common_common_f, ɵangular_packages_common_common_k, ɵangular_packages_common_common_j, ɵangular_packages_common_common_i, ɵangular_packages_common_common_a, ɵangular_packages_common_common_b, ɵangular_packages_common_common_e, ɵangular_packages_common_common_d, ɵregisterLocaleData, registerLocaleData, formatDate, formatCurrency, formatNumber, formatPercent, NgLocaleLocalization, NgLocalization, Plural, NumberFormatStyle, FormStyle, TranslationWidth, FormatWidth, NumberSymbol, WeekDay, getNumberOfCurrencyDigits, getCurrencySymbol, getLocaleDayPeriods, getLocaleDayNames, getLocaleMonthNames, getLocaleId, getLocaleEraNames, getLocaleWeekEndRange, getLocaleFirstDayOfWeek, getLocaleDateFormat, getLocaleDateTimeFormat, getLocaleExtraDayPeriodRules, getLocaleExtraDayPeriods, getLocalePluralCase, getLocaleTimeFormat, getLocaleNumberSymbol, getLocaleNumberFormat, getLocaleCurrencyName, getLocaleCurrencySymbol, ɵparseCookieValue, CommonModule, DeprecatedI18NPipesModule, NgClass, NgClassBase, NgForOf, NgForOfContext, NgIf, NgIfContext, NgPlural, NgPluralCase, NgStyle, NgStyleBase, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet, NgComponentOutlet, DOCUMENT, AsyncPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, JsonPipe, LowerCasePipe, CurrencyPipe, DecimalPipe, PercentPipe, SlicePipe, UpperCasePipe, TitleCasePipe, KeyValuePipe, DeprecatedDatePipe, DeprecatedCurrencyPipe, DeprecatedDecimalPipe, DeprecatedPercentPipe, ɵPLATFORM_BROWSER_ID, ɵPLATFORM_SERVER_ID, ɵPLATFORM_WORKER_APP_ID, ɵPLATFORM_WORKER_UI_ID, isPlatformBrowser, isPlatformServer, isPlatformWorkerApp, isPlatformWorkerUi, VERSION, ViewportScroller, ɵNullViewportScroller, ɵNgClassImplProvider__POST_R3__, ɵNgClassR2Impl, ɵNgClassImpl, ɵNgStyleImplProvider__POST_R3__, ɵNgStyleR2Impl, ɵNgStyleImpl, ɵngStyleDirectiveDef__POST_R3__, ɵngClassDirectiveDef__POST_R3__, PlatformLocation, LOCATION_INITIALIZED, LocationStrategy, APP_BASE_HREF, HashLocationStrategy, PathLocationStrategy, Location */ /***/ function node_modulesAngularCommonFesm2015CommonJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_c", function () { return COMMON_DIRECTIVES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_h", function () { return NgClassImplProvider; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_g", function () { return NgClassImplProvider__PRE_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_f", function () { return NgClassR3Impl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_k", function () { return NgStyleImplProvider; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_j", function () { return NgStyleImplProvider__PRE_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_i", function () { return NgStyleR3Impl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_a", function () { return DEPRECATED_PLURAL_FN; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_b", function () { return getPluralCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_e", function () { return COMMON_DEPRECATED_I18N_PIPES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_d", function () { return COMMON_PIPES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵregisterLocaleData", function () { return registerLocaleData; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerLocaleData", function () { return registerLocaleData; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatDate", function () { return formatDate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatCurrency", function () { return formatCurrency; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatNumber", function () { return formatNumber; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatPercent", function () { return formatPercent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgLocaleLocalization", function () { return NgLocaleLocalization; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgLocalization", function () { return NgLocalization; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Plural", function () { return Plural; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumberFormatStyle", function () { return NumberFormatStyle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormStyle", function () { return FormStyle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TranslationWidth", function () { return TranslationWidth; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormatWidth", function () { return FormatWidth; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumberSymbol", function () { return NumberSymbol; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WeekDay", function () { return WeekDay; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNumberOfCurrencyDigits", function () { return getNumberOfCurrencyDigits; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCurrencySymbol", function () { return getCurrencySymbol; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDayPeriods", function () { return getLocaleDayPeriods; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDayNames", function () { return getLocaleDayNames; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleMonthNames", function () { return getLocaleMonthNames; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleId", function () { return getLocaleId; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleEraNames", function () { return getLocaleEraNames; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleWeekEndRange", function () { return getLocaleWeekEndRange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleFirstDayOfWeek", function () { return getLocaleFirstDayOfWeek; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDateFormat", function () { return getLocaleDateFormat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDateTimeFormat", function () { return getLocaleDateTimeFormat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleExtraDayPeriodRules", function () { return getLocaleExtraDayPeriodRules; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleExtraDayPeriods", function () { return getLocaleExtraDayPeriods; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocalePluralCase", function () { return getLocalePluralCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleTimeFormat", function () { return getLocaleTimeFormat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleNumberSymbol", function () { return getLocaleNumberSymbol; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleNumberFormat", function () { return getLocaleNumberFormat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleCurrencyName", function () { return getLocaleCurrencyName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleCurrencySymbol", function () { return getLocaleCurrencySymbol; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵparseCookieValue", function () { return parseCookieValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommonModule", function () { return CommonModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedI18NPipesModule", function () { return DeprecatedI18NPipesModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgClass", function () { return NgClass; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgClassBase", function () { return NgClassBase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgForOf", function () { return NgForOf; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgForOfContext", function () { return NgForOfContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgIf", function () { return NgIf; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgIfContext", function () { return NgIfContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgPlural", function () { return NgPlural; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgPluralCase", function () { return NgPluralCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgStyle", function () { return NgStyle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgStyleBase", function () { return NgStyleBase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSwitch", function () { return NgSwitch; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSwitchCase", function () { return NgSwitchCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSwitchDefault", function () { return NgSwitchDefault; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgTemplateOutlet", function () { return NgTemplateOutlet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgComponentOutlet", function () { return NgComponentOutlet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOCUMENT", function () { return DOCUMENT; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsyncPipe", function () { return AsyncPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DatePipe", function () { return DatePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I18nPluralPipe", function () { return I18nPluralPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I18nSelectPipe", function () { return I18nSelectPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonPipe", function () { return JsonPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LowerCasePipe", function () { return LowerCasePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CurrencyPipe", function () { return CurrencyPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DecimalPipe", function () { return DecimalPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PercentPipe", function () { return PercentPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SlicePipe", function () { return SlicePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UpperCasePipe", function () { return UpperCasePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TitleCasePipe", function () { return TitleCasePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyValuePipe", function () { return KeyValuePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedDatePipe", function () { return DeprecatedDatePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedCurrencyPipe", function () { return DeprecatedCurrencyPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedDecimalPipe", function () { return DeprecatedDecimalPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedPercentPipe", function () { return DeprecatedPercentPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_BROWSER_ID", function () { return PLATFORM_BROWSER_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_SERVER_ID", function () { return PLATFORM_SERVER_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_WORKER_APP_ID", function () { return PLATFORM_WORKER_APP_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_WORKER_UI_ID", function () { return PLATFORM_WORKER_UI_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformBrowser", function () { return isPlatformBrowser; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformServer", function () { return isPlatformServer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformWorkerApp", function () { return isPlatformWorkerApp; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformWorkerUi", function () { return isPlatformWorkerUi; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function () { return VERSION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewportScroller", function () { return ViewportScroller; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNullViewportScroller", function () { return NullViewportScroller; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNgClassImplProvider__POST_R3__", function () { return NgClassImplProvider__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNgClassR2Impl", function () { return NgClassR2Impl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNgClassImpl", function () { return NgClassImpl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNgStyleImplProvider__POST_R3__", function () { return NgStyleImplProvider__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNgStyleR2Impl", function () { return NgStyleR2Impl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNgStyleImpl", function () { return NgStyleImpl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵngStyleDirectiveDef__POST_R3__", function () { return ngStyleDirectiveDef__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵngClassDirectiveDef__POST_R3__", function () { return ngClassDirectiveDef__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlatformLocation", function () { return PlatformLocation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOCATION_INITIALIZED", function () { return LOCATION_INITIALIZED; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocationStrategy", function () { return LocationStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_BASE_HREF", function () { return APP_BASE_HREF; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HashLocationStrategy", function () { return HashLocationStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PathLocationStrategy", function () { return PathLocationStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Location", function () { return Location; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! @angular/core */ "./node_modules/@angular/core/fesm2015/core.js"); /** * @license Angular v8.2.12 * (c) 2010-2019 Google LLC. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * 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. * * \@publicApi * @abstract */ var PlatformLocation = function PlatformLocation() { _classCallCheck(this, PlatformLocation); }; if (false) {} /** * \@description * Indicates when a location is initialized. * * \@publicApi * @type {?} */ var LOCATION_INITIALIZED = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('Location Initialized'); /** * \@description * A serializable version of the event from `onPopState` or `onHashChange` * * \@publicApi * @record */ function LocationChangeEvent() {} if (false) {} /** * \@publicApi * @record */ function LocationChangeListener() {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Enables the `Location` service to read route state from the browser's URL. * Angular provides two strategies: * `HashLocationStrategy` and `PathLocationStrategy`. * * Applications should use the `Router` or `Location` services to * interact with application route state. * * For instance, `HashLocationStrategy` produces URLs like * <code class="no-auto-link">http://example.com#/foo</code>, * and `PathLocationStrategy` produces * <code class="no-auto-link">http://example.com/foo</code> as an equivalent URL. * * See these two classes for more. * * \@publicApi * @abstract */ var LocationStrategy = function LocationStrategy() { _classCallCheck(this, LocationStrategy); }; if (false) {} /** * A predefined [DI token](guide/glossary#di-token) for the base href * to be used with the `PathLocationStrategy`. * The base href is the URL prefix that should be preserved when generating * and recognizing URLs. * * \@usageNotes * * The following example shows how to use this token to configure the root app injector * with a base href value, so that the DI framework can supply the dependency anywhere in the app. * * ```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 {} * ``` * * \@publicApi * @type {?} */ var APP_BASE_HREF = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('appBaseHref'); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@publicApi * @record */ function PopStateEvent() {} if (false) {} /** * \@description * * A service that applications can use to interact with a browser's URL. * * Depending on the `LocationStrategy` used, `Location` persists * to the URL's path or the URL's hash segment. * * \@usageNotes * * It's better to use the `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 * * <code-example path='common/location/ts/path_location_component.ts' * region='LocationComponent'></code-example> * * \@publicApi */ var Location = /*#__PURE__*/function () { /** * @param {?} platformStrategy * @param {?} platformLocation */ function Location(platformStrategy, platformLocation) { var _this = this; _classCallCheck(this, Location); /** * \@internal */ this._subject = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * \@internal */ this._urlChangeListeners = []; this._platformStrategy = platformStrategy; /** @type {?} */ var browserBaseHref = this._platformStrategy.getBaseHref(); this._platformLocation = platformLocation; this._baseHref = Location.stripTrailingSlash(_stripIndexHtml(browserBaseHref)); this._platformStrategy.onPopState( /** * @param {?} ev * @return {?} */ function (ev) { _this._subject.emit({ 'url': _this.path(true), 'pop': true, 'state': ev.state, 'type': ev.type }); }); } /** * Normalizes the URL path for this location. * * @param {?=} includeHash True to include an anchor fragment in the path. * * @return {?} The normalized URL path. */ // TODO: vsavkin. Remove the boolean flag and always include hash once the deprecated router is // removed. _createClass2(Location, [{ key: "path", value: function path() { var includeHash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; return this.normalize(this._platformStrategy.path(includeHash)); } /** * Reports the current state of the location history. * @return {?} The current value of the `history.state` object. */ }, { key: "getState", value: function getState() { return this._platformLocation.getState(); } /** * Normalizes the given path and compares to the current normalized path. * * @param {?} path The given URL path. * @param {?=} query Query parameters. * * @return {?} True if the given URL path is equal to the current normalized path, false * otherwise. */ }, { key: "isCurrentPathEqualTo", value: function isCurrentPathEqualTo(path) { var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; return this.path() == this.normalize(path + Location.normalizeQueryParams(query)); } /** * Normalizes a URL path by stripping any trailing slashes. * * @param {?} url String representing a URL. * * @return {?} The normalized URL string. */ }, { key: "normalize", value: function normalize(url) { return Location.stripTrailingSlash(_stripBaseHref(this._baseHref, _stripIndexHtml(url))); } /** * Normalizes an external URL path. * If the given URL doesn't begin with a leading slash (`'/'`), adds one * before normalizing. Adds a hash if `HashLocationStrategy` is * in use, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use. * * @param {?} url String representing a URL. * * @return {?} A normalized platform-specific URL. */ }, { key: "prepareExternalUrl", value: function prepareExternalUrl(url) { if (url && url[0] !== '/') { url = '/' + url; } return this._platformStrategy.prepareExternalUrl(url); } // TODO: rename this method to pushState /** * Changes the browser's URL to a normalized version of a given URL, and pushes a * new item onto the platform's history. * * @param {?} path URL path to normalize. * @param {?=} query Query parameters. * @param {?=} state Location history state. * * @return {?} */ }, { key: "go", value: function go(path) { var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; var state = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; this._platformStrategy.pushState(state, '', path, query); this._notifyUrlChangeListeners(this.prepareExternalUrl(path + Location.normalizeQueryParams(query)), state); } /** * Changes the browser's URL to a normalized version of the given URL, and replaces * the top item on the platform's history stack. * * @param {?} path URL path to normalize. * @param {?=} query Query parameters. * @param {?=} state Location history state. * @return {?} */ }, { key: "replaceState", value: function replaceState(path) { var query = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; var state = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; this._platformStrategy.replaceState(state, '', path, query); this._notifyUrlChangeListeners(this.prepareExternalUrl(path + Location.normalizeQueryParams(query)), state); } /** * Navigates forward in the platform's history. * @return {?} */ }, { key: "forward", value: function forward() { this._platformStrategy.forward(); } /** * Navigates back in the platform's history. * @return {?} */ }, { key: "back", value: function back() { this._platformStrategy.back(); } /** * Registers a URL change listener. Use to catch updates performed by the Angular * framework that are not detectible through "popstate" or "hashchange" events. * * @param {?} fn The change handler function, which take a URL and a location history state. * @return {?} */ }, { key: "onUrlChange", value: function onUrlChange(fn) { var _this2 = this; this._urlChangeListeners.push(fn); this.subscribe( /** * @param {?} v * @return {?} */ function (v) { _this2._notifyUrlChangeListeners(v.url, v.state); }); } /** * \@internal * @param {?=} url * @param {?=} state * @return {?} */ }, { key: "_notifyUrlChangeListeners", value: function _notifyUrlChangeListeners() { var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; var state = arguments.length > 1 ? arguments[1] : undefined; this._urlChangeListeners.forEach( /** * @param {?} fn * @return {?} */ function (fn) { return fn(url, state); }); } /** * Subscribes to the platform's `popState` events. * * @param {?} onNext * @param {?=} onThrow * @param {?=} onReturn * @return {?} Subscribed events. */ }, { key: "subscribe", value: function subscribe(onNext, onThrow, onReturn) { return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn }); } /** * Normalizes URL parameters by prepending with `?` if needed. * * @param {?} params String of URL parameters. * * @return {?} The normalized URL parameters string. */ }], [{ key: "normalizeQueryParams", value: function normalizeQueryParams(params) { return params && params[0] !== '?' ? '?' + params : params; } /** * Joins two parts of a URL with a slash if needed. * * @param {?} start URL string * @param {?} end URL string * * * @return {?} The joined URL string. */ }, { key: "joinWithSlash", value: function joinWithSlash(start, end) { if (start.length == 0) { return end; } if (end.length == 0) { return start; } /** @type {?} */ var 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; } /** * Removes a trailing slash from a URL string if needed. * Looks for the first occurrence of either `#`, `?`, or the end of the * line as `/` characters and removes the trailing slash if one exists. * * @param {?} url URL string. * * @return {?} The URL string, modified if needed. */ }, { key: "stripTrailingSlash", value: function stripTrailingSlash(url) { /** @type {?} */ var match = url.match(/#|\?|$/); /** @type {?} */ var pathEndIdx = match && match.index || url.length; /** @type {?} */ var droppedSlashIdx = pathEndIdx - (url[pathEndIdx - 1] === '/' ? 1 : 0); return url.slice(0, droppedSlashIdx) + url.slice(pathEndIdx); } }]); return Location; }(); Location.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; /** @nocollapse */ Location.ctorParameters = function () { return [{ type: LocationStrategy }, { type: PlatformLocation }]; }; if (false) {} /** * @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$/, ''); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@description * 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`. * * \@usageNotes * * ### Example * * {\@example common/location/ts/hash_location_component.ts region='LocationComponent'} * * \@publicApi */ var HashLocationStrategy = /*#__PURE__*/function (_LocationStrategy) { _inherits(HashLocationStrategy, _LocationStrategy); var _super = _createSuper(HashLocationStrategy); /** * @param {?} _platformLocation * @param {?=} _baseHref */ function HashLocationStrategy(_platformLocation, _baseHref) { var _this3; _classCallCheck(this, HashLocationStrategy); _this3 = _super.call(this); _this3._platformLocation = _platformLocation; _this3._baseHref = ''; if (_baseHref != null) { _this3._baseHref = _baseHref; } return _this3; } /** * @param {?} fn * @return {?} */ _createClass2(HashLocationStrategy, [{ key: "onPopState", value: function onPopState(fn) { this._platformLocation.onPopState(fn); this._platformLocation.onHashChange(fn); } /** * @return {?} */ }, { key: "getBaseHref", value: function getBaseHref() { return this._baseHref; } /** * @param {?=} includeHash * @return {?} */ }, { key: "path", value: function path() { var includeHash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; // the hash value is always prefixed with a `#` // and if it is empty then it will stay empty /** @type {?} */ var path = this._platformLocation.hash; if (path == null) path = '#'; return path.length > 0 ? path.substring(1) : path; } /** * @param {?} internal * @return {?} */ }, { key: "prepareExternalUrl", value: function prepareExternalUrl(internal) { /** @type {?} */ var url = Location.joinWithSlash(this._baseHref, internal); return url.length > 0 ? '#' + url : url; } /** * @param {?} state * @param {?} title * @param {?} path * @param {?} queryParams * @return {?} */ }, { key: "pushState", value: function pushState(state, title, path, queryParams) { /** @type {?} */ var 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 {?} */ }, { key: "replaceState", value: function replaceState(state, title, path, queryParams) { /** @type {?} */ var url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams)); if (url.length == 0) { url = this._platformLocation.pathname; } this._platformLocation.replaceState(state, title, url); } /** * @return {?} */ }, { key: "forward", value: function forward() { this._platformLocation.forward(); } /** * @return {?} */ }, { key: "back", value: function back() { this._platformLocation.back(); } }]); return HashLocationStrategy; }(LocationStrategy); HashLocationStrategy.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; /** @nocollapse */ HashLocationStrategy.ctorParameters = function () { return [{ type: PlatformLocation }, { type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [APP_BASE_HREF] }] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@description * 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 `<base href='/my/app'/>` to the document and call * `location.go('/foo')`, the browser's URL will become * `example.com/my/app/foo`. * * \@usageNotes * * ### Example * * {\@example common/location/ts/path_location_component.ts region='LocationComponent'} * * \@publicApi */ var PathLocationStrategy = /*#__PURE__*/function (_LocationStrategy2) { _inherits(PathLocationStrategy, _LocationStrategy2); var _super2 = _createSuper(PathLocationStrategy); /** * @param {?} _platformLocation * @param {?=} href */ function PathLocationStrategy(_platformLocation, href) { var _this4; _classCallCheck(this, PathLocationStrategy); _this4 = _super2.call(this); _this4._platformLocation = _platformLocation; if (href == null) { href = _this4._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."); } _this4._baseHref = href; return _this4; } /** * @param {?} fn * @return {?} */ _createClass2(PathLocationStrategy, [{ key: "onPopState", value: function onPopState(fn) { this._platformLocation.onPopState(fn); this._platformLocation.onHashChange(fn); } /** * @return {?} */ }, { key: "getBaseHref", value: function getBaseHref() { return this._baseHref; } /** * @param {?} internal * @return {?} */ }, { key: "prepareExternalUrl", value: function prepareExternalUrl(internal) { return Location.joinWithSlash(this._baseHref, internal); } /** * @param {?=} includeHash * @return {?} */ }, { key: "path", value: function path() { var includeHash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; /** @type {?} */ var pathname = this._platformLocation.pathname + Location.normalizeQueryParams(this._platformLocation.search); /** @type {?} */ var hash = this._platformLocation.hash; return hash && includeHash ? "".concat(pathname).concat(hash) : pathname; } /** * @param {?} state * @param {?} title * @param {?} url * @param {?} queryParams * @return {?} */ }, { key: "pushState", value: function pushState(state, title, url, queryParams) { /** @type {?} */ var externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams)); this._platformLocation.pushState(state, title, externalUrl); } /** * @param {?} state * @param {?} title * @param {?} url * @param {?} queryParams * @return {?} */ }, { key: "replaceState", value: function replaceState(state, title, url, queryParams) { /** @type {?} */ var externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams)); this._platformLocation.replaceState(state, title, externalUrl); } /** * @return {?} */ }, { key: "forward", value: function forward() { this._platformLocation.forward(); } /** * @return {?} */ }, { key: "back", value: function back() { this._platformLocation.back(); } }]); return PathLocationStrategy; }(LocationStrategy); PathLocationStrategy.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; /** @nocollapse */ PathLocationStrategy.ctorParameters = function () { return [{ type: PlatformLocation }, { type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [APP_BASE_HREF] }] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js /** * \@internal * @type {?} */ var CURRENCIES_EN = { 'ADP': [undefined, undefined, 0], 'AFN': [undefined, undefined, 0], 'ALL': [undefined, undefined, 0], 'AMD': [undefined, undefined, 0], 'AOA': [undefined, 'Kz'], 'ARS': [undefined, '$'], 'AUD': ['A$', '$'], 'BAM': [undefined, 'KM'], 'BBD': [undefined, '$'], 'BDT': [undefined, '৳'], 'BHD': [undefined, undefined, 3], 'BIF': [undefined, undefined, 0], 'BMD': [undefined, '$'], 'BND': [undefined, '$'], 'BOB': [undefined, 'Bs'], 'BRL': ['R$'], 'BSD': [undefined, '$'], 'BWP': [undefined, 'P'], 'BYN': [undefined, 'р.', 2], 'BYR': [undefined, undefined, 0], 'BZD': [undefined, '$'], 'CAD': ['CA$', '$', 2], 'CHF': [undefined, undefined, 2], 'CLF': [undefined, undefined, 4], 'CLP': [undefined, '$', 0], 'CNY': ['CN¥', '¥'], 'COP': [undefined, '$', 0], 'CRC': [undefined, '₡', 2], 'CUC': [undefined, '$'], 'CUP': [undefined, '$'], 'CZK': [undefined, 'Kč', 2], 'DJF': [undefined, undefined, 0], 'DKK': [undefined, 'kr', 2], 'DOP': [undefined, '$'], 'EGP': [undefined, 'E£'], 'ESP': [undefined, '₧', 0], 'EUR': ['€'], 'FJD': [undefined, '$'], 'FKP': [undefined, '£'], 'GBP': ['£'], 'GEL': [undefined, '₾'], 'GIP': [undefined, '£'], 'GNF': [undefined, 'FG', 0], 'GTQ': [undefined, 'Q'], 'GYD': [undefined, '$', 0], 'HKD': ['HK$', '$'], 'HNL': [undefined, 'L'], 'HRK': [undefined, 'kn'], 'HUF': [undefined, 'Ft', 2], 'IDR': [undefined, 'Rp', 0], 'ILS': ['₪'], 'INR': ['₹'], 'IQD': [undefined, undefined, 0], 'IRR': [undefined, undefined, 0], 'ISK': [undefined, 'kr', 0], 'ITL': [undefined, undefined, 0], 'JMD': [undefined, '$'], 'JOD': [undefined, undefined, 3], 'JPY': ['¥', undefined, 0], 'KHR': [undefined, '៛'], 'KMF': [undefined, 'CF', 0], 'KPW': [undefined, '₩', 0], 'KRW': ['₩', undefined, 0], 'KWD': [undefined, undefined, 3], 'KYD': [undefined, '$'], 'KZT': [undefined, '₸'], 'LAK': [undefined, '₭', 0], 'LBP': [undefined, 'L£', 0], 'LKR': [undefined, 'Rs'], 'LRD': [undefined, '$'], 'LTL': [undefined, 'Lt'], 'LUF': [undefined, undefined, 0], 'LVL': [undefined, 'Ls'], 'LYD': [undefined, undefined, 3], 'MGA': [undefined, 'Ar', 0], 'MGF': [undefined, undefined, 0], 'MMK': [undefined, 'K', 0], 'MNT': [undefined, '₮', 0], 'MRO': [undefined, undefined, 0], 'MUR': [undefined, 'Rs', 0], 'MXN': ['MX$', '$'], 'MYR': [undefined, 'RM'], 'NAD': [undefined, '$'], 'NGN': [undefined, '₦'], 'NIO': [undefined, 'C$'], 'NOK': [undefined, 'kr', 2], 'NPR': [undefined, 'Rs'], 'NZD': ['NZ$', '$'], 'OMR': [undefined, undefined, 3], 'PHP': [undefined, '₱'], 'PKR': [undefined, 'Rs', 0], 'PLN': [undefined, 'zł'], 'PYG': [undefined, '₲', 0], 'RON': [undefined, 'lei'], 'RSD': [undefined, undefined, 0], 'RUB': [undefined, '₽'], 'RUR': [undefined, 'р.'], 'RWF': [undefined, 'RF', 0], 'SBD': [undefined, '$'], 'SEK': [undefined, 'kr', 2], 'SGD': [undefined, '$'], 'SHP': [undefined, '£'], 'SLL': [undefined, undefined, 0], 'SOS': [undefined, undefined, 0], 'SRD': [undefined, '$'], 'SSP': [undefined, '£'], 'STD': [undefined, undefined, 0], 'STN': [undefined, 'Db'], 'SYP': [undefined, '£', 0], 'THB': [undefined, '฿'], 'TMM': [undefined, undefined, 0], 'TND': [undefined, undefined, 3], 'TOP': [undefined, 'T$'], 'TRL': [undefined, undefined, 0], 'TRY': [undefined, '₺'], 'TTD': [undefined, '$'], 'TWD': ['NT$', '$', 2], 'TZS': [undefined, undefined, 0], 'UAH': [undefined, '₴'], 'UGX': [undefined, undefined, 0], 'USD': ['$'], 'UYI': [undefined, undefined, 0], 'UYU': [undefined, '$'], 'UZS': [undefined, undefined, 0], 'VEF': [undefined, 'Bs'], 'VND': ['₫', undefined, 0], 'VUV': [undefined, undefined, 0], 'XAF': ['FCFA', undefined, 0], 'XCD': ['EC$', '$'], 'XOF': ['CFA', undefined, 0], 'XPF': ['CFPF', undefined, 0], 'YER': [undefined, undefined, 0], 'ZAR': [undefined, 'R'], 'ZMK': [undefined, undefined, 0], 'ZMW': [undefined, 'ZK'], 'ZWD': [undefined, undefined, 0] }; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @enum {number} */ var NumberFormatStyle = { Decimal: 0, Percent: 1, Currency: 2, Scientific: 3 }; NumberFormatStyle[NumberFormatStyle.Decimal] = 'Decimal'; NumberFormatStyle[NumberFormatStyle.Percent] = 'Percent'; NumberFormatStyle[NumberFormatStyle.Currency] = 'Currency'; NumberFormatStyle[NumberFormatStyle.Scientific] = 'Scientific'; /** @enum {number} */ var Plural = { Zero: 0, One: 1, Two: 2, Few: 3, Many: 4, 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'; /** @enum {number} */ var FormStyle = { Format: 0, Standalone: 1 }; FormStyle[FormStyle.Format] = 'Format'; FormStyle[FormStyle.Standalone] = 'Standalone'; /** @enum {number} */ var TranslationWidth = { /** 1 character for `en-US`. For example: 'S' */ Narrow: 0, /** 3 characters for `en-US`. For example: 'Sun' */ Abbreviated: 1, /** Full length for `en-US`. For example: "Sunday" */ Wide: 2, /** 2 characters for `en-US`, For example: "Su" */ Short: 3 }; TranslationWidth[TranslationWidth.Narrow] = 'Narrow'; TranslationWidth[TranslationWidth.Abbreviated] = 'Abbreviated'; TranslationWidth[TranslationWidth.Wide] = 'Wide'; TranslationWidth[TranslationWidth.Short] = 'Short'; /** @enum {number} */ var FormatWidth = { /** * For `en-US`, 'M/d/yy, h:mm a'` * (Example: `6/15/15, 9:03 AM`) */ Short: 0, /** * For `en-US`, `'MMM d, y, h:mm:ss a'` * (Example: `Jun 15, 2015, 9:03:01 AM`) */ Medium: 1, /** * For `en-US`, `'MMMM d, y, h:mm:ss a z'` * (Example: `June 15, 2015 at 9:03:01 AM GMT+1`) */ Long: 2, /** * For `en-US`, `'EEEE, MMMM d, y, h:mm:ss a zzzz'` * (Example: `Monday, June 15, 2015 at 9:03:01 AM GMT+01:00`) */ Full: 3 }; FormatWidth[FormatWidth.Short] = 'Short'; FormatWidth[FormatWidth.Medium] = 'Medium'; FormatWidth[FormatWidth.Long] = 'Long'; FormatWidth[FormatWidth.Full] = 'Full'; /** @enum {number} */ var NumberSymbol = { /** * Decimal separator. * For `en-US`, the dot character. * Example : 2,345`.`67 */ Decimal: 0, /** * Grouping separator, typically for thousands. * For `en-US`, the comma character. * Example: 2`,`345.67 */ Group: 1, /** * List-item separator. * Example: "one, two, and three" */ List: 2, /** * Sign for percentage (out of 100). * Example: 23.4% */ PercentSign: 3, /** * Sign for positive numbers. * Example: +23 */ PlusSign: 4, /** * Sign for negative numbers. * Example: -23 */ MinusSign: 5, /** * Computer notation for exponential value (n times a power of 10). * Example: 1.2E3 */ Exponential: 6, /** * Human-readable format of exponential. * Example: 1.2x103 */ SuperscriptingExponent: 7, /** * Sign for permille (out of 1000). * Example: 23.4‰ */ PerMille: 8, /** * Infinity, can be used with plus and minus. * Example: ∞, +∞, -∞ */ Infinity: 9, /** * Not a number. * Example: NaN */ NaN: 10, /** * Symbol used between time units. * Example: 10:52 */ TimeSeparator: 11, /** * Decimal separator for currency values (fallback to `Decimal`). * Example: $2,345.67 */ CurrencyDecimal: 12, /** * Group separator for currency values (fallback to `Group`). * Example: $2,345.67 */ CurrencyGroup: 13 }; NumberSymbol[NumberSymbol.Decimal] = 'Decimal'; NumberSymbol[NumberSymbol.Group] = 'Group'; NumberSymbol[NumberSymbol.List] = 'List'; NumberSymbol[NumberSymbol.PercentSign] = 'PercentSign'; NumberSymbol[NumberSymbol.PlusSign] = 'PlusSign'; NumberSymbol[NumberSymbol.MinusSign] = 'MinusSign'; NumberSymbol[NumberSymbol.Exponential] = 'Exponential'; NumberSymbol[NumberSymbol.SuperscriptingExponent] = 'SuperscriptingExponent'; NumberSymbol[NumberSymbol.PerMille] = 'PerMille'; NumberSymbol[NumberSymbol.Infinity] = 'Infinity'; NumberSymbol[NumberSymbol.NaN] = 'NaN'; NumberSymbol[NumberSymbol.TimeSeparator] = 'TimeSeparator'; NumberSymbol[NumberSymbol.CurrencyDecimal] = 'CurrencyDecimal'; NumberSymbol[NumberSymbol.CurrencyGroup] = 'CurrencyGroup'; /** @enum {number} */ var WeekDay = { Sunday: 0, Monday: 1, Tuesday: 2, Wednesday: 3, Thursday: 4, Friday: 5, Saturday: 6 }; WeekDay[WeekDay.Sunday] = 'Sunday'; WeekDay[WeekDay.Monday] = 'Monday'; WeekDay[WeekDay.Tuesday] = 'Tuesday'; WeekDay[WeekDay.Wednesday] = 'Wednesday'; WeekDay[WeekDay.Thursday] = 'Thursday'; WeekDay[WeekDay.Friday] = 'Friday'; WeekDay[WeekDay.Saturday] = 'Saturday'; /** * Retrieves the locale ID from the currently loaded locale. * The loaded locale could be, for example, a global one rather than a regional one. * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} locale A locale code, such as `fr-FR`. * @return {?} The locale code. For example, `fr`. */ function getLocaleId(locale) { return Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale)[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].LocaleId]; } /** * Retrieves day period strings for the given locale. * * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} locale A locale code for the locale format rules to use. * @param {?} formStyle The required grammatical form. * @param {?} width The required character width. * @return {?} An array of localized period strings. For example, `[AM, PM]` for `en-US`. */ function getLocaleDayPeriods(locale, formStyle, width) { /** @type {?} */ var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); /** @type {?} */ var amPmData = /** @type {?} */ [data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].DayPeriodsFormat], data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].DayPeriodsStandalone]]; /** @type {?} */ var amPm = getLastDefinedValue(amPmData, formStyle); return getLastDefinedValue(amPm, width); } /** * Retrieves days of the week for the given locale, using the Gregorian calendar. * * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} locale A locale code for the locale format rules to use. * @param {?} formStyle The required grammatical form. * @param {?} width The required character width. * @return {?} An array of localized name strings. * For example,`[Sunday, Monday, ... Saturday]` for `en-US`. */ function getLocaleDayNames(locale, formStyle, width) { /** @type {?} */ var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); /** @type {?} */ var daysData = /** @type {?} */ [data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].DaysFormat], data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].DaysStandalone]]; /** @type {?} */ var days = getLastDefinedValue(daysData, formStyle); return getLastDefinedValue(days, width); } /** * Retrieves months of the year for the given locale, using the Gregorian calendar. * * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} locale A locale code for the locale format rules to use. * @param {?} formStyle The required grammatical form. * @param {?} width The required character width. * @return {?} An array of localized name strings. * For example, `[January, February, ...]` for `en-US`. */ function getLocaleMonthNames(locale, formStyle, width) { /** @type {?} */ var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); /** @type {?} */ var monthsData = /** @type {?} */ [data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].MonthsFormat], data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].MonthsStandalone]]; /** @type {?} */ var months = getLastDefinedValue(monthsData, formStyle); return getLastDefinedValue(months, width); } /** * Retrieves Gregorian-calendar eras for the given locale. * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} locale A locale code for the locale format rules to use. * @param {?} width The required character width. * @return {?} An array of localized era strings. * For example, `[AD, BC]` for `en-US`. */ function getLocaleEraNames(locale, width) { /** @type {?} */ var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); /** @type {?} */ var erasData = /** @type {?} */ data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].Eras]; return getLastDefinedValue(erasData, width); } /** * Retrieves the first day of the week for the given locale. * * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} locale A locale code for the locale format rules to use. * @return {?} A day index number, using the 0-based week-day index for `en-US` * (Sunday = 0, Monday = 1, ...). * For example, for `fr-FR`, returns 1 to indicate that the first day is Monday. */ function getLocaleFirstDayOfWeek(locale) { /** @type {?} */ var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].FirstDayOfWeek]; } /** * Range of week days that are considered the week-end for the given locale. * * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} locale A locale code for the locale format rules to use. * @return {?} The range of day values, `[startDay, endDay]`. */ function getLocaleWeekEndRange(locale) { /** @type {?} */ var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].WeekendRange]; } /** * Retrieves a localized date-value formating string. * * @see `FormatWidth` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} locale A locale code for the locale format rules to use. * @param {?} width The format type. * @return {?} The localized formating string. */ function getLocaleDateFormat(locale, width) { /** @type {?} */ var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); return getLastDefinedValue(data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].DateFormat], width); } /** * Retrieves a localized time-value formatting string. * * @see `FormatWidth` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * \@publicApi * @param {?} locale A locale code for the locale format rules to use. * @param {?} width The format type. * @return {?} The localized formatting string. */ function getLocaleTimeFormat(locale, width) { /** @type {?} */ var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); return getLastDefinedValue(data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].TimeFormat], width); } /** * Retrieves a localized date-time formatting string. * * @see `FormatWidth` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} locale A locale code for the locale format rules to use. * @param {?} width The format type. * @return {?} The localized formatting string. */ function getLocaleDateTimeFormat(locale, width) { /** @type {?} */ var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); /** @type {?} */ var dateTimeFormatData = /** @type {?} */ data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].DateTimeFormat]; return getLastDefinedValue(dateTimeFormatData, width); } /** * Retrieves a localized number symbol that can be used to replace placeholders in number formats. * @see `NumberSymbol` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} locale The locale code. * @param {?} symbol The symbol to localize. * @return {?} The character for the localized symbol. */ function getLocaleNumberSymbol(locale, symbol) { /** @type {?} */ var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); /** @type {?} */ var res = data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].NumberSymbols][symbol]; if (typeof res === 'undefined') { if (symbol === NumberSymbol.CurrencyDecimal) { return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].NumberSymbols][NumberSymbol.Decimal]; } else if (symbol === NumberSymbol.CurrencyGroup) { return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].NumberSymbols][NumberSymbol.Group]; } } return res; } /** * Retrieves a number format for a given locale. * * Numbers are formatted using patterns, like `#,###.00`. For example, the pattern `#,###.00` * when used to format the number 12345.678 could result in "12'345,678". That would happen if the * grouping separator for your language is an apostrophe, and the decimal separator is a comma. * * <b>Important:</b> The characters `.` `,` `0` `#` (and others below) are special placeholders * that stand for the decimal separator, and so on, and are NOT real characters. * You must NOT "translate" the placeholders. For example, don't change `.` to `,` even though in * your language the decimal point is written with a comma. The symbols should be replaced by the * local equivalents, using the appropriate `NumberSymbol` for your language. * * Here are the special characters used in number patterns: * * | Symbol | Meaning | * |--------|---------| * | . | Replaced automatically by the character used for the decimal point. | * | , | Replaced by the "grouping" (thousands) separator. | * | 0 | Replaced by a digit (or zero if there aren't enough digits). | * | # | Replaced by a digit (or nothing if there aren't enough). | * | ¤ | Replaced by a currency symbol, such as $ or USD. | * | % | Marks a percent format. The % symbol may change position, but must be retained. | * | E | Marks a scientific format. The E symbol may change position, but must be retained. | * | ' | Special characters used as literal characters are quoted with ASCII single quotes. | * * @see `NumberFormatStyle` / [CLDR website](http://cldr.unicode.org/translation/number-patterns) / [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} locale A locale code for the locale format rules to use. * @param {?} type The type of numeric value to be formatted (such as `Decimal` or `Currency`.) * @return {?} The localized format string. */ function getLocaleNumberFormat(locale, type) { /** @type {?} */ var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].NumberFormats][type]; } /** * Retrieves the symbol used to represent the currency for the main country * corresponding to a given locale. For example, '$' for `en-US`. * * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} locale A locale code for the locale format rules to use. * @return {?} The localized symbol character, * or `null` if the main country cannot be determined. */ function getLocaleCurrencySymbol(locale) { /** @type {?} */ var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].CurrencySymbol] || null; } /** * Retrieves the name of the currency for the main country corresponding * to a given locale. For example, 'US Dollar' for `en-US`. * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} locale A locale code for the locale format rules to use. * @return {?} The currency name, * or `null` if the main country cannot be determined. */ function getLocaleCurrencyName(locale) { /** @type {?} */ var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].CurrencyName] || null; } /** * Retrieves the currency values for a given locale. * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * @param {?} locale A locale code for the locale format rules to use. * @return {?} The currency values. */ function getLocaleCurrencies(locale) { /** @type {?} */ var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); return data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].Currencies]; } /** * \@alias core/ɵgetLocalePluralCase * \@publicApi * @type {?} */ var getLocalePluralCase = _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵgetLocalePluralCase"]; /** * @param {?} data * @return {?} */ function checkFullData(data) { if (!data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].ExtraData]) { throw new Error("Missing extra locale data for the locale \"".concat(data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].LocaleId], "\". Use \"registerLocaleData\" to load new data. See the \"I18n guide\" on angular.io to know more.")); } } /** * Retrieves locale-specific rules used to determine which day period to use * when more than one period is defined for a locale. * * There is a rule for each defined day period. The * first rule is applied to the first day period and so on. * Fall back to AM/PM when no rules are available. * * A rule can specify a period as time range, or as a single time value. * * This functionality is only available when you have loaded the full locale data. * See the ["I18n guide"](guide/i18n#i18n-pipes). * * @see `getLocaleExtraDayPeriods()` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} locale A locale code for the locale format rules to use. * @return {?} The rules for the locale, a single time value or array of *from-time, to-time*, * or null if no periods are available. * */ function getLocaleExtraDayPeriodRules(locale) { /** @type {?} */ var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); checkFullData(data); /** @type {?} */ var rules = data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].ExtraData][2 /* ExtraDayPeriodsRules */ ] || []; return rules.map( /** * @param {?} rule * @return {?} */ function (rule) { if (typeof rule === 'string') { return extractTime(rule); } return [extractTime(rule[0]), extractTime(rule[1])]; }); } /** * Retrieves locale-specific day periods, which indicate roughly how a day is broken up * in different languages. * For example, for `en-US`, periods are morning, noon, afternoon, evening, and midnight. * * This functionality is only available when you have loaded the full locale data. * See the ["I18n guide"](guide/i18n#i18n-pipes). * * @see `getLocaleExtraDayPeriodRules()` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} locale A locale code for the locale format rules to use. * @param {?} formStyle The required grammatical form. * @param {?} width The required character width. * @return {?} The translated day-period strings. */ function getLocaleExtraDayPeriods(locale, formStyle, width) { /** @type {?} */ var data = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵfindLocaleData"])(locale); checkFullData(data); /** @type {?} */ var dayPeriodsData = /** @type {?} */ [data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].ExtraData][0 /* ExtraDayPeriodFormats */ ], data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].ExtraData][1 /* ExtraDayPeriodStandalone */ ]]; /** @type {?} */ var dayPeriods = getLastDefinedValue(dayPeriodsData, formStyle) || []; return getLastDefinedValue(dayPeriods, width) || []; } /** * Retrieves the first value that is defined in an array, going backwards from an index position. * * To avoid repeating the same data (as when the "format" and "standalone" forms are the same) * add the first value to the locale data arrays, and add other values only if they are different. * * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @template T * @param {?} data The data array to retrieve from. * @param {?} index A 0-based index into the array to start from. * @return {?} The value immediately before the given index position. */ function getLastDefinedValue(data, index) { for (var i = index; i > -1; i--) { if (typeof data[i] !== 'undefined') { return data[i]; } } throw new Error('Locale data API: locale data undefined'); } /** * Extracts the hours and minutes from a string like "15:45" * @param {?} time * @return {?} */ function extractTime(time) { var _time$split = time.split(':'), _time$split2 = _slicedToArray(_time$split, 2), h = _time$split2[0], m = _time$split2[1]; return { hours: +h, minutes: +m }; } /** * Retrieves the currency symbol for a given currency code. * * For example, for the default `en-US` locale, the code `USD` can * be represented by the narrow symbol `$` or the wide symbol `US$`. * * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} code The currency code. * @param {?} format The format, `wide` or `narrow`. * @param {?=} locale A locale code for the locale format rules to use. * * @return {?} The symbol, or the currency code if no symbol is available.0 */ function getCurrencySymbol(code, format) { var locale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'en'; /** @type {?} */ var currency = getLocaleCurrencies(locale)[code] || CURRENCIES_EN[code] || []; /** @type {?} */ var symbolNarrow = currency[1 /* SymbolNarrow */ ]; if (format === 'narrow' && typeof symbolNarrow === 'string') { return symbolNarrow; } return currency[0 /* Symbol */ ] || code; } // Most currencies have cents, that's why the default is 2 /** @type {?} */ var DEFAULT_NB_OF_CURRENCY_DIGITS = 2; /** * Reports the number of decimal digits for a given currency. * The value depends upon the presence of cents in that particular currency. * * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} code The currency code. * @return {?} The number of decimal digits, typically 0 or 2. */ function getNumberOfCurrencyDigits(code) { /** @type {?} */ var digits; /** @type {?} */ var currency = CURRENCIES_EN[code]; if (currency) { digits = currency[2 /* NbOfDigits */ ]; } return typeof digits === 'number' ? digits : DEFAULT_NB_OF_CURRENCY_DIGITS; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var ISO8601_DATE_REGEX = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; // 1 2 3 4 5 6 7 8 9 10 11 /** @type {?} */ var NAMED_FORMATS = {}; /** @type {?} */ var DATE_FORMATS_SPLIT = /((?:[^GyMLwWdEabBhHmsSzZO']+)|(?:'(?:[^']|'')*')|(?:G{1,5}|y{1,4}|M{1,5}|L{1,5}|w{1,2}|W{1}|d{1,2}|E{1,6}|a{1,5}|b{1,5}|B{1,5}|h{1,2}|H{1,2}|m{1,2}|s{1,2}|S{1,3}|z{1,4}|Z{1,5}|O{1,4}))([\s\S]*)/; /** @enum {number} */ var ZoneWidth = { Short: 0, ShortGMT: 1, Long: 2, Extended: 3 }; ZoneWidth[ZoneWidth.Short] = 'Short'; ZoneWidth[ZoneWidth.ShortGMT] = 'ShortGMT'; ZoneWidth[ZoneWidth.Long] = 'Long'; ZoneWidth[ZoneWidth.Extended] = 'Extended'; /** @enum {number} */ var DateType = { FullYear: 0, Month: 1, Date: 2, Hours: 3, Minutes: 4, Seconds: 5, FractionalSeconds: 6, Day: 7 }; DateType[DateType.FullYear] = 'FullYear'; DateType[DateType.Month] = 'Month'; DateType[DateType.Date] = 'Date'; DateType[DateType.Hours] = 'Hours'; DateType[DateType.Minutes] = 'Minutes'; DateType[DateType.Seconds] = 'Seconds'; DateType[DateType.FractionalSeconds] = 'FractionalSeconds'; DateType[DateType.Day] = 'Day'; /** @enum {number} */ var TranslationType = { DayPeriods: 0, Days: 1, Months: 2, Eras: 3 }; TranslationType[TranslationType.DayPeriods] = 'DayPeriods'; TranslationType[TranslationType.Days] = 'Days'; TranslationType[TranslationType.Months] = 'Months'; TranslationType[TranslationType.Eras] = 'Eras'; /** * \@ngModule CommonModule * \@description * * Formats a date according to locale rules. * * @see `DatePipe` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} value The date to format, as a Date, or a number (milliseconds since UTC epoch) * or an [ISO date-time string](https://www.w3.org/TR/NOTE-datetime). * @param {?} format The date-time components to include. See `DatePipe` for details. * @param {?} locale A locale code for the locale format rules to use. * @param {?=} timezone The time zone. A time zone offset from GMT (such as `'+0430'`), * or a standard UTC/GMT or continental US time zone abbreviation. * If not specified, uses host system settings. * * @return {?} The formatted date string. * */ function formatDate(value, format, locale, timezone) { /** @type {?} */ var date = toDate(value); /** @type {?} */ var namedFormat = getNamedFormat(locale, format); format = namedFormat || format; /** @type {?} */ var parts = []; /** @type {?} */ var match; while (format) { match = DATE_FORMATS_SPLIT.exec(format); if (match) { parts = parts.concat(match.slice(1)); /** @type {?} */ var part = parts.pop(); if (!part) { break; } format = part; } else { parts.push(format); break; } } /** @type {?} */ var dateTimezoneOffset = date.getTimezoneOffset(); if (timezone) { dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset); date = convertTimezoneToLocal(date, timezone, true); } /** @type {?} */ var text = ''; parts.forEach( /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var dateFormatter = getDateFormatter(value); text += dateFormatter ? dateFormatter(date, locale, dateTimezoneOffset) : value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\''); }); return text; } /** * @param {?} locale * @param {?} format * @return {?} */ function getNamedFormat(locale, format) { /** @type {?} */ var localeId = getLocaleId(locale); NAMED_FORMATS[localeId] = NAMED_FORMATS[localeId] || {}; if (NAMED_FORMATS[localeId][format]) { return NAMED_FORMATS[localeId][format]; } /** @type {?} */ var formatValue = ''; switch (format) { case 'shortDate': formatValue = getLocaleDateFormat(locale, FormatWidth.Short); break; case 'mediumDate': formatValue = getLocaleDateFormat(locale, FormatWidth.Medium); break; case 'longDate': formatValue = getLocaleDateFormat(locale, FormatWidth.Long); break; case 'fullDate': formatValue = getLocaleDateFormat(locale, FormatWidth.Full); break; case 'shortTime': formatValue = getLocaleTimeFormat(locale, FormatWidth.Short); break; case 'mediumTime': formatValue = getLocaleTimeFormat(locale, FormatWidth.Medium); break; case 'longTime': formatValue = getLocaleTimeFormat(locale, FormatWidth.Long); break; case 'fullTime': formatValue = getLocaleTimeFormat(locale, FormatWidth.Full); break; case 'short': /** @type {?} */ var shortTime = getNamedFormat(locale, 'shortTime'); /** @type {?} */ var shortDate = getNamedFormat(locale, 'shortDate'); formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Short), [shortTime, shortDate]); break; case 'medium': /** @type {?} */ var mediumTime = getNamedFormat(locale, 'mediumTime'); /** @type {?} */ var mediumDate = getNamedFormat(locale, 'mediumDate'); formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Medium), [mediumTime, mediumDate]); break; case 'long': /** @type {?} */ var longTime = getNamedFormat(locale, 'longTime'); /** @type {?} */ var longDate = getNamedFormat(locale, 'longDate'); formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Long), [longTime, longDate]); break; case 'full': /** @type {?} */ var fullTime = getNamedFormat(locale, 'fullTime'); /** @type {?} */ var fullDate = getNamedFormat(locale, 'fullDate'); formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Full), [fullTime, fullDate]); break; } if (formatValue) { NAMED_FORMATS[localeId][format] = formatValue; } return formatValue; } /** * @param {?} str * @param {?} opt_values * @return {?} */ function formatDateTime(str, opt_values) { if (opt_values) { str = str.replace(/\{([^}]+)}/g, /** * @param {?} match * @param {?} key * @return {?} */ function (match, key) { return opt_values != null && key in opt_values ? opt_values[key] : match; }); } return str; } /** * @param {?} num * @param {?} digits * @param {?=} minusSign * @param {?=} trim * @param {?=} negWrap * @return {?} */ function padNumber(num, digits) { var minusSign = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '-'; var trim = arguments.length > 3 ? arguments[3] : undefined; var negWrap = arguments.length > 4 ? arguments[4] : undefined; /** @type {?} */ var neg = ''; if (num < 0 || negWrap && num <= 0) { if (negWrap) { num = -num + 1; } else { num = -num; neg = minusSign; } } /** @type {?} */ var strNum = String(num); while (strNum.length < digits) { strNum = '0' + strNum; } if (trim) { strNum = strNum.substr(strNum.length - digits); } return neg + strNum; } /** * @param {?} milliseconds * @param {?} digits * @return {?} */ function formatFractionalSeconds(milliseconds, digits) { /** @type {?} */ var strMs = padNumber(milliseconds, 3); return strMs.substr(0, digits); } /** * Returns a date formatter that transforms a date into its locale digit representation * @param {?} name * @param {?} size * @param {?=} offset * @param {?=} trim * @param {?=} negWrap * @return {?} */ function dateGetter(name, size) { var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; var trim = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; var negWrap = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; return ( /** * @param {?} date * @param {?} locale * @return {?} */ function (date, locale) { /** @type {?} */ var part = getDatePart(name, date); if (offset > 0 || part > -offset) { part += offset; } if (name === DateType.Hours) { if (part === 0 && offset === -12) { part = 12; } } else if (name === DateType.FractionalSeconds) { return formatFractionalSeconds(part, size); } /** @type {?} */ var localeMinus = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign); return padNumber(part, size, localeMinus, trim, negWrap); } ); } /** * @param {?} part * @param {?} date * @return {?} */ function getDatePart(part, date) { switch (part) { case DateType.FullYear: return date.getFullYear(); case DateType.Month: return date.getMonth(); case DateType.Date: return date.getDate(); case DateType.Hours: return date.getHours(); case DateType.Minutes: return date.getMinutes(); case DateType.Seconds: return date.getSeconds(); case DateType.FractionalSeconds: return date.getMilliseconds(); case DateType.Day: return date.getDay(); default: throw new Error("Unknown DateType value \"".concat(part, "\".")); } } /** * Returns a date formatter that transforms a date into its locale string representation * @param {?} name * @param {?} width * @param {?=} form * @param {?=} extended * @return {?} */ function dateStrGetter(name, width) { var form = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : FormStyle.Format; var extended = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; return ( /** * @param {?} date * @param {?} locale * @return {?} */ function (date, locale) { return getDateTranslation(date, locale, name, width, form, extended); } ); } /** * Returns the locale translation of a date for a given form, type and width * @param {?} date * @param {?} locale * @param {?} name * @param {?} width * @param {?} form * @param {?} extended * @return {?} */ function getDateTranslation(date, locale, name, width, form, extended) { switch (name) { case TranslationType.Months: return getLocaleMonthNames(locale, form, width)[date.getMonth()]; case TranslationType.Days: return getLocaleDayNames(locale, form, width)[date.getDay()]; case TranslationType.DayPeriods: /** @type {?} */ var currentHours = date.getHours(); /** @type {?} */ var currentMinutes = date.getMinutes(); if (extended) { /** @type {?} */ var rules = getLocaleExtraDayPeriodRules(locale); /** @type {?} */ var dayPeriods = getLocaleExtraDayPeriods(locale, form, width); /** @type {?} */ var result; rules.forEach( /** * @param {?} rule * @param {?} index * @return {?} */ function (rule, index) { if (Array.isArray(rule)) { // morning, afternoon, evening, night var _rule$ = rule[0], hoursFrom = _rule$.hours, minutesFrom = _rule$.minutes; var _rule$2 = rule[1], hoursTo = _rule$2.hours, minutesTo = _rule$2.minutes; if (currentHours >= hoursFrom && currentMinutes >= minutesFrom && (currentHours < hoursTo || currentHours === hoursTo && currentMinutes < minutesTo)) { result = dayPeriods[index]; } } else { // noon or midnight // noon or midnight var hours = rule.hours, minutes = rule.minutes; if (hours === currentHours && minutes === currentMinutes) { result = dayPeriods[index]; } } }); if (result) { return result; } } // if no rules for the day periods, we use am/pm by default return getLocaleDayPeriods(locale, form, /** @type {?} */ width)[currentHours < 12 ? 0 : 1]; case TranslationType.Eras: return getLocaleEraNames(locale, /** @type {?} */ width)[date.getFullYear() <= 0 ? 0 : 1]; default: // This default case is not needed by TypeScript compiler, as the switch is exhaustive. // However Closure Compiler does not understand that and reports an error in typed mode. // The `throw new Error` below works around the problem, and the unexpected: never variable // makes sure tsc still checks this code is unreachable. /** @type {?} */ var unexpected = name; throw new Error("unexpected translation type ".concat(unexpected)); } } /** * Returns a date formatter that transforms a date and an offset into a timezone with ISO8601 or * GMT format depending on the width (eg: short = +0430, short:GMT = GMT+4, long = GMT+04:30, * extended = +04:30) * @param {?} width * @return {?} */ function timeZoneGetter(width) { return ( /** * @param {?} date * @param {?} locale * @param {?} offset * @return {?} */ function (date, locale, offset) { /** @type {?} */ var zone = -1 * offset; /** @type {?} */ var minusSign = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign); /** @type {?} */ var hours = zone > 0 ? Math.floor(zone / 60) : Math.ceil(zone / 60); switch (width) { case ZoneWidth.Short: return (zone >= 0 ? '+' : '') + padNumber(hours, 2, minusSign) + padNumber(Math.abs(zone % 60), 2, minusSign); case ZoneWidth.ShortGMT: return 'GMT' + (zone >= 0 ? '+' : '') + padNumber(hours, 1, minusSign); case ZoneWidth.Long: return 'GMT' + (zone >= 0 ? '+' : '') + padNumber(hours, 2, minusSign) + ':' + padNumber(Math.abs(zone % 60), 2, minusSign); case ZoneWidth.Extended: if (offset === 0) { return 'Z'; } else { return (zone >= 0 ? '+' : '') + padNumber(hours, 2, minusSign) + ':' + padNumber(Math.abs(zone % 60), 2, minusSign); } default: throw new Error("Unknown zone width \"".concat(width, "\"")); } } ); } /** @type {?} */ var JANUARY = 0; /** @type {?} */ var THURSDAY = 4; /** * @param {?} year * @return {?} */ function getFirstThursdayOfYear(year) { /** @type {?} */ var firstDayOfYear = new Date(year, JANUARY, 1).getDay(); return new Date(year, 0, 1 + (firstDayOfYear <= THURSDAY ? THURSDAY : THURSDAY + 7) - firstDayOfYear); } /** * @param {?} datetime * @return {?} */ function getThursdayThisWeek(datetime) { return new Date(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + (THURSDAY - datetime.getDay())); } /** * @param {?} size * @param {?=} monthBased * @return {?} */ function weekGetter(size) { var monthBased = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; return ( /** * @param {?} date * @param {?} locale * @return {?} */ function (date, locale) { /** @type {?} */ var result; if (monthBased) { /** @type {?} */ var nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1; /** @type {?} */ var today = date.getDate(); result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7); } else { /** @type {?} */ var firstThurs = getFirstThursdayOfYear(date.getFullYear()); /** @type {?} */ var thisThurs = getThursdayThisWeek(date); /** @type {?} */ var diff = thisThurs.getTime() - firstThurs.getTime(); result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week } return padNumber(result, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign)); } ); } /** @type {?} */ var DATE_FORMATS = {}; // Based on CLDR formats: // See complete list: http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table // See also explanations: http://cldr.unicode.org/translation/date-time // TODO(ocombe): support all missing cldr formats: Y, U, Q, D, F, e, c, j, J, C, A, v, V, X, x /** * @param {?} format * @return {?} */ function getDateFormatter(format) { if (DATE_FORMATS[format]) { return DATE_FORMATS[format]; } /** @type {?} */ var formatter; switch (format) { // Era name (AD/BC) case 'G': case 'GG': case 'GGG': formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Abbreviated); break; case 'GGGG': formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Wide); break; case 'GGGGG': formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Narrow); break; // 1 digit representation of the year, e.g. (AD 1 => 1, AD 199 => 199) case 'y': formatter = dateGetter(DateType.FullYear, 1, 0, false, true); break; // 2 digit representation of the year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10) case 'yy': formatter = dateGetter(DateType.FullYear, 2, 0, true, true); break; // 3 digit representation of the year, padded (000-999). (e.g. AD 2001 => 01, AD 2010 => 10) case 'yyy': formatter = dateGetter(DateType.FullYear, 3, 0, false, true); break; // 4 digit representation of the year (e.g. AD 1 => 0001, AD 2010 => 2010) case 'yyyy': formatter = dateGetter(DateType.FullYear, 4, 0, false, true); break; // Month of the year (1-12), numeric case 'M': case 'L': formatter = dateGetter(DateType.Month, 1, 1); break; case 'MM': case 'LL': formatter = dateGetter(DateType.Month, 2, 1); break; // Month of the year (January, ...), string, format case 'MMM': formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated); break; case 'MMMM': formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Wide); break; case 'MMMMM': formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Narrow); break; // Month of the year (January, ...), string, standalone case 'LLL': formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated, FormStyle.Standalone); break; case 'LLLL': formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Wide, FormStyle.Standalone); break; case 'LLLLL': formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Narrow, FormStyle.Standalone); break; // Week of the year (1, ... 52) case 'w': formatter = weekGetter(1); break; case 'ww': formatter = weekGetter(2); break; // Week of the month (1, ...) case 'W': formatter = weekGetter(1, true); break; // Day of the month (1-31) case 'd': formatter = dateGetter(DateType.Date, 1); break; case 'dd': formatter = dateGetter(DateType.Date, 2); break; // Day of the Week case 'E': case 'EE': case 'EEE': formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Abbreviated); break; case 'EEEE': formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Wide); break; case 'EEEEE': formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Narrow); break; case 'EEEEEE': formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Short); break; // Generic period of the day (am-pm) case 'a': case 'aa': case 'aaa': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated); break; case 'aaaa': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide); break; case 'aaaaa': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow); break; // Extended period of the day (midnight, at night, ...), standalone case 'b': case 'bb': case 'bbb': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Standalone, true); break; case 'bbbb': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Standalone, true); break; case 'bbbbb': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Standalone, true); break; // Extended period of the day (midnight, night, ...), standalone case 'B': case 'BB': case 'BBB': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Format, true); break; case 'BBBB': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Format, true); break; case 'BBBBB': formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Format, true); break; // Hour in AM/PM, (1-12) case 'h': formatter = dateGetter(DateType.Hours, 1, -12); break; case 'hh': formatter = dateGetter(DateType.Hours, 2, -12); break; // Hour of the day (0-23) case 'H': formatter = dateGetter(DateType.Hours, 1); break; // Hour in day, padded (00-23) case 'HH': formatter = dateGetter(DateType.Hours, 2); break; // Minute of the hour (0-59) case 'm': formatter = dateGetter(DateType.Minutes, 1); break; case 'mm': formatter = dateGetter(DateType.Minutes, 2); break; // Second of the minute (0-59) case 's': formatter = dateGetter(DateType.Seconds, 1); break; case 'ss': formatter = dateGetter(DateType.Seconds, 2); break; // Fractional second case 'S': formatter = dateGetter(DateType.FractionalSeconds, 1); break; case 'SS': formatter = dateGetter(DateType.FractionalSeconds, 2); break; case 'SSS': formatter = dateGetter(DateType.FractionalSeconds, 3); break; // Timezone ISO8601 short format (-0430) case 'Z': case 'ZZ': case 'ZZZ': formatter = timeZoneGetter(ZoneWidth.Short); break; // Timezone ISO8601 extended format (-04:30) case 'ZZZZZ': formatter = timeZoneGetter(ZoneWidth.Extended); break; // Timezone GMT short format (GMT+4) case 'O': case 'OO': case 'OOO': // Should be location, but fallback to format O instead because we don't have the data yet case 'z': case 'zz': case 'zzz': formatter = timeZoneGetter(ZoneWidth.ShortGMT); break; // Timezone GMT long format (GMT+0430) case 'OOOO': case 'ZZZZ': // Should be location, but fallback to format O instead because we don't have the data yet case 'zzzz': formatter = timeZoneGetter(ZoneWidth.Long); break; default: return null; } DATE_FORMATS[format] = formatter; return formatter; } /** * @param {?} timezone * @param {?} fallback * @return {?} */ function timezoneToOffset(timezone, fallback) { // Support: IE 9-11 only, Edge 13-15+ // IE/Edge do not "understand" colon (`:`) in timezone timezone = timezone.replace(/:/g, ''); /** @type {?} */ var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000; return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset; } /** * @param {?} date * @param {?} minutes * @return {?} */ function addDateMinutes(date, minutes) { date = new Date(date.getTime()); date.setMinutes(date.getMinutes() + minutes); return date; } /** * @param {?} date * @param {?} timezone * @param {?} reverse * @return {?} */ function convertTimezoneToLocal(date, timezone, reverse) { /** @type {?} */ var reverseValue = reverse ? -1 : 1; /** @type {?} */ var dateTimezoneOffset = date.getTimezoneOffset(); /** @type {?} */ var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset); return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset)); } /** * Converts a value to date. * * Supported input formats: * - `Date` * - number: timestamp * - string: numeric (e.g. "1234"), ISO and date strings in a format supported by * [Date.parse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse). * Note: ISO strings without time return a date without timeoffset. * * Throws if unable to convert to a date. * @param {?} value * @return {?} */ function toDate(value) { if (isDate(value)) { return value; } if (typeof value === 'number' && !isNaN(value)) { return new Date(value); } if (typeof value === 'string') { value = value.trim(); /** @type {?} */ var parsedNb = parseFloat(value); // any string that only contains numbers, like "1234" but not like "1234hello" if (!isNaN( /** @type {?} */ value - parsedNb)) { return new Date(parsedNb); } if (/^(\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 _value$split$map = value.split('-').map( /** * @param {?} val * @return {?} */ function (val) { return +val; }), _value$split$map2 = _slicedToArray(_value$split$map, 3), y = _value$split$map2[0], m = _value$split$map2[1], d = _value$split$map2[2]; return new Date(y, m - 1, d); } /** @type {?} */ var match; if (match = value.match(ISO8601_DATE_REGEX)) { return isoStringToDate(match); } } /** @type {?} */ var date = new Date( /** @type {?} */ value); if (!isDate(date)) { throw new Error("Unable to convert \"".concat(value, "\" into a date")); } return date; } /** * Converts a date in ISO8601 to a Date. * Used instead of `Date.parse` because of browser discrepancies. * @param {?} match * @return {?} */ function isoStringToDate(match) { /** @type {?} */ var date = new Date(0); /** @type {?} */ var tzHour = 0; /** @type {?} */ var tzMin = 0; // match[8] means that the string contains "Z" (UTC) or a timezone like "+01:00" or "+0100" /** @type {?} */ var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear; /** @type {?} */ var timeSetter = match[8] ? date.setUTCHours : date.setHours; // if there is a timezone defined like "+01:00" or "+0100" if (match[9]) { tzHour = Number(match[9] + match[10]); tzMin = Number(match[9] + match[11]); } dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3])); /** @type {?} */ var h = Number(match[4] || 0) - tzHour; /** @type {?} */ var m = Number(match[5] || 0) - tzMin; /** @type {?} */ var s = Number(match[6] || 0); /** @type {?} */ var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000); timeSetter.call(date, h, m, s, ms); return date; } /** * @param {?} value * @return {?} */ function isDate(value) { return value instanceof Date && !isNaN(value.valueOf()); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/; /** @type {?} */ var MAX_DIGITS = 22; /** @type {?} */ var DECIMAL_SEP = '.'; /** @type {?} */ var ZERO_CHAR = '0'; /** @type {?} */ var PATTERN_SEP = ';'; /** @type {?} */ var GROUP_SEP = ','; /** @type {?} */ var DIGIT_CHAR = '#'; /** @type {?} */ var CURRENCY_CHAR = '¤'; /** @type {?} */ var PERCENT_CHAR = '%'; /** * Transforms a number to a locale string based on a style and a format. * @param {?} value * @param {?} pattern * @param {?} locale * @param {?} groupSymbol * @param {?} decimalSymbol * @param {?=} digitsInfo * @param {?=} isPercent * @return {?} */ function formatNumberToLocaleString(value, pattern, locale, groupSymbol, decimalSymbol, digitsInfo) { var isPercent = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false; /** @type {?} */ var formattedText = ''; /** @type {?} */ var isZero = false; if (!isFinite(value)) { formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity); } else { /** @type {?} */ var parsedNumber = parseNumber(value); if (isPercent) { parsedNumber = toPercent(parsedNumber); } /** @type {?} */ var minInt = pattern.minInt; /** @type {?} */ var minFraction = pattern.minFrac; /** @type {?} */ var maxFraction = pattern.maxFrac; if (digitsInfo) { /** @type {?} */ var parts = digitsInfo.match(NUMBER_FORMAT_REGEXP); if (parts === null) { throw new Error("".concat(digitsInfo, " is not a valid digit info")); } /** @type {?} */ var minIntPart = parts[1]; /** @type {?} */ var minFractionPart = parts[3]; /** @type {?} */ var maxFractionPart = parts[5]; if (minIntPart != null) { minInt = parseIntAutoRadix(minIntPart); } if (minFractionPart != null) { minFraction = parseIntAutoRadix(minFractionPart); } if (maxFractionPart != null) { maxFraction = parseIntAutoRadix(maxFractionPart); } else if (minFractionPart != null && minFraction > maxFraction) { maxFraction = minFraction; } } roundNumber(parsedNumber, minFraction, maxFraction); /** @type {?} */ var digits = parsedNumber.digits; /** @type {?} */ var integerLen = parsedNumber.integerLen; /** @type {?} */ var exponent = parsedNumber.exponent; /** @type {?} */ var decimals = []; isZero = digits.every( /** * @param {?} d * @return {?} */ function (d) { return !d; }); // pad zeros for small numbers for (; integerLen < minInt; integerLen++) { digits.unshift(0); } // pad zeros for small numbers for (; integerLen < 0; integerLen++) { digits.unshift(0); } // extract decimals digits if (integerLen > 0) { decimals = digits.splice(integerLen, digits.length); } else { decimals = digits; digits = [0]; } // format the integer digits with grouping separators /** @type {?} */ var groups = []; if (digits.length >= pattern.lgSize) { groups.unshift(digits.splice(-pattern.lgSize, digits.length).join('')); } while (digits.length > pattern.gSize) { groups.unshift(digits.splice(-pattern.gSize, digits.length).join('')); } if (digits.length) { groups.unshift(digits.join('')); } formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol)); // append the decimal digits if (decimals.length) { formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join(''); } if (exponent) { formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + '+' + exponent; } } if (value < 0 && !isZero) { formattedText = pattern.negPre + formattedText + pattern.negSuf; } else { formattedText = pattern.posPre + formattedText + pattern.posSuf; } return formattedText; } /** * \@ngModule CommonModule * \@description * * Formats a number as currency using locale rules. * * @see `formatNumber()` / `DecimalPipe` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} value The number to format. * @param {?} locale A locale code for the locale format rules to use. * @param {?} currency A string containing the currency symbol or its name, * such as "$" or "Canadian Dollar". Used in output string, but does not affect the operation * of the function. * @param {?=} currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) * currency code, such as `USD` for the US dollar and `EUR` for the euro. * Used to determine the number of digits in the decimal part. * @param {?=} digitsInfo * @return {?} The formatted currency value. * */ function formatCurrency(value, locale, currency, currencyCode, digitsInfo) { /** @type {?} */ var format = getLocaleNumberFormat(locale, NumberFormatStyle.Currency); /** @type {?} */ var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign)); pattern.minFrac = getNumberOfCurrencyDigits( /** @type {?} */ currencyCode); pattern.maxFrac = pattern.minFrac; /** @type {?} */ var res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.CurrencyGroup, NumberSymbol.CurrencyDecimal, digitsInfo); return res.replace(CURRENCY_CHAR, currency) // if we have 2 time the currency character, the second one is ignored .replace(CURRENCY_CHAR, ''); } /** * \@ngModule CommonModule * \@description * * Formats a number as a percentage according to locale rules. * * @see `formatNumber()` / `DecimalPipe` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * \@publicApi * * @param {?} value The number to format. * @param {?} locale A locale code for the locale format rules to use. * @param {?=} digitsInfo * @return {?} The formatted percentage value. * */ function formatPercent(value, locale, digitsInfo) { /** @type {?} */ var format = getLocaleNumberFormat(locale, NumberFormatStyle.Percent); /** @type {?} */ var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign)); /** @type {?} */ var res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo, true); return res.replace(new RegExp(PERCENT_CHAR, 'g'), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign)); } /** * \@ngModule CommonModule * \@description * * Formats a number as text, with group sizing, separator, and other * parameters based on the locale. * * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * * \@publicApi * @param {?} value The number to format. * @param {?} locale A locale code for the locale format rules to use. * @param {?=} digitsInfo * @return {?} The formatted text string. */ function formatNumber(value, locale, digitsInfo) { /** @type {?} */ var format = getLocaleNumberFormat(locale, NumberFormatStyle.Decimal); /** @type {?} */ var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign)); return formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo); } /** * @record */ function ParsedNumberFormat() {} if (false) {} /** * @param {?} format * @param {?=} minusSign * @return {?} */ function parseNumberFormat(format) { var minusSign = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '-'; /** @type {?} */ var p = { minInt: 1, minFrac: 0, maxFrac: 0, posPre: '', posSuf: '', negPre: '', negSuf: '', gSize: 0, lgSize: 0 }; /** @type {?} */ var patternParts = format.split(PATTERN_SEP); /** @type {?} */ var positive = patternParts[0]; /** @type {?} */ var negative = patternParts[1]; /** @type {?} */ var positiveParts = positive.indexOf(DECIMAL_SEP) !== -1 ? positive.split(DECIMAL_SEP) : [positive.substring(0, positive.lastIndexOf(ZERO_CHAR) + 1), positive.substring(positive.lastIndexOf(ZERO_CHAR) + 1)]; /** @type {?} */ var integer = positiveParts[0]; /** @type {?} */ var fraction = positiveParts[1] || ''; p.posPre = integer.substr(0, integer.indexOf(DIGIT_CHAR)); for (var i = 0; i < fraction.length; i++) { /** @type {?} */ var ch = fraction.charAt(i); if (ch === ZERO_CHAR) { p.minFrac = p.maxFrac = i + 1; } else if (ch === DIGIT_CHAR) { p.maxFrac = i + 1; } else { p.posSuf += ch; } } /** @type {?} */ var groups = integer.split(GROUP_SEP); p.gSize = groups[1] ? groups[1].length : 0; p.lgSize = groups[2] || groups[1] ? (groups[2] || groups[1]).length : 0; if (negative) { /** @type {?} */ var trunkLen = positive.length - p.posPre.length - p.posSuf.length; /** @type {?} */ var pos = negative.indexOf(DIGIT_CHAR); p.negPre = negative.substr(0, pos).replace(/'/g, ''); p.negSuf = negative.substr(pos + trunkLen).replace(/'/g, ''); } else { p.negPre = minusSign + p.posPre; p.negSuf = p.posSuf; } return p; } /** * @record */ function ParsedNumber() {} if (false) {} // Transforms a parsed number into a percentage by multiplying it by 100 /** * @param {?} parsedNumber * @return {?} */ function toPercent(parsedNumber) { // if the number is 0, don't do anything if (parsedNumber.digits[0] === 0) { return parsedNumber; } // Getting the current number of decimals /** @type {?} */ var fractionLen = parsedNumber.digits.length - parsedNumber.integerLen; if (parsedNumber.exponent) { parsedNumber.exponent += 2; } else { if (fractionLen === 0) { parsedNumber.digits.push(0, 0); } else if (fractionLen === 1) { parsedNumber.digits.push(0); } parsedNumber.integerLen += 2; } return parsedNumber; } /** * Parses a number. * Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/ * @param {?} num * @return {?} */ function parseNumber(num) { /** @type {?} */ var numStr = Math.abs(num) + ''; /** @type {?} */ var exponent = 0; /** @type {?} */ var digits; /** @type {?} */ var integerLen; /** @type {?} */ var i; /** @type {?} */ var j; /** @type {?} */ var zeros; // Decimal point? if ((integerLen = numStr.indexOf(DECIMAL_SEP)) > -1) { numStr = numStr.replace(DECIMAL_SEP, ''); } // Exponential form? if ((i = numStr.search(/e/i)) > 0) { // Work out the exponent. if (integerLen < 0) integerLen = i; integerLen += +numStr.slice(i + 1); numStr = numStr.substring(0, i); } else if (integerLen < 0) { // There was no decimal point or exponent so it is an integer. integerLen = numStr.length; } // Count the number of leading zeros. for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) { /* empty */ } if (i === (zeros = numStr.length)) { // The digits are all zero. digits = [0]; integerLen = 1; } else { // Count the number of trailing zeros zeros--; while (numStr.charAt(zeros) === ZERO_CHAR) { zeros--; } // Trailing zeros are insignificant so ignore them integerLen -= i; digits = []; // Convert string to array of digits without leading/trailing zeros. for (j = 0; i <= zeros; i++, j++) { digits[j] = Number(numStr.charAt(i)); } } // If the number overflows the maximum allowed digits then use an exponent. if (integerLen > MAX_DIGITS) { digits = digits.splice(0, MAX_DIGITS - 1); exponent = integerLen - 1; integerLen = 1; } return { digits: digits, exponent: exponent, integerLen: integerLen }; } /** * Round the parsed number to the specified number of decimal places * This function changes the parsedNumber in-place * @param {?} parsedNumber * @param {?} minFrac * @param {?} maxFrac * @return {?} */ function roundNumber(parsedNumber, minFrac, maxFrac) { if (minFrac > maxFrac) { throw new Error("The minimum number of digits after fraction (".concat(minFrac, ") is higher than the maximum (").concat(maxFrac, ").")); } /** @type {?} */ var digits = parsedNumber.digits; /** @type {?} */ var fractionLen = digits.length - parsedNumber.integerLen; /** @type {?} */ var fractionSize = Math.min(Math.max(minFrac, fractionLen), maxFrac); // The index of the digit to where rounding is to occur /** @type {?} */ var roundAt = fractionSize + parsedNumber.integerLen; /** @type {?} */ var digit = digits[roundAt]; if (roundAt > 0) { // Drop fractional digits beyond `roundAt` digits.splice(Math.max(parsedNumber.integerLen, roundAt)); // Set non-fractional digits beyond `roundAt` to 0 for (var j = roundAt; j < digits.length; j++) { digits[j] = 0; } } else { // We rounded to zero so reset the parsedNumber fractionLen = Math.max(0, fractionLen); parsedNumber.integerLen = 1; digits.length = Math.max(1, roundAt = fractionSize + 1); digits[0] = 0; for (var i = 1; i < roundAt; i++) { digits[i] = 0; } } if (digit >= 5) { if (roundAt - 1 < 0) { for (var k = 0; k > roundAt; k--) { digits.unshift(0); parsedNumber.integerLen++; } digits.unshift(1); parsedNumber.integerLen++; } else { digits[roundAt - 1]++; } } // Pad out with zeros to get the required fraction length for (; fractionLen < Math.max(0, fractionSize); fractionLen++) { digits.push(0); } /** @type {?} */ var dropTrailingZeros = fractionSize !== 0; // Minimal length = nb of decimals required + current nb of integers // Any number besides that is optional and can be removed if it's a trailing 0 /** @type {?} */ var minLen = minFrac + parsedNumber.integerLen; // Do any carrying, e.g. a digit was rounded up to 10 /** @type {?} */ var carry = digits.reduceRight( /** * @param {?} carry * @param {?} d * @param {?} i * @param {?} digits * @return {?} */ function (carry, d, i, digits) { d = d + carry; digits[i] = d < 10 ? d : d - 10; // d % 10 if (dropTrailingZeros) { // Do not keep meaningless fractional trailing zeros (e.g. 15.52000 --> 15.52) if (digits[i] === 0 && i >= minLen) { digits.pop(); } else { dropTrailingZeros = false; } } return d >= 10 ? 1 : 0; // Math.floor(d / 10); }, 0); if (carry) { digits.unshift(carry); parsedNumber.integerLen++; } } /** * @param {?} text * @return {?} */ function parseIntAutoRadix(text) { /** @type {?} */ var result = parseInt(text); if (isNaN(result)) { throw new Error('Invalid integer literal when parsing ' + text); } return result; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @deprecated from v5 * @type {?} */ var DEPRECATED_PLURAL_FN = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('UseV4Plurals'); /** * \@publicApi * @abstract */ var NgLocalization = function NgLocalization() { _classCallCheck(this, NgLocalization); }; if (false) {} /** * Returns the plural category for a given value. * - "=value" when the case exists, * - the plural category otherwise * @param {?} value * @param {?} cases * @param {?} ngLocalization * @param {?=} locale * @return {?} */ function getPluralCategory(value, cases, ngLocalization, locale) { /** @type {?} */ var key = "=".concat(value); if (cases.indexOf(key) > -1) { return key; } key = ngLocalization.getPluralCategory(value, locale); if (cases.indexOf(key) > -1) { return key; } if (cases.indexOf('other') > -1) { return 'other'; } throw new Error("No plural message found for value \"".concat(value, "\"")); } /** * Returns the plural case based on the locale * * \@publicApi */ var NgLocaleLocalization = /*#__PURE__*/function (_NgLocalization) { _inherits(NgLocaleLocalization, _NgLocalization); var _super3 = _createSuper(NgLocaleLocalization); /** * @param {?} locale * @param {?=} deprecatedPluralFn */ function NgLocaleLocalization(locale, deprecatedPluralFn) { var _this5; _classCallCheck(this, NgLocaleLocalization); _this5 = _super3.call(this); _this5.locale = locale; _this5.deprecatedPluralFn = deprecatedPluralFn; return _this5; } /** * @param {?} value * @param {?=} locale * @return {?} */ _createClass2(NgLocaleLocalization, [{ key: "getPluralCategory", value: function getPluralCategory(value, locale) { /** @type {?} */ var plural = this.deprecatedPluralFn ? this.deprecatedPluralFn(locale || this.locale, value) : getLocalePluralCase(locale || 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: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; /** @nocollapse */ NgLocaleLocalization.ctorParameters = function () { return [{ type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"]] }] }, { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [DEPRECATED_PLURAL_FN] }] }]; }; if (false) {} /** * Returns the plural case based on the locale * * @deprecated from v5 the plural case function is in locale data files common/locales/*.ts * \@publicApi * @param {?} locale * @param {?} nLike * @return {?} */ function getPluralCase(locale, nLike) { // TODO(vicb): lazy compute if (typeof nLike === 'string') { nLike = parseInt( /** @type {?} */ nLike, 10); } /** @type {?} */ var n = /** @type {?} */ nLike; /** @type {?} */ var nDecimal = n.toString().replace(/^[^.]*\.?/, ''); /** @type {?} */ var i = Math.floor(Math.abs(n)); /** @type {?} */ var v = nDecimal.length; /** @type {?} */ var f = parseInt(nDecimal, 10); /** @type {?} */ var t = parseInt(n.toString().replace(/^[^.]*\.?|0+$/g, ''), 10) || 0; /** @type {?} */ var 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 '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; // When there is no specification, the default is always "other" // Spec: http://cldr.unicode.org/index/cldr-spec/plural-rules // > other (required—general plural form — also used if the language only has a single form) default: return Plural.Other; } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Register global data to be used internally by Angular. See the * ["I18n guide"](guide/i18n#i18n-pipes) to know how to import additional locale data. * * \@publicApi * @param {?} data * @param {?=} localeId * @param {?=} extraData * @return {?} */ // The signature registerLocaleData(data: any, extraData?: any) is deprecated since v5.1 function registerLocaleData(data, localeId, extraData) { if (typeof localeId !== 'string') { extraData = localeId; localeId = data[_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].LocaleId]; } localeId = localeId.toLowerCase().replace(/_/g, '-'); _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLOCALE_DATA"][localeId] = data; if (extraData) { _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLOCALE_DATA"][localeId][_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵLocaleDataIndex"].ExtraData] = extraData; } } /** @enum {number} */ var ExtraLocaleDataIndex = { ExtraDayPeriodFormats: 0, ExtraDayPeriodStandalone: 1, ExtraDayPeriodsRules: 2 }; /** @enum {number} */ var CurrencyIndex = { Symbol: 0, SymbolNarrow: 1, NbOfDigits: 2 }; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 {?} cookieStr * @param {?} name * @return {?} */ function parseCookieValue(cookieStr, name) { name = encodeURIComponent(name); var _iterator = _createForOfIteratorHelper(cookieStr.split(';')), _step; try { for (_iterator.s(); !(_step = _iterator.n()).done;) { var cookie = _step.value; /** @type {?} */ var eqIndex = cookie.indexOf('='); var _ref2 = eqIndex == -1 ? [cookie, ''] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)], _ref3 = _slicedToArray(_ref2, 2), cookieName = _ref3[0], cookieValue = _ref3[1]; if (cookieName.trim() === name) { return decodeURIComponent(cookieValue); } } } catch (err) { _iterator.e(err); } finally { _iterator.f(); } return null; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Used to diff and convert ngStyle/ngClass instructions into [style] and [class] bindings. * * ngStyle and ngClass both accept various forms of input and behave differently than that * of how [style] and [class] behave in Angular. * * The differences are: * - ngStyle and ngClass both **watch** their binding values for changes each time CD runs * while [style] and [class] bindings do not (they check for identity changes) * - ngStyle allows for unit-based keys (e.g. `{'max-width.px':value}`) and [style] does not * - ngClass supports arrays of class values and [class] only accepts map and string values * - ngClass allows for multiple className keys (space-separated) within an array or map * (as the * key) while [class] only accepts a simple key/value map object * * Having Angular understand and adapt to all the different forms of behavior is complicated * and unnecessary. Instead, ngClass and ngStyle should have their input values be converted * into something that the core-level [style] and [class] bindings understand. * * This [StylingDiffer] class handles this conversion by creating a new input value each time * the inner representation of the binding value have changed. * * ## Why do we care about ngStyle/ngClass? * The styling algorithm code (documented inside of `render3/interfaces/styling.ts`) needs to * respect and understand the styling values emitted through ngStyle and ngClass (when they * are present and used in a template). * * Instead of having these directives manage styling on their own, they should be included * into the Angular styling algorithm that exists for [style] and [class] bindings. * * Here's why: * * - If ngStyle/ngClass is used in combination with [style]/[class] bindings then the * styles and classes would fall out of sync and be applied and updated at * inconsistent times * - Both ngClass/ngStyle do not respect [class.name] and [style.prop] bindings * (they will write over them given the right combination of events) * * ``` * <!-- if `w1` is updated then it will always override `w2` * if `w2` is updated then it will always override `w1` * if both are updated at the same time then `w1` wins --> * <div [ngStyle]="{width:w1}" [style.width]="w2">...</div> * * <!-- if `w1` is updated then it will always lose to `w2` * if `w2` is updated then it will always override `w1` * if both are updated at the same time then `w2` wins --> * <div [style]="{width:w1}" [style.width]="w2">...</div> * ``` * - ngClass/ngStyle were written as a directives and made use of maps, closures and other * expensive data structures which were evaluated each time CD runs * @template T */ var StylingDiffer = /*#__PURE__*/function () { /** * @param {?} _name * @param {?} _options */ function StylingDiffer(_name, _options) { _classCallCheck(this, StylingDiffer); this._name = _name; this._options = _options; this.value = null; this._lastSetValue = null; this._lastSetValueType = 0 /* Null */ ; this._lastSetValueIdentityChange = false; } /** * Sets (updates) the styling value within the differ. * * Only when `hasValueChanged` is called then this new value will be evaluted * and checked against the previous value. * * @param {?} value the new styling value provided from the ngClass/ngStyle binding * @return {?} */ _createClass2(StylingDiffer, [{ key: "setValue", value: function setValue(value) { if (Array.isArray(value)) { this._lastSetValueType = 4 /* Array */ ; } else if (value instanceof Set) { this._lastSetValueType = 8 /* Set */ ; } else if (value && typeof value === 'string') { if (!(this._options & 4 /* AllowStringValue */ )) { throw new Error(this._name + ' string values are not allowed'); } this._lastSetValueType = 1 /* String */ ; } else { this._lastSetValueType = value ? 2 /* Map */ : 0 /* Null */ ; } this._lastSetValueIdentityChange = true; this._lastSetValue = value || null; } /** * Determines whether or not the value has changed. * * This function can be called right after `setValue()` is called, but it can also be * called incase the existing value (if it's a collection) changes internally. If the * value is indeed a collection it will do the necessary diffing work and produce a * new object value as assign that to `value`. * * @return {?} whether or not the value has changed in some way. */ }, { key: "hasValueChanged", value: function hasValueChanged() { /** @type {?} */ var valueHasChanged = this._lastSetValueIdentityChange; if (!valueHasChanged && !(this._lastSetValueType & 14 /* Collection */ )) return false; /** @type {?} */ var finalValue = null; /** @type {?} */ var trimValues = this._options & 1 /* TrimProperties */ ? true : false; /** @type {?} */ var parseOutUnits = this._options & 8 /* AllowUnits */ ? true : false; /** @type {?} */ var allowSubKeys = this._options & 2 /* AllowSubKeys */ ? true : false; switch (this._lastSetValueType) { // case 1: [input]="string" case 1 /* String */ : /** @type {?} */ var tokens = /** @type {?} */ this._lastSetValue.split(/\s+/g); if (this._options & 16 /* ForceAsMap */ ) { finalValue = {}; tokens.forEach( /** * @param {?} token * @param {?} i * @return {?} */ function (token, i) { return ( /** @type {?} */ finalValue[token] = true ); }); } else { finalValue = tokens.reduce( /** * @param {?} str * @param {?} token * @param {?} i * @return {?} */ function (str, token, i) { return str + (i ? ' ' : '') + token; }); } break; // case 2: [input]="{key:value}" case 2 /* Map */ : /** @type {?} */ var map = /** @type {?} */ this._lastSetValue; /** @type {?} */ var keys = Object.keys(map); if (!valueHasChanged) { if (this.value) { // we know that the classExp value exists and that it is // a map (otherwise an identity change would have occurred) valueHasChanged = mapHasChanged(keys, /** @type {?} */ this.value, map); } else { valueHasChanged = true; } } if (valueHasChanged) { finalValue = bulidMapFromValues(this._name, trimValues, parseOutUnits, allowSubKeys, map, keys); } break; // case 3a: [input]="[str1, str2, ...]" // case 3b: [input]="Set" case 4 /* Array */ : case 8 /* Set */ : /** @type {?} */ var values = Array.from( /** @type {?} */ this._lastSetValue); if (!valueHasChanged) { /** @type {?} */ var _keys = Object.keys( /** @type {?} */ this.value); valueHasChanged = !arrayEqualsArray(_keys, values); } if (valueHasChanged) { finalValue = bulidMapFromValues(this._name, trimValues, parseOutUnits, allowSubKeys, values); } break; // case 4: [input]="null|undefined" default: finalValue = null; break; } if (valueHasChanged) { /** @type {?} */ this.value = /** @type {?} */ finalValue; } return valueHasChanged; } }]); return StylingDiffer; }(); if (false) {} /** @enum {number} */ var StylingDifferOptions = { None: 0, TrimProperties: 1, AllowSubKeys: 2, AllowStringValue: 4, AllowUnits: 8, ForceAsMap: 16 }; /** @enum {number} */ var StylingDifferValueTypes = { Null: 0, String: 1, Map: 2, Array: 4, Set: 8, Collection: 14 }; /** * builds and returns a map based on the values input value * * If the `keys` param is provided then the `values` param is treated as a * string map. Otherwise `values` is treated as a string array. * @param {?} errorPrefix * @param {?} trim * @param {?} parseOutUnits * @param {?} allowSubKeys * @param {?} values * @param {?=} keys * @return {?} */ function bulidMapFromValues(errorPrefix, trim, parseOutUnits, allowSubKeys, values, keys) { /** @type {?} */ var map = {}; if (keys) { // case 1: map for (var i = 0; i < keys.length; i++) { /** @type {?} */ var key = keys[i]; key = trim ? key.trim() : key; /** @type {?} */ var value = /** @type {?} */ values[key]; setMapValues(map, key, value, parseOutUnits, allowSubKeys); } } else { // case 2: array for (var _i2 = 0; _i2 < values.length; _i2++) { /** @type {?} */ var _value2 = /** @type {?} */ values[_i2]; assertValidValue(errorPrefix, _value2); _value2 = trim ? _value2.trim() : _value2; setMapValues(map, _value2, true, false, allowSubKeys); } } return map; } /** * @param {?} errorPrefix * @param {?} value * @return {?} */ function assertValidValue(errorPrefix, value) { if (typeof value !== 'string') { throw new Error("".concat(errorPrefix, " can only toggle CSS classes expressed as strings, got ").concat(value)); } } /** * @param {?} map * @param {?} key * @param {?} value * @param {?} parseOutUnits * @param {?} allowSubKeys * @return {?} */ function setMapValues(map, key, value, parseOutUnits, allowSubKeys) { if (allowSubKeys && key.indexOf(' ') > 0) { /** @type {?} */ var innerKeys = key.split(/\s+/g); for (var j = 0; j < innerKeys.length; j++) { setIndividualMapValue(map, innerKeys[j], value, parseOutUnits); } } else { setIndividualMapValue(map, key, value, parseOutUnits); } } /** * @param {?} map * @param {?} key * @param {?} value * @param {?} parseOutUnits * @return {?} */ function setIndividualMapValue(map, key, value, parseOutUnits) { if (parseOutUnits) { /** @type {?} */ var values = normalizeStyleKeyAndValue(key, value); value = values.value; key = values.key; } map[key] = value; } /** * @param {?} key * @param {?} value * @return {?} */ function normalizeStyleKeyAndValue(key, value) { /** @type {?} */ var index = key.indexOf('.'); if (index > 0) { /** @type {?} */ var unit = key.substr(index + 1); key = key.substring(0, index); if (value != null) { // we should not convert null values to string value += unit; } } return { key: key, value: value }; } /** * @param {?} keys * @param {?} a * @param {?} b * @return {?} */ function mapHasChanged(keys, a, b) { /** @type {?} */ var oldKeys = Object.keys(a); /** @type {?} */ var newKeys = keys; // the keys are different which means the map changed if (!arrayEqualsArray(oldKeys, newKeys)) { return true; } for (var i = 0; i < newKeys.length; i++) { /** @type {?} */ var key = newKeys[i]; if (a[key] !== b[key]) { return true; } } return false; } /** * @param {?} a * @param {?} b * @return {?} */ function arrayEqualsArray(a, b) { if (a && b) { if (a.length !== b.length) return false; for (var i = 0; i < a.length; i++) { if (b.indexOf(a[i]) === -1) return false; } return true; } return false; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Used as a token for an injected service within the NgClass directive. * * NgClass behaves differenly whether or not VE is being used or not. If * present then the legacy ngClass diffing algorithm will be used as an * injected service. Otherwise the new diffing algorithm (which delegates * to the `[class]` binding) will be used. This toggle behavior is done so * via the ivy_switch mechanism. * @abstract */ var NgClassImpl = function NgClassImpl() { _classCallCheck(this, NgClassImpl); }; if (false) {} var NgClassR2Impl = /*#__PURE__*/function () { /** * @param {?} _iterableDiffers * @param {?} _keyValueDiffers * @param {?} _ngEl * @param {?} _renderer */ function NgClassR2Impl(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) { _classCallCheck(this, NgClassR2Impl); this._iterableDiffers = _iterableDiffers; this._keyValueDiffers = _keyValueDiffers; this._ngEl = _ngEl; this._renderer = _renderer; this._initialClasses = []; } /** * @return {?} */ _createClass2(NgClassR2Impl, [{ key: "getValue", value: function getValue() { return null; } /** * @param {?} value * @return {?} */ }, { key: "setClass", value: function setClass(value) { this._removeClasses(this._initialClasses); this._initialClasses = typeof value === 'string' ? value.split(/\s+/) : []; this._applyClasses(this._initialClasses); this._applyClasses(this._rawClass); } /** * @param {?} value * @return {?} */ }, { key: "setNgClass", value: function setNgClass(value) { this._removeClasses(this._rawClass); this._applyClasses(this._initialClasses); this._iterableDiffer = null; this._keyValueDiffer = null; this._rawClass = typeof value === 'string' ? value.split(/\s+/) : value; if (this._rawClass) { if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵisListLikeIterable"])(this._rawClass)) { this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create(); } else { this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create(); } } } /** * @return {?} */ }, { key: "applyChanges", value: function applyChanges() { if (this._iterableDiffer) { /** @type {?} */ var iterableChanges = this._iterableDiffer.diff( /** @type {?} */ this._rawClass); if (iterableChanges) { this._applyIterableChanges(iterableChanges); } } else if (this._keyValueDiffer) { /** @type {?} */ var keyValueChanges = this._keyValueDiffer.diff( /** @type {?} */ this._rawClass); if (keyValueChanges) { this._applyKeyValueChanges(keyValueChanges); } } } /** * @private * @param {?} changes * @return {?} */ }, { key: "_applyKeyValueChanges", value: function _applyKeyValueChanges(changes) { var _this6 = this; changes.forEachAddedItem( /** * @param {?} record * @return {?} */ function (record) { return _this6._toggleClass(record.key, record.currentValue); }); changes.forEachChangedItem( /** * @param {?} record * @return {?} */ function (record) { return _this6._toggleClass(record.key, record.currentValue); }); changes.forEachRemovedItem( /** * @param {?} record * @return {?} */ function (record) { if (record.previousValue) { _this6._toggleClass(record.key, false); } }); } /** * @private * @param {?} changes * @return {?} */ }, { key: "_applyIterableChanges", value: function _applyIterableChanges(changes) { var _this7 = this; changes.forEachAddedItem( /** * @param {?} record * @return {?} */ function (record) { if (typeof record.item === 'string') { _this7._toggleClass(record.item, true); } else { throw new Error("NgClass can only toggle CSS classes expressed as strings, got ".concat(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵstringify"])(record.item))); } }); changes.forEachRemovedItem( /** * @param {?} record * @return {?} */ function (record) { return _this7._toggleClass(record.item, false); }); } /** * Applies a collection of CSS classes to the DOM element. * * For argument of type Set and Array CSS class names contained in those collections are always * added. * For argument of type Map CSS class name in the map's key is toggled based on the value (added * for truthy and removed for falsy). * @private * @param {?} rawClassVal * @return {?} */ }, { key: "_applyClasses", value: function _applyClasses(rawClassVal) { var _this8 = this; if (rawClassVal) { if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) { /** @type {?} */ rawClassVal.forEach( /** * @param {?} klass * @return {?} */ function (klass) { return _this8._toggleClass(klass, true); }); } else { Object.keys(rawClassVal).forEach( /** * @param {?} klass * @return {?} */ function (klass) { return _this8._toggleClass(klass, !!rawClassVal[klass]); }); } } } /** * Removes a collection of CSS classes from the DOM element. This is mostly useful for cleanup * purposes. * @private * @param {?} rawClassVal * @return {?} */ }, { key: "_removeClasses", value: function _removeClasses(rawClassVal) { var _this9 = this; if (rawClassVal) { if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) { /** @type {?} */ rawClassVal.forEach( /** * @param {?} klass * @return {?} */ function (klass) { return _this9._toggleClass(klass, false); }); } else { Object.keys(rawClassVal).forEach( /** * @param {?} klass * @return {?} */ function (klass) { return _this9._toggleClass(klass, false); }); } } } /** * @private * @param {?} klass * @param {?} enabled * @return {?} */ }, { key: "_toggleClass", value: function _toggleClass(klass, enabled) { var _this10 = this; klass = klass.trim(); if (klass) { klass.split(/\s+/g).forEach( /** * @param {?} klass * @return {?} */ function (klass) { if (enabled) { _this10._renderer.addClass(_this10._ngEl.nativeElement, klass); } else { _this10._renderer.removeClass(_this10._ngEl.nativeElement, klass); } }); } } }]); return NgClassR2Impl; }(); NgClassR2Impl.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; /** @nocollapse */ NgClassR2Impl.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["IterableDiffers"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["KeyValueDiffers"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"] }]; }; if (false) {} var NgClassR3Impl = /*#__PURE__*/function () { function NgClassR3Impl() { _classCallCheck(this, NgClassR3Impl); this._value = null; this._ngClassDiffer = new StylingDiffer('NgClass', 1 /* TrimProperties */ | 2 /* AllowSubKeys */ | 4 /* AllowStringValue */ | 16 /* ForceAsMap */ ); this._classStringDiffer = null; } /** * @return {?} */ _createClass2(NgClassR3Impl, [{ key: "getValue", value: function getValue() { return this._value; } /** * @param {?} value * @return {?} */ }, { key: "setClass", value: function setClass(value) { // early exit incase the binding gets emitted as an empty value which // means there is no reason to instantiate and diff the values... if (!value && !this._classStringDiffer) return; this._classStringDiffer = this._classStringDiffer || new StylingDiffer('class', 4 /* AllowStringValue */ | 16 /* ForceAsMap */ ); this._classStringDiffer.setValue(value); } /** * @param {?} value * @return {?} */ }, { key: "setNgClass", value: function setNgClass(value) { this._ngClassDiffer.setValue(value); } /** * @return {?} */ }, { key: "applyChanges", value: function applyChanges() { /** @type {?} */ var classChanged = this._classStringDiffer ? this._classStringDiffer.hasValueChanged() : false; /** @type {?} */ var ngClassChanged = this._ngClassDiffer.hasValueChanged(); if (classChanged || ngClassChanged) { /** @type {?} */ var value = this._ngClassDiffer.value; if (this._classStringDiffer) { /** @type {?} */ var classValue = this._classStringDiffer.value; if (classValue) { value = value ? Object.assign({}, classValue, value) : classValue; } } this._value = value; } } }]); return NgClassR3Impl; }(); NgClassR3Impl.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; if (false) {} // the implementation for both NgStyleR2Impl and NgStyleR3Impl are // not ivy_switch'd away, instead they are only hooked up into the // DI via NgStyle's directive's provider property. /** @type {?} */ var NgClassImplProvider__PRE_R3__ = { provide: NgClassImpl, useClass: NgClassR2Impl }; /** @type {?} */ var NgClassImplProvider__POST_R3__ = { provide: NgClassImpl, useClass: NgClassR3Impl }; /** @type {?} */ var NgClassImplProvider = NgClassImplProvider__PRE_R3__; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /* * NgClass (as well as NgStyle) behaves differently when loaded in the VE and when not. * * If the VE is present (which is for older versions of Angular) then NgClass will inject * the legacy diffing algorithm as a service and delegate all styling changes to that. * * If the VE is not present then NgStyle will normalize (through the injected service) and * then write all styling changes to the `[style]` binding directly (through a host binding). * Then Angular will notice the host binding change and treat the changes as styling * changes and apply them via the core styling instructions that exist within Angular. */ // used when the VE is present /** @type {?} */ var ngClassDirectiveDef__PRE_R3__ = undefined; // used when the VE is not present (note the directive will // never be instantiated normally because it is apart of a // base class) var ɵ0 = /** * @return {?} */ function ɵ0() {}, ɵ1 = /** * @return {?} */ function ɵ1() {}, ɵ2 = /** * @param {?} rf * @param {?} ctx * @param {?} elIndex * @return {?} */ function ɵ2(rf, ctx, elIndex) { if (rf & 1 /* Create */ ) { Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵallocHostVars"])(1); Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵstyling"])(); } if (rf & 2 /* Update */ ) { Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵclassMap"])(ctx.getValue()); Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵstylingApply"])(); } }; /** @type {?} */ var ngClassDirectiveDef__POST_R3__ = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineDirective"])({ type: /** @type {?} */ ɵ0, selectors: /** @type {?} */ null, factory: ɵ1, hostBindings: ɵ2 }); /** @type {?} */ var ngClassDirectiveDef = ngClassDirectiveDef__PRE_R3__; /** * Serves as the base non-VE container for NgClass. * * While this is a base class that NgClass extends from, the * class itself acts as a container for non-VE code to setup * a link to the `[class]` host binding (via the static * `ngDirectiveDef` property on the class). * * Note that the `ngDirectiveDef` property's code is switched * depending if VE is present or not (this allows for the * binding code to be set only for newer versions of Angular). * * \@publicApi */ var NgClassBase = /*#__PURE__*/function () { /** * @param {?} _delegate */ function NgClassBase(_delegate) { _classCallCheck(this, NgClassBase); this._delegate = _delegate; } /** * @return {?} */ _createClass2(NgClassBase, [{ key: "getValue", value: function getValue() { return this._delegate.getValue(); } }]); return NgClassBase; }(); /** @nocollapse */ NgClassBase.ngDirectiveDef = ngClassDirectiveDef; if (false) {} /** * \@ngModule CommonModule * * \@usageNotes * ``` * <some-element [ngClass]="'first second'">...</some-element> * * <some-element [ngClass]="['first', 'second']">...</some-element> * * <some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...</some-element> * * <some-element [ngClass]="stringExp|arrayExp|objExp">...</some-element> * * <some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element> * ``` * * \@description * * Adds and removes CSS classes on an HTML element. * * 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. * * \@publicApi */ var NgClass = /*#__PURE__*/function (_NgClassBase) { _inherits(NgClass, _NgClassBase); var _super4 = _createSuper(NgClass); /** * @param {?} delegate */ function NgClass(delegate) { _classCallCheck(this, NgClass); return _super4.call(this, delegate); } /** * @param {?} value * @return {?} */ _createClass2(NgClass, [{ key: "ngDoCheck", /** * @return {?} */ value: function ngDoCheck() { this._delegate.applyChanges(); } }, { key: "klass", set: function set(value) { this._delegate.setClass(value); } /** * @param {?} value * @return {?} */ }, { key: "ngClass", set: function set(value) { this._delegate.setNgClass(value); } }]); return NgClass; }(NgClassBase); NgClass.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[ngClass]', providers: [NgClassImplProvider] }] }]; /** @nocollapse */ NgClass.ctorParameters = function () { return [{ type: NgClassImpl }]; }; NgClass.propDecorators = { klass: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['class'] }], ngClass: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['ngClass'] }] }; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * 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. * * \@usageNotes * * ### 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 * ``` * <ng-container *ngComponentOutlet="componentTypeExpression"></ng-container> * ``` * * Customized injector/content * ``` * <ng-container *ngComponentOutlet="componentTypeExpression; * injector: injectorExpression; * content: contentNodesExpression;"> * </ng-container> * ``` * * Customized ngModuleFactory * ``` * <ng-container *ngComponentOutlet="componentTypeExpression; * ngModuleFactory: moduleFactory;"> * </ng-container> * ``` * * ### A simple example * * {\@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'} * * A more complete example with additional options: * * {\@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'} * * \@publicApi * \@ngModule CommonModule */ var NgComponentOutlet = /*#__PURE__*/function () { /** * @param {?} _viewContainerRef */ function NgComponentOutlet(_viewContainerRef) { _classCallCheck(this, NgComponentOutlet); this._viewContainerRef = _viewContainerRef; this._componentRef = null; this._moduleRef = null; } /** * @param {?} changes * @return {?} */ _createClass2(NgComponentOutlet, [{ key: "ngOnChanges", value: function ngOnChanges(changes) { this._viewContainerRef.clear(); this._componentRef = null; if (this.ngComponentOutlet) { /** @type {?} */ var elInjector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector; if (changes['ngComponentOutletNgModuleFactory']) { if (this._moduleRef) this._moduleRef.destroy(); if (this.ngComponentOutletNgModuleFactory) { /** @type {?} */ var parentModule = elInjector.get(_angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModuleRef"]); this._moduleRef = this.ngComponentOutletNgModuleFactory.create(parentModule.injector); } else { this._moduleRef = null; } } /** @type {?} */ var componentFactoryResolver = this._moduleRef ? this._moduleRef.componentFactoryResolver : elInjector.get(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ComponentFactoryResolver"]); /** @type {?} */ var componentFactory = componentFactoryResolver.resolveComponentFactory(this.ngComponentOutlet); this._componentRef = this._viewContainerRef.createComponent(componentFactory, this._viewContainerRef.length, elInjector, this.ngComponentOutletContent); } } /** * @return {?} */ }, { key: "ngOnDestroy", value: function ngOnDestroy() { if (this._moduleRef) this._moduleRef.destroy(); } }]); return NgComponentOutlet; }(); NgComponentOutlet.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[ngComponentOutlet]' }] }]; /** @nocollapse */ NgComponentOutlet.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"] }]; }; NgComponentOutlet.propDecorators = { ngComponentOutlet: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], ngComponentOutletInjector: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], ngComponentOutletContent: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], ngComponentOutletNgModuleFactory: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@publicApi * @template T */ var NgForOfContext = /*#__PURE__*/function () { /** * @param {?} $implicit * @param {?} ngForOf * @param {?} index * @param {?} count */ function NgForOfContext($implicit, ngForOf, index, count) { _classCallCheck(this, NgForOfContext); this.$implicit = $implicit; this.ngForOf = ngForOf; this.index = index; this.count = count; } /** * @return {?} */ _createClass2(NgForOfContext, [{ key: "first", get: function get() { return this.index === 0; } /** * @return {?} */ }, { key: "last", get: function get() { return this.index === this.count - 1; } /** * @return {?} */ }, { key: "even", get: function get() { return this.index % 2 === 0; } /** * @return {?} */ }, { key: "odd", get: function get() { return !this.even; } }]); return NgForOfContext; }(); if (false) {} /** * A [structural directive](guide/structural-directives) that renders * a template for each item in a collection. * The directive is placed on an element, which becomes the parent * of the cloned templates. * * The `ngForOf` directive is generally used in the * [shorthand form](guide/structural-directives#the-asterisk--prefix) `*ngFor`. * In this form, the template to be rendered for each iteration is the content * of an anchor element containing the directive. * * The following example shows the shorthand syntax with some options, * contained in an `<li>` element. * * ``` * <li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li> * ``` * * The shorthand form expands into a long form that uses the `ngForOf` selector * on an `<ng-template>` element. * The content of the `<ng-template>` element is the `<li>` element that held the * short-form directive. * * Here is the expanded version of the short-form example. * * ``` * <ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn"> * <li>...</li> * </ng-template> * ``` * * Angular automatically expands the shorthand syntax as it compiles the template. * The context for each embedded view is logically merged to the current component * context according to its lexical position. * * When using the shorthand syntax, Angular allows only [one structural directive * on an element](guide/structural-directives#one-structural-directive-per-host-element). * If you want to iterate conditionally, for example, * put the `*ngIf` on a container element that wraps the `*ngFor` element. * For futher discussion, see * [Structural Directives](guide/structural-directives#one-per-element). * * \@usageNotes * * ### Local variables * * `NgForOf` provides exported values that can be aliased to local variables. * For example: * * ``` * <li *ngFor="let user of userObservable | async as users; index as i; first as isFirst"> * {{i}}/{{users.length}}. {{user}} <span *ngIf="isFirst">default</span> * </li> * ``` * * The following exported values can be aliased to local variables: * * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`). * - `ngForOf: NgIterable<T>`: 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. * * ### 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. * * 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 that are present, such as `<input>` elements that accept user input. Inserted rows can * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state * such as user input. * For more on animations, see [Transitions and Triggers](guide/transition-and-triggers). * * The identities of elements in the iterator can change while the data does not. * This can happen, for example, if the iterator is produced from an RPC to the server, and that * RPC is re-run. Even if the data hasn't changed, the second response produces objects with * different identities, and Angular must tear down the entire DOM and rebuild it (as if all old * elements were deleted and all new elements inserted). * * To avoid this expensive operation, you can customize the default tracking algorithm. * by supplying the `trackBy` option to `NgForOf`. * `trackBy` takes a function that has two arguments: `index` and `item`. * If `trackBy` is given, Angular tracks changes by the return value of the function. * * @see [Structural Directives](guide/structural-directives) * \@ngModule CommonModule * \@publicApi * @template T */ var NgForOf = /*#__PURE__*/function () { /** * @param {?} _viewContainer * @param {?} _template * @param {?} _differs */ function NgForOf(_viewContainer, _template, _differs) { _classCallCheck(this, NgForOf); this._viewContainer = _viewContainer; this._template = _template; this._differs = _differs; this._ngForOfDirty = true; this._differ = null; } /** * The value of the iterable expression, which can be used as a * [template input variable](guide/structural-directives#template-input-variable). * @param {?} ngForOf * @return {?} */ _createClass2(NgForOf, [{ key: "ngDoCheck", /** * Applies the changes when needed. * @return {?} */ value: function ngDoCheck() { if (this._ngForOfDirty) { this._ngForOfDirty = false; // React on ngForOf changes only once all inputs have been initialized /** @type {?} */ var value = this._ngForOf; if (!this._differ && value) { try { this._differ = this._differs.find(value).create(this.ngForTrackBy); } catch (_a) { throw new Error("Cannot find a differ supporting object '".concat(value, "' of type '").concat(getTypeName(value), "'. NgFor only supports binding to Iterables such as Arrays.")); } } } if (this._differ) { /** @type {?} */ var changes = this._differ.diff(this._ngForOf); if (changes) this._applyChanges(changes); } } /** * @private * @param {?} changes * @return {?} */ }, { key: "_applyChanges", value: function _applyChanges(changes) { var _this11 = this; /** @type {?} */ var insertTuples = []; changes.forEachOperation( /** * @param {?} item * @param {?} adjustedPreviousIndex * @param {?} currentIndex * @return {?} */ function (item, adjustedPreviousIndex, currentIndex) { if (item.previousIndex == null) { /** @type {?} */ var view = _this11._viewContainer.createEmbeddedView(_this11._template, new NgForOfContext( /** @type {?} */ null, _this11._ngForOf, -1, -1), currentIndex === null ? undefined : currentIndex); /** @type {?} */ var tuple = new RecordViewTuple(item, view); insertTuples.push(tuple); } else if (currentIndex == null) { _this11._viewContainer.remove(adjustedPreviousIndex === null ? undefined : adjustedPreviousIndex); } else if (adjustedPreviousIndex !== null) { /** @type {?} */ var _view2 = /** @type {?} */ _this11._viewContainer.get(adjustedPreviousIndex); _this11._viewContainer.move(_view2, currentIndex); /** @type {?} */ var _tuple = new RecordViewTuple(item, /** @type {?} */ _view2); insertTuples.push(_tuple); } }); for (var i = 0; i < insertTuples.length; i++) { this._perViewChange(insertTuples[i].view, insertTuples[i].record); } for (var _i3 = 0, ilen = this._viewContainer.length; _i3 < ilen; _i3++) { /** @type {?} */ var viewRef = /** @type {?} */ this._viewContainer.get(_i3); viewRef.context.index = _i3; viewRef.context.count = ilen; viewRef.context.ngForOf = this._ngForOf; } changes.forEachIdentityChange( /** * @param {?} record * @return {?} */ function (record) { /** @type {?} */ var viewRef = /** @type {?} */ _this11._viewContainer.get(record.currentIndex); viewRef.context.$implicit = record.item; }); } /** * @private * @param {?} view * @param {?} record * @return {?} */ }, { key: "_perViewChange", value: function _perViewChange(view, record) { view.context.$implicit = record.item; } /** * Asserts the correct type of the context for the template that `NgForOf` will render. * * The presence of this method is a signal to the Ivy template type-check compiler that the * `NgForOf` structural directive renders its template with a specific context type. * @template T * @param {?} dir * @param {?} ctx * @return {?} */ }, { key: "ngForOf", set: function set(ngForOf) { this._ngForOf = ngForOf; this._ngForOfDirty = true; } /** * A function that defines how to track changes for items in the iterable. * * When items are added, moved, or removed in the iterable, * the directive must re-render the appropriate DOM nodes. * To minimize churn in the DOM, only nodes that have changed * are re-rendered. * * By default, the change detector assumes that * the object instance identifies the node in the iterable. * When this function is supplied, the directive uses * the result of calling this function to identify the item node, * rather than the identity of the object itself. * * The function receives two inputs, * the iteration index and the node object ID. * @param {?} fn * @return {?} */ }, { key: "ngForTrackBy", set: function set(fn) { if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["isDevMode"])() && fn != null && typeof fn !== 'function') { // TODO(vicb): use a log service once there is a public one available if ( /** @type {?} */ console && /** @type {?} */ console.warn) { console.warn("trackBy must be a function, but received ".concat(JSON.stringify(fn), ". ") + "See https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html#!#change-propagation for more information."); } } this._trackByFn = fn; } /** * @return {?} */ , get: function get() { return this._trackByFn; } /** * A reference to the template that is stamped out for each item in the iterable. * @see [template reference variable](guide/template-syntax#template-reference-variables--var-) * @param {?} value * @return {?} */ }, { key: "ngForTemplate", set: function set(value) { // TODO(TS2.1): make TemplateRef<Partial<NgForRowOf<T>>> 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; } } }], [{ key: "ngTemplateContextGuard", value: function ngTemplateContextGuard(dir, ctx) { return true; } }]); return NgForOf; }(); NgForOf.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[ngFor][ngForOf]' }] }]; /** @nocollapse */ NgForOf.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["IterableDiffers"] }]; }; NgForOf.propDecorators = { ngForOf: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], ngForTrackBy: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], ngForTemplate: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; if (false) {} /** * @template T */ var RecordViewTuple = /** * @param {?} record * @param {?} view */ function RecordViewTuple(record, view) { _classCallCheck(this, RecordViewTuple); this.record = record; this.view = view; }; if (false) {} /** * @param {?} type * @return {?} */ function getTypeName(type) { return type['name'] || typeof type; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A structural directive that conditionally includes a template based on the value of * an expression coerced to Boolean. * When the expression evaluates to true, Angular renders the template * provided in a `then` clause, and when false or null, * Angular renders the template provided in an optional `else` clause. The default * template for the `else` clause is blank. * * A [shorthand form](guide/structural-directives#the-asterisk--prefix) of the directive, * `*ngIf="condition"`, is generally used, provided * as an attribute of the anchor element for the inserted template. * Angular expands this into a more explicit version, in which the anchor element * is contained in an `<ng-template>` element. * * Simple form with shorthand syntax: * * ``` * <div *ngIf="condition">Content to render when condition is true.</div> * ``` * * Simple form with expanded syntax: * * ``` * <ng-template [ngIf]="condition"><div>Content to render when condition is * true.</div></ng-template> * ``` * * Form with an "else" block: * * ``` * <div *ngIf="condition; else elseBlock">Content to render when condition is true.</div> * <ng-template #elseBlock>Content to render when condition is false.</ng-template> * ``` * * Shorthand form with "then" and "else" blocks: * * ``` * <div *ngIf="condition; then thenBlock else elseBlock"></div> * <ng-template #thenBlock>Content to render when condition is true.</ng-template> * <ng-template #elseBlock>Content to render when condition is false.</ng-template> * ``` * * Form with storing the value locally: * * ``` * <div *ngIf="condition as value; else elseBlock">{{value}}</div> * <ng-template #elseBlock>Content to render when value is null.</ng-template> * ``` * * \@usageNotes * * The `*ngIf` directive is most commonly used to conditionally show an inline template, * as seen in the following example. * The default `else` template is blank. * * {\@example common/ngIf/ts/module.ts region='NgIfSimple'} * * ### Showing an alternative template using `else` * * To display a template when `expression` evaluates to false, use an `else` template * binding as shown in the following example. * The `else` binding points to an `<ng-template>` element 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 an external `then` template * * In the previous example, the then-clause template is specified inline, as the content of the * tag that contains the `ngIf` directive. You can also specify a template that is defined * externally, by referencing a labeled `<ng-template>` element. When you do this, you can * change which template to use at runtime, as shown in the following example. * * {\@example common/ngIf/ts/module.ts region='NgIfThenElse'} * * ### Storing a conditional result in a variable * * You might want to show a set of properties from the same object. If you are waiting * for asynchronous data, the object can be undefined. * In this case, you can use `ngIf` and store the result of the condition in a local * variable as shown in the the following example. * * {\@example common/ngIf/ts/module.ts region='NgIfAs'} * * This code uses only one `AsyncPipe`, so only one subscription is created. * The conditional statement stores the result of `userStream|async` in the local variable `user`. * You can then bind the local `user` repeatedly. * * The conditional displays the data only if `userStream` returns a value, * so you don't need to use the * [safe-navigation-operator](guide/template-syntax#safe-navigation-operator) (`?.`) * to guard against null values when accessing properties. * You can display an alternative template while waiting for the data. * * ### Shorthand syntax * * The shorthand syntax `*ngIf` expands into two separate template specifications * for the "then" and "else" clauses. For example, consider the following shorthand statement, * that is meant to show a loading page while waiting for data to be loaded. * * ``` * <div class="hero-list" *ngIf="heroes else loading"> * ... * </div> * * <ng-template #loading> * <div>Loading...</div> * </ng-template> * ``` * * You can see that the "else" clause references the `<ng-template>` * with the `#loading` label, and the template for the "then" clause * is provided as the content of the anchor element. * * However, when Angular expands the shorthand syntax, it creates * another `<ng-template>` tag, with `ngIf` and `ngIfElse` directives. * The anchor element containing the template for the "then" clause becomes * the content of this unlabeled `<ng-template>` tag. * * ``` * <ng-template [ngIf]="hero-list" [ngIfElse]="loading"> * <div class="hero-list"> * ... * </div> * </ng-template> * * <ng-template #loading> * <div>Loading...</div> * </ng-template> * ``` * * The presence of the implicit template object has implications for the nesting of * structural directives. For more on this subject, see * [Structural Directives](https://angular.io/guide/structural-directives#one-per-element). * * \@ngModule CommonModule * \@publicApi */ var NgIf = /*#__PURE__*/function () { /** * @param {?} _viewContainer * @param {?} templateRef */ function NgIf(_viewContainer, templateRef) { _classCallCheck(this, NgIf); this._viewContainer = _viewContainer; this._context = new NgIfContext(); this._thenTemplateRef = null; this._elseTemplateRef = null; this._thenViewRef = null; this._elseViewRef = null; this._thenTemplateRef = templateRef; } /** * The Boolean expression to evaluate as the condition for showing a template. * @param {?} condition * @return {?} */ _createClass2(NgIf, [{ key: "_updateView", /** * @private * @return {?} */ value: function _updateView() { 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); } } } } }, { key: "ngIf", set: function set(condition) { this._context.$implicit = this._context.ngIf = condition; this._updateView(); } /** * A template to show if the condition expression evaluates to true. * @param {?} templateRef * @return {?} */ }, { key: "ngIfThen", set: function set(templateRef) { assertTemplate('ngIfThen', templateRef); this._thenTemplateRef = templateRef; this._thenViewRef = null; // clear previous view if any. this._updateView(); } /** * A template to show if the condition expression evaluates to false. * @param {?} templateRef * @return {?} */ }, { key: "ngIfElse", set: function set(templateRef) { assertTemplate('ngIfElse', templateRef); this._elseTemplateRef = templateRef; this._elseViewRef = null; // clear previous view if any. this._updateView(); } }]); return NgIf; }(); NgIf.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[ngIf]' }] }]; /** @nocollapse */ NgIf.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"] }]; }; NgIf.propDecorators = { ngIf: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], ngIfThen: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], ngIfElse: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; if (false) {} /** * \@publicApi */ var NgIfContext = function NgIfContext() { _classCallCheck(this, NgIfContext); this.$implicit = null; this.ngIf = null; }; if (false) {} /** * @param {?} property * @param {?} templateRef * @return {?} */ function assertTemplate(property, templateRef) { /** @type {?} */ var isTemplateRefOrNull = !!(!templateRef || templateRef.createEmbeddedView); if (!isTemplateRefOrNull) { throw new Error("".concat(property, " must be a TemplateRef, but received '").concat(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵstringify"])(templateRef), "'.")); } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var SwitchView = /*#__PURE__*/function () { /** * @param {?} _viewContainerRef * @param {?} _templateRef */ function SwitchView(_viewContainerRef, _templateRef) { _classCallCheck(this, SwitchView); this._viewContainerRef = _viewContainerRef; this._templateRef = _templateRef; this._created = false; } /** * @return {?} */ _createClass2(SwitchView, [{ key: "create", value: function create() { this._created = true; this._viewContainerRef.createEmbeddedView(this._templateRef); } /** * @return {?} */ }, { key: "destroy", value: function destroy() { this._created = false; this._viewContainerRef.clear(); } /** * @param {?} created * @return {?} */ }, { key: "enforceState", value: function enforceState(created) { if (created && !this._created) { this.create(); } else if (!created && this._created) { this.destroy(); } } }]); return SwitchView; }(); if (false) {} /** * \@ngModule CommonModule * * \@description A structural directive that adds or removes templates (displaying or hiding views) * when the next match expression matches the switch expression. * * The `[ngSwitch]` directive on a container specifies an expression to match against. * The expressions to match are provided by `ngSwitchCase` directives on views within the container. * - Every view that matches is rendered. * - If there are no matches, a view with the `ngSwitchDefault` directive is rendered. * - Elements within the `[NgSwitch]` statement but outside of any `NgSwitchCase` * or `ngSwitchDefault` directive are preserved at the location. * * \@usageNotes * Define a container element for the directive, and specify the switch expression * to match against as an attribute: * * ``` * <container-element [ngSwitch]="switch_expression"> * ``` * * Within the container, `*ngSwitchCase` statements specify the match expressions * as attributes. Include `*ngSwitchDefault` as the final case. * * ``` * <container-element [ngSwitch]="switch_expression"> * <some-element *ngSwitchCase="match_expression_1">...</some-element> * ... * <some-element *ngSwitchDefault>...</some-element> * </container-element> * ``` * * ### Usage Examples * * The following example shows how to use more than one case to display the same view: * * ``` * <container-element [ngSwitch]="switch_expression"> * <!-- the same view can be shown in more than one case --> * <some-element *ngSwitchCase="match_expression_1">...</some-element> * <some-element *ngSwitchCase="match_expression_2">...</some-element> * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element> * <!--default case when there are no matches --> * <some-element *ngSwitchDefault>...</some-element> * </container-element> * ``` * * The following example shows how cases can be nested: * ``` * <container-element [ngSwitch]="switch_expression"> * <some-element *ngSwitchCase="match_expression_1">...</some-element> * <some-element *ngSwitchCase="match_expression_2">...</some-element> * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element> * <ng-container *ngSwitchCase="match_expression_3"> * <!-- use a ng-container to group multiple root nodes --> * <inner-element></inner-element> * <inner-other-element></inner-other-element> * </ng-container> * <some-element *ngSwitchDefault>...</some-element> * </container-element> * ``` * * \@publicApi * @see `NgSwitchCase` * @see `NgSwitchDefault` * @see [Structural Directives](guide/structural-directives) * */ var NgSwitch = /*#__PURE__*/function () { function NgSwitch() { _classCallCheck(this, NgSwitch); this._defaultUsed = false; this._caseCount = 0; this._lastCaseCheckIndex = 0; this._lastCasesMatched = false; } /** * @param {?} newValue * @return {?} */ _createClass2(NgSwitch, [{ key: "_addCase", /** * \@internal * @return {?} */ value: function _addCase() { return this._caseCount++; } /** * \@internal * @param {?} view * @return {?} */ }, { key: "_addDefault", value: function _addDefault(view) { if (!this._defaultViews) { this._defaultViews = []; } this._defaultViews.push(view); } /** * \@internal * @param {?} value * @return {?} */ }, { key: "_matchCase", value: function _matchCase(value) { /** @type {?} */ var 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; } /** * @private * @param {?} useDefault * @return {?} */ }, { key: "_updateDefaultCases", value: function _updateDefaultCases(useDefault) { if (this._defaultViews && useDefault !== this._defaultUsed) { this._defaultUsed = useDefault; for (var i = 0; i < this._defaultViews.length; i++) { /** @type {?} */ var defaultView = this._defaultViews[i]; defaultView.enforceState(useDefault); } } } }, { key: "ngSwitch", set: function set(newValue) { this._ngSwitch = newValue; if (this._caseCount === 0) { this._updateDefaultCases(true); } } }]); return NgSwitch; }(); NgSwitch.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[ngSwitch]' }] }]; NgSwitch.propDecorators = { ngSwitch: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; if (false) {} /** * \@ngModule CommonModule * * \@description * Provides a switch case expression to match against an enclosing `ngSwitch` expression. * When the expressions match, the given `NgSwitchCase` template is rendered. * If multiple match expressions match the switch expression value, all of them are displayed. * * \@usageNotes * * Within a switch container, `*ngSwitchCase` statements specify the match expressions * as attributes. Include `*ngSwitchDefault` as the final case. * * ``` * <container-element [ngSwitch]="switch_expression"> * <some-element *ngSwitchCase="match_expression_1">...</some-element> * ... * <some-element *ngSwitchDefault>...</some-element> * </container-element> * ``` * * Each switch-case statement contains an in-line HTML template or template reference * that defines the subtree to be selected if the value of the match expression * matches the value of the switch expression. * * Unlike JavaScript, which uses strict equality, Angular uses loose equality. * This means that the empty string, `""` matches 0. * * \@publicApi * @see `NgSwitch` * @see `NgSwitchDefault` * */ var NgSwitchCase = /*#__PURE__*/function () { /** * @param {?} viewContainer * @param {?} templateRef * @param {?} ngSwitch */ function NgSwitchCase(viewContainer, templateRef, ngSwitch) { _classCallCheck(this, NgSwitchCase); this.ngSwitch = ngSwitch; ngSwitch._addCase(); this._view = new SwitchView(viewContainer, templateRef); } /** * Performs case matching. For internal use only. * @return {?} */ _createClass2(NgSwitchCase, [{ key: "ngDoCheck", value: function ngDoCheck() { this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase)); } }]); return NgSwitchCase; }(); NgSwitchCase.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[ngSwitchCase]' }] }]; /** @nocollapse */ NgSwitchCase.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"] }, { type: NgSwitch, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Host"] }] }]; }; NgSwitchCase.propDecorators = { ngSwitchCase: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; if (false) {} /** * \@ngModule CommonModule * * \@description * * Creates a view that is rendered when no `NgSwitchCase` expressions * match the `NgSwitch` expression. * This statement should be the final case in an `NgSwitch`. * * \@publicApi * @see `NgSwitch` * @see `NgSwitchCase` * */ var NgSwitchDefault = /** * @param {?} viewContainer * @param {?} templateRef * @param {?} ngSwitch */ function NgSwitchDefault(viewContainer, templateRef, ngSwitch) { _classCallCheck(this, NgSwitchDefault); ngSwitch._addDefault(new SwitchView(viewContainer, templateRef)); }; NgSwitchDefault.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[ngSwitchDefault]' }] }]; /** @nocollapse */ NgSwitchDefault.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"] }, { type: NgSwitch, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Host"] }] }]; }; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@ngModule CommonModule * * \@usageNotes * ``` * <some-element [ngPlural]="value"> * <ng-template ngPluralCase="=0">there is nothing</ng-template> * <ng-template ngPluralCase="=1">there is one</ng-template> * <ng-template ngPluralCase="few">there are a few</ng-template> * </some-element> * ``` * * \@description * * Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization. * * 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 * * \@publicApi */ var NgPlural = /*#__PURE__*/function () { /** * @param {?} _localization */ function NgPlural(_localization) { _classCallCheck(this, NgPlural); this._localization = _localization; this._caseViews = {}; } /** * @param {?} value * @return {?} */ _createClass2(NgPlural, [{ key: "addCase", /** * @param {?} value * @param {?} switchView * @return {?} */ value: function addCase(value, switchView) { this._caseViews[value] = switchView; } /** * @private * @return {?} */ }, { key: "_updateView", value: function _updateView() { this._clearViews(); /** @type {?} */ var cases = Object.keys(this._caseViews); /** @type {?} */ var key = getPluralCategory(this._switchValue, cases, this._localization); this._activateView(this._caseViews[key]); } /** * @private * @return {?} */ }, { key: "_clearViews", value: function _clearViews() { if (this._activeView) this._activeView.destroy(); } /** * @private * @param {?} view * @return {?} */ }, { key: "_activateView", value: function _activateView(view) { if (view) { this._activeView = view; this._activeView.create(); } } }, { key: "ngPlural", set: function set(value) { this._switchValue = value; this._updateView(); } }]); return NgPlural; }(); NgPlural.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[ngPlural]' }] }]; /** @nocollapse */ NgPlural.ctorParameters = function () { return [{ type: NgLocalization }]; }; NgPlural.propDecorators = { ngPlural: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; if (false) {} /** * \@ngModule CommonModule * * \@description * * 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. * * \@usageNotes * ``` * <some-element [ngPlural]="value"> * <ng-template ngPluralCase="=0">...</ng-template> * <ng-template ngPluralCase="other">...</ng-template> * </some-element> * ``` * * See {\@link NgPlural} for more details and example. * * \@publicApi */ var NgPluralCase = /** * @param {?} value * @param {?} template * @param {?} viewContainer * @param {?} ngPlural */ function NgPluralCase(value, template, viewContainer, ngPlural) { _classCallCheck(this, NgPluralCase); this.value = value; /** @type {?} */ var isANumber = !isNaN(Number(value)); ngPlural.addCase(isANumber ? "=".concat(value) : value, new SwitchView(viewContainer, template)); }; NgPluralCase.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[ngPluralCase]' }] }]; /** @nocollapse */ NgPluralCase.ctorParameters = function () { return [{ type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Attribute"], args: ['ngPluralCase'] }] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"] }, { type: NgPlural, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Host"] }] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Used as a token for an injected service within the NgStyle directive. * * NgStyle behaves differenly whether or not VE is being used or not. If * present then the legacy ngClass diffing algorithm will be used as an * injected service. Otherwise the new diffing algorithm (which delegates * to the `[style]` binding) will be used. This toggle behavior is done so * via the ivy_switch mechanism. * @abstract */ var NgStyleImpl = function NgStyleImpl() { _classCallCheck(this, NgStyleImpl); }; if (false) {} var NgStyleR2Impl = /*#__PURE__*/function () { /** * @param {?} _ngEl * @param {?} _differs * @param {?} _renderer */ function NgStyleR2Impl(_ngEl, _differs, _renderer) { _classCallCheck(this, NgStyleR2Impl); this._ngEl = _ngEl; this._differs = _differs; this._renderer = _renderer; } /** * @return {?} */ _createClass2(NgStyleR2Impl, [{ key: "getValue", value: function getValue() { return null; } /** * A map of style properties, specified as colon-separated * key-value pairs. * * The key is a style name, with an optional `.<unit>` suffix * (such as 'top.px', 'font-style.em'). * * The value is an expression to be evaluated. * @param {?} values * @return {?} */ }, { key: "setNgStyle", value: function setNgStyle(values) { this._ngStyle = values; if (!this._differ && values) { this._differ = this._differs.find(values).create(); } } /** * Applies the new styles if needed. * @return {?} */ }, { key: "applyChanges", value: function applyChanges() { if (this._differ) { /** @type {?} */ var changes = this._differ.diff(this._ngStyle); if (changes) { this._applyChanges(changes); } } } /** * @private * @param {?} changes * @return {?} */ }, { key: "_applyChanges", value: function _applyChanges(changes) { var _this12 = this; changes.forEachRemovedItem( /** * @param {?} record * @return {?} */ function (record) { return _this12._setStyle(record.key, null); }); changes.forEachAddedItem( /** * @param {?} record * @return {?} */ function (record) { return _this12._setStyle(record.key, record.currentValue); }); changes.forEachChangedItem( /** * @param {?} record * @return {?} */ function (record) { return _this12._setStyle(record.key, record.currentValue); }); } /** * @private * @param {?} nameAndUnit * @param {?} value * @return {?} */ }, { key: "_setStyle", value: function _setStyle(nameAndUnit, value) { var _nameAndUnit$split = nameAndUnit.split('.'), _nameAndUnit$split2 = _slicedToArray(_nameAndUnit$split, 2), name = _nameAndUnit$split2[0], unit = _nameAndUnit$split2[1]; value = value != null && unit ? "".concat(value).concat(unit) : value; if (value != null) { this._renderer.setStyle(this._ngEl.nativeElement, name, /** @type {?} */ value); } else { this._renderer.removeStyle(this._ngEl.nativeElement, name); } } }]); return NgStyleR2Impl; }(); NgStyleR2Impl.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; /** @nocollapse */ NgStyleR2Impl.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["KeyValueDiffers"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"] }]; }; if (false) {} var NgStyleR3Impl = /*#__PURE__*/function () { function NgStyleR3Impl() { _classCallCheck(this, NgStyleR3Impl); this._differ = new StylingDiffer('NgStyle', 8 /* AllowUnits */ ); this._value = null; } /** * @return {?} */ _createClass2(NgStyleR3Impl, [{ key: "getValue", value: function getValue() { return this._value; } /** * @param {?} value * @return {?} */ }, { key: "setNgStyle", value: function setNgStyle(value) { this._differ.setValue(value); } /** * @return {?} */ }, { key: "applyChanges", value: function applyChanges() { if (this._differ.hasValueChanged()) { this._value = this._differ.value; } } }]); return NgStyleR3Impl; }(); NgStyleR3Impl.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; if (false) {} // the implementation for both NgClassR2Impl and NgClassR3Impl are // not ivy_switch'd away, instead they are only hooked up into the // DI via NgStyle's directive's provider property. /** @type {?} */ var NgStyleImplProvider__PRE_R3__ = { provide: NgStyleImpl, useClass: NgStyleR2Impl }; /** @type {?} */ var NgStyleImplProvider__POST_R3__ = { provide: NgStyleImpl, useClass: NgStyleR3Impl }; /** @type {?} */ var NgStyleImplProvider = NgStyleImplProvider__PRE_R3__; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /* * NgStyle (as well as NgClass) behaves differently when loaded in the VE and when not. * * If the VE is present (which is for older versions of Angular) then NgStyle will inject * the legacy diffing algorithm as a service and delegate all styling changes to that. * * If the VE is not present then NgStyle will normalize (through the injected service) and * then write all styling changes to the `[style]` binding directly (through a host binding). * Then Angular will notice the host binding change and treat the changes as styling * changes and apply them via the core styling instructions that exist within Angular. */ // used when the VE is present /** @type {?} */ var ngStyleDirectiveDef__PRE_R3__ = undefined; // used when the VE is not present (note the directive will // never be instantiated normally because it is apart of a // base class) var ɵ0$1 = /** * @return {?} */ function ɵ0$1() {}, ɵ1$1 = /** * @return {?} */ function ɵ1$1() {}, ɵ2$1 = /** * @param {?} rf * @param {?} ctx * @param {?} elIndex * @return {?} */ function ɵ2$1(rf, ctx, elIndex) { if (rf & 1 /* Create */ ) { Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵstyling"])(); } if (rf & 2 /* Update */ ) { Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵstyleMap"])(ctx.getValue()); Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵstylingApply"])(); } }; /** @type {?} */ var ngStyleDirectiveDef__POST_R3__ = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineDirective"])({ type: /** @type {?} */ ɵ0$1, selectors: /** @type {?} */ null, factory: ɵ1$1, hostBindings: ɵ2$1 }); /** @type {?} */ var ngStyleDirectiveDef = ngStyleDirectiveDef__PRE_R3__; /** * Serves as the base non-VE container for NgStyle. * * While this is a base class that NgStyle extends from, the * class itself acts as a container for non-VE code to setup * a link to the `[style]` host binding (via the static * `ngDirectiveDef` property on the class). * * Note that the `ngDirectiveDef` property's code is switched * depending if VE is present or not (this allows for the * binding code to be set only for newer versions of Angular). * * \@publicApi */ var NgStyleBase = /*#__PURE__*/function () { /** * @param {?} _delegate */ function NgStyleBase(_delegate) { _classCallCheck(this, NgStyleBase); this._delegate = _delegate; } /** * @return {?} */ _createClass2(NgStyleBase, [{ key: "getValue", value: function getValue() { return this._delegate.getValue(); } }]); return NgStyleBase; }(); /** @nocollapse */ NgStyleBase.ngDirectiveDef = ngStyleDirectiveDef; if (false) {} /** * \@ngModule CommonModule * * \@usageNotes * * Set the font of the containing element to the result of an expression. * * ``` * <some-element [ngStyle]="{'font-style': styleExp}">...</some-element> * ``` * * Set the width of the containing element to a pixel value returned by an expression. * * ``` * <some-element [ngStyle]="{'max-width.px': widthExp}">...</some-element> * ``` * * Set a collection of style values using an expression that returns key-value pairs. * * ``` * <some-element [ngStyle]="objExp">...</some-element> * ``` * * \@description * * An attribute directive that updates styles for the containing HTML element. * Sets one or more style properties, specified as colon-separated key-value pairs. * The key is a style name, with an optional `.<unit>` suffix * (such as 'top.px', 'font-style.em'). * The value is an expression to be evaluated. * The resulting non-null value, expressed in the given unit, * is assigned to the given style property. * If the result of evaluation is null, the corresponding style is removed. * * \@publicApi */ var NgStyle = /*#__PURE__*/function (_NgStyleBase) { _inherits(NgStyle, _NgStyleBase); var _super5 = _createSuper(NgStyle); /** * @param {?} delegate */ function NgStyle(delegate) { _classCallCheck(this, NgStyle); return _super5.call(this, delegate); } /** * @param {?} value * @return {?} */ _createClass2(NgStyle, [{ key: "ngDoCheck", /** * @return {?} */ value: function ngDoCheck() { this._delegate.applyChanges(); } }, { key: "ngStyle", set: function set(value) { this._delegate.setNgStyle(value); } }]); return NgStyle; }(NgStyleBase); NgStyle.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[ngStyle]', providers: [NgStyleImplProvider] }] }]; /** @nocollapse */ NgStyle.ctorParameters = function () { return [{ type: NgStyleImpl }]; }; NgStyle.propDecorators = { ngStyle: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['ngStyle'] }] }; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@ngModule CommonModule * * \@description * * Inserts an embedded view from a prepared `TemplateRef`. * * 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. * * \@usageNotes * ``` * <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container> * ``` * * Using the key `$implicit` in the context object will set its value as default. * * ### Example * * {\@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'} * * \@publicApi */ var NgTemplateOutlet = /*#__PURE__*/function () { /** * @param {?} _viewContainerRef */ function NgTemplateOutlet(_viewContainerRef) { _classCallCheck(this, NgTemplateOutlet); this._viewContainerRef = _viewContainerRef; this._viewRef = null; /** * A context object to attach to the {\@link EmbeddedViewRef}. This should be an * object, the object's keys will be available for binding by the local template `let` * declarations. * Using the key `$implicit` in the context object will set its value as default. */ this.ngTemplateOutletContext = null; /** * A string defining the template reference and optionally the context object for the template. */ this.ngTemplateOutlet = null; } /** * @param {?} changes * @return {?} */ _createClass2(NgTemplateOutlet, [{ key: "ngOnChanges", value: function ngOnChanges(changes) { /** @type {?} */ var recreateView = this._shouldRecreateView(changes); if (recreateView) { if (this._viewRef) { this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._viewRef)); } if (this.ngTemplateOutlet) { this._viewRef = this._viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, this.ngTemplateOutletContext); } } else { if (this._viewRef && this.ngTemplateOutletContext) { this._updateExistingContext(this.ngTemplateOutletContext); } } } /** * We need to re-create existing embedded view if: * - templateRef has changed * - context has changes * * We mark context object as changed when the corresponding object * shape changes (new properties are added or existing properties are removed). * In other words we consider context with the same properties as "the same" even * if object reference changes (see https://github.com/angular/angular/issues/13407). * @private * @param {?} changes * @return {?} */ }, { key: "_shouldRecreateView", value: function _shouldRecreateView(changes) { /** @type {?} */ var ctxChange = changes['ngTemplateOutletContext']; return !!changes['ngTemplateOutlet'] || ctxChange && this._hasContextShapeChanged(ctxChange); } /** * @private * @param {?} ctxChange * @return {?} */ }, { key: "_hasContextShapeChanged", value: function _hasContextShapeChanged(ctxChange) { /** @type {?} */ var prevCtxKeys = Object.keys(ctxChange.previousValue || {}); /** @type {?} */ var currCtxKeys = Object.keys(ctxChange.currentValue || {}); if (prevCtxKeys.length === currCtxKeys.length) { var _iterator2 = _createForOfIteratorHelper(currCtxKeys), _step2; try { for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { var propName = _step2.value; if (prevCtxKeys.indexOf(propName) === -1) { return true; } } } catch (err) { _iterator2.e(err); } finally { _iterator2.f(); } return false; } else { return true; } } /** * @private * @param {?} ctx * @return {?} */ }, { key: "_updateExistingContext", value: function _updateExistingContext(ctx) { for (var _i4 = 0, _Object$keys = Object.keys(ctx); _i4 < _Object$keys.length; _i4++) { var propName = _Object$keys[_i4]; /** @type {?} */ /** @type {?} */ this._viewRef.context[propName] = /** @type {?} */ this.ngTemplateOutletContext[propName]; } } }]); return NgTemplateOutlet; }(); NgTemplateOutlet.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[ngTemplateOutlet]' }] }]; /** @nocollapse */ NgTemplateOutlet.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"] }]; }; NgTemplateOutlet.propDecorators = { ngTemplateOutletContext: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], ngTemplateOutlet: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A collection of Angular directives that are likely to be used in each and every Angular * application. * @type {?} */ var COMMON_DIRECTIVES = [NgClass, NgComponentOutlet, NgForOf, NgIf, NgTemplateOutlet, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgPlural, NgPluralCase]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} type * @param {?} value * @return {?} */ function invalidPipeArgumentError(type, value) { return Error("InvalidPipeArgument: '".concat(value, "' for pipe '").concat(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵstringify"])(type), "'")); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NumberFormatter = /*#__PURE__*/function () { function NumberFormatter() { _classCallCheck(this, NumberFormatter); } _createClass2(NumberFormatter, null, [{ key: "format", /** * @param {?} num * @param {?} locale * @param {?} style * @param {?=} opts * @return {?} */ value: function format(num, locale, style) { var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; var minimumIntegerDigits = opts.minimumIntegerDigits, minimumFractionDigits = opts.minimumFractionDigits, maximumFractionDigits = opts.maximumFractionDigits, currency = opts.currency, _opts$currencyAsSymbo = opts.currencyAsSymbol, currencyAsSymbol = _opts$currencyAsSymbo === void 0 ? false : _opts$currencyAsSymbo; /** @type {?} */ var 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; }(); /** @type {?} */ var DATE_FORMATS_SPLIT$1 = /((?:[^yMLdHhmsazZEwGjJ']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|J+|j+|m+|s+|a|z|Z|G+|w+))(.*)/; /** @type {?} */ 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)])) }; /** @type {?} */ var DATE_FORMATS$1 = { // 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$1('short'), 'z': timeZoneGetter$1('long'), 'ww': datePartGetterFactory({}), // Week of year, padded (00-53). Week 01 is the week with the // first Thursday of the year. not support ? 'w': datePartGetterFactory({}), // Week of year (0-53). Week 1 is the week with the first Thursday // 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 ( /** * @param {?} date * @param {?} locale * @return {?} */ function (date, locale) { /** @type {?} */ var result = inner(date, locale); return result.length == 1 ? '0' + result : result; } ); } /** * @param {?} inner * @return {?} */ function hourClockExtractor(inner) { return ( /** * @param {?} date * @param {?} locale * @return {?} */ function (date, locale) { return inner(date, locale).split(' ')[1]; } ); } /** * @param {?} inner * @return {?} */ function hourExtractor(inner) { return ( /** * @param {?} date * @param {?} locale * @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$1(timezone) { // To workaround `Intl` API restriction for single timezone let format with 24 hours /** @type {?} */ var options = { hour: '2-digit', hour12: false, timeZoneName: timezone }; return ( /** * @param {?} date * @param {?} locale * @return {?} */ function (date, locale) { /** @type {?} */ var 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) { /** @type {?} */ var result = {}; result[prop] = len === 2 ? '2-digit' : 'numeric'; return result; } /** * @param {?} prop * @param {?} len * @return {?} */ function nameCondition(prop, len) { /** @type {?} */ var result = {}; if (len < 4) { result[prop] = len > 1 ? 'short' : 'narrow'; } else { result[prop] = 'long'; } return result; } /** * @param {?} options * @return {?} */ function combine(options) { return options.reduce( /** * @param {?} merged * @param {?} opt * @return {?} */ function (merged, opt) { return Object.assign({}, merged, opt); }, {}); } /** * @param {?} ret * @return {?} */ function datePartGetterFactory(ret) { return ( /** * @param {?} date * @param {?} locale * @return {?} */ function (date, locale) { return intlDateFormat(date, locale, ret); } ); } /** @type {?} */ var DATE_FORMATTER_CACHE = new Map(); /** * @param {?} format * @param {?} date * @param {?} locale * @return {?} */ function dateFormatter(format, date, locale) { /** @type {?} */ var fn = PATTERN_ALIASES[format]; if (fn) return fn(date, locale); /** @type {?} */ var cacheKey = format; /** @type {?} */ var parts = DATE_FORMATTER_CACHE.get(cacheKey); if (!parts) { parts = []; /** @type {?} */ var match; DATE_FORMATS_SPLIT$1.exec(format); /** @type {?} */ var _format = format; while (_format) { match = DATE_FORMATS_SPLIT$1.exec(_format); if (match) { parts = parts.concat(match.slice(1)); _format = /** @type {?} */ parts.pop(); } else { parts.push(_format); _format = null; } } DATE_FORMATTER_CACHE.set(cacheKey, parts); } return parts.reduce( /** * @param {?} text * @param {?} part * @return {?} */ function (text, part) { /** @type {?} */ var fn = DATE_FORMATS$1[part]; return text + (fn ? fn(date, locale) : partToTime(part)); }, ''); } /** * @param {?} part * @return {?} */ function partToTime(part) { return part === '\'\'' ? '\'' : part.replace(/(^'|'$)/g, '').replace(/''/g, '\''); } var DateFormatter = /*#__PURE__*/function () { function DateFormatter() { _classCallCheck(this, DateFormatter); } _createClass2(DateFormatter, null, [{ key: "format", /** * @param {?} date * @param {?} locale * @param {?} pattern * @return {?} */ value: function format(date, locale, pattern) { return dateFormatter(pattern, date, locale); } }]); return DateFormatter; }(); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@ngModule CommonModule * \@description * * Formats a date according to locale rules. * * 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. * * \@usageNotes * * ### Examples * * Assuming `dateObj` is (year: 2010, month: 9, day: 3, hour: 12 PM, minute: 05, second: 08) * in the _local_ time and locale is 'en-US': * * {\@example common/pipes/ts/date_pipe.ts region='DeprecatedDatePipe'} * * \@publicApi */ var DeprecatedDatePipe = /*#__PURE__*/function () { /** * @param {?} _locale */ function DeprecatedDatePipe(_locale) { _classCallCheck(this, DeprecatedDatePipe); this._locale = _locale; } /** * @param {?} value * @param {?=} pattern * @return {?} */ _createClass2(DeprecatedDatePipe, [{ key: "transform", value: function transform(value) { var pattern = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'mediumDate'; if (value == null || value === '' || value !== value) return null; /** @type {?} */ var date; if (typeof value === 'string') { value = value.trim(); } if (isDate$1(value)) { date = value; } else if (!isNaN(value - parseFloat(value))) { date = new Date(parseFloat(value)); } else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) { /** * For ISO Strings without time the day, month and year must be extracted from the ISO String * before Date creation to avoid time offset and errors in the new Date. * If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new * date, some browsers (e.g. IE 9) will throw an invalid Date error * If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the * timeoffset * is applied * Note: ISO months are 0 for January, 1 for February, ... */ var _value$split$map3 = value.split('-').map( /** * @param {?} val * @return {?} */ function (val) { return parseInt(val, 10); }), _value$split$map4 = _slicedToArray(_value$split$map3, 3), y = _value$split$map4[0], m = _value$split$map4[1], d = _value$split$map4[2]; date = new Date(y, m - 1, d); } else { date = new Date(value); } if (!isDate$1(date)) { /** @type {?} */ var match; if (typeof value === 'string' && (match = value.match(ISO8601_DATE_REGEX))) { date = isoStringToDate(match); } else { throw invalidPipeArgumentError(DeprecatedDatePipe, value); } } return DateFormatter.format(date, this._locale, DeprecatedDatePipe._ALIASES[pattern] || pattern); } }]); return DeprecatedDatePipe; }(); /** * \@internal */ DeprecatedDatePipe._ALIASES = { 'medium': 'yMMMdjms', 'short': 'yMdjm', 'fullDate': 'yMMMMEEEEd', 'longDate': 'yMMMMd', 'mediumDate': 'yMMMd', 'shortDate': 'yMd', 'mediumTime': 'jms', 'shortTime': 'jm' }; DeprecatedDatePipe.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'date', pure: true }] }]; /** @nocollapse */ DeprecatedDatePipe.ctorParameters = function () { return [{ type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"]] }] }]; }; if (false) {} /** * @param {?} value * @return {?} */ function isDate$1(value) { return value instanceof Date && !isNaN(value.valueOf()); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} pipe * @param {?} locale * @param {?} value * @param {?} style * @param {?=} digits * @param {?=} currency * @param {?=} currencyAsSymbol * @return {?} */ function formatNumber$1(pipe, locale, value, style, digits) { var currency = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null; var currencyAsSymbol = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false; if (value == null) return null; // Convert strings to numbers value = typeof value === 'string' && !isNaN(+value - parseFloat(value)) ? +value : value; if (typeof value !== 'number') { throw invalidPipeArgumentError(pipe, value); } /** @type {?} */ var minInt; /** @type {?} */ var minFraction; /** @type {?} */ var maxFraction; if (style !== NumberFormatStyle.Currency) { // rely on Intl default for currency minInt = 1; minFraction = 0; maxFraction = 3; } if (digits) { /** @type {?} */ var parts = digits.match(NUMBER_FORMAT_REGEXP); if (parts === null) { throw new Error("".concat(digits, " is not a valid digit info for number pipes")); } if (parts[1] != null) { // min integer digits minInt = parseIntAutoRadix(parts[1]); } if (parts[3] != null) { // min fraction digits minFraction = parseIntAutoRadix(parts[3]); } if (parts[5] != null) { // max fraction digits maxFraction = parseIntAutoRadix(parts[5]); } } return NumberFormatter.format( /** @type {?} */ value, locale, style, { minimumIntegerDigits: minInt, minimumFractionDigits: minFraction, maximumFractionDigits: maxFraction, currency: currency, currencyAsSymbol: currencyAsSymbol }); } /** * 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: <br> * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code> * - `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 [Browser Support](guide/browser-support) for details. * * \@usageNotes * * ### Example * * {\@example common/pipes/ts/number_pipe.ts region='DeprecatedNumberPipe'} * * \@ngModule CommonModule * \@publicApi */ var DeprecatedDecimalPipe = /*#__PURE__*/function () { /** * @param {?} _locale */ function DeprecatedDecimalPipe(_locale) { _classCallCheck(this, DeprecatedDecimalPipe); this._locale = _locale; } /** * @param {?} value * @param {?=} digits * @return {?} */ _createClass2(DeprecatedDecimalPipe, [{ key: "transform", value: function transform(value, digits) { return formatNumber$1(DeprecatedDecimalPipe, this._locale, value, NumberFormatStyle.Decimal, digits); } }]); return DeprecatedDecimalPipe; }(); DeprecatedDecimalPipe.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'number' }] }]; /** @nocollapse */ DeprecatedDecimalPipe.ctorParameters = function () { return [{ type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"]] }] }]; }; if (false) {} /** * \@ngModule CommonModule * * \@description * * Formats a number as percentage according to locale rules. * * - `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 [Browser Support](guide/browser-support) for details. * * \@usageNotes * * ### Example * * {\@example common/pipes/ts/percent_pipe.ts region='DeprecatedPercentPipe'} * * \@publicApi */ var DeprecatedPercentPipe = /*#__PURE__*/function () { /** * @param {?} _locale */ function DeprecatedPercentPipe(_locale) { _classCallCheck(this, DeprecatedPercentPipe); this._locale = _locale; } /** * @param {?} value * @param {?=} digits * @return {?} */ _createClass2(DeprecatedPercentPipe, [{ key: "transform", value: function transform(value, digits) { return formatNumber$1(DeprecatedPercentPipe, this._locale, value, NumberFormatStyle.Percent, digits); } }]); return DeprecatedPercentPipe; }(); DeprecatedPercentPipe.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'percent' }] }]; /** @nocollapse */ DeprecatedPercentPipe.ctorParameters = function () { return [{ type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"]] }] }]; }; if (false) {} /** * \@ngModule CommonModule * \@description * * Formats a number as currency using locale rules. * * 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 [Browser Support](guide/browser-support) for details. * * \@usageNotes * * ### Example * * {\@example common/pipes/ts/currency_pipe.ts region='DeprecatedCurrencyPipe'} * * \@publicApi */ var DeprecatedCurrencyPipe = /*#__PURE__*/function () { /** * @param {?} _locale */ function DeprecatedCurrencyPipe(_locale) { _classCallCheck(this, DeprecatedCurrencyPipe); this._locale = _locale; } /** * @param {?} value * @param {?=} currencyCode * @param {?=} symbolDisplay * @param {?=} digits * @return {?} */ _createClass2(DeprecatedCurrencyPipe, [{ key: "transform", value: function transform(value) { var currencyCode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'USD'; var symbolDisplay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var digits = arguments.length > 3 ? arguments[3] : undefined; return formatNumber$1(DeprecatedCurrencyPipe, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay); } }]); return DeprecatedCurrencyPipe; }(); DeprecatedCurrencyPipe.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'currency' }] }]; /** @nocollapse */ DeprecatedCurrencyPipe.ctorParameters = function () { return [{ type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"]] }] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A collection of deprecated i18n pipes that require intl api * * @deprecated from v5 * @type {?} */ var COMMON_DEPRECATED_I18N_PIPES = [DeprecatedDecimalPipe, DeprecatedPercentPipe, DeprecatedCurrencyPipe, DeprecatedDatePipe]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function SubscriptionStrategy() {} if (false) {} var ObservableStrategy = /*#__PURE__*/function () { function ObservableStrategy() { _classCallCheck(this, ObservableStrategy); } _createClass2(ObservableStrategy, [{ key: "createSubscription", /** * @param {?} async * @param {?} updateLatestValue * @return {?} */ value: function createSubscription(async, updateLatestValue) { return async.subscribe({ next: updateLatestValue, error: /** * @param {?} e * @return {?} */ function error(e) { throw e; } }); } /** * @param {?} subscription * @return {?} */ }, { key: "dispose", value: function dispose(subscription) { subscription.unsubscribe(); } /** * @param {?} subscription * @return {?} */ }, { key: "onDestroy", value: function onDestroy(subscription) { subscription.unsubscribe(); } }]); return ObservableStrategy; }(); var PromiseStrategy = /*#__PURE__*/function () { function PromiseStrategy() { _classCallCheck(this, PromiseStrategy); } _createClass2(PromiseStrategy, [{ key: "createSubscription", /** * @param {?} async * @param {?} updateLatestValue * @return {?} */ value: function createSubscription(async, updateLatestValue) { return async.then(updateLatestValue, /** * @param {?} e * @return {?} */ function (e) { throw e; }); } /** * @param {?} subscription * @return {?} */ }, { key: "dispose", value: function dispose(subscription) {} /** * @param {?} subscription * @return {?} */ }, { key: "onDestroy", value: function onDestroy(subscription) {} }]); return PromiseStrategy; }(); /** @type {?} */ var _promiseStrategy = new PromiseStrategy(); /** @type {?} */ var _observableStrategy = new ObservableStrategy(); /** * \@ngModule CommonModule * \@description * * Unwraps a value from an asynchronous primitive. * * 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. * * \@usageNotes * * ### 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'} * * \@publicApi */ var AsyncPipe = /*#__PURE__*/function () { /** * @param {?} _ref */ function AsyncPipe(_ref) { _classCallCheck(this, AsyncPipe); this._ref = _ref; this._latestValue = null; this._latestReturnedValue = null; this._subscription = null; this._obj = null; this._strategy = /** @type {?} */ null; } /** * @return {?} */ _createClass2(AsyncPipe, [{ key: "ngOnDestroy", value: function ngOnDestroy() { if (this._subscription) { this._dispose(); } } /** * @param {?} obj * @return {?} */ }, { key: "transform", value: function transform(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 (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵlooseIdentical"])(this._latestValue, this._latestReturnedValue)) { return this._latestReturnedValue; } this._latestReturnedValue = this._latestValue; return _angular_core__WEBPACK_IMPORTED_MODULE_0__["WrappedValue"].wrap(this._latestValue); } /** * @private * @param {?} obj * @return {?} */ }, { key: "_subscribe", value: function _subscribe(obj) { var _this13 = this; this._obj = obj; this._strategy = this._selectStrategy(obj); this._subscription = this._strategy.createSubscription(obj, /** * @param {?} value * @return {?} */ function (value) { return _this13._updateLatestValue(obj, value); }); } /** * @private * @param {?} obj * @return {?} */ }, { key: "_selectStrategy", value: function _selectStrategy(obj) { if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵisPromise"])(obj)) { return _promiseStrategy; } if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵisObservable"])(obj)) { return _observableStrategy; } throw invalidPipeArgumentError(AsyncPipe, obj); } /** * @private * @return {?} */ }, { key: "_dispose", value: function _dispose() { this._strategy.dispose( /** @type {?} */ this._subscription); this._latestValue = null; this._latestReturnedValue = null; this._subscription = null; this._obj = null; } /** * @private * @param {?} async * @param {?} value * @return {?} */ }, { key: "_updateLatestValue", value: function _updateLatestValue(async, value) { if (async === this._obj) { this._latestValue = value; this._ref.markForCheck(); } } }]); return AsyncPipe; }(); AsyncPipe.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'async', pure: false }] }]; /** @nocollapse */ AsyncPipe.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Transforms text to all lower case. * * @see `UpperCasePipe` * @see `TitleCasePipe` * \@usageNotes * * The following example defines a view that allows the user to enter * text, and then uses the pipe to convert the input text to all lower case. * * <code-example path="common/pipes/ts/lowerupper_pipe.ts" region='LowerUpperPipe'></code-example> * * \@ngModule CommonModule * \@publicApi */ var LowerCasePipe = /*#__PURE__*/function () { function LowerCasePipe() { _classCallCheck(this, LowerCasePipe); } _createClass2(LowerCasePipe, [{ key: "transform", /** * @param {?} value The string to transform to lower case. * @return {?} */ value: function transform(value) { if (!value) return value; if (typeof value !== 'string') { throw invalidPipeArgumentError(LowerCasePipe, value); } return value.toLowerCase(); } }]); return LowerCasePipe; }(); LowerCasePipe.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'lowercase' }] }]; // // Regex below matches any Unicode word and compatible with ES5. In ES2018 the same result // can be achieved by using /\p{L}\S*/gu and also known as Unicode Property Escapes // (http://2ality.com/2017/07/regexp-unicode-property-escapes.html). Since there is no // transpilation of this functionality down to ES5 without external tool, the only solution is // to use already transpiled form. Example can be found here - // https://mothereff.in/regexpu#input=var+regex+%3D+/%5Cp%7BL%7D/u%3B&unicodePropertyEscape=1 // /** @type {?} */ var unicodeWordMatch = /(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D])\S*/g; /** * Transforms text to title case. * Capitalizes the first letter of each word, and transforms the * rest of the word to lower case. * Words are delimited by any whitespace character, such as a space, tab, or line-feed character. * * @see `LowerCasePipe` * @see `UpperCasePipe` * * \@usageNotes * The following example shows the result of transforming various strings into title case. * * <code-example path="common/pipes/ts/titlecase_pipe.ts" region='TitleCasePipe'></code-example> * * \@ngModule CommonModule * \@publicApi */ var TitleCasePipe = /*#__PURE__*/function () { function TitleCasePipe() { _classCallCheck(this, TitleCasePipe); } _createClass2(TitleCasePipe, [{ key: "transform", /** * @param {?} value The string to transform to title case. * @return {?} */ value: function transform(value) { if (!value) return value; if (typeof value !== 'string') { throw invalidPipeArgumentError(TitleCasePipe, value); } return value.replace(unicodeWordMatch, /** * @param {?} txt * @return {?} */ function (txt) { return txt[0].toUpperCase() + txt.substr(1).toLowerCase(); }); } }]); return TitleCasePipe; }(); TitleCasePipe.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'titlecase' }] }]; /** * Transforms text to all upper case. * @see `LowerCasePipe` * @see `TitleCasePipe` * * \@ngModule CommonModule * \@publicApi */ var UpperCasePipe = /*#__PURE__*/function () { function UpperCasePipe() { _classCallCheck(this, UpperCasePipe); } _createClass2(UpperCasePipe, [{ key: "transform", /** * @param {?} value The string to transform to upper case. * @return {?} */ value: function transform(value) { if (!value) return value; if (typeof value !== 'string') { throw invalidPipeArgumentError(UpperCasePipe, value); } return value.toUpperCase(); } }]); return UpperCasePipe; }(); UpperCasePipe.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'uppercase' }] }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // clang-format off /** * \@ngModule CommonModule * \@description * * Formats a date value according to locale rules. * * Only the `en-US` locale data comes with Angular. To localize dates * in another language, you must import the corresponding locale data. * See the [I18n guide](guide/i18n#i18n-pipes) for more information. * * @see `formatDate()` * * * \@usageNotes * * The result of this pipe is not reevaluated when the input is mutated. To avoid the need to * reformat the date on every change-detection cycle, treat the date as an immutable object * and change the reference when the pipe needs to run again. * * ### Pre-defined format options * * Examples are given in `en-US` locale. * * - `'short'`: equivalent to `'M/d/yy, h:mm a'` (`6/15/15, 9:03 AM`). * - `'medium'`: equivalent to `'MMM d, y, h:mm:ss a'` (`Jun 15, 2015, 9:03:01 AM`). * - `'long'`: equivalent to `'MMMM d, y, h:mm:ss a z'` (`June 15, 2015 at 9:03:01 AM * GMT+1`). * - `'full'`: equivalent to `'EEEE, MMMM d, y, h:mm:ss a zzzz'` (`Monday, June 15, 2015 at * 9:03:01 AM GMT+01:00`). * - `'shortDate'`: equivalent to `'M/d/yy'` (`6/15/15`). * - `'mediumDate'`: equivalent to `'MMM d, y'` (`Jun 15, 2015`). * - `'longDate'`: equivalent to `'MMMM d, y'` (`June 15, 2015`). * - `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` (`Monday, June 15, 2015`). * - `'shortTime'`: equivalent to `'h:mm a'` (`9:03 AM`). * - `'mediumTime'`: equivalent to `'h:mm:ss a'` (`9:03:01 AM`). * - `'longTime'`: equivalent to `'h:mm:ss a z'` (`9:03:01 AM GMT+1`). * - `'fullTime'`: equivalent to `'h:mm:ss a zzzz'` (`9:03:01 AM GMT+01:00`). * * ### Custom format options * * You can construct a format string using symbols to specify the components * of a date-time value, as described in the following table. * Format details depend on the locale. * Fields marked with (*) are only available in the extra data set for the given locale. * * | Field type | Format | Description | Example Value | * |--------------------|-------------|---------------------------------------------------------------|------------------------------------------------------------| * | Era | G, GG & GGG | Abbreviated | AD | * | | GGGG | Wide | Anno Domini | * | | GGGGG | Narrow | A | * | Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 | * | | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 | * | | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 | * | | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 | * | Month | M | Numeric: 1 digit | 9, 12 | * | | MM | Numeric: 2 digits + zero padded | 09, 12 | * | | MMM | Abbreviated | Sep | * | | MMMM | Wide | September | * | | MMMMM | Narrow | S | * | Month standalone | L | Numeric: 1 digit | 9, 12 | * | | LL | Numeric: 2 digits + zero padded | 09, 12 | * | | LLL | Abbreviated | Sep | * | | LLLL | Wide | September | * | | LLLLL | Narrow | S | * | Week of year | w | Numeric: minimum digits | 1... 53 | * | | ww | Numeric: 2 digits + zero padded | 01... 53 | * | Week of month | W | Numeric: 1 digit | 1... 5 | * | Day of month | d | Numeric: minimum digits | 1 | * | | dd | Numeric: 2 digits + zero padded | 01 | * | Week day | E, EE & EEE | Abbreviated | Tue | * | | EEEE | Wide | Tuesday | * | | EEEEE | Narrow | T | * | | EEEEEE | Short | Tu | * | Period | a, aa & aaa | Abbreviated | am/pm or AM/PM | * | | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem | * | | aaaaa | Narrow | a/p | * | Period* | B, BB & BBB | Abbreviated | mid. | * | | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night | * | | BBBBB | Narrow | md | * | Period standalone* | b, bb & bbb | Abbreviated | mid. | * | | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night | * | | bbbbb | Narrow | md | * | Hour 1-12 | h | Numeric: minimum digits | 1, 12 | * | | hh | Numeric: 2 digits + zero padded | 01, 12 | * | Hour 0-23 | H | Numeric: minimum digits | 0, 23 | * | | HH | Numeric: 2 digits + zero padded | 00, 23 | * | Minute | m | Numeric: minimum digits | 8, 59 | * | | mm | Numeric: 2 digits + zero padded | 08, 59 | * | Second | s | Numeric: minimum digits | 0... 59 | * | | ss | Numeric: 2 digits + zero padded | 00... 59 | * | Fractional seconds | S | Numeric: 1 digit | 0... 9 | * | | SS | Numeric: 2 digits + zero padded | 00... 99 | * | | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 | * | Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 | * | | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 | * | | Z, ZZ & ZZZ | ISO8601 basic format | -0800 | * | | ZZZZ | Long localized GMT format | GMT-8:00 | * | | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 | * | | O, OO & OOO | Short localized GMT format | GMT-8 | * | | OOOO | Long localized GMT format | GMT-08:00 | * * Note that timezone correction is not applied to an ISO string that has no time component, such as "2016-09-19" * * ### Format examples * * These examples transform a date into various formats, * assuming that `dateObj` is a JavaScript `Date` object for * year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11, * given in the local time for the `en-US` locale. * * ``` * {{ 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:'mm:ss' }} // output is '43:11' * ``` * * ### Usage example * * The following component uses a date pipe to display the current date in different formats. * * ``` * \@Component({ * selector: 'date-pipe', * template: `<div> * <p>Today is {{today | date}}</p> * <p>Or if you prefer, {{today | date:'fullDate'}}</p> * <p>The time is {{today | date:'h:mm a z'}}</p> * </div>` * }) * // Get the current date and time as a date-time value. * export class DatePipeComponent { * today: number = Date.now(); * } * ``` * * \@publicApi */ // clang-format on var DatePipe = /*#__PURE__*/function () { /** * @param {?} locale */ function DatePipe(locale) { _classCallCheck(this, DatePipe); this.locale = locale; } /** * @param {?} value The date expression: a `Date` object, a number * (milliseconds since UTC epoch), or an ISO string (https://www.w3.org/TR/NOTE-datetime). * @param {?=} format The date/time components to include, using predefined options or a * custom format string. * @param {?=} timezone A timezone offset (such as `'+0430'`), or a standard * UTC/GMT or continental US timezone abbreviation. * When not supplied, uses the end-user's local system timezone. * @param {?=} locale A locale code for the locale format rules to use. * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default. * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app). * @return {?} A date string in the desired format. */ _createClass2(DatePipe, [{ key: "transform", value: function transform(value) { var format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'mediumDate'; var timezone = arguments.length > 2 ? arguments[2] : undefined; var locale = arguments.length > 3 ? arguments[3] : undefined; if (value == null || value === '' || value !== value) return null; try { return formatDate(value, format, locale || this.locale, timezone); } catch (error) { throw invalidPipeArgumentError(DatePipe, error.message); } } }]); return DatePipe; }(); DatePipe.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'date', pure: true }] }]; /** @nocollapse */ DatePipe.ctorParameters = function () { return [{ type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"]] }] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var _INTERPOLATION_REGEXP = /#/g; /** * \@ngModule CommonModule * \@description * * Maps a value to a string that pluralizes the value according to locale rules. * * \@usageNotes * * ### Example * * {\@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'} * * \@publicApi */ var I18nPluralPipe = /*#__PURE__*/function () { /** * @param {?} _localization */ function I18nPluralPipe(_localization) { _classCallCheck(this, I18nPluralPipe); this._localization = _localization; } /** * @param {?} value the number to be formatted * @param {?} pluralMap an object that mimics the ICU format, see * http://userguide.icu-project.org/formatparse/messages. * @param {?=} locale a `string` defining the locale to use (uses the current {\@link LOCALE_ID} by * default). * @return {?} */ _createClass2(I18nPluralPipe, [{ key: "transform", value: function transform(value, pluralMap, locale) { if (value == null) return ''; if (typeof pluralMap !== 'object' || pluralMap === null) { throw invalidPipeArgumentError(I18nPluralPipe, pluralMap); } /** @type {?} */ var key = getPluralCategory(value, Object.keys(pluralMap), this._localization, locale); return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString()); } }]); return I18nPluralPipe; }(); I18nPluralPipe.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'i18nPlural', pure: true }] }]; /** @nocollapse */ I18nPluralPipe.ctorParameters = function () { return [{ type: NgLocalization }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@ngModule CommonModule * \@description * * Generic selector that displays the string that matches the current value. * * If none of the keys of the `mapping` match the `value`, then the content * of the `other` key is returned when present, otherwise an empty string is returned. * * \@usageNotes * * ### Example * * {\@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'} * * \@publicApi */ var I18nSelectPipe = /*#__PURE__*/function () { function I18nSelectPipe() { _classCallCheck(this, I18nSelectPipe); } _createClass2(I18nSelectPipe, [{ key: "transform", /** * @param {?} value a string to be internationalized. * @param {?} mapping an object that indicates the text that should be displayed * for different values of the provided `value`. * @return {?} */ value: function transform(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: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'i18nSelect', pure: true }] }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@ngModule CommonModule * \@description * * Converts a value into its JSON-format representation. Useful for debugging. * * \@usageNotes * * The following component uses a JSON pipe to convert an object * to JSON format, and displays the string in both formats for comparison. * * {\@example common/pipes/ts/json_pipe.ts region='JsonPipe'} * * \@publicApi */ var JsonPipe = /*#__PURE__*/function () { function JsonPipe() { _classCallCheck(this, JsonPipe); } _createClass2(JsonPipe, [{ key: "transform", /** * @param {?} value A value of any type to convert into a JSON-format string. * @return {?} */ value: function transform(value) { return JSON.stringify(value, null, 2); } }]); return JsonPipe; }(); JsonPipe.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'json', pure: false }] }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @template K, V * @param {?} key * @param {?} value * @return {?} */ function makeKeyValuePair(key, value) { return { key: key, value: value }; } /** * A key value pair. * Usually used to represent the key value pairs from a Map or Object. * * \@publicApi * @record * @template K, V */ function KeyValue() {} if (false) {} /** * \@ngModule CommonModule * \@description * * Transforms Object or Map into an array of key value pairs. * * The output array will be ordered by keys. * By default the comparator will be by Unicode point value. * You can optionally pass a compareFn if your keys are complex types. * * \@usageNotes * ### Examples * * This examples show how an Object or a Map can be iterated by ngFor with the use of this keyvalue * pipe. * * {\@example common/pipes/ts/keyvalue_pipe.ts region='KeyValuePipe'} * * \@publicApi */ var KeyValuePipe = /*#__PURE__*/function () { /** * @param {?} differs */ function KeyValuePipe(differs) { _classCallCheck(this, KeyValuePipe); this.differs = differs; this.keyValues = []; } /** * @template K, V * @param {?} input * @param {?=} compareFn * @return {?} */ _createClass2(KeyValuePipe, [{ key: "transform", value: function transform(input) { var _this14 = this; var compareFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultComparator; if (!input || !(input instanceof Map) && typeof input !== 'object') { return null; } if (!this.differ) { // make a differ for whatever type we've been passed in this.differ = this.differs.find(input).create(); } /** @type {?} */ var differChanges = this.differ.diff( /** @type {?} */ input); if (differChanges) { this.keyValues = []; differChanges.forEachItem( /** * @param {?} r * @return {?} */ function (r) { _this14.keyValues.push(makeKeyValuePair(r.key, /** @type {?} */ r.currentValue)); }); this.keyValues.sort(compareFn); } return this.keyValues; } }]); return KeyValuePipe; }(); KeyValuePipe.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'keyvalue', pure: false }] }]; /** @nocollapse */ KeyValuePipe.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["KeyValueDiffers"] }]; }; if (false) {} /** * @template K, V * @param {?} keyValueA * @param {?} keyValueB * @return {?} */ function defaultComparator(keyValueA, keyValueB) { /** @type {?} */ var a = keyValueA.key; /** @type {?} */ var b = keyValueB.key; // if same exit with 0; if (a === b) return 0; // make sure that undefined are at the end of the sort. if (a === undefined) return 1; if (b === undefined) return -1; // make sure that nulls are at the end of the sort. if (a === null) return 1; if (b === null) return -1; if (typeof a == 'string' && typeof b == 'string') { return a < b ? -1 : 1; } if (typeof a == 'number' && typeof b == 'number') { return a - b; } if (typeof a == 'boolean' && typeof b == 'boolean') { return a < b ? -1 : 1; } // `a` and `b` are of different types. Compare their string values. /** @type {?} */ var aString = String(a); /** @type {?} */ var bString = String(b); return aString == bString ? 0 : aString < bString ? -1 : 1; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@ngModule CommonModule * \@description * * Transforms a number into a string, * formatted according to locale rules that determine group sizing and * separator, decimal-point character, and other locale-specific * configurations. * * If no parameters are specified, the function rounds off to the nearest value using this * [rounding method](https://en.wikibooks.org/wiki/Arithmetic/Rounding). * The behavior differs from that of the JavaScript ```Math.round()``` function. * In the following case for example, the pipe rounds down where * ```Math.round()``` rounds up: * * ```html * -2.5 | number:'1.0-0' * > -3 * Math.round(-2.5) * > -2 * ``` * * @see `formatNumber()` * * \@usageNotes * The following code shows how the pipe transforms numbers * into text strings, according to various format specifications, * where the caller's default locale is `en-US`. * * ### Example * * <code-example path="common/pipes/ts/number_pipe.ts" region='NumberPipe'></code-example> * * \@publicApi */ var DecimalPipe = /*#__PURE__*/function () { /** * @param {?} _locale */ function DecimalPipe(_locale) { _classCallCheck(this, DecimalPipe); this._locale = _locale; } /** * @param {?} value The number to be formatted. * @param {?=} digitsInfo Decimal representation options, specified by a string * in the following format:<br> * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>. * - `minIntegerDigits`: The minimum number of integer digits before the decimal point. * Default is `1`. * - `minFractionDigits`: The minimum number of digits after the decimal point. * Default is `0`. * - `maxFractionDigits`: The maximum number of digits after the decimal point. * Default is `3`. * @param {?=} locale A locale code for the locale format rules to use. * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default. * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app). * @return {?} */ _createClass2(DecimalPipe, [{ key: "transform", value: function transform(value, digitsInfo, locale) { if (isEmpty(value)) return null; locale = locale || this._locale; try { /** @type {?} */ var num = strToNumber(value); return formatNumber(num, locale, digitsInfo); } catch (error) { throw invalidPipeArgumentError(DecimalPipe, error.message); } } }]); return DecimalPipe; }(); DecimalPipe.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'number' }] }]; /** @nocollapse */ DecimalPipe.ctorParameters = function () { return [{ type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"]] }] }]; }; if (false) {} /** * \@ngModule CommonModule * \@description * * Transforms a number to a percentage * string, formatted according to locale rules that determine group sizing and * separator, decimal-point character, and other locale-specific * configurations. * * @see `formatPercent()` * * \@usageNotes * The following code shows how the pipe transforms numbers * into text strings, according to various format specifications, * where the caller's default locale is `en-US`. * * <code-example path="common/pipes/ts/percent_pipe.ts" region='PercentPipe'></code-example> * * \@publicApi */ var PercentPipe = /*#__PURE__*/function () { /** * @param {?} _locale */ function PercentPipe(_locale) { _classCallCheck(this, PercentPipe); this._locale = _locale; } /** * * @param {?} value The number to be formatted as a percentage. * @param {?=} digitsInfo Decimal representation options, specified by a string * in the following format:<br> * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>. * - `minIntegerDigits`: The minimum number of integer digits before the decimal point. * Default is `1`. * - `minFractionDigits`: The minimum number of digits after the decimal point. * Default is `0`. * - `maxFractionDigits`: The maximum number of digits after the decimal point. * Default is `0`. * @param {?=} locale A locale code for the locale format rules to use. * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default. * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app). * @return {?} */ _createClass2(PercentPipe, [{ key: "transform", value: function transform(value, digitsInfo, locale) { if (isEmpty(value)) return null; locale = locale || this._locale; try { /** @type {?} */ var num = strToNumber(value); return formatPercent(num, locale, digitsInfo); } catch (error) { throw invalidPipeArgumentError(PercentPipe, error.message); } } }]); return PercentPipe; }(); PercentPipe.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'percent' }] }]; /** @nocollapse */ PercentPipe.ctorParameters = function () { return [{ type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"]] }] }]; }; if (false) {} /** * \@ngModule CommonModule * \@description * * Transforms a number to a currency string, formatted according to locale rules * that determine group sizing and separator, decimal-point character, * and other locale-specific configurations. * * @see `getCurrencySymbol()` * @see `formatCurrency()` * * \@usageNotes * The following code shows how the pipe transforms numbers * into text strings, according to various format specifications, * where the caller's default locale is `en-US`. * * <code-example path="common/pipes/ts/currency_pipe.ts" region='CurrencyPipe'></code-example> * * \@publicApi */ var CurrencyPipe = /*#__PURE__*/function () { /** * @param {?} _locale */ function CurrencyPipe(_locale) { _classCallCheck(this, CurrencyPipe); this._locale = _locale; } /** * * @param {?} value The number to be formatted as currency. * @param {?=} currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, * such as `USD` for the US dollar and `EUR` for the euro. * @param {?=} display The format for the currency indicator. One of the following: * - `code`: Show the code (such as `USD`). * - `symbol`(default): Show the symbol (such as `$`). * - `symbol-narrow`: Use the narrow symbol for locales that have two symbols for their * currency. * For example, the Canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`. If the * locale has no narrow symbol, uses the standard symbol for the locale. * - String: Use the given string value instead of a code or a symbol. * For example, an empty string will suppress the currency & symbol. * - Boolean (marked deprecated in v5): `true` for symbol and false for `code`. * * @param {?=} digitsInfo Decimal representation options, specified by a string * in the following format:<br> * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>. * - `minIntegerDigits`: The minimum number of integer digits before the decimal point. * Default is `1`. * - `minFractionDigits`: The minimum number of digits after the decimal point. * Default is `2`. * - `maxFractionDigits`: The maximum number of digits after the decimal point. * Default is `2`. * If not provided, the number will be formatted with the proper amount of digits, * depending on what the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) specifies. * For example, the Canadian dollar has 2 digits, whereas the Chilean peso has none. * @param {?=} locale A locale code for the locale format rules to use. * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default. * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app). * @return {?} */ _createClass2(CurrencyPipe, [{ key: "transform", value: function transform(value, currencyCode) { var display = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'symbol'; var digitsInfo = arguments.length > 3 ? arguments[3] : undefined; var locale = arguments.length > 4 ? arguments[4] : undefined; if (isEmpty(value)) return null; locale = locale || this._locale; if (typeof display === 'boolean') { if ( /** @type {?} */ console && /** @type {?} */ console.warn) { console.warn("Warning: the currency pipe has been changed in Angular v5. The symbolDisplay option (third parameter) is now a string instead of a boolean. The accepted values are \"code\", \"symbol\" or \"symbol-narrow\"."); } display = display ? 'symbol' : 'code'; } /** @type {?} */ var currency = currencyCode || 'USD'; if (display !== 'code') { if (display === 'symbol' || display === 'symbol-narrow') { currency = getCurrencySymbol(currency, display === 'symbol' ? 'wide' : 'narrow', locale); } else { currency = display; } } try { /** @type {?} */ var num = strToNumber(value); return formatCurrency(num, locale, currency, currencyCode, digitsInfo); } catch (error) { throw invalidPipeArgumentError(CurrencyPipe, error.message); } } }]); return CurrencyPipe; }(); CurrencyPipe.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'currency' }] }]; /** @nocollapse */ CurrencyPipe.ctorParameters = function () { return [{ type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"]] }] }]; }; if (false) {} /** * @param {?} value * @return {?} */ function isEmpty(value) { return value == null || value === '' || value !== value; } /** * Transforms a string into a number (if needed). * @param {?} value * @return {?} */ function strToNumber(value) { // Convert strings to numbers if (typeof value === 'string' && !isNaN(Number(value) - parseFloat(value))) { return Number(value); } if (typeof value !== 'number') { throw new Error("".concat(value, " is not a number")); } return value; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@ngModule CommonModule * \@description * * Creates a new `Array` or `String` containing a subset (slice) of the elements. * * \@usageNotes * * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()` * and `String.prototype.slice()`. * * When operating on an `Array`, the returned `Array` 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: * * ```html * <li>b</li> * <li>c</li> * ``` * * ### String Examples * * {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'} * * \@publicApi */ var SlicePipe = /*#__PURE__*/function () { function SlicePipe() { _classCallCheck(this, SlicePipe); } _createClass2(SlicePipe, [{ key: "transform", /** * @param {?} value * @param {?} start * @param {?=} end * @return {?} */ value: function transform(value, start, end) { if (value == null) return value; if (!this.supports(value)) { throw invalidPipeArgumentError(SlicePipe, value); } return value.slice(start, end); } /** * @private * @param {?} obj * @return {?} */ }, { key: "supports", value: function supports(obj) { return typeof obj === 'string' || Array.isArray(obj); } }]); return SlicePipe; }(); SlicePipe.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{ name: 'slice', pure: false }] }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A collection of Angular pipes that are likely to be used in each and every application. * @type {?} */ var COMMON_PIPES = [AsyncPipe, UpperCasePipe, LowerCasePipe, JsonPipe, SlicePipe, DecimalPipe, PercentPipe, TitleCasePipe, CurrencyPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, KeyValuePipe]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // Note: This does not contain the location providers, // as they need some platform specific implementations to work. /** * Exports all the basic Angular directives and pipes, * such as `NgIf`, `NgForOf`, `DecimalPipe`, and so on. * Re-exported by `BrowserModule`, which is included automatically in the root * `AppModule` when you create a new app with the CLI `new` command. * * * The `providers` options configure the NgModule's injector to provide * localization dependencies to members. * * The `exports` options make the declared directives and pipes available for import * by other NgModules. * * \@publicApi */ var CommonModule = function CommonModule() { _classCallCheck(this, CommonModule); }; CommonModule.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ declarations: [COMMON_DIRECTIVES, COMMON_PIPES], exports: [COMMON_DIRECTIVES, COMMON_PIPES], providers: [{ provide: NgLocalization, useClass: NgLocaleLocalization }] }] }]; var ɵ0$2 = getPluralCase; /** * A module that contains the deprecated i18n pipes. * * @deprecated from v5 * \@publicApi */ var DeprecatedI18NPipesModule = function DeprecatedI18NPipesModule() { _classCallCheck(this, DeprecatedI18NPipesModule); }; DeprecatedI18NPipesModule.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ declarations: [COMMON_DEPRECATED_I18N_PIPES], exports: [COMMON_DEPRECATED_I18N_PIPES], providers: [{ provide: DEPRECATED_PLURAL_FN, useValue: ɵ0$2 }] }] }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A DI Token representing the main rendering context. In a browser this is the DOM Document. * * Note: Document might not be available in the Application Context when Application and Rendering * Contexts are not the same (e.g. when running the application in a Web Worker). * * \@publicApi * @type {?} */ var DOCUMENT = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('DocumentToken'); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** @type {?} */ var PLATFORM_BROWSER_ID = 'browser'; /** @type {?} */ var PLATFORM_SERVER_ID = 'server'; /** @type {?} */ var PLATFORM_WORKER_APP_ID = 'browserWorkerApp'; /** @type {?} */ var PLATFORM_WORKER_UI_ID = 'browserWorkerUi'; /** * Returns whether a platform id represents a browser platform. * \@publicApi * @param {?} platformId * @return {?} */ function isPlatformBrowser(platformId) { return platformId === PLATFORM_BROWSER_ID; } /** * Returns whether a platform id represents a server platform. * \@publicApi * @param {?} platformId * @return {?} */ function isPlatformServer(platformId) { return platformId === PLATFORM_SERVER_ID; } /** * Returns whether a platform id represents a web worker app platform. * \@publicApi * @param {?} platformId * @return {?} */ function isPlatformWorkerApp(platformId) { return platformId === PLATFORM_WORKER_APP_ID; } /** * Returns whether a platform id represents a web worker UI platform. * \@publicApi * @param {?} platformId * @return {?} */ function isPlatformWorkerUi(platformId) { return platformId === PLATFORM_WORKER_UI_ID; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@publicApi * @type {?} */ var VERSION = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["Version"]('8.2.12'); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Defines a scroll position manager. Implemented by `BrowserViewportScroller`. * * \@publicApi * @abstract */ var ViewportScroller = function ViewportScroller() { _classCallCheck(this, ViewportScroller); }; // De-sugared tree-shakable injection // See #23917 /** @nocollapse */ /** @nocollapse */ ViewportScroller.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵdefineInjectable"])({ token: ViewportScroller, providedIn: 'root', factory: /** * @nocollapse @return {?} */ function factory() { return new BrowserViewportScroller(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"])(DOCUMENT), window, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵɵinject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ErrorHandler"])); } }); if (false) {} /** * Manages the scroll position for a browser window. */ var BrowserViewportScroller = /*#__PURE__*/function () { /** * @param {?} document * @param {?} window * @param {?} errorHandler */ function BrowserViewportScroller(document, window, errorHandler) { _classCallCheck(this, BrowserViewportScroller); this.document = document; this.window = window; this.errorHandler = errorHandler; this.offset = /** * @return {?} */ function () { return [0, 0]; }; } /** * Configures the top offset used when scrolling to an anchor. * @param {?} offset A position in screen coordinates (a tuple with x and y values) * or a function that returns the top offset position. * * @return {?} */ _createClass2(BrowserViewportScroller, [{ key: "setOffset", value: function setOffset(offset) { if (Array.isArray(offset)) { this.offset = /** * @return {?} */ function () { return offset; }; } else { this.offset = offset; } } /** * Retrieves the current scroll position. * @return {?} The position in screen coordinates. */ }, { key: "getScrollPosition", value: function getScrollPosition() { if (this.supportScrollRestoration()) { return [this.window.scrollX, this.window.scrollY]; } else { return [0, 0]; } } /** * Sets the scroll position. * @param {?} position The new position in screen coordinates. * @return {?} */ }, { key: "scrollToPosition", value: function scrollToPosition(position) { if (this.supportScrollRestoration()) { this.window.scrollTo(position[0], position[1]); } } /** * Scrolls to an anchor element. * @param {?} anchor The ID of the anchor element. * @return {?} */ }, { key: "scrollToAnchor", value: function scrollToAnchor(anchor) { if (this.supportScrollRestoration()) { // Escape anything passed to `querySelector` as it can throw errors and stop the application // from working if invalid values are passed. if (this.window.CSS && this.window.CSS.escape) { anchor = this.window.CSS.escape(anchor); } else { anchor = anchor.replace(/(\"|\'\ |:|\.|\[|\]|,|=)/g, '\\$1'); } try { /** @type {?} */ var elSelectedById = this.document.querySelector("#".concat(anchor)); if (elSelectedById) { this.scrollToElement(elSelectedById); return; } /** @type {?} */ var elSelectedByName = this.document.querySelector("[name='".concat(anchor, "']")); if (elSelectedByName) { this.scrollToElement(elSelectedByName); return; } } catch (e) { this.errorHandler.handleError(e); } } } /** * Disables automatic scroll restoration provided by the browser. * @param {?} scrollRestoration * @return {?} */ }, { key: "setHistoryScrollRestoration", value: function setHistoryScrollRestoration(scrollRestoration) { if (this.supportScrollRestoration()) { /** @type {?} */ var history = this.window.history; if (history && history.scrollRestoration) { history.scrollRestoration = scrollRestoration; } } } /** * @private * @param {?} el * @return {?} */ }, { key: "scrollToElement", value: function scrollToElement(el) { /** @type {?} */ var rect = el.getBoundingClientRect(); /** @type {?} */ var left = rect.left + this.window.pageXOffset; /** @type {?} */ var top = rect.top + this.window.pageYOffset; /** @type {?} */ var offset = this.offset(); this.window.scrollTo(left - offset[0], top - offset[1]); } /** * We only support scroll restoration when we can get a hold of window. * This means that we do not support this behavior when running in a web worker. * * Lifting this restriction right now would require more changes in the dom adapter. * Since webworkers aren't widely used, we will lift it once RouterScroller is * battle-tested. * @private * @return {?} */ }, { key: "supportScrollRestoration", value: function supportScrollRestoration() { try { return !!this.window && !!this.window.scrollTo; } catch (_a) { return false; } } }]); return BrowserViewportScroller; }(); if (false) {} /** * Provides an empty implementation of the viewport scroller. This will * live in \@angular/common as it will be used by both platform-server and platform-webworker. */ var NullViewportScroller = /*#__PURE__*/function () { function NullViewportScroller() { _classCallCheck(this, NullViewportScroller); } _createClass2(NullViewportScroller, [{ key: "setOffset", /** * Empty implementation * @param {?} offset * @return {?} */ value: function setOffset(offset) {} /** * Empty implementation * @return {?} */ }, { key: "getScrollPosition", value: function getScrollPosition() { return [0, 0]; } /** * Empty implementation * @param {?} position * @return {?} */ }, { key: "scrollToPosition", value: function scrollToPosition(position) {} /** * Empty implementation * @param {?} anchor * @return {?} */ }, { key: "scrollToAnchor", value: function scrollToAnchor(anchor) {} /** * Empty implementation * @param {?} scrollRestoration * @return {?} */ }, { key: "setHistoryScrollRestoration", value: function setHistoryScrollRestoration(scrollRestoration) {} }]); return NullViewportScroller; }(); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=common.js.map /***/ }, /***/ "./node_modules/@angular/common/fesm2015/http.js": /*!*******************************************************!*\ !*** ./node_modules/@angular/common/fesm2015/http.js ***! \*******************************************************/ /*! exports provided: ɵangular_packages_common_http_http_a, ɵangular_packages_common_http_http_b, ɵangular_packages_common_http_http_c, ɵangular_packages_common_http_http_d, ɵangular_packages_common_http_http_g, ɵangular_packages_common_http_http_h, ɵangular_packages_common_http_http_e, ɵangular_packages_common_http_http_f, HttpBackend, HttpHandler, HttpClient, HttpHeaders, HTTP_INTERCEPTORS, JsonpClientBackend, JsonpInterceptor, HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule, ɵHttpInterceptingHandler, HttpParams, HttpUrlEncodingCodec, HttpRequest, HttpErrorResponse, HttpEventType, HttpHeaderResponse, HttpResponse, HttpResponseBase, HttpXhrBackend, XhrFactory, HttpXsrfTokenExtractor */ /***/ function node_modulesAngularCommonFesm2015HttpJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_a", function () { return NoopInterceptor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_b", function () { return JsonpCallbackContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_c", function () { return jsonpCallbackContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_d", function () { return BrowserXhr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_g", function () { return HttpXsrfCookieExtractor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_h", function () { return HttpXsrfInterceptor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_e", function () { return XSRF_COOKIE_NAME; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_f", function () { return XSRF_HEADER_NAME; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpBackend", function () { return HttpBackend; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpHandler", function () { return HttpHandler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpClient", function () { return HttpClient; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpHeaders", function () { return HttpHeaders; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HTTP_INTERCEPTORS", function () { return HTTP_INTERCEPTORS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonpClientBackend", function () { return JsonpClientBackend; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonpInterceptor", function () { return JsonpInterceptor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpClientJsonpModule", function () { return HttpClientJsonpModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpClientModule", function () { return HttpClientModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpClientXsrfModule", function () { return HttpClientXsrfModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵHttpInterceptingHandler", function () { return HttpInterceptingHandler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpParams", function () { return HttpParams; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpUrlEncodingCodec", function () { return HttpUrlEncodingCodec; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpRequest", function () { return HttpRequest; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpErrorResponse", function () { return HttpErrorResponse; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpEventType", function () { return HttpEventType; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpHeaderResponse", function () { return HttpHeaderResponse; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpResponse", function () { return HttpResponse; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpResponseBase", function () { return HttpResponseBase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpXhrBackend", function () { return HttpXhrBackend; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "XhrFactory", function () { return XhrFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpXsrfTokenExtractor", function () { return HttpXsrfTokenExtractor; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! @angular/core */ "./node_modules/@angular/core/fesm2015/core.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! rxjs */ "./node_modules/rxjs/_esm2015/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! rxjs/operators */ "./node_modules/rxjs/_esm2015/operators/index.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! @angular/common */ "./node_modules/@angular/common/fesm2015/common.js"); /** * @license Angular v8.2.12 * (c) 2010-2019 Google LLC. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 an `HttpRequest` into a stream of `HttpEvent`s, one of which will likely be a * `HttpResponse`. * * `HttpHandler` is injectable. When injected, the handler instance dispatches requests to the * first interceptor in the chain, which dispatches to the second, etc, eventually reaching the * `HttpBackend`. * * In an `HttpInterceptor`, the `HttpHandler` parameter is the next interceptor in the chain. * * \@publicApi * @abstract */ var HttpHandler = function HttpHandler() { _classCallCheck(this, HttpHandler); }; if (false) {} /** * A final `HttpHandler` which will dispatch the request via browser HTTP APIs to a backend. * * Interceptors sit between the `HttpClient` interface and the `HttpBackend`. * * When injected, `HttpBackend` dispatches requests directly to the backend, without going * through the interceptor chain. * * \@publicApi * @abstract */ var HttpBackend = function HttpBackend() { _classCallCheck(this, HttpBackend); }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** * @record */ function Update() {} if (false) {} /** * Represents the header configuration options for an HTTP request. * Instances are immutable. Modifying methods return a cloned * instance with the change. The original object is never changed. * * \@publicApi */ var HttpHeaders = /*#__PURE__*/function () { /** * Constructs a new HTTP header object with the given values. * @param {?=} headers */ function HttpHeaders(headers) { var _this15 = this; _classCallCheck(this, HttpHeaders); /** * Internal map of lowercased header names to the normalized * form of the name (the form seen first). */ this.normalizedNames = new Map(); /** * Queued updates to be materialized the next initialization. */ this.lazyUpdate = null; if (!headers) { this.headers = new Map(); } else if (typeof headers === 'string') { this.lazyInit = /** * @return {?} */ function () { _this15.headers = new Map(); headers.split('\n').forEach( /** * @param {?} line * @return {?} */ function (line) { /** @type {?} */ var index = line.indexOf(':'); if (index > 0) { /** @type {?} */ var name = line.slice(0, index); /** @type {?} */ var key = name.toLowerCase(); /** @type {?} */ var value = line.slice(index + 1).trim(); _this15.maybeSetNormalizedName(name, key); if (_this15.headers.has(key)) { /** @type {?} */ _this15.headers.get(key).push(value); } else { _this15.headers.set(key, [value]); } } }); }; } else { this.lazyInit = /** * @return {?} */ function () { _this15.headers = new Map(); Object.keys(headers).forEach( /** * @param {?} name * @return {?} */ function (name) { /** @type {?} */ var values = headers[name]; /** @type {?} */ var key = name.toLowerCase(); if (typeof values === 'string') { values = [values]; } if (values.length > 0) { _this15.headers.set(key, values); _this15.maybeSetNormalizedName(name, key); } }); }; } } /** * Checks for existence of a given header. * * @param {?} name The header name to check for existence. * * @return {?} True if the header exists, false otherwise. */ _createClass2(HttpHeaders, [{ key: "has", value: function has(name) { this.init(); return this.headers.has(name.toLowerCase()); } /** * Retrieves the first value of a given header. * * @param {?} name The header name. * * @return {?} The value string if the header exists, null otherwise */ }, { key: "get", value: function get(name) { this.init(); /** @type {?} */ var values = this.headers.get(name.toLowerCase()); return values && values.length > 0 ? values[0] : null; } /** * Retrieves the names of the headers. * * @return {?} A list of header names. */ }, { key: "keys", value: function keys() { this.init(); return Array.from(this.normalizedNames.values()); } /** * Retrieves a list of values for a given header. * * @param {?} name The header name from which to retrieve values. * * @return {?} A string of values if the header exists, null otherwise. */ }, { key: "getAll", value: function getAll(name) { this.init(); return this.headers.get(name.toLowerCase()) || null; } /** * Appends a new value to the existing set of values for a header * and returns them in a clone of the original instance. * * @param {?} name The header name for which to append the value or values. * @param {?} value The new value or array of values. * * @return {?} A clone of the HTTP headers object with the value appended to the given header. */ }, { key: "append", value: function append(name, value) { return this.clone({ name: name, value: value, op: 'a' }); } /** * Sets or modifies a value for a given header in a clone of the original instance. * If the header already exists, its value is replaced with the given value * in the returned object. * * @param {?} name The header name. * @param {?} value The value or values to set or overide for the given header. * * @return {?} A clone of the HTTP headers object with the newly set header value. */ }, { key: "set", value: function set(name, value) { return this.clone({ name: name, value: value, op: 's' }); } /** * Deletes values for a given header in a clone of the original instance. * * @param {?} name The header name. * @param {?=} value The value or values to delete for the given header. * * @return {?} A clone of the HTTP headers object with the given value deleted. */ }, { key: "delete", value: function _delete(name, value) { return this.clone({ name: name, value: value, op: 'd' }); } /** * @private * @param {?} name * @param {?} lcName * @return {?} */ }, { key: "maybeSetNormalizedName", value: function maybeSetNormalizedName(name, lcName) { if (!this.normalizedNames.has(lcName)) { this.normalizedNames.set(lcName, name); } } /** * @private * @return {?} */ }, { key: "init", value: function init() { var _this16 = this; if (!!this.lazyInit) { if (this.lazyInit instanceof HttpHeaders) { this.copyFrom(this.lazyInit); } else { this.lazyInit(); } this.lazyInit = null; if (!!this.lazyUpdate) { this.lazyUpdate.forEach( /** * @param {?} update * @return {?} */ function (update) { return _this16.applyUpdate(update); }); this.lazyUpdate = null; } } } /** * @private * @param {?} other * @return {?} */ }, { key: "copyFrom", value: function copyFrom(other) { var _this17 = this; other.init(); Array.from(other.headers.keys()).forEach( /** * @param {?} key * @return {?} */ function (key) { _this17.headers.set(key, /** @type {?} */ other.headers.get(key)); _this17.normalizedNames.set(key, /** @type {?} */ other.normalizedNames.get(key)); }); } /** * @private * @param {?} update * @return {?} */ }, { key: "clone", value: function clone(update) { /** @type {?} */ var clone = new HttpHeaders(); clone.lazyInit = !!this.lazyInit && this.lazyInit instanceof HttpHeaders ? this.lazyInit : this; clone.lazyUpdate = (this.lazyUpdate || []).concat([update]); return clone; } /** * @private * @param {?} update * @return {?} */ }, { key: "applyUpdate", value: function applyUpdate(update) { /** @type {?} */ var key = update.name.toLowerCase(); switch (update.op) { case 'a': case 's': /** @type {?} */ var value = /** @type {?} */ update.value; if (typeof value === 'string') { value = [value]; } if (value.length === 0) { return; } this.maybeSetNormalizedName(update.name, key); /** @type {?} */ var base = (update.op === 'a' ? this.headers.get(key) : undefined) || []; base.push.apply(base, _toConsumableArray(value)); this.headers.set(key, base); break; case 'd': /** @type {?} */ var toDelete = /** @type {?} */ update.value; if (!toDelete) { this.headers["delete"](key); this.normalizedNames["delete"](key); } else { /** @type {?} */ var existing = this.headers.get(key); if (!existing) { return; } existing = existing.filter( /** * @param {?} value * @return {?} */ function (value) { return toDelete.indexOf(value) === -1; }); if (existing.length === 0) { this.headers["delete"](key); this.normalizedNames["delete"](key); } else { this.headers.set(key, existing); } } break; } } /** * \@internal * @param {?} fn * @return {?} */ }, { key: "forEach", value: function forEach(fn) { var _this18 = this; this.init(); Array.from(this.normalizedNames.keys()).forEach( /** * @param {?} key * @return {?} */ function (key) { return fn( /** @type {?} */ _this18.normalizedNames.get(key), /** @type {?} */ _this18.headers.get(key)); }); } }]); return HttpHeaders; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 codec for encoding and decoding parameters in URLs. * * Used by `HttpParams`. * * \@publicApi * * @record */ function HttpParameterCodec() {} if (false) {} /** * Provides encoding and decoding of URL parameter and query-string values. * * Serializes and parses URL parameter keys and values to encode and decode them. * If you pass URL query parameters without encoding, * the query parameters can be misinterpreted at the receiving end. * * * \@publicApi */ var HttpUrlEncodingCodec = /*#__PURE__*/function () { function HttpUrlEncodingCodec() { _classCallCheck(this, HttpUrlEncodingCodec); } _createClass2(HttpUrlEncodingCodec, [{ key: "encodeKey", /** * Encodes a key name for a URL parameter or query-string. * @param {?} key The key name. * @return {?} The encoded key name. */ value: function encodeKey(key) { return standardEncoding(key); } /** * Encodes the value of a URL parameter or query-string. * @param {?} value The value. * @return {?} The encoded value. */ }, { key: "encodeValue", value: function encodeValue(value) { return standardEncoding(value); } /** * Decodes an encoded URL parameter or query-string key. * @param {?} key The encoded key name. * @return {?} The decoded key name. */ }, { key: "decodeKey", value: function decodeKey(key) { return decodeURIComponent(key); } /** * Decodes an encoded URL parameter or query-string value. * @param {?} value The encoded value. * @return {?} The decoded value. */ }, { key: "decodeValue", value: function decodeValue(value) { return decodeURIComponent(value); } }]); return HttpUrlEncodingCodec; }(); /** * @param {?} rawParams * @param {?} codec * @return {?} */ function paramParser(rawParams, codec) { /** @type {?} */ var map = new Map(); if (rawParams.length > 0) { /** @type {?} */ var params = rawParams.split('&'); params.forEach( /** * @param {?} param * @return {?} */ function (param) { /** @type {?} */ var eqIdx = param.indexOf('='); var _ref4 = eqIdx == -1 ? [codec.decodeKey(param), ''] : [codec.decodeKey(param.slice(0, eqIdx)), codec.decodeValue(param.slice(eqIdx + 1))], _ref5 = _slicedToArray(_ref4, 2), key = _ref5[0], val = _ref5[1]; /** @type {?} */ var list = map.get(key) || []; list.push(val); map.set(key, list); }); } return map; } /** * @param {?} v * @return {?} */ function standardEncoding(v) { return encodeURIComponent(v).replace(/%40/gi, '@').replace(/%3A/gi, ':').replace(/%24/gi, '$').replace(/%2C/gi, ',').replace(/%3B/gi, ';').replace(/%2B/gi, '+').replace(/%3D/gi, '=').replace(/%3F/gi, '?').replace(/%2F/gi, '/'); } /** * @record */ function Update$1() {} if (false) {} /** * Options used to construct an `HttpParams` instance. * * \@publicApi * @record */ function HttpParamsOptions() {} if (false) {} /** * An HTTP request/response body that represents serialized parameters, * per the MIME type `application/x-www-form-urlencoded`. * * This class is immutable; all mutation operations return a new instance. * * \@publicApi */ var HttpParams = /*#__PURE__*/function () { /** * @param {?=} options */ function HttpParams() { var _this19 = this; var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : /** @type {?} */ {}; _classCallCheck(this, HttpParams); this.updates = null; this.cloneFrom = null; this.encoder = options.encoder || new HttpUrlEncodingCodec(); if (!!options.fromString) { if (!!options.fromObject) { throw new Error("Cannot specify both fromString and fromObject."); } this.map = paramParser(options.fromString, this.encoder); } else if (!!options.fromObject) { this.map = new Map(); Object.keys(options.fromObject).forEach( /** * @param {?} key * @return {?} */ function (key) { /** @type {?} */ var value = /** @type {?} */ options.fromObject[key]; /** @type {?} */ _this19.map.set(key, Array.isArray(value) ? value : [value]); }); } else { this.map = null; } } /** * Reports whether the body includes one or more values for a given parameter. * @param {?} param The parameter name. * @return {?} True if the parameter has one or more values, * false if it has no value or is not present. */ _createClass2(HttpParams, [{ key: "has", value: function has(param) { this.init(); return ( /** @type {?} */ this.map.has(param) ); } /** * Retrieves the first value for a parameter. * @param {?} param The parameter name. * @return {?} The first value of the given parameter, * or `null` if the parameter is not present. */ }, { key: "get", value: function get(param) { this.init(); /** @type {?} */ var res = /** @type {?} */ this.map.get(param); return !!res ? res[0] : null; } /** * Retrieves all values for a parameter. * @param {?} param The parameter name. * @return {?} All values in a string array, * or `null` if the parameter not present. */ }, { key: "getAll", value: function getAll(param) { this.init(); return ( /** @type {?} */ this.map.get(param) || null ); } /** * Retrieves all the parameters for this body. * @return {?} The parameter names in a string array. */ }, { key: "keys", value: function keys() { this.init(); return Array.from( /** @type {?} */ this.map.keys()); } /** * Appends a new value to existing values for a parameter. * @param {?} param The parameter name. * @param {?} value The new value to add. * @return {?} A new body with the appended value. */ }, { key: "append", value: function append(param, value) { return this.clone({ param: param, value: value, op: 'a' }); } /** * Replaces the value for a parameter. * @param {?} param The parameter name. * @param {?} value The new value. * @return {?} A new body with the new value. */ }, { key: "set", value: function set(param, value) { return this.clone({ param: param, value: value, op: 's' }); } /** * Removes a given value or all values from a parameter. * @param {?} param The parameter name. * @param {?=} value The value to remove, if provided. * @return {?} A new body with the given value removed, or with all values * removed if no value is specified. */ }, { key: "delete", value: function _delete(param, value) { return this.clone({ param: param, value: value, op: 'd' }); } /** * Serializes the body to an encoded string, where key-value pairs (separated by `=`) are * separated by `&`s. * @return {?} */ }, { key: "toString", value: function toString() { var _this20 = this; this.init(); return this.keys().map( /** * @param {?} key * @return {?} */ function (key) { /** @type {?} */ var eKey = _this20.encoder.encodeKey(key); return ( /** @type {?} */ /** @type {?} */ _this20.map.get(key).map( /** * @param {?} value * @return {?} */ function (value) { return eKey + '=' + _this20.encoder.encodeValue(value); }).join('&') ); }).join('&'); } /** * @private * @param {?} update * @return {?} */ }, { key: "clone", value: function clone(update) { /** @type {?} */ var clone = new HttpParams( /** @type {?} */ { encoder: this.encoder }); clone.cloneFrom = this.cloneFrom || this; clone.updates = (this.updates || []).concat([update]); return clone; } /** * @private * @return {?} */ }, { key: "init", value: function init() { var _this21 = this; if (this.map === null) { this.map = new Map(); } if (this.cloneFrom !== null) { this.cloneFrom.init(); this.cloneFrom.keys().forEach( /** * @param {?} key * @return {?} */ function (key) { return ( /** @type {?} */ _this21.map.set(key, /** @type {?} */ /** @type {?} */ /** @type {?} */ _this21.cloneFrom.map.get(key)) ); }); /** @type {?} */ this.updates.forEach( /** * @param {?} update * @return {?} */ function (update) { switch (update.op) { case 'a': case 's': /** @type {?} */ var base = (update.op === 'a' ? /** @type {?} */ _this21.map.get(update.param) : undefined) || []; base.push( /** @type {?} */ update.value); /** @type {?} */ _this21.map.set(update.param, base); break; case 'd': if (update.value !== undefined) { /** @type {?} */ var _base = /** @type {?} */ _this21.map.get(update.param) || []; /** @type {?} */ var idx = _base.indexOf(update.value); if (idx !== -1) { _base.splice(idx, 1); } if (_base.length > 0) { /** @type {?} */ _this21.map.set(update.param, _base); } else { /** @type {?} */ _this21.map["delete"](update.param); } } else { /** @type {?} */ _this21.map["delete"](update.param); break; } } }); this.cloneFrom = this.updates = null; } } }]); return HttpParams; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Construction interface for `HttpRequest`s. * * All values are optional and will override default values if provided. * @record */ function HttpRequestInit() {} if (false) {} /** * Determine whether the given HTTP method may include a body. * @param {?} method * @return {?} */ function mightHaveBody(method) { switch (method) { case 'DELETE': case 'GET': case 'HEAD': case 'OPTIONS': case 'JSONP': return false; default: return true; } } /** * Safely assert whether the given value is an ArrayBuffer. * * In some execution environments ArrayBuffer is not defined. * @param {?} value * @return {?} */ function isArrayBuffer(value) { return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer; } /** * Safely assert whether the given value is a Blob. * * In some execution environments Blob is not defined. * @param {?} value * @return {?} */ function isBlob(value) { return typeof Blob !== 'undefined' && value instanceof Blob; } /** * Safely assert whether the given value is a FormData instance. * * In some execution environments FormData is not defined. * @param {?} value * @return {?} */ function isFormData(value) { return typeof FormData !== 'undefined' && value instanceof FormData; } /** * An outgoing HTTP request with an optional typed body. * * `HttpRequest` represents an outgoing request, including URL, method, * headers, body, and other request configuration options. Instances should be * assumed to be immutable. To modify a `HttpRequest`, the `clone` * method should be used. * * \@publicApi * @template T */ var HttpRequest = /*#__PURE__*/function () { /** * @param {?} method * @param {?} url * @param {?=} third * @param {?=} fourth */ function HttpRequest(method, url, third, fourth) { _classCallCheck(this, HttpRequest); this.url = url; /** * The request body, or `null` if one isn't set. * * Bodies are not enforced to be immutable, as they can include a reference to any * user-defined data type. However, interceptors should take care to preserve * idempotence by treating them as such. */ this.body = null; /** * Whether this request should be made in a way that exposes progress events. * * Progress events are expensive (change detection runs on each event) and so * they should only be requested if the consumer intends to monitor them. */ this.reportProgress = false; /** * Whether this request should be sent with outgoing credentials (cookies). */ this.withCredentials = false; /** * The expected response type of the server. * * This is used to parse the response appropriately before returning it to * the requestee. */ this.responseType = 'json'; this.method = method.toUpperCase(); // Next, need to figure out which argument holds the HttpRequestInit // options, if any. /** @type {?} */ var options; // Check whether a body argument is expected. The only valid way to omit // the body argument is to use a known no-body method like GET. if (mightHaveBody(this.method) || !!fourth) { // Body is the third argument, options are the fourth. this.body = third !== undefined ? /** @type {?} */ third : null; options = fourth; } else { // No body required, options are the third argument. The body stays null. options = /** @type {?} */ third; } // If options have been passed, interpret them. if (options) { // Normalize reportProgress and withCredentials. this.reportProgress = !!options.reportProgress; this.withCredentials = !!options.withCredentials; // Override default response type of 'json' if one is provided. if (!!options.responseType) { this.responseType = options.responseType; } // Override headers if they're provided. if (!!options.headers) { this.headers = options.headers; } if (!!options.params) { this.params = options.params; } } // If no headers have been passed in, construct a new HttpHeaders instance. if (!this.headers) { this.headers = new HttpHeaders(); } // If no parameters have been passed in, construct a new HttpUrlEncodedParams instance. if (!this.params) { this.params = new HttpParams(); this.urlWithParams = url; } else { // Encode the parameters to a string in preparation for inclusion in the URL. /** @type {?} */ var params = this.params.toString(); if (params.length === 0) { // No parameters, the visible URL is just the URL given at creation time. this.urlWithParams = url; } else { // Does the URL already have query parameters? Look for '?'. /** @type {?} */ var qIdx = url.indexOf('?'); // There are 3 cases to handle: // 1) No existing parameters -> append '?' followed by params. // 2) '?' exists and is followed by existing query string -> // append '&' followed by params. // 3) '?' exists at the end of the url -> append params directly. // This basically amounts to determining the character, if any, with // which to join the URL and parameters. /** @type {?} */ var sep = qIdx === -1 ? '?' : qIdx < url.length - 1 ? '&' : ''; this.urlWithParams = url + sep + params; } } } /** * Transform the free-form body into a serialized format suitable for * transmission to the server. * @return {?} */ _createClass2(HttpRequest, [{ key: "serializeBody", value: function serializeBody() { // If no body is present, no need to serialize it. if (this.body === null) { return null; } // Check whether the body is already in a serialized form. If so, // it can just be returned directly. if (isArrayBuffer(this.body) || isBlob(this.body) || isFormData(this.body) || typeof this.body === 'string') { return this.body; } // Check whether the body is an instance of HttpUrlEncodedParams. if (this.body instanceof HttpParams) { return this.body.toString(); } // Check whether the body is an object or array, and serialize with JSON if so. if (typeof this.body === 'object' || typeof this.body === 'boolean' || Array.isArray(this.body)) { return JSON.stringify(this.body); } // Fall back on toString() for everything else. return ( /** @type {?} */ this.body.toString() ); } /** * Examine the body and attempt to infer an appropriate MIME type * for it. * * If no such type can be inferred, this method will return `null`. * @return {?} */ }, { key: "detectContentTypeHeader", value: function detectContentTypeHeader() { // An empty body has no content type. if (this.body === null) { return null; } // FormData bodies rely on the browser's content type assignment. if (isFormData(this.body)) { return null; } // Blobs usually have their own content type. If it doesn't, then // no type can be inferred. if (isBlob(this.body)) { return this.body.type || null; } // Array buffers have unknown contents and thus no type can be inferred. if (isArrayBuffer(this.body)) { return null; } // Technically, strings could be a form of JSON data, but it's safe enough // to assume they're plain strings. if (typeof this.body === 'string') { return 'text/plain'; } // `HttpUrlEncodedParams` has its own content-type. if (this.body instanceof HttpParams) { return 'application/x-www-form-urlencoded;charset=UTF-8'; } // Arrays, objects, and numbers will be encoded as JSON. if (typeof this.body === 'object' || typeof this.body === 'number' || Array.isArray(this.body)) { return 'application/json'; } // No type could be inferred. return null; } /** * @param {?=} update * @return {?} */ }, { key: "clone", value: function clone() { var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; // For method, url, and responseType, take the current value unless // it is overridden in the update hash. /** @type {?} */ var method = update.method || this.method; /** @type {?} */ var url = update.url || this.url; /** @type {?} */ var responseType = update.responseType || this.responseType; // The body is somewhat special - a `null` value in update.body means // whatever current body is present is being overridden with an empty // body, whereas an `undefined` value in update.body implies no // override. /** @type {?} */ var body = update.body !== undefined ? update.body : this.body; // Carefully handle the boolean options to differentiate between // `false` and `undefined` in the update args. /** @type {?} */ var withCredentials = update.withCredentials !== undefined ? update.withCredentials : this.withCredentials; /** @type {?} */ var reportProgress = update.reportProgress !== undefined ? update.reportProgress : this.reportProgress; // Headers and params may be appended to if `setHeaders` or // `setParams` are used. /** @type {?} */ var headers = update.headers || this.headers; /** @type {?} */ var params = update.params || this.params; // Check whether the caller has asked to add headers. if (update.setHeaders !== undefined) { // Set every requested header. headers = Object.keys(update.setHeaders).reduce( /** * @param {?} headers * @param {?} name * @return {?} */ function (headers, name) { return headers.set(name, /** @type {?} */ update.setHeaders[name]); }, headers); } // Check whether the caller has asked to set params. if (update.setParams) { // Set every requested param. params = Object.keys(update.setParams).reduce( /** * @param {?} params * @param {?} param * @return {?} */ function (params, param) { return params.set(param, /** @type {?} */ update.setParams[param]); }, params); } // Finally, construct the new HttpRequest using the pieces from above. return new HttpRequest(method, url, body, { params: params, headers: headers, reportProgress: reportProgress, responseType: responseType, withCredentials: withCredentials }); } }]); return HttpRequest; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @enum {number} */ var HttpEventType = { /** * The request was sent out over the wire. */ Sent: 0, /** * An upload progress event was received. */ UploadProgress: 1, /** * The response status code and headers were received. */ ResponseHeader: 2, /** * A download progress event was received. */ DownloadProgress: 3, /** * The full response including the body was received. */ Response: 4, /** * A custom event from an interceptor or a backend. */ User: 5 }; HttpEventType[HttpEventType.Sent] = 'Sent'; HttpEventType[HttpEventType.UploadProgress] = 'UploadProgress'; HttpEventType[HttpEventType.ResponseHeader] = 'ResponseHeader'; HttpEventType[HttpEventType.DownloadProgress] = 'DownloadProgress'; HttpEventType[HttpEventType.Response] = 'Response'; HttpEventType[HttpEventType.User] = 'User'; /** * Base interface for progress events. * * \@publicApi * @record */ function HttpProgressEvent() {} if (false) {} /** * A download progress event. * * \@publicApi * @record */ function HttpDownloadProgressEvent() {} if (false) {} /** * An upload progress event. * * \@publicApi * @record */ function HttpUploadProgressEvent() {} if (false) {} /** * An event indicating that the request was sent to the server. Useful * when a request may be retried multiple times, to distinguish between * retries on the final event stream. * * \@publicApi * @record */ function HttpSentEvent() {} if (false) {} /** * A user-defined event. * * Grouping all custom events under this type ensures they will be handled * and forwarded by all implementations of interceptors. * * \@publicApi * @record * @template T */ function HttpUserEvent() {} if (false) {} /** * An error that represents a failed attempt to JSON.parse text coming back * from the server. * * It bundles the Error object with the actual response body that failed to parse. * * * @record */ function HttpJsonParseError() {} if (false) {} /** * Base class for both `HttpResponse` and `HttpHeaderResponse`. * * \@publicApi * @abstract */ var HttpResponseBase = /** * Super-constructor for all responses. * * The single parameter accepted is an initialization hash. Any properties * of the response passed there will override the default values. * @param {?} init * @param {?=} defaultStatus * @param {?=} defaultStatusText */ function HttpResponseBase(init) { var defaultStatus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200; var defaultStatusText = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'OK'; _classCallCheck(this, HttpResponseBase); // If the hash has values passed, use them to initialize the response. // Otherwise use the default values. this.headers = init.headers || new HttpHeaders(); this.status = init.status !== undefined ? init.status : defaultStatus; this.statusText = init.statusText || defaultStatusText; this.url = init.url || null; // Cache the ok value to avoid defining a getter. this.ok = this.status >= 200 && this.status < 300; }; if (false) {} /** * A partial HTTP response which only includes the status and header data, * but no response body. * * `HttpHeaderResponse` is a `HttpEvent` available on the response * event stream, only when progress events are requested. * * \@publicApi */ var HttpHeaderResponse = /*#__PURE__*/function (_HttpResponseBase) { _inherits(HttpHeaderResponse, _HttpResponseBase); var _super6 = _createSuper(HttpHeaderResponse); /** * Create a new `HttpHeaderResponse` with the given parameters. * @param {?=} init */ function HttpHeaderResponse() { var _this22; var init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, HttpHeaderResponse); _this22 = _super6.call(this, init); _this22.type = HttpEventType.ResponseHeader; return _this22; } /** * Copy this `HttpHeaderResponse`, overriding its contents with the * given parameter hash. * @param {?=} update * @return {?} */ _createClass2(HttpHeaderResponse, [{ key: "clone", value: function clone() { var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; // Perform a straightforward initialization of the new HttpHeaderResponse, // overriding the current parameters with new ones if given. return new HttpHeaderResponse({ headers: update.headers || this.headers, status: update.status !== undefined ? update.status : this.status, statusText: update.statusText || this.statusText, url: update.url || this.url || undefined }); } }]); return HttpHeaderResponse; }(HttpResponseBase); if (false) {} /** * A full HTTP response, including a typed response body (which may be `null` * if one was not returned). * * `HttpResponse` is a `HttpEvent` available on the response event * stream. * * \@publicApi * @template T */ var HttpResponse = /*#__PURE__*/function (_HttpResponseBase2) { _inherits(HttpResponse, _HttpResponseBase2); var _super7 = _createSuper(HttpResponse); /** * Construct a new `HttpResponse`. * @param {?=} init */ function HttpResponse() { var _this23; var init = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, HttpResponse); _this23 = _super7.call(this, init); _this23.type = HttpEventType.Response; _this23.body = init.body !== undefined ? init.body : null; return _this23; } /** * @param {?=} update * @return {?} */ _createClass2(HttpResponse, [{ key: "clone", value: function clone() { var update = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return new HttpResponse({ body: update.body !== undefined ? update.body : this.body, headers: update.headers || this.headers, status: update.status !== undefined ? update.status : this.status, statusText: update.statusText || this.statusText, url: update.url || this.url || undefined }); } }]); return HttpResponse; }(HttpResponseBase); if (false) {} /** * A response that represents an error or failure, either from a * non-successful HTTP status, an error while executing the request, * or some other failure which occurred during the parsing of the response. * * Any error returned on the `Observable` response stream will be * wrapped in an `HttpErrorResponse` to provide additional context about * the state of the HTTP layer when the error occurred. The error property * will contain either a wrapped Error object or the error response returned * from the server. * * \@publicApi */ var HttpErrorResponse = /*#__PURE__*/function (_HttpResponseBase3) { _inherits(HttpErrorResponse, _HttpResponseBase3); var _super8 = _createSuper(HttpErrorResponse); /** * @param {?} init */ function HttpErrorResponse(init) { var _this24; _classCallCheck(this, HttpErrorResponse); // Initialize with a default status of 0 / Unknown Error. _this24 = _super8.call(this, init, 0, 'Unknown Error'); _this24.name = 'HttpErrorResponse'; /** * Errors are never okay, even when the status code is in the 2xx success range. */ _this24.ok = false; // If the response was successful, then this was a parse error. Otherwise, it was // a protocol-level failure of some sort. Either the request failed in transit // or the server returned an unsuccessful status code. if (_this24.status >= 200 && _this24.status < 300) { _this24.message = "Http failure during parsing for ".concat(init.url || '(unknown url)'); } else { _this24.message = "Http failure response for ".concat(init.url || '(unknown url)', ": ").concat(init.status, " ").concat(init.statusText); } _this24.error = init.error || null; return _this24; } return HttpErrorResponse; }(HttpResponseBase); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Constructs an instance of `HttpRequestOptions<T>` from a source `HttpMethodOptions` and * the given `body`. This function clones the object and adds the body. * * Note that the `responseType` *options* value is a String that identifies the * single data type of the response. * A single overload version of the method handles each response type. * The value of `responseType` cannot be a union, as the combined signature could imply. * * @template T * @param {?} options * @param {?} body * @return {?} */ function addBody(options, body) { return { body: body, headers: options.headers, observe: options.observe, params: options.params, reportProgress: options.reportProgress, responseType: options.responseType, withCredentials: options.withCredentials }; } /** * Performs HTTP requests. * This service is available as an injectable class, with methods to perform HTTP requests. * Each request method has multiple signatures, and the return type varies based on * the signature that is called (mainly the values of `observe` and `responseType`). * * Note that the `responseType` *options* value is a String that identifies the * single data type of the response. * A single overload version of the method handles each response type. * The value of `responseType` cannot be a union, as the combined signature could imply. * * \@usageNotes * Sample HTTP requests for the [Tour of Heroes](/tutorial/toh-pt0) application. * * ### HTTP Request Example * * ``` * // GET heroes whose name contains search term * searchHeroes(term: string): observable<Hero[]>{ * * const params = new HttpParams({fromString: 'name=term'}); * return this.httpClient.request('GET', this.heroesUrl, {responseType:'json', params}); * } * ``` * ### JSONP Example * ``` * requestJsonp(url, callback = 'callback') { * return this.httpClient.jsonp(this.heroesURL, callback); * } * ``` * * ### PATCH Example * ``` * // PATCH one of the heroes' name * patchHero (id: number, heroName: string): Observable<{}> { * const url = `${this.heroesUrl}/${id}`; // PATCH api/heroes/42 * return this.httpClient.patch(url, {name: heroName}, httpOptions) * .pipe(catchError(this.handleError('patchHero'))); * } * ``` * * @see [HTTP Guide](guide/http) * * \@publicApi */ var HttpClient = /*#__PURE__*/function () { /** * @param {?} handler */ function HttpClient(handler) { _classCallCheck(this, HttpClient); this.handler = handler; } /** * Constructs an observable for a generic HTTP request that, when subscribed, * fires the request through the chain of registered interceptors and on to the * server. * * You can pass an `HttpRequest` directly as the only parameter. In this case, * the call returns an observable of the raw `HttpEvent` stream. * * Alternatively you can pass an HTTP method as the first parameter, * a URL string as the second, and an options hash containing the request body as the third. * See `addBody()`. In this case, the specified `responseType` and `observe` options determine the * type of returned observable. * * The `responseType` value determines how a successful response body is parsed. * * If `responseType` is the default `json`, you can pass a type interface for the resulting * object as a type parameter to the call. * * The `observe` value determines the return type, according to what you are interested in * observing. * * An `observe` value of events returns an observable of the raw `HttpEvent` stream, including * progress events by default. * * An `observe` value of response returns an observable of `HttpResponse<T>`, * where the `T` parameter depends on the `responseType` and any optionally provided type * parameter. * * An `observe` value of body returns an observable of `<T>` with the same `T` body type. * * @param {?} first * @param {?=} url * @param {?=} options * @return {?} */ _createClass2(HttpClient, [{ key: "request", value: function request(first, url) { var _this25 = this; var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; /** @type {?} */ var req; // First, check whether the primary argument is an instance of `HttpRequest`. if (first instanceof HttpRequest) { // It is. The other arguments must be undefined (per the signatures) and can be // ignored. req = /** @type {?} */ first; } else { // It's a string, so it represents a URL. Construct a request based on it, // and incorporate the remaining arguments (assuming `GET` unless a method is // provided. // Figure out the headers. /** @type {?} */ var headers = undefined; if (options.headers instanceof HttpHeaders) { headers = options.headers; } else { headers = new HttpHeaders(options.headers); } // Sort out parameters. /** @type {?} */ var params = undefined; if (!!options.params) { if (options.params instanceof HttpParams) { params = options.params; } else { params = new HttpParams( /** @type {?} */ { fromObject: options.params }); } } // Construct the request. req = new HttpRequest(first, /** @type {?} */ url, options.body !== undefined ? options.body : null, { headers: headers, params: params, reportProgress: options.reportProgress, // By default, JSON is assumed to be returned for all calls. responseType: options.responseType || 'json', withCredentials: options.withCredentials }); } // Start with an Observable.of() the initial request, and run the handler (which // includes all interceptors) inside a concatMap(). This way, the handler runs // inside an Observable chain, which causes interceptors to be re-run on every // subscription (this also makes retries re-run the handler, including interceptors). /** @type {?} */ var events$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_1__["of"])(req).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__["concatMap"])( /** * @param {?} req * @return {?} */ function (req) { return _this25.handler.handle(req); })); // If coming via the API signature which accepts a previously constructed HttpRequest, // the only option is to get the event stream. Otherwise, return the event stream if // that is what was requested. if (first instanceof HttpRequest || options.observe === 'events') { return events$; } // The requested stream contains either the full response or the body. In either // case, the first step is to filter the event stream to extract a stream of // responses(s). /** @type {?} */ var res$ = /** @type {?} */ events$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__["filter"])( /** * @param {?} event * @return {?} */ function (event) { return event instanceof HttpResponse; })); // Decide which stream to return. switch (options.observe || 'body') { case 'body': // The requested stream is the body. Map the response stream to the response // body. This could be done more simply, but a misbehaving interceptor might // transform the response body into a different format and ignore the requested // responseType. Guard against this by validating that the response is of the // requested type. switch (req.responseType) { case 'arraybuffer': return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__["map"])( /** * @param {?} res * @return {?} */ function (res) { // Validate that the body is an ArrayBuffer. if (res.body !== null && !(res.body instanceof ArrayBuffer)) { throw new Error('Response is not an ArrayBuffer.'); } return res.body; })); case 'blob': return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__["map"])( /** * @param {?} res * @return {?} */ function (res) { // Validate that the body is a Blob. if (res.body !== null && !(res.body instanceof Blob)) { throw new Error('Response is not a Blob.'); } return res.body; })); case 'text': return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__["map"])( /** * @param {?} res * @return {?} */ function (res) { // Validate that the body is a string. if (res.body !== null && typeof res.body !== 'string') { throw new Error('Response is not a string.'); } return res.body; })); case 'json': default: // No validation needed for JSON responses, as they can be of any type. return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__["map"])( /** * @param {?} res * @return {?} */ function (res) { return res.body; })); } case 'response': // The response stream was requested directly, so return it. return res$; default: // Guard against new future observe types being added. throw new Error("Unreachable: unhandled observe type ".concat(options.observe, "}")); } } /** * Constructs an observable that, when subscribed, causes the configured * `DELETE` request to execute on the server. See the individual overloads for * details on the return type. * * @param {?} url The endpoint URL. * @param {?=} options The HTTP options to send with the request. * * @return {?} */ }, { key: "delete", value: function _delete(url) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return this.request('DELETE', url, /** @type {?} */ options); } /** * Constructs an observable that, when subscribed, causes the configured * `GET` request to execute on the server. See the individual overloads for * details on the return type. * @param {?} url * @param {?=} options * @return {?} */ }, { key: "get", value: function get(url) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return this.request('GET', url, /** @type {?} */ options); } /** * Constructs an observable that, when subscribed, causes the configured * `HEAD` request to execute on the server. The `HEAD` method returns * meta information about the resource without transferring the * resource itself. See the individual overloads for * details on the return type. * @param {?} url * @param {?=} options * @return {?} */ }, { key: "head", value: function head(url) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return this.request('HEAD', url, /** @type {?} */ options); } /** * Constructs an `Observable` that, when subscribed, causes a request with the special method * `JSONP` to be dispatched via the interceptor pipeline. * The [JSONP pattern](https://en.wikipedia.org/wiki/JSONP) works around limitations of certain * API endpoints that don't support newer, * and preferable [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) protocol. * JSONP treats the endpoint API as a JavaScript file and tricks the browser to process the * requests even if the API endpoint is not located on the same domain (origin) as the client-side * application making the request. * The endpoint API must support JSONP callback for JSONP requests to work. * The resource API returns the JSON response wrapped in a callback function. * You can pass the callback function name as one of the query parameters. * Note that JSONP requests can only be used with `GET` requests. * * @template T * @param {?} url The resource URL. * @param {?} callbackParam The callback function name. * * @return {?} */ }, { key: "jsonp", value: function jsonp(url, callbackParam) { return this.request('JSONP', url, { params: new HttpParams().append(callbackParam, 'JSONP_CALLBACK'), observe: 'body', responseType: 'json' }); } /** * Constructs an `Observable` that, when subscribed, causes the configured * `OPTIONS` request to execute on the server. This method allows the client * to determine the supported HTTP methods and other capabilites of an endpoint, * without implying a resource action. See the individual overloads for * details on the return type. * @param {?} url * @param {?=} options * @return {?} */ }, { key: "options", value: function options(url) { var _options2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return this.request('OPTIONS', url, /** @type {?} */ _options2); } /** * Constructs an observable that, when subscribed, causes the configured * `PATCH` request to execute on the server. See the individual overloads for * details on the return type. * @param {?} url * @param {?} body * @param {?=} options * @return {?} */ }, { key: "patch", value: function patch(url, body) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; return this.request('PATCH', url, addBody(options, body)); } /** * Constructs an observable that, when subscribed, causes the configured * `POST` request to execute on the server. The server responds with the location of * the replaced resource. See the individual overloads for * details on the return type. * @param {?} url * @param {?} body * @param {?=} options * @return {?} */ }, { key: "post", value: function post(url, body) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; return this.request('POST', url, addBody(options, body)); } /** * Constructs an observable that, when subscribed, causes the configured * `PUT` request to execute on the server. The `PUT` method replaces an existing resource * with a new set of values. * See the individual overloads for details on the return type. * @param {?} url * @param {?} body * @param {?=} options * @return {?} */ }, { key: "put", value: function put(url, body) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; return this.request('PUT', url, addBody(options, body)); } }]); return HttpClient; }(); HttpClient.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; /** @nocollapse */ HttpClient.ctorParameters = function () { return [{ type: HttpHandler }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Intercepts and handles an `HttpRequest` or `HttpResponse`. * * Most interceptors transform the outgoing request before passing it to the * next interceptor in the chain, by calling `next.handle(transformedReq)`. * An interceptor may transform the * response event stream as well, by applying additional RxJS operators on the stream * returned by `next.handle()`. * * More rarely, an interceptor may handle the request entirely, * and compose a new event stream instead of invoking `next.handle()`. This is an * acceptable behavior, but keep in mind that further interceptors will be skipped entirely. * * It is also rare but valid for an interceptor to return multiple responses on the * event stream for a single request. * * \@publicApi * * @see [HTTP Guide](guide/http#intercepting-requests-and-responses) * * \@usageNotes * * To use the same instance of `HttpInterceptors` for the entire app, import the `HttpClientModule` * only in your `AppModule`, and add the interceptors to the root application injector . * If you import `HttpClientModule` multiple times across different modules (for example, in lazy * loading modules), each import creates a new copy of the `HttpClientModule`, which overwrites the interceptors * provided in the root module. * * @record */ function HttpInterceptor() {} if (false) {} /** * `HttpHandler` which applies an `HttpInterceptor` to an `HttpRequest`. * * */ var HttpInterceptorHandler = /*#__PURE__*/function () { /** * @param {?} next * @param {?} interceptor */ function HttpInterceptorHandler(next, interceptor) { _classCallCheck(this, HttpInterceptorHandler); this.next = next; this.interceptor = interceptor; } /** * @param {?} req * @return {?} */ _createClass2(HttpInterceptorHandler, [{ key: "handle", value: function handle(req) { return this.interceptor.intercept(req, this.next); } }]); return HttpInterceptorHandler; }(); if (false) {} /** * A multi-provider token that represents the array of registered * `HttpInterceptor` objects. * * \@publicApi * @type {?} */ var HTTP_INTERCEPTORS = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('HTTP_INTERCEPTORS'); var NoopInterceptor = /*#__PURE__*/function () { function NoopInterceptor() { _classCallCheck(this, NoopInterceptor); } _createClass2(NoopInterceptor, [{ key: "intercept", /** * @param {?} req * @param {?} next * @return {?} */ value: function intercept(req, next) { return next.handle(req); } }]); return NoopInterceptor; }(); NoopInterceptor.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // Every request made through JSONP needs a callback name that's unique across the // whole page. Each request is assigned an id and the callback name is constructed // from that. The next id to be assigned is tracked in a global variable here that // is shared among all applications on the page. /** @type {?} */ var nextRequestId = 0; // Error text given when a JSONP script is injected, but doesn't invoke the callback // passed in its URL. /** @type {?} */ var JSONP_ERR_NO_CALLBACK = 'JSONP injected script did not invoke callback.'; // Error text given when a request is passed to the JsonpClientBackend that doesn't // have a request method JSONP. /** @type {?} */ var JSONP_ERR_WRONG_METHOD = 'JSONP requests must use JSONP request method.'; /** @type {?} */ var JSONP_ERR_WRONG_RESPONSE_TYPE = 'JSONP requests must use Json response type.'; /** * DI token/abstract type representing a map of JSONP callbacks. * * In the browser, this should always be the `window` object. * * * @abstract */ var JsonpCallbackContext = function JsonpCallbackContext() { _classCallCheck(this, JsonpCallbackContext); }; /** * Processes an `HttpRequest` with the JSONP method, * by performing JSONP style requests. * @see `HttpHandler` * @see `HttpXhrBackend` * * \@publicApi */ var JsonpClientBackend = /*#__PURE__*/function () { /** * @param {?} callbackMap * @param {?} document */ function JsonpClientBackend(callbackMap, document) { _classCallCheck(this, JsonpClientBackend); this.callbackMap = callbackMap; this.document = document; } /** * Get the name of the next callback method, by incrementing the global `nextRequestId`. * @private * @return {?} */ _createClass2(JsonpClientBackend, [{ key: "nextCallback", value: function nextCallback() { return "ng_jsonp_callback_".concat(nextRequestId++); } /** * Processes a JSONP request and returns an event stream of the results. * @param {?} req The request object. * @return {?} An observable of the response events. * */ }, { key: "handle", value: function handle(req) { var _this26 = this; // Firstly, check both the method and response type. If either doesn't match // then the request was improperly routed here and cannot be handled. if (req.method !== 'JSONP') { throw new Error(JSONP_ERR_WRONG_METHOD); } else if (req.responseType !== 'json') { throw new Error(JSONP_ERR_WRONG_RESPONSE_TYPE); } // Everything else happens inside the Observable boundary. return new rxjs__WEBPACK_IMPORTED_MODULE_1__["Observable"]( /** * @param {?} observer * @return {?} */ function (observer) { // The first step to make a request is to generate the callback name, and replace the // callback placeholder in the URL with the name. Care has to be taken here to ensure // a trailing &, if matched, gets inserted back into the URL in the correct place. /** @type {?} */ var callback = _this26.nextCallback(); /** @type {?} */ var url = req.urlWithParams.replace(/=JSONP_CALLBACK(&|$)/, "=".concat(callback, "$1")); // Construct the <script> tag and point it at the URL. /** @type {?} */ var node = _this26.document.createElement('script'); node.src = url; // A JSONP request requires waiting for multiple callbacks. These variables // are closed over and track state across those callbacks. // The response object, if one has been received, or null otherwise. /** @type {?} */ var body = null; // Whether the response callback has been called. /** @type {?} */ var finished = false; // Whether the request has been cancelled (and thus any other callbacks) // should be ignored. /** @type {?} */ var cancelled = false; // Set the response callback in this.callbackMap (which will be the window // object in the browser. The script being loaded via the <script> tag will // eventually call this callback. _this26.callbackMap[callback] = /** * @param {?=} data * @return {?} */ function (data) { // Data has been received from the JSONP script. Firstly, delete this callback. delete _this26.callbackMap[callback]; // Next, make sure the request wasn't cancelled in the meantime. if (cancelled) { return; } // Set state to indicate data was received. body = data; finished = true; }; // cleanup() is a utility closure that removes the <script> from the page and // the response callback from the window. This logic is used in both the // success, error, and cancellation paths, so it's extracted out for convenience. /** @type {?} */ var cleanup = /** * @return {?} */ function cleanup() { // Remove the <script> tag if it's still on the page. if (node.parentNode) { node.parentNode.removeChild(node); } // Remove the response callback from the callbackMap (window object in the // browser). delete _this26.callbackMap[callback]; }; // onLoad() is the success callback which runs after the response callback // if the JSONP script loads successfully. The event itself is unimportant. // If something went wrong, onLoad() may run without the response callback // having been invoked. /** @type {?} */ var onLoad = /** * @param {?} event * @return {?} */ function onLoad(event) { // Do nothing if the request has been cancelled. if (cancelled) { return; } // Cleanup the page. cleanup(); // Check whether the response callback has run. if (!finished) { // It hasn't, something went wrong with the request. Return an error via // the Observable error path. All JSONP errors have status 0. observer.error(new HttpErrorResponse({ url: url, status: 0, statusText: 'JSONP Error', error: new Error(JSONP_ERR_NO_CALLBACK) })); return; } // Success. body either contains the response body or null if none was // returned. observer.next(new HttpResponse({ body: body, status: 200, statusText: 'OK', url: url })); // Complete the stream, the response is over. observer.complete(); }; // onError() is the error callback, which runs if the script returned generates // a Javascript error. It emits the error via the Observable error channel as // a HttpErrorResponse. /** @type {?} */ var onError = /** * @param {?} error * @return {?} */ function onError(error) { // If the request was already cancelled, no need to emit anything. if (cancelled) { return; } cleanup(); // Wrap the error in a HttpErrorResponse. observer.error(new HttpErrorResponse({ error: error, status: 0, statusText: 'JSONP Error', url: url })); }; // Subscribe to both the success (load) and error events on the <script> tag, // and add it to the page. node.addEventListener('load', onLoad); node.addEventListener('error', onError); _this26.document.body.appendChild(node); // The request has now been successfully sent. observer.next({ type: HttpEventType.Sent }); // Cancellation handler. return ( /** * @return {?} */ function () { // Track the cancellation so event listeners won't do anything even if already scheduled. cancelled = true; // Remove the event listeners so they won't run if the events later fire. node.removeEventListener('load', onLoad); node.removeEventListener('error', onError); // And finally, clean up the page. cleanup(); } ); }); } }]); return JsonpClientBackend; }(); JsonpClientBackend.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; /** @nocollapse */ JsonpClientBackend.ctorParameters = function () { return [{ type: JsonpCallbackContext }, { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_common__WEBPACK_IMPORTED_MODULE_3__["DOCUMENT"]] }] }]; }; if (false) {} /** * Identifies requests with the method JSONP and * shifts them to the `JsonpClientBackend`. * * @see `HttpInterceptor` * * \@publicApi */ var JsonpInterceptor = /*#__PURE__*/function () { /** * @param {?} jsonp */ function JsonpInterceptor(jsonp) { _classCallCheck(this, JsonpInterceptor); this.jsonp = jsonp; } /** * Identifies and handles a given JSONP request. * @param {?} req The outgoing request object to handle. * @param {?} next The next interceptor in the chain, or the backend * if no interceptors remain in the chain. * @return {?} An observable of the event stream. */ _createClass2(JsonpInterceptor, [{ key: "intercept", value: function intercept(req, next) { if (req.method === 'JSONP') { return this.jsonp.handle( /** @type {?} */ req); } // Fall through for normal HTTP requests. return next.handle(req); } }]); return JsonpInterceptor; }(); JsonpInterceptor.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; /** @nocollapse */ JsonpInterceptor.ctorParameters = function () { return [{ type: JsonpClientBackend }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var XSSI_PREFIX = /^\)\]\}',?\n/; /** * Determine an appropriate URL for the response, by checking either * XMLHttpRequest.responseURL or the X-Request-URL header. * @param {?} xhr * @return {?} */ function getResponseUrl(xhr) { if ('responseURL' in xhr && xhr.responseURL) { return xhr.responseURL; } if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) { return xhr.getResponseHeader('X-Request-URL'); } return null; } /** * A wrapper around the `XMLHttpRequest` constructor. * * \@publicApi * @abstract */ var XhrFactory = function XhrFactory() { _classCallCheck(this, XhrFactory); }; if (false) {} /** * A factory for `HttpXhrBackend` that uses the `XMLHttpRequest` browser API. * */ var BrowserXhr = /*#__PURE__*/function () { function BrowserXhr() { _classCallCheck(this, BrowserXhr); } /** * @return {?} */ _createClass2(BrowserXhr, [{ key: "build", value: function build() { return ( /** @type {?} */ new XMLHttpRequest() ); } }]); return BrowserXhr; }(); BrowserXhr.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; /** @nocollapse */ BrowserXhr.ctorParameters = function () { return []; }; /** * Tracks a response from the server that does not yet have a body. * @record */ function PartialResponse() {} if (false) {} /** * Uses `XMLHttpRequest` to send requests to a backend server. * @see `HttpHandler` * @see `JsonpClientBackend` * * \@publicApi */ var HttpXhrBackend = /*#__PURE__*/function () { /** * @param {?} xhrFactory */ function HttpXhrBackend(xhrFactory) { _classCallCheck(this, HttpXhrBackend); this.xhrFactory = xhrFactory; } /** * Processes a request and returns a stream of response events. * @param {?} req The request object. * @return {?} An observable of the response events. */ _createClass2(HttpXhrBackend, [{ key: "handle", value: function handle(req) { var _this27 = this; // Quick check to give a better error message when a user attempts to use // HttpClient.jsonp() without installing the JsonpClientModule if (req.method === 'JSONP') { throw new Error("Attempted to construct Jsonp request without JsonpClientModule installed."); } // Everything happens on Observable subscription. return new rxjs__WEBPACK_IMPORTED_MODULE_1__["Observable"]( /** * @param {?} observer * @return {?} */ function (observer) { // Start by setting up the XHR object with request method, URL, and withCredentials flag. /** @type {?} */ var xhr = _this27.xhrFactory.build(); xhr.open(req.method, req.urlWithParams); if (!!req.withCredentials) { xhr.withCredentials = true; } // Add all the requested headers. req.headers.forEach( /** * @param {?} name * @param {?} values * @return {?} */ function (name, values) { return xhr.setRequestHeader(name, values.join(',')); }); // Add an Accept header if one isn't present already. if (!req.headers.has('Accept')) { xhr.setRequestHeader('Accept', 'application/json, text/plain, */*'); } // Auto-detect the Content-Type header if one isn't present already. if (!req.headers.has('Content-Type')) { /** @type {?} */ var detectedType = req.detectContentTypeHeader(); // Sometimes Content-Type detection fails. if (detectedType !== null) { xhr.setRequestHeader('Content-Type', detectedType); } } // Set the responseType if one was requested. if (req.responseType) { /** @type {?} */ var responseType = req.responseType.toLowerCase(); // JSON responses need to be processed as text. This is because if the server // returns an XSSI-prefixed JSON response, the browser will fail to parse it, // xhr.response will be null, and xhr.responseText cannot be accessed to // retrieve the prefixed JSON data in order to strip the prefix. Thus, all JSON // is parsed by first requesting text and then applying JSON.parse. xhr.responseType = /** @type {?} */ responseType !== 'json' ? responseType : 'text'; } // Serialize the request body if one is present. If not, this will be set to null. /** @type {?} */ var reqBody = req.serializeBody(); // If progress events are enabled, response headers will be delivered // in two events - the HttpHeaderResponse event and the full HttpResponse // event. However, since response headers don't change in between these // two events, it doesn't make sense to parse them twice. So headerResponse // caches the data extracted from the response whenever it's first parsed, // to ensure parsing isn't duplicated. /** @type {?} */ var headerResponse = null; // partialFromXhr extracts the HttpHeaderResponse from the current XMLHttpRequest // state, and memoizes it into headerResponse. /** @type {?} */ var partialFromXhr = /** * @return {?} */ function partialFromXhr() { if (headerResponse !== null) { return headerResponse; } // Read status and normalize an IE9 bug (http://bugs.jquery.com/ticket/1450). /** @type {?} */ var status = xhr.status === 1223 ? 204 : xhr.status; /** @type {?} */ var statusText = xhr.statusText || 'OK'; // Parse headers from XMLHttpRequest - this step is lazy. /** @type {?} */ var headers = new HttpHeaders(xhr.getAllResponseHeaders()); // Read the response URL from the XMLHttpResponse instance and fall back on the // request URL. /** @type {?} */ var url = getResponseUrl(xhr) || req.url; // Construct the HttpHeaderResponse and memoize it. headerResponse = new HttpHeaderResponse({ headers: headers, status: status, statusText: statusText, url: url }); return headerResponse; }; // Next, a few closures are defined for the various events which XMLHttpRequest can // emit. This allows them to be unregistered as event listeners later. // First up is the load event, which represents a response being fully available. /** @type {?} */ var onLoad = /** * @return {?} */ function onLoad() { // Read response state from the memoized partial data. var _partialFromXhr = partialFromXhr(), headers = _partialFromXhr.headers, status = _partialFromXhr.status, statusText = _partialFromXhr.statusText, url = _partialFromXhr.url; // The body will be read out if present. /** @type {?} */ var body = null; if (status !== 204) { // Use XMLHttpRequest.response if set, responseText otherwise. body = typeof xhr.response === 'undefined' ? xhr.responseText : xhr.response; } // Normalize another potential bug (this one comes from CORS). if (status === 0) { status = !!body ? 200 : 0; } // ok determines whether the response will be transmitted on the event or // error channel. Unsuccessful status codes (not 2xx) will always be errors, // but a successful status code can still result in an error if the user // asked for JSON data and the body cannot be parsed as such. /** @type {?} */ var ok = status >= 200 && status < 300; // Check whether the body needs to be parsed as JSON (in many cases the browser // will have done that already). if (req.responseType === 'json' && typeof body === 'string') { // Save the original body, before attempting XSSI prefix stripping. /** @type {?} */ var originalBody = body; body = body.replace(XSSI_PREFIX, ''); try { // Attempt the parse. If it fails, a parse error should be delivered to the user. body = body !== '' ? JSON.parse(body) : null; } catch (error) { // Since the JSON.parse failed, it's reasonable to assume this might not have been a // JSON response. Restore the original body (including any XSSI prefix) to deliver // a better error response. body = originalBody; // If this was an error request to begin with, leave it as a string, it probably // just isn't JSON. Otherwise, deliver the parsing error to the user. if (ok) { // Even though the response status was 2xx, this is still an error. ok = false; // The parse error contains the text of the body that failed to parse. body = /** @type {?} */ { error: error, text: body }; } } } if (ok) { // A successful response is delivered on the event stream. observer.next(new HttpResponse({ body: body, headers: headers, status: status, statusText: statusText, url: url || undefined })); // The full body has been received and delivered, no further events // are possible. This request is complete. observer.complete(); } else { // An unsuccessful request is delivered on the error channel. observer.error(new HttpErrorResponse({ // The error in this case is the response body (error from the server). error: body, headers: headers, status: status, statusText: statusText, url: url || undefined })); } }; // The onError callback is called when something goes wrong at the network level. // Connection timeout, DNS error, offline, etc. These are actual errors, and are // transmitted on the error channel. /** @type {?} */ var onError = /** * @param {?} error * @return {?} */ function onError(error) { var _partialFromXhr2 = partialFromXhr(), url = _partialFromXhr2.url; /** @type {?} */ var res = new HttpErrorResponse({ error: error, status: xhr.status || 0, statusText: xhr.statusText || 'Unknown Error', url: url || undefined }); observer.error(res); }; // The sentHeaders flag tracks whether the HttpResponseHeaders event // has been sent on the stream. This is necessary to track if progress // is enabled since the event will be sent on only the first download // progerss event. /** @type {?} */ var sentHeaders = false; // The download progress event handler, which is only registered if // progress events are enabled. /** @type {?} */ var onDownProgress = /** * @param {?} event * @return {?} */ function onDownProgress(event) { // Send the HttpResponseHeaders event if it hasn't been sent already. if (!sentHeaders) { observer.next(partialFromXhr()); sentHeaders = true; } // Start building the download progress event to deliver on the response // event stream. /** @type {?} */ var progressEvent = { type: HttpEventType.DownloadProgress, loaded: event.loaded }; // Set the total number of bytes in the event if it's available. if (event.lengthComputable) { progressEvent.total = event.total; } // If the request was for text content and a partial response is // available on XMLHttpRequest, include it in the progress event // to allow for streaming reads. if (req.responseType === 'text' && !!xhr.responseText) { progressEvent.partialText = xhr.responseText; } // Finally, fire the event. observer.next(progressEvent); }; // The upload progress event handler, which is only registered if // progress events are enabled. /** @type {?} */ var onUpProgress = /** * @param {?} event * @return {?} */ function onUpProgress(event) { // Upload progress events are simpler. Begin building the progress // event. /** @type {?} */ var progress = { type: HttpEventType.UploadProgress, loaded: event.loaded }; // If the total number of bytes being uploaded is available, include // it. if (event.lengthComputable) { progress.total = event.total; } // Send the event. observer.next(progress); }; // By default, register for load and error events. xhr.addEventListener('load', onLoad); xhr.addEventListener('error', onError); // Progress events are only enabled if requested. if (req.reportProgress) { // Download progress is always enabled if requested. xhr.addEventListener('progress', onDownProgress); // Upload progress depends on whether there is a body to upload. if (reqBody !== null && xhr.upload) { xhr.upload.addEventListener('progress', onUpProgress); } } // Fire the request, and notify the event stream that it was fired. xhr.send( /** @type {?} */ reqBody); observer.next({ type: HttpEventType.Sent }); // This is the return from the Observable function, which is the // request cancellation handler. return ( /** * @return {?} */ function () { // On a cancellation, remove all registered event listeners. xhr.removeEventListener('error', onError); xhr.removeEventListener('load', onLoad); if (req.reportProgress) { xhr.removeEventListener('progress', onDownProgress); if (reqBody !== null && xhr.upload) { xhr.upload.removeEventListener('progress', onUpProgress); } } // Finally, abort the in-flight request. xhr.abort(); } ); }); } }]); return HttpXhrBackend; }(); HttpXhrBackend.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; /** @nocollapse */ HttpXhrBackend.ctorParameters = function () { return [{ type: XhrFactory }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var XSRF_COOKIE_NAME = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('XSRF_COOKIE_NAME'); /** @type {?} */ var XSRF_HEADER_NAME = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('XSRF_HEADER_NAME'); /** * Retrieves the current XSRF token to use with the next outgoing request. * * \@publicApi * @abstract */ var HttpXsrfTokenExtractor = function HttpXsrfTokenExtractor() { _classCallCheck(this, HttpXsrfTokenExtractor); }; if (false) {} /** * `HttpXsrfTokenExtractor` which retrieves the token from a cookie. */ var HttpXsrfCookieExtractor = /*#__PURE__*/function () { /** * @param {?} doc * @param {?} platform * @param {?} cookieName */ function HttpXsrfCookieExtractor(doc, platform, cookieName) { _classCallCheck(this, HttpXsrfCookieExtractor); this.doc = doc; this.platform = platform; this.cookieName = cookieName; this.lastCookieString = ''; this.lastToken = null; /** * \@internal for testing */ this.parseCount = 0; } /** * @return {?} */ _createClass2(HttpXsrfCookieExtractor, [{ key: "getToken", value: function getToken() { if (this.platform === 'server') { return null; } /** @type {?} */ var cookieString = this.doc.cookie || ''; if (cookieString !== this.lastCookieString) { this.parseCount++; this.lastToken = Object(_angular_common__WEBPACK_IMPORTED_MODULE_3__["ɵparseCookieValue"])(cookieString, this.cookieName); this.lastCookieString = cookieString; } return this.lastToken; } }]); return HttpXsrfCookieExtractor; }(); HttpXsrfCookieExtractor.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; /** @nocollapse */ HttpXsrfCookieExtractor.ctorParameters = function () { return [{ type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_common__WEBPACK_IMPORTED_MODULE_3__["DOCUMENT"]] }] }, { type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [_angular_core__WEBPACK_IMPORTED_MODULE_0__["PLATFORM_ID"]] }] }, { type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [XSRF_COOKIE_NAME] }] }]; }; if (false) {} /** * `HttpInterceptor` which adds an XSRF token to eligible outgoing requests. */ var HttpXsrfInterceptor = /*#__PURE__*/function () { /** * @param {?} tokenService * @param {?} headerName */ function HttpXsrfInterceptor(tokenService, headerName) { _classCallCheck(this, HttpXsrfInterceptor); this.tokenService = tokenService; this.headerName = headerName; } /** * @param {?} req * @param {?} next * @return {?} */ _createClass2(HttpXsrfInterceptor, [{ key: "intercept", value: function intercept(req, next) { /** @type {?} */ var lcUrl = req.url.toLowerCase(); // Skip both non-mutating requests and absolute URLs. // Non-mutating requests don't require a token, and absolute URLs require special handling // anyway as the cookie set // on our origin is not the same as the token expected by another origin. if (req.method === 'GET' || req.method === 'HEAD' || lcUrl.startsWith('http://') || lcUrl.startsWith('https://')) { return next.handle(req); } /** @type {?} */ var token = this.tokenService.getToken(); // Be careful not to overwrite an existing header of the same name. if (token !== null && !req.headers.has(this.headerName)) { req = req.clone({ headers: req.headers.set(this.headerName, token) }); } return next.handle(req); } }]); return HttpXsrfInterceptor; }(); HttpXsrfInterceptor.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; /** @nocollapse */ HttpXsrfInterceptor.ctorParameters = function () { return [{ type: HttpXsrfTokenExtractor }, { type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [XSRF_HEADER_NAME] }] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * An injectable `HttpHandler` that applies multiple interceptors * to a request before passing it to the given `HttpBackend`. * * The interceptors are loaded lazily from the injector, to allow * interceptors to themselves inject classes depending indirectly * on `HttpInterceptingHandler` itself. * @see `HttpInterceptor` */ var HttpInterceptingHandler = /*#__PURE__*/function () { /** * @param {?} backend * @param {?} injector */ function HttpInterceptingHandler(backend, injector) { _classCallCheck(this, HttpInterceptingHandler); this.backend = backend; this.injector = injector; this.chain = null; } /** * @param {?} req * @return {?} */ _createClass2(HttpInterceptingHandler, [{ key: "handle", value: function handle(req) { if (this.chain === null) { /** @type {?} */ var interceptors = this.injector.get(HTTP_INTERCEPTORS, []); this.chain = interceptors.reduceRight( /** * @param {?} next * @param {?} interceptor * @return {?} */ function (next, interceptor) { return new HttpInterceptorHandler(next, interceptor); }, this.backend); } return this.chain.handle(req); } }]); return HttpInterceptingHandler; }(); HttpInterceptingHandler.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; /** @nocollapse */ HttpInterceptingHandler.ctorParameters = function () { return [{ type: HttpBackend }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injector"] }]; }; if (false) {} /** * Constructs an `HttpHandler` that applies interceptors * to a request before passing it to the given `HttpBackend`. * * Use as a factory function within `HttpClientModule`. * * * @param {?} backend * @param {?=} interceptors * @return {?} */ function interceptingHandler(backend) { var interceptors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; if (!interceptors) { return backend; } return interceptors.reduceRight( /** * @param {?} next * @param {?} interceptor * @return {?} */ function (next, interceptor) { return new HttpInterceptorHandler(next, interceptor); }, backend); } /** * Factory function that determines where to store JSONP callbacks. * * Ordinarily JSONP callbacks are stored on the `window` object, but this may not exist * in test environments. In that case, callbacks are stored on an anonymous object instead. * * * @return {?} */ function jsonpCallbackContext() { if (typeof window === 'object') { return window; } return {}; } /** * Configures XSRF protection support for outgoing requests. * * For a server that supports a cookie-based XSRF protection system, * use directly to configure XSRF protection with the correct * cookie and header names. * * If no names are supplied, the default cookie name is `XSRF-TOKEN` * and the default header name is `X-XSRF-TOKEN`. * * \@publicApi */ var HttpClientXsrfModule = /*#__PURE__*/function () { function HttpClientXsrfModule() { _classCallCheck(this, HttpClientXsrfModule); } _createClass2(HttpClientXsrfModule, null, [{ key: "disable", /** * Disable the default XSRF protection. * @return {?} */ value: function disable() { return { ngModule: HttpClientXsrfModule, providers: [{ provide: HttpXsrfInterceptor, useClass: NoopInterceptor }] }; } /** * Configure XSRF protection. * @param {?=} options An object that can specify either or both * cookie name or header name. * - Cookie name default is `XSRF-TOKEN`. * - Header name default is `X-XSRF-TOKEN`. * * @return {?} */ }, { key: "withOptions", value: function withOptions() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return { ngModule: HttpClientXsrfModule, providers: [options.cookieName ? { provide: XSRF_COOKIE_NAME, useValue: options.cookieName } : [], options.headerName ? { provide: XSRF_HEADER_NAME, useValue: options.headerName } : []] }; } }]); return HttpClientXsrfModule; }(); HttpClientXsrfModule.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ providers: [HttpXsrfInterceptor, { provide: HTTP_INTERCEPTORS, useExisting: HttpXsrfInterceptor, multi: true }, { provide: HttpXsrfTokenExtractor, useClass: HttpXsrfCookieExtractor }, { provide: XSRF_COOKIE_NAME, useValue: 'XSRF-TOKEN' }, { provide: XSRF_HEADER_NAME, useValue: 'X-XSRF-TOKEN' }] }] }]; /** * Configures the [dependency injector](guide/glossary#injector) for `HttpClient` * with supporting services for XSRF. Automatically imported by `HttpClientModule`. * * You can add interceptors to the chain behind `HttpClient` by binding them to the * multiprovider for built-in [DI token](guide/glossary#di-token) `HTTP_INTERCEPTORS`. * * \@publicApi */ var HttpClientModule = function HttpClientModule() { _classCallCheck(this, HttpClientModule); }; HttpClientModule.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ /** * Optional configuration for XSRF protection. */ imports: [HttpClientXsrfModule.withOptions({ cookieName: 'XSRF-TOKEN', headerName: 'X-XSRF-TOKEN' })], /** * Configures the [dependency injector](guide/glossary#injector) where it is imported * with supporting services for HTTP communications. */ providers: [HttpClient, { provide: HttpHandler, useClass: HttpInterceptingHandler }, HttpXhrBackend, { provide: HttpBackend, useExisting: HttpXhrBackend }, BrowserXhr, { provide: XhrFactory, useExisting: BrowserXhr }] }] }]; /** * Configures the [dependency injector](guide/glossary#injector) for `HttpClient` * with supporting services for JSONP. * Without this module, Jsonp requests reach the backend * with method JSONP, where they are rejected. * * You can add interceptors to the chain behind `HttpClient` by binding them to the * multiprovider for built-in [DI token](guide/glossary#di-token) `HTTP_INTERCEPTORS`. * * \@publicApi */ var HttpClientJsonpModule = function HttpClientJsonpModule() { _classCallCheck(this, HttpClientJsonpModule); }; HttpClientJsonpModule.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ providers: [JsonpClientBackend, { provide: JsonpCallbackContext, useFactory: jsonpCallbackContext }, { provide: HTTP_INTERCEPTORS, useClass: JsonpInterceptor, multi: true }] }] }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=http.js.map /***/ }, /***/ "./node_modules/@angular/compiler/fesm2015/compiler.js": /*!*************************************************************!*\ !*** ./node_modules/@angular/compiler/fesm2015/compiler.js ***! \*************************************************************/ /*! exports provided: core, CompilerConfig, preserveWhitespacesDefault, isLoweredSymbol, createLoweredSymbol, Identifiers, JitCompiler, ConstantPool, DirectiveResolver, PipeResolver, NgModuleResolver, DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig, NgModuleCompiler, ArrayType, AssertNotNull, DYNAMIC_TYPE, BinaryOperator, BinaryOperatorExpr, BuiltinMethod, BuiltinType, BuiltinTypeName, BuiltinVar, CastExpr, ClassField, ClassMethod, ClassStmt, CommaExpr, CommentStmt, ConditionalExpr, DeclareFunctionStmt, DeclareVarStmt, Expression, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, literalMap, FunctionExpr, IfStmt, InstantiateExpr, InvokeFunctionExpr, InvokeMethodExpr, JSDocCommentStmt, LiteralArrayExpr, LiteralExpr, LiteralMapExpr, MapType, NotExpr, ReadKeyExpr, ReadPropExpr, ReadVarExpr, ReturnStatement, ThrowStmt, TryCatchStmt, Type, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, StmtModifier, Statement, STRING_TYPE, TypeofExpr, collectExternalReferences, EmitterVisitorContext, JitEvaluator, ViewCompiler, findStaticQueryIds, staticViewQueryIds, getParseErrors, isSyntaxError, syntaxError, Version, TmplAstBoundAttribute, TmplAstBoundEvent, TmplAstBoundText, TmplAstContent, TmplAstElement, TmplAstRecursiveVisitor, TmplAstReference, TmplAstTemplate, TmplAstText, TmplAstTextAttribute, TmplAstVariable, R3Identifiers, R3ResolvedDependencyType, compileInjector, compileNgModule, compilePipeFromMetadata, makeBindingParser, parseTemplate, compileBaseDefFromMetadata, compileComponentFromMetadata, compileDirectiveFromMetadata, parseHostBindings, verifyHostBindings, publishFacade, VERSION, TextAst, BoundTextAst, AttrAst, BoundElementPropertyAst, BoundEventAst, ReferenceAst, VariableAst, ElementAst, EmbeddedTemplateAst, BoundDirectivePropertyAst, DirectiveAst, ProviderAst, ProviderAstType, NgContentAst, NullTemplateVisitor, RecursiveTemplateAstVisitor, templateVisitAll, sanitizeIdentifier, identifierName, identifierModuleUrl, viewClassName, rendererTypeName, hostViewClassName, componentFactoryName, CompileSummaryKind, tokenName, tokenReference, CompileStylesheetMetadata, CompileTemplateMetadata, CompileDirectiveMetadata, CompilePipeMetadata, CompileShallowModuleMetadata, CompileNgModuleMetadata, TransitiveCompileNgModuleMetadata, ProviderMeta, flatten, templateSourceUrl, sharedStylesheetJitUrl, ngModuleJitUrl, templateJitUrl, createAotUrlResolver, createAotCompiler, AotCompiler, analyzeNgModules, analyzeAndValidateNgModules, analyzeFile, analyzeFileForInjectables, mergeAnalyzedFiles, GeneratedFile, toTypeScript, formattedError, isFormattedError, StaticReflector, StaticSymbol, StaticSymbolCache, ResolvedStaticSymbol, StaticSymbolResolver, unescapeIdentifier, unwrapResolvedMetadata, AotSummaryResolver, AstPath, SummaryResolver, JitSummaryResolver, CompileReflector, createUrlResolverWithoutPackagePrefix, createOfflineCompileUrlResolver, UrlResolver, getUrlScheme, ResourceLoader, ElementSchemaRegistry, Extractor, I18NHtmlParser, MessageBundle, Serializer, Xliff, Xliff2, Xmb, Xtb, DirectiveNormalizer, ParserError, ParseSpan, AST, Quote, EmptyExpr, ImplicitReceiver, Chain, Conditional, PropertyRead, PropertyWrite, SafePropertyRead, KeyedRead, KeyedWrite, BindingPipe, LiteralPrimitive, LiteralArray, LiteralMap, Interpolation, Binary, PrefixNot, NonNullAssert, MethodCall, SafeMethodCall, FunctionCall, AbsoluteSourceSpan, ASTWithSource, TemplateBinding, NullAstVisitor, RecursiveAstVisitor, AstTransformer, AstMemoryEfficientTransformer, visitAstChildren, ParsedProperty, ParsedPropertyType, ParsedEvent, ParsedVariable, BoundElementProperty, TokenType, Lexer, Token, EOF, isIdentifier, isQuote, SplitInterpolation, TemplateBindingParseResult, Parser, _ParseAST, ERROR_COMPONENT_TYPE, CompileMetadataResolver, Text, Expansion, ExpansionCase, Attribute, Element, Comment, visitAll, RecursiveVisitor, findNode, HtmlParser, ParseTreeResult, TreeError, HtmlTagDefinition, getHtmlTagDefinition, TagContentType, splitNsName, isNgContainer, isNgContent, isNgTemplate, getNsPrefix, mergeNsAndName, NAMED_ENTITIES, NGSP_UNICODE, debugOutputAstAsTypeScript, TypeScriptEmitter, ParseLocation, ParseSourceFile, ParseSourceSpan, EMPTY_PARSE_LOCATION, EMPTY_SOURCE_SPAN, ParseErrorLevel, ParseError, typeSourceSpan, r3JitTypeSourceSpan, DomElementSchemaRegistry, CssSelector, SelectorMatcher, SelectorListContext, SelectorContext, HOST_ATTR, CONTENT_ATTR, StylesCompileDependency, CompiledStylesheet, StyleCompiler, TemplateParseError, TemplateParseResult, TemplateParser, splitClasses, createElementCssSelector, removeSummaryDuplicates, isEmptyExpression, compileInjectable, R3TargetBinder, R3BoundTarget */ /***/ function node_modulesAngularCompilerFesm2015CompilerJs(module, __webpack_exports__, __webpack_require__) { "use strict"; var _BoundPropertyMapping; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "core", function () { return core; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompilerConfig", function () { return CompilerConfig; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "preserveWhitespacesDefault", function () { return preserveWhitespacesDefault; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isLoweredSymbol", function () { return isLoweredSymbol; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLoweredSymbol", function () { return createLoweredSymbol; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Identifiers", function () { return Identifiers; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JitCompiler", function () { return JitCompiler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConstantPool", function () { return ConstantPool; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DirectiveResolver", function () { return DirectiveResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PipeResolver", function () { return PipeResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModuleResolver", function () { return NgModuleResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_INTERPOLATION_CONFIG", function () { return DEFAULT_INTERPOLATION_CONFIG; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InterpolationConfig", function () { return InterpolationConfig; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModuleCompiler", function () { return NgModuleCompiler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayType", function () { return ArrayType; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AssertNotNull", function () { return AssertNotNull; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DYNAMIC_TYPE", function () { return DYNAMIC_TYPE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BinaryOperator", function () { return BinaryOperator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BinaryOperatorExpr", function () { return BinaryOperatorExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BuiltinMethod", function () { return BuiltinMethod; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BuiltinType", function () { return BuiltinType; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BuiltinTypeName", function () { return BuiltinTypeName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BuiltinVar", function () { return BuiltinVar; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CastExpr", function () { return CastExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ClassField", function () { return ClassField; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ClassMethod", function () { return ClassMethod; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ClassStmt", function () { return ClassStmt; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommaExpr", function () { return CommaExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommentStmt", function () { return CommentStmt; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConditionalExpr", function () { return ConditionalExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeclareFunctionStmt", function () { return DeclareFunctionStmt; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeclareVarStmt", function () { return DeclareVarStmt; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Expression", function () { return Expression; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpressionStatement", function () { return ExpressionStatement; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpressionType", function () { return ExpressionType; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExternalExpr", function () { return ExternalExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExternalReference", function () { return ExternalReference; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "literalMap", function () { return literalMap; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionExpr", function () { return FunctionExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IfStmt", function () { return IfStmt; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InstantiateExpr", function () { return InstantiateExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InvokeFunctionExpr", function () { return InvokeFunctionExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InvokeMethodExpr", function () { return InvokeMethodExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JSDocCommentStmt", function () { return JSDocCommentStmt; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LiteralArrayExpr", function () { return LiteralArrayExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LiteralExpr", function () { return LiteralExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LiteralMapExpr", function () { return LiteralMapExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MapType", function () { return MapType; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NotExpr", function () { return NotExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReadKeyExpr", function () { return ReadKeyExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReadPropExpr", function () { return ReadPropExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReadVarExpr", function () { return ReadVarExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReturnStatement", function () { return ReturnStatement; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ThrowStmt", function () { return ThrowStmt; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TryCatchStmt", function () { return TryCatchStmt; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Type", function () { return Type$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WrappedNodeExpr", function () { return WrappedNodeExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WriteKeyExpr", function () { return WriteKeyExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WritePropExpr", function () { return WritePropExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WriteVarExpr", function () { return WriteVarExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StmtModifier", function () { return StmtModifier; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Statement", function () { return Statement; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "STRING_TYPE", function () { return STRING_TYPE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TypeofExpr", function () { return TypeofExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "collectExternalReferences", function () { return collectExternalReferences; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmitterVisitorContext", function () { return EmitterVisitorContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JitEvaluator", function () { return JitEvaluator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewCompiler", function () { return ViewCompiler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findStaticQueryIds", function () { return findStaticQueryIds; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticViewQueryIds", function () { return staticViewQueryIds; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getParseErrors", function () { return getParseErrors; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isSyntaxError", function () { return isSyntaxError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "syntaxError", function () { return syntaxError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Version", function () { return Version; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TmplAstBoundAttribute", function () { return BoundAttribute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TmplAstBoundEvent", function () { return BoundEvent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TmplAstBoundText", function () { return BoundText; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TmplAstContent", function () { return Content; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TmplAstElement", function () { return Element; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TmplAstRecursiveVisitor", function () { return RecursiveVisitor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TmplAstReference", function () { return Reference; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TmplAstTemplate", function () { return Template; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TmplAstText", function () { return Text; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TmplAstTextAttribute", function () { return TextAttribute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TmplAstVariable", function () { return Variable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R3Identifiers", function () { return Identifiers$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R3ResolvedDependencyType", function () { return R3ResolvedDependencyType; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compileInjector", function () { return _compileInjector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compileNgModule", function () { return _compileNgModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compilePipeFromMetadata", function () { return compilePipeFromMetadata; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeBindingParser", function () { return makeBindingParser; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseTemplate", function () { return parseTemplate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compileBaseDefFromMetadata", function () { return compileBaseDefFromMetadata; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compileComponentFromMetadata", function () { return compileComponentFromMetadata; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compileDirectiveFromMetadata", function () { return compileDirectiveFromMetadata; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseHostBindings", function () { return parseHostBindings; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "verifyHostBindings", function () { return verifyHostBindings; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publishFacade", function () { return publishFacade; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function () { return VERSION$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextAst", function () { return TextAst; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoundTextAst", function () { return BoundTextAst; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AttrAst", function () { return AttrAst; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoundElementPropertyAst", function () { return BoundElementPropertyAst; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoundEventAst", function () { return BoundEventAst; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReferenceAst", function () { return ReferenceAst; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VariableAst", function () { return VariableAst; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ElementAst", function () { return ElementAst; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmbeddedTemplateAst", function () { return EmbeddedTemplateAst; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoundDirectivePropertyAst", function () { return BoundDirectivePropertyAst; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DirectiveAst", function () { return DirectiveAst; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProviderAst", function () { return ProviderAst; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProviderAstType", function () { return ProviderAstType; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgContentAst", function () { return NgContentAst; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NullTemplateVisitor", function () { return NullTemplateVisitor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RecursiveTemplateAstVisitor", function () { return RecursiveTemplateAstVisitor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "templateVisitAll", function () { return templateVisitAll; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sanitizeIdentifier", function () { return sanitizeIdentifier; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "identifierName", function () { return identifierName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "identifierModuleUrl", function () { return identifierModuleUrl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "viewClassName", function () { return viewClassName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rendererTypeName", function () { return rendererTypeName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hostViewClassName", function () { return hostViewClassName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "componentFactoryName", function () { return componentFactoryName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompileSummaryKind", function () { return CompileSummaryKind; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tokenName", function () { return tokenName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tokenReference", function () { return tokenReference; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompileStylesheetMetadata", function () { return CompileStylesheetMetadata; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompileTemplateMetadata", function () { return CompileTemplateMetadata; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompileDirectiveMetadata", function () { return CompileDirectiveMetadata; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompilePipeMetadata", function () { return CompilePipeMetadata; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompileShallowModuleMetadata", function () { return CompileShallowModuleMetadata; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompileNgModuleMetadata", function () { return CompileNgModuleMetadata; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TransitiveCompileNgModuleMetadata", function () { return TransitiveCompileNgModuleMetadata; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProviderMeta", function () { return ProviderMeta; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "flatten", function () { return flatten; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "templateSourceUrl", function () { return templateSourceUrl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sharedStylesheetJitUrl", function () { return sharedStylesheetJitUrl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ngModuleJitUrl", function () { return ngModuleJitUrl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "templateJitUrl", function () { return templateJitUrl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createAotUrlResolver", function () { return createAotUrlResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createAotCompiler", function () { return createAotCompiler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AotCompiler", function () { return AotCompiler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "analyzeNgModules", function () { return analyzeNgModules; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "analyzeAndValidateNgModules", function () { return analyzeAndValidateNgModules; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "analyzeFile", function () { return analyzeFile; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "analyzeFileForInjectables", function () { return analyzeFileForInjectables; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeAnalyzedFiles", function () { return mergeAnalyzedFiles; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GeneratedFile", function () { return GeneratedFile; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toTypeScript", function () { return toTypeScript; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formattedError", function () { return formattedError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isFormattedError", function () { return isFormattedError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StaticReflector", function () { return StaticReflector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StaticSymbol", function () { return StaticSymbol; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StaticSymbolCache", function () { return StaticSymbolCache; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResolvedStaticSymbol", function () { return ResolvedStaticSymbol; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StaticSymbolResolver", function () { return StaticSymbolResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unescapeIdentifier", function () { return unescapeIdentifier; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unwrapResolvedMetadata", function () { return unwrapResolvedMetadata; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AotSummaryResolver", function () { return AotSummaryResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AstPath", function () { return AstPath; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SummaryResolver", function () { return SummaryResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JitSummaryResolver", function () { return JitSummaryResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompileReflector", function () { return CompileReflector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createUrlResolverWithoutPackagePrefix", function () { return createUrlResolverWithoutPackagePrefix; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createOfflineCompileUrlResolver", function () { return createOfflineCompileUrlResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlResolver", function () { return UrlResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUrlScheme", function () { return getUrlScheme; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResourceLoader", function () { return ResourceLoader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ElementSchemaRegistry", function () { return ElementSchemaRegistry; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Extractor", function () { return Extractor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I18NHtmlParser", function () { return I18NHtmlParser; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MessageBundle", function () { return MessageBundle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Serializer", function () { return Serializer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Xliff", function () { return Xliff; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Xliff2", function () { return Xliff2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Xmb", function () { return Xmb; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Xtb", function () { return Xtb; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DirectiveNormalizer", function () { return DirectiveNormalizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParserError", function () { return ParserError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseSpan", function () { return ParseSpan; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AST", function () { return AST; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Quote", function () { return Quote; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmptyExpr", function () { return EmptyExpr; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ImplicitReceiver", function () { return ImplicitReceiver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Chain", function () { return Chain; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Conditional", function () { return Conditional; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PropertyRead", function () { return PropertyRead; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PropertyWrite", function () { return PropertyWrite; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SafePropertyRead", function () { return SafePropertyRead; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyedRead", function () { return KeyedRead; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyedWrite", function () { return KeyedWrite; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BindingPipe", function () { return BindingPipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LiteralPrimitive", function () { return LiteralPrimitive; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LiteralArray", function () { return LiteralArray; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LiteralMap", function () { return LiteralMap; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Interpolation", function () { return Interpolation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Binary", function () { return Binary; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PrefixNot", function () { return PrefixNot; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NonNullAssert", function () { return NonNullAssert; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MethodCall", function () { return MethodCall; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SafeMethodCall", function () { return SafeMethodCall; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function () { return FunctionCall; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbsoluteSourceSpan", function () { return AbsoluteSourceSpan; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ASTWithSource", function () { return ASTWithSource; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplateBinding", function () { return TemplateBinding; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NullAstVisitor", function () { return NullAstVisitor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RecursiveAstVisitor", function () { return RecursiveAstVisitor$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AstTransformer", function () { return AstTransformer$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AstMemoryEfficientTransformer", function () { return AstMemoryEfficientTransformer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "visitAstChildren", function () { return visitAstChildren; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParsedProperty", function () { return ParsedProperty; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParsedPropertyType", function () { return ParsedPropertyType; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParsedEvent", function () { return ParsedEvent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParsedVariable", function () { return ParsedVariable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoundElementProperty", function () { return BoundElementProperty; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TokenType", function () { return TokenType$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Lexer", function () { return Lexer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Token", function () { return Token$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EOF", function () { return EOF; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isIdentifier", function () { return isIdentifier; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isQuote", function () { return isQuote; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SplitInterpolation", function () { return SplitInterpolation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplateBindingParseResult", function () { return TemplateBindingParseResult; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Parser", function () { return Parser$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_ParseAST", function () { return _ParseAST; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_COMPONENT_TYPE", function () { return ERROR_COMPONENT_TYPE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompileMetadataResolver", function () { return CompileMetadataResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Text", function () { return Text$3; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Expansion", function () { return Expansion; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpansionCase", function () { return ExpansionCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Attribute", function () { return Attribute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Element", function () { return Element$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Comment", function () { return Comment; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "visitAll", function () { return visitAll$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RecursiveVisitor", function () { return RecursiveVisitor$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findNode", function () { return findNode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HtmlParser", function () { return HtmlParser; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseTreeResult", function () { return ParseTreeResult; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TreeError", function () { return TreeError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HtmlTagDefinition", function () { return HtmlTagDefinition; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getHtmlTagDefinition", function () { return getHtmlTagDefinition; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TagContentType", function () { return TagContentType; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "splitNsName", function () { return splitNsName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNgContainer", function () { return isNgContainer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNgContent", function () { return isNgContent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNgTemplate", function () { return isNgTemplate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNsPrefix", function () { return getNsPrefix; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeNsAndName", function () { return mergeNsAndName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NAMED_ENTITIES", function () { return NAMED_ENTITIES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NGSP_UNICODE", function () { return NGSP_UNICODE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "debugOutputAstAsTypeScript", function () { return debugOutputAstAsTypeScript; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TypeScriptEmitter", function () { return TypeScriptEmitter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseLocation", function () { return ParseLocation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseSourceFile", function () { return ParseSourceFile; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseSourceSpan", function () { return ParseSourceSpan; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EMPTY_PARSE_LOCATION", function () { return EMPTY_PARSE_LOCATION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EMPTY_SOURCE_SPAN", function () { return EMPTY_SOURCE_SPAN; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseErrorLevel", function () { return ParseErrorLevel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseError", function () { return ParseError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "typeSourceSpan", function () { return typeSourceSpan; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r3JitTypeSourceSpan", function () { return r3JitTypeSourceSpan; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DomElementSchemaRegistry", function () { return DomElementSchemaRegistry; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CssSelector", function () { return CssSelector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectorMatcher", function () { return SelectorMatcher; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectorListContext", function () { return SelectorListContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectorContext", function () { return SelectorContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HOST_ATTR", function () { return HOST_ATTR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CONTENT_ATTR", function () { return CONTENT_ATTR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StylesCompileDependency", function () { return StylesCompileDependency; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompiledStylesheet", function () { return CompiledStylesheet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StyleCompiler", function () { return StyleCompiler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplateParseError", function () { return TemplateParseError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplateParseResult", function () { return TemplateParseResult; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplateParser", function () { return TemplateParser; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "splitClasses", function () { return splitClasses; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createElementCssSelector", function () { return createElementCssSelector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeSummaryDuplicates", function () { return removeSummaryDuplicates; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isEmptyExpression", function () { return isEmptyExpression; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compileInjectable", function () { return _compileInjectable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R3TargetBinder", function () { return R3TargetBinder; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R3BoundTarget", function () { return R3BoundTarget; }); /** * @license Angular v8.2.12 * (c) 2010-2019 Google LLC. 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 */ var TagContentType; (function (TagContentType) { TagContentType[TagContentType["RAW_TEXT"] = 0] = "RAW_TEXT"; TagContentType[TagContentType["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT"; TagContentType[TagContentType["PARSABLE_DATA"] = 2] = "PARSABLE_DATA"; })(TagContentType || (TagContentType = {})); function splitNsName(elementName) { if (elementName[0] != ':') { return [null, elementName]; } var colonIndex = elementName.indexOf(':', 1); if (colonIndex == -1) { throw new Error("Unsupported format \"".concat(elementName, "\" expecting \":namespace:name\"")); } return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)]; } // `<ng-container>` tags work the same regardless the namespace function isNgContainer(tagName) { return splitNsName(tagName)[1] === 'ng-container'; } // `<ng-content>` tags work the same regardless the namespace function isNgContent(tagName) { return splitNsName(tagName)[1] === 'ng-content'; } // `<ng-template>` tags work the same regardless the namespace function isNgTemplate(tagName) { return splitNsName(tagName)[1] === 'ng-template'; } function getNsPrefix(fullName) { return fullName === null ? null : splitNsName(fullName)[0]; } function mergeNsAndName(prefix, localName) { return prefix ? ":".concat(prefix, ":").concat(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': "\xC1", 'aacute': "\xE1", 'Acirc': "\xC2", 'acirc': "\xE2", 'acute': "\xB4", 'AElig': "\xC6", 'aelig': "\xE6", 'Agrave': "\xC0", 'agrave': "\xE0", 'alefsym': "\u2135", 'Alpha': "\u0391", 'alpha': "\u03B1", 'amp': '&', 'and': "\u2227", 'ang': "\u2220", 'apos': "'", 'Aring': "\xC5", 'aring': "\xE5", 'asymp': "\u2248", 'Atilde': "\xC3", 'atilde': "\xE3", 'Auml': "\xC4", 'auml': "\xE4", 'bdquo': "\u201E", 'Beta': "\u0392", 'beta': "\u03B2", 'brvbar': "\xA6", 'bull': "\u2022", 'cap': "\u2229", 'Ccedil': "\xC7", 'ccedil': "\xE7", 'cedil': "\xB8", 'cent': "\xA2", 'Chi': "\u03A7", 'chi': "\u03C7", 'circ': "\u02C6", 'clubs': "\u2663", 'cong': "\u2245", 'copy': "\xA9", 'crarr': "\u21B5", 'cup': "\u222A", 'curren': "\xA4", 'dagger': "\u2020", 'Dagger': "\u2021", 'darr': "\u2193", 'dArr': "\u21D3", 'deg': "\xB0", 'Delta': "\u0394", 'delta': "\u03B4", 'diams': "\u2666", 'divide': "\xF7", 'Eacute': "\xC9", 'eacute': "\xE9", 'Ecirc': "\xCA", 'ecirc': "\xEA", 'Egrave': "\xC8", 'egrave': "\xE8", 'empty': "\u2205", 'emsp': "\u2003", 'ensp': "\u2002", 'Epsilon': "\u0395", 'epsilon': "\u03B5", 'equiv': "\u2261", 'Eta': "\u0397", 'eta': "\u03B7", 'ETH': "\xD0", 'eth': "\xF0", 'Euml': "\xCB", 'euml': "\xEB", 'euro': "\u20AC", 'exist': "\u2203", 'fnof': "\u0192", 'forall': "\u2200", 'frac12': "\xBD", 'frac14': "\xBC", 'frac34': "\xBE", 'frasl': "\u2044", 'Gamma': "\u0393", 'gamma': "\u03B3", 'ge': "\u2265", 'gt': '>', 'harr': "\u2194", 'hArr': "\u21D4", 'hearts': "\u2665", 'hellip': "\u2026", 'Iacute': "\xCD", 'iacute': "\xED", 'Icirc': "\xCE", 'icirc': "\xEE", 'iexcl': "\xA1", 'Igrave': "\xCC", 'igrave': "\xEC", 'image': "\u2111", 'infin': "\u221E", 'int': "\u222B", 'Iota': "\u0399", 'iota': "\u03B9", 'iquest': "\xBF", 'isin': "\u2208", 'Iuml': "\xCF", 'iuml': "\xEF", 'Kappa': "\u039A", 'kappa': "\u03BA", 'Lambda': "\u039B", 'lambda': "\u03BB", 'lang': "\u27E8", 'laquo': "\xAB", 'larr': "\u2190", 'lArr': "\u21D0", 'lceil': "\u2308", 'ldquo': "\u201C", 'le': "\u2264", 'lfloor': "\u230A", 'lowast': "\u2217", 'loz': "\u25CA", 'lrm': "\u200E", 'lsaquo': "\u2039", 'lsquo': "\u2018", 'lt': '<', 'macr': "\xAF", 'mdash': "\u2014", 'micro': "\xB5", 'middot': "\xB7", 'minus': "\u2212", 'Mu': "\u039C", 'mu': "\u03BC", 'nabla': "\u2207", 'nbsp': "\xA0", 'ndash': "\u2013", 'ne': "\u2260", 'ni': "\u220B", 'not': "\xAC", 'notin': "\u2209", 'nsub': "\u2284", 'Ntilde': "\xD1", 'ntilde': "\xF1", 'Nu': "\u039D", 'nu': "\u03BD", 'Oacute': "\xD3", 'oacute': "\xF3", 'Ocirc': "\xD4", 'ocirc': "\xF4", 'OElig': "\u0152", 'oelig': "\u0153", 'Ograve': "\xD2", 'ograve': "\xF2", 'oline': "\u203E", 'Omega': "\u03A9", 'omega': "\u03C9", 'Omicron': "\u039F", 'omicron': "\u03BF", 'oplus': "\u2295", 'or': "\u2228", 'ordf': "\xAA", 'ordm': "\xBA", 'Oslash': "\xD8", 'oslash': "\xF8", 'Otilde': "\xD5", 'otilde': "\xF5", 'otimes': "\u2297", 'Ouml': "\xD6", 'ouml': "\xF6", 'para': "\xB6", 'permil': "\u2030", 'perp': "\u22A5", 'Phi': "\u03A6", 'phi': "\u03C6", 'Pi': "\u03A0", 'pi': "\u03C0", 'piv': "\u03D6", 'plusmn': "\xB1", 'pound': "\xA3", 'prime': "\u2032", 'Prime': "\u2033", 'prod': "\u220F", 'prop': "\u221D", 'Psi': "\u03A8", 'psi': "\u03C8", 'quot': "\"", 'radic': "\u221A", 'rang': "\u27E9", 'raquo': "\xBB", 'rarr': "\u2192", 'rArr': "\u21D2", 'rceil': "\u2309", 'rdquo': "\u201D", 'real': "\u211C", 'reg': "\xAE", 'rfloor': "\u230B", 'Rho': "\u03A1", 'rho': "\u03C1", 'rlm': "\u200F", 'rsaquo': "\u203A", 'rsquo': "\u2019", 'sbquo': "\u201A", 'Scaron': "\u0160", 'scaron': "\u0161", 'sdot': "\u22C5", 'sect': "\xA7", 'shy': "\xAD", 'Sigma': "\u03A3", 'sigma': "\u03C3", 'sigmaf': "\u03C2", 'sim': "\u223C", 'spades': "\u2660", 'sub': "\u2282", 'sube': "\u2286", 'sum': "\u2211", 'sup': "\u2283", 'sup1': "\xB9", 'sup2': "\xB2", 'sup3': "\xB3", 'supe': "\u2287", 'szlig': "\xDF", 'Tau': "\u03A4", 'tau': "\u03C4", 'there4': "\u2234", 'Theta': "\u0398", 'theta': "\u03B8", 'thetasym': "\u03D1", 'thinsp': "\u2009", 'THORN': "\xDE", 'thorn': "\xFE", 'tilde': "\u02DC", 'times': "\xD7", 'trade': "\u2122", 'Uacute': "\xDA", 'uacute': "\xFA", 'uarr': "\u2191", 'uArr': "\u21D1", 'Ucirc': "\xDB", 'ucirc': "\xFB", 'Ugrave': "\xD9", 'ugrave': "\xF9", 'uml': "\xA8", 'upsih': "\u03D2", 'Upsilon': "\u03A5", 'upsilon': "\u03C5", 'Uuml': "\xDC", 'uuml': "\xFC", 'weierp': "\u2118", 'Xi': "\u039E", 'xi': "\u03BE", 'Yacute': "\xDD", 'yacute': "\xFD", 'yen': "\xA5", 'yuml': "\xFF", 'Yuml': "\u0178", 'Zeta': "\u0396", 'zeta': "\u03B6", 'zwj': "\u200D", 'zwnj': "\u200C" }; // The &ngsp; pseudo-entity is denoting a space. see: // https://github.com/dart-lang/angular/blob/0bb611387d29d65b5af7f9d2515ab571fd3fbee4/_tests/test/compiler/preserve_whitespace_test.dart var NGSP_UNICODE = "\uE500"; NAMED_ENTITIES['ngsp'] = NGSP_UNICODE; /** * @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 = /*#__PURE__*/function () { function HtmlTagDefinition() { var _this28 = this; var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, closedByChildren = _ref6.closedByChildren, implicitNamespacePrefix = _ref6.implicitNamespacePrefix, _ref6$contentType = _ref6.contentType, contentType = _ref6$contentType === void 0 ? TagContentType.PARSABLE_DATA : _ref6$contentType, _ref6$closedByParent = _ref6.closedByParent, closedByParent = _ref6$closedByParent === void 0 ? false : _ref6$closedByParent, _ref6$isVoid = _ref6.isVoid, isVoid = _ref6$isVoid === void 0 ? false : _ref6$isVoid, _ref6$ignoreFirstLf = _ref6.ignoreFirstLf, ignoreFirstLf = _ref6$ignoreFirstLf === void 0 ? false : _ref6$ignoreFirstLf; _classCallCheck(this, HtmlTagDefinition); this.closedByChildren = {}; this.closedByParent = false; this.canSelfClose = false; if (closedByChildren && closedByChildren.length > 0) { closedByChildren.forEach(function (tagName) { return _this28.closedByChildren[tagName] = true; }); } this.isVoid = isVoid; this.closedByParent = closedByParent || isVoid; this.implicitNamespacePrefix = implicitNamespacePrefix || null; this.contentType = contentType; this.ignoreFirstLf = ignoreFirstLf; } _createClass2(HtmlTagDefinition, [{ key: "isClosedByChild", value: function isClosedByChild(name) { return this.isVoid || name.toLowerCase() in this.closedByChildren; } }]); return HtmlTagDefinition; }(); var _DEFAULT_TAG_DEFINITION; // see http://www.w3.org/TR/html51/syntax.html#optional-tags // This implementation does not fully conform to the HTML5 spec. var TAG_DEFINITIONS; function getHtmlTagDefinition(tagName) { if (!TAG_DEFINITIONS) { _DEFAULT_TAG_DEFINITION = new HtmlTagDefinition(); 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'], closedByParent: true }), 'td': new HtmlTagDefinition({ closedByChildren: ['td', 'th'], closedByParent: true }), 'th': new HtmlTagDefinition({ closedByChildren: ['td', 'th'], closedByParent: true }), 'col': new HtmlTagDefinition({ 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 }) }; } 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\\()|' + //":not(" '([-\\w]+)|' + // "tag" '(?:\\.([-\\w]+))|' + // ".class" // "-" should appear first in the regexp below as FF31 parses "[.-\w]" as a range '(?:\\[([-.\\w*]+)(?:=([\"\']?)([^\\]\"\']*)\\5)?\\])|' + // "[name]", "[name=value]", // "[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 = /*#__PURE__*/function () { function CssSelector() { _classCallCheck(this, CssSelector); this.element = null; this.classNames = []; /** * The selectors are encoded in pairs where: * - even locations are attribute names * - odd locations are attribute values. * * Example: * Selector: `[key1=value1][key2]` would parse to: * ``` * ['key1', 'value1', 'key2', ''] * ``` */ this.attrs = []; this.notSelectors = []; } _createClass2(CssSelector, [{ key: "isElementSelector", value: function isElementSelector() { return this.hasElementSelector() && this.classNames.length == 0 && this.attrs.length == 0 && this.notSelectors.length === 0; } }, { key: "hasElementSelector", value: function hasElementSelector() { return !!this.element; } }, { key: "setElement", value: function setElement() { var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; this.element = element; } /** Gets a template string for an element that matches the selector. */ }, { key: "getMatchingElementTemplate", value: function getMatchingElementTemplate() { var tagName = this.element || 'div'; var classAttr = this.classNames.length > 0 ? " class=\"".concat(this.classNames.join(' '), "\"") : ''; var attrs = ''; for (var i = 0; i < this.attrs.length; i += 2) { var attrName = this.attrs[i]; var attrValue = this.attrs[i + 1] !== '' ? "=\"".concat(this.attrs[i + 1], "\"") : ''; attrs += " ".concat(attrName).concat(attrValue); } return getHtmlTagDefinition(tagName).isVoid ? "<".concat(tagName).concat(classAttr).concat(attrs, "/>") : "<".concat(tagName).concat(classAttr).concat(attrs, "></").concat(tagName, ">"); } }, { key: "getAttrs", value: function getAttrs() { var result = []; if (this.classNames.length > 0) { result.push('class', this.classNames.join(' ')); } return result.concat(this.attrs); } }, { key: "addAttribute", value: function addAttribute(name) { var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; this.attrs.push(name, value && value.toLowerCase() || ''); } }, { key: "addClassName", value: function addClassName(name) { this.classNames.push(name.toLowerCase()); } }, { key: "toString", value: function toString() { var res = this.element || ''; if (this.classNames) { this.classNames.forEach(function (klass) { return res += ".".concat(klass); }); } if (this.attrs) { for (var i = 0; i < this.attrs.length; i += 2) { var name = this.attrs[i]; var value = this.attrs[i + 1]; res += "[".concat(name).concat(value ? '=' + value : '', "]"); } } this.notSelectors.forEach(function (notSelector) { return res += ":not(".concat(notSelector, ")"); }); return res; } }], [{ key: "parse", value: function parse(selector) { var results = []; var _addResult = function _addResult(res, cssSel) { if (cssSel.notSelectors.length > 0 && !cssSel.element && cssSel.classNames.length == 0 && cssSel.attrs.length == 0) { cssSel.element = '*'; } res.push(cssSel); }; var cssSelector = new CssSelector(); var match; var current = cssSelector; var 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; }(); /** * Reads a list of CssSelectors and allows to calculate which ones * are contained in a given CssSelector. */ var SelectorMatcher = /*#__PURE__*/function () { function SelectorMatcher() { _classCallCheck(this, 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 = []; } _createClass2(SelectorMatcher, [{ key: "addSelectables", value: function addSelectables(cssSelectors, callbackCtxt) { var listContext = null; if (cssSelectors.length > 1) { listContext = new SelectorListContext(cssSelectors); this._listContexts.push(listContext); } for (var 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 */ }, { key: "_addSelectable", value: function _addSelectable(cssSelector, callbackCtxt, listContext) { var matcher = this; var element = cssSelector.element; var classNames = cssSelector.classNames; var attrs = cssSelector.attrs; var selectable = new SelectorContext(cssSelector, callbackCtxt, listContext); if (element) { var 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 i = 0; i < classNames.length; i++) { var _isTerminal = attrs.length === 0 && i === classNames.length - 1; var className = classNames[i]; if (_isTerminal) { this._addTerminal(matcher._classMap, className, selectable); } else { matcher = this._addPartial(matcher._classPartialMap, className); } } } if (attrs) { for (var _i5 = 0; _i5 < attrs.length; _i5 += 2) { var _isTerminal2 = _i5 === attrs.length - 2; var name = attrs[_i5]; var value = attrs[_i5 + 1]; if (_isTerminal2) { var terminalMap = matcher._attrValueMap; var terminalValuesMap = terminalMap.get(name); if (!terminalValuesMap) { terminalValuesMap = new Map(); terminalMap.set(name, terminalValuesMap); } this._addTerminal(terminalValuesMap, value, selectable); } else { var partialMap = matcher._attrValuePartialMap; var partialValuesMap = partialMap.get(name); if (!partialValuesMap) { partialValuesMap = new Map(); partialMap.set(name, partialValuesMap); } matcher = this._addPartial(partialValuesMap, value); } } } } }, { key: "_addTerminal", value: function _addTerminal(map, name, selectable) { var terminalList = map.get(name); if (!terminalList) { terminalList = []; map.set(name, terminalList); } terminalList.push(selectable); } }, { key: "_addPartial", value: function _addPartial(map, name) { var 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 */ }, { key: "match", value: function match(cssSelector, matchedCallback) { var result = false; var element = cssSelector.element; var classNames = cssSelector.classNames; var attrs = cssSelector.attrs; for (var 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 _i6 = 0; _i6 < classNames.length; _i6++) { var className = classNames[_i6]; result = this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result; result = this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) || result; } } if (attrs) { for (var _i7 = 0; _i7 < attrs.length; _i7 += 2) { var name = attrs[_i7]; var value = attrs[_i7 + 1]; var terminalValuesMap = this._attrValueMap.get(name); if (value) { result = this._matchTerminal(terminalValuesMap, '', cssSelector, matchedCallback) || result; } result = this._matchTerminal(terminalValuesMap, value, cssSelector, matchedCallback) || result; var 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 */ }, { key: "_matchTerminal", value: function _matchTerminal(map, name, cssSelector, matchedCallback) { if (!map || typeof name !== 'string') { return false; } var selectables = map.get(name) || []; var starSelectables = map.get('*'); if (starSelectables) { selectables = selectables.concat(starSelectables); } if (selectables.length === 0) { return false; } var selectable; var result = false; for (var i = 0; i < selectables.length; i++) { selectable = selectables[i]; result = selectable.finalize(cssSelector, matchedCallback) || result; } return result; } /** @internal */ }, { key: "_matchPartial", value: function _matchPartial(map, name, cssSelector, matchedCallback) { if (!map || typeof name !== 'string') { return false; } var 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); } }], [{ key: "createNotMatcher", value: function createNotMatcher(notSelectors) { var notMatcher = new SelectorMatcher(); notMatcher.addSelectables(notSelectors, null); return notMatcher; } }]); return SelectorMatcher; }(); var SelectorListContext = function SelectorListContext(selectors) { _classCallCheck(this, SelectorListContext); this.selectors = selectors; this.alreadyMatched = false; }; // Store context to pass back selector and context when a selector is matched var SelectorContext = /*#__PURE__*/function () { function SelectorContext(selector, cbContext, listContext) { _classCallCheck(this, SelectorContext); this.selector = selector; this.cbContext = cbContext; this.listContext = listContext; this.notSelectors = selector.notSelectors; } _createClass2(SelectorContext, [{ key: "finalize", value: function finalize(cssSelector, callback) { var result = true; if (this.notSelectors.length > 0 && (!this.listContext || !this.listContext.alreadyMatched)) { var 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 createInject = makeMetadataFactory('Inject', function (token) { return { token: token }; }); var createInjectionToken = makeMetadataFactory('InjectionToken', function (desc) { return { _desc: desc, ngInjectableDef: undefined }; }); var createAttribute = makeMetadataFactory('Attribute', function (attributeName) { return { attributeName: attributeName }; }); var createContentChildren = makeMetadataFactory('ContentChildren', function (selector) { var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return Object.assign({ selector: selector, first: false, isViewQuery: false, descendants: false }, data); }); var createContentChild = makeMetadataFactory('ContentChild', function (selector) { var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return Object.assign({ selector: selector, first: true, isViewQuery: false, descendants: true }, data); }); var createViewChildren = makeMetadataFactory('ViewChildren', function (selector) { var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return Object.assign({ selector: selector, first: false, isViewQuery: true, descendants: true }, data); }); var createViewChild = makeMetadataFactory('ViewChild', function (selector, data) { return Object.assign({ selector: selector, first: true, isViewQuery: true, descendants: true }, data); }); var createDirective = makeMetadataFactory('Directive', function () { var dir = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return dir; }); var ViewEncapsulation; (function (ViewEncapsulation) { ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated"; ViewEncapsulation[ViewEncapsulation["Native"] = 1] = "Native"; ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None"; ViewEncapsulation[ViewEncapsulation["ShadowDom"] = 3] = "ShadowDom"; })(ViewEncapsulation || (ViewEncapsulation = {})); var ChangeDetectionStrategy; (function (ChangeDetectionStrategy) { ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 0] = "OnPush"; ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 1] = "Default"; })(ChangeDetectionStrategy || (ChangeDetectionStrategy = {})); var createComponent = makeMetadataFactory('Component', function () { var c = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return Object.assign({ changeDetection: ChangeDetectionStrategy.Default }, c); }); var createPipe = makeMetadataFactory('Pipe', function (p) { return Object.assign({ pure: true }, p); }); var createInput = makeMetadataFactory('Input', function (bindingPropertyName) { return { bindingPropertyName: bindingPropertyName }; }); var createOutput = makeMetadataFactory('Output', function (bindingPropertyName) { return { bindingPropertyName: bindingPropertyName }; }); var createHostBinding = makeMetadataFactory('HostBinding', function (hostPropertyName) { return { hostPropertyName: hostPropertyName }; }); var createHostListener = makeMetadataFactory('HostListener', function (eventName, args) { return { eventName: eventName, args: args }; }); var createNgModule = makeMetadataFactory('NgModule', function (ngModule) { return ngModule; }); var createInjectable = makeMetadataFactory('Injectable', function () { var injectable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return injectable; }); var CUSTOM_ELEMENTS_SCHEMA = { name: 'custom-elements' }; var NO_ERRORS_SCHEMA = { name: 'no-errors-schema' }; var createOptional = makeMetadataFactory('Optional'); var createSelf = makeMetadataFactory('Self'); var createSkipSelf = makeMetadataFactory('SkipSelf'); var createHost = makeMetadataFactory('Host'); var Type = Function; var SecurityContext; (function (SecurityContext) { SecurityContext[SecurityContext["NONE"] = 0] = "NONE"; SecurityContext[SecurityContext["HTML"] = 1] = "HTML"; SecurityContext[SecurityContext["STYLE"] = 2] = "STYLE"; SecurityContext[SecurityContext["SCRIPT"] = 3] = "SCRIPT"; SecurityContext[SecurityContext["URL"] = 4] = "URL"; SecurityContext[SecurityContext["RESOURCE_URL"] = 5] = "RESOURCE_URL"; })(SecurityContext || (SecurityContext = {})); var MissingTranslationStrategy; (function (MissingTranslationStrategy) { MissingTranslationStrategy[MissingTranslationStrategy["Error"] = 0] = "Error"; MissingTranslationStrategy[MissingTranslationStrategy["Warning"] = 1] = "Warning"; MissingTranslationStrategy[MissingTranslationStrategy["Ignore"] = 2] = "Ignore"; })(MissingTranslationStrategy || (MissingTranslationStrategy = {})); function makeMetadataFactory(name, props) { // This must be declared as a function, not a fat arrow, so that ES2015 devmode produces code // that works with the static_reflector.ts in the ViewEngine compiler. // In particular, `_registerDecoratorOrConstructor` assumes that the value returned here can be // new'ed. function factory() { var values = props ? props.apply(void 0, arguments) : {}; return Object.assign({ ngMetadataName: name }, values); } factory.isTypeOf = function (obj) { return obj && obj.ngMetadataName === name; }; factory.ngMetadataName = name; return factory; } function parserSelectorToSimpleSelector(selector) { var classes = selector.classNames && selector.classNames.length ? [8 /* CLASS */ ].concat(_toConsumableArray(selector.classNames)) : []; var elementName = selector.element && selector.element !== '*' ? selector.element : ''; return [elementName].concat(_toConsumableArray(selector.attrs), _toConsumableArray(classes)); } function parserSelectorToNegativeSelector(selector) { var classes = selector.classNames && selector.classNames.length ? [8 /* CLASS */ ].concat(_toConsumableArray(selector.classNames)) : []; if (selector.element) { return [1 /* NOT */ | 4 /* ELEMENT */ , selector.element].concat(_toConsumableArray(selector.attrs), _toConsumableArray(classes)); } else if (selector.attrs.length) { return [1 /* NOT */ | 2 /* ATTRIBUTE */ ].concat(_toConsumableArray(selector.attrs), _toConsumableArray(classes)); } else { return selector.classNames && selector.classNames.length ? [1 /* NOT */ | 8 /* CLASS */ ].concat(_toConsumableArray(selector.classNames)) : []; } } function parserSelectorToR3Selector(selector) { var positive = parserSelectorToSimpleSelector(selector); var negative = selector.notSelectors && selector.notSelectors.length ? selector.notSelectors.map(function (notSelector) { return parserSelectorToNegativeSelector(notSelector); }) : []; return positive.concat.apply(positive, _toConsumableArray(negative)); } function parseSelectorToR3Selector(selector) { return selector ? CssSelector.parse(selector).map(parserSelectorToR3Selector) : []; } var core = /*#__PURE__*/Object.freeze({ createInject: createInject, createInjectionToken: createInjectionToken, createAttribute: createAttribute, createContentChildren: createContentChildren, createContentChild: createContentChild, createViewChildren: createViewChildren, createViewChild: createViewChild, createDirective: createDirective, get ViewEncapsulation() { return ViewEncapsulation; }, get ChangeDetectionStrategy() { return ChangeDetectionStrategy; }, createComponent: createComponent, createPipe: createPipe, createInput: createInput, createOutput: createOutput, createHostBinding: createHostBinding, createHostListener: createHostListener, createNgModule: createNgModule, createInjectable: createInjectable, CUSTOM_ELEMENTS_SCHEMA: CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA: NO_ERRORS_SCHEMA, createOptional: createOptional, createSelf: createSelf, createSkipSelf: createSkipSelf, createHost: createHost, Type: Type, get SecurityContext() { return SecurityContext; }, get MissingTranslationStrategy() { return MissingTranslationStrategy; }, parseSelectorToR3Selector: parseSelectorToR3Selector }); /** * @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 */ //// Types var TypeModifier; (function (TypeModifier) { TypeModifier[TypeModifier["Const"] = 0] = "Const"; })(TypeModifier || (TypeModifier = {})); var Type$1 = /*#__PURE__*/function () { function Type$1() { var modifiers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; _classCallCheck(this, Type$1); this.modifiers = modifiers; if (!modifiers) { this.modifiers = []; } } _createClass2(Type$1, [{ key: "hasModifier", value: function hasModifier(modifier) { return this.modifiers.indexOf(modifier) !== -1; } }]); return Type$1; }(); var BuiltinTypeName; (function (BuiltinTypeName) { BuiltinTypeName[BuiltinTypeName["Dynamic"] = 0] = "Dynamic"; BuiltinTypeName[BuiltinTypeName["Bool"] = 1] = "Bool"; BuiltinTypeName[BuiltinTypeName["String"] = 2] = "String"; BuiltinTypeName[BuiltinTypeName["Int"] = 3] = "Int"; BuiltinTypeName[BuiltinTypeName["Number"] = 4] = "Number"; BuiltinTypeName[BuiltinTypeName["Function"] = 5] = "Function"; BuiltinTypeName[BuiltinTypeName["Inferred"] = 6] = "Inferred"; BuiltinTypeName[BuiltinTypeName["None"] = 7] = "None"; })(BuiltinTypeName || (BuiltinTypeName = {})); var BuiltinType = /*#__PURE__*/function (_Type$) { _inherits(BuiltinType, _Type$); var _super9 = _createSuper(BuiltinType); function BuiltinType(name) { var _this29; var modifiers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; _classCallCheck(this, BuiltinType); _this29 = _super9.call(this, modifiers); _this29.name = name; return _this29; } _createClass2(BuiltinType, [{ key: "visitType", value: function visitType(visitor, context) { return visitor.visitBuiltinType(this, context); } }]); return BuiltinType; }(Type$1); var ExpressionType = /*#__PURE__*/function (_Type$2) { _inherits(ExpressionType, _Type$2); var _super10 = _createSuper(ExpressionType); function ExpressionType(value) { var _this30; var modifiers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var typeParams = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; _classCallCheck(this, ExpressionType); _this30 = _super10.call(this, modifiers); _this30.value = value; _this30.typeParams = typeParams; return _this30; } _createClass2(ExpressionType, [{ key: "visitType", value: function visitType(visitor, context) { return visitor.visitExpressionType(this, context); } }]); return ExpressionType; }(Type$1); var ArrayType = /*#__PURE__*/function (_Type$3) { _inherits(ArrayType, _Type$3); var _super11 = _createSuper(ArrayType); function ArrayType(of) { var _this31; var modifiers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; _classCallCheck(this, ArrayType); _this31 = _super11.call(this, modifiers); _this31.of = of; return _this31; } _createClass2(ArrayType, [{ key: "visitType", value: function visitType(visitor, context) { return visitor.visitArrayType(this, context); } }]); return ArrayType; }(Type$1); var MapType = /*#__PURE__*/function (_Type$4) { _inherits(MapType, _Type$4); var _super12 = _createSuper(MapType); function MapType(valueType) { var _this32; var modifiers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; _classCallCheck(this, MapType); _this32 = _super12.call(this, modifiers); _this32.valueType = valueType || null; return _this32; } _createClass2(MapType, [{ key: "visitType", value: function visitType(visitor, context) { return visitor.visitMapType(this, context); } }]); return MapType; }(Type$1); var DYNAMIC_TYPE = new BuiltinType(BuiltinTypeName.Dynamic); var INFERRED_TYPE = new BuiltinType(BuiltinTypeName.Inferred); var BOOL_TYPE = new BuiltinType(BuiltinTypeName.Bool); var INT_TYPE = new BuiltinType(BuiltinTypeName.Int); var NUMBER_TYPE = new BuiltinType(BuiltinTypeName.Number); var STRING_TYPE = new BuiltinType(BuiltinTypeName.String); var FUNCTION_TYPE = new BuiltinType(BuiltinTypeName.Function); var NONE_TYPE = new BuiltinType(BuiltinTypeName.None); ///// Expressions var BinaryOperator; (function (BinaryOperator) { BinaryOperator[BinaryOperator["Equals"] = 0] = "Equals"; BinaryOperator[BinaryOperator["NotEquals"] = 1] = "NotEquals"; BinaryOperator[BinaryOperator["Identical"] = 2] = "Identical"; BinaryOperator[BinaryOperator["NotIdentical"] = 3] = "NotIdentical"; BinaryOperator[BinaryOperator["Minus"] = 4] = "Minus"; BinaryOperator[BinaryOperator["Plus"] = 5] = "Plus"; BinaryOperator[BinaryOperator["Divide"] = 6] = "Divide"; BinaryOperator[BinaryOperator["Multiply"] = 7] = "Multiply"; BinaryOperator[BinaryOperator["Modulo"] = 8] = "Modulo"; BinaryOperator[BinaryOperator["And"] = 9] = "And"; BinaryOperator[BinaryOperator["Or"] = 10] = "Or"; BinaryOperator[BinaryOperator["BitwiseAnd"] = 11] = "BitwiseAnd"; BinaryOperator[BinaryOperator["Lower"] = 12] = "Lower"; BinaryOperator[BinaryOperator["LowerEquals"] = 13] = "LowerEquals"; BinaryOperator[BinaryOperator["Bigger"] = 14] = "Bigger"; BinaryOperator[BinaryOperator["BiggerEquals"] = 15] = "BiggerEquals"; })(BinaryOperator || (BinaryOperator = {})); function nullSafeIsEquivalent(base, other) { if (base == null || other == null) { return base == other; } return base.isEquivalent(other); } function areAllEquivalent(base, other) { var len = base.length; if (len !== other.length) { return false; } for (var i = 0; i < len; i++) { if (!base[i].isEquivalent(other[i])) { return false; } } return true; } var Expression = /*#__PURE__*/function () { function Expression(type, sourceSpan) { _classCallCheck(this, Expression); this.type = type || null; this.sourceSpan = sourceSpan || null; } _createClass2(Expression, [{ key: "prop", value: function prop(name, sourceSpan) { return new ReadPropExpr(this, name, null, sourceSpan); } }, { key: "key", value: function key(index, type, sourceSpan) { return new ReadKeyExpr(this, index, type, sourceSpan); } }, { key: "callMethod", value: function callMethod(name, params, sourceSpan) { return new InvokeMethodExpr(this, name, params, null, sourceSpan); } }, { key: "callFn", value: function callFn(params, sourceSpan) { return new InvokeFunctionExpr(this, params, null, sourceSpan); } }, { key: "instantiate", value: function instantiate(params, type, sourceSpan) { return new InstantiateExpr(this, params, type, sourceSpan); } }, { key: "conditional", value: function conditional(trueCase) { var falseCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var sourceSpan = arguments.length > 2 ? arguments[2] : undefined; return new ConditionalExpr(this, trueCase, falseCase, null, sourceSpan); } }, { key: "equals", value: function equals(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Equals, this, rhs, null, sourceSpan); } }, { key: "notEquals", value: function notEquals(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.NotEquals, this, rhs, null, sourceSpan); } }, { key: "identical", value: function identical(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Identical, this, rhs, null, sourceSpan); } }, { key: "notIdentical", value: function notIdentical(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.NotIdentical, this, rhs, null, sourceSpan); } }, { key: "minus", value: function minus(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Minus, this, rhs, null, sourceSpan); } }, { key: "plus", value: function plus(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Plus, this, rhs, null, sourceSpan); } }, { key: "divide", value: function divide(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Divide, this, rhs, null, sourceSpan); } }, { key: "multiply", value: function multiply(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Multiply, this, rhs, null, sourceSpan); } }, { key: "modulo", value: function modulo(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Modulo, this, rhs, null, sourceSpan); } }, { key: "and", value: function and(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.And, this, rhs, null, sourceSpan); } }, { key: "bitwiseAnd", value: function bitwiseAnd(rhs, sourceSpan) { var parens = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; return new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, this, rhs, null, sourceSpan, parens); } }, { key: "or", value: function or(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Or, this, rhs, null, sourceSpan); } }, { key: "lower", value: function lower(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Lower, this, rhs, null, sourceSpan); } }, { key: "lowerEquals", value: function lowerEquals(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.LowerEquals, this, rhs, null, sourceSpan); } }, { key: "bigger", value: function bigger(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.Bigger, this, rhs, null, sourceSpan); } }, { key: "biggerEquals", value: function biggerEquals(rhs, sourceSpan) { return new BinaryOperatorExpr(BinaryOperator.BiggerEquals, this, rhs, null, sourceSpan); } }, { key: "isBlank", value: function isBlank(sourceSpan) { // Note: We use equals by purpose here to compare to null and undefined in JS. // We use the typed null to allow strictNullChecks to narrow types. return this.equals(TYPED_NULL_EXPR, sourceSpan); } }, { key: "cast", value: function cast(type, sourceSpan) { return new CastExpr(this, type, sourceSpan); } }, { key: "toStmt", value: function toStmt() { return new ExpressionStatement(this, null); } }]); return Expression; }(); var BuiltinVar; (function (BuiltinVar) { BuiltinVar[BuiltinVar["This"] = 0] = "This"; BuiltinVar[BuiltinVar["Super"] = 1] = "Super"; BuiltinVar[BuiltinVar["CatchError"] = 2] = "CatchError"; BuiltinVar[BuiltinVar["CatchStack"] = 3] = "CatchStack"; })(BuiltinVar || (BuiltinVar = {})); var ReadVarExpr = /*#__PURE__*/function (_Expression) { _inherits(ReadVarExpr, _Expression); var _super13 = _createSuper(ReadVarExpr); function ReadVarExpr(name, type, sourceSpan) { var _this33; _classCallCheck(this, ReadVarExpr); _this33 = _super13.call(this, type, sourceSpan); if (typeof name === 'string') { _this33.name = name; _this33.builtin = null; } else { _this33.name = null; _this33.builtin = name; } return _this33; } _createClass2(ReadVarExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof ReadVarExpr && this.name === e.name && this.builtin === e.builtin; } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitReadVarExpr(this, context); } }, { key: "set", value: function set(value) { if (!this.name) { throw new Error("Built in variable ".concat(this.builtin, " can not be assigned to.")); } return new WriteVarExpr(this.name, value, null, this.sourceSpan); } }]); return ReadVarExpr; }(Expression); var TypeofExpr = /*#__PURE__*/function (_Expression2) { _inherits(TypeofExpr, _Expression2); var _super14 = _createSuper(TypeofExpr); function TypeofExpr(expr, type, sourceSpan) { var _this34; _classCallCheck(this, TypeofExpr); _this34 = _super14.call(this, type, sourceSpan); _this34.expr = expr; return _this34; } _createClass2(TypeofExpr, [{ key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitTypeofExpr(this, context); } }, { key: "isEquivalent", value: function isEquivalent(e) { return e instanceof TypeofExpr && e.expr.isEquivalent(this.expr); } }, { key: "isConstant", value: function isConstant() { return this.expr.isConstant(); } }]); return TypeofExpr; }(Expression); var WrappedNodeExpr = /*#__PURE__*/function (_Expression3) { _inherits(WrappedNodeExpr, _Expression3); var _super15 = _createSuper(WrappedNodeExpr); function WrappedNodeExpr(node, type, sourceSpan) { var _this35; _classCallCheck(this, WrappedNodeExpr); _this35 = _super15.call(this, type, sourceSpan); _this35.node = node; return _this35; } _createClass2(WrappedNodeExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof WrappedNodeExpr && this.node === e.node; } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitWrappedNodeExpr(this, context); } }]); return WrappedNodeExpr; }(Expression); var WriteVarExpr = /*#__PURE__*/function (_Expression4) { _inherits(WriteVarExpr, _Expression4); var _super16 = _createSuper(WriteVarExpr); function WriteVarExpr(name, value, type, sourceSpan) { var _this36; _classCallCheck(this, WriteVarExpr); _this36 = _super16.call(this, type || value.type, sourceSpan); _this36.name = name; _this36.value = value; return _this36; } _createClass2(WriteVarExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof WriteVarExpr && this.name === e.name && this.value.isEquivalent(e.value); } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitWriteVarExpr(this, context); } }, { key: "toDeclStmt", value: function toDeclStmt(type, modifiers) { return new DeclareVarStmt(this.name, this.value, type, modifiers, this.sourceSpan); } }, { key: "toConstDecl", value: function toConstDecl() { return this.toDeclStmt(INFERRED_TYPE, [StmtModifier.Final]); } }]); return WriteVarExpr; }(Expression); var WriteKeyExpr = /*#__PURE__*/function (_Expression5) { _inherits(WriteKeyExpr, _Expression5); var _super17 = _createSuper(WriteKeyExpr); function WriteKeyExpr(receiver, index, value, type, sourceSpan) { var _this37; _classCallCheck(this, WriteKeyExpr); _this37 = _super17.call(this, type || value.type, sourceSpan); _this37.receiver = receiver; _this37.index = index; _this37.value = value; return _this37; } _createClass2(WriteKeyExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof WriteKeyExpr && this.receiver.isEquivalent(e.receiver) && this.index.isEquivalent(e.index) && this.value.isEquivalent(e.value); } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitWriteKeyExpr(this, context); } }]); return WriteKeyExpr; }(Expression); var WritePropExpr = /*#__PURE__*/function (_Expression6) { _inherits(WritePropExpr, _Expression6); var _super18 = _createSuper(WritePropExpr); function WritePropExpr(receiver, name, value, type, sourceSpan) { var _this38; _classCallCheck(this, WritePropExpr); _this38 = _super18.call(this, type || value.type, sourceSpan); _this38.receiver = receiver; _this38.name = name; _this38.value = value; return _this38; } _createClass2(WritePropExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof WritePropExpr && this.receiver.isEquivalent(e.receiver) && this.name === e.name && this.value.isEquivalent(e.value); } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitWritePropExpr(this, context); } }]); return WritePropExpr; }(Expression); var BuiltinMethod; (function (BuiltinMethod) { BuiltinMethod[BuiltinMethod["ConcatArray"] = 0] = "ConcatArray"; BuiltinMethod[BuiltinMethod["SubscribeObservable"] = 1] = "SubscribeObservable"; BuiltinMethod[BuiltinMethod["Bind"] = 2] = "Bind"; })(BuiltinMethod || (BuiltinMethod = {})); var InvokeMethodExpr = /*#__PURE__*/function (_Expression7) { _inherits(InvokeMethodExpr, _Expression7); var _super19 = _createSuper(InvokeMethodExpr); function InvokeMethodExpr(receiver, method, args, type, sourceSpan) { var _this39; _classCallCheck(this, InvokeMethodExpr); _this39 = _super19.call(this, type, sourceSpan); _this39.receiver = receiver; _this39.args = args; if (typeof method === 'string') { _this39.name = method; _this39.builtin = null; } else { _this39.name = null; _this39.builtin = method; } return _this39; } _createClass2(InvokeMethodExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof InvokeMethodExpr && this.receiver.isEquivalent(e.receiver) && this.name === e.name && this.builtin === e.builtin && areAllEquivalent(this.args, e.args); } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitInvokeMethodExpr(this, context); } }]); return InvokeMethodExpr; }(Expression); var InvokeFunctionExpr = /*#__PURE__*/function (_Expression8) { _inherits(InvokeFunctionExpr, _Expression8); var _super20 = _createSuper(InvokeFunctionExpr); function InvokeFunctionExpr(fn, args, type, sourceSpan) { var _this40; var pure = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; _classCallCheck(this, InvokeFunctionExpr); _this40 = _super20.call(this, type, sourceSpan); _this40.fn = fn; _this40.args = args; _this40.pure = pure; return _this40; } _createClass2(InvokeFunctionExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof InvokeFunctionExpr && this.fn.isEquivalent(e.fn) && areAllEquivalent(this.args, e.args) && this.pure === e.pure; } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitInvokeFunctionExpr(this, context); } }]); return InvokeFunctionExpr; }(Expression); var InstantiateExpr = /*#__PURE__*/function (_Expression9) { _inherits(InstantiateExpr, _Expression9); var _super21 = _createSuper(InstantiateExpr); function InstantiateExpr(classExpr, args, type, sourceSpan) { var _this41; _classCallCheck(this, InstantiateExpr); _this41 = _super21.call(this, type, sourceSpan); _this41.classExpr = classExpr; _this41.args = args; return _this41; } _createClass2(InstantiateExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof InstantiateExpr && this.classExpr.isEquivalent(e.classExpr) && areAllEquivalent(this.args, e.args); } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitInstantiateExpr(this, context); } }]); return InstantiateExpr; }(Expression); var LiteralExpr = /*#__PURE__*/function (_Expression10) { _inherits(LiteralExpr, _Expression10); var _super22 = _createSuper(LiteralExpr); function LiteralExpr(value, type, sourceSpan) { var _this42; _classCallCheck(this, LiteralExpr); _this42 = _super22.call(this, type, sourceSpan); _this42.value = value; return _this42; } _createClass2(LiteralExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof LiteralExpr && this.value === e.value; } }, { key: "isConstant", value: function isConstant() { return true; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitLiteralExpr(this, context); } }]); return LiteralExpr; }(Expression); var ExternalExpr = /*#__PURE__*/function (_Expression11) { _inherits(ExternalExpr, _Expression11); var _super23 = _createSuper(ExternalExpr); function ExternalExpr(value, type) { var _this43; var typeParams = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var sourceSpan = arguments.length > 3 ? arguments[3] : undefined; _classCallCheck(this, ExternalExpr); _this43 = _super23.call(this, type, sourceSpan); _this43.value = value; _this43.typeParams = typeParams; return _this43; } _createClass2(ExternalExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof ExternalExpr && this.value.name === e.value.name && this.value.moduleName === e.value.moduleName && this.value.runtime === e.value.runtime; } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitExternalExpr(this, context); } }]); return ExternalExpr; }(Expression); var ExternalReference = function ExternalReference(moduleName, name, runtime) { _classCallCheck(this, ExternalReference); this.moduleName = moduleName; this.name = name; this.runtime = runtime; }; var ConditionalExpr = /*#__PURE__*/function (_Expression12) { _inherits(ConditionalExpr, _Expression12); var _super24 = _createSuper(ConditionalExpr); function ConditionalExpr(condition, trueCase) { var _this44; var falseCase = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var type = arguments.length > 3 ? arguments[3] : undefined; var sourceSpan = arguments.length > 4 ? arguments[4] : undefined; _classCallCheck(this, ConditionalExpr); _this44 = _super24.call(this, type || trueCase.type, sourceSpan); _this44.condition = condition; _this44.falseCase = falseCase; _this44.trueCase = trueCase; return _this44; } _createClass2(ConditionalExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof ConditionalExpr && this.condition.isEquivalent(e.condition) && this.trueCase.isEquivalent(e.trueCase) && nullSafeIsEquivalent(this.falseCase, e.falseCase); } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitConditionalExpr(this, context); } }]); return ConditionalExpr; }(Expression); var NotExpr = /*#__PURE__*/function (_Expression13) { _inherits(NotExpr, _Expression13); var _super25 = _createSuper(NotExpr); function NotExpr(condition, sourceSpan) { var _this45; _classCallCheck(this, NotExpr); _this45 = _super25.call(this, BOOL_TYPE, sourceSpan); _this45.condition = condition; return _this45; } _createClass2(NotExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof NotExpr && this.condition.isEquivalent(e.condition); } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitNotExpr(this, context); } }]); return NotExpr; }(Expression); var AssertNotNull = /*#__PURE__*/function (_Expression14) { _inherits(AssertNotNull, _Expression14); var _super26 = _createSuper(AssertNotNull); function AssertNotNull(condition, sourceSpan) { var _this46; _classCallCheck(this, AssertNotNull); _this46 = _super26.call(this, condition.type, sourceSpan); _this46.condition = condition; return _this46; } _createClass2(AssertNotNull, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof AssertNotNull && this.condition.isEquivalent(e.condition); } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitAssertNotNullExpr(this, context); } }]); return AssertNotNull; }(Expression); var CastExpr = /*#__PURE__*/function (_Expression15) { _inherits(CastExpr, _Expression15); var _super27 = _createSuper(CastExpr); function CastExpr(value, type, sourceSpan) { var _this47; _classCallCheck(this, CastExpr); _this47 = _super27.call(this, type, sourceSpan); _this47.value = value; return _this47; } _createClass2(CastExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof CastExpr && this.value.isEquivalent(e.value); } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitCastExpr(this, context); } }]); return CastExpr; }(Expression); var FnParam = /*#__PURE__*/function () { function FnParam(name) { var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; _classCallCheck(this, FnParam); this.name = name; this.type = type; } _createClass2(FnParam, [{ key: "isEquivalent", value: function isEquivalent(param) { return this.name === param.name; } }]); return FnParam; }(); var FunctionExpr = /*#__PURE__*/function (_Expression16) { _inherits(FunctionExpr, _Expression16); var _super28 = _createSuper(FunctionExpr); function FunctionExpr(params, statements, type, sourceSpan, name) { var _this48; _classCallCheck(this, FunctionExpr); _this48 = _super28.call(this, type, sourceSpan); _this48.params = params; _this48.statements = statements; _this48.name = name; return _this48; } _createClass2(FunctionExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof FunctionExpr && areAllEquivalent(this.params, e.params) && areAllEquivalent(this.statements, e.statements); } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitFunctionExpr(this, context); } }, { key: "toDeclStmt", value: function toDeclStmt(name) { var modifiers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return new DeclareFunctionStmt(name, this.params, this.statements, this.type, modifiers, this.sourceSpan); } }]); return FunctionExpr; }(Expression); var BinaryOperatorExpr = /*#__PURE__*/function (_Expression17) { _inherits(BinaryOperatorExpr, _Expression17); var _super29 = _createSuper(BinaryOperatorExpr); function BinaryOperatorExpr(operator, lhs, rhs, type, sourceSpan) { var _this49; var parens = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : true; _classCallCheck(this, BinaryOperatorExpr); _this49 = _super29.call(this, type || lhs.type, sourceSpan); _this49.operator = operator; _this49.rhs = rhs; _this49.parens = parens; _this49.lhs = lhs; return _this49; } _createClass2(BinaryOperatorExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof BinaryOperatorExpr && this.operator === e.operator && this.lhs.isEquivalent(e.lhs) && this.rhs.isEquivalent(e.rhs); } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitBinaryOperatorExpr(this, context); } }]); return BinaryOperatorExpr; }(Expression); var ReadPropExpr = /*#__PURE__*/function (_Expression18) { _inherits(ReadPropExpr, _Expression18); var _super30 = _createSuper(ReadPropExpr); function ReadPropExpr(receiver, name, type, sourceSpan) { var _this50; _classCallCheck(this, ReadPropExpr); _this50 = _super30.call(this, type, sourceSpan); _this50.receiver = receiver; _this50.name = name; return _this50; } _createClass2(ReadPropExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof ReadPropExpr && this.receiver.isEquivalent(e.receiver) && this.name === e.name; } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitReadPropExpr(this, context); } }, { key: "set", value: function set(value) { return new WritePropExpr(this.receiver, this.name, value, null, this.sourceSpan); } }]); return ReadPropExpr; }(Expression); var ReadKeyExpr = /*#__PURE__*/function (_Expression19) { _inherits(ReadKeyExpr, _Expression19); var _super31 = _createSuper(ReadKeyExpr); function ReadKeyExpr(receiver, index, type, sourceSpan) { var _this51; _classCallCheck(this, ReadKeyExpr); _this51 = _super31.call(this, type, sourceSpan); _this51.receiver = receiver; _this51.index = index; return _this51; } _createClass2(ReadKeyExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof ReadKeyExpr && this.receiver.isEquivalent(e.receiver) && this.index.isEquivalent(e.index); } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitReadKeyExpr(this, context); } }, { key: "set", value: function set(value) { return new WriteKeyExpr(this.receiver, this.index, value, null, this.sourceSpan); } }]); return ReadKeyExpr; }(Expression); var LiteralArrayExpr = /*#__PURE__*/function (_Expression20) { _inherits(LiteralArrayExpr, _Expression20); var _super32 = _createSuper(LiteralArrayExpr); function LiteralArrayExpr(entries, type, sourceSpan) { var _this52; _classCallCheck(this, LiteralArrayExpr); _this52 = _super32.call(this, type, sourceSpan); _this52.entries = entries; return _this52; } _createClass2(LiteralArrayExpr, [{ key: "isConstant", value: function isConstant() { return this.entries.every(function (e) { return e.isConstant(); }); } }, { key: "isEquivalent", value: function isEquivalent(e) { return e instanceof LiteralArrayExpr && areAllEquivalent(this.entries, e.entries); } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitLiteralArrayExpr(this, context); } }]); return LiteralArrayExpr; }(Expression); var LiteralMapEntry = /*#__PURE__*/function () { function LiteralMapEntry(key, value, quoted) { _classCallCheck(this, LiteralMapEntry); this.key = key; this.value = value; this.quoted = quoted; } _createClass2(LiteralMapEntry, [{ key: "isEquivalent", value: function isEquivalent(e) { return this.key === e.key && this.value.isEquivalent(e.value); } }]); return LiteralMapEntry; }(); var LiteralMapExpr = /*#__PURE__*/function (_Expression21) { _inherits(LiteralMapExpr, _Expression21); var _super33 = _createSuper(LiteralMapExpr); function LiteralMapExpr(entries, type, sourceSpan) { var _this53; _classCallCheck(this, LiteralMapExpr); _this53 = _super33.call(this, type, sourceSpan); _this53.entries = entries; _this53.valueType = null; if (type) { _this53.valueType = type.valueType; } return _this53; } _createClass2(LiteralMapExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof LiteralMapExpr && areAllEquivalent(this.entries, e.entries); } }, { key: "isConstant", value: function isConstant() { return this.entries.every(function (e) { return e.value.isConstant(); }); } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitLiteralMapExpr(this, context); } }]); return LiteralMapExpr; }(Expression); var CommaExpr = /*#__PURE__*/function (_Expression22) { _inherits(CommaExpr, _Expression22); var _super34 = _createSuper(CommaExpr); function CommaExpr(parts, sourceSpan) { var _this54; _classCallCheck(this, CommaExpr); _this54 = _super34.call(this, parts[parts.length - 1].type, sourceSpan); _this54.parts = parts; return _this54; } _createClass2(CommaExpr, [{ key: "isEquivalent", value: function isEquivalent(e) { return e instanceof CommaExpr && areAllEquivalent(this.parts, e.parts); } }, { key: "isConstant", value: function isConstant() { return false; } }, { key: "visitExpression", value: function visitExpression(visitor, context) { return visitor.visitCommaExpr(this, context); } }]); return CommaExpr; }(Expression); var THIS_EXPR = new ReadVarExpr(BuiltinVar.This, null, null); var SUPER_EXPR = new ReadVarExpr(BuiltinVar.Super, null, null); var CATCH_ERROR_VAR = new ReadVarExpr(BuiltinVar.CatchError, null, null); var CATCH_STACK_VAR = new ReadVarExpr(BuiltinVar.CatchStack, null, null); var NULL_EXPR = new LiteralExpr(null, null, null); var TYPED_NULL_EXPR = new LiteralExpr(null, INFERRED_TYPE, null); //// Statements var StmtModifier; (function (StmtModifier) { StmtModifier[StmtModifier["Final"] = 0] = "Final"; StmtModifier[StmtModifier["Private"] = 1] = "Private"; StmtModifier[StmtModifier["Exported"] = 2] = "Exported"; StmtModifier[StmtModifier["Static"] = 3] = "Static"; })(StmtModifier || (StmtModifier = {})); var Statement = /*#__PURE__*/function () { function Statement(modifiers, sourceSpan) { _classCallCheck(this, Statement); this.modifiers = modifiers || []; this.sourceSpan = sourceSpan || null; } _createClass2(Statement, [{ key: "hasModifier", value: function hasModifier(modifier) { return this.modifiers.indexOf(modifier) !== -1; } }]); return Statement; }(); var DeclareVarStmt = /*#__PURE__*/function (_Statement) { _inherits(DeclareVarStmt, _Statement); var _super35 = _createSuper(DeclareVarStmt); function DeclareVarStmt(name, value, type) { var _this55; var modifiers = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; var sourceSpan = arguments.length > 4 ? arguments[4] : undefined; _classCallCheck(this, DeclareVarStmt); _this55 = _super35.call(this, modifiers, sourceSpan); _this55.name = name; _this55.value = value; _this55.type = type || value && value.type || null; return _this55; } _createClass2(DeclareVarStmt, [{ key: "isEquivalent", value: function isEquivalent(stmt) { return stmt instanceof DeclareVarStmt && this.name === stmt.name && (this.value ? !!stmt.value && this.value.isEquivalent(stmt.value) : !stmt.value); } }, { key: "visitStatement", value: function visitStatement(visitor, context) { return visitor.visitDeclareVarStmt(this, context); } }]); return DeclareVarStmt; }(Statement); var DeclareFunctionStmt = /*#__PURE__*/function (_Statement2) { _inherits(DeclareFunctionStmt, _Statement2); var _super36 = _createSuper(DeclareFunctionStmt); function DeclareFunctionStmt(name, params, statements, type) { var _this56; var modifiers = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null; var sourceSpan = arguments.length > 5 ? arguments[5] : undefined; _classCallCheck(this, DeclareFunctionStmt); _this56 = _super36.call(this, modifiers, sourceSpan); _this56.name = name; _this56.params = params; _this56.statements = statements; _this56.type = type || null; return _this56; } _createClass2(DeclareFunctionStmt, [{ key: "isEquivalent", value: function isEquivalent(stmt) { return stmt instanceof DeclareFunctionStmt && areAllEquivalent(this.params, stmt.params) && areAllEquivalent(this.statements, stmt.statements); } }, { key: "visitStatement", value: function visitStatement(visitor, context) { return visitor.visitDeclareFunctionStmt(this, context); } }]); return DeclareFunctionStmt; }(Statement); var ExpressionStatement = /*#__PURE__*/function (_Statement3) { _inherits(ExpressionStatement, _Statement3); var _super37 = _createSuper(ExpressionStatement); function ExpressionStatement(expr, sourceSpan) { var _this57; _classCallCheck(this, ExpressionStatement); _this57 = _super37.call(this, null, sourceSpan); _this57.expr = expr; return _this57; } _createClass2(ExpressionStatement, [{ key: "isEquivalent", value: function isEquivalent(stmt) { return stmt instanceof ExpressionStatement && this.expr.isEquivalent(stmt.expr); } }, { key: "visitStatement", value: function visitStatement(visitor, context) { return visitor.visitExpressionStmt(this, context); } }]); return ExpressionStatement; }(Statement); var ReturnStatement = /*#__PURE__*/function (_Statement4) { _inherits(ReturnStatement, _Statement4); var _super38 = _createSuper(ReturnStatement); function ReturnStatement(value, sourceSpan) { var _this58; _classCallCheck(this, ReturnStatement); _this58 = _super38.call(this, null, sourceSpan); _this58.value = value; return _this58; } _createClass2(ReturnStatement, [{ key: "isEquivalent", value: function isEquivalent(stmt) { return stmt instanceof ReturnStatement && this.value.isEquivalent(stmt.value); } }, { key: "visitStatement", value: function visitStatement(visitor, context) { return visitor.visitReturnStmt(this, context); } }]); return ReturnStatement; }(Statement); var AbstractClassPart = /*#__PURE__*/function () { function AbstractClassPart(type, modifiers) { _classCallCheck(this, AbstractClassPart); this.modifiers = modifiers; if (!modifiers) { this.modifiers = []; } this.type = type || null; } _createClass2(AbstractClassPart, [{ key: "hasModifier", value: function hasModifier(modifier) { return this.modifiers.indexOf(modifier) !== -1; } }]); return AbstractClassPart; }(); var ClassField = /*#__PURE__*/function (_AbstractClassPart) { _inherits(ClassField, _AbstractClassPart); var _super39 = _createSuper(ClassField); function ClassField(name, type) { var _this59; var modifiers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var initializer = arguments.length > 3 ? arguments[3] : undefined; _classCallCheck(this, ClassField); _this59 = _super39.call(this, type, modifiers); _this59.name = name; _this59.initializer = initializer; return _this59; } _createClass2(ClassField, [{ key: "isEquivalent", value: function isEquivalent(f) { return this.name === f.name; } }]); return ClassField; }(AbstractClassPart); var ClassMethod = /*#__PURE__*/function (_AbstractClassPart2) { _inherits(ClassMethod, _AbstractClassPart2); var _super40 = _createSuper(ClassMethod); function ClassMethod(name, params, body, type) { var _this60; var modifiers = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null; _classCallCheck(this, ClassMethod); _this60 = _super40.call(this, type, modifiers); _this60.name = name; _this60.params = params; _this60.body = body; return _this60; } _createClass2(ClassMethod, [{ key: "isEquivalent", value: function isEquivalent(m) { return this.name === m.name && areAllEquivalent(this.body, m.body); } }]); return ClassMethod; }(AbstractClassPart); var ClassGetter = /*#__PURE__*/function (_AbstractClassPart3) { _inherits(ClassGetter, _AbstractClassPart3); var _super41 = _createSuper(ClassGetter); function ClassGetter(name, body, type) { var _this61; var modifiers = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; _classCallCheck(this, ClassGetter); _this61 = _super41.call(this, type, modifiers); _this61.name = name; _this61.body = body; return _this61; } _createClass2(ClassGetter, [{ key: "isEquivalent", value: function isEquivalent(m) { return this.name === m.name && areAllEquivalent(this.body, m.body); } }]); return ClassGetter; }(AbstractClassPart); var ClassStmt = /*#__PURE__*/function (_Statement5) { _inherits(ClassStmt, _Statement5); var _super42 = _createSuper(ClassStmt); function ClassStmt(name, parent, fields, getters, constructorMethod, methods) { var _this62; var modifiers = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null; var sourceSpan = arguments.length > 7 ? arguments[7] : undefined; _classCallCheck(this, ClassStmt); _this62 = _super42.call(this, modifiers, sourceSpan); _this62.name = name; _this62.parent = parent; _this62.fields = fields; _this62.getters = getters; _this62.constructorMethod = constructorMethod; _this62.methods = methods; return _this62; } _createClass2(ClassStmt, [{ key: "isEquivalent", value: function isEquivalent(stmt) { return stmt instanceof ClassStmt && this.name === stmt.name && nullSafeIsEquivalent(this.parent, stmt.parent) && areAllEquivalent(this.fields, stmt.fields) && areAllEquivalent(this.getters, stmt.getters) && this.constructorMethod.isEquivalent(stmt.constructorMethod) && areAllEquivalent(this.methods, stmt.methods); } }, { key: "visitStatement", value: function visitStatement(visitor, context) { return visitor.visitDeclareClassStmt(this, context); } }]); return ClassStmt; }(Statement); var IfStmt = /*#__PURE__*/function (_Statement6) { _inherits(IfStmt, _Statement6); var _super43 = _createSuper(IfStmt); function IfStmt(condition, trueCase) { var _this63; var falseCase = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; var sourceSpan = arguments.length > 3 ? arguments[3] : undefined; _classCallCheck(this, IfStmt); _this63 = _super43.call(this, null, sourceSpan); _this63.condition = condition; _this63.trueCase = trueCase; _this63.falseCase = falseCase; return _this63; } _createClass2(IfStmt, [{ key: "isEquivalent", value: function isEquivalent(stmt) { return stmt instanceof IfStmt && this.condition.isEquivalent(stmt.condition) && areAllEquivalent(this.trueCase, stmt.trueCase) && areAllEquivalent(this.falseCase, stmt.falseCase); } }, { key: "visitStatement", value: function visitStatement(visitor, context) { return visitor.visitIfStmt(this, context); } }]); return IfStmt; }(Statement); var CommentStmt = /*#__PURE__*/function (_Statement7) { _inherits(CommentStmt, _Statement7); var _super44 = _createSuper(CommentStmt); function CommentStmt(comment) { var _this64; var multiline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var sourceSpan = arguments.length > 2 ? arguments[2] : undefined; _classCallCheck(this, CommentStmt); _this64 = _super44.call(this, null, sourceSpan); _this64.comment = comment; _this64.multiline = multiline; return _this64; } _createClass2(CommentStmt, [{ key: "isEquivalent", value: function isEquivalent(stmt) { return stmt instanceof CommentStmt; } }, { key: "visitStatement", value: function visitStatement(visitor, context) { return visitor.visitCommentStmt(this, context); } }]); return CommentStmt; }(Statement); var JSDocCommentStmt = /*#__PURE__*/function (_Statement8) { _inherits(JSDocCommentStmt, _Statement8); var _super45 = _createSuper(JSDocCommentStmt); function JSDocCommentStmt() { var _this65; var tags = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var sourceSpan = arguments.length > 1 ? arguments[1] : undefined; _classCallCheck(this, JSDocCommentStmt); _this65 = _super45.call(this, null, sourceSpan); _this65.tags = tags; return _this65; } _createClass2(JSDocCommentStmt, [{ key: "isEquivalent", value: function isEquivalent(stmt) { return stmt instanceof JSDocCommentStmt && this.toString() === stmt.toString(); } }, { key: "visitStatement", value: function visitStatement(visitor, context) { return visitor.visitJSDocCommentStmt(this, context); } }, { key: "toString", value: function toString() { return serializeTags(this.tags); } }]); return JSDocCommentStmt; }(Statement); var TryCatchStmt = /*#__PURE__*/function (_Statement9) { _inherits(TryCatchStmt, _Statement9); var _super46 = _createSuper(TryCatchStmt); function TryCatchStmt(bodyStmts, catchStmts, sourceSpan) { var _this66; _classCallCheck(this, TryCatchStmt); _this66 = _super46.call(this, null, sourceSpan); _this66.bodyStmts = bodyStmts; _this66.catchStmts = catchStmts; return _this66; } _createClass2(TryCatchStmt, [{ key: "isEquivalent", value: function isEquivalent(stmt) { return stmt instanceof TryCatchStmt && areAllEquivalent(this.bodyStmts, stmt.bodyStmts) && areAllEquivalent(this.catchStmts, stmt.catchStmts); } }, { key: "visitStatement", value: function visitStatement(visitor, context) { return visitor.visitTryCatchStmt(this, context); } }]); return TryCatchStmt; }(Statement); var ThrowStmt = /*#__PURE__*/function (_Statement10) { _inherits(ThrowStmt, _Statement10); var _super47 = _createSuper(ThrowStmt); function ThrowStmt(error, sourceSpan) { var _this67; _classCallCheck(this, ThrowStmt); _this67 = _super47.call(this, null, sourceSpan); _this67.error = error; return _this67; } _createClass2(ThrowStmt, [{ key: "isEquivalent", value: function isEquivalent(stmt) { return stmt instanceof TryCatchStmt && this.error.isEquivalent(stmt.error); } }, { key: "visitStatement", value: function visitStatement(visitor, context) { return visitor.visitThrowStmt(this, context); } }]); return ThrowStmt; }(Statement); var AstTransformer = /*#__PURE__*/function () { function AstTransformer() { _classCallCheck(this, AstTransformer); } _createClass2(AstTransformer, [{ key: "transformExpr", value: function transformExpr(expr, context) { return expr; } }, { key: "transformStmt", value: function transformStmt(stmt, context) { return stmt; } }, { key: "visitReadVarExpr", value: function visitReadVarExpr(ast, context) { return this.transformExpr(ast, context); } }, { key: "visitWrappedNodeExpr", value: function visitWrappedNodeExpr(ast, context) { return this.transformExpr(ast, context); } }, { key: "visitTypeofExpr", value: function visitTypeofExpr(expr, context) { return this.transformExpr(new TypeofExpr(expr.expr.visitExpression(this, context), expr.type, expr.sourceSpan), context); } }, { key: "visitWriteVarExpr", value: function visitWriteVarExpr(expr, context) { return this.transformExpr(new WriteVarExpr(expr.name, expr.value.visitExpression(this, context), expr.type, expr.sourceSpan), context); } }, { key: "visitWriteKeyExpr", value: function visitWriteKeyExpr(expr, context) { return this.transformExpr(new WriteKeyExpr(expr.receiver.visitExpression(this, context), expr.index.visitExpression(this, context), expr.value.visitExpression(this, context), expr.type, expr.sourceSpan), context); } }, { key: "visitWritePropExpr", value: function visitWritePropExpr(expr, context) { return this.transformExpr(new WritePropExpr(expr.receiver.visitExpression(this, context), expr.name, expr.value.visitExpression(this, context), expr.type, expr.sourceSpan), context); } }, { key: "visitInvokeMethodExpr", value: function visitInvokeMethodExpr(ast, context) { var method = ast.builtin || ast.name; return this.transformExpr(new InvokeMethodExpr(ast.receiver.visitExpression(this, context), method, this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context); } }, { key: "visitInvokeFunctionExpr", value: function visitInvokeFunctionExpr(ast, context) { return this.transformExpr(new InvokeFunctionExpr(ast.fn.visitExpression(this, context), this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context); } }, { key: "visitInstantiateExpr", value: function visitInstantiateExpr(ast, context) { return this.transformExpr(new InstantiateExpr(ast.classExpr.visitExpression(this, context), this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context); } }, { key: "visitLiteralExpr", value: function visitLiteralExpr(ast, context) { return this.transformExpr(ast, context); } }, { key: "visitExternalExpr", value: function visitExternalExpr(ast, context) { return this.transformExpr(ast, context); } }, { key: "visitConditionalExpr", value: function visitConditionalExpr(ast, context) { return this.transformExpr(new ConditionalExpr(ast.condition.visitExpression(this, context), ast.trueCase.visitExpression(this, context), ast.falseCase.visitExpression(this, context), ast.type, ast.sourceSpan), context); } }, { key: "visitNotExpr", value: function visitNotExpr(ast, context) { return this.transformExpr(new NotExpr(ast.condition.visitExpression(this, context), ast.sourceSpan), context); } }, { key: "visitAssertNotNullExpr", value: function visitAssertNotNullExpr(ast, context) { return this.transformExpr(new AssertNotNull(ast.condition.visitExpression(this, context), ast.sourceSpan), context); } }, { key: "visitCastExpr", value: function visitCastExpr(ast, context) { return this.transformExpr(new CastExpr(ast.value.visitExpression(this, context), ast.type, ast.sourceSpan), context); } }, { key: "visitFunctionExpr", value: function visitFunctionExpr(ast, context) { return this.transformExpr(new FunctionExpr(ast.params, this.visitAllStatements(ast.statements, context), ast.type, ast.sourceSpan), context); } }, { key: "visitBinaryOperatorExpr", value: function visitBinaryOperatorExpr(ast, context) { return this.transformExpr(new BinaryOperatorExpr(ast.operator, ast.lhs.visitExpression(this, context), ast.rhs.visitExpression(this, context), ast.type, ast.sourceSpan), context); } }, { key: "visitReadPropExpr", value: function visitReadPropExpr(ast, context) { return this.transformExpr(new ReadPropExpr(ast.receiver.visitExpression(this, context), ast.name, ast.type, ast.sourceSpan), context); } }, { key: "visitReadKeyExpr", value: function visitReadKeyExpr(ast, context) { return this.transformExpr(new ReadKeyExpr(ast.receiver.visitExpression(this, context), ast.index.visitExpression(this, context), ast.type, ast.sourceSpan), context); } }, { key: "visitLiteralArrayExpr", value: function visitLiteralArrayExpr(ast, context) { return this.transformExpr(new LiteralArrayExpr(this.visitAllExpressions(ast.entries, context), ast.type, ast.sourceSpan), context); } }, { key: "visitLiteralMapExpr", value: function visitLiteralMapExpr(ast, context) { var _this68 = this; var entries = ast.entries.map(function (entry) { return new LiteralMapEntry(entry.key, entry.value.visitExpression(_this68, context), entry.quoted); }); var mapType = new MapType(ast.valueType, null); return this.transformExpr(new LiteralMapExpr(entries, mapType, ast.sourceSpan), context); } }, { key: "visitCommaExpr", value: function visitCommaExpr(ast, context) { return this.transformExpr(new CommaExpr(this.visitAllExpressions(ast.parts, context), ast.sourceSpan), context); } }, { key: "visitAllExpressions", value: function visitAllExpressions(exprs, context) { var _this69 = this; return exprs.map(function (expr) { return expr.visitExpression(_this69, context); }); } }, { key: "visitDeclareVarStmt", value: function visitDeclareVarStmt(stmt, context) { var value = stmt.value && stmt.value.visitExpression(this, context); return this.transformStmt(new DeclareVarStmt(stmt.name, value, stmt.type, stmt.modifiers, stmt.sourceSpan), context); } }, { key: "visitDeclareFunctionStmt", value: function visitDeclareFunctionStmt(stmt, context) { return this.transformStmt(new DeclareFunctionStmt(stmt.name, stmt.params, this.visitAllStatements(stmt.statements, context), stmt.type, stmt.modifiers, stmt.sourceSpan), context); } }, { key: "visitExpressionStmt", value: function visitExpressionStmt(stmt, context) { return this.transformStmt(new ExpressionStatement(stmt.expr.visitExpression(this, context), stmt.sourceSpan), context); } }, { key: "visitReturnStmt", value: function visitReturnStmt(stmt, context) { return this.transformStmt(new ReturnStatement(stmt.value.visitExpression(this, context), stmt.sourceSpan), context); } }, { key: "visitDeclareClassStmt", value: function visitDeclareClassStmt(stmt, context) { var _this70 = this; var parent = stmt.parent.visitExpression(this, context); var getters = stmt.getters.map(function (getter) { return new ClassGetter(getter.name, _this70.visitAllStatements(getter.body, context), getter.type, getter.modifiers); }); var ctorMethod = stmt.constructorMethod && new ClassMethod(stmt.constructorMethod.name, stmt.constructorMethod.params, this.visitAllStatements(stmt.constructorMethod.body, context), stmt.constructorMethod.type, stmt.constructorMethod.modifiers); var methods = stmt.methods.map(function (method) { return new ClassMethod(method.name, method.params, _this70.visitAllStatements(method.body, context), method.type, method.modifiers); }); return this.transformStmt(new ClassStmt(stmt.name, parent, stmt.fields, getters, ctorMethod, methods, stmt.modifiers, stmt.sourceSpan), context); } }, { key: "visitIfStmt", value: function visitIfStmt(stmt, context) { return this.transformStmt(new IfStmt(stmt.condition.visitExpression(this, context), this.visitAllStatements(stmt.trueCase, context), this.visitAllStatements(stmt.falseCase, context), stmt.sourceSpan), context); } }, { key: "visitTryCatchStmt", value: function visitTryCatchStmt(stmt, context) { return this.transformStmt(new TryCatchStmt(this.visitAllStatements(stmt.bodyStmts, context), this.visitAllStatements(stmt.catchStmts, context), stmt.sourceSpan), context); } }, { key: "visitThrowStmt", value: function visitThrowStmt(stmt, context) { return this.transformStmt(new ThrowStmt(stmt.error.visitExpression(this, context), stmt.sourceSpan), context); } }, { key: "visitCommentStmt", value: function visitCommentStmt(stmt, context) { return this.transformStmt(stmt, context); } }, { key: "visitJSDocCommentStmt", value: function visitJSDocCommentStmt(stmt, context) { return this.transformStmt(stmt, context); } }, { key: "visitAllStatements", value: function visitAllStatements(stmts, context) { var _this71 = this; return stmts.map(function (stmt) { return stmt.visitStatement(_this71, context); }); } }]); return AstTransformer; }(); var RecursiveAstVisitor = /*#__PURE__*/function () { function RecursiveAstVisitor() { _classCallCheck(this, RecursiveAstVisitor); } _createClass2(RecursiveAstVisitor, [{ key: "visitType", value: function visitType(ast, context) { return ast; } }, { key: "visitExpression", value: function visitExpression(ast, context) { if (ast.type) { ast.type.visitType(this, context); } return ast; } }, { key: "visitBuiltinType", value: function visitBuiltinType(type, context) { return this.visitType(type, context); } }, { key: "visitExpressionType", value: function visitExpressionType(type, context) { var _this72 = this; type.value.visitExpression(this, context); if (type.typeParams !== null) { type.typeParams.forEach(function (param) { return _this72.visitType(param, context); }); } return this.visitType(type, context); } }, { key: "visitArrayType", value: function visitArrayType(type, context) { return this.visitType(type, context); } }, { key: "visitMapType", value: function visitMapType(type, context) { return this.visitType(type, context); } }, { key: "visitWrappedNodeExpr", value: function visitWrappedNodeExpr(ast, context) { return ast; } }, { key: "visitTypeofExpr", value: function visitTypeofExpr(ast, context) { return this.visitExpression(ast, context); } }, { key: "visitReadVarExpr", value: function visitReadVarExpr(ast, context) { return this.visitExpression(ast, context); } }, { key: "visitWriteVarExpr", value: function visitWriteVarExpr(ast, context) { ast.value.visitExpression(this, context); return this.visitExpression(ast, context); } }, { key: "visitWriteKeyExpr", value: function visitWriteKeyExpr(ast, context) { ast.receiver.visitExpression(this, context); ast.index.visitExpression(this, context); ast.value.visitExpression(this, context); return this.visitExpression(ast, context); } }, { key: "visitWritePropExpr", value: function visitWritePropExpr(ast, context) { ast.receiver.visitExpression(this, context); ast.value.visitExpression(this, context); return this.visitExpression(ast, context); } }, { key: "visitInvokeMethodExpr", value: function visitInvokeMethodExpr(ast, context) { ast.receiver.visitExpression(this, context); this.visitAllExpressions(ast.args, context); return this.visitExpression(ast, context); } }, { key: "visitInvokeFunctionExpr", value: function visitInvokeFunctionExpr(ast, context) { ast.fn.visitExpression(this, context); this.visitAllExpressions(ast.args, context); return this.visitExpression(ast, context); } }, { key: "visitInstantiateExpr", value: function visitInstantiateExpr(ast, context) { ast.classExpr.visitExpression(this, context); this.visitAllExpressions(ast.args, context); return this.visitExpression(ast, context); } }, { key: "visitLiteralExpr", value: function visitLiteralExpr(ast, context) { return this.visitExpression(ast, context); } }, { key: "visitExternalExpr", value: function visitExternalExpr(ast, context) { var _this73 = this; if (ast.typeParams) { ast.typeParams.forEach(function (type) { return type.visitType(_this73, context); }); } return this.visitExpression(ast, context); } }, { key: "visitConditionalExpr", value: function visitConditionalExpr(ast, context) { ast.condition.visitExpression(this, context); ast.trueCase.visitExpression(this, context); ast.falseCase.visitExpression(this, context); return this.visitExpression(ast, context); } }, { key: "visitNotExpr", value: function visitNotExpr(ast, context) { ast.condition.visitExpression(this, context); return this.visitExpression(ast, context); } }, { key: "visitAssertNotNullExpr", value: function visitAssertNotNullExpr(ast, context) { ast.condition.visitExpression(this, context); return this.visitExpression(ast, context); } }, { key: "visitCastExpr", value: function visitCastExpr(ast, context) { ast.value.visitExpression(this, context); return this.visitExpression(ast, context); } }, { key: "visitFunctionExpr", value: function visitFunctionExpr(ast, context) { this.visitAllStatements(ast.statements, context); return this.visitExpression(ast, context); } }, { key: "visitBinaryOperatorExpr", value: function visitBinaryOperatorExpr(ast, context) { ast.lhs.visitExpression(this, context); ast.rhs.visitExpression(this, context); return this.visitExpression(ast, context); } }, { key: "visitReadPropExpr", value: function visitReadPropExpr(ast, context) { ast.receiver.visitExpression(this, context); return this.visitExpression(ast, context); } }, { key: "visitReadKeyExpr", value: function visitReadKeyExpr(ast, context) { ast.receiver.visitExpression(this, context); ast.index.visitExpression(this, context); return this.visitExpression(ast, context); } }, { key: "visitLiteralArrayExpr", value: function visitLiteralArrayExpr(ast, context) { this.visitAllExpressions(ast.entries, context); return this.visitExpression(ast, context); } }, { key: "visitLiteralMapExpr", value: function visitLiteralMapExpr(ast, context) { var _this74 = this; ast.entries.forEach(function (entry) { return entry.value.visitExpression(_this74, context); }); return this.visitExpression(ast, context); } }, { key: "visitCommaExpr", value: function visitCommaExpr(ast, context) { this.visitAllExpressions(ast.parts, context); return this.visitExpression(ast, context); } }, { key: "visitAllExpressions", value: function visitAllExpressions(exprs, context) { var _this75 = this; exprs.forEach(function (expr) { return expr.visitExpression(_this75, context); }); } }, { key: "visitDeclareVarStmt", value: function visitDeclareVarStmt(stmt, context) { if (stmt.value) { stmt.value.visitExpression(this, context); } if (stmt.type) { stmt.type.visitType(this, context); } return stmt; } }, { key: "visitDeclareFunctionStmt", value: function visitDeclareFunctionStmt(stmt, context) { this.visitAllStatements(stmt.statements, context); if (stmt.type) { stmt.type.visitType(this, context); } return stmt; } }, { key: "visitExpressionStmt", value: function visitExpressionStmt(stmt, context) { stmt.expr.visitExpression(this, context); return stmt; } }, { key: "visitReturnStmt", value: function visitReturnStmt(stmt, context) { stmt.value.visitExpression(this, context); return stmt; } }, { key: "visitDeclareClassStmt", value: function visitDeclareClassStmt(stmt, context) { var _this76 = this; stmt.parent.visitExpression(this, context); stmt.getters.forEach(function (getter) { return _this76.visitAllStatements(getter.body, context); }); if (stmt.constructorMethod) { this.visitAllStatements(stmt.constructorMethod.body, context); } stmt.methods.forEach(function (method) { return _this76.visitAllStatements(method.body, context); }); return stmt; } }, { key: "visitIfStmt", value: function visitIfStmt(stmt, context) { stmt.condition.visitExpression(this, context); this.visitAllStatements(stmt.trueCase, context); this.visitAllStatements(stmt.falseCase, context); return stmt; } }, { key: "visitTryCatchStmt", value: function visitTryCatchStmt(stmt, context) { this.visitAllStatements(stmt.bodyStmts, context); this.visitAllStatements(stmt.catchStmts, context); return stmt; } }, { key: "visitThrowStmt", value: function visitThrowStmt(stmt, context) { stmt.error.visitExpression(this, context); return stmt; } }, { key: "visitCommentStmt", value: function visitCommentStmt(stmt, context) { return stmt; } }, { key: "visitJSDocCommentStmt", value: function visitJSDocCommentStmt(stmt, context) { return stmt; } }, { key: "visitAllStatements", value: function visitAllStatements(stmts, context) { var _this77 = this; stmts.forEach(function (stmt) { return stmt.visitStatement(_this77, context); }); } }]); return RecursiveAstVisitor; }(); function findReadVarNames(stmts) { var visitor = new _ReadVarVisitor(); visitor.visitAllStatements(stmts, null); return visitor.varNames; } var _ReadVarVisitor = /*#__PURE__*/function (_RecursiveAstVisitor) { _inherits(_ReadVarVisitor, _RecursiveAstVisitor); var _super48 = _createSuper(_ReadVarVisitor); function _ReadVarVisitor() { var _this78; _classCallCheck(this, _ReadVarVisitor); _this78 = _super48.apply(this, arguments); _this78.varNames = new Set(); return _this78; } _createClass2(_ReadVarVisitor, [{ key: "visitDeclareFunctionStmt", value: function visitDeclareFunctionStmt(stmt, context) { // Don't descend into nested functions return stmt; } }, { key: "visitDeclareClassStmt", value: function visitDeclareClassStmt(stmt, context) { // Don't descend into nested classes return stmt; } }, { key: "visitReadVarExpr", value: function visitReadVarExpr(ast, context) { if (ast.name) { this.varNames.add(ast.name); } return null; } }]); return _ReadVarVisitor; }(RecursiveAstVisitor); function collectExternalReferences(stmts) { var visitor = new _FindExternalReferencesVisitor(); visitor.visitAllStatements(stmts, null); return visitor.externalReferences; } var _FindExternalReferencesVisitor = /*#__PURE__*/function (_RecursiveAstVisitor2) { _inherits(_FindExternalReferencesVisitor, _RecursiveAstVisitor2); var _super49 = _createSuper(_FindExternalReferencesVisitor); function _FindExternalReferencesVisitor() { var _this79; _classCallCheck(this, _FindExternalReferencesVisitor); _this79 = _super49.apply(this, arguments); _this79.externalReferences = []; return _this79; } _createClass2(_FindExternalReferencesVisitor, [{ key: "visitExternalExpr", value: function visitExternalExpr(e, context) { this.externalReferences.push(e.value); return _get(_getPrototypeOf(_FindExternalReferencesVisitor.prototype), "visitExternalExpr", this).call(this, e, context); } }]); return _FindExternalReferencesVisitor; }(RecursiveAstVisitor); function applySourceSpanToStatementIfNeeded(stmt, sourceSpan) { if (!sourceSpan) { return stmt; } var transformer = new _ApplySourceSpanTransformer(sourceSpan); return stmt.visitStatement(transformer, null); } function applySourceSpanToExpressionIfNeeded(expr, sourceSpan) { if (!sourceSpan) { return expr; } var transformer = new _ApplySourceSpanTransformer(sourceSpan); return expr.visitExpression(transformer, null); } var _ApplySourceSpanTransformer = /*#__PURE__*/function (_AstTransformer) { _inherits(_ApplySourceSpanTransformer, _AstTransformer); var _super50 = _createSuper(_ApplySourceSpanTransformer); function _ApplySourceSpanTransformer(sourceSpan) { var _this80; _classCallCheck(this, _ApplySourceSpanTransformer); _this80 = _super50.call(this); _this80.sourceSpan = sourceSpan; return _this80; } _createClass2(_ApplySourceSpanTransformer, [{ key: "_clone", value: function _clone(obj) { var clone = Object.create(obj.constructor.prototype); for (var _i8 = 0, _Object$keys2 = Object.keys(obj); _i8 < _Object$keys2.length; _i8++) { var prop = _Object$keys2[_i8]; clone[prop] = obj[prop]; } return clone; } }, { key: "transformExpr", value: function transformExpr(expr, context) { if (!expr.sourceSpan) { expr = this._clone(expr); expr.sourceSpan = this.sourceSpan; } return expr; } }, { key: "transformStmt", value: function transformStmt(stmt, context) { if (!stmt.sourceSpan) { stmt = this._clone(stmt); stmt.sourceSpan = this.sourceSpan; } return stmt; } }]); return _ApplySourceSpanTransformer; }(AstTransformer); function variable(name, type, sourceSpan) { return new ReadVarExpr(name, type, sourceSpan); } function importExpr(id) { var typeParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var sourceSpan = arguments.length > 2 ? arguments[2] : undefined; return new ExternalExpr(id, null, typeParams, sourceSpan); } function importType(id) { var typeParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var typeModifiers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; return id != null ? expressionType(importExpr(id, typeParams, null), typeModifiers) : null; } function expressionType(expr) { var typeModifiers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var typeParams = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; return new ExpressionType(expr, typeModifiers, typeParams); } function typeofExpr(expr) { return new TypeofExpr(expr); } function literalArr(values, type, sourceSpan) { return new LiteralArrayExpr(values, type, sourceSpan); } function literalMap(values) { var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return new LiteralMapExpr(values.map(function (e) { return new LiteralMapEntry(e.key, e.value, e.quoted); }), type, null); } function not(expr, sourceSpan) { return new NotExpr(expr, sourceSpan); } function assertNotNull(expr, sourceSpan) { return new AssertNotNull(expr, sourceSpan); } function fn(params, body, type, sourceSpan, name) { return new FunctionExpr(params, body, type, sourceSpan, name); } function ifStmt(condition, thenClause, elseClause) { return new IfStmt(condition, thenClause, elseClause); } function literal(value, type, sourceSpan) { return new LiteralExpr(value, type, sourceSpan); } function isNull(exp) { return exp instanceof LiteralExpr && exp.value === null; } /* * Serializes a `Tag` into a string. * Returns a string like " @foo {bar} baz" (note the leading whitespace before `@foo`). */ function tagToString(tag) { var out = ''; if (tag.tagName) { out += " @".concat(tag.tagName); } if (tag.text) { if (tag.text.match(/\/\*|\*\//)) { throw new Error('JSDoc text cannot contain "/*" and "*/"'); } out += ' ' + tag.text.replace(/@/g, '\\@'); } return out; } function serializeTags(tags) { if (tags.length === 0) return ''; var out = '*\n'; var _iterator3 = _createForOfIteratorHelper(tags), _step3; try { for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { var tag = _step3.value; out += ' *'; // If the tagToString is multi-line, insert " * " prefixes on subsequent lines. out += tagToString(tag).replace(/\n/g, '\n * '); out += '\n'; } } catch (err) { _iterator3.e(err); } finally { _iterator3.f(); } out += ' '; return out; } /** * @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 DASH_CASE_REGEXP = /-+([a-z0-9])/g; function dashCaseToCamelCase(input) { return input.replace(DASH_CASE_REGEXP, function () { for (var _len = arguments.length, m = new Array(_len), _key = 0; _key < _len; _key++) { m[_key] = arguments[_key]; } return m[1].toUpperCase(); }); } function splitAtColon(input, defaultValues) { return _splitAt(input, ':', defaultValues); } function splitAtPeriod(input, defaultValues) { return _splitAt(input, '.', defaultValues); } function _splitAt(input, character, defaultValues) { var characterIndex = input.indexOf(character); if (characterIndex == -1) return defaultValues; return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()]; } function visitValue(value, visitor, context) { if (Array.isArray(value)) { return visitor.visitArray(value, context); } if (isStrictStringMap(value)) { return visitor.visitStringMap(value, context); } if (value == null || typeof value == 'string' || typeof value == 'number' || typeof value == 'boolean') { return visitor.visitPrimitive(value, context); } return visitor.visitOther(value, context); } function isDefined(val) { return val !== null && val !== undefined; } function noUndefined(val) { return val === undefined ? null : val; } var ValueTransformer = /*#__PURE__*/function () { function ValueTransformer() { _classCallCheck(this, ValueTransformer); } _createClass2(ValueTransformer, [{ key: "visitArray", value: function visitArray(arr, context) { var _this81 = this; return arr.map(function (value) { return visitValue(value, _this81, context); }); } }, { key: "visitStringMap", value: function visitStringMap(map, context) { var _this82 = this; var result = {}; Object.keys(map).forEach(function (key) { result[key] = visitValue(map[key], _this82, context); }); return result; } }, { key: "visitPrimitive", value: function visitPrimitive(value, context) { return value; } }, { key: "visitOther", value: function visitOther(value, context) { return value; } }]); return ValueTransformer; }(); var SyncAsync = { assertSync: function assertSync(value) { if (isPromise(value)) { throw new Error("Illegal state: value cannot be a promise"); } return value; }, then: function then(value, cb) { return isPromise(value) ? value.then(cb) : cb(value); }, all: function all(syncAsyncValues) { return syncAsyncValues.some(isPromise) ? Promise.all(syncAsyncValues) : syncAsyncValues; } }; function error(msg) { throw new Error("Internal Error: ".concat(msg)); } function syntaxError(msg, parseErrors) { var error = Error(msg); error[ERROR_SYNTAX_ERROR] = true; if (parseErrors) error[ERROR_PARSE_ERRORS] = parseErrors; return error; } var ERROR_SYNTAX_ERROR = 'ngSyntaxError'; var ERROR_PARSE_ERRORS = 'ngParseErrors'; function isSyntaxError(error) { return error[ERROR_SYNTAX_ERROR]; } function getParseErrors(error) { return error[ERROR_PARSE_ERRORS] || []; } // Escape characters that have a special meaning in Regular Expressions function escapeRegExp(s) { return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); } var STRING_MAP_PROTO = Object.getPrototypeOf({}); function isStrictStringMap(obj) { return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO; } function utf8Encode(str) { var encoded = ''; for (var index = 0; index < str.length; index++) { var 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 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; } function stringify(token) { if (typeof token === 'string') { return token; } if (token instanceof Array) { return '[' + token.map(stringify).join(', ') + ']'; } if (token == null) { return '' + token; } if (token.overriddenName) { return "".concat(token.overriddenName); } if (token.name) { return "".concat(token.name); } if (!token.toString) { return 'object'; } // WARNING: do not try to `JSON.stringify(token)` here // see https://github.com/angular/angular/issues/23440 var res = token.toString(); if (res == null) { return '' + res; } var newLineIndex = res.indexOf('\n'); return newLineIndex === -1 ? res : res.substring(0, newLineIndex); } /** * Lazily retrieves the reference value from a forwardRef. */ function resolveForwardRef(type) { if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__')) { return type(); } else { return type; } } /** * Determine if the argument is shaped like a Promise */ function isPromise(obj) { // allow any Promise/A+ compliant thenable. // It's up to the caller to ensure that obj.then conforms to the spec return !!obj && typeof obj.then === 'function'; } var Version = function Version(full) { _classCallCheck(this, Version); this.full = full; var splits = full.split('.'); this.major = splits[0]; this.minor = splits[1]; this.patch = splits.slice(2).join('.'); }; var __window = typeof window !== 'undefined' && window; var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope && self; var __global = typeof global !== 'undefined' && global; // Check __global first, because in Node tests both __global and __window may be defined and _global // should be __global in that case. var _global = __global || __window || __self; /** * @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 CONSTANT_PREFIX = '_c'; /** * Context to use when producing a key. * * This ensures we see the constant not the reference variable when producing * a key. */ var KEY_CONTEXT = {}; /** * A node that is a place-holder that allows the node to be replaced when the actual * node is known. * * This allows the constant pool to change an expression from a direct reference to * a constant to a shared constant. It returns a fix-up node that is later allowed to * change the referenced expression. */ var FixupExpression = /*#__PURE__*/function (_Expression23) { _inherits(FixupExpression, _Expression23); var _super51 = _createSuper(FixupExpression); function FixupExpression(resolved) { var _this83; _classCallCheck(this, FixupExpression); _this83 = _super51.call(this, resolved.type); _this83.resolved = resolved; _this83.original = resolved; return _this83; } _createClass2(FixupExpression, [{ key: "visitExpression", value: function visitExpression(visitor, context) { if (context === KEY_CONTEXT) { // When producing a key we want to traverse the constant not the // variable used to refer to it. return this.original.visitExpression(visitor, context); } else { return this.resolved.visitExpression(visitor, context); } } }, { key: "isEquivalent", value: function isEquivalent(e) { return e instanceof FixupExpression && this.resolved.isEquivalent(e.resolved); } }, { key: "isConstant", value: function isConstant() { return true; } }, { key: "fixup", value: function fixup(expression) { this.resolved = expression; this.shared = true; } }]); return FixupExpression; }(Expression); /** * A constant pool allows a code emitter to share constant in an output context. * * The constant pool also supports sharing access to ivy definitions references. */ var ConstantPool = /*#__PURE__*/function () { function ConstantPool() { _classCallCheck(this, ConstantPool); this.statements = []; this.literals = new Map(); this.literalFactories = new Map(); this.injectorDefinitions = new Map(); this.directiveDefinitions = new Map(); this.componentDefinitions = new Map(); this.pipeDefinitions = new Map(); this.nextNameIndex = 0; } _createClass2(ConstantPool, [{ key: "getConstLiteral", value: function getConstLiteral(literal, forceShared) { if (literal instanceof LiteralExpr || literal instanceof FixupExpression) { // Do no put simple literals into the constant pool or try to produce a constant for a // reference to a constant. return literal; } var key = this.keyOf(literal); var fixup = this.literals.get(key); var newValue = false; if (!fixup) { fixup = new FixupExpression(literal); this.literals.set(key, fixup); newValue = true; } if (!newValue && !fixup.shared || newValue && forceShared) { // Replace the expression with a variable var name = this.freshName(); this.statements.push(variable(name).set(literal).toDeclStmt(INFERRED_TYPE, [StmtModifier.Final])); fixup.fixup(variable(name)); } return fixup; } }, { key: "getDefinition", value: function getDefinition(type, kind, ctx) { var forceShared = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; var definitions = this.definitionsOf(kind); var fixup = definitions.get(type); var newValue = false; if (!fixup) { var property = this.propertyNameOf(kind); fixup = new FixupExpression(ctx.importExpr(type).prop(property)); definitions.set(type, fixup); newValue = true; } if (!newValue && !fixup.shared || newValue && forceShared) { var name = this.freshName(); this.statements.push(variable(name).set(fixup.resolved).toDeclStmt(INFERRED_TYPE, [StmtModifier.Final])); fixup.fixup(variable(name)); } return fixup; } }, { key: "getLiteralFactory", value: function getLiteralFactory(literal$1) { // Create a pure function that builds an array of a mix of constant and variable expressions if (literal$1 instanceof LiteralArrayExpr) { var argumentsForKey = literal$1.entries.map(function (e) { return e.isConstant() ? e : literal(null); }); var key = this.keyOf(literalArr(argumentsForKey)); return this._getLiteralFactory(key, literal$1.entries, function (entries) { return literalArr(entries); }); } else { var expressionForKey = literalMap(literal$1.entries.map(function (e) { return { key: e.key, value: e.value.isConstant() ? e.value : literal(null), quoted: e.quoted }; })); var _key2 = this.keyOf(expressionForKey); return this._getLiteralFactory(_key2, literal$1.entries.map(function (e) { return e.value; }), function (entries) { return literalMap(entries.map(function (value, index) { return { key: literal$1.entries[index].key, value: value, quoted: literal$1.entries[index].quoted }; })); }); } } }, { key: "_getLiteralFactory", value: function _getLiteralFactory(key, values, resultMap) { var _this84 = this; var literalFactory = this.literalFactories.get(key); var literalFactoryArguments = values.filter(function (e) { return !e.isConstant(); }); if (!literalFactory) { var resultExpressions = values.map(function (e, index) { return e.isConstant() ? _this84.getConstLiteral(e, true) : variable("a".concat(index)); }); var parameters = resultExpressions.filter(isVariable).map(function (e) { return new FnParam(e.name, DYNAMIC_TYPE); }); var pureFunctionDeclaration = fn(parameters, [new ReturnStatement(resultMap(resultExpressions))], INFERRED_TYPE); var name = this.freshName(); this.statements.push(variable(name).set(pureFunctionDeclaration).toDeclStmt(INFERRED_TYPE, [StmtModifier.Final])); literalFactory = variable(name); this.literalFactories.set(key, literalFactory); } return { literalFactory: literalFactory, literalFactoryArguments: literalFactoryArguments }; } /** * Produce a unique name. * * The name might be unique among different prefixes if any of the prefixes end in * a digit so the prefix should be a constant string (not based on user input) and * must not end in a digit. */ }, { key: "uniqueName", value: function uniqueName(prefix) { return "".concat(prefix).concat(this.nextNameIndex++); } }, { key: "definitionsOf", value: function definitionsOf(kind) { switch (kind) { case 2 /* Component */ : return this.componentDefinitions; case 1 /* Directive */ : return this.directiveDefinitions; case 0 /* Injector */ : return this.injectorDefinitions; case 3 /* Pipe */ : return this.pipeDefinitions; } error("Unknown definition kind ".concat(kind)); return this.componentDefinitions; } }, { key: "propertyNameOf", value: function propertyNameOf(kind) { switch (kind) { case 2 /* Component */ : return 'ngComponentDef'; case 1 /* Directive */ : return 'ngDirectiveDef'; case 0 /* Injector */ : return 'ngInjectorDef'; case 3 /* Pipe */ : return 'ngPipeDef'; } error("Unknown definition kind ".concat(kind)); return '<unknown>'; } }, { key: "freshName", value: function freshName() { return this.uniqueName(CONSTANT_PREFIX); } }, { key: "keyOf", value: function keyOf(expression) { return expression.visitExpression(new KeyVisitor(), KEY_CONTEXT); } }]); return ConstantPool; }(); /** * Visitor used to determine if 2 expressions are equivalent and can be shared in the * `ConstantPool`. * * When the id (string) generated by the visitor is equal, expressions are considered equivalent. */ var KeyVisitor = /*#__PURE__*/function () { function KeyVisitor() { _classCallCheck(this, KeyVisitor); this.visitWrappedNodeExpr = invalid; this.visitWriteVarExpr = invalid; this.visitWriteKeyExpr = invalid; this.visitWritePropExpr = invalid; this.visitInvokeMethodExpr = invalid; this.visitInvokeFunctionExpr = invalid; this.visitInstantiateExpr = invalid; this.visitConditionalExpr = invalid; this.visitNotExpr = invalid; this.visitAssertNotNullExpr = invalid; this.visitCastExpr = invalid; this.visitFunctionExpr = invalid; this.visitBinaryOperatorExpr = invalid; this.visitReadPropExpr = invalid; this.visitReadKeyExpr = invalid; this.visitCommaExpr = invalid; } _createClass2(KeyVisitor, [{ key: "visitLiteralExpr", value: function visitLiteralExpr(ast) { return "".concat(typeof ast.value === 'string' ? '"' + ast.value + '"' : ast.value); } }, { key: "visitLiteralArrayExpr", value: function visitLiteralArrayExpr(ast, context) { var _this85 = this; return "[".concat(ast.entries.map(function (entry) { return entry.visitExpression(_this85, context); }).join(','), "]"); } }, { key: "visitLiteralMapExpr", value: function visitLiteralMapExpr(ast, context) { var _this86 = this; var mapKey = function mapKey(entry) { var quote = entry.quoted ? '"' : ''; return "".concat(quote).concat(entry.key).concat(quote); }; var mapEntry = function mapEntry(entry) { return "".concat(mapKey(entry), ":").concat(entry.value.visitExpression(_this86, context)); }; return "{".concat(ast.entries.map(mapEntry).join(',')); } }, { key: "visitExternalExpr", value: function visitExternalExpr(ast) { return ast.value.moduleName ? "EX:".concat(ast.value.moduleName, ":").concat(ast.value.name) : "EX:".concat(ast.value.runtime.name); } }, { key: "visitReadVarExpr", value: function visitReadVarExpr(node) { return "VAR:".concat(node.name); } }, { key: "visitTypeofExpr", value: function visitTypeofExpr(node, context) { return "TYPEOF:".concat(node.expr.visitExpression(this, context)); } }]); return KeyVisitor; }(); function invalid(arg) { throw new Error("Invalid state: Visitor ".concat(this.constructor.name, " doesn't handle ").concat(arg.constructor.name)); } function isVariable(e) { return e instanceof ReadVarExpr; } /** * @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 = '@angular/core'; var Identifiers = function Identifiers() { _classCallCheck(this, Identifiers); }; Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS = { name: 'ANALYZE_FOR_ENTRY_COMPONENTS', moduleName: CORE }; Identifiers.ElementRef = { name: 'ElementRef', moduleName: CORE }; Identifiers.NgModuleRef = { name: 'NgModuleRef', moduleName: CORE }; Identifiers.ViewContainerRef = { name: 'ViewContainerRef', moduleName: CORE }; Identifiers.ChangeDetectorRef = { name: 'ChangeDetectorRef', moduleName: CORE }; Identifiers.QueryList = { name: 'QueryList', moduleName: CORE }; Identifiers.TemplateRef = { name: 'TemplateRef', moduleName: CORE }; Identifiers.Renderer2 = { name: 'Renderer2', moduleName: CORE }; Identifiers.CodegenComponentFactoryResolver = { name: 'ɵCodegenComponentFactoryResolver', moduleName: CORE }; Identifiers.ComponentFactoryResolver = { name: 'ComponentFactoryResolver', moduleName: CORE }; Identifiers.ComponentFactory = { name: 'ComponentFactory', moduleName: CORE }; Identifiers.ComponentRef = { name: 'ComponentRef', moduleName: CORE }; Identifiers.NgModuleFactory = { name: 'NgModuleFactory', moduleName: CORE }; Identifiers.createModuleFactory = { name: 'ɵcmf', moduleName: CORE }; Identifiers.moduleDef = { name: 'ɵmod', moduleName: CORE }; Identifiers.moduleProviderDef = { name: 'ɵmpd', moduleName: CORE }; Identifiers.RegisterModuleFactoryFn = { name: 'ɵregisterModuleFactory', moduleName: CORE }; Identifiers.inject = { name: 'ɵɵinject', moduleName: CORE }; Identifiers.INJECTOR = { name: 'INJECTOR', moduleName: CORE }; Identifiers.Injector = { name: 'Injector', moduleName: CORE }; Identifiers.ɵɵdefineInjectable = { name: 'ɵɵdefineInjectable', moduleName: CORE }; Identifiers.InjectableDef = { name: 'ɵɵInjectableDef', moduleName: CORE }; Identifiers.ViewEncapsulation = { name: 'ViewEncapsulation', moduleName: CORE }; Identifiers.ChangeDetectionStrategy = { name: 'ChangeDetectionStrategy', moduleName: CORE }; Identifiers.SecurityContext = { name: 'SecurityContext', moduleName: CORE }; Identifiers.LOCALE_ID = { name: 'LOCALE_ID', moduleName: CORE }; Identifiers.TRANSLATIONS_FORMAT = { name: 'TRANSLATIONS_FORMAT', moduleName: CORE }; Identifiers.inlineInterpolate = { name: 'ɵinlineInterpolate', moduleName: CORE }; Identifiers.interpolate = { name: 'ɵinterpolate', moduleName: CORE }; Identifiers.EMPTY_ARRAY = { name: 'ɵEMPTY_ARRAY', moduleName: CORE }; Identifiers.EMPTY_MAP = { name: 'ɵEMPTY_MAP', moduleName: CORE }; Identifiers.Renderer = { name: 'Renderer', moduleName: CORE }; Identifiers.viewDef = { name: 'ɵvid', moduleName: CORE }; Identifiers.elementDef = { name: 'ɵeld', moduleName: CORE }; Identifiers.anchorDef = { name: 'ɵand', moduleName: CORE }; Identifiers.textDef = { name: 'ɵted', moduleName: CORE }; Identifiers.directiveDef = { name: 'ɵdid', moduleName: CORE }; Identifiers.providerDef = { name: 'ɵprd', moduleName: CORE }; Identifiers.queryDef = { name: 'ɵqud', moduleName: CORE }; Identifiers.pureArrayDef = { name: 'ɵpad', moduleName: CORE }; Identifiers.pureObjectDef = { name: 'ɵpod', moduleName: CORE }; Identifiers.purePipeDef = { name: 'ɵppd', moduleName: CORE }; Identifiers.pipeDef = { name: 'ɵpid', moduleName: CORE }; Identifiers.nodeValue = { name: 'ɵnov', moduleName: CORE }; Identifiers.ngContentDef = { name: 'ɵncd', moduleName: CORE }; Identifiers.unwrapValue = { name: 'ɵunv', moduleName: CORE }; Identifiers.createRendererType2 = { name: 'ɵcrt', moduleName: CORE }; // type only Identifiers.RendererType2 = { name: 'RendererType2', moduleName: CORE }; // type only Identifiers.ViewDefinition = { name: 'ɵViewDefinition', moduleName: CORE }; Identifiers.createComponentFactory = { name: 'ɵccf', moduleName: CORE }; Identifiers.setClassMetadata = { name: 'ɵsetClassMetadata', moduleName: CORE }; function createTokenForReference(reference) { return { identifier: { reference: reference } }; } function createTokenForExternalReference(reflector, reference) { return createTokenForReference(reflector.resolveExternalReference(reference)); } /** * @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 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 = /*#__PURE__*/function () { function StaticSymbol(filePath, name, members) { _classCallCheck(this, StaticSymbol); this.filePath = filePath; this.name = name; this.members = members; } _createClass2(StaticSymbol, [{ key: "assertNoMembers", value: function assertNoMembers() { if (this.members.length) { throw new Error("Illegal state: symbol without members expected, but got ".concat(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 = /*#__PURE__*/function () { function StaticSymbolCache() { _classCallCheck(this, StaticSymbolCache); this.cache = new Map(); } _createClass2(StaticSymbolCache, [{ key: "get", value: function get(declarationFile, name, members) { members = members || []; var memberSuffix = members.length ? ".".concat(members.join('.')) : ''; var key = "\"".concat(declarationFile, "\".").concat(name).concat(memberSuffix); var result = this.cache.get(key); if (!result) { result = new StaticSymbol(declarationFile, name, members); this.cache.set(key, result); } return result; } }]); return StaticSymbolCache; }(); /** * @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]+)$/; function sanitizeIdentifier(name) { return name.replace(/\W/g, '_'); } var _anonymousTypeIndex = 0; function identifierName(compileIdentifier) { if (!compileIdentifier || !compileIdentifier.reference) { return null; } var ref = compileIdentifier.reference; if (ref instanceof StaticSymbol) { return ref.name; } if (ref['__anonymousType']) { return ref['__anonymousType']; } var identifier = stringify(ref); if (identifier.indexOf('(') >= 0) { // case: anonymous functions! identifier = "anonymous_".concat(_anonymousTypeIndex++); ref['__anonymousType'] = identifier; } else { identifier = sanitizeIdentifier(identifier); } return identifier; } function identifierModuleUrl(compileIdentifier) { var ref = compileIdentifier.reference; if (ref instanceof StaticSymbol) { return ref.filePath; } // Runtime type return "./".concat(stringify(ref)); } function viewClassName(compType, embeddedTemplateIndex) { return "View_".concat(identifierName({ reference: compType }), "_").concat(embeddedTemplateIndex); } function rendererTypeName(compType) { return "RenderType_".concat(identifierName({ reference: compType })); } function hostViewClassName(compType) { return "HostView_".concat(identifierName({ reference: compType })); } function componentFactoryName(compType) { return "".concat(identifierName({ reference: compType }), "NgFactory"); } var CompileSummaryKind; (function (CompileSummaryKind) { CompileSummaryKind[CompileSummaryKind["Pipe"] = 0] = "Pipe"; CompileSummaryKind[CompileSummaryKind["Directive"] = 1] = "Directive"; CompileSummaryKind[CompileSummaryKind["NgModule"] = 2] = "NgModule"; CompileSummaryKind[CompileSummaryKind["Injectable"] = 3] = "Injectable"; })(CompileSummaryKind || (CompileSummaryKind = {})); function tokenName(token) { return token.value != null ? sanitizeIdentifier(token.value) : identifierName(token.identifier); } function tokenReference(token) { if (token.identifier != null) { return token.identifier.reference; } else { return token.value; } } /** * Metadata about a stylesheet */ var CompileStylesheetMetadata = function CompileStylesheetMetadata() { var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, moduleUrl = _ref7.moduleUrl, styles = _ref7.styles, styleUrls = _ref7.styleUrls; _classCallCheck(this, CompileStylesheetMetadata); this.moduleUrl = moduleUrl || null; this.styles = _normalizeArray(styles); this.styleUrls = _normalizeArray(styleUrls); }; /** * Metadata regarding compilation of a template. */ var CompileTemplateMetadata = /*#__PURE__*/function () { function CompileTemplateMetadata(_ref8) { var encapsulation = _ref8.encapsulation, template = _ref8.template, templateUrl = _ref8.templateUrl, htmlAst = _ref8.htmlAst, styles = _ref8.styles, styleUrls = _ref8.styleUrls, externalStylesheets = _ref8.externalStylesheets, animations = _ref8.animations, ngContentSelectors = _ref8.ngContentSelectors, interpolation = _ref8.interpolation, isInline = _ref8.isInline, preserveWhitespaces = _ref8.preserveWhitespaces; _classCallCheck(this, CompileTemplateMetadata); this.encapsulation = encapsulation; this.template = template; this.templateUrl = templateUrl; this.htmlAst = htmlAst; 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; this.preserveWhitespaces = preserveWhitespaces; } _createClass2(CompileTemplateMetadata, [{ key: "toSummary", value: function toSummary() { return { ngContentSelectors: this.ngContentSelectors, encapsulation: this.encapsulation, styles: this.styles, animations: this.animations }; } }]); return CompileTemplateMetadata; }(); /** * Metadata regarding compilation of a directive. */ var CompileDirectiveMetadata = /*#__PURE__*/function () { _createClass2(CompileDirectiveMetadata, null, [{ key: "create", value: function create(_ref9) { var isHost = _ref9.isHost, type = _ref9.type, isComponent = _ref9.isComponent, selector = _ref9.selector, exportAs = _ref9.exportAs, changeDetection = _ref9.changeDetection, inputs = _ref9.inputs, outputs = _ref9.outputs, host = _ref9.host, providers = _ref9.providers, viewProviders = _ref9.viewProviders, queries = _ref9.queries, guards = _ref9.guards, viewQueries = _ref9.viewQueries, entryComponents = _ref9.entryComponents, template = _ref9.template, componentViewType = _ref9.componentViewType, rendererType = _ref9.rendererType, componentFactory = _ref9.componentFactory; var hostListeners = {}; var hostProperties = {}; var hostAttributes = {}; if (host != null) { Object.keys(host).forEach(function (key) { var value = host[key]; var 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 inputsMap = {}; if (inputs != null) { inputs.forEach(function (bindConfig) { // canonical syntax: `dirProp: elProp` // if there is no `:`, use dirProp = elProp var parts = splitAtColon(bindConfig, [bindConfig, bindConfig]); inputsMap[parts[0]] = parts[1]; }); } var outputsMap = {}; if (outputs != null) { outputs.forEach(function (bindConfig) { // canonical syntax: `dirProp: elProp` // if there is no `:`, use dirProp = elProp var 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, guards: guards, viewQueries: viewQueries, entryComponents: entryComponents, template: template, componentViewType: componentViewType, rendererType: rendererType, componentFactory: componentFactory }); } }]); function CompileDirectiveMetadata(_ref10) { var isHost = _ref10.isHost, type = _ref10.type, isComponent = _ref10.isComponent, selector = _ref10.selector, exportAs = _ref10.exportAs, changeDetection = _ref10.changeDetection, inputs = _ref10.inputs, outputs = _ref10.outputs, hostListeners = _ref10.hostListeners, hostProperties = _ref10.hostProperties, hostAttributes = _ref10.hostAttributes, providers = _ref10.providers, viewProviders = _ref10.viewProviders, queries = _ref10.queries, guards = _ref10.guards, viewQueries = _ref10.viewQueries, entryComponents = _ref10.entryComponents, template = _ref10.template, componentViewType = _ref10.componentViewType, rendererType = _ref10.rendererType, componentFactory = _ref10.componentFactory; _classCallCheck(this, CompileDirectiveMetadata); 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.guards = guards; this.viewQueries = _normalizeArray(viewQueries); this.entryComponents = _normalizeArray(entryComponents); this.template = template; this.componentViewType = componentViewType; this.rendererType = rendererType; this.componentFactory = componentFactory; } _createClass2(CompileDirectiveMetadata, [{ key: "toSummary", value: function toSummary() { 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, guards: this.guards, 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; }(); var CompilePipeMetadata = /*#__PURE__*/function () { function CompilePipeMetadata(_ref11) { var type = _ref11.type, name = _ref11.name, pure = _ref11.pure; _classCallCheck(this, CompilePipeMetadata); this.type = type; this.name = name; this.pure = !!pure; } _createClass2(CompilePipeMetadata, [{ key: "toSummary", value: function toSummary() { return { summaryKind: CompileSummaryKind.Pipe, type: this.type, name: this.name, pure: this.pure }; } }]); return CompilePipeMetadata; }(); var CompileShallowModuleMetadata = function CompileShallowModuleMetadata() { _classCallCheck(this, CompileShallowModuleMetadata); }; /** * Metadata regarding compilation of a module. */ var CompileNgModuleMetadata = /*#__PURE__*/function () { function CompileNgModuleMetadata(_ref12) { var type = _ref12.type, providers = _ref12.providers, declaredDirectives = _ref12.declaredDirectives, exportedDirectives = _ref12.exportedDirectives, declaredPipes = _ref12.declaredPipes, exportedPipes = _ref12.exportedPipes, entryComponents = _ref12.entryComponents, bootstrapComponents = _ref12.bootstrapComponents, importedModules = _ref12.importedModules, exportedModules = _ref12.exportedModules, schemas = _ref12.schemas, transitiveModule = _ref12.transitiveModule, id = _ref12.id; _classCallCheck(this, CompileNgModuleMetadata); 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; } _createClass2(CompileNgModuleMetadata, [{ key: "toSummary", value: function toSummary() { var 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 = /*#__PURE__*/function () { function TransitiveCompileNgModuleMetadata() { _classCallCheck(this, 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 = []; } _createClass2(TransitiveCompileNgModuleMetadata, [{ key: "addProvider", value: function addProvider(provider, module) { this.providers.push({ provider: provider, module: module }); } }, { key: "addDirective", value: function addDirective(id) { if (!this.directivesSet.has(id.reference)) { this.directivesSet.add(id.reference); this.directives.push(id); } } }, { key: "addExportedDirective", value: function addExportedDirective(id) { if (!this.exportedDirectivesSet.has(id.reference)) { this.exportedDirectivesSet.add(id.reference); this.exportedDirectives.push(id); } } }, { key: "addPipe", value: function addPipe(id) { if (!this.pipesSet.has(id.reference)) { this.pipesSet.add(id.reference); this.pipes.push(id); } } }, { key: "addExportedPipe", value: function addExportedPipe(id) { if (!this.exportedPipesSet.has(id.reference)) { this.exportedPipesSet.add(id.reference); this.exportedPipes.push(id); } } }, { key: "addModule", value: function addModule(id) { if (!this.modulesSet.has(id.reference)) { this.modulesSet.add(id.reference); this.modules.push(id); } } }, { key: "addEntryComponent", value: function addEntryComponent(ec) { if (!this.entryComponentsSet.has(ec.componentType)) { this.entryComponentsSet.add(ec.componentType); this.entryComponents.push(ec); } } }]); return TransitiveCompileNgModuleMetadata; }(); function _normalizeArray(obj) { return obj || []; } var ProviderMeta = function ProviderMeta(token, _ref13) { var useClass = _ref13.useClass, useValue = _ref13.useValue, useExisting = _ref13.useExisting, useFactory = _ref13.useFactory, deps = _ref13.deps, multi = _ref13.multi; _classCallCheck(this, ProviderMeta); this.token = token; this.useClass = useClass || null; this.useValue = useValue; this.useExisting = useExisting; this.useFactory = useFactory || null; this.dependencies = deps || null; this.multi = !!multi; }; function flatten(list) { return list.reduce(function (flat, item) { var flatItem = Array.isArray(item) ? flatten(item) : item; return flat.concat(flatItem); }, []); } function jitSourceUrl(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:///'); } function templateSourceUrl(ngModuleType, compMeta, templateMeta) { var 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 = "".concat(compMeta.type.reference.filePath, ".").concat(compMeta.type.reference.name, ".html"); } else { url = "".concat(identifierName(ngModuleType), "/").concat(identifierName(compMeta.type), ".html"); } } else { url = templateMeta.templateUrl; } return compMeta.type.reference instanceof StaticSymbol ? url : jitSourceUrl(url); } function sharedStylesheetJitUrl(meta, id) { var pathParts = meta.moduleUrl.split(/\/\\/g); var baseName = pathParts[pathParts.length - 1]; return jitSourceUrl("css/".concat(id).concat(baseName, ".ngstyle.js")); } function ngModuleJitUrl(moduleMeta) { return jitSourceUrl("".concat(identifierName(moduleMeta.type), "/module.ngfactory.js")); } function templateJitUrl(ngModuleType, compMeta) { return jitSourceUrl("".concat(identifierName(ngModuleType), "/").concat(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 CORE$1 = '@angular/core'; var Identifiers$1 = function Identifiers$1() { _classCallCheck(this, Identifiers$1); }; /* Methods */ Identifiers$1.NEW_METHOD = 'factory'; Identifiers$1.TRANSFORM_METHOD = 'transform'; Identifiers$1.PATCH_DEPS = 'patchedDeps'; /* Instructions */ Identifiers$1.namespaceHTML = { name: 'ɵɵnamespaceHTML', moduleName: CORE$1 }; Identifiers$1.namespaceMathML = { name: 'ɵɵnamespaceMathML', moduleName: CORE$1 }; Identifiers$1.namespaceSVG = { name: 'ɵɵnamespaceSVG', moduleName: CORE$1 }; Identifiers$1.element = { name: 'ɵɵelement', moduleName: CORE$1 }; Identifiers$1.elementStart = { name: 'ɵɵelementStart', moduleName: CORE$1 }; Identifiers$1.elementEnd = { name: 'ɵɵelementEnd', moduleName: CORE$1 }; Identifiers$1.select = { name: 'ɵɵselect', moduleName: CORE$1 }; Identifiers$1.updateSyntheticHostBinding = { name: 'ɵɵupdateSyntheticHostBinding', moduleName: CORE$1 }; Identifiers$1.componentHostSyntheticListener = { name: 'ɵɵcomponentHostSyntheticListener', moduleName: CORE$1 }; Identifiers$1.attribute = { name: 'ɵɵattribute', moduleName: CORE$1 }; Identifiers$1.attributeInterpolate1 = { name: 'ɵɵattributeInterpolate1', moduleName: CORE$1 }; Identifiers$1.attributeInterpolate2 = { name: 'ɵɵattributeInterpolate2', moduleName: CORE$1 }; Identifiers$1.attributeInterpolate3 = { name: 'ɵɵattributeInterpolate3', moduleName: CORE$1 }; Identifiers$1.attributeInterpolate4 = { name: 'ɵɵattributeInterpolate4', moduleName: CORE$1 }; Identifiers$1.attributeInterpolate5 = { name: 'ɵɵattributeInterpolate5', moduleName: CORE$1 }; Identifiers$1.attributeInterpolate6 = { name: 'ɵɵattributeInterpolate6', moduleName: CORE$1 }; Identifiers$1.attributeInterpolate7 = { name: 'ɵɵattributeInterpolate7', moduleName: CORE$1 }; Identifiers$1.attributeInterpolate8 = { name: 'ɵɵattributeInterpolate8', moduleName: CORE$1 }; Identifiers$1.attributeInterpolateV = { name: 'ɵɵattributeInterpolateV', moduleName: CORE$1 }; Identifiers$1.classProp = { name: 'ɵɵclassProp', moduleName: CORE$1 }; Identifiers$1.elementContainerStart = { name: 'ɵɵelementContainerStart', moduleName: CORE$1 }; Identifiers$1.elementContainerEnd = { name: 'ɵɵelementContainerEnd', moduleName: CORE$1 }; Identifiers$1.elementContainer = { name: 'ɵɵelementContainer', moduleName: CORE$1 }; Identifiers$1.styling = { name: 'ɵɵstyling', moduleName: CORE$1 }; Identifiers$1.styleMap = { name: 'ɵɵstyleMap', moduleName: CORE$1 }; Identifiers$1.classMap = { name: 'ɵɵclassMap', moduleName: CORE$1 }; Identifiers$1.classMapInterpolate1 = { name: 'ɵɵclassMapInterpolate1', moduleName: CORE$1 }; Identifiers$1.classMapInterpolate2 = { name: 'ɵɵclassMapInterpolate2', moduleName: CORE$1 }; Identifiers$1.classMapInterpolate3 = { name: 'ɵɵclassMapInterpolate3', moduleName: CORE$1 }; Identifiers$1.classMapInterpolate4 = { name: 'ɵɵclassMapInterpolate4', moduleName: CORE$1 }; Identifiers$1.classMapInterpolate5 = { name: 'ɵɵclassMapInterpolate5', moduleName: CORE$1 }; Identifiers$1.classMapInterpolate6 = { name: 'ɵɵclassMapInterpolate6', moduleName: CORE$1 }; Identifiers$1.classMapInterpolate7 = { name: 'ɵɵclassMapInterpolate7', moduleName: CORE$1 }; Identifiers$1.classMapInterpolate8 = { name: 'ɵɵclassMapInterpolate8', moduleName: CORE$1 }; Identifiers$1.classMapInterpolateV = { name: 'ɵɵclassMapInterpolateV', moduleName: CORE$1 }; Identifiers$1.styleProp = { name: 'ɵɵstyleProp', moduleName: CORE$1 }; Identifiers$1.stylePropInterpolate1 = { name: 'ɵɵstylePropInterpolate1', moduleName: CORE$1 }; Identifiers$1.stylePropInterpolate2 = { name: 'ɵɵstylePropInterpolate2', moduleName: CORE$1 }; Identifiers$1.stylePropInterpolate3 = { name: 'ɵɵstylePropInterpolate3', moduleName: CORE$1 }; Identifiers$1.stylePropInterpolate4 = { name: 'ɵɵstylePropInterpolate4', moduleName: CORE$1 }; Identifiers$1.stylePropInterpolate5 = { name: 'ɵɵstylePropInterpolate5', moduleName: CORE$1 }; Identifiers$1.stylePropInterpolate6 = { name: 'ɵɵstylePropInterpolate6', moduleName: CORE$1 }; Identifiers$1.stylePropInterpolate7 = { name: 'ɵɵstylePropInterpolate7', moduleName: CORE$1 }; Identifiers$1.stylePropInterpolate8 = { name: 'ɵɵstylePropInterpolate8', moduleName: CORE$1 }; Identifiers$1.stylePropInterpolateV = { name: 'ɵɵstylePropInterpolateV', moduleName: CORE$1 }; Identifiers$1.stylingApply = { name: 'ɵɵstylingApply', moduleName: CORE$1 }; Identifiers$1.styleSanitizer = { name: 'ɵɵstyleSanitizer', moduleName: CORE$1 }; Identifiers$1.elementHostAttrs = { name: 'ɵɵelementHostAttrs', moduleName: CORE$1 }; Identifiers$1.containerCreate = { name: 'ɵɵcontainer', moduleName: CORE$1 }; Identifiers$1.nextContext = { name: 'ɵɵnextContext', moduleName: CORE$1 }; Identifiers$1.templateCreate = { name: 'ɵɵtemplate', moduleName: CORE$1 }; Identifiers$1.text = { name: 'ɵɵtext', moduleName: CORE$1 }; Identifiers$1.textBinding = { name: 'ɵɵtextBinding', moduleName: CORE$1 }; Identifiers$1.enableBindings = { name: 'ɵɵenableBindings', moduleName: CORE$1 }; Identifiers$1.disableBindings = { name: 'ɵɵdisableBindings', moduleName: CORE$1 }; Identifiers$1.allocHostVars = { name: 'ɵɵallocHostVars', moduleName: CORE$1 }; Identifiers$1.getCurrentView = { name: 'ɵɵgetCurrentView', moduleName: CORE$1 }; Identifiers$1.textInterpolate = { name: 'ɵɵtextInterpolate', moduleName: CORE$1 }; Identifiers$1.textInterpolate1 = { name: 'ɵɵtextInterpolate1', moduleName: CORE$1 }; Identifiers$1.textInterpolate2 = { name: 'ɵɵtextInterpolate2', moduleName: CORE$1 }; Identifiers$1.textInterpolate3 = { name: 'ɵɵtextInterpolate3', moduleName: CORE$1 }; Identifiers$1.textInterpolate4 = { name: 'ɵɵtextInterpolate4', moduleName: CORE$1 }; Identifiers$1.textInterpolate5 = { name: 'ɵɵtextInterpolate5', moduleName: CORE$1 }; Identifiers$1.textInterpolate6 = { name: 'ɵɵtextInterpolate6', moduleName: CORE$1 }; Identifiers$1.textInterpolate7 = { name: 'ɵɵtextInterpolate7', moduleName: CORE$1 }; Identifiers$1.textInterpolate8 = { name: 'ɵɵtextInterpolate8', moduleName: CORE$1 }; Identifiers$1.textInterpolateV = { name: 'ɵɵtextInterpolateV', moduleName: CORE$1 }; Identifiers$1.restoreView = { name: 'ɵɵrestoreView', moduleName: CORE$1 }; Identifiers$1.pureFunction0 = { name: 'ɵɵpureFunction0', moduleName: CORE$1 }; Identifiers$1.pureFunction1 = { name: 'ɵɵpureFunction1', moduleName: CORE$1 }; Identifiers$1.pureFunction2 = { name: 'ɵɵpureFunction2', moduleName: CORE$1 }; Identifiers$1.pureFunction3 = { name: 'ɵɵpureFunction3', moduleName: CORE$1 }; Identifiers$1.pureFunction4 = { name: 'ɵɵpureFunction4', moduleName: CORE$1 }; Identifiers$1.pureFunction5 = { name: 'ɵɵpureFunction5', moduleName: CORE$1 }; Identifiers$1.pureFunction6 = { name: 'ɵɵpureFunction6', moduleName: CORE$1 }; Identifiers$1.pureFunction7 = { name: 'ɵɵpureFunction7', moduleName: CORE$1 }; Identifiers$1.pureFunction8 = { name: 'ɵɵpureFunction8', moduleName: CORE$1 }; Identifiers$1.pureFunctionV = { name: 'ɵɵpureFunctionV', moduleName: CORE$1 }; Identifiers$1.pipeBind1 = { name: 'ɵɵpipeBind1', moduleName: CORE$1 }; Identifiers$1.pipeBind2 = { name: 'ɵɵpipeBind2', moduleName: CORE$1 }; Identifiers$1.pipeBind3 = { name: 'ɵɵpipeBind3', moduleName: CORE$1 }; Identifiers$1.pipeBind4 = { name: 'ɵɵpipeBind4', moduleName: CORE$1 }; Identifiers$1.pipeBindV = { name: 'ɵɵpipeBindV', moduleName: CORE$1 }; Identifiers$1.hostProperty = { name: 'ɵɵhostProperty', moduleName: CORE$1 }; Identifiers$1.property = { name: 'ɵɵproperty', moduleName: CORE$1 }; Identifiers$1.propertyInterpolate = { name: 'ɵɵpropertyInterpolate', moduleName: CORE$1 }; Identifiers$1.propertyInterpolate1 = { name: 'ɵɵpropertyInterpolate1', moduleName: CORE$1 }; Identifiers$1.propertyInterpolate2 = { name: 'ɵɵpropertyInterpolate2', moduleName: CORE$1 }; Identifiers$1.propertyInterpolate3 = { name: 'ɵɵpropertyInterpolate3', moduleName: CORE$1 }; Identifiers$1.propertyInterpolate4 = { name: 'ɵɵpropertyInterpolate4', moduleName: CORE$1 }; Identifiers$1.propertyInterpolate5 = { name: 'ɵɵpropertyInterpolate5', moduleName: CORE$1 }; Identifiers$1.propertyInterpolate6 = { name: 'ɵɵpropertyInterpolate6', moduleName: CORE$1 }; Identifiers$1.propertyInterpolate7 = { name: 'ɵɵpropertyInterpolate7', moduleName: CORE$1 }; Identifiers$1.propertyInterpolate8 = { name: 'ɵɵpropertyInterpolate8', moduleName: CORE$1 }; Identifiers$1.propertyInterpolateV = { name: 'ɵɵpropertyInterpolateV', moduleName: CORE$1 }; Identifiers$1.i18n = { name: 'ɵɵi18n', moduleName: CORE$1 }; Identifiers$1.i18nAttributes = { name: 'ɵɵi18nAttributes', moduleName: CORE$1 }; Identifiers$1.i18nExp = { name: 'ɵɵi18nExp', moduleName: CORE$1 }; Identifiers$1.i18nStart = { name: 'ɵɵi18nStart', moduleName: CORE$1 }; Identifiers$1.i18nEnd = { name: 'ɵɵi18nEnd', moduleName: CORE$1 }; Identifiers$1.i18nApply = { name: 'ɵɵi18nApply', moduleName: CORE$1 }; Identifiers$1.i18nPostprocess = { name: 'ɵɵi18nPostprocess', moduleName: CORE$1 }; Identifiers$1.i18nLocalize = { name: 'ɵɵi18nLocalize', moduleName: CORE$1 }; Identifiers$1.load = { name: 'ɵɵload', moduleName: CORE$1 }; Identifiers$1.pipe = { name: 'ɵɵpipe', moduleName: CORE$1 }; Identifiers$1.projection = { name: 'ɵɵprojection', moduleName: CORE$1 }; Identifiers$1.projectionDef = { name: 'ɵɵprojectionDef', moduleName: CORE$1 }; Identifiers$1.reference = { name: 'ɵɵreference', moduleName: CORE$1 }; Identifiers$1.inject = { name: 'ɵɵinject', moduleName: CORE$1 }; Identifiers$1.injectAttribute = { name: 'ɵɵinjectAttribute', moduleName: CORE$1 }; Identifiers$1.injectPipeChangeDetectorRef = { name: 'ɵɵinjectPipeChangeDetectorRef', moduleName: CORE$1 }; Identifiers$1.directiveInject = { name: 'ɵɵdirectiveInject', moduleName: CORE$1 }; Identifiers$1.templateRefExtractor = { name: 'ɵɵtemplateRefExtractor', moduleName: CORE$1 }; Identifiers$1.resolveWindow = { name: 'ɵɵresolveWindow', moduleName: CORE$1 }; Identifiers$1.resolveDocument = { name: 'ɵɵresolveDocument', moduleName: CORE$1 }; Identifiers$1.resolveBody = { name: 'ɵɵresolveBody', moduleName: CORE$1 }; Identifiers$1.defineBase = { name: 'ɵɵdefineBase', moduleName: CORE$1 }; Identifiers$1.BaseDef = { name: 'ɵɵBaseDef', moduleName: CORE$1 }; Identifiers$1.defineComponent = { name: 'ɵɵdefineComponent', moduleName: CORE$1 }; Identifiers$1.setComponentScope = { name: 'ɵɵsetComponentScope', moduleName: CORE$1 }; Identifiers$1.ComponentDefWithMeta = { name: 'ɵɵComponentDefWithMeta', moduleName: CORE$1 }; Identifiers$1.defineDirective = { name: 'ɵɵdefineDirective', moduleName: CORE$1 }; Identifiers$1.DirectiveDefWithMeta = { name: 'ɵɵDirectiveDefWithMeta', moduleName: CORE$1 }; Identifiers$1.InjectorDef = { name: 'ɵɵInjectorDef', moduleName: CORE$1 }; Identifiers$1.defineInjector = { name: 'ɵɵdefineInjector', moduleName: CORE$1 }; Identifiers$1.NgModuleDefWithMeta = { name: 'ɵɵNgModuleDefWithMeta', moduleName: CORE$1 }; Identifiers$1.defineNgModule = { name: 'ɵɵdefineNgModule', moduleName: CORE$1 }; Identifiers$1.setNgModuleScope = { name: 'ɵɵsetNgModuleScope', moduleName: CORE$1 }; Identifiers$1.PipeDefWithMeta = { name: 'ɵɵPipeDefWithMeta', moduleName: CORE$1 }; Identifiers$1.definePipe = { name: 'ɵɵdefinePipe', moduleName: CORE$1 }; Identifiers$1.queryRefresh = { name: 'ɵɵqueryRefresh', moduleName: CORE$1 }; Identifiers$1.viewQuery = { name: 'ɵɵviewQuery', moduleName: CORE$1 }; Identifiers$1.staticViewQuery = { name: 'ɵɵstaticViewQuery', moduleName: CORE$1 }; Identifiers$1.staticContentQuery = { name: 'ɵɵstaticContentQuery', moduleName: CORE$1 }; Identifiers$1.loadViewQuery = { name: 'ɵɵloadViewQuery', moduleName: CORE$1 }; Identifiers$1.contentQuery = { name: 'ɵɵcontentQuery', moduleName: CORE$1 }; Identifiers$1.loadContentQuery = { name: 'ɵɵloadContentQuery', moduleName: CORE$1 }; Identifiers$1.NgOnChangesFeature = { name: 'ɵɵNgOnChangesFeature', moduleName: CORE$1 }; Identifiers$1.InheritDefinitionFeature = { name: 'ɵɵInheritDefinitionFeature', moduleName: CORE$1 }; Identifiers$1.ProvidersFeature = { name: 'ɵɵProvidersFeature', moduleName: CORE$1 }; Identifiers$1.listener = { name: 'ɵɵlistener', moduleName: CORE$1 }; Identifiers$1.getFactoryOf = { name: 'ɵɵgetFactoryOf', moduleName: CORE$1 }; Identifiers$1.getInheritedFactory = { name: 'ɵɵgetInheritedFactory', moduleName: CORE$1 }; // sanitization-related functions Identifiers$1.sanitizeHtml = { name: 'ɵɵsanitizeHtml', moduleName: CORE$1 }; Identifiers$1.sanitizeStyle = { name: 'ɵɵsanitizeStyle', moduleName: CORE$1 }; Identifiers$1.defaultStyleSanitizer = { name: 'ɵɵdefaultStyleSanitizer', moduleName: CORE$1 }; Identifiers$1.sanitizeResourceUrl = { name: 'ɵɵsanitizeResourceUrl', moduleName: CORE$1 }; Identifiers$1.sanitizeScript = { name: 'ɵɵsanitizeScript', moduleName: CORE$1 }; Identifiers$1.sanitizeUrl = { name: 'ɵɵsanitizeUrl', moduleName: CORE$1 }; Identifiers$1.sanitizeUrlOrResourceUrl = { name: 'ɵɵsanitizeUrlOrResourceUrl', moduleName: CORE$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 $EOF = 0; var $BSPACE = 8; 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 $7 = 55; 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 $b = 98; 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 $PIPE = 124; var $TILDA = 126; var $AT = 64; var $BT = 96; function isWhitespace(code) { return code >= $TAB && code <= $SPACE || code == $NBSP; } function isDigit(code) { return $0 <= code && code <= $9; } function isAsciiLetter(code) { return code >= $a && code <= $z || code >= $A && code <= $Z; } function isAsciiHexDigit(code) { return code >= $a && code <= $f || code >= $A && code <= $F || isDigit(code); } function isNewLine(code) { return code === $LF || code === $CR; } function isOctalDigit(code) { return $0 <= code && code <= $7; } /** * @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 = /*#__PURE__*/function () { function ParseLocation(file, offset, line, col) { _classCallCheck(this, ParseLocation); this.file = file; this.offset = offset; this.line = line; this.col = col; } _createClass2(ParseLocation, [{ key: "toString", value: function toString() { return this.offset != null ? "".concat(this.file.url, "@").concat(this.line, ":").concat(this.col) : this.file.url; } }, { key: "moveBy", value: function moveBy(delta) { var source = this.file.content; var len = source.length; var offset = this.offset; var line = this.line; var col = this.col; while (offset > 0 && delta < 0) { offset--; delta++; var ch = source.charCodeAt(offset); if (ch == $LF) { line--; var priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode($LF)); col = priorLine > 0 ? offset - priorLine : offset; } else { col--; } } while (offset < len && delta > 0) { var _ch = source.charCodeAt(offset); offset++; delta--; if (_ch == $LF) { line++; col = 0; } else { col++; } } return new ParseLocation(this.file, offset, line, col); } // Return the source around the location // Up to `maxChars` or `maxLines` on each side of the location }, { key: "getContext", value: function getContext(maxChars, maxLines) { var content = this.file.content; var startOffset = this.offset; if (startOffset != null) { if (startOffset > content.length - 1) { startOffset = content.length - 1; } var endOffset = startOffset; var ctxChars = 0; var 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 ParseSourceFile(content, url) { _classCallCheck(this, ParseSourceFile); this.content = content; this.url = url; }; var ParseSourceSpan = /*#__PURE__*/function () { function ParseSourceSpan(start, end) { var details = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; _classCallCheck(this, ParseSourceSpan); this.start = start; this.end = end; this.details = details; } _createClass2(ParseSourceSpan, [{ key: "toString", value: function toString() { return this.start.file.content.substring(this.start.offset, this.end.offset); } }]); return ParseSourceSpan; }(); var EMPTY_PARSE_LOCATION = new ParseLocation(new ParseSourceFile('', ''), 0, 0, 0); var EMPTY_SOURCE_SPAN = new ParseSourceSpan(EMPTY_PARSE_LOCATION, EMPTY_PARSE_LOCATION); var ParseErrorLevel; (function (ParseErrorLevel) { ParseErrorLevel[ParseErrorLevel["WARNING"] = 0] = "WARNING"; ParseErrorLevel[ParseErrorLevel["ERROR"] = 1] = "ERROR"; })(ParseErrorLevel || (ParseErrorLevel = {})); var ParseError = /*#__PURE__*/function () { function ParseError(span, msg) { var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ParseErrorLevel.ERROR; _classCallCheck(this, ParseError); this.span = span; this.msg = msg; this.level = level; } _createClass2(ParseError, [{ key: "contextualMessage", value: function contextualMessage() { var ctx = this.span.start.getContext(100, 3); return ctx ? "".concat(this.msg, " (\"").concat(ctx.before, "[").concat(ParseErrorLevel[this.level], " ->]").concat(ctx.after, "\")") : this.msg; } }, { key: "toString", value: function toString() { var details = this.span.details ? ", ".concat(this.span.details) : ''; return "".concat(this.contextualMessage(), ": ").concat(this.span.start).concat(details); } }]); return ParseError; }(); function typeSourceSpan(kind, type) { var moduleUrl = identifierModuleUrl(type); var sourceFileName = moduleUrl != null ? "in ".concat(kind, " ").concat(identifierName(type), " in ").concat(moduleUrl) : "in ".concat(kind, " ").concat(identifierName(type)); var sourceFile = new ParseSourceFile('', sourceFileName); return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1)); } /** * Generates Source Span object for a given R3 Type for JIT mode. * * @param kind Component or Directive. * @param typeName name of the Component or Directive. * @param sourceUrl reference to Component or Directive source. * @returns instance of ParseSourceSpan that represent a given Component or Directive. */ function r3JitTypeSourceSpan(kind, typeName, sourceUrl) { var sourceFileName = "in ".concat(kind, " ").concat(typeName, " in ").concat(sourceUrl); var 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 = /*#__PURE__*/function () { function Text(value, sourceSpan) { _classCallCheck(this, Text); this.value = value; this.sourceSpan = sourceSpan; } _createClass2(Text, [{ key: "visit", value: function visit(visitor) { return visitor.visitText(this); } }]); return Text; }(); var BoundText = /*#__PURE__*/function () { function BoundText(value, sourceSpan, i18n) { _classCallCheck(this, BoundText); this.value = value; this.sourceSpan = sourceSpan; this.i18n = i18n; } _createClass2(BoundText, [{ key: "visit", value: function visit(visitor) { return visitor.visitBoundText(this); } }]); return BoundText; }(); var TextAttribute = /*#__PURE__*/function () { function TextAttribute(name, value, sourceSpan, valueSpan, i18n) { _classCallCheck(this, TextAttribute); this.name = name; this.value = value; this.sourceSpan = sourceSpan; this.valueSpan = valueSpan; this.i18n = i18n; } _createClass2(TextAttribute, [{ key: "visit", value: function visit(visitor) { return visitor.visitTextAttribute(this); } }]); return TextAttribute; }(); var BoundAttribute = /*#__PURE__*/function () { function BoundAttribute(name, type, securityContext, value, unit, sourceSpan, valueSpan, i18n) { _classCallCheck(this, BoundAttribute); this.name = name; this.type = type; this.securityContext = securityContext; this.value = value; this.unit = unit; this.sourceSpan = sourceSpan; this.valueSpan = valueSpan; this.i18n = i18n; } _createClass2(BoundAttribute, [{ key: "visit", value: function visit(visitor) { return visitor.visitBoundAttribute(this); } }], [{ key: "fromBoundElementProperty", value: function fromBoundElementProperty(prop, i18n) { return new BoundAttribute(prop.name, prop.type, prop.securityContext, prop.value, prop.unit, prop.sourceSpan, prop.valueSpan, i18n); } }]); return BoundAttribute; }(); var BoundEvent = /*#__PURE__*/function () { function BoundEvent(name, type, handler, target, phase, sourceSpan, handlerSpan) { _classCallCheck(this, BoundEvent); this.name = name; this.type = type; this.handler = handler; this.target = target; this.phase = phase; this.sourceSpan = sourceSpan; this.handlerSpan = handlerSpan; } _createClass2(BoundEvent, [{ key: "visit", value: function visit(visitor) { return visitor.visitBoundEvent(this); } }], [{ key: "fromParsedEvent", value: function fromParsedEvent(event) { var target = event.type === 0 /* Regular */ ? event.targetOrPhase : null; var phase = event.type === 1 /* Animation */ ? event.targetOrPhase : null; return new BoundEvent(event.name, event.type, event.handler, target, phase, event.sourceSpan, event.handlerSpan); } }]); return BoundEvent; }(); var Element = /*#__PURE__*/function () { function Element(name, attributes, inputs, outputs, children, references, sourceSpan, startSourceSpan, endSourceSpan, i18n) { _classCallCheck(this, Element); this.name = name; this.attributes = attributes; this.inputs = inputs; this.outputs = outputs; this.children = children; this.references = references; this.sourceSpan = sourceSpan; this.startSourceSpan = startSourceSpan; this.endSourceSpan = endSourceSpan; this.i18n = i18n; // If the element is empty then the source span should include any closing tag if (children.length === 0 && startSourceSpan && endSourceSpan) { this.sourceSpan = new ParseSourceSpan(sourceSpan.start, endSourceSpan.end); } } _createClass2(Element, [{ key: "visit", value: function visit(visitor) { return visitor.visitElement(this); } }]); return Element; }(); var Template = /*#__PURE__*/function () { function Template(tagName, attributes, inputs, outputs, templateAttrs, children, references, variables, sourceSpan, startSourceSpan, endSourceSpan, i18n) { _classCallCheck(this, Template); this.tagName = tagName; this.attributes = attributes; this.inputs = inputs; this.outputs = outputs; this.templateAttrs = templateAttrs; this.children = children; this.references = references; this.variables = variables; this.sourceSpan = sourceSpan; this.startSourceSpan = startSourceSpan; this.endSourceSpan = endSourceSpan; this.i18n = i18n; } _createClass2(Template, [{ key: "visit", value: function visit(visitor) { return visitor.visitTemplate(this); } }]); return Template; }(); var Content = /*#__PURE__*/function () { function Content(selector, attributes, sourceSpan, i18n) { _classCallCheck(this, Content); this.selector = selector; this.attributes = attributes; this.sourceSpan = sourceSpan; this.i18n = i18n; } _createClass2(Content, [{ key: "visit", value: function visit(visitor) { return visitor.visitContent(this); } }]); return Content; }(); var Variable = /*#__PURE__*/function () { function Variable(name, value, sourceSpan, valueSpan) { _classCallCheck(this, Variable); this.name = name; this.value = value; this.sourceSpan = sourceSpan; this.valueSpan = valueSpan; } _createClass2(Variable, [{ key: "visit", value: function visit(visitor) { return visitor.visitVariable(this); } }]); return Variable; }(); var Reference = /*#__PURE__*/function () { function Reference(name, value, sourceSpan, valueSpan) { _classCallCheck(this, Reference); this.name = name; this.value = value; this.sourceSpan = sourceSpan; this.valueSpan = valueSpan; } _createClass2(Reference, [{ key: "visit", value: function visit(visitor) { return visitor.visitReference(this); } }]); return Reference; }(); var Icu = /*#__PURE__*/function () { function Icu(vars, placeholders, sourceSpan, i18n) { _classCallCheck(this, Icu); this.vars = vars; this.placeholders = placeholders; this.sourceSpan = sourceSpan; this.i18n = i18n; } _createClass2(Icu, [{ key: "visit", value: function visit(visitor) { return visitor.visitIcu(this); } }]); return Icu; }(); var NullVisitor = /*#__PURE__*/function () { function NullVisitor() { _classCallCheck(this, NullVisitor); } _createClass2(NullVisitor, [{ key: "visitElement", value: function visitElement(element) {} }, { key: "visitTemplate", value: function visitTemplate(template) {} }, { key: "visitContent", value: function visitContent(content) {} }, { key: "visitVariable", value: function visitVariable(variable) {} }, { key: "visitReference", value: function visitReference(reference) {} }, { key: "visitTextAttribute", value: function visitTextAttribute(attribute) {} }, { key: "visitBoundAttribute", value: function visitBoundAttribute(attribute) {} }, { key: "visitBoundEvent", value: function visitBoundEvent(attribute) {} }, { key: "visitText", value: function visitText(text) {} }, { key: "visitBoundText", value: function visitBoundText(text) {} }, { key: "visitIcu", value: function visitIcu(icu) {} }]); return NullVisitor; }(); var RecursiveVisitor = /*#__PURE__*/function () { function RecursiveVisitor() { _classCallCheck(this, RecursiveVisitor); } _createClass2(RecursiveVisitor, [{ key: "visitElement", value: function visitElement(element) { visitAll(this, element.attributes); visitAll(this, element.children); visitAll(this, element.references); } }, { key: "visitTemplate", value: function visitTemplate(template) { visitAll(this, template.attributes); visitAll(this, template.children); visitAll(this, template.references); visitAll(this, template.variables); } }, { key: "visitContent", value: function visitContent(content) {} }, { key: "visitVariable", value: function visitVariable(variable) {} }, { key: "visitReference", value: function visitReference(reference) {} }, { key: "visitTextAttribute", value: function visitTextAttribute(attribute) {} }, { key: "visitBoundAttribute", value: function visitBoundAttribute(attribute) {} }, { key: "visitBoundEvent", value: function visitBoundEvent(attribute) {} }, { key: "visitText", value: function visitText(text) {} }, { key: "visitBoundText", value: function visitBoundText(text) {} }, { key: "visitIcu", value: function visitIcu(icu) {} }]); return RecursiveVisitor; }(); var TransformVisitor = /*#__PURE__*/function () { function TransformVisitor() { _classCallCheck(this, TransformVisitor); } _createClass2(TransformVisitor, [{ key: "visitElement", value: function visitElement(element) { var newAttributes = transformAll(this, element.attributes); var newInputs = transformAll(this, element.inputs); var newOutputs = transformAll(this, element.outputs); var newChildren = transformAll(this, element.children); var newReferences = transformAll(this, element.references); if (newAttributes != element.attributes || newInputs != element.inputs || newOutputs != element.outputs || newChildren != element.children || newReferences != element.references) { return new Element(element.name, newAttributes, newInputs, newOutputs, newChildren, newReferences, element.sourceSpan, element.startSourceSpan, element.endSourceSpan); } return element; } }, { key: "visitTemplate", value: function visitTemplate(template) { var newAttributes = transformAll(this, template.attributes); var newInputs = transformAll(this, template.inputs); var newOutputs = transformAll(this, template.outputs); var newTemplateAttrs = transformAll(this, template.templateAttrs); var newChildren = transformAll(this, template.children); var newReferences = transformAll(this, template.references); var newVariables = transformAll(this, template.variables); if (newAttributes != template.attributes || newInputs != template.inputs || newOutputs != template.outputs || newTemplateAttrs != template.templateAttrs || newChildren != template.children || newReferences != template.references || newVariables != template.variables) { return new Template(template.tagName, newAttributes, newInputs, newOutputs, newTemplateAttrs, newChildren, newReferences, newVariables, template.sourceSpan, template.startSourceSpan, template.endSourceSpan); } return template; } }, { key: "visitContent", value: function visitContent(content) { return content; } }, { key: "visitVariable", value: function visitVariable(variable) { return variable; } }, { key: "visitReference", value: function visitReference(reference) { return reference; } }, { key: "visitTextAttribute", value: function visitTextAttribute(attribute) { return attribute; } }, { key: "visitBoundAttribute", value: function visitBoundAttribute(attribute) { return attribute; } }, { key: "visitBoundEvent", value: function visitBoundEvent(attribute) { return attribute; } }, { key: "visitText", value: function visitText(text) { return text; } }, { key: "visitBoundText", value: function visitBoundText(text) { return text; } }, { key: "visitIcu", value: function visitIcu(icu) { return icu; } }]); return TransformVisitor; }(); function visitAll(visitor, nodes) { var result = []; if (visitor.visit) { var _iterator4 = _createForOfIteratorHelper(nodes), _step4; try { for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { var node = _step4.value; var newNode = visitor.visit(node) || node.visit(visitor); } } catch (err) { _iterator4.e(err); } finally { _iterator4.f(); } } else { var _iterator5 = _createForOfIteratorHelper(nodes), _step5; try { for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { var _node = _step5.value; var _newNode = _node.visit(visitor); if (_newNode) { result.push(_newNode); } } } catch (err) { _iterator5.e(err); } finally { _iterator5.f(); } } return result; } function transformAll(visitor, nodes) { var result = []; var changed = false; var _iterator6 = _createForOfIteratorHelper(nodes), _step6; try { for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) { var node = _step6.value; var newNode = node.visit(visitor); if (newNode) { result.push(newNode); } changed = changed || newNode != node; } } catch (err) { _iterator6.e(err); } finally { _iterator6.f(); } return changed ? result : nodes; } /** * @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 = /** * @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) { _classCallCheck(this, Message); 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 = []; } }; var Text$1 = /*#__PURE__*/function () { function Text$1(value, sourceSpan) { _classCallCheck(this, Text$1); this.value = value; this.sourceSpan = sourceSpan; } _createClass2(Text$1, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitText(this, context); } }]); return Text$1; }(); // TODO(vicb): do we really need this node (vs an array) ? var Container = /*#__PURE__*/function () { function Container(children, sourceSpan) { _classCallCheck(this, Container); this.children = children; this.sourceSpan = sourceSpan; } _createClass2(Container, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitContainer(this, context); } }]); return Container; }(); var Icu$1 = /*#__PURE__*/function () { function Icu$1(expression, type, cases, sourceSpan) { _classCallCheck(this, Icu$1); this.expression = expression; this.type = type; this.cases = cases; this.sourceSpan = sourceSpan; } _createClass2(Icu$1, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitIcu(this, context); } }]); return Icu$1; }(); var TagPlaceholder = /*#__PURE__*/function () { function TagPlaceholder(tag, attrs, startName, closeName, children, isVoid, sourceSpan) { _classCallCheck(this, TagPlaceholder); this.tag = tag; this.attrs = attrs; this.startName = startName; this.closeName = closeName; this.children = children; this.isVoid = isVoid; this.sourceSpan = sourceSpan; } _createClass2(TagPlaceholder, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitTagPlaceholder(this, context); } }]); return TagPlaceholder; }(); var Placeholder = /*#__PURE__*/function () { function Placeholder(value, name, sourceSpan) { _classCallCheck(this, Placeholder); this.value = value; this.name = name; this.sourceSpan = sourceSpan; } _createClass2(Placeholder, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitPlaceholder(this, context); } }]); return Placeholder; }(); var IcuPlaceholder = /*#__PURE__*/function () { function IcuPlaceholder(value, name, sourceSpan) { _classCallCheck(this, IcuPlaceholder); this.value = value; this.name = name; this.sourceSpan = sourceSpan; } _createClass2(IcuPlaceholder, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitIcuPlaceholder(this, context); } }]); return IcuPlaceholder; }(); // Clone the AST var CloneVisitor = /*#__PURE__*/function () { function CloneVisitor() { _classCallCheck(this, CloneVisitor); } _createClass2(CloneVisitor, [{ key: "visitText", value: function visitText(text, context) { return new Text$1(text.value, text.sourceSpan); } }, { key: "visitContainer", value: function visitContainer(container, context) { var _this87 = this; var children = container.children.map(function (n) { return n.visit(_this87, context); }); return new Container(children, container.sourceSpan); } }, { key: "visitIcu", value: function visitIcu(icu, context) { var _this88 = this; var cases = {}; Object.keys(icu.cases).forEach(function (key) { return cases[key] = icu.cases[key].visit(_this88, context); }); var msg = new Icu$1(icu.expression, icu.type, cases, icu.sourceSpan); msg.expressionPlaceholder = icu.expressionPlaceholder; return msg; } }, { key: "visitTagPlaceholder", value: function visitTagPlaceholder(ph, context) { var _this89 = this; var children = ph.children.map(function (n) { return n.visit(_this89, context); }); return new TagPlaceholder(ph.tag, ph.attrs, ph.startName, ph.closeName, children, ph.isVoid, ph.sourceSpan); } }, { key: "visitPlaceholder", value: function visitPlaceholder(ph, context) { return new Placeholder(ph.value, ph.name, ph.sourceSpan); } }, { key: "visitIcuPlaceholder", value: function visitIcuPlaceholder(ph, context) { return new IcuPlaceholder(ph.value, ph.name, ph.sourceSpan); } }]); return CloneVisitor; }(); // Visit all the nodes recursively var RecurseVisitor = /*#__PURE__*/function () { function RecurseVisitor() { _classCallCheck(this, RecurseVisitor); } _createClass2(RecurseVisitor, [{ key: "visitText", value: function visitText(text, context) {} }, { key: "visitContainer", value: function visitContainer(container, context) { var _this90 = this; container.children.forEach(function (child) { return child.visit(_this90); }); } }, { key: "visitIcu", value: function visitIcu(icu, context) { var _this91 = this; Object.keys(icu.cases).forEach(function (k) { icu.cases[k].visit(_this91); }); } }, { key: "visitTagPlaceholder", value: function visitTagPlaceholder(ph, context) { var _this92 = this; ph.children.forEach(function (child) { return child.visit(_this92); }); } }, { key: "visitPlaceholder", value: function visitPlaceholder(ph, context) {} }, { key: "visitIcuPlaceholder", value: function visitIcuPlaceholder(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 */ function _digest2(message) { return message.id || sha1(serializeNodes(message.nodes).join('') + "[".concat(message.meaning, "]")); } function decimalDigest(message) { if (message.id) { return message.id; } var visitor = new _SerializerIgnoreIcuExpVisitor(); var 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 = /*#__PURE__*/function () { function _SerializerVisitor() { _classCallCheck(this, _SerializerVisitor); } _createClass2(_SerializerVisitor, [{ key: "visitText", value: function visitText(text, context) { return text.value; } }, { key: "visitContainer", value: function visitContainer(container, context) { var _this93 = this; return "[".concat(container.children.map(function (child) { return child.visit(_this93); }).join(', '), "]"); } }, { key: "visitIcu", value: function visitIcu(icu, context) { var _this94 = this; var strCases = Object.keys(icu.cases).map(function (k) { return "".concat(k, " {").concat(icu.cases[k].visit(_this94), "}"); }); return "{".concat(icu.expression, ", ").concat(icu.type, ", ").concat(strCases.join(', '), "}"); } }, { key: "visitTagPlaceholder", value: function visitTagPlaceholder(ph, context) { var _this95 = this; return ph.isVoid ? "<ph tag name=\"".concat(ph.startName, "\"/>") : "<ph tag name=\"".concat(ph.startName, "\">").concat(ph.children.map(function (child) { return child.visit(_this95); }).join(', '), "</ph name=\"").concat(ph.closeName, "\">"); } }, { key: "visitPlaceholder", value: function visitPlaceholder(ph, context) { return ph.value ? "<ph name=\"".concat(ph.name, "\">").concat(ph.value, "</ph>") : "<ph name=\"".concat(ph.name, "\"/>"); } }, { key: "visitIcuPlaceholder", value: function visitIcuPlaceholder(ph, context) { return "<ph icu name=\"".concat(ph.name, "\">").concat(ph.value.visit(this), "</ph>"); } }]); return _SerializerVisitor; }(); var serializerVisitor = new _SerializerVisitor(); 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 = /*#__PURE__*/function (_SerializerVisitor2) { _inherits(_SerializerIgnoreIcuExpVisitor, _SerializerVisitor2); var _super52 = _createSuper(_SerializerIgnoreIcuExpVisitor); function _SerializerIgnoreIcuExpVisitor() { _classCallCheck(this, _SerializerIgnoreIcuExpVisitor); return _super52.apply(this, arguments); } _createClass2(_SerializerIgnoreIcuExpVisitor, [{ key: "visitIcu", value: function visitIcu(icu, context) { var _this96 = this; var strCases = Object.keys(icu.cases).map(function (k) { return "".concat(k, " {").concat(icu.cases[k].visit(_this96), "}"); }); // Do not take the expression into account return "{".concat(icu.type, ", ").concat(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. */ function sha1(str) { var utf8 = utf8Encode(str); var words32 = stringToWords32(utf8, Endian.Big); var len = utf8.length * 8; var w = new Array(80); var a = 0x67452301, b = 0xefcdab89, c = 0x98badcfe, d = 0x10325476, e = 0xc3d2e1f0; words32[len >> 5] |= 0x80 << 24 - len % 32; words32[(len + 64 >> 9 << 4) + 15] = len; for (var i = 0; i < words32.length; i += 16) { var h0 = a, h1 = b, h2 = c, h3 = d, h4 = e; for (var 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 _fk = fk(j, b, c, d), _fk2 = _slicedToArray(_fk, 2), f = _fk2[0], k = _fk2[1]; var temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32); var _ref14 = [d, c, rol32(b, 30), a, temp]; e = _ref14[0]; d = _ref14[1]; c = _ref14[2]; b = _ref14[3]; a = _ref14[4]; } var _ref15 = [add32(a, h0), add32(b, h1), add32(c, h2), add32(d, h3), add32(e, h4)]; a = _ref15[0]; b = _ref15[1]; c = _ref15[2]; d = _ref15[3]; e = _ref15[4]; } return byteStringToHexString(words32ToByteString([a, b, c, d, e])); } 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 */ function fingerprint(str) { var utf8 = utf8Encode(str); var _ref16 = [hash32(utf8, 0), hash32(utf8, 102072)], hi = _ref16[0], lo = _ref16[1]; if (hi == 0 && (lo == 0 || lo == 1)) { hi = hi ^ 0x130f9bef; lo = lo ^ -0x6b5f56d8; } return [hi, lo]; } function computeMsgId(msg, meaning) { var _fingerprint = fingerprint(msg), _fingerprint2 = _slicedToArray(_fingerprint, 2), hi = _fingerprint2[0], lo = _fingerprint2[1]; if (meaning) { var _fingerprint3 = fingerprint(meaning), _fingerprint4 = _slicedToArray(_fingerprint3, 2), him = _fingerprint4[0], lom = _fingerprint4[1]; var _add = add64(rol64([hi, lo], 1), [him, lom]); var _add2 = _slicedToArray(_add, 2); hi = _add2[0]; lo = _add2[1]; } return byteStringToDecString(words32ToByteString([hi & 0x7fffffff, lo])); } function hash32(str, c) { var a = 0x9e3779b9, b = 0x9e3779b9; var i; var 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)); var _mix = mix([a, b, c]); var _mix2 = _slicedToArray(_mix, 3); a = _mix2[0]; b = _mix2[1]; c = _mix2[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]; } // clang-format off function mix(_ref17) { var _ref18 = _slicedToArray(_ref17, 3), a = _ref18[0], b = _ref18[1], c = _ref18[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]; } // clang-format on // Utils var Endian; (function (Endian) { Endian[Endian["Little"] = 0] = "Little"; Endian[Endian["Big"] = 1] = "Big"; })(Endian || (Endian = {})); function add32(a, b) { return add32to64(a, b)[1]; } function add32to64(a, b) { var low = (a & 0xffff) + (b & 0xffff); var high = (a >>> 16) + (b >>> 16) + (low >>> 16); return [high >>> 16, high << 16 | low & 0xffff]; } function add64(_ref19, _ref20) { var _ref21 = _slicedToArray(_ref19, 2), ah = _ref21[0], al = _ref21[1]; var _ref22 = _slicedToArray(_ref20, 2), bh = _ref22[0], bl = _ref22[1]; var _add32to = add32to64(al, bl), _add32to2 = _slicedToArray(_add32to, 2), carry = _add32to2[0], l = _add32to2[1]; var h = add32(add32(ah, bh), carry); return [h, l]; } function sub32(a, b) { var low = (a & 0xffff) - (b & 0xffff); var high = (a >> 16) - (b >> 16) + (low >> 16); return high << 16 | low & 0xffff; } // Rotate a 32b number left `count` position function rol32(a, count) { return a << count | a >>> 32 - count; } // Rotate a 64b number left `count` position function rol64(_ref23, count) { var _ref24 = _slicedToArray(_ref23, 2), hi = _ref24[0], lo = _ref24[1]; var h = hi << count | lo >>> 32 - count; var l = lo << count | hi >>> 32 - count; return [h, l]; } function stringToWords32(str, endian) { var words32 = Array(str.length + 3 >>> 2); for (var i = 0; i < words32.length; i++) { words32[i] = wordAt(str, i * 4, endian); } return words32; } function byteAt(str, index) { return index >= str.length ? 0 : str.charCodeAt(index) & 0xff; } function wordAt(str, index, endian) { var word = 0; if (endian === Endian.Big) { for (var i = 0; i < 4; i++) { word += byteAt(str, index + i) << 24 - 8 * i; } } else { for (var _i9 = 0; _i9 < 4; _i9++) { word += byteAt(str, index + _i9) << 8 * _i9; } } return word; } function words32ToByteString(words32) { return words32.reduce(function (str, word) { return str + word32ToByteString(word); }, ''); } function word32ToByteString(word) { var str = ''; for (var i = 0; i < 4; i++) { str += String.fromCharCode(word >>> 8 * (3 - i) & 0xff); } return str; } function byteStringToHexString(str) { var hex = ''; for (var i = 0; i < str.length; i++) { var b = byteAt(str, i); hex += (b >>> 4).toString(16) + (b & 0x0f).toString(16); } return hex.toLowerCase(); } // based on http://www.danvk.org/hex2dec.html (JS can not handle more than 56b) function byteStringToDecString(str) { var decimal = ''; var toThePower = '1'; for (var i = str.length - 1; i >= 0; i--) { decimal = addBigInt(decimal, numberTimesBigInt(byteAt(str, i), toThePower)); toThePower = numberTimesBigInt(256, toThePower); } return decimal.split('').reverse().join(''); } // x and y decimal, lowest significant digit first function addBigInt(x, y) { var sum = ''; var len = Math.max(x.length, y.length); for (var i = 0, carry = 0; i < len || carry; i++) { var tmpSum = carry + +(x[i] || 0) + +(y[i] || 0); if (tmpSum >= 10) { carry = 1; sum += tmpSum - 10; } else { carry = 0; sum += tmpSum; } } return sum; } function numberTimesBigInt(num, b) { var product = ''; var 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 */ var Serializer = /*#__PURE__*/function () { function Serializer() { _classCallCheck(this, Serializer); } _createClass2(Serializer, [{ key: "createNameMapper", // Creates a name mapper, see `PlaceholderMapper` // Returning `null` means that no name mapping is used. value: function createNameMapper(message) { return null; } }]); return Serializer; }(); /** * A simple mapper that take a function to transform an internal name to a public name */ var SimplePlaceholderMapper = /*#__PURE__*/function (_RecurseVisitor) { _inherits(SimplePlaceholderMapper, _RecurseVisitor); var _super53 = _createSuper(SimplePlaceholderMapper); // create a mapping from the message function SimplePlaceholderMapper(message, mapName) { var _this97; _classCallCheck(this, SimplePlaceholderMapper); _this97 = _super53.call(this); _this97.mapName = mapName; _this97.internalToPublic = {}; _this97.publicToNextId = {}; _this97.publicToInternal = {}; message.nodes.forEach(function (node) { return node.visit(_assertThisInitialized(_this97)); }); return _this97; } _createClass2(SimplePlaceholderMapper, [{ key: "toPublicName", value: function toPublicName(internalName) { return this.internalToPublic.hasOwnProperty(internalName) ? this.internalToPublic[internalName] : null; } }, { key: "toInternalName", value: function toInternalName(publicName) { return this.publicToInternal.hasOwnProperty(publicName) ? this.publicToInternal[publicName] : null; } }, { key: "visitText", value: function visitText(text, context) { return null; } }, { key: "visitTagPlaceholder", value: function visitTagPlaceholder(ph, context) { this.visitPlaceholderName(ph.startName); _get(_getPrototypeOf(SimplePlaceholderMapper.prototype), "visitTagPlaceholder", this).call(this, ph, context); this.visitPlaceholderName(ph.closeName); } }, { key: "visitPlaceholder", value: function visitPlaceholder(ph, context) { this.visitPlaceholderName(ph.name); } }, { key: "visitIcuPlaceholder", value: function visitIcuPlaceholder(ph, context) { this.visitPlaceholderName(ph.name); } // XMB placeholders could only contains A-Z, 0-9 and _ }, { key: "visitPlaceholderName", value: function visitPlaceholderName(internalName) { if (!internalName || this.internalToPublic.hasOwnProperty(internalName)) { return; } var publicName = this.mapName(internalName); if (this.publicToInternal.hasOwnProperty(publicName)) { // Create a new XMB when it has already been used var nextId = this.publicToNextId[publicName]; this.publicToNextId[publicName] = nextId + 1; publicName = "".concat(publicName, "_").concat(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 = /*#__PURE__*/function () { function _Visitor() { _classCallCheck(this, _Visitor); } _createClass2(_Visitor, [{ key: "visitTag", value: function visitTag(tag) { var _this98 = this; var strAttrs = this._serializeAttributes(tag.attrs); if (tag.children.length == 0) { return "<".concat(tag.name).concat(strAttrs, "/>"); } var strChildren = tag.children.map(function (node) { return node.visit(_this98); }); return "<".concat(tag.name).concat(strAttrs, ">").concat(strChildren.join(''), "</").concat(tag.name, ">"); } }, { key: "visitText", value: function visitText(text) { return text.value; } }, { key: "visitDeclaration", value: function visitDeclaration(decl) { return "<?xml".concat(this._serializeAttributes(decl.attrs), " ?>"); } }, { key: "_serializeAttributes", value: function _serializeAttributes(attrs) { var strAttrs = Object.keys(attrs).map(function (name) { return "".concat(name, "=\"").concat(attrs[name], "\""); }).join(' '); return strAttrs.length > 0 ? ' ' + strAttrs : ''; } }, { key: "visitDoctype", value: function visitDoctype(doctype) { return "<!DOCTYPE ".concat(doctype.rootTag, " [\n").concat(doctype.dtd, "\n]>"); } }]); return _Visitor; }(); var _visitor = new _Visitor(); function serialize(nodes) { return nodes.map(function (node) { return node.visit(_visitor); }).join(''); } var Declaration = /*#__PURE__*/function () { function Declaration(unescapedAttrs) { var _this99 = this; _classCallCheck(this, Declaration); this.attrs = {}; Object.keys(unescapedAttrs).forEach(function (k) { _this99.attrs[k] = escapeXml(unescapedAttrs[k]); }); } _createClass2(Declaration, [{ key: "visit", value: function visit(visitor) { return visitor.visitDeclaration(this); } }]); return Declaration; }(); var Doctype = /*#__PURE__*/function () { function Doctype(rootTag, dtd) { _classCallCheck(this, Doctype); this.rootTag = rootTag; this.dtd = dtd; } _createClass2(Doctype, [{ key: "visit", value: function visit(visitor) { return visitor.visitDoctype(this); } }]); return Doctype; }(); var Tag = /*#__PURE__*/function () { function Tag(name) { var _this100 = this; var unescapedAttrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var children = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; _classCallCheck(this, Tag); this.name = name; this.children = children; this.attrs = {}; Object.keys(unescapedAttrs).forEach(function (k) { _this100.attrs[k] = escapeXml(unescapedAttrs[k]); }); } _createClass2(Tag, [{ key: "visit", value: function visit(visitor) { return visitor.visitTag(this); } }]); return Tag; }(); var Text$2 = /*#__PURE__*/function () { function Text$2(unescapedValue) { _classCallCheck(this, Text$2); this.value = escapeXml(unescapedValue); } _createClass2(Text$2, [{ key: "visit", value: function visit(visitor) { return visitor.visitText(this); } }]); return Text$2; }(); var CR = /*#__PURE__*/function (_Text$) { _inherits(CR, _Text$); var _super54 = _createSuper(CR); function CR() { var ws = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; _classCallCheck(this, CR); return _super54.call(this, "\n".concat(new Array(ws + 1).join(' '))); } return CR; }(Text$2); var _ESCAPED_CHARS = [[/&/g, '&'], [/"/g, '"'], [/'/g, '''], [/</g, '<'], [/>/g, '>']]; // Escape `_ESCAPED_CHARS` characters in the given text with encoded entities 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 _MESSAGES_TAG = 'messagebundle'; var _MESSAGE_TAG = 'msg'; var _PLACEHOLDER_TAG = 'ph'; var _EXAMPLE_TAG = 'ex'; var _SOURCE_TAG = 'source'; var _DOCTYPE = "<!ELEMENT messagebundle (msg)*>\n<!ATTLIST messagebundle class CDATA #IMPLIED>\n\n<!ELEMENT msg (#PCDATA|ph|source)*>\n<!ATTLIST msg id CDATA #IMPLIED>\n<!ATTLIST msg seq CDATA #IMPLIED>\n<!ATTLIST msg name CDATA #IMPLIED>\n<!ATTLIST msg desc CDATA #IMPLIED>\n<!ATTLIST msg meaning CDATA #IMPLIED>\n<!ATTLIST msg obsolete (obsolete) #IMPLIED>\n<!ATTLIST msg xml:space (default|preserve) \"default\">\n<!ATTLIST msg is_hidden CDATA #IMPLIED>\n\n<!ELEMENT source (#PCDATA)>\n\n<!ELEMENT ph (#PCDATA|ex)*>\n<!ATTLIST ph name CDATA #REQUIRED>\n\n<!ELEMENT ex (#PCDATA)>"; var Xmb = /*#__PURE__*/function (_Serializer) { _inherits(Xmb, _Serializer); var _super55 = _createSuper(Xmb); function Xmb() { _classCallCheck(this, Xmb); return _super55.apply(this, arguments); } _createClass2(Xmb, [{ key: "write", value: function write(messages, locale) { var exampleVisitor = new ExampleVisitor(); var visitor = new _Visitor$1(); var rootNode = new Tag(_MESSAGES_TAG); messages.forEach(function (message) { var attrs = { id: message.id }; if (message.description) { attrs['desc'] = message.description; } if (message.meaning) { attrs['meaning'] = message.meaning; } var sourceTags = []; message.sources.forEach(function (source) { sourceTags.push(new Tag(_SOURCE_TAG, {}, [new Text$2("".concat(source.filePath, ":").concat(source.startLine).concat(source.endLine !== source.startLine ? ',' + source.endLine : ''))])); }); rootNode.children.push(new CR(2), new Tag(_MESSAGE_TAG, attrs, [].concat(sourceTags, _toConsumableArray(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()]); } }, { key: "load", value: function load(content, url) { throw new Error('Unsupported'); } }, { key: "digest", value: function digest(message) { return digest$1(message); } }, { key: "createNameMapper", value: function createNameMapper(message) { return new SimplePlaceholderMapper(message, toPublicName); } }]); return Xmb; }(Serializer); var _Visitor$1 = /*#__PURE__*/function () { function _Visitor$1() { _classCallCheck(this, _Visitor$1); } _createClass2(_Visitor$1, [{ key: "visitText", value: function visitText(text, context) { return [new Text$2(text.value)]; } }, { key: "visitContainer", value: function visitContainer(container, context) { var _this101 = this; var nodes = []; container.children.forEach(function (node) { return nodes.push.apply(nodes, _toConsumableArray(node.visit(_this101))); }); return nodes; } }, { key: "visitIcu", value: function visitIcu(icu, context) { var _this102 = this; var nodes = [new Text$2("{".concat(icu.expressionPlaceholder, ", ").concat(icu.type, ", "))]; Object.keys(icu.cases).forEach(function (c) { nodes.push.apply(nodes, [new Text$2("".concat(c, " {"))].concat(_toConsumableArray(icu.cases[c].visit(_this102)), [new Text$2("} ")])); }); nodes.push(new Text$2("}")); return nodes; } }, { key: "visitTagPlaceholder", value: function visitTagPlaceholder(ph, context) { var startTagAsText = new Text$2("<".concat(ph.tag, ">")); var startEx = new Tag(_EXAMPLE_TAG, {}, [startTagAsText]); // TC requires PH to have a non empty EX, and uses the text node to show the "original" value. var startTagPh = new Tag(_PLACEHOLDER_TAG, { name: ph.startName }, [startEx, startTagAsText]); if (ph.isVoid) { // void tags have no children nor closing tags return [startTagPh]; } var closeTagAsText = new Text$2("</".concat(ph.tag, ">")); var closeEx = new Tag(_EXAMPLE_TAG, {}, [closeTagAsText]); // TC requires PH to have a non empty EX, and uses the text node to show the "original" value. var closeTagPh = new Tag(_PLACEHOLDER_TAG, { name: ph.closeName }, [closeEx, closeTagAsText]); return [startTagPh].concat(_toConsumableArray(this.serialize(ph.children)), [closeTagPh]); } }, { key: "visitPlaceholder", value: function visitPlaceholder(ph, context) { var interpolationAsText = new Text$2("{{".concat(ph.value, "}}")); // Example tag needs to be not-empty for TC. var exTag = new Tag(_EXAMPLE_TAG, {}, [interpolationAsText]); return [// TC requires PH to have a non empty EX, and uses the text node to show the "original" value. new Tag(_PLACEHOLDER_TAG, { name: ph.name }, [exTag, interpolationAsText])]; } }, { key: "visitIcuPlaceholder", value: function visitIcuPlaceholder(ph, context) { var icuExpression = ph.value.expression; var icuType = ph.value.type; var icuCases = Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' '); var icuAsText = new Text$2("{".concat(icuExpression, ", ").concat(icuType, ", ").concat(icuCases, "}")); var exTag = new Tag(_EXAMPLE_TAG, {}, [icuAsText]); return [// TC requires PH to have a non empty EX, and uses the text node to show the "original" value. new Tag(_PLACEHOLDER_TAG, { name: ph.name }, [exTag, icuAsText])]; } }, { key: "serialize", value: function serialize(nodes) { var _ref25, _this103 = this; return (_ref25 = []).concat.apply(_ref25, _toConsumableArray(nodes.map(function (node) { return node.visit(_this103); }))); } }]); return _Visitor$1; }(); function digest$1(message) { return decimalDigest(message); } // TC requires at least one non-empty example on placeholders var ExampleVisitor = /*#__PURE__*/function () { function ExampleVisitor() { _classCallCheck(this, ExampleVisitor); } _createClass2(ExampleVisitor, [{ key: "addDefaultExamples", value: function addDefaultExamples(node) { node.visit(this); return node; } }, { key: "visitTag", value: function visitTag(tag) { var _this104 = this; if (tag.name === _PLACEHOLDER_TAG) { if (!tag.children || tag.children.length == 0) { var exText = new Text$2(tag.attrs['name'] || '...'); tag.children = [new Tag(_EXAMPLE_TAG, {}, [exText])]; } } else if (tag.children) { tag.children.forEach(function (node) { return node.visit(_this104); }); } } }, { key: "visitText", value: function visitText(text) {} }, { key: "visitDeclaration", value: function visitDeclaration(decl) {} }, { key: "visitDoctype", value: function visitDoctype(doctype) {} }]); return ExampleVisitor; }(); // XMB/XTB placeholders can only contain A-Z, 0-9 and _ 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 */ function mapEntry(key, value) { return { key: key, value: value, quoted: false }; } function mapLiteral(obj) { var quoted = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; return literalMap(Object.keys(obj).map(function (key) { return { key: key, quoted: quoted, value: obj[key] }; })); } /** * @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 */ /* Closure variables holding messages must be named `MSG_[A-Z0-9]+` */ var CLOSURE_TRANSLATION_PREFIX = 'MSG_'; /* Prefix for non-`goog.getMsg` i18n-related vars */ var TRANSLATION_PREFIX = 'I18N_'; /** Closure uses `goog.getMsg(message)` to lookup translations */ var GOOG_GET_MSG = 'goog.getMsg'; /** Name of the global variable that is used to determine if we use Closure translations or not */ var NG_I18N_CLOSURE_MODE = 'ngI18nClosureMode'; /** I18n separators for metadata **/ var I18N_MEANING_SEPARATOR = '|'; var I18N_ID_SEPARATOR = '@@'; /** Name of the i18n attributes **/ var I18N_ATTR = 'i18n'; var I18N_ATTR_PREFIX = 'i18n-'; /** Prefix of var expressions used in ICUs */ var I18N_ICU_VAR_PREFIX = 'VAR_'; /** Prefix of ICU expressions for post processing */ var I18N_ICU_MAPPING_PREFIX = 'I18N_EXP_'; /** Placeholder wrapper for i18n expressions **/ var I18N_PLACEHOLDER_SYMBOL = '�'; function i18nTranslationToDeclStmt(variable$1, closureVar, message, meta, params) { var statements = []; // var I18N_X; statements.push(new DeclareVarStmt(variable$1.name, undefined, INFERRED_TYPE, null, variable$1.sourceSpan)); var args = [literal(message)]; if (params && Object.keys(params).length) { args.push(mapLiteral(params, true)); } // Closure JSDoc comments var docStatements = i18nMetaToDocStmt(meta); var thenStatements = docStatements ? [docStatements] : []; var googFnCall = variable(GOOG_GET_MSG).callFn(args); // const MSG_... = goog.getMsg(..); thenStatements.push(closureVar.set(googFnCall).toConstDecl()); // I18N_X = MSG_...; thenStatements.push(new ExpressionStatement(variable$1.set(closureVar))); var localizeFnCall = importExpr(Identifiers$1.i18nLocalize).callFn(args); // I18N_X = i18nLocalize(...); var elseStatements = [new ExpressionStatement(variable$1.set(localizeFnCall))]; // if(ngI18nClosureMode) { ... } else { ... } statements.push(ifStmt(variable(NG_I18N_CLOSURE_MODE), thenStatements, elseStatements)); return statements; } // Converts i18n meta information for a message (id, description, meaning) // to a JsDoc statement formatted as expected by the Closure compiler. function i18nMetaToDocStmt(meta) { var tags = []; if (meta.description) { tags.push({ tagName: "desc" /* Desc */ , text: meta.description }); } if (meta.meaning) { tags.push({ tagName: "meaning" /* Meaning */ , text: meta.meaning }); } return tags.length == 0 ? null : new JSDocCommentStmt(tags); } function isI18nAttribute(name) { return name === I18N_ATTR || name.startsWith(I18N_ATTR_PREFIX); } function isI18nRootNode(meta) { return meta instanceof Message; } function isSingleI18nIcu(meta) { return isI18nRootNode(meta) && meta.nodes.length === 1 && meta.nodes[0] instanceof Icu$1; } function hasI18nAttrs(element) { return element.attrs.some(function (attr) { return isI18nAttribute(attr.name); }); } function metaFromI18nMessage(message) { var id = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return { id: typeof id === 'string' ? id : message.id || '', meaning: message.meaning || '', description: message.description || '' }; } function icuFromI18nMessage(message) { return message.nodes[0]; } function wrapI18nPlaceholder(content) { var contextId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var blockId = contextId > 0 ? ":".concat(contextId) : ''; return "".concat(I18N_PLACEHOLDER_SYMBOL).concat(content).concat(blockId).concat(I18N_PLACEHOLDER_SYMBOL); } function assembleI18nBoundString(strings) { var bindingStartIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var contextId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; if (!strings.length) return ''; var acc = ''; var lastIdx = strings.length - 1; for (var i = 0; i < lastIdx; i++) { acc += "".concat(strings[i]).concat(wrapI18nPlaceholder(bindingStartIndex + i, contextId)); } acc += strings[lastIdx]; return acc; } function getSeqNumberGenerator() { var startsAt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var current = startsAt; return function () { return current++; }; } function placeholdersToParams(placeholders) { var params = {}; placeholders.forEach(function (values, key) { params[key] = literal(values.length > 1 ? "[".concat(values.join('|'), "]") : values[0]); }); return params; } function updatePlaceholderMap(map, name) { var current = map.get(name) || []; for (var _len2 = arguments.length, values = new Array(_len2 > 2 ? _len2 - 2 : 0), _key3 = 2; _key3 < _len2; _key3++) { values[_key3 - 2] = arguments[_key3]; } current.push.apply(current, values); map.set(name, current); } function assembleBoundTextPlaceholders(meta) { var bindingStartIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var contextId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; var startIdx = bindingStartIndex; var placeholders = new Map(); var node = meta instanceof Message ? meta.nodes.find(function (node) { return node instanceof Container; }) : meta; if (node) { node.children.filter(function (child) { return child instanceof Placeholder; }).forEach(function (child, idx) { var content = wrapI18nPlaceholder(startIdx + idx, contextId); updatePlaceholderMap(placeholders, child.name, content); }); } return placeholders; } function findIndex(items, callback) { for (var i = 0; i < items.length; i++) { if (callback(items[i])) { return i; } } return -1; } /** * Parses i18n metas like: * - "@@id", * - "description[@@id]", * - "meaning|description[@@id]" * and returns an object with parsed output. * * @param meta String that represents i18n meta * @returns Object with id, meaning and description fields */ function parseI18nMeta(meta) { var id; var meaning; var description; if (meta) { var idIndex = meta.indexOf(I18N_ID_SEPARATOR); var descIndex = meta.indexOf(I18N_MEANING_SEPARATOR); var meaningAndDesc; var _ref26 = idIndex > -1 ? [meta.slice(0, idIndex), meta.slice(idIndex + 2)] : [meta, '']; var _ref27 = _slicedToArray(_ref26, 2); meaningAndDesc = _ref27[0]; id = _ref27[1]; var _ref28 = descIndex > -1 ? [meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)] : ['', meaningAndDesc]; var _ref29 = _slicedToArray(_ref28, 2); meaning = _ref29[0]; description = _ref29[1]; } return { id: id, meaning: meaning, description: description }; } /** * Converts internal placeholder names to public-facing format * (for example to use in goog.getMsg call). * Example: `START_TAG_DIV_1` is converted to `startTagDiv_1`. * * @param name The placeholder name that should be formatted * @returns Formatted placeholder name */ function formatI18nPlaceholderName(name) { var useCamelCase = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var publicName = toPublicName(name); if (!useCamelCase) { return publicName; } var chunks = publicName.split('_'); if (chunks.length === 1) { // if no "_" found - just lowercase the value return name.toLowerCase(); } var postfix; // eject last element if it's a number if (/^\d+$/.test(chunks[chunks.length - 1])) { postfix = chunks.pop(); } var raw = chunks.shift().toLowerCase(); if (chunks.length) { raw += chunks.map(function (c) { return c.charAt(0).toUpperCase() + c.slice(1).toLowerCase(); }).join(''); } return postfix ? "".concat(raw, "_").concat(postfix) : raw; } /** * Generates a prefix for translation const name. * * @param extra Additional local prefix that should be injected into translation var name * @returns Complete translation const prefix */ function getTranslationConstPrefix(extra) { return "".concat(CLOSURE_TRANSLATION_PREFIX).concat(extra).toUpperCase(); } /** * Generates translation declaration statements. * * @param variable Translation value reference * @param closureVar Variable for Closure `goog.getMsg` calls * @param message Text message to be translated * @param meta Object that contains meta information (id, meaning and description) * @param params Object with placeholders key-value pairs * @param transformFn Optional transformation (post processing) function reference * @returns Array of Statements that represent a given translation */ function getTranslationDeclStmts(variable, closureVar, message, meta) { var params = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; var transformFn = arguments.length > 5 ? arguments[5] : undefined; var statements = []; statements.push.apply(statements, _toConsumableArray(i18nTranslationToDeclStmt(variable, closureVar, message, meta, params))); if (transformFn) { statements.push(new ExpressionStatement(variable.set(transformFn(variable)))); } return statements; } /** * @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 */ /** * Checks whether an object key contains potentially unsafe chars, thus the key should be wrapped in * quotes. Note: we do not wrap all keys into quotes, as it may have impact on minification and may * bot work in some cases when object keys are mangled by minifier. * * TODO(FW-1136): this is a temporary solution, we need to come up with a better way of working with * inputs that contain potentially unsafe chars. */ var UNSAFE_OBJECT_KEY_NAME_REGEXP = /[-.]/; /** Name of the temporary to use during data binding */ var TEMPORARY_NAME = '_t'; /** Name of the context parameter passed into a template function */ var CONTEXT_NAME = 'ctx'; /** Name of the RenderFlag passed into a template function */ var RENDER_FLAGS = 'rf'; /** The prefix reference variables */ var REFERENCE_PREFIX = '_r'; /** The name of the implicit context reference */ var IMPLICIT_REFERENCE = '$implicit'; /** Non bindable attribute name **/ var NON_BINDABLE_ATTR = 'ngNonBindable'; /** * Creates an allocator for a temporary variable. * * A variable declaration is added to the statements the first time the allocator is invoked. */ function temporaryAllocator(statements, name) { var temp = null; return function () { if (!temp) { statements.push(new DeclareVarStmt(TEMPORARY_NAME, undefined, DYNAMIC_TYPE)); temp = variable(name); } return temp; }; } function unsupported(feature) { if (this) { throw new Error("Builder ".concat(this.constructor.name, " doesn't support ").concat(feature, " yet")); } throw new Error("Feature ".concat(feature, " is not supported yet")); } function invalid$1(arg) { throw new Error("Invalid state: Visitor ".concat(this.constructor.name, " doesn't handle ").concat(arg.constructor.name)); } function asLiteral(value) { if (Array.isArray(value)) { return literalArr(value.map(asLiteral)); } return literal(value, INFERRED_TYPE); } function conditionallyCreateMapObjectLiteral(keys, keepDeclared) { if (Object.getOwnPropertyNames(keys).length > 0) { return mapToExpression(keys, keepDeclared); } return null; } function mapToExpression(map, keepDeclared) { return literalMap(Object.getOwnPropertyNames(map).map(function (key) { // canonical syntax: `dirProp: publicProp` // if there is no `:`, use dirProp = elProp var value = map[key]; var declaredName; var publicName; var minifiedName; if (Array.isArray(value)) { var _value3 = _slicedToArray(value, 2); publicName = _value3[0]; declaredName = _value3[1]; } else { var _splitAtColon = splitAtColon(key, [key, value]); var _splitAtColon2 = _slicedToArray(_splitAtColon, 2); declaredName = _splitAtColon2[0]; publicName = _splitAtColon2[1]; } minifiedName = declaredName; return { key: minifiedName, // put quotes around keys that contain potentially unsafe characters quoted: UNSAFE_OBJECT_KEY_NAME_REGEXP.test(minifiedName), value: keepDeclared && publicName !== declaredName ? literalArr([asLiteral(publicName), asLiteral(declaredName)]) : asLiteral(publicName) }; })); } /** * Remove trailing null nodes as they are implied. */ function trimTrailingNulls(parameters) { while (isNull(parameters[parameters.length - 1])) { parameters.pop(); } return parameters; } function getQueryPredicate(query, constantPool) { if (Array.isArray(query.predicate)) { var predicate = []; query.predicate.forEach(function (selector) { // Each item in predicates array may contain strings with comma-separated refs // (for ex. 'ref, ref1, ..., refN'), thus we extract individual refs and store them // as separate array entities var selectors = selector.split(',').map(function (token) { return literal(token.trim()); }); predicate.push.apply(predicate, _toConsumableArray(selectors)); }); return constantPool.getConstLiteral(literalArr(predicate), true); } else { return query.predicate; } } function noop() {} var DefinitionMap = /*#__PURE__*/function () { function DefinitionMap() { _classCallCheck(this, DefinitionMap); this.values = []; } _createClass2(DefinitionMap, [{ key: "set", value: function set(key, value) { if (value) { this.values.push({ key: key, value: value, quoted: false }); } } }, { key: "toLiteralMap", value: function toLiteralMap() { return literalMap(this.values); } }]); return DefinitionMap; }(); /** * Extract a map of properties to values for a given element or template node, which can be used * by the directive matching machinery. * * @param elOrTpl the element or template in question * @return an object set up for directive matching. For attributes on the element/template, this * object maps a property name to its (static) value. For any bindings, this map simply maps the * property name to an empty string. */ function getAttrsForDirectiveMatching(elOrTpl) { var attributesMap = {}; if (elOrTpl instanceof Template && elOrTpl.tagName !== 'ng-template') { elOrTpl.templateAttrs.forEach(function (a) { return attributesMap[a.name] = ''; }); } else { elOrTpl.attributes.forEach(function (a) { if (!isI18nAttribute(a.name)) { attributesMap[a.name] = a.value; } }); elOrTpl.inputs.forEach(function (i) { attributesMap[i.name] = ''; }); elOrTpl.outputs.forEach(function (o) { attributesMap[o.name] = ''; }); } return attributesMap; } /** Returns a call expression to a chained instruction, e.g. `property(params[0])(params[1])`. */ function chainedInstruction(reference, calls, span) { var expression = importExpr(reference, null, span); if (calls.length > 0) { for (var i = 0; i < calls.length; i++) { expression = expression.callFn(calls[i], span); } } else { // Add a blank invocation, in case the `calls` array is empty. expression = expression.callFn([], span); } return expression; } /** * Gets the number of arguments expected to be passed to a generated instruction in the case of * interpolation instructions. * @param interpolation An interpolation ast */ function getInterpolationArgsLength(interpolation) { var expressions = interpolation.expressions, strings = interpolation.strings; if (expressions.length === 1 && strings.length === 2 && strings[0] === '' && strings[1] === '') { // If the interpolation has one interpolated value, but the prefix and suffix are both empty // strings, we only pass one argument, to a special instruction like `propertyInterpolate` or // `textInterpolate`. return 1; } else { return expressions.length + strings.length; } } /** * @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 R3FactoryDelegateType; (function (R3FactoryDelegateType) { R3FactoryDelegateType[R3FactoryDelegateType["Class"] = 0] = "Class"; R3FactoryDelegateType[R3FactoryDelegateType["Function"] = 1] = "Function"; R3FactoryDelegateType[R3FactoryDelegateType["Factory"] = 2] = "Factory"; })(R3FactoryDelegateType || (R3FactoryDelegateType = {})); /** * Resolved type of a dependency. * * Occasionally, dependencies will have special significance which is known statically. In that * case the `R3ResolvedDependencyType` informs the factory generator that a particular dependency * should be generated specially (usually by calling a special injection function instead of the * standard one). */ var R3ResolvedDependencyType; (function (R3ResolvedDependencyType) { /** * A normal token dependency. */ R3ResolvedDependencyType[R3ResolvedDependencyType["Token"] = 0] = "Token"; /** * The dependency is for an attribute. * * The token expression is a string representing the attribute name. */ R3ResolvedDependencyType[R3ResolvedDependencyType["Attribute"] = 1] = "Attribute"; /** * Injecting the `ChangeDetectorRef` token. Needs special handling when injected into a pipe. */ R3ResolvedDependencyType[R3ResolvedDependencyType["ChangeDetectorRef"] = 2] = "ChangeDetectorRef"; })(R3ResolvedDependencyType || (R3ResolvedDependencyType = {})); /** * Construct a factory function expression for the given `R3FactoryMetadata`. */ function compileFactoryFunction(meta) { var isPipe = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var t = variable('t'); var statements = []; // The type to instantiate via constructor invocation. If there is no delegated factory, meaning // this type is always created by constructor invocation, then this is the type-to-create // parameter provided by the user (t) if specified, or the current type if not. If there is a // delegated factory (which is used to create the current type) then this is only the type-to- // create parameter (t). var typeForCtor = !isDelegatedMetadata(meta) ? new BinaryOperatorExpr(BinaryOperator.Or, t, meta.type) : t; var ctorExpr = null; if (meta.deps !== null) { // There is a constructor (either explicitly or implicitly defined). if (meta.deps !== 'invalid') { ctorExpr = new InstantiateExpr(typeForCtor, injectDependencies(meta.deps, meta.injectFn, isPipe)); } } else { var baseFactory = variable("\u0275".concat(meta.name, "_BaseFactory")); var getInheritedFactory = importExpr(Identifiers$1.getInheritedFactory); var baseFactoryStmt = baseFactory.set(getInheritedFactory.callFn([meta.type])).toDeclStmt(INFERRED_TYPE, [StmtModifier.Exported, StmtModifier.Final]); statements.push(baseFactoryStmt); // There is no constructor, use the base class' factory to construct typeForCtor. ctorExpr = baseFactory.callFn([typeForCtor]); } var ctorExprFinal = ctorExpr; var body = []; var retExpr = null; function makeConditionalFactory(nonCtorExpr) { var r = variable('r'); body.push(r.set(NULL_EXPR).toDeclStmt()); var ctorStmt = null; if (ctorExprFinal !== null) { ctorStmt = r.set(ctorExprFinal).toStmt(); } else { ctorStmt = makeErrorStmt(meta.name); } body.push(ifStmt(t, [ctorStmt], [r.set(nonCtorExpr).toStmt()])); return r; } if (isDelegatedMetadata(meta) && meta.delegateType === R3FactoryDelegateType.Factory) { var delegateFactory = variable("\u0275".concat(meta.name, "_BaseFactory")); var getFactoryOf = importExpr(Identifiers$1.getFactoryOf); if (meta.delegate.isEquivalent(meta.type)) { throw new Error("Illegal state: compiling factory that delegates to itself"); } var delegateFactoryStmt = delegateFactory.set(getFactoryOf.callFn([meta.delegate])).toDeclStmt(INFERRED_TYPE, [StmtModifier.Exported, StmtModifier.Final]); statements.push(delegateFactoryStmt); retExpr = makeConditionalFactory(delegateFactory.callFn([])); } else if (isDelegatedMetadata(meta)) { // This type is created with a delegated factory. If a type parameter is not specified, call // the factory instead. var delegateArgs = injectDependencies(meta.delegateDeps, meta.injectFn, isPipe); // Either call `new delegate(...)` or `delegate(...)` depending on meta.useNewForDelegate. var factoryExpr = new (meta.delegateType === R3FactoryDelegateType.Class ? InstantiateExpr : InvokeFunctionExpr)(meta.delegate, delegateArgs); retExpr = makeConditionalFactory(factoryExpr); } else if (isExpressionFactoryMetadata(meta)) { // TODO(alxhub): decide whether to lower the value here or in the caller retExpr = makeConditionalFactory(meta.expression); } else { retExpr = ctorExpr; } if (retExpr !== null) { body.push(new ReturnStatement(retExpr)); } else { body.push(makeErrorStmt(meta.name)); } return { factory: fn([new FnParam('t', DYNAMIC_TYPE)], body, INFERRED_TYPE, undefined, "".concat(meta.name, "_Factory")), statements: statements }; } function injectDependencies(deps, injectFn, isPipe) { return deps.map(function (dep) { return compileInjectDependency(dep, injectFn, isPipe); }); } function compileInjectDependency(dep, injectFn, isPipe) { // Interpret the dependency according to its resolved type. switch (dep.resolved) { case R3ResolvedDependencyType.Token: case R3ResolvedDependencyType.ChangeDetectorRef: // Build up the injection flags according to the metadata. var flags = 0 /* Default */ | (dep.self ? 2 /* Self */ : 0) | (dep.skipSelf ? 4 /* SkipSelf */ : 0) | (dep.host ? 1 /* Host */ : 0) | (dep.optional ? 8 /* Optional */ : 0); // If this dependency is optional or otherwise has non-default flags, then additional // parameters describing how to inject the dependency must be passed to the inject function // that's being used. var flagsParam = flags !== 0 /* Default */ || dep.optional ? literal(flags) : null; // We have a separate instruction for injecting ChangeDetectorRef into a pipe. if (isPipe && dep.resolved === R3ResolvedDependencyType.ChangeDetectorRef) { return importExpr(Identifiers$1.injectPipeChangeDetectorRef).callFn(flagsParam ? [flagsParam] : []); } // Build up the arguments to the injectFn call. var injectArgs = [dep.token]; if (flagsParam) { injectArgs.push(flagsParam); } return importExpr(injectFn).callFn(injectArgs); case R3ResolvedDependencyType.Attribute: // In the case of attributes, the attribute name in question is given as the token. return importExpr(Identifiers$1.injectAttribute).callFn([dep.token]); default: return unsupported("Unknown R3ResolvedDependencyType: ".concat(R3ResolvedDependencyType[dep.resolved])); } } /** * A helper function useful for extracting `R3DependencyMetadata` from a Render2 * `CompileTypeMetadata` instance. */ function dependenciesFromGlobalMetadata(type, outputCtx, reflector) { // Use the `CompileReflector` to look up references to some well-known Angular types. These will // be compared with the token to statically determine whether the token has significance to // Angular, and set the correct `R3ResolvedDependencyType` as a result. var injectorRef = reflector.resolveExternalReference(Identifiers.Injector); // Iterate through the type's DI dependencies and produce `R3DependencyMetadata` for each of them. var deps = []; var _iterator7 = _createForOfIteratorHelper(type.diDeps), _step7; try { for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) { var dependency = _step7.value; if (dependency.token) { var tokenRef = tokenReference(dependency.token); var resolved = dependency.isAttribute ? R3ResolvedDependencyType.Attribute : R3ResolvedDependencyType.Token; // In the case of most dependencies, the token will be a reference to a type. Sometimes, // however, it can be a string, in the case of older Angular code or @Attribute injection. var token = tokenRef instanceof StaticSymbol ? outputCtx.importExpr(tokenRef) : literal(tokenRef); // Construct the dependency. deps.push({ token: token, resolved: resolved, host: !!dependency.isHost, optional: !!dependency.isOptional, self: !!dependency.isSelf, skipSelf: !!dependency.isSkipSelf }); } else { unsupported('dependency without a token'); } } } catch (err) { _iterator7.e(err); } finally { _iterator7.f(); } return deps; } function makeErrorStmt(name) { return new ThrowStmt(new InstantiateExpr(new ReadVarExpr('Error'), [literal("".concat(name, " has a constructor which is not compatible with Dependency Injection. It should probably not be @Injectable()."))])); } function isDelegatedMetadata(meta) { return meta.delegateType !== undefined; } function isExpressionFactoryMetadata(meta) { return meta.expression !== undefined; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Convert an object map with `Expression` values into a `LiteralMapExpr`. */ function mapToMapExpression(map) { var result = Object.keys(map).map(function (key) { return { key: key, value: map[key], quoted: false }; }); return literalMap(result); } /** * Convert metadata into an `Expression` in the given `OutputContext`. * * This operation will handle arrays, references to symbols, or literal `null` or `undefined`. */ function convertMetaToOutput(meta, ctx) { if (Array.isArray(meta)) { return literalArr(meta.map(function (entry) { return convertMetaToOutput(entry, ctx); })); } if (meta instanceof StaticSymbol) { return ctx.importExpr(meta); } if (meta == null) { return literal(meta); } throw new Error("Internal error: Unsupported or unknown metadata: ".concat(meta)); } function typeWithParameters(type, numParams) { var params = null; if (numParams > 0) { params = []; for (var i = 0; i < numParams; i++) { params.push(DYNAMIC_TYPE); } } return expressionType(type, null, params); } var ANIMATE_SYMBOL_PREFIX = '@'; function prepareSyntheticPropertyName(name) { return "".concat(ANIMATE_SYMBOL_PREFIX).concat(name); } function prepareSyntheticListenerName(name, phase) { return "".concat(ANIMATE_SYMBOL_PREFIX).concat(name, ".").concat(phase); } function isSyntheticPropertyOrListener(name) { return name.charAt(0) == ANIMATE_SYMBOL_PREFIX; } function getSyntheticPropertyName(name) { // this will strip out listener phase values... // @foo.start => @foo var i = name.indexOf('.'); name = i > 0 ? name.substring(0, i) : name; if (name.charAt(0) !== ANIMATE_SYMBOL_PREFIX) { name = ANIMATE_SYMBOL_PREFIX + name; } return name; } function prepareSyntheticListenerFunctionName(name, phase) { return "animation_".concat(name, "_").concat(phase); } /** * @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 */ function _compileInjectable(meta) { var result = null; var factoryMeta = { name: meta.name, type: meta.type, deps: meta.ctorDeps, injectFn: Identifiers.inject }; if (meta.useClass !== undefined) { // meta.useClass has two modes of operation. Either deps are specified, in which case `new` is // used to instantiate the class with dependencies injected, or deps are not specified and // the factory of the class is used to instantiate it. // // A special case exists for useClass: Type where Type is the injectable type itself and no // deps are specified, in which case 'useClass' is effectively ignored. var useClassOnSelf = meta.useClass.isEquivalent(meta.type); var deps = undefined; if (meta.userDeps !== undefined) { deps = meta.userDeps; } if (deps !== undefined) { // factory: () => new meta.useClass(...deps) result = compileFactoryFunction(Object.assign({}, factoryMeta, { delegate: meta.useClass, delegateDeps: deps, delegateType: R3FactoryDelegateType.Class })); } else if (useClassOnSelf) { result = compileFactoryFunction(factoryMeta); } else { result = compileFactoryFunction(Object.assign({}, factoryMeta, { delegate: meta.useClass, delegateType: R3FactoryDelegateType.Factory })); } } else if (meta.useFactory !== undefined) { result = compileFactoryFunction(Object.assign({}, factoryMeta, { delegate: meta.useFactory, delegateDeps: meta.userDeps || [], delegateType: R3FactoryDelegateType.Function })); } else if (meta.useValue !== undefined) { // Note: it's safe to use `meta.useValue` instead of the `USE_VALUE in meta` check used for // client code because meta.useValue is an Expression which will be defined even if the actual // value is undefined. result = compileFactoryFunction(Object.assign({}, factoryMeta, { expression: meta.useValue })); } else if (meta.useExisting !== undefined) { // useExisting is an `inject` call on the existing token. result = compileFactoryFunction(Object.assign({}, factoryMeta, { expression: importExpr(Identifiers.inject).callFn([meta.useExisting]) })); } else { result = compileFactoryFunction(factoryMeta); } var token = meta.type; var providedIn = meta.providedIn; var expression = importExpr(Identifiers.ɵɵdefineInjectable).callFn([mapToMapExpression({ token: token, factory: result.factory, providedIn: providedIn })]); var type = new ExpressionType(importExpr(Identifiers.InjectableDef, [typeWithParameters(meta.type, meta.typeArgumentCount)])); return { expression: expression, type: type, statements: result.statements }; } /** * @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 */ function assertArrayOfStrings(identifier, value) { if (value == null) { return; } if (!Array.isArray(value)) { throw new Error("Expected '".concat(identifier, "' to be an array of strings.")); } for (var i = 0; i < value.length; i += 1) { if (typeof value[i] !== 'string') { throw new Error("Expected '".concat(identifier, "' to be an array of strings.")); } } } var UNUSABLE_INTERPOLATION_REGEXPS = [/^\s*$/, /[<>]/, /^[{}]$/, /&(#|[a-z])/i, /^\/\//]; function assertInterpolationSymbols(identifier, value) { if (value != null && !(Array.isArray(value) && value.length == 2)) { throw new Error("Expected '".concat(identifier, "' to be an array, [start, end].")); } else if (value != null) { var start = value[0]; var end = value[1]; // Check for unusable interpolation symbols UNUSABLE_INTERPOLATION_REGEXPS.forEach(function (regexp) { if (regexp.test(start) || regexp.test(end)) { throw new Error("['".concat(start, "', '").concat(end, "'] 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 = /*#__PURE__*/function () { function InterpolationConfig(start, end) { _classCallCheck(this, InterpolationConfig); this.start = start; this.end = end; } _createClass2(InterpolationConfig, null, [{ key: "fromArray", value: function fromArray(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 */ // https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit var VERSION = 3; var JS_B64_PREFIX = '# sourceMappingURL=data:application/json;base64,'; var SourceMapGenerator = /*#__PURE__*/function () { function SourceMapGenerator() { var file = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; _classCallCheck(this, SourceMapGenerator); this.file = file; this.sourcesContent = new Map(); this.lines = []; this.lastCol0 = 0; this.hasMappings = false; } // The content is `null` when the content is expected to be loaded using the URL _createClass2(SourceMapGenerator, [{ key: "addSource", value: function addSource(url) { var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; if (!this.sourcesContent.has(url)) { this.sourcesContent.set(url, content); } return this; } }, { key: "addLine", value: function addLine() { this.lines.push([]); this.lastCol0 = 0; return this; } }, { key: "addMapping", value: function addMapping(col0, sourceUrl, sourceLine0, sourceCol0) { if (!this.currentLine) { throw new Error("A line must be added before mappings can be added"); } if (sourceUrl != null && !this.sourcesContent.has(sourceUrl)) { throw new Error("Unknown source file \"".concat(sourceUrl, "\"")); } if (col0 == null) { throw new Error("The column in the generated code must be provided"); } if (col0 < this.lastCol0) { throw new Error("Mapping should be added in output order"); } if (sourceUrl && (sourceLine0 == null || sourceCol0 == null)) { throw new Error("The source location must be provided when a source url is provided"); } this.hasMappings = true; this.lastCol0 = col0; this.currentLine.push({ col0: col0, sourceUrl: sourceUrl, sourceLine0: sourceLine0, sourceCol0: sourceCol0 }); return this; } }, { key: "toJSON", value: function toJSON() { var _this105 = this; if (!this.hasMappings) { return null; } var sourcesIndex = new Map(); var sources = []; var sourcesContent = []; Array.from(this.sourcesContent.keys()).forEach(function (url, i) { sourcesIndex.set(url, i); sources.push(url); sourcesContent.push(_this105.sourcesContent.get(url) || null); }); var mappings = ''; var lastCol0 = 0; var lastSourceIndex = 0; var lastSourceLine0 = 0; var lastSourceCol0 = 0; this.lines.forEach(function (segments) { lastCol0 = 0; mappings += segments.map(function (segment) { // zero-based starting column of the line in the generated code var segAsStr = toBase64VLQ(segment.col0 - lastCol0); lastCol0 = segment.col0; if (segment.sourceUrl != null) { // zero-based index into the “sources” list segAsStr += toBase64VLQ(sourcesIndex.get(segment.sourceUrl) - lastSourceIndex); lastSourceIndex = sourcesIndex.get(segment.sourceUrl); // the zero-based starting line in the original source segAsStr += toBase64VLQ(segment.sourceLine0 - lastSourceLine0); lastSourceLine0 = segment.sourceLine0; // the zero-based starting column in the original source segAsStr += toBase64VLQ(segment.sourceCol0 - lastSourceCol0); lastSourceCol0 = segment.sourceCol0; } return segAsStr; }).join(','); mappings += ';'; }); mappings = mappings.slice(0, -1); return { 'file': this.file || '', 'version': VERSION, 'sourceRoot': '', 'sources': sources, 'sourcesContent': sourcesContent, 'mappings': mappings }; } }, { key: "toJsComment", value: function toJsComment() { return this.hasMappings ? '//' + JS_B64_PREFIX + toBase64String(JSON.stringify(this, null, 0)) : ''; } }, { key: "currentLine", get: function get() { return this.lines.slice(-1)[0]; } }]); return SourceMapGenerator; }(); function toBase64String(value) { var b64 = ''; value = utf8Encode(value); for (var i = 0; i < value.length;) { var i1 = value.charCodeAt(i++); var i2 = value.charCodeAt(i++); var i3 = value.charCodeAt(i++); b64 += toBase64Digit(i1 >> 2); b64 += toBase64Digit((i1 & 3) << 4 | (isNaN(i2) ? 0 : i2 >> 4)); b64 += isNaN(i2) ? '=' : toBase64Digit((i2 & 15) << 2 | i3 >> 6); b64 += isNaN(i2) || isNaN(i3) ? '=' : toBase64Digit(i3 & 63); } return b64; } function toBase64VLQ(value) { value = value < 0 ? (-value << 1) + 1 : value << 1; var out = ''; do { var digit = value & 31; value = value >> 5; if (value > 0) { digit = digit | 32; } out += toBase64Digit(digit); } while (value > 0); return out; } var B64_DIGITS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; function toBase64Digit(value) { if (value < 0 || value >= 64) { throw new Error("Can only encode value in the range [0, 63]"); } return B64_DIGITS[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 _SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\r|\$/g; var _LEGAL_IDENTIFIER_RE = /^[$A-Z_][0-9A-Z_$]*$/i; var _INDENT_WITH = ' '; var CATCH_ERROR_VAR$1 = variable('error', null, null); var CATCH_STACK_VAR$1 = variable('stack', null, null); var _EmittedLine = function _EmittedLine(indent) { _classCallCheck(this, _EmittedLine); this.indent = indent; this.partsLength = 0; this.parts = []; this.srcSpans = []; }; var EmitterVisitorContext = /*#__PURE__*/function () { function EmitterVisitorContext(_indent) { _classCallCheck(this, EmitterVisitorContext); this._indent = _indent; this._classes = []; this._preambleLineCount = 0; this._lines = [new _EmittedLine(_indent)]; } _createClass2(EmitterVisitorContext, [{ key: "println", value: function println(from) { var lastPart = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; this.print(from || null, lastPart, true); } }, { key: "lineIsEmpty", value: function lineIsEmpty() { return this._currentLine.parts.length === 0; } }, { key: "lineLength", value: function lineLength() { return this._currentLine.indent * _INDENT_WITH.length + this._currentLine.partsLength; } }, { key: "print", value: function print(from, part) { var newLine = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; if (part.length > 0) { this._currentLine.parts.push(part); this._currentLine.partsLength += part.length; this._currentLine.srcSpans.push(from && from.sourceSpan || null); } if (newLine) { this._lines.push(new _EmittedLine(this._indent)); } } }, { key: "removeEmptyLastLine", value: function removeEmptyLastLine() { if (this.lineIsEmpty()) { this._lines.pop(); } } }, { key: "incIndent", value: function incIndent() { this._indent++; if (this.lineIsEmpty()) { this._currentLine.indent = this._indent; } } }, { key: "decIndent", value: function decIndent() { this._indent--; if (this.lineIsEmpty()) { this._currentLine.indent = this._indent; } } }, { key: "pushClass", value: function pushClass(clazz) { this._classes.push(clazz); } }, { key: "popClass", value: function popClass() { return this._classes.pop(); } }, { key: "toSource", value: function toSource() { return this.sourceLines.map(function (l) { return l.parts.length > 0 ? _createIndent(l.indent) + l.parts.join('') : ''; }).join('\n'); } }, { key: "toSourceMapGenerator", value: function toSourceMapGenerator(genFilePath) { var startsAtLine = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var map = new SourceMapGenerator(genFilePath); var firstOffsetMapped = false; var mapFirstOffsetIfNeeded = function mapFirstOffsetIfNeeded() { if (!firstOffsetMapped) { // Add a single space so that tools won't try to load the file from disk. // Note: We are using virtual urls like `ng:///`, so we have to // provide a content here. map.addSource(genFilePath, ' ').addMapping(0, genFilePath, 0, 0); firstOffsetMapped = true; } }; for (var i = 0; i < startsAtLine; i++) { map.addLine(); mapFirstOffsetIfNeeded(); } this.sourceLines.forEach(function (line, lineIdx) { map.addLine(); var spans = line.srcSpans; var parts = line.parts; var col0 = line.indent * _INDENT_WITH.length; var spanIdx = 0; // skip leading parts without source spans while (spanIdx < spans.length && !spans[spanIdx]) { col0 += parts[spanIdx].length; spanIdx++; } if (spanIdx < spans.length && lineIdx === 0 && col0 === 0) { firstOffsetMapped = true; } else { mapFirstOffsetIfNeeded(); } while (spanIdx < spans.length) { var span = spans[spanIdx]; var source = span.start.file; var sourceLine = span.start.line; var sourceCol = span.start.col; map.addSource(source.url, source.content).addMapping(col0, source.url, sourceLine, sourceCol); col0 += parts[spanIdx].length; spanIdx++; // assign parts without span or the same span to the previous segment while (spanIdx < spans.length && (span === spans[spanIdx] || !spans[spanIdx])) { col0 += parts[spanIdx].length; spanIdx++; } } }); return map; } }, { key: "setPreambleLineCount", value: function setPreambleLineCount(count) { return this._preambleLineCount = count; } }, { key: "spanOf", value: function spanOf(line, column) { var emittedLine = this._lines[line - this._preambleLineCount]; if (emittedLine) { var columnsLeft = column - _createIndent(emittedLine.indent).length; for (var partIndex = 0; partIndex < emittedLine.parts.length; partIndex++) { var part = emittedLine.parts[partIndex]; if (part.length > columnsLeft) { return emittedLine.srcSpans[partIndex]; } columnsLeft -= part.length; } } return null; } }, { key: "_currentLine", get: function get() { return this._lines[this._lines.length - 1]; } }, { key: "currentClass", get: function get() { return this._classes.length > 0 ? this._classes[this._classes.length - 1] : null; } }, { key: "sourceLines", get: function get() { if (this._lines.length && this._lines[this._lines.length - 1].parts.length === 0) { return this._lines.slice(0, -1); } return this._lines; } }], [{ key: "createRoot", value: function createRoot() { return new EmitterVisitorContext(0); } }]); return EmitterVisitorContext; }(); var AbstractEmitterVisitor = /*#__PURE__*/function () { function AbstractEmitterVisitor(_escapeDollarInStrings) { _classCallCheck(this, AbstractEmitterVisitor); this._escapeDollarInStrings = _escapeDollarInStrings; } _createClass2(AbstractEmitterVisitor, [{ key: "visitExpressionStmt", value: function visitExpressionStmt(stmt, ctx) { stmt.expr.visitExpression(this, ctx); ctx.println(stmt, ';'); return null; } }, { key: "visitReturnStmt", value: function visitReturnStmt(stmt, ctx) { ctx.print(stmt, "return "); stmt.value.visitExpression(this, ctx); ctx.println(stmt, ';'); return null; } }, { key: "visitIfStmt", value: function visitIfStmt(stmt, ctx) { ctx.print(stmt, "if ("); stmt.condition.visitExpression(this, ctx); ctx.print(stmt, ") {"); var hasElseCase = stmt.falseCase != null && stmt.falseCase.length > 0; if (stmt.trueCase.length <= 1 && !hasElseCase) { ctx.print(stmt, " "); this.visitAllStatements(stmt.trueCase, ctx); ctx.removeEmptyLastLine(); ctx.print(stmt, " "); } else { ctx.println(); ctx.incIndent(); this.visitAllStatements(stmt.trueCase, ctx); ctx.decIndent(); if (hasElseCase) { ctx.println(stmt, "} else {"); ctx.incIndent(); this.visitAllStatements(stmt.falseCase, ctx); ctx.decIndent(); } } ctx.println(stmt, "}"); return null; } }, { key: "visitThrowStmt", value: function visitThrowStmt(stmt, ctx) { ctx.print(stmt, "throw "); stmt.error.visitExpression(this, ctx); ctx.println(stmt, ";"); return null; } }, { key: "visitCommentStmt", value: function visitCommentStmt(stmt, ctx) { if (stmt.multiline) { ctx.println(stmt, "/* ".concat(stmt.comment, " */")); } else { stmt.comment.split('\n').forEach(function (line) { ctx.println(stmt, "// ".concat(line)); }); } return null; } }, { key: "visitJSDocCommentStmt", value: function visitJSDocCommentStmt(stmt, ctx) { ctx.println(stmt, "/*".concat(stmt.toString(), "*/")); return null; } }, { key: "visitWriteVarExpr", value: function visitWriteVarExpr(expr, ctx) { var lineWasEmpty = ctx.lineIsEmpty(); if (!lineWasEmpty) { ctx.print(expr, '('); } ctx.print(expr, "".concat(expr.name, " = ")); expr.value.visitExpression(this, ctx); if (!lineWasEmpty) { ctx.print(expr, ')'); } return null; } }, { key: "visitWriteKeyExpr", value: function visitWriteKeyExpr(expr, ctx) { var lineWasEmpty = ctx.lineIsEmpty(); if (!lineWasEmpty) { ctx.print(expr, '('); } expr.receiver.visitExpression(this, ctx); ctx.print(expr, "["); expr.index.visitExpression(this, ctx); ctx.print(expr, "] = "); expr.value.visitExpression(this, ctx); if (!lineWasEmpty) { ctx.print(expr, ')'); } return null; } }, { key: "visitWritePropExpr", value: function visitWritePropExpr(expr, ctx) { var lineWasEmpty = ctx.lineIsEmpty(); if (!lineWasEmpty) { ctx.print(expr, '('); } expr.receiver.visitExpression(this, ctx); ctx.print(expr, ".".concat(expr.name, " = ")); expr.value.visitExpression(this, ctx); if (!lineWasEmpty) { ctx.print(expr, ')'); } return null; } }, { key: "visitInvokeMethodExpr", value: function visitInvokeMethodExpr(expr, ctx) { expr.receiver.visitExpression(this, ctx); var name = expr.name; if (expr.builtin != null) { name = this.getBuiltinMethodName(expr.builtin); if (name == null) { // some builtins just mean to skip the call. return null; } } ctx.print(expr, ".".concat(name, "(")); this.visitAllExpressions(expr.args, ctx, ","); ctx.print(expr, ")"); return null; } }, { key: "visitInvokeFunctionExpr", value: function visitInvokeFunctionExpr(expr, ctx) { expr.fn.visitExpression(this, ctx); ctx.print(expr, "("); this.visitAllExpressions(expr.args, ctx, ','); ctx.print(expr, ")"); return null; } }, { key: "visitWrappedNodeExpr", value: function visitWrappedNodeExpr(ast, ctx) { throw new Error('Abstract emitter cannot visit WrappedNodeExpr.'); } }, { key: "visitTypeofExpr", value: function visitTypeofExpr(expr, ctx) { ctx.print(expr, 'typeof '); expr.expr.visitExpression(this, ctx); } }, { key: "visitReadVarExpr", value: function visitReadVarExpr(ast, ctx) { var varName = ast.name; if (ast.builtin != null) { switch (ast.builtin) { case BuiltinVar.Super: varName = 'super'; break; case BuiltinVar.This: varName = 'this'; break; case BuiltinVar.CatchError: varName = CATCH_ERROR_VAR$1.name; break; case BuiltinVar.CatchStack: varName = CATCH_STACK_VAR$1.name; break; default: throw new Error("Unknown builtin variable ".concat(ast.builtin)); } } ctx.print(ast, varName); return null; } }, { key: "visitInstantiateExpr", value: function visitInstantiateExpr(ast, ctx) { ctx.print(ast, "new "); ast.classExpr.visitExpression(this, ctx); ctx.print(ast, "("); this.visitAllExpressions(ast.args, ctx, ','); ctx.print(ast, ")"); return null; } }, { key: "visitLiteralExpr", value: function visitLiteralExpr(ast, ctx) { var value = ast.value; if (typeof value === 'string') { ctx.print(ast, escapeIdentifier(value, this._escapeDollarInStrings)); } else { ctx.print(ast, "".concat(value)); } return null; } }, { key: "visitConditionalExpr", value: function visitConditionalExpr(ast, ctx) { ctx.print(ast, "("); ast.condition.visitExpression(this, ctx); ctx.print(ast, '? '); ast.trueCase.visitExpression(this, ctx); ctx.print(ast, ': '); ast.falseCase.visitExpression(this, ctx); ctx.print(ast, ")"); return null; } }, { key: "visitNotExpr", value: function visitNotExpr(ast, ctx) { ctx.print(ast, '!'); ast.condition.visitExpression(this, ctx); return null; } }, { key: "visitAssertNotNullExpr", value: function visitAssertNotNullExpr(ast, ctx) { ast.condition.visitExpression(this, ctx); return null; } }, { key: "visitBinaryOperatorExpr", value: function visitBinaryOperatorExpr(ast, ctx) { var opStr; switch (ast.operator) { case BinaryOperator.Equals: opStr = '=='; break; case BinaryOperator.Identical: opStr = '==='; break; case BinaryOperator.NotEquals: opStr = '!='; break; case BinaryOperator.NotIdentical: opStr = '!=='; break; case BinaryOperator.And: opStr = '&&'; break; case BinaryOperator.BitwiseAnd: opStr = '&'; break; case BinaryOperator.Or: opStr = '||'; break; case BinaryOperator.Plus: opStr = '+'; break; case BinaryOperator.Minus: opStr = '-'; break; case BinaryOperator.Divide: opStr = '/'; break; case BinaryOperator.Multiply: opStr = '*'; break; case BinaryOperator.Modulo: opStr = '%'; break; case BinaryOperator.Lower: opStr = '<'; break; case BinaryOperator.LowerEquals: opStr = '<='; break; case BinaryOperator.Bigger: opStr = '>'; break; case BinaryOperator.BiggerEquals: opStr = '>='; break; default: throw new Error("Unknown operator ".concat(ast.operator)); } if (ast.parens) ctx.print(ast, "("); ast.lhs.visitExpression(this, ctx); ctx.print(ast, " ".concat(opStr, " ")); ast.rhs.visitExpression(this, ctx); if (ast.parens) ctx.print(ast, ")"); return null; } }, { key: "visitReadPropExpr", value: function visitReadPropExpr(ast, ctx) { ast.receiver.visitExpression(this, ctx); ctx.print(ast, "."); ctx.print(ast, ast.name); return null; } }, { key: "visitReadKeyExpr", value: function visitReadKeyExpr(ast, ctx) { ast.receiver.visitExpression(this, ctx); ctx.print(ast, "["); ast.index.visitExpression(this, ctx); ctx.print(ast, "]"); return null; } }, { key: "visitLiteralArrayExpr", value: function visitLiteralArrayExpr(ast, ctx) { ctx.print(ast, "["); this.visitAllExpressions(ast.entries, ctx, ','); ctx.print(ast, "]"); return null; } }, { key: "visitLiteralMapExpr", value: function visitLiteralMapExpr(ast, ctx) { var _this106 = this; ctx.print(ast, "{"); this.visitAllObjects(function (entry) { ctx.print(ast, "".concat(escapeIdentifier(entry.key, _this106._escapeDollarInStrings, entry.quoted), ":")); entry.value.visitExpression(_this106, ctx); }, ast.entries, ctx, ','); ctx.print(ast, "}"); return null; } }, { key: "visitCommaExpr", value: function visitCommaExpr(ast, ctx) { ctx.print(ast, '('); this.visitAllExpressions(ast.parts, ctx, ','); ctx.print(ast, ')'); return null; } }, { key: "visitAllExpressions", value: function visitAllExpressions(expressions, ctx, separator) { var _this107 = this; this.visitAllObjects(function (expr) { return expr.visitExpression(_this107, ctx); }, expressions, ctx, separator); } }, { key: "visitAllObjects", value: function visitAllObjects(handler, expressions, ctx, separator) { var incrementedIndent = false; for (var i = 0; i < expressions.length; i++) { if (i > 0) { if (ctx.lineLength() > 80) { ctx.print(null, separator, true); if (!incrementedIndent) { // continuation are marked with double indent. ctx.incIndent(); ctx.incIndent(); incrementedIndent = true; } } else { ctx.print(null, separator, false); } } handler(expressions[i]); } if (incrementedIndent) { // continuation are marked with double indent. ctx.decIndent(); ctx.decIndent(); } } }, { key: "visitAllStatements", value: function visitAllStatements(statements, ctx) { var _this108 = this; statements.forEach(function (stmt) { return stmt.visitStatement(_this108, ctx); }); } }]); return AbstractEmitterVisitor; }(); function escapeIdentifier(input, escapeDollar) { var alwaysQuote = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; if (input == null) { return null; } var body = input.replace(_SINGLE_QUOTE_ESCAPE_STRING_RE, function () { if ((arguments.length <= 0 ? undefined : arguments[0]) == '$') { return escapeDollar ? '\\$' : '$'; } else if ((arguments.length <= 0 ? undefined : arguments[0]) == '\n') { return '\\n'; } else if ((arguments.length <= 0 ? undefined : arguments[0]) == '\r') { return '\\r'; } else { return "\\".concat(arguments.length <= 0 ? undefined : arguments[0]); } }); var requiresQuotes = alwaysQuote || !_LEGAL_IDENTIFIER_RE.test(body); return requiresQuotes ? "'".concat(body, "'") : body; } function _createIndent(count) { var res = ''; for (var i = 0; i < count; i++) { res += _INDENT_WITH; } return res; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var AbstractJsEmitterVisitor = /*#__PURE__*/function (_AbstractEmitterVisit) { _inherits(AbstractJsEmitterVisitor, _AbstractEmitterVisit); var _super56 = _createSuper(AbstractJsEmitterVisitor); function AbstractJsEmitterVisitor() { _classCallCheck(this, AbstractJsEmitterVisitor); return _super56.call(this, false); } _createClass2(AbstractJsEmitterVisitor, [{ key: "visitDeclareClassStmt", value: function visitDeclareClassStmt(stmt, ctx) { var _this109 = this; ctx.pushClass(stmt); this._visitClassConstructor(stmt, ctx); if (stmt.parent != null) { ctx.print(stmt, "".concat(stmt.name, ".prototype = Object.create(")); stmt.parent.visitExpression(this, ctx); ctx.println(stmt, ".prototype);"); } stmt.getters.forEach(function (getter) { return _this109._visitClassGetter(stmt, getter, ctx); }); stmt.methods.forEach(function (method) { return _this109._visitClassMethod(stmt, method, ctx); }); ctx.popClass(); return null; } }, { key: "_visitClassConstructor", value: function _visitClassConstructor(stmt, ctx) { ctx.print(stmt, "function ".concat(stmt.name, "(")); if (stmt.constructorMethod != null) { this._visitParams(stmt.constructorMethod.params, ctx); } ctx.println(stmt, ") {"); ctx.incIndent(); if (stmt.constructorMethod != null) { if (stmt.constructorMethod.body.length > 0) { ctx.println(stmt, "var self = this;"); this.visitAllStatements(stmt.constructorMethod.body, ctx); } } ctx.decIndent(); ctx.println(stmt, "}"); } }, { key: "_visitClassGetter", value: function _visitClassGetter(stmt, getter, ctx) { ctx.println(stmt, "Object.defineProperty(".concat(stmt.name, ".prototype, '").concat(getter.name, "', { get: function() {")); ctx.incIndent(); if (getter.body.length > 0) { ctx.println(stmt, "var self = this;"); this.visitAllStatements(getter.body, ctx); } ctx.decIndent(); ctx.println(stmt, "}});"); } }, { key: "_visitClassMethod", value: function _visitClassMethod(stmt, method, ctx) { ctx.print(stmt, "".concat(stmt.name, ".prototype.").concat(method.name, " = function(")); this._visitParams(method.params, ctx); ctx.println(stmt, ") {"); ctx.incIndent(); if (method.body.length > 0) { ctx.println(stmt, "var self = this;"); this.visitAllStatements(method.body, ctx); } ctx.decIndent(); ctx.println(stmt, "};"); } }, { key: "visitWrappedNodeExpr", value: function visitWrappedNodeExpr(ast, ctx) { throw new Error('Cannot emit a WrappedNodeExpr in Javascript.'); } }, { key: "visitReadVarExpr", value: function visitReadVarExpr(ast, ctx) { if (ast.builtin === BuiltinVar.This) { ctx.print(ast, 'self'); } else if (ast.builtin === BuiltinVar.Super) { throw new Error("'super' needs to be handled at a parent ast node, not at the variable level!"); } else { _get(_getPrototypeOf(AbstractJsEmitterVisitor.prototype), "visitReadVarExpr", this).call(this, ast, ctx); } return null; } }, { key: "visitDeclareVarStmt", value: function visitDeclareVarStmt(stmt, ctx) { ctx.print(stmt, "var ".concat(stmt.name)); if (stmt.value) { ctx.print(stmt, ' = '); stmt.value.visitExpression(this, ctx); } ctx.println(stmt, ";"); return null; } }, { key: "visitCastExpr", value: function visitCastExpr(ast, ctx) { ast.value.visitExpression(this, ctx); return null; } }, { key: "visitInvokeFunctionExpr", value: function visitInvokeFunctionExpr(expr, ctx) { var fnExpr = expr.fn; if (fnExpr instanceof ReadVarExpr && fnExpr.builtin === BuiltinVar.Super) { ctx.currentClass.parent.visitExpression(this, ctx); ctx.print(expr, ".call(this"); if (expr.args.length > 0) { ctx.print(expr, ", "); this.visitAllExpressions(expr.args, ctx, ','); } ctx.print(expr, ")"); } else { _get(_getPrototypeOf(AbstractJsEmitterVisitor.prototype), "visitInvokeFunctionExpr", this).call(this, expr, ctx); } return null; } }, { key: "visitFunctionExpr", value: function visitFunctionExpr(ast, ctx) { ctx.print(ast, "function".concat(ast.name ? ' ' + ast.name : '', "(")); this._visitParams(ast.params, ctx); ctx.println(ast, ") {"); ctx.incIndent(); this.visitAllStatements(ast.statements, ctx); ctx.decIndent(); ctx.print(ast, "}"); return null; } }, { key: "visitDeclareFunctionStmt", value: function visitDeclareFunctionStmt(stmt, ctx) { ctx.print(stmt, "function ".concat(stmt.name, "(")); this._visitParams(stmt.params, ctx); ctx.println(stmt, ") {"); ctx.incIndent(); this.visitAllStatements(stmt.statements, ctx); ctx.decIndent(); ctx.println(stmt, "}"); return null; } }, { key: "visitTryCatchStmt", value: function visitTryCatchStmt(stmt, ctx) { ctx.println(stmt, "try {"); ctx.incIndent(); this.visitAllStatements(stmt.bodyStmts, ctx); ctx.decIndent(); ctx.println(stmt, "} catch (".concat(CATCH_ERROR_VAR$1.name, ") {")); ctx.incIndent(); var catchStmts = [CATCH_STACK_VAR$1.set(CATCH_ERROR_VAR$1.prop('stack')).toDeclStmt(null, [StmtModifier.Final])].concat(stmt.catchStmts); this.visitAllStatements(catchStmts, ctx); ctx.decIndent(); ctx.println(stmt, "}"); return null; } }, { key: "_visitParams", value: function _visitParams(params, ctx) { this.visitAllObjects(function (param) { return ctx.print(null, param.name); }, params, ctx, ','); } }, { key: "getBuiltinMethodName", value: function getBuiltinMethodName(method) { var name; switch (method) { case BuiltinMethod.ConcatArray: name = 'concat'; break; case BuiltinMethod.SubscribeObservable: name = 'subscribe'; break; case BuiltinMethod.Bind: name = 'bind'; break; default: throw new Error("Unknown builtin method: ".concat(method)); } return name; } }]); return AbstractJsEmitterVisitor; }(AbstractEmitterVisitor); /** * @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 helper class to manage the evaluation of JIT generated code. */ var JitEvaluator = /*#__PURE__*/function () { function JitEvaluator() { _classCallCheck(this, JitEvaluator); } _createClass2(JitEvaluator, [{ key: "evaluateStatements", /** * * @param sourceUrl The URL of the generated code. * @param statements An array of Angular statement AST nodes to be evaluated. * @param reflector A helper used when converting the statements to executable code. * @param createSourceMaps If true then create a source-map for the generated code and include it * inline as a source-map comment. * @returns A map of all the variables in the generated code. */ value: function evaluateStatements(sourceUrl, statements, reflector, createSourceMaps) { var converter = new JitEmitterVisitor(reflector); var ctx = EmitterVisitorContext.createRoot(); // Ensure generated code is in strict mode if (statements.length > 0 && !isUseStrictStatement(statements[0])) { statements = [literal('use strict').toStmt()].concat(_toConsumableArray(statements)); } converter.visitAllStatements(statements, ctx); converter.createReturnStmt(ctx); return this.evaluateCode(sourceUrl, ctx, converter.getArgs(), createSourceMaps); } /** * Evaluate a piece of JIT generated code. * @param sourceUrl The URL of this generated code. * @param ctx A context object that contains an AST of the code to be evaluated. * @param vars A map containing the names and values of variables that the evaluated code might * reference. * @param createSourceMap If true then create a source-map for the generated code and include it * inline as a source-map comment. * @returns The result of evaluating the code. */ }, { key: "evaluateCode", value: function evaluateCode(sourceUrl, ctx, vars, createSourceMap) { var fnBody = "\"use strict\";".concat(ctx.toSource(), "\n//# sourceURL=").concat(sourceUrl); var fnArgNames = []; var fnArgValues = []; for (var argName in vars) { fnArgValues.push(vars[argName]); fnArgNames.push(argName); } if (createSourceMap) { // using `new Function(...)` generates a header, 1 line of no arguments, 2 lines otherwise // E.g. ``` // function anonymous(a,b,c // /**/) { ... }``` // We don't want to hard code this fact, so we auto detect it via an empty function first. var emptyFn = _construct(Function, _toConsumableArray(fnArgNames.concat('return null;'))).toString(); var headerLines = emptyFn.slice(0, emptyFn.indexOf('return null;')).split('\n').length - 1; fnBody += "\n".concat(ctx.toSourceMapGenerator(sourceUrl, headerLines).toJsComment()); } var fn = _construct(Function, _toConsumableArray(fnArgNames.concat(fnBody))); return this.executeFunction(fn, fnArgValues); } /** * Execute a JIT generated function by calling it. * * This method can be overridden in tests to capture the functions that are generated * by this `JitEvaluator` class. * * @param fn A function to execute. * @param args The arguments to pass to the function being executed. * @returns The return value of the executed function. */ }, { key: "executeFunction", value: function executeFunction(fn, args) { return fn.apply(void 0, _toConsumableArray(args)); } }]); return JitEvaluator; }(); /** * An Angular AST visitor that converts AST nodes into executable JavaScript code. */ var JitEmitterVisitor = /*#__PURE__*/function (_AbstractJsEmitterVis) { _inherits(JitEmitterVisitor, _AbstractJsEmitterVis); var _super57 = _createSuper(JitEmitterVisitor); function JitEmitterVisitor(reflector) { var _this110; _classCallCheck(this, JitEmitterVisitor); _this110 = _super57.call(this); _this110.reflector = reflector; _this110._evalArgNames = []; _this110._evalArgValues = []; _this110._evalExportedVars = []; return _this110; } _createClass2(JitEmitterVisitor, [{ key: "createReturnStmt", value: function createReturnStmt(ctx) { var stmt = new ReturnStatement(new LiteralMapExpr(this._evalExportedVars.map(function (resultVar) { return new LiteralMapEntry(resultVar, variable(resultVar), false); }))); stmt.visitStatement(this, ctx); } }, { key: "getArgs", value: function getArgs() { var result = {}; for (var i = 0; i < this._evalArgNames.length; i++) { result[this._evalArgNames[i]] = this._evalArgValues[i]; } return result; } }, { key: "visitExternalExpr", value: function visitExternalExpr(ast, ctx) { this._emitReferenceToExternal(ast, this.reflector.resolveExternalReference(ast.value), ctx); return null; } }, { key: "visitWrappedNodeExpr", value: function visitWrappedNodeExpr(ast, ctx) { this._emitReferenceToExternal(ast, ast.node, ctx); return null; } }, { key: "visitDeclareVarStmt", value: function visitDeclareVarStmt(stmt, ctx) { if (stmt.hasModifier(StmtModifier.Exported)) { this._evalExportedVars.push(stmt.name); } return _get(_getPrototypeOf(JitEmitterVisitor.prototype), "visitDeclareVarStmt", this).call(this, stmt, ctx); } }, { key: "visitDeclareFunctionStmt", value: function visitDeclareFunctionStmt(stmt, ctx) { if (stmt.hasModifier(StmtModifier.Exported)) { this._evalExportedVars.push(stmt.name); } return _get(_getPrototypeOf(JitEmitterVisitor.prototype), "visitDeclareFunctionStmt", this).call(this, stmt, ctx); } }, { key: "visitDeclareClassStmt", value: function visitDeclareClassStmt(stmt, ctx) { if (stmt.hasModifier(StmtModifier.Exported)) { this._evalExportedVars.push(stmt.name); } return _get(_getPrototypeOf(JitEmitterVisitor.prototype), "visitDeclareClassStmt", this).call(this, stmt, ctx); } }, { key: "_emitReferenceToExternal", value: function _emitReferenceToExternal(ast, value, ctx) { var id = this._evalArgValues.indexOf(value); if (id === -1) { id = this._evalArgValues.length; this._evalArgValues.push(value); var name = identifierName({ reference: value }) || 'val'; this._evalArgNames.push("jit_".concat(name, "_").concat(id)); } ctx.print(ast, this._evalArgNames[id]); } }]); return JitEmitterVisitor; }(AbstractJsEmitterVisitor); function isUseStrictStatement(statement) { return statement.isEquivalent(literal('use strict').toStmt()); } /** * @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 */ /** * Implementation of `CompileReflector` which resolves references to @angular/core * symbols at runtime, according to a consumer-provided mapping. * * Only supports `resolveExternalReference`, all other methods throw. */ var R3JitReflector = /*#__PURE__*/function () { function R3JitReflector(context) { _classCallCheck(this, R3JitReflector); this.context = context; } _createClass2(R3JitReflector, [{ key: "resolveExternalReference", value: function resolveExternalReference(ref) { // This reflector only handles @angular/core imports. if (ref.moduleName !== '@angular/core') { throw new Error("Cannot resolve external reference to ".concat(ref.moduleName, ", only references to @angular/core are supported.")); } if (!this.context.hasOwnProperty(ref.name)) { throw new Error("No value provided for @angular/core symbol '".concat(ref.name, "'.")); } return this.context[ref.name]; } }, { key: "parameters", value: function parameters(typeOrFunc) { throw new Error('Not implemented.'); } }, { key: "annotations", value: function annotations(typeOrFunc) { throw new Error('Not implemented.'); } }, { key: "shallowAnnotations", value: function shallowAnnotations(typeOrFunc) { throw new Error('Not implemented.'); } }, { key: "tryAnnotations", value: function tryAnnotations(typeOrFunc) { throw new Error('Not implemented.'); } }, { key: "propMetadata", value: function propMetadata(typeOrFunc) { throw new Error('Not implemented.'); } }, { key: "hasLifecycleHook", value: function hasLifecycleHook(type, lcProperty) { throw new Error('Not implemented.'); } }, { key: "guards", value: function guards(typeOrFunc) { throw new Error('Not implemented.'); } }, { key: "componentModuleUrl", value: function componentModuleUrl(type, cmpMetadata) { throw new Error('Not implemented.'); } }]); return R3JitReflector; }(); /** * @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 */ /** * Construct an `R3NgModuleDef` for the given `R3NgModuleMetadata`. */ function _compileNgModule(meta) { var moduleType = meta.type, bootstrap = meta.bootstrap, declarations = meta.declarations, imports = meta.imports, exports = meta.exports, schemas = meta.schemas, containsForwardDecls = meta.containsForwardDecls, emitInline = meta.emitInline, id = meta.id; var additionalStatements = []; var definitionMap = { type: moduleType }; // Only generate the keys in the metadata if the arrays have values. if (bootstrap.length) { definitionMap.bootstrap = refsToArray(bootstrap, containsForwardDecls); } // If requested to emit scope information inline, pass the declarations, imports and exports to // the `ɵɵdefineNgModule` call. The JIT compilation uses this. if (emitInline) { if (declarations.length) { definitionMap.declarations = refsToArray(declarations, containsForwardDecls); } if (imports.length) { definitionMap.imports = refsToArray(imports, containsForwardDecls); } if (exports.length) { definitionMap.exports = refsToArray(exports, containsForwardDecls); } } // If not emitting inline, the scope information is not passed into `ɵɵdefineNgModule` as it would // prevent tree-shaking of the declarations, imports and exports references. else { var setNgModuleScopeCall = generateSetNgModuleScopeCall(meta); if (setNgModuleScopeCall !== null) { additionalStatements.push(setNgModuleScopeCall); } } if (schemas && schemas.length) { definitionMap.schemas = literalArr(schemas.map(function (ref) { return ref.value; })); } if (id) { definitionMap.id = id; } var expression = importExpr(Identifiers$1.defineNgModule).callFn([mapToMapExpression(definitionMap)]); var type = new ExpressionType(importExpr(Identifiers$1.NgModuleDefWithMeta, [new ExpressionType(moduleType), tupleTypeOf(declarations), tupleTypeOf(imports), tupleTypeOf(exports)])); return { expression: expression, type: type, additionalStatements: additionalStatements }; } /** * Generates a function call to `ɵɵsetNgModuleScope` with all necessary information so that the * transitive module scope can be computed during runtime in JIT mode. This call is marked pure * such that the references to declarations, imports and exports may be elided causing these * symbols to become tree-shakeable. */ function generateSetNgModuleScopeCall(meta) { var moduleType = meta.type, declarations = meta.declarations, imports = meta.imports, exports = meta.exports, containsForwardDecls = meta.containsForwardDecls; var scopeMap = {}; if (declarations.length) { scopeMap.declarations = refsToArray(declarations, containsForwardDecls); } if (imports.length) { scopeMap.imports = refsToArray(imports, containsForwardDecls); } if (exports.length) { scopeMap.exports = refsToArray(exports, containsForwardDecls); } if (Object.keys(scopeMap).length === 0) { return null; } var fnCall = new InvokeFunctionExpr( /* fn */ importExpr(Identifiers$1.setNgModuleScope), /* args */ [moduleType, mapToMapExpression(scopeMap)], /* type */ undefined, /* sourceSpan */ undefined, /* pure */ true); return fnCall.toStmt(); } function _compileInjector(meta) { var result = compileFactoryFunction({ name: meta.name, type: meta.type, deps: meta.deps, injectFn: Identifiers$1.inject }); var definitionMap = { factory: result.factory }; if (meta.providers !== null) { definitionMap.providers = meta.providers; } if (meta.imports.length > 0) { definitionMap.imports = literalArr(meta.imports); } var expression = importExpr(Identifiers$1.defineInjector).callFn([mapToMapExpression(definitionMap)]); var type = new ExpressionType(importExpr(Identifiers$1.InjectorDef, [new ExpressionType(meta.type)])); return { expression: expression, type: type, statements: result.statements }; } // TODO(alxhub): integrate this with `compileNgModule`. Currently the two are separate operations. function compileNgModuleFromRender2(ctx, ngModule, injectableCompiler) { var className = identifierName(ngModule.type); var rawImports = ngModule.rawImports ? [ngModule.rawImports] : []; var rawExports = ngModule.rawExports ? [ngModule.rawExports] : []; var injectorDefArg = mapLiteral({ 'factory': injectableCompiler.factoryFor({ type: ngModule.type, symbol: ngModule.type.reference }, ctx), 'providers': convertMetaToOutput(ngModule.rawProviders, ctx), 'imports': convertMetaToOutput([].concat(rawImports, rawExports), ctx) }); var injectorDef = importExpr(Identifiers$1.defineInjector).callFn([injectorDefArg]); ctx.statements.push(new ClassStmt( /* name */ className, /* parent */ null, /* fields */ [new ClassField( /* name */ 'ngInjectorDef', /* type */ INFERRED_TYPE, /* modifiers */ [StmtModifier.Static], /* initializer */ injectorDef)], /* getters */ [], /* constructorMethod */ new ClassMethod(null, [], []), /* methods */ [])); } function accessExportScope(module) { var selectorScope = new ReadPropExpr(module, 'ngModuleDef'); return new ReadPropExpr(selectorScope, 'exported'); } function tupleTypeOf(exp) { var types = exp.map(function (ref) { return typeofExpr(ref.type); }); return exp.length > 0 ? expressionType(literalArr(types)) : NONE_TYPE; } function refsToArray(refs, shouldForwardDeclare) { var values = literalArr(refs.map(function (ref) { return ref.value; })); return shouldForwardDeclare ? fn([], [new ReturnStatement(values)]) : values; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ function compilePipeFromMetadata(metadata) { var definitionMapValues = []; // e.g. `name: 'myPipe'` definitionMapValues.push({ key: 'name', value: literal(metadata.pipeName), quoted: false }); // e.g. `type: MyPipe` definitionMapValues.push({ key: 'type', value: metadata.type, quoted: false }); var templateFactory = compileFactoryFunction({ name: metadata.name, type: metadata.type, deps: metadata.deps, injectFn: Identifiers$1.directiveInject }, true); definitionMapValues.push({ key: 'factory', value: templateFactory.factory, quoted: false }); // e.g. `pure: true` definitionMapValues.push({ key: 'pure', value: literal(metadata.pure), quoted: false }); var expression = importExpr(Identifiers$1.definePipe).callFn([literalMap(definitionMapValues)]); var type = new ExpressionType(importExpr(Identifiers$1.PipeDefWithMeta, [typeWithParameters(metadata.type, metadata.typeArgumentCount), new ExpressionType(new LiteralExpr(metadata.pipeName))])); return { expression: expression, type: type, statements: templateFactory.statements }; } /** * Write a pipe definition to the output context. */ function compilePipeFromRender2(outputCtx, pipe, reflector) { var definitionMapValues = []; var name = identifierName(pipe.type); if (!name) { return error("Cannot resolve the name of ".concat(pipe.type)); } var metadata = { name: name, pipeName: pipe.name, type: outputCtx.importExpr(pipe.type.reference), typeArgumentCount: 0, deps: dependenciesFromGlobalMetadata(pipe.type, outputCtx, reflector), pure: pipe.pure }; var res = compilePipeFromMetadata(metadata); var definitionField = outputCtx.constantPool.propertyNameOf(3 /* Pipe */ ); outputCtx.statements.push(new ClassStmt( /* name */ name, /* parent */ null, /* fields */ [new ClassField( /* name */ definitionField, /* type */ INFERRED_TYPE, /* modifiers */ [StmtModifier.Static], /* initializer */ res.expression)], /* getters */ [], /* constructorMethod */ new ClassMethod(null, [], []), /* methods */ [])); } /** * @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 ParserError(message, input, errLocation, ctxLocation) { _classCallCheck(this, ParserError); this.input = input; this.errLocation = errLocation; this.ctxLocation = ctxLocation; this.message = "Parser Error: ".concat(message, " ").concat(errLocation, " [").concat(input, "] in ").concat(ctxLocation); }; var ParseSpan = function ParseSpan(start, end) { _classCallCheck(this, ParseSpan); this.start = start; this.end = end; }; var AST = /*#__PURE__*/function () { function AST(span) { _classCallCheck(this, AST); this.span = span; } _createClass2(AST, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return null; } }, { key: "toString", value: function toString() { 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 = /*#__PURE__*/function (_AST) { _inherits(Quote, _AST); var _super58 = _createSuper(Quote); function Quote(span, prefix, uninterpretedExpression, location) { var _this111; _classCallCheck(this, Quote); _this111 = _super58.call(this, span); _this111.prefix = prefix; _this111.uninterpretedExpression = uninterpretedExpression; _this111.location = location; return _this111; } _createClass2(Quote, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitQuote(this, context); } }, { key: "toString", value: function toString() { return 'Quote'; } }]); return Quote; }(AST); var EmptyExpr = /*#__PURE__*/function (_AST2) { _inherits(EmptyExpr, _AST2); var _super59 = _createSuper(EmptyExpr); function EmptyExpr() { _classCallCheck(this, EmptyExpr); return _super59.apply(this, arguments); } _createClass2(EmptyExpr, [{ key: "visit", value: function visit(visitor) {// do nothing var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; } }]); return EmptyExpr; }(AST); var ImplicitReceiver = /*#__PURE__*/function (_AST3) { _inherits(ImplicitReceiver, _AST3); var _super60 = _createSuper(ImplicitReceiver); function ImplicitReceiver() { _classCallCheck(this, ImplicitReceiver); return _super60.apply(this, arguments); } _createClass2(ImplicitReceiver, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitImplicitReceiver(this, context); } }]); return ImplicitReceiver; }(AST); /** * Multiple expressions separated by a semicolon. */ var Chain = /*#__PURE__*/function (_AST4) { _inherits(Chain, _AST4); var _super61 = _createSuper(Chain); function Chain(span, expressions) { var _this112; _classCallCheck(this, Chain); _this112 = _super61.call(this, span); _this112.expressions = expressions; return _this112; } _createClass2(Chain, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitChain(this, context); } }]); return Chain; }(AST); var Conditional = /*#__PURE__*/function (_AST5) { _inherits(Conditional, _AST5); var _super62 = _createSuper(Conditional); function Conditional(span, condition, trueExp, falseExp) { var _this113; _classCallCheck(this, Conditional); _this113 = _super62.call(this, span); _this113.condition = condition; _this113.trueExp = trueExp; _this113.falseExp = falseExp; return _this113; } _createClass2(Conditional, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitConditional(this, context); } }]); return Conditional; }(AST); var PropertyRead = /*#__PURE__*/function (_AST6) { _inherits(PropertyRead, _AST6); var _super63 = _createSuper(PropertyRead); function PropertyRead(span, receiver, name) { var _this114; _classCallCheck(this, PropertyRead); _this114 = _super63.call(this, span); _this114.receiver = receiver; _this114.name = name; return _this114; } _createClass2(PropertyRead, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitPropertyRead(this, context); } }]); return PropertyRead; }(AST); var PropertyWrite = /*#__PURE__*/function (_AST7) { _inherits(PropertyWrite, _AST7); var _super64 = _createSuper(PropertyWrite); function PropertyWrite(span, receiver, name, value) { var _this115; _classCallCheck(this, PropertyWrite); _this115 = _super64.call(this, span); _this115.receiver = receiver; _this115.name = name; _this115.value = value; return _this115; } _createClass2(PropertyWrite, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitPropertyWrite(this, context); } }]); return PropertyWrite; }(AST); var SafePropertyRead = /*#__PURE__*/function (_AST8) { _inherits(SafePropertyRead, _AST8); var _super65 = _createSuper(SafePropertyRead); function SafePropertyRead(span, receiver, name) { var _this116; _classCallCheck(this, SafePropertyRead); _this116 = _super65.call(this, span); _this116.receiver = receiver; _this116.name = name; return _this116; } _createClass2(SafePropertyRead, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitSafePropertyRead(this, context); } }]); return SafePropertyRead; }(AST); var KeyedRead = /*#__PURE__*/function (_AST9) { _inherits(KeyedRead, _AST9); var _super66 = _createSuper(KeyedRead); function KeyedRead(span, obj, key) { var _this117; _classCallCheck(this, KeyedRead); _this117 = _super66.call(this, span); _this117.obj = obj; _this117.key = key; return _this117; } _createClass2(KeyedRead, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitKeyedRead(this, context); } }]); return KeyedRead; }(AST); var KeyedWrite = /*#__PURE__*/function (_AST10) { _inherits(KeyedWrite, _AST10); var _super67 = _createSuper(KeyedWrite); function KeyedWrite(span, obj, key, value) { var _this118; _classCallCheck(this, KeyedWrite); _this118 = _super67.call(this, span); _this118.obj = obj; _this118.key = key; _this118.value = value; return _this118; } _createClass2(KeyedWrite, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitKeyedWrite(this, context); } }]); return KeyedWrite; }(AST); var BindingPipe = /*#__PURE__*/function (_AST11) { _inherits(BindingPipe, _AST11); var _super68 = _createSuper(BindingPipe); function BindingPipe(span, exp, name, args) { var _this119; _classCallCheck(this, BindingPipe); _this119 = _super68.call(this, span); _this119.exp = exp; _this119.name = name; _this119.args = args; return _this119; } _createClass2(BindingPipe, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitPipe(this, context); } }]); return BindingPipe; }(AST); var LiteralPrimitive = /*#__PURE__*/function (_AST12) { _inherits(LiteralPrimitive, _AST12); var _super69 = _createSuper(LiteralPrimitive); function LiteralPrimitive(span, value) { var _this120; _classCallCheck(this, LiteralPrimitive); _this120 = _super69.call(this, span); _this120.value = value; return _this120; } _createClass2(LiteralPrimitive, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitLiteralPrimitive(this, context); } }]); return LiteralPrimitive; }(AST); var LiteralArray = /*#__PURE__*/function (_AST13) { _inherits(LiteralArray, _AST13); var _super70 = _createSuper(LiteralArray); function LiteralArray(span, expressions) { var _this121; _classCallCheck(this, LiteralArray); _this121 = _super70.call(this, span); _this121.expressions = expressions; return _this121; } _createClass2(LiteralArray, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitLiteralArray(this, context); } }]); return LiteralArray; }(AST); var LiteralMap = /*#__PURE__*/function (_AST14) { _inherits(LiteralMap, _AST14); var _super71 = _createSuper(LiteralMap); function LiteralMap(span, keys, values) { var _this122; _classCallCheck(this, LiteralMap); _this122 = _super71.call(this, span); _this122.keys = keys; _this122.values = values; return _this122; } _createClass2(LiteralMap, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitLiteralMap(this, context); } }]); return LiteralMap; }(AST); var Interpolation = /*#__PURE__*/function (_AST15) { _inherits(Interpolation, _AST15); var _super72 = _createSuper(Interpolation); function Interpolation(span, strings, expressions) { var _this123; _classCallCheck(this, Interpolation); _this123 = _super72.call(this, span); _this123.strings = strings; _this123.expressions = expressions; return _this123; } _createClass2(Interpolation, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitInterpolation(this, context); } }]); return Interpolation; }(AST); var Binary = /*#__PURE__*/function (_AST16) { _inherits(Binary, _AST16); var _super73 = _createSuper(Binary); function Binary(span, operation, left, right) { var _this124; _classCallCheck(this, Binary); _this124 = _super73.call(this, span); _this124.operation = operation; _this124.left = left; _this124.right = right; return _this124; } _createClass2(Binary, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitBinary(this, context); } }]); return Binary; }(AST); var PrefixNot = /*#__PURE__*/function (_AST17) { _inherits(PrefixNot, _AST17); var _super74 = _createSuper(PrefixNot); function PrefixNot(span, expression) { var _this125; _classCallCheck(this, PrefixNot); _this125 = _super74.call(this, span); _this125.expression = expression; return _this125; } _createClass2(PrefixNot, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitPrefixNot(this, context); } }]); return PrefixNot; }(AST); var NonNullAssert = /*#__PURE__*/function (_AST18) { _inherits(NonNullAssert, _AST18); var _super75 = _createSuper(NonNullAssert); function NonNullAssert(span, expression) { var _this126; _classCallCheck(this, NonNullAssert); _this126 = _super75.call(this, span); _this126.expression = expression; return _this126; } _createClass2(NonNullAssert, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitNonNullAssert(this, context); } }]); return NonNullAssert; }(AST); var MethodCall = /*#__PURE__*/function (_AST19) { _inherits(MethodCall, _AST19); var _super76 = _createSuper(MethodCall); function MethodCall(span, receiver, name, args) { var _this127; _classCallCheck(this, MethodCall); _this127 = _super76.call(this, span); _this127.receiver = receiver; _this127.name = name; _this127.args = args; return _this127; } _createClass2(MethodCall, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitMethodCall(this, context); } }]); return MethodCall; }(AST); var SafeMethodCall = /*#__PURE__*/function (_AST20) { _inherits(SafeMethodCall, _AST20); var _super77 = _createSuper(SafeMethodCall); function SafeMethodCall(span, receiver, name, args) { var _this128; _classCallCheck(this, SafeMethodCall); _this128 = _super77.call(this, span); _this128.receiver = receiver; _this128.name = name; _this128.args = args; return _this128; } _createClass2(SafeMethodCall, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitSafeMethodCall(this, context); } }]); return SafeMethodCall; }(AST); var FunctionCall = /*#__PURE__*/function (_AST21) { _inherits(FunctionCall, _AST21); var _super78 = _createSuper(FunctionCall); function FunctionCall(span, target, args) { var _this129; _classCallCheck(this, FunctionCall); _this129 = _super78.call(this, span); _this129.target = target; _this129.args = args; return _this129; } _createClass2(FunctionCall, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return visitor.visitFunctionCall(this, context); } }]); return FunctionCall; }(AST); /** * Records the absolute position of a text span in a source file, where `start` and `end` are the * starting and ending byte offsets, respectively, of the text span in a source file. */ var AbsoluteSourceSpan = function AbsoluteSourceSpan(start, end) { _classCallCheck(this, AbsoluteSourceSpan); this.start = start; this.end = end; }; var ASTWithSource = /*#__PURE__*/function (_AST22) { _inherits(ASTWithSource, _AST22); var _super79 = _createSuper(ASTWithSource); function ASTWithSource(ast, source, location, absoluteOffset, errors) { var _this130; _classCallCheck(this, ASTWithSource); _this130 = _super79.call(this, new ParseSpan(0, source == null ? 0 : source.length)); _this130.ast = ast; _this130.source = source; _this130.location = location; _this130.errors = errors; _this130.sourceSpan = new AbsoluteSourceSpan(absoluteOffset, absoluteOffset + _this130.span.end); return _this130; } _createClass2(ASTWithSource, [{ key: "visit", value: function visit(visitor) { var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; if (visitor.visitASTWithSource) { return visitor.visitASTWithSource(this, context); } return this.ast.visit(visitor, context); } }, { key: "toString", value: function toString() { return "".concat(this.source, " in ").concat(this.location); } }]); return ASTWithSource; }(AST); var TemplateBinding = function TemplateBinding(span, key, keyIsVar, name, expression) { _classCallCheck(this, TemplateBinding); this.span = span; this.key = key; this.keyIsVar = keyIsVar; this.name = name; this.expression = expression; }; var NullAstVisitor = /*#__PURE__*/function () { function NullAstVisitor() { _classCallCheck(this, NullAstVisitor); } _createClass2(NullAstVisitor, [{ key: "visitBinary", value: function visitBinary(ast, context) {} }, { key: "visitChain", value: function visitChain(ast, context) {} }, { key: "visitConditional", value: function visitConditional(ast, context) {} }, { key: "visitFunctionCall", value: function visitFunctionCall(ast, context) {} }, { key: "visitImplicitReceiver", value: function visitImplicitReceiver(ast, context) {} }, { key: "visitInterpolation", value: function visitInterpolation(ast, context) {} }, { key: "visitKeyedRead", value: function visitKeyedRead(ast, context) {} }, { key: "visitKeyedWrite", value: function visitKeyedWrite(ast, context) {} }, { key: "visitLiteralArray", value: function visitLiteralArray(ast, context) {} }, { key: "visitLiteralMap", value: function visitLiteralMap(ast, context) {} }, { key: "visitLiteralPrimitive", value: function visitLiteralPrimitive(ast, context) {} }, { key: "visitMethodCall", value: function visitMethodCall(ast, context) {} }, { key: "visitPipe", value: function visitPipe(ast, context) {} }, { key: "visitPrefixNot", value: function visitPrefixNot(ast, context) {} }, { key: "visitNonNullAssert", value: function visitNonNullAssert(ast, context) {} }, { key: "visitPropertyRead", value: function visitPropertyRead(ast, context) {} }, { key: "visitPropertyWrite", value: function visitPropertyWrite(ast, context) {} }, { key: "visitQuote", value: function visitQuote(ast, context) {} }, { key: "visitSafeMethodCall", value: function visitSafeMethodCall(ast, context) {} }, { key: "visitSafePropertyRead", value: function visitSafePropertyRead(ast, context) {} }]); return NullAstVisitor; }(); var RecursiveAstVisitor$1 = /*#__PURE__*/function () { function RecursiveAstVisitor$1() { _classCallCheck(this, RecursiveAstVisitor$1); } _createClass2(RecursiveAstVisitor$1, [{ key: "visitBinary", value: function visitBinary(ast, context) { ast.left.visit(this, context); ast.right.visit(this, context); return null; } }, { key: "visitChain", value: function visitChain(ast, context) { return this.visitAll(ast.expressions, context); } }, { key: "visitConditional", value: function visitConditional(ast, context) { ast.condition.visit(this, context); ast.trueExp.visit(this, context); ast.falseExp.visit(this, context); return null; } }, { key: "visitPipe", value: function visitPipe(ast, context) { ast.exp.visit(this, context); this.visitAll(ast.args, context); return null; } }, { key: "visitFunctionCall", value: function visitFunctionCall(ast, context) { ast.target.visit(this, context); this.visitAll(ast.args, context); return null; } }, { key: "visitImplicitReceiver", value: function visitImplicitReceiver(ast, context) { return null; } }, { key: "visitInterpolation", value: function visitInterpolation(ast, context) { return this.visitAll(ast.expressions, context); } }, { key: "visitKeyedRead", value: function visitKeyedRead(ast, context) { ast.obj.visit(this, context); ast.key.visit(this, context); return null; } }, { key: "visitKeyedWrite", value: function visitKeyedWrite(ast, context) { ast.obj.visit(this, context); ast.key.visit(this, context); ast.value.visit(this, context); return null; } }, { key: "visitLiteralArray", value: function visitLiteralArray(ast, context) { return this.visitAll(ast.expressions, context); } }, { key: "visitLiteralMap", value: function visitLiteralMap(ast, context) { return this.visitAll(ast.values, context); } }, { key: "visitLiteralPrimitive", value: function visitLiteralPrimitive(ast, context) { return null; } }, { key: "visitMethodCall", value: function visitMethodCall(ast, context) { ast.receiver.visit(this, context); return this.visitAll(ast.args, context); } }, { key: "visitPrefixNot", value: function visitPrefixNot(ast, context) { ast.expression.visit(this, context); return null; } }, { key: "visitNonNullAssert", value: function visitNonNullAssert(ast, context) { ast.expression.visit(this, context); return null; } }, { key: "visitPropertyRead", value: function visitPropertyRead(ast, context) { ast.receiver.visit(this, context); return null; } }, { key: "visitPropertyWrite", value: function visitPropertyWrite(ast, context) { ast.receiver.visit(this, context); ast.value.visit(this, context); return null; } }, { key: "visitSafePropertyRead", value: function visitSafePropertyRead(ast, context) { ast.receiver.visit(this, context); return null; } }, { key: "visitSafeMethodCall", value: function visitSafeMethodCall(ast, context) { ast.receiver.visit(this, context); return this.visitAll(ast.args, context); } }, { key: "visitAll", value: function visitAll(asts, context) { var _this131 = this; asts.forEach(function (ast) { return ast.visit(_this131, context); }); return null; } }, { key: "visitQuote", value: function visitQuote(ast, context) { return null; } }]); return RecursiveAstVisitor$1; }(); var AstTransformer$1 = /*#__PURE__*/function () { function AstTransformer$1() { _classCallCheck(this, AstTransformer$1); } _createClass2(AstTransformer$1, [{ key: "visitImplicitReceiver", value: function visitImplicitReceiver(ast, context) { return ast; } }, { key: "visitInterpolation", value: function visitInterpolation(ast, context) { return new Interpolation(ast.span, ast.strings, this.visitAll(ast.expressions)); } }, { key: "visitLiteralPrimitive", value: function visitLiteralPrimitive(ast, context) { return new LiteralPrimitive(ast.span, ast.value); } }, { key: "visitPropertyRead", value: function visitPropertyRead(ast, context) { return new PropertyRead(ast.span, ast.receiver.visit(this), ast.name); } }, { key: "visitPropertyWrite", value: function visitPropertyWrite(ast, context) { return new PropertyWrite(ast.span, ast.receiver.visit(this), ast.name, ast.value.visit(this)); } }, { key: "visitSafePropertyRead", value: function visitSafePropertyRead(ast, context) { return new SafePropertyRead(ast.span, ast.receiver.visit(this), ast.name); } }, { key: "visitMethodCall", value: function visitMethodCall(ast, context) { return new MethodCall(ast.span, ast.receiver.visit(this), ast.name, this.visitAll(ast.args)); } }, { key: "visitSafeMethodCall", value: function visitSafeMethodCall(ast, context) { return new SafeMethodCall(ast.span, ast.receiver.visit(this), ast.name, this.visitAll(ast.args)); } }, { key: "visitFunctionCall", value: function visitFunctionCall(ast, context) { return new FunctionCall(ast.span, ast.target.visit(this), this.visitAll(ast.args)); } }, { key: "visitLiteralArray", value: function visitLiteralArray(ast, context) { return new LiteralArray(ast.span, this.visitAll(ast.expressions)); } }, { key: "visitLiteralMap", value: function visitLiteralMap(ast, context) { return new LiteralMap(ast.span, ast.keys, this.visitAll(ast.values)); } }, { key: "visitBinary", value: function visitBinary(ast, context) { return new Binary(ast.span, ast.operation, ast.left.visit(this), ast.right.visit(this)); } }, { key: "visitPrefixNot", value: function visitPrefixNot(ast, context) { return new PrefixNot(ast.span, ast.expression.visit(this)); } }, { key: "visitNonNullAssert", value: function visitNonNullAssert(ast, context) { return new NonNullAssert(ast.span, ast.expression.visit(this)); } }, { key: "visitConditional", value: function visitConditional(ast, context) { return new Conditional(ast.span, ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this)); } }, { key: "visitPipe", value: function visitPipe(ast, context) { return new BindingPipe(ast.span, ast.exp.visit(this), ast.name, this.visitAll(ast.args)); } }, { key: "visitKeyedRead", value: function visitKeyedRead(ast, context) { return new KeyedRead(ast.span, ast.obj.visit(this), ast.key.visit(this)); } }, { key: "visitKeyedWrite", value: function visitKeyedWrite(ast, context) { return new KeyedWrite(ast.span, ast.obj.visit(this), ast.key.visit(this), ast.value.visit(this)); } }, { key: "visitAll", value: function visitAll(asts) { var res = new Array(asts.length); for (var i = 0; i < asts.length; ++i) { res[i] = asts[i].visit(this); } return res; } }, { key: "visitChain", value: function visitChain(ast, context) { return new Chain(ast.span, this.visitAll(ast.expressions)); } }, { key: "visitQuote", value: function visitQuote(ast, context) { return new Quote(ast.span, ast.prefix, ast.uninterpretedExpression, ast.location); } }]); return AstTransformer$1; }(); // A transformer that only creates new nodes if the transformer makes a change or // a change is made a child node. var AstMemoryEfficientTransformer = /*#__PURE__*/function () { function AstMemoryEfficientTransformer() { _classCallCheck(this, AstMemoryEfficientTransformer); } _createClass2(AstMemoryEfficientTransformer, [{ key: "visitImplicitReceiver", value: function visitImplicitReceiver(ast, context) { return ast; } }, { key: "visitInterpolation", value: function visitInterpolation(ast, context) { var expressions = this.visitAll(ast.expressions); if (expressions !== ast.expressions) return new Interpolation(ast.span, ast.strings, expressions); return ast; } }, { key: "visitLiteralPrimitive", value: function visitLiteralPrimitive(ast, context) { return ast; } }, { key: "visitPropertyRead", value: function visitPropertyRead(ast, context) { var receiver = ast.receiver.visit(this); if (receiver !== ast.receiver) { return new PropertyRead(ast.span, receiver, ast.name); } return ast; } }, { key: "visitPropertyWrite", value: function visitPropertyWrite(ast, context) { var receiver = ast.receiver.visit(this); var value = ast.value.visit(this); if (receiver !== ast.receiver || value !== ast.value) { return new PropertyWrite(ast.span, receiver, ast.name, value); } return ast; } }, { key: "visitSafePropertyRead", value: function visitSafePropertyRead(ast, context) { var receiver = ast.receiver.visit(this); if (receiver !== ast.receiver) { return new SafePropertyRead(ast.span, receiver, ast.name); } return ast; } }, { key: "visitMethodCall", value: function visitMethodCall(ast, context) { var receiver = ast.receiver.visit(this); var args = this.visitAll(ast.args); if (receiver !== ast.receiver || args !== ast.args) { return new MethodCall(ast.span, receiver, ast.name, args); } return ast; } }, { key: "visitSafeMethodCall", value: function visitSafeMethodCall(ast, context) { var receiver = ast.receiver.visit(this); var args = this.visitAll(ast.args); if (receiver !== ast.receiver || args !== ast.args) { return new SafeMethodCall(ast.span, receiver, ast.name, args); } return ast; } }, { key: "visitFunctionCall", value: function visitFunctionCall(ast, context) { var target = ast.target && ast.target.visit(this); var args = this.visitAll(ast.args); if (target !== ast.target || args !== ast.args) { return new FunctionCall(ast.span, target, args); } return ast; } }, { key: "visitLiteralArray", value: function visitLiteralArray(ast, context) { var expressions = this.visitAll(ast.expressions); if (expressions !== ast.expressions) { return new LiteralArray(ast.span, expressions); } return ast; } }, { key: "visitLiteralMap", value: function visitLiteralMap(ast, context) { var values = this.visitAll(ast.values); if (values !== ast.values) { return new LiteralMap(ast.span, ast.keys, values); } return ast; } }, { key: "visitBinary", value: function visitBinary(ast, context) { var left = ast.left.visit(this); var right = ast.right.visit(this); if (left !== ast.left || right !== ast.right) { return new Binary(ast.span, ast.operation, left, right); } return ast; } }, { key: "visitPrefixNot", value: function visitPrefixNot(ast, context) { var expression = ast.expression.visit(this); if (expression !== ast.expression) { return new PrefixNot(ast.span, expression); } return ast; } }, { key: "visitNonNullAssert", value: function visitNonNullAssert(ast, context) { var expression = ast.expression.visit(this); if (expression !== ast.expression) { return new NonNullAssert(ast.span, expression); } return ast; } }, { key: "visitConditional", value: function visitConditional(ast, context) { var condition = ast.condition.visit(this); var trueExp = ast.trueExp.visit(this); var falseExp = ast.falseExp.visit(this); if (condition !== ast.condition || trueExp !== ast.trueExp || falseExp !== ast.falseExp) { return new Conditional(ast.span, condition, trueExp, falseExp); } return ast; } }, { key: "visitPipe", value: function visitPipe(ast, context) { var exp = ast.exp.visit(this); var args = this.visitAll(ast.args); if (exp !== ast.exp || args !== ast.args) { return new BindingPipe(ast.span, exp, ast.name, args); } return ast; } }, { key: "visitKeyedRead", value: function visitKeyedRead(ast, context) { var obj = ast.obj.visit(this); var key = ast.key.visit(this); if (obj !== ast.obj || key !== ast.key) { return new KeyedRead(ast.span, obj, key); } return ast; } }, { key: "visitKeyedWrite", value: function visitKeyedWrite(ast, context) { var obj = ast.obj.visit(this); var key = ast.key.visit(this); var value = ast.value.visit(this); if (obj !== ast.obj || key !== ast.key || value !== ast.value) { return new KeyedWrite(ast.span, obj, key, value); } return ast; } }, { key: "visitAll", value: function visitAll(asts) { var res = new Array(asts.length); var modified = false; for (var i = 0; i < asts.length; ++i) { var original = asts[i]; var value = original.visit(this); res[i] = value; modified = modified || value !== original; } return modified ? res : asts; } }, { key: "visitChain", value: function visitChain(ast, context) { var expressions = this.visitAll(ast.expressions); if (expressions !== ast.expressions) { return new Chain(ast.span, expressions); } return ast; } }, { key: "visitQuote", value: function visitQuote(ast, context) { return ast; } }]); return AstMemoryEfficientTransformer; }(); function visitAstChildren(ast, visitor, context) { function visit(ast) { visitor.visit && visitor.visit(ast, context) || ast.visit(visitor, context); } function visitAll(asts) { asts.forEach(visit); } ast.visit({ visitBinary: function visitBinary(ast) { visit(ast.left); visit(ast.right); }, visitChain: function visitChain(ast) { visitAll(ast.expressions); }, visitConditional: function visitConditional(ast) { visit(ast.condition); visit(ast.trueExp); visit(ast.falseExp); }, visitFunctionCall: function visitFunctionCall(ast) { if (ast.target) { visit(ast.target); } visitAll(ast.args); }, visitImplicitReceiver: function visitImplicitReceiver(ast) {}, visitInterpolation: function visitInterpolation(ast) { visitAll(ast.expressions); }, visitKeyedRead: function visitKeyedRead(ast) { visit(ast.obj); visit(ast.key); }, visitKeyedWrite: function visitKeyedWrite(ast) { visit(ast.obj); visit(ast.key); visit(ast.obj); }, visitLiteralArray: function visitLiteralArray(ast) { visitAll(ast.expressions); }, visitLiteralMap: function visitLiteralMap(ast) {}, visitLiteralPrimitive: function visitLiteralPrimitive(ast) {}, visitMethodCall: function visitMethodCall(ast) { visit(ast.receiver); visitAll(ast.args); }, visitPipe: function visitPipe(ast) { visit(ast.exp); visitAll(ast.args); }, visitPrefixNot: function visitPrefixNot(ast) { visit(ast.expression); }, visitNonNullAssert: function visitNonNullAssert(ast) { visit(ast.expression); }, visitPropertyRead: function visitPropertyRead(ast) { visit(ast.receiver); }, visitPropertyWrite: function visitPropertyWrite(ast) { visit(ast.receiver); visit(ast.value); }, visitQuote: function visitQuote(ast) {}, visitSafeMethodCall: function visitSafeMethodCall(ast) { visit(ast.receiver); visitAll(ast.args); }, visitSafePropertyRead: function visitSafePropertyRead(ast) { visit(ast.receiver); } }); } // Bindings var ParsedProperty = function ParsedProperty(name, expression, type, sourceSpan, valueSpan) { _classCallCheck(this, ParsedProperty); this.name = name; this.expression = expression; this.type = type; this.sourceSpan = sourceSpan; this.valueSpan = valueSpan; this.isLiteral = this.type === ParsedPropertyType.LITERAL_ATTR; this.isAnimation = this.type === ParsedPropertyType.ANIMATION; }; var ParsedPropertyType; (function (ParsedPropertyType) { ParsedPropertyType[ParsedPropertyType["DEFAULT"] = 0] = "DEFAULT"; ParsedPropertyType[ParsedPropertyType["LITERAL_ATTR"] = 1] = "LITERAL_ATTR"; ParsedPropertyType[ParsedPropertyType["ANIMATION"] = 2] = "ANIMATION"; })(ParsedPropertyType || (ParsedPropertyType = {})); var ParsedEvent = // Regular events have a target // Animation events have a phase function ParsedEvent(name, targetOrPhase, type, handler, sourceSpan, handlerSpan) { _classCallCheck(this, ParsedEvent); this.name = name; this.targetOrPhase = targetOrPhase; this.type = type; this.handler = handler; this.sourceSpan = sourceSpan; this.handlerSpan = handlerSpan; }; var ParsedVariable = function ParsedVariable(name, value, sourceSpan) { _classCallCheck(this, ParsedVariable); this.name = name; this.value = value; this.sourceSpan = sourceSpan; }; var BoundElementProperty = function BoundElementProperty(name, type, securityContext, value, unit, sourceSpan, valueSpan) { _classCallCheck(this, BoundElementProperty); this.name = name; this.type = type; this.securityContext = securityContext; this.value = value; this.unit = unit; this.sourceSpan = sourceSpan; this.valueSpan = valueSpan; }; /** * @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 EventHandlerVars = function EventHandlerVars() { _classCallCheck(this, EventHandlerVars); }; EventHandlerVars.event = variable('$event'); var ConvertActionBindingResult = function ConvertActionBindingResult( /** * Render2 compatible statements, */ stmts, /** * Variable name used with render2 compatible statements. */ allowDefault) { _classCallCheck(this, ConvertActionBindingResult); this.stmts = stmts; this.allowDefault = allowDefault; /** * This is bit of a hack. It converts statements which render2 expects to statements which are * expected by render3. * * Example: `<div click="doSomething($event)">` will generate: * * Render3: * ``` * const pd_b:any = ((<any>ctx.doSomething($event)) !== false); * return pd_b; * ``` * * but render2 expects: * ``` * return ctx.doSomething($event); * ``` */ // TODO(misko): remove this hack once we no longer support ViewEngine. this.render3Stmts = stmts.map(function (statement) { if (statement instanceof DeclareVarStmt && statement.name == allowDefault.name && statement.value instanceof BinaryOperatorExpr) { var lhs = statement.value.lhs; return new ReturnStatement(lhs.value); } return statement; }); }; /** * Converts the given expression AST into an executable output AST, assuming the expression is * used in an action binding (e.g. an event handler). */ function convertActionBinding(localResolver, implicitReceiver, action, bindingId, interpolationFunction, baseSourceSpan) { if (!localResolver) { localResolver = new DefaultLocalResolver(); } var actionWithoutBuiltins = convertPropertyBindingBuiltins({ createLiteralArrayConverter: function createLiteralArrayConverter(argCount) { // Note: no caching for literal arrays in actions. return function (args) { return literalArr(args); }; }, createLiteralMapConverter: function createLiteralMapConverter(keys) { // Note: no caching for literal maps in actions. return function (values) { var entries = keys.map(function (k, i) { return { key: k.key, value: values[i], quoted: k.quoted }; }); return literalMap(entries); }; }, createPipeConverter: function createPipeConverter(name) { throw new Error("Illegal State: Actions are not allowed to contain pipes. Pipe: ".concat(name)); } }, action); var visitor = new _AstToIrVisitor(localResolver, implicitReceiver, bindingId, interpolationFunction, baseSourceSpan); var actionStmts = []; flattenStatements(actionWithoutBuiltins.visit(visitor, _Mode.Statement), actionStmts); prependTemporaryDecls(visitor.temporaryCount, bindingId, actionStmts); if (visitor.usesImplicitReceiver) { localResolver.notifyImplicitReceiverUse(); } var lastIndex = actionStmts.length - 1; var preventDefaultVar = null; if (lastIndex >= 0) { var lastStatement = actionStmts[lastIndex]; var returnExpr = convertStmtIntoExpression(lastStatement); if (returnExpr) { // Note: We need to cast the result of the method call to dynamic, // as it might be a void method! preventDefaultVar = createPreventDefaultVar(bindingId); actionStmts[lastIndex] = preventDefaultVar.set(returnExpr.cast(DYNAMIC_TYPE).notIdentical(literal(false))).toDeclStmt(null, [StmtModifier.Final]); } } return new ConvertActionBindingResult(actionStmts, preventDefaultVar); } function convertPropertyBindingBuiltins(converterFactory, ast) { return convertBuiltins(converterFactory, ast); } var ConvertPropertyBindingResult = function ConvertPropertyBindingResult(stmts, currValExpr) { _classCallCheck(this, ConvertPropertyBindingResult); this.stmts = stmts; this.currValExpr = currValExpr; }; var BindingForm; (function (BindingForm) { // The general form of binding expression, supports all expressions. BindingForm[BindingForm["General"] = 0] = "General"; // Try to generate a simple binding (no temporaries or statements) // otherwise generate a general binding BindingForm[BindingForm["TrySimple"] = 1] = "TrySimple"; })(BindingForm || (BindingForm = {})); /** * Converts the given expression AST into an executable output AST, assuming the expression * is used in property binding. The expression has to be preprocessed via * `convertPropertyBindingBuiltins`. */ function _convertPropertyBinding(localResolver, implicitReceiver, expressionWithoutBuiltins, bindingId, form, interpolationFunction) { if (!localResolver) { localResolver = new DefaultLocalResolver(); } var currValExpr = createCurrValueExpr(bindingId); var visitor = new _AstToIrVisitor(localResolver, implicitReceiver, bindingId, interpolationFunction); var outputExpr = expressionWithoutBuiltins.visit(visitor, _Mode.Expression); var stmts = getStatementsFromVisitor(visitor, bindingId); if (visitor.usesImplicitReceiver) { localResolver.notifyImplicitReceiverUse(); } if (visitor.temporaryCount === 0 && form == BindingForm.TrySimple) { return new ConvertPropertyBindingResult([], outputExpr); } stmts.push(currValExpr.set(outputExpr).toDeclStmt(DYNAMIC_TYPE, [StmtModifier.Final])); return new ConvertPropertyBindingResult(stmts, currValExpr); } /** * Given some expression, such as a binding or interpolation expression, and a context expression to * look values up on, visit each facet of the given expression resolving values from the context * expression such that a list of arguments can be derived from the found values that can be used as * arguments to an external update instruction. * * @param localResolver The resolver to use to look up expressions by name appropriately * @param contextVariableExpression The expression representing the context variable used to create * the final argument expressions * @param expressionWithArgumentsToExtract The expression to visit to figure out what values need to * be resolved and what arguments list to build. * @param bindingId A name prefix used to create temporary variable names if they're needed for the * arguments generated * @returns An array of expressions that can be passed as arguments to instruction expressions like * `o.importExpr(R3.propertyInterpolate).callFn(result)` */ function convertUpdateArguments(localResolver, contextVariableExpression, expressionWithArgumentsToExtract, bindingId) { var visitor = new _AstToIrVisitor(localResolver, contextVariableExpression, bindingId, undefined); var outputExpr = expressionWithArgumentsToExtract.visit(visitor, _Mode.Expression); if (visitor.usesImplicitReceiver) { localResolver.notifyImplicitReceiverUse(); } var stmts = getStatementsFromVisitor(visitor, bindingId); // Removing the first argument, because it was a length for ViewEngine, not Ivy. var args = outputExpr.args.slice(1); if (expressionWithArgumentsToExtract instanceof Interpolation) { // If we're dealing with an interpolation of 1 value with an empty prefix and suffix, reduce the // args returned to just the value, because we're going to pass it to a special instruction. var strings = expressionWithArgumentsToExtract.strings; if (args.length === 3 && strings[0] === '' && strings[1] === '') { // Single argument interpolate instructions. args = [args[1]]; } else if (args.length >= 19) { // 19 or more arguments must be passed to the `interpolateV`-style instructions, which accept // an array of arguments args = [literalArr(args)]; } } return { stmts: stmts, args: args }; } function getStatementsFromVisitor(visitor, bindingId) { var stmts = []; for (var i = 0; i < visitor.temporaryCount; i++) { stmts.push(temporaryDeclaration(bindingId, i)); } return stmts; } function convertBuiltins(converterFactory, ast) { var visitor = new _BuiltinAstConverter(converterFactory); return ast.visit(visitor); } function temporaryName(bindingId, temporaryNumber) { return "tmp_".concat(bindingId, "_").concat(temporaryNumber); } function temporaryDeclaration(bindingId, temporaryNumber) { return new DeclareVarStmt(temporaryName(bindingId, temporaryNumber), NULL_EXPR); } function prependTemporaryDecls(temporaryCount, bindingId, statements) { for (var i = temporaryCount - 1; i >= 0; i--) { statements.unshift(temporaryDeclaration(bindingId, i)); } } var _Mode; (function (_Mode) { _Mode[_Mode["Statement"] = 0] = "Statement"; _Mode[_Mode["Expression"] = 1] = "Expression"; })(_Mode || (_Mode = {})); function ensureStatementMode(mode, ast) { if (mode !== _Mode.Statement) { throw new Error("Expected a statement, but saw ".concat(ast)); } } function ensureExpressionMode(mode, ast) { if (mode !== _Mode.Expression) { throw new Error("Expected an expression, but saw ".concat(ast)); } } function convertToStatementIfNeeded(mode, expr) { if (mode === _Mode.Statement) { return expr.toStmt(); } else { return expr; } } var _BuiltinAstConverter = /*#__PURE__*/function (_AstTransformer$) { _inherits(_BuiltinAstConverter, _AstTransformer$); var _super80 = _createSuper(_BuiltinAstConverter); function _BuiltinAstConverter(_converterFactory) { var _this132; _classCallCheck(this, _BuiltinAstConverter); _this132 = _super80.call(this); _this132._converterFactory = _converterFactory; return _this132; } _createClass2(_BuiltinAstConverter, [{ key: "visitPipe", value: function visitPipe(ast, context) { var _this133 = this; var args = [ast.exp].concat(_toConsumableArray(ast.args)).map(function (ast) { return ast.visit(_this133, context); }); return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createPipeConverter(ast.name, args.length)); } }, { key: "visitLiteralArray", value: function visitLiteralArray(ast, context) { var _this134 = this; var args = ast.expressions.map(function (ast) { return ast.visit(_this134, context); }); return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createLiteralArrayConverter(ast.expressions.length)); } }, { key: "visitLiteralMap", value: function visitLiteralMap(ast, context) { var _this135 = this; var args = ast.values.map(function (ast) { return ast.visit(_this135, context); }); return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createLiteralMapConverter(ast.keys)); } }]); return _BuiltinAstConverter; }(AstTransformer$1); var _AstToIrVisitor = /*#__PURE__*/function () { function _AstToIrVisitor(_localResolver, _implicitReceiver, bindingId, interpolationFunction, baseSourceSpan) { _classCallCheck(this, _AstToIrVisitor); this._localResolver = _localResolver; this._implicitReceiver = _implicitReceiver; this.bindingId = bindingId; this.interpolationFunction = interpolationFunction; this.baseSourceSpan = baseSourceSpan; this._nodeMap = new Map(); this._resultMap = new Map(); this._currentTemporary = 0; this.temporaryCount = 0; this.usesImplicitReceiver = false; } _createClass2(_AstToIrVisitor, [{ key: "visitBinary", value: function visitBinary(ast, mode) { var op; switch (ast.operation) { case '+': op = BinaryOperator.Plus; break; case '-': op = BinaryOperator.Minus; break; case '*': op = BinaryOperator.Multiply; break; case '/': op = BinaryOperator.Divide; break; case '%': op = BinaryOperator.Modulo; break; case '&&': op = BinaryOperator.And; break; case '||': op = BinaryOperator.Or; break; case '==': op = BinaryOperator.Equals; break; case '!=': op = BinaryOperator.NotEquals; break; case '===': op = BinaryOperator.Identical; break; case '!==': op = BinaryOperator.NotIdentical; break; case '<': op = BinaryOperator.Lower; break; case '>': op = BinaryOperator.Bigger; break; case '<=': op = BinaryOperator.LowerEquals; break; case '>=': op = BinaryOperator.BiggerEquals; break; default: throw new Error("Unsupported operation ".concat(ast.operation)); } return convertToStatementIfNeeded(mode, new BinaryOperatorExpr(op, this._visit(ast.left, _Mode.Expression), this._visit(ast.right, _Mode.Expression), undefined, this.convertSourceSpan(ast.span))); } }, { key: "visitChain", value: function visitChain(ast, mode) { ensureStatementMode(mode, ast); return this.visitAll(ast.expressions, mode); } }, { key: "visitConditional", value: function visitConditional(ast, mode) { var value = this._visit(ast.condition, _Mode.Expression); return convertToStatementIfNeeded(mode, value.conditional(this._visit(ast.trueExp, _Mode.Expression), this._visit(ast.falseExp, _Mode.Expression), this.convertSourceSpan(ast.span))); } }, { key: "visitPipe", value: function visitPipe(ast, mode) { throw new Error("Illegal state: Pipes should have been converted into functions. Pipe: ".concat(ast.name)); } }, { key: "visitFunctionCall", value: function visitFunctionCall(ast, mode) { var convertedArgs = this.visitAll(ast.args, _Mode.Expression); var fnResult; if (ast instanceof BuiltinFunctionCall) { fnResult = ast.converter(convertedArgs); } else { fnResult = this._visit(ast.target, _Mode.Expression).callFn(convertedArgs, this.convertSourceSpan(ast.span)); } return convertToStatementIfNeeded(mode, fnResult); } }, { key: "visitImplicitReceiver", value: function visitImplicitReceiver(ast, mode) { ensureExpressionMode(mode, ast); this.usesImplicitReceiver = true; return this._implicitReceiver; } }, { key: "visitInterpolation", value: function visitInterpolation(ast, mode) { ensureExpressionMode(mode, ast); var args = [literal(ast.expressions.length)]; for (var i = 0; i < ast.strings.length - 1; i++) { args.push(literal(ast.strings[i])); args.push(this._visit(ast.expressions[i], _Mode.Expression)); } args.push(literal(ast.strings[ast.strings.length - 1])); if (this.interpolationFunction) { return this.interpolationFunction(args); } return ast.expressions.length <= 9 ? importExpr(Identifiers.inlineInterpolate).callFn(args) : importExpr(Identifiers.interpolate).callFn([args[0], literalArr(args.slice(1), undefined, this.convertSourceSpan(ast.span))]); } }, { key: "visitKeyedRead", value: function visitKeyedRead(ast, mode) { var leftMostSafe = this.leftMostSafeNode(ast); if (leftMostSafe) { return this.convertSafeAccess(ast, leftMostSafe, mode); } else { return convertToStatementIfNeeded(mode, this._visit(ast.obj, _Mode.Expression).key(this._visit(ast.key, _Mode.Expression))); } } }, { key: "visitKeyedWrite", value: function visitKeyedWrite(ast, mode) { var obj = this._visit(ast.obj, _Mode.Expression); var key = this._visit(ast.key, _Mode.Expression); var value = this._visit(ast.value, _Mode.Expression); return convertToStatementIfNeeded(mode, obj.key(key).set(value)); } }, { key: "visitLiteralArray", value: function visitLiteralArray(ast, mode) { throw new Error("Illegal State: literal arrays should have been converted into functions"); } }, { key: "visitLiteralMap", value: function visitLiteralMap(ast, mode) { throw new Error("Illegal State: literal maps should have been converted into functions"); } }, { key: "visitLiteralPrimitive", value: function visitLiteralPrimitive(ast, mode) { // For literal values of null, undefined, true, or false allow type interference // to infer the type. var type = ast.value === null || ast.value === undefined || ast.value === true || ast.value === true ? INFERRED_TYPE : undefined; return convertToStatementIfNeeded(mode, literal(ast.value, type, this.convertSourceSpan(ast.span))); } }, { key: "_getLocal", value: function _getLocal(name) { return this._localResolver.getLocal(name); } }, { key: "visitMethodCall", value: function visitMethodCall(ast, mode) { if (ast.receiver instanceof ImplicitReceiver && ast.name == '$any') { var args = this.visitAll(ast.args, _Mode.Expression); if (args.length != 1) { throw new Error("Invalid call to $any, expected 1 argument but received ".concat(args.length || 'none')); } return args[0].cast(DYNAMIC_TYPE, this.convertSourceSpan(ast.span)); } var leftMostSafe = this.leftMostSafeNode(ast); if (leftMostSafe) { return this.convertSafeAccess(ast, leftMostSafe, mode); } else { var _args = this.visitAll(ast.args, _Mode.Expression); var prevUsesImplicitReceiver = this.usesImplicitReceiver; var result = null; var receiver = this._visit(ast.receiver, _Mode.Expression); if (receiver === this._implicitReceiver) { var varExpr = this._getLocal(ast.name); if (varExpr) { // Restore the previous "usesImplicitReceiver" state since the implicit // receiver has been replaced with a resolved local expression. this.usesImplicitReceiver = prevUsesImplicitReceiver; result = varExpr.callFn(_args); } } if (result == null) { result = receiver.callMethod(ast.name, _args, this.convertSourceSpan(ast.span)); } return convertToStatementIfNeeded(mode, result); } } }, { key: "visitPrefixNot", value: function visitPrefixNot(ast, mode) { return convertToStatementIfNeeded(mode, not(this._visit(ast.expression, _Mode.Expression))); } }, { key: "visitNonNullAssert", value: function visitNonNullAssert(ast, mode) { return convertToStatementIfNeeded(mode, assertNotNull(this._visit(ast.expression, _Mode.Expression))); } }, { key: "visitPropertyRead", value: function visitPropertyRead(ast, mode) { var leftMostSafe = this.leftMostSafeNode(ast); if (leftMostSafe) { return this.convertSafeAccess(ast, leftMostSafe, mode); } else { var result = null; var prevUsesImplicitReceiver = this.usesImplicitReceiver; var receiver = this._visit(ast.receiver, _Mode.Expression); if (receiver === this._implicitReceiver) { result = this._getLocal(ast.name); if (result) { // Restore the previous "usesImplicitReceiver" state since the implicit // receiver has been replaced with a resolved local expression. this.usesImplicitReceiver = prevUsesImplicitReceiver; } } if (result == null) { result = receiver.prop(ast.name); } return convertToStatementIfNeeded(mode, result); } } }, { key: "visitPropertyWrite", value: function visitPropertyWrite(ast, mode) { var receiver = this._visit(ast.receiver, _Mode.Expression); var prevUsesImplicitReceiver = this.usesImplicitReceiver; var varExpr = null; if (receiver === this._implicitReceiver) { var localExpr = this._getLocal(ast.name); if (localExpr) { if (localExpr instanceof ReadPropExpr) { // If the local variable is a property read expression, it's a reference // to a 'context.property' value and will be used as the target of the // write expression. varExpr = localExpr; // Restore the previous "usesImplicitReceiver" state since the implicit // receiver has been replaced with a resolved local expression. this.usesImplicitReceiver = prevUsesImplicitReceiver; } else { // Otherwise it's an error. throw new Error('Cannot assign to a reference or variable!'); } } } // If no local expression could be produced, use the original receiver's // property as the target. if (varExpr === null) { varExpr = receiver.prop(ast.name); } return convertToStatementIfNeeded(mode, varExpr.set(this._visit(ast.value, _Mode.Expression))); } }, { key: "visitSafePropertyRead", value: function visitSafePropertyRead(ast, mode) { return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode); } }, { key: "visitSafeMethodCall", value: function visitSafeMethodCall(ast, mode) { return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode); } }, { key: "visitAll", value: function visitAll(asts, mode) { var _this136 = this; return asts.map(function (ast) { return _this136._visit(ast, mode); }); } }, { key: "visitQuote", value: function visitQuote(ast, mode) { throw new Error("Quotes are not supported for evaluation!\n Statement: ".concat(ast.uninterpretedExpression, " located at ").concat(ast.location)); } }, { key: "_visit", value: function _visit(ast, mode) { var result = this._resultMap.get(ast); if (result) return result; return (this._nodeMap.get(ast) || ast).visit(this, mode); } }, { key: "convertSafeAccess", value: function convertSafeAccess(ast, leftMostSafe, mode) { // If the expression contains a safe access node on the left it needs to be converted to // an expression that guards the access to the member by checking the receiver for blank. As // execution proceeds from left to right, the left most part of the expression must be guarded // first but, because member access is left associative, the right side of the expression is at // the top of the AST. The desired result requires lifting a copy of the the left part of the // expression up to test it for blank before generating the unguarded version. // Consider, for example the following expression: a?.b.c?.d.e // This results in the ast: // . // / \ // ?. e // / \ // . d // / \ // ?. c // / \ // a b // The following tree should be generated: // // /---- ? ----\ // / | \ // a /--- ? ---\ null // / | \ // . . null // / \ / \ // . c . e // / \ / \ // a b . d // / \ // . c // / \ // a b // // Notice that the first guard condition is the left hand of the left most safe access node // which comes in as leftMostSafe to this routine. var guardedExpression = this._visit(leftMostSafe.receiver, _Mode.Expression); var temporary = undefined; if (this.needsTemporary(leftMostSafe.receiver)) { // If the expression has method calls or pipes then we need to save the result into a // temporary variable to avoid calling stateful or impure code more than once. temporary = this.allocateTemporary(); // Preserve the result in the temporary variable guardedExpression = temporary.set(guardedExpression); // Ensure all further references to the guarded expression refer to the temporary instead. this._resultMap.set(leftMostSafe.receiver, temporary); } var condition = guardedExpression.isBlank(); // Convert the ast to an unguarded access to the receiver's member. The map will substitute // leftMostNode with its unguarded version in the call to `this.visit()`. if (leftMostSafe instanceof SafeMethodCall) { this._nodeMap.set(leftMostSafe, new MethodCall(leftMostSafe.span, leftMostSafe.receiver, leftMostSafe.name, leftMostSafe.args)); } else { this._nodeMap.set(leftMostSafe, new PropertyRead(leftMostSafe.span, leftMostSafe.receiver, leftMostSafe.name)); } // Recursively convert the node now without the guarded member access. var access = this._visit(ast, _Mode.Expression); // Remove the mapping. This is not strictly required as the converter only traverses each node // once but is safer if the conversion is changed to traverse the nodes more than once. this._nodeMap["delete"](leftMostSafe); // If we allocated a temporary, release it. if (temporary) { this.releaseTemporary(temporary); } // Produce the conditional return convertToStatementIfNeeded(mode, condition.conditional(literal(null), access)); } // Given a expression of the form a?.b.c?.d.e the the left most safe node is // the (a?.b). The . and ?. are left associative thus can be rewritten as: // ((((a?.c).b).c)?.d).e. This returns the most deeply nested safe read or // safe method call as this needs be transform initially to: // a == null ? null : a.c.b.c?.d.e // then to: // a == null ? null : a.b.c == null ? null : a.b.c.d.e }, { key: "leftMostSafeNode", value: function leftMostSafeNode(ast) { var _this137 = this; var visit = function visit(visitor, ast) { return (_this137._nodeMap.get(ast) || ast).visit(visitor); }; return ast.visit({ visitBinary: function visitBinary(ast) { return null; }, visitChain: function visitChain(ast) { return null; }, visitConditional: function visitConditional(ast) { return null; }, visitFunctionCall: function visitFunctionCall(ast) { return null; }, visitImplicitReceiver: function visitImplicitReceiver(ast) { return null; }, visitInterpolation: function visitInterpolation(ast) { return null; }, visitKeyedRead: function visitKeyedRead(ast) { return visit(this, ast.obj); }, visitKeyedWrite: function visitKeyedWrite(ast) { return null; }, visitLiteralArray: function visitLiteralArray(ast) { return null; }, visitLiteralMap: function visitLiteralMap(ast) { return null; }, visitLiteralPrimitive: function visitLiteralPrimitive(ast) { return null; }, visitMethodCall: function visitMethodCall(ast) { return visit(this, ast.receiver); }, visitPipe: function visitPipe(ast) { return null; }, visitPrefixNot: function visitPrefixNot(ast) { return null; }, visitNonNullAssert: function visitNonNullAssert(ast) { return null; }, visitPropertyRead: function visitPropertyRead(ast) { return visit(this, ast.receiver); }, visitPropertyWrite: function visitPropertyWrite(ast) { return null; }, visitQuote: function visitQuote(ast) { return null; }, visitSafeMethodCall: function visitSafeMethodCall(ast) { return visit(this, ast.receiver) || ast; }, visitSafePropertyRead: function visitSafePropertyRead(ast) { return visit(this, ast.receiver) || ast; } }); } // Returns true of the AST includes a method or a pipe indicating that, if the // expression is used as the target of a safe property or method access then // the expression should be stored into a temporary variable. }, { key: "needsTemporary", value: function needsTemporary(ast) { var _this138 = this; var visit = function visit(visitor, ast) { return ast && (_this138._nodeMap.get(ast) || ast).visit(visitor); }; var visitSome = function visitSome(visitor, ast) { return ast.some(function (ast) { return visit(visitor, ast); }); }; return ast.visit({ visitBinary: function visitBinary(ast) { return visit(this, ast.left) || visit(this, ast.right); }, visitChain: function visitChain(ast) { return false; }, visitConditional: function visitConditional(ast) { return visit(this, ast.condition) || visit(this, ast.trueExp) || visit(this, ast.falseExp); }, visitFunctionCall: function visitFunctionCall(ast) { return true; }, visitImplicitReceiver: function visitImplicitReceiver(ast) { return false; }, visitInterpolation: function visitInterpolation(ast) { return visitSome(this, ast.expressions); }, visitKeyedRead: function visitKeyedRead(ast) { return false; }, visitKeyedWrite: function visitKeyedWrite(ast) { return false; }, visitLiteralArray: function visitLiteralArray(ast) { return true; }, visitLiteralMap: function visitLiteralMap(ast) { return true; }, visitLiteralPrimitive: function visitLiteralPrimitive(ast) { return false; }, visitMethodCall: function visitMethodCall(ast) { return true; }, visitPipe: function visitPipe(ast) { return true; }, visitPrefixNot: function visitPrefixNot(ast) { return visit(this, ast.expression); }, visitNonNullAssert: function visitNonNullAssert(ast) { return visit(this, ast.expression); }, visitPropertyRead: function visitPropertyRead(ast) { return false; }, visitPropertyWrite: function visitPropertyWrite(ast) { return false; }, visitQuote: function visitQuote(ast) { return false; }, visitSafeMethodCall: function visitSafeMethodCall(ast) { return true; }, visitSafePropertyRead: function visitSafePropertyRead(ast) { return false; } }); } }, { key: "allocateTemporary", value: function allocateTemporary() { var tempNumber = this._currentTemporary++; this.temporaryCount = Math.max(this._currentTemporary, this.temporaryCount); return new ReadVarExpr(temporaryName(this.bindingId, tempNumber)); } }, { key: "releaseTemporary", value: function releaseTemporary(temporary) { this._currentTemporary--; if (temporary.name != temporaryName(this.bindingId, this._currentTemporary)) { throw new Error("Temporary ".concat(temporary.name, " released out of order")); } } /** * Creates an absolute `ParseSourceSpan` from the relative `ParseSpan`. * * `ParseSpan` objects are relative to the start of the expression. * This method converts these to full `ParseSourceSpan` objects that * show where the span is within the overall source file. * * @param span the relative span to convert. * @returns a `ParseSourceSpan` for the the given span or null if no * `baseSourceSpan` was provided to this class. */ }, { key: "convertSourceSpan", value: function convertSourceSpan(span) { if (this.baseSourceSpan) { var start = this.baseSourceSpan.start.moveBy(span.start); var end = this.baseSourceSpan.start.moveBy(span.end); return new ParseSourceSpan(start, end); } else { return null; } } }]); return _AstToIrVisitor; }(); function flattenStatements(arg, output) { if (Array.isArray(arg)) { arg.forEach(function (entry) { return flattenStatements(entry, output); }); } else { output.push(arg); } } var DefaultLocalResolver = /*#__PURE__*/function () { function DefaultLocalResolver() { _classCallCheck(this, DefaultLocalResolver); } _createClass2(DefaultLocalResolver, [{ key: "notifyImplicitReceiverUse", value: function notifyImplicitReceiverUse() {} }, { key: "getLocal", value: function getLocal(name) { if (name === EventHandlerVars.event.name) { return EventHandlerVars.event; } return null; } }]); return DefaultLocalResolver; }(); function createCurrValueExpr(bindingId) { return variable("currVal_".concat(bindingId)); // fix syntax highlighting: ` } function createPreventDefaultVar(bindingId) { return variable("pd_".concat(bindingId)); } function convertStmtIntoExpression(stmt) { if (stmt instanceof ExpressionStatement) { return stmt.expr; } else if (stmt instanceof ReturnStatement) { return stmt.value; } return null; } var BuiltinFunctionCall = /*#__PURE__*/function (_FunctionCall) { _inherits(BuiltinFunctionCall, _FunctionCall); var _super81 = _createSuper(BuiltinFunctionCall); function BuiltinFunctionCall(span, args, converter) { var _this139; _classCallCheck(this, BuiltinFunctionCall); _this139 = _super81.call(this, span, null, args); _this139.args = args; _this139.converter = converter; return _this139; } return BuiltinFunctionCall; }(FunctionCall); /** * @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 file is a port of shadowCSS from webcomponents.js to TypeScript. * * Please make sure to keep to edits in sync with the source file. * * Source: * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js * * The original file level comment is reproduced below */ /* This is a limited shim for ShadowDOM css styling. https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#styles The intention here is to support only the styling features which can be relatively simply implemented. The goal is to allow users to avoid the most obvious pitfalls and do so without compromising performance significantly. For ShadowDOM styling that's not covered here, a set of best practices can be provided that should allow users to accomplish more complex styling. The following is a list of specific ShadowDOM styling features and a brief discussion of the approach used to shim. Shimmed features: * :host, :host-context: ShadowDOM allows styling of the shadowRoot's host element using the :host rule. To shim this feature, the :host styles are reformatted and prefixed with a given scope name and promoted to a document level stylesheet. For example, given a scope name of .foo, a rule like this: :host { background: red; } } becomes: .foo { background: red; } * encapsulation: Styles defined within ShadowDOM, apply only to dom inside the ShadowDOM. Polymer uses one of two techniques to implement this feature. By default, rules are prefixed with the host element tag name as a descendant selector. This ensures styling does not leak out of the 'top' of the element's ShadowDOM. For example, div { font-weight: bold; } becomes: x-foo div { font-weight: bold; } becomes: Alternatively, if WebComponents.ShadowCSS.strictStyling is set to true then selectors are scoped by adding an attribute selector suffix to each simple selector that contains the host element tag name. Each element in the element's ShadowDOM template is also given the scope attribute. Thus, these rules match only elements that have the scope attribute. For example, given a scope name of x-foo, a rule like this: div { font-weight: bold; } becomes: div[x-foo] { font-weight: bold; } Note that elements that are dynamically added to a scope must have the scope selector added to them manually. * upper/lower bound encapsulation: Styles which are defined outside a shadowRoot should not cross the ShadowDOM boundary and should not apply inside a shadowRoot. This styling behavior is not emulated. Some possible ways to do this that were rejected due to complexity and/or performance concerns include: (1) reset every possible property for every possible selector for a given scope name; (2) re-implement css in javascript. As an alternative, users should make sure to use selectors specific to the scope in which they are working. * ::distributed: This behavior is not emulated. It's often not necessary to style the contents of a specific insertion point and instead, descendants of the host element can be styled selectively. Users can also create an extra node around an insertion point and style that node's contents via descendent selectors. For example, with a shadowRoot like this: <style> ::content(div) { background: red; } </style> <content></content> could become: <style> / *@polyfill .content-container div * / ::content(div) { background: red; } </style> <div class="content-container"> <content></content> </div> Note the use of @polyfill in the comment above a ShadowDOM specific style declaration. This is a directive to the styling shim to use the selector in comments in lieu of the next selector when running under polyfill. */ var ShadowCss = /*#__PURE__*/function () { function ShadowCss() { _classCallCheck(this, ShadowCss); this.strictStyling = true; } /* * Shim some cssText with the given selector. Returns cssText that can * be included in the document via WebComponents.ShadowCSS.addCssToDocument(css). * * When strictStyling is true: * - selector is the attribute added to all elements inside the host, * - hostSelector is the attribute added to the host itself. */ _createClass2(ShadowCss, [{ key: "shimCssText", value: function shimCssText(cssText, selector) { var hostSelector = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; var commentsWithHash = extractCommentsWithHash(cssText); cssText = stripComments(cssText); cssText = this._insertDirectives(cssText); var scopedCssText = this._scopeCssText(cssText, selector, hostSelector); return [scopedCssText].concat(_toConsumableArray(commentsWithHash)).join('\n'); } }, { key: "_insertDirectives", value: function _insertDirectives(cssText) { cssText = this._insertPolyfillDirectivesInCssText(cssText); return this._insertPolyfillRulesInCssText(cssText); } /* * Process styles to convert native ShadowDOM rules that will trip * up the css parser; we rely on decorating the stylesheet with inert rules. * * For example, we convert this rule: * * polyfill-next-selector { content: ':host menu-item'; } * ::content menu-item { * * to this: * * scopeName menu-item { * **/ }, { key: "_insertPolyfillDirectivesInCssText", value: function _insertPolyfillDirectivesInCssText(cssText) { // Difference with webcomponents.js: does not handle comments return cssText.replace(_cssContentNextSelectorRe, function () { return (arguments.length <= 2 ? undefined : arguments[2]) + '{'; }); } /* * Process styles to add rules which will only apply under the polyfill * * For example, we convert this rule: * * polyfill-rule { * content: ':host menu-item'; * ... * } * * to this: * * scopeName menu-item {...} * **/ }, { key: "_insertPolyfillRulesInCssText", value: function _insertPolyfillRulesInCssText(cssText) { // Difference with webcomponents.js: does not handle comments return cssText.replace(_cssContentRuleRe, function () { for (var _len3 = arguments.length, m = new Array(_len3), _key4 = 0; _key4 < _len3; _key4++) { m[_key4] = arguments[_key4]; } var rule = m[0].replace(m[1], '').replace(m[2], ''); return m[4] + rule; }); } /* Ensure styles are scoped. Pseudo-scoping takes a rule like: * * .foo {... } * * and converts this to * * scopeName .foo { ... } */ }, { key: "_scopeCssText", value: function _scopeCssText(cssText, scopeSelector, hostSelector) { var unscopedRules = this._extractUnscopedRulesFromCssText(cssText); // replace :host and :host-context -shadowcsshost and -shadowcsshost respectively cssText = this._insertPolyfillHostInCssText(cssText); cssText = this._convertColonHost(cssText); cssText = this._convertColonHostContext(cssText); cssText = this._convertShadowDOMSelectors(cssText); if (scopeSelector) { cssText = this._scopeSelectors(cssText, scopeSelector, hostSelector); } cssText = cssText + '\n' + unscopedRules; return cssText.trim(); } /* * Process styles to add rules which will only apply under the polyfill * and do not process via CSSOM. (CSSOM is destructive to rules on rare * occasions, e.g. -webkit-calc on Safari.) * For example, we convert this rule: * * @polyfill-unscoped-rule { * content: 'menu-item'; * ... } * * to this: * * menu-item {...} * **/ }, { key: "_extractUnscopedRulesFromCssText", value: function _extractUnscopedRulesFromCssText(cssText) { // Difference with webcomponents.js: does not handle comments var r = ''; var m; _cssContentUnscopedRuleRe.lastIndex = 0; while ((m = _cssContentUnscopedRuleRe.exec(cssText)) !== null) { var rule = m[0].replace(m[2], '').replace(m[1], m[4]); r += rule + '\n\n'; } return r; } /* * convert a rule like :host(.foo) > .bar { } * * to * * .foo<scopeName> > .bar */ }, { key: "_convertColonHost", value: function _convertColonHost(cssText) { return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer); } /* * convert a rule like :host-context(.foo) > .bar { } * * to * * .foo<scopeName> > .bar, .foo scopeName > .bar { } * * and * * :host-context(.foo:host) .bar { ... } * * to * * .foo<scopeName> .bar { ... } */ }, { key: "_convertColonHostContext", value: function _convertColonHostContext(cssText) { return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer); } }, { key: "_convertColonRule", value: function _convertColonRule(cssText, regExp, partReplacer) { // m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule return cssText.replace(regExp, function () { for (var _len4 = arguments.length, m = new Array(_len4), _key5 = 0; _key5 < _len4; _key5++) { m[_key5] = arguments[_key5]; } if (m[2]) { var parts = m[2].split(','); var r = []; for (var i = 0; i < parts.length; i++) { var p = parts[i].trim(); if (!p) break; r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); } return r.join(','); } else { return _polyfillHostNoCombinator + m[3]; } }); } }, { key: "_colonHostContextPartReplacer", value: function _colonHostContextPartReplacer(host, part, suffix) { if (part.indexOf(_polyfillHost) > -1) { return this._colonHostPartReplacer(host, part, suffix); } else { return host + part + suffix + ', ' + part + ' ' + host + suffix; } } }, { key: "_colonHostPartReplacer", value: function _colonHostPartReplacer(host, part, suffix) { return host + part.replace(_polyfillHost, '') + suffix; } /* * Convert combinators like ::shadow and pseudo-elements like ::content * by replacing with space. */ }, { key: "_convertShadowDOMSelectors", value: function _convertShadowDOMSelectors(cssText) { return _shadowDOMSelectorsRe.reduce(function (result, pattern) { return result.replace(pattern, ' '); }, cssText); } // change a selector like 'div' to 'name div' }, { key: "_scopeSelectors", value: function _scopeSelectors(cssText, scopeSelector, hostSelector) { var _this140 = this; return processRules(cssText, function (rule) { var selector = rule.selector; var content = rule.content; if (rule.selector[0] != '@') { selector = _this140._scopeSelector(rule.selector, scopeSelector, hostSelector, _this140.strictStyling); } else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') || rule.selector.startsWith('@page') || rule.selector.startsWith('@document')) { content = _this140._scopeSelectors(rule.content, scopeSelector, hostSelector); } return new CssRule(selector, content); }); } }, { key: "_scopeSelector", value: function _scopeSelector(selector, scopeSelector, hostSelector, strict) { var _this141 = this; return selector.split(',').map(function (part) { return part.trim().split(_shadowDeepSelectors); }).map(function (deepParts) { var _deepParts = _toArray(deepParts), shallowPart = _deepParts[0], otherParts = _deepParts.slice(1); var applyScope = function applyScope(shallowPart) { if (_this141._selectorNeedsScoping(shallowPart, scopeSelector)) { return strict ? _this141._applyStrictSelectorScope(shallowPart, scopeSelector, hostSelector) : _this141._applySelectorScope(shallowPart, scopeSelector, hostSelector); } else { return shallowPart; } }; return [applyScope(shallowPart)].concat(_toConsumableArray(otherParts)).join(' '); }).join(', '); } }, { key: "_selectorNeedsScoping", value: function _selectorNeedsScoping(selector, scopeSelector) { var re = this._makeScopeMatcher(scopeSelector); return !re.test(selector); } }, { key: "_makeScopeMatcher", value: function _makeScopeMatcher(scopeSelector) { var lre = /\[/g; var rre = /\]/g; scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]'); return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); } }, { key: "_applySelectorScope", value: function _applySelectorScope(selector, scopeSelector, hostSelector) { // Difference from webcomponents.js: scopeSelector could not be an array return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector); } // scope via name and [is=name] }, { key: "_applySimpleSelectorScope", value: function _applySimpleSelectorScope(selector, scopeSelector, hostSelector) { // In Android browser, the lastIndex is not reset when the regex is used in String.replace() _polyfillHostRe.lastIndex = 0; if (_polyfillHostRe.test(selector)) { var replaceBy = this.strictStyling ? "[".concat(hostSelector, "]") : scopeSelector; return selector.replace(_polyfillHostNoCombinatorRe, function (hnc, selector) { return selector.replace(/([^:]*)(:*)(.*)/, function (_, before, colon, after) { return before + replaceBy + colon + after; }); }).replace(_polyfillHostRe, replaceBy + ' '); } return scopeSelector + ' ' + selector; } // return a selector with [name] suffix on each simple selector // e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name] /** @internal */ }, { key: "_applyStrictSelectorScope", value: function _applyStrictSelectorScope(selector, scopeSelector, hostSelector) { var _this142 = this; var isRe = /\[is=([^\]]*)\]/g; scopeSelector = scopeSelector.replace(isRe, function (_) { return arguments.length <= 1 ? undefined : arguments[1]; }); var attrName = '[' + scopeSelector + ']'; var _scopeSelectorPart = function _scopeSelectorPart(p) { var scopedP = p.trim(); if (!scopedP) { return ''; } if (p.indexOf(_polyfillHostNoCombinator) > -1) { scopedP = _this142._applySimpleSelectorScope(p, scopeSelector, hostSelector); } else { // remove :host since it should be unnecessary var t = p.replace(_polyfillHostRe, ''); if (t.length > 0) { var matches = t.match(/([^:]*)(:*)(.*)/); if (matches) { scopedP = matches[1] + attrName + matches[2] + matches[3]; } } } return scopedP; }; var safeContent = new SafeSelector(selector); selector = safeContent.content(); var scopedSelector = ''; var startIndex = 0; var res; var sep = /( |>|\+|~(?!=))\s*/g; // If a selector appears before :host it should not be shimmed as it // matches on ancestor elements and not on elements in the host's shadow // `:host-context(div)` is transformed to // `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator` // the `div` is not part of the component in the 2nd selectors and should not be scoped. // Historically `component-tag:host` was matching the component so we also want to preserve // this behavior to avoid breaking legacy apps (it should not match). // The behavior should be: // - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything) // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a // `:host-context(tag)`) var hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1; // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present var shouldScope = !hasHost; while ((res = sep.exec(selector)) !== null) { var separator = res[1]; var _part = selector.slice(startIndex, res.index).trim(); shouldScope = shouldScope || _part.indexOf(_polyfillHostNoCombinator) > -1; var scopedPart = shouldScope ? _scopeSelectorPart(_part) : _part; scopedSelector += "".concat(scopedPart, " ").concat(separator, " "); startIndex = sep.lastIndex; } var part = selector.substring(startIndex); shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1; scopedSelector += shouldScope ? _scopeSelectorPart(part) : part; // replace the placeholders with their original values return safeContent.restore(scopedSelector); } }, { key: "_insertPolyfillHostInCssText", value: function _insertPolyfillHostInCssText(selector) { return selector.replace(_colonHostContextRe, _polyfillHostContext).replace(_colonHostRe, _polyfillHost); } }]); return ShadowCss; }(); var SafeSelector = /*#__PURE__*/function () { function SafeSelector(selector) { var _this143 = this; _classCallCheck(this, SafeSelector); this.placeholders = []; this.index = 0; // Replaces attribute selectors with placeholders. // The WS in [attr="va lue"] would otherwise be interpreted as a selector separator. selector = selector.replace(/(\[[^\]]*\])/g, function (_, keep) { var replaceBy = "__ph-".concat(_this143.index, "__"); _this143.placeholders.push(keep); _this143.index++; return replaceBy; }); // Replaces the expression in `:nth-child(2n + 1)` with a placeholder. // WS and "+" would otherwise be interpreted as selector separators. this._content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, function (_, pseudo, exp) { var replaceBy = "__ph-".concat(_this143.index, "__"); _this143.placeholders.push(exp); _this143.index++; return pseudo + replaceBy; }); } _createClass2(SafeSelector, [{ key: "restore", value: function restore(content) { var _this144 = this; return content.replace(/__ph-(\d+)__/g, function (ph, index) { return _this144.placeholders[+index]; }); } }, { key: "content", value: function content() { return this._content; } }]); return SafeSelector; }(); var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim; var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim; var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim; var _polyfillHost = '-shadowcsshost'; // note: :host-context pre-processed to -shadowcsshostcontext. var _polyfillHostContext = '-shadowcsscontext'; var _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)'; var _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim'); var _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim'); var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/; var _shadowDOMSelectorsRe = [/::shadow/g, /::content/g, // Deprecated selectors /\/shadow-deep\//g, /\/shadow\//g]; // The deep combinator is deprecated in the CSS spec // Support for `>>>`, `deep`, `::ng-deep` is then also deprecated and will be removed in the future. // see https://github.com/angular/angular/pull/17677 var _shadowDeepSelectors = /(?:>>>)|(?:\/deep\/)|(?:::ng-deep)/g; var _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$'; var _polyfillHostRe = /-shadowcsshost/gim; var _colonHostRe = /:host/gim; var _colonHostContextRe = /:host-context/gim; var _commentRe = /\/\*\s*[\s\S]*?\*\//g; function stripComments(input) { return input.replace(_commentRe, ''); } var _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g; function extractCommentsWithHash(input) { return input.match(_commentWithHashRe) || []; } var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g; var _curlyRe = /([{}])/g; var OPEN_CURLY = '{'; var CLOSE_CURLY = '}'; var BLOCK_PLACEHOLDER = '%BLOCK%'; var CssRule = function CssRule(selector, content) { _classCallCheck(this, CssRule); this.selector = selector; this.content = content; }; function processRules(input, ruleCallback) { var inputWithEscapedBlocks = escapeBlocks(input); var nextBlockIndex = 0; return inputWithEscapedBlocks.escapedString.replace(_ruleRe, function () { var selector = arguments.length <= 2 ? undefined : arguments[2]; var content = ''; var suffix = arguments.length <= 4 ? undefined : arguments[4]; var contentPrefix = ''; if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) { content = inputWithEscapedBlocks.blocks[nextBlockIndex++]; suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1); contentPrefix = '{'; } var rule = ruleCallback(new CssRule(selector, content)); return "".concat(arguments.length <= 1 ? undefined : arguments[1]).concat(rule.selector).concat(arguments.length <= 3 ? undefined : arguments[3]).concat(contentPrefix).concat(rule.content).concat(suffix); }); } var StringWithEscapedBlocks = function StringWithEscapedBlocks(escapedString, blocks) { _classCallCheck(this, StringWithEscapedBlocks); this.escapedString = escapedString; this.blocks = blocks; }; function escapeBlocks(input) { var inputParts = input.split(_curlyRe); var resultParts = []; var escapedBlocks = []; var bracketCount = 0; var currentBlockParts = []; for (var partIndex = 0; partIndex < inputParts.length; partIndex++) { var part = inputParts[partIndex]; if (part == CLOSE_CURLY) { bracketCount--; } if (bracketCount > 0) { currentBlockParts.push(part); } else { if (currentBlockParts.length > 0) { escapedBlocks.push(currentBlockParts.join('')); resultParts.push(BLOCK_PLACEHOLDER); currentBlockParts = []; } resultParts.push(part); } if (part == OPEN_CURLY) { bracketCount++; } } if (currentBlockParts.length > 0) { escapedBlocks.push(currentBlockParts.join('')); resultParts.push(BLOCK_PLACEHOLDER); } return new StringWithEscapedBlocks(resultParts.join(''), escapedBlocks); } /** * @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 COMPONENT_VARIABLE = '%COMP%'; var HOST_ATTR = "_nghost-".concat(COMPONENT_VARIABLE); var CONTENT_ATTR = "_ngcontent-".concat(COMPONENT_VARIABLE); var StylesCompileDependency = function StylesCompileDependency(name, moduleUrl, setValue) { _classCallCheck(this, StylesCompileDependency); this.name = name; this.moduleUrl = moduleUrl; this.setValue = setValue; }; var CompiledStylesheet = function CompiledStylesheet(outputCtx, stylesVar, dependencies, isShimmed, meta) { _classCallCheck(this, CompiledStylesheet); this.outputCtx = outputCtx; this.stylesVar = stylesVar; this.dependencies = dependencies; this.isShimmed = isShimmed; this.meta = meta; }; var StyleCompiler = /*#__PURE__*/function () { function StyleCompiler(_urlResolver) { _classCallCheck(this, StyleCompiler); this._urlResolver = _urlResolver; this._shadowCss = new ShadowCss(); } _createClass2(StyleCompiler, [{ key: "compileComponent", value: function compileComponent(outputCtx, comp) { var template = comp.template; return this._compileStyles(outputCtx, comp, new CompileStylesheetMetadata({ styles: template.styles, styleUrls: template.styleUrls, moduleUrl: identifierModuleUrl(comp.type) }), this.needsStyleShim(comp), true); } }, { key: "compileStyles", value: function compileStyles(outputCtx, comp, stylesheet) { var shim = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : this.needsStyleShim(comp); return this._compileStyles(outputCtx, comp, stylesheet, shim, false); } }, { key: "needsStyleShim", value: function needsStyleShim(comp) { return comp.template.encapsulation === ViewEncapsulation.Emulated; } }, { key: "_compileStyles", value: function _compileStyles(outputCtx, comp, stylesheet, shim, isComponentStylesheet) { var _this145 = this; var styleExpressions = stylesheet.styles.map(function (plainStyle) { return literal(_this145._shimIfNeeded(plainStyle, shim)); }); var dependencies = []; stylesheet.styleUrls.forEach(function (styleUrl) { var exprIndex = styleExpressions.length; // Note: This placeholder will be filled later. styleExpressions.push(null); dependencies.push(new StylesCompileDependency(getStylesVarName(null), styleUrl, function (value) { return styleExpressions[exprIndex] = outputCtx.importExpr(value); })); }); // styles variable contains plain strings and arrays of other styles arrays (recursive), // so we set its type to dynamic. var stylesVar = getStylesVarName(isComponentStylesheet ? comp : null); var stmt = variable(stylesVar).set(literalArr(styleExpressions, new ArrayType(DYNAMIC_TYPE, [TypeModifier.Const]))).toDeclStmt(null, isComponentStylesheet ? [StmtModifier.Final] : [StmtModifier.Final, StmtModifier.Exported]); outputCtx.statements.push(stmt); return new CompiledStylesheet(outputCtx, stylesVar, dependencies, shim, stylesheet); } }, { key: "_shimIfNeeded", value: function _shimIfNeeded(style, shim) { return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style; } }]); return StyleCompiler; }(); function getStylesVarName(component) { var result = "styles"; if (component) { result += "_".concat(identifierName(component.type)); } 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 */ /** * A path is an ordered set of elements. Typically a path is to a * particular offset in a source file. The head of the list is the top * most node. The tail is the node that contains the offset directly. * * For example, the expression `a + b + c` might have an ast that looks * like: * + * / \ * a + * / \ * b c * * The path to the node at offset 9 would be `['+' at 1-10, '+' at 7-10, * 'c' at 9-10]` and the path the node at offset 1 would be * `['+' at 1-10, 'a' at 1-2]`. */ var AstPath = /*#__PURE__*/function () { function AstPath(path) { var position = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1; _classCallCheck(this, AstPath); this.path = path; this.position = position; } _createClass2(AstPath, [{ key: "parentOf", value: function parentOf(node) { return node && this.path[this.path.indexOf(node) - 1]; } }, { key: "childOf", value: function childOf(node) { return this.path[this.path.indexOf(node) + 1]; } }, { key: "first", value: function first(ctor) { for (var i = this.path.length - 1; i >= 0; i--) { var item = this.path[i]; if (item instanceof ctor) return item; } } }, { key: "push", value: function push(node) { this.path.push(node); } }, { key: "pop", value: function pop() { return this.path.pop(); } }, { key: "empty", get: function get() { return !this.path || !this.path.length; } }, { key: "head", get: function get() { return this.path[0]; } }, { key: "tail", get: function get() { return this.path[this.path.length - 1]; } }]); return AstPath; }(); /** * @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$3 = /*#__PURE__*/function () { function Text$3(value, sourceSpan, i18n) { _classCallCheck(this, Text$3); this.value = value; this.sourceSpan = sourceSpan; this.i18n = i18n; } _createClass2(Text$3, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitText(this, context); } }]); return Text$3; }(); var Expansion = /*#__PURE__*/function () { function Expansion(switchValue, type, cases, sourceSpan, switchValueSourceSpan, i18n) { _classCallCheck(this, Expansion); this.switchValue = switchValue; this.type = type; this.cases = cases; this.sourceSpan = sourceSpan; this.switchValueSourceSpan = switchValueSourceSpan; this.i18n = i18n; } _createClass2(Expansion, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitExpansion(this, context); } }]); return Expansion; }(); var ExpansionCase = /*#__PURE__*/function () { function ExpansionCase(value, expression, sourceSpan, valueSourceSpan, expSourceSpan) { _classCallCheck(this, ExpansionCase); this.value = value; this.expression = expression; this.sourceSpan = sourceSpan; this.valueSourceSpan = valueSourceSpan; this.expSourceSpan = expSourceSpan; } _createClass2(ExpansionCase, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitExpansionCase(this, context); } }]); return ExpansionCase; }(); var Attribute = /*#__PURE__*/function () { function Attribute(name, value, sourceSpan, valueSpan, i18n) { _classCallCheck(this, Attribute); this.name = name; this.value = value; this.sourceSpan = sourceSpan; this.valueSpan = valueSpan; this.i18n = i18n; } _createClass2(Attribute, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitAttribute(this, context); } }]); return Attribute; }(); var Element$1 = /*#__PURE__*/function () { function Element$1(name, attrs, children, sourceSpan) { var startSourceSpan = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null; var endSourceSpan = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null; var i18n = arguments.length > 6 ? arguments[6] : undefined; _classCallCheck(this, Element$1); this.name = name; this.attrs = attrs; this.children = children; this.sourceSpan = sourceSpan; this.startSourceSpan = startSourceSpan; this.endSourceSpan = endSourceSpan; this.i18n = i18n; } _createClass2(Element$1, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitElement(this, context); } }]); return Element$1; }(); var Comment = /*#__PURE__*/function () { function Comment(value, sourceSpan) { _classCallCheck(this, Comment); this.value = value; this.sourceSpan = sourceSpan; } _createClass2(Comment, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitComment(this, context); } }]); return Comment; }(); function visitAll$1(visitor, nodes) { var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var result = []; var 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 astResult = visit(ast); if (astResult) { result.push(astResult); } }); return result; } var RecursiveVisitor$1 = /*#__PURE__*/function () { function RecursiveVisitor$1() { _classCallCheck(this, RecursiveVisitor$1); } _createClass2(RecursiveVisitor$1, [{ key: "visitElement", value: function visitElement(ast, context) { this.visitChildren(context, function (visit) { visit(ast.attrs); visit(ast.children); }); } }, { key: "visitAttribute", value: function visitAttribute(ast, context) {} }, { key: "visitText", value: function visitText(ast, context) {} }, { key: "visitComment", value: function visitComment(ast, context) {} }, { key: "visitExpansion", value: function visitExpansion(ast, context) { return this.visitChildren(context, function (visit) { visit(ast.cases); }); } }, { key: "visitExpansionCase", value: function visitExpansionCase(ast, context) {} }, { key: "visitChildren", value: function visitChildren(context, cb) { var results = []; var t = this; function visit(children) { if (children) results.push(visitAll$1(t, children, context)); } cb(visit); return Array.prototype.concat.apply([], results); } }]); return RecursiveVisitor$1; }(); function spanOf(ast) { var start = ast.sourceSpan.start.offset; var end = ast.sourceSpan.end.offset; if (ast instanceof Element$1) { if (ast.endSourceSpan) { end = ast.endSourceSpan.end.offset; } else if (ast.children && ast.children.length) { end = spanOf(ast.children[ast.children.length - 1]).end; } } return { start: start, end: end }; } function findNode(nodes, position) { var path = []; var visitor = new ( /*#__PURE__*/function (_RecursiveVisitor$) { _inherits(_class, _RecursiveVisitor$); var _super82 = _createSuper(_class); function _class() { _classCallCheck(this, _class); return _super82.apply(this, arguments); } _createClass2(_class, [{ key: "visit", value: function visit(ast, context) { var span = spanOf(ast); if (span.start <= position && position < span.end) { path.push(ast); } else { // Returning a value here will result in the children being skipped. return true; } } }]); return _class; }(RecursiveVisitor$1))(); visitAll$1(visitor, nodes); return new AstPath(path, position); } /** * @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; (function (TokenType) { TokenType[TokenType["TAG_OPEN_START"] = 0] = "TAG_OPEN_START"; TokenType[TokenType["TAG_OPEN_END"] = 1] = "TAG_OPEN_END"; TokenType[TokenType["TAG_OPEN_END_VOID"] = 2] = "TAG_OPEN_END_VOID"; TokenType[TokenType["TAG_CLOSE"] = 3] = "TAG_CLOSE"; TokenType[TokenType["TEXT"] = 4] = "TEXT"; TokenType[TokenType["ESCAPABLE_RAW_TEXT"] = 5] = "ESCAPABLE_RAW_TEXT"; TokenType[TokenType["RAW_TEXT"] = 6] = "RAW_TEXT"; TokenType[TokenType["COMMENT_START"] = 7] = "COMMENT_START"; TokenType[TokenType["COMMENT_END"] = 8] = "COMMENT_END"; TokenType[TokenType["CDATA_START"] = 9] = "CDATA_START"; TokenType[TokenType["CDATA_END"] = 10] = "CDATA_END"; TokenType[TokenType["ATTR_NAME"] = 11] = "ATTR_NAME"; TokenType[TokenType["ATTR_QUOTE"] = 12] = "ATTR_QUOTE"; TokenType[TokenType["ATTR_VALUE"] = 13] = "ATTR_VALUE"; TokenType[TokenType["DOC_TYPE"] = 14] = "DOC_TYPE"; TokenType[TokenType["EXPANSION_FORM_START"] = 15] = "EXPANSION_FORM_START"; TokenType[TokenType["EXPANSION_CASE_VALUE"] = 16] = "EXPANSION_CASE_VALUE"; TokenType[TokenType["EXPANSION_CASE_EXP_START"] = 17] = "EXPANSION_CASE_EXP_START"; TokenType[TokenType["EXPANSION_CASE_EXP_END"] = 18] = "EXPANSION_CASE_EXP_END"; TokenType[TokenType["EXPANSION_FORM_END"] = 19] = "EXPANSION_FORM_END"; TokenType[TokenType["EOF"] = 20] = "EOF"; })(TokenType || (TokenType = {})); var Token = function Token(type, parts, sourceSpan) { _classCallCheck(this, Token); this.type = type; this.parts = parts; this.sourceSpan = sourceSpan; }; var TokenError = /*#__PURE__*/function (_ParseError) { _inherits(TokenError, _ParseError); var _super83 = _createSuper(TokenError); function TokenError(errorMsg, tokenType, span) { var _this146; _classCallCheck(this, TokenError); _this146 = _super83.call(this, span, errorMsg); _this146.tokenType = tokenType; return _this146; } return TokenError; }(ParseError); var TokenizeResult = function TokenizeResult(tokens, errors) { _classCallCheck(this, TokenizeResult); this.tokens = tokens; this.errors = errors; }; function tokenize(source, url, getTagDefinition) { var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; return new _Tokenizer(new ParseSourceFile(source, url), getTagDefinition, options).tokenize(); } var _CR_OR_CRLF_REGEXP = /\r\n?/g; function _unexpectedCharacterErrorMsg(charCode) { var _char = charCode === $EOF ? 'EOF' : String.fromCharCode(charCode); return "Unexpected character \"".concat(_char, "\""); } function _unknownEntityErrorMsg(entitySrc) { return "Unknown entity \"".concat(entitySrc, "\" - use the \"&#<decimal>;\" or \"&#x<hex>;\" syntax"); } var _ControlFlowError = function _ControlFlowError(error) { _classCallCheck(this, _ControlFlowError); this.error = error; }; // See http://www.w3.org/TR/html51/syntax.html#writing var _Tokenizer = /*#__PURE__*/function () { /** * @param _file The html source file being tokenized. * @param _getTagDefinition A function that will retrieve a tag definition for a given tag name. * @param options Configuration of the tokenization. */ function _Tokenizer(_file, _getTagDefinition, options) { _classCallCheck(this, _Tokenizer); this._getTagDefinition = _getTagDefinition; this._currentTokenStart = null; this._currentTokenType = null; this._expansionCaseStack = []; this._inInterpolation = false; this.tokens = []; this.errors = []; this._tokenizeIcu = options.tokenizeExpansionForms || false; this._interpolationConfig = options.interpolationConfig || DEFAULT_INTERPOLATION_CONFIG; this._leadingTriviaCodePoints = options.leadingTriviaChars && options.leadingTriviaChars.map(function (c) { return c.codePointAt(0) || 0; }); var range = options.range || { endPos: _file.content.length, startPos: 0, startLine: 0, startCol: 0 }; this._cursor = options.escapedString ? new EscapedCharacterCursor(_file, range) : new PlainCharacterCursor(_file, range); try { this._cursor.init(); } catch (e) { this.handleError(e); } } _createClass2(_Tokenizer, [{ key: "_processCarriageReturns", value: function _processCarriageReturns(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'); } }, { key: "tokenize", value: function tokenize() { while (this._cursor.peek() !== $EOF) { var start = this._cursor.clone(); 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) { this.handleError(e); } } this._beginToken(TokenType.EOF); this._endToken([]); return new TokenizeResult(mergeTextTokens(this.tokens), this.errors); } /** * @returns whether an ICU token has been created * @internal */ }, { key: "_tokenizeExpansionForm", value: function _tokenizeExpansionForm() { if (this.isExpansionFormStart()) { this._consumeExpansionFormStart(); return true; } if (isExpansionCaseStart(this._cursor.peek()) && this._isInExpansionForm()) { this._consumeExpansionCaseStart(); return true; } if (this._cursor.peek() === $RBRACE) { if (this._isInExpansionCase()) { this._consumeExpansionCaseEnd(); return true; } if (this._isInExpansionForm()) { this._consumeExpansionFormEnd(); return true; } } return false; } }, { key: "_beginToken", value: function _beginToken(type) { var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._cursor.clone(); this._currentTokenStart = start; this._currentTokenType = type; } }, { key: "_endToken", value: function _endToken(parts) { var end = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this._cursor.clone(); if (this._currentTokenStart === null) { throw new TokenError('Programming error - attempted to end a token when there was no start to the token', this._currentTokenType, this._cursor.getSpan(end)); } if (this._currentTokenType === null) { throw new TokenError('Programming error - attempted to end a token which has no token type', null, this._cursor.getSpan(this._currentTokenStart)); } var token = new Token(this._currentTokenType, parts, this._cursor.getSpan(this._currentTokenStart, this._leadingTriviaCodePoints)); this.tokens.push(token); this._currentTokenStart = null; this._currentTokenType = null; return token; } }, { key: "_createError", value: function _createError(msg, span) { if (this._isInExpansionForm()) { msg += " (Do you have an unescaped \"{\" in your template? Use \"{{ '{' }}\") to escape it.)"; } var error = new TokenError(msg, this._currentTokenType, span); this._currentTokenStart = null; this._currentTokenType = null; return new _ControlFlowError(error); } }, { key: "handleError", value: function handleError(e) { if (e instanceof CursorError) { e = this._createError(e.msg, this._cursor.getSpan(e.cursor)); } if (e instanceof _ControlFlowError) { this.errors.push(e.error); } else { throw e; } } }, { key: "_attemptCharCode", value: function _attemptCharCode(charCode) { if (this._cursor.peek() === charCode) { this._cursor.advance(); return true; } return false; } }, { key: "_attemptCharCodeCaseInsensitive", value: function _attemptCharCodeCaseInsensitive(charCode) { if (compareCharCodeCaseInsensitive(this._cursor.peek(), charCode)) { this._cursor.advance(); return true; } return false; } }, { key: "_requireCharCode", value: function _requireCharCode(charCode) { var location = this._cursor.clone(); if (!this._attemptCharCode(charCode)) { throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(location)); } } }, { key: "_attemptStr", value: function _attemptStr(chars) { var len = chars.length; if (this._cursor.charsLeft() < len) { return false; } var initialPosition = this._cursor.clone(); for (var 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._cursor = initialPosition; return false; } } return true; } }, { key: "_attemptStrCaseInsensitive", value: function _attemptStrCaseInsensitive(chars) { for (var i = 0; i < chars.length; i++) { if (!this._attemptCharCodeCaseInsensitive(chars.charCodeAt(i))) { return false; } } return true; } }, { key: "_requireStr", value: function _requireStr(chars) { var location = this._cursor.clone(); if (!this._attemptStr(chars)) { throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(location)); } } }, { key: "_attemptCharCodeUntilFn", value: function _attemptCharCodeUntilFn(predicate) { while (!predicate(this._cursor.peek())) { this._cursor.advance(); } } }, { key: "_requireCharCodeUntilFn", value: function _requireCharCodeUntilFn(predicate, len) { var start = this._cursor.clone(); this._attemptCharCodeUntilFn(predicate); var end = this._cursor.clone(); if (end.diff(start) < len) { throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(start)); } } }, { key: "_attemptUntilChar", value: function _attemptUntilChar(_char2) { while (this._cursor.peek() !== _char2) { this._cursor.advance(); } } }, { key: "_readChar", value: function _readChar(decodeEntities) { if (decodeEntities && this._cursor.peek() === $AMPERSAND) { return this._decodeEntity(); } else { // Don't rely upon reading directly from `_input` as the actual char value // may have been generated from an escape sequence. var _char3 = String.fromCodePoint(this._cursor.peek()); this._cursor.advance(); return _char3; } } }, { key: "_decodeEntity", value: function _decodeEntity() { var start = this._cursor.clone(); this._cursor.advance(); if (this._attemptCharCode($HASH)) { var isHex = this._attemptCharCode($x) || this._attemptCharCode($X); var codeStart = this._cursor.clone(); this._attemptCharCodeUntilFn(isDigitEntityEnd); if (this._cursor.peek() != $SEMICOLON) { throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan()); } var strNum = this._cursor.getChars(codeStart); this._cursor.advance(); try { var charCode = parseInt(strNum, isHex ? 16 : 10); return String.fromCharCode(charCode); } catch (_a) { throw this._createError(_unknownEntityErrorMsg(this._cursor.getChars(start)), this._cursor.getSpan()); } } else { var nameStart = this._cursor.clone(); this._attemptCharCodeUntilFn(isNamedEntityEnd); if (this._cursor.peek() != $SEMICOLON) { this._cursor = nameStart; return '&'; } var name = this._cursor.getChars(nameStart); this._cursor.advance(); var _char4 = NAMED_ENTITIES[name]; if (!_char4) { throw this._createError(_unknownEntityErrorMsg(name), this._cursor.getSpan(start)); } return _char4; } } }, { key: "_consumeRawText", value: function _consumeRawText(decodeEntities, endMarkerPredicate) { this._beginToken(decodeEntities ? TokenType.ESCAPABLE_RAW_TEXT : TokenType.RAW_TEXT); var parts = []; while (true) { var tagCloseStart = this._cursor.clone(); var foundEndMarker = endMarkerPredicate(); this._cursor = tagCloseStart; if (foundEndMarker) { break; } parts.push(this._readChar(decodeEntities)); } return this._endToken([this._processCarriageReturns(parts.join(''))]); } }, { key: "_consumeComment", value: function _consumeComment(start) { var _this147 = this; this._beginToken(TokenType.COMMENT_START, start); this._requireCharCode($MINUS); this._endToken([]); this._consumeRawText(false, function () { return _this147._attemptStr('-->'); }); this._beginToken(TokenType.COMMENT_END); this._requireStr('-->'); this._endToken([]); } }, { key: "_consumeCdata", value: function _consumeCdata(start) { var _this148 = this; this._beginToken(TokenType.CDATA_START, start); this._requireStr('CDATA['); this._endToken([]); this._consumeRawText(false, function () { return _this148._attemptStr(']]>'); }); this._beginToken(TokenType.CDATA_END); this._requireStr(']]>'); this._endToken([]); } }, { key: "_consumeDocType", value: function _consumeDocType(start) { this._beginToken(TokenType.DOC_TYPE, start); var contentStart = this._cursor.clone(); this._attemptUntilChar($GT); var content = this._cursor.getChars(contentStart); this._cursor.advance(); this._endToken([content]); } }, { key: "_consumePrefixAndName", value: function _consumePrefixAndName() { var nameOrPrefixStart = this._cursor.clone(); var prefix = ''; while (this._cursor.peek() !== $COLON && !isPrefixEnd(this._cursor.peek())) { this._cursor.advance(); } var nameStart; if (this._cursor.peek() === $COLON) { prefix = this._cursor.getChars(nameOrPrefixStart); this._cursor.advance(); nameStart = this._cursor.clone(); } else { nameStart = nameOrPrefixStart; } this._requireCharCodeUntilFn(isNameEnd, prefix === '' ? 0 : 1); var name = this._cursor.getChars(nameStart); return [prefix, name]; } }, { key: "_consumeTagOpen", value: function _consumeTagOpen(start) { var tagName; var prefix; var openTagToken; var tokensBeforeTagOpen = this.tokens.length; var innerStart = this._cursor.clone(); try { if (!isAsciiLetter(this._cursor.peek())) { throw this._createError(_unexpectedCharacterErrorMsg(this._cursor.peek()), this._cursor.getSpan(start)); } openTagToken = this._consumeTagOpenStart(start); prefix = openTagToken.parts[0]; tagName = openTagToken.parts[1]; this._attemptCharCodeUntilFn(isNotWhitespace); while (this._cursor.peek() !== $SLASH && this._cursor.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 (including invalid "attributes"), assume we want a "<" this._cursor = innerStart; if (openTagToken) { this.tokens.length = tokensBeforeTagOpen; } // Back to back text tokens are merged at the end this._beginToken(TokenType.TEXT, start); this._endToken(['<']); return; } throw e; } var contentTokenType = this._getTagDefinition(tagName).contentType; if (contentTokenType === TagContentType.RAW_TEXT) { this._consumeRawTextWithTagClose(prefix, tagName, false); } else if (contentTokenType === TagContentType.ESCAPABLE_RAW_TEXT) { this._consumeRawTextWithTagClose(prefix, tagName, true); } } }, { key: "_consumeRawTextWithTagClose", value: function _consumeRawTextWithTagClose(prefix, tagName, decodeEntities) { var _this149 = this; var textToken = this._consumeRawText(decodeEntities, function () { if (!_this149._attemptCharCode($LT)) return false; if (!_this149._attemptCharCode($SLASH)) return false; _this149._attemptCharCodeUntilFn(isNotWhitespace); if (!_this149._attemptStrCaseInsensitive(tagName)) return false; _this149._attemptCharCodeUntilFn(isNotWhitespace); return _this149._attemptCharCode($GT); }); this._beginToken(TokenType.TAG_CLOSE); this._requireCharCodeUntilFn(function (code) { return code === $GT; }, 3); this._cursor.advance(); // Consume the `>` this._endToken([prefix, tagName]); } }, { key: "_consumeTagOpenStart", value: function _consumeTagOpenStart(start) { this._beginToken(TokenType.TAG_OPEN_START, start); var parts = this._consumePrefixAndName(); return this._endToken(parts); } }, { key: "_consumeAttributeName", value: function _consumeAttributeName() { var attrNameStart = this._cursor.peek(); if (attrNameStart === $SQ || attrNameStart === $DQ) { throw this._createError(_unexpectedCharacterErrorMsg(attrNameStart), this._cursor.getSpan()); } this._beginToken(TokenType.ATTR_NAME); var prefixAndName = this._consumePrefixAndName(); this._endToken(prefixAndName); } }, { key: "_consumeAttributeValue", value: function _consumeAttributeValue() { var value; if (this._cursor.peek() === $SQ || this._cursor.peek() === $DQ) { this._beginToken(TokenType.ATTR_QUOTE); var quoteChar = this._cursor.peek(); this._cursor.advance(); this._endToken([String.fromCodePoint(quoteChar)]); this._beginToken(TokenType.ATTR_VALUE); var parts = []; while (this._cursor.peek() !== quoteChar) { parts.push(this._readChar(true)); } value = parts.join(''); this._endToken([this._processCarriageReturns(value)]); this._beginToken(TokenType.ATTR_QUOTE); this._cursor.advance(); this._endToken([String.fromCodePoint(quoteChar)]); } else { this._beginToken(TokenType.ATTR_VALUE); var valueStart = this._cursor.clone(); this._requireCharCodeUntilFn(isNameEnd, 1); value = this._cursor.getChars(valueStart); this._endToken([this._processCarriageReturns(value)]); } } }, { key: "_consumeTagOpenEnd", value: function _consumeTagOpenEnd() { var tokenType = this._attemptCharCode($SLASH) ? TokenType.TAG_OPEN_END_VOID : TokenType.TAG_OPEN_END; this._beginToken(tokenType); this._requireCharCode($GT); this._endToken([]); } }, { key: "_consumeTagClose", value: function _consumeTagClose(start) { this._beginToken(TokenType.TAG_CLOSE, start); this._attemptCharCodeUntilFn(isNotWhitespace); var prefixAndName = this._consumePrefixAndName(); this._attemptCharCodeUntilFn(isNotWhitespace); this._requireCharCode($GT); this._endToken(prefixAndName); } }, { key: "_consumeExpansionFormStart", value: function _consumeExpansionFormStart() { this._beginToken(TokenType.EXPANSION_FORM_START); this._requireCharCode($LBRACE); this._endToken([]); this._expansionCaseStack.push(TokenType.EXPANSION_FORM_START); this._beginToken(TokenType.RAW_TEXT); var condition = this._readUntil($COMMA); this._endToken([condition]); this._requireCharCode($COMMA); this._attemptCharCodeUntilFn(isNotWhitespace); this._beginToken(TokenType.RAW_TEXT); var type = this._readUntil($COMMA); this._endToken([type]); this._requireCharCode($COMMA); this._attemptCharCodeUntilFn(isNotWhitespace); } }, { key: "_consumeExpansionCaseStart", value: function _consumeExpansionCaseStart() { this._beginToken(TokenType.EXPANSION_CASE_VALUE); var value = this._readUntil($LBRACE).trim(); this._endToken([value]); this._attemptCharCodeUntilFn(isNotWhitespace); this._beginToken(TokenType.EXPANSION_CASE_EXP_START); this._requireCharCode($LBRACE); this._endToken([]); this._attemptCharCodeUntilFn(isNotWhitespace); this._expansionCaseStack.push(TokenType.EXPANSION_CASE_EXP_START); } }, { key: "_consumeExpansionCaseEnd", value: function _consumeExpansionCaseEnd() { this._beginToken(TokenType.EXPANSION_CASE_EXP_END); this._requireCharCode($RBRACE); this._endToken([]); this._attemptCharCodeUntilFn(isNotWhitespace); this._expansionCaseStack.pop(); } }, { key: "_consumeExpansionFormEnd", value: function _consumeExpansionFormEnd() { this._beginToken(TokenType.EXPANSION_FORM_END); this._requireCharCode($RBRACE); this._endToken([]); this._expansionCaseStack.pop(); } }, { key: "_consumeText", value: function _consumeText() { var start = this._cursor.clone(); this._beginToken(TokenType.TEXT, start); var 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(''))]); } }, { key: "_isTextEnd", value: function _isTextEnd() { if (this._cursor.peek() === $LT || this._cursor.peek() === $EOF) { return true; } if (this._tokenizeIcu && !this._inInterpolation) { if (this.isExpansionFormStart()) { // start of an expansion form return true; } if (this._cursor.peek() === $RBRACE && this._isInExpansionCase()) { // end of and expansion case return true; } } return false; } }, { key: "_readUntil", value: function _readUntil(_char5) { var start = this._cursor.clone(); this._attemptUntilChar(_char5); return this._cursor.getChars(start); } }, { key: "_isInExpansionCase", value: function _isInExpansionCase() { return this._expansionCaseStack.length > 0 && this._expansionCaseStack[this._expansionCaseStack.length - 1] === TokenType.EXPANSION_CASE_EXP_START; } }, { key: "_isInExpansionForm", value: function _isInExpansionForm() { return this._expansionCaseStack.length > 0 && this._expansionCaseStack[this._expansionCaseStack.length - 1] === TokenType.EXPANSION_FORM_START; } }, { key: "isExpansionFormStart", value: function isExpansionFormStart() { if (this._cursor.peek() !== $LBRACE) { return false; } if (this._interpolationConfig) { var start = this._cursor.clone(); var isInterpolation = this._attemptStr(this._interpolationConfig.start); this._cursor = start; return !isInterpolation; } return true; } }]); return _Tokenizer; }(); function isNotWhitespace(code) { return !isWhitespace(code) || code === $EOF; } function isNameEnd(code) { return isWhitespace(code) || code === $GT || code === $SLASH || code === $SQ || code === $DQ || code === $EQ; } function isPrefixEnd(code) { return (code < $a || $z < code) && (code < $A || $Z < code) && (code < $0 || code > $9); } function isDigitEntityEnd(code) { return code == $SEMICOLON || code == $EOF || !isAsciiHexDigit(code); } function isNamedEntityEnd(code) { return code == $SEMICOLON || code == $EOF || !isAsciiLetter(code); } function isExpansionCaseStart(peek) { return peek === $EQ || isAsciiLetter(peek) || isDigit(peek); } function compareCharCodeCaseInsensitive(code1, code2) { return toUpperCaseCharCode(code1) == toUpperCaseCharCode(code2); } function toUpperCaseCharCode(code) { return code >= $a && code <= $z ? code - $a + $A : code; } function mergeTextTokens(srcTokens) { var dstTokens = []; var lastDstToken = undefined; for (var i = 0; i < srcTokens.length; i++) { var token = srcTokens[i]; if (lastDstToken && lastDstToken.type == TokenType.TEXT && token.type == TokenType.TEXT) { lastDstToken.parts[0] += token.parts[0]; lastDstToken.sourceSpan.end = token.sourceSpan.end; } else { lastDstToken = token; dstTokens.push(lastDstToken); } } return dstTokens; } var PlainCharacterCursor = /*#__PURE__*/function () { function PlainCharacterCursor(fileOrCursor, range) { _classCallCheck(this, PlainCharacterCursor); if (fileOrCursor instanceof PlainCharacterCursor) { this.file = fileOrCursor.file; this.input = fileOrCursor.input; this.end = fileOrCursor.end; this.state = Object.assign({}, fileOrCursor.state); } else { if (!range) { throw new Error('Programming error: the range argument must be provided with a file argument.'); } this.file = fileOrCursor; this.input = fileOrCursor.content; this.end = range.endPos; this.state = { peek: -1, offset: range.startPos, line: range.startLine, column: range.startCol }; } } _createClass2(PlainCharacterCursor, [{ key: "clone", value: function clone() { return new PlainCharacterCursor(this); } }, { key: "peek", value: function peek() { return this.state.peek; } }, { key: "charsLeft", value: function charsLeft() { return this.end - this.state.offset; } }, { key: "diff", value: function diff(other) { return this.state.offset - other.state.offset; } }, { key: "advance", value: function advance() { this.advanceState(this.state); } }, { key: "init", value: function init() { this.updatePeek(this.state); } }, { key: "getSpan", value: function getSpan(start, leadingTriviaCodePoints) { start = start || this; if (leadingTriviaCodePoints) { start = start.clone(); while (this.diff(start) > 0 && leadingTriviaCodePoints.indexOf(start.peek()) !== -1) { start.advance(); } } return new ParseSourceSpan(new ParseLocation(start.file, start.state.offset, start.state.line, start.state.column), new ParseLocation(this.file, this.state.offset, this.state.line, this.state.column)); } }, { key: "getChars", value: function getChars(start) { return this.input.substring(start.state.offset, this.state.offset); } }, { key: "charAt", value: function charAt(pos) { return this.input.charCodeAt(pos); } }, { key: "advanceState", value: function advanceState(state) { if (state.offset >= this.end) { this.state = state; throw new CursorError('Unexpected character "EOF"', this); } var currentChar = this.charAt(state.offset); if (currentChar === $LF) { state.line++; state.column = 0; } else if (!isNewLine(currentChar)) { state.column++; } state.offset++; this.updatePeek(state); } }, { key: "updatePeek", value: function updatePeek(state) { state.peek = state.offset >= this.end ? $EOF : this.charAt(state.offset); } }]); return PlainCharacterCursor; }(); var EscapedCharacterCursor = /*#__PURE__*/function (_PlainCharacterCursor) { _inherits(EscapedCharacterCursor, _PlainCharacterCursor); var _super84 = _createSuper(EscapedCharacterCursor); function EscapedCharacterCursor(fileOrCursor, range) { var _this150; _classCallCheck(this, EscapedCharacterCursor); if (fileOrCursor instanceof EscapedCharacterCursor) { _this150 = _super84.call(this, fileOrCursor); _this150.internalState = Object.assign({}, fileOrCursor.internalState); } else { _this150 = _super84.call(this, fileOrCursor, range); _this150.internalState = _this150.state; } return _possibleConstructorReturn(_this150); } _createClass2(EscapedCharacterCursor, [{ key: "advance", value: function advance() { this.state = this.internalState; _get(_getPrototypeOf(EscapedCharacterCursor.prototype), "advance", this).call(this); this.processEscapeSequence(); } }, { key: "init", value: function init() { _get(_getPrototypeOf(EscapedCharacterCursor.prototype), "init", this).call(this); this.processEscapeSequence(); } }, { key: "clone", value: function clone() { return new EscapedCharacterCursor(this); } }, { key: "getChars", value: function getChars(start) { var cursor = start.clone(); var chars = ''; while (cursor.internalState.offset < this.internalState.offset) { chars += String.fromCodePoint(cursor.peek()); cursor.advance(); } return chars; } /** * Process the escape sequence that starts at the current position in the text. * * This method is called to ensure that `peek` has the unescaped value of escape sequences. */ }, { key: "processEscapeSequence", value: function processEscapeSequence() { var _this151 = this; var peek = function peek() { return _this151.internalState.peek; }; if (peek() === $BACKSLASH) { // We have hit an escape sequence so we need the internal state to become independent // of the external state. this.internalState = Object.assign({}, this.state); // Move past the backslash this.advanceState(this.internalState); // First check for standard control char sequences if (peek() === $n) { this.state.peek = $LF; } else if (peek() === $r) { this.state.peek = $CR; } else if (peek() === $v) { this.state.peek = $VTAB; } else if (peek() === $t) { this.state.peek = $TAB; } else if (peek() === $b) { this.state.peek = $BSPACE; } else if (peek() === $f) { this.state.peek = $FF; } // Now consider more complex sequences else if (peek() === $u) { // Unicode code-point sequence this.advanceState(this.internalState); // advance past the `u` char if (peek() === $LBRACE) { // Variable length Unicode, e.g. `\x{123}` this.advanceState(this.internalState); // advance past the `{` char // Advance past the variable number of hex digits until we hit a `}` char var digitStart = this.clone(); var length = 0; while (peek() !== $RBRACE) { this.advanceState(this.internalState); length++; } this.state.peek = this.decodeHexDigits(digitStart, length); } else { // Fixed length Unicode, e.g. `\u1234` var _digitStart = this.clone(); this.advanceState(this.internalState); this.advanceState(this.internalState); this.advanceState(this.internalState); this.state.peek = this.decodeHexDigits(_digitStart, 4); } } else if (peek() === $x) { // Hex char code, e.g. `\x2F` this.advanceState(this.internalState); // advance past the `x` char var _digitStart2 = this.clone(); this.advanceState(this.internalState); this.state.peek = this.decodeHexDigits(_digitStart2, 2); } else if (isOctalDigit(peek())) { // Octal char code, e.g. `\012`, var octal = ''; var _length = 0; var previous = this.clone(); while (isOctalDigit(peek()) && _length < 3) { previous = this.clone(); octal += String.fromCodePoint(peek()); this.advanceState(this.internalState); _length++; } this.state.peek = parseInt(octal, 8); // Backup one char this.internalState = previous.internalState; } else if (isNewLine(this.internalState.peek)) { // Line continuation `\` followed by a new line this.advanceState(this.internalState); // advance over the newline this.state = this.internalState; } else { // If none of the `if` blocks were executed then we just have an escaped normal character. // In that case we just, effectively, skip the backslash from the character. this.state.peek = this.internalState.peek; } } } }, { key: "decodeHexDigits", value: function decodeHexDigits(start, length) { var hex = this.input.substr(start.internalState.offset, length); var charCode = parseInt(hex, 16); if (!isNaN(charCode)) { return charCode; } else { start.state = start.internalState; throw new CursorError('Invalid hexadecimal escape sequence', start); } } }]); return EscapedCharacterCursor; }(PlainCharacterCursor); var CursorError = function CursorError(msg, cursor) { _classCallCheck(this, CursorError); this.msg = msg; this.cursor = cursor; }; /** * @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 = /*#__PURE__*/function (_ParseError2) { _inherits(TreeError, _ParseError2); var _super85 = _createSuper(TreeError); function TreeError(elementName, span, msg) { var _this152; _classCallCheck(this, TreeError); _this152 = _super85.call(this, span, msg); _this152.elementName = elementName; return _this152; } _createClass2(TreeError, null, [{ key: "create", value: function create(elementName, span, msg) { return new TreeError(elementName, span, msg); } }]); return TreeError; }(ParseError); var ParseTreeResult = function ParseTreeResult(rootNodes, errors) { _classCallCheck(this, ParseTreeResult); this.rootNodes = rootNodes; this.errors = errors; }; var Parser = /*#__PURE__*/function () { function Parser(getTagDefinition) { _classCallCheck(this, Parser); this.getTagDefinition = getTagDefinition; } _createClass2(Parser, [{ key: "parse", value: function parse(source, url, options) { var tokensAndErrors = tokenize(source, url, this.getTagDefinition, options); var treeAndErrors = new _TreeBuilder(tokensAndErrors.tokens, this.getTagDefinition).build(); return new ParseTreeResult(treeAndErrors.rootNodes, tokensAndErrors.errors.concat(treeAndErrors.errors)); } }]); return Parser; }(); var _TreeBuilder = /*#__PURE__*/function () { function _TreeBuilder(tokens, getTagDefinition) { _classCallCheck(this, _TreeBuilder); this.tokens = tokens; this.getTagDefinition = getTagDefinition; this._index = -1; this._rootNodes = []; this._errors = []; this._elementStack = []; this._advance(); } _createClass2(_TreeBuilder, [{ key: "build", value: function build() { while (this._peek.type !== TokenType.EOF) { if (this._peek.type === TokenType.TAG_OPEN_START) { this._consumeStartTag(this._advance()); } else if (this._peek.type === TokenType.TAG_CLOSE) { this._consumeEndTag(this._advance()); } else if (this._peek.type === TokenType.CDATA_START) { this._closeVoidElement(); this._consumeCdata(this._advance()); } else if (this._peek.type === TokenType.COMMENT_START) { this._closeVoidElement(); this._consumeComment(this._advance()); } else if (this._peek.type === TokenType.TEXT || this._peek.type === TokenType.RAW_TEXT || this._peek.type === TokenType.ESCAPABLE_RAW_TEXT) { this._closeVoidElement(); this._consumeText(this._advance()); } else if (this._peek.type === TokenType.EXPANSION_FORM_START) { this._consumeExpansion(this._advance()); } else { // Skip all other tokens... this._advance(); } } return new ParseTreeResult(this._rootNodes, this._errors); } }, { key: "_advance", value: function _advance() { var 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; } }, { key: "_advanceIf", value: function _advanceIf(type) { if (this._peek.type === type) { return this._advance(); } return null; } }, { key: "_consumeCdata", value: function _consumeCdata(startToken) { this._consumeText(this._advance()); this._advanceIf(TokenType.CDATA_END); } }, { key: "_consumeComment", value: function _consumeComment(token) { var text = this._advanceIf(TokenType.RAW_TEXT); this._advanceIf(TokenType.COMMENT_END); var value = text != null ? text.parts[0].trim() : null; this._addToParent(new Comment(value, token.sourceSpan)); } }, { key: "_consumeExpansion", value: function _consumeExpansion(token) { var switchValue = this._advance(); var type = this._advance(); var cases = []; // read = while (this._peek.type === TokenType.EXPANSION_CASE_VALUE) { var expCase = this._parseExpansionCase(); if (!expCase) return; // error cases.push(expCase); } // read the final } if (this._peek.type !== TokenType.EXPANSION_FORM_END) { this._errors.push(TreeError.create(null, this._peek.sourceSpan, "Invalid ICU message. Missing '}'.")); return; } var 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(); } }, { key: "_parseExpansionCase", value: function _parseExpansionCase() { var value = this._advance(); // read { if (this._peek.type !== TokenType.EXPANSION_CASE_EXP_START) { this._errors.push(TreeError.create(null, this._peek.sourceSpan, "Invalid ICU message. Missing '{'.")); return null; } // read until } var start = this._advance(); var exp = this._collectExpansionExpTokens(start); if (!exp) return null; var end = this._advance(); exp.push(new Token(TokenType.EOF, [], end.sourceSpan)); // parse everything in between { and } var parsedExp = new _TreeBuilder(exp, this.getTagDefinition).build(); if (parsedExp.errors.length > 0) { this._errors = this._errors.concat(parsedExp.errors); return null; } var sourceSpan = new ParseSourceSpan(value.sourceSpan.start, end.sourceSpan.end); var expSourceSpan = new ParseSourceSpan(start.sourceSpan.start, end.sourceSpan.end); return new ExpansionCase(value.parts[0], parsedExp.rootNodes, sourceSpan, value.sourceSpan, expSourceSpan); } }, { key: "_collectExpansionExpTokens", value: function _collectExpansionExpTokens(start) { var exp = []; var expansionFormStack = [TokenType.EXPANSION_CASE_EXP_START]; while (true) { if (this._peek.type === TokenType.EXPANSION_FORM_START || this._peek.type === TokenType.EXPANSION_CASE_EXP_START) { expansionFormStack.push(this._peek.type); } if (this._peek.type === TokenType.EXPANSION_CASE_EXP_END) { if (lastOnStack(expansionFormStack, TokenType.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.EXPANSION_FORM_END) { if (lastOnStack(expansionFormStack, TokenType.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.EOF) { this._errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'.")); return null; } exp.push(this._advance()); } } }, { key: "_consumeText", value: function _consumeText(token) { var text = token.parts[0]; if (text.length > 0 && text[0] == '\n') { var 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$3(text, token.sourceSpan)); } } }, { key: "_closeVoidElement", value: function _closeVoidElement() { var el = this._getParentElement(); if (el && this.getTagDefinition(el.name).isVoid) { this._elementStack.pop(); } } }, { key: "_consumeStartTag", value: function _consumeStartTag(startTagToken) { var prefix = startTagToken.parts[0]; var name = startTagToken.parts[1]; var attrs = []; while (this._peek.type === TokenType.ATTR_NAME) { attrs.push(this._consumeAttr(this._advance())); } var fullName = this._getElementFullName(prefix, name, this._getParentElement()); var 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.TAG_OPEN_END_VOID) { this._advance(); selfClosing = true; var 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 \"".concat(startTagToken.parts[1], "\""))); } } else if (this._peek.type === TokenType.TAG_OPEN_END) { this._advance(); selfClosing = false; } var end = this._peek.sourceSpan.start; var span = new ParseSourceSpan(startTagToken.sourceSpan.start, end); var el = new Element$1(fullName, attrs, [], span, span, undefined); this._pushElement(el); if (selfClosing) { this._popElement(fullName); el.endSourceSpan = span; } } }, { key: "_pushElement", value: function _pushElement(el) { var parentEl = this._getParentElement(); if (parentEl && this.getTagDefinition(parentEl.name).isClosedByChild(el.name)) { this._elementStack.pop(); } this._addToParent(el); this._elementStack.push(el); } }, { key: "_consumeEndTag", value: function _consumeEndTag(endTagToken) { var 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 \"".concat(endTagToken.parts[1], "\""))); } else if (!this._popElement(fullName)) { var errMsg = "Unexpected closing tag \"".concat(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)); } } }, { key: "_popElement", value: function _popElement(fullName) { for (var stackIndex = this._elementStack.length - 1; stackIndex >= 0; stackIndex--) { var 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; } }, { key: "_consumeAttr", value: function _consumeAttr(attrName) { var fullName = mergeNsAndName(attrName.parts[0], attrName.parts[1]); var end = attrName.sourceSpan.end; var value = ''; var valueSpan = undefined; if (this._peek.type === TokenType.ATTR_QUOTE) { this._advance(); } if (this._peek.type === TokenType.ATTR_VALUE) { var valueToken = this._advance(); value = valueToken.parts[0]; end = valueToken.sourceSpan.end; valueSpan = valueToken.sourceSpan; } if (this._peek.type === TokenType.ATTR_QUOTE) { var quoteToken = this._advance(); end = quoteToken.sourceSpan.end; } return new Attribute(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, end), valueSpan); } }, { key: "_getParentElement", value: function _getParentElement() { return this._elementStack.length > 0 ? this._elementStack[this._elementStack.length - 1] : null; } /** * Returns the parent in the DOM and the container. * * `<ng-container>` elements are skipped as they are not rendered as DOM element. */ }, { key: "_getParentElementSkippingContainers", value: function _getParentElementSkippingContainers() { var container = null; for (var 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: null, container: container }; } }, { key: "_addToParent", value: function _addToParent(node) { var 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 */ }, { key: "_insertBeforeContainer", value: function _insertBeforeContainer(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 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); } } }, { key: "_getElementFullName", value: function _getElementFullName(prefix, localName, parentElement) { if (prefix === '') { prefix = this.getTagDefinition(localName).implicitNamespacePrefix || ''; if (prefix === '' && parentElement != null) { prefix = getNsPrefix(parentElement.name); } } return mergeNsAndName(prefix, localName); } }]); return _TreeBuilder; }(); 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 HtmlParser = /*#__PURE__*/function (_Parser) { _inherits(HtmlParser, _Parser); var _super86 = _createSuper(HtmlParser); function HtmlParser() { _classCallCheck(this, HtmlParser); return _super86.call(this, getHtmlTagDefinition); } _createClass2(HtmlParser, [{ key: "parse", value: function parse(source, url, options) { return _get(_getPrototypeOf(HtmlParser.prototype), "parse", this).call(this, source, url, options); } }]); return HtmlParser; }(Parser); /** * @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 PRESERVE_WS_ATTR_NAME = 'ngPreserveWhitespaces'; var SKIP_WS_TRIM_TAGS = new Set(['pre', 'template', 'textarea', 'script', 'style']); // Equivalent to \s with \u00a0 (non-breaking space) excluded. // Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp var WS_CHARS = " \f\n\r\t\x0B\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF"; var NO_WS_REGEXP = new RegExp("[^".concat(WS_CHARS, "]")); var WS_REPLACE_REGEXP = new RegExp("[".concat(WS_CHARS, "]{2,}"), 'g'); function hasPreserveWhitespacesAttr(attrs) { return attrs.some(function (attr) { return attr.name === PRESERVE_WS_ATTR_NAME; }); } /** * Angular Dart introduced &ngsp; as a placeholder for non-removable space, see: * https://github.com/dart-lang/angular/blob/0bb611387d29d65b5af7f9d2515ab571fd3fbee4/_tests/test/compiler/preserve_whitespace_test.dart#L25-L32 * In Angular Dart &ngsp; is converted to the 0xE500 PUA (Private Use Areas) unicode character * and later on replaced by a space. We are re-implementing the same idea here. */ function replaceNgsp(value) { // lexer is replacing the &ngsp; pseudo-entity with NGSP_UNICODE return value.replace(new RegExp(NGSP_UNICODE, 'g'), ' '); } /** * This visitor can walk HTML parse tree and remove / trim text nodes using the following rules: * - consider spaces, tabs and new lines as whitespace characters; * - drop text nodes consisting of whitespace characters only; * - for all other text nodes replace consecutive whitespace characters with one space; * - convert &ngsp; pseudo-entity to a single space; * * Removal and trimming of whitespaces have positive performance impact (less code to generate * while compiling templates, faster view creation). At the same time it can be "destructive" * in some cases (whitespaces can influence layout). Because of the potential of breaking layout * this visitor is not activated by default in Angular 5 and people need to explicitly opt-in for * whitespace removal. The default option for whitespace removal will be revisited in Angular 6 * and might be changed to "on" by default. */ var WhitespaceVisitor = /*#__PURE__*/function () { function WhitespaceVisitor() { _classCallCheck(this, WhitespaceVisitor); } _createClass2(WhitespaceVisitor, [{ key: "visitElement", value: function visitElement(element, context) { if (SKIP_WS_TRIM_TAGS.has(element.name) || hasPreserveWhitespacesAttr(element.attrs)) { // don't descent into elements where we need to preserve whitespaces // but still visit all attributes to eliminate one used as a market to preserve WS return new Element$1(element.name, visitAll$1(this, element.attrs), element.children, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n); } return new Element$1(element.name, element.attrs, visitAll$1(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n); } }, { key: "visitAttribute", value: function visitAttribute(attribute, context) { return attribute.name !== PRESERVE_WS_ATTR_NAME ? attribute : null; } }, { key: "visitText", value: function visitText(text, context) { var isNotBlank = text.value.match(NO_WS_REGEXP); if (isNotBlank) { return new Text$3(replaceNgsp(text.value).replace(WS_REPLACE_REGEXP, ' '), text.sourceSpan, text.i18n); } return null; } }, { key: "visitComment", value: function visitComment(comment, context) { return comment; } }, { key: "visitExpansion", value: function visitExpansion(expansion, context) { return expansion; } }, { key: "visitExpansionCase", value: function visitExpansionCase(expansionCase, context) { return expansionCase; } }]); return WhitespaceVisitor; }(); function removeWhitespaces(htmlAstWithErrors) { return new ParseTreeResult(visitAll$1(new WhitespaceVisitor(), htmlAstWithErrors.rootNodes), htmlAstWithErrors.errors); } /** * @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 * * ``` * <ng-container [ngPlural]="messages.length"> * <ng-template ngPluralCase="=0">zero</ng-template> * <ng-template ngPluralCase="=1">one</ng-template> * <ng-template ngPluralCase="other">more than one</ng-template> * </ng-container> * ``` */ function expandNodes(nodes) { var expander = new _Expander(); return new ExpansionResult(visitAll$1(expander, nodes), expander.isExpanded, expander.errors); } var ExpansionResult = function ExpansionResult(nodes, expanded, errors) { _classCallCheck(this, ExpansionResult); this.nodes = nodes; this.expanded = expanded; this.errors = errors; }; var ExpansionError = /*#__PURE__*/function (_ParseError3) { _inherits(ExpansionError, _ParseError3); var _super87 = _createSuper(ExpansionError); function ExpansionError(span, errorMsg) { _classCallCheck(this, ExpansionError); return _super87.call(this, span, errorMsg); } return ExpansionError; }(ParseError); /** * Expand expansion forms (plural, select) to directives * * @internal */ var _Expander = /*#__PURE__*/function () { function _Expander() { _classCallCheck(this, _Expander); this.isExpanded = false; this.errors = []; } _createClass2(_Expander, [{ key: "visitElement", value: function visitElement(element, context) { return new Element$1(element.name, element.attrs, visitAll$1(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan); } }, { key: "visitAttribute", value: function visitAttribute(attribute, context) { return attribute; } }, { key: "visitText", value: function visitText(text, context) { return text; } }, { key: "visitComment", value: function visitComment(comment, context) { return comment; } }, { key: "visitExpansion", value: function visitExpansion(icu, context) { this.isExpanded = true; return icu.type == 'plural' ? _expandPluralForm(icu, this.errors) : _expandDefaultForm(icu, this.errors); } }, { key: "visitExpansionCase", value: function visitExpansionCase(icuCase, context) { throw new Error('Should not be reached'); } }]); return _Expander; }(); // Plural forms are expanded to `NgPlural` and `NgPluralCase`s function _expandPluralForm(ast, errors) { var 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 \"=<number>\" or one of ".concat(PLURAL_CASES.join(", ")))); } var expansionResult = expandNodes(c.expression); errors.push.apply(errors, _toConsumableArray(expansionResult.errors)); return new Element$1("ng-template", [new Attribute('ngPluralCase', "".concat(c.value), c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan); }); var switchAttr = new Attribute('[ngPlural]', ast.switchValue, ast.switchValueSourceSpan); return new Element$1('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan); } // ICU messages (excluding plural form) are expanded to `NgSwitch` and `NgSwitchCase`s function _expandDefaultForm(ast, errors) { var children = ast.cases.map(function (c) { var expansionResult = expandNodes(c.expression); errors.push.apply(errors, _toConsumableArray(expansionResult.errors)); if (c.value === 'other') { // other is the default case when no values match return new Element$1("ng-template", [new Attribute('ngSwitchDefault', '', c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan); } return new Element$1("ng-template", [new Attribute('ngSwitchCase', "".concat(c.value), c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan); }); var switchAttr = new Attribute('[ngSwitch]', ast.switchValue, ast.switchValueSourceSpan); return new Element$1('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 */ /** * A segment of text within the template. */ var TextAst = /*#__PURE__*/function () { function TextAst(value, ngContentIndex, sourceSpan) { _classCallCheck(this, TextAst); this.value = value; this.ngContentIndex = ngContentIndex; this.sourceSpan = sourceSpan; } _createClass2(TextAst, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitText(this, context); } }]); return TextAst; }(); /** * A bound expression within the text of a template. */ var BoundTextAst = /*#__PURE__*/function () { function BoundTextAst(value, ngContentIndex, sourceSpan) { _classCallCheck(this, BoundTextAst); this.value = value; this.ngContentIndex = ngContentIndex; this.sourceSpan = sourceSpan; } _createClass2(BoundTextAst, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitBoundText(this, context); } }]); return BoundTextAst; }(); /** * A plain attribute on an element. */ var AttrAst = /*#__PURE__*/function () { function AttrAst(name, value, sourceSpan) { _classCallCheck(this, AttrAst); this.name = name; this.value = value; this.sourceSpan = sourceSpan; } _createClass2(AttrAst, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitAttr(this, context); } }]); return AttrAst; }(); var BoundPropertyMapping = (_BoundPropertyMapping = {}, _defineProperty(_BoundPropertyMapping, 4 /* Animation */ , 4), _defineProperty(_BoundPropertyMapping, 1 /* Attribute */ , /* Animation */ 1), _defineProperty(_BoundPropertyMapping, 2 /* Class */ , /* Attribute */ 2), _defineProperty(_BoundPropertyMapping, 0 /* Property */ , /* Class */ 0), _defineProperty(_BoundPropertyMapping, 3 /* Style */ , /* Property */ 3), _BoundPropertyMapping); /** * A binding for an element property (e.g. `[property]="expression"`) or an animation trigger (e.g. * `[@trigger]="stateExp"`) */ var BoundElementPropertyAst = /*#__PURE__*/function () { function BoundElementPropertyAst(name, type, securityContext, value, unit, sourceSpan) { _classCallCheck(this, BoundElementPropertyAst); this.name = name; this.type = type; this.securityContext = securityContext; this.value = value; this.unit = unit; this.sourceSpan = sourceSpan; this.isAnimation = this.type === 4 /* Animation */ ; } _createClass2(BoundElementPropertyAst, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitElementProperty(this, context); } }], [{ key: "fromBoundProperty", value: function fromBoundProperty(prop) { var type = BoundPropertyMapping[prop.type]; return new BoundElementPropertyAst(prop.name, type, prop.securityContext, prop.value, prop.unit, prop.sourceSpan); } }]); 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 = /*#__PURE__*/function () { function BoundEventAst(name, target, phase, handler, sourceSpan, handlerSpan) { _classCallCheck(this, BoundEventAst); this.name = name; this.target = target; this.phase = phase; this.handler = handler; this.sourceSpan = sourceSpan; this.handlerSpan = handlerSpan; this.fullName = BoundEventAst.calcFullName(this.name, this.target, this.phase); this.isAnimation = !!this.phase; } _createClass2(BoundEventAst, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitEvent(this, context); } }], [{ key: "calcFullName", value: function calcFullName(name, target, phase) { if (target) { return "".concat(target, ":").concat(name); } if (phase) { return "@".concat(name, ".").concat(phase); } return name; } }, { key: "fromParsedEvent", value: function fromParsedEvent(event) { var target = event.type === 0 /* Regular */ ? event.targetOrPhase : null; var phase = event.type === 1 /* Animation */ ? event.targetOrPhase : null; return new BoundEventAst(event.name, target, phase, event.handler, event.sourceSpan, event.handlerSpan); } }]); return BoundEventAst; }(); /** * A reference declaration on an element (e.g. `let someName="expression"`). */ var ReferenceAst = /*#__PURE__*/function () { function ReferenceAst(name, value, originalValue, sourceSpan) { _classCallCheck(this, ReferenceAst); this.name = name; this.value = value; this.originalValue = originalValue; this.sourceSpan = sourceSpan; } _createClass2(ReferenceAst, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitReference(this, context); } }]); return ReferenceAst; }(); /** * A variable declaration on a <ng-template> (e.g. `var-someName="someLocalName"`). */ var VariableAst = /*#__PURE__*/function () { function VariableAst(name, value, sourceSpan) { _classCallCheck(this, VariableAst); this.name = name; this.value = value; this.sourceSpan = sourceSpan; } _createClass2(VariableAst, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitVariable(this, context); } }], [{ key: "fromParsedVariable", value: function fromParsedVariable(v) { return new VariableAst(v.name, v.value, v.sourceSpan); } }]); return VariableAst; }(); /** * An element declaration in a template. */ var ElementAst = /*#__PURE__*/function () { function ElementAst(name, attrs, inputs, outputs, references, directives, providers, hasViewContainer, queryMatches, children, ngContentIndex, sourceSpan, endSourceSpan) { _classCallCheck(this, ElementAst); 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; } _createClass2(ElementAst, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitElement(this, context); } }]); return ElementAst; }(); /** * A `<ng-template>` element included in an Angular template. */ var EmbeddedTemplateAst = /*#__PURE__*/function () { function EmbeddedTemplateAst(attrs, outputs, references, variables, directives, providers, hasViewContainer, queryMatches, children, ngContentIndex, sourceSpan) { _classCallCheck(this, EmbeddedTemplateAst); 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; } _createClass2(EmbeddedTemplateAst, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitEmbeddedTemplate(this, context); } }]); return EmbeddedTemplateAst; }(); /** * A directive property with a bound value (e.g. `*ngIf="condition"). */ var BoundDirectivePropertyAst = /*#__PURE__*/function () { function BoundDirectivePropertyAst(directiveName, templateName, value, sourceSpan) { _classCallCheck(this, BoundDirectivePropertyAst); this.directiveName = directiveName; this.templateName = templateName; this.value = value; this.sourceSpan = sourceSpan; } _createClass2(BoundDirectivePropertyAst, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitDirectiveProperty(this, context); } }]); return BoundDirectivePropertyAst; }(); /** * A directive declared on an element. */ var DirectiveAst = /*#__PURE__*/function () { function DirectiveAst(directive, inputs, hostProperties, hostEvents, contentQueryStartId, sourceSpan) { _classCallCheck(this, DirectiveAst); this.directive = directive; this.inputs = inputs; this.hostProperties = hostProperties; this.hostEvents = hostEvents; this.contentQueryStartId = contentQueryStartId; this.sourceSpan = sourceSpan; } _createClass2(DirectiveAst, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitDirective(this, context); } }]); return DirectiveAst; }(); /** * A provider declared on an element */ var ProviderAst = /*#__PURE__*/function () { function ProviderAst(token, multiProvider, eager, providers, providerType, lifecycleHooks, sourceSpan, isModule) { _classCallCheck(this, ProviderAst); this.token = token; this.multiProvider = multiProvider; this.eager = eager; this.providers = providers; this.providerType = providerType; this.lifecycleHooks = lifecycleHooks; this.sourceSpan = sourceSpan; this.isModule = isModule; } _createClass2(ProviderAst, [{ key: "visit", value: function visit(visitor, context) { // No visit method in the visitor for now... return null; } }]); return ProviderAst; }(); var ProviderAstType; (function (ProviderAstType) { ProviderAstType[ProviderAstType["PublicService"] = 0] = "PublicService"; ProviderAstType[ProviderAstType["PrivateService"] = 1] = "PrivateService"; ProviderAstType[ProviderAstType["Component"] = 2] = "Component"; ProviderAstType[ProviderAstType["Directive"] = 3] = "Directive"; ProviderAstType[ProviderAstType["Builtin"] = 4] = "Builtin"; })(ProviderAstType || (ProviderAstType = {})); /** * Position where content is to be projected (instance of `<ng-content>` in a template). */ var NgContentAst = /*#__PURE__*/function () { function NgContentAst(index, ngContentIndex, sourceSpan) { _classCallCheck(this, NgContentAst); this.index = index; this.ngContentIndex = ngContentIndex; this.sourceSpan = sourceSpan; } _createClass2(NgContentAst, [{ key: "visit", value: function visit(visitor, context) { return visitor.visitNgContent(this, context); } }]); return NgContentAst; }(); /** * A visitor that accepts each node but doesn't do anything. It is intended to be used * as the base class for a visitor that is only interested in a subset of the node types. */ var NullTemplateVisitor = /*#__PURE__*/function () { function NullTemplateVisitor() { _classCallCheck(this, NullTemplateVisitor); } _createClass2(NullTemplateVisitor, [{ key: "visitNgContent", value: function visitNgContent(ast, context) {} }, { key: "visitEmbeddedTemplate", value: function visitEmbeddedTemplate(ast, context) {} }, { key: "visitElement", value: function visitElement(ast, context) {} }, { key: "visitReference", value: function visitReference(ast, context) {} }, { key: "visitVariable", value: function visitVariable(ast, context) {} }, { key: "visitEvent", value: function visitEvent(ast, context) {} }, { key: "visitElementProperty", value: function visitElementProperty(ast, context) {} }, { key: "visitAttr", value: function visitAttr(ast, context) {} }, { key: "visitBoundText", value: function visitBoundText(ast, context) {} }, { key: "visitText", value: function visitText(ast, context) {} }, { key: "visitDirective", value: function visitDirective(ast, context) {} }, { key: "visitDirectiveProperty", value: function visitDirectiveProperty(ast, context) {} }]); return NullTemplateVisitor; }(); /** * Base class that can be used to build a visitor that visits each node * in an template ast recursively. */ var RecursiveTemplateAstVisitor = /*#__PURE__*/function (_NullTemplateVisitor) { _inherits(RecursiveTemplateAstVisitor, _NullTemplateVisitor); var _super88 = _createSuper(RecursiveTemplateAstVisitor); function RecursiveTemplateAstVisitor() { _classCallCheck(this, RecursiveTemplateAstVisitor); return _super88.call(this); } // Nodes with children _createClass2(RecursiveTemplateAstVisitor, [{ key: "visitEmbeddedTemplate", value: function visitEmbeddedTemplate(ast, context) { return this.visitChildren(context, function (visit) { visit(ast.attrs); visit(ast.references); visit(ast.variables); visit(ast.directives); visit(ast.providers); visit(ast.children); }); } }, { key: "visitElement", value: function visitElement(ast, context) { return this.visitChildren(context, function (visit) { visit(ast.attrs); visit(ast.inputs); visit(ast.outputs); visit(ast.references); visit(ast.directives); visit(ast.providers); visit(ast.children); }); } }, { key: "visitDirective", value: function visitDirective(ast, context) { return this.visitChildren(context, function (visit) { visit(ast.inputs); visit(ast.hostProperties); visit(ast.hostEvents); }); } }, { key: "visitChildren", value: function visitChildren(context, cb) { var results = []; var t = this; function visit(children) { if (children && children.length) results.push(templateVisitAll(t, children, context)); } cb(visit); return Array.prototype.concat.apply([], results); } }]); return RecursiveTemplateAstVisitor; }(NullTemplateVisitor); /** * Visit every node in a list of {@link TemplateAst}s with the given {@link TemplateAstVisitor}. */ function templateVisitAll(visitor, asts) { var context = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var result = []; var 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 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 ProviderError = /*#__PURE__*/function (_ParseError4) { _inherits(ProviderError, _ParseError4); var _super89 = _createSuper(ProviderError); function ProviderError(message, span) { _classCallCheck(this, ProviderError); return _super89.call(this, span, message); } return ProviderError; }(ParseError); var ProviderViewContext = function ProviderViewContext(reflector, component) { var _this153 = this; _classCallCheck(this, ProviderViewContext); this.reflector = reflector; this.component = component; this.errors = []; this.viewQueries = _getViewQueries(component); this.viewProviders = new Map(); component.viewProviders.forEach(function (provider) { if (_this153.viewProviders.get(tokenReference(provider.token)) == null) { _this153.viewProviders.set(tokenReference(provider.token), true); } }); }; var ProviderElementContext = /*#__PURE__*/function () { function ProviderElementContext(viewContext, _parent, _isViewRoot, _directiveAsts, attrs, refs, isTemplate, contentQueryStartId, _sourceSpan) { var _this154 = this; _classCallCheck(this, ProviderElementContext); this.viewContext = viewContext; this._parent = _parent; this._isViewRoot = _isViewRoot; this._directiveAsts = _directiveAsts; this._sourceSpan = _sourceSpan; this._transformedProviders = new Map(); this._seenProviders = new Map(); this._queriedTokens = new Map(); this.transformedHasViewContainer = false; this._attrs = {}; attrs.forEach(function (attrAst) { return _this154._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) { _this154._addQueryReadsTo(provider.token, provider.token, _this154._queriedTokens); }); if (isTemplate) { var templateRefId = createTokenForExternalReference(this.viewContext.reflector, Identifiers.TemplateRef); this._addQueryReadsTo(templateRefId, templateRefId, this._queriedTokens); } refs.forEach(function (refAst) { var defaultQueryValue = refAst.value || createTokenForExternalReference(_this154.viewContext.reflector, Identifiers.ElementRef); _this154._addQueryReadsTo({ value: refAst.name }, defaultQueryValue, _this154._queriedTokens); }); if (this._queriedTokens.get(this.viewContext.reflector.resolveExternalReference(Identifiers.ViewContainerRef))) { this.transformedHasViewContainer = true; } // create the providers that we know are eager first Array.from(this._allProviders.values()).forEach(function (provider) { var eager = provider.eager || _this154._queriedTokens.get(tokenReference(provider.token)); if (eager) { _this154._getOrCreateLocalProvider(provider.providerType, provider.token, true); } }); } _createClass2(ProviderElementContext, [{ key: "afterElement", value: function afterElement() { var _this155 = this; // collect lazy providers Array.from(this._allProviders.values()).forEach(function (provider) { _this155._getOrCreateLocalProvider(provider.providerType, provider.token, false); }); } }, { key: "_addQueryReadsTo", value: function _addQueryReadsTo(token, defaultValue, queryReadTokens) { this._getQueriesFor(token).forEach(function (query) { var queryValue = query.meta.read || defaultValue; var tokenRef = tokenReference(queryValue); var queryMatches = queryReadTokens.get(tokenRef); if (!queryMatches) { queryMatches = []; queryReadTokens.set(tokenRef, queryMatches); } queryMatches.push({ queryId: query.queryId, value: queryValue }); }); } }, { key: "_getQueriesFor", value: function _getQueriesFor(token) { var result = []; var currentEl = this; var distance = 0; var queries; while (currentEl !== null) { queries = currentEl._contentQueries.get(tokenReference(token)); if (queries) { result.push.apply(result, _toConsumableArray(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, _toConsumableArray(queries)); } return result; } }, { key: "_getOrCreateLocalProvider", value: function _getOrCreateLocalProvider(requestingProviderType, token, eager) { var _this156 = this; var 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 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! ".concat(tokenName(token)), this._sourceSpan)); return null; } this._seenProviders.set(tokenReference(token), true); var transformedProviders = resolvedProvider.providers.map(function (provider) { var transformedUseValue = provider.useValue; var transformedUseExisting = provider.useExisting; var transformedDeps = undefined; if (provider.useExisting != null) { var existingDiDep = _this156._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 deps = provider.deps || provider.useFactory.diDeps; transformedDeps = deps.map(function (dep) { return _this156._getDependency(resolvedProvider.providerType, dep, eager); }); } else if (provider.useClass) { var _deps = provider.deps || provider.useClass.diDeps; transformedDeps = _deps.map(function (dep) { return _this156._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; } }, { key: "_getLocalDependency", value: function _getLocalDependency(requestingProviderType, dep) { var eager = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; if (dep.isAttribute) { var 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) === this.viewContext.reflector.resolveExternalReference(Identifiers.Renderer) || tokenReference(dep.token) === this.viewContext.reflector.resolveExternalReference(Identifiers.ElementRef) || tokenReference(dep.token) === this.viewContext.reflector.resolveExternalReference(Identifiers.ChangeDetectorRef) || tokenReference(dep.token) === this.viewContext.reflector.resolveExternalReference(Identifiers.TemplateRef)) { return dep; } if (tokenReference(dep.token) === this.viewContext.reflector.resolveExternalReference(Identifiers.ViewContainerRef)) { this.transformedHasViewContainer = true; } } // access the injector if (tokenReference(dep.token) === this.viewContext.reflector.resolveExternalReference(Identifiers.Injector)) { return dep; } // access providers if (this._getOrCreateLocalProvider(requestingProviderType, dep.token, eager) != null) { return dep; } } return null; } }, { key: "_getDependency", value: function _getDependency(requestingProviderType, dep) { var eager = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var currElement = this; var currEager = eager; var 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 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(dep.token) || this.viewContext.viewProviders.get(tokenReference(dep.token)) != null) { result = dep; } else { result = dep.isOptional ? { isValue: true, value: null } : null; } } } if (!result) { this.viewContext.errors.push(new ProviderError("No provider for ".concat(tokenName(dep.token)), this._sourceSpan)); } return result; } }, { key: "transformProviders", get: function get() { // Note: Maps keep their insertion order. var lazyProviders = []; var eagerProviders = []; this._transformedProviders.forEach(function (provider) { if (provider.eager) { eagerProviders.push(provider); } else { lazyProviders.push(provider); } }); return lazyProviders.concat(eagerProviders); } }, { key: "transformedDirectiveAsts", get: function get() { var sortedProviderTypes = this.transformProviders.map(function (provider) { return provider.token.identifier; }); var sortedDirectives = this._directiveAsts.slice(); sortedDirectives.sort(function (dir1, dir2) { return sortedProviderTypes.indexOf(dir1.directive.type) - sortedProviderTypes.indexOf(dir2.directive.type); }); return sortedDirectives; } }, { key: "queryMatches", get: function get() { var allMatches = []; this._queriedTokens.forEach(function (matches) { allMatches.push.apply(allMatches, _toConsumableArray(matches)); }); return allMatches; } }]); return ProviderElementContext; }(); var NgModuleProviderAnalyzer = /*#__PURE__*/function () { function NgModuleProviderAnalyzer(reflector, ngModule, extraProviders, sourceSpan) { var _this157 = this; _classCallCheck(this, NgModuleProviderAnalyzer); this.reflector = reflector; 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, _this157._errors, _this157._allProviders, /* isModule */ true); }); _resolveProviders(ngModule.transitiveModule.providers.map(function (entry) { return entry.provider; }).concat(extraProviders), ProviderAstType.PublicService, false, sourceSpan, this._errors, this._allProviders, /* isModule */ false); } _createClass2(NgModuleProviderAnalyzer, [{ key: "parse", value: function parse() { var _this158 = this; Array.from(this._allProviders.values()).forEach(function (provider) { _this158._getOrCreateLocalProvider(provider.token, provider.eager); }); if (this._errors.length > 0) { var errorString = this._errors.join('\n'); throw new Error("Provider parse errors:\n".concat(errorString)); } // Note: Maps keep their insertion order. var lazyProviders = []; var eagerProviders = []; this._transformedProviders.forEach(function (provider) { if (provider.eager) { eagerProviders.push(provider); } else { lazyProviders.push(provider); } }); return lazyProviders.concat(eagerProviders); } }, { key: "_getOrCreateLocalProvider", value: function _getOrCreateLocalProvider(token, eager) { var _this159 = this; var resolvedProvider = this._allProviders.get(tokenReference(token)); if (!resolvedProvider) { return null; } var 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! ".concat(tokenName(token)), resolvedProvider.sourceSpan)); return null; } this._seenProviders.set(tokenReference(token), true); var transformedProviders = resolvedProvider.providers.map(function (provider) { var transformedUseValue = provider.useValue; var transformedUseExisting = provider.useExisting; var transformedDeps = undefined; if (provider.useExisting != null) { var existingDiDep = _this159._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 deps = provider.deps || provider.useFactory.diDeps; transformedDeps = deps.map(function (dep) { return _this159._getDependency(dep, eager, resolvedProvider.sourceSpan); }); } else if (provider.useClass) { var _deps2 = provider.deps || provider.useClass.diDeps; transformedDeps = _deps2.map(function (dep) { return _this159._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; } }, { key: "_getDependency", value: function _getDependency(dep) { var eager = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var requestorSourceSpan = arguments.length > 2 ? arguments[2] : undefined; var foundLocal = false; if (!dep.isSkipSelf && dep.token != null) { // access the injector if (tokenReference(dep.token) === this.reflector.resolveExternalReference(Identifiers.Injector) || tokenReference(dep.token) === this.reflector.resolveExternalReference(Identifiers.ComponentFactoryResolver)) { foundLocal = true; // access providers } else if (this._getOrCreateLocalProvider(dep.token, eager) != null) { foundLocal = true; } } return dep; } }]); return NgModuleProviderAnalyzer; }(); function _transformProvider(provider, _ref30) { var useExisting = _ref30.useExisting, useValue = _ref30.useValue, deps = _ref30.deps; return { token: provider.token, useClass: provider.useClass, useExisting: useExisting, useFactory: provider.useFactory, useValue: useValue, deps: deps, multi: provider.multi }; } function _transformProviderAst(provider, _ref31) { var eager = _ref31.eager, providers = _ref31.providers; return new ProviderAst(provider.token, provider.multiProvider, provider.eager || eager, providers, provider.providerType, provider.lifecycleHooks, provider.sourceSpan, provider.isModule); } function _resolveProvidersFromDirectives(directives, sourceSpan, targetErrors) { var providersByToken = new Map(); directives.forEach(function (directive) { var dirProvider = { token: { identifier: directive.type }, useClass: directive.type }; _resolveProviders([dirProvider], directive.isComponent ? ProviderAstType.Component : ProviderAstType.Directive, true, sourceSpan, targetErrors, providersByToken, /* isModule */ false); }); // Note: directives need to be able to overwrite providers of a component! var 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, /* isModule */ false); _resolveProviders(directive.viewProviders, ProviderAstType.PrivateService, false, sourceSpan, targetErrors, providersByToken, /* isModule */ false); }); return providersByToken; } function _resolveProviders(providers, providerType, eager, sourceSpan, targetErrors, targetProvidersByToken, isModule) { providers.forEach(function (provider) { var 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 ".concat(tokenName(resolvedProvider.token)), sourceSpan)); } if (!resolvedProvider) { var lifecycleHooks = provider.token.identifier && provider.token.identifier.lifecycleHooks ? provider.token.identifier.lifecycleHooks : []; var isUseValue = !(provider.useClass || provider.useExisting || provider.useFactory); resolvedProvider = new ProviderAst(provider.token, !!provider.multi, eager || isUseValue, [provider], providerType, lifecycleHooks, sourceSpan, isModule); targetProvidersByToken.set(tokenReference(provider.token), resolvedProvider); } else { if (!provider.multi) { resolvedProvider.providers.length = 0; } resolvedProvider.providers.push(provider); } }); } function _getViewQueries(component) { // Note: queries start with id 1 so we can use the number in a Bloom filter! var viewQueryId = 1; var viewQueries = new Map(); if (component.viewQueries) { component.viewQueries.forEach(function (query) { return _addQueryToTokenMap(viewQueries, { meta: query, queryId: viewQueryId++ }); }); } return viewQueries; } function _getContentQueries(contentQueryStartId, directives) { var contentQueryId = contentQueryStartId; var 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; } function _addQueryToTokenMap(map, query) { query.meta.selectors.forEach(function (token) { var 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 */ var StyleWithImports = function StyleWithImports(style, styleUrls) { _classCallCheck(this, StyleWithImports); this.style = style; this.styleUrls = styleUrls; }; function isStyleUrlResolvable(url) { if (url == null || url.length === 0 || url[0] == '/') return false; var 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 */ function extractStyleUrls(resolver, baseUrl, cssText) { var foundUrls = []; var modifiedCssText = cssText.replace(CSS_STRIPPABLE_COMMENT_REGEXP, '').replace(CSS_IMPORT_REGEXP, function () { var url = (arguments.length <= 1 ? undefined : arguments[1]) || (arguments.length <= 2 ? undefined : arguments[2]); if (!isStyleUrlResolvable(url)) { // Do not attempt to resolve non-package absolute URLs with URI // scheme return arguments.length <= 0 ? undefined : arguments[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_STRIPPABLE_COMMENT_REGEXP = /\/\*(?!#\s*(?:sourceURL|sourceMappingURL)=)[\s\S]+?\*\//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-'; /** * Parses bindings in templates and in the directive host area. */ var BindingParser = /*#__PURE__*/function () { function BindingParser(_exprParser, _interpolationConfig, _schemaRegistry, pipes, errors) { _classCallCheck(this, BindingParser); this._exprParser = _exprParser; this._interpolationConfig = _interpolationConfig; this._schemaRegistry = _schemaRegistry; this.errors = errors; this.pipesByName = null; this._usedPipes = new Map(); // When the `pipes` parameter is `null`, do not check for used pipes // This is used in IVY when we might not know the available pipes at compile time if (pipes) { var pipesByName = new Map(); pipes.forEach(function (pipe) { return pipesByName.set(pipe.name, pipe); }); this.pipesByName = pipesByName; } } _createClass2(BindingParser, [{ key: "getUsedPipes", value: function getUsedPipes() { return Array.from(this._usedPipes.values()); } }, { key: "createBoundHostProperties", value: function createBoundHostProperties(dirMeta, sourceSpan) { var _this160 = this; if (dirMeta.hostProperties) { var boundProps = []; Object.keys(dirMeta.hostProperties).forEach(function (propName) { var expression = dirMeta.hostProperties[propName]; if (typeof expression === 'string') { _this160.parsePropertyBinding(propName, expression, true, sourceSpan, sourceSpan.start.offset, undefined, [], boundProps); } else { _this160._reportError("Value of the host property binding \"".concat(propName, "\" needs to be a string representing an expression but got \"").concat(expression, "\" (").concat(typeof expression, ")"), sourceSpan); } }); return boundProps; } return null; } }, { key: "createDirectiveHostPropertyAsts", value: function createDirectiveHostPropertyAsts(dirMeta, elementSelector, sourceSpan) { var _this161 = this; var boundProps = this.createBoundHostProperties(dirMeta, sourceSpan); return boundProps && boundProps.map(function (prop) { return _this161.createBoundElementProperty(elementSelector, prop); }); } }, { key: "createDirectiveHostEventAsts", value: function createDirectiveHostEventAsts(dirMeta, sourceSpan) { var _this162 = this; if (dirMeta.hostListeners) { var targetEvents = []; Object.keys(dirMeta.hostListeners).forEach(function (propName) { var expression = dirMeta.hostListeners[propName]; if (typeof expression === 'string') { // TODO: pass a more accurate handlerSpan for this event. _this162.parseEvent(propName, expression, sourceSpan, sourceSpan, [], targetEvents); } else { _this162._reportError("Value of the host listener \"".concat(propName, "\" needs to be a string representing an expression but got \"").concat(expression, "\" (").concat(typeof expression, ")"), sourceSpan); } }); return targetEvents; } return null; } }, { key: "parseInterpolation", value: function parseInterpolation(value, sourceSpan) { var sourceInfo = sourceSpan.start.toString(); try { var ast = this._exprParser.parseInterpolation(value, sourceInfo, sourceSpan.start.offset, this._interpolationConfig); if (ast) this._reportExpressionParserErrors(ast.errors, sourceSpan); this._checkPipes(ast, sourceSpan); return ast; } catch (e) { this._reportError("".concat(e), sourceSpan); return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo, sourceSpan.start.offset); } } // Parse an inline template binding. ie `<tag *tplKey="<tplValue>">` }, { key: "parseInlineTemplateBinding", value: function parseInlineTemplateBinding(tplKey, tplValue, sourceSpan, absoluteOffset, targetMatchableAttrs, targetProps, targetVars) { var bindings = this._parseTemplateBindings(tplKey, tplValue, sourceSpan); for (var i = 0; i < bindings.length; i++) { var binding = bindings[i]; if (binding.keyIsVar) { targetVars.push(new ParsedVariable(binding.key, binding.name, sourceSpan)); } else if (binding.expression) { this._parsePropertyAst(binding.key, binding.expression, sourceSpan, undefined, targetMatchableAttrs, targetProps); } else { targetMatchableAttrs.push([binding.key, '']); this.parseLiteralAttr(binding.key, null, sourceSpan, absoluteOffset, undefined, targetMatchableAttrs, targetProps); } } } }, { key: "_parseTemplateBindings", value: function _parseTemplateBindings(tplKey, tplValue, sourceSpan) { var _this163 = this; var sourceInfo = sourceSpan.start.toString(); try { var bindingsResult = this._exprParser.parseTemplateBindings(tplKey, tplValue, sourceInfo, sourceSpan.start.offset); this._reportExpressionParserErrors(bindingsResult.errors, sourceSpan); bindingsResult.templateBindings.forEach(function (binding) { if (binding.expression) { _this163._checkPipes(binding.expression, sourceSpan); } }); bindingsResult.warnings.forEach(function (warning) { _this163._reportError(warning, sourceSpan, ParseErrorLevel.WARNING); }); return bindingsResult.templateBindings; } catch (e) { this._reportError("".concat(e), sourceSpan); return []; } } }, { key: "parseLiteralAttr", value: function parseLiteralAttr(name, value, sourceSpan, absoluteOffset, valueSpan, 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, absoluteOffset, valueSpan, targetMatchableAttrs, targetProps); } else { targetProps.push(new ParsedProperty(name, this._exprParser.wrapLiteralPrimitive(value, '', absoluteOffset), ParsedPropertyType.LITERAL_ATTR, sourceSpan, valueSpan)); } } }, { key: "parsePropertyBinding", value: function parsePropertyBinding(name, expression, isHost, sourceSpan, absoluteOffset, valueSpan, targetMatchableAttrs, targetProps) { var 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, absoluteOffset, valueSpan, targetMatchableAttrs, targetProps); } else { this._parsePropertyAst(name, this._parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), sourceSpan, valueSpan, targetMatchableAttrs, targetProps); } } }, { key: "parsePropertyInterpolation", value: function parsePropertyInterpolation(name, value, sourceSpan, valueSpan, targetMatchableAttrs, targetProps) { var expr = this.parseInterpolation(value, valueSpan || sourceSpan); if (expr) { this._parsePropertyAst(name, expr, sourceSpan, valueSpan, targetMatchableAttrs, targetProps); return true; } return false; } }, { key: "_parsePropertyAst", value: function _parsePropertyAst(name, ast, sourceSpan, valueSpan, targetMatchableAttrs, targetProps) { targetMatchableAttrs.push([name, ast.source]); targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.DEFAULT, sourceSpan, valueSpan)); } }, { key: "_parseAnimation", value: function _parseAnimation(name, expression, sourceSpan, absoluteOffset, valueSpan, 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 ast = this._parseBinding(expression || 'undefined', false, valueSpan || sourceSpan, absoluteOffset); targetMatchableAttrs.push([name, ast.source]); targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.ANIMATION, sourceSpan, valueSpan)); } }, { key: "_parseBinding", value: function _parseBinding(value, isHostBinding, sourceSpan, absoluteOffset) { var sourceInfo = (sourceSpan && sourceSpan.start || '(unknown)').toString(); try { var ast = isHostBinding ? this._exprParser.parseSimpleBinding(value, sourceInfo, absoluteOffset, this._interpolationConfig) : this._exprParser.parseBinding(value, sourceInfo, absoluteOffset, this._interpolationConfig); if (ast) this._reportExpressionParserErrors(ast.errors, sourceSpan); this._checkPipes(ast, sourceSpan); return ast; } catch (e) { this._reportError("".concat(e), sourceSpan); return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo, absoluteOffset); } } }, { key: "createBoundElementProperty", value: function createBoundElementProperty(elementSelector, boundProp) { var skipValidation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var mapPropertyName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; if (boundProp.isAnimation) { return new BoundElementProperty(boundProp.name, 4 /* Animation */ , SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan, boundProp.valueSpan); } var unit = null; var bindingType = undefined; var boundPropertyName = null; var parts = boundProp.name.split(PROPERTY_PARTS_SEPARATOR); var securityContexts = undefined; // Check for special cases (prefix style, attr, class) if (parts.length > 1) { if (parts[0] == ATTRIBUTE_PREFIX) { boundPropertyName = parts[1]; if (!skipValidation) { this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, true); } securityContexts = _calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, true); var nsSeparatorIdx = boundPropertyName.indexOf(':'); if (nsSeparatorIdx > -1) { var ns = boundPropertyName.substring(0, nsSeparatorIdx); var name = boundPropertyName.substring(nsSeparatorIdx + 1); boundPropertyName = mergeNsAndName(ns, name); } bindingType = 1 /* Attribute */ ; } else if (parts[0] == CLASS_PREFIX) { boundPropertyName = parts[1]; bindingType = 2 /* Class */ ; securityContexts = [SecurityContext.NONE]; } else if (parts[0] == STYLE_PREFIX) { unit = parts.length > 2 ? parts[2] : null; boundPropertyName = parts[1]; bindingType = 3 /* Style */ ; securityContexts = [SecurityContext.STYLE]; } } // If not a special case, use the full property name if (boundPropertyName === null) { var mappedPropName = this._schemaRegistry.getMappedPropName(boundProp.name); boundPropertyName = mapPropertyName ? mappedPropName : boundProp.name; securityContexts = _calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, mappedPropName, false); bindingType = 0 /* Property */ ; if (!skipValidation) { this._validatePropertyOrAttributeName(mappedPropName, boundProp.sourceSpan, false); } } return new BoundElementProperty(boundPropertyName, bindingType, securityContexts[0], boundProp.expression, unit, boundProp.sourceSpan, boundProp.valueSpan); } }, { key: "parseEvent", value: function parseEvent(name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents) { if (isAnimationLabel(name)) { name = name.substr(1); this._parseAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents); } else { this._parseRegularEvent(name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents); } } }, { key: "calcPossibleSecurityContexts", value: function calcPossibleSecurityContexts(selector, propName, isAttribute) { var prop = this._schemaRegistry.getMappedPropName(propName); return _calcPossibleSecurityContexts(this._schemaRegistry, selector, prop, isAttribute); } }, { key: "_parseAnimationEvent", value: function _parseAnimationEvent(name, expression, sourceSpan, handlerSpan, targetEvents) { var matches = splitAtPeriod(name, [name, '']); var eventName = matches[0]; var phase = matches[1].toLowerCase(); if (phase) { switch (phase) { case 'start': case 'done': var ast = this._parseAction(expression, handlerSpan); targetEvents.push(new ParsedEvent(eventName, phase, 1 /* Animation */ , ast, sourceSpan, handlerSpan)); break; default: this._reportError("The provided animation output phase value \"".concat(phase, "\" for \"@").concat(eventName, "\" is not supported (use start or done)"), sourceSpan); break; } } else { this._reportError("The animation trigger output event (@".concat(eventName, ") is missing its phase value name (start or done are currently supported)"), sourceSpan); } } }, { key: "_parseRegularEvent", value: function _parseRegularEvent(name, expression, sourceSpan, handlerSpan, targetMatchableAttrs, targetEvents) { // long format: 'target: eventName' var _splitAtColon3 = splitAtColon(name, [null, name]), _splitAtColon4 = _slicedToArray(_splitAtColon3, 2), target = _splitAtColon4[0], eventName = _splitAtColon4[1]; var ast = this._parseAction(expression, handlerSpan); targetMatchableAttrs.push([name, ast.source]); targetEvents.push(new ParsedEvent(eventName, target, 0 /* Regular */ , ast, sourceSpan, handlerSpan)); // Don't detect directives for event names for now, // so don't add the event name to the matchableAttrs } }, { key: "_parseAction", value: function _parseAction(value, sourceSpan) { var sourceInfo = (sourceSpan && sourceSpan.start || '(unknown').toString(); var absoluteOffset = sourceSpan && sourceSpan.start ? sourceSpan.start.offset : 0; try { var ast = this._exprParser.parseAction(value, sourceInfo, absoluteOffset, 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, absoluteOffset); } this._checkPipes(ast, sourceSpan); return ast; } catch (e) { this._reportError("".concat(e), sourceSpan); return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo, absoluteOffset); } } }, { key: "_reportError", value: function _reportError(message, sourceSpan) { var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ParseErrorLevel.ERROR; this.errors.push(new ParseError(sourceSpan, message, level)); } }, { key: "_reportExpressionParserErrors", value: function _reportExpressionParserErrors(errors, sourceSpan) { var _iterator8 = _createForOfIteratorHelper(errors), _step8; try { for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) { var _error = _step8.value; this._reportError(_error.message, sourceSpan); } } catch (err) { _iterator8.e(err); } finally { _iterator8.f(); } } // Make sure all the used pipes are known in `this.pipesByName` }, { key: "_checkPipes", value: function _checkPipes(ast, sourceSpan) { var _this164 = this; if (ast && this.pipesByName) { var collector = new PipeCollector(); ast.visit(collector); collector.pipes.forEach(function (ast, pipeName) { var pipeMeta = _this164.pipesByName.get(pipeName); if (!pipeMeta) { _this164._reportError("The pipe '".concat(pipeName, "' could not be found"), new ParseSourceSpan(sourceSpan.start.moveBy(ast.span.start), sourceSpan.start.moveBy(ast.span.end))); } else { _this164._usedPipes.set(pipeName, pipeMeta); } }); } } /** * @param propName the name of the property / attribute * @param sourceSpan * @param isAttr true when binding to an attribute */ }, { key: "_validatePropertyOrAttributeName", value: function _validatePropertyOrAttributeName(propName, sourceSpan, isAttr) { var report = isAttr ? this._schemaRegistry.validateAttribute(propName) : this._schemaRegistry.validateProperty(propName); if (report.error) { this._reportError(report.msg, sourceSpan, ParseErrorLevel.ERROR); } } }, { key: "interpolationConfig", get: function get() { return this._interpolationConfig; } }]); return BindingParser; }(); var PipeCollector = /*#__PURE__*/function (_RecursiveAstVisitor$) { _inherits(PipeCollector, _RecursiveAstVisitor$); var _super90 = _createSuper(PipeCollector); function PipeCollector() { var _this165; _classCallCheck(this, PipeCollector); _this165 = _super90.apply(this, arguments); _this165.pipes = new Map(); return _this165; } _createClass2(PipeCollector, [{ key: "visitPipe", value: function visitPipe(ast, context) { this.pipes.set(ast.name, ast); ast.exp.visit(this); this.visitAll(ast.args, context); return null; } }]); return PipeCollector; }(RecursiveAstVisitor$1); function isAnimationLabel(name) { return name[0] == '@'; } function _calcPossibleSecurityContexts(registry, selector, propName, isAttribute) { var ctxs = []; CssSelector.parse(selector).forEach(function (selector) { var elementNames = selector.element ? [selector.element] : registry.allKnownElementNames(); var notElementNames = new Set(selector.notSelectors.filter(function (selector) { return selector.isElementSelector(); }).map(function (selector) { return selector.element; })); var possibleElementNames = elementNames.filter(function (elementName) { return !notElementNames.has(elementName); }); ctxs.push.apply(ctxs, _toConsumableArray(possibleElementNames.map(function (elementName) { return registry.securityContext(elementName, propName, isAttribute); }))); }); return ctxs.length === 0 ? [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'; function preparseElement(ast) { var selectAttr = null; var hrefAttr = null; var relAttr = null; var nonBindable = false; var projectAs = ''; ast.attrs.forEach(function (attr) { var 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 nodeName = ast.name.toLowerCase(); var 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; (function (PreparsedElementType) { PreparsedElementType[PreparsedElementType["NG_CONTENT"] = 0] = "NG_CONTENT"; PreparsedElementType[PreparsedElementType["STYLE"] = 1] = "STYLE"; PreparsedElementType[PreparsedElementType["STYLESHEET"] = 2] = "STYLESHEET"; PreparsedElementType[PreparsedElementType["SCRIPT"] = 3] = "SCRIPT"; PreparsedElementType[PreparsedElementType["OTHER"] = 4] = "OTHER"; })(PreparsedElementType || (PreparsedElementType = {})); var PreparsedElement = function PreparsedElement(type, selectAttr, hrefAttr, nonBindable, projectAs) { _classCallCheck(this, PreparsedElement); this.type = type; this.selectAttr = selectAttr; this.hrefAttr = hrefAttr; this.nonBindable = nonBindable; this.projectAs = projectAs; }; 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; var TEMPLATE_ATTR_PREFIX = '*'; var CLASS_ATTR = 'class'; var _TEXT_CSS_SELECTOR; function TEXT_CSS_SELECTOR() { if (!_TEXT_CSS_SELECTOR) { _TEXT_CSS_SELECTOR = CssSelector.parse('*')[0]; } return _TEXT_CSS_SELECTOR; } var TemplateParseError = /*#__PURE__*/function (_ParseError5) { _inherits(TemplateParseError, _ParseError5); var _super91 = _createSuper(TemplateParseError); function TemplateParseError(message, span, level) { _classCallCheck(this, TemplateParseError); return _super91.call(this, span, message, level); } return TemplateParseError; }(ParseError); var TemplateParseResult = function TemplateParseResult(templateAst, usedPipes, errors) { _classCallCheck(this, TemplateParseResult); this.templateAst = templateAst; this.usedPipes = usedPipes; this.errors = errors; }; var TemplateParser = /*#__PURE__*/function () { function TemplateParser(_config, _reflector, _exprParser, _schemaRegistry, _htmlParser, _console, transforms) { _classCallCheck(this, TemplateParser); this._config = _config; this._reflector = _reflector; this._exprParser = _exprParser; this._schemaRegistry = _schemaRegistry; this._htmlParser = _htmlParser; this._console = _console; this.transforms = transforms; } _createClass2(TemplateParser, [{ key: "parse", value: function parse(component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces) { var result = this.tryParse(component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces); var warnings = result.errors.filter(function (error) { return error.level === ParseErrorLevel.WARNING; }); var errors = result.errors.filter(function (error) { return error.level === ParseErrorLevel.ERROR; }); if (warnings.length > 0) { this._console.warn("Template parse warnings:\n".concat(warnings.join('\n'))); } if (errors.length > 0) { var errorString = errors.join('\n'); throw syntaxError("Template parse errors:\n".concat(errorString), errors); } return { template: result.templateAst, pipes: result.usedPipes }; } }, { key: "tryParse", value: function tryParse(component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces) { var htmlParseResult = typeof template === 'string' ? this._htmlParser.parse(template, templateUrl, { tokenizeExpansionForms: true, interpolationConfig: this.getInterpolationConfig(component) }) : template; if (!preserveWhitespaces) { htmlParseResult = removeWhitespaces(htmlParseResult); } return this.tryParseHtml(this.expandHtml(htmlParseResult), component, directives, pipes, schemas); } }, { key: "tryParseHtml", value: function tryParseHtml(htmlAstWithErrors, component, directives, pipes, schemas) { var result; var errors = htmlAstWithErrors.errors; var usedPipes = []; if (htmlAstWithErrors.rootNodes.length > 0) { var uniqDirectives = removeSummaryDuplicates(directives); var uniqPipes = removeSummaryDuplicates(pipes); var providerViewContext = new ProviderViewContext(this._reflector, component); var interpolationConfig = undefined; if (component.template && component.template.interpolation) { interpolationConfig = { start: component.template.interpolation[0], end: component.template.interpolation[1] }; } var bindingParser = new BindingParser(this._exprParser, interpolationConfig, this._schemaRegistry, uniqPipes, errors); var parseVisitor = new TemplateParseVisitor(this._reflector, this._config, providerViewContext, uniqDirectives, bindingParser, this._schemaRegistry, schemas, errors); result = visitAll$1(parseVisitor, htmlAstWithErrors.rootNodes, EMPTY_ELEMENT_CONTEXT); errors.push.apply(errors, _toConsumableArray(providerViewContext.errors)); usedPipes.push.apply(usedPipes, _toConsumableArray(bindingParser.getUsedPipes())); } else { result = []; } this._assertNoReferenceDuplicationOnTemplate(result, errors); if (errors.length > 0) { return new TemplateParseResult(result, usedPipes, errors); } if (this.transforms) { this.transforms.forEach(function (transform) { result = templateVisitAll(transform, result); }); } return new TemplateParseResult(result, usedPipes, errors); } }, { key: "expandHtml", value: function expandHtml(htmlAstWithErrors) { var forced = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var errors = htmlAstWithErrors.errors; if (errors.length == 0 || forced) { // Transform ICU messages to angular directives var expandedHtmlAst = expandNodes(htmlAstWithErrors.rootNodes); errors.push.apply(errors, _toConsumableArray(expandedHtmlAst.errors)); htmlAstWithErrors = new ParseTreeResult(expandedHtmlAst.nodes, errors); } return htmlAstWithErrors; } }, { key: "getInterpolationConfig", value: function getInterpolationConfig(component) { if (component.template) { return InterpolationConfig.fromArray(component.template.interpolation); } return undefined; } /** @internal */ }, { key: "_assertNoReferenceDuplicationOnTemplate", value: function _assertNoReferenceDuplicationOnTemplate(result, errors) { var existingReferences = []; result.filter(function (element) { return !!element.references; }).forEach(function (element) { return element.references.forEach(function (reference) { var name = reference.name; if (existingReferences.indexOf(name) < 0) { existingReferences.push(name); } else { var _error2 = new TemplateParseError("Reference \"#".concat(name, "\" is defined several times"), reference.sourceSpan, ParseErrorLevel.ERROR); errors.push(_error2); } }); }); } }, { key: "expressionParser", get: function get() { return this._exprParser; } }]); return TemplateParser; }(); var TemplateParseVisitor = /*#__PURE__*/function () { function TemplateParseVisitor(reflector, config, providerViewContext, directives, _bindingParser, _schemaRegistry, _schemas, _targetErrors) { var _this166 = this; _classCallCheck(this, TemplateParseVisitor); this.reflector = reflector; this.config = config; this.providerViewContext = providerViewContext; this._bindingParser = _bindingParser; this._schemaRegistry = _schemaRegistry; this._schemas = _schemas; this._targetErrors = _targetErrors; this.selectorMatcher = new SelectorMatcher(); this.directivesIndex = new Map(); this.ngContentCount = 0; // Note: queries start with id 1 so we can use the number in a Bloom filter! this.contentQueryStartId = providerViewContext.component.viewQueries.length + 1; directives.forEach(function (directive, index) { var selector = CssSelector.parse(directive.selector); _this166.selectorMatcher.addSelectables(selector, directive); _this166.directivesIndex.set(directive, index); }); } _createClass2(TemplateParseVisitor, [{ key: "visitExpansion", value: function visitExpansion(expansion, context) { return null; } }, { key: "visitExpansionCase", value: function visitExpansionCase(expansionCase, context) { return null; } }, { key: "visitText", value: function visitText(text, parent) { var ngContentIndex = parent.findNgContentIndex(TEXT_CSS_SELECTOR()); var valueNoNgsp = replaceNgsp(text.value); var expr = this._bindingParser.parseInterpolation(valueNoNgsp, text.sourceSpan); return expr ? new BoundTextAst(expr, ngContentIndex, text.sourceSpan) : new TextAst(valueNoNgsp, ngContentIndex, text.sourceSpan); } }, { key: "visitAttribute", value: function visitAttribute(attribute, context) { return new AttrAst(attribute.name, attribute.value, attribute.sourceSpan); } }, { key: "visitComment", value: function visitComment(comment, context) { return null; } }, { key: "visitElement", value: function visitElement(element, parent) { var _this167 = this; var queryStartIndex = this.contentQueryStartId; var elName = element.name; var preparsedElement = preparseElement(element); if (preparsedElement.type === PreparsedElementType.SCRIPT || preparsedElement.type === PreparsedElementType.STYLE) { // Skipping <script> for security reasons // Skipping <style> as we already processed them // in the StyleCompiler return null; } if (preparsedElement.type === PreparsedElementType.STYLESHEET && isStyleUrlResolvable(preparsedElement.hrefAttr)) { // Skipping stylesheets with either relative urls or package scheme as we already processed // them in the StyleCompiler return null; } var matchableAttrs = []; var elementOrDirectiveProps = []; var elementOrDirectiveRefs = []; var elementVars = []; var events = []; var templateElementOrDirectiveProps = []; var templateMatchableAttrs = []; var templateElementVars = []; var hasInlineTemplates = false; var attrs = []; var isTemplateElement = isNgTemplate(element.name); element.attrs.forEach(function (attr) { var parsedVariables = []; var hasBinding = _this167._parseAttr(isTemplateElement, attr, matchableAttrs, elementOrDirectiveProps, events, elementOrDirectiveRefs, elementVars); elementVars.push.apply(elementVars, _toConsumableArray(parsedVariables.map(function (v) { return VariableAst.fromParsedVariable(v); }))); var templateValue; var templateKey; var normalizedName = _this167._normalizeAttributeName(attr.name); if (normalizedName.startsWith(TEMPLATE_ATTR_PREFIX)) { templateValue = attr.value; templateKey = normalizedName.substring(TEMPLATE_ATTR_PREFIX.length); } var hasTemplateBinding = templateValue != null; if (hasTemplateBinding) { if (hasInlineTemplates) { _this167._reportError("Can't have multiple template bindings on one element. Use only one attribute prefixed with *", attr.sourceSpan); } hasInlineTemplates = true; var _parsedVariables = []; _this167._bindingParser.parseInlineTemplateBinding(templateKey, templateValue, attr.sourceSpan, attr.sourceSpan.start.offset, templateMatchableAttrs, templateElementOrDirectiveProps, _parsedVariables); templateElementVars.push.apply(templateElementVars, _toConsumableArray(_parsedVariables.map(function (v) { return VariableAst.fromParsedVariable(v); }))); } if (!hasBinding && !hasTemplateBinding) { // don't include the bindings as attributes as well in the AST attrs.push(_this167.visitAttribute(attr, null)); matchableAttrs.push([attr.name, attr.value]); } }); var elementCssSelector = createElementCssSelector(elName, matchableAttrs); var _this$_parseDirective = this._parseDirectives(this.selectorMatcher, elementCssSelector), directiveMetas = _this$_parseDirective.directives, matchElement = _this$_parseDirective.matchElement; var references = []; var boundDirectivePropNames = new Set(); var directiveAsts = this._createDirectiveAsts(isTemplateElement, element.name, directiveMetas, elementOrDirectiveProps, elementOrDirectiveRefs, element.sourceSpan, references, boundDirectivePropNames); var elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, boundDirectivePropNames); var isViewRoot = parent.isTemplateElement || hasInlineTemplates; var providerContext = new ProviderElementContext(this.providerViewContext, parent.providerContext, isViewRoot, directiveAsts, attrs, references, isTemplateElement, queryStartIndex, element.sourceSpan); var children = visitAll$1(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children, ElementContext.create(isTemplateElement, directiveAsts, isTemplateElement ? parent.providerContext : providerContext)); providerContext.afterElement(); // Override the actual selector when the `ngProjectAs` attribute is provided var projectionSelector = preparsedElement.projectAs != '' ? CssSelector.parse(preparsedElement.projectAs)[0] : elementCssSelector; var ngContentIndex = parent.findNgContentIndex(projectionSelector); var parsedElement; if (preparsedElement.type === PreparsedElementType.NG_CONTENT) { // `<ng-content>` element if (element.children && !element.children.every(_isEmptyTextNode)) { this._reportError("<ng-content> element cannot have content.", element.sourceSpan); } parsedElement = new NgContentAst(this.ngContentCount++, hasInlineTemplates ? null : ngContentIndex, element.sourceSpan); } else if (isTemplateElement) { // `<ng-template>` element this._assertAllEventsPublishedByDirectives(directiveAsts, events); this._assertNoComponentsNorElementBindingsOnTemplate(directiveAsts, elementProps, element.sourceSpan); parsedElement = new EmbeddedTemplateAst(attrs, events, references, elementVars, providerContext.transformedDirectiveAsts, providerContext.transformProviders, providerContext.transformedHasViewContainer, providerContext.queryMatches, children, hasInlineTemplates ? null : ngContentIndex, element.sourceSpan); } else { // element other than `<ng-content>` and `<ng-template>` this._assertElementExists(matchElement, element); this._assertOnlyOneComponent(directiveAsts, element.sourceSpan); var _ngContentIndex = hasInlineTemplates ? null : parent.findNgContentIndex(projectionSelector); parsedElement = new ElementAst(elName, attrs, elementProps, events, references, providerContext.transformedDirectiveAsts, providerContext.transformProviders, providerContext.transformedHasViewContainer, providerContext.queryMatches, children, hasInlineTemplates ? null : _ngContentIndex, element.sourceSpan, element.endSourceSpan || null); } if (hasInlineTemplates) { // The element as a *-attribute var templateQueryStartIndex = this.contentQueryStartId; var templateSelector = createElementCssSelector('ng-template', templateMatchableAttrs); var _this$_parseDirective2 = this._parseDirectives(this.selectorMatcher, templateSelector), directives = _this$_parseDirective2.directives; var templateBoundDirectivePropNames = new Set(); var templateDirectiveAsts = this._createDirectiveAsts(true, elName, directives, templateElementOrDirectiveProps, [], element.sourceSpan, [], templateBoundDirectivePropNames); var templateElementProps = this._createElementPropertyAsts(elName, templateElementOrDirectiveProps, templateBoundDirectivePropNames); this._assertNoComponentsNorElementBindingsOnTemplate(templateDirectiveAsts, templateElementProps, element.sourceSpan); var templateProviderContext = new ProviderElementContext(this.providerViewContext, parent.providerContext, parent.isTemplateElement, templateDirectiveAsts, [], [], true, templateQueryStartIndex, element.sourceSpan); templateProviderContext.afterElement(); parsedElement = new EmbeddedTemplateAst([], [], [], templateElementVars, templateProviderContext.transformedDirectiveAsts, templateProviderContext.transformProviders, templateProviderContext.transformedHasViewContainer, templateProviderContext.queryMatches, [parsedElement], ngContentIndex, element.sourceSpan); } return parsedElement; } }, { key: "_parseAttr", value: function _parseAttr(isTemplateElement, attr, targetMatchableAttrs, targetProps, targetEvents, targetRefs, targetVars) { var name = this._normalizeAttributeName(attr.name); var value = attr.value; var srcSpan = attr.sourceSpan; var absoluteOffset = attr.valueSpan ? attr.valueSpan.start.offset : srcSpan.start.offset; var boundEvents = []; var bindParts = name.match(BIND_NAME_REGEXP); var hasBinding = false; if (bindParts !== null) { hasBinding = true; if (bindParts[KW_BIND_IDX] != null) { this._bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX], value, false, srcSpan, absoluteOffset, attr.valueSpan, targetMatchableAttrs, targetProps); } else if (bindParts[KW_LET_IDX]) { if (isTemplateElement) { var identifier = bindParts[IDENT_KW_IDX]; this._parseVariable(identifier, value, srcSpan, targetVars); } else { this._reportError("\"let-\" is only supported on ng-template elements.", srcSpan); } } else if (bindParts[KW_REF_IDX]) { var _identifier = bindParts[IDENT_KW_IDX]; this._parseReference(_identifier, value, srcSpan, targetRefs); } else if (bindParts[KW_ON_IDX]) { this._bindingParser.parseEvent(bindParts[IDENT_KW_IDX], value, srcSpan, attr.valueSpan || srcSpan, targetMatchableAttrs, boundEvents); } else if (bindParts[KW_BINDON_IDX]) { this._bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX], value, false, srcSpan, absoluteOffset, attr.valueSpan, targetMatchableAttrs, targetProps); this._parseAssignmentEvent(bindParts[IDENT_KW_IDX], value, srcSpan, attr.valueSpan || srcSpan, targetMatchableAttrs, boundEvents); } else if (bindParts[KW_AT_IDX]) { this._bindingParser.parseLiteralAttr(name, value, srcSpan, absoluteOffset, attr.valueSpan, targetMatchableAttrs, targetProps); } else if (bindParts[IDENT_BANANA_BOX_IDX]) { this._bindingParser.parsePropertyBinding(bindParts[IDENT_BANANA_BOX_IDX], value, false, srcSpan, absoluteOffset, attr.valueSpan, targetMatchableAttrs, targetProps); this._parseAssignmentEvent(bindParts[IDENT_BANANA_BOX_IDX], value, srcSpan, attr.valueSpan || srcSpan, targetMatchableAttrs, boundEvents); } else if (bindParts[IDENT_PROPERTY_IDX]) { this._bindingParser.parsePropertyBinding(bindParts[IDENT_PROPERTY_IDX], value, false, srcSpan, absoluteOffset, attr.valueSpan, targetMatchableAttrs, targetProps); } else if (bindParts[IDENT_EVENT_IDX]) { this._bindingParser.parseEvent(bindParts[IDENT_EVENT_IDX], value, srcSpan, attr.valueSpan || srcSpan, targetMatchableAttrs, boundEvents); } } else { hasBinding = this._bindingParser.parsePropertyInterpolation(name, value, srcSpan, attr.valueSpan, targetMatchableAttrs, targetProps); } if (!hasBinding) { this._bindingParser.parseLiteralAttr(name, value, srcSpan, absoluteOffset, attr.valueSpan, targetMatchableAttrs, targetProps); } targetEvents.push.apply(targetEvents, _toConsumableArray(boundEvents.map(function (e) { return BoundEventAst.fromParsedEvent(e); }))); return hasBinding; } }, { key: "_normalizeAttributeName", value: function _normalizeAttributeName(attrName) { return /^data-/i.test(attrName) ? attrName.substring(5) : attrName; } }, { key: "_parseVariable", value: function _parseVariable(identifier, value, sourceSpan, targetVars) { if (identifier.indexOf('-') > -1) { this._reportError("\"-\" is not allowed in variable names", sourceSpan); } targetVars.push(new VariableAst(identifier, value, sourceSpan)); } }, { key: "_parseReference", value: function _parseReference(identifier, value, sourceSpan, targetRefs) { if (identifier.indexOf('-') > -1) { this._reportError("\"-\" is not allowed in reference names", sourceSpan); } targetRefs.push(new ElementOrDirectiveRef(identifier, value, sourceSpan)); } }, { key: "_parseAssignmentEvent", value: function _parseAssignmentEvent(name, expression, sourceSpan, valueSpan, targetMatchableAttrs, targetEvents) { this._bindingParser.parseEvent("".concat(name, "Change"), "".concat(expression, "=$event"), sourceSpan, valueSpan, targetMatchableAttrs, targetEvents); } }, { key: "_parseDirectives", value: function _parseDirectives(selectorMatcher, elementCssSelector) { var _this168 = this; // Need to sort the directives so that we get consistent results throughout, // as selectorMatcher uses Maps inside. // Also deduplicate directives as they might match more than one time! var directives = new Array(this.directivesIndex.size); // Whether any directive selector matches on the element name var matchElement = false; selectorMatcher.match(elementCssSelector, function (selector, directive) { directives[_this168.directivesIndex.get(directive)] = directive; matchElement = matchElement || selector.hasElementSelector(); }); return { directives: directives.filter(function (dir) { return !!dir; }), matchElement: matchElement }; } }, { key: "_createDirectiveAsts", value: function _createDirectiveAsts(isTemplateElement, elementName, directives, props, elementOrDirectiveRefs, elementSourceSpan, targetReferences, targetBoundDirectivePropNames) { var _this169 = this; var matchedReferences = new Set(); var component = null; var directiveAsts = directives.map(function (directive) { var sourceSpan = new ParseSourceSpan(elementSourceSpan.start, elementSourceSpan.end, "Directive ".concat(identifierName(directive.type))); if (directive.isComponent) { component = directive; } var directiveProperties = []; var boundProperties = _this169._bindingParser.createDirectiveHostPropertyAsts(directive, elementName, sourceSpan); var hostProperties = boundProperties.map(function (prop) { return BoundElementPropertyAst.fromBoundProperty(prop); }); // Note: We need to check the host properties here as well, // as we don't know the element name in the DirectiveWrapperCompiler yet. hostProperties = _this169._checkPropertiesInSchema(elementName, hostProperties); var parsedEvents = _this169._bindingParser.createDirectiveHostEventAsts(directive, sourceSpan); _this169._createDirectivePropertyAsts(directive.inputs, props, directiveProperties, targetBoundDirectivePropNames); elementOrDirectiveRefs.forEach(function (elOrDirRef) { if (elOrDirRef.value.length === 0 && directive.isComponent || elOrDirRef.isReferenceToDirective(directive)) { targetReferences.push(new ReferenceAst(elOrDirRef.name, createTokenForReference(directive.type.reference), elOrDirRef.value, elOrDirRef.sourceSpan)); matchedReferences.add(elOrDirRef.name); } }); var hostEvents = parsedEvents.map(function (e) { return BoundEventAst.fromParsedEvent(e); }); var contentQueryStartId = _this169.contentQueryStartId; _this169.contentQueryStartId += directive.queries.length; return new DirectiveAst(directive, directiveProperties, hostProperties, hostEvents, contentQueryStartId, sourceSpan); }); elementOrDirectiveRefs.forEach(function (elOrDirRef) { if (elOrDirRef.value.length > 0) { if (!matchedReferences.has(elOrDirRef.name)) { _this169._reportError("There is no directive with \"exportAs\" set to \"".concat(elOrDirRef.value, "\""), elOrDirRef.sourceSpan); } } else if (!component) { var refToken = null; if (isTemplateElement) { refToken = createTokenForExternalReference(_this169.reflector, Identifiers.TemplateRef); } targetReferences.push(new ReferenceAst(elOrDirRef.name, refToken, elOrDirRef.value, elOrDirRef.sourceSpan)); } }); return directiveAsts; } }, { key: "_createDirectivePropertyAsts", value: function _createDirectivePropertyAsts(directiveProperties, boundProps, targetBoundDirectiveProps, targetBoundDirectivePropNames) { if (directiveProperties) { var boundPropsByName = new Map(); boundProps.forEach(function (boundProp) { var prevValue = boundPropsByName.get(boundProp.name); if (!prevValue || prevValue.isLiteral) { // give [a]="b" a higher precedence than a="b" on the same element boundPropsByName.set(boundProp.name, boundProp); } }); Object.keys(directiveProperties).forEach(function (dirProp) { var elProp = directiveProperties[dirProp]; var boundProp = boundPropsByName.get(elProp); // Bindings are optional, so this binding only needs to be set up if an expression is given. if (boundProp) { targetBoundDirectivePropNames.add(boundProp.name); if (!isEmptyExpression(boundProp.expression)) { targetBoundDirectiveProps.push(new BoundDirectivePropertyAst(dirProp, boundProp.name, boundProp.expression, boundProp.sourceSpan)); } } }); } } }, { key: "_createElementPropertyAsts", value: function _createElementPropertyAsts(elementName, props, boundDirectivePropNames) { var _this170 = this; var boundElementProps = []; props.forEach(function (prop) { if (!prop.isLiteral && !boundDirectivePropNames.has(prop.name)) { var boundProp = _this170._bindingParser.createBoundElementProperty(elementName, prop); boundElementProps.push(BoundElementPropertyAst.fromBoundProperty(boundProp)); } }); return this._checkPropertiesInSchema(elementName, boundElementProps); } }, { key: "_findComponentDirectives", value: function _findComponentDirectives(directives) { return directives.filter(function (directive) { return directive.directive.isComponent; }); } }, { key: "_findComponentDirectiveNames", value: function _findComponentDirectiveNames(directives) { return this._findComponentDirectives(directives).map(function (directive) { return identifierName(directive.directive.type); }); } }, { key: "_assertOnlyOneComponent", value: function _assertOnlyOneComponent(directives, sourceSpan) { var componentTypeNames = this._findComponentDirectiveNames(directives); if (componentTypeNames.length > 1) { this._reportError("More than one component matched on this element.\n" + "Make sure that only one component's selector can match a given element.\n" + "Conflicting components: ".concat(componentTypeNames.join(',')), sourceSpan); } } /** * Make sure that non-angular tags conform to the schemas. * * Note: An element is considered an angular tag when at least one directive selector matches the * tag name. * * @param matchElement Whether any directive has matched on the tag name * @param element the html element */ }, { key: "_assertElementExists", value: function _assertElementExists(matchElement, element) { var elName = element.name.replace(/^:xhtml:/, ''); if (!matchElement && !this._schemaRegistry.hasElement(elName, this._schemas)) { var errorMsg = "'".concat(elName, "' is not a known element:\n"); errorMsg += "1. If '".concat(elName, "' is an Angular component, then verify that it is part of this module.\n"); if (elName.indexOf('-') > -1) { errorMsg += "2. If '".concat(elName, "' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message."); } else { errorMsg += "2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component."; } this._reportError(errorMsg, element.sourceSpan); } } }, { key: "_assertNoComponentsNorElementBindingsOnTemplate", value: function _assertNoComponentsNorElementBindingsOnTemplate(directives, elementProps, sourceSpan) { var _this171 = this; var componentTypeNames = this._findComponentDirectiveNames(directives); if (componentTypeNames.length > 0) { this._reportError("Components on an embedded template: ".concat(componentTypeNames.join(',')), sourceSpan); } elementProps.forEach(function (prop) { _this171._reportError("Property binding ".concat(prop.name, " not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the \"@NgModule.declarations\"."), sourceSpan); }); } }, { key: "_assertAllEventsPublishedByDirectives", value: function _assertAllEventsPublishedByDirectives(directives, events) { var _this172 = this; var allDirectiveEvents = new Set(); directives.forEach(function (directive) { Object.keys(directive.directive.outputs).forEach(function (k) { var eventName = directive.directive.outputs[k]; allDirectiveEvents.add(eventName); }); }); events.forEach(function (event) { if (event.target != null || !allDirectiveEvents.has(event.name)) { _this172._reportError("Event binding ".concat(event.fullName, " not emitted by any directive on an embedded template. Make sure that the event name is spelled correctly and all directives are listed in the \"@NgModule.declarations\"."), event.sourceSpan); } }); } }, { key: "_checkPropertiesInSchema", value: function _checkPropertiesInSchema(elementName, boundProps) { var _this173 = this; // Note: We can't filter out empty expressions before this method, // as we still want to validate them! return boundProps.filter(function (boundProp) { if (boundProp.type === 0 /* Property */ && !_this173._schemaRegistry.hasProperty(elementName, boundProp.name, _this173._schemas)) { var errorMsg = "Can't bind to '".concat(boundProp.name, "' since it isn't a known property of '").concat(elementName, "'."); if (elementName.startsWith('ng-')) { errorMsg += "\n1. If '".concat(boundProp.name, "' is an Angular directive, then add 'CommonModule' to the '@NgModule.imports' of this component.") + "\n2. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component."; } else if (elementName.indexOf('-') > -1) { errorMsg += "\n1. If '".concat(elementName, "' is an Angular component and it has '").concat(boundProp.name, "' input, then verify that it is part of this module.") + "\n2. If '".concat(elementName, "' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.") + "\n3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component."; } _this173._reportError(errorMsg, boundProp.sourceSpan); } return !isEmptyExpression(boundProp.value); }); } }, { key: "_reportError", value: function _reportError(message, sourceSpan) { var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ParseErrorLevel.ERROR; this._targetErrors.push(new ParseError(sourceSpan, message, level)); } }]); return TemplateParseVisitor; }(); var NonBindableVisitor = /*#__PURE__*/function () { function NonBindableVisitor() { _classCallCheck(this, NonBindableVisitor); } _createClass2(NonBindableVisitor, [{ key: "visitElement", value: function visitElement(ast, parent) { var preparsedElement = preparseElement(ast); if (preparsedElement.type === PreparsedElementType.SCRIPT || preparsedElement.type === PreparsedElementType.STYLE || preparsedElement.type === PreparsedElementType.STYLESHEET) { // Skipping <script> for security reasons // Skipping <style> and stylesheets as we already processed them // in the StyleCompiler return null; } var attrNameAndValues = ast.attrs.map(function (attr) { return [attr.name, attr.value]; }); var selector = createElementCssSelector(ast.name, attrNameAndValues); var ngContentIndex = parent.findNgContentIndex(selector); var children = visitAll$1(this, ast.children, EMPTY_ELEMENT_CONTEXT); return new ElementAst(ast.name, visitAll$1(this, ast.attrs), [], [], [], [], [], false, [], children, ngContentIndex, ast.sourceSpan, ast.endSourceSpan); } }, { key: "visitComment", value: function visitComment(comment, context) { return null; } }, { key: "visitAttribute", value: function visitAttribute(attribute, context) { return new AttrAst(attribute.name, attribute.value, attribute.sourceSpan); } }, { key: "visitText", value: function visitText(text, parent) { var ngContentIndex = parent.findNgContentIndex(TEXT_CSS_SELECTOR()); return new TextAst(text.value, ngContentIndex, text.sourceSpan); } }, { key: "visitExpansion", value: function visitExpansion(expansion, context) { return expansion; } }, { key: "visitExpansionCase", value: function visitExpansionCase(expansionCase, context) { return expansionCase; } }]); return NonBindableVisitor; }(); /** * A reference to an element or directive in a template. E.g., the reference in this template: * * <div #myMenu="coolMenu"> * * would be {name: 'myMenu', value: 'coolMenu', sourceSpan: ...} */ var ElementOrDirectiveRef = /*#__PURE__*/function () { function ElementOrDirectiveRef(name, value, sourceSpan) { _classCallCheck(this, ElementOrDirectiveRef); this.name = name; this.value = value; this.sourceSpan = sourceSpan; } /** Gets whether this is a reference to the given directive. */ _createClass2(ElementOrDirectiveRef, [{ key: "isReferenceToDirective", value: function isReferenceToDirective(directive) { return splitExportAs(directive.exportAs).indexOf(this.value) !== -1; } }]); return ElementOrDirectiveRef; }(); /** Splits a raw, potentially comma-delimited `exportAs` value into an array of names. */ function splitExportAs(exportAs) { return exportAs ? exportAs.split(',').map(function (e) { return e.trim(); }) : []; } function splitClasses(classAttrValue) { return classAttrValue.trim().split(/\s+/g); } var ElementContext = /*#__PURE__*/function () { function ElementContext(isTemplateElement, _ngContentIndexMatcher, _wildcardNgContentIndex, providerContext) { _classCallCheck(this, ElementContext); this.isTemplateElement = isTemplateElement; this._ngContentIndexMatcher = _ngContentIndexMatcher; this._wildcardNgContentIndex = _wildcardNgContentIndex; this.providerContext = providerContext; } _createClass2(ElementContext, [{ key: "findNgContentIndex", value: function findNgContentIndex(selector) { var ngContentIndices = []; this._ngContentIndexMatcher.match(selector, function (selector, ngContentIndex) { ngContentIndices.push(ngContentIndex); }); ngContentIndices.sort(); if (this._wildcardNgContentIndex != null) { ngContentIndices.push(this._wildcardNgContentIndex); } return ngContentIndices.length > 0 ? ngContentIndices[0] : null; } }], [{ key: "create", value: function create(isTemplateElement, directives, providerContext) { var matcher = new SelectorMatcher(); var wildcardNgContentIndex = null; var component = directives.find(function (directive) { return directive.directive.isComponent; }); if (component) { var ngContentSelectors = component.directive.template.ngContentSelectors; for (var i = 0; i < ngContentSelectors.length; i++) { var selector = ngContentSelectors[i]; if (selector === '*') { wildcardNgContentIndex = i; } else { matcher.addSelectables(CssSelector.parse(ngContentSelectors[i]), i); } } } return new ElementContext(isTemplateElement, matcher, wildcardNgContentIndex, providerContext); } }]); return ElementContext; }(); function createElementCssSelector(elementName, attributes) { var cssSelector = new CssSelector(); var elNameNoNs = splitNsName(elementName)[1]; cssSelector.setElement(elNameNoNs); for (var i = 0; i < attributes.length; i++) { var attrName = attributes[i][0]; var attrNameNoNs = splitNsName(attrName)[1]; var attrValue = attributes[i][1]; cssSelector.addAttribute(attrNameNoNs, attrValue); if (attrName.toLowerCase() == CLASS_ATTR) { var classes = splitClasses(attrValue); classes.forEach(function (className) { return cssSelector.addClassName(className); }); } } return cssSelector; } var EMPTY_ELEMENT_CONTEXT = new ElementContext(true, new SelectorMatcher(), null, null); var NON_BINDABLE_VISITOR = new NonBindableVisitor(); function _isEmptyTextNode(node) { return node instanceof Text$3 && node.value.trim().length == 0; } function removeSummaryDuplicates(items) { var map = new Map(); items.forEach(function (item) { if (!map.get(item.type.reference)) { map.set(item.type.reference, item); } }); return Array.from(map.values()); } function isEmptyExpression(ast) { if (ast instanceof ASTWithSource) { ast = ast.ast; } return ast instanceof EmptyExpr; } /** * @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 */ /** * Parses string representation of a style and converts it into object literal. * * @param value string representation of style as used in the `style` attribute in HTML. * Example: `color: red; height: auto`. * @returns An array of style property name and value pairs, e.g. `['color', 'red', 'height', * 'auto']` */ function parse(value) { // we use a string array here instead of a string map // because a string-map is not guaranteed to retain the // order of the entries whereas a string array can be // construted in a [key, value, key, value] format. var styles = []; var i = 0; var parenDepth = 0; var quote = 0 /* QuoteNone */ ; var valueStart = 0; var propStart = 0; var currentProp = null; var valueHasQuotes = false; while (i < value.length) { var token = value.charCodeAt(i++); switch (token) { case 40 /* OpenParen */ : parenDepth++; break; case 41 /* CloseParen */ : parenDepth--; break; case 39 /* QuoteSingle */ : // valueStart needs to be there since prop values don't // have quotes in CSS valueHasQuotes = valueHasQuotes || valueStart > 0; if (quote === 0 /* QuoteNone */ ) { quote = 39 /* QuoteSingle */ ; } else if (quote === 39 /* QuoteSingle */ && value.charCodeAt(i - 1) !== 92 /* BackSlash */ ) { quote = 0 /* QuoteNone */ ; } break; case 34 /* QuoteDouble */ : // same logic as above valueHasQuotes = valueHasQuotes || valueStart > 0; if (quote === 0 /* QuoteNone */ ) { quote = 34 /* QuoteDouble */ ; } else if (quote === 34 /* QuoteDouble */ && value.charCodeAt(i - 1) !== 92 /* BackSlash */ ) { quote = 0 /* QuoteNone */ ; } break; case 58 /* Colon */ : if (!currentProp && parenDepth === 0 && quote === 0 /* QuoteNone */ ) { currentProp = hyphenate(value.substring(propStart, i - 1).trim()); valueStart = i; } break; case 59 /* Semicolon */ : if (currentProp && valueStart > 0 && parenDepth === 0 && quote === 0 /* QuoteNone */ ) { var styleVal = value.substring(valueStart, i - 1).trim(); styles.push(currentProp, valueHasQuotes ? stripUnnecessaryQuotes(styleVal) : styleVal); propStart = i; valueStart = 0; currentProp = null; valueHasQuotes = false; } break; } } if (currentProp && valueStart) { var _styleVal = value.substr(valueStart).trim(); styles.push(currentProp, valueHasQuotes ? stripUnnecessaryQuotes(_styleVal) : _styleVal); } return styles; } function stripUnnecessaryQuotes(value) { var qS = value.charCodeAt(0); var qE = value.charCodeAt(value.length - 1); if (qS == qE && (qS == 39 /* QuoteSingle */ || qS == 34 /* QuoteDouble */ )) { var tempValue = value.substring(1, value.length - 1); // special case to avoid using a multi-quoted string that was just chomped // (e.g. `font-family: "Verdana", "sans-serif"`) if (tempValue.indexOf('\'') == -1 && tempValue.indexOf('"') == -1) { value = tempValue; } } return value; } function hyphenate(value) { return value.replace(/[a-z][A-Z]/g, function (v) { return v.charAt(0) + '-' + v.charAt(1); }).toLowerCase(); } var IMPORTANT_FLAG = '!important'; /** * Produces creation/update instructions for all styling bindings (class and style) * * It also produces the creation instruction to register all initial styling values * (which are all the static class="..." and style="..." attribute values that exist * on an element within a template). * * The builder class below handles producing instructions for the following cases: * * - Static style/class attributes (style="..." and class="...") * - Dynamic style/class map bindings ([style]="map" and [class]="map|string") * - Dynamic style/class property bindings ([style.prop]="exp" and [class.name]="exp") * * Due to the complex relationship of all of these cases, the instructions generated * for these attributes/properties/bindings must be done so in the correct order. The * order which these must be generated is as follows: * * if (createMode) { * styling(...) * } * if (updateMode) { * styleMap(...) * classMap(...) * styleProp(...) * classProp(...) * stylingApply(...) * } * * The creation/update methods within the builder class produce these instructions. */ var StylingBuilder = /*#__PURE__*/function () { function StylingBuilder(_elementIndexExpr, _directiveExpr) { _classCallCheck(this, StylingBuilder); this._elementIndexExpr = _elementIndexExpr; this._directiveExpr = _directiveExpr; /** Whether or not there are any static styling values present */ this._hasInitialValues = false; /** * Whether or not there are any styling bindings present * (i.e. `[style]`, `[class]`, `[style.prop]` or `[class.name]`) */ this.hasBindings = false; /** the input for [class] (if it exists) */ this._classMapInput = null; /** the input for [style] (if it exists) */ this._styleMapInput = null; /** an array of each [style.prop] input */ this._singleStyleInputs = null; /** an array of each [class.name] input */ this._singleClassInputs = null; this._lastStylingInput = null; this._firstStylingInput = null; // maps are used instead of hash maps because a Map will // retain the ordering of the keys /** * Represents the location of each style binding in the template * (e.g. `<div [style.width]="w" [style.height]="h">` implies * that `width=0` and `height=1`) */ this._stylesIndex = new Map(); /** * Represents the location of each class binding in the template * (e.g. `<div [class.big]="b" [class.hidden]="h">` implies * that `big=0` and `hidden=1`) */ this._classesIndex = new Map(); this._initialStyleValues = []; this._initialClassValues = []; // certain style properties ALWAYS need sanitization // this is checked each time new styles are encountered this._useDefaultSanitizer = false; } /** * Registers a given input to the styling builder to be later used when producing AOT code. * * The code below will only accept the input if it is somehow tied to styling (whether it be * style/class bindings or static style/class attributes). */ _createClass2(StylingBuilder, [{ key: "registerBoundInput", value: function registerBoundInput(input) { // [attr.style] or [attr.class] are skipped in the code below, // they should not be treated as styling-based bindings since // they are intended to be written directly to the attr and // will therefore skip all style/class resolution that is present // with style="", [style]="" and [style.prop]="", class="", // [class.prop]="". [class]="" assignments var binding = null; var name = input.name; switch (input.type) { case 0 /* Property */ : binding = this.registerInputBasedOnName(name, input.value, input.sourceSpan); break; case 3 /* Style */ : binding = this.registerStyleInput(name, false, input.value, input.sourceSpan, input.unit); break; case 2 /* Class */ : binding = this.registerClassInput(name, false, input.value, input.sourceSpan); break; } return binding ? true : false; } }, { key: "registerInputBasedOnName", value: function registerInputBasedOnName(name, expression, sourceSpan) { var binding = null; var nameToMatch = name.substring(0, 5); // class | style var isStyle = nameToMatch === 'style'; var isClass = isStyle ? false : nameToMatch === 'class'; if (isStyle || isClass) { var isMapBased = name.charAt(5) !== '.'; // style.prop or class.prop makes this a no var property = name.substr(isMapBased ? 5 : 6); // the dot explains why there's a +1 if (isStyle) { binding = this.registerStyleInput(property, isMapBased, expression, sourceSpan); } else { binding = this.registerClassInput(property, isMapBased, expression, sourceSpan); } } return binding; } }, { key: "registerStyleInput", value: function registerStyleInput(name, isMapBased, value, sourceSpan, unit) { if (isEmptyExpression(value)) { return null; } name = normalizePropName(name); var _parseProperty = parseProperty(name), property = _parseProperty.property, hasOverrideFlag = _parseProperty.hasOverrideFlag, bindingUnit = _parseProperty.unit; var entry = { name: property, unit: unit || bindingUnit, value: value, sourceSpan: sourceSpan, hasOverrideFlag: hasOverrideFlag }; if (isMapBased) { this._useDefaultSanitizer = true; this._styleMapInput = entry; } else { (this._singleStyleInputs = this._singleStyleInputs || []).push(entry); this._useDefaultSanitizer = this._useDefaultSanitizer || isStyleSanitizable(name); registerIntoMap(this._stylesIndex, property); } this._lastStylingInput = entry; this._firstStylingInput = this._firstStylingInput || entry; this.hasBindings = true; return entry; } }, { key: "registerClassInput", value: function registerClassInput(name, isMapBased, value, sourceSpan) { if (isEmptyExpression(value)) { return null; } var _parseProperty2 = parseProperty(name), property = _parseProperty2.property, hasOverrideFlag = _parseProperty2.hasOverrideFlag; var entry = { name: property, value: value, sourceSpan: sourceSpan, hasOverrideFlag: hasOverrideFlag, unit: null }; if (isMapBased) { this._classMapInput = entry; } else { (this._singleClassInputs = this._singleClassInputs || []).push(entry); registerIntoMap(this._classesIndex, property); } this._lastStylingInput = entry; this._firstStylingInput = this._firstStylingInput || entry; this.hasBindings = true; return entry; } /** * Registers the element's static style string value to the builder. * * @param value the style string (e.g. `width:100px; height:200px;`) */ }, { key: "registerStyleAttr", value: function registerStyleAttr(value) { this._initialStyleValues = parse(value); this._hasInitialValues = true; } /** * Registers the element's static class string value to the builder. * * @param value the className string (e.g. `disabled gold zoom`) */ }, { key: "registerClassAttr", value: function registerClassAttr(value) { this._initialClassValues = value.trim().split(/\s+/g); this._hasInitialValues = true; } /** * Appends all styling-related expressions to the provided attrs array. * * @param attrs an existing array where each of the styling expressions * will be inserted into. */ }, { key: "populateInitialStylingAttrs", value: function populateInitialStylingAttrs(attrs) { // [CLASS_MARKER, 'foo', 'bar', 'baz' ...] if (this._initialClassValues.length) { attrs.push(literal(1 /* Classes */ )); for (var i = 0; i < this._initialClassValues.length; i++) { attrs.push(literal(this._initialClassValues[i])); } } // [STYLE_MARKER, 'width', '200px', 'height', '100px', ...] if (this._initialStyleValues.length) { attrs.push(literal(2 /* Styles */ )); for (var _i10 = 0; _i10 < this._initialStyleValues.length; _i10 += 2) { attrs.push(literal(this._initialStyleValues[_i10]), literal(this._initialStyleValues[_i10 + 1])); } } } /** * Builds an instruction with all the expressions and parameters for `elementHostAttrs`. * * The instruction generation code below is used for producing the AOT statement code which is * responsible for registering initial styles (within a directive hostBindings' creation block), * as well as any of the provided attribute values, to the directive host element. */ }, { key: "buildHostAttrsInstruction", value: function buildHostAttrsInstruction(sourceSpan, attrs, constantPool) { var _this174 = this; if (this._directiveExpr && (attrs.length || this._hasInitialValues)) { return { sourceSpan: sourceSpan, reference: Identifiers$1.elementHostAttrs, allocateBindingSlots: 0, params: function params() { // params => elementHostAttrs(attrs) _this174.populateInitialStylingAttrs(attrs); var attrArray = !attrs.some(function (attr) { return attr instanceof WrappedNodeExpr; }) ? getConstantLiteralFromArray(constantPool, attrs) : literalArr(attrs); return [attrArray]; } }; } return null; } /** * Builds an instruction with all the expressions and parameters for `styling`. * * The instruction generation code below is used for producing the AOT statement code which is * responsible for registering style/class bindings to an element. */ }, { key: "buildStylingInstruction", value: function buildStylingInstruction(sourceSpan, constantPool) { if (this.hasBindings) { return { sourceSpan: sourceSpan, allocateBindingSlots: 0, reference: Identifiers$1.styling, params: function params() { return []; } }; } return null; } /** * Builds an instruction with all the expressions and parameters for `classMap`. * * The instruction data will contain all expressions for `classMap` to function * which includes the `[class]` expression params. */ }, { key: "buildClassMapInstruction", value: function buildClassMapInstruction(valueConverter) { if (this._classMapInput) { return this._buildMapBasedInstruction(valueConverter, true, this._classMapInput); } return null; } /** * Builds an instruction with all the expressions and parameters for `styleMap`. * * The instruction data will contain all expressions for `styleMap` to function * which includes the `[style]` expression params. */ }, { key: "buildStyleMapInstruction", value: function buildStyleMapInstruction(valueConverter) { if (this._styleMapInput) { return this._buildMapBasedInstruction(valueConverter, false, this._styleMapInput); } return null; } }, { key: "_buildMapBasedInstruction", value: function _buildMapBasedInstruction(valueConverter, isClassBased, stylingInput) { // each styling binding value is stored in the LView var totalBindingSlotsRequired = 1; // these values must be outside of the update block so that they can // be evaluated (the AST visit call) during creation time so that any // pipes can be picked up in time before the template is built var mapValue = stylingInput.value.visit(valueConverter); var reference; if (mapValue instanceof Interpolation && isClassBased) { totalBindingSlotsRequired += mapValue.expressions.length; reference = getClassMapInterpolationExpression(mapValue); } else { reference = isClassBased ? Identifiers$1.classMap : Identifiers$1.styleMap; } return { sourceSpan: stylingInput.sourceSpan, reference: reference, allocateBindingSlots: totalBindingSlotsRequired, supportsInterpolation: isClassBased, params: function params(convertFn) { var convertResult = convertFn(mapValue); return Array.isArray(convertResult) ? convertResult : [convertResult]; } }; } }, { key: "_buildSingleInputs", value: function _buildSingleInputs(reference, inputs, mapIndex, allowUnits, valueConverter, getInterpolationExpressionFn) { var totalBindingSlotsRequired = 0; return inputs.map(function (input) { var value = input.value.visit(valueConverter); // each styling binding value is stored in the LView var totalBindingSlotsRequired = 1; if (value instanceof Interpolation) { totalBindingSlotsRequired += value.expressions.length; if (getInterpolationExpressionFn) { reference = getInterpolationExpressionFn(value); } } return { sourceSpan: input.sourceSpan, supportsInterpolation: !!getInterpolationExpressionFn, allocateBindingSlots: totalBindingSlotsRequired, reference: reference, params: function params(convertFn) { // params => stylingProp(propName, value) var params = []; params.push(literal(input.name)); var convertResult = convertFn(value); if (Array.isArray(convertResult)) { params.push.apply(params, _toConsumableArray(convertResult)); } else { params.push(convertResult); } if (allowUnits && input.unit) { params.push(literal(input.unit)); } return params; } }; }); } }, { key: "_buildClassInputs", value: function _buildClassInputs(valueConverter) { if (this._singleClassInputs) { return this._buildSingleInputs(Identifiers$1.classProp, this._singleClassInputs, this._classesIndex, false, valueConverter); } return []; } }, { key: "_buildStyleInputs", value: function _buildStyleInputs(valueConverter) { if (this._singleStyleInputs) { return this._buildSingleInputs(Identifiers$1.styleProp, this._singleStyleInputs, this._stylesIndex, true, valueConverter, getStylePropInterpolationExpression); } return []; } }, { key: "_buildApplyFn", value: function _buildApplyFn() { return { sourceSpan: this._lastStylingInput ? this._lastStylingInput.sourceSpan : null, reference: Identifiers$1.stylingApply, allocateBindingSlots: 0, params: function params() { return []; } }; } }, { key: "_buildSanitizerFn", value: function _buildSanitizerFn() { return { sourceSpan: this._firstStylingInput ? this._firstStylingInput.sourceSpan : null, reference: Identifiers$1.styleSanitizer, allocateBindingSlots: 0, params: function params() { return [importExpr(Identifiers$1.defaultStyleSanitizer)]; } }; } /** * Constructs all instructions which contain the expressions that will be placed * into the update block of a template function or a directive hostBindings function. */ }, { key: "buildUpdateLevelInstructions", value: function buildUpdateLevelInstructions(valueConverter) { var instructions = []; if (this.hasBindings) { if (this._useDefaultSanitizer) { instructions.push(this._buildSanitizerFn()); } var styleMapInstruction = this.buildStyleMapInstruction(valueConverter); if (styleMapInstruction) { instructions.push(styleMapInstruction); } var classMapInstruction = this.buildClassMapInstruction(valueConverter); if (classMapInstruction) { instructions.push(classMapInstruction); } instructions.push.apply(instructions, _toConsumableArray(this._buildStyleInputs(valueConverter))); instructions.push.apply(instructions, _toConsumableArray(this._buildClassInputs(valueConverter))); instructions.push(this._buildApplyFn()); } return instructions; } }]); return StylingBuilder; }(); function registerIntoMap(map, key) { if (!map.has(key)) { map.set(key, map.size); } } function isStyleSanitizable(prop) { // Note that browsers support both the dash case and // camel case property names when setting through JS. return prop === 'background-image' || prop === 'backgroundImage' || prop === 'background' || prop === 'border-image' || prop === 'borderImage' || prop === 'filter' || prop === 'list-style' || prop === 'listStyle' || prop === 'list-style-image' || prop === 'listStyleImage' || prop === 'clip-path' || prop === 'clipPath'; } /** * Simple helper function to either provide the constant literal that will house the value * here or a null value if the provided values are empty. */ function getConstantLiteralFromArray(constantPool, values) { return values.length ? constantPool.getConstLiteral(literalArr(values), true) : NULL_EXPR; } /** * Simple helper function that adds a parameter or does nothing at all depending on the provided * predicate and totalExpectedArgs values */ function addParam(params, predicate, value, argNumber, totalExpectedArgs) { if (predicate && value) { params.push(value); } else if (argNumber < totalExpectedArgs) { params.push(NULL_EXPR); } } function parseProperty(name) { var hasOverrideFlag = false; var overrideIndex = name.indexOf(IMPORTANT_FLAG); if (overrideIndex !== -1) { name = overrideIndex > 0 ? name.substring(0, overrideIndex) : ''; hasOverrideFlag = true; } var unit = ''; var property = name; var unitIndex = name.lastIndexOf('.'); if (unitIndex > 0) { unit = name.substr(unitIndex + 1); property = name.substring(0, unitIndex); } return { property: property, unit: unit, hasOverrideFlag: hasOverrideFlag }; } /** * Gets the instruction to generate for an interpolated class map. * @param interpolation An Interpolation AST */ function getClassMapInterpolationExpression(interpolation) { switch (getInterpolationArgsLength(interpolation)) { case 1: return Identifiers$1.classMap; case 3: return Identifiers$1.classMapInterpolate1; case 5: return Identifiers$1.classMapInterpolate2; case 7: return Identifiers$1.classMapInterpolate3; case 9: return Identifiers$1.classMapInterpolate4; case 11: return Identifiers$1.classMapInterpolate5; case 13: return Identifiers$1.classMapInterpolate6; case 15: return Identifiers$1.classMapInterpolate7; case 17: return Identifiers$1.classMapInterpolate8; default: return Identifiers$1.classMapInterpolateV; } } /** * Gets the instruction to generate for an interpolated style prop. * @param interpolation An Interpolation AST */ function getStylePropInterpolationExpression(interpolation) { switch (getInterpolationArgsLength(interpolation)) { case 1: return Identifiers$1.styleProp; case 3: return Identifiers$1.stylePropInterpolate1; case 5: return Identifiers$1.stylePropInterpolate2; case 7: return Identifiers$1.stylePropInterpolate3; case 9: return Identifiers$1.stylePropInterpolate4; case 11: return Identifiers$1.stylePropInterpolate5; case 13: return Identifiers$1.stylePropInterpolate6; case 15: return Identifiers$1.stylePropInterpolate7; case 17: return Identifiers$1.stylePropInterpolate8; default: return Identifiers$1.stylePropInterpolateV; } } function normalizePropName(prop) { return hyphenate(prop); } /** * @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; (function (TokenType) { TokenType[TokenType["Character"] = 0] = "Character"; TokenType[TokenType["Identifier"] = 1] = "Identifier"; TokenType[TokenType["Keyword"] = 2] = "Keyword"; TokenType[TokenType["String"] = 3] = "String"; TokenType[TokenType["Operator"] = 4] = "Operator"; TokenType[TokenType["Number"] = 5] = "Number"; TokenType[TokenType["Error"] = 6] = "Error"; })(TokenType$1 || (TokenType$1 = {})); var KEYWORDS = ['var', 'let', 'as', 'null', 'undefined', 'true', 'false', 'if', 'else', 'this']; var Lexer = /*#__PURE__*/function () { function Lexer() { _classCallCheck(this, Lexer); } _createClass2(Lexer, [{ key: "tokenize", value: function tokenize(text) { var scanner = new _Scanner(text); var tokens = []; var token = scanner.scanToken(); while (token != null) { tokens.push(token); token = scanner.scanToken(); } return tokens; } }]); return Lexer; }(); var Token$1 = /*#__PURE__*/function () { function Token$1(index, type, numValue, strValue) { _classCallCheck(this, Token$1); this.index = index; this.type = type; this.numValue = numValue; this.strValue = strValue; } _createClass2(Token$1, [{ key: "isCharacter", value: function isCharacter(code) { return this.type == TokenType$1.Character && this.numValue == code; } }, { key: "isNumber", value: function isNumber() { return this.type == TokenType$1.Number; } }, { key: "isString", value: function isString() { return this.type == TokenType$1.String; } }, { key: "isOperator", value: function isOperator(operator) { return this.type == TokenType$1.Operator && this.strValue == operator; } }, { key: "isIdentifier", value: function isIdentifier() { return this.type == TokenType$1.Identifier; } }, { key: "isKeyword", value: function isKeyword() { return this.type == TokenType$1.Keyword; } }, { key: "isKeywordLet", value: function isKeywordLet() { return this.type == TokenType$1.Keyword && this.strValue == 'let'; } }, { key: "isKeywordAs", value: function isKeywordAs() { return this.type == TokenType$1.Keyword && this.strValue == 'as'; } }, { key: "isKeywordNull", value: function isKeywordNull() { return this.type == TokenType$1.Keyword && this.strValue == 'null'; } }, { key: "isKeywordUndefined", value: function isKeywordUndefined() { return this.type == TokenType$1.Keyword && this.strValue == 'undefined'; } }, { key: "isKeywordTrue", value: function isKeywordTrue() { return this.type == TokenType$1.Keyword && this.strValue == 'true'; } }, { key: "isKeywordFalse", value: function isKeywordFalse() { return this.type == TokenType$1.Keyword && this.strValue == 'false'; } }, { key: "isKeywordThis", value: function isKeywordThis() { return this.type == TokenType$1.Keyword && this.strValue == 'this'; } }, { key: "isError", value: function isError() { return this.type == TokenType$1.Error; } }, { key: "toNumber", value: function toNumber() { return this.type == TokenType$1.Number ? this.numValue : -1; } }, { key: "toString", value: function toString() { switch (this.type) { case TokenType$1.Character: case TokenType$1.Identifier: case TokenType$1.Keyword: case TokenType$1.Operator: case TokenType$1.String: case TokenType$1.Error: return this.strValue; case TokenType$1.Number: return this.numValue.toString(); default: return null; } } }]); return Token$1; }(); function newCharacterToken(index, code) { return new Token$1(index, TokenType$1.Character, code, String.fromCharCode(code)); } function newIdentifierToken(index, text) { return new Token$1(index, TokenType$1.Identifier, 0, text); } function newKeywordToken(index, text) { return new Token$1(index, TokenType$1.Keyword, 0, text); } function newOperatorToken(index, text) { return new Token$1(index, TokenType$1.Operator, 0, text); } function newStringToken(index, text) { return new Token$1(index, TokenType$1.String, 0, text); } function newNumberToken(index, n) { return new Token$1(index, TokenType$1.Number, n, ''); } function newErrorToken(index, message) { return new Token$1(index, TokenType$1.Error, 0, message); } var EOF = new Token$1(-1, TokenType$1.Character, 0, ''); var _Scanner = /*#__PURE__*/function () { function _Scanner(input) { _classCallCheck(this, _Scanner); this.input = input; this.peek = 0; this.index = -1; this.length = input.length; this.advance(); } _createClass2(_Scanner, [{ key: "advance", value: function advance() { this.peek = ++this.index >= this.length ? $EOF : this.input.charCodeAt(this.index); } }, { key: "scanToken", value: function scanToken() { var input = this.input, length = this.length; var peek = this.peek, 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 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 [".concat(String.fromCharCode(peek), "]"), 0); } }, { key: "scanCharacter", value: function scanCharacter(start, code) { this.advance(); return newCharacterToken(start, code); } }, { key: "scanOperator", value: function scanOperator(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) */ }, { key: "scanComplexOperator", value: function scanComplexOperator(start, one, twoCode, two, threeCode, three) { this.advance(); var str = one; if (this.peek == twoCode) { this.advance(); str += two; } if (threeCode != null && this.peek == threeCode) { this.advance(); str += three; } return newOperatorToken(start, str); } }, { key: "scanIdentifier", value: function scanIdentifier() { var start = this.index; this.advance(); while (isIdentifierPart(this.peek)) { this.advance(); } var str = this.input.substring(start, this.index); return KEYWORDS.indexOf(str) > -1 ? newKeywordToken(start, str) : newIdentifierToken(start, str); } }, { key: "scanNumber", value: function scanNumber(start) { var simple = this.index === start; this.advance(); // Skip initial digit. while (true) { if (isDigit(this.peek)) {// Do nothing. } 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 str = this.input.substring(start, this.index); var value = simple ? parseIntAutoRadix(str) : parseFloat(str); return newNumberToken(start, value); } }, { key: "scanString", value: function scanString() { var start = this.index; var quote = this.peek; this.advance(); // Skip initial quote. var buffer = ''; var marker = this.index; var input = this.input; while (this.peek != quote) { if (this.peek == $BACKSLASH) { buffer += input.substring(marker, this.index); this.advance(); var 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 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".concat(hex, "]"), 0); } for (var 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 last = input.substring(marker, this.index); this.advance(); // Skip terminating quote. return newStringToken(start, buffer + last); } }, { key: "error", value: function error(message, offset) { var position = this.index + offset; return newErrorToken(position, "Lexer Error: ".concat(message, " at column ").concat(position, " in expression [").concat(this.input, "]")); } }]); return _Scanner; }(); function isIdentifierStart(code) { return $a <= code && code <= $z || $A <= code && code <= $Z || code == $_ || code == $$; } function isIdentifier(input) { if (input.length == 0) return false; var 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; } function isIdentifierPart(code) { return isAsciiLetter(code) || isDigit(code) || code == $_ || code == $$; } function isExponentStart(code) { return code == $e || code == $E; } function isExponentSign(code) { return code == $MINUS || code == $PLUS; } function isQuote(code) { return code === $SQ || code === $DQ || code === $BT; } 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; } } function parseIntAutoRadix(text) { var 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 SplitInterpolation(strings, expressions, offsets) { _classCallCheck(this, SplitInterpolation); this.strings = strings; this.expressions = expressions; this.offsets = offsets; }; var TemplateBindingParseResult = function TemplateBindingParseResult(templateBindings, warnings, errors) { _classCallCheck(this, TemplateBindingParseResult); this.templateBindings = templateBindings; this.warnings = warnings; this.errors = errors; }; function _createInterpolateRegExp(config) { var pattern = escapeRegExp(config.start) + '([\\s\\S]*?)' + escapeRegExp(config.end); return new RegExp(pattern, 'g'); } var Parser$1 = /*#__PURE__*/function () { function Parser$1(_lexer) { _classCallCheck(this, Parser$1); this._lexer = _lexer; this.errors = []; } _createClass2(Parser$1, [{ key: "parseAction", value: function parseAction(input, location, absoluteOffset) { var interpolationConfig = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_INTERPOLATION_CONFIG; this._checkNoInterpolation(input, location, interpolationConfig); var sourceToLex = this._stripComments(input); var tokens = this._lexer.tokenize(this._stripComments(input)); var ast = new _ParseAST(input, location, absoluteOffset, tokens, sourceToLex.length, true, this.errors, input.length - sourceToLex.length).parseChain(); return new ASTWithSource(ast, input, location, absoluteOffset, this.errors); } }, { key: "parseBinding", value: function parseBinding(input, location, absoluteOffset) { var interpolationConfig = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_INTERPOLATION_CONFIG; var ast = this._parseBindingAst(input, location, absoluteOffset, interpolationConfig); return new ASTWithSource(ast, input, location, absoluteOffset, this.errors); } }, { key: "parseSimpleBinding", value: function parseSimpleBinding(input, location, absoluteOffset) { var interpolationConfig = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_INTERPOLATION_CONFIG; var ast = this._parseBindingAst(input, location, absoluteOffset, interpolationConfig); var errors = SimpleExpressionChecker.check(ast); if (errors.length > 0) { this._reportError("Host binding expression cannot contain ".concat(errors.join(' ')), input, location); } return new ASTWithSource(ast, input, location, absoluteOffset, this.errors); } }, { key: "_reportError", value: function _reportError(message, input, errLocation, ctxLocation) { this.errors.push(new ParserError(message, input, errLocation, ctxLocation)); } }, { key: "_parseBindingAst", value: function _parseBindingAst(input, location, absoluteOffset, 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 quote = this._parseQuote(input, location); if (quote != null) { return quote; } this._checkNoInterpolation(input, location, interpolationConfig); var sourceToLex = this._stripComments(input); var tokens = this._lexer.tokenize(sourceToLex); return new _ParseAST(input, location, absoluteOffset, tokens, sourceToLex.length, false, this.errors, input.length - sourceToLex.length).parseChain(); } }, { key: "_parseQuote", value: function _parseQuote(input, location) { if (input == null) return null; var prefixSeparatorIndex = input.indexOf(':'); if (prefixSeparatorIndex == -1) return null; var prefix = input.substring(0, prefixSeparatorIndex).trim(); if (!isIdentifier(prefix)) return null; var uninterpretedExpression = input.substring(prefixSeparatorIndex + 1); return new Quote(new ParseSpan(0, input.length), prefix, uninterpretedExpression, location); } }, { key: "parseTemplateBindings", value: function parseTemplateBindings(tplKey, tplValue, location, absoluteOffset) { var tokens = this._lexer.tokenize(tplValue); return new _ParseAST(tplValue, location, absoluteOffset, tokens, tplValue.length, false, this.errors, 0).parseTemplateBindings(tplKey); } }, { key: "parseInterpolation", value: function parseInterpolation(input, location, absoluteOffset) { var interpolationConfig = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_INTERPOLATION_CONFIG; var split = this.splitInterpolation(input, location, interpolationConfig); if (split == null) return null; var expressions = []; for (var i = 0; i < split.expressions.length; ++i) { var expressionText = split.expressions[i]; var sourceToLex = this._stripComments(expressionText); var tokens = this._lexer.tokenize(sourceToLex); var ast = new _ParseAST(input, location, absoluteOffset, 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, absoluteOffset, this.errors); } }, { key: "splitInterpolation", value: function splitInterpolation(input, location) { var interpolationConfig = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_INTERPOLATION_CONFIG; var regexp = _createInterpolateRegExp(interpolationConfig); var parts = input.split(regexp); if (parts.length <= 1) { return null; } var strings = []; var expressions = []; var offsets = []; var offset = 0; for (var i = 0; i < parts.length; i++) { var 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 ".concat(this._findInterpolationErrorColumn(parts, i, interpolationConfig), " in"), location); expressions.push('$implict'); offsets.push(offset); } } return new SplitInterpolation(strings, expressions, offsets); } }, { key: "wrapLiteralPrimitive", value: function wrapLiteralPrimitive(input, location, absoluteOffset) { return new ASTWithSource(new LiteralPrimitive(new ParseSpan(0, input == null ? 0 : input.length), input), input, location, absoluteOffset, this.errors); } }, { key: "_stripComments", value: function _stripComments(input) { var i = this._commentStart(input); return i != null ? input.substring(0, i).trim() : input; } }, { key: "_commentStart", value: function _commentStart(input) { var outerQuote = null; for (var i = 0; i < input.length - 1; i++) { var _char6 = input.charCodeAt(i); var nextChar = input.charCodeAt(i + 1); if (_char6 === $SLASH && nextChar == $SLASH && outerQuote == null) return i; if (outerQuote === _char6) { outerQuote = null; } else if (outerQuote == null && isQuote(_char6)) { outerQuote = _char6; } } return null; } }, { key: "_checkNoInterpolation", value: function _checkNoInterpolation(input, location, interpolationConfig) { var regexp = _createInterpolateRegExp(interpolationConfig); var parts = input.split(regexp); if (parts.length > 1) { this._reportError("Got interpolation (".concat(interpolationConfig.start).concat(interpolationConfig.end, ") where expression was expected"), input, "at column ".concat(this._findInterpolationErrorColumn(parts, 1, interpolationConfig), " in"), location); } } }, { key: "_findInterpolationErrorColumn", value: function _findInterpolationErrorColumn(parts, partInErrIdx, interpolationConfig) { var errLocation = ''; for (var j = 0; j < partInErrIdx; j++) { errLocation += j % 2 === 0 ? parts[j] : "".concat(interpolationConfig.start).concat(parts[j]).concat(interpolationConfig.end); } return errLocation.length; } }]); return Parser$1; }(); var _ParseAST = /*#__PURE__*/function () { function _ParseAST(input, location, absoluteOffset, tokens, inputLength, parseAction, errors, offset) { _classCallCheck(this, _ParseAST); this.input = input; this.location = location; this.absoluteOffset = absoluteOffset; 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; } _createClass2(_ParseAST, [{ key: "peek", value: function peek(offset) { var i = this.index + offset; return i < this.tokens.length ? this.tokens[i] : EOF; } }, { key: "span", value: function span(start) { return new ParseSpan(start, this.inputIndex); } }, { key: "advance", value: function advance() { this.index++; } }, { key: "optionalCharacter", value: function optionalCharacter(code) { if (this.next.isCharacter(code)) { this.advance(); return true; } else { return false; } } }, { key: "peekKeywordLet", value: function peekKeywordLet() { return this.next.isKeywordLet(); } }, { key: "peekKeywordAs", value: function peekKeywordAs() { return this.next.isKeywordAs(); } }, { key: "expectCharacter", value: function expectCharacter(code) { if (this.optionalCharacter(code)) return; this.error("Missing expected ".concat(String.fromCharCode(code))); } }, { key: "optionalOperator", value: function optionalOperator(op) { if (this.next.isOperator(op)) { this.advance(); return true; } else { return false; } } }, { key: "expectOperator", value: function expectOperator(operator) { if (this.optionalOperator(operator)) return; this.error("Missing expected operator ".concat(operator)); } }, { key: "expectIdentifierOrKeyword", value: function expectIdentifierOrKeyword() { var n = this.next; if (!n.isIdentifier() && !n.isKeyword()) { this.error("Unexpected token ".concat(n, ", expected identifier or keyword")); return ''; } this.advance(); return n.toString(); } }, { key: "expectIdentifierOrKeywordOrString", value: function expectIdentifierOrKeywordOrString() { var n = this.next; if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) { this.error("Unexpected token ".concat(n, ", expected identifier, keyword, or string")); return ''; } this.advance(); return n.toString(); } }, { key: "parseChain", value: function parseChain() { var exprs = []; var start = this.inputIndex; while (this.index < this.tokens.length) { var 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 '".concat(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); } }, { key: "parsePipe", value: function parsePipe() { var result = this.parseExpression(); if (this.optionalOperator('|')) { if (this.parseAction) { this.error('Cannot have a pipe in an action expression'); } do { var name = this.expectIdentifierOrKeyword(); var 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; } }, { key: "parseExpression", value: function parseExpression() { return this.parseConditional(); } }, { key: "parseConditional", value: function parseConditional() { var start = this.inputIndex; var result = this.parseLogicalOr(); if (this.optionalOperator('?')) { var yes = this.parsePipe(); var no; if (!this.optionalCharacter($COLON)) { var end = this.inputIndex; var expression = this.input.substring(start, end); this.error("Conditional expression ".concat(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; } } }, { key: "parseLogicalOr", value: function parseLogicalOr() { // '||' var result = this.parseLogicalAnd(); while (this.optionalOperator('||')) { var right = this.parseLogicalAnd(); result = new Binary(this.span(result.span.start), '||', result, right); } return result; } }, { key: "parseLogicalAnd", value: function parseLogicalAnd() { // '&&' var result = this.parseEquality(); while (this.optionalOperator('&&')) { var right = this.parseEquality(); result = new Binary(this.span(result.span.start), '&&', result, right); } return result; } }, { key: "parseEquality", value: function parseEquality() { // '==','!=','===','!==' var result = this.parseRelational(); while (this.next.type == TokenType$1.Operator) { var operator = this.next.strValue; switch (operator) { case '==': case '===': case '!=': case '!==': this.advance(); var right = this.parseRelational(); result = new Binary(this.span(result.span.start), operator, result, right); continue; } break; } return result; } }, { key: "parseRelational", value: function parseRelational() { // '<', '>', '<=', '>=' var result = this.parseAdditive(); while (this.next.type == TokenType$1.Operator) { var operator = this.next.strValue; switch (operator) { case '<': case '>': case '<=': case '>=': this.advance(); var right = this.parseAdditive(); result = new Binary(this.span(result.span.start), operator, result, right); continue; } break; } return result; } }, { key: "parseAdditive", value: function parseAdditive() { // '+', '-' var result = this.parseMultiplicative(); while (this.next.type == TokenType$1.Operator) { var operator = this.next.strValue; switch (operator) { case '+': case '-': this.advance(); var right = this.parseMultiplicative(); result = new Binary(this.span(result.span.start), operator, result, right); continue; } break; } return result; } }, { key: "parseMultiplicative", value: function parseMultiplicative() { // '*', '%', '/' var result = this.parsePrefix(); while (this.next.type == TokenType$1.Operator) { var operator = this.next.strValue; switch (operator) { case '*': case '%': case '/': this.advance(); var right = this.parsePrefix(); result = new Binary(this.span(result.span.start), operator, result, right); continue; } break; } return result; } }, { key: "parsePrefix", value: function parsePrefix() { if (this.next.type == TokenType$1.Operator) { var start = this.inputIndex; var operator = this.next.strValue; var result; switch (operator) { case '+': this.advance(); result = this.parsePrefix(); return new Binary(this.span(start), '-', result, new LiteralPrimitive(new ParseSpan(start, start), 0)); 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(); } }, { key: "parseCallChain", value: function parseCallChain() { var 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 key = this.parsePipe(); this.rbracketsExpected--; this.expectCharacter($RBRACKET); if (this.optionalOperator('=')) { var 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 args = this.parseCallArguments(); this.rparensExpected--; this.expectCharacter($RPAREN); result = new FunctionCall(this.span(result.span.start), result, args); } else if (this.optionalOperator('!')) { result = new NonNullAssert(this.span(result.span.start), result); } else { return result; } } } }, { key: "parsePrimary", value: function parsePrimary() { var start = this.inputIndex; if (this.optionalCharacter($LPAREN)) { this.rparensExpected++; var 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 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 value = this.next.toNumber(); this.advance(); return new LiteralPrimitive(this.span(start), value); } else if (this.next.isString()) { var 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: ".concat(this.input)); return new EmptyExpr(this.span(start)); } else { this.error("Unexpected token ".concat(this.next)); return new EmptyExpr(this.span(start)); } } }, { key: "parseExpressionList", value: function parseExpressionList(terminator) { var result = []; if (!this.next.isCharacter(terminator)) { do { result.push(this.parsePipe()); } while (this.optionalCharacter($COMMA)); } return result; } }, { key: "parseLiteralMap", value: function parseLiteralMap() { var keys = []; var values = []; var start = this.inputIndex; this.expectCharacter($LBRACE); if (!this.optionalCharacter($RBRACE)) { this.rbracesExpected++; do { var quoted = this.next.isString(); var key = this.expectIdentifierOrKeywordOrString(); keys.push({ key: key, quoted: quoted }); this.expectCharacter($COLON); values.push(this.parsePipe()); } while (this.optionalCharacter($COMMA)); this.rbracesExpected--; this.expectCharacter($RBRACE); } return new LiteralMap(this.span(start), keys, values); } }, { key: "parseAccessMemberOrMethodCall", value: function parseAccessMemberOrMethodCall(receiver) { var isSafe = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var start = receiver.span.start; var id = this.expectIdentifierOrKeyword(); if (this.optionalCharacter($LPAREN)) { this.rparensExpected++; var args = this.parseCallArguments(); this.expectCharacter($RPAREN); this.rparensExpected--; var 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 value = this.parseConditional(); return new PropertyWrite(this.span(start), receiver, id, value); } else { return new PropertyRead(this.span(start), receiver, id); } } } } }, { key: "parseCallArguments", value: function parseCallArguments() { if (this.next.isCharacter($RPAREN)) return []; var positionals = []; do { positionals.push(this.parsePipe()); } while (this.optionalCharacter($COMMA)); return positionals; } /** * An identifier, a keyword, a string with an optional `-` in between. */ }, { key: "expectTemplateBindingKey", value: function expectTemplateBindingKey() { var result = ''; var operatorFound = false; do { result += this.expectIdentifierOrKeywordOrString(); operatorFound = this.optionalOperator('-'); if (operatorFound) { result += '-'; } } while (operatorFound); return result.toString(); } // Parses the AST for `<some-tag *tplKey=AST>` }, { key: "parseTemplateBindings", value: function parseTemplateBindings(tplKey) { var firstBinding = true; var bindings = []; var warnings = []; do { var start = this.inputIndex; var rawKey = void 0; var key = void 0; var isVar = false; if (firstBinding) { rawKey = key = tplKey; firstBinding = false; } else { isVar = this.peekKeywordLet(); if (isVar) this.advance(); rawKey = this.expectTemplateBindingKey(); key = isVar ? rawKey : tplKey + rawKey[0].toUpperCase() + rawKey.substring(1); this.optionalCharacter($COLON); } var name = null; var expression = null; if (isVar) { if (this.optionalOperator('=')) { name = this.expectTemplateBindingKey(); } else { name = '\$implicit'; } } else if (this.peekKeywordAs()) { this.advance(); // consume `as` name = rawKey; key = this.expectTemplateBindingKey(); // read local var name isVar = true; } else if (this.next !== EOF && !this.peekKeywordLet()) { var _start = this.inputIndex; var ast = this.parsePipe(); var source = this.input.substring(_start - this.offset, this.inputIndex - this.offset); expression = new ASTWithSource(ast, source, this.location, this.absoluteOffset, this.errors); } bindings.push(new TemplateBinding(this.span(start), key, isVar, name, expression)); if (this.peekKeywordAs() && !isVar) { var letStart = this.inputIndex; this.advance(); // consume `as` var letName = this.expectTemplateBindingKey(); // read local var name bindings.push(new TemplateBinding(this.span(letStart), letName, true, key, null)); } if (!this.optionalCharacter($SEMICOLON)) { this.optionalCharacter($COMMA); } } while (this.index < this.tokens.length); return new TemplateBindingParseResult(bindings, warnings, this.errors); } }, { key: "error", value: function error(message) { var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; this.errors.push(new ParserError(message, this.input, this.locationText(index), this.location)); this.skip(); } }, { key: "locationText", value: function locationText() { var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; if (index == null) index = this.index; return index < this.tokens.length ? "at column ".concat(this.tokens[index].index + 1, " in") : "at the end of the expression"; } // Error recovery should skip tokens until it encounters a recovery point. skip() treats // the end of input and a ';' as unconditionally a recovery point. It also treats ')', // '}' and ']' as conditional recovery points if one of calling productions is expecting // one of these symbols. This allows skip() to recover from errors such as '(a.) + 1' allowing // more of the AST to be retained (it doesn't skip any tokens as the ')' is retained because // of the '(' begins an '(' <expr> ')' production). The recovery points of grouping symbols // must be conditional as they must be skipped if none of the calling productions are not // expecting the closing token else we will never make progress in the case of an // extraneous group closing symbol (such as a stray ')'). This is not the case for ';' because // parseChain() is always the root production and it expects a ';'. // If a production expects one of these token it increments the corresponding nesting count, // and then decrements it just prior to checking if the token is in the input. }, { key: "skip", value: function skip() { var 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(this.next.toString(), this.input, this.locationText(), this.location)); } this.advance(); n = this.next; } } }, { key: "next", get: function get() { return this.peek(0); } }, { key: "inputIndex", get: function get() { return this.index < this.tokens.length ? this.next.index + this.offset : this.inputLength + this.offset; } }]); return _ParseAST; }(); var SimpleExpressionChecker = /*#__PURE__*/function () { function SimpleExpressionChecker() { _classCallCheck(this, SimpleExpressionChecker); this.errors = []; } _createClass2(SimpleExpressionChecker, [{ key: "visitImplicitReceiver", value: function visitImplicitReceiver(ast, context) {} }, { key: "visitInterpolation", value: function visitInterpolation(ast, context) {} }, { key: "visitLiteralPrimitive", value: function visitLiteralPrimitive(ast, context) {} }, { key: "visitPropertyRead", value: function visitPropertyRead(ast, context) {} }, { key: "visitPropertyWrite", value: function visitPropertyWrite(ast, context) {} }, { key: "visitSafePropertyRead", value: function visitSafePropertyRead(ast, context) {} }, { key: "visitMethodCall", value: function visitMethodCall(ast, context) {} }, { key: "visitSafeMethodCall", value: function visitSafeMethodCall(ast, context) {} }, { key: "visitFunctionCall", value: function visitFunctionCall(ast, context) {} }, { key: "visitLiteralArray", value: function visitLiteralArray(ast, context) { this.visitAll(ast.expressions); } }, { key: "visitLiteralMap", value: function visitLiteralMap(ast, context) { this.visitAll(ast.values); } }, { key: "visitBinary", value: function visitBinary(ast, context) {} }, { key: "visitPrefixNot", value: function visitPrefixNot(ast, context) {} }, { key: "visitNonNullAssert", value: function visitNonNullAssert(ast, context) {} }, { key: "visitConditional", value: function visitConditional(ast, context) {} }, { key: "visitPipe", value: function visitPipe(ast, context) { this.errors.push('pipes'); } }, { key: "visitKeyedRead", value: function visitKeyedRead(ast, context) {} }, { key: "visitKeyedWrite", value: function visitKeyedWrite(ast, context) {} }, { key: "visitAll", value: function visitAll(asts) { var _this175 = this; return asts.map(function (node) { return node.visit(_this175); }); } }, { key: "visitChain", value: function visitChain(ast, context) {} }, { key: "visitQuote", value: function visitQuote(ast, context) {} }], [{ key: "check", value: function check(ast) { var s = new SimpleExpressionChecker(); ast.visit(s); return s.errors; } }]); 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 */ // ================================================================================================= // ================================================================================================= // =========== S T O P - S T O P - S T O P - S T O P - S T O P - S T O P =========== // ================================================================================================= // ================================================================================================= // // DO NOT EDIT THIS LIST OF SECURITY SENSITIVE PROPERTIES WITHOUT A SECURITY REVIEW! // Reach out to mprobst for details. // // ================================================================================================= /** Map from tagName|propertyName SecurityContext. Properties applying to all tags use '*'. */ var _SECURITY_SCHEMA; function SECURITY_SCHEMA() { if (!_SECURITY_SCHEMA) { _SECURITY_SCHEMA = {}; // Case is insignificant below, all element and attribute names are lower-cased for lookup. registerContext(SecurityContext.HTML, ['iframe|srcdoc', '*|innerHTML', '*|outerHTML']); registerContext(SecurityContext.STYLE, ['*|style']); // NB: no SCRIPT contexts here, they are never allowed due to the parser stripping them. registerContext(SecurityContext.URL, ['*|formAction', 'area|href', 'area|ping', 'audio|src', 'a|href', 'a|ping', 'blockquote|cite', 'body|background', 'del|cite', 'form|action', 'img|src', 'img|srcset', 'input|src', 'ins|cite', 'q|cite', 'source|src', 'source|srcset', 'track|src', 'video|poster', 'video|src']); registerContext(SecurityContext.RESOURCE_URL, ['applet|code', 'applet|codebase', 'base|href', 'embed|src', 'frame|src', 'head|profile', 'html|manifest', 'iframe|src', 'link|href', 'media|src', 'object|codebase', 'object|data', 'script|src']); } return _SECURITY_SCHEMA; } function registerContext(ctx, specs) { var _iterator9 = _createForOfIteratorHelper(specs), _step9; try { for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) { var spec = _step9.value; _SECURITY_SCHEMA[spec.toLowerCase()] = ctx; } } catch (err) { _iterator9.e(err); } finally { _iterator9.f(); } } /** * @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 ElementSchemaRegistry = function ElementSchemaRegistry() { _classCallCheck(this, 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 BOOLEAN = 'boolean'; var NUMBER = 'number'; var STRING = 'string'; var OBJECT = 'object'; /** * This array represents the DOM schema. It encodes inheritance, properties, and events. * * ## Overview * * Each line represents one kind of element. The `element_inheritance` and properties are joined * using `element_inheritance|properties` syntax. * * ## Element Inheritance * * The `element_inheritance` can be further subdivided as `element1,element2,...^parentElement`. * Here the individual elements are separated by `,` (commas). Every element in the list * has identical properties. * * An `element` may inherit additional properties from `parentElement` If no `^parentElement` is * specified then `""` (blank) element is assumed. * * NOTE: The blank element inherits from root `[Element]` element, the super element of all * elements. * * NOTE an element prefix such as `:svg:` has no special meaning to the schema. * * ## Properties * * Each element has a set of properties separated by `,` (commas). Each property can be prefixed * by a special character designating its type: * * - (no prefix): property is a string. * - `*`: property represents an event. * - `!`: property is a boolean. * - `#`: property is a number. * - `%`: property is an object. * * ## Query * * The class creates an internal squas representation which allows to easily answer the query of * if a given property exist on a given element. * * NOTE: We don't yet support querying for types or events. * NOTE: This schema is auto extracted from `schema_extractor.ts` located in the test folder, * see dom_element_schema_registry_spec.ts */ // ================================================================================================= // ================================================================================================= // =========== S T O P - S T O P - S T O P - S T O P - S T O P - S T O P =========== // ================================================================================================= // ================================================================================================= // // DO NOT EDIT THIS DOM SCHEMA WITHOUT A SECURITY REVIEW! // // Newly added properties must be security reviewed and assigned an appropriate SecurityContext in // dom_security_schema.ts. Reach out to mprobst & rjamet for details. // // ================================================================================================= var SCHEMA = ['[Element]|textContent,%classList,className,id,innerHTML,*beforecopy,*beforecut,*beforepaste,*copy,*cut,*paste,*search,*selectstart,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerHTML,#scrollLeft,#scrollTop,slot' + /* added manually to avoid breaking changes */ ',*message,*mozfullscreenchange,*mozfullscreenerror,*mozpointerlockchange,*mozpointerlockerror,*webglcontextcreationerror,*webglcontextlost,*webglcontextrestored', '[HTMLElement]^[Element]|accessKey,contentEditable,dir,!draggable,!hidden,innerText,lang,*abort,*auxclick,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*cuechange,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*seeked,*seeking,*select,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,outerText,!spellcheck,%style,#tabIndex,title,!translate', 'abbr,address,article,aside,b,bdi,bdo,cite,code,dd,dfn,dt,em,figcaption,figure,footer,header,i,kbd,main,mark,nav,noscript,rb,rp,rt,rtc,ruby,s,samp,section,small,strong,sub,sup,u,var,wbr^[HTMLElement]|accessKey,contentEditable,dir,!draggable,!hidden,innerText,lang,*abort,*auxclick,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*cuechange,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*seeked,*seeking,*select,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,outerText,!spellcheck,%style,#tabIndex,title,!translate', 'media^[HTMLElement]|!autoplay,!controls,%controlsList,%crossOrigin,#currentTime,!defaultMuted,#defaultPlaybackRate,!disableRemotePlayback,!loop,!muted,*encrypted,*waitingforkey,#playbackRate,preload,src,%srcObject,#volume', ':svg:^[HTMLElement]|*abort,*auxclick,*blur,*cancel,*canplay,*canplaythrough,*change,*click,*close,*contextmenu,*cuechange,*dblclick,*drag,*dragend,*dragenter,*dragleave,*dragover,*dragstart,*drop,*durationchange,*emptied,*ended,*error,*focus,*gotpointercapture,*input,*invalid,*keydown,*keypress,*keyup,*load,*loadeddata,*loadedmetadata,*loadstart,*lostpointercapture,*mousedown,*mouseenter,*mouseleave,*mousemove,*mouseout,*mouseover,*mouseup,*mousewheel,*pause,*play,*playing,*pointercancel,*pointerdown,*pointerenter,*pointerleave,*pointermove,*pointerout,*pointerover,*pointerup,*progress,*ratechange,*reset,*resize,*scroll,*seeked,*seeking,*select,*show,*stalled,*submit,*suspend,*timeupdate,*toggle,*volumechange,*waiting,%style,#tabIndex', ':svg:graphics^:svg:|', ':svg:animation^:svg:|*begin,*end,*repeat', ':svg:geometry^:svg:|', ':svg:componentTransferFunction^:svg:|', ':svg:gradient^:svg:|', ':svg:textContent^:svg:graphics|', ':svg:textPositioning^:svg:textContent|', 'a^[HTMLElement]|charset,coords,download,hash,host,hostname,href,hreflang,name,password,pathname,ping,port,protocol,referrerPolicy,rel,rev,search,shape,target,text,type,username', 'area^[HTMLElement]|alt,coords,download,hash,host,hostname,href,!noHref,password,pathname,ping,port,protocol,referrerPolicy,rel,search,shape,target,username', 'audio^media|', 'br^[HTMLElement]|clear', 'base^[HTMLElement]|href,target', 'body^[HTMLElement]|aLink,background,bgColor,link,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,text,vLink', 'button^[HTMLElement]|!autofocus,!disabled,formAction,formEnctype,formMethod,!formNoValidate,formTarget,name,type,value', 'canvas^[HTMLElement]|#height,#width', 'content^[HTMLElement]|select', 'dl^[HTMLElement]|!compact', 'datalist^[HTMLElement]|', 'details^[HTMLElement]|!open', 'dialog^[HTMLElement]|!open,returnValue', 'dir^[HTMLElement]|!compact', 'div^[HTMLElement]|align', 'embed^[HTMLElement]|align,height,name,src,type,width', 'fieldset^[HTMLElement]|!disabled,name', 'font^[HTMLElement]|color,face,size', 'form^[HTMLElement]|acceptCharset,action,autocomplete,encoding,enctype,method,name,!noValidate,target', 'frame^[HTMLElement]|frameBorder,longDesc,marginHeight,marginWidth,name,!noResize,scrolling,src', 'frameset^[HTMLElement]|cols,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,rows', 'hr^[HTMLElement]|align,color,!noShade,size,width', 'head^[HTMLElement]|', 'h1,h2,h3,h4,h5,h6^[HTMLElement]|align', 'html^[HTMLElement]|version', 'iframe^[HTMLElement]|align,!allowFullscreen,frameBorder,height,longDesc,marginHeight,marginWidth,name,referrerPolicy,%sandbox,scrolling,src,srcdoc,width', 'img^[HTMLElement]|align,alt,border,%crossOrigin,#height,#hspace,!isMap,longDesc,lowsrc,name,referrerPolicy,sizes,src,srcset,useMap,#vspace,#width', 'input^[HTMLElement]|accept,align,alt,autocapitalize,autocomplete,!autofocus,!checked,!defaultChecked,defaultValue,dirName,!disabled,%files,formAction,formEnctype,formMethod,!formNoValidate,formTarget,#height,!incremental,!indeterminate,max,#maxLength,min,#minLength,!multiple,name,pattern,placeholder,!readOnly,!required,selectionDirection,#selectionEnd,#selectionStart,#size,src,step,type,useMap,value,%valueAsDate,#valueAsNumber,#width', 'li^[HTMLElement]|type,#value', 'label^[HTMLElement]|htmlFor', 'legend^[HTMLElement]|align', 'link^[HTMLElement]|as,charset,%crossOrigin,!disabled,href,hreflang,integrity,media,referrerPolicy,rel,%relList,rev,%sizes,target,type', 'map^[HTMLElement]|name', 'marquee^[HTMLElement]|behavior,bgColor,direction,height,#hspace,#loop,#scrollAmount,#scrollDelay,!trueSpeed,#vspace,width', 'menu^[HTMLElement]|!compact', 'meta^[HTMLElement]|content,httpEquiv,name,scheme', 'meter^[HTMLElement]|#high,#low,#max,#min,#optimum,#value', 'ins,del^[HTMLElement]|cite,dateTime', 'ol^[HTMLElement]|!compact,!reversed,#start,type', 'object^[HTMLElement]|align,archive,border,code,codeBase,codeType,data,!declare,height,#hspace,name,standby,type,useMap,#vspace,width', 'optgroup^[HTMLElement]|!disabled,label', 'option^[HTMLElement]|!defaultSelected,!disabled,label,!selected,text,value', 'output^[HTMLElement]|defaultValue,%htmlFor,name,value', 'p^[HTMLElement]|align', 'param^[HTMLElement]|name,type,value,valueType', 'picture^[HTMLElement]|', 'pre^[HTMLElement]|#width', 'progress^[HTMLElement]|#max,#value', 'q,blockquote,cite^[HTMLElement]|', 'script^[HTMLElement]|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,src,text,type', 'select^[HTMLElement]|!autofocus,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value', 'shadow^[HTMLElement]|', 'slot^[HTMLElement]|name', 'source^[HTMLElement]|media,sizes,src,srcset,type', 'span^[HTMLElement]|', 'style^[HTMLElement]|!disabled,media,type', 'caption^[HTMLElement]|align', 'th,td^[HTMLElement]|abbr,align,axis,bgColor,ch,chOff,#colSpan,headers,height,!noWrap,#rowSpan,scope,vAlign,width', 'col,colgroup^[HTMLElement]|align,ch,chOff,#span,vAlign,width', 'table^[HTMLElement]|align,bgColor,border,%caption,cellPadding,cellSpacing,frame,rules,summary,%tFoot,%tHead,width', 'tr^[HTMLElement]|align,bgColor,ch,chOff,vAlign', 'tfoot,thead,tbody^[HTMLElement]|align,ch,chOff,vAlign', 'template^[HTMLElement]|', 'textarea^[HTMLElement]|autocapitalize,!autofocus,#cols,defaultValue,dirName,!disabled,#maxLength,#minLength,name,placeholder,!readOnly,!required,#rows,selectionDirection,#selectionEnd,#selectionStart,value,wrap', 'title^[HTMLElement]|text', 'track^[HTMLElement]|!default,kind,label,src,srclang', 'ul^[HTMLElement]|!compact,type', 'unknown^[HTMLElement]|', 'video^media|#height,poster,#width', ':svg:a^:svg:graphics|', ':svg:animate^:svg:animation|', ':svg:animateMotion^:svg:animation|', ':svg:animateTransform^:svg:animation|', ':svg:circle^:svg:geometry|', ':svg:clipPath^:svg:graphics|', ':svg:defs^:svg:graphics|', ':svg:desc^:svg:|', ':svg:discard^:svg:|', ':svg:ellipse^:svg:geometry|', ':svg:feBlend^:svg:|', ':svg:feColorMatrix^:svg:|', ':svg:feComponentTransfer^:svg:|', ':svg:feComposite^:svg:|', ':svg:feConvolveMatrix^:svg:|', ':svg:feDiffuseLighting^:svg:|', ':svg:feDisplacementMap^:svg:|', ':svg:feDistantLight^:svg:|', ':svg:feDropShadow^:svg:|', ':svg:feFlood^:svg:|', ':svg:feFuncA^:svg:componentTransferFunction|', ':svg:feFuncB^:svg:componentTransferFunction|', ':svg:feFuncG^:svg:componentTransferFunction|', ':svg:feFuncR^:svg:componentTransferFunction|', ':svg:feGaussianBlur^:svg:|', ':svg:feImage^:svg:|', ':svg:feMerge^:svg:|', ':svg:feMergeNode^:svg:|', ':svg:feMorphology^:svg:|', ':svg:feOffset^:svg:|', ':svg:fePointLight^:svg:|', ':svg:feSpecularLighting^:svg:|', ':svg:feSpotLight^:svg:|', ':svg:feTile^:svg:|', ':svg:feTurbulence^:svg:|', ':svg:filter^:svg:|', ':svg:foreignObject^:svg:graphics|', ':svg:g^:svg:graphics|', ':svg:image^:svg:graphics|', ':svg:line^:svg:geometry|', ':svg:linearGradient^:svg:gradient|', ':svg:mpath^:svg:|', ':svg:marker^:svg:|', ':svg:mask^:svg:|', ':svg:metadata^:svg:|', ':svg:path^:svg:geometry|', ':svg:pattern^:svg:|', ':svg:polygon^:svg:geometry|', ':svg:polyline^:svg:geometry|', ':svg:radialGradient^:svg:gradient|', ':svg:rect^:svg:geometry|', ':svg:svg^:svg:graphics|#currentScale,#zoomAndPan', ':svg:script^:svg:|type', ':svg:set^:svg:animation|', ':svg:stop^:svg:|', ':svg:style^:svg:|!disabled,media,title,type', ':svg:switch^:svg:graphics|', ':svg:symbol^:svg:|', ':svg:tspan^:svg:textPositioning|', ':svg:text^:svg:textPositioning|', ':svg:textPath^:svg:textContent|', ':svg:title^:svg:|', ':svg:use^:svg:graphics|', ':svg:view^:svg:|#zoomAndPan', 'data^[HTMLElement]|value', 'keygen^[HTMLElement]|!autofocus,challenge,!disabled,form,keytype,name', 'menuitem^[HTMLElement]|type,label,icon,!disabled,!checked,radiogroup,!default', 'summary^[HTMLElement]|', 'time^[HTMLElement]|dateTime', ':svg:cursor^:svg:|']; var _ATTR_TO_PROP = { 'class': 'className', 'for': 'htmlFor', 'formaction': 'formAction', 'innerHtml': 'innerHTML', 'readonly': 'readOnly', 'tabindex': 'tabIndex' }; var DomElementSchemaRegistry = /*#__PURE__*/function (_ElementSchemaRegistr) { _inherits(DomElementSchemaRegistry, _ElementSchemaRegistr); var _super92 = _createSuper(DomElementSchemaRegistry); function DomElementSchemaRegistry() { var _this176; _classCallCheck(this, DomElementSchemaRegistry); _this176 = _super92.call(this); _this176._schema = {}; SCHEMA.forEach(function (encodedType) { var type = {}; var _encodedType$split = encodedType.split('|'), _encodedType$split2 = _slicedToArray(_encodedType$split, 2), strType = _encodedType$split2[0], strProperties = _encodedType$split2[1]; var properties = strProperties.split(','); var _strType$split = strType.split('^'), _strType$split2 = _slicedToArray(_strType$split, 2), typeNames = _strType$split2[0], superName = _strType$split2[1]; typeNames.split(',').forEach(function (tag) { return _this176._schema[tag.toLowerCase()] = type; }); var superType = superName && _this176._schema[superName.toLowerCase()]; if (superType) { Object.keys(superType).forEach(function (prop) { type[prop] = superType[prop]; }); } properties.forEach(function (property) { if (property.length > 0) { switch (property[0]) { case '*': // We don't yet support events. // If ever allowing to bind to events, GO THROUGH A SECURITY REVIEW, allowing events // will // almost certainly introduce bad XSS vulnerabilities. // type[property.substring(1)] = EVENT; break; case '!': type[property.substring(1)] = BOOLEAN; break; case '#': type[property.substring(1)] = NUMBER; break; case '%': type[property.substring(1)] = OBJECT; break; default: type[property] = STRING; } } }); }); return _this176; } _createClass2(DomElementSchemaRegistry, [{ key: "hasProperty", value: function hasProperty(tagName, propName, schemaMetas) { if (schemaMetas.some(function (schema) { return schema.name === NO_ERRORS_SCHEMA.name; })) { return true; } if (tagName.indexOf('-') > -1) { if (isNgContainer(tagName) || isNgContent(tagName)) { return false; } if (schemaMetas.some(function (schema) { return schema.name === CUSTOM_ELEMENTS_SCHEMA.name; })) { // Can't tell now as we don't know which properties a custom element will get // once it is instantiated return true; } } var elementProperties = this._schema[tagName.toLowerCase()] || this._schema['unknown']; return !!elementProperties[propName]; } }, { key: "hasElement", value: function hasElement(tagName, schemaMetas) { if (schemaMetas.some(function (schema) { return schema.name === NO_ERRORS_SCHEMA.name; })) { return true; } if (tagName.indexOf('-') > -1) { if (isNgContainer(tagName) || isNgContent(tagName)) { return true; } if (schemaMetas.some(function (schema) { return schema.name === CUSTOM_ELEMENTS_SCHEMA.name; })) { // Allow any custom elements return true; } } return !!this._schema[tagName.toLowerCase()]; } /** * securityContext returns the security context for the given property on the given DOM tag. * * Tag and property name are statically known and cannot change at runtime, i.e. it is not * possible to bind a value into a changing attribute or tag name. * * The filtering is based on a list of allowed tags|attributes. All attributes in the schema * above are assumed to have the 'NONE' security context, i.e. that they are safe inert * string values. Only specific well known attack vectors are assigned their appropriate context. */ }, { key: "securityContext", value: function securityContext(tagName, propName, isAttribute) { if (isAttribute) { // NB: For security purposes, use the mapped property name, not the attribute name. propName = this.getMappedPropName(propName); } // Make sure comparisons are case insensitive, so that case differences between attribute and // property names do not have a security impact. tagName = tagName.toLowerCase(); propName = propName.toLowerCase(); var ctx = SECURITY_SCHEMA()[tagName + '|' + propName]; if (ctx) { return ctx; } ctx = SECURITY_SCHEMA()['*|' + propName]; return ctx ? ctx : SecurityContext.NONE; } }, { key: "getMappedPropName", value: function getMappedPropName(propName) { return _ATTR_TO_PROP[propName] || propName; } }, { key: "getDefaultComponentElementName", value: function getDefaultComponentElementName() { return 'ng-component'; } }, { key: "validateProperty", value: function validateProperty(name) { if (name.toLowerCase().startsWith('on')) { var msg = "Binding to event property '".concat(name, "' is disallowed for security reasons, ") + "please use (".concat(name.slice(2), ")=...") + "\nIf '".concat(name, "' is a directive input, make sure the directive is imported by the") + " current module."; return { error: true, msg: msg }; } else { return { error: false }; } } }, { key: "validateAttribute", value: function validateAttribute(name) { if (name.toLowerCase().startsWith('on')) { var msg = "Binding to event attribute '".concat(name, "' is disallowed for security reasons, ") + "please use (".concat(name.slice(2), ")=..."); return { error: true, msg: msg }; } else { return { error: false }; } } }, { key: "allKnownElementNames", value: function allKnownElementNames() { return Object.keys(this._schema); } }, { key: "normalizeAnimationStyleProperty", value: function normalizeAnimationStyleProperty(propName) { return dashCaseToCamelCase(propName); } }, { key: "normalizeAnimationStyleValue", value: function normalizeAnimationStyleValue(camelCaseProp, userProvidedProp, val) { var unit = ''; var strVal = val.toString().trim(); var errorMsg = null; if (_isPixelDimensionStyle(camelCaseProp) && val !== 0 && val !== '0') { if (typeof val === 'number') { unit = 'px'; } else { var valAndSuffixMatch = val.match(/^[+-]?[\d\.]+([a-z]*)$/); if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) { errorMsg = "Please provide a CSS unit value for ".concat(userProvidedProp, ":").concat(val); } } } return { error: errorMsg, value: strVal + unit }; } }]); return DomElementSchemaRegistry; }(ElementSchemaRegistry); function _isPixelDimensionStyle(prop) { switch (prop) { case 'width': case 'height': case 'minWidth': case 'minHeight': case 'maxWidth': case 'maxHeight': case 'left': case 'top': case 'bottom': case 'right': case 'fontSize': case 'outlineWidth': case 'outlineOffset': case 'paddingTop': case 'paddingLeft': case 'paddingBottom': case 'paddingRight': case 'marginTop': case 'marginLeft': case 'marginBottom': case 'marginRight': case 'borderRadius': case 'borderWidth': case 'borderTopWidth': case 'borderLeftWidth': case 'borderRightWidth': case 'borderBottomWidth': case 'textIndent': return true; default: return false; } } /** * @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$1 = /^(?:(?:(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/; // Group 1 = "bind-" var KW_BIND_IDX$1 = 1; // Group 2 = "let-" var KW_LET_IDX$1 = 2; // Group 3 = "ref-/#" var KW_REF_IDX$1 = 3; // Group 4 = "on-" var KW_ON_IDX$1 = 4; // Group 5 = "bindon-" var KW_BINDON_IDX$1 = 5; // Group 6 = "@" var KW_AT_IDX$1 = 6; // Group 7 = the identifier after "bind-", "let-", "ref-/#", "on-", "bindon-" or "@" var IDENT_KW_IDX$1 = 7; // Group 8 = identifier inside [()] var IDENT_BANANA_BOX_IDX$1 = 8; // Group 9 = identifier inside [] var IDENT_PROPERTY_IDX$1 = 9; // Group 10 = identifier inside () var IDENT_EVENT_IDX$1 = 10; var TEMPLATE_ATTR_PREFIX$1 = '*'; function htmlAstToRender3Ast(htmlNodes, bindingParser) { var transformer = new HtmlAstToIvyAst(bindingParser); var ivyNodes = visitAll$1(transformer, htmlNodes); // Errors might originate in either the binding parser or the html to ivy transformer var allErrors = bindingParser.errors.concat(transformer.errors); var errors = allErrors.filter(function (e) { return e.level === ParseErrorLevel.ERROR; }); if (errors.length > 0) { var errorString = errors.join('\n'); throw syntaxError("Template parse errors:\n".concat(errorString), errors); } return { nodes: ivyNodes, errors: allErrors, styleUrls: transformer.styleUrls, styles: transformer.styles }; } var HtmlAstToIvyAst = /*#__PURE__*/function () { function HtmlAstToIvyAst(bindingParser) { _classCallCheck(this, HtmlAstToIvyAst); this.bindingParser = bindingParser; this.errors = []; this.styles = []; this.styleUrls = []; } // HTML visitor _createClass2(HtmlAstToIvyAst, [{ key: "visitElement", value: function visitElement(element) { var _this177 = this; var preparsedElement = preparseElement(element); if (preparsedElement.type === PreparsedElementType.SCRIPT) { return null; } else if (preparsedElement.type === PreparsedElementType.STYLE) { var contents = textContents(element); if (contents !== null) { this.styles.push(contents); } return null; } else if (preparsedElement.type === PreparsedElementType.STYLESHEET && isStyleUrlResolvable(preparsedElement.hrefAttr)) { this.styleUrls.push(preparsedElement.hrefAttr); return null; } // Whether the element is a `<ng-template>` var isTemplateElement = isNgTemplate(element.name); var parsedProperties = []; var boundEvents = []; var variables = []; var references = []; var attributes = []; var i18nAttrsMeta = {}; var templateParsedProperties = []; var templateVariables = []; // Whether the element has any *-attribute var elementHasInlineTemplate = false; var _iterator10 = _createForOfIteratorHelper(element.attrs), _step10; try { for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) { var attribute = _step10.value; var hasBinding = false; var normalizedName = normalizeAttributeName(attribute.name); // `*attr` defines template bindings var isTemplateBinding = false; if (attribute.i18n) { i18nAttrsMeta[attribute.name] = attribute.i18n; } if (normalizedName.startsWith(TEMPLATE_ATTR_PREFIX$1)) { // *-attributes if (elementHasInlineTemplate) { this.reportError("Can't have multiple template bindings on one element. Use only one attribute prefixed with *", attribute.sourceSpan); } isTemplateBinding = true; elementHasInlineTemplate = true; var templateValue = attribute.value; var templateKey = normalizedName.substring(TEMPLATE_ATTR_PREFIX$1.length); var parsedVariables = []; var absoluteOffset = attribute.valueSpan ? attribute.valueSpan.start.offset : attribute.sourceSpan.start.offset; this.bindingParser.parseInlineTemplateBinding(templateKey, templateValue, attribute.sourceSpan, absoluteOffset, [], templateParsedProperties, parsedVariables); templateVariables.push.apply(templateVariables, _toConsumableArray(parsedVariables.map(function (v) { return new Variable(v.name, v.value, v.sourceSpan); }))); } else { // Check for variables, events, property bindings, interpolation hasBinding = this.parseAttribute(isTemplateElement, attribute, [], parsedProperties, boundEvents, variables, references); } if (!hasBinding && !isTemplateBinding) { // don't include the bindings as attributes as well in the AST attributes.push(this.visitAttribute(attribute)); } } } catch (err) { _iterator10.e(err); } finally { _iterator10.f(); } var children = visitAll$1(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR$1 : this, element.children); var parsedElement; if (preparsedElement.type === PreparsedElementType.NG_CONTENT) { // `<ng-content>` if (element.children && !element.children.every(function (node) { return isEmptyTextNode(node) || isCommentNode(node); })) { this.reportError("<ng-content> element cannot have content.", element.sourceSpan); } var selector = preparsedElement.selectAttr; var attrs = element.attrs.map(function (attr) { return _this177.visitAttribute(attr); }); parsedElement = new Content(selector, attrs, element.sourceSpan, element.i18n); } else if (isTemplateElement) { // `<ng-template>` var _attrs = this.extractAttributes(element.name, parsedProperties, i18nAttrsMeta); parsedElement = new Template(element.name, attributes, _attrs.bound, boundEvents, [ /* no template attributes */ ], children, references, variables, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n); } else { var _attrs2 = this.extractAttributes(element.name, parsedProperties, i18nAttrsMeta); parsedElement = new Element(element.name, attributes, _attrs2.bound, boundEvents, children, references, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n); } if (elementHasInlineTemplate) { // If this node is an inline-template (e.g. has *ngFor) then we need to create a template // node that contains this node. // Moreover, if the node is an element, then we need to hoist its attributes to the template // node for matching against content projection selectors. var _attrs3 = this.extractAttributes('ng-template', templateParsedProperties, i18nAttrsMeta); var templateAttrs = []; _attrs3.literal.forEach(function (attr) { return templateAttrs.push(attr); }); _attrs3.bound.forEach(function (attr) { return templateAttrs.push(attr); }); var hoistedAttrs = parsedElement instanceof Element ? { attributes: parsedElement.attributes, inputs: parsedElement.inputs, outputs: parsedElement.outputs } : { attributes: [], inputs: [], outputs: [] }; // TODO(pk): test for this case parsedElement = new Template(parsedElement.name, hoistedAttrs.attributes, hoistedAttrs.inputs, hoistedAttrs.outputs, templateAttrs, [parsedElement], [ /* no references */ ], templateVariables, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n); } return parsedElement; } }, { key: "visitAttribute", value: function visitAttribute(attribute) { return new TextAttribute(attribute.name, attribute.value, attribute.sourceSpan, attribute.valueSpan, attribute.i18n); } }, { key: "visitText", value: function visitText(text) { return this._visitTextWithInterpolation(text.value, text.sourceSpan, text.i18n); } }, { key: "visitExpansion", value: function visitExpansion(expansion) { var _this178 = this; var meta = expansion.i18n; // do not generate Icu in case it was created // outside of i18n block in a template if (!meta) { return null; } var vars = {}; var placeholders = {}; // extract VARs from ICUs - we process them separately while // assembling resulting message via goog.getMsg function, since // we need to pass them to top-level goog.getMsg call Object.keys(meta.placeholders).forEach(function (key) { var value = meta.placeholders[key]; if (key.startsWith(I18N_ICU_VAR_PREFIX)) { var config = _this178.bindingParser.interpolationConfig; // ICU expression is a plain string, not wrapped into start // and end tags, so we wrap it before passing to binding parser var wrapped = "".concat(config.start).concat(value).concat(config.end); vars[key] = _this178._visitTextWithInterpolation(wrapped, expansion.sourceSpan); } else { placeholders[key] = _this178._visitTextWithInterpolation(value, expansion.sourceSpan); } }); return new Icu(vars, placeholders, expansion.sourceSpan, meta); } }, { key: "visitExpansionCase", value: function visitExpansionCase(expansionCase) { return null; } }, { key: "visitComment", value: function visitComment(comment) { return null; } // convert view engine `ParsedProperty` to a format suitable for IVY }, { key: "extractAttributes", value: function extractAttributes(elementName, properties, i18nPropsMeta) { var _this179 = this; var bound = []; var literal = []; properties.forEach(function (prop) { var i18n = i18nPropsMeta[prop.name]; if (prop.isLiteral) { literal.push(new TextAttribute(prop.name, prop.expression.source || '', prop.sourceSpan, undefined, i18n)); } else { // Note that validation is skipped and property mapping is disabled // due to the fact that we need to make sure a given prop is not an // input of a directive and directive matching happens at runtime. var bep = _this179.bindingParser.createBoundElementProperty(elementName, prop, /* skipValidation */ true, /* mapPropertyName */ false); bound.push(BoundAttribute.fromBoundElementProperty(bep, i18n)); } }); return { bound: bound, literal: literal }; } }, { key: "parseAttribute", value: function parseAttribute(isTemplateElement, attribute, matchableAttributes, parsedProperties, boundEvents, variables, references) { var name = normalizeAttributeName(attribute.name); var value = attribute.value; var srcSpan = attribute.sourceSpan; var absoluteOffset = attribute.valueSpan ? attribute.valueSpan.start.offset : srcSpan.start.offset; var bindParts = name.match(BIND_NAME_REGEXP$1); var hasBinding = false; if (bindParts) { hasBinding = true; if (bindParts[KW_BIND_IDX$1] != null) { this.bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX$1], value, false, srcSpan, absoluteOffset, attribute.valueSpan, matchableAttributes, parsedProperties); } else if (bindParts[KW_LET_IDX$1]) { if (isTemplateElement) { var identifier = bindParts[IDENT_KW_IDX$1]; this.parseVariable(identifier, value, srcSpan, attribute.valueSpan, variables); } else { this.reportError("\"let-\" is only supported on ng-template elements.", srcSpan); } } else if (bindParts[KW_REF_IDX$1]) { var _identifier2 = bindParts[IDENT_KW_IDX$1]; this.parseReference(_identifier2, value, srcSpan, attribute.valueSpan, references); } else if (bindParts[KW_ON_IDX$1]) { var events = []; this.bindingParser.parseEvent(bindParts[IDENT_KW_IDX$1], value, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, events); addEvents(events, boundEvents); } else if (bindParts[KW_BINDON_IDX$1]) { this.bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX$1], value, false, srcSpan, absoluteOffset, attribute.valueSpan, matchableAttributes, parsedProperties); this.parseAssignmentEvent(bindParts[IDENT_KW_IDX$1], value, srcSpan, attribute.valueSpan, matchableAttributes, boundEvents); } else if (bindParts[KW_AT_IDX$1]) { this.bindingParser.parseLiteralAttr(name, value, srcSpan, absoluteOffset, attribute.valueSpan, matchableAttributes, parsedProperties); } else if (bindParts[IDENT_BANANA_BOX_IDX$1]) { this.bindingParser.parsePropertyBinding(bindParts[IDENT_BANANA_BOX_IDX$1], value, false, srcSpan, absoluteOffset, attribute.valueSpan, matchableAttributes, parsedProperties); this.parseAssignmentEvent(bindParts[IDENT_BANANA_BOX_IDX$1], value, srcSpan, attribute.valueSpan, matchableAttributes, boundEvents); } else if (bindParts[IDENT_PROPERTY_IDX$1]) { this.bindingParser.parsePropertyBinding(bindParts[IDENT_PROPERTY_IDX$1], value, false, srcSpan, absoluteOffset, attribute.valueSpan, matchableAttributes, parsedProperties); } else if (bindParts[IDENT_EVENT_IDX$1]) { var _events2 = []; this.bindingParser.parseEvent(bindParts[IDENT_EVENT_IDX$1], value, srcSpan, attribute.valueSpan || srcSpan, matchableAttributes, _events2); addEvents(_events2, boundEvents); } } else { hasBinding = this.bindingParser.parsePropertyInterpolation(name, value, srcSpan, attribute.valueSpan, matchableAttributes, parsedProperties); } return hasBinding; } }, { key: "_visitTextWithInterpolation", value: function _visitTextWithInterpolation(value, sourceSpan, i18n) { var valueNoNgsp = replaceNgsp(value); var expr = this.bindingParser.parseInterpolation(valueNoNgsp, sourceSpan); return expr ? new BoundText(expr, sourceSpan, i18n) : new Text(valueNoNgsp, sourceSpan); } }, { key: "parseVariable", value: function parseVariable(identifier, value, sourceSpan, valueSpan, variables) { if (identifier.indexOf('-') > -1) { this.reportError("\"-\" is not allowed in variable names", sourceSpan); } variables.push(new Variable(identifier, value, sourceSpan, valueSpan)); } }, { key: "parseReference", value: function parseReference(identifier, value, sourceSpan, valueSpan, references) { if (identifier.indexOf('-') > -1) { this.reportError("\"-\" is not allowed in reference names", sourceSpan); } references.push(new Reference(identifier, value, sourceSpan, valueSpan)); } }, { key: "parseAssignmentEvent", value: function parseAssignmentEvent(name, expression, sourceSpan, valueSpan, targetMatchableAttrs, boundEvents) { var events = []; this.bindingParser.parseEvent("".concat(name, "Change"), "".concat(expression, "=$event"), sourceSpan, valueSpan || sourceSpan, targetMatchableAttrs, events); addEvents(events, boundEvents); } }, { key: "reportError", value: function reportError(message, sourceSpan) { var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ParseErrorLevel.ERROR; this.errors.push(new ParseError(sourceSpan, message, level)); } }]); return HtmlAstToIvyAst; }(); var NonBindableVisitor$1 = /*#__PURE__*/function () { function NonBindableVisitor$1() { _classCallCheck(this, NonBindableVisitor$1); } _createClass2(NonBindableVisitor$1, [{ key: "visitElement", value: function visitElement(ast) { var preparsedElement = preparseElement(ast); if (preparsedElement.type === PreparsedElementType.SCRIPT || preparsedElement.type === PreparsedElementType.STYLE || preparsedElement.type === PreparsedElementType.STYLESHEET) { // Skipping <script> for security reasons // Skipping <style> and stylesheets as we already processed them // in the StyleCompiler return null; } var children = visitAll$1(this, ast.children, null); return new Element(ast.name, visitAll$1(this, ast.attrs), /* inputs */ [], /* outputs */ [], children, /* references */ [], ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan); } }, { key: "visitComment", value: function visitComment(comment) { return null; } }, { key: "visitAttribute", value: function visitAttribute(attribute) { return new TextAttribute(attribute.name, attribute.value, attribute.sourceSpan, undefined, attribute.i18n); } }, { key: "visitText", value: function visitText(text) { return new Text(text.value, text.sourceSpan); } }, { key: "visitExpansion", value: function visitExpansion(expansion) { return null; } }, { key: "visitExpansionCase", value: function visitExpansionCase(expansionCase) { return null; } }]); return NonBindableVisitor$1; }(); var NON_BINDABLE_VISITOR$1 = new NonBindableVisitor$1(); function normalizeAttributeName(attrName) { return /^data-/i.test(attrName) ? attrName.substring(5) : attrName; } function addEvents(events, boundEvents) { boundEvents.push.apply(boundEvents, _toConsumableArray(events.map(function (e) { return BoundEvent.fromParsedEvent(e); }))); } function isEmptyTextNode(node) { return node instanceof Text$3 && node.value.trim().length == 0; } function isCommentNode(node) { return node instanceof Comment; } function textContents(node) { if (node.children.length !== 1 || !(node.children[0] instanceof Text$3)) { return null; } else { return node.children[0].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 TagType; (function (TagType) { TagType[TagType["ELEMENT"] = 0] = "ELEMENT"; TagType[TagType["TEMPLATE"] = 1] = "TEMPLATE"; TagType[TagType["PROJECTION"] = 2] = "PROJECTION"; })(TagType || (TagType = {})); /** * Generates an object that is used as a shared state between parent and all child contexts. */ function setupRegistry() { return { getUniqueId: getSeqNumberGenerator(), icus: new Map() }; } /** * I18nContext is a helper class which keeps track of all i18n-related aspects * (accumulates placeholders, bindings, etc) between i18nStart and i18nEnd instructions. * * When we enter a nested template, the top-level context is being passed down * to the nested component, which uses this context to generate a child instance * of I18nContext class (to handle nested template) and at the end, reconciles it back * with the parent context. * * @param index Instruction index of i18nStart, which initiates this context * @param ref Reference to a translation const that represents the content if thus context * @param level Nestng level defined for child contexts * @param templateIndex Instruction index of a template which this context belongs to * @param meta Meta information (id, meaning, description, etc) associated with this context */ var I18nContext = /*#__PURE__*/function () { function I18nContext(index, ref) { var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; var templateIndex = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; var meta = arguments.length > 4 ? arguments[4] : undefined; var registry = arguments.length > 5 ? arguments[5] : undefined; _classCallCheck(this, I18nContext); this.index = index; this.ref = ref; this.level = level; this.templateIndex = templateIndex; this.meta = meta; this.registry = registry; this.bindings = new Set(); this.placeholders = new Map(); this.isEmitted = false; this._unresolvedCtxCount = 0; this._registry = registry || setupRegistry(); this.id = this._registry.getUniqueId(); } _createClass2(I18nContext, [{ key: "appendTag", value: function appendTag(type, node, index, closed) { if (node.isVoid && closed) { return; // ignore "close" for void tags } var ph = node.isVoid || !closed ? node.startName : node.closeName; var content = { type: type, index: index, ctx: this.id, isVoid: node.isVoid, closed: closed }; updatePlaceholderMap(this.placeholders, ph, content); } }, { key: "getSerializedPlaceholders", value: function getSerializedPlaceholders() { var result = new Map(); this.placeholders.forEach(function (values, key) { return result.set(key, values.map(serializePlaceholderValue)); }); return result; } // public API to accumulate i18n-related content }, { key: "appendBinding", value: function appendBinding(binding) { this.bindings.add(binding); } }, { key: "appendIcu", value: function appendIcu(name, ref) { updatePlaceholderMap(this._registry.icus, name, ref); } }, { key: "appendBoundText", value: function appendBoundText(node) { var _this180 = this; var phs = assembleBoundTextPlaceholders(node, this.bindings.size, this.id); phs.forEach(function (values, key) { return updatePlaceholderMap.apply(void 0, [_this180.placeholders, key].concat(_toConsumableArray(values))); }); } }, { key: "appendTemplate", value: function appendTemplate(node, index) { // add open and close tags at the same time, // since we process nested templates separately this.appendTag(TagType.TEMPLATE, node, index, false); this.appendTag(TagType.TEMPLATE, node, index, true); this._unresolvedCtxCount++; } }, { key: "appendElement", value: function appendElement(node, index, closed) { this.appendTag(TagType.ELEMENT, node, index, closed); } }, { key: "appendProjection", value: function appendProjection(node, index) { // add open and close tags at the same time, // since we process projected content separately this.appendTag(TagType.PROJECTION, node, index, false); this.appendTag(TagType.PROJECTION, node, index, true); } /** * Generates an instance of a child context based on the root one, * when we enter a nested template within I18n section. * * @param index Instruction index of corresponding i18nStart, which initiates this context * @param templateIndex Instruction index of a template which this context belongs to * @param meta Meta information (id, meaning, description, etc) associated with this context * * @returns I18nContext instance */ }, { key: "forkChildContext", value: function forkChildContext(index, templateIndex, meta) { return new I18nContext(index, this.ref, this.level + 1, templateIndex, meta, this._registry); } /** * Reconciles child context into parent one once the end of the i18n block is reached (i18nEnd). * * @param context Child I18nContext instance to be reconciled with parent context. */ }, { key: "reconcileChildContext", value: function reconcileChildContext(context) { var _this181 = this; // set the right context id for open and close // template tags, so we can use it as sub-block ids ['start', 'close'].forEach(function (op) { var key = context.meta["".concat(op, "Name")]; var phs = _this181.placeholders.get(key) || []; var tag = phs.find(findTemplateFn(_this181.id, context.templateIndex)); if (tag) { tag.ctx = context.id; } }); // reconcile placeholders var childPhs = context.placeholders; childPhs.forEach(function (values, key) { var phs = _this181.placeholders.get(key); if (!phs) { _this181.placeholders.set(key, values); return; } // try to find matching template... var tmplIdx = findIndex(phs, findTemplateFn(context.id, context.templateIndex)); if (tmplIdx >= 0) { // ... if found - replace it with nested template content var isCloseTag = key.startsWith('CLOSE'); var isTemplateTag = key.endsWith('NG-TEMPLATE'); if (isTemplateTag) { // current template's content is placed before or after // parent template tag, depending on the open/close atrribute phs.splice.apply(phs, [tmplIdx + (isCloseTag ? 0 : 1), 0].concat(_toConsumableArray(values))); } else { var idx = isCloseTag ? values.length - 1 : 0; values[idx].tmpl = phs[tmplIdx]; phs.splice.apply(phs, [tmplIdx, 1].concat(_toConsumableArray(values))); } } else { // ... otherwise just append content to placeholder value phs.push.apply(phs, _toConsumableArray(values)); } _this181.placeholders.set(key, phs); }); this._unresolvedCtxCount--; } }, { key: "icus", get: function get() { return this._registry.icus; } }, { key: "isRoot", get: function get() { return this.level === 0; } }, { key: "isResolved", get: function get() { return this._unresolvedCtxCount === 0; } }]); return I18nContext; }(); // // Helper methods // function wrap(symbol, index, contextId, closed) { var state = closed ? '/' : ''; return wrapI18nPlaceholder("".concat(state).concat(symbol).concat(index), contextId); } function wrapTag(symbol, _ref32, closed) { var index = _ref32.index, ctx = _ref32.ctx, isVoid = _ref32.isVoid; return isVoid ? wrap(symbol, index, ctx) + wrap(symbol, index, ctx, true) : wrap(symbol, index, ctx, closed); } function findTemplateFn(ctx, templateIndex) { return function (token) { return typeof token === 'object' && token.type === TagType.TEMPLATE && token.index === templateIndex && token.ctx === ctx; }; } function serializePlaceholderValue(value) { var element = function element(data, closed) { return wrapTag('#', data, closed); }; var template = function template(data, closed) { return wrapTag('*', data, closed); }; var projection = function projection(data, closed) { return wrapTag('!', data, closed); }; switch (value.type) { case TagType.ELEMENT: // close element tag if (value.closed) { return element(value, true) + (value.tmpl ? template(value.tmpl, true) : ''); } // open element tag that also initiates a template if (value.tmpl) { return template(value.tmpl) + element(value) + (value.isVoid ? template(value.tmpl, true) : ''); } return element(value); case TagType.TEMPLATE: return template(value, value.closed); case TagType.PROJECTION: return projection(value, value.closed); default: return value; } } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ 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. */ var PlaceholderRegistry = /*#__PURE__*/function () { function PlaceholderRegistry() { _classCallCheck(this, PlaceholderRegistry); // Count the occurrence of the base name top generate a unique name this._placeHolderNameCounts = {}; // Maps signature to placeholder names this._signatureToName = {}; } _createClass2(PlaceholderRegistry, [{ key: "getStartTagPlaceholderName", value: function getStartTagPlaceholderName(tag, attrs, isVoid) { var signature = this._hashTag(tag, attrs, isVoid); if (this._signatureToName[signature]) { return this._signatureToName[signature]; } var upperTag = tag.toUpperCase(); var baseName = TAG_TO_PLACEHOLDER_NAMES[upperTag] || "TAG_".concat(upperTag); var name = this._generateUniqueName(isVoid ? baseName : "START_".concat(baseName)); this._signatureToName[signature] = name; return name; } }, { key: "getCloseTagPlaceholderName", value: function getCloseTagPlaceholderName(tag) { var signature = this._hashClosingTag(tag); if (this._signatureToName[signature]) { return this._signatureToName[signature]; } var upperTag = tag.toUpperCase(); var baseName = TAG_TO_PLACEHOLDER_NAMES[upperTag] || "TAG_".concat(upperTag); var name = this._generateUniqueName("CLOSE_".concat(baseName)); this._signatureToName[signature] = name; return name; } }, { key: "getPlaceholderName", value: function getPlaceholderName(name, content) { var upperName = name.toUpperCase(); var signature = "PH: ".concat(upperName, "=").concat(content); if (this._signatureToName[signature]) { return this._signatureToName[signature]; } var uniqueName = this._generateUniqueName(upperName); this._signatureToName[signature] = uniqueName; return uniqueName; } }, { key: "getUniquePlaceholder", value: function getUniquePlaceholder(name) { return this._generateUniqueName(name.toUpperCase()); } // Generate a hash for a tag - does not take attribute order into account }, { key: "_hashTag", value: function _hashTag(tag, attrs, isVoid) { var start = "<".concat(tag); var strAttrs = Object.keys(attrs).sort().map(function (name) { return " ".concat(name, "=").concat(attrs[name]); }).join(''); var end = isVoid ? '/>' : "></".concat(tag, ">"); return start + strAttrs + end; } }, { key: "_hashClosingTag", value: function _hashClosingTag(tag) { return this._hashTag("/".concat(tag), {}, false); } }, { key: "_generateUniqueName", value: function _generateUniqueName(base) { var seen = this._placeHolderNameCounts.hasOwnProperty(base); if (!seen) { this._placeHolderNameCounts[base] = 1; return base; } var id = this._placeHolderNameCounts[base]; this._placeHolderNameCounts[base] = id + 1; return "".concat(base, "_").concat(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$1(new Lexer()); /** * Returns a function converting html nodes to an i18n Message given an interpolationConfig */ function createI18nMessageFactory(interpolationConfig) { var visitor = new _I18nVisitor(_expParser, interpolationConfig); return function (nodes, meaning, description, id, visitNodeFn) { return visitor.toI18nMessage(nodes, meaning, description, id, visitNodeFn); }; } var _I18nVisitor = /*#__PURE__*/function () { function _I18nVisitor(_expressionParser, _interpolationConfig) { _classCallCheck(this, _I18nVisitor); this._expressionParser = _expressionParser; this._interpolationConfig = _interpolationConfig; } _createClass2(_I18nVisitor, [{ key: "toI18nMessage", value: function toI18nMessage(nodes, meaning, description, id, visitNodeFn) { this._isIcu = nodes.length == 1 && nodes[0] instanceof Expansion; this._icuDepth = 0; this._placeholderRegistry = new PlaceholderRegistry(); this._placeholderToContent = {}; this._placeholderToMessage = {}; this._visitNodeFn = visitNodeFn; var i18nodes = visitAll$1(this, nodes, {}); return new Message(i18nodes, this._placeholderToContent, this._placeholderToMessage, meaning, description, id); } }, { key: "_visitNode", value: function _visitNode(html, i18n) { if (this._visitNodeFn) { this._visitNodeFn(html, i18n); } return i18n; } }, { key: "visitElement", value: function visitElement(el, context) { var children = visitAll$1(this, el.children); var attrs = {}; el.attrs.forEach(function (attr) { // Do not visit the attributes, translatable ones are top-level ASTs attrs[attr.name] = attr.value; }); var isVoid = getHtmlTagDefinition(el.name).isVoid; var startPhName = this._placeholderRegistry.getStartTagPlaceholderName(el.name, attrs, isVoid); this._placeholderToContent[startPhName] = el.sourceSpan.toString(); var closePhName = ''; if (!isVoid) { closePhName = this._placeholderRegistry.getCloseTagPlaceholderName(el.name); this._placeholderToContent[closePhName] = "</".concat(el.name, ">"); } var node = new TagPlaceholder(el.name, attrs, startPhName, closePhName, children, isVoid, el.sourceSpan); return this._visitNode(el, node); } }, { key: "visitAttribute", value: function visitAttribute(attribute, context) { var node = this._visitTextWithInterpolation(attribute.value, attribute.sourceSpan); return this._visitNode(attribute, node); } }, { key: "visitText", value: function visitText(text, context) { var node = this._visitTextWithInterpolation(text.value, text.sourceSpan); return this._visitNode(text, node); } }, { key: "visitComment", value: function visitComment(comment, context) { return null; } }, { key: "visitExpansion", value: function visitExpansion(icu, context) { var _this182 = this; this._icuDepth++; var i18nIcuCases = {}; var i18nIcu = new Icu$1(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(_this182, {}); }), 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 expPh = this._placeholderRegistry.getUniquePlaceholder("VAR_".concat(icu.type)); i18nIcu.expressionPlaceholder = expPh; this._placeholderToContent[expPh] = icu.switchValue; return this._visitNode(icu, 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 phName = this._placeholderRegistry.getPlaceholderName('ICU', icu.sourceSpan.toString()); var visitor = new _I18nVisitor(this._expressionParser, this._interpolationConfig); this._placeholderToMessage[phName] = visitor.toI18nMessage([icu], '', '', ''); var node = new IcuPlaceholder(i18nIcu, phName, icu.sourceSpan); return this._visitNode(icu, node); } }, { key: "visitExpansionCase", value: function visitExpansionCase(icuCase, context) { throw new Error('Unreachable code'); } }, { key: "_visitTextWithInterpolation", value: function _visitTextWithInterpolation(text, sourceSpan) { var 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 nodes = []; var container = new Container(nodes, sourceSpan); var _this$_interpolationC = this._interpolationConfig, sDelimiter = _this$_interpolationC.start, eDelimiter = _this$_interpolationC.end; for (var i = 0; i < splitInterpolation.strings.length - 1; i++) { var expression = splitInterpolation.expressions[i]; var baseName = _extractPlaceholderName(expression) || 'INTERPOLATION'; var 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 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; 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 */ function setI18nRefs(html, i18n) { html.i18n = i18n; } /** * This visitor walks over HTML parse tree and converts information stored in * i18n-related attributes ("i18n" and "i18n-*") into i18n meta object that is * stored with other element's and attribute's information. */ var I18nMetaVisitor = /*#__PURE__*/function () { function I18nMetaVisitor() { var interpolationConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_INTERPOLATION_CONFIG; var keepI18nAttrs = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; _classCallCheck(this, I18nMetaVisitor); this.interpolationConfig = interpolationConfig; this.keepI18nAttrs = keepI18nAttrs; // i18n message generation factory this._createI18nMessage = createI18nMessageFactory(interpolationConfig); } _createClass2(I18nMetaVisitor, [{ key: "_generateI18nMessage", value: function _generateI18nMessage(nodes) { var meta = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; var visitNodeFn = arguments.length > 2 ? arguments[2] : undefined; var parsed = typeof meta === 'string' ? parseI18nMeta(meta) : metaFromI18nMessage(meta); var message = this._createI18nMessage(nodes, parsed.meaning || '', parsed.description || '', parsed.id || '', visitNodeFn); if (!message.id) { // generate (or restore) message id if not specified in template message.id = typeof meta !== 'string' && meta.id || decimalDigest(message); } return message; } }, { key: "visitElement", value: function visitElement(element, context) { if (hasI18nAttrs(element)) { var attrs = []; var attrsMeta = {}; var _iterator11 = _createForOfIteratorHelper(element.attrs), _step11; try { for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) { var _attr = _step11.value; if (_attr.name === I18N_ATTR) { // root 'i18n' node attribute var i18n = element.i18n || _attr.value; var message = this._generateI18nMessage(element.children, i18n, setI18nRefs); // do not assign empty i18n meta if (message.nodes.length) { element.i18n = message; } } else if (_attr.name.startsWith(I18N_ATTR_PREFIX)) { // 'i18n-*' attributes var key = _attr.name.slice(I18N_ATTR_PREFIX.length); attrsMeta[key] = _attr.value; } else { // non-i18n attributes attrs.push(_attr); } } // set i18n meta for attributes } catch (err) { _iterator11.e(err); } finally { _iterator11.f(); } if (Object.keys(attrsMeta).length) { var _iterator12 = _createForOfIteratorHelper(attrs), _step12; try { for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) { var attr = _step12.value; var meta = attrsMeta[attr.name]; // do not create translation for empty attributes if (meta !== undefined && attr.value) { attr.i18n = this._generateI18nMessage([attr], attr.i18n || meta); } } } catch (err) { _iterator12.e(err); } finally { _iterator12.f(); } } if (!this.keepI18nAttrs) { // update element's attributes, // keeping only non-i18n related ones element.attrs = attrs; } } visitAll$1(this, element.children); return element; } }, { key: "visitExpansion", value: function visitExpansion(expansion, context) { var message; var meta = expansion.i18n; if (meta instanceof IcuPlaceholder) { // set ICU placeholder name (e.g. "ICU_1"), // generated while processing root element contents, // so we can reference it when we output translation var name = meta.name; message = this._generateI18nMessage([expansion], meta); var icu = icuFromI18nMessage(message); icu.name = name; } else { // when ICU is a root level translation message = this._generateI18nMessage([expansion], meta); } expansion.i18n = message; return expansion; } }, { key: "visitText", value: function visitText(text, context) { return text; } }, { key: "visitAttribute", value: function visitAttribute(attribute, context) { return attribute; } }, { key: "visitComment", value: function visitComment(comment, context) { return comment; } }, { key: "visitExpansionCase", value: function visitExpansionCase(expansionCase, context) { return expansionCase; } }]); return I18nMetaVisitor; }(); function processI18nMeta(htmlAstWithErrors) { var interpolationConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_INTERPOLATION_CONFIG; return new ParseTreeResult(visitAll$1(new I18nMetaVisitor(interpolationConfig, /* keepI18nAttrs */ false), htmlAstWithErrors.rootNodes), htmlAstWithErrors.errors); } /** * @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 visitor walks over i18n tree and generates its string representation, including ICUs and * placeholders in `{$placeholder}` (for plain messages) or `{PLACEHOLDER}` (inside ICUs) format. */ var SerializerVisitor = /*#__PURE__*/function () { function SerializerVisitor() { _classCallCheck(this, SerializerVisitor); /** * Keeps track of ICU nesting level, allowing to detect that we are processing elements of an ICU. * * This is needed due to the fact that placeholders in ICUs and in other messages are represented * differently in Closure: * - {$placeholder} in non-ICU case * - {PLACEHOLDER} inside ICU */ this.icuNestingLevel = 0; } _createClass2(SerializerVisitor, [{ key: "formatPh", value: function formatPh(value) { var isInsideIcu = this.icuNestingLevel > 0; var formatted = formatI18nPlaceholderName(value, /* useCamelCase */ !isInsideIcu); return isInsideIcu ? "{".concat(formatted, "}") : "{$".concat(formatted, "}"); } }, { key: "visitText", value: function visitText(text, context) { return text.value; } }, { key: "visitContainer", value: function visitContainer(container, context) { var _this183 = this; return container.children.map(function (child) { return child.visit(_this183); }).join(''); } }, { key: "visitIcu", value: function visitIcu(icu, context) { var _this184 = this; this.icuNestingLevel++; var strCases = Object.keys(icu.cases).map(function (k) { return "".concat(k, " {").concat(icu.cases[k].visit(_this184), "}"); }); var result = "{".concat(icu.expressionPlaceholder, ", ").concat(icu.type, ", ").concat(strCases.join(' '), "}"); this.icuNestingLevel--; return result; } }, { key: "visitTagPlaceholder", value: function visitTagPlaceholder(ph, context) { var _this185 = this; return ph.isVoid ? this.formatPh(ph.startName) : "".concat(this.formatPh(ph.startName)).concat(ph.children.map(function (child) { return child.visit(_this185); }).join('')).concat(this.formatPh(ph.closeName)); } }, { key: "visitPlaceholder", value: function visitPlaceholder(ph, context) { return this.formatPh(ph.name); } }, { key: "visitIcuPlaceholder", value: function visitIcuPlaceholder(ph, context) { return this.formatPh(ph.name); } }]); return SerializerVisitor; }(); var serializerVisitor$1 = new SerializerVisitor(); function getSerializedI18nContent(message) { return message.nodes.map(function (node) { return node.visit(serializerVisitor$1, null); }).join(''); } /** * @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 */ // Selector attribute name of `<ng-content>` var NG_CONTENT_SELECT_ATTR$1 = 'select'; // Attribute name of `ngProjectAs`. var NG_PROJECT_AS_ATTR_NAME = 'ngProjectAs'; // List of supported global targets for event listeners var GLOBAL_TARGET_RESOLVERS = new Map([['window', Identifiers$1.resolveWindow], ['document', Identifiers$1.resolveDocument], ['body', Identifiers$1.resolveBody]]); var LEADING_TRIVIA_CHARS = [' ', '\n', '\r', '\t']; // if (rf & flags) { .. } function renderFlagCheckIfStmt(flags, statements) { return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal(flags), null, false), statements); } function prepareEventListenerParameters(eventAst) { var handlerName = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var scope = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var type = eventAst.type, name = eventAst.name, target = eventAst.target, phase = eventAst.phase, handler = eventAst.handler; if (target && !GLOBAL_TARGET_RESOLVERS.has(target)) { throw new Error("Unexpected global target '".concat(target, "' defined for '").concat(name, "' event.\n Supported list of global targets: ").concat(Array.from(GLOBAL_TARGET_RESOLVERS.keys()), ".")); } var implicitReceiverExpr = scope === null || scope.bindingLevel === 0 ? variable(CONTEXT_NAME) : scope.getOrCreateSharedContextVar(0); var bindingExpr = convertActionBinding(scope, implicitReceiverExpr, handler, 'b', function () { return error('Unexpected interpolation'); }, eventAst.handlerSpan); var statements = []; if (scope) { statements.push.apply(statements, _toConsumableArray(scope.restoreViewStatement())); statements.push.apply(statements, _toConsumableArray(scope.variableDeclarations())); } statements.push.apply(statements, _toConsumableArray(bindingExpr.render3Stmts)); var eventName = type === 1 /* Animation */ ? prepareSyntheticListenerName(name, phase) : name; var fnName = handlerName && sanitizeIdentifier(handlerName); var fnArgs = [new FnParam('$event', DYNAMIC_TYPE)]; var handlerFn = fn(fnArgs, statements, INFERRED_TYPE, null, fnName); var params = [literal(eventName), handlerFn]; if (target) { params.push(literal(false), // `useCapture` flag, defaults to `false` importExpr(GLOBAL_TARGET_RESOLVERS.get(target))); } return params; } var TemplateDefinitionBuilder = /*#__PURE__*/function () { function TemplateDefinitionBuilder(constantPool, parentBindingScope) { var _this186 = this; var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; var contextName = arguments.length > 3 ? arguments[3] : undefined; var i18nContext = arguments.length > 4 ? arguments[4] : undefined; var templateIndex = arguments.length > 5 ? arguments[5] : undefined; var templateName = arguments.length > 6 ? arguments[6] : undefined; var directiveMatcher = arguments.length > 7 ? arguments[7] : undefined; var directives = arguments.length > 8 ? arguments[8] : undefined; var pipeTypeByName = arguments.length > 9 ? arguments[9] : undefined; var pipes = arguments.length > 10 ? arguments[10] : undefined; var _namespace = arguments.length > 11 ? arguments[11] : undefined; var relativeContextFilePath = arguments.length > 12 ? arguments[12] : undefined; var i18nUseExternalIds = arguments.length > 13 ? arguments[13] : undefined; _classCallCheck(this, TemplateDefinitionBuilder); this.constantPool = constantPool; this.level = level; this.contextName = contextName; this.i18nContext = i18nContext; this.templateIndex = templateIndex; this.templateName = templateName; this.directiveMatcher = directiveMatcher; this.directives = directives; this.pipeTypeByName = pipeTypeByName; this.pipes = pipes; this._namespace = _namespace; this.relativeContextFilePath = relativeContextFilePath; this.i18nUseExternalIds = i18nUseExternalIds; this._dataIndex = 0; this._bindingContext = 0; this._prefixCode = []; /** * List of callbacks to generate creation mode instructions. We store them here as we process * the template so bindings in listeners are resolved only once all nodes have been visited. * This ensures all local refs and context variables are available for matching. */ this._creationCodeFns = []; /** * List of callbacks to generate update mode instructions. We store them here as we process * the template so bindings are resolved only once all nodes have been visited. This ensures * all local refs and context variables are available for matching. */ this._updateCodeFns = []; /** * Memorizes the last node index for which a select instruction has been generated. * We're initializing this to -1 to ensure the `select(0)` instruction is generated before any * relevant update instructions. */ this._lastNodeIndexWithFlush = -1; /** Temporary variable declarations generated from visiting pipes, literals, etc. */ this._tempVariables = []; /** * List of callbacks to build nested templates. Nested templates must not be visited until * after the parent template has finished visiting all of its nodes. This ensures that all * local ref bindings in nested templates are able to find local ref values if the refs * are defined after the template declaration. */ this._nestedTemplateFns = []; this._unsupported = unsupported; // i18n context local to this template this.i18n = null; // Number of slots to reserve for pureFunctions this._pureFunctionSlots = 0; // Number of binding slots this._bindingSlots = 0; // Projection slots found in the template. Projection slots can distribute projected // nodes based on a selector, or can just use the wildcard selector to match // all nodes which aren't matching any selector. this._ngContentReservedSlots = []; // Number of non-default selectors found in all parent templates of this template. We need to // track it to properly adjust projection slot index in the `projection` instruction. this._ngContentSelectorsOffset = 0; // Expression that should be used as implicit receiver when converting template // expressions to output AST. this._implicitReceiverExpr = null; // These should be handled in the template or element directly. this.visitReference = invalid$1; this.visitVariable = invalid$1; this.visitTextAttribute = invalid$1; this.visitBoundAttribute = invalid$1; this.visitBoundEvent = invalid$1; this._bindingScope = parentBindingScope.nestedScope(level); // Turn the relative context file path into an identifier by replacing non-alphanumeric // characters with underscores. this.fileBasedI18nSuffix = relativeContextFilePath.replace(/[^A-Za-z0-9]/g, '_') + '_'; this._valueConverter = new ValueConverter(constantPool, function () { return _this186.allocateDataSlot(); }, function (numSlots) { return _this186.allocatePureFunctionSlots(numSlots); }, function (name, localName, slot, value) { var pipeType = pipeTypeByName.get(name); if (pipeType) { _this186.pipes.add(pipeType); } _this186._bindingScope.set(_this186.level, localName, value); _this186.creationInstruction(null, Identifiers$1.pipe, [literal(slot), literal(name)]); }); } _createClass2(TemplateDefinitionBuilder, [{ key: "registerContextVariables", value: function registerContextVariables(variable$1) { var scopedName = this._bindingScope.freshReferenceName(); var retrievalLevel = this.level; var lhs = variable(variable$1.name + scopedName); this._bindingScope.set(retrievalLevel, variable$1.name, lhs, 1 /* CONTEXT */ , function (scope, relativeLevel) { var rhs; if (scope.bindingLevel === retrievalLevel) { // e.g. ctx rhs = variable(CONTEXT_NAME); } else { var sharedCtxVar = scope.getSharedContextName(retrievalLevel); // e.g. ctx_r0 OR x(2); rhs = sharedCtxVar ? sharedCtxVar : generateNextContextExpr(relativeLevel); } // e.g. const $item$ = x(2).$implicit; return [lhs.set(rhs.prop(variable$1.value || IMPLICIT_REFERENCE)).toConstDecl()]; }); } }, { key: "buildTemplateFunction", value: function buildTemplateFunction(nodes, variables) { var _this187 = this; var ngContentSelectorsOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; var i18n = arguments.length > 3 ? arguments[3] : undefined; this._ngContentSelectorsOffset = ngContentSelectorsOffset; if (this._namespace !== Identifiers$1.namespaceHTML) { this.creationInstruction(null, this._namespace); } // Create variable bindings variables.forEach(function (v) { return _this187.registerContextVariables(v); }); // Initiate i18n context in case: // - this template has parent i18n context // - or the template has i18n meta associated with it, // but it's not initiated by the Element (e.g. <ng-template i18n>) var initI18nContext = this.i18nContext || isI18nRootNode(i18n) && !isSingleI18nIcu(i18n) && !(isSingleElementTemplate(nodes) && nodes[0].i18n === i18n); var selfClosingI18nInstruction = hasTextChildrenOnly(nodes); if (initI18nContext) { this.i18nStart(null, i18n, selfClosingI18nInstruction); } // This is the initial pass through the nodes of this template. In this pass, we // queue all creation mode and update mode instructions for generation in the second // pass. It's necessary to separate the passes to ensure local refs are defined before // resolving bindings. We also count bindings in this pass as we walk bound expressions. visitAll(this, nodes); // Add total binding count to pure function count so pure function instructions are // generated with the correct slot offset when update instructions are processed. this._pureFunctionSlots += this._bindingSlots; // Pipes are walked in the first pass (to enqueue `pipe()` creation instructions and // `pipeBind` update instructions), so we have to update the slot offsets manually // to account for bindings. this._valueConverter.updatePipeSlotOffsets(this._bindingSlots); // Nested templates must be processed before creation instructions so template() // instructions can be generated with the correct internal const count. this._nestedTemplateFns.forEach(function (buildTemplateFn) { return buildTemplateFn(); }); // Output the `projectionDef` instruction when some `<ng-content>` tags are present. // The `projectionDef` instruction is only emitted for the component template and // is skipped for nested templates (<ng-template> tags). if (this.level === 0 && this._ngContentReservedSlots.length) { var parameters = []; // By default the `projectionDef` instructions creates one slot for the wildcard // selector if no parameters are passed. Therefore we only want to allocate a new // array for the projection slots if the default projection slot is not sufficient. if (this._ngContentReservedSlots.length > 1 || this._ngContentReservedSlots[0] !== '*') { var r3ReservedSlots = this._ngContentReservedSlots.map(function (s) { return s !== '*' ? parseSelectorToR3Selector(s) : s; }); parameters.push(this.constantPool.getConstLiteral(asLiteral(r3ReservedSlots), true)); } // Since we accumulate ngContent selectors while processing template elements, // we *prepend* `projectionDef` to creation instructions block, to put it before // any `projection` instructions this.creationInstruction(null, Identifiers$1.projectionDef, parameters, /* prepend */ true); } if (initI18nContext) { this.i18nEnd(null, selfClosingI18nInstruction); } // Generate all the creation mode instructions (e.g. resolve bindings in listeners) var creationStatements = this._creationCodeFns.map(function (fn) { return fn(); }); // Generate all the update mode instructions (e.g. resolve property or text bindings) var updateStatements = this._updateCodeFns.map(function (fn) { return fn(); }); // Variable declaration must occur after binding resolution so we can generate context // instructions that build on each other. // e.g. const b = nextContext().$implicit(); const b = nextContext(); var creationVariables = this._bindingScope.viewSnapshotStatements(); var updateVariables = this._bindingScope.variableDeclarations().concat(this._tempVariables); var creationBlock = creationStatements.length > 0 ? [renderFlagCheckIfStmt(1 /* Create */ , creationVariables.concat(creationStatements))] : []; var updateBlock = updateStatements.length > 0 ? [renderFlagCheckIfStmt(2 /* Update */ , updateVariables.concat(updateStatements))] : []; return fn( // i.e. (rf: RenderFlags, ctx: any) [new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null)], [].concat(_toConsumableArray(this._prefixCode), creationBlock, updateBlock), INFERRED_TYPE, null, this.templateName); } // LocalResolver }, { key: "getLocal", value: function getLocal(name) { return this._bindingScope.get(name); } // LocalResolver }, { key: "notifyImplicitReceiverUse", value: function notifyImplicitReceiverUse() { this._bindingScope.notifyImplicitReceiverUse(); } }, { key: "i18nTranslate", value: function i18nTranslate(message) { var _this$constantPool$st; var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var ref = arguments.length > 2 ? arguments[2] : undefined; var transformFn = arguments.length > 3 ? arguments[3] : undefined; var _ref = ref || variable(this.constantPool.uniqueName(TRANSLATION_PREFIX)); // Closure Compiler requires const names to start with `MSG_` but disallows any other const to // start with `MSG_`. We define a variable starting with `MSG_` just for the `goog.getMsg` call var closureVar = this.i18nGenerateClosureVar(message.id); var formattedParams = this.i18nFormatPlaceholderNames(params, /* useCamelCase */ true); var meta = metaFromI18nMessage(message); var content = getSerializedI18nContent(message); var statements = getTranslationDeclStmts(_ref, closureVar, content, meta, formattedParams, transformFn); (_this$constantPool$st = this.constantPool.statements).push.apply(_this$constantPool$st, _toConsumableArray(statements)); return _ref; } }, { key: "i18nFormatPlaceholderNames", value: function i18nFormatPlaceholderNames() { var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var useCamelCase = arguments.length > 1 ? arguments[1] : undefined; var _params = {}; if (params && Object.keys(params).length) { Object.keys(params).forEach(function (key) { return _params[formatI18nPlaceholderName(key, useCamelCase)] = params[key]; }); } return _params; } }, { key: "i18nAppendBindings", value: function i18nAppendBindings(expressions) { var _this188 = this; if (expressions.length > 0) { expressions.forEach(function (expression) { return _this188.i18n.appendBinding(expression); }); } } }, { key: "i18nBindProps", value: function i18nBindProps(props) { var _this189 = this; var bound = {}; Object.keys(props).forEach(function (key) { var prop = props[key]; if (prop instanceof Text) { bound[key] = literal(prop.value); } else { var value = prop.value.visit(_this189._valueConverter); _this189.allocateBindingSlots(value); if (value instanceof Interpolation) { var strings = value.strings, expressions = value.expressions; var _this189$i18n = _this189.i18n, id = _this189$i18n.id, bindings = _this189$i18n.bindings; var label = assembleI18nBoundString(strings, bindings.size, id); _this189.i18nAppendBindings(expressions); bound[key] = literal(label); } } }); return bound; } }, { key: "i18nGenerateClosureVar", value: function i18nGenerateClosureVar(messageId) { var name; var suffix = this.fileBasedI18nSuffix.toUpperCase(); if (this.i18nUseExternalIds) { var prefix = getTranslationConstPrefix("EXTERNAL_"); var uniqueSuffix = this.constantPool.uniqueName(suffix); name = "".concat(prefix).concat(sanitizeIdentifier(messageId), "$$").concat(uniqueSuffix); } else { var _prefix = getTranslationConstPrefix(suffix); name = this.constantPool.uniqueName(_prefix); } return variable(name); } }, { key: "i18nUpdateRef", value: function i18nUpdateRef(context) { var icus = context.icus, meta = context.meta, isRoot = context.isRoot, isResolved = context.isResolved, isEmitted = context.isEmitted; if (isRoot && isResolved && !isEmitted && !isSingleI18nIcu(meta)) { context.isEmitted = true; var placeholders = context.getSerializedPlaceholders(); var icuMapping = {}; var params = placeholders.size ? placeholdersToParams(placeholders) : {}; if (icus.size) { icus.forEach(function (refs, key) { if (refs.length === 1) { // if we have one ICU defined for a given // placeholder - just output its reference params[key] = refs[0]; } else { // ... otherwise we need to activate post-processing // to replace ICU placeholders with proper values var placeholder = wrapI18nPlaceholder("".concat(I18N_ICU_MAPPING_PREFIX).concat(key)); params[key] = literal(placeholder); icuMapping[key] = literalArr(refs); } }); } // translation requires post processing in 2 cases: // - if we have placeholders with multiple values (ex. `START_DIV`: [�#1�, �#2�, ...]) // - if we have multiple ICUs that refer to the same placeholder name var needsPostprocessing = Array.from(placeholders.values()).some(function (value) { return value.length > 1; }) || Object.keys(icuMapping).length; var transformFn; if (needsPostprocessing) { transformFn = function transformFn(raw) { var args = [raw]; if (Object.keys(icuMapping).length) { args.push(mapLiteral(icuMapping, true)); } return instruction(null, Identifiers$1.i18nPostprocess, args); }; } this.i18nTranslate(meta, params, context.ref, transformFn); } } }, { key: "i18nStart", value: function i18nStart() { var span = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var meta = arguments.length > 1 ? arguments[1] : undefined; var selfClosing = arguments.length > 2 ? arguments[2] : undefined; var index = this.allocateDataSlot(); if (this.i18nContext) { this.i18n = this.i18nContext.forkChildContext(index, this.templateIndex, meta); } else { var _ref33 = variable(this.constantPool.uniqueName(TRANSLATION_PREFIX)); this.i18n = new I18nContext(index, _ref33, 0, this.templateIndex, meta); } // generate i18nStart instruction var _this$i18n = this.i18n, id = _this$i18n.id, ref = _this$i18n.ref; var params = [literal(index), ref]; if (id > 0) { // do not push 3rd argument (sub-block id) // into i18nStart call for top level i18n context params.push(literal(id)); } this.creationInstruction(span, selfClosing ? Identifiers$1.i18n : Identifiers$1.i18nStart, params); } }, { key: "i18nEnd", value: function i18nEnd() { var _this190 = this; var span = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var selfClosing = arguments.length > 1 ? arguments[1] : undefined; if (!this.i18n) { throw new Error('i18nEnd is executed with no i18n context present'); } if (this.i18nContext) { this.i18nContext.reconcileChildContext(this.i18n); this.i18nUpdateRef(this.i18nContext); } else { this.i18nUpdateRef(this.i18n); } // setup accumulated bindings var _this$i18n2 = this.i18n, index = _this$i18n2.index, bindings = _this$i18n2.bindings; if (bindings.size) { var chainBindings = []; bindings.forEach(function (binding) { chainBindings.push({ sourceSpan: span, value: function value() { return _this190.convertPropertyBinding(binding); } }); }); this.updateInstructionChain(index, Identifiers$1.i18nExp, chainBindings); this.updateInstruction(index, span, Identifiers$1.i18nApply, [literal(index)]); } if (!selfClosing) { this.creationInstruction(span, Identifiers$1.i18nEnd); } this.i18n = null; // reset local i18n context } }, { key: "visitContent", value: function visitContent(ngContent) { var slot = this.allocateDataSlot(); var projectionSlotIdx = this._ngContentSelectorsOffset + this._ngContentReservedSlots.length; var parameters = [literal(slot)]; var attributes = []; this._ngContentReservedSlots.push(ngContent.selector); ngContent.attributes.forEach(function (attribute) { var name = attribute.name, value = attribute.value; if (name === NG_PROJECT_AS_ATTR_NAME) { attributes.push.apply(attributes, _toConsumableArray(getNgProjectAsLiteral(attribute))); } else if (name.toLowerCase() !== NG_CONTENT_SELECT_ATTR$1) { attributes.push(literal(name), literal(value)); } }); if (attributes.length > 0) { parameters.push(literal(projectionSlotIdx), literalArr(attributes)); } else if (projectionSlotIdx !== 0) { parameters.push(literal(projectionSlotIdx)); } this.creationInstruction(ngContent.sourceSpan, Identifiers$1.projection, parameters); if (this.i18n) { this.i18n.appendProjection(ngContent.i18n, slot); } } }, { key: "getNamespaceInstruction", value: function getNamespaceInstruction(namespaceKey) { switch (namespaceKey) { case 'math': return Identifiers$1.namespaceMathML; case 'svg': return Identifiers$1.namespaceSVG; default: return Identifiers$1.namespaceHTML; } } }, { key: "addNamespaceInstruction", value: function addNamespaceInstruction(nsInstruction, element) { this._namespace = nsInstruction; this.creationInstruction(element.sourceSpan, nsInstruction); } }, { key: "visitElement", value: function visitElement(element) { var _this191 = this; var elementIndex = this.allocateDataSlot(); var stylingBuilder = new StylingBuilder(literal(elementIndex), null); var isNonBindableMode = false; var isI18nRootElement = isI18nRootNode(element.i18n) && !isSingleI18nIcu(element.i18n); if (isI18nRootElement && this.i18n) { throw new Error("Could not mark an element as translatable inside of a translatable section"); } var i18nAttrs = []; var outputAttrs = []; var _splitNsName = splitNsName(element.name), _splitNsName2 = _slicedToArray(_splitNsName, 2), namespaceKey = _splitNsName2[0], elementName = _splitNsName2[1]; var isNgContainer$1 = isNgContainer(element.name); // Handle styling, i18n, ngNonBindable attributes var _iterator13 = _createForOfIteratorHelper(element.attributes), _step13; try { for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) { var attr = _step13.value; var name = attr.name, value = attr.value; if (name === NON_BINDABLE_ATTR) { isNonBindableMode = true; } else if (name === 'style') { stylingBuilder.registerStyleAttr(value); } else if (name === 'class') { stylingBuilder.registerClassAttr(value); } else { if (attr.i18n) { // Place attributes into a separate array for i18n processing, but also keep such // attributes in the main list to make them available for directive matching at runtime. // TODO(FW-1248): prevent attributes duplication in `i18nAttributes` and `elementStart` // arguments i18nAttrs.push(attr); } else { outputAttrs.push(attr); } } } // Match directives on non i18n attributes } catch (err) { _iterator13.e(err); } finally { _iterator13.f(); } this.matchDirectives(element.name, element); // Regular element or ng-container creation mode var parameters = [literal(elementIndex)]; if (!isNgContainer$1) { parameters.push(literal(elementName)); } // Add the attributes var attributes = []; var allOtherInputs = []; element.inputs.forEach(function (input) { var stylingInputWasSet = stylingBuilder.registerBoundInput(input); if (!stylingInputWasSet) { if (input.type === 0 /* Property */ && input.i18n) { // Place attributes into a separate array for i18n processing, but also keep such // attributes in the main list to make them available for directive matching at runtime. // TODO(FW-1248): prevent attributes duplication in `i18nAttributes` and `elementStart` // arguments i18nAttrs.push(input); } else { allOtherInputs.push(input); } } }); outputAttrs.forEach(function (attr) { if (attr.name === NG_PROJECT_AS_ATTR_NAME) { attributes.push.apply(attributes, _toConsumableArray(getNgProjectAsLiteral(attr))); } else { attributes.push.apply(attributes, _toConsumableArray(getAttributeNameLiterals(attr.name)).concat([literal(attr.value)])); } }); // add attributes for directive and projection matching purposes attributes.push.apply(attributes, _toConsumableArray(this.prepareNonRenderAttrs(allOtherInputs, element.outputs, stylingBuilder, [], i18nAttrs))); parameters.push(this.toAttrsParam(attributes)); // local refs (ex.: <div #foo #bar="baz">) parameters.push(this.prepareRefsParameter(element.references)); var wasInNamespace = this._namespace; var currentNamespace = this.getNamespaceInstruction(namespaceKey); // If the namespace is changing now, include an instruction to change it // during element creation. if (currentNamespace !== wasInNamespace) { this.addNamespaceInstruction(currentNamespace, element); } if (this.i18n) { this.i18n.appendElement(element.i18n, elementIndex); } // Note that we do not append text node instructions and ICUs inside i18n section, // so we exclude them while calculating whether current element has children var hasChildren = !isI18nRootElement && this.i18n ? !hasTextChildrenOnly(element.children) : element.children.length > 0; var createSelfClosingInstruction = !stylingBuilder.hasBindings && element.outputs.length === 0 && i18nAttrs.length === 0 && !hasChildren; var createSelfClosingI18nInstruction = !createSelfClosingInstruction && !stylingBuilder.hasBindings && hasTextChildrenOnly(element.children); if (createSelfClosingInstruction) { this.creationInstruction(element.sourceSpan, isNgContainer$1 ? Identifiers$1.elementContainer : Identifiers$1.element, trimTrailingNulls(parameters)); } else { this.creationInstruction(element.sourceSpan, isNgContainer$1 ? Identifiers$1.elementContainerStart : Identifiers$1.elementStart, trimTrailingNulls(parameters)); if (isNonBindableMode) { this.creationInstruction(element.sourceSpan, Identifiers$1.disableBindings); } // process i18n element attributes if (i18nAttrs.length) { var hasBindings = false; var i18nAttrArgs = []; var bindings = []; i18nAttrs.forEach(function (attr) { var message = attr.i18n; if (attr instanceof TextAttribute) { i18nAttrArgs.push(literal(attr.name), _this191.i18nTranslate(message)); } else { var converted = attr.value.visit(_this191._valueConverter); _this191.allocateBindingSlots(converted); if (converted instanceof Interpolation) { var placeholders = assembleBoundTextPlaceholders(message); var params = placeholdersToParams(placeholders); i18nAttrArgs.push(literal(attr.name), _this191.i18nTranslate(message, params)); converted.expressions.forEach(function (expression) { hasBindings = true; bindings.push({ sourceSpan: element.sourceSpan, value: function value() { return _this191.convertExpressionBinding(expression); } }); }); } } }); if (bindings.length) { this.updateInstructionChain(elementIndex, Identifiers$1.i18nExp, bindings); } if (i18nAttrArgs.length) { var index = literal(this.allocateDataSlot()); var args = this.constantPool.getConstLiteral(literalArr(i18nAttrArgs), true); this.creationInstruction(element.sourceSpan, Identifiers$1.i18nAttributes, [index, args]); if (hasBindings) { this.updateInstruction(elementIndex, element.sourceSpan, Identifiers$1.i18nApply, [index]); } } } // The style bindings code is placed into two distinct blocks within the template function AOT // code: creation and update. The creation code contains the `styling` instructions // which will apply the collected binding values to the element. `styling` is // designed to run inside of `elementStart` and `elementEnd`. The update instructions // (things like `styleProp`, `classProp`, etc..) are applied later on in this // file this.processStylingInstruction(elementIndex, stylingBuilder.buildStylingInstruction(element.sourceSpan, this.constantPool), true); // Generate Listeners (outputs) element.outputs.forEach(function (outputAst) { _this191.creationInstruction(outputAst.sourceSpan, Identifiers$1.listener, _this191.prepareListenerParameter(element.name, outputAst, elementIndex)); }); // Note: it's important to keep i18n/i18nStart instructions after i18nAttributes and // listeners, to make sure i18nAttributes instruction targets current element at runtime. if (isI18nRootElement) { this.i18nStart(element.sourceSpan, element.i18n, createSelfClosingI18nInstruction); } } // the code here will collect all update-level styling instructions and add them to the // update block of the template function AOT code. Instructions like `styleProp`, // `styleMap`, `classMap`, `classProp` and `stylingApply` // are all generated and assigned in the code below. var stylingInstructions = stylingBuilder.buildUpdateLevelInstructions(this._valueConverter); var limit = stylingInstructions.length - 1; for (var i = 0; i <= limit; i++) { var _instruction = stylingInstructions[i]; this._bindingSlots += _instruction.allocateBindingSlots; this.processStylingInstruction(elementIndex, _instruction, false); } // the reason why `undefined` is used is because the renderer understands this as a // special value to symbolize that there is no RHS to this binding // TODO (matsko): revisit this once FW-959 is approached var emptyValueBindInstruction = literal(undefined); var propertyBindings = []; var attributeBindings = []; // Generate element input bindings allOtherInputs.forEach(function (input) { var inputType = input.type; if (inputType === 4 /* Animation */ ) { var _value4 = input.value.visit(_this191._valueConverter); // animation bindings can be presented in the following formats: // 1. [@binding]="fooExp" // 2. [@binding]="{value:fooExp, params:{...}}" // 3. [@binding] // 4. @binding // All formats will be valid for when a synthetic binding is created. // The reasoning for this is because the renderer should get each // synthetic binding value in the order of the array that they are // defined in... var hasValue = _value4 instanceof LiteralPrimitive ? !!_value4.value : true; _this191.allocateBindingSlots(_value4); propertyBindings.push({ name: prepareSyntheticPropertyName(input.name), sourceSpan: input.sourceSpan, value: function value() { return hasValue ? _this191.convertPropertyBinding(_value4) : emptyValueBindInstruction; } }); } else { // we must skip attributes with associated i18n context, since these attributes are handled // separately and corresponding `i18nExp` and `i18nApply` instructions will be generated if (input.i18n) return; var _value5 = input.value.visit(_this191._valueConverter); if (_value5 !== undefined) { var params = []; var _splitNsName3 = splitNsName(input.name), _splitNsName4 = _slicedToArray(_splitNsName3, 2), attrNamespace = _splitNsName4[0], attrName = _splitNsName4[1]; var isAttributeBinding = inputType === 1 /* Attribute */ ; var sanitizationRef = resolveSanitizationFn(input.securityContext, isAttributeBinding); if (sanitizationRef) params.push(sanitizationRef); if (attrNamespace) { var namespaceLiteral = literal(attrNamespace); if (sanitizationRef) { params.push(namespaceLiteral); } else { // If there wasn't a sanitization ref, we need to add // an extra param so that we can pass in the namespace. params.push(literal(null), namespaceLiteral); } } _this191.allocateBindingSlots(_value5); if (inputType === 0 /* Property */ ) { if (_value5 instanceof Interpolation) { // prop="{{value}}" and friends _this191.interpolatedUpdateInstruction(getPropertyInterpolationExpression(_value5), elementIndex, attrName, input, _value5, params); } else { // [prop]="value" // Collect all the properties so that we can chain into a single function at the end. propertyBindings.push({ name: attrName, sourceSpan: input.sourceSpan, value: function value() { return _this191.convertPropertyBinding(_value5); }, params: params }); } } else if (inputType === 1 /* Attribute */ ) { if (_value5 instanceof Interpolation && getInterpolationArgsLength(_value5) > 1) { // attr.name="text{{value}}" and friends _this191.interpolatedUpdateInstruction(getAttributeInterpolationExpression(_value5), elementIndex, attrName, input, _value5, params); } else { var boundValue = _value5 instanceof Interpolation ? _value5.expressions[0] : _value5; // [attr.name]="value" or attr.name="{{value}}" // Collect the attribute bindings so that they can be chained at the end. attributeBindings.push({ name: attrName, sourceSpan: input.sourceSpan, value: function value() { return _this191.convertPropertyBinding(boundValue); }, params: params }); } } else { // class prop _this191.updateInstruction(elementIndex, input.sourceSpan, Identifiers$1.classProp, function () { return [literal(elementIndex), literal(attrName), _this191.convertPropertyBinding(_value5)].concat(params); }); } } } }); if (propertyBindings.length > 0) { this.updateInstructionChain(elementIndex, Identifiers$1.property, propertyBindings); } if (attributeBindings.length > 0) { this.updateInstructionChain(elementIndex, Identifiers$1.attribute, attributeBindings); } // Traverse element child nodes visitAll(this, element.children); if (!isI18nRootElement && this.i18n) { this.i18n.appendElement(element.i18n, elementIndex, true); } if (!createSelfClosingInstruction) { // Finish element construction mode. var span = element.endSourceSpan || element.sourceSpan; if (isI18nRootElement) { this.i18nEnd(span, createSelfClosingI18nInstruction); } if (isNonBindableMode) { this.creationInstruction(span, Identifiers$1.enableBindings); } this.creationInstruction(span, isNgContainer$1 ? Identifiers$1.elementContainerEnd : Identifiers$1.elementEnd); } } /** * Adds an update instruction for an interpolated property or attribute, such as * `prop="{{value}}"` or `attr.title="{{value}}"` */ }, { key: "interpolatedUpdateInstruction", value: function interpolatedUpdateInstruction(instruction, elementIndex, attrName, input, value, params) { var _this192 = this; this.updateInstruction(elementIndex, input.sourceSpan, instruction, function () { return [literal(attrName)].concat(_toConsumableArray(_this192.getUpdateInstructionArguments(value)), _toConsumableArray(params)); }); } }, { key: "visitTemplate", value: function visitTemplate(template) { var _this193 = this; var NG_TEMPLATE_TAG_NAME = 'ng-template'; var templateIndex = this.allocateDataSlot(); if (this.i18n) { this.i18n.appendTemplate(template.i18n, templateIndex); } var tagName = sanitizeIdentifier(template.tagName || ''); var contextName = "".concat(this.contextName).concat(tagName ? '_' + tagName : '', "_").concat(templateIndex); var templateName = "".concat(contextName, "_Template"); var parameters = [literal(templateIndex), variable(templateName), // We don't care about the tag's namespace here, because we infer // it based on the parent nodes inside the template instruction. literal(template.tagName ? splitNsName(template.tagName)[1] : template.tagName)]; // find directives matching on a given <ng-template> node this.matchDirectives(NG_TEMPLATE_TAG_NAME, template); // prepare attributes parameter (including attributes used for directive matching) var attrsExprs = []; template.attributes.forEach(function (a) { attrsExprs.push(asLiteral(a.name), asLiteral(a.value)); }); attrsExprs.push.apply(attrsExprs, _toConsumableArray(this.prepareNonRenderAttrs(template.inputs, template.outputs, undefined, template.templateAttrs))); parameters.push(this.toAttrsParam(attrsExprs)); // local refs (ex.: <ng-template #foo>) if (template.references && template.references.length) { parameters.push(this.prepareRefsParameter(template.references)); parameters.push(importExpr(Identifiers$1.templateRefExtractor)); } // Create the template function var templateVisitor = new TemplateDefinitionBuilder(this.constantPool, this._bindingScope, this.level + 1, contextName, this.i18n, templateIndex, templateName, this.directiveMatcher, this.directives, this.pipeTypeByName, this.pipes, this._namespace, this.fileBasedI18nSuffix, this.i18nUseExternalIds); // Nested templates must not be visited until after their parent templates have completed // processing, so they are queued here until after the initial pass. Otherwise, we wouldn't // be able to support bindings in nested templates to local refs that occur after the // template definition. e.g. <div *ngIf="showing">{{ foo }}</div> <div #foo></div> this._nestedTemplateFns.push(function () { var templateFunctionExpr = templateVisitor.buildTemplateFunction(template.children, template.variables, _this193._ngContentReservedSlots.length + _this193._ngContentSelectorsOffset, template.i18n); _this193.constantPool.statements.push(templateFunctionExpr.toDeclStmt(templateName, null)); if (templateVisitor._ngContentReservedSlots.length) { var _this193$_ngContentRe; (_this193$_ngContentRe = _this193._ngContentReservedSlots).push.apply(_this193$_ngContentRe, _toConsumableArray(templateVisitor._ngContentReservedSlots)); } }); // e.g. template(1, MyComp_Template_1) this.creationInstruction(template.sourceSpan, Identifiers$1.templateCreate, function () { parameters.splice(2, 0, literal(templateVisitor.getConstCount()), literal(templateVisitor.getVarCount())); return trimTrailingNulls(parameters); }); // handle property bindings e.g. ɵɵproperty('ngForOf', ctx.items), et al; this.templatePropertyBindings(templateIndex, template.templateAttrs); // Only add normal input/output binding instructions on explicit ng-template elements. if (template.tagName === NG_TEMPLATE_TAG_NAME) { // Add the input bindings this.templatePropertyBindings(templateIndex, template.inputs); // Generate listeners for directive output template.outputs.forEach(function (outputAst) { _this193.creationInstruction(outputAst.sourceSpan, Identifiers$1.listener, _this193.prepareListenerParameter('ng_template', outputAst, templateIndex)); }); } } }, { key: "visitBoundText", value: function visitBoundText(text) { var _this194 = this; if (this.i18n) { var _value6 = text.value.visit(this._valueConverter); this.allocateBindingSlots(_value6); if (_value6 instanceof Interpolation) { this.i18n.appendBoundText(text.i18n); this.i18nAppendBindings(_value6.expressions); } return; } var nodeIndex = this.allocateDataSlot(); this.creationInstruction(text.sourceSpan, Identifiers$1.text, [literal(nodeIndex)]); var value = text.value.visit(this._valueConverter); this.allocateBindingSlots(value); if (value instanceof Interpolation) { this.updateInstruction(nodeIndex, text.sourceSpan, getTextInterpolationExpression(value), function () { return _this194.getUpdateInstructionArguments(value); }); } else { this.updateInstruction(nodeIndex, text.sourceSpan, Identifiers$1.textBinding, function () { return [_this194.convertPropertyBinding(value)]; }); } } }, { key: "visitText", value: function visitText(text) { // when a text element is located within a translatable // block, we exclude this text element from instructions set, // since it will be captured in i18n content and processed at runtime if (!this.i18n) { this.creationInstruction(text.sourceSpan, Identifiers$1.text, [literal(this.allocateDataSlot()), literal(text.value)]); } } }, { key: "visitIcu", value: function visitIcu(icu) { var _this195 = this; var initWasInvoked = false; // if an ICU was created outside of i18n block, we still treat // it as a translatable entity and invoke i18nStart and i18nEnd // to generate i18n context and the necessary instructions if (!this.i18n) { initWasInvoked = true; this.i18nStart(null, icu.i18n, true); } var i18n = this.i18n; var vars = this.i18nBindProps(icu.vars); var placeholders = this.i18nBindProps(icu.placeholders); // output ICU directly and keep ICU reference in context var message = icu.i18n; // we always need post-processing function for ICUs, to make sure that: // - all placeholders in a form of {PLACEHOLDER} are replaced with actual values (note: // `goog.getMsg` does not process ICUs and uses the `{PLACEHOLDER}` format for placeholders // inside ICUs) // - all ICU vars (such as `VAR_SELECT` or `VAR_PLURAL`) are replaced with correct values var transformFn = function transformFn(raw) { var params = Object.assign({}, vars, placeholders); var formatted = _this195.i18nFormatPlaceholderNames(params, /* useCamelCase */ false); return instruction(null, Identifiers$1.i18nPostprocess, [raw, mapLiteral(formatted, true)]); }; // in case the whole i18n message is a single ICU - we do not need to // create a separate top-level translation, we can use the root ref instead // and make this ICU a top-level translation // note: ICU placeholders are replaced with actual values in `i18nPostprocess` function // separately, so we do not pass placeholders into `i18nTranslate` function. if (isSingleI18nIcu(i18n.meta)) { this.i18nTranslate(message, /* placeholders */ {}, i18n.ref, transformFn); } else { // output ICU directly and keep ICU reference in context var ref = this.i18nTranslate(message, /* placeholders */ {}, /* ref */ undefined, transformFn); i18n.appendIcu(icuFromI18nMessage(message).name, ref); } if (initWasInvoked) { this.i18nEnd(null, true); } return null; } }, { key: "allocateDataSlot", value: function allocateDataSlot() { return this._dataIndex++; } }, { key: "getConstCount", value: function getConstCount() { return this._dataIndex; } }, { key: "getVarCount", value: function getVarCount() { return this._pureFunctionSlots; } }, { key: "getNgContentSelectors", value: function getNgContentSelectors() { return this._ngContentReservedSlots.length ? this.constantPool.getConstLiteral(asLiteral(this._ngContentReservedSlots), true) : null; } }, { key: "bindingContext", value: function bindingContext() { return "".concat(this._bindingContext++); } }, { key: "templatePropertyBindings", value: function templatePropertyBindings(templateIndex, attrs) { var _this196 = this; var propertyBindings = []; attrs.forEach(function (input) { if (input instanceof BoundAttribute) { var _value7 = input.value.visit(_this196._valueConverter); if (_value7 !== undefined) { _this196.allocateBindingSlots(_value7); propertyBindings.push({ name: input.name, sourceSpan: input.sourceSpan, value: function value() { return _this196.convertPropertyBinding(_value7); } }); } } }); if (propertyBindings.length > 0) { this.updateInstructionChain(templateIndex, Identifiers$1.property, propertyBindings); } } // Bindings must only be resolved after all local refs have been visited, so all // instructions are queued in callbacks that execute once the initial pass has completed. // Otherwise, we wouldn't be able to support local refs that are defined after their // bindings. e.g. {{ foo }} <div #foo></div> }, { key: "instructionFn", value: function instructionFn(fns, span, reference, paramsOrFn) { var prepend = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; fns[prepend ? 'unshift' : 'push'](function () { var params = Array.isArray(paramsOrFn) ? paramsOrFn : paramsOrFn(); return instruction(span, reference, params).toStmt(); }); } }, { key: "processStylingInstruction", value: function processStylingInstruction(elementIndex, instruction, createMode) { var _this197 = this; if (instruction) { if (createMode) { this.creationInstruction(instruction.sourceSpan, instruction.reference, function () { return instruction.params(function (value) { return _this197.convertPropertyBinding(value); }); }); } else { this.updateInstruction(elementIndex, instruction.sourceSpan, instruction.reference, function () { return instruction.params(function (value) { return instruction.supportsInterpolation && value instanceof Interpolation ? _this197.getUpdateInstructionArguments(value) : _this197.convertPropertyBinding(value); }); }); } } } }, { key: "creationInstruction", value: function creationInstruction(span, reference, paramsOrFn, prepend) { this.instructionFn(this._creationCodeFns, span, reference, paramsOrFn || [], prepend); } }, { key: "updateInstruction", value: function updateInstruction(nodeIndex, span, reference, paramsOrFn) { this.addSelectInstructionIfNecessary(nodeIndex, span); this.instructionFn(this._updateCodeFns, span, reference, paramsOrFn || []); } }, { key: "updateInstructionChain", value: function updateInstructionChain(nodeIndex, reference, bindings) { var span = bindings.length ? bindings[0].sourceSpan : null; this.addSelectInstructionIfNecessary(nodeIndex, span); this._updateCodeFns.push(function () { var calls = bindings.map(function (property) { var fnParams = [property.value()].concat(_toConsumableArray(property.params || [])); if (property.name) { fnParams.unshift(literal(property.name)); } return fnParams; }); return chainedInstruction(reference, calls, span).toStmt(); }); } }, { key: "addSelectInstructionIfNecessary", value: function addSelectInstructionIfNecessary(nodeIndex, span) { if (this._lastNodeIndexWithFlush < nodeIndex) { if (nodeIndex > 0) { this.instructionFn(this._updateCodeFns, span, Identifiers$1.select, [literal(nodeIndex)]); } this._lastNodeIndexWithFlush = nodeIndex; } } }, { key: "allocatePureFunctionSlots", value: function allocatePureFunctionSlots(numSlots) { var originalSlots = this._pureFunctionSlots; this._pureFunctionSlots += numSlots; return originalSlots; } }, { key: "allocateBindingSlots", value: function allocateBindingSlots(value) { this._bindingSlots += value instanceof Interpolation ? value.expressions.length : 1; } /** * Gets an expression that refers to the implicit receiver. The implicit * receiver is always the root level context. */ }, { key: "getImplicitReceiverExpr", value: function getImplicitReceiverExpr() { if (this._implicitReceiverExpr) { return this._implicitReceiverExpr; } return this._implicitReceiverExpr = this.level === 0 ? variable(CONTEXT_NAME) : this._bindingScope.getOrCreateSharedContextVar(0); } }, { key: "convertExpressionBinding", value: function convertExpressionBinding(value) { var convertedPropertyBinding = _convertPropertyBinding(this, this.getImplicitReceiverExpr(), value, this.bindingContext(), BindingForm.TrySimple); return convertedPropertyBinding.currValExpr; } }, { key: "convertPropertyBinding", value: function convertPropertyBinding(value) { var _this$_tempVariables; var convertedPropertyBinding = _convertPropertyBinding(this, this.getImplicitReceiverExpr(), value, this.bindingContext(), BindingForm.TrySimple, function () { return error('Unexpected interpolation'); }); var valExpr = convertedPropertyBinding.currValExpr; (_this$_tempVariables = this._tempVariables).push.apply(_this$_tempVariables, _toConsumableArray(convertedPropertyBinding.stmts)); return valExpr; } /** * Gets a list of argument expressions to pass to an update instruction expression. Also updates * the temp variables state with temp variables that were identified as needing to be created * while visiting the arguments. * @param value The original expression we will be resolving an arguments list from. */ }, { key: "getUpdateInstructionArguments", value: function getUpdateInstructionArguments(value) { var _this$_tempVariables2; var _convertUpdateArgumen = convertUpdateArguments(this, this.getImplicitReceiverExpr(), value, this.bindingContext()), args = _convertUpdateArgumen.args, stmts = _convertUpdateArgumen.stmts; (_this$_tempVariables2 = this._tempVariables).push.apply(_this$_tempVariables2, _toConsumableArray(stmts)); return args; } }, { key: "matchDirectives", value: function matchDirectives(tagName, elOrTpl) { var _this198 = this; if (this.directiveMatcher) { var selector = createCssSelector(tagName, getAttrsForDirectiveMatching(elOrTpl)); this.directiveMatcher.match(selector, function (cssSelector, staticType) { _this198.directives.add(staticType); }); } } /** * Prepares all attribute expression values for the `TAttributes` array. * * The purpose of this function is to properly construct an attributes array that * is passed into the `elementStart` (or just `element`) functions. Because there * are many different types of attributes, the array needs to be constructed in a * special way so that `elementStart` can properly evaluate them. * * The format looks like this: * * ``` * attrs = [prop, value, prop2, value2, * CLASSES, class1, class2, * STYLES, style1, value1, style2, value2, * BINDINGS, name1, name2, name3, * TEMPLATE, name4, name5, name6, * I18N, name7, name8, ...] * ``` * * Note that this function will fully ignore all synthetic (@foo) attribute values * because those values are intended to always be generated as property instructions. */ }, { key: "prepareNonRenderAttrs", value: function prepareNonRenderAttrs(inputs, outputs, styles) { var templateAttrs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; var i18nAttrs = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : []; var alreadySeen = new Set(); var attrExprs = []; function addAttrExpr(key, value) { if (typeof key === 'string') { if (!alreadySeen.has(key)) { attrExprs.push.apply(attrExprs, _toConsumableArray(getAttributeNameLiterals(key))); value !== undefined && attrExprs.push(value); alreadySeen.add(key); } } else { attrExprs.push(literal(key)); } } // it's important that this occurs before BINDINGS and TEMPLATE because once `elementStart` // comes across the BINDINGS or TEMPLATE markers then it will continue reading each value as // as single property value cell by cell. if (styles) { styles.populateInitialStylingAttrs(attrExprs); } if (inputs.length || outputs.length) { var attrsLengthBeforeInputs = attrExprs.length; for (var i = 0; i < inputs.length; i++) { var input = inputs[i]; // We don't want the animation and attribute bindings in the // attributes array since they aren't used for directive matching. if (input.type !== 4 /* Animation */ && input.type !== 1 /* Attribute */ ) { addAttrExpr(input.name); } } for (var _i11 = 0; _i11 < outputs.length; _i11++) { var output = outputs[_i11]; if (output.type !== 1 /* Animation */ ) { addAttrExpr(output.name); } } // this is a cheap way of adding the marker only after all the input/output // values have been filtered (by not including the animation ones) and added // to the expressions. The marker is important because it tells the runtime // code that this is where attributes without values start... if (attrExprs.length !== attrsLengthBeforeInputs) { attrExprs.splice(attrsLengthBeforeInputs, 0, literal(3 /* Bindings */ )); } } if (templateAttrs.length) { attrExprs.push(literal(4 /* Template */ )); templateAttrs.forEach(function (attr) { return addAttrExpr(attr.name); }); } if (i18nAttrs.length) { attrExprs.push(literal(6 /* I18n */ )); i18nAttrs.forEach(function (attr) { return addAttrExpr(attr.name); }); } return attrExprs; } }, { key: "toAttrsParam", value: function toAttrsParam(attrsExprs) { return attrsExprs.length > 0 ? this.constantPool.getConstLiteral(literalArr(attrsExprs), true) : TYPED_NULL_EXPR; } }, { key: "prepareRefsParameter", value: function prepareRefsParameter(references) { var _this199 = this; if (!references || references.length === 0) { return TYPED_NULL_EXPR; } var refsParam = flatten(references.map(function (reference) { var slot = _this199.allocateDataSlot(); // Generate the update temporary. var variableName = _this199._bindingScope.freshReferenceName(); var retrievalLevel = _this199.level; var lhs = variable(variableName); _this199._bindingScope.set(retrievalLevel, reference.name, lhs, 0 /* DEFAULT */ , function (scope, relativeLevel) { // e.g. nextContext(2); var nextContextStmt = relativeLevel > 0 ? [generateNextContextExpr(relativeLevel).toStmt()] : []; // e.g. const $foo$ = reference(1); var refExpr = lhs.set(importExpr(Identifiers$1.reference).callFn([literal(slot)])); return nextContextStmt.concat(refExpr.toConstDecl()); }, true); return [reference.name, reference.value]; })); return this.constantPool.getConstLiteral(asLiteral(refsParam), true); } }, { key: "prepareListenerParameter", value: function prepareListenerParameter(tagName, outputAst, index) { var _this200 = this; return function () { var eventName = outputAst.name; var bindingFnName = outputAst.type === 1 /* Animation */ ? // synthetic @listener.foo values are treated the exact same as are standard listeners prepareSyntheticListenerFunctionName(eventName, outputAst.phase) : sanitizeIdentifier(eventName); var handlerName = "".concat(_this200.templateName, "_").concat(tagName, "_").concat(bindingFnName, "_").concat(index, "_listener"); var scope = _this200._bindingScope.nestedScope(_this200._bindingScope.bindingLevel); return prepareEventListenerParameters(outputAst, handlerName, scope); }; } }]); return TemplateDefinitionBuilder; }(); var ValueConverter = /*#__PURE__*/function (_AstMemoryEfficientTr) { _inherits(ValueConverter, _AstMemoryEfficientTr); var _super93 = _createSuper(ValueConverter); function ValueConverter(constantPool, allocateSlot, allocatePureFunctionSlots, definePipe) { var _this201; _classCallCheck(this, ValueConverter); _this201 = _super93.call(this); _this201.constantPool = constantPool; _this201.allocateSlot = allocateSlot; _this201.allocatePureFunctionSlots = allocatePureFunctionSlots; _this201.definePipe = definePipe; _this201._pipeBindExprs = []; return _this201; } // AstMemoryEfficientTransformer _createClass2(ValueConverter, [{ key: "visitPipe", value: function visitPipe(pipe, context) { // Allocate a slot to create the pipe var slot = this.allocateSlot(); var slotPseudoLocal = "PIPE:".concat(slot); // Allocate one slot for the result plus one slot per pipe argument var pureFunctionSlot = this.allocatePureFunctionSlots(2 + pipe.args.length); var target = new PropertyRead(pipe.span, new ImplicitReceiver(pipe.span), slotPseudoLocal); var _pipeBindingCallInfo = pipeBindingCallInfo(pipe.args), identifier = _pipeBindingCallInfo.identifier, isVarLength = _pipeBindingCallInfo.isVarLength; this.definePipe(pipe.name, slotPseudoLocal, slot, importExpr(identifier)); var args = [pipe.exp].concat(_toConsumableArray(pipe.args)); var convertedArgs = isVarLength ? this.visitAll([new LiteralArray(pipe.span, args)]) : this.visitAll(args); var pipeBindExpr = new FunctionCall(pipe.span, target, [new LiteralPrimitive(pipe.span, slot), new LiteralPrimitive(pipe.span, pureFunctionSlot)].concat(_toConsumableArray(convertedArgs))); this._pipeBindExprs.push(pipeBindExpr); return pipeBindExpr; } }, { key: "updatePipeSlotOffsets", value: function updatePipeSlotOffsets(bindingSlots) { this._pipeBindExprs.forEach(function (pipe) { // update the slot offset arg (index 1) to account for binding slots var slotOffset = pipe.args[1]; slotOffset.value += bindingSlots; }); } }, { key: "visitLiteralArray", value: function visitLiteralArray(array, context) { var _this202 = this; return new BuiltinFunctionCall(array.span, this.visitAll(array.expressions), function (values) { // If the literal has calculated (non-literal) elements transform it into // calls to literal factories that compose the literal and will cache intermediate // values. Otherwise, just return an literal array that contains the values. var literal = literalArr(values); return values.every(function (a) { return a.isConstant(); }) ? _this202.constantPool.getConstLiteral(literal, true) : getLiteralFactory(_this202.constantPool, literal, _this202.allocatePureFunctionSlots); }); } }, { key: "visitLiteralMap", value: function visitLiteralMap(map, context) { var _this203 = this; return new BuiltinFunctionCall(map.span, this.visitAll(map.values), function (values) { // If the literal has calculated (non-literal) elements transform it into // calls to literal factories that compose the literal and will cache intermediate // values. Otherwise, just return an literal array that contains the values. var literal = literalMap(values.map(function (value, index) { return { key: map.keys[index].key, value: value, quoted: map.keys[index].quoted }; })); return values.every(function (a) { return a.isConstant(); }) ? _this203.constantPool.getConstLiteral(literal, true) : getLiteralFactory(_this203.constantPool, literal, _this203.allocatePureFunctionSlots); }); } }]); return ValueConverter; }(AstMemoryEfficientTransformer); // Pipes always have at least one parameter, the value they operate on var pipeBindingIdentifiers = [Identifiers$1.pipeBind1, Identifiers$1.pipeBind2, Identifiers$1.pipeBind3, Identifiers$1.pipeBind4]; function pipeBindingCallInfo(args) { var identifier = pipeBindingIdentifiers[args.length]; return { identifier: identifier || Identifiers$1.pipeBindV, isVarLength: !identifier }; } var pureFunctionIdentifiers = [Identifiers$1.pureFunction0, Identifiers$1.pureFunction1, Identifiers$1.pureFunction2, Identifiers$1.pureFunction3, Identifiers$1.pureFunction4, Identifiers$1.pureFunction5, Identifiers$1.pureFunction6, Identifiers$1.pureFunction7, Identifiers$1.pureFunction8]; function pureFunctionCallInfo(args) { var identifier = pureFunctionIdentifiers[args.length]; return { identifier: identifier || Identifiers$1.pureFunctionV, isVarLength: !identifier }; } function instruction(span, reference, params) { return importExpr(reference, null, span).callFn(params, span); } // e.g. x(2); function generateNextContextExpr(relativeLevelDiff) { return importExpr(Identifiers$1.nextContext).callFn(relativeLevelDiff > 1 ? [literal(relativeLevelDiff)] : []); } function getLiteralFactory(constantPool, literal$1, allocateSlots) { var _constantPool$getLite = constantPool.getLiteralFactory(literal$1), literalFactory = _constantPool$getLite.literalFactory, literalFactoryArguments = _constantPool$getLite.literalFactoryArguments; // Allocate 1 slot for the result plus 1 per argument var startSlot = allocateSlots(1 + literalFactoryArguments.length); literalFactoryArguments.length > 0 || error("Expected arguments to a literal factory function"); var _pureFunctionCallInfo = pureFunctionCallInfo(literalFactoryArguments), identifier = _pureFunctionCallInfo.identifier, isVarLength = _pureFunctionCallInfo.isVarLength; // Literal factories are pure functions that only need to be re-invoked when the parameters // change. var args = [literal(startSlot), literalFactory]; if (isVarLength) { args.push(literalArr(literalFactoryArguments)); } else { args.push.apply(args, _toConsumableArray(literalFactoryArguments)); } return importExpr(identifier).callFn(args); } /** * Gets an array of literals that can be added to an expression * to represent the name and namespace of an attribute. E.g. * `:xlink:href` turns into `[AttributeMarker.NamespaceURI, 'xlink', 'href']`. * * @param name Name of the attribute, including the namespace. */ function getAttributeNameLiterals(name) { var _splitNsName5 = splitNsName(name), _splitNsName6 = _slicedToArray(_splitNsName5, 2), attributeNamespace = _splitNsName6[0], attributeName = _splitNsName6[1]; var nameLiteral = literal(attributeName); if (attributeNamespace) { return [literal(0 /* NamespaceURI */ ), literal(attributeNamespace), nameLiteral]; } return [nameLiteral]; } /** The prefix used to get a shared context in BindingScope's map. */ var SHARED_CONTEXT_KEY = '$$shared_ctx$$'; var BindingScope = /*#__PURE__*/function () { function BindingScope() { var bindingLevel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; _classCallCheck(this, BindingScope); this.bindingLevel = bindingLevel; this.parent = parent; /** Keeps a map from local variables to their BindingData. */ this.map = new Map(); this.referenceNameIndex = 0; this.restoreViewVariable = null; } _createClass2(BindingScope, [{ key: "get", value: function get(name) { var current = this; while (current) { var value = current.map.get(name); if (value != null) { if (current !== this) { // make a local copy and reset the `declare` state value = { retrievalLevel: value.retrievalLevel, lhs: value.lhs, declareLocalCallback: value.declareLocalCallback, declare: false, priority: value.priority, localRef: value.localRef }; // Cache the value locally. this.map.set(name, value); // Possibly generate a shared context var this.maybeGenerateSharedContextVar(value); this.maybeRestoreView(value.retrievalLevel, value.localRef); } if (value.declareLocalCallback && !value.declare) { value.declare = true; } return value.lhs; } current = current.parent; } // If we get to this point, we are looking for a property on the top level component // - If level === 0, we are on the top and don't need to re-declare `ctx`. // - If level > 0, we are in an embedded view. We need to retrieve the name of the // local var we used to store the component context, e.g. const $comp$ = x(); return this.bindingLevel === 0 ? null : this.getComponentProperty(name); } /** * Create a local variable for later reference. * * @param retrievalLevel The level from which this value can be retrieved * @param name Name of the variable. * @param lhs AST representing the left hand side of the `let lhs = rhs;`. * @param priority The sorting priority of this var * @param declareLocalCallback The callback to invoke when declaring this local var * @param localRef Whether or not this is a local ref */ }, { key: "set", value: function set(retrievalLevel, name, lhs) { var priority = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; var /* DEFAULT */ declareLocalCallback = arguments.length > 4 ? arguments[4] : undefined; var localRef = arguments.length > 5 ? arguments[5] : undefined; if (this.map.has(name)) { if (localRef) { // Do not throw an error if it's a local ref and do not update existing value, // so the first defined ref is always returned. return this; } error("The name ".concat(name, " is already defined in scope to be ").concat(this.map.get(name))); } this.map.set(name, { retrievalLevel: retrievalLevel, lhs: lhs, declare: false, declareLocalCallback: declareLocalCallback, priority: priority, localRef: localRef || false }); return this; } // Implemented as part of LocalResolver. }, { key: "getLocal", value: function getLocal(name) { return this.get(name); } // Implemented as part of LocalResolver. }, { key: "notifyImplicitReceiverUse", value: function notifyImplicitReceiverUse() { if (this.bindingLevel !== 0) { // Since the implicit receiver is accessed in an embedded view, we need to // ensure that we declare a shared context variable for the current template // in the update variables. this.map.get(SHARED_CONTEXT_KEY + 0).declare = true; } } }, { key: "nestedScope", value: function nestedScope(level) { var newScope = new BindingScope(level, this); if (level > 0) newScope.generateSharedContextVar(0); return newScope; } /** * Gets or creates a shared context variable and returns its expression. Note that * this does not mean that the shared variable will be declared. Variables in the * binding scope will be only declared if they are used. */ }, { key: "getOrCreateSharedContextVar", value: function getOrCreateSharedContextVar(retrievalLevel) { var bindingKey = SHARED_CONTEXT_KEY + retrievalLevel; if (!this.map.has(bindingKey)) { this.generateSharedContextVar(retrievalLevel); } // Shared context variables are always generated as "ReadVarExpr". return this.map.get(bindingKey).lhs; } }, { key: "getSharedContextName", value: function getSharedContextName(retrievalLevel) { var sharedCtxObj = this.map.get(SHARED_CONTEXT_KEY + retrievalLevel); // Shared context variables are always generated as "ReadVarExpr". return sharedCtxObj && sharedCtxObj.declare ? sharedCtxObj.lhs : null; } }, { key: "maybeGenerateSharedContextVar", value: function maybeGenerateSharedContextVar(value) { if (value.priority === 1 /* CONTEXT */ && value.retrievalLevel < this.bindingLevel) { var sharedCtxObj = this.map.get(SHARED_CONTEXT_KEY + value.retrievalLevel); if (sharedCtxObj) { sharedCtxObj.declare = true; } else { this.generateSharedContextVar(value.retrievalLevel); } } } }, { key: "generateSharedContextVar", value: function generateSharedContextVar(retrievalLevel) { var lhs = variable(CONTEXT_NAME + this.freshReferenceName()); this.map.set(SHARED_CONTEXT_KEY + retrievalLevel, { retrievalLevel: retrievalLevel, lhs: lhs, declareLocalCallback: function declareLocalCallback(scope, relativeLevel) { // const ctx_r0 = nextContext(2); return [lhs.set(generateNextContextExpr(relativeLevel)).toConstDecl()]; }, declare: false, priority: 2 /* SHARED_CONTEXT */ , localRef: false }); } }, { key: "getComponentProperty", value: function getComponentProperty(name) { var componentValue = this.map.get(SHARED_CONTEXT_KEY + 0); componentValue.declare = true; this.maybeRestoreView(0, false); return componentValue.lhs.prop(name); } }, { key: "maybeRestoreView", value: function maybeRestoreView(retrievalLevel, localRefLookup) { // We want to restore the current view in listener fns if: // 1 - we are accessing a value in a parent view, which requires walking the view tree rather // than using the ctx arg. In this case, the retrieval and binding level will be different. // 2 - we are looking up a local ref, which requires restoring the view where the local // ref is stored if (this.isListenerScope() && (retrievalLevel < this.bindingLevel || localRefLookup)) { if (!this.parent.restoreViewVariable) { // parent saves variable to generate a shared `const $s$ = getCurrentView();` instruction this.parent.restoreViewVariable = variable(this.parent.freshReferenceName()); } this.restoreViewVariable = this.parent.restoreViewVariable; } } }, { key: "restoreViewStatement", value: function restoreViewStatement() { // restoreView($state$); return this.restoreViewVariable ? [instruction(null, Identifiers$1.restoreView, [this.restoreViewVariable]).toStmt()] : []; } }, { key: "viewSnapshotStatements", value: function viewSnapshotStatements() { // const $state$ = getCurrentView(); var getCurrentViewInstruction = instruction(null, Identifiers$1.getCurrentView, []); return this.restoreViewVariable ? [this.restoreViewVariable.set(getCurrentViewInstruction).toConstDecl()] : []; } }, { key: "isListenerScope", value: function isListenerScope() { return this.parent && this.parent.bindingLevel === this.bindingLevel; } }, { key: "variableDeclarations", value: function variableDeclarations() { var _this204 = this; var currentContextLevel = 0; return Array.from(this.map.values()).filter(function (value) { return value.declare; }).sort(function (a, b) { return b.retrievalLevel - a.retrievalLevel || b.priority - a.priority; }).reduce(function (stmts, value) { var levelDiff = _this204.bindingLevel - value.retrievalLevel; var currStmts = value.declareLocalCallback(_this204, levelDiff - currentContextLevel); currentContextLevel = levelDiff; return stmts.concat(currStmts); }, []); } }, { key: "freshReferenceName", value: function freshReferenceName() { var current = this; // Find the top scope as it maintains the global reference count while (current.parent) { current = current.parent; } var ref = "".concat(REFERENCE_PREFIX).concat(current.referenceNameIndex++); return ref; } }], [{ key: "ROOT_SCOPE", get: function get() { if (!BindingScope._ROOT_SCOPE) { BindingScope._ROOT_SCOPE = new BindingScope().set(0, '$event', variable('$event')); } return BindingScope._ROOT_SCOPE; } }]); return BindingScope; }(); /** * Creates a `CssSelector` given a tag name and a map of attributes */ function createCssSelector(tag, attributes) { var cssSelector = new CssSelector(); cssSelector.setElement(tag); Object.getOwnPropertyNames(attributes).forEach(function (name) { var value = attributes[name]; cssSelector.addAttribute(name, value); if (name.toLowerCase() === 'class') { var classes = value.trim().split(/\s+/); classes.forEach(function (className) { return cssSelector.addClassName(className); }); } }); return cssSelector; } /** * Creates an array of expressions out of an `ngProjectAs` attributes * which can be added to the instruction parameters. */ function getNgProjectAsLiteral(attribute) { // Parse the attribute value into a CssSelectorList. Note that we only take the // first selector, because we don't support multiple selectors in ngProjectAs. var parsedR3Selector = parseSelectorToR3Selector(attribute.value)[0]; return [literal(5 /* ProjectAs */ ), asLiteral(parsedR3Selector)]; } /** * Gets the instruction to generate for an interpolated property * @param interpolation An Interpolation AST */ function getPropertyInterpolationExpression(interpolation) { switch (getInterpolationArgsLength(interpolation)) { case 1: return Identifiers$1.propertyInterpolate; case 3: return Identifiers$1.propertyInterpolate1; case 5: return Identifiers$1.propertyInterpolate2; case 7: return Identifiers$1.propertyInterpolate3; case 9: return Identifiers$1.propertyInterpolate4; case 11: return Identifiers$1.propertyInterpolate5; case 13: return Identifiers$1.propertyInterpolate6; case 15: return Identifiers$1.propertyInterpolate7; case 17: return Identifiers$1.propertyInterpolate8; default: return Identifiers$1.propertyInterpolateV; } } /** * Gets the instruction to generate for an interpolated attribute * @param interpolation An Interpolation AST */ function getAttributeInterpolationExpression(interpolation) { switch (getInterpolationArgsLength(interpolation)) { case 3: return Identifiers$1.attributeInterpolate1; case 5: return Identifiers$1.attributeInterpolate2; case 7: return Identifiers$1.attributeInterpolate3; case 9: return Identifiers$1.attributeInterpolate4; case 11: return Identifiers$1.attributeInterpolate5; case 13: return Identifiers$1.attributeInterpolate6; case 15: return Identifiers$1.attributeInterpolate7; case 17: return Identifiers$1.attributeInterpolate8; default: return Identifiers$1.attributeInterpolateV; } } /** * Gets the instruction to generate for interpolated text. * @param interpolation An Interpolation AST */ function getTextInterpolationExpression(interpolation) { switch (getInterpolationArgsLength(interpolation)) { case 1: return Identifiers$1.textInterpolate; case 3: return Identifiers$1.textInterpolate1; case 5: return Identifiers$1.textInterpolate2; case 7: return Identifiers$1.textInterpolate3; case 9: return Identifiers$1.textInterpolate4; case 11: return Identifiers$1.textInterpolate5; case 13: return Identifiers$1.textInterpolate6; case 15: return Identifiers$1.textInterpolate7; case 17: return Identifiers$1.textInterpolate8; default: return Identifiers$1.textInterpolateV; } } /** * Parse a template into render3 `Node`s and additional metadata, with no other dependencies. * * @param template text of the template to parse * @param templateUrl URL to use for source mapping of the parsed template * @param options options to modify how the template is parsed */ function parseTemplate(template, templateUrl) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var interpolationConfig = options.interpolationConfig, preserveWhitespaces = options.preserveWhitespaces; var bindingParser = makeBindingParser(interpolationConfig); var htmlParser = new HtmlParser(); var parseResult = htmlParser.parse(template, templateUrl, Object.assign({ leadingTriviaChars: LEADING_TRIVIA_CHARS }, options, { tokenizeExpansionForms: true })); if (parseResult.errors && parseResult.errors.length > 0) { return { errors: parseResult.errors, nodes: [], styleUrls: [], styles: [] }; } var rootNodes = parseResult.rootNodes; // process i18n meta information (scan attributes, generate ids) // before we run whitespace removal process, because existing i18n // extraction process (ng xi18n) relies on a raw content to generate // message ids rootNodes = visitAll$1(new I18nMetaVisitor(interpolationConfig, !preserveWhitespaces), rootNodes); if (!preserveWhitespaces) { rootNodes = visitAll$1(new WhitespaceVisitor(), rootNodes); // run i18n meta visitor again in case we remove whitespaces, because // that might affect generated i18n message content. During this pass // i18n IDs generated at the first pass will be preserved, so we can mimic // existing extraction process (ng xi18n) rootNodes = visitAll$1(new I18nMetaVisitor(interpolationConfig, /* keepI18nAttrs */ false), rootNodes); } var _htmlAstToRender3Ast = htmlAstToRender3Ast(rootNodes, bindingParser), nodes = _htmlAstToRender3Ast.nodes, errors = _htmlAstToRender3Ast.errors, styleUrls = _htmlAstToRender3Ast.styleUrls, styles = _htmlAstToRender3Ast.styles; if (errors && errors.length > 0) { return { errors: errors, nodes: [], styleUrls: [], styles: [] }; } return { nodes: nodes, styleUrls: styleUrls, styles: styles }; } /** * Construct a `BindingParser` with a default configuration. */ function makeBindingParser() { var interpolationConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_INTERPOLATION_CONFIG; return new BindingParser(new Parser$1(new Lexer()), interpolationConfig, new DomElementSchemaRegistry(), null, []); } function resolveSanitizationFn(context, isAttribute) { switch (context) { case SecurityContext.HTML: return importExpr(Identifiers$1.sanitizeHtml); case SecurityContext.SCRIPT: return importExpr(Identifiers$1.sanitizeScript); case SecurityContext.STYLE: // the compiler does not fill in an instruction for [style.prop?] binding // values because the style algorithm knows internally what props are subject // to sanitization (only [attr.style] values are explicitly sanitized) return isAttribute ? importExpr(Identifiers$1.sanitizeStyle) : null; case SecurityContext.URL: return importExpr(Identifiers$1.sanitizeUrl); case SecurityContext.RESOURCE_URL: return importExpr(Identifiers$1.sanitizeResourceUrl); default: return null; } } function isSingleElementTemplate(children) { return children.length === 1 && children[0] instanceof Element; } function isTextNode(node) { return node instanceof Text || node instanceof BoundText || node instanceof Icu; } function hasTextChildrenOnly(children) { return children.every(isTextNode); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var EMPTY_ARRAY = []; // This regex matches any binding names that contain the "attr." prefix, e.g. "attr.required" // If there is a match, the first matching group will contain the attribute name to bind. var ATTR_REGEX = /attr\.([^\]]+)/; function getStylingPrefix(name) { return name.substring(0, 5); // style or class } function baseDirectiveFields(meta, constantPool, bindingParser) { var definitionMap = new DefinitionMap(); // e.g. `type: MyDirective` definitionMap.set('type', meta.type); // e.g. `selectors: [['', 'someDir', '']]` definitionMap.set('selectors', createDirectiveSelector(meta.selector)); // e.g. `factory: () => new MyApp(directiveInject(ElementRef))` var result = compileFactoryFunction({ name: meta.name, type: meta.type, deps: meta.deps, injectFn: Identifiers$1.directiveInject }); definitionMap.set('factory', result.factory); if (meta.queries.length > 0) { // e.g. `contentQueries: (rf, ctx, dirIndex) => { ... } definitionMap.set('contentQueries', createContentQueriesFunction(meta.queries, constantPool, meta.name)); } if (meta.viewQueries.length) { definitionMap.set('viewQuery', createViewQueriesFunction(meta.viewQueries, constantPool, meta.name)); } // e.g. `hostBindings: (rf, ctx, elIndex) => { ... } definitionMap.set('hostBindings', createHostBindingsFunction(meta.host, meta.typeSourceSpan, bindingParser, constantPool, meta.selector || '', meta.name)); // e.g 'inputs: {a: 'a'}` definitionMap.set('inputs', conditionallyCreateMapObjectLiteral(meta.inputs, true)); // e.g 'outputs: {a: 'a'}` definitionMap.set('outputs', conditionallyCreateMapObjectLiteral(meta.outputs)); if (meta.exportAs !== null) { definitionMap.set('exportAs', literalArr(meta.exportAs.map(function (e) { return literal(e); }))); } return { definitionMap: definitionMap, statements: result.statements }; } /** * Add features to the definition map. */ function addFeatures(definitionMap, meta) { // e.g. `features: [NgOnChangesFeature()]` var features = []; var providers = meta.providers; var viewProviders = meta.viewProviders; if (providers || viewProviders) { var args = [providers || new LiteralArrayExpr([])]; if (viewProviders) { args.push(viewProviders); } features.push(importExpr(Identifiers$1.ProvidersFeature).callFn(args)); } if (meta.usesInheritance) { features.push(importExpr(Identifiers$1.InheritDefinitionFeature)); } if (meta.lifecycle.usesOnChanges) { features.push(importExpr(Identifiers$1.NgOnChangesFeature).callFn(EMPTY_ARRAY)); } if (features.length) { definitionMap.set('features', literalArr(features)); } } /** * Compile a directive for the render3 runtime as defined by the `R3DirectiveMetadata`. */ function compileDirectiveFromMetadata(meta, constantPool, bindingParser) { var _baseDirectiveFields = baseDirectiveFields(meta, constantPool, bindingParser), definitionMap = _baseDirectiveFields.definitionMap, statements = _baseDirectiveFields.statements; addFeatures(definitionMap, meta); var expression = importExpr(Identifiers$1.defineDirective).callFn([definitionMap.toLiteralMap()]); if (!meta.selector) { throw new Error("Directive ".concat(meta.name, " has no selector, please add it!")); } var type = createTypeForDef(meta, Identifiers$1.DirectiveDefWithMeta); return { expression: expression, type: type, statements: statements }; } /** * Compile a base definition for the render3 runtime as defined by {@link R3BaseRefMetadata} * @param meta the metadata used for compilation. */ function compileBaseDefFromMetadata(meta, constantPool, bindingParser) { var definitionMap = new DefinitionMap(); if (meta.inputs) { var inputs = meta.inputs; var inputsMap = Object.keys(inputs).map(function (key) { var v = inputs[key]; var value = Array.isArray(v) ? literalArr(v.map(function (vx) { return literal(vx); })) : literal(v); return { key: key, value: value, quoted: false }; }); definitionMap.set('inputs', literalMap(inputsMap)); } if (meta.outputs) { var outputs = meta.outputs; var outputsMap = Object.keys(outputs).map(function (key) { var value = literal(outputs[key]); return { key: key, value: value, quoted: false }; }); definitionMap.set('outputs', literalMap(outputsMap)); } if (meta.viewQueries && meta.viewQueries.length > 0) { definitionMap.set('viewQuery', createViewQueriesFunction(meta.viewQueries, constantPool)); } if (meta.queries && meta.queries.length > 0) { definitionMap.set('contentQueries', createContentQueriesFunction(meta.queries, constantPool)); } if (meta.host) { definitionMap.set('hostBindings', createHostBindingsFunction(meta.host, meta.typeSourceSpan, bindingParser, constantPool, meta.name)); } var expression = importExpr(Identifiers$1.defineBase).callFn([definitionMap.toLiteralMap()]); var type = new ExpressionType(importExpr(Identifiers$1.BaseDef), /* modifiers */ null, [expressionType(meta.type)]); return { expression: expression, type: type }; } /** * Compile a component for the render3 runtime as defined by the `R3ComponentMetadata`. */ function compileComponentFromMetadata(meta, constantPool, bindingParser) { var _baseDirectiveFields2 = baseDirectiveFields(meta, constantPool, bindingParser), definitionMap = _baseDirectiveFields2.definitionMap, statements = _baseDirectiveFields2.statements; addFeatures(definitionMap, meta); var selector = meta.selector && CssSelector.parse(meta.selector); var firstSelector = selector && selector[0]; // e.g. `attr: ["class", ".my.app"]` // This is optional an only included if the first selector of a component specifies attributes. if (firstSelector) { var selectorAttributes = firstSelector.getAttrs(); if (selectorAttributes.length) { definitionMap.set('attrs', constantPool.getConstLiteral(literalArr(selectorAttributes.map(function (value) { return value != null ? literal(value) : literal(undefined); })), /* forceShared */ true)); } } // Generate the CSS matcher that recognize directive var directiveMatcher = null; if (meta.directives.length > 0) { var matcher = new SelectorMatcher(); var _iterator14 = _createForOfIteratorHelper(meta.directives), _step14; try { for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) { var _step14$value = _step14.value, _selector = _step14$value.selector, _expression = _step14$value.expression; matcher.addSelectables(CssSelector.parse(_selector), _expression); } } catch (err) { _iterator14.e(err); } finally { _iterator14.f(); } directiveMatcher = matcher; } // e.g. `template: function MyComponent_Template(_ctx, _cm) {...}` var templateTypeName = meta.name; var templateName = templateTypeName ? "".concat(templateTypeName, "_Template") : null; var directivesUsed = new Set(); var pipesUsed = new Set(); var changeDetection = meta.changeDetection; var template = meta.template; var templateBuilder = new TemplateDefinitionBuilder(constantPool, BindingScope.ROOT_SCOPE, 0, templateTypeName, null, null, templateName, directiveMatcher, directivesUsed, meta.pipes, pipesUsed, Identifiers$1.namespaceHTML, meta.relativeContextFilePath, meta.i18nUseExternalIds); var templateFunctionExpression = templateBuilder.buildTemplateFunction(template.nodes, []); // We need to provide this so that dynamically generated components know what // projected content blocks to pass through to the component when it is instantiated. var ngContentSelectors = templateBuilder.getNgContentSelectors(); if (ngContentSelectors) { definitionMap.set('ngContentSelectors', ngContentSelectors); } // e.g. `consts: 2` definitionMap.set('consts', literal(templateBuilder.getConstCount())); // e.g. `vars: 2` definitionMap.set('vars', literal(templateBuilder.getVarCount())); definitionMap.set('template', templateFunctionExpression); // e.g. `directives: [MyDirective]` if (directivesUsed.size) { var directivesExpr = literalArr(Array.from(directivesUsed)); if (meta.wrapDirectivesAndPipesInClosure) { directivesExpr = fn([], [new ReturnStatement(directivesExpr)]); } definitionMap.set('directives', directivesExpr); } // e.g. `pipes: [MyPipe]` if (pipesUsed.size) { var pipesExpr = literalArr(Array.from(pipesUsed)); if (meta.wrapDirectivesAndPipesInClosure) { pipesExpr = fn([], [new ReturnStatement(pipesExpr)]); } definitionMap.set('pipes', pipesExpr); } if (meta.encapsulation === null) { meta.encapsulation = ViewEncapsulation.Emulated; } // e.g. `styles: [str1, str2]` if (meta.styles && meta.styles.length) { var styleValues = meta.encapsulation == ViewEncapsulation.Emulated ? compileStyles(meta.styles, CONTENT_ATTR, HOST_ATTR) : meta.styles; var strings = styleValues.map(function (str) { return literal(str); }); definitionMap.set('styles', literalArr(strings)); } else if (meta.encapsulation === ViewEncapsulation.Emulated) { // If there is no style, don't generate css selectors on elements meta.encapsulation = ViewEncapsulation.None; } // Only set view encapsulation if it's not the default value if (meta.encapsulation !== ViewEncapsulation.Emulated) { definitionMap.set('encapsulation', literal(meta.encapsulation)); } // e.g. `animation: [trigger('123', [])]` if (meta.animations !== null) { definitionMap.set('data', literalMap([{ key: 'animation', value: meta.animations, quoted: false }])); } // Only set the change detection flag if it's defined and it's not the default. if (changeDetection != null && changeDetection !== ChangeDetectionStrategy.Default) { definitionMap.set('changeDetection', literal(changeDetection)); } // On the type side, remove newlines from the selector as it will need to fit into a TypeScript // string literal, which must be on one line. var selectorForType = (meta.selector || '').replace(/\n/g, ''); var expression = importExpr(Identifiers$1.defineComponent).callFn([definitionMap.toLiteralMap()]); var type = createTypeForDef(meta, Identifiers$1.ComponentDefWithMeta); return { expression: expression, type: type, statements: statements }; } /** * A wrapper around `compileDirective` which depends on render2 global analysis data as its input * instead of the `R3DirectiveMetadata`. * * `R3DirectiveMetadata` is computed from `CompileDirectiveMetadata` and other statically reflected * information. */ function compileDirectiveFromRender2(outputCtx, directive, reflector, bindingParser) { var name = identifierName(directive.type); name || error("Cannot resolver the name of ".concat(directive.type)); var definitionField = outputCtx.constantPool.propertyNameOf(1 /* Directive */ ); var meta = directiveMetadataFromGlobalMetadata(directive, outputCtx, reflector); var res = compileDirectiveFromMetadata(meta, outputCtx.constantPool, bindingParser); // Create the partial class to be merged with the actual class. outputCtx.statements.push(new ClassStmt(name, null, [new ClassField(definitionField, INFERRED_TYPE, [StmtModifier.Static], res.expression)], [], new ClassMethod(null, [], []), [])); } /** * A wrapper around `compileComponent` which depends on render2 global analysis data as its input * instead of the `R3DirectiveMetadata`. * * `R3ComponentMetadata` is computed from `CompileDirectiveMetadata` and other statically reflected * information. */ function compileComponentFromRender2(outputCtx, component, render3Ast, reflector, bindingParser, directiveTypeBySel, pipeTypeByName) { var name = identifierName(component.type); name || error("Cannot resolver the name of ".concat(component.type)); var definitionField = outputCtx.constantPool.propertyNameOf(2 /* Component */ ); var summary = component.toSummary(); // Compute the R3ComponentMetadata from the CompileDirectiveMetadata var meta = Object.assign({}, directiveMetadataFromGlobalMetadata(component, outputCtx, reflector), { selector: component.selector, template: { nodes: render3Ast.nodes }, directives: [], pipes: typeMapToExpressionMap(pipeTypeByName, outputCtx), viewQueries: queriesFromGlobalMetadata(component.viewQueries, outputCtx), wrapDirectivesAndPipesInClosure: false, styles: summary.template && summary.template.styles || EMPTY_ARRAY, encapsulation: summary.template && summary.template.encapsulation || ViewEncapsulation.Emulated, interpolation: DEFAULT_INTERPOLATION_CONFIG, animations: null, viewProviders: component.viewProviders.length > 0 ? new WrappedNodeExpr(component.viewProviders) : null, relativeContextFilePath: '', i18nUseExternalIds: true }); var res = compileComponentFromMetadata(meta, outputCtx.constantPool, bindingParser); // Create the partial class to be merged with the actual class. outputCtx.statements.push(new ClassStmt(name, null, [new ClassField(definitionField, INFERRED_TYPE, [StmtModifier.Static], res.expression)], [], new ClassMethod(null, [], []), [])); } /** * Compute `R3DirectiveMetadata` given `CompileDirectiveMetadata` and a `CompileReflector`. */ function directiveMetadataFromGlobalMetadata(directive, outputCtx, reflector) { // The global-analysis based Ivy mode in ngc is no longer utilized/supported. throw new Error('unsupported'); } /** * Convert `CompileQueryMetadata` into `R3QueryMetadata`. */ function queriesFromGlobalMetadata(queries, outputCtx) { return queries.map(function (query) { var read = null; if (query.read && query.read.identifier) { read = outputCtx.importExpr(query.read.identifier.reference); } return { propertyName: query.propertyName, first: query.first, predicate: selectorsFromGlobalMetadata(query.selectors, outputCtx), descendants: query.descendants, read: read, "static": !!query["static"] }; }); } /** * Convert `CompileTokenMetadata` for query selectors into either an expression for a predicate * type, or a list of string predicates. */ function selectorsFromGlobalMetadata(selectors, outputCtx) { if (selectors.length > 1 || selectors.length == 1 && selectors[0].value) { var selectorStrings = selectors.map(function (value) { return value.value; }); selectorStrings.some(function (value) { return !value; }) && error('Found a type among the string selectors expected'); return outputCtx.constantPool.getConstLiteral(literalArr(selectorStrings.map(function (value) { return literal(value); }))); } if (selectors.length == 1) { var first = selectors[0]; if (first.identifier) { return outputCtx.importExpr(first.identifier.reference); } } error('Unexpected query form'); return NULL_EXPR; } function prepareQueryParams(query, constantPool) { var parameters = [getQueryPredicate(query, constantPool), literal(query.descendants)]; if (query.read) { parameters.push(query.read); } return parameters; } // Turn a directive selector into an R3-compatible selector for directive def function createDirectiveSelector(selector) { return asLiteral(parseSelectorToR3Selector(selector)); } function convertAttributesToExpressions(attributes) { var values = []; var _iterator15 = _createForOfIteratorHelper(Object.getOwnPropertyNames(attributes)), _step15; try { for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) { var key = _step15.value; var value = attributes[key]; values.push(literal(key), value); } } catch (err) { _iterator15.e(err); } finally { _iterator15.f(); } return values; } // Define and update any content queries function createContentQueriesFunction(queries, constantPool, name) { var createStatements = []; var updateStatements = []; var tempAllocator = temporaryAllocator(updateStatements, TEMPORARY_NAME); var _iterator16 = _createForOfIteratorHelper(queries), _step16; try { for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) { var query = _step16.value; var queryInstruction = query["static"] ? Identifiers$1.staticContentQuery : Identifiers$1.contentQuery; // creation, e.g. r3.contentQuery(dirIndex, somePredicate, true, null); createStatements.push(importExpr(queryInstruction).callFn([variable('dirIndex')].concat(_toConsumableArray(prepareQueryParams(query, constantPool)))).toStmt()); // update, e.g. (r3.queryRefresh(tmp = r3.loadContentQuery()) && (ctx.someDir = tmp)); var temporary = tempAllocator(); var getQueryList = importExpr(Identifiers$1.loadContentQuery).callFn([]); var refresh = importExpr(Identifiers$1.queryRefresh).callFn([temporary.set(getQueryList)]); var updateDirective = variable(CONTEXT_NAME).prop(query.propertyName).set(query.first ? temporary.prop('first') : temporary); updateStatements.push(refresh.and(updateDirective).toStmt()); } } catch (err) { _iterator16.e(err); } finally { _iterator16.f(); } var contentQueriesFnName = name ? "".concat(name, "_ContentQueries") : null; return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null), new FnParam('dirIndex', null)], [renderFlagCheckIfStmt(1 /* Create */ , createStatements), renderFlagCheckIfStmt(2 /* Update */ , updateStatements)], INFERRED_TYPE, null, contentQueriesFnName); } function stringAsType(str) { return expressionType(literal(str)); } function stringMapAsType(map) { var mapValues = Object.keys(map).map(function (key) { var value = Array.isArray(map[key]) ? map[key][0] : map[key]; return { key: key, value: literal(value), quoted: true }; }); return expressionType(literalMap(mapValues)); } function stringArrayAsType(arr) { return arr.length > 0 ? expressionType(literalArr(arr.map(function (value) { return literal(value); }))) : NONE_TYPE; } function createTypeForDef(meta, typeBase) { // On the type side, remove newlines from the selector as it will need to fit into a TypeScript // string literal, which must be on one line. var selectorForType = (meta.selector || '').replace(/\n/g, ''); return expressionType(importExpr(typeBase, [typeWithParameters(meta.type, meta.typeArgumentCount), stringAsType(selectorForType), meta.exportAs !== null ? stringArrayAsType(meta.exportAs) : NONE_TYPE, stringMapAsType(meta.inputs), stringMapAsType(meta.outputs), stringArrayAsType(meta.queries.map(function (q) { return q.propertyName; }))])); } // Define and update any view queries function createViewQueriesFunction(viewQueries, constantPool, name) { var createStatements = []; var updateStatements = []; var tempAllocator = temporaryAllocator(updateStatements, TEMPORARY_NAME); viewQueries.forEach(function (query) { var queryInstruction = query["static"] ? Identifiers$1.staticViewQuery : Identifiers$1.viewQuery; // creation, e.g. r3.viewQuery(somePredicate, true); var queryDefinition = importExpr(queryInstruction).callFn(prepareQueryParams(query, constantPool)); createStatements.push(queryDefinition.toStmt()); // update, e.g. (r3.queryRefresh(tmp = r3.loadViewQuery()) && (ctx.someDir = tmp)); var temporary = tempAllocator(); var getQueryList = importExpr(Identifiers$1.loadViewQuery).callFn([]); var refresh = importExpr(Identifiers$1.queryRefresh).callFn([temporary.set(getQueryList)]); var updateDirective = variable(CONTEXT_NAME).prop(query.propertyName).set(query.first ? temporary.prop('first') : temporary); updateStatements.push(refresh.and(updateDirective).toStmt()); }); var viewQueryFnName = name ? "".concat(name, "_Query") : null; return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null)], [renderFlagCheckIfStmt(1 /* Create */ , createStatements), renderFlagCheckIfStmt(2 /* Update */ , updateStatements)], INFERRED_TYPE, null, viewQueryFnName); } // Return a host binding function or null if one is not necessary. function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindingParser, constantPool, selector, name) { // Initialize hostVarsCount to number of bound host properties (interpolations illegal) var hostVarsCount = Object.keys(hostBindingsMetadata.properties).length; var elVarExp = variable('elIndex'); var bindingContext = variable(CONTEXT_NAME); var styleBuilder = new StylingBuilder(elVarExp, bindingContext); var _hostBindingsMetadata = hostBindingsMetadata.specialAttributes, styleAttr = _hostBindingsMetadata.styleAttr, classAttr = _hostBindingsMetadata.classAttr; if (styleAttr !== undefined) { styleBuilder.registerStyleAttr(styleAttr); } if (classAttr !== undefined) { styleBuilder.registerClassAttr(classAttr); } var createStatements = []; var updateStatements = []; var totalHostVarsCount = hostVarsCount; var hostBindingSourceSpan = typeSourceSpan; var directiveSummary = metadataAsSummary(hostBindingsMetadata); var valueConverter; var getValueConverter = function getValueConverter() { if (!valueConverter) { var hostVarsCountFn = function hostVarsCountFn(numSlots) { var originalVarsCount = totalHostVarsCount; totalHostVarsCount += numSlots; return originalVarsCount; }; valueConverter = new ValueConverter(constantPool, function () { return error('Unexpected node'); }, // new nodes are illegal here hostVarsCountFn, function () { return error('Unexpected pipe'); }); // pipes are illegal here } return valueConverter; }; // Calculate host event bindings var eventBindings = bindingParser.createDirectiveHostEventAsts(directiveSummary, hostBindingSourceSpan); if (eventBindings && eventBindings.length) { var listeners = createHostListeners(eventBindings, name); createStatements.push.apply(createStatements, _toConsumableArray(listeners)); } // Calculate the host property bindings var bindings = bindingParser.createBoundHostProperties(directiveSummary, hostBindingSourceSpan); var propertyBindings = []; var attributeBindings = []; var syntheticHostBindings = []; bindings && bindings.forEach(function (binding) { var name = binding.name; var stylingInputWasSet = styleBuilder.registerInputBasedOnName(name, binding.expression, binding.sourceSpan); if (!stylingInputWasSet) { // resolve literal arrays and literal objects var value = binding.expression.visit(getValueConverter()); var bindingExpr = bindingFn(bindingContext, value); var _getBindingNameAndIns = getBindingNameAndInstruction(binding), bindingName = _getBindingNameAndIns.bindingName, _instruction2 = _getBindingNameAndIns.instruction, isAttribute = _getBindingNameAndIns.isAttribute; var securityContexts = bindingParser.calcPossibleSecurityContexts(selector, bindingName, isAttribute).filter(function (context) { return context !== SecurityContext.NONE; }); var sanitizerFn = null; if (securityContexts.length) { if (securityContexts.length === 2 && securityContexts.indexOf(SecurityContext.URL) > -1 && securityContexts.indexOf(SecurityContext.RESOURCE_URL) > -1) { // Special case for some URL attributes (such as "src" and "href") that may be a part // of different security contexts. In this case we use special santitization function and // select the actual sanitizer at runtime based on a tag name that is provided while // invoking sanitization function. sanitizerFn = importExpr(Identifiers$1.sanitizeUrlOrResourceUrl); } else { sanitizerFn = resolveSanitizationFn(securityContexts[0], isAttribute); } } var instructionParams = [literal(bindingName), bindingExpr.currValExpr]; if (sanitizerFn) { instructionParams.push(sanitizerFn); } updateStatements.push.apply(updateStatements, _toConsumableArray(bindingExpr.stmts)); if (_instruction2 === Identifiers$1.hostProperty) { propertyBindings.push(instructionParams); } else if (_instruction2 === Identifiers$1.attribute) { attributeBindings.push(instructionParams); } else if (_instruction2 === Identifiers$1.updateSyntheticHostBinding) { syntheticHostBindings.push(instructionParams); } else { updateStatements.push(importExpr(_instruction2).callFn(instructionParams).toStmt()); } } }); if (propertyBindings.length > 0) { updateStatements.push(chainedInstruction(Identifiers$1.hostProperty, propertyBindings).toStmt()); } if (attributeBindings.length > 0) { updateStatements.push(chainedInstruction(Identifiers$1.attribute, attributeBindings).toStmt()); } if (syntheticHostBindings.length > 0) { updateStatements.push(chainedInstruction(Identifiers$1.updateSyntheticHostBinding, syntheticHostBindings).toStmt()); } // since we're dealing with directives/components and both have hostBinding // functions, we need to generate a special hostAttrs instruction that deals // with both the assignment of styling as well as static attributes to the host // element. The instruction below will instruct all initial styling (styling // that is inside of a host binding within a directive/component) to be attached // to the host element alongside any of the provided host attributes that were // collected earlier. var hostAttrs = convertAttributesToExpressions(hostBindingsMetadata.attributes); var hostInstruction = styleBuilder.buildHostAttrsInstruction(null, hostAttrs, constantPool); if (hostInstruction) { createStatements.push(createStylingStmt(hostInstruction, bindingContext, bindingFn)); } if (styleBuilder.hasBindings) { // singular style/class bindings (things like `[style.prop]` and `[class.name]`) // MUST be registered on a given element within the component/directive // templateFn/hostBindingsFn functions. The instruction below will figure out // what all the bindings are and then generate the statements required to register // those bindings to the element via `styling`. var stylingInstruction = styleBuilder.buildStylingInstruction(null, constantPool); if (stylingInstruction) { createStatements.push(createStylingStmt(stylingInstruction, bindingContext, bindingFn)); } // finally each binding that was registered in the statement above will need to be added to // the update block of a component/directive templateFn/hostBindingsFn so that the bindings // are evaluated and updated for the element. styleBuilder.buildUpdateLevelInstructions(getValueConverter()).forEach(function (instruction) { // we subtract a value of `1` here because the binding slot was already // allocated at the top of this method when all the input bindings were // counted. totalHostVarsCount += Math.max(instruction.allocateBindingSlots - 1, 0); updateStatements.push(createStylingStmt(instruction, bindingContext, bindingFn)); }); } if (totalHostVarsCount) { createStatements.unshift(importExpr(Identifiers$1.allocHostVars).callFn([literal(totalHostVarsCount)]).toStmt()); } if (createStatements.length > 0 || updateStatements.length > 0) { var hostBindingsFnName = name ? "".concat(name, "_HostBindings") : null; var statements = []; if (createStatements.length > 0) { statements.push(renderFlagCheckIfStmt(1 /* Create */ , createStatements)); } if (updateStatements.length > 0) { statements.push(renderFlagCheckIfStmt(2 /* Update */ , updateStatements)); } return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null), new FnParam(elVarExp.name, NUMBER_TYPE)], statements, INFERRED_TYPE, null, hostBindingsFnName); } return null; } function bindingFn(implicit, value) { return _convertPropertyBinding(null, implicit, value, 'b', BindingForm.TrySimple, function () { return error('Unexpected interpolation'); }); } function createStylingStmt(instruction, bindingContext, bindingFn) { var params = instruction.params(function (value) { return bindingFn(bindingContext, value).currValExpr; }); return importExpr(instruction.reference, null, instruction.sourceSpan).callFn(params, instruction.sourceSpan).toStmt(); } function getBindingNameAndInstruction(binding) { var bindingName = binding.name; var instruction; // Check to see if this is an attr binding or a property binding var attrMatches = bindingName.match(ATTR_REGEX); if (attrMatches) { bindingName = attrMatches[1]; instruction = Identifiers$1.attribute; } else { if (binding.isAnimation) { bindingName = prepareSyntheticPropertyName(bindingName); // host bindings that have a synthetic property (e.g. @foo) should always be rendered // in the context of the component and not the parent. Therefore there is a special // compatibility instruction available for this purpose. instruction = Identifiers$1.updateSyntheticHostBinding; } else { instruction = Identifiers$1.hostProperty; } } return { bindingName: bindingName, instruction: instruction, isAttribute: !!attrMatches }; } function createHostListeners(eventBindings, name) { return eventBindings.map(function (binding) { var bindingName = binding.name && sanitizeIdentifier(binding.name); var bindingFnName = binding.type === 1 /* Animation */ ? prepareSyntheticListenerFunctionName(bindingName, binding.targetOrPhase) : bindingName; var handlerName = name && bindingName ? "".concat(name, "_").concat(bindingFnName, "_HostBindingHandler") : null; var params = prepareEventListenerParameters(BoundEvent.fromParsedEvent(binding), handlerName); var instruction = binding.type == 1 /* Animation */ ? Identifiers$1.componentHostSyntheticListener : Identifiers$1.listener; return importExpr(instruction).callFn(params).toStmt(); }); } function metadataAsSummary(meta) { // clang-format off return { // This is used by the BindingParser, which only deals with listeners and properties. There's no // need to pass attributes to it. hostAttributes: {}, hostListeners: meta.listeners, hostProperties: meta.properties }; // clang-format on } function typeMapToExpressionMap(map, outputCtx) { // Convert each map entry into another entry where the value is an expression importing the type. var entries = Array.from(map).map(function (_ref34) { var _ref35 = _slicedToArray(_ref34, 2), key = _ref35[0], type = _ref35[1]; return [key, outputCtx.importExpr(type)]; }); return new Map(entries); } var HOST_REG_EXP$1 = /^(?:\[([^\]]+)\])|(?:\(([^\)]+)\))$/; function parseHostBindings(host) { var attributes = {}; var listeners = {}; var properties = {}; var specialAttributes = {}; for (var _i12 = 0, _Object$keys3 = Object.keys(host); _i12 < _Object$keys3.length; _i12++) { var key = _Object$keys3[_i12]; var value = host[key]; var matches = key.match(HOST_REG_EXP$1); if (matches === null) { switch (key) { case 'class': if (typeof value !== 'string') { // TODO(alxhub): make this a diagnostic. throw new Error("Class binding must be string"); } specialAttributes.classAttr = value; break; case 'style': if (typeof value !== 'string') { // TODO(alxhub): make this a diagnostic. throw new Error("Style binding must be string"); } specialAttributes.styleAttr = value; break; default: if (typeof value === 'string') { attributes[key] = literal(value); } else { attributes[key] = value; } } } else if (matches[1 /* Binding */ ] != null) { if (typeof value !== 'string') { // TODO(alxhub): make this a diagnostic. throw new Error("Property binding must be string"); } // synthetic properties (the ones that have a `@` as a prefix) // are still treated the same as regular properties. Therefore // there is no point in storing them in a separate map. properties[matches[1 /* Binding */ ]] = value; } else if (matches[2 /* Event */ ] != null) { if (typeof value !== 'string') { // TODO(alxhub): make this a diagnostic. throw new Error("Event binding must be string"); } listeners[matches[2 /* Event */ ]] = value; } } return { attributes: attributes, listeners: listeners, properties: properties, specialAttributes: specialAttributes }; } /** * Verifies host bindings and returns the list of errors (if any). Empty array indicates that a * given set of host bindings has no errors. * * @param bindings set of host bindings to verify. * @param sourceSpan source span where host bindings were defined. * @returns array of errors associated with a given set of host bindings. */ function verifyHostBindings(bindings, sourceSpan) { var summary = metadataAsSummary(bindings); // TODO: abstract out host bindings verification logic and use it instead of // creating events and properties ASTs to detect errors (FW-996) var bindingParser = makeBindingParser(); bindingParser.createDirectiveHostEventAsts(summary, sourceSpan); bindingParser.createBoundHostProperties(summary, sourceSpan); return bindingParser.errors; } function compileStyles(styles, selector, hostSelector) { var shadowCss = new ShadowCss(); return styles.map(function (style) { return shadowCss.shimCssText(style, selector, hostSelector); }); } /** * @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 interface for retrieving documents by URL that the compiler uses * to load templates. */ var ResourceLoader = /*#__PURE__*/function () { function ResourceLoader() { _classCallCheck(this, ResourceLoader); } _createClass2(ResourceLoader, [{ key: "get", value: function get(url) { return ''; } }]); return ResourceLoader; }(); /** * @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 CompilerFacadeImpl = /*#__PURE__*/function () { function CompilerFacadeImpl() { var jitEvaluator = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new JitEvaluator(); _classCallCheck(this, CompilerFacadeImpl); this.jitEvaluator = jitEvaluator; this.R3ResolvedDependencyType = R3ResolvedDependencyType; this.ResourceLoader = ResourceLoader; this.elementSchemaRegistry = new DomElementSchemaRegistry(); } _createClass2(CompilerFacadeImpl, [{ key: "compilePipe", value: function compilePipe(angularCoreEnv, sourceMapUrl, facade) { var res = compilePipeFromMetadata({ name: facade.name, type: new WrappedNodeExpr(facade.type), typeArgumentCount: facade.typeArgumentCount, deps: convertR3DependencyMetadataArray(facade.deps), pipeName: facade.pipeName, pure: facade.pure }); return this.jitExpression(res.expression, angularCoreEnv, sourceMapUrl, res.statements); } }, { key: "compileInjectable", value: function compileInjectable(angularCoreEnv, sourceMapUrl, facade) { var _compileInjectable2 = _compileInjectable({ name: facade.name, type: new WrappedNodeExpr(facade.type), typeArgumentCount: facade.typeArgumentCount, providedIn: computeProvidedIn(facade.providedIn), useClass: wrapExpression(facade, USE_CLASS), useFactory: wrapExpression(facade, USE_FACTORY), useValue: wrapExpression(facade, USE_VALUE), useExisting: wrapExpression(facade, USE_EXISTING), ctorDeps: convertR3DependencyMetadataArray(facade.ctorDeps), userDeps: convertR3DependencyMetadataArray(facade.userDeps) || undefined }), expression = _compileInjectable2.expression, statements = _compileInjectable2.statements; return this.jitExpression(expression, angularCoreEnv, sourceMapUrl, statements); } }, { key: "compileInjector", value: function compileInjector(angularCoreEnv, sourceMapUrl, facade) { var meta = { name: facade.name, type: new WrappedNodeExpr(facade.type), deps: convertR3DependencyMetadataArray(facade.deps), providers: new WrappedNodeExpr(facade.providers), imports: facade.imports.map(function (i) { return new WrappedNodeExpr(i); }) }; var res = _compileInjector(meta); return this.jitExpression(res.expression, angularCoreEnv, sourceMapUrl, res.statements); } }, { key: "compileNgModule", value: function compileNgModule(angularCoreEnv, sourceMapUrl, facade) { var meta = { type: new WrappedNodeExpr(facade.type), bootstrap: facade.bootstrap.map(wrapReference), declarations: facade.declarations.map(wrapReference), imports: facade.imports.map(wrapReference), exports: facade.exports.map(wrapReference), emitInline: true, containsForwardDecls: false, schemas: facade.schemas ? facade.schemas.map(wrapReference) : null, id: facade.id ? new WrappedNodeExpr(facade.id) : null }; var res = _compileNgModule(meta); return this.jitExpression(res.expression, angularCoreEnv, sourceMapUrl, []); } }, { key: "compileDirective", value: function compileDirective(angularCoreEnv, sourceMapUrl, facade) { var constantPool = new ConstantPool(); var bindingParser = makeBindingParser(); var meta = convertDirectiveFacadeToMetadata(facade); var res = compileDirectiveFromMetadata(meta, constantPool, bindingParser); var preStatements = [].concat(_toConsumableArray(constantPool.statements), _toConsumableArray(res.statements)); return this.jitExpression(res.expression, angularCoreEnv, sourceMapUrl, preStatements); } }, { key: "compileComponent", value: function compileComponent(angularCoreEnv, sourceMapUrl, facade) { // The ConstantPool is a requirement of the JIT'er. var constantPool = new ConstantPool(); var interpolationConfig = facade.interpolation ? InterpolationConfig.fromArray(facade.interpolation) : DEFAULT_INTERPOLATION_CONFIG; // Parse the template and check for errors. var template = parseTemplate(facade.template, sourceMapUrl, { preserveWhitespaces: facade.preserveWhitespaces, interpolationConfig: interpolationConfig }); if (template.errors !== undefined) { var errors = template.errors.map(function (err) { return err.toString(); }).join(', '); throw new Error("Errors during JIT compilation of template for ".concat(facade.name, ": ").concat(errors)); } // Compile the component metadata, including template, into an expression. // TODO(alxhub): implement inputs, outputs, queries, etc. var res = compileComponentFromMetadata(Object.assign({}, facade, convertDirectiveFacadeToMetadata(facade), { selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(), template: template, wrapDirectivesAndPipesInClosure: false, styles: facade.styles || [], encapsulation: facade.encapsulation, interpolation: interpolationConfig, changeDetection: facade.changeDetection, animations: facade.animations != null ? new WrappedNodeExpr(facade.animations) : null, viewProviders: facade.viewProviders != null ? new WrappedNodeExpr(facade.viewProviders) : null, relativeContextFilePath: '', i18nUseExternalIds: true }), constantPool, makeBindingParser(interpolationConfig)); var preStatements = [].concat(_toConsumableArray(constantPool.statements), _toConsumableArray(res.statements)); return this.jitExpression(res.expression, angularCoreEnv, "ng:///".concat(facade.name, ".js"), preStatements); } }, { key: "compileBase", value: function compileBase(angularCoreEnv, sourceMapUrl, facade) { var constantPool = new ConstantPool(); var typeSourceSpan = this.createParseSourceSpan('Base', facade.name, "ng:///".concat(facade.name, ".js")); var meta = Object.assign({}, facade, { typeSourceSpan: typeSourceSpan, viewQueries: facade.viewQueries ? facade.viewQueries.map(convertToR3QueryMetadata) : facade.viewQueries, queries: facade.queries ? facade.queries.map(convertToR3QueryMetadata) : facade.queries, host: extractHostBindings(facade.propMetadata, typeSourceSpan) }); var res = compileBaseDefFromMetadata(meta, constantPool, makeBindingParser()); return this.jitExpression(res.expression, angularCoreEnv, sourceMapUrl, constantPool.statements); } }, { key: "createParseSourceSpan", value: function createParseSourceSpan(kind, typeName, sourceUrl) { return r3JitTypeSourceSpan(kind, typeName, sourceUrl); } /** * JIT compiles an expression and returns the result of executing that expression. * * @param def the definition which will be compiled and executed to get the value to patch * @param context an object map of @angular/core symbol names to symbols which will be available * in the context of the compiled expression * @param sourceUrl a URL to use for the source map of the compiled expression * @param preStatements a collection of statements that should be evaluated before the expression. */ }, { key: "jitExpression", value: function jitExpression(def, context, sourceUrl, preStatements) { // The ConstantPool may contain Statements which declare variables used in the final expression. // Therefore, its statements need to precede the actual JIT operation. The final statement is a // declaration of $def which is set to the expression being compiled. var statements = [].concat(_toConsumableArray(preStatements), [new DeclareVarStmt('$def', def, undefined, [StmtModifier.Exported])]); var res = this.jitEvaluator.evaluateStatements(sourceUrl, statements, new R3JitReflector(context), /* enableSourceMaps */ true); return res['$def']; } }]); return CompilerFacadeImpl; }(); var USE_CLASS = Object.keys({ useClass: null })[0]; var USE_FACTORY = Object.keys({ useFactory: null })[0]; var USE_VALUE = Object.keys({ useValue: null })[0]; var USE_EXISTING = Object.keys({ useExisting: null })[0]; var wrapReference = function wrapReference(value) { var wrapped = new WrappedNodeExpr(value); return { value: wrapped, type: wrapped }; }; function convertToR3QueryMetadata(facade) { return Object.assign({}, facade, { predicate: Array.isArray(facade.predicate) ? facade.predicate : new WrappedNodeExpr(facade.predicate), read: facade.read ? new WrappedNodeExpr(facade.read) : null, "static": facade["static"] }); } function convertDirectiveFacadeToMetadata(facade) { var inputsFromMetadata = parseInputOutputs(facade.inputs || []); var outputsFromMetadata = parseInputOutputs(facade.outputs || []); var propMetadata = facade.propMetadata; var inputsFromType = {}; var outputsFromType = {}; var _loop = function _loop(field) { if (propMetadata.hasOwnProperty(field)) { propMetadata[field].forEach(function (ann) { if (isInput(ann)) { inputsFromType[field] = ann.bindingPropertyName ? [ann.bindingPropertyName, field] : field; } else if (isOutput(ann)) { outputsFromType[field] = ann.bindingPropertyName || field; } }); } }; for (var field in propMetadata) { _loop(field); } return Object.assign({}, facade, { typeSourceSpan: facade.typeSourceSpan, type: new WrappedNodeExpr(facade.type), deps: convertR3DependencyMetadataArray(facade.deps), host: extractHostBindings(facade.propMetadata, facade.typeSourceSpan, facade.host), inputs: Object.assign({}, inputsFromMetadata, inputsFromType), outputs: Object.assign({}, outputsFromMetadata, outputsFromType), queries: facade.queries.map(convertToR3QueryMetadata), providers: facade.providers != null ? new WrappedNodeExpr(facade.providers) : null, viewQueries: facade.viewQueries.map(convertToR3QueryMetadata) }); } function wrapExpression(obj, property) { if (obj.hasOwnProperty(property)) { return new WrappedNodeExpr(obj[property]); } else { return undefined; } } function computeProvidedIn(providedIn) { if (providedIn == null || typeof providedIn === 'string') { return new LiteralExpr(providedIn); } else { return new WrappedNodeExpr(providedIn); } } function convertR3DependencyMetadata(facade) { var tokenExpr; if (facade.token === null) { tokenExpr = new LiteralExpr(null); } else if (facade.resolved === R3ResolvedDependencyType.Attribute) { tokenExpr = new LiteralExpr(facade.token); } else { tokenExpr = new WrappedNodeExpr(facade.token); } return { token: tokenExpr, resolved: facade.resolved, host: facade.host, optional: facade.optional, self: facade.self, skipSelf: facade.skipSelf }; } function convertR3DependencyMetadataArray(facades) { return facades == null ? null : facades.map(convertR3DependencyMetadata); } function extractHostBindings(propMetadata, sourceSpan, host) { // First parse the declarations from the metadata. var bindings = parseHostBindings(host || {}); // After that check host bindings for errors var errors = verifyHostBindings(bindings, sourceSpan); if (errors.length) { throw new Error(errors.map(function (error) { return error.msg; }).join('\n')); } // Next, loop over the properties of the object, looking for @HostBinding and @HostListener. var _loop2 = function _loop2(field) { if (propMetadata.hasOwnProperty(field)) { propMetadata[field].forEach(function (ann) { if (isHostBinding(ann)) { bindings.properties[ann.hostPropertyName || field] = field; } else if (isHostListener(ann)) { bindings.listeners[ann.eventName || field] = "".concat(field, "(").concat((ann.args || []).join(','), ")"); } }); } }; for (var field in propMetadata) { _loop2(field); } return bindings; } function isHostBinding(value) { return value.ngMetadataName === 'HostBinding'; } function isHostListener(value) { return value.ngMetadataName === 'HostListener'; } function isInput(value) { return value.ngMetadataName === 'Input'; } function isOutput(value) { return value.ngMetadataName === 'Output'; } function parseInputOutputs(values) { return values.reduce(function (map, value) { var _value$split$map5 = value.split(',').map(function (piece) { return piece.trim(); }), _value$split$map6 = _slicedToArray(_value$split$map5, 2), field = _value$split$map6[0], property = _value$split$map6[1]; map[field] = property || field; return map; }, {}); } function publishFacade(global) { var ng = global.ng || (global.ng = {}); ng.ɵcompilerFacade = new CompilerFacadeImpl(); } /** * @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 = new Version('8.2.12'); /** * @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 CompilerConfig() { var _ref36 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref36$defaultEncapsu = _ref36.defaultEncapsulation, defaultEncapsulation = _ref36$defaultEncapsu === void 0 ? ViewEncapsulation.Emulated : _ref36$defaultEncapsu, _ref36$useJit = _ref36.useJit, useJit = _ref36$useJit === void 0 ? true : _ref36$useJit, _ref36$jitDevMode = _ref36.jitDevMode, jitDevMode = _ref36$jitDevMode === void 0 ? false : _ref36$jitDevMode, _ref36$missingTransla = _ref36.missingTranslation, missingTranslation = _ref36$missingTransla === void 0 ? null : _ref36$missingTransla, preserveWhitespaces = _ref36.preserveWhitespaces, strictInjectionParameters = _ref36.strictInjectionParameters; _classCallCheck(this, CompilerConfig); this.defaultEncapsulation = defaultEncapsulation; this.useJit = !!useJit; this.jitDevMode = !!jitDevMode; this.missingTranslation = missingTranslation; this.preserveWhitespaces = preserveWhitespacesDefault(noUndefined(preserveWhitespaces)); this.strictInjectionParameters = strictInjectionParameters === true; }; function preserveWhitespacesDefault(preserveWhitespacesOption) { var defaultSetting = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; return preserveWhitespacesOption === null ? defaultSetting : preserveWhitespacesOption; } /** * @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 DirectiveNormalizer = /*#__PURE__*/function () { function DirectiveNormalizer(_resourceLoader, _urlResolver, _htmlParser, _config) { _classCallCheck(this, DirectiveNormalizer); this._resourceLoader = _resourceLoader; this._urlResolver = _urlResolver; this._htmlParser = _htmlParser; this._config = _config; this._resourceLoaderCache = new Map(); } _createClass2(DirectiveNormalizer, [{ key: "clearCache", value: function clearCache() { this._resourceLoaderCache.clear(); } }, { key: "clearCacheFor", value: function clearCacheFor(normalizedDirective) { var _this205 = this; if (!normalizedDirective.isComponent) { return; } var template = normalizedDirective.template; this._resourceLoaderCache["delete"](template.templateUrl); template.externalStylesheets.forEach(function (stylesheet) { _this205._resourceLoaderCache["delete"](stylesheet.moduleUrl); }); } }, { key: "_fetch", value: function _fetch(url) { var result = this._resourceLoaderCache.get(url); if (!result) { result = this._resourceLoader.get(url); this._resourceLoaderCache.set(url, result); } return result; } }, { key: "normalizeTemplate", value: function normalizeTemplate(prenormData) { var _this206 = this; if (isDefined(prenormData.template)) { if (isDefined(prenormData.templateUrl)) { throw syntaxError("'".concat(stringify(prenormData.componentType), "' component cannot define both template and templateUrl")); } if (typeof prenormData.template !== 'string') { throw syntaxError("The template specified for component ".concat(stringify(prenormData.componentType), " is not a string")); } } else if (isDefined(prenormData.templateUrl)) { if (typeof prenormData.templateUrl !== 'string') { throw syntaxError("The templateUrl specified for component ".concat(stringify(prenormData.componentType), " is not a string")); } } else { throw syntaxError("No template specified for component ".concat(stringify(prenormData.componentType))); } if (isDefined(prenormData.preserveWhitespaces) && typeof prenormData.preserveWhitespaces !== 'boolean') { throw syntaxError("The preserveWhitespaces option for component ".concat(stringify(prenormData.componentType), " must be a boolean")); } return SyncAsync.then(this._preParseTemplate(prenormData), function (preparsedTemplate) { return _this206._normalizeTemplateMetadata(prenormData, preparsedTemplate); }); } }, { key: "_preParseTemplate", value: function _preParseTemplate(prenomData) { var _this207 = this; var template; var templateUrl; if (prenomData.template != null) { template = prenomData.template; templateUrl = prenomData.moduleUrl; } else { templateUrl = this._urlResolver.resolve(prenomData.moduleUrl, prenomData.templateUrl); template = this._fetch(templateUrl); } return SyncAsync.then(template, function (template) { return _this207._preparseLoadedTemplate(prenomData, template, templateUrl); }); } }, { key: "_preparseLoadedTemplate", value: function _preparseLoadedTemplate(prenormData, template, templateAbsUrl) { var isInline = !!prenormData.template; var interpolationConfig = InterpolationConfig.fromArray(prenormData.interpolation); var templateUrl = templateSourceUrl({ reference: prenormData.ngModuleType }, { type: { reference: prenormData.componentType } }, { isInline: isInline, templateUrl: templateAbsUrl }); var rootNodesAndErrors = this._htmlParser.parse(template, templateUrl, { tokenizeExpansionForms: true, interpolationConfig: interpolationConfig }); if (rootNodesAndErrors.errors.length > 0) { var errorString = rootNodesAndErrors.errors.join('\n'); throw syntaxError("Template parse errors:\n".concat(errorString)); } var templateMetadataStyles = this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: prenormData.styles, moduleUrl: prenormData.moduleUrl })); var visitor = new TemplatePreparseVisitor(); visitAll$1(visitor, rootNodesAndErrors.rootNodes); var templateStyles = this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: visitor.styles, styleUrls: visitor.styleUrls, moduleUrl: templateAbsUrl })); var styles = templateMetadataStyles.styles.concat(templateStyles.styles); var inlineStyleUrls = templateMetadataStyles.styleUrls.concat(templateStyles.styleUrls); var styleUrls = this._normalizeStylesheet(new CompileStylesheetMetadata({ styleUrls: prenormData.styleUrls, moduleUrl: prenormData.moduleUrl })).styleUrls; return { template: template, templateUrl: templateAbsUrl, isInline: isInline, htmlAst: rootNodesAndErrors, styles: styles, inlineStyleUrls: inlineStyleUrls, styleUrls: styleUrls, ngContentSelectors: visitor.ngContentSelectors }; } }, { key: "_normalizeTemplateMetadata", value: function _normalizeTemplateMetadata(prenormData, preparsedTemplate) { var _this208 = this; return SyncAsync.then(this._loadMissingExternalStylesheets(preparsedTemplate.styleUrls.concat(preparsedTemplate.inlineStyleUrls)), function (externalStylesheets) { return _this208._normalizeLoadedTemplateMetadata(prenormData, preparsedTemplate, externalStylesheets); }); } }, { key: "_normalizeLoadedTemplateMetadata", value: function _normalizeLoadedTemplateMetadata(prenormData, preparsedTemplate, stylesheets) { var _this209 = this; // Algorithm: // - produce exactly 1 entry per original styleUrl in // CompileTemplateMetadata.externalStylesheets with all styles inlined // - inline all styles that are referenced by the template into CompileTemplateMetadata.styles. // Reason: be able to determine how many stylesheets there are even without loading // the template nor the stylesheets, so we can create a stub for TypeScript always synchronously // (as resource loading may be async) var styles = _toConsumableArray(preparsedTemplate.styles); this._inlineStyles(preparsedTemplate.inlineStyleUrls, stylesheets, styles); var styleUrls = preparsedTemplate.styleUrls; var externalStylesheets = styleUrls.map(function (styleUrl) { var stylesheet = stylesheets.get(styleUrl); var styles = _toConsumableArray(stylesheet.styles); _this209._inlineStyles(stylesheet.styleUrls, stylesheets, styles); return new CompileStylesheetMetadata({ moduleUrl: styleUrl, styles: styles }); }); var encapsulation = prenormData.encapsulation; if (encapsulation == null) { encapsulation = this._config.defaultEncapsulation; } if (encapsulation === ViewEncapsulation.Emulated && styles.length === 0 && styleUrls.length === 0) { encapsulation = ViewEncapsulation.None; } return new CompileTemplateMetadata({ encapsulation: encapsulation, template: preparsedTemplate.template, templateUrl: preparsedTemplate.templateUrl, htmlAst: preparsedTemplate.htmlAst, styles: styles, styleUrls: styleUrls, ngContentSelectors: preparsedTemplate.ngContentSelectors, animations: prenormData.animations, interpolation: prenormData.interpolation, isInline: preparsedTemplate.isInline, externalStylesheets: externalStylesheets, preserveWhitespaces: preserveWhitespacesDefault(prenormData.preserveWhitespaces, this._config.preserveWhitespaces) }); } }, { key: "_inlineStyles", value: function _inlineStyles(styleUrls, stylesheets, targetStyles) { var _this210 = this; styleUrls.forEach(function (styleUrl) { var stylesheet = stylesheets.get(styleUrl); stylesheet.styles.forEach(function (style) { return targetStyles.push(style); }); _this210._inlineStyles(stylesheet.styleUrls, stylesheets, targetStyles); }); } }, { key: "_loadMissingExternalStylesheets", value: function _loadMissingExternalStylesheets(styleUrls) { var _this211 = this; var loadedStylesheets = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Map(); return SyncAsync.then(SyncAsync.all(styleUrls.filter(function (styleUrl) { return !loadedStylesheets.has(styleUrl); }).map(function (styleUrl) { return SyncAsync.then(_this211._fetch(styleUrl), function (loadedStyle) { var stylesheet = _this211._normalizeStylesheet(new CompileStylesheetMetadata({ styles: [loadedStyle], moduleUrl: styleUrl })); loadedStylesheets.set(styleUrl, stylesheet); return _this211._loadMissingExternalStylesheets(stylesheet.styleUrls, loadedStylesheets); }); })), function (_) { return loadedStylesheets; }); } }, { key: "_normalizeStylesheet", value: function _normalizeStylesheet(stylesheet) { var _this212 = this; var moduleUrl = stylesheet.moduleUrl; var allStyleUrls = stylesheet.styleUrls.filter(isStyleUrlResolvable).map(function (url) { return _this212._urlResolver.resolve(moduleUrl, url); }); var allStyles = stylesheet.styles.map(function (style) { var styleWithImports = extractStyleUrls(_this212._urlResolver, moduleUrl, style); allStyleUrls.push.apply(allStyleUrls, _toConsumableArray(styleWithImports.styleUrls)); return styleWithImports.style; }); return new CompileStylesheetMetadata({ styles: allStyles, styleUrls: allStyleUrls, moduleUrl: moduleUrl }); } }]); return DirectiveNormalizer; }(); var TemplatePreparseVisitor = /*#__PURE__*/function () { function TemplatePreparseVisitor() { _classCallCheck(this, TemplatePreparseVisitor); this.ngContentSelectors = []; this.styles = []; this.styleUrls = []; this.ngNonBindableStackCount = 0; } _createClass2(TemplatePreparseVisitor, [{ key: "visitElement", value: function visitElement(ast, context) { var preparsedElement = preparseElement(ast); switch (preparsedElement.type) { case PreparsedElementType.NG_CONTENT: if (this.ngNonBindableStackCount === 0) { this.ngContentSelectors.push(preparsedElement.selectAttr); } break; case PreparsedElementType.STYLE: var textContent = ''; ast.children.forEach(function (child) { if (child instanceof Text$3) { textContent += child.value; } }); this.styles.push(textContent); break; case PreparsedElementType.STYLESHEET: this.styleUrls.push(preparsedElement.hrefAttr); break; default: break; } if (preparsedElement.nonBindable) { this.ngNonBindableStackCount++; } visitAll$1(this, ast.children); if (preparsedElement.nonBindable) { this.ngNonBindableStackCount--; } return null; } }, { key: "visitExpansion", value: function visitExpansion(ast, context) { visitAll$1(this, ast.cases); } }, { key: "visitExpansionCase", value: function visitExpansionCase(ast, context) { visitAll$1(this, ast.expression); } }, { key: "visitComment", value: function visitComment(ast, context) { return null; } }, { key: "visitAttribute", value: function visitAttribute(ast, context) { return null; } }, { key: "visitText", value: function visitText(ast, context) { return null; } }]); return TemplatePreparseVisitor; }(); /** * @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 QUERY_METADATA_IDENTIFIERS = [createViewChild, createViewChildren, createContentChild, createContentChildren]; /* * Resolve a `Type` for {@link Directive}. * * This interface can be overridden by the application developer to create custom behavior. * * See {@link Compiler} */ var DirectiveResolver = /*#__PURE__*/function () { function DirectiveResolver(_reflector) { _classCallCheck(this, DirectiveResolver); this._reflector = _reflector; } _createClass2(DirectiveResolver, [{ key: "isDirective", value: function isDirective(type) { var typeMetadata = this._reflector.annotations(resolveForwardRef(type)); return typeMetadata && typeMetadata.some(isDirectiveMetadata); } }, { key: "resolve", value: function resolve(type) { var throwIfNotFound = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var typeMetadata = this._reflector.annotations(resolveForwardRef(type)); if (typeMetadata) { var metadata = findLast(typeMetadata, isDirectiveMetadata); if (metadata) { var propertyMetadata = this._reflector.propMetadata(type); var guards = this._reflector.guards(type); return this._mergeWithPropertyMetadata(metadata, propertyMetadata, guards, type); } } if (throwIfNotFound) { throw new Error("No Directive annotation found on ".concat(stringify(type))); } return null; } }, { key: "_mergeWithPropertyMetadata", value: function _mergeWithPropertyMetadata(dm, propertyMetadata, guards, directiveType) { var inputs = []; var outputs = []; var host = {}; var queries = {}; Object.keys(propertyMetadata).forEach(function (propName) { var input = findLast(propertyMetadata[propName], function (a) { return createInput.isTypeOf(a); }); if (input) { if (input.bindingPropertyName) { inputs.push("".concat(propName, ": ").concat(input.bindingPropertyName)); } else { inputs.push(propName); } } var output = findLast(propertyMetadata[propName], function (a) { return createOutput.isTypeOf(a); }); if (output) { if (output.bindingPropertyName) { outputs.push("".concat(propName, ": ").concat(output.bindingPropertyName)); } else { outputs.push(propName); } } var hostBindings = propertyMetadata[propName].filter(function (a) { return createHostBinding.isTypeOf(a); }); hostBindings.forEach(function (hostBinding) { if (hostBinding.hostPropertyName) { var startWith = hostBinding.hostPropertyName[0]; if (startWith === '(') { throw new Error("@HostBinding can not bind to events. Use @HostListener instead."); } else if (startWith === '[') { throw new Error("@HostBinding parameter should be a property name, 'class.<name>', or 'attr.<name>'."); } host["[".concat(hostBinding.hostPropertyName, "]")] = propName; } else { host["[".concat(propName, "]")] = propName; } }); var hostListeners = propertyMetadata[propName].filter(function (a) { return createHostListener.isTypeOf(a); }); hostListeners.forEach(function (hostListener) { var args = hostListener.args || []; host["(".concat(hostListener.eventName, ")")] = "".concat(propName, "(").concat(args.join(','), ")"); }); var query = findLast(propertyMetadata[propName], function (a) { return QUERY_METADATA_IDENTIFIERS.some(function (i) { return i.isTypeOf(a); }); }); if (query) { queries[propName] = query; } }); return this._merge(dm, inputs, outputs, host, queries, guards, directiveType); } }, { key: "_extractPublicName", value: function _extractPublicName(def) { return splitAtColon(def, [null, def])[1].trim(); } }, { key: "_dedupeBindings", value: function _dedupeBindings(bindings) { var names = new Set(); var publicNames = new Set(); var reversedResult = []; // go last to first to allow later entries to overwrite previous entries for (var i = bindings.length - 1; i >= 0; i--) { var binding = bindings[i]; var name = this._extractPublicName(binding); publicNames.add(name); if (!names.has(name)) { names.add(name); reversedResult.push(binding); } } return reversedResult.reverse(); } }, { key: "_merge", value: function _merge(directive, inputs, outputs, host, queries, guards, directiveType) { var mergedInputs = this._dedupeBindings(directive.inputs ? directive.inputs.concat(inputs) : inputs); var mergedOutputs = this._dedupeBindings(directive.outputs ? directive.outputs.concat(outputs) : outputs); var mergedHost = directive.host ? Object.assign({}, directive.host, host) : host; var mergedQueries = directive.queries ? Object.assign({}, directive.queries, queries) : queries; if (createComponent.isTypeOf(directive)) { var comp = directive; return createComponent({ selector: comp.selector, inputs: mergedInputs, outputs: mergedOutputs, host: mergedHost, exportAs: comp.exportAs, moduleId: comp.moduleId, queries: mergedQueries, changeDetection: comp.changeDetection, providers: comp.providers, viewProviders: comp.viewProviders, entryComponents: comp.entryComponents, template: comp.template, templateUrl: comp.templateUrl, styles: comp.styles, styleUrls: comp.styleUrls, encapsulation: comp.encapsulation, animations: comp.animations, interpolation: comp.interpolation, preserveWhitespaces: directive.preserveWhitespaces }); } else { return createDirective({ selector: directive.selector, inputs: mergedInputs, outputs: mergedOutputs, host: mergedHost, exportAs: directive.exportAs, queries: mergedQueries, providers: directive.providers, guards: guards }); } } }]); return DirectiveResolver; }(); function isDirectiveMetadata(type) { return createDirective.isTypeOf(type) || createComponent.isTypeOf(type); } function findLast(arr, condition) { for (var i = arr.length - 1; i >= 0; i--) { if (condition(arr[i])) { return arr[i]; } } return null; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * An i18n error. */ var I18nError = /*#__PURE__*/function (_ParseError6) { _inherits(I18nError, _ParseError6); var _super94 = _createSuper(I18nError); function I18nError(span, msg) { _classCallCheck(this, I18nError); return _super94.call(this, span, msg); } 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 = '@@'; var i18nCommentsWarned = false; /** * Extract translatable messages from an html AST */ function extractMessages(nodes, interpolationConfig, implicitTags, implicitAttrs) { var visitor = new _Visitor$2(implicitTags, implicitAttrs); return visitor.extract(nodes, interpolationConfig); } function mergeTranslations(nodes, translations, interpolationConfig, implicitTags, implicitAttrs) { var visitor = new _Visitor$2(implicitTags, implicitAttrs); return visitor.merge(nodes, translations, interpolationConfig); } var ExtractionResult = function ExtractionResult(messages, errors) { _classCallCheck(this, ExtractionResult); this.messages = messages; this.errors = errors; }; var _VisitorMode; (function (_VisitorMode) { _VisitorMode[_VisitorMode["Extract"] = 0] = "Extract"; _VisitorMode[_VisitorMode["Merge"] = 1] = "Merge"; })(_VisitorMode || (_VisitorMode = {})); /** * 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$2 = /*#__PURE__*/function () { function _Visitor$2(_implicitTags, _implicitAttrs) { _classCallCheck(this, _Visitor$2); this._implicitTags = _implicitTags; this._implicitAttrs = _implicitAttrs; } /** * Extracts the messages from the tree */ _createClass2(_Visitor$2, [{ key: "extract", value: function extract(nodes, interpolationConfig) { var _this213 = this; this._init(_VisitorMode.Extract, interpolationConfig); nodes.forEach(function (node) { return node.visit(_this213, 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 */ }, { key: "merge", value: function merge(nodes, translations, interpolationConfig) { this._init(_VisitorMode.Merge, interpolationConfig); this._translations = translations; // Construct a single fake root element var wrapper = new Element$1('wrapper', [], nodes, undefined, undefined, undefined); var translatedNode = wrapper.visit(this, null); if (this._inI18nBlock) { this._reportError(nodes[nodes.length - 1], 'Unclosed block'); } return new ParseTreeResult(translatedNode.children, this._errors); } }, { key: "visitExpansionCase", value: function visitExpansionCase(icuCase, context) { // Parse cases for translatable html attributes var expression = visitAll$1(this, icuCase.expression, context); if (this._mode === _VisitorMode.Merge) { return new ExpansionCase(icuCase.value, expression, icuCase.sourceSpan, icuCase.valueSourceSpan, icuCase.expSourceSpan); } } }, { key: "visitExpansion", value: function visitExpansion(icu, context) { this._mayBeAddBlockChildren(icu); var 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 cases = visitAll$1(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; } }, { key: "visitComment", value: function visitComment(comment, context) { var isOpening = _isOpeningComment(comment); if (isOpening && this._isInTranslatableSection) { this._reportError(comment, 'Could not start a block inside a translatable section'); return; } var 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) { // deprecated from v5 you should use <ng-container i18n> instead of i18n comments if (!i18nCommentsWarned && console && console.warn) { i18nCommentsWarned = true; var details = comment.sourceSpan.details ? ", ".concat(comment.sourceSpan.details) : ''; // TODO(ocombe): use a log service once there is a public one available console.warn("I18n comments are deprecated, use an <ng-container> element instead (".concat(comment.sourceSpan.start).concat(details, ")")); } 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 message = this._addMessage(this._blockChildren, this._blockMeaningAndDesc); // merge attributes in sections var nodes = this._translateMessage(comment, message); return visitAll$1(this, nodes); } else { this._reportError(comment, 'I18N blocks should not cross element boundaries'); return; } } } } } }, { key: "visitText", value: function visitText(text, context) { if (this._isInTranslatableSection) { this._mayBeAddBlockChildren(text); } return text; } }, { key: "visitElement", value: function visitElement(el, context) { var _this214 = this; this._mayBeAddBlockChildren(el); this._depth++; var wasInI18nNode = this._inI18nNode; var wasInImplicitNode = this._inImplicitNode; var childNodes = []; var translatedChildNodes = undefined; // Extract: // - top level nodes with the (implicit) "i18n" attribute if not already in a section // - ICU messages var i18nAttr = _getI18nAttr(el); var i18nMeta = i18nAttr ? i18nAttr.value : ''; var isImplicit = this._implicitTags.some(function (tag) { return el.name === tag; }) && !this._inIcu && !this._isInTranslatableSection; var isTopLevelImplicit = !wasInImplicitNode && isImplicit; this._inImplicitNode = wasInImplicitNode || isImplicit; if (!this._isInTranslatableSection && !this._inIcu) { if (i18nAttr || isTopLevelImplicit) { this._inI18nNode = true; var message = this._addMessage(el.children, i18nMeta); translatedChildNodes = this._translateMessage(el, message); } if (this._mode == _VisitorMode.Extract) { var isTranslatable = i18nAttr || isTopLevelImplicit; if (isTranslatable) this._openTranslatableSection(el); visitAll$1(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$1(this, el.children); } } if (this._mode === _VisitorMode.Merge) { var visitNodes = translatedChildNodes || el.children; visitNodes.forEach(function (child) { var visited = child.visit(_this214, context); if (visited && !_this214._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 `<!-- /i18n -->`) childNodes = childNodes.concat(visited); } }); } this._visitAttributesOf(el); this._depth--; this._inI18nNode = wasInI18nNode; this._inImplicitNode = wasInImplicitNode; if (this._mode === _VisitorMode.Merge) { var translatedAttrs = this._translateAttributes(el); return new Element$1(el.name, translatedAttrs, childNodes, el.sourceSpan, el.startSourceSpan, el.endSourceSpan); } return null; } }, { key: "visitAttribute", value: function visitAttribute(attribute, context) { throw new Error('unreachable code'); } }, { key: "_init", value: function _init(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); } // looks for translatable attributes }, { key: "_visitAttributesOf", value: function _visitAttributesOf(el) { var _this215 = this; var explicitAttrNameToValue = {}; var 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) { _this215._addMessage([attr], explicitAttrNameToValue[attr.name]); } else if (implicitAttrNames.some(function (name) { return attr.name === name; })) { _this215._addMessage([attr]); } }); } // add a translatable message }, { key: "_addMessage", value: function _addMessage(ast, msgMeta) { if (ast.length == 0 || ast.length == 1 && ast[0] instanceof Attribute && !ast[0].value) { // Do not create empty messages return null; } var _parseMessageMeta2 = _parseMessageMeta(msgMeta), meaning = _parseMessageMeta2.meaning, description = _parseMessageMeta2.description, id = _parseMessageMeta2.id; var message = this._createI18nMessage(ast, meaning, description, id); this._messages.push(message); return message; } // Translates the given message given the `TranslationBundle` // This is used for translating elements / blocks - see `_translateAttributes` for attributes // no-op when called in extraction mode (returns []) }, { key: "_translateMessage", value: function _translateMessage(el, message) { if (message && this._mode === _VisitorMode.Merge) { var nodes = this._translations.get(message); if (nodes) { return nodes; } this._reportError(el, "Translation unavailable for message id=\"".concat(this._translations.digest(message), "\"")); } return []; } // translate the attributes of an element and remove i18n specific attributes }, { key: "_translateAttributes", value: function _translateAttributes(el) { var _this216 = this; var attributes = el.attrs; var i18nParsedMessageMeta = {}; attributes.forEach(function (attr) { if (attr.name.startsWith(_I18N_ATTR_PREFIX)) { i18nParsedMessageMeta[attr.name.slice(_I18N_ATTR_PREFIX.length)] = _parseMessageMeta(attr.value); } }); var 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 _i18nParsedMessageMet = i18nParsedMessageMeta[attr.name], meaning = _i18nParsedMessageMet.meaning, description = _i18nParsedMessageMet.description, id = _i18nParsedMessageMet.id; var message = _this216._createI18nMessage([attr], meaning, description, id); var nodes = _this216._translations.get(message); if (nodes) { if (nodes.length == 0) { translatedAttributes.push(new Attribute(attr.name, '', attr.sourceSpan)); } else if (nodes[0] instanceof Text$3) { var value = nodes[0].value; translatedAttributes.push(new Attribute(attr.name, value, attr.sourceSpan)); } else { _this216._reportError(el, "Unexpected translation for attribute \"".concat(attr.name, "\" (id=\"").concat(id || _this216._translations.digest(message), "\")")); } } else { _this216._reportError(el, "Translation unavailable for attribute \"".concat(attr.name, "\" (id=\"").concat(id || _this216._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 */ }, { key: "_mayBeAddBlockChildren", value: function _mayBeAddBlockChildren(node) { if (this._inI18nBlock && !this._inIcu && this._depth == this._blockStartDepth) { this._blockChildren.push(node); } } /** * Marks the start of a section, see `_closeTranslatableSection` */ }, { key: "_openTranslatableSection", value: function _openTranslatableSection(node) { if (this._isInTranslatableSection) { this._reportError(node, 'Unexpected section start'); } else { this._msgCountAtSectionStart = this._messages.length; } } /** * A translatable section could be: * - the content of translatable element, * - nodes between `<!-- i18n -->` and `<!-- /i18n -->` comments */ }, { key: "_closeTranslatableSection", /** * Terminates a section. * * If a section has only one significant children (comments not significant) then we should not * keep the message from this children: * * `<p i18n="meaning|description">{ICU message}</p>` would produce two messages: * - one for the <p> 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) */ value: function _closeTranslatableSection(node, directChildren) { if (!this._isInTranslatableSection) { this._reportError(node, 'Unexpected section end'); return; } var startIndex = this._msgCountAtSectionStart; var significantChildren = directChildren.reduce(function (count, node) { return count + (node instanceof Comment ? 0 : 1); }, 0); if (significantChildren == 1) { for (var i = this._messages.length - 1; i >= startIndex; i--) { var ast = this._messages[i].nodes; if (!(ast.length == 1 && ast[0] instanceof Text$1)) { this._messages.splice(i, 1); break; } } } this._msgCountAtSectionStart = undefined; } }, { key: "_reportError", value: function _reportError(node, msg) { this._errors.push(new I18nError(node.sourceSpan, msg)); } }, { key: "_isInTranslatableSection", get: function get() { return this._msgCountAtSectionStart !== void 0; } }]); return _Visitor$2; }(); function _isOpeningComment(n) { return !!(n instanceof Comment && n.value && n.value.startsWith('i18n')); } function _isClosingComment(n) { return !!(n instanceof Comment && n.value && n.value === '/i18n'); } function _getI18nAttr(p) { return p.attrs.find(function (attr) { return attr.name === _I18N_ATTR; }) || null; } function _parseMessageMeta(i18n) { if (!i18n) return { meaning: '', description: '', id: '' }; var idIndex = i18n.indexOf(ID_SEPARATOR); var descIndex = i18n.indexOf(MEANING_SEPARATOR); var _ref37 = idIndex > -1 ? [i18n.slice(0, idIndex), i18n.slice(idIndex + 2)] : [i18n, ''], _ref38 = _slicedToArray(_ref37, 2), meaningAndDesc = _ref38[0], id = _ref38[1]; var _ref39 = descIndex > -1 ? [meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)] : ['', meaningAndDesc], _ref40 = _slicedToArray(_ref39, 2), meaning = _ref40[0], description = _ref40[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 = /*#__PURE__*/function () { function XmlTagDefinition() { _classCallCheck(this, XmlTagDefinition); this.closedByParent = false; this.contentType = TagContentType.PARSABLE_DATA; this.isVoid = false; this.ignoreFirstLf = false; this.canSelfClose = true; } _createClass2(XmlTagDefinition, [{ key: "requireExtraParent", value: function requireExtraParent(currentParent) { return false; } }, { key: "isClosedByChild", value: function isClosedByChild(name) { return false; } }]); return XmlTagDefinition; }(); var _TAG_DEFINITION = new XmlTagDefinition(); 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 = /*#__PURE__*/function (_Parser2) { _inherits(XmlParser, _Parser2); var _super95 = _createSuper(XmlParser); function XmlParser() { _classCallCheck(this, XmlParser); return _super95.call(this, getXmlTagDefinition); } _createClass2(XmlParser, [{ key: "parse", value: function parse(source, url, options) { return _get(_getPrototypeOf(XmlParser.prototype), "parse", this).call(this, source, url, options); } }]); return XmlParser; }(Parser); /** * @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$1 = 'x'; var _MARKER_TAG = 'mrk'; var _FILE_TAG = 'file'; var _SOURCE_TAG$1 = 'source'; var _SEGMENT_SOURCE_TAG = 'seg-source'; var _TARGET_TAG = 'target'; var _UNIT_TAG = 'trans-unit'; var _CONTEXT_GROUP_TAG = 'context-group'; var _CONTEXT_TAG = 'context'; // http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html // http://docs.oasis-open.org/xliff/v1.2/xliff-profile-html/xliff-profile-html-1.2.html var Xliff = /*#__PURE__*/function (_Serializer2) { _inherits(Xliff, _Serializer2); var _super96 = _createSuper(Xliff); function Xliff() { _classCallCheck(this, Xliff); return _super96.apply(this, arguments); } _createClass2(Xliff, [{ key: "write", value: function write(messages, locale) { var visitor = new _WriteVisitor(); var transUnits = []; messages.forEach(function (message) { var _transUnit$children; var contextTags = []; message.sources.forEach(function (source) { var 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("".concat(source.startLine))]), new CR(8)); contextTags.push(new CR(8), contextGroupTag); }); var transUnit = new Tag(_UNIT_TAG, { id: message.id, datatype: 'html' }); (_transUnit$children = transUnit.children).push.apply(_transUnit$children, [new CR(8), new Tag(_SOURCE_TAG$1, {}, visitor.serialize(message.nodes))].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 body = new Tag('body', {}, [].concat(transUnits, [new CR(4)])); var file = new Tag('file', { 'source-language': locale || _DEFAULT_SOURCE_LANG, datatype: 'plaintext', original: 'ng2.template' }, [new CR(4), body, new CR(2)]); var 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()]); } }, { key: "load", value: function load(content, url) { // xliff to xml nodes var xliffParser = new XliffParser(); var _xliffParser$parse = xliffParser.parse(content, url), locale = _xliffParser$parse.locale, msgIdToHtml = _xliffParser$parse.msgIdToHtml, errors = _xliffParser$parse.errors; // xml nodes to i18n nodes var i18nNodesByMsgId = {}; var converter = new XmlToI18n(); Object.keys(msgIdToHtml).forEach(function (msgId) { var _converter$convert = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _converter$convert.i18nNodes, e = _converter$convert.errors; errors.push.apply(errors, _toConsumableArray(e)); i18nNodesByMsgId[msgId] = i18nNodes; }); if (errors.length) { throw new Error("xliff parse errors:\n".concat(errors.join('\n'))); } return { locale: locale, i18nNodesByMsgId: i18nNodesByMsgId }; } }, { key: "digest", value: function digest(message) { return _digest2(message); } }]); return Xliff; }(Serializer); var _WriteVisitor = /*#__PURE__*/function () { function _WriteVisitor() { _classCallCheck(this, _WriteVisitor); } _createClass2(_WriteVisitor, [{ key: "visitText", value: function visitText(text, context) { return [new Text$2(text.value)]; } }, { key: "visitContainer", value: function visitContainer(container, context) { var _this217 = this; var nodes = []; container.children.forEach(function (node) { return nodes.push.apply(nodes, _toConsumableArray(node.visit(_this217))); }); return nodes; } }, { key: "visitIcu", value: function visitIcu(icu, context) { var _this218 = this; var nodes = [new Text$2("{".concat(icu.expressionPlaceholder, ", ").concat(icu.type, ", "))]; Object.keys(icu.cases).forEach(function (c) { nodes.push.apply(nodes, [new Text$2("".concat(c, " {"))].concat(_toConsumableArray(icu.cases[c].visit(_this218)), [new Text$2("} ")])); }); nodes.push(new Text$2("}")); return nodes; } }, { key: "visitTagPlaceholder", value: function visitTagPlaceholder(ph, context) { var ctype = getCtypeForTag(ph.tag); if (ph.isVoid) { // void tags have no children nor closing tags return [new Tag(_PLACEHOLDER_TAG$1, { id: ph.startName, ctype: ctype, 'equiv-text': "<".concat(ph.tag, "/>") })]; } var startTagPh = new Tag(_PLACEHOLDER_TAG$1, { id: ph.startName, ctype: ctype, 'equiv-text': "<".concat(ph.tag, ">") }); var closeTagPh = new Tag(_PLACEHOLDER_TAG$1, { id: ph.closeName, ctype: ctype, 'equiv-text': "</".concat(ph.tag, ">") }); return [startTagPh].concat(_toConsumableArray(this.serialize(ph.children)), [closeTagPh]); } }, { key: "visitPlaceholder", value: function visitPlaceholder(ph, context) { return [new Tag(_PLACEHOLDER_TAG$1, { id: ph.name, 'equiv-text': "{{".concat(ph.value, "}}") })]; } }, { key: "visitIcuPlaceholder", value: function visitIcuPlaceholder(ph, context) { var equivText = "{".concat(ph.value.expression, ", ").concat(ph.value.type, ", ").concat(Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' '), "}"); return [new Tag(_PLACEHOLDER_TAG$1, { id: ph.name, 'equiv-text': equivText })]; } }, { key: "serialize", value: function serialize(nodes) { var _ref41, _this219 = this; return (_ref41 = []).concat.apply(_ref41, _toConsumableArray(nodes.map(function (node) { return node.visit(_this219); }))); } }]); return _WriteVisitor; }(); // TODO(vicb): add error management (structure) // Extract messages as xml nodes from the xliff file var XliffParser = /*#__PURE__*/function () { function XliffParser() { _classCallCheck(this, XliffParser); this._locale = null; } _createClass2(XliffParser, [{ key: "parse", value: function parse(xliff, url) { this._unitMlString = null; this._msgIdToHtml = {}; var xml = new XmlParser().parse(xliff, url); this._errors = xml.errors; visitAll$1(this, xml.rootNodes, null); return { msgIdToHtml: this._msgIdToHtml, errors: this._errors, locale: this._locale }; } }, { key: "visitElement", value: function visitElement(element, context) { switch (element.name) { case _UNIT_TAG: this._unitMlString = null; var idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; }); if (!idAttr) { this._addError(element, "<".concat(_UNIT_TAG, "> misses the \"id\" attribute")); } else { var id = idAttr.value; if (this._msgIdToHtml.hasOwnProperty(id)) { this._addError(element, "Duplicated translations for msg ".concat(id)); } else { visitAll$1(this, element.children, null); if (typeof this._unitMlString === 'string') { this._msgIdToHtml[id] = this._unitMlString; } else { this._addError(element, "Message ".concat(id, " misses a translation")); } } } break; // ignore those tags case _SOURCE_TAG$1: case _SEGMENT_SOURCE_TAG: break; case _TARGET_TAG: var innerTextStart = element.startSourceSpan.end.offset; var innerTextEnd = element.endSourceSpan.start.offset; var content = element.startSourceSpan.start.file.content; var innerText = content.slice(innerTextStart, innerTextEnd); this._unitMlString = innerText; break; case _FILE_TAG: var localeAttr = element.attrs.find(function (attr) { return attr.name === 'target-language'; }); if (localeAttr) { this._locale = localeAttr.value; } visitAll$1(this, element.children, null); break; default: // TODO(vicb): assert file structure, xliff version // For now only recurse on unhandled nodes visitAll$1(this, element.children, null); } } }, { key: "visitAttribute", value: function visitAttribute(attribute, context) {} }, { key: "visitText", value: function visitText(text, context) {} }, { key: "visitComment", value: function visitComment(comment, context) {} }, { key: "visitExpansion", value: function visitExpansion(expansion, context) {} }, { key: "visitExpansionCase", value: function visitExpansionCase(expansionCase, context) {} }, { key: "_addError", value: function _addError(node, message) { this._errors.push(new I18nError(node.sourceSpan, message)); } }]); return XliffParser; }(); // Convert ml nodes (xliff syntax) to i18n nodes var XmlToI18n = /*#__PURE__*/function () { function XmlToI18n() { _classCallCheck(this, XmlToI18n); } _createClass2(XmlToI18n, [{ key: "convert", value: function convert(message, url) { var _ref42; var xmlIcu = new XmlParser().parse(message, url, { tokenizeExpansionForms: true }); this._errors = xmlIcu.errors; var i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ? [] : (_ref42 = []).concat.apply(_ref42, _toConsumableArray(visitAll$1(this, xmlIcu.rootNodes))); return { i18nNodes: i18nNodes, errors: this._errors }; } }, { key: "visitText", value: function visitText(text, context) { return new Text$1(text.value, text.sourceSpan); } }, { key: "visitElement", value: function visitElement(el, context) { if (el.name === _PLACEHOLDER_TAG$1) { var nameAttr = el.attrs.find(function (attr) { return attr.name === 'id'; }); if (nameAttr) { return new Placeholder('', nameAttr.value, el.sourceSpan); } this._addError(el, "<".concat(_PLACEHOLDER_TAG$1, "> misses the \"id\" attribute")); return null; } if (el.name === _MARKER_TAG) { var _ref43; return (_ref43 = []).concat.apply(_ref43, _toConsumableArray(visitAll$1(this, el.children))); } this._addError(el, "Unexpected tag"); return null; } }, { key: "visitExpansion", value: function visitExpansion(icu, context) { var caseMap = {}; visitAll$1(this, icu.cases).forEach(function (c) { caseMap[c.value] = new Container(c.nodes, icu.sourceSpan); }); return new Icu$1(icu.switchValue, icu.type, caseMap, icu.sourceSpan); } }, { key: "visitExpansionCase", value: function visitExpansionCase(icuCase, context) { return { value: icuCase.value, nodes: visitAll$1(this, icuCase.expression) }; } }, { key: "visitComment", value: function visitComment(comment, context) {} }, { key: "visitAttribute", value: function visitAttribute(attribute, context) {} }, { key: "_addError", value: function _addError(node, message) { this._errors.push(new I18nError(node.sourceSpan, message)); } }]); return XmlToI18n; }(); function getCtypeForTag(tag) { switch (tag.toLowerCase()) { case 'br': return 'lb'; case 'img': return 'image'; default: return "x-".concat(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$2 = 'ph'; var _PLACEHOLDER_SPANNING_TAG = 'pc'; var _MARKER_TAG$1 = 'mrk'; var _XLIFF_TAG = 'xliff'; var _SOURCE_TAG$2 = 'source'; var _TARGET_TAG$1 = 'target'; var _UNIT_TAG$1 = 'unit'; // http://docs.oasis-open.org/xliff/xliff-core/v2.0/os/xliff-core-v2.0-os.html var Xliff2 = /*#__PURE__*/function (_Serializer3) { _inherits(Xliff2, _Serializer3); var _super97 = _createSuper(Xliff2); function Xliff2() { _classCallCheck(this, Xliff2); return _super97.apply(this, arguments); } _createClass2(Xliff2, [{ key: "write", value: function write(messages, locale) { var visitor = new _WriteVisitor$1(); var units = []; messages.forEach(function (message) { var unit = new Tag(_UNIT_TAG$1, { id: message.id }); var notes = new Tag('notes'); if (message.description || message.meaning) { 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)])); } } message.sources.forEach(function (source) { notes.children.push(new CR(8), new Tag('note', { category: 'location' }, [new Text$2("".concat(source.filePath, ":").concat(source.startLine).concat(source.endLine !== source.startLine ? ',' + source.endLine : ''))])); }); notes.children.push(new CR(6)); unit.children.push(new CR(6), notes); var segment = new Tag('segment'); segment.children.push(new CR(8), new Tag(_SOURCE_TAG$2, {}, visitor.serialize(message.nodes)), new CR(6)); unit.children.push(new CR(6), segment, new CR(4)); units.push(new CR(4), unit); }); var file = new Tag('file', { 'original': 'ng.template', id: 'ngi18n' }, [].concat(units, [new CR(2)])); var 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()]); } }, { key: "load", value: function load(content, url) { // xliff to xml nodes var xliff2Parser = new Xliff2Parser(); var _xliff2Parser$parse = xliff2Parser.parse(content, url), locale = _xliff2Parser$parse.locale, msgIdToHtml = _xliff2Parser$parse.msgIdToHtml, errors = _xliff2Parser$parse.errors; // xml nodes to i18n nodes var i18nNodesByMsgId = {}; var converter = new XmlToI18n$1(); Object.keys(msgIdToHtml).forEach(function (msgId) { var _converter$convert2 = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _converter$convert2.i18nNodes, e = _converter$convert2.errors; errors.push.apply(errors, _toConsumableArray(e)); i18nNodesByMsgId[msgId] = i18nNodes; }); if (errors.length) { throw new Error("xliff2 parse errors:\n".concat(errors.join('\n'))); } return { locale: locale, i18nNodesByMsgId: i18nNodesByMsgId }; } }, { key: "digest", value: function digest(message) { return decimalDigest(message); } }]); return Xliff2; }(Serializer); var _WriteVisitor$1 = /*#__PURE__*/function () { function _WriteVisitor$1() { _classCallCheck(this, _WriteVisitor$1); } _createClass2(_WriteVisitor$1, [{ key: "visitText", value: function visitText(text, context) { return [new Text$2(text.value)]; } }, { key: "visitContainer", value: function visitContainer(container, context) { var _this220 = this; var nodes = []; container.children.forEach(function (node) { return nodes.push.apply(nodes, _toConsumableArray(node.visit(_this220))); }); return nodes; } }, { key: "visitIcu", value: function visitIcu(icu, context) { var _this221 = this; var nodes = [new Text$2("{".concat(icu.expressionPlaceholder, ", ").concat(icu.type, ", "))]; Object.keys(icu.cases).forEach(function (c) { nodes.push.apply(nodes, [new Text$2("".concat(c, " {"))].concat(_toConsumableArray(icu.cases[c].visit(_this221)), [new Text$2("} ")])); }); nodes.push(new Text$2("}")); return nodes; } }, { key: "visitTagPlaceholder", value: function visitTagPlaceholder(ph, context) { var _ref44, _this222 = this; var type = getTypeForTag(ph.tag); if (ph.isVoid) { var tagPh = new Tag(_PLACEHOLDER_TAG$2, { id: (this._nextPlaceholderId++).toString(), equiv: ph.startName, type: type, disp: "<".concat(ph.tag, "/>") }); return [tagPh]; } var tagPc = new Tag(_PLACEHOLDER_SPANNING_TAG, { id: (this._nextPlaceholderId++).toString(), equivStart: ph.startName, equivEnd: ph.closeName, type: type, dispStart: "<".concat(ph.tag, ">"), dispEnd: "</".concat(ph.tag, ">") }); var nodes = (_ref44 = []).concat.apply(_ref44, _toConsumableArray(ph.children.map(function (node) { return node.visit(_this222); }))); if (nodes.length) { nodes.forEach(function (node) { return tagPc.children.push(node); }); } else { tagPc.children.push(new Text$2('')); } return [tagPc]; } }, { key: "visitPlaceholder", value: function visitPlaceholder(ph, context) { var idStr = (this._nextPlaceholderId++).toString(); return [new Tag(_PLACEHOLDER_TAG$2, { id: idStr, equiv: ph.name, disp: "{{".concat(ph.value, "}}") })]; } }, { key: "visitIcuPlaceholder", value: function visitIcuPlaceholder(ph, context) { var cases = Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' '); var idStr = (this._nextPlaceholderId++).toString(); return [new Tag(_PLACEHOLDER_TAG$2, { id: idStr, equiv: ph.name, disp: "{".concat(ph.value.expression, ", ").concat(ph.value.type, ", ").concat(cases, "}") })]; } }, { key: "serialize", value: function serialize(nodes) { var _ref45, _this223 = this; this._nextPlaceholderId = 0; return (_ref45 = []).concat.apply(_ref45, _toConsumableArray(nodes.map(function (node) { return node.visit(_this223); }))); } }]); return _WriteVisitor$1; }(); // Extract messages as xml nodes from the xliff file var Xliff2Parser = /*#__PURE__*/function () { function Xliff2Parser() { _classCallCheck(this, Xliff2Parser); this._locale = null; } _createClass2(Xliff2Parser, [{ key: "parse", value: function parse(xliff, url) { this._unitMlString = null; this._msgIdToHtml = {}; var xml = new XmlParser().parse(xliff, url); this._errors = xml.errors; visitAll$1(this, xml.rootNodes, null); return { msgIdToHtml: this._msgIdToHtml, errors: this._errors, locale: this._locale }; } }, { key: "visitElement", value: function visitElement(element, context) { switch (element.name) { case _UNIT_TAG$1: this._unitMlString = null; var idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; }); if (!idAttr) { this._addError(element, "<".concat(_UNIT_TAG$1, "> misses the \"id\" attribute")); } else { var id = idAttr.value; if (this._msgIdToHtml.hasOwnProperty(id)) { this._addError(element, "Duplicated translations for msg ".concat(id)); } else { visitAll$1(this, element.children, null); if (typeof this._unitMlString === 'string') { this._msgIdToHtml[id] = this._unitMlString; } else { this._addError(element, "Message ".concat(id, " misses a translation")); } } } break; case _SOURCE_TAG$2: // ignore source message break; case _TARGET_TAG$1: var innerTextStart = element.startSourceSpan.end.offset; var innerTextEnd = element.endSourceSpan.start.offset; var content = element.startSourceSpan.start.file.content; var innerText = content.slice(innerTextStart, innerTextEnd); this._unitMlString = innerText; break; case _XLIFF_TAG: var localeAttr = element.attrs.find(function (attr) { return attr.name === 'trgLang'; }); if (localeAttr) { this._locale = localeAttr.value; } var versionAttr = element.attrs.find(function (attr) { return attr.name === 'version'; }); if (versionAttr) { var version = versionAttr.value; if (version !== '2.0') { this._addError(element, "The XLIFF file version ".concat(version, " is not compatible with XLIFF 2.0 serializer")); } else { visitAll$1(this, element.children, null); } } break; default: visitAll$1(this, element.children, null); } } }, { key: "visitAttribute", value: function visitAttribute(attribute, context) {} }, { key: "visitText", value: function visitText(text, context) {} }, { key: "visitComment", value: function visitComment(comment, context) {} }, { key: "visitExpansion", value: function visitExpansion(expansion, context) {} }, { key: "visitExpansionCase", value: function visitExpansionCase(expansionCase, context) {} }, { key: "_addError", value: function _addError(node, message) { this._errors.push(new I18nError(node.sourceSpan, message)); } }]); return Xliff2Parser; }(); // Convert ml nodes (xliff syntax) to i18n nodes var XmlToI18n$1 = /*#__PURE__*/function () { function XmlToI18n$1() { _classCallCheck(this, XmlToI18n$1); } _createClass2(XmlToI18n$1, [{ key: "convert", value: function convert(message, url) { var _ref46; var xmlIcu = new XmlParser().parse(message, url, { tokenizeExpansionForms: true }); this._errors = xmlIcu.errors; var i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ? [] : (_ref46 = []).concat.apply(_ref46, _toConsumableArray(visitAll$1(this, xmlIcu.rootNodes))); return { i18nNodes: i18nNodes, errors: this._errors }; } }, { key: "visitText", value: function visitText(text, context) { return new Text$1(text.value, text.sourceSpan); } }, { key: "visitElement", value: function visitElement(el, context) { var _this224 = this, _ref47; switch (el.name) { case _PLACEHOLDER_TAG$2: var nameAttr = el.attrs.find(function (attr) { return attr.name === 'equiv'; }); if (nameAttr) { return [new Placeholder('', nameAttr.value, el.sourceSpan)]; } this._addError(el, "<".concat(_PLACEHOLDER_TAG$2, "> misses the \"equiv\" attribute")); break; case _PLACEHOLDER_SPANNING_TAG: var startAttr = el.attrs.find(function (attr) { return attr.name === 'equivStart'; }); var endAttr = el.attrs.find(function (attr) { return attr.name === 'equivEnd'; }); if (!startAttr) { this._addError(el, "<".concat(_PLACEHOLDER_TAG$2, "> misses the \"equivStart\" attribute")); } else if (!endAttr) { this._addError(el, "<".concat(_PLACEHOLDER_TAG$2, "> misses the \"equivEnd\" attribute")); } else { var startId = startAttr.value; var endId = endAttr.value; var nodes = []; return nodes.concat.apply(nodes, [new Placeholder('', startId, el.sourceSpan)].concat(_toConsumableArray(el.children.map(function (node) { return node.visit(_this224, null); })), [new Placeholder('', endId, el.sourceSpan)])); } break; case _MARKER_TAG$1: return (_ref47 = []).concat.apply(_ref47, _toConsumableArray(visitAll$1(this, el.children))); default: this._addError(el, "Unexpected tag"); } return null; } }, { key: "visitExpansion", value: function visitExpansion(icu, context) { var caseMap = {}; visitAll$1(this, icu.cases).forEach(function (c) { caseMap[c.value] = new Container(c.nodes, icu.sourceSpan); }); return new Icu$1(icu.switchValue, icu.type, caseMap, icu.sourceSpan); } }, { key: "visitExpansionCase", value: function visitExpansionCase(icuCase, context) { var _ref48; return { value: icuCase.value, nodes: (_ref48 = []).concat.apply(_ref48, _toConsumableArray(visitAll$1(this, icuCase.expression))) }; } }, { key: "visitComment", value: function visitComment(comment, context) {} }, { key: "visitAttribute", value: function visitAttribute(attribute, context) {} }, { key: "_addError", value: function _addError(node, message) { this._errors.push(new I18nError(node.sourceSpan, message)); } }]); return XmlToI18n$1; }(); 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 _TRANSLATIONS_TAG = 'translationbundle'; var _TRANSLATION_TAG = 'translation'; var _PLACEHOLDER_TAG$3 = 'ph'; var Xtb = /*#__PURE__*/function (_Serializer4) { _inherits(Xtb, _Serializer4); var _super98 = _createSuper(Xtb); function Xtb() { _classCallCheck(this, Xtb); return _super98.apply(this, arguments); } _createClass2(Xtb, [{ key: "write", value: function write(messages, locale) { throw new Error('Unsupported'); } }, { key: "load", value: function load(content, url) { // xtb to xml nodes var xtbParser = new XtbParser(); var _xtbParser$parse = xtbParser.parse(content, url), locale = _xtbParser$parse.locale, msgIdToHtml = _xtbParser$parse.msgIdToHtml, errors = _xtbParser$parse.errors; // xml nodes to i18n nodes var i18nNodesByMsgId = {}; var 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 valueFn = function valueFn() { var _converter$convert3 = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _converter$convert3.i18nNodes, errors = _converter$convert3.errors; if (errors.length) { throw new Error("xtb parse errors:\n".concat(errors.join('\n'))); } return i18nNodes; }; createLazyProperty(i18nNodesByMsgId, msgId, valueFn); }); if (errors.length) { throw new Error("xtb parse errors:\n".concat(errors.join('\n'))); } return { locale: locale, i18nNodesByMsgId: i18nNodesByMsgId }; } }, { key: "digest", value: function digest(message) { return digest$1(message); } }, { key: "createNameMapper", value: function createNameMapper(message) { return new SimplePlaceholderMapper(message, toPublicName); } }]); return Xtb; }(Serializer); function createLazyProperty(messages, id, valueFn) { Object.defineProperty(messages, id, { configurable: true, enumerable: true, get: function get() { var value = valueFn(); Object.defineProperty(messages, id, { enumerable: true, value: value }); return value; }, set: function set(_) { throw new Error('Could not overwrite an XTB translation'); } }); } // Extract messages as xml nodes from the xtb file var XtbParser = /*#__PURE__*/function () { function XtbParser() { _classCallCheck(this, XtbParser); this._locale = null; } _createClass2(XtbParser, [{ key: "parse", value: function parse(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 xml = new XmlParser().parse(xtb, url); this._errors = xml.errors; visitAll$1(this, xml.rootNodes); return { msgIdToHtml: this._msgIdToHtml, errors: this._errors, locale: this._locale }; } }, { key: "visitElement", value: function visitElement(element, context) { switch (element.name) { case _TRANSLATIONS_TAG: this._bundleDepth++; if (this._bundleDepth > 1) { this._addError(element, "<".concat(_TRANSLATIONS_TAG, "> elements can not be nested")); } var langAttr = element.attrs.find(function (attr) { return attr.name === 'lang'; }); if (langAttr) { this._locale = langAttr.value; } visitAll$1(this, element.children, null); this._bundleDepth--; break; case _TRANSLATION_TAG: var idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; }); if (!idAttr) { this._addError(element, "<".concat(_TRANSLATION_TAG, "> misses the \"id\" attribute")); } else { var id = idAttr.value; if (this._msgIdToHtml.hasOwnProperty(id)) { this._addError(element, "Duplicated translations for msg ".concat(id)); } else { var innerTextStart = element.startSourceSpan.end.offset; var innerTextEnd = element.endSourceSpan.start.offset; var content = element.startSourceSpan.start.file.content; var innerText = content.slice(innerTextStart, innerTextEnd); this._msgIdToHtml[id] = innerText; } } break; default: this._addError(element, 'Unexpected tag'); } } }, { key: "visitAttribute", value: function visitAttribute(attribute, context) {} }, { key: "visitText", value: function visitText(text, context) {} }, { key: "visitComment", value: function visitComment(comment, context) {} }, { key: "visitExpansion", value: function visitExpansion(expansion, context) {} }, { key: "visitExpansionCase", value: function visitExpansionCase(expansionCase, context) {} }, { key: "_addError", value: function _addError(node, message) { this._errors.push(new I18nError(node.sourceSpan, message)); } }]); return XtbParser; }(); // Convert ml nodes (xtb syntax) to i18n nodes var XmlToI18n$2 = /*#__PURE__*/function () { function XmlToI18n$2() { _classCallCheck(this, XmlToI18n$2); } _createClass2(XmlToI18n$2, [{ key: "convert", value: function convert(message, url) { var xmlIcu = new XmlParser().parse(message, url, { tokenizeExpansionForms: true }); this._errors = xmlIcu.errors; var i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ? [] : visitAll$1(this, xmlIcu.rootNodes); return { i18nNodes: i18nNodes, errors: this._errors }; } }, { key: "visitText", value: function visitText(text, context) { return new Text$1(text.value, text.sourceSpan); } }, { key: "visitExpansion", value: function visitExpansion(icu, context) { var caseMap = {}; visitAll$1(this, icu.cases).forEach(function (c) { caseMap[c.value] = new Container(c.nodes, icu.sourceSpan); }); return new Icu$1(icu.switchValue, icu.type, caseMap, icu.sourceSpan); } }, { key: "visitExpansionCase", value: function visitExpansionCase(icuCase, context) { return { value: icuCase.value, nodes: visitAll$1(this, icuCase.expression) }; } }, { key: "visitElement", value: function visitElement(el, context) { if (el.name === _PLACEHOLDER_TAG$3) { var nameAttr = el.attrs.find(function (attr) { return attr.name === 'name'; }); if (nameAttr) { return new Placeholder('', nameAttr.value, el.sourceSpan); } this._addError(el, "<".concat(_PLACEHOLDER_TAG$3, "> misses the \"name\" attribute")); } else { this._addError(el, "Unexpected tag"); } return null; } }, { key: "visitComment", value: function visitComment(comment, context) {} }, { key: "visitAttribute", value: function visitAttribute(attribute, context) {} }, { key: "_addError", value: function _addError(node, message) { this._errors.push(new I18nError(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 */ /** * A container for translated messages */ var TranslationBundle = /*#__PURE__*/function () { function TranslationBundle() { var _i18nNodesByMsgId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var locale = arguments.length > 1 ? arguments[1] : undefined; var digest = arguments.length > 2 ? arguments[2] : undefined; var mapperFactory = arguments.length > 3 ? arguments[3] : undefined; var missingTranslationStrategy = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : MissingTranslationStrategy.Warning; var console = arguments.length > 5 ? arguments[5] : undefined; _classCallCheck(this, TranslationBundle); this._i18nNodesByMsgId = _i18nNodesByMsgId; this.digest = digest; this.mapperFactory = mapperFactory; this._i18nToHtml = new I18nToHtmlVisitor(_i18nNodesByMsgId, locale, digest, mapperFactory, missingTranslationStrategy, console); } // Creates a `TranslationBundle` by parsing the given `content` with the `serializer`. _createClass2(TranslationBundle, [{ key: "get", // Returns the translation as HTML nodes from the given source message. value: function get(srcMsg) { var html = this._i18nToHtml.convert(srcMsg); if (html.errors.length) { throw new Error(html.errors.join('\n')); } return html.nodes; } }, { key: "has", value: function has(srcMsg) { return this.digest(srcMsg) in this._i18nNodesByMsgId; } }], [{ key: "load", value: function load(content, url, serializer, missingTranslationStrategy, console) { var _serializer$load = serializer.load(content, url), locale = _serializer$load.locale, i18nNodesByMsgId = _serializer$load.i18nNodesByMsgId; var digestFn = function digestFn(m) { return serializer.digest(m); }; var mapperFactory = function mapperFactory(m) { return serializer.createNameMapper(m); }; return new TranslationBundle(i18nNodesByMsgId, locale, digestFn, mapperFactory, missingTranslationStrategy, console); } }]); return TranslationBundle; }(); var I18nToHtmlVisitor = /*#__PURE__*/function () { function I18nToHtmlVisitor() { var _i18nNodesByMsgId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var _locale = arguments.length > 1 ? arguments[1] : undefined; var _digest = arguments.length > 2 ? arguments[2] : undefined; var _mapperFactory = arguments.length > 3 ? arguments[3] : undefined; var _missingTranslationStrategy = arguments.length > 4 ? arguments[4] : undefined; var _console = arguments.length > 5 ? arguments[5] : undefined; _classCallCheck(this, I18nToHtmlVisitor); this._i18nNodesByMsgId = _i18nNodesByMsgId; this._locale = _locale; this._digest = _digest; this._mapperFactory = _mapperFactory; this._missingTranslationStrategy = _missingTranslationStrategy; this._console = _console; this._contextStack = []; this._errors = []; } _createClass2(I18nToHtmlVisitor, [{ key: "convert", value: function convert(srcMsg) { this._contextStack.length = 0; this._errors.length = 0; // i18n to text var text = this._convertToText(srcMsg); // text to html var url = srcMsg.nodes[0].sourceSpan.start.file.url; var html = new HtmlParser().parse(text, url, { tokenizeExpansionForms: true }); return { nodes: html.rootNodes, errors: [].concat(_toConsumableArray(this._errors), _toConsumableArray(html.errors)) }; } }, { key: "visitText", value: function visitText(text, context) { // `convert()` uses an `HtmlParser` to return `html.Node`s // we should then make sure that any special characters are escaped return escapeXml(text.value); } }, { key: "visitContainer", value: function visitContainer(container, context) { var _this225 = this; return container.children.map(function (n) { return n.visit(_this225); }).join(''); } }, { key: "visitIcu", value: function visitIcu(icu, context) { var _this226 = this; var cases = Object.keys(icu.cases).map(function (k) { return "".concat(k, " {").concat(icu.cases[k].visit(_this226), "}"); }); // TODO(vicb): Once all format switch to using expression placeholders // we should throw when the placeholder is not in the source message var exp = this._srcMsg.placeholders.hasOwnProperty(icu.expression) ? this._srcMsg.placeholders[icu.expression] : icu.expression; return "{".concat(exp, ", ").concat(icu.type, ", ").concat(cases.join(' '), "}"); } }, { key: "visitPlaceholder", value: function visitPlaceholder(ph, context) { var 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 \"".concat(ph.name, "\"")); return ''; } // Loaded message contains only placeholders (vs tag and icu placeholders). // However when a translation can not be found, we need to serialize the source message // which can contain tag placeholders }, { key: "visitTagPlaceholder", value: function visitTagPlaceholder(ph, context) { var _this227 = this; var tag = "".concat(ph.tag); var attrs = Object.keys(ph.attrs).map(function (name) { return "".concat(name, "=\"").concat(ph.attrs[name], "\""); }).join(' '); if (ph.isVoid) { return "<".concat(tag, " ").concat(attrs, "/>"); } var children = ph.children.map(function (c) { return c.visit(_this227); }).join(''); return "<".concat(tag, " ").concat(attrs, ">").concat(children, "</").concat(tag, ">"); } // Loaded message contains only placeholders (vs tag and icu placeholders). // However when a translation can not be found, we need to serialize the source message // which can contain tag placeholders }, { key: "visitIcuPlaceholder", value: function visitIcuPlaceholder(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. */ }, { key: "_convertToText", value: function _convertToText(srcMsg) { var _this228 = this; var id = this._digest(srcMsg); var mapper = this._mapperFactory ? this._mapperFactory(srcMsg) : null; var 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 === MissingTranslationStrategy.Error) { var ctx = this._locale ? " for locale \"".concat(this._locale, "\"") : ''; this._addError(srcMsg.nodes[0], "Missing translation for message \"".concat(id, "\"").concat(ctx)); } else if (this._console && this._missingTranslationStrategy === MissingTranslationStrategy.Warning) { var _ctx2 = this._locale ? " for locale \"".concat(this._locale, "\"") : ''; this._console.warn("Missing translation for message \"".concat(id, "\"").concat(_ctx2)); } nodes = srcMsg.nodes; this._mapper = function (name) { return name; }; } var text = nodes.map(function (node) { return node.visit(_this228); }).join(''); var context = this._contextStack.pop(); this._srcMsg = context.msg; this._mapper = context.mapper; return text; } }, { key: "_addError", value: function _addError(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 = /*#__PURE__*/function () { function I18NHtmlParser(_htmlParser, translations, translationsFormat) { var missingTranslation = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : MissingTranslationStrategy.Warning; var console = arguments.length > 4 ? arguments[4] : undefined; _classCallCheck(this, I18NHtmlParser); this._htmlParser = _htmlParser; if (translations) { var serializer = createSerializer(translationsFormat); this._translationBundle = TranslationBundle.load(translations, 'i18n', serializer, missingTranslation, console); } else { this._translationBundle = new TranslationBundle({}, null, _digest2, undefined, missingTranslation, console); } } _createClass2(I18NHtmlParser, [{ key: "parse", value: function parse(source, url) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var interpolationConfig = options.interpolationConfig || DEFAULT_INTERPOLATION_CONFIG; var parseResult = this._htmlParser.parse(source, url, Object.assign({ interpolationConfig: interpolationConfig }, options)); if (parseResult.errors.length) { return new ParseTreeResult(parseResult.rootNodes, parseResult.errors); } return mergeTranslations(parseResult.rootNodes, this._translationBundle, interpolationConfig, [], {}); } }]); return I18NHtmlParser; }(); 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 QUOTED_KEYS = '$quoted$'; function convertValueToOutputAst(ctx, value) { var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; return visitValue(value, new _ValueOutputAstTransformer(ctx), type); } var _ValueOutputAstTransformer = /*#__PURE__*/function () { function _ValueOutputAstTransformer(ctx) { _classCallCheck(this, _ValueOutputAstTransformer); this.ctx = ctx; } _createClass2(_ValueOutputAstTransformer, [{ key: "visitArray", value: function visitArray(arr, type) { var _this229 = this; return literalArr(arr.map(function (value) { return visitValue(value, _this229, null); }), type); } }, { key: "visitStringMap", value: function visitStringMap(map, type) { var _this230 = this; var entries = []; var quotedSet = new Set(map && map[QUOTED_KEYS]); Object.keys(map).forEach(function (key) { entries.push(new LiteralMapEntry(key, visitValue(map[key], _this230, null), quotedSet.has(key))); }); return new LiteralMapExpr(entries, type); } }, { key: "visitPrimitive", value: function visitPrimitive(value, type) { return literal(value, type); } }, { key: "visitOther", value: function visitOther(value, type) { if (value instanceof Expression) { return value; } else { return this.ctx.importExpr(value); } } }]); return _ValueOutputAstTransformer; }(); /** * @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 */ function mapEntry$1(key, value) { return { key: key, value: value, quoted: false }; } var InjectableCompiler = /*#__PURE__*/function () { function InjectableCompiler(reflector, alwaysGenerateDef) { _classCallCheck(this, InjectableCompiler); this.reflector = reflector; this.alwaysGenerateDef = alwaysGenerateDef; this.tokenInjector = reflector.resolveExternalReference(Identifiers.Injector); } _createClass2(InjectableCompiler, [{ key: "depsArray", value: function depsArray(deps, ctx) { var _this231 = this; return deps.map(function (dep) { var token = dep; var args = [token]; var flags = 0 /* Default */ ; if (Array.isArray(dep)) { for (var i = 0; i < dep.length; i++) { var v = dep[i]; if (v) { if (v.ngMetadataName === 'Optional') { flags |= 8 /* Optional */ ; } else if (v.ngMetadataName === 'SkipSelf') { flags |= 4 /* SkipSelf */ ; } else if (v.ngMetadataName === 'Self') { flags |= 2 /* Self */ ; } else if (v.ngMetadataName === 'Inject') { token = v.token; } else { token = v; } } } } var tokenExpr; if (typeof token === 'string') { tokenExpr = literal(token); } else if (token === _this231.tokenInjector) { tokenExpr = importExpr(Identifiers.INJECTOR); } else { tokenExpr = ctx.importExpr(token); } if (flags !== 0 /* Default */ ) { args = [tokenExpr, literal(flags)]; } else { args = [tokenExpr]; } return importExpr(Identifiers.inject).callFn(args); }); } }, { key: "factoryFor", value: function factoryFor(injectable, ctx) { var retValue; if (injectable.useExisting) { retValue = importExpr(Identifiers.inject).callFn([ctx.importExpr(injectable.useExisting)]); } else if (injectable.useFactory) { var deps = injectable.deps || []; if (deps.length > 0) { retValue = ctx.importExpr(injectable.useFactory).callFn(this.depsArray(deps, ctx)); } else { return ctx.importExpr(injectable.useFactory); } } else if (injectable.useValue) { retValue = convertValueToOutputAst(ctx, injectable.useValue); } else { var clazz = injectable.useClass || injectable.symbol; var depArgs = this.depsArray(this.reflector.parameters(clazz), ctx); retValue = new InstantiateExpr(ctx.importExpr(clazz), depArgs); } return fn([], [new ReturnStatement(retValue)], undefined, undefined, injectable.symbol.name + '_Factory'); } }, { key: "injectableDef", value: function injectableDef(injectable, ctx) { var providedIn = NULL_EXPR; if (injectable.providedIn !== undefined) { if (injectable.providedIn === null) { providedIn = NULL_EXPR; } else if (typeof injectable.providedIn === 'string') { providedIn = literal(injectable.providedIn); } else { providedIn = ctx.importExpr(injectable.providedIn); } } var def = [mapEntry$1('factory', this.factoryFor(injectable, ctx)), mapEntry$1('token', ctx.importExpr(injectable.type.reference)), mapEntry$1('providedIn', providedIn)]; return importExpr(Identifiers.ɵɵdefineInjectable).callFn([literalMap(def)]); } }, { key: "compile", value: function compile(injectable, ctx) { if (this.alwaysGenerateDef || injectable.providedIn !== undefined) { var className = identifierName(injectable.type); var clazz = new ClassStmt(className, null, [new ClassField('ngInjectableDef', INFERRED_TYPE, [StmtModifier.Static], this.injectableDef(injectable, ctx))], [], new ClassMethod(null, [], []), []); ctx.statements.push(clazz); } } }]); return InjectableCompiler; }(); /** * @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 STRIP_SRC_FILE_SUFFIXES = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/; var GENERATED_FILE = /\.ngfactory\.|\.ngsummary\./; var JIT_SUMMARY_FILE = /\.ngsummary\./; var JIT_SUMMARY_NAME = /NgSummary$/; function ngfactoryFilePath(filePath) { var forceSourceFile = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var urlWithSuffix = splitTypescriptSuffix(filePath, forceSourceFile); return "".concat(urlWithSuffix[0], ".ngfactory").concat(normalizeGenFileSuffix(urlWithSuffix[1])); } function stripGeneratedFileSuffix(filePath) { return filePath.replace(GENERATED_FILE, '.'); } function isGeneratedFile(filePath) { return GENERATED_FILE.test(filePath); } function splitTypescriptSuffix(path) { var forceSourceFile = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; if (path.endsWith('.d.ts')) { return [path.slice(0, -5), forceSourceFile ? '.ts' : '.d.ts']; } var lastDot = path.lastIndexOf('.'); if (lastDot !== -1) { return [path.substring(0, lastDot), path.substring(lastDot)]; } return [path, '']; } function normalizeGenFileSuffix(srcFileSuffix) { return srcFileSuffix === '.tsx' ? '.ts' : srcFileSuffix; } function summaryFileName(fileName) { var fileNameWithoutSuffix = fileName.replace(STRIP_SRC_FILE_SUFFIXES, ''); return "".concat(fileNameWithoutSuffix, ".ngsummary.json"); } function summaryForJitFileName(fileName) { var forceSourceFile = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var urlWithSuffix = splitTypescriptSuffix(stripGeneratedFileSuffix(fileName), forceSourceFile); return "".concat(urlWithSuffix[0], ".ngsummary").concat(urlWithSuffix[1]); } function stripSummaryForJitFileSuffix(filePath) { return filePath.replace(JIT_SUMMARY_FILE, '.'); } function summaryForJitName(symbolName) { return "".concat(symbolName, "NgSummary"); } function stripSummaryForJitNameSuffix(symbolName) { return symbolName.replace(JIT_SUMMARY_NAME, ''); } var LOWERED_SYMBOL = /\u0275\d+/; function isLoweredSymbol(name) { return LOWERED_SYMBOL.test(name); } function createLoweredSymbol(id) { return "\u0275".concat(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 LifecycleHooks; (function (LifecycleHooks) { LifecycleHooks[LifecycleHooks["OnInit"] = 0] = "OnInit"; LifecycleHooks[LifecycleHooks["OnDestroy"] = 1] = "OnDestroy"; LifecycleHooks[LifecycleHooks["DoCheck"] = 2] = "DoCheck"; LifecycleHooks[LifecycleHooks["OnChanges"] = 3] = "OnChanges"; LifecycleHooks[LifecycleHooks["AfterContentInit"] = 4] = "AfterContentInit"; LifecycleHooks[LifecycleHooks["AfterContentChecked"] = 5] = "AfterContentChecked"; LifecycleHooks[LifecycleHooks["AfterViewInit"] = 6] = "AfterViewInit"; LifecycleHooks[LifecycleHooks["AfterViewChecked"] = 7] = "AfterViewChecked"; })(LifecycleHooks || (LifecycleHooks = {})); var LIFECYCLE_HOOKS_VALUES = [LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges, LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit, LifecycleHooks.AfterViewChecked]; function hasLifecycleHook(reflector, hook, token) { return reflector.hasLifecycleHook(token, getHookName(hook)); } function getAllLifecycleHooks(reflector, token) { return LIFECYCLE_HOOKS_VALUES.filter(function (hook) { return hasLifecycleHook(reflector, hook, token); }); } function getHookName(hook) { switch (hook) { case LifecycleHooks.OnInit: return 'ngOnInit'; case LifecycleHooks.OnDestroy: return 'ngOnDestroy'; case LifecycleHooks.DoCheck: return 'ngDoCheck'; case LifecycleHooks.OnChanges: return 'ngOnChanges'; case LifecycleHooks.AfterContentInit: return 'ngAfterContentInit'; case LifecycleHooks.AfterContentChecked: return 'ngAfterContentChecked'; case LifecycleHooks.AfterViewInit: return 'ngAfterViewInit'; case LifecycleHooks.AfterViewChecked: return 'ngAfterViewChecked'; default: // This default case is not needed by TypeScript compiler, as the switch is exhaustive. // However Closure Compiler does not understand that and reports an error in typed mode. // The `throw new Error` below works around the problem, and the unexpected: never variable // makes sure tsc still checks this code is unreachable. var unexpected = hook; throw new Error("unexpected ".concat(unexpected)); } } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var ERROR_COMPONENT_TYPE = 'ngComponentType'; // Design notes: // - don't lazily create metadata: // For some metadata, we need to do async work sometimes, // so the user has to kick off this loading. // But we want to report errors even when the async work is // not required to check that the user would have been able // to wait correctly. var CompileMetadataResolver = /*#__PURE__*/function () { function CompileMetadataResolver(_config, _htmlParser, _ngModuleResolver, _directiveResolver, _pipeResolver, _summaryResolver, _schemaRegistry, _directiveNormalizer, _console, _staticSymbolCache, _reflector, _errorCollector) { _classCallCheck(this, CompileMetadataResolver); this._config = _config; this._htmlParser = _htmlParser; this._ngModuleResolver = _ngModuleResolver; this._directiveResolver = _directiveResolver; this._pipeResolver = _pipeResolver; this._summaryResolver = _summaryResolver; this._schemaRegistry = _schemaRegistry; this._directiveNormalizer = _directiveNormalizer; this._console = _console; this._staticSymbolCache = _staticSymbolCache; this._reflector = _reflector; this._errorCollector = _errorCollector; this._nonNormalizedDirectiveCache = new Map(); this._directiveCache = new Map(); this._summaryCache = new Map(); this._pipeCache = new Map(); this._ngModuleCache = new Map(); this._ngModuleOfTypes = new Map(); this._shallowModuleCache = new Map(); } _createClass2(CompileMetadataResolver, [{ key: "getReflector", value: function getReflector() { return this._reflector; } }, { key: "clearCacheFor", value: function clearCacheFor(type) { var dirMeta = this._directiveCache.get(type); this._directiveCache["delete"](type); this._nonNormalizedDirectiveCache["delete"](type); this._summaryCache["delete"](type); this._pipeCache["delete"](type); this._ngModuleOfTypes["delete"](type); // Clear all of the NgModule as they contain transitive information! this._ngModuleCache.clear(); if (dirMeta) { this._directiveNormalizer.clearCacheFor(dirMeta); } } }, { key: "clearCache", value: function clearCache() { this._directiveCache.clear(); this._nonNormalizedDirectiveCache.clear(); this._summaryCache.clear(); this._pipeCache.clear(); this._ngModuleCache.clear(); this._ngModuleOfTypes.clear(); this._directiveNormalizer.clearCache(); } }, { key: "_createProxyClass", value: function _createProxyClass(baseType, name) { var delegate = null; var proxyClass = function proxyClass() { if (!delegate) { throw new Error("Illegal state: Class ".concat(name, " for type ").concat(stringify(baseType), " is not compiled yet!")); } return delegate.apply(this, arguments); }; proxyClass.setDelegate = function (d) { delegate = d; proxyClass.prototype = d.prototype; }; // Make stringify work correctly proxyClass.overriddenName = name; return proxyClass; } }, { key: "getGeneratedClass", value: function getGeneratedClass(dirType, name) { if (dirType instanceof StaticSymbol) { return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), name); } else { return this._createProxyClass(dirType, name); } } }, { key: "getComponentViewClass", value: function getComponentViewClass(dirType) { return this.getGeneratedClass(dirType, viewClassName(dirType, 0)); } }, { key: "getHostComponentViewClass", value: function getHostComponentViewClass(dirType) { return this.getGeneratedClass(dirType, hostViewClassName(dirType)); } }, { key: "getHostComponentType", value: function getHostComponentType(dirType) { var name = "".concat(identifierName({ reference: dirType }), "_Host"); if (dirType instanceof StaticSymbol) { return this._staticSymbolCache.get(dirType.filePath, name); } return this._createProxyClass(dirType, name); } }, { key: "getRendererType", value: function getRendererType(dirType) { if (dirType instanceof StaticSymbol) { return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), rendererTypeName(dirType)); } else { // returning an object as proxy, // that we fill later during runtime compilation. return {}; } } }, { key: "getComponentFactory", value: function getComponentFactory(selector, dirType, inputs, outputs) { if (dirType instanceof StaticSymbol) { return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), componentFactoryName(dirType)); } else { var hostView = this.getHostComponentViewClass(dirType); // Note: ngContentSelectors will be filled later once the template is // loaded. var createComponentFactory = this._reflector.resolveExternalReference(Identifiers.createComponentFactory); return createComponentFactory(selector, dirType, hostView, inputs, outputs, []); } } }, { key: "initComponentFactory", value: function initComponentFactory(factory, ngContentSelectors) { if (!(factory instanceof StaticSymbol)) { var _factory$ngContentSel; (_factory$ngContentSel = factory.ngContentSelectors).push.apply(_factory$ngContentSel, _toConsumableArray(ngContentSelectors)); } } }, { key: "_loadSummary", value: function _loadSummary(type, kind) { var typeSummary = this._summaryCache.get(type); if (!typeSummary) { var summary = this._summaryResolver.resolveSummary(type); typeSummary = summary ? summary.type : null; this._summaryCache.set(type, typeSummary || null); } return typeSummary && typeSummary.summaryKind === kind ? typeSummary : null; } }, { key: "getHostComponentMetadata", value: function getHostComponentMetadata(compMeta, hostViewType) { var hostType = this.getHostComponentType(compMeta.type.reference); if (!hostViewType) { hostViewType = this.getHostComponentViewClass(hostType); } // Note: ! is ok here as this method should only be called with normalized directive // metadata, which always fills in the selector. var template = CssSelector.parse(compMeta.selector)[0].getMatchingElementTemplate(); var templateUrl = ''; var htmlAst = this._htmlParser.parse(template, templateUrl); return CompileDirectiveMetadata.create({ isHost: true, type: { reference: hostType, diDeps: [], lifecycleHooks: [] }, template: new CompileTemplateMetadata({ encapsulation: ViewEncapsulation.None, template: template, templateUrl: templateUrl, htmlAst: htmlAst, styles: [], styleUrls: [], ngContentSelectors: [], animations: [], isInline: true, externalStylesheets: [], interpolation: null, preserveWhitespaces: false }), exportAs: null, changeDetection: ChangeDetectionStrategy.Default, inputs: [], outputs: [], host: {}, isComponent: true, selector: '*', providers: [], viewProviders: [], queries: [], guards: {}, viewQueries: [], componentViewType: hostViewType, rendererType: { id: '__Host__', encapsulation: ViewEncapsulation.None, styles: [], data: {} }, entryComponents: [], componentFactory: null }); } }, { key: "loadDirectiveMetadata", value: function loadDirectiveMetadata(ngModuleType, directiveType, isSync) { var _this232 = this; if (this._directiveCache.has(directiveType)) { return null; } directiveType = resolveForwardRef(directiveType); var _this$getNonNormalize = this.getNonNormalizedDirectiveMetadata(directiveType), annotation = _this$getNonNormalize.annotation, metadata = _this$getNonNormalize.metadata; var createDirectiveMetadata = function createDirectiveMetadata(templateMetadata) { var normalizedDirMeta = new CompileDirectiveMetadata({ isHost: false, type: metadata.type, isComponent: metadata.isComponent, selector: metadata.selector, exportAs: metadata.exportAs, changeDetection: metadata.changeDetection, inputs: metadata.inputs, outputs: metadata.outputs, hostListeners: metadata.hostListeners, hostProperties: metadata.hostProperties, hostAttributes: metadata.hostAttributes, providers: metadata.providers, viewProviders: metadata.viewProviders, queries: metadata.queries, guards: metadata.guards, viewQueries: metadata.viewQueries, entryComponents: metadata.entryComponents, componentViewType: metadata.componentViewType, rendererType: metadata.rendererType, componentFactory: metadata.componentFactory, template: templateMetadata }); if (templateMetadata) { _this232.initComponentFactory(metadata.componentFactory, templateMetadata.ngContentSelectors); } _this232._directiveCache.set(directiveType, normalizedDirMeta); _this232._summaryCache.set(directiveType, normalizedDirMeta.toSummary()); return null; }; if (metadata.isComponent) { var template = metadata.template; var templateMeta = this._directiveNormalizer.normalizeTemplate({ ngModuleType: ngModuleType, componentType: directiveType, moduleUrl: this._reflector.componentModuleUrl(directiveType, annotation), encapsulation: template.encapsulation, template: template.template, templateUrl: template.templateUrl, styles: template.styles, styleUrls: template.styleUrls, animations: template.animations, interpolation: template.interpolation, preserveWhitespaces: template.preserveWhitespaces }); if (isPromise(templateMeta) && isSync) { this._reportError(componentStillLoadingError(directiveType), directiveType); return null; } return SyncAsync.then(templateMeta, createDirectiveMetadata); } else { // directive createDirectiveMetadata(null); return null; } } }, { key: "getNonNormalizedDirectiveMetadata", value: function getNonNormalizedDirectiveMetadata(directiveType) { var _this233 = this; directiveType = resolveForwardRef(directiveType); if (!directiveType) { return null; } var cacheEntry = this._nonNormalizedDirectiveCache.get(directiveType); if (cacheEntry) { return cacheEntry; } var dirMeta = this._directiveResolver.resolve(directiveType, false); if (!dirMeta) { return null; } var nonNormalizedTemplateMetadata = undefined; if (createComponent.isTypeOf(dirMeta)) { // component var compMeta = dirMeta; assertArrayOfStrings('styles', compMeta.styles); assertArrayOfStrings('styleUrls', compMeta.styleUrls); assertInterpolationSymbols('interpolation', compMeta.interpolation); var animations = compMeta.animations; nonNormalizedTemplateMetadata = new CompileTemplateMetadata({ encapsulation: noUndefined(compMeta.encapsulation), template: noUndefined(compMeta.template), templateUrl: noUndefined(compMeta.templateUrl), htmlAst: null, styles: compMeta.styles || [], styleUrls: compMeta.styleUrls || [], animations: animations || [], interpolation: noUndefined(compMeta.interpolation), isInline: !!compMeta.template, externalStylesheets: [], ngContentSelectors: [], preserveWhitespaces: noUndefined(dirMeta.preserveWhitespaces) }); } var changeDetectionStrategy = null; var viewProviders = []; var entryComponentMetadata = []; var selector = dirMeta.selector; if (createComponent.isTypeOf(dirMeta)) { // Component var _compMeta = dirMeta; changeDetectionStrategy = _compMeta.changeDetection; if (_compMeta.viewProviders) { viewProviders = this._getProvidersMetadata(_compMeta.viewProviders, entryComponentMetadata, "viewProviders for \"".concat(stringifyType(directiveType), "\""), [], directiveType); } if (_compMeta.entryComponents) { entryComponentMetadata = flattenAndDedupeArray(_compMeta.entryComponents).map(function (type) { return _this233._getEntryComponentMetadata(type); }).concat(entryComponentMetadata); } if (!selector) { selector = this._schemaRegistry.getDefaultComponentElementName(); } } else { // Directive if (!selector) { this._reportError(syntaxError("Directive ".concat(stringifyType(directiveType), " has no selector, please add it!")), directiveType); selector = 'error'; } } var providers = []; if (dirMeta.providers != null) { providers = this._getProvidersMetadata(dirMeta.providers, entryComponentMetadata, "providers for \"".concat(stringifyType(directiveType), "\""), [], directiveType); } var queries = []; var viewQueries = []; if (dirMeta.queries != null) { queries = this._getQueriesMetadata(dirMeta.queries, false, directiveType); viewQueries = this._getQueriesMetadata(dirMeta.queries, true, directiveType); } var metadata = CompileDirectiveMetadata.create({ isHost: false, selector: selector, exportAs: noUndefined(dirMeta.exportAs), isComponent: !!nonNormalizedTemplateMetadata, type: this._getTypeMetadata(directiveType), template: nonNormalizedTemplateMetadata, changeDetection: changeDetectionStrategy, inputs: dirMeta.inputs || [], outputs: dirMeta.outputs || [], host: dirMeta.host || {}, providers: providers || [], viewProviders: viewProviders || [], queries: queries || [], guards: dirMeta.guards || {}, viewQueries: viewQueries || [], entryComponents: entryComponentMetadata, componentViewType: nonNormalizedTemplateMetadata ? this.getComponentViewClass(directiveType) : null, rendererType: nonNormalizedTemplateMetadata ? this.getRendererType(directiveType) : null, componentFactory: null }); if (nonNormalizedTemplateMetadata) { metadata.componentFactory = this.getComponentFactory(selector, directiveType, metadata.inputs, metadata.outputs); } cacheEntry = { metadata: metadata, annotation: dirMeta }; this._nonNormalizedDirectiveCache.set(directiveType, cacheEntry); return cacheEntry; } /** * Gets the metadata for the given directive. * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first. */ }, { key: "getDirectiveMetadata", value: function getDirectiveMetadata(directiveType) { var dirMeta = this._directiveCache.get(directiveType); if (!dirMeta) { this._reportError(syntaxError("Illegal state: getDirectiveMetadata can only be called after loadNgModuleDirectiveAndPipeMetadata for a module that declares it. Directive ".concat(stringifyType(directiveType), ".")), directiveType); } return dirMeta; } }, { key: "getDirectiveSummary", value: function getDirectiveSummary(dirType) { var dirSummary = this._loadSummary(dirType, CompileSummaryKind.Directive); if (!dirSummary) { this._reportError(syntaxError("Illegal state: Could not load the summary for directive ".concat(stringifyType(dirType), ".")), dirType); } return dirSummary; } }, { key: "isDirective", value: function isDirective(type) { return !!this._loadSummary(type, CompileSummaryKind.Directive) || this._directiveResolver.isDirective(type); } }, { key: "isPipe", value: function isPipe(type) { return !!this._loadSummary(type, CompileSummaryKind.Pipe) || this._pipeResolver.isPipe(type); } }, { key: "isNgModule", value: function isNgModule(type) { return !!this._loadSummary(type, CompileSummaryKind.NgModule) || this._ngModuleResolver.isNgModule(type); } }, { key: "getNgModuleSummary", value: function getNgModuleSummary(moduleType) { var alreadyCollecting = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var moduleSummary = this._loadSummary(moduleType, CompileSummaryKind.NgModule); if (!moduleSummary) { var moduleMeta = this.getNgModuleMetadata(moduleType, false, alreadyCollecting); moduleSummary = moduleMeta ? moduleMeta.toSummary() : null; if (moduleSummary) { this._summaryCache.set(moduleType, moduleSummary); } } return moduleSummary; } /** * Loads the declared directives and pipes of an NgModule. */ }, { key: "loadNgModuleDirectiveAndPipeMetadata", value: function loadNgModuleDirectiveAndPipeMetadata(moduleType, isSync) { var _this234 = this; var throwIfNotFound = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; var ngModule = this.getNgModuleMetadata(moduleType, throwIfNotFound); var loading = []; if (ngModule) { ngModule.declaredDirectives.forEach(function (id) { var promise = _this234.loadDirectiveMetadata(moduleType, id.reference, isSync); if (promise) { loading.push(promise); } }); ngModule.declaredPipes.forEach(function (id) { return _this234._loadPipeMetadata(id.reference); }); } return Promise.all(loading); } }, { key: "getShallowModuleMetadata", value: function getShallowModuleMetadata(moduleType) { var compileMeta = this._shallowModuleCache.get(moduleType); if (compileMeta) { return compileMeta; } var ngModuleMeta = findLast(this._reflector.shallowAnnotations(moduleType), createNgModule.isTypeOf); compileMeta = { type: this._getTypeMetadata(moduleType), rawExports: ngModuleMeta.exports, rawImports: ngModuleMeta.imports, rawProviders: ngModuleMeta.providers }; this._shallowModuleCache.set(moduleType, compileMeta); return compileMeta; } }, { key: "getNgModuleMetadata", value: function getNgModuleMetadata(moduleType) { var _this235 = this; var throwIfNotFound = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var alreadyCollecting = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; moduleType = resolveForwardRef(moduleType); var compileMeta = this._ngModuleCache.get(moduleType); if (compileMeta) { return compileMeta; } var meta = this._ngModuleResolver.resolve(moduleType, throwIfNotFound); if (!meta) { return null; } var declaredDirectives = []; var exportedNonModuleIdentifiers = []; var declaredPipes = []; var importedModules = []; var exportedModules = []; var providers = []; var entryComponents = []; var bootstrapComponents = []; var schemas = []; if (meta.imports) { flattenAndDedupeArray(meta.imports).forEach(function (importedType) { var importedModuleType = undefined; if (isValidType(importedType)) { importedModuleType = importedType; } else if (importedType && importedType.ngModule) { var moduleWithProviders = importedType; importedModuleType = moduleWithProviders.ngModule; if (moduleWithProviders.providers) { providers.push.apply(providers, _toConsumableArray(_this235._getProvidersMetadata(moduleWithProviders.providers, entryComponents, "provider for the NgModule '".concat(stringifyType(importedModuleType), "'"), [], importedType))); } } if (importedModuleType) { if (_this235._checkSelfImport(moduleType, importedModuleType)) return; if (!alreadyCollecting) alreadyCollecting = new Set(); if (alreadyCollecting.has(importedModuleType)) { _this235._reportError(syntaxError("".concat(_this235._getTypeDescriptor(importedModuleType), " '").concat(stringifyType(importedType), "' is imported recursively by the module '").concat(stringifyType(moduleType), "'.")), moduleType); return; } alreadyCollecting.add(importedModuleType); var importedModuleSummary = _this235.getNgModuleSummary(importedModuleType, alreadyCollecting); alreadyCollecting["delete"](importedModuleType); if (!importedModuleSummary) { _this235._reportError(syntaxError("Unexpected ".concat(_this235._getTypeDescriptor(importedType), " '").concat(stringifyType(importedType), "' imported by the module '").concat(stringifyType(moduleType), "'. Please add a @NgModule annotation.")), moduleType); return; } importedModules.push(importedModuleSummary); } else { _this235._reportError(syntaxError("Unexpected value '".concat(stringifyType(importedType), "' imported by the module '").concat(stringifyType(moduleType), "'")), moduleType); return; } }); } if (meta.exports) { flattenAndDedupeArray(meta.exports).forEach(function (exportedType) { if (!isValidType(exportedType)) { _this235._reportError(syntaxError("Unexpected value '".concat(stringifyType(exportedType), "' exported by the module '").concat(stringifyType(moduleType), "'")), moduleType); return; } if (!alreadyCollecting) alreadyCollecting = new Set(); if (alreadyCollecting.has(exportedType)) { _this235._reportError(syntaxError("".concat(_this235._getTypeDescriptor(exportedType), " '").concat(stringify(exportedType), "' is exported recursively by the module '").concat(stringifyType(moduleType), "'")), moduleType); return; } alreadyCollecting.add(exportedType); var exportedModuleSummary = _this235.getNgModuleSummary(exportedType, alreadyCollecting); alreadyCollecting["delete"](exportedType); if (exportedModuleSummary) { exportedModules.push(exportedModuleSummary); } else { exportedNonModuleIdentifiers.push(_this235._getIdentifierMetadata(exportedType)); } }); } // Note: This will be modified later, so we rely on // getting a new instance every time! var transitiveModule = this._getTransitiveNgModuleMetadata(importedModules, exportedModules); if (meta.declarations) { flattenAndDedupeArray(meta.declarations).forEach(function (declaredType) { if (!isValidType(declaredType)) { _this235._reportError(syntaxError("Unexpected value '".concat(stringifyType(declaredType), "' declared by the module '").concat(stringifyType(moduleType), "'")), moduleType); return; } var declaredIdentifier = _this235._getIdentifierMetadata(declaredType); if (_this235.isDirective(declaredType)) { transitiveModule.addDirective(declaredIdentifier); declaredDirectives.push(declaredIdentifier); _this235._addTypeToModule(declaredType, moduleType); } else if (_this235.isPipe(declaredType)) { transitiveModule.addPipe(declaredIdentifier); transitiveModule.pipes.push(declaredIdentifier); declaredPipes.push(declaredIdentifier); _this235._addTypeToModule(declaredType, moduleType); } else { _this235._reportError(syntaxError("Unexpected ".concat(_this235._getTypeDescriptor(declaredType), " '").concat(stringifyType(declaredType), "' declared by the module '").concat(stringifyType(moduleType), "'. Please add a @Pipe/@Directive/@Component annotation.")), moduleType); return; } }); } var exportedDirectives = []; var exportedPipes = []; exportedNonModuleIdentifiers.forEach(function (exportedId) { if (transitiveModule.directivesSet.has(exportedId.reference)) { exportedDirectives.push(exportedId); transitiveModule.addExportedDirective(exportedId); } else if (transitiveModule.pipesSet.has(exportedId.reference)) { exportedPipes.push(exportedId); transitiveModule.addExportedPipe(exportedId); } else { _this235._reportError(syntaxError("Can't export ".concat(_this235._getTypeDescriptor(exportedId.reference), " ").concat(stringifyType(exportedId.reference), " from ").concat(stringifyType(moduleType), " as it was neither declared nor imported!")), moduleType); return; } }); // The providers of the module have to go last // so that they overwrite any other provider we already added. if (meta.providers) { providers.push.apply(providers, _toConsumableArray(this._getProvidersMetadata(meta.providers, entryComponents, "provider for the NgModule '".concat(stringifyType(moduleType), "'"), [], moduleType))); } if (meta.entryComponents) { entryComponents.push.apply(entryComponents, _toConsumableArray(flattenAndDedupeArray(meta.entryComponents).map(function (type) { return _this235._getEntryComponentMetadata(type); }))); } if (meta.bootstrap) { flattenAndDedupeArray(meta.bootstrap).forEach(function (type) { if (!isValidType(type)) { _this235._reportError(syntaxError("Unexpected value '".concat(stringifyType(type), "' used in the bootstrap property of module '").concat(stringifyType(moduleType), "'")), moduleType); return; } bootstrapComponents.push(_this235._getIdentifierMetadata(type)); }); } entryComponents.push.apply(entryComponents, _toConsumableArray(bootstrapComponents.map(function (type) { return _this235._getEntryComponentMetadata(type.reference); }))); if (meta.schemas) { schemas.push.apply(schemas, _toConsumableArray(flattenAndDedupeArray(meta.schemas))); } compileMeta = new CompileNgModuleMetadata({ type: this._getTypeMetadata(moduleType), providers: providers, entryComponents: entryComponents, bootstrapComponents: bootstrapComponents, schemas: schemas, declaredDirectives: declaredDirectives, exportedDirectives: exportedDirectives, declaredPipes: declaredPipes, exportedPipes: exportedPipes, importedModules: importedModules, exportedModules: exportedModules, transitiveModule: transitiveModule, id: meta.id || null }); entryComponents.forEach(function (id) { return transitiveModule.addEntryComponent(id); }); providers.forEach(function (provider) { return transitiveModule.addProvider(provider, compileMeta.type); }); transitiveModule.addModule(compileMeta.type); this._ngModuleCache.set(moduleType, compileMeta); return compileMeta; } }, { key: "_checkSelfImport", value: function _checkSelfImport(moduleType, importedModuleType) { if (moduleType === importedModuleType) { this._reportError(syntaxError("'".concat(stringifyType(moduleType), "' module can't import itself")), moduleType); return true; } return false; } }, { key: "_getTypeDescriptor", value: function _getTypeDescriptor(type) { if (isValidType(type)) { if (this.isDirective(type)) { return 'directive'; } if (this.isPipe(type)) { return 'pipe'; } if (this.isNgModule(type)) { return 'module'; } } if (type.provide) { return 'provider'; } return 'value'; } }, { key: "_addTypeToModule", value: function _addTypeToModule(type, moduleType) { var oldModule = this._ngModuleOfTypes.get(type); if (oldModule && oldModule !== moduleType) { this._reportError(syntaxError("Type ".concat(stringifyType(type), " is part of the declarations of 2 modules: ").concat(stringifyType(oldModule), " and ").concat(stringifyType(moduleType), "! ") + "Please consider moving ".concat(stringifyType(type), " to a higher module that imports ").concat(stringifyType(oldModule), " and ").concat(stringifyType(moduleType), ". ") + "You can also create a new NgModule that exports and includes ".concat(stringifyType(type), " then import that NgModule in ").concat(stringifyType(oldModule), " and ").concat(stringifyType(moduleType), ".")), moduleType); return; } this._ngModuleOfTypes.set(type, moduleType); } }, { key: "_getTransitiveNgModuleMetadata", value: function _getTransitiveNgModuleMetadata(importedModules, exportedModules) { // collect `providers` / `entryComponents` from all imported and all exported modules var result = new TransitiveCompileNgModuleMetadata(); var modulesByToken = new Map(); importedModules.concat(exportedModules).forEach(function (modSummary) { modSummary.modules.forEach(function (mod) { return result.addModule(mod); }); modSummary.entryComponents.forEach(function (comp) { return result.addEntryComponent(comp); }); var addedTokens = new Set(); modSummary.providers.forEach(function (entry) { var tokenRef = tokenReference(entry.provider.token); var prevModules = modulesByToken.get(tokenRef); if (!prevModules) { prevModules = new Set(); modulesByToken.set(tokenRef, prevModules); } var moduleRef = entry.module.reference; // Note: the providers of one module may still contain multiple providers // per token (e.g. for multi providers), and we need to preserve these. if (addedTokens.has(tokenRef) || !prevModules.has(moduleRef)) { prevModules.add(moduleRef); addedTokens.add(tokenRef); result.addProvider(entry.provider, entry.module); } }); }); exportedModules.forEach(function (modSummary) { modSummary.exportedDirectives.forEach(function (id) { return result.addExportedDirective(id); }); modSummary.exportedPipes.forEach(function (id) { return result.addExportedPipe(id); }); }); importedModules.forEach(function (modSummary) { modSummary.exportedDirectives.forEach(function (id) { return result.addDirective(id); }); modSummary.exportedPipes.forEach(function (id) { return result.addPipe(id); }); }); return result; } }, { key: "_getIdentifierMetadata", value: function _getIdentifierMetadata(type) { type = resolveForwardRef(type); return { reference: type }; } }, { key: "isInjectable", value: function isInjectable(type) { var annotations = this._reflector.tryAnnotations(type); return annotations.some(function (ann) { return createInjectable.isTypeOf(ann); }); } }, { key: "getInjectableSummary", value: function getInjectableSummary(type) { return { summaryKind: CompileSummaryKind.Injectable, type: this._getTypeMetadata(type, null, false) }; } }, { key: "getInjectableMetadata", value: function getInjectableMetadata(type) { var dependencies = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var throwOnUnknownDeps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; var typeSummary = this._loadSummary(type, CompileSummaryKind.Injectable); var typeMetadata = typeSummary ? typeSummary.type : this._getTypeMetadata(type, dependencies, throwOnUnknownDeps); var annotations = this._reflector.annotations(type).filter(function (ann) { return createInjectable.isTypeOf(ann); }); if (annotations.length === 0) { return null; } var meta = annotations[annotations.length - 1]; return { symbol: type, type: typeMetadata, providedIn: meta.providedIn, useValue: meta.useValue, useClass: meta.useClass, useExisting: meta.useExisting, useFactory: meta.useFactory, deps: meta.deps }; } }, { key: "_getTypeMetadata", value: function _getTypeMetadata(type) { var dependencies = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var throwOnUnknownDeps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; var identifier = this._getIdentifierMetadata(type); return { reference: identifier.reference, diDeps: this._getDependenciesMetadata(identifier.reference, dependencies, throwOnUnknownDeps), lifecycleHooks: getAllLifecycleHooks(this._reflector, identifier.reference) }; } }, { key: "_getFactoryMetadata", value: function _getFactoryMetadata(factory) { var dependencies = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; factory = resolveForwardRef(factory); return { reference: factory, diDeps: this._getDependenciesMetadata(factory, dependencies) }; } /** * Gets the metadata for the given pipe. * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first. */ }, { key: "getPipeMetadata", value: function getPipeMetadata(pipeType) { var pipeMeta = this._pipeCache.get(pipeType); if (!pipeMeta) { this._reportError(syntaxError("Illegal state: getPipeMetadata can only be called after loadNgModuleDirectiveAndPipeMetadata for a module that declares it. Pipe ".concat(stringifyType(pipeType), ".")), pipeType); } return pipeMeta || null; } }, { key: "getPipeSummary", value: function getPipeSummary(pipeType) { var pipeSummary = this._loadSummary(pipeType, CompileSummaryKind.Pipe); if (!pipeSummary) { this._reportError(syntaxError("Illegal state: Could not load the summary for pipe ".concat(stringifyType(pipeType), ".")), pipeType); } return pipeSummary; } }, { key: "getOrLoadPipeMetadata", value: function getOrLoadPipeMetadata(pipeType) { var pipeMeta = this._pipeCache.get(pipeType); if (!pipeMeta) { pipeMeta = this._loadPipeMetadata(pipeType); } return pipeMeta; } }, { key: "_loadPipeMetadata", value: function _loadPipeMetadata(pipeType) { pipeType = resolveForwardRef(pipeType); var pipeAnnotation = this._pipeResolver.resolve(pipeType); var pipeMeta = new CompilePipeMetadata({ type: this._getTypeMetadata(pipeType), name: pipeAnnotation.name, pure: !!pipeAnnotation.pure }); this._pipeCache.set(pipeType, pipeMeta); this._summaryCache.set(pipeType, pipeMeta.toSummary()); return pipeMeta; } }, { key: "_getDependenciesMetadata", value: function _getDependenciesMetadata(typeOrFunc, dependencies) { var _this236 = this; var throwOnUnknownDeps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; var hasUnknownDeps = false; var params = dependencies || this._reflector.parameters(typeOrFunc) || []; var dependenciesMetadata = params.map(function (param) { var isAttribute = false; var isHost = false; var isSelf = false; var isSkipSelf = false; var isOptional = false; var token = null; if (Array.isArray(param)) { param.forEach(function (paramEntry) { if (createHost.isTypeOf(paramEntry)) { isHost = true; } else if (createSelf.isTypeOf(paramEntry)) { isSelf = true; } else if (createSkipSelf.isTypeOf(paramEntry)) { isSkipSelf = true; } else if (createOptional.isTypeOf(paramEntry)) { isOptional = true; } else if (createAttribute.isTypeOf(paramEntry)) { isAttribute = true; token = paramEntry.attributeName; } else if (createInject.isTypeOf(paramEntry)) { token = paramEntry.token; } else if (createInjectionToken.isTypeOf(paramEntry) || paramEntry instanceof StaticSymbol) { token = paramEntry; } else if (isValidType(paramEntry) && token == null) { token = paramEntry; } }); } else { token = param; } if (token == null) { hasUnknownDeps = true; return {}; } return { isAttribute: isAttribute, isHost: isHost, isSelf: isSelf, isSkipSelf: isSkipSelf, isOptional: isOptional, token: _this236._getTokenMetadata(token) }; }); if (hasUnknownDeps) { var depsTokens = dependenciesMetadata.map(function (dep) { return dep.token ? stringifyType(dep.token) : '?'; }).join(', '); var message = "Can't resolve all parameters for ".concat(stringifyType(typeOrFunc), ": (").concat(depsTokens, ")."); if (throwOnUnknownDeps || this._config.strictInjectionParameters) { this._reportError(syntaxError(message), typeOrFunc); } else { this._console.warn("Warning: ".concat(message, " This will become an error in Angular v6.x")); } } return dependenciesMetadata; } }, { key: "_getTokenMetadata", value: function _getTokenMetadata(token) { token = resolveForwardRef(token); var compileToken; if (typeof token === 'string') { compileToken = { value: token }; } else { compileToken = { identifier: { reference: token } }; } return compileToken; } }, { key: "_getProvidersMetadata", value: function _getProvidersMetadata(providers, targetEntryComponents, debugInfo) { var _this237 = this; var compileProviders = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; var type = arguments.length > 4 ? arguments[4] : undefined; providers.forEach(function (provider, providerIdx) { if (Array.isArray(provider)) { _this237._getProvidersMetadata(provider, targetEntryComponents, debugInfo, compileProviders); } else { provider = resolveForwardRef(provider); var providerMeta = undefined; if (provider && typeof provider === 'object' && provider.hasOwnProperty('provide')) { _this237._validateProvider(provider); providerMeta = new ProviderMeta(provider.provide, provider); } else if (isValidType(provider)) { providerMeta = new ProviderMeta(provider, { useClass: provider }); } else if (provider === void 0) { _this237._reportError(syntaxError("Encountered undefined provider! Usually this means you have a circular dependencies. This might be caused by using 'barrel' index.ts files.")); return; } else { var providersInfo = providers.reduce(function (soFar, seenProvider, seenProviderIdx) { if (seenProviderIdx < providerIdx) { soFar.push("".concat(stringifyType(seenProvider))); } else if (seenProviderIdx == providerIdx) { soFar.push("?".concat(stringifyType(seenProvider), "?")); } else if (seenProviderIdx == providerIdx + 1) { soFar.push('...'); } return soFar; }, []).join(', '); _this237._reportError(syntaxError("Invalid ".concat(debugInfo ? debugInfo : 'provider', " - only instances of Provider and Type are allowed, got: [").concat(providersInfo, "]")), type); return; } if (providerMeta.token === _this237._reflector.resolveExternalReference(Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS)) { targetEntryComponents.push.apply(targetEntryComponents, _toConsumableArray(_this237._getEntryComponentsFromProvider(providerMeta, type))); } else { compileProviders.push(_this237.getProviderMetadata(providerMeta)); } } }); return compileProviders; } }, { key: "_validateProvider", value: function _validateProvider(provider) { if (provider.hasOwnProperty('useClass') && provider.useClass == null) { this._reportError(syntaxError("Invalid provider for ".concat(stringifyType(provider.provide), ". useClass cannot be ").concat(provider.useClass, ".\n Usually it happens when:\n 1. There's a circular dependency (might be caused by using index.ts (barrel) files).\n 2. Class was used before it was declared. Use forwardRef in this case."))); } } }, { key: "_getEntryComponentsFromProvider", value: function _getEntryComponentsFromProvider(provider, type) { var _this238 = this; var components = []; var collectedIdentifiers = []; if (provider.useFactory || provider.useExisting || provider.useClass) { this._reportError(syntaxError("The ANALYZE_FOR_ENTRY_COMPONENTS token only supports useValue!"), type); return []; } if (!provider.multi) { this._reportError(syntaxError("The ANALYZE_FOR_ENTRY_COMPONENTS token only supports 'multi = true'!"), type); return []; } extractIdentifiers(provider.useValue, collectedIdentifiers); collectedIdentifiers.forEach(function (identifier) { var entry = _this238._getEntryComponentMetadata(identifier.reference, false); if (entry) { components.push(entry); } }); return components; } }, { key: "_getEntryComponentMetadata", value: function _getEntryComponentMetadata(dirType) { var throwIfNotFound = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var dirMeta = this.getNonNormalizedDirectiveMetadata(dirType); if (dirMeta && dirMeta.metadata.isComponent) { return { componentType: dirType, componentFactory: dirMeta.metadata.componentFactory }; } var dirSummary = this._loadSummary(dirType, CompileSummaryKind.Directive); if (dirSummary && dirSummary.isComponent) { return { componentType: dirType, componentFactory: dirSummary.componentFactory }; } if (throwIfNotFound) { throw syntaxError("".concat(dirType.name, " cannot be used as an entry component.")); } return null; } }, { key: "_getInjectableTypeMetadata", value: function _getInjectableTypeMetadata(type) { var dependencies = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var typeSummary = this._loadSummary(type, CompileSummaryKind.Injectable); if (typeSummary) { return typeSummary.type; } return this._getTypeMetadata(type, dependencies); } }, { key: "getProviderMetadata", value: function getProviderMetadata(provider) { var compileDeps = undefined; var compileTypeMetadata = null; var compileFactoryMetadata = null; var token = this._getTokenMetadata(provider.token); if (provider.useClass) { compileTypeMetadata = this._getInjectableTypeMetadata(provider.useClass, provider.dependencies); compileDeps = compileTypeMetadata.diDeps; if (provider.token === provider.useClass) { // use the compileTypeMetadata as it contains information about lifecycleHooks... token = { identifier: compileTypeMetadata }; } } else if (provider.useFactory) { compileFactoryMetadata = this._getFactoryMetadata(provider.useFactory, provider.dependencies); compileDeps = compileFactoryMetadata.diDeps; } return { token: token, useClass: compileTypeMetadata, useValue: provider.useValue, useFactory: compileFactoryMetadata, useExisting: provider.useExisting ? this._getTokenMetadata(provider.useExisting) : undefined, deps: compileDeps, multi: provider.multi }; } }, { key: "_getQueriesMetadata", value: function _getQueriesMetadata(queries, isViewQuery, directiveType) { var _this239 = this; var res = []; Object.keys(queries).forEach(function (propertyName) { var query = queries[propertyName]; if (query.isViewQuery === isViewQuery) { res.push(_this239._getQueryMetadata(query, propertyName, directiveType)); } }); return res; } }, { key: "_queryVarBindings", value: function _queryVarBindings(selector) { return selector.split(/\s*,\s*/); } }, { key: "_getQueryMetadata", value: function _getQueryMetadata(q, propertyName, typeOrFunc) { var _this240 = this; var selectors; if (typeof q.selector === 'string') { selectors = this._queryVarBindings(q.selector).map(function (varName) { return _this240._getTokenMetadata(varName); }); } else { if (!q.selector) { this._reportError(syntaxError("Can't construct a query for the property \"".concat(propertyName, "\" of \"").concat(stringifyType(typeOrFunc), "\" since the query selector wasn't defined.")), typeOrFunc); selectors = []; } else { selectors = [this._getTokenMetadata(q.selector)]; } } return { selectors: selectors, first: q.first, descendants: q.descendants, propertyName: propertyName, read: q.read ? this._getTokenMetadata(q.read) : null, "static": q["static"] }; } }, { key: "_reportError", value: function _reportError(error, type, otherType) { if (this._errorCollector) { this._errorCollector(error, type); if (otherType) { this._errorCollector(error, otherType); } } else { throw error; } } }]); return CompileMetadataResolver; }(); function flattenArray(tree) { var out = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; if (tree) { for (var i = 0; i < tree.length; i++) { var item = resolveForwardRef(tree[i]); if (Array.isArray(item)) { flattenArray(item, out); } else { out.push(item); } } } return out; } function dedupeArray(array) { if (array) { return Array.from(new Set(array)); } return []; } function flattenAndDedupeArray(tree) { return dedupeArray(flattenArray(tree)); } function isValidType(value) { return value instanceof StaticSymbol || value instanceof Type; } function extractIdentifiers(value, targetIdentifiers) { visitValue(value, new _CompileValueConverter(), targetIdentifiers); } var _CompileValueConverter = /*#__PURE__*/function (_ValueTransformer) { _inherits(_CompileValueConverter, _ValueTransformer); var _super99 = _createSuper(_CompileValueConverter); function _CompileValueConverter() { _classCallCheck(this, _CompileValueConverter); return _super99.apply(this, arguments); } _createClass2(_CompileValueConverter, [{ key: "visitOther", value: function visitOther(value, targetIdentifiers) { targetIdentifiers.push({ reference: value }); } }]); return _CompileValueConverter; }(ValueTransformer); function stringifyType(type) { if (type instanceof StaticSymbol) { return "".concat(type.name, " in ").concat(type.filePath); } else { return stringify(type); } } /** * Indicates that a component is still being loaded in a synchronous compile. */ function componentStillLoadingError(compType) { var error = Error("Can't compile synchronously as ".concat(stringify(compType), " is still being loaded!")); error[ERROR_COMPONENT_TYPE] = compType; return error; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ function providerDef(ctx, providerAst) { var flags = 0 /* None */ ; if (!providerAst.eager) { flags |= 4096 /* LazyProvider */ ; } if (providerAst.providerType === ProviderAstType.PrivateService) { flags |= 8192 /* PrivateProvider */ ; } if (providerAst.isModule) { flags |= 1073741824 /* TypeModuleProvider */ ; } providerAst.lifecycleHooks.forEach(function (lifecycleHook) { // for regular providers, we only support ngOnDestroy if (lifecycleHook === LifecycleHooks.OnDestroy || providerAst.providerType === ProviderAstType.Directive || providerAst.providerType === ProviderAstType.Component) { flags |= lifecycleHookToNodeFlag(lifecycleHook); } }); var _ref49 = providerAst.multiProvider ? multiProviderDef(ctx, flags, providerAst.providers) : singleProviderDef(ctx, flags, providerAst.providerType, providerAst.providers[0]), providerExpr = _ref49.providerExpr, providerFlags = _ref49.flags, depsExpr = _ref49.depsExpr; return { providerExpr: providerExpr, flags: providerFlags, depsExpr: depsExpr, tokenExpr: tokenExpr(ctx, providerAst.token) }; } function multiProviderDef(ctx, flags, providers) { var allDepDefs = []; var allParams = []; var exprs = providers.map(function (provider, providerIndex) { var expr; if (provider.useClass) { var depExprs = convertDeps(providerIndex, provider.deps || provider.useClass.diDeps); expr = ctx.importExpr(provider.useClass.reference).instantiate(depExprs); } else if (provider.useFactory) { var _depExprs = convertDeps(providerIndex, provider.deps || provider.useFactory.diDeps); expr = ctx.importExpr(provider.useFactory.reference).callFn(_depExprs); } else if (provider.useExisting) { var _depExprs2 = convertDeps(providerIndex, [{ token: provider.useExisting }]); expr = _depExprs2[0]; } else { expr = convertValueToOutputAst(ctx, provider.useValue); } return expr; }); var providerExpr = fn(allParams, [new ReturnStatement(literalArr(exprs))], INFERRED_TYPE); return { providerExpr: providerExpr, flags: flags | 1024 /* TypeFactoryProvider */ , depsExpr: literalArr(allDepDefs) }; function convertDeps(providerIndex, deps) { return deps.map(function (dep, depIndex) { var paramName = "p".concat(providerIndex, "_").concat(depIndex); allParams.push(new FnParam(paramName, DYNAMIC_TYPE)); allDepDefs.push(depDef(ctx, dep)); return variable(paramName); }); } } function singleProviderDef(ctx, flags, providerType, providerMeta) { var providerExpr; var deps; if (providerType === ProviderAstType.Directive || providerType === ProviderAstType.Component) { providerExpr = ctx.importExpr(providerMeta.useClass.reference); flags |= 16384 /* TypeDirective */ ; deps = providerMeta.deps || providerMeta.useClass.diDeps; } else { if (providerMeta.useClass) { providerExpr = ctx.importExpr(providerMeta.useClass.reference); flags |= 512 /* TypeClassProvider */ ; deps = providerMeta.deps || providerMeta.useClass.diDeps; } else if (providerMeta.useFactory) { providerExpr = ctx.importExpr(providerMeta.useFactory.reference); flags |= 1024 /* TypeFactoryProvider */ ; deps = providerMeta.deps || providerMeta.useFactory.diDeps; } else if (providerMeta.useExisting) { providerExpr = NULL_EXPR; flags |= 2048 /* TypeUseExistingProvider */ ; deps = [{ token: providerMeta.useExisting }]; } else { providerExpr = convertValueToOutputAst(ctx, providerMeta.useValue); flags |= 256 /* TypeValueProvider */ ; deps = []; } } var depsExpr = literalArr(deps.map(function (dep) { return depDef(ctx, dep); })); return { providerExpr: providerExpr, flags: flags, depsExpr: depsExpr }; } function tokenExpr(ctx, tokenMeta) { return tokenMeta.identifier ? ctx.importExpr(tokenMeta.identifier.reference) : literal(tokenMeta.value); } function depDef(ctx, dep) { // Note: the following fields have already been normalized out by provider_analyzer: // - isAttribute, isHost var expr = dep.isValue ? convertValueToOutputAst(ctx, dep.value) : tokenExpr(ctx, dep.token); var flags = 0 /* None */ ; if (dep.isSkipSelf) { flags |= 1 /* SkipSelf */ ; } if (dep.isOptional) { flags |= 2 /* Optional */ ; } if (dep.isSelf) { flags |= 4 /* Self */ ; } if (dep.isValue) { flags |= 8 /* Value */ ; } return flags === 0 /* None */ ? expr : literalArr([literal(flags), expr]); } function lifecycleHookToNodeFlag(lifecycleHook) { var nodeFlag = 0 /* None */ ; switch (lifecycleHook) { case LifecycleHooks.AfterContentChecked: nodeFlag = 2097152 /* AfterContentChecked */ ; break; case LifecycleHooks.AfterContentInit: nodeFlag = 1048576 /* AfterContentInit */ ; break; case LifecycleHooks.AfterViewChecked: nodeFlag = 8388608 /* AfterViewChecked */ ; break; case LifecycleHooks.AfterViewInit: nodeFlag = 4194304 /* AfterViewInit */ ; break; case LifecycleHooks.DoCheck: nodeFlag = 262144 /* DoCheck */ ; break; case LifecycleHooks.OnChanges: nodeFlag = 524288 /* OnChanges */ ; break; case LifecycleHooks.OnDestroy: nodeFlag = 131072 /* OnDestroy */ ; break; case LifecycleHooks.OnInit: nodeFlag = 65536 /* OnInit */ ; break; } return nodeFlag; } function componentFactoryResolverProviderDef(reflector, ctx, flags, entryComponents) { var entryComponentFactories = entryComponents.map(function (entryComponent) { return ctx.importExpr(entryComponent.componentFactory); }); var token = createTokenForExternalReference(reflector, Identifiers.ComponentFactoryResolver); var classMeta = { diDeps: [{ isValue: true, value: literalArr(entryComponentFactories) }, { token: token, isSkipSelf: true, isOptional: true }, { token: createTokenForExternalReference(reflector, Identifiers.NgModuleRef) }], lifecycleHooks: [], reference: reflector.resolveExternalReference(Identifiers.CodegenComponentFactoryResolver) }; var _singleProviderDef = singleProviderDef(ctx, flags, ProviderAstType.PrivateService, { token: token, multi: false, useClass: classMeta }), providerExpr = _singleProviderDef.providerExpr, providerFlags = _singleProviderDef.flags, depsExpr = _singleProviderDef.depsExpr; return { providerExpr: providerExpr, flags: providerFlags, depsExpr: depsExpr, tokenExpr: tokenExpr(ctx, token) }; } /** * @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 NgModuleCompileResult = function NgModuleCompileResult(ngModuleFactoryVar) { _classCallCheck(this, NgModuleCompileResult); this.ngModuleFactoryVar = ngModuleFactoryVar; }; var LOG_VAR = variable('_l'); var NgModuleCompiler = /*#__PURE__*/function () { function NgModuleCompiler(reflector) { _classCallCheck(this, NgModuleCompiler); this.reflector = reflector; } _createClass2(NgModuleCompiler, [{ key: "compile", value: function compile(ctx, ngModuleMeta, extraProviders) { var sourceSpan = typeSourceSpan('NgModule', ngModuleMeta.type); var entryComponentFactories = ngModuleMeta.transitiveModule.entryComponents; var bootstrapComponents = ngModuleMeta.bootstrapComponents; var providerParser = new NgModuleProviderAnalyzer(this.reflector, ngModuleMeta, extraProviders, sourceSpan); var providerDefs = [componentFactoryResolverProviderDef(this.reflector, ctx, 0 /* None */ , entryComponentFactories)].concat(providerParser.parse().map(function (provider) { return providerDef(ctx, provider); })).map(function (_ref50) { var providerExpr = _ref50.providerExpr, depsExpr = _ref50.depsExpr, flags = _ref50.flags, tokenExpr = _ref50.tokenExpr; return importExpr(Identifiers.moduleProviderDef).callFn([literal(flags), tokenExpr, providerExpr, depsExpr]); }); var ngModuleDef = importExpr(Identifiers.moduleDef).callFn([literalArr(providerDefs)]); var ngModuleDefFactory = fn([new FnParam(LOG_VAR.name)], [new ReturnStatement(ngModuleDef)], INFERRED_TYPE); var ngModuleFactoryVar = "".concat(identifierName(ngModuleMeta.type), "NgFactory"); this._createNgModuleFactory(ctx, ngModuleMeta.type.reference, importExpr(Identifiers.createModuleFactory).callFn([ctx.importExpr(ngModuleMeta.type.reference), literalArr(bootstrapComponents.map(function (id) { return ctx.importExpr(id.reference); })), ngModuleDefFactory])); if (ngModuleMeta.id) { var id = typeof ngModuleMeta.id === 'string' ? literal(ngModuleMeta.id) : ctx.importExpr(ngModuleMeta.id); var registerFactoryStmt = importExpr(Identifiers.RegisterModuleFactoryFn).callFn([id, variable(ngModuleFactoryVar)]).toStmt(); ctx.statements.push(registerFactoryStmt); } return new NgModuleCompileResult(ngModuleFactoryVar); } }, { key: "createStub", value: function createStub(ctx, ngModuleReference) { this._createNgModuleFactory(ctx, ngModuleReference, NULL_EXPR); } }, { key: "_createNgModuleFactory", value: function _createNgModuleFactory(ctx, reference, value) { var ngModuleFactoryVar = "".concat(identifierName({ reference: reference }), "NgFactory"); var ngModuleFactoryStmt = variable(ngModuleFactoryVar).set(value).toDeclStmt(importType(Identifiers.NgModuleFactory, [expressionType(ctx.importExpr(reference))], [TypeModifier.Const]), [StmtModifier.Final, StmtModifier.Exported]); ctx.statements.push(ngModuleFactoryStmt); } }]); return NgModuleCompiler; }(); /** * @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 */ /** * Resolves types to {@link NgModule}. */ var NgModuleResolver = /*#__PURE__*/function () { function NgModuleResolver(_reflector) { _classCallCheck(this, NgModuleResolver); this._reflector = _reflector; } _createClass2(NgModuleResolver, [{ key: "isNgModule", value: function isNgModule(type) { return this._reflector.annotations(type).some(createNgModule.isTypeOf); } }, { key: "resolve", value: function resolve(type) { var throwIfNotFound = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var ngModuleMeta = findLast(this._reflector.annotations(type), createNgModule.isTypeOf); if (ngModuleMeta) { return ngModuleMeta; } else { if (throwIfNotFound) { throw new Error("No NgModule metadata found for '".concat(stringify(type), "'.")); } return null; } } }]); return NgModuleResolver; }(); /** * @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 _debugFilePath = '/debug/lib'; function debugOutputAstAsTypeScript(ast) { var converter = new _TsEmitterVisitor(); var ctx = EmitterVisitorContext.createRoot(); var asts = Array.isArray(ast) ? ast : [ast]; asts.forEach(function (ast) { if (ast instanceof Statement) { ast.visitStatement(converter, ctx); } else if (ast instanceof Expression) { ast.visitExpression(converter, ctx); } else if (ast instanceof Type$1) { ast.visitType(converter, ctx); } else { throw new Error("Don't know how to print debug info for ".concat(ast)); } }); return ctx.toSource(); } var TypeScriptEmitter = /*#__PURE__*/function () { function TypeScriptEmitter() { _classCallCheck(this, TypeScriptEmitter); } _createClass2(TypeScriptEmitter, [{ key: "emitStatementsAndContext", value: function emitStatementsAndContext(genFilePath, stmts) { var preamble = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; var emitSourceMaps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; var referenceFilter = arguments.length > 4 ? arguments[4] : undefined; var importFilter = arguments.length > 5 ? arguments[5] : undefined; var converter = new _TsEmitterVisitor(referenceFilter, importFilter); var ctx = EmitterVisitorContext.createRoot(); converter.visitAllStatements(stmts, ctx); var preambleLines = preamble ? preamble.split('\n') : []; converter.reexports.forEach(function (reexports, exportedModuleName) { var reexportsCode = reexports.map(function (reexport) { return "".concat(reexport.name, " as ").concat(reexport.as); }).join(','); preambleLines.push("export {".concat(reexportsCode, "} from '").concat(exportedModuleName, "';")); }); converter.importsWithPrefixes.forEach(function (prefix, importedModuleName) { // Note: can't write the real word for import as it screws up system.js auto detection... preambleLines.push("imp" + "ort * as ".concat(prefix, " from '").concat(importedModuleName, "';")); }); var sm = emitSourceMaps ? ctx.toSourceMapGenerator(genFilePath, preambleLines.length).toJsComment() : ''; var lines = [].concat(_toConsumableArray(preambleLines), [ctx.toSource(), sm]); if (sm) { // always add a newline at the end, as some tools have bugs without it. lines.push(''); } ctx.setPreambleLineCount(preambleLines.length); return { sourceText: lines.join('\n'), context: ctx }; } }, { key: "emitStatements", value: function emitStatements(genFilePath, stmts) { var preamble = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; return this.emitStatementsAndContext(genFilePath, stmts, preamble).sourceText; } }]); return TypeScriptEmitter; }(); var _TsEmitterVisitor = /*#__PURE__*/function (_AbstractEmitterVisit2) { _inherits(_TsEmitterVisitor, _AbstractEmitterVisit2); var _super100 = _createSuper(_TsEmitterVisitor); function _TsEmitterVisitor(referenceFilter, importFilter) { var _this241; _classCallCheck(this, _TsEmitterVisitor); _this241 = _super100.call(this, false); _this241.referenceFilter = referenceFilter; _this241.importFilter = importFilter; _this241.typeExpression = 0; _this241.importsWithPrefixes = new Map(); _this241.reexports = new Map(); return _this241; } _createClass2(_TsEmitterVisitor, [{ key: "visitType", value: function visitType(t, ctx) { var defaultType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'any'; if (t) { this.typeExpression++; t.visitType(this, ctx); this.typeExpression--; } else { ctx.print(null, defaultType); } } }, { key: "visitLiteralExpr", value: function visitLiteralExpr(ast, ctx) { var value = ast.value; if (value == null && ast.type != INFERRED_TYPE) { ctx.print(ast, "(".concat(value, " as any)")); return null; } return _get(_getPrototypeOf(_TsEmitterVisitor.prototype), "visitLiteralExpr", this).call(this, ast, ctx); } // Temporary workaround to support strictNullCheck enabled consumers of ngc emit. // In SNC mode, [] have the type never[], so we cast here to any[]. // TODO: narrow the cast to a more explicit type, or use a pattern that does not // start with [].concat. see https://github.com/angular/angular/pull/11846 }, { key: "visitLiteralArrayExpr", value: function visitLiteralArrayExpr(ast, ctx) { if (ast.entries.length === 0) { ctx.print(ast, '('); } var result = _get(_getPrototypeOf(_TsEmitterVisitor.prototype), "visitLiteralArrayExpr", this).call(this, ast, ctx); if (ast.entries.length === 0) { ctx.print(ast, ' as any[])'); } return result; } }, { key: "visitExternalExpr", value: function visitExternalExpr(ast, ctx) { this._visitIdentifier(ast.value, ast.typeParams, ctx); return null; } }, { key: "visitAssertNotNullExpr", value: function visitAssertNotNullExpr(ast, ctx) { var result = _get(_getPrototypeOf(_TsEmitterVisitor.prototype), "visitAssertNotNullExpr", this).call(this, ast, ctx); ctx.print(ast, '!'); return result; } }, { key: "visitDeclareVarStmt", value: function visitDeclareVarStmt(stmt, ctx) { if (stmt.hasModifier(StmtModifier.Exported) && stmt.value instanceof ExternalExpr && !stmt.type) { // check for a reexport var _stmt$value$value = stmt.value.value, name = _stmt$value$value.name, moduleName = _stmt$value$value.moduleName; if (moduleName) { var reexports = this.reexports.get(moduleName); if (!reexports) { reexports = []; this.reexports.set(moduleName, reexports); } reexports.push({ name: name, as: stmt.name }); return null; } } if (stmt.hasModifier(StmtModifier.Exported)) { ctx.print(stmt, "export "); } if (stmt.hasModifier(StmtModifier.Final)) { ctx.print(stmt, "const"); } else { ctx.print(stmt, "var"); } ctx.print(stmt, " ".concat(stmt.name)); this._printColonType(stmt.type, ctx); if (stmt.value) { ctx.print(stmt, " = "); stmt.value.visitExpression(this, ctx); } ctx.println(stmt, ";"); return null; } }, { key: "visitWrappedNodeExpr", value: function visitWrappedNodeExpr(ast, ctx) { throw new Error('Cannot visit a WrappedNodeExpr when outputting Typescript.'); } }, { key: "visitCastExpr", value: function visitCastExpr(ast, ctx) { ctx.print(ast, "(<"); ast.type.visitType(this, ctx); ctx.print(ast, ">"); ast.value.visitExpression(this, ctx); ctx.print(ast, ")"); return null; } }, { key: "visitInstantiateExpr", value: function visitInstantiateExpr(ast, ctx) { ctx.print(ast, "new "); this.typeExpression++; ast.classExpr.visitExpression(this, ctx); this.typeExpression--; ctx.print(ast, "("); this.visitAllExpressions(ast.args, ctx, ','); ctx.print(ast, ")"); return null; } }, { key: "visitDeclareClassStmt", value: function visitDeclareClassStmt(stmt, ctx) { var _this242 = this; ctx.pushClass(stmt); if (stmt.hasModifier(StmtModifier.Exported)) { ctx.print(stmt, "export "); } ctx.print(stmt, "class ".concat(stmt.name)); if (stmt.parent != null) { ctx.print(stmt, " extends "); this.typeExpression++; stmt.parent.visitExpression(this, ctx); this.typeExpression--; } ctx.println(stmt, " {"); ctx.incIndent(); stmt.fields.forEach(function (field) { return _this242._visitClassField(field, ctx); }); if (stmt.constructorMethod != null) { this._visitClassConstructor(stmt, ctx); } stmt.getters.forEach(function (getter) { return _this242._visitClassGetter(getter, ctx); }); stmt.methods.forEach(function (method) { return _this242._visitClassMethod(method, ctx); }); ctx.decIndent(); ctx.println(stmt, "}"); ctx.popClass(); return null; } }, { key: "_visitClassField", value: function _visitClassField(field, ctx) { if (field.hasModifier(StmtModifier.Private)) { // comment out as a workaround for #10967 ctx.print(null, "/*private*/ "); } if (field.hasModifier(StmtModifier.Static)) { ctx.print(null, 'static '); } ctx.print(null, field.name); this._printColonType(field.type, ctx); if (field.initializer) { ctx.print(null, ' = '); field.initializer.visitExpression(this, ctx); } ctx.println(null, ";"); } }, { key: "_visitClassGetter", value: function _visitClassGetter(getter, ctx) { if (getter.hasModifier(StmtModifier.Private)) { ctx.print(null, "private "); } ctx.print(null, "get ".concat(getter.name, "()")); this._printColonType(getter.type, ctx); ctx.println(null, " {"); ctx.incIndent(); this.visitAllStatements(getter.body, ctx); ctx.decIndent(); ctx.println(null, "}"); } }, { key: "_visitClassConstructor", value: function _visitClassConstructor(stmt, ctx) { ctx.print(stmt, "constructor("); this._visitParams(stmt.constructorMethod.params, ctx); ctx.println(stmt, ") {"); ctx.incIndent(); this.visitAllStatements(stmt.constructorMethod.body, ctx); ctx.decIndent(); ctx.println(stmt, "}"); } }, { key: "_visitClassMethod", value: function _visitClassMethod(method, ctx) { if (method.hasModifier(StmtModifier.Private)) { ctx.print(null, "private "); } ctx.print(null, "".concat(method.name, "(")); this._visitParams(method.params, ctx); ctx.print(null, ")"); this._printColonType(method.type, ctx, 'void'); ctx.println(null, " {"); ctx.incIndent(); this.visitAllStatements(method.body, ctx); ctx.decIndent(); ctx.println(null, "}"); } }, { key: "visitFunctionExpr", value: function visitFunctionExpr(ast, ctx) { if (ast.name) { ctx.print(ast, 'function '); ctx.print(ast, ast.name); } ctx.print(ast, "("); this._visitParams(ast.params, ctx); ctx.print(ast, ")"); this._printColonType(ast.type, ctx, 'void'); if (!ast.name) { ctx.print(ast, " => "); } ctx.println(ast, '{'); ctx.incIndent(); this.visitAllStatements(ast.statements, ctx); ctx.decIndent(); ctx.print(ast, "}"); return null; } }, { key: "visitDeclareFunctionStmt", value: function visitDeclareFunctionStmt(stmt, ctx) { if (stmt.hasModifier(StmtModifier.Exported)) { ctx.print(stmt, "export "); } ctx.print(stmt, "function ".concat(stmt.name, "(")); this._visitParams(stmt.params, ctx); ctx.print(stmt, ")"); this._printColonType(stmt.type, ctx, 'void'); ctx.println(stmt, " {"); ctx.incIndent(); this.visitAllStatements(stmt.statements, ctx); ctx.decIndent(); ctx.println(stmt, "}"); return null; } }, { key: "visitTryCatchStmt", value: function visitTryCatchStmt(stmt, ctx) { ctx.println(stmt, "try {"); ctx.incIndent(); this.visitAllStatements(stmt.bodyStmts, ctx); ctx.decIndent(); ctx.println(stmt, "} catch (".concat(CATCH_ERROR_VAR$1.name, ") {")); ctx.incIndent(); var catchStmts = [CATCH_STACK_VAR$1.set(CATCH_ERROR_VAR$1.prop('stack', null)).toDeclStmt(null, [StmtModifier.Final])].concat(stmt.catchStmts); this.visitAllStatements(catchStmts, ctx); ctx.decIndent(); ctx.println(stmt, "}"); return null; } }, { key: "visitBuiltinType", value: function visitBuiltinType(type, ctx) { var typeStr; switch (type.name) { case BuiltinTypeName.Bool: typeStr = 'boolean'; break; case BuiltinTypeName.Dynamic: typeStr = 'any'; break; case BuiltinTypeName.Function: typeStr = 'Function'; break; case BuiltinTypeName.Number: typeStr = 'number'; break; case BuiltinTypeName.Int: typeStr = 'number'; break; case BuiltinTypeName.String: typeStr = 'string'; break; case BuiltinTypeName.None: typeStr = 'never'; break; default: throw new Error("Unsupported builtin type ".concat(type.name)); } ctx.print(null, typeStr); return null; } }, { key: "visitExpressionType", value: function visitExpressionType(ast, ctx) { var _this243 = this; ast.value.visitExpression(this, ctx); if (ast.typeParams !== null) { ctx.print(null, '<'); this.visitAllObjects(function (type) { return _this243.visitType(type, ctx); }, ast.typeParams, ctx, ','); ctx.print(null, '>'); } return null; } }, { key: "visitArrayType", value: function visitArrayType(type, ctx) { this.visitType(type.of, ctx); ctx.print(null, "[]"); return null; } }, { key: "visitMapType", value: function visitMapType(type, ctx) { ctx.print(null, "{[key: string]:"); this.visitType(type.valueType, ctx); ctx.print(null, "}"); return null; } }, { key: "getBuiltinMethodName", value: function getBuiltinMethodName(method) { var name; switch (method) { case BuiltinMethod.ConcatArray: name = 'concat'; break; case BuiltinMethod.SubscribeObservable: name = 'subscribe'; break; case BuiltinMethod.Bind: name = 'bind'; break; default: throw new Error("Unknown builtin method: ".concat(method)); } return name; } }, { key: "_visitParams", value: function _visitParams(params, ctx) { var _this244 = this; this.visitAllObjects(function (param) { ctx.print(null, param.name); _this244._printColonType(param.type, ctx); }, params, ctx, ','); } }, { key: "_visitIdentifier", value: function _visitIdentifier(value, typeParams, ctx) { var _this245 = this; var name = value.name, moduleName = value.moduleName; if (this.referenceFilter && this.referenceFilter(value)) { ctx.print(null, '(null as any)'); return; } if (moduleName && (!this.importFilter || !this.importFilter(value))) { var prefix = this.importsWithPrefixes.get(moduleName); if (prefix == null) { prefix = "i".concat(this.importsWithPrefixes.size); this.importsWithPrefixes.set(moduleName, prefix); } ctx.print(null, "".concat(prefix, ".")); } ctx.print(null, name); if (this.typeExpression > 0) { // If we are in a type expression that refers to a generic type then supply // the required type parameters. If there were not enough type parameters // supplied, supply any as the type. Outside a type expression the reference // should not supply type parameters and be treated as a simple value reference // to the constructor function itself. var suppliedParameters = typeParams || []; if (suppliedParameters.length > 0) { ctx.print(null, "<"); this.visitAllObjects(function (type) { return type.visitType(_this245, ctx); }, typeParams, ctx, ','); ctx.print(null, ">"); } } } }, { key: "_printColonType", value: function _printColonType(type, ctx, defaultType) { if (type !== INFERRED_TYPE) { ctx.print(null, ':'); this.visitType(type, ctx, defaultType); } } }]); return _TsEmitterVisitor; }(AbstractEmitterVisitor); /** * @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 */ /** * Resolve a `Type` for {@link Pipe}. * * This interface can be overridden by the application developer to create custom behavior. * * See {@link Compiler} */ var PipeResolver = /*#__PURE__*/function () { function PipeResolver(_reflector) { _classCallCheck(this, PipeResolver); this._reflector = _reflector; } _createClass2(PipeResolver, [{ key: "isPipe", value: function isPipe(type) { var typeMetadata = this._reflector.annotations(resolveForwardRef(type)); return typeMetadata && typeMetadata.some(createPipe.isTypeOf); } /** * Return {@link Pipe} for a given `Type`. */ }, { key: "resolve", value: function resolve(type) { var throwIfNotFound = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; var metas = this._reflector.annotations(resolveForwardRef(type)); if (metas) { var annotation = findLast(metas, createPipe.isTypeOf); if (annotation) { return annotation; } } if (throwIfNotFound) { throw new Error("No Pipe decorator found on ".concat(stringify(type))); } return null; } }]); return PipeResolver; }(); /** * @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 */ /** * Generates code that is used to type check templates. */ var TypeCheckCompiler = /*#__PURE__*/function () { function TypeCheckCompiler(options, reflector) { _classCallCheck(this, TypeCheckCompiler); this.options = options; this.reflector = reflector; } /** * Important notes: * - This must not produce new `import` statements, but only refer to types outside * of the file via the variables provided via externalReferenceVars. * This allows Typescript to reuse the old program's structure as no imports have changed. * - This must not produce any exports, as this would pollute the .d.ts file * and also violate the point above. */ _createClass2(TypeCheckCompiler, [{ key: "compileComponent", value: function compileComponent(componentId, component, template, usedPipes, externalReferenceVars, ctx) { var _this246 = this; var pipes = new Map(); usedPipes.forEach(function (p) { return pipes.set(p.name, p.type.reference); }); var embeddedViewCount = 0; var viewBuilderFactory = function viewBuilderFactory(parent, guards) { var embeddedViewIndex = embeddedViewCount++; return new ViewBuilder(_this246.options, _this246.reflector, externalReferenceVars, parent, component.type.reference, component.isHost, embeddedViewIndex, pipes, guards, ctx, viewBuilderFactory); }; var visitor = viewBuilderFactory(null, []); visitor.visitAll([], template); return visitor.build(componentId); } }]); return TypeCheckCompiler; }(); var DYNAMIC_VAR_NAME = '_any'; var TypeCheckLocalResolver = /*#__PURE__*/function () { function TypeCheckLocalResolver() { _classCallCheck(this, TypeCheckLocalResolver); } _createClass2(TypeCheckLocalResolver, [{ key: "notifyImplicitReceiverUse", value: function notifyImplicitReceiverUse() {} }, { key: "getLocal", value: function getLocal(name) { if (name === EventHandlerVars.event.name) { // References to the event should not be type-checked. // TODO(chuckj): determine a better type for the event. return variable(DYNAMIC_VAR_NAME); } return null; } }]); return TypeCheckLocalResolver; }(); var defaultResolver = new TypeCheckLocalResolver(); var ViewBuilder = /*#__PURE__*/function () { function ViewBuilder(options, reflector, externalReferenceVars, parent, component, isHostComponent, embeddedViewIndex, pipes, guards, ctx, viewBuilderFactory) { _classCallCheck(this, ViewBuilder); this.options = options; this.reflector = reflector; this.externalReferenceVars = externalReferenceVars; this.parent = parent; this.component = component; this.isHostComponent = isHostComponent; this.embeddedViewIndex = embeddedViewIndex; this.pipes = pipes; this.guards = guards; this.ctx = ctx; this.viewBuilderFactory = viewBuilderFactory; this.refOutputVars = new Map(); this.variables = []; this.children = []; this.updates = []; this.actions = []; } _createClass2(ViewBuilder, [{ key: "getOutputVar", value: function getOutputVar(type) { var varName; if (type === this.component && this.isHostComponent) { varName = DYNAMIC_VAR_NAME; } else if (type instanceof StaticSymbol) { varName = this.externalReferenceVars.get(type); } else { varName = DYNAMIC_VAR_NAME; } if (!varName) { throw new Error("Illegal State: referring to a type without a variable ".concat(JSON.stringify(type))); } return varName; } }, { key: "getTypeGuardExpressions", value: function getTypeGuardExpressions(ast) { var result = _toConsumableArray(this.guards); var _iterator17 = _createForOfIteratorHelper(ast.directives), _step17; try { for (_iterator17.s(); !(_step17 = _iterator17.n()).done;) { var directive = _step17.value; var _iterator18 = _createForOfIteratorHelper(directive.inputs), _step18; try { for (_iterator18.s(); !(_step18 = _iterator18.n()).done;) { var input = _step18.value; var guard = directive.directive.guards[input.directiveName]; if (guard) { var useIf = guard === 'UseIf'; result.push({ guard: guard, useIf: useIf, expression: { context: this.component, value: input.value } }); } } } catch (err) { _iterator18.e(err); } finally { _iterator18.f(); } } } catch (err) { _iterator17.e(err); } finally { _iterator17.f(); } return result; } }, { key: "visitAll", value: function visitAll(variables, astNodes) { this.variables = variables; templateVisitAll(this, astNodes); } }, { key: "build", value: function build(componentId) { var _this247 = this; var targetStatements = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; this.children.forEach(function (child) { return child.build(componentId, targetStatements); }); var viewStmts = [variable(DYNAMIC_VAR_NAME).set(NULL_EXPR).toDeclStmt(DYNAMIC_TYPE)]; var bindingCount = 0; this.updates.forEach(function (expression) { var _viewStmts; var _this247$preprocessUp = _this247.preprocessUpdateExpression(expression), sourceSpan = _this247$preprocessUp.sourceSpan, context = _this247$preprocessUp.context, value = _this247$preprocessUp.value; var bindingId = "".concat(bindingCount++); var nameResolver = context === _this247.component ? _this247 : defaultResolver; var _convertPropertyBindi = _convertPropertyBinding(nameResolver, variable(_this247.getOutputVar(context)), value, bindingId, BindingForm.General), stmts = _convertPropertyBindi.stmts, currValExpr = _convertPropertyBindi.currValExpr; stmts.push(new ExpressionStatement(currValExpr)); (_viewStmts = viewStmts).push.apply(_viewStmts, _toConsumableArray(stmts.map(function (stmt) { return applySourceSpanToStatementIfNeeded(stmt, sourceSpan); }))); }); this.actions.forEach(function (_ref51) { var _viewStmts2; var sourceSpan = _ref51.sourceSpan, context = _ref51.context, value = _ref51.value; var bindingId = "".concat(bindingCount++); var nameResolver = context === _this247.component ? _this247 : defaultResolver; var _convertActionBinding = convertActionBinding(nameResolver, variable(_this247.getOutputVar(context)), value, bindingId), stmts = _convertActionBinding.stmts; (_viewStmts2 = viewStmts).push.apply(_viewStmts2, _toConsumableArray(stmts.map(function (stmt) { return applySourceSpanToStatementIfNeeded(stmt, sourceSpan); }))); }); if (this.guards.length) { var guardExpression = undefined; var _iterator19 = _createForOfIteratorHelper(this.guards), _step19; try { for (_iterator19.s(); !(_step19 = _iterator19.n()).done;) { var guard = _step19.value; var _this$preprocessUpdat = this.preprocessUpdateExpression(guard.expression), context = _this$preprocessUpdat.context, value = _this$preprocessUpdat.value; var bindingId = "".concat(bindingCount++); var nameResolver = context === this.component ? this : defaultResolver; // We only support support simple expressions and ignore others as they // are unlikely to affect type narrowing. var _convertPropertyBindi2 = _convertPropertyBinding(nameResolver, variable(this.getOutputVar(context)), value, bindingId, BindingForm.TrySimple), stmts = _convertPropertyBindi2.stmts, currValExpr = _convertPropertyBindi2.currValExpr; if (stmts.length == 0) { var guardClause = guard.useIf ? currValExpr : this.ctx.importExpr(guard.guard).callFn([currValExpr]); guardExpression = guardExpression ? guardExpression.and(guardClause) : guardClause; } } } catch (err) { _iterator19.e(err); } finally { _iterator19.f(); } if (guardExpression) { viewStmts = [new IfStmt(guardExpression, viewStmts)]; } } var viewName = "_View_".concat(componentId, "_").concat(this.embeddedViewIndex); var viewFactory = new DeclareFunctionStmt(viewName, [], viewStmts); targetStatements.push(viewFactory); return targetStatements; } }, { key: "visitBoundText", value: function visitBoundText(ast, context) { var _this248 = this; var astWithSource = ast.value; var inter = astWithSource.ast; inter.expressions.forEach(function (expr) { return _this248.updates.push({ context: _this248.component, value: expr, sourceSpan: ast.sourceSpan }); }); } }, { key: "visitEmbeddedTemplate", value: function visitEmbeddedTemplate(ast, context) { this.visitElementOrTemplate(ast); // Note: The old view compiler used to use an `any` type // for the context in any embedded view. // We keep this behaivor behind a flag for now. if (this.options.fullTemplateTypeCheck) { // Find any applicable type guards. For example, NgIf has a type guard on ngIf // (see NgIf.ngIfTypeGuard) that can be used to indicate that a template is only // stamped out if ngIf is truthy so any bindings in the template can assume that, // if a nullable type is used for ngIf, that expression is not null or undefined. var guards = this.getTypeGuardExpressions(ast); var childVisitor = this.viewBuilderFactory(this, guards); this.children.push(childVisitor); childVisitor.visitAll(ast.variables, ast.children); } } }, { key: "visitElement", value: function visitElement(ast, context) { var _this249 = this; this.visitElementOrTemplate(ast); var inputDefs = []; var updateRendererExpressions = []; var outputDefs = []; ast.inputs.forEach(function (inputAst) { _this249.updates.push({ context: _this249.component, value: inputAst.value, sourceSpan: inputAst.sourceSpan }); }); templateVisitAll(this, ast.children); } }, { key: "visitElementOrTemplate", value: function visitElementOrTemplate(ast) { var _this250 = this; ast.directives.forEach(function (dirAst) { _this250.visitDirective(dirAst); }); ast.references.forEach(function (ref) { var outputVarType = null; // Note: The old view compiler used to use an `any` type // for directives exposed via `exportAs`. // We keep this behaivor behind a flag for now. if (ref.value && ref.value.identifier && _this250.options.fullTemplateTypeCheck) { outputVarType = ref.value.identifier.reference; } else { outputVarType = BuiltinTypeName.Dynamic; } _this250.refOutputVars.set(ref.name, outputVarType); }); ast.outputs.forEach(function (outputAst) { _this250.actions.push({ context: _this250.component, value: outputAst.handler, sourceSpan: outputAst.sourceSpan }); }); } }, { key: "visitDirective", value: function visitDirective(dirAst) { var _this251 = this; var dirType = dirAst.directive.type.reference; dirAst.inputs.forEach(function (input) { return _this251.updates.push({ context: _this251.component, value: input.value, sourceSpan: input.sourceSpan }); }); // Note: The old view compiler used to use an `any` type // for expressions in host properties / events. // We keep this behaivor behind a flag for now. if (this.options.fullTemplateTypeCheck) { dirAst.hostProperties.forEach(function (inputAst) { return _this251.updates.push({ context: dirType, value: inputAst.value, sourceSpan: inputAst.sourceSpan }); }); dirAst.hostEvents.forEach(function (hostEventAst) { return _this251.actions.push({ context: dirType, value: hostEventAst.handler, sourceSpan: hostEventAst.sourceSpan }); }); } } }, { key: "notifyImplicitReceiverUse", value: function notifyImplicitReceiverUse() {} }, { key: "getLocal", value: function getLocal(name) { if (name == EventHandlerVars.event.name) { return variable(this.getOutputVar(BuiltinTypeName.Dynamic)); } for (var currBuilder = this; currBuilder; currBuilder = currBuilder.parent) { var outputVarType = void 0; // check references outputVarType = currBuilder.refOutputVars.get(name); if (outputVarType == null) { // check variables var varAst = currBuilder.variables.find(function (varAst) { return varAst.name === name; }); if (varAst) { outputVarType = BuiltinTypeName.Dynamic; } } if (outputVarType != null) { return variable(this.getOutputVar(outputVarType)); } } return null; } }, { key: "pipeOutputVar", value: function pipeOutputVar(name) { var pipe = this.pipes.get(name); if (!pipe) { throw new Error("Illegal State: Could not find pipe ".concat(name, " in template of ").concat(this.component)); } return this.getOutputVar(pipe); } }, { key: "preprocessUpdateExpression", value: function preprocessUpdateExpression(expression) { var _this252 = this; return { sourceSpan: expression.sourceSpan, context: expression.context, value: convertPropertyBindingBuiltins({ createLiteralArrayConverter: function createLiteralArrayConverter(argCount) { return function (args) { var arr = literalArr(args); // Note: The old view compiler used to use an `any` type // for arrays. return _this252.options.fullTemplateTypeCheck ? arr : arr.cast(DYNAMIC_TYPE); }; }, createLiteralMapConverter: function createLiteralMapConverter(keys) { return function (values) { var entries = keys.map(function (k, i) { return { key: k.key, value: values[i], quoted: k.quoted }; }); var map = literalMap(entries); // Note: The old view compiler used to use an `any` type // for maps. return _this252.options.fullTemplateTypeCheck ? map : map.cast(DYNAMIC_TYPE); }; }, createPipeConverter: function createPipeConverter(name, argCount) { return function (args) { // Note: The old view compiler used to use an `any` type // for pipes. var pipeExpr = _this252.options.fullTemplateTypeCheck ? variable(_this252.pipeOutputVar(name)) : variable(_this252.getOutputVar(BuiltinTypeName.Dynamic)); return pipeExpr.callMethod('transform', args); }; } }, expression.value) }; } }, { key: "visitNgContent", value: function visitNgContent(ast, context) {} }, { key: "visitText", value: function visitText(ast, context) {} }, { key: "visitDirectiveProperty", value: function visitDirectiveProperty(ast, context) {} }, { key: "visitReference", value: function visitReference(ast, context) {} }, { key: "visitVariable", value: function visitVariable(ast, context) {} }, { key: "visitEvent", value: function visitEvent(ast, context) {} }, { key: "visitElementProperty", value: function visitElementProperty(ast, context) {} }, { key: "visitAttr", value: function visitAttr(ast, context) {} }]); return ViewBuilder; }(); /** * @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 CLASS_ATTR$1 = 'class'; var STYLE_ATTR = 'style'; var IMPLICIT_TEMPLATE_VAR = '\$implicit'; var ViewCompileResult = function ViewCompileResult(viewClassVar, rendererTypeVar) { _classCallCheck(this, ViewCompileResult); this.viewClassVar = viewClassVar; this.rendererTypeVar = rendererTypeVar; }; var ViewCompiler = /*#__PURE__*/function () { function ViewCompiler(_reflector) { _classCallCheck(this, ViewCompiler); this._reflector = _reflector; } _createClass2(ViewCompiler, [{ key: "compileComponent", value: function compileComponent(outputCtx, component, template, styles, usedPipes) { var _this253 = this, _outputCtx$statements; var embeddedViewCount = 0; var staticQueryIds = findStaticQueryIds(template); var renderComponentVarName = undefined; if (!component.isHost) { var _template2 = component.template; var customRenderData = []; if (_template2.animations && _template2.animations.length) { customRenderData.push(new LiteralMapEntry('animation', convertValueToOutputAst(outputCtx, _template2.animations), true)); } var renderComponentVar = variable(rendererTypeName(component.type.reference)); renderComponentVarName = renderComponentVar.name; outputCtx.statements.push(renderComponentVar.set(importExpr(Identifiers.createRendererType2).callFn([new LiteralMapExpr([new LiteralMapEntry('encapsulation', literal(_template2.encapsulation), false), new LiteralMapEntry('styles', styles, false), new LiteralMapEntry('data', new LiteralMapExpr(customRenderData), false)])])).toDeclStmt(importType(Identifiers.RendererType2), [StmtModifier.Final, StmtModifier.Exported])); } var viewBuilderFactory = function viewBuilderFactory(parent) { var embeddedViewIndex = embeddedViewCount++; return new ViewBuilder$1(_this253._reflector, outputCtx, parent, component, embeddedViewIndex, usedPipes, staticQueryIds, viewBuilderFactory); }; var visitor = viewBuilderFactory(null); visitor.visitAll([], template); (_outputCtx$statements = outputCtx.statements).push.apply(_outputCtx$statements, _toConsumableArray(visitor.build())); return new ViewCompileResult(visitor.viewName, renderComponentVarName); } }]); return ViewCompiler; }(); var LOG_VAR$1 = variable('_l'); var VIEW_VAR = variable('_v'); var CHECK_VAR = variable('_ck'); var COMP_VAR = variable('_co'); var EVENT_NAME_VAR = variable('en'); var ALLOW_DEFAULT_VAR = variable("ad"); var ViewBuilder$1 = /*#__PURE__*/function () { function ViewBuilder$1(reflector, outputCtx, parent, component, embeddedViewIndex, usedPipes, staticQueryIds, viewBuilderFactory) { _classCallCheck(this, ViewBuilder$1); this.reflector = reflector; this.outputCtx = outputCtx; this.parent = parent; this.component = component; this.embeddedViewIndex = embeddedViewIndex; this.usedPipes = usedPipes; this.staticQueryIds = staticQueryIds; this.viewBuilderFactory = viewBuilderFactory; this.nodes = []; this.purePipeNodeIndices = Object.create(null); // Need Object.create so that we don't have builtin values... this.refNodeIndices = Object.create(null); this.variables = []; this.children = []; // TODO(tbosch): The old view compiler used to use an `any` type // for the context in any embedded view. We keep this behaivor for now // to be able to introduce the new view compiler without too many errors. this.compType = this.embeddedViewIndex > 0 ? DYNAMIC_TYPE : expressionType(outputCtx.importExpr(this.component.type.reference)); this.viewName = viewClassName(this.component.type.reference, this.embeddedViewIndex); } _createClass2(ViewBuilder$1, [{ key: "visitAll", value: function visitAll(variables, astNodes) { var _this254 = this; this.variables = variables; // create the pipes for the pure pipes immediately, so that we know their indices. if (!this.parent) { this.usedPipes.forEach(function (pipe) { if (pipe.pure) { _this254.purePipeNodeIndices[pipe.name] = _this254._createPipe(null, pipe); } }); } if (!this.parent) { var queryIds = staticViewQueryIds(this.staticQueryIds); this.component.viewQueries.forEach(function (query, queryIndex) { // Note: queries start with id 1 so we can use the number in a Bloom filter! var queryId = queryIndex + 1; var bindingType = query.first ? 0 /* First */ : 1 /* All */ ; var flags = 134217728 /* TypeViewQuery */ | calcStaticDynamicQueryFlags(queryIds, queryId, query); _this254.nodes.push(function () { return { sourceSpan: null, nodeFlags: flags, nodeDef: importExpr(Identifiers.queryDef).callFn([literal(flags), literal(queryId), new LiteralMapExpr([new LiteralMapEntry(query.propertyName, literal(bindingType), false)])]) }; }); }); } templateVisitAll(this, astNodes); if (this.parent && (astNodes.length === 0 || needsAdditionalRootNode(astNodes))) { // if the view is an embedded view, then we need to add an additional root node in some cases this.nodes.push(function () { return { sourceSpan: null, nodeFlags: 1 /* TypeElement */ , nodeDef: importExpr(Identifiers.anchorDef).callFn([literal(0 /* None */ ), NULL_EXPR, NULL_EXPR, literal(0)]) }; }); } } }, { key: "build", value: function build() { var targetStatements = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; this.children.forEach(function (child) { return child.build(targetStatements); }); var _this$_createNodeExpr = this._createNodeExpressions(), updateRendererStmts = _this$_createNodeExpr.updateRendererStmts, updateDirectivesStmts = _this$_createNodeExpr.updateDirectivesStmts, nodeDefExprs = _this$_createNodeExpr.nodeDefExprs; var updateRendererFn = this._createUpdateFn(updateRendererStmts); var updateDirectivesFn = this._createUpdateFn(updateDirectivesStmts); var viewFlags = 0 /* None */ ; if (!this.parent && this.component.changeDetection === ChangeDetectionStrategy.OnPush) { viewFlags |= 2 /* OnPush */ ; } var viewFactory = new DeclareFunctionStmt(this.viewName, [new FnParam(LOG_VAR$1.name)], [new ReturnStatement(importExpr(Identifiers.viewDef).callFn([literal(viewFlags), literalArr(nodeDefExprs), updateDirectivesFn, updateRendererFn]))], importType(Identifiers.ViewDefinition), this.embeddedViewIndex === 0 ? [StmtModifier.Exported] : []); targetStatements.push(viewFactory); return targetStatements; } }, { key: "_createUpdateFn", value: function _createUpdateFn(updateStmts) { var updateFn; if (updateStmts.length > 0) { var preStmts = []; if (!this.component.isHost && findReadVarNames(updateStmts).has(COMP_VAR.name)) { preStmts.push(COMP_VAR.set(VIEW_VAR.prop('component')).toDeclStmt(this.compType)); } updateFn = fn([new FnParam(CHECK_VAR.name, INFERRED_TYPE), new FnParam(VIEW_VAR.name, INFERRED_TYPE)], [].concat(preStmts, _toConsumableArray(updateStmts)), INFERRED_TYPE); } else { updateFn = NULL_EXPR; } return updateFn; } }, { key: "visitNgContent", value: function visitNgContent(ast, context) { // ngContentDef(ngContentIndex: number, index: number): NodeDef; this.nodes.push(function () { return { sourceSpan: ast.sourceSpan, nodeFlags: 8 /* TypeNgContent */ , nodeDef: importExpr(Identifiers.ngContentDef).callFn([literal(ast.ngContentIndex), literal(ast.index)]) }; }); } }, { key: "visitText", value: function visitText(ast, context) { // Static text nodes have no check function var checkIndex = -1; this.nodes.push(function () { return { sourceSpan: ast.sourceSpan, nodeFlags: 2 /* TypeText */ , nodeDef: importExpr(Identifiers.textDef).callFn([literal(checkIndex), literal(ast.ngContentIndex), literalArr([literal(ast.value)])]) }; }); } }, { key: "visitBoundText", value: function visitBoundText(ast, context) { var _this255 = this; var nodeIndex = this.nodes.length; // reserve the space in the nodeDefs array this.nodes.push(null); var astWithSource = ast.value; var inter = astWithSource.ast; var updateRendererExpressions = inter.expressions.map(function (expr, bindingIndex) { return _this255._preprocessUpdateExpression({ nodeIndex: nodeIndex, bindingIndex: bindingIndex, sourceSpan: ast.sourceSpan, context: COMP_VAR, value: expr }); }); // Check index is the same as the node index during compilation // They might only differ at runtime var checkIndex = nodeIndex; this.nodes[nodeIndex] = function () { return { sourceSpan: ast.sourceSpan, nodeFlags: 2 /* TypeText */ , nodeDef: importExpr(Identifiers.textDef).callFn([literal(checkIndex), literal(ast.ngContentIndex), literalArr(inter.strings.map(function (s) { return literal(s); }))]), updateRenderer: updateRendererExpressions }; }; } }, { key: "visitEmbeddedTemplate", value: function visitEmbeddedTemplate(ast, context) { var _this256 = this; var nodeIndex = this.nodes.length; // reserve the space in the nodeDefs array this.nodes.push(null); var _this$_visitElementOr = this._visitElementOrTemplate(nodeIndex, ast), flags = _this$_visitElementOr.flags, queryMatchesExpr = _this$_visitElementOr.queryMatchesExpr, hostEvents = _this$_visitElementOr.hostEvents; var childVisitor = this.viewBuilderFactory(this); this.children.push(childVisitor); childVisitor.visitAll(ast.variables, ast.children); var childCount = this.nodes.length - nodeIndex - 1; // anchorDef( // flags: NodeFlags, matchedQueries: [string, QueryValueType][], ngContentIndex: number, // childCount: number, handleEventFn?: ElementHandleEventFn, templateFactory?: // ViewDefinitionFactory): NodeDef; this.nodes[nodeIndex] = function () { return { sourceSpan: ast.sourceSpan, nodeFlags: 1 /* TypeElement */ | flags, nodeDef: importExpr(Identifiers.anchorDef).callFn([literal(flags), queryMatchesExpr, literal(ast.ngContentIndex), literal(childCount), _this256._createElementHandleEventFn(nodeIndex, hostEvents), variable(childVisitor.viewName)]) }; }; } }, { key: "visitElement", value: function visitElement(ast, context) { var _this257 = this; var nodeIndex = this.nodes.length; // reserve the space in the nodeDefs array so we can add children this.nodes.push(null); // Using a null element name creates an anchor. var elName = isNgContainer(ast.name) ? null : ast.name; var _this$_visitElementOr2 = this._visitElementOrTemplate(nodeIndex, ast), flags = _this$_visitElementOr2.flags, usedEvents = _this$_visitElementOr2.usedEvents, queryMatchesExpr = _this$_visitElementOr2.queryMatchesExpr, dirHostBindings = _this$_visitElementOr2.hostBindings, hostEvents = _this$_visitElementOr2.hostEvents; var inputDefs = []; var updateRendererExpressions = []; var outputDefs = []; if (elName) { var hostBindings = ast.inputs.map(function (inputAst) { return { context: COMP_VAR, inputAst: inputAst, dirAst: null }; }).concat(dirHostBindings); if (hostBindings.length) { updateRendererExpressions = hostBindings.map(function (hostBinding, bindingIndex) { return _this257._preprocessUpdateExpression({ context: hostBinding.context, nodeIndex: nodeIndex, bindingIndex: bindingIndex, sourceSpan: hostBinding.inputAst.sourceSpan, value: hostBinding.inputAst.value }); }); inputDefs = hostBindings.map(function (hostBinding) { return elementBindingDef(hostBinding.inputAst, hostBinding.dirAst); }); } outputDefs = usedEvents.map(function (_ref52) { var _ref53 = _slicedToArray(_ref52, 2), target = _ref53[0], eventName = _ref53[1]; return literalArr([literal(target), literal(eventName)]); }); } templateVisitAll(this, ast.children); var childCount = this.nodes.length - nodeIndex - 1; var compAst = ast.directives.find(function (dirAst) { return dirAst.directive.isComponent; }); var compRendererType = NULL_EXPR; var compView = NULL_EXPR; if (compAst) { compView = this.outputCtx.importExpr(compAst.directive.componentViewType); compRendererType = this.outputCtx.importExpr(compAst.directive.rendererType); } // Check index is the same as the node index during compilation // They might only differ at runtime var checkIndex = nodeIndex; this.nodes[nodeIndex] = function () { return { sourceSpan: ast.sourceSpan, nodeFlags: 1 /* TypeElement */ | flags, nodeDef: importExpr(Identifiers.elementDef).callFn([literal(checkIndex), literal(flags), queryMatchesExpr, literal(ast.ngContentIndex), literal(childCount), literal(elName), elName ? fixedAttrsDef(ast) : NULL_EXPR, inputDefs.length ? literalArr(inputDefs) : NULL_EXPR, outputDefs.length ? literalArr(outputDefs) : NULL_EXPR, _this257._createElementHandleEventFn(nodeIndex, hostEvents), compView, compRendererType]), updateRenderer: updateRendererExpressions }; }; } }, { key: "_visitElementOrTemplate", value: function _visitElementOrTemplate(nodeIndex, ast) { var _this258 = this; var flags = 0 /* None */ ; if (ast.hasViewContainer) { flags |= 16777216 /* EmbeddedViews */ ; } var usedEvents = new Map(); ast.outputs.forEach(function (event) { var _elementEventNameAndT = elementEventNameAndTarget(event, null), name = _elementEventNameAndT.name, target = _elementEventNameAndT.target; usedEvents.set(elementEventFullName(target, name), [target, name]); }); ast.directives.forEach(function (dirAst) { dirAst.hostEvents.forEach(function (event) { var _elementEventNameAndT2 = elementEventNameAndTarget(event, dirAst), name = _elementEventNameAndT2.name, target = _elementEventNameAndT2.target; usedEvents.set(elementEventFullName(target, name), [target, name]); }); }); var hostBindings = []; var hostEvents = []; this._visitComponentFactoryResolverProvider(ast.directives); ast.providers.forEach(function (providerAst, providerIndex) { var dirAst = undefined; var dirIndex = undefined; ast.directives.forEach(function (localDirAst, i) { if (localDirAst.directive.type.reference === tokenReference(providerAst.token)) { dirAst = localDirAst; dirIndex = i; } }); if (dirAst) { var _this258$_visitDirect = _this258._visitDirective(providerAst, dirAst, dirIndex, nodeIndex, ast.references, ast.queryMatches, usedEvents, _this258.staticQueryIds.get(ast)), dirHostBindings = _this258$_visitDirect.hostBindings, dirHostEvents = _this258$_visitDirect.hostEvents; hostBindings.push.apply(hostBindings, _toConsumableArray(dirHostBindings)); hostEvents.push.apply(hostEvents, _toConsumableArray(dirHostEvents)); } else { _this258._visitProvider(providerAst, ast.queryMatches); } }); var queryMatchExprs = []; ast.queryMatches.forEach(function (match) { var valueType = undefined; if (tokenReference(match.value) === _this258.reflector.resolveExternalReference(Identifiers.ElementRef)) { valueType = 0 /* ElementRef */ ; } else if (tokenReference(match.value) === _this258.reflector.resolveExternalReference(Identifiers.ViewContainerRef)) { valueType = 3 /* ViewContainerRef */ ; } else if (tokenReference(match.value) === _this258.reflector.resolveExternalReference(Identifiers.TemplateRef)) { valueType = 2 /* TemplateRef */ ; } if (valueType != null) { queryMatchExprs.push(literalArr([literal(match.queryId), literal(valueType)])); } }); ast.references.forEach(function (ref) { var valueType = undefined; if (!ref.value) { valueType = 1 /* RenderElement */ ; } else if (tokenReference(ref.value) === _this258.reflector.resolveExternalReference(Identifiers.TemplateRef)) { valueType = 2 /* TemplateRef */ ; } if (valueType != null) { _this258.refNodeIndices[ref.name] = nodeIndex; queryMatchExprs.push(literalArr([literal(ref.name), literal(valueType)])); } }); ast.outputs.forEach(function (outputAst) { hostEvents.push({ context: COMP_VAR, eventAst: outputAst, dirAst: null }); }); return { flags: flags, usedEvents: Array.from(usedEvents.values()), queryMatchesExpr: queryMatchExprs.length ? literalArr(queryMatchExprs) : NULL_EXPR, hostBindings: hostBindings, hostEvents: hostEvents }; } }, { key: "_visitDirective", value: function _visitDirective(providerAst, dirAst, directiveIndex, elementNodeIndex, refs, queryMatches, usedEvents, queryIds) { var _this259 = this; var nodeIndex = this.nodes.length; // reserve the space in the nodeDefs array so we can add children this.nodes.push(null); dirAst.directive.queries.forEach(function (query, queryIndex) { var queryId = dirAst.contentQueryStartId + queryIndex; var flags = 67108864 /* TypeContentQuery */ | calcStaticDynamicQueryFlags(queryIds, queryId, query); var bindingType = query.first ? 0 /* First */ : 1 /* All */ ; _this259.nodes.push(function () { return { sourceSpan: dirAst.sourceSpan, nodeFlags: flags, nodeDef: importExpr(Identifiers.queryDef).callFn([literal(flags), literal(queryId), new LiteralMapExpr([new LiteralMapEntry(query.propertyName, literal(bindingType), false)])]) }; }); }); // Note: the operation below might also create new nodeDefs, // but we don't want them to be a child of a directive, // as they might be a provider/pipe on their own. // I.e. we only allow queries as children of directives nodes. var childCount = this.nodes.length - nodeIndex - 1; var _this$_visitProviderO = this._visitProviderOrDirective(providerAst, queryMatches), flags = _this$_visitProviderO.flags, queryMatchExprs = _this$_visitProviderO.queryMatchExprs, providerExpr = _this$_visitProviderO.providerExpr, depsExpr = _this$_visitProviderO.depsExpr; refs.forEach(function (ref) { if (ref.value && tokenReference(ref.value) === tokenReference(providerAst.token)) { _this259.refNodeIndices[ref.name] = nodeIndex; queryMatchExprs.push(literalArr([literal(ref.name), literal(4 /* Provider */ )])); } }); if (dirAst.directive.isComponent) { flags |= 32768 /* Component */ ; } var inputDefs = dirAst.inputs.map(function (inputAst, inputIndex) { var mapValue = literalArr([literal(inputIndex), literal(inputAst.directiveName)]); // Note: it's important to not quote the key so that we can capture renames by minifiers! return new LiteralMapEntry(inputAst.directiveName, mapValue, false); }); var outputDefs = []; var dirMeta = dirAst.directive; Object.keys(dirMeta.outputs).forEach(function (propName) { var eventName = dirMeta.outputs[propName]; if (usedEvents.has(eventName)) { // Note: it's important to not quote the key so that we can capture renames by minifiers! outputDefs.push(new LiteralMapEntry(propName, literal(eventName), false)); } }); var updateDirectiveExpressions = []; if (dirAst.inputs.length || (flags & (262144 /* DoCheck */ | 65536 /* OnInit */ )) > 0) { updateDirectiveExpressions = dirAst.inputs.map(function (input, bindingIndex) { return _this259._preprocessUpdateExpression({ nodeIndex: nodeIndex, bindingIndex: bindingIndex, sourceSpan: input.sourceSpan, context: COMP_VAR, value: input.value }); }); } var dirContextExpr = importExpr(Identifiers.nodeValue).callFn([VIEW_VAR, literal(nodeIndex)]); var hostBindings = dirAst.hostProperties.map(function (inputAst) { return { context: dirContextExpr, dirAst: dirAst, inputAst: inputAst }; }); var hostEvents = dirAst.hostEvents.map(function (hostEventAst) { return { context: dirContextExpr, eventAst: hostEventAst, dirAst: dirAst }; }); // Check index is the same as the node index during compilation // They might only differ at runtime var checkIndex = nodeIndex; this.nodes[nodeIndex] = function () { return { sourceSpan: dirAst.sourceSpan, nodeFlags: 16384 /* TypeDirective */ | flags, nodeDef: importExpr(Identifiers.directiveDef).callFn([literal(checkIndex), literal(flags), queryMatchExprs.length ? literalArr(queryMatchExprs) : NULL_EXPR, literal(childCount), providerExpr, depsExpr, inputDefs.length ? new LiteralMapExpr(inputDefs) : NULL_EXPR, outputDefs.length ? new LiteralMapExpr(outputDefs) : NULL_EXPR]), updateDirectives: updateDirectiveExpressions, directive: dirAst.directive.type }; }; return { hostBindings: hostBindings, hostEvents: hostEvents }; } }, { key: "_visitProvider", value: function _visitProvider(providerAst, queryMatches) { this._addProviderNode(this._visitProviderOrDirective(providerAst, queryMatches)); } }, { key: "_visitComponentFactoryResolverProvider", value: function _visitComponentFactoryResolverProvider(directives) { var componentDirMeta = directives.find(function (dirAst) { return dirAst.directive.isComponent; }); if (componentDirMeta && componentDirMeta.directive.entryComponents.length) { var _componentFactoryReso = componentFactoryResolverProviderDef(this.reflector, this.outputCtx, 8192 /* PrivateProvider */ , componentDirMeta.directive.entryComponents), providerExpr = _componentFactoryReso.providerExpr, depsExpr = _componentFactoryReso.depsExpr, flags = _componentFactoryReso.flags, _tokenExpr = _componentFactoryReso.tokenExpr; this._addProviderNode({ providerExpr: providerExpr, depsExpr: depsExpr, flags: flags, tokenExpr: _tokenExpr, queryMatchExprs: [], sourceSpan: componentDirMeta.sourceSpan }); } } }, { key: "_addProviderNode", value: function _addProviderNode(data) { var nodeIndex = this.nodes.length; // providerDef( // flags: NodeFlags, matchedQueries: [string, QueryValueType][], token:any, // value: any, deps: ([DepFlags, any] | any)[]): NodeDef; this.nodes.push(function () { return { sourceSpan: data.sourceSpan, nodeFlags: data.flags, nodeDef: importExpr(Identifiers.providerDef).callFn([literal(data.flags), data.queryMatchExprs.length ? literalArr(data.queryMatchExprs) : NULL_EXPR, data.tokenExpr, data.providerExpr, data.depsExpr]) }; }); } }, { key: "_visitProviderOrDirective", value: function _visitProviderOrDirective(providerAst, queryMatches) { var flags = 0 /* None */ ; var queryMatchExprs = []; queryMatches.forEach(function (match) { if (tokenReference(match.value) === tokenReference(providerAst.token)) { queryMatchExprs.push(literalArr([literal(match.queryId), literal(4 /* Provider */ )])); } }); var _providerDef = providerDef(this.outputCtx, providerAst), providerExpr = _providerDef.providerExpr, depsExpr = _providerDef.depsExpr, providerFlags = _providerDef.flags, tokenExpr = _providerDef.tokenExpr; return { flags: flags | providerFlags, queryMatchExprs: queryMatchExprs, providerExpr: providerExpr, depsExpr: depsExpr, tokenExpr: tokenExpr, sourceSpan: providerAst.sourceSpan }; } }, { key: "getLocal", value: function getLocal(name) { if (name == EventHandlerVars.event.name) { return EventHandlerVars.event; } var currViewExpr = VIEW_VAR; for (var currBuilder = this; currBuilder; currBuilder = currBuilder.parent, currViewExpr = currViewExpr.prop('parent').cast(DYNAMIC_TYPE)) { // check references var refNodeIndex = currBuilder.refNodeIndices[name]; if (refNodeIndex != null) { return importExpr(Identifiers.nodeValue).callFn([currViewExpr, literal(refNodeIndex)]); } // check variables var varAst = currBuilder.variables.find(function (varAst) { return varAst.name === name; }); if (varAst) { var varValue = varAst.value || IMPLICIT_TEMPLATE_VAR; return currViewExpr.prop('context').prop(varValue); } } return null; } }, { key: "notifyImplicitReceiverUse", value: function notifyImplicitReceiverUse() {// Not needed in View Engine as View Engine walks through the generated // expressions to figure out if the implicit receiver is used and needs // to be generated as part of the pre-update statements. } }, { key: "_createLiteralArrayConverter", value: function _createLiteralArrayConverter(sourceSpan, argCount) { if (argCount === 0) { var valueExpr = importExpr(Identifiers.EMPTY_ARRAY); return function () { return valueExpr; }; } var checkIndex = this.nodes.length; this.nodes.push(function () { return { sourceSpan: sourceSpan, nodeFlags: 32 /* TypePureArray */ , nodeDef: importExpr(Identifiers.pureArrayDef).callFn([literal(checkIndex), literal(argCount)]) }; }); return function (args) { return callCheckStmt(checkIndex, args); }; } }, { key: "_createLiteralMapConverter", value: function _createLiteralMapConverter(sourceSpan, keys) { if (keys.length === 0) { var valueExpr = importExpr(Identifiers.EMPTY_MAP); return function () { return valueExpr; }; } var map = literalMap(keys.map(function (e, i) { return Object.assign({}, e, { value: literal(i) }); })); var checkIndex = this.nodes.length; this.nodes.push(function () { return { sourceSpan: sourceSpan, nodeFlags: 64 /* TypePureObject */ , nodeDef: importExpr(Identifiers.pureObjectDef).callFn([literal(checkIndex), map]) }; }); return function (args) { return callCheckStmt(checkIndex, args); }; } }, { key: "_createPipeConverter", value: function _createPipeConverter(expression, name, argCount) { var pipe = this.usedPipes.find(function (pipeSummary) { return pipeSummary.name === name; }); if (pipe.pure) { var checkIndex = this.nodes.length; this.nodes.push(function () { return { sourceSpan: expression.sourceSpan, nodeFlags: 128 /* TypePurePipe */ , nodeDef: importExpr(Identifiers.purePipeDef).callFn([literal(checkIndex), literal(argCount)]) }; }); // find underlying pipe in the component view var compViewExpr = VIEW_VAR; var compBuilder = this; while (compBuilder.parent) { compBuilder = compBuilder.parent; compViewExpr = compViewExpr.prop('parent').cast(DYNAMIC_TYPE); } var pipeNodeIndex = compBuilder.purePipeNodeIndices[name]; var pipeValueExpr = importExpr(Identifiers.nodeValue).callFn([compViewExpr, literal(pipeNodeIndex)]); return function (args) { return callUnwrapValue(expression.nodeIndex, expression.bindingIndex, callCheckStmt(checkIndex, [pipeValueExpr].concat(args))); }; } else { var nodeIndex = this._createPipe(expression.sourceSpan, pipe); var nodeValueExpr = importExpr(Identifiers.nodeValue).callFn([VIEW_VAR, literal(nodeIndex)]); return function (args) { return callUnwrapValue(expression.nodeIndex, expression.bindingIndex, nodeValueExpr.callMethod('transform', args)); }; } } }, { key: "_createPipe", value: function _createPipe(sourceSpan, pipe) { var _this260 = this; var nodeIndex = this.nodes.length; var flags = 0 /* None */ ; pipe.type.lifecycleHooks.forEach(function (lifecycleHook) { // for pipes, we only support ngOnDestroy if (lifecycleHook === LifecycleHooks.OnDestroy) { flags |= lifecycleHookToNodeFlag(lifecycleHook); } }); var depExprs = pipe.type.diDeps.map(function (diDep) { return depDef(_this260.outputCtx, diDep); }); // function pipeDef( // flags: NodeFlags, ctor: any, deps: ([DepFlags, any] | any)[]): NodeDef this.nodes.push(function () { return { sourceSpan: sourceSpan, nodeFlags: 16 /* TypePipe */ , nodeDef: importExpr(Identifiers.pipeDef).callFn([literal(flags), _this260.outputCtx.importExpr(pipe.type.reference), literalArr(depExprs)]) }; }); return nodeIndex; } /** * For the AST in `UpdateExpression.value`: * - create nodes for pipes, literal arrays and, literal maps, * - update the AST to replace pipes, literal arrays and, literal maps with calls to check fn. * * WARNING: This might create new nodeDefs (for pipes and literal arrays and literal maps)! */ }, { key: "_preprocessUpdateExpression", value: function _preprocessUpdateExpression(expression) { var _this261 = this; return { nodeIndex: expression.nodeIndex, bindingIndex: expression.bindingIndex, sourceSpan: expression.sourceSpan, context: expression.context, value: convertPropertyBindingBuiltins({ createLiteralArrayConverter: function createLiteralArrayConverter(argCount) { return _this261._createLiteralArrayConverter(expression.sourceSpan, argCount); }, createLiteralMapConverter: function createLiteralMapConverter(keys) { return _this261._createLiteralMapConverter(expression.sourceSpan, keys); }, createPipeConverter: function createPipeConverter(name, argCount) { return _this261._createPipeConverter(expression, name, argCount); } }, expression.value) }; } }, { key: "_createNodeExpressions", value: function _createNodeExpressions() { var self = this; var updateBindingCount = 0; var updateRendererStmts = []; var updateDirectivesStmts = []; var nodeDefExprs = this.nodes.map(function (factory, nodeIndex) { var _factory = factory(), nodeDef = _factory.nodeDef, nodeFlags = _factory.nodeFlags, updateDirectives = _factory.updateDirectives, updateRenderer = _factory.updateRenderer, sourceSpan = _factory.sourceSpan; if (updateRenderer) { updateRendererStmts.push.apply(updateRendererStmts, _toConsumableArray(createUpdateStatements(nodeIndex, sourceSpan, updateRenderer, false))); } if (updateDirectives) { updateDirectivesStmts.push.apply(updateDirectivesStmts, _toConsumableArray(createUpdateStatements(nodeIndex, sourceSpan, updateDirectives, (nodeFlags & (262144 /* DoCheck */ | 65536 /* OnInit */ )) > 0))); } // We use a comma expression to call the log function before // the nodeDef function, but still use the result of the nodeDef function // as the value. // Note: We only add the logger to elements / text nodes, // so we don't generate too much code. var logWithNodeDef = nodeFlags & 3 /* CatRenderNode */ ? new CommaExpr([LOG_VAR$1.callFn([]).callFn([]), nodeDef]) : nodeDef; return applySourceSpanToExpressionIfNeeded(logWithNodeDef, sourceSpan); }); return { updateRendererStmts: updateRendererStmts, updateDirectivesStmts: updateDirectivesStmts, nodeDefExprs: nodeDefExprs }; function createUpdateStatements(nodeIndex, sourceSpan, expressions, allowEmptyExprs) { var updateStmts = []; var exprs = expressions.map(function (_ref54) { var sourceSpan = _ref54.sourceSpan, context = _ref54.context, value = _ref54.value; var bindingId = "".concat(updateBindingCount++); var nameResolver = context === COMP_VAR ? self : null; var _convertPropertyBindi3 = _convertPropertyBinding(nameResolver, context, value, bindingId, BindingForm.General), stmts = _convertPropertyBindi3.stmts, currValExpr = _convertPropertyBindi3.currValExpr; updateStmts.push.apply(updateStmts, _toConsumableArray(stmts.map(function (stmt) { return applySourceSpanToStatementIfNeeded(stmt, sourceSpan); }))); return applySourceSpanToExpressionIfNeeded(currValExpr, sourceSpan); }); if (expressions.length || allowEmptyExprs) { updateStmts.push(applySourceSpanToStatementIfNeeded(callCheckStmt(nodeIndex, exprs).toStmt(), sourceSpan)); } return updateStmts; } } }, { key: "_createElementHandleEventFn", value: function _createElementHandleEventFn(nodeIndex, handlers) { var _this262 = this; var handleEventStmts = []; var handleEventBindingCount = 0; handlers.forEach(function (_ref55) { var context = _ref55.context, eventAst = _ref55.eventAst, dirAst = _ref55.dirAst; var bindingId = "".concat(handleEventBindingCount++); var nameResolver = context === COMP_VAR ? _this262 : null; var _convertActionBinding2 = convertActionBinding(nameResolver, context, eventAst.handler, bindingId), stmts = _convertActionBinding2.stmts, allowDefault = _convertActionBinding2.allowDefault; var trueStmts = stmts; if (allowDefault) { trueStmts.push(ALLOW_DEFAULT_VAR.set(allowDefault.and(ALLOW_DEFAULT_VAR)).toStmt()); } var _elementEventNameAndT3 = elementEventNameAndTarget(eventAst, dirAst), eventTarget = _elementEventNameAndT3.target, eventName = _elementEventNameAndT3.name; var fullEventName = elementEventFullName(eventTarget, eventName); handleEventStmts.push(applySourceSpanToStatementIfNeeded(new IfStmt(literal(fullEventName).identical(EVENT_NAME_VAR), trueStmts), eventAst.sourceSpan)); }); var handleEventFn; if (handleEventStmts.length > 0) { var preStmts = [ALLOW_DEFAULT_VAR.set(literal(true)).toDeclStmt(BOOL_TYPE)]; if (!this.component.isHost && findReadVarNames(handleEventStmts).has(COMP_VAR.name)) { preStmts.push(COMP_VAR.set(VIEW_VAR.prop('component')).toDeclStmt(this.compType)); } handleEventFn = fn([new FnParam(VIEW_VAR.name, INFERRED_TYPE), new FnParam(EVENT_NAME_VAR.name, INFERRED_TYPE), new FnParam(EventHandlerVars.event.name, INFERRED_TYPE)], [].concat(preStmts, handleEventStmts, [new ReturnStatement(ALLOW_DEFAULT_VAR)]), INFERRED_TYPE); } else { handleEventFn = NULL_EXPR; } return handleEventFn; } }, { key: "visitDirective", value: function visitDirective(ast, context) {} }, { key: "visitDirectiveProperty", value: function visitDirectiveProperty(ast, context) {} }, { key: "visitReference", value: function visitReference(ast, context) {} }, { key: "visitVariable", value: function visitVariable(ast, context) {} }, { key: "visitEvent", value: function visitEvent(ast, context) {} }, { key: "visitElementProperty", value: function visitElementProperty(ast, context) {} }, { key: "visitAttr", value: function visitAttr(ast, context) {} }]); return ViewBuilder$1; }(); function needsAdditionalRootNode(astNodes) { var lastAstNode = astNodes[astNodes.length - 1]; if (lastAstNode instanceof EmbeddedTemplateAst) { return lastAstNode.hasViewContainer; } if (lastAstNode instanceof ElementAst) { if (isNgContainer(lastAstNode.name) && lastAstNode.children.length) { return needsAdditionalRootNode(lastAstNode.children); } return lastAstNode.hasViewContainer; } return lastAstNode instanceof NgContentAst; } function elementBindingDef(inputAst, dirAst) { var inputType = inputAst.type; switch (inputType) { case 1 /* Attribute */ : return literalArr([literal(1 /* TypeElementAttribute */ ), literal(inputAst.name), literal(inputAst.securityContext)]); case 0 /* Property */ : return literalArr([literal(8 /* TypeProperty */ ), literal(inputAst.name), literal(inputAst.securityContext)]); case 4 /* Animation */ : var bindingType = 8 /* TypeProperty */ | (dirAst && dirAst.directive.isComponent ? 32 /* SyntheticHostProperty */ : 16 /* SyntheticProperty */ ); return literalArr([literal(bindingType), literal('@' + inputAst.name), literal(inputAst.securityContext)]); case 2 /* Class */ : return literalArr([literal(2 /* TypeElementClass */ ), literal(inputAst.name), NULL_EXPR]); case 3 /* Style */ : return literalArr([literal(4 /* TypeElementStyle */ ), literal(inputAst.name), literal(inputAst.unit)]); default: // This default case is not needed by TypeScript compiler, as the switch is exhaustive. // However Closure Compiler does not understand that and reports an error in typed mode. // The `throw new Error` below works around the problem, and the unexpected: never variable // makes sure tsc still checks this code is unreachable. var unexpected = inputType; throw new Error("unexpected ".concat(unexpected)); } } function fixedAttrsDef(elementAst) { var mapResult = Object.create(null); elementAst.attrs.forEach(function (attrAst) { mapResult[attrAst.name] = attrAst.value; }); elementAst.directives.forEach(function (dirAst) { Object.keys(dirAst.directive.hostAttributes).forEach(function (name) { var value = dirAst.directive.hostAttributes[name]; var prevValue = mapResult[name]; mapResult[name] = prevValue != null ? mergeAttributeValue(name, prevValue, value) : value; }); }); // Note: We need to sort to get a defined output order // for tests and for caching generated artifacts... return literalArr(Object.keys(mapResult).sort().map(function (attrName) { return literalArr([literal(attrName), literal(mapResult[attrName])]); })); } function mergeAttributeValue(attrName, attrValue1, attrValue2) { if (attrName == CLASS_ATTR$1 || attrName == STYLE_ATTR) { return "".concat(attrValue1, " ").concat(attrValue2); } else { return attrValue2; } } function callCheckStmt(nodeIndex, exprs) { if (exprs.length > 10) { return CHECK_VAR.callFn([VIEW_VAR, literal(nodeIndex), literal(1 /* Dynamic */ ), literalArr(exprs)]); } else { return CHECK_VAR.callFn([VIEW_VAR, literal(nodeIndex), literal(0 /* Inline */ )].concat(_toConsumableArray(exprs))); } } function callUnwrapValue(nodeIndex, bindingIdx, expr) { return importExpr(Identifiers.unwrapValue).callFn([VIEW_VAR, literal(nodeIndex), literal(bindingIdx), expr]); } function findStaticQueryIds(nodes) { var result = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Map(); nodes.forEach(function (node) { var staticQueryIds = new Set(); var dynamicQueryIds = new Set(); var queryMatches = undefined; if (node instanceof ElementAst) { findStaticQueryIds(node.children, result); node.children.forEach(function (child) { var childData = result.get(child); childData.staticQueryIds.forEach(function (queryId) { return staticQueryIds.add(queryId); }); childData.dynamicQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); }); }); queryMatches = node.queryMatches; } else if (node instanceof EmbeddedTemplateAst) { findStaticQueryIds(node.children, result); node.children.forEach(function (child) { var childData = result.get(child); childData.staticQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); }); childData.dynamicQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); }); }); queryMatches = node.queryMatches; } if (queryMatches) { queryMatches.forEach(function (match) { return staticQueryIds.add(match.queryId); }); } dynamicQueryIds.forEach(function (queryId) { return staticQueryIds["delete"](queryId); }); result.set(node, { staticQueryIds: staticQueryIds, dynamicQueryIds: dynamicQueryIds }); }); return result; } function staticViewQueryIds(nodeStaticQueryIds) { var staticQueryIds = new Set(); var dynamicQueryIds = new Set(); Array.from(nodeStaticQueryIds.values()).forEach(function (entry) { entry.staticQueryIds.forEach(function (queryId) { return staticQueryIds.add(queryId); }); entry.dynamicQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); }); }); dynamicQueryIds.forEach(function (queryId) { return staticQueryIds["delete"](queryId); }); return { staticQueryIds: staticQueryIds, dynamicQueryIds: dynamicQueryIds }; } function elementEventNameAndTarget(eventAst, dirAst) { if (eventAst.isAnimation) { return { name: "@".concat(eventAst.name, ".").concat(eventAst.phase), target: dirAst && dirAst.directive.isComponent ? 'component' : null }; } else { return eventAst; } } function calcStaticDynamicQueryFlags(queryIds, queryId, query) { var flags = 0 /* None */ ; // Note: We only make queries static that query for a single item. // This is because of backwards compatibility with the old view compiler... if (query.first && shouldResolveAsStaticQuery(queryIds, queryId, query)) { flags |= 268435456 /* StaticQuery */ ; } else { flags |= 536870912 /* DynamicQuery */ ; } return flags; } function shouldResolveAsStaticQuery(queryIds, queryId, query) { // If query.static has been set by the user, use that value to determine whether // the query is static. If none has been set, sort the query into static/dynamic // based on query results (i.e. dynamic if CD needs to run to get all results). return query["static"] || query["static"] == null && (queryIds.staticQueryIds.has(queryId) || !queryIds.dynamicQueryIds.has(queryId)); } function elementEventFullName(target, name) { return target ? "".concat(target, ":").concat(name) : name; } /** * @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 message extracted from the templates. */ var MessageBundle = /*#__PURE__*/function () { function MessageBundle(_htmlParser, _implicitTags, _implicitAttrs) { var _locale = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; _classCallCheck(this, MessageBundle); this._htmlParser = _htmlParser; this._implicitTags = _implicitTags; this._implicitAttrs = _implicitAttrs; this._locale = _locale; this._messages = []; } _createClass2(MessageBundle, [{ key: "updateFromTemplate", value: function updateFromTemplate(html, url, interpolationConfig) { var _this$_messages; var htmlParserResult = this._htmlParser.parse(html, url, { tokenizeExpansionForms: true, interpolationConfig: interpolationConfig }); if (htmlParserResult.errors.length) { return htmlParserResult.errors; } var i18nParserResult = extractMessages(htmlParserResult.rootNodes, interpolationConfig, this._implicitTags, this._implicitAttrs); if (i18nParserResult.errors.length) { return i18nParserResult.errors; } (_this$_messages = this._messages).push.apply(_this$_messages, _toConsumableArray(i18nParserResult.messages)); return []; } // Return the message in the internal format // The public (serialized) format might be different, see the `write` method. }, { key: "getMessages", value: function getMessages() { return this._messages; } }, { key: "write", value: function write(serializer, filterSources) { var messages = {}; var mapperVisitor = new MapPlaceholderNames(); // Deduplicate messages based on their ID this._messages.forEach(function (message) { var id = serializer.digest(message); if (!messages.hasOwnProperty(id)) { messages[id] = message; } else { var _messages$id$sources; (_messages$id$sources = messages[id].sources).push.apply(_messages$id$sources, _toConsumableArray(message.sources)); } }); // Transform placeholder names using the serializer mapping var msgList = Object.keys(messages).map(function (id) { var mapper = serializer.createNameMapper(messages[id]); var src = messages[id]; var nodes = mapper ? mapperVisitor.convert(src.nodes, mapper) : src.nodes; var transformedMessage = new Message(nodes, {}, {}, src.meaning, src.description, id); transformedMessage.sources = src.sources; if (filterSources) { transformedMessage.sources.forEach(function (source) { return source.filePath = filterSources(source.filePath); }); } return transformedMessage; }); return serializer.write(msgList, this._locale); } }]); return MessageBundle; }(); // Transform an i18n AST by renaming the placeholder nodes with the given mapper var MapPlaceholderNames = /*#__PURE__*/function (_CloneVisitor) { _inherits(MapPlaceholderNames, _CloneVisitor); var _super101 = _createSuper(MapPlaceholderNames); function MapPlaceholderNames() { _classCallCheck(this, MapPlaceholderNames); return _super101.apply(this, arguments); } _createClass2(MapPlaceholderNames, [{ key: "convert", value: function convert(nodes, mapper) { var _this263 = this; return mapper ? nodes.map(function (n) { return n.visit(_this263, mapper); }) : nodes; } }, { key: "visitTagPlaceholder", value: function visitTagPlaceholder(ph, mapper) { var _this264 = this; var startName = mapper.toPublicName(ph.startName); var closeName = ph.closeName ? mapper.toPublicName(ph.closeName) : ph.closeName; var children = ph.children.map(function (n) { return n.visit(_this264, mapper); }); return new TagPlaceholder(ph.tag, ph.attrs, startName, closeName, children, ph.isVoid, ph.sourceSpan); } }, { key: "visitPlaceholder", value: function visitPlaceholder(ph, mapper) { return new Placeholder(ph.value, mapper.toPublicName(ph.name), ph.sourceSpan); } }, { key: "visitIcuPlaceholder", value: function visitIcuPlaceholder(ph, mapper) { return new IcuPlaceholder(ph.value, mapper.toPublicName(ph.name), ph.sourceSpan); } }]); return MapPlaceholderNames; }(CloneVisitor); /** * @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 GeneratedFile = /*#__PURE__*/function () { function GeneratedFile(srcFileUrl, genFileUrl, sourceOrStmts) { _classCallCheck(this, GeneratedFile); this.srcFileUrl = srcFileUrl; this.genFileUrl = genFileUrl; if (typeof sourceOrStmts === 'string') { this.source = sourceOrStmts; this.stmts = null; } else { this.source = null; this.stmts = sourceOrStmts; } } _createClass2(GeneratedFile, [{ key: "isEquivalent", value: function isEquivalent(other) { if (this.genFileUrl !== other.genFileUrl) { return false; } if (this.source) { return this.source === other.source; } if (other.stmts == null) { return false; } // Note: the constructor guarantees that if this.source is not filled, // then this.stmts is. return areAllEquivalent(this.stmts, other.stmts); } }]); return GeneratedFile; }(); function toTypeScript(file) { var preamble = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; if (!file.stmts) { throw new Error("Illegal state: No stmts present on GeneratedFile ".concat(file.genFileUrl)); } return new TypeScriptEmitter().emitStatements(file.genFileUrl, file.stmts, preamble); } /** * @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 */ function _listLazyRoutes(moduleMeta, reflector) { var allLazyRoutes = []; var _iterator20 = _createForOfIteratorHelper(moduleMeta.transitiveModule.providers), _step20; try { for (_iterator20.s(); !(_step20 = _iterator20.n()).done;) { var _step20$value = _step20.value, provider = _step20$value.provider, _module = _step20$value.module; if (tokenReference(provider.token) === reflector.ROUTES) { var loadChildren = _collectLoadChildren(provider.useValue); var _iterator21 = _createForOfIteratorHelper(loadChildren), _step21; try { for (_iterator21.s(); !(_step21 = _iterator21.n()).done;) { var route = _step21.value; allLazyRoutes.push(parseLazyRoute(route, reflector, _module.reference)); } } catch (err) { _iterator21.e(err); } finally { _iterator21.f(); } } } } catch (err) { _iterator20.e(err); } finally { _iterator20.f(); } return allLazyRoutes; } function _collectLoadChildren(routes) { var target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; if (typeof routes === 'string') { target.push(routes); } else if (Array.isArray(routes)) { var _iterator22 = _createForOfIteratorHelper(routes), _step22; try { for (_iterator22.s(); !(_step22 = _iterator22.n()).done;) { var route = _step22.value; _collectLoadChildren(route, target); } } catch (err) { _iterator22.e(err); } finally { _iterator22.f(); } } else if (routes.loadChildren) { _collectLoadChildren(routes.loadChildren, target); } else if (routes.children) { _collectLoadChildren(routes.children, target); } return target; } function parseLazyRoute(route, reflector, module) { var _route$split = route.split('#'), _route$split2 = _slicedToArray(_route$split, 2), routePath = _route$split2[0], routeName = _route$split2[1]; var referencedModule = reflector.resolveExternalReference({ moduleName: routePath, name: routeName }, module ? module.filePath : undefined); return { route: route, module: module || referencedModule, referencedModule: referencedModule }; } /** * @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 TS = /^(?!.*\.d\.ts$).*\.ts$/; var ResolvedStaticSymbol = function ResolvedStaticSymbol(symbol, metadata) { _classCallCheck(this, ResolvedStaticSymbol); this.symbol = symbol; this.metadata = metadata; }; var SUPPORTED_SCHEMA_VERSION = 4; /** * This class is responsible for loading metadata per symbol, * and normalizing references between symbols. * * Internally, it only uses symbols without members, * and deduces the values for symbols with members based * on these symbols. */ var StaticSymbolResolver = /*#__PURE__*/function () { function StaticSymbolResolver(host, staticSymbolCache, summaryResolver, errorRecorder) { _classCallCheck(this, StaticSymbolResolver); this.host = host; this.staticSymbolCache = staticSymbolCache; this.summaryResolver = summaryResolver; this.errorRecorder = errorRecorder; this.metadataCache = new Map(); // Note: this will only contain StaticSymbols without members! this.resolvedSymbols = new Map(); this.resolvedFilePaths = new Set(); // Note: this will only contain StaticSymbols without members! this.importAs = new Map(); this.symbolResourcePaths = new Map(); this.symbolFromFile = new Map(); this.knownFileNameToModuleNames = new Map(); } _createClass2(StaticSymbolResolver, [{ key: "resolveSymbol", value: function resolveSymbol(staticSymbol) { if (staticSymbol.members.length > 0) { return this._resolveSymbolMembers(staticSymbol); } // Note: always ask for a summary first, // as we might have read shallow metadata via a .d.ts file // for the symbol. var resultFromSummary = this._resolveSymbolFromSummary(staticSymbol); if (resultFromSummary) { return resultFromSummary; } var resultFromCache = this.resolvedSymbols.get(staticSymbol); if (resultFromCache) { return resultFromCache; } // Note: Some users use libraries that were not compiled with ngc, i.e. they don't // have summaries, only .d.ts files. So we always need to check both, the summary // and metadata. this._createSymbolsOf(staticSymbol.filePath); return this.resolvedSymbols.get(staticSymbol); } /** * getImportAs produces a symbol that can be used to import the given symbol. * The import might be different than the symbol if the symbol is exported from * a library with a summary; in which case we want to import the symbol from the * ngfactory re-export instead of directly to avoid introducing a direct dependency * on an otherwise indirect dependency. * * @param staticSymbol the symbol for which to generate a import symbol */ }, { key: "getImportAs", value: function getImportAs(staticSymbol) { var useSummaries = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; if (staticSymbol.members.length) { var baseSymbol = this.getStaticSymbol(staticSymbol.filePath, staticSymbol.name); var baseImportAs = this.getImportAs(baseSymbol, useSummaries); return baseImportAs ? this.getStaticSymbol(baseImportAs.filePath, baseImportAs.name, staticSymbol.members) : null; } var summarizedFileName = stripSummaryForJitFileSuffix(staticSymbol.filePath); if (summarizedFileName !== staticSymbol.filePath) { var summarizedName = stripSummaryForJitNameSuffix(staticSymbol.name); var _baseSymbol = this.getStaticSymbol(summarizedFileName, summarizedName, staticSymbol.members); var _baseImportAs = this.getImportAs(_baseSymbol, useSummaries); return _baseImportAs ? this.getStaticSymbol(summaryForJitFileName(_baseImportAs.filePath), summaryForJitName(_baseImportAs.name), _baseSymbol.members) : null; } var result = useSummaries && this.summaryResolver.getImportAs(staticSymbol) || null; if (!result) { result = this.importAs.get(staticSymbol); } return result; } /** * getResourcePath produces the path to the original location of the symbol and should * be used to determine the relative location of resource references recorded in * symbol metadata. */ }, { key: "getResourcePath", value: function getResourcePath(staticSymbol) { return this.symbolResourcePaths.get(staticSymbol) || staticSymbol.filePath; } /** * getTypeArity returns the number of generic type parameters the given symbol * has. If the symbol is not a type the result is null. */ }, { key: "getTypeArity", value: function getTypeArity(staticSymbol) { // If the file is a factory/ngsummary file, don't resolve the symbol as doing so would // cause the metadata for an factory/ngsummary file to be loaded which doesn't exist. // All references to generated classes must include the correct arity whenever // generating code. if (isGeneratedFile(staticSymbol.filePath)) { return null; } var resolvedSymbol = unwrapResolvedMetadata(this.resolveSymbol(staticSymbol)); while (resolvedSymbol && resolvedSymbol.metadata instanceof StaticSymbol) { resolvedSymbol = unwrapResolvedMetadata(this.resolveSymbol(resolvedSymbol.metadata)); } return resolvedSymbol && resolvedSymbol.metadata && resolvedSymbol.metadata.arity || null; } }, { key: "getKnownModuleName", value: function getKnownModuleName(filePath) { return this.knownFileNameToModuleNames.get(filePath) || null; } }, { key: "recordImportAs", value: function recordImportAs(sourceSymbol, targetSymbol) { sourceSymbol.assertNoMembers(); targetSymbol.assertNoMembers(); this.importAs.set(sourceSymbol, targetSymbol); } }, { key: "recordModuleNameForFileName", value: function recordModuleNameForFileName(fileName, moduleName) { this.knownFileNameToModuleNames.set(fileName, moduleName); } /** * Invalidate all information derived from the given file. * * @param fileName the file to invalidate */ }, { key: "invalidateFile", value: function invalidateFile(fileName) { this.metadataCache["delete"](fileName); this.resolvedFilePaths["delete"](fileName); var symbols = this.symbolFromFile.get(fileName); if (symbols) { this.symbolFromFile["delete"](fileName); var _iterator23 = _createForOfIteratorHelper(symbols), _step23; try { for (_iterator23.s(); !(_step23 = _iterator23.n()).done;) { var symbol = _step23.value; this.resolvedSymbols["delete"](symbol); this.importAs["delete"](symbol); this.symbolResourcePaths["delete"](symbol); } } catch (err) { _iterator23.e(err); } finally { _iterator23.f(); } } } /** @internal */ }, { key: "ignoreErrorsFor", value: function ignoreErrorsFor(cb) { var recorder = this.errorRecorder; this.errorRecorder = function () {}; try { return cb(); } finally { this.errorRecorder = recorder; } } }, { key: "_resolveSymbolMembers", value: function _resolveSymbolMembers(staticSymbol) { var members = staticSymbol.members; var baseResolvedSymbol = this.resolveSymbol(this.getStaticSymbol(staticSymbol.filePath, staticSymbol.name)); if (!baseResolvedSymbol) { return null; } var baseMetadata = unwrapResolvedMetadata(baseResolvedSymbol.metadata); if (baseMetadata instanceof StaticSymbol) { return new ResolvedStaticSymbol(staticSymbol, this.getStaticSymbol(baseMetadata.filePath, baseMetadata.name, members)); } else if (baseMetadata && baseMetadata.__symbolic === 'class') { if (baseMetadata.statics && members.length === 1) { return new ResolvedStaticSymbol(staticSymbol, baseMetadata.statics[members[0]]); } } else { var value = baseMetadata; for (var i = 0; i < members.length && value; i++) { value = value[members[i]]; } return new ResolvedStaticSymbol(staticSymbol, value); } return null; } }, { key: "_resolveSymbolFromSummary", value: function _resolveSymbolFromSummary(staticSymbol) { var summary = this.summaryResolver.resolveSummary(staticSymbol); return summary ? new ResolvedStaticSymbol(staticSymbol, summary.metadata) : null; } /** * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded. * All types passed to the StaticResolver should be pseudo-types returned by this method. * * @param declarationFile the absolute path of the file where the symbol is declared * @param name the name of the type. * @param members a symbol for a static member of the named type */ }, { key: "getStaticSymbol", value: function getStaticSymbol(declarationFile, name, members) { return this.staticSymbolCache.get(declarationFile, name, members); } /** * hasDecorators checks a file's metadata for the presence of decorators without evaluating the * metadata. * * @param filePath the absolute path to examine for decorators. * @returns true if any class in the file has a decorator. */ }, { key: "hasDecorators", value: function hasDecorators(filePath) { var metadata = this.getModuleMetadata(filePath); if (metadata['metadata']) { return Object.keys(metadata['metadata']).some(function (metadataKey) { var entry = metadata['metadata'][metadataKey]; return entry && entry.__symbolic === 'class' && entry.decorators; }); } return false; } }, { key: "getSymbolsOf", value: function getSymbolsOf(filePath) { var summarySymbols = this.summaryResolver.getSymbolsOf(filePath); if (summarySymbols) { return summarySymbols; } // Note: Some users use libraries that were not compiled with ngc, i.e. they don't // have summaries, only .d.ts files, but `summaryResolver.isLibraryFile` returns true. this._createSymbolsOf(filePath); var metadataSymbols = []; this.resolvedSymbols.forEach(function (resolvedSymbol) { if (resolvedSymbol.symbol.filePath === filePath) { metadataSymbols.push(resolvedSymbol.symbol); } }); return metadataSymbols; } }, { key: "_createSymbolsOf", value: function _createSymbolsOf(filePath) { var _this265 = this; if (this.resolvedFilePaths.has(filePath)) { return; } this.resolvedFilePaths.add(filePath); var resolvedSymbols = []; var metadata = this.getModuleMetadata(filePath); if (metadata['importAs']) { // Index bundle indices should use the importAs module name defined // in the bundle. this.knownFileNameToModuleNames.set(filePath, metadata['importAs']); } // handle the symbols in one of the re-export location if (metadata['exports']) { var _iterator24 = _createForOfIteratorHelper(metadata['exports']), _step24; try { var _loop3 = function _loop3() { var moduleExport = _step24.value; // handle the symbols in the list of explicitly re-exported symbols. if (moduleExport["export"]) { moduleExport["export"].forEach(function (exportSymbol) { var symbolName; if (typeof exportSymbol === 'string') { symbolName = exportSymbol; } else { symbolName = exportSymbol.as; } symbolName = unescapeIdentifier(symbolName); var symName = symbolName; if (typeof exportSymbol !== 'string') { symName = unescapeIdentifier(exportSymbol.name); } var resolvedModule = _this265.resolveModule(moduleExport.from, filePath); if (resolvedModule) { var targetSymbol = _this265.getStaticSymbol(resolvedModule, symName); var sourceSymbol = _this265.getStaticSymbol(filePath, symbolName); resolvedSymbols.push(_this265.createExport(sourceSymbol, targetSymbol)); } }); } else { // handle the symbols via export * directives. var resolvedModule = _this265.resolveModule(moduleExport.from, filePath); if (resolvedModule) { var nestedExports = _this265.getSymbolsOf(resolvedModule); nestedExports.forEach(function (targetSymbol) { var sourceSymbol = _this265.getStaticSymbol(filePath, targetSymbol.name); resolvedSymbols.push(_this265.createExport(sourceSymbol, targetSymbol)); }); } } }; for (_iterator24.s(); !(_step24 = _iterator24.n()).done;) { _loop3(); } } catch (err) { _iterator24.e(err); } finally { _iterator24.f(); } } // handle the actual metadata. Has to be after the exports // as there might be collisions in the names, and we want the symbols // of the current module to win ofter reexports. if (metadata['metadata']) { // handle direct declarations of the symbol var topLevelSymbolNames = new Set(Object.keys(metadata['metadata']).map(unescapeIdentifier)); var origins = metadata['origins'] || {}; Object.keys(metadata['metadata']).forEach(function (metadataKey) { var symbolMeta = metadata['metadata'][metadataKey]; var name = unescapeIdentifier(metadataKey); var symbol = _this265.getStaticSymbol(filePath, name); var origin = origins.hasOwnProperty(metadataKey) && origins[metadataKey]; if (origin) { // If the symbol is from a bundled index, use the declaration location of the // symbol so relative references (such as './my.html') will be calculated // correctly. var originFilePath = _this265.resolveModule(origin, filePath); if (!originFilePath) { _this265.reportError(new Error("Couldn't resolve original symbol for ".concat(origin, " from ").concat(_this265.host.getOutputName(filePath)))); } else { _this265.symbolResourcePaths.set(symbol, originFilePath); } } resolvedSymbols.push(_this265.createResolvedSymbol(symbol, filePath, topLevelSymbolNames, symbolMeta)); }); } resolvedSymbols.forEach(function (resolvedSymbol) { return _this265.resolvedSymbols.set(resolvedSymbol.symbol, resolvedSymbol); }); this.symbolFromFile.set(filePath, resolvedSymbols.map(function (resolvedSymbol) { return resolvedSymbol.symbol; })); } }, { key: "createResolvedSymbol", value: function createResolvedSymbol(sourceSymbol, topLevelPath, topLevelSymbolNames, metadata) { var _this266 = this; // For classes that don't have Angular summaries / metadata, // we only keep their arity, but nothing else // (e.g. their constructor parameters). // We do this to prevent introducing deep imports // as we didn't generate .ngfactory.ts files with proper reexports. var isTsFile = TS.test(sourceSymbol.filePath); if (this.summaryResolver.isLibraryFile(sourceSymbol.filePath) && !isTsFile && metadata && metadata['__symbolic'] === 'class') { var _transformedMeta = { __symbolic: 'class', arity: metadata.arity }; return new ResolvedStaticSymbol(sourceSymbol, _transformedMeta); } var _originalFileMemo; var getOriginalName = function getOriginalName() { if (!_originalFileMemo) { // Guess what the original file name is from the reference. If it has a `.d.ts` extension // replace it with `.ts`. If it already has `.ts` just leave it in place. If it doesn't have // .ts or .d.ts, append `.ts'. Also, if it is in `node_modules`, trim the `node_module` // location as it is not important to finding the file. _originalFileMemo = _this266.host.getOutputName(topLevelPath.replace(/((\.ts)|(\.d\.ts)|)$/, '.ts').replace(/^.*node_modules[/\\]/, '')); } return _originalFileMemo; }; var self = this; var ReferenceTransformer = /*#__PURE__*/function (_ValueTransformer2) { _inherits(ReferenceTransformer, _ValueTransformer2); var _super102 = _createSuper(ReferenceTransformer); function ReferenceTransformer() { _classCallCheck(this, ReferenceTransformer); return _super102.apply(this, arguments); } _createClass2(ReferenceTransformer, [{ key: "visitStringMap", value: function visitStringMap(map, functionParams) { var symbolic = map['__symbolic']; if (symbolic === 'function') { var oldLen = functionParams.length; functionParams.push.apply(functionParams, _toConsumableArray(map['parameters'] || [])); var result = _get(_getPrototypeOf(ReferenceTransformer.prototype), "visitStringMap", this).call(this, map, functionParams); functionParams.length = oldLen; return result; } else if (symbolic === 'reference') { var _module2 = map['module']; var name = map['name'] ? unescapeIdentifier(map['name']) : map['name']; if (!name) { return null; } var filePath; if (_module2) { filePath = self.resolveModule(_module2, sourceSymbol.filePath); if (!filePath) { return { __symbolic: 'error', message: "Could not resolve ".concat(_module2, " relative to ").concat(self.host.getMetadataFor(sourceSymbol.filePath), "."), line: map['line'], character: map['character'], fileName: getOriginalName() }; } return { __symbolic: 'resolved', symbol: self.getStaticSymbol(filePath, name), line: map['line'], character: map['character'], fileName: getOriginalName() }; } else if (functionParams.indexOf(name) >= 0) { // reference to a function parameter return { __symbolic: 'reference', name: name }; } else { if (topLevelSymbolNames.has(name)) { return self.getStaticSymbol(topLevelPath, name); } // ambient value null; } } else if (symbolic === 'error') { return Object.assign({}, map, { fileName: getOriginalName() }); } else { return _get(_getPrototypeOf(ReferenceTransformer.prototype), "visitStringMap", this).call(this, map, functionParams); } } }]); return ReferenceTransformer; }(ValueTransformer); var transformedMeta = visitValue(metadata, new ReferenceTransformer(), []); var unwrappedTransformedMeta = unwrapResolvedMetadata(transformedMeta); if (unwrappedTransformedMeta instanceof StaticSymbol) { return this.createExport(sourceSymbol, unwrappedTransformedMeta); } return new ResolvedStaticSymbol(sourceSymbol, transformedMeta); } }, { key: "createExport", value: function createExport(sourceSymbol, targetSymbol) { sourceSymbol.assertNoMembers(); targetSymbol.assertNoMembers(); if (this.summaryResolver.isLibraryFile(sourceSymbol.filePath) && this.summaryResolver.isLibraryFile(targetSymbol.filePath)) { // This case is for an ng library importing symbols from a plain ts library // transitively. // Note: We rely on the fact that we discover symbols in the direction // from source files to library files this.importAs.set(targetSymbol, this.getImportAs(sourceSymbol) || sourceSymbol); } return new ResolvedStaticSymbol(sourceSymbol, targetSymbol); } }, { key: "reportError", value: function reportError(error, context, path) { if (this.errorRecorder) { this.errorRecorder(error, context && context.filePath || path); } else { throw error; } } /** * @param module an absolute path to a module file. */ }, { key: "getModuleMetadata", value: function getModuleMetadata(module) { var moduleMetadata = this.metadataCache.get(module); if (!moduleMetadata) { var moduleMetadatas = this.host.getMetadataFor(module); if (moduleMetadatas) { var maxVersion = -1; moduleMetadatas.forEach(function (md) { if (md && md['version'] > maxVersion) { maxVersion = md['version']; moduleMetadata = md; } }); } if (!moduleMetadata) { moduleMetadata = { __symbolic: 'module', version: SUPPORTED_SCHEMA_VERSION, module: module, metadata: {} }; } if (moduleMetadata['version'] != SUPPORTED_SCHEMA_VERSION) { var errorMessage = moduleMetadata['version'] == 2 ? "Unsupported metadata version ".concat(moduleMetadata['version'], " for module ").concat(module, ". This module should be compiled with a newer version of ngc") : "Metadata version mismatch for module ".concat(this.host.getOutputName(module), ", found version ").concat(moduleMetadata['version'], ", expected ").concat(SUPPORTED_SCHEMA_VERSION); this.reportError(new Error(errorMessage)); } this.metadataCache.set(module, moduleMetadata); } return moduleMetadata; } }, { key: "getSymbolByModule", value: function getSymbolByModule(module, symbolName, containingFile) { var filePath = this.resolveModule(module, containingFile); if (!filePath) { this.reportError(new Error("Could not resolve module ".concat(module).concat(containingFile ? ' relative to ' + this.host.getOutputName(containingFile) : ''))); return this.getStaticSymbol("ERROR:".concat(module), symbolName); } return this.getStaticSymbol(filePath, symbolName); } }, { key: "resolveModule", value: function resolveModule(module, containingFile) { try { return this.host.moduleNameToFileName(module, containingFile); } catch (e) { console.error("Could not resolve module '".concat(module, "' relative to file ").concat(containingFile)); this.reportError(e, undefined, containingFile); } return null; } }]); return StaticSymbolResolver; }(); // Remove extra underscore from escaped identifier. // See https://github.com/Microsoft/TypeScript/blob/master/src/compiler/utilities.ts function unescapeIdentifier(identifier) { return identifier.startsWith('___') ? identifier.substr(1) : identifier; } function unwrapResolvedMetadata(metadata) { if (metadata && metadata.__symbolic === 'resolved') { return metadata.symbol; } return metadata; } /** * @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 */ function serializeSummaries(srcFileName, forJitCtx, summaryResolver, symbolResolver, symbols, types) { var createExternalSymbolReexports = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false; var toJsonSerializer = new ToJsonSerializer(symbolResolver, summaryResolver, srcFileName); // for symbols, we use everything except for the class metadata itself // (we keep the statics though), as the class metadata is contained in the // CompileTypeSummary. symbols.forEach(function (resolvedSymbol) { return toJsonSerializer.addSummary({ symbol: resolvedSymbol.symbol, metadata: resolvedSymbol.metadata }); }); // Add type summaries. types.forEach(function (_ref56) { var summary = _ref56.summary, metadata = _ref56.metadata; toJsonSerializer.addSummary({ symbol: summary.type.reference, metadata: undefined, type: summary }); }); var _toJsonSerializer$ser = toJsonSerializer.serialize(createExternalSymbolReexports), json = _toJsonSerializer$ser.json, exportAs = _toJsonSerializer$ser.exportAs; if (forJitCtx) { var forJitSerializer = new ForJitSerializer(forJitCtx, symbolResolver, summaryResolver); types.forEach(function (_ref57) { var summary = _ref57.summary, metadata = _ref57.metadata; forJitSerializer.addSourceType(summary, metadata); }); toJsonSerializer.unprocessedSymbolSummariesBySymbol.forEach(function (summary) { if (summaryResolver.isLibraryFile(summary.symbol.filePath) && summary.type) { forJitSerializer.addLibType(summary.type); } }); forJitSerializer.serialize(exportAs); } return { json: json, exportAs: exportAs }; } function deserializeSummaries(symbolCache, summaryResolver, libraryFileName, json) { var deserializer = new FromJsonDeserializer(symbolCache, summaryResolver); return deserializer.deserialize(libraryFileName, json); } function createForJitStub(outputCtx, reference) { return createSummaryForJitFunction(outputCtx, reference, NULL_EXPR); } function createSummaryForJitFunction(outputCtx, reference, value) { var fnName = summaryForJitName(reference.name); outputCtx.statements.push(fn([], [new ReturnStatement(value)], new ArrayType(DYNAMIC_TYPE)).toDeclStmt(fnName, [StmtModifier.Final, StmtModifier.Exported])); } var ToJsonSerializer = /*#__PURE__*/function (_ValueTransformer3) { _inherits(ToJsonSerializer, _ValueTransformer3); var _super103 = _createSuper(ToJsonSerializer); function ToJsonSerializer(symbolResolver, summaryResolver, srcFileName) { var _this267; _classCallCheck(this, ToJsonSerializer); _this267 = _super103.call(this); _this267.symbolResolver = symbolResolver; _this267.summaryResolver = summaryResolver; _this267.srcFileName = srcFileName; // Note: This only contains symbols without members. _this267.symbols = []; _this267.indexBySymbol = new Map(); _this267.reexportedBy = new Map(); // This now contains a `__symbol: number` in the place of // StaticSymbols, but otherwise has the same shape as the original objects. _this267.processedSummaryBySymbol = new Map(); _this267.processedSummaries = []; _this267.unprocessedSymbolSummariesBySymbol = new Map(); _this267.moduleName = symbolResolver.getKnownModuleName(srcFileName); return _this267; } _createClass2(ToJsonSerializer, [{ key: "addSummary", value: function addSummary(summary) { var _this268 = this; var unprocessedSummary = this.unprocessedSymbolSummariesBySymbol.get(summary.symbol); var processedSummary = this.processedSummaryBySymbol.get(summary.symbol); if (!unprocessedSummary) { unprocessedSummary = { symbol: summary.symbol, metadata: undefined }; this.unprocessedSymbolSummariesBySymbol.set(summary.symbol, unprocessedSummary); processedSummary = { symbol: this.processValue(summary.symbol, 0 /* None */ ) }; this.processedSummaries.push(processedSummary); this.processedSummaryBySymbol.set(summary.symbol, processedSummary); } if (!unprocessedSummary.metadata && summary.metadata) { var metadata = summary.metadata || {}; if (metadata.__symbolic === 'class') { // For classes, we keep everything except their class decorators. // We need to keep e.g. the ctor args, method names, method decorators // so that the class can be extended in another compilation unit. // We don't keep the class decorators as // 1) they refer to data // that should not cause a rebuild of downstream compilation units // (e.g. inline templates of @Component, or @NgModule.declarations) // 2) their data is already captured in TypeSummaries, e.g. DirectiveSummary. var clone = {}; Object.keys(metadata).forEach(function (propName) { if (propName !== 'decorators') { clone[propName] = metadata[propName]; } }); metadata = clone; } else if (isCall(metadata)) { if (!isFunctionCall(metadata) && !isMethodCallOnVariable(metadata)) { // Don't store complex calls as we won't be able to simplify them anyways later on. metadata = { __symbolic: 'error', message: 'Complex function calls are not supported.' }; } } // Note: We need to keep storing ctor calls for e.g. // `export const x = new InjectionToken(...)` unprocessedSummary.metadata = metadata; processedSummary.metadata = this.processValue(metadata, 1 /* ResolveValue */ ); if (metadata instanceof StaticSymbol && this.summaryResolver.isLibraryFile(metadata.filePath)) { var declarationSymbol = this.symbols[this.indexBySymbol.get(metadata)]; if (!isLoweredSymbol(declarationSymbol.name)) { // Note: symbols that were introduced during codegen in the user file can have a reexport // if a user used `export *`. However, we can't rely on this as tsickle will change // `export *` into named exports, using only the information from the typechecker. // As we introduce the new symbols after typecheck, Tsickle does not know about them, // and omits them when expanding `export *`. // So we have to keep reexporting these symbols manually via .ngfactory files. this.reexportedBy.set(declarationSymbol, summary.symbol); } } } if (!unprocessedSummary.type && summary.type) { unprocessedSummary.type = summary.type; // Note: We don't add the summaries of all referenced symbols as for the ResolvedSymbols, // as the type summaries already contain the transitive data that they require // (in a minimal way). processedSummary.type = this.processValue(summary.type, 0 /* None */ ); // except for reexported directives / pipes, so we need to store // their summaries explicitly. if (summary.type.summaryKind === CompileSummaryKind.NgModule) { var ngModuleSummary = summary.type; ngModuleSummary.exportedDirectives.concat(ngModuleSummary.exportedPipes).forEach(function (id) { var symbol = id.reference; if (_this268.summaryResolver.isLibraryFile(symbol.filePath) && !_this268.unprocessedSymbolSummariesBySymbol.has(symbol)) { var _summary = _this268.summaryResolver.resolveSummary(symbol); if (_summary) { _this268.addSummary(_summary); } } }); } } } /** * @param createExternalSymbolReexports Whether external static symbols should be re-exported. * This can be enabled if external symbols should be re-exported by the current module in * order to avoid dynamically generated module dependencies which can break strict dependency * enforcements (as in Google3). Read more here: https://github.com/angular/angular/issues/25644 */ }, { key: "serialize", value: function serialize(createExternalSymbolReexports) { var _this269 = this; var exportAs = []; var json = JSON.stringify({ moduleName: this.moduleName, summaries: this.processedSummaries, symbols: this.symbols.map(function (symbol, index) { symbol.assertNoMembers(); var importAs = undefined; if (_this269.summaryResolver.isLibraryFile(symbol.filePath)) { var reexportSymbol = _this269.reexportedBy.get(symbol); if (reexportSymbol) { // In case the given external static symbol is already manually exported by the // user, we just proxy the external static symbol reference to the manual export. // This ensures that the AOT compiler imports the external symbol through the // user export and does not introduce another dependency which is not needed. importAs = _this269.indexBySymbol.get(reexportSymbol); } else if (createExternalSymbolReexports) { // In this case, the given external static symbol is *not* manually exported by // the user, and we manually create a re-export in the factory file so that we // don't introduce another module dependency. This is useful when running within // Bazel so that the AOT compiler does not introduce any module dependencies // which can break the strict dependency enforcement. (e.g. as in Google3) // Read more about this here: https://github.com/angular/angular/issues/25644 var summary = _this269.unprocessedSymbolSummariesBySymbol.get(symbol); if (!summary || !summary.metadata || summary.metadata.__symbolic !== 'interface') { importAs = "".concat(symbol.name, "_").concat(index); exportAs.push({ symbol: symbol, exportAs: importAs }); } } } return { __symbol: index, name: symbol.name, filePath: _this269.summaryResolver.toSummaryFileName(symbol.filePath, _this269.srcFileName), importAs: importAs }; }) }); return { json: json, exportAs: exportAs }; } }, { key: "processValue", value: function processValue(value, flags) { return visitValue(value, this, flags); } }, { key: "visitOther", value: function visitOther(value, context) { if (value instanceof StaticSymbol) { var baseSymbol = this.symbolResolver.getStaticSymbol(value.filePath, value.name); var index = this.visitStaticSymbol(baseSymbol, context); return { __symbol: index, members: value.members }; } } /** * Strip line and character numbers from ngsummaries. * Emitting them causes white spaces changes to retrigger upstream * recompilations in bazel. * TODO: find out a way to have line and character numbers in errors without * excessive recompilation in bazel. */ }, { key: "visitStringMap", value: function visitStringMap(map, context) { if (map['__symbolic'] === 'resolved') { return visitValue(map['symbol'], this, context); } if (map['__symbolic'] === 'error') { delete map['line']; delete map['character']; } return _get(_getPrototypeOf(ToJsonSerializer.prototype), "visitStringMap", this).call(this, map, context); } /** * Returns null if the options.resolveValue is true, and the summary for the symbol * resolved to a type or could not be resolved. */ }, { key: "visitStaticSymbol", value: function visitStaticSymbol(baseSymbol, flags) { var index = this.indexBySymbol.get(baseSymbol); var summary = null; if (flags & 1 /* ResolveValue */ && this.summaryResolver.isLibraryFile(baseSymbol.filePath)) { if (this.unprocessedSymbolSummariesBySymbol.has(baseSymbol)) { // the summary for this symbol was already added // -> nothing to do. return index; } summary = this.loadSummary(baseSymbol); if (summary && summary.metadata instanceof StaticSymbol) { // The summary is a reexport index = this.visitStaticSymbol(summary.metadata, flags); // reset the summary as it is just a reexport, so we don't want to store it. summary = null; } } else if (index != null) { // Note: == on purpose to compare with undefined! // No summary and the symbol is already added -> nothing to do. return index; } // Note: == on purpose to compare with undefined! if (index == null) { index = this.symbols.length; this.symbols.push(baseSymbol); } this.indexBySymbol.set(baseSymbol, index); if (summary) { this.addSummary(summary); } return index; } }, { key: "loadSummary", value: function loadSummary(symbol) { var summary = this.summaryResolver.resolveSummary(symbol); if (!summary) { // some symbols might originate from a plain typescript library // that just exported .d.ts and .metadata.json files, i.e. where no summary // files were created. var resolvedSymbol = this.symbolResolver.resolveSymbol(symbol); if (resolvedSymbol) { summary = { symbol: resolvedSymbol.symbol, metadata: resolvedSymbol.metadata }; } } return summary; } }]); return ToJsonSerializer; }(ValueTransformer); var ForJitSerializer = /*#__PURE__*/function () { function ForJitSerializer(outputCtx, symbolResolver, summaryResolver) { _classCallCheck(this, ForJitSerializer); this.outputCtx = outputCtx; this.symbolResolver = symbolResolver; this.summaryResolver = summaryResolver; this.data = []; } _createClass2(ForJitSerializer, [{ key: "addSourceType", value: function addSourceType(summary, metadata) { this.data.push({ summary: summary, metadata: metadata, isLibrary: false }); } }, { key: "addLibType", value: function addLibType(summary) { this.data.push({ summary: summary, metadata: null, isLibrary: true }); } }, { key: "serialize", value: function serialize(exportAsArr) { var _this270 = this; var exportAsBySymbol = new Map(); var _iterator25 = _createForOfIteratorHelper(exportAsArr), _step25; try { for (_iterator25.s(); !(_step25 = _iterator25.n()).done;) { var _step25$value = _step25.value, symbol = _step25$value.symbol, exportAs = _step25$value.exportAs; exportAsBySymbol.set(symbol, exportAs); } } catch (err) { _iterator25.e(err); } finally { _iterator25.f(); } var ngModuleSymbols = new Set(); var _iterator26 = _createForOfIteratorHelper(this.data), _step26; try { for (_iterator26.s(); !(_step26 = _iterator26.n()).done;) { var _step26$value = _step26.value, summary = _step26$value.summary, metadata = _step26$value.metadata, isLibrary = _step26$value.isLibrary; if (summary.summaryKind === CompileSummaryKind.NgModule) { // collect the symbols that refer to NgModule classes. // Note: we can't just rely on `summary.type.summaryKind` to determine this as // we don't add the summaries of all referenced symbols when we serialize type summaries. // See serializeSummaries for details. ngModuleSymbols.add(summary.type.reference); var modSummary = summary; var _iterator27 = _createForOfIteratorHelper(modSummary.modules), _step27; try { for (_iterator27.s(); !(_step27 = _iterator27.n()).done;) { var mod = _step27.value; ngModuleSymbols.add(mod.reference); } } catch (err) { _iterator27.e(err); } finally { _iterator27.f(); } } if (!isLibrary) { var fnName = summaryForJitName(summary.type.reference.name); createSummaryForJitFunction(this.outputCtx, summary.type.reference, this.serializeSummaryWithDeps(summary, metadata)); } } } catch (err) { _iterator26.e(err); } finally { _iterator26.f(); } ngModuleSymbols.forEach(function (ngModuleSymbol) { if (_this270.summaryResolver.isLibraryFile(ngModuleSymbol.filePath)) { var exportAs = exportAsBySymbol.get(ngModuleSymbol) || ngModuleSymbol.name; var jitExportAsName = summaryForJitName(exportAs); _this270.outputCtx.statements.push(variable(jitExportAsName).set(_this270.serializeSummaryRef(ngModuleSymbol)).toDeclStmt(null, [StmtModifier.Exported])); } }); } }, { key: "serializeSummaryWithDeps", value: function serializeSummaryWithDeps(summary, metadata) { var _this271 = this; var expressions = [this.serializeSummary(summary)]; var providers = []; if (metadata instanceof CompileNgModuleMetadata) { expressions.push.apply(expressions, _toConsumableArray( // For directives / pipes, we only add the declared ones, // and rely on transitively importing NgModules to get the transitive // summaries. metadata.declaredDirectives.concat(metadata.declaredPipes).map(function (type) { return type.reference; }) // For modules, // we also add the summaries for modules // from libraries. // This is ok as we produce reexports for all transitive modules. .concat(metadata.transitiveModule.modules.map(function (type) { return type.reference; }).filter(function (ref) { return ref !== metadata.type.reference; })).map(function (ref) { return _this271.serializeSummaryRef(ref); }))); // Note: We don't use `NgModuleSummary.providers`, as that one is transitive, // and we already have transitive modules. providers = metadata.providers; } else if (summary.summaryKind === CompileSummaryKind.Directive) { var dirSummary = summary; providers = dirSummary.providers.concat(dirSummary.viewProviders); } // Note: We can't just refer to the `ngsummary.ts` files for `useClass` providers (as we do for // declaredDirectives / declaredPipes), as we allow // providers without ctor arguments to skip the `@Injectable` decorator, // i.e. we didn't generate .ngsummary.ts files for these. expressions.push.apply(expressions, _toConsumableArray(providers.filter(function (provider) { return !!provider.useClass; }).map(function (provider) { return _this271.serializeSummary({ summaryKind: CompileSummaryKind.Injectable, type: provider.useClass }); }))); return literalArr(expressions); } }, { key: "serializeSummaryRef", value: function serializeSummaryRef(typeSymbol) { var jitImportedSymbol = this.symbolResolver.getStaticSymbol(summaryForJitFileName(typeSymbol.filePath), summaryForJitName(typeSymbol.name)); return this.outputCtx.importExpr(jitImportedSymbol); } }, { key: "serializeSummary", value: function serializeSummary(data) { var outputCtx = this.outputCtx; var Transformer = /*#__PURE__*/function () { function Transformer() { _classCallCheck(this, Transformer); } _createClass2(Transformer, [{ key: "visitArray", value: function visitArray(arr, context) { var _this272 = this; return literalArr(arr.map(function (entry) { return visitValue(entry, _this272, context); })); } }, { key: "visitStringMap", value: function visitStringMap(map, context) { var _this273 = this; return new LiteralMapExpr(Object.keys(map).map(function (key) { return new LiteralMapEntry(key, visitValue(map[key], _this273, context), false); })); } }, { key: "visitPrimitive", value: function visitPrimitive(value, context) { return literal(value); } }, { key: "visitOther", value: function visitOther(value, context) { if (value instanceof StaticSymbol) { return outputCtx.importExpr(value); } else { throw new Error("Illegal State: Encountered value ".concat(value)); } } }]); return Transformer; }(); return visitValue(data, new Transformer(), null); } }]); return ForJitSerializer; }(); var FromJsonDeserializer = /*#__PURE__*/function (_ValueTransformer4) { _inherits(FromJsonDeserializer, _ValueTransformer4); var _super104 = _createSuper(FromJsonDeserializer); function FromJsonDeserializer(symbolCache, summaryResolver) { var _this274; _classCallCheck(this, FromJsonDeserializer); _this274 = _super104.call(this); _this274.symbolCache = symbolCache; _this274.summaryResolver = summaryResolver; return _this274; } _createClass2(FromJsonDeserializer, [{ key: "deserialize", value: function deserialize(libraryFileName, json) { var _this275 = this; var data = JSON.parse(json); var allImportAs = []; this.symbols = data.symbols.map(function (serializedSymbol) { return _this275.symbolCache.get(_this275.summaryResolver.fromSummaryFileName(serializedSymbol.filePath, libraryFileName), serializedSymbol.name); }); data.symbols.forEach(function (serializedSymbol, index) { var symbol = _this275.symbols[index]; var importAs = serializedSymbol.importAs; if (typeof importAs === 'number') { allImportAs.push({ symbol: symbol, importAs: _this275.symbols[importAs] }); } else if (typeof importAs === 'string') { allImportAs.push({ symbol: symbol, importAs: _this275.symbolCache.get(ngfactoryFilePath(libraryFileName), importAs) }); } }); var summaries = visitValue(data.summaries, this, null); return { moduleName: data.moduleName, summaries: summaries, importAs: allImportAs }; } }, { key: "visitStringMap", value: function visitStringMap(map, context) { if ('__symbol' in map) { var baseSymbol = this.symbols[map['__symbol']]; var members = map['members']; return members.length ? this.symbolCache.get(baseSymbol.filePath, baseSymbol.name, members) : baseSymbol; } else { return _get(_getPrototypeOf(FromJsonDeserializer.prototype), "visitStringMap", this).call(this, map, context); } } }]); return FromJsonDeserializer; }(ValueTransformer); function isCall(metadata) { return metadata && metadata.__symbolic === 'call'; } function isFunctionCall(metadata) { return isCall(metadata) && unwrapResolvedMetadata(metadata.expression) instanceof StaticSymbol; } function isMethodCallOnVariable(metadata) { return isCall(metadata) && metadata.expression && metadata.expression.__symbolic === 'select' && unwrapResolvedMetadata(metadata.expression.expression) instanceof StaticSymbol; } /** * @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 AotCompiler = /*#__PURE__*/function () { function AotCompiler(_config, _options, _host, reflector, _metadataResolver, _templateParser, _styleCompiler, _viewCompiler, _typeCheckCompiler, _ngModuleCompiler, _injectableCompiler, _outputEmitter, _summaryResolver, _symbolResolver) { _classCallCheck(this, AotCompiler); this._config = _config; this._options = _options; this._host = _host; this.reflector = reflector; this._metadataResolver = _metadataResolver; this._templateParser = _templateParser; this._styleCompiler = _styleCompiler; this._viewCompiler = _viewCompiler; this._typeCheckCompiler = _typeCheckCompiler; this._ngModuleCompiler = _ngModuleCompiler; this._injectableCompiler = _injectableCompiler; this._outputEmitter = _outputEmitter; this._summaryResolver = _summaryResolver; this._symbolResolver = _symbolResolver; this._templateAstCache = new Map(); this._analyzedFiles = new Map(); this._analyzedFilesForInjectables = new Map(); } _createClass2(AotCompiler, [{ key: "clearCache", value: function clearCache() { this._metadataResolver.clearCache(); } }, { key: "analyzeModulesSync", value: function analyzeModulesSync(rootFiles) { var _this276 = this; var analyzeResult = analyzeAndValidateNgModules(rootFiles, this._host, this._symbolResolver, this._metadataResolver); analyzeResult.ngModules.forEach(function (ngModule) { return _this276._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, true); }); return analyzeResult; } }, { key: "analyzeModulesAsync", value: function analyzeModulesAsync(rootFiles) { var _this277 = this; var analyzeResult = analyzeAndValidateNgModules(rootFiles, this._host, this._symbolResolver, this._metadataResolver); return Promise.all(analyzeResult.ngModules.map(function (ngModule) { return _this277._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false); })).then(function () { return analyzeResult; }); } }, { key: "_analyzeFile", value: function _analyzeFile(fileName) { var analyzedFile = this._analyzedFiles.get(fileName); if (!analyzedFile) { analyzedFile = analyzeFile(this._host, this._symbolResolver, this._metadataResolver, fileName); this._analyzedFiles.set(fileName, analyzedFile); } return analyzedFile; } }, { key: "_analyzeFileForInjectables", value: function _analyzeFileForInjectables(fileName) { var analyzedFile = this._analyzedFilesForInjectables.get(fileName); if (!analyzedFile) { analyzedFile = analyzeFileForInjectables(this._host, this._symbolResolver, this._metadataResolver, fileName); this._analyzedFilesForInjectables.set(fileName, analyzedFile); } return analyzedFile; } }, { key: "findGeneratedFileNames", value: function findGeneratedFileNames(fileName) { var _this278 = this; var genFileNames = []; var file = this._analyzeFile(fileName); // Make sure we create a .ngfactory if we have a injectable/directive/pipe/NgModule // or a reference to a non source file. // Note: This is overestimating the required .ngfactory files as the real calculation is harder. // Only do this for StubEmitFlags.Basic, as adding a type check block // does not change this file (as we generate type check blocks based on NgModules). if (this._options.allowEmptyCodegenFiles || file.directives.length || file.pipes.length || file.injectables.length || file.ngModules.length || file.exportsNonSourceFiles) { genFileNames.push(ngfactoryFilePath(file.fileName, true)); if (this._options.enableSummariesForJit) { genFileNames.push(summaryForJitFileName(file.fileName, true)); } } var fileSuffix = normalizeGenFileSuffix(splitTypescriptSuffix(file.fileName, true)[1]); file.directives.forEach(function (dirSymbol) { var compMeta = _this278._metadataResolver.getNonNormalizedDirectiveMetadata(dirSymbol).metadata; if (!compMeta.isComponent) { return; } // Note: compMeta is a component and therefore template is non null. compMeta.template.styleUrls.forEach(function (styleUrl) { var normalizedUrl = _this278._host.resourceNameToFileName(styleUrl, file.fileName); if (!normalizedUrl) { throw syntaxError("Couldn't resolve resource ".concat(styleUrl, " relative to ").concat(file.fileName)); } var needsShim = (compMeta.template.encapsulation || _this278._config.defaultEncapsulation) === ViewEncapsulation.Emulated; genFileNames.push(_stylesModuleUrl(normalizedUrl, needsShim, fileSuffix)); if (_this278._options.allowEmptyCodegenFiles) { genFileNames.push(_stylesModuleUrl(normalizedUrl, !needsShim, fileSuffix)); } }); }); return genFileNames; } }, { key: "emitBasicStub", value: function emitBasicStub(genFileName, originalFileName) { var outputCtx = this._createOutputContext(genFileName); if (genFileName.endsWith('.ngfactory.ts')) { if (!originalFileName) { throw new Error("Assertion error: require the original file for .ngfactory.ts stubs. File: ".concat(genFileName)); } var originalFile = this._analyzeFile(originalFileName); this._createNgFactoryStub(outputCtx, originalFile, 1 /* Basic */ ); } else if (genFileName.endsWith('.ngsummary.ts')) { if (this._options.enableSummariesForJit) { if (!originalFileName) { throw new Error("Assertion error: require the original file for .ngsummary.ts stubs. File: ".concat(genFileName)); } var _originalFile = this._analyzeFile(originalFileName); _createEmptyStub(outputCtx); _originalFile.ngModules.forEach(function (ngModule) { // create exports that user code can reference createForJitStub(outputCtx, ngModule.type.reference); }); } } else if (genFileName.endsWith('.ngstyle.ts')) { _createEmptyStub(outputCtx); } // Note: for the stubs, we don't need a property srcFileUrl, // as later on in emitAllImpls we will create the proper GeneratedFiles with the // correct srcFileUrl. // This is good as e.g. for .ngstyle.ts files we can't derive // the url of components based on the genFileUrl. return this._codegenSourceModule('unknown', outputCtx); } }, { key: "emitTypeCheckStub", value: function emitTypeCheckStub(genFileName, originalFileName) { var originalFile = this._analyzeFile(originalFileName); var outputCtx = this._createOutputContext(genFileName); if (genFileName.endsWith('.ngfactory.ts')) { this._createNgFactoryStub(outputCtx, originalFile, 2 /* TypeCheck */ ); } return outputCtx.statements.length > 0 ? this._codegenSourceModule(originalFile.fileName, outputCtx) : null; } }, { key: "loadFilesAsync", value: function loadFilesAsync(fileNames, tsFiles) { var _this279 = this; var files = fileNames.map(function (fileName) { return _this279._analyzeFile(fileName); }); var loadingPromises = []; files.forEach(function (file) { return file.ngModules.forEach(function (ngModule) { return loadingPromises.push(_this279._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false)); }); }); var analyzedInjectables = tsFiles.map(function (tsFile) { return _this279._analyzeFileForInjectables(tsFile); }); return Promise.all(loadingPromises).then(function (_) { return { analyzedModules: mergeAndValidateNgFiles(files), analyzedInjectables: analyzedInjectables }; }); } }, { key: "loadFilesSync", value: function loadFilesSync(fileNames, tsFiles) { var _this280 = this; var files = fileNames.map(function (fileName) { return _this280._analyzeFile(fileName); }); files.forEach(function (file) { return file.ngModules.forEach(function (ngModule) { return _this280._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, true); }); }); var analyzedInjectables = tsFiles.map(function (tsFile) { return _this280._analyzeFileForInjectables(tsFile); }); return { analyzedModules: mergeAndValidateNgFiles(files), analyzedInjectables: analyzedInjectables }; } }, { key: "_createNgFactoryStub", value: function _createNgFactoryStub(outputCtx, file, emitFlags) { var _this281 = this; var componentId = 0; file.ngModules.forEach(function (ngModuleMeta, ngModuleIndex) { // Note: the code below needs to executed for StubEmitFlags.Basic and StubEmitFlags.TypeCheck, // so we don't change the .ngfactory file too much when adding the type-check block. // create exports that user code can reference _this281._ngModuleCompiler.createStub(outputCtx, ngModuleMeta.type.reference); // add references to the symbols from the metadata. // These can be used by the type check block for components, // and they also cause TypeScript to include these files into the program too, // which will make them part of the analyzedFiles. var externalReferences = [].concat(_toConsumableArray(ngModuleMeta.transitiveModule.directives.map(function (d) { return d.reference; })), _toConsumableArray(ngModuleMeta.transitiveModule.pipes.map(function (d) { return d.reference; })), _toConsumableArray(ngModuleMeta.importedModules.map(function (m) { return m.type.reference; })), _toConsumableArray(ngModuleMeta.exportedModules.map(function (m) { return m.type.reference; })), _toConsumableArray(_this281._externalIdentifierReferences([Identifiers.TemplateRef, Identifiers.ElementRef]))); var externalReferenceVars = new Map(); externalReferences.forEach(function (ref, typeIndex) { externalReferenceVars.set(ref, "_decl".concat(ngModuleIndex, "_").concat(typeIndex)); }); externalReferenceVars.forEach(function (varName, reference) { outputCtx.statements.push(variable(varName).set(NULL_EXPR.cast(DYNAMIC_TYPE)).toDeclStmt(expressionType(outputCtx.importExpr(reference, /* typeParams */ null, /* useSummaries */ false)))); }); if (emitFlags & 2 /* TypeCheck */ ) { // add the type-check block for all components of the NgModule ngModuleMeta.declaredDirectives.forEach(function (dirId) { var compMeta = _this281._metadataResolver.getDirectiveMetadata(dirId.reference); if (!compMeta.isComponent) { return; } componentId++; _this281._createTypeCheckBlock(outputCtx, "".concat(compMeta.type.reference.name, "_Host_").concat(componentId), ngModuleMeta, _this281._metadataResolver.getHostComponentMetadata(compMeta), [compMeta.type], externalReferenceVars); _this281._createTypeCheckBlock(outputCtx, "".concat(compMeta.type.reference.name, "_").concat(componentId), ngModuleMeta, compMeta, ngModuleMeta.transitiveModule.directives, externalReferenceVars); }); } }); if (outputCtx.statements.length === 0) { _createEmptyStub(outputCtx); } } }, { key: "_externalIdentifierReferences", value: function _externalIdentifierReferences(references) { var result = []; var _iterator28 = _createForOfIteratorHelper(references), _step28; try { for (_iterator28.s(); !(_step28 = _iterator28.n()).done;) { var reference = _step28.value; var token = createTokenForExternalReference(this.reflector, reference); if (token.identifier) { result.push(token.identifier.reference); } } } catch (err) { _iterator28.e(err); } finally { _iterator28.f(); } return result; } }, { key: "_createTypeCheckBlock", value: function _createTypeCheckBlock(ctx, componentId, moduleMeta, compMeta, directives, externalReferenceVars) { var _ctx$statements; var _this$_parseTemplate = this._parseTemplate(compMeta, moduleMeta, directives), parsedTemplate = _this$_parseTemplate.template, usedPipes = _this$_parseTemplate.pipes; (_ctx$statements = ctx.statements).push.apply(_ctx$statements, _toConsumableArray(this._typeCheckCompiler.compileComponent(componentId, compMeta, parsedTemplate, usedPipes, externalReferenceVars, ctx))); } }, { key: "emitMessageBundle", value: function emitMessageBundle(analyzeResult, locale) { var _this282 = this; var errors = []; var htmlParser = new HtmlParser(); // TODO(vicb): implicit tags & attributes var messageBundle = new MessageBundle(htmlParser, [], {}, locale); analyzeResult.files.forEach(function (file) { var compMetas = []; file.directives.forEach(function (directiveType) { var dirMeta = _this282._metadataResolver.getDirectiveMetadata(directiveType); if (dirMeta && dirMeta.isComponent) { compMetas.push(dirMeta); } }); compMetas.forEach(function (compMeta) { var html = compMeta.template.template; // Template URL points to either an HTML or TS file depending on whether // the file is used with `templateUrl:` or `template:`, respectively. var templateUrl = compMeta.template.templateUrl; var interpolationConfig = InterpolationConfig.fromArray(compMeta.template.interpolation); errors.push.apply(errors, _toConsumableArray(messageBundle.updateFromTemplate(html, templateUrl, interpolationConfig))); }); }); if (errors.length) { throw new Error(errors.map(function (e) { return e.toString(); }).join('\n')); } return messageBundle; } }, { key: "emitAllPartialModules", value: function emitAllPartialModules(_ref58, r3Files) { var _this283 = this; var ngModuleByPipeOrDirective = _ref58.ngModuleByPipeOrDirective, files = _ref58.files; var contextMap = new Map(); var getContext = function getContext(fileName) { if (!contextMap.has(fileName)) { contextMap.set(fileName, _this283._createOutputContext(fileName)); } return contextMap.get(fileName); }; files.forEach(function (file) { return _this283._compilePartialModule(file.fileName, ngModuleByPipeOrDirective, file.directives, file.pipes, file.ngModules, file.injectables, getContext(file.fileName)); }); r3Files.forEach(function (file) { return _this283._compileShallowModules(file.fileName, file.shallowModules, getContext(file.fileName)); }); return Array.from(contextMap.values()).map(function (context) { return { fileName: context.genFilePath, statements: [].concat(_toConsumableArray(context.constantPool.statements), _toConsumableArray(context.statements)) }; }); } }, { key: "_compileShallowModules", value: function _compileShallowModules(fileName, shallowModules, context) { var _this284 = this; shallowModules.forEach(function (module) { return compileNgModuleFromRender2(context, module, _this284._injectableCompiler); }); } }, { key: "_compilePartialModule", value: function _compilePartialModule(fileName, ngModuleByPipeOrDirective, directives, pipes, ngModules, injectables, context) { var _this285 = this; var errors = []; var schemaRegistry = new DomElementSchemaRegistry(); var hostBindingParser = new BindingParser(this._templateParser.expressionParser, DEFAULT_INTERPOLATION_CONFIG, schemaRegistry, [], errors); // Process all components and directives directives.forEach(function (directiveType) { var directiveMetadata = _this285._metadataResolver.getDirectiveMetadata(directiveType); if (directiveMetadata.isComponent) { var _module3 = ngModuleByPipeOrDirective.get(directiveType); _module3 || error("Cannot determine the module for component '".concat(identifierName(directiveMetadata.type), "'")); var htmlAst = directiveMetadata.template.htmlAst; var preserveWhitespaces = directiveMetadata.template.preserveWhitespaces; if (!preserveWhitespaces) { htmlAst = removeWhitespaces(htmlAst); } var render3Ast = htmlAstToRender3Ast(htmlAst.rootNodes, hostBindingParser); // Map of StaticType by directive selectors var directiveTypeBySel = new Map(); var _directives = _module3.transitiveModule.directives.map(function (dir) { return _this285._metadataResolver.getDirectiveSummary(dir.reference); }); _directives.forEach(function (directive) { if (directive.selector) { directiveTypeBySel.set(directive.selector, directive.type.reference); } }); // Map of StaticType by pipe names var pipeTypeByName = new Map(); var _pipes = _module3.transitiveModule.pipes.map(function (pipe) { return _this285._metadataResolver.getPipeSummary(pipe.reference); }); _pipes.forEach(function (pipe) { pipeTypeByName.set(pipe.name, pipe.type.reference); }); compileComponentFromRender2(context, directiveMetadata, render3Ast, _this285.reflector, hostBindingParser, directiveTypeBySel, pipeTypeByName); } else { compileDirectiveFromRender2(context, directiveMetadata, _this285.reflector, hostBindingParser); } }); pipes.forEach(function (pipeType) { var pipeMetadata = _this285._metadataResolver.getPipeMetadata(pipeType); if (pipeMetadata) { compilePipeFromRender2(context, pipeMetadata, _this285.reflector); } }); injectables.forEach(function (injectable) { return _this285._injectableCompiler.compile(injectable, context); }); } }, { key: "emitAllPartialModules2", value: function emitAllPartialModules2(files) { var _this286 = this; // Using reduce like this is a select many pattern (where map is a select pattern) return files.reduce(function (r, file) { r.push.apply(r, _toConsumableArray(_this286._emitPartialModule2(file.fileName, file.injectables))); return r; }, []); } }, { key: "_emitPartialModule2", value: function _emitPartialModule2(fileName, injectables) { var _this287 = this; var context = this._createOutputContext(fileName); injectables.forEach(function (injectable) { return _this287._injectableCompiler.compile(injectable, context); }); if (context.statements && context.statements.length > 0) { return [{ fileName: fileName, statements: [].concat(_toConsumableArray(context.constantPool.statements), _toConsumableArray(context.statements)) }]; } return []; } }, { key: "emitAllImpls", value: function emitAllImpls(analyzeResult) { var _this288 = this; var ngModuleByPipeOrDirective = analyzeResult.ngModuleByPipeOrDirective, files = analyzeResult.files; var sourceModules = files.map(function (file) { return _this288._compileImplFile(file.fileName, ngModuleByPipeOrDirective, file.directives, file.pipes, file.ngModules, file.injectables); }); return flatten(sourceModules); } }, { key: "_compileImplFile", value: function _compileImplFile(srcFileUrl, ngModuleByPipeOrDirective, directives, pipes, ngModules, injectables) { var _this289 = this; var fileSuffix = normalizeGenFileSuffix(splitTypescriptSuffix(srcFileUrl, true)[1]); var generatedFiles = []; var outputCtx = this._createOutputContext(ngfactoryFilePath(srcFileUrl, true)); generatedFiles.push.apply(generatedFiles, _toConsumableArray(this._createSummary(srcFileUrl, directives, pipes, ngModules, injectables, outputCtx))); // compile all ng modules ngModules.forEach(function (ngModuleMeta) { return _this289._compileModule(outputCtx, ngModuleMeta); }); // compile components directives.forEach(function (dirType) { var compMeta = _this289._metadataResolver.getDirectiveMetadata(dirType); if (!compMeta.isComponent) { return; } var ngModule = ngModuleByPipeOrDirective.get(dirType); if (!ngModule) { throw new Error("Internal Error: cannot determine the module for component ".concat(identifierName(compMeta.type), "!")); } // compile styles var componentStylesheet = _this289._styleCompiler.compileComponent(outputCtx, compMeta); // Note: compMeta is a component and therefore template is non null. compMeta.template.externalStylesheets.forEach(function (stylesheetMeta) { // Note: fill non shim and shim style files as they might // be shared by component with and without ViewEncapsulation. var shim = _this289._styleCompiler.needsStyleShim(compMeta); generatedFiles.push(_this289._codegenStyles(srcFileUrl, compMeta, stylesheetMeta, shim, fileSuffix)); if (_this289._options.allowEmptyCodegenFiles) { generatedFiles.push(_this289._codegenStyles(srcFileUrl, compMeta, stylesheetMeta, !shim, fileSuffix)); } }); // compile components var compViewVars = _this289._compileComponent(outputCtx, compMeta, ngModule, ngModule.transitiveModule.directives, componentStylesheet, fileSuffix); _this289._compileComponentFactory(outputCtx, compMeta, ngModule, fileSuffix); }); if (outputCtx.statements.length > 0 || this._options.allowEmptyCodegenFiles) { var srcModule = this._codegenSourceModule(srcFileUrl, outputCtx); generatedFiles.unshift(srcModule); } return generatedFiles; } }, { key: "_createSummary", value: function _createSummary(srcFileName, directives, pipes, ngModules, injectables, ngFactoryCtx) { var _this290 = this; var symbolSummaries = this._symbolResolver.getSymbolsOf(srcFileName).map(function (symbol) { return _this290._symbolResolver.resolveSymbol(symbol); }); var typeData = [].concat(_toConsumableArray(ngModules.map(function (meta) { return { summary: _this290._metadataResolver.getNgModuleSummary(meta.type.reference), metadata: _this290._metadataResolver.getNgModuleMetadata(meta.type.reference) }; })), _toConsumableArray(directives.map(function (ref) { return { summary: _this290._metadataResolver.getDirectiveSummary(ref), metadata: _this290._metadataResolver.getDirectiveMetadata(ref) }; })), _toConsumableArray(pipes.map(function (ref) { return { summary: _this290._metadataResolver.getPipeSummary(ref), metadata: _this290._metadataResolver.getPipeMetadata(ref) }; })), _toConsumableArray(injectables.map(function (ref) { return { summary: _this290._metadataResolver.getInjectableSummary(ref.symbol), metadata: _this290._metadataResolver.getInjectableSummary(ref.symbol).type }; }))); var forJitOutputCtx = this._options.enableSummariesForJit ? this._createOutputContext(summaryForJitFileName(srcFileName, true)) : null; var _serializeSummaries = serializeSummaries(srcFileName, forJitOutputCtx, this._summaryResolver, this._symbolResolver, symbolSummaries, typeData, this._options.createExternalSymbolFactoryReexports), json = _serializeSummaries.json, exportAs = _serializeSummaries.exportAs; exportAs.forEach(function (entry) { ngFactoryCtx.statements.push(variable(entry.exportAs).set(ngFactoryCtx.importExpr(entry.symbol)).toDeclStmt(null, [StmtModifier.Exported])); }); var summaryJson = new GeneratedFile(srcFileName, summaryFileName(srcFileName), json); var result = [summaryJson]; if (forJitOutputCtx) { result.push(this._codegenSourceModule(srcFileName, forJitOutputCtx)); } return result; } }, { key: "_compileModule", value: function _compileModule(outputCtx, ngModule) { var providers = []; if (this._options.locale) { var normalizedLocale = this._options.locale.replace(/_/g, '-'); providers.push({ token: createTokenForExternalReference(this.reflector, Identifiers.LOCALE_ID), useValue: normalizedLocale }); } if (this._options.i18nFormat) { providers.push({ token: createTokenForExternalReference(this.reflector, Identifiers.TRANSLATIONS_FORMAT), useValue: this._options.i18nFormat }); } this._ngModuleCompiler.compile(outputCtx, ngModule, providers); } }, { key: "_compileComponentFactory", value: function _compileComponentFactory(outputCtx, compMeta, ngModule, fileSuffix) { var hostMeta = this._metadataResolver.getHostComponentMetadata(compMeta); var hostViewFactoryVar = this._compileComponent(outputCtx, hostMeta, ngModule, [compMeta.type], null, fileSuffix).viewClassVar; var compFactoryVar = componentFactoryName(compMeta.type.reference); var inputsExprs = []; for (var propName in compMeta.inputs) { var templateName = compMeta.inputs[propName]; // Don't quote so that the key gets minified... inputsExprs.push(new LiteralMapEntry(propName, literal(templateName), false)); } var outputsExprs = []; for (var _propName in compMeta.outputs) { var _templateName = compMeta.outputs[_propName]; // Don't quote so that the key gets minified... outputsExprs.push(new LiteralMapEntry(_propName, literal(_templateName), false)); } outputCtx.statements.push(variable(compFactoryVar).set(importExpr(Identifiers.createComponentFactory).callFn([literal(compMeta.selector), outputCtx.importExpr(compMeta.type.reference), variable(hostViewFactoryVar), new LiteralMapExpr(inputsExprs), new LiteralMapExpr(outputsExprs), literalArr(compMeta.template.ngContentSelectors.map(function (selector) { return literal(selector); }))])).toDeclStmt(importType(Identifiers.ComponentFactory, [expressionType(outputCtx.importExpr(compMeta.type.reference))], [TypeModifier.Const]), [StmtModifier.Final, StmtModifier.Exported])); } }, { key: "_compileComponent", value: function _compileComponent(outputCtx, compMeta, ngModule, directiveIdentifiers, componentStyles, fileSuffix) { var _this$_parseTemplate2 = this._parseTemplate(compMeta, ngModule, directiveIdentifiers), parsedTemplate = _this$_parseTemplate2.template, usedPipes = _this$_parseTemplate2.pipes; var stylesExpr = componentStyles ? variable(componentStyles.stylesVar) : literalArr([]); var viewResult = this._viewCompiler.compileComponent(outputCtx, compMeta, parsedTemplate, stylesExpr, usedPipes); if (componentStyles) { _resolveStyleStatements(this._symbolResolver, componentStyles, this._styleCompiler.needsStyleShim(compMeta), fileSuffix); } return viewResult; } }, { key: "_parseTemplate", value: function _parseTemplate(compMeta, ngModule, directiveIdentifiers) { var _this291 = this; if (this._templateAstCache.has(compMeta.type.reference)) { return this._templateAstCache.get(compMeta.type.reference); } var preserveWhitespaces = compMeta.template.preserveWhitespaces; var directives = directiveIdentifiers.map(function (dir) { return _this291._metadataResolver.getDirectiveSummary(dir.reference); }); var pipes = ngModule.transitiveModule.pipes.map(function (pipe) { return _this291._metadataResolver.getPipeSummary(pipe.reference); }); var result = this._templateParser.parse(compMeta, compMeta.template.htmlAst, directives, pipes, ngModule.schemas, templateSourceUrl(ngModule.type, compMeta, compMeta.template), preserveWhitespaces); this._templateAstCache.set(compMeta.type.reference, result); return result; } }, { key: "_createOutputContext", value: function _createOutputContext(genFilePath) { var _this292 = this; var importExpr$1 = function importExpr$1(symbol) { var typeParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var useSummaries = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; if (!(symbol instanceof StaticSymbol)) { throw new Error("Internal error: unknown identifier ".concat(JSON.stringify(symbol))); } var arity = _this292._symbolResolver.getTypeArity(symbol) || 0; var _ref59 = _this292._symbolResolver.getImportAs(symbol, useSummaries) || symbol, filePath = _ref59.filePath, name = _ref59.name, members = _ref59.members; var importModule = _this292._fileNameToModuleName(filePath, genFilePath); // It should be good enough to compare filePath to genFilePath and if they are equal // there is a self reference. However, ngfactory files generate to .ts but their // symbols have .d.ts so a simple compare is insufficient. They should be canonical // and is tracked by #17705. var selfReference = _this292._fileNameToModuleName(genFilePath, genFilePath); var moduleName = importModule === selfReference ? null : importModule; // If we are in a type expression that refers to a generic type then supply // the required type parameters. If there were not enough type parameters // supplied, supply any as the type. Outside a type expression the reference // should not supply type parameters and be treated as a simple value reference // to the constructor function itself. var suppliedTypeParams = typeParams || []; var missingTypeParamsCount = arity - suppliedTypeParams.length; var allTypeParams = suppliedTypeParams.concat(new Array(missingTypeParamsCount).fill(DYNAMIC_TYPE)); return members.reduce(function (expr, memberName) { return expr.prop(memberName); }, importExpr(new ExternalReference(moduleName, name, null), allTypeParams)); }; return { statements: [], genFilePath: genFilePath, importExpr: importExpr$1, constantPool: new ConstantPool() }; } }, { key: "_fileNameToModuleName", value: function _fileNameToModuleName(importedFilePath, containingFilePath) { return this._summaryResolver.getKnownModuleName(importedFilePath) || this._symbolResolver.getKnownModuleName(importedFilePath) || this._host.fileNameToModuleName(importedFilePath, containingFilePath); } }, { key: "_codegenStyles", value: function _codegenStyles(srcFileUrl, compMeta, stylesheetMetadata, isShimmed, fileSuffix) { var outputCtx = this._createOutputContext(_stylesModuleUrl(stylesheetMetadata.moduleUrl, isShimmed, fileSuffix)); var compiledStylesheet = this._styleCompiler.compileStyles(outputCtx, compMeta, stylesheetMetadata, isShimmed); _resolveStyleStatements(this._symbolResolver, compiledStylesheet, isShimmed, fileSuffix); return this._codegenSourceModule(srcFileUrl, outputCtx); } }, { key: "_codegenSourceModule", value: function _codegenSourceModule(srcFileUrl, ctx) { return new GeneratedFile(srcFileUrl, ctx.genFilePath, ctx.statements); } }, { key: "listLazyRoutes", value: function listLazyRoutes(entryRoute, analyzedModules) { var self = this; if (entryRoute) { var symbol = parseLazyRoute(entryRoute, this.reflector).referencedModule; return visitLazyRoute(symbol); } else if (analyzedModules) { var allLazyRoutes = []; var _iterator29 = _createForOfIteratorHelper(analyzedModules.ngModules), _step29; try { for (_iterator29.s(); !(_step29 = _iterator29.n()).done;) { var ngModule = _step29.value; var lazyRoutes = _listLazyRoutes(ngModule, this.reflector); var _iterator30 = _createForOfIteratorHelper(lazyRoutes), _step30; try { for (_iterator30.s(); !(_step30 = _iterator30.n()).done;) { var lazyRoute = _step30.value; allLazyRoutes.push(lazyRoute); } } catch (err) { _iterator30.e(err); } finally { _iterator30.f(); } } } catch (err) { _iterator29.e(err); } finally { _iterator29.f(); } return allLazyRoutes; } else { throw new Error("Either route or analyzedModules has to be specified!"); } function visitLazyRoute(symbol) { var seenRoutes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Set(); var allLazyRoutes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; // Support pointing to default exports, but stop recursing there, // as the StaticReflector does not yet support default exports. if (seenRoutes.has(symbol) || !symbol.name) { return allLazyRoutes; } seenRoutes.add(symbol); var lazyRoutes = _listLazyRoutes(self._metadataResolver.getNgModuleMetadata(symbol, true), self.reflector); var _iterator31 = _createForOfIteratorHelper(lazyRoutes), _step31; try { for (_iterator31.s(); !(_step31 = _iterator31.n()).done;) { var _lazyRoute = _step31.value; allLazyRoutes.push(_lazyRoute); visitLazyRoute(_lazyRoute.referencedModule, seenRoutes, allLazyRoutes); } } catch (err) { _iterator31.e(err); } finally { _iterator31.f(); } return allLazyRoutes; } } }]); return AotCompiler; }(); function _createEmptyStub(outputCtx) { // Note: We need to produce at least one import statement so that // TypeScript knows that the file is an es6 module. Otherwise our generated // exports / imports won't be emitted properly by TypeScript. outputCtx.statements.push(importExpr(Identifiers.ComponentFactory).toStmt()); } function _resolveStyleStatements(symbolResolver, compileResult, needsShim, fileSuffix) { compileResult.dependencies.forEach(function (dep) { dep.setValue(symbolResolver.getStaticSymbol(_stylesModuleUrl(dep.moduleUrl, needsShim, fileSuffix), dep.name)); }); } function _stylesModuleUrl(stylesheetUrl, shim, suffix) { return "".concat(stylesheetUrl).concat(shim ? '.shim' : '', ".ngstyle").concat(suffix); } function analyzeNgModules(fileNames, host, staticSymbolResolver, metadataResolver) { var files = _analyzeFilesIncludingNonProgramFiles(fileNames, host, staticSymbolResolver, metadataResolver); return mergeAnalyzedFiles(files); } function analyzeAndValidateNgModules(fileNames, host, staticSymbolResolver, metadataResolver) { return validateAnalyzedModules(analyzeNgModules(fileNames, host, staticSymbolResolver, metadataResolver)); } function validateAnalyzedModules(analyzedModules) { if (analyzedModules.symbolsMissingModule && analyzedModules.symbolsMissingModule.length) { var messages = analyzedModules.symbolsMissingModule.map(function (s) { return "Cannot determine the module for class ".concat(s.name, " in ").concat(s.filePath, "! Add ").concat(s.name, " to the NgModule to fix it."); }); throw syntaxError(messages.join('\n')); } return analyzedModules; } // Analyzes all of the program files, // including files that are not part of the program // but are referenced by an NgModule. function _analyzeFilesIncludingNonProgramFiles(fileNames, host, staticSymbolResolver, metadataResolver) { var seenFiles = new Set(); var files = []; var visitFile = function visitFile(fileName) { if (seenFiles.has(fileName) || !host.isSourceFile(fileName)) { return false; } seenFiles.add(fileName); var analyzedFile = analyzeFile(host, staticSymbolResolver, metadataResolver, fileName); files.push(analyzedFile); analyzedFile.ngModules.forEach(function (ngModule) { ngModule.transitiveModule.modules.forEach(function (modMeta) { return visitFile(modMeta.reference.filePath); }); }); }; fileNames.forEach(function (fileName) { return visitFile(fileName); }); return files; } function analyzeFile(host, staticSymbolResolver, metadataResolver, fileName) { var directives = []; var pipes = []; var injectables = []; var ngModules = []; var hasDecorators = staticSymbolResolver.hasDecorators(fileName); var exportsNonSourceFiles = false; // Don't analyze .d.ts files that have no decorators as a shortcut // to speed up the analysis. This prevents us from // resolving the references in these files. // Note: exportsNonSourceFiles is only needed when compiling with summaries, // which is not the case when .d.ts files are treated as input files. if (!fileName.endsWith('.d.ts') || hasDecorators) { staticSymbolResolver.getSymbolsOf(fileName).forEach(function (symbol) { var resolvedSymbol = staticSymbolResolver.resolveSymbol(symbol); var symbolMeta = resolvedSymbol.metadata; if (!symbolMeta || symbolMeta.__symbolic === 'error') { return; } var isNgSymbol = false; if (symbolMeta.__symbolic === 'class') { if (metadataResolver.isDirective(symbol)) { isNgSymbol = true; directives.push(symbol); } else if (metadataResolver.isPipe(symbol)) { isNgSymbol = true; pipes.push(symbol); } else if (metadataResolver.isNgModule(symbol)) { var ngModule = metadataResolver.getNgModuleMetadata(symbol, false); if (ngModule) { isNgSymbol = true; ngModules.push(ngModule); } } else if (metadataResolver.isInjectable(symbol)) { isNgSymbol = true; var injectable = metadataResolver.getInjectableMetadata(symbol, null, false); if (injectable) { injectables.push(injectable); } } } if (!isNgSymbol) { exportsNonSourceFiles = exportsNonSourceFiles || isValueExportingNonSourceFile(host, symbolMeta); } }); } return { fileName: fileName, directives: directives, pipes: pipes, ngModules: ngModules, injectables: injectables, exportsNonSourceFiles: exportsNonSourceFiles }; } function analyzeFileForInjectables(host, staticSymbolResolver, metadataResolver, fileName) { var injectables = []; var shallowModules = []; if (staticSymbolResolver.hasDecorators(fileName)) { staticSymbolResolver.getSymbolsOf(fileName).forEach(function (symbol) { var resolvedSymbol = staticSymbolResolver.resolveSymbol(symbol); var symbolMeta = resolvedSymbol.metadata; if (!symbolMeta || symbolMeta.__symbolic === 'error') { return; } if (symbolMeta.__symbolic === 'class') { if (metadataResolver.isInjectable(symbol)) { var injectable = metadataResolver.getInjectableMetadata(symbol, null, false); if (injectable) { injectables.push(injectable); } } else if (metadataResolver.isNgModule(symbol)) { var _module4 = metadataResolver.getShallowModuleMetadata(symbol); if (_module4) { shallowModules.push(_module4); } } } }); } return { fileName: fileName, injectables: injectables, shallowModules: shallowModules }; } function isValueExportingNonSourceFile(host, metadata) { var exportsNonSourceFiles = false; var Visitor = /*#__PURE__*/function () { function Visitor() { _classCallCheck(this, Visitor); } _createClass2(Visitor, [{ key: "visitArray", value: function visitArray(arr, context) { var _this293 = this; arr.forEach(function (v) { return visitValue(v, _this293, context); }); } }, { key: "visitStringMap", value: function visitStringMap(map, context) { var _this294 = this; Object.keys(map).forEach(function (key) { return visitValue(map[key], _this294, context); }); } }, { key: "visitPrimitive", value: function visitPrimitive(value, context) {} }, { key: "visitOther", value: function visitOther(value, context) { if (value instanceof StaticSymbol && !host.isSourceFile(value.filePath)) { exportsNonSourceFiles = true; } } }]); return Visitor; }(); visitValue(metadata, new Visitor(), null); return exportsNonSourceFiles; } function mergeAnalyzedFiles(analyzedFiles) { var allNgModules = []; var ngModuleByPipeOrDirective = new Map(); var allPipesAndDirectives = new Set(); analyzedFiles.forEach(function (af) { af.ngModules.forEach(function (ngModule) { allNgModules.push(ngModule); ngModule.declaredDirectives.forEach(function (d) { return ngModuleByPipeOrDirective.set(d.reference, ngModule); }); ngModule.declaredPipes.forEach(function (p) { return ngModuleByPipeOrDirective.set(p.reference, ngModule); }); }); af.directives.forEach(function (d) { return allPipesAndDirectives.add(d); }); af.pipes.forEach(function (p) { return allPipesAndDirectives.add(p); }); }); var symbolsMissingModule = []; allPipesAndDirectives.forEach(function (ref) { if (!ngModuleByPipeOrDirective.has(ref)) { symbolsMissingModule.push(ref); } }); return { ngModules: allNgModules, ngModuleByPipeOrDirective: ngModuleByPipeOrDirective, symbolsMissingModule: symbolsMissingModule, files: analyzedFiles }; } function mergeAndValidateNgFiles(files) { return validateAnalyzedModules(mergeAnalyzedFiles(files)); } /** * @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 FORMATTED_MESSAGE = 'ngFormattedMessage'; function indentStr(level) { if (level <= 0) return ''; if (level < 6) return ['', ' ', ' ', ' ', ' ', ' '][level]; var half = indentStr(Math.floor(level / 2)); return half + half + (level % 2 === 1 ? ' ' : ''); } function formatChain(chain) { var indent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; if (!chain) return ''; var position = chain.position ? "".concat(chain.position.fileName, "(").concat(chain.position.line + 1, ",").concat(chain.position.column + 1, ")") : ''; var prefix = position && indent === 0 ? "".concat(position, ": ") : ''; var postfix = position && indent !== 0 ? " at ".concat(position) : ''; var message = "".concat(prefix).concat(chain.message).concat(postfix); return "".concat(indentStr(indent)).concat(message).concat(chain.next && '\n' + formatChain(chain.next, indent + 2) || ''); } function formattedError(chain) { var message = formatChain(chain) + '.'; var error = syntaxError(message); error[FORMATTED_MESSAGE] = true; error.chain = chain; error.position = chain.position; return error; } function isFormattedError(error) { return !!error[FORMATTED_MESSAGE]; } /** * @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 ANGULAR_CORE = '@angular/core'; var ANGULAR_ROUTER = '@angular/router'; var HIDDEN_KEY = /^\$.*\$$/; var IGNORE = { __symbolic: 'ignore' }; var USE_VALUE$1 = 'useValue'; var PROVIDE = 'provide'; var REFERENCE_SET = new Set([USE_VALUE$1, 'useFactory', 'data', 'id', 'loadChildren']); var TYPEGUARD_POSTFIX = 'TypeGuard'; var USE_IF = 'UseIf'; function shouldIgnore(value) { return value && value.__symbolic == 'ignore'; } /** * A static reflector implements enough of the Reflector API that is necessary to compile * templates statically. */ var StaticReflector = /*#__PURE__*/function () { function StaticReflector(summaryResolver, symbolResolver) { var _this295 = this; var knownMetadataClasses = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; var knownMetadataFunctions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; var errorRecorder = arguments.length > 4 ? arguments[4] : undefined; _classCallCheck(this, StaticReflector); this.summaryResolver = summaryResolver; this.symbolResolver = symbolResolver; this.errorRecorder = errorRecorder; this.annotationCache = new Map(); this.shallowAnnotationCache = new Map(); this.propertyCache = new Map(); this.parameterCache = new Map(); this.methodCache = new Map(); this.staticCache = new Map(); this.conversionMap = new Map(); this.resolvedExternalReferences = new Map(); this.annotationForParentClassWithSummaryKind = new Map(); this.initializeConversionMap(); knownMetadataClasses.forEach(function (kc) { return _this295._registerDecoratorOrConstructor(_this295.getStaticSymbol(kc.filePath, kc.name), kc.ctor); }); knownMetadataFunctions.forEach(function (kf) { return _this295._registerFunction(_this295.getStaticSymbol(kf.filePath, kf.name), kf.fn); }); this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Directive, [createDirective, createComponent]); this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Pipe, [createPipe]); this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.NgModule, [createNgModule]); this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Injectable, [createInjectable, createPipe, createDirective, createComponent, createNgModule]); } _createClass2(StaticReflector, [{ key: "componentModuleUrl", value: function componentModuleUrl(typeOrFunc) { var staticSymbol = this.findSymbolDeclaration(typeOrFunc); return this.symbolResolver.getResourcePath(staticSymbol); } }, { key: "resolveExternalReference", value: function resolveExternalReference(ref, containingFile) { var key = undefined; if (!containingFile) { key = "".concat(ref.moduleName, ":").concat(ref.name); var _declarationSymbol = this.resolvedExternalReferences.get(key); if (_declarationSymbol) return _declarationSymbol; } var refSymbol = this.symbolResolver.getSymbolByModule(ref.moduleName, ref.name, containingFile); var declarationSymbol = this.findSymbolDeclaration(refSymbol); if (!containingFile) { this.symbolResolver.recordModuleNameForFileName(refSymbol.filePath, ref.moduleName); this.symbolResolver.recordImportAs(declarationSymbol, refSymbol); } if (key) { this.resolvedExternalReferences.set(key, declarationSymbol); } return declarationSymbol; } }, { key: "findDeclaration", value: function findDeclaration(moduleUrl, name, containingFile) { return this.findSymbolDeclaration(this.symbolResolver.getSymbolByModule(moduleUrl, name, containingFile)); } }, { key: "tryFindDeclaration", value: function tryFindDeclaration(moduleUrl, name, containingFile) { var _this296 = this; return this.symbolResolver.ignoreErrorsFor(function () { return _this296.findDeclaration(moduleUrl, name, containingFile); }); } }, { key: "findSymbolDeclaration", value: function findSymbolDeclaration(symbol) { var resolvedSymbol = this.symbolResolver.resolveSymbol(symbol); if (resolvedSymbol) { var resolvedMetadata = resolvedSymbol.metadata; if (resolvedMetadata && resolvedMetadata.__symbolic === 'resolved') { resolvedMetadata = resolvedMetadata.symbol; } if (resolvedMetadata instanceof StaticSymbol) { return this.findSymbolDeclaration(resolvedSymbol.metadata); } } return symbol; } }, { key: "tryAnnotations", value: function tryAnnotations(type) { var originalRecorder = this.errorRecorder; this.errorRecorder = function (error, fileName) {}; try { return this.annotations(type); } finally { this.errorRecorder = originalRecorder; } } }, { key: "annotations", value: function annotations(type) { var _this297 = this; return this._annotations(type, function (type, decorators) { return _this297.simplify(type, decorators); }, this.annotationCache); } }, { key: "shallowAnnotations", value: function shallowAnnotations(type) { var _this298 = this; return this._annotations(type, function (type, decorators) { return _this298.simplify(type, decorators, true); }, this.shallowAnnotationCache); } }, { key: "_annotations", value: function _annotations(type, simplify, annotationCache) { var annotations = annotationCache.get(type); if (!annotations) { annotations = []; var classMetadata = this.getTypeMetadata(type); var parentType = this.findParentType(type, classMetadata); if (parentType) { var _annotations2; var parentAnnotations = this.annotations(parentType); (_annotations2 = annotations).push.apply(_annotations2, _toConsumableArray(parentAnnotations)); } var ownAnnotations = []; if (classMetadata['decorators']) { ownAnnotations = simplify(type, classMetadata['decorators']); if (ownAnnotations) { var _annotations3; (_annotations3 = annotations).push.apply(_annotations3, _toConsumableArray(ownAnnotations)); } } if (parentType && !this.summaryResolver.isLibraryFile(type.filePath) && this.summaryResolver.isLibraryFile(parentType.filePath)) { var summary = this.summaryResolver.resolveSummary(parentType); if (summary && summary.type) { var requiredAnnotationTypes = this.annotationForParentClassWithSummaryKind.get(summary.type.summaryKind); var typeHasRequiredAnnotation = requiredAnnotationTypes.some(function (requiredType) { return ownAnnotations.some(function (ann) { return requiredType.isTypeOf(ann); }); }); if (!typeHasRequiredAnnotation) { this.reportError(formatMetadataError(metadataError("Class ".concat(type.name, " in ").concat(type.filePath, " extends from a ").concat(CompileSummaryKind[summary.type.summaryKind], " in another compilation unit without duplicating the decorator"), /* summary */ undefined, "Please add a ".concat(requiredAnnotationTypes.map(function (type) { return type.ngMetadataName; }).join(' or '), " decorator to the class")), type), type); } } } annotationCache.set(type, annotations.filter(function (ann) { return !!ann; })); } return annotations; } }, { key: "propMetadata", value: function propMetadata(type) { var _this299 = this; var propMetadata = this.propertyCache.get(type); if (!propMetadata) { var classMetadata = this.getTypeMetadata(type); propMetadata = {}; var parentType = this.findParentType(type, classMetadata); if (parentType) { var parentPropMetadata = this.propMetadata(parentType); Object.keys(parentPropMetadata).forEach(function (parentProp) { propMetadata[parentProp] = parentPropMetadata[parentProp]; }); } var members = classMetadata['members'] || {}; Object.keys(members).forEach(function (propName) { var propData = members[propName]; var prop = propData.find(function (a) { return a['__symbolic'] == 'property' || a['__symbolic'] == 'method'; }); var decorators = []; if (propMetadata[propName]) { decorators.push.apply(decorators, _toConsumableArray(propMetadata[propName])); } propMetadata[propName] = decorators; if (prop && prop['decorators']) { decorators.push.apply(decorators, _toConsumableArray(_this299.simplify(type, prop['decorators']))); } }); this.propertyCache.set(type, propMetadata); } return propMetadata; } }, { key: "parameters", value: function parameters(type) { var _this300 = this; if (!(type instanceof StaticSymbol)) { this.reportError(new Error("parameters received ".concat(JSON.stringify(type), " which is not a StaticSymbol")), type); return []; } try { var parameters = this.parameterCache.get(type); if (!parameters) { var classMetadata = this.getTypeMetadata(type); var parentType = this.findParentType(type, classMetadata); var members = classMetadata ? classMetadata['members'] : null; var ctorData = members ? members['__ctor__'] : null; if (ctorData) { var ctor = ctorData.find(function (a) { return a['__symbolic'] == 'constructor'; }); var rawParameterTypes = ctor['parameters'] || []; var parameterDecorators = this.simplify(type, ctor['parameterDecorators'] || []); parameters = []; rawParameterTypes.forEach(function (rawParamType, index) { var nestedResult = []; var paramType = _this300.trySimplify(type, rawParamType); if (paramType) nestedResult.push(paramType); var decorators = parameterDecorators ? parameterDecorators[index] : null; if (decorators) { nestedResult.push.apply(nestedResult, _toConsumableArray(decorators)); } parameters.push(nestedResult); }); } else if (parentType) { parameters = this.parameters(parentType); } if (!parameters) { parameters = []; } this.parameterCache.set(type, parameters); } return parameters; } catch (e) { console.error("Failed on type ".concat(JSON.stringify(type), " with error ").concat(e)); throw e; } } }, { key: "_methodNames", value: function _methodNames(type) { var methodNames = this.methodCache.get(type); if (!methodNames) { var classMetadata = this.getTypeMetadata(type); methodNames = {}; var parentType = this.findParentType(type, classMetadata); if (parentType) { var parentMethodNames = this._methodNames(parentType); Object.keys(parentMethodNames).forEach(function (parentProp) { methodNames[parentProp] = parentMethodNames[parentProp]; }); } var members = classMetadata['members'] || {}; Object.keys(members).forEach(function (propName) { var propData = members[propName]; var isMethod = propData.some(function (a) { return a['__symbolic'] == 'method'; }); methodNames[propName] = methodNames[propName] || isMethod; }); this.methodCache.set(type, methodNames); } return methodNames; } }, { key: "_staticMembers", value: function _staticMembers(type) { var staticMembers = this.staticCache.get(type); if (!staticMembers) { var classMetadata = this.getTypeMetadata(type); var staticMemberData = classMetadata['statics'] || {}; staticMembers = Object.keys(staticMemberData); this.staticCache.set(type, staticMembers); } return staticMembers; } }, { key: "findParentType", value: function findParentType(type, classMetadata) { var parentType = this.trySimplify(type, classMetadata['extends']); if (parentType instanceof StaticSymbol) { return parentType; } } }, { key: "hasLifecycleHook", value: function hasLifecycleHook(type, lcProperty) { if (!(type instanceof StaticSymbol)) { this.reportError(new Error("hasLifecycleHook received ".concat(JSON.stringify(type), " which is not a StaticSymbol")), type); } try { return !!this._methodNames(type)[lcProperty]; } catch (e) { console.error("Failed on type ".concat(JSON.stringify(type), " with error ").concat(e)); throw e; } } }, { key: "guards", value: function guards(type) { if (!(type instanceof StaticSymbol)) { this.reportError(new Error("guards received ".concat(JSON.stringify(type), " which is not a StaticSymbol")), type); return {}; } var staticMembers = this._staticMembers(type); var result = {}; var _iterator32 = _createForOfIteratorHelper(staticMembers), _step32; try { for (_iterator32.s(); !(_step32 = _iterator32.n()).done;) { var name = _step32.value; if (name.endsWith(TYPEGUARD_POSTFIX)) { var property = name.substr(0, name.length - TYPEGUARD_POSTFIX.length); var value = void 0; if (property.endsWith(USE_IF)) { property = name.substr(0, property.length - USE_IF.length); value = USE_IF; } else { value = this.getStaticSymbol(type.filePath, type.name, [name]); } result[property] = value; } } } catch (err) { _iterator32.e(err); } finally { _iterator32.f(); } return result; } }, { key: "_registerDecoratorOrConstructor", value: function _registerDecoratorOrConstructor(type, ctor) { this.conversionMap.set(type, function (context, args) { return _construct(ctor, _toConsumableArray(args)); }); } }, { key: "_registerFunction", value: function _registerFunction(type, fn) { this.conversionMap.set(type, function (context, args) { return fn.apply(undefined, args); }); } }, { key: "initializeConversionMap", value: function initializeConversionMap() { this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Injectable'), createInjectable); this.injectionToken = this.findDeclaration(ANGULAR_CORE, 'InjectionToken'); this.opaqueToken = this.findDeclaration(ANGULAR_CORE, 'OpaqueToken'); this.ROUTES = this.tryFindDeclaration(ANGULAR_ROUTER, 'ROUTES'); this.ANALYZE_FOR_ENTRY_COMPONENTS = this.findDeclaration(ANGULAR_CORE, 'ANALYZE_FOR_ENTRY_COMPONENTS'); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Host'), createHost); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Self'), createSelf); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'SkipSelf'), createSkipSelf); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Inject'), createInject); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Optional'), createOptional); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Attribute'), createAttribute); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ContentChild'), createContentChild); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ContentChildren'), createContentChildren); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ViewChild'), createViewChild); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ViewChildren'), createViewChildren); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Input'), createInput); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Output'), createOutput); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Pipe'), createPipe); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'HostBinding'), createHostBinding); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'HostListener'), createHostListener); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Directive'), createDirective); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Component'), createComponent); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'NgModule'), createNgModule); // Note: Some metadata classes can be used directly with Provider.deps. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Host'), createHost); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Self'), createSelf); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'SkipSelf'), createSkipSelf); this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Optional'), createOptional); } /** * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded. * All types passed to the StaticResolver should be pseudo-types returned by this method. * * @param declarationFile the absolute path of the file where the symbol is declared * @param name the name of the type. */ }, { key: "getStaticSymbol", value: function getStaticSymbol(declarationFile, name, members) { return this.symbolResolver.getStaticSymbol(declarationFile, name, members); } /** * Simplify but discard any errors */ }, { key: "trySimplify", value: function trySimplify(context, value) { var originalRecorder = this.errorRecorder; this.errorRecorder = function (error, fileName) {}; var result = this.simplify(context, value); this.errorRecorder = originalRecorder; return result; } /** @internal */ }, { key: "simplify", value: function simplify(context, value) { var lazy = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var self = this; var scope = BindingScope$1.empty; var calling = new Map(); var rootContext = context; function simplifyInContext(context, value, depth, references) { function resolveReferenceValue(staticSymbol) { var resolvedSymbol = self.symbolResolver.resolveSymbol(staticSymbol); return resolvedSymbol ? resolvedSymbol.metadata : null; } function simplifyEagerly(value) { return simplifyInContext(context, value, depth, 0); } function simplifyLazily(value) { return simplifyInContext(context, value, depth, references + 1); } function simplifyNested(nestedContext, value) { if (nestedContext === context) { // If the context hasn't changed let the exception propagate unmodified. return simplifyInContext(nestedContext, value, depth + 1, references); } try { return simplifyInContext(nestedContext, value, depth + 1, references); } catch (e) { if (isMetadataError(e)) { // Propagate the message text up but add a message to the chain that explains how we got // here. // e.chain implies e.symbol var summaryMsg = e.chain ? 'references \'' + e.symbol.name + '\'' : errorSummary(e); var summary = "'".concat(nestedContext.name, "' ").concat(summaryMsg); var chain = { message: summary, position: e.position, next: e.chain }; // TODO(chuckj): retrieve the position information indirectly from the collectors node // map if the metadata is from a .ts file. self.error({ message: e.message, advise: e.advise, context: e.context, chain: chain, symbol: nestedContext }, context); } else { // It is probably an internal error. throw e; } } } function simplifyCall(functionSymbol, targetFunction, args, targetExpression) { if (targetFunction && targetFunction['__symbolic'] == 'function') { if (calling.get(functionSymbol)) { self.error({ message: 'Recursion is not supported', summary: "called '".concat(functionSymbol.name, "' recursively"), value: targetFunction }, functionSymbol); } try { var _value8 = targetFunction['value']; if (_value8 && (depth != 0 || _value8.__symbolic != 'error')) { var parameters = targetFunction['parameters']; var defaults = targetFunction.defaults; args = args.map(function (arg) { return simplifyNested(context, arg); }).map(function (arg) { return shouldIgnore(arg) ? undefined : arg; }); if (defaults && defaults.length > args.length) { var _args2; (_args2 = args).push.apply(_args2, _toConsumableArray(defaults.slice(args.length).map(function (value) { return simplify(value); }))); } calling.set(functionSymbol, true); var functionScope = BindingScope$1.build(); for (var i = 0; i < parameters.length; i++) { functionScope.define(parameters[i], args[i]); } var oldScope = scope; var _result; try { scope = functionScope.done(); _result = simplifyNested(functionSymbol, _value8); } finally { scope = oldScope; } return _result; } } finally { calling["delete"](functionSymbol); } } if (depth === 0) { // If depth is 0 we are evaluating the top level expression that is describing element // decorator. In this case, it is a decorator we don't understand, such as a custom // non-angular decorator, and we should just ignore it. return IGNORE; } var position = undefined; if (targetExpression && targetExpression.__symbolic == 'resolved') { var line = targetExpression.line; var character = targetExpression.character; var fileName = targetExpression.fileName; if (fileName != null && line != null && character != null) { position = { fileName: fileName, line: line, column: character }; } } self.error({ message: FUNCTION_CALL_NOT_SUPPORTED, context: functionSymbol, value: targetFunction, position: position }, context); } function simplify(expression) { if (isPrimitive(expression)) { return expression; } if (expression instanceof Array) { var _result2 = []; var _iterator33 = _createForOfIteratorHelper(expression), _step33; try { for (_iterator33.s(); !(_step33 = _iterator33.n()).done;) { var item = _step33.value; // Check for a spread expression if (item && item.__symbolic === 'spread') { // We call with references as 0 because we require the actual value and cannot // tolerate a reference here. var spreadArray = simplifyEagerly(item.expression); if (Array.isArray(spreadArray)) { var _iterator34 = _createForOfIteratorHelper(spreadArray), _step34; try { for (_iterator34.s(); !(_step34 = _iterator34.n()).done;) { var spreadItem = _step34.value; _result2.push(spreadItem); } } catch (err) { _iterator34.e(err); } finally { _iterator34.f(); } continue; } } var _value9 = simplify(item); if (shouldIgnore(_value9)) { continue; } _result2.push(_value9); } } catch (err) { _iterator33.e(err); } finally { _iterator33.f(); } return _result2; } if (expression instanceof StaticSymbol) { // Stop simplification at builtin symbols or if we are in a reference context and // the symbol doesn't have members. if (expression === self.injectionToken || self.conversionMap.has(expression) || references > 0 && !expression.members.length) { return expression; } else { var staticSymbol = expression; var declarationValue = resolveReferenceValue(staticSymbol); if (declarationValue != null) { return simplifyNested(staticSymbol, declarationValue); } else { return staticSymbol; } } } if (expression) { if (expression['__symbolic']) { var _staticSymbol; switch (expression['__symbolic']) { case 'binop': var left = simplify(expression['left']); if (shouldIgnore(left)) return left; var right = simplify(expression['right']); if (shouldIgnore(right)) return right; switch (expression['operator']) { case '&&': return left && right; case '||': return left || right; case '|': return left | right; case '^': return left ^ right; case '&': return left & right; case '==': return left == right; case '!=': return left != right; case '===': return left === right; case '!==': return left !== right; case '<': return left < right; case '>': return left > right; case '<=': return left <= right; case '>=': return left >= right; case '<<': return left << right; case '>>': return left >> right; case '+': return left + right; case '-': return left - right; case '*': return left * right; case '/': return left / right; case '%': return left % right; } return null; case 'if': var condition = simplify(expression['condition']); return condition ? simplify(expression['thenExpression']) : simplify(expression['elseExpression']); case 'pre': var operand = simplify(expression['operand']); if (shouldIgnore(operand)) return operand; switch (expression['operator']) { case '+': return operand; case '-': return -operand; case '!': return !operand; case '~': return ~operand; } return null; case 'index': var indexTarget = simplifyEagerly(expression['expression']); var index = simplifyEagerly(expression['index']); if (indexTarget && isPrimitive(index)) return indexTarget[index]; return null; case 'select': var member = expression['member']; var selectContext = context; var selectTarget = simplify(expression['expression']); if (selectTarget instanceof StaticSymbol) { var members = selectTarget.members.concat(member); selectContext = self.getStaticSymbol(selectTarget.filePath, selectTarget.name, members); var _declarationValue = resolveReferenceValue(selectContext); if (_declarationValue != null) { return simplifyNested(selectContext, _declarationValue); } else { return selectContext; } } if (selectTarget && isPrimitive(member)) return simplifyNested(selectContext, selectTarget[member]); return null; case 'reference': // Note: This only has to deal with variable references, as symbol references have // been converted into 'resolved' // in the StaticSymbolResolver. var name = expression['name']; var localValue = scope.resolve(name); if (localValue != BindingScope$1.missing) { return localValue; } break; case 'resolved': try { return simplify(expression.symbol); } catch (e) { // If an error is reported evaluating the symbol record the position of the // reference in the error so it can // be reported in the error message generated from the exception. if (isMetadataError(e) && expression.fileName != null && expression.line != null && expression.character != null) { e.position = { fileName: expression.fileName, line: expression.line, column: expression.character }; } throw e; } case 'class': return context; case 'function': return context; case 'new': case 'call': // Determine if the function is a built-in conversion _staticSymbol = simplifyInContext(context, expression['expression'], depth + 1, /* references */ 0); if (_staticSymbol instanceof StaticSymbol) { if (_staticSymbol === self.injectionToken || _staticSymbol === self.opaqueToken) { // if somebody calls new InjectionToken, don't create an InjectionToken, // but rather return the symbol to which the InjectionToken is assigned to. // OpaqueToken is supported too as it is required by the language service to // support v4 and prior versions of Angular. return context; } var argExpressions = expression['arguments'] || []; var converter = self.conversionMap.get(_staticSymbol); if (converter) { var args = argExpressions.map(function (arg) { return simplifyNested(context, arg); }).map(function (arg) { return shouldIgnore(arg) ? undefined : arg; }); return converter(context, args); } else { // Determine if the function is one we can simplify. var targetFunction = resolveReferenceValue(_staticSymbol); return simplifyCall(_staticSymbol, targetFunction, argExpressions, expression['expression']); } } return IGNORE; case 'error': var message = expression.message; if (expression['line'] != null) { self.error({ message: message, context: expression.context, value: expression, position: { fileName: expression['fileName'], line: expression['line'], column: expression['character'] } }, context); } else { self.error({ message: message, context: expression.context }, context); } return IGNORE; case 'ignore': return expression; } return null; } return mapStringMap(expression, function (value, name) { if (REFERENCE_SET.has(name)) { if (name === USE_VALUE$1 && PROVIDE in expression) { // If this is a provider expression, check for special tokens that need the value // during analysis. var provide = simplify(expression.provide); if (provide === self.ROUTES || provide == self.ANALYZE_FOR_ENTRY_COMPONENTS) { return simplify(value); } } return simplifyLazily(value); } return simplify(value); }); } return IGNORE; } return simplify(value); } var result; try { result = simplifyInContext(context, value, 0, lazy ? 1 : 0); } catch (e) { if (this.errorRecorder) { this.reportError(e, context); } else { throw formatMetadataError(e, context); } } if (shouldIgnore(result)) { return undefined; } return result; } }, { key: "getTypeMetadata", value: function getTypeMetadata(type) { var resolvedSymbol = this.symbolResolver.resolveSymbol(type); return resolvedSymbol && resolvedSymbol.metadata ? resolvedSymbol.metadata : { __symbolic: 'class' }; } }, { key: "reportError", value: function reportError(error, context, path) { if (this.errorRecorder) { this.errorRecorder(formatMetadataError(error, context), context && context.filePath || path); } else { throw error; } } }, { key: "error", value: function error(_ref60, reportingContext) { var message = _ref60.message, summary = _ref60.summary, advise = _ref60.advise, position = _ref60.position, context = _ref60.context, value = _ref60.value, symbol = _ref60.symbol, chain = _ref60.chain; this.reportError(metadataError(message, summary, advise, position, symbol, context, chain), reportingContext); } }]); return StaticReflector; }(); var METADATA_ERROR = 'ngMetadataError'; function metadataError(message, summary, advise, position, symbol, context, chain) { var error = syntaxError(message); error[METADATA_ERROR] = true; if (advise) error.advise = advise; if (position) error.position = position; if (summary) error.summary = summary; if (context) error.context = context; if (chain) error.chain = chain; if (symbol) error.symbol = symbol; return error; } function isMetadataError(error) { return !!error[METADATA_ERROR]; } var REFERENCE_TO_NONEXPORTED_CLASS = 'Reference to non-exported class'; var VARIABLE_NOT_INITIALIZED = 'Variable not initialized'; var DESTRUCTURE_NOT_SUPPORTED = 'Destructuring not supported'; var COULD_NOT_RESOLVE_TYPE = 'Could not resolve type'; var FUNCTION_CALL_NOT_SUPPORTED = 'Function call not supported'; var REFERENCE_TO_LOCAL_SYMBOL = 'Reference to a local symbol'; var LAMBDA_NOT_SUPPORTED = 'Lambda not supported'; function expandedMessage(message, context) { switch (message) { case REFERENCE_TO_NONEXPORTED_CLASS: if (context && context.className) { return "References to a non-exported class are not supported in decorators but ".concat(context.className, " was referenced."); } break; case VARIABLE_NOT_INITIALIZED: return 'Only initialized variables and constants can be referenced in decorators because the value of this variable is needed by the template compiler'; case DESTRUCTURE_NOT_SUPPORTED: return 'Referencing an exported destructured variable or constant is not supported in decorators and this value is needed by the template compiler'; case COULD_NOT_RESOLVE_TYPE: if (context && context.typeName) { return "Could not resolve type ".concat(context.typeName); } break; case FUNCTION_CALL_NOT_SUPPORTED: if (context && context.name) { return "Function calls are not supported in decorators but '".concat(context.name, "' was called"); } return 'Function calls are not supported in decorators'; case REFERENCE_TO_LOCAL_SYMBOL: if (context && context.name) { return "Reference to a local (non-exported) symbols are not supported in decorators but '".concat(context.name, "' was referenced"); } break; case LAMBDA_NOT_SUPPORTED: return "Function expressions are not supported in decorators"; } return message; } function messageAdvise(message, context) { switch (message) { case REFERENCE_TO_NONEXPORTED_CLASS: if (context && context.className) { return "Consider exporting '".concat(context.className, "'"); } break; case DESTRUCTURE_NOT_SUPPORTED: return 'Consider simplifying to avoid destructuring'; case REFERENCE_TO_LOCAL_SYMBOL: if (context && context.name) { return "Consider exporting '".concat(context.name, "'"); } break; case LAMBDA_NOT_SUPPORTED: return "Consider changing the function expression into an exported function"; } return undefined; } function errorSummary(error) { if (error.summary) { return error.summary; } switch (error.message) { case REFERENCE_TO_NONEXPORTED_CLASS: if (error.context && error.context.className) { return "references non-exported class ".concat(error.context.className); } break; case VARIABLE_NOT_INITIALIZED: return 'is not initialized'; case DESTRUCTURE_NOT_SUPPORTED: return 'is a destructured variable'; case COULD_NOT_RESOLVE_TYPE: return 'could not be resolved'; case FUNCTION_CALL_NOT_SUPPORTED: if (error.context && error.context.name) { return "calls '".concat(error.context.name, "'"); } return "calls a function"; case REFERENCE_TO_LOCAL_SYMBOL: if (error.context && error.context.name) { return "references local variable ".concat(error.context.name); } return "references a local variable"; } return 'contains the error'; } function mapStringMap(input, transform) { if (!input) return {}; var result = {}; Object.keys(input).forEach(function (key) { var value = transform(input[key], key); if (!shouldIgnore(value)) { if (HIDDEN_KEY.test(key)) { Object.defineProperty(result, key, { enumerable: false, configurable: true, value: value }); } else { result[key] = value; } } }); return result; } function isPrimitive(o) { return o === null || typeof o !== 'function' && typeof o !== 'object'; } var BindingScope$1 = /*#__PURE__*/function () { function BindingScope$1() { _classCallCheck(this, BindingScope$1); } _createClass2(BindingScope$1, null, [{ key: "build", value: function build() { var current = new Map(); return { define: function define(name, value) { current.set(name, value); return this; }, done: function done() { return current.size > 0 ? new PopulatedScope(current) : BindingScope$1.empty; } }; } }]); return BindingScope$1; }(); BindingScope$1.missing = {}; BindingScope$1.empty = { resolve: function resolve(name) { return BindingScope$1.missing; } }; var PopulatedScope = /*#__PURE__*/function (_BindingScope$) { _inherits(PopulatedScope, _BindingScope$); var _super105 = _createSuper(PopulatedScope); function PopulatedScope(bindings) { var _this301; _classCallCheck(this, PopulatedScope); _this301 = _super105.call(this); _this301.bindings = bindings; return _this301; } _createClass2(PopulatedScope, [{ key: "resolve", value: function resolve(name) { return this.bindings.has(name) ? this.bindings.get(name) : BindingScope$1.missing; } }]); return PopulatedScope; }(BindingScope$1); function formatMetadataMessageChain(chain, advise) { var expanded = expandedMessage(chain.message, chain.context); var nesting = chain.symbol ? " in '".concat(chain.symbol.name, "'") : ''; var message = "".concat(expanded).concat(nesting); var position = chain.position; var next = chain.next ? formatMetadataMessageChain(chain.next, advise) : advise ? { message: advise } : undefined; return { message: message, position: position, next: next }; } function formatMetadataError(e, context) { if (isMetadataError(e)) { // Produce a formatted version of the and leaving enough information in the original error // to recover the formatting information to eventually produce a diagnostic error message. var position = e.position; var chain = { message: "Error during template compile of '".concat(context.name, "'"), position: position, next: { message: e.message, next: e.chain, context: e.context, symbol: e.symbol } }; var advise = e.advise || messageAdvise(e.message, e.context); return formattedError(formatMetadataMessageChain(chain, advise)); } return e; } /** * @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 AotSummaryResolver = /*#__PURE__*/function () { function AotSummaryResolver(host, staticSymbolCache) { _classCallCheck(this, AotSummaryResolver); this.host = host; this.staticSymbolCache = staticSymbolCache; // Note: this will only contain StaticSymbols without members! this.summaryCache = new Map(); this.loadedFilePaths = new Map(); // Note: this will only contain StaticSymbols without members! this.importAs = new Map(); this.knownFileNameToModuleNames = new Map(); } _createClass2(AotSummaryResolver, [{ key: "isLibraryFile", value: function isLibraryFile(filePath) { // Note: We need to strip the .ngfactory. file path, // so this method also works for generated files // (for which host.isSourceFile will always return false). return !this.host.isSourceFile(stripGeneratedFileSuffix(filePath)); } }, { key: "toSummaryFileName", value: function toSummaryFileName(filePath, referringSrcFileName) { return this.host.toSummaryFileName(filePath, referringSrcFileName); } }, { key: "fromSummaryFileName", value: function fromSummaryFileName(fileName, referringLibFileName) { return this.host.fromSummaryFileName(fileName, referringLibFileName); } }, { key: "resolveSummary", value: function resolveSummary(staticSymbol) { var rootSymbol = staticSymbol.members.length ? this.staticSymbolCache.get(staticSymbol.filePath, staticSymbol.name) : staticSymbol; var summary = this.summaryCache.get(rootSymbol); if (!summary) { this._loadSummaryFile(staticSymbol.filePath); summary = this.summaryCache.get(staticSymbol); } return rootSymbol === staticSymbol && summary || null; } }, { key: "getSymbolsOf", value: function getSymbolsOf(filePath) { if (this._loadSummaryFile(filePath)) { return Array.from(this.summaryCache.keys()).filter(function (symbol) { return symbol.filePath === filePath; }); } return null; } }, { key: "getImportAs", value: function getImportAs(staticSymbol) { staticSymbol.assertNoMembers(); return this.importAs.get(staticSymbol); } /** * Converts a file path to a module name that can be used as an `import`. */ }, { key: "getKnownModuleName", value: function getKnownModuleName(importedFilePath) { return this.knownFileNameToModuleNames.get(importedFilePath) || null; } }, { key: "addSummary", value: function addSummary(summary) { this.summaryCache.set(summary.symbol, summary); } }, { key: "_loadSummaryFile", value: function _loadSummaryFile(filePath) { var _this302 = this; var hasSummary = this.loadedFilePaths.get(filePath); if (hasSummary != null) { return hasSummary; } var json = null; if (this.isLibraryFile(filePath)) { var summaryFilePath = summaryFileName(filePath); try { json = this.host.loadSummary(summaryFilePath); } catch (e) { console.error("Error loading summary file ".concat(summaryFilePath)); throw e; } } hasSummary = json != null; this.loadedFilePaths.set(filePath, hasSummary); if (json) { var _deserializeSummaries = deserializeSummaries(this.staticSymbolCache, this, filePath, json), moduleName = _deserializeSummaries.moduleName, summaries = _deserializeSummaries.summaries, importAs = _deserializeSummaries.importAs; summaries.forEach(function (summary) { return _this302.summaryCache.set(summary.symbol, summary); }); if (moduleName) { this.knownFileNameToModuleNames.set(filePath, moduleName); } importAs.forEach(function (importAs) { _this302.importAs.set(importAs.symbol, importAs.importAs); }); } return hasSummary; } }]); return AotSummaryResolver; }(); /** * @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 */ function createAotUrlResolver(host) { return { resolve: function resolve(basePath, url) { var filePath = host.resourceNameToFileName(url, basePath); if (!filePath) { throw syntaxError("Couldn't resolve resource ".concat(url, " from ").concat(basePath)); } return filePath; } }; } /** * Creates a new AotCompiler based on options and a host. */ function createAotCompiler(compilerHost, options, errorCollector) { var translations = options.translations || ''; var urlResolver = createAotUrlResolver(compilerHost); var symbolCache = new StaticSymbolCache(); var summaryResolver = new AotSummaryResolver(compilerHost, symbolCache); var symbolResolver = new StaticSymbolResolver(compilerHost, symbolCache, summaryResolver); var staticReflector = new StaticReflector(summaryResolver, symbolResolver, [], [], errorCollector); var htmlParser; if (!!options.enableIvy) { // Ivy handles i18n at the compiler level so we must use a regular parser htmlParser = new HtmlParser(); } else { htmlParser = new I18NHtmlParser(new HtmlParser(), translations, options.i18nFormat, options.missingTranslation, console); } var config = new CompilerConfig({ defaultEncapsulation: ViewEncapsulation.Emulated, useJit: false, missingTranslation: options.missingTranslation, preserveWhitespaces: options.preserveWhitespaces, strictInjectionParameters: options.strictInjectionParameters }); var normalizer = new DirectiveNormalizer({ get: function get(url) { return compilerHost.loadResource(url); } }, urlResolver, htmlParser, config); var expressionParser = new Parser$1(new Lexer()); var elementSchemaRegistry = new DomElementSchemaRegistry(); var tmplParser = new TemplateParser(config, staticReflector, expressionParser, elementSchemaRegistry, htmlParser, console, []); var resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector, errorCollector); // TODO(vicb): do not pass options.i18nFormat here var viewCompiler = new ViewCompiler(staticReflector); var typeCheckCompiler = new TypeCheckCompiler(options, staticReflector); var compiler = new AotCompiler(config, options, compilerHost, staticReflector, resolver, tmplParser, new StyleCompiler(urlResolver), viewCompiler, typeCheckCompiler, new NgModuleCompiler(staticReflector), new InjectableCompiler(staticReflector, !!options.enableIvy), new TypeScriptEmitter(), summaryResolver, symbolResolver); return { compiler: compiler, reflector: staticReflector }; } var SummaryResolver = function SummaryResolver() { _classCallCheck(this, SummaryResolver); }; var JitSummaryResolver = /*#__PURE__*/function () { function JitSummaryResolver() { _classCallCheck(this, JitSummaryResolver); this._summaries = new Map(); } _createClass2(JitSummaryResolver, [{ key: "isLibraryFile", value: function isLibraryFile() { return false; } }, { key: "toSummaryFileName", value: function toSummaryFileName(fileName) { return fileName; } }, { key: "fromSummaryFileName", value: function fromSummaryFileName(fileName) { return fileName; } }, { key: "resolveSummary", value: function resolveSummary(reference) { return this._summaries.get(reference) || null; } }, { key: "getSymbolsOf", value: function getSymbolsOf() { return []; } }, { key: "getImportAs", value: function getImportAs(reference) { return reference; } }, { key: "getKnownModuleName", value: function getKnownModuleName(fileName) { return null; } }, { key: "addSummary", value: function addSummary(summary) { this._summaries.set(summary.symbol, summary); } }]); return JitSummaryResolver; }(); /** * @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 */ function interpretStatements(statements, reflector) { var ctx = new _ExecutionContext(null, null, null, new Map()); var visitor = new StatementInterpreter(reflector); visitor.visitAllStatements(statements, ctx); var result = {}; ctx.exports.forEach(function (exportName) { result[exportName] = ctx.vars.get(exportName); }); return result; } function _executeFunctionStatements(varNames, varValues, statements, ctx, visitor) { var childCtx = ctx.createChildWihtLocalVars(); for (var i = 0; i < varNames.length; i++) { childCtx.vars.set(varNames[i], varValues[i]); } var result = visitor.visitAllStatements(statements, childCtx); return result ? result.value : null; } var _ExecutionContext = /*#__PURE__*/function () { function _ExecutionContext(parent, instance, className, vars) { _classCallCheck(this, _ExecutionContext); this.parent = parent; this.instance = instance; this.className = className; this.vars = vars; this.exports = []; } _createClass2(_ExecutionContext, [{ key: "createChildWihtLocalVars", value: function createChildWihtLocalVars() { return new _ExecutionContext(this, this.instance, this.className, new Map()); } }]); return _ExecutionContext; }(); var ReturnValue = function ReturnValue(value) { _classCallCheck(this, ReturnValue); this.value = value; }; function createDynamicClass(_classStmt, _ctx, _visitor) { var propertyDescriptors = {}; _classStmt.getters.forEach(function (getter) { // Note: use `function` instead of arrow function to capture `this` propertyDescriptors[getter.name] = { configurable: false, get: function get() { var instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars); return _executeFunctionStatements([], [], getter.body, instanceCtx, _visitor); } }; }); _classStmt.methods.forEach(function (method) { var paramNames = method.params.map(function (param) { return param.name; }); // Note: use `function` instead of arrow function to capture `this` propertyDescriptors[method.name] = { writable: false, configurable: false, value: function value() { var instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars); for (var _len5 = arguments.length, args = new Array(_len5), _key6 = 0; _key6 < _len5; _key6++) { args[_key6] = arguments[_key6]; } return _executeFunctionStatements(paramNames, args, method.body, instanceCtx, _visitor); } }; }); var ctorParamNames = _classStmt.constructorMethod.params.map(function (param) { return param.name; }); // Note: use `function` instead of arrow function to capture `this` var ctor = function ctor() { var _this303 = this; var instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars); _classStmt.fields.forEach(function (field) { _this303[field.name] = undefined; }); for (var _len6 = arguments.length, args = new Array(_len6), _key7 = 0; _key7 < _len6; _key7++) { args[_key7] = arguments[_key7]; } _executeFunctionStatements(ctorParamNames, args, _classStmt.constructorMethod.body, instanceCtx, _visitor); }; var superClass = _classStmt.parent ? _classStmt.parent.visitExpression(_visitor, _ctx) : Object; ctor.prototype = Object.create(superClass.prototype, propertyDescriptors); return ctor; } var StatementInterpreter = /*#__PURE__*/function () { function StatementInterpreter(reflector) { _classCallCheck(this, StatementInterpreter); this.reflector = reflector; } _createClass2(StatementInterpreter, [{ key: "debugAst", value: function debugAst(ast) { return debugOutputAstAsTypeScript(ast); } }, { key: "visitDeclareVarStmt", value: function visitDeclareVarStmt(stmt, ctx) { var initialValue = stmt.value ? stmt.value.visitExpression(this, ctx) : undefined; ctx.vars.set(stmt.name, initialValue); if (stmt.hasModifier(StmtModifier.Exported)) { ctx.exports.push(stmt.name); } return null; } }, { key: "visitWriteVarExpr", value: function visitWriteVarExpr(expr, ctx) { var value = expr.value.visitExpression(this, ctx); var currCtx = ctx; while (currCtx != null) { if (currCtx.vars.has(expr.name)) { currCtx.vars.set(expr.name, value); return value; } currCtx = currCtx.parent; } throw new Error("Not declared variable ".concat(expr.name)); } }, { key: "visitWrappedNodeExpr", value: function visitWrappedNodeExpr(ast, ctx) { throw new Error('Cannot interpret a WrappedNodeExpr.'); } }, { key: "visitTypeofExpr", value: function visitTypeofExpr(ast, ctx) { throw new Error('Cannot interpret a TypeofExpr'); } }, { key: "visitReadVarExpr", value: function visitReadVarExpr(ast, ctx) { var varName = ast.name; if (ast.builtin != null) { switch (ast.builtin) { case BuiltinVar.Super: return Object.getPrototypeOf(ctx.instance); case BuiltinVar.This: return ctx.instance; case BuiltinVar.CatchError: varName = CATCH_ERROR_VAR$2; break; case BuiltinVar.CatchStack: varName = CATCH_STACK_VAR$2; break; default: throw new Error("Unknown builtin variable ".concat(ast.builtin)); } } var currCtx = ctx; while (currCtx != null) { if (currCtx.vars.has(varName)) { return currCtx.vars.get(varName); } currCtx = currCtx.parent; } throw new Error("Not declared variable ".concat(varName)); } }, { key: "visitWriteKeyExpr", value: function visitWriteKeyExpr(expr, ctx) { var receiver = expr.receiver.visitExpression(this, ctx); var index = expr.index.visitExpression(this, ctx); var value = expr.value.visitExpression(this, ctx); receiver[index] = value; return value; } }, { key: "visitWritePropExpr", value: function visitWritePropExpr(expr, ctx) { var receiver = expr.receiver.visitExpression(this, ctx); var value = expr.value.visitExpression(this, ctx); receiver[expr.name] = value; return value; } }, { key: "visitInvokeMethodExpr", value: function visitInvokeMethodExpr(expr, ctx) { var receiver = expr.receiver.visitExpression(this, ctx); var args = this.visitAllExpressions(expr.args, ctx); var result; if (expr.builtin != null) { switch (expr.builtin) { case BuiltinMethod.ConcatArray: result = receiver.concat.apply(receiver, _toConsumableArray(args)); break; case BuiltinMethod.SubscribeObservable: result = receiver.subscribe({ next: args[0] }); break; case BuiltinMethod.Bind: result = receiver.bind.apply(receiver, _toConsumableArray(args)); break; default: throw new Error("Unknown builtin method ".concat(expr.builtin)); } } else { result = receiver[expr.name].apply(receiver, args); } return result; } }, { key: "visitInvokeFunctionExpr", value: function visitInvokeFunctionExpr(stmt, ctx) { var args = this.visitAllExpressions(stmt.args, ctx); var fnExpr = stmt.fn; if (fnExpr instanceof ReadVarExpr && fnExpr.builtin === BuiltinVar.Super) { ctx.instance.constructor.prototype.constructor.apply(ctx.instance, args); return null; } else { var _fn = stmt.fn.visitExpression(this, ctx); return _fn.apply(null, args); } } }, { key: "visitReturnStmt", value: function visitReturnStmt(stmt, ctx) { return new ReturnValue(stmt.value.visitExpression(this, ctx)); } }, { key: "visitDeclareClassStmt", value: function visitDeclareClassStmt(stmt, ctx) { var clazz = createDynamicClass(stmt, ctx, this); ctx.vars.set(stmt.name, clazz); if (stmt.hasModifier(StmtModifier.Exported)) { ctx.exports.push(stmt.name); } return null; } }, { key: "visitExpressionStmt", value: function visitExpressionStmt(stmt, ctx) { return stmt.expr.visitExpression(this, ctx); } }, { key: "visitIfStmt", value: function visitIfStmt(stmt, ctx) { var condition = stmt.condition.visitExpression(this, ctx); if (condition) { return this.visitAllStatements(stmt.trueCase, ctx); } else if (stmt.falseCase != null) { return this.visitAllStatements(stmt.falseCase, ctx); } return null; } }, { key: "visitTryCatchStmt", value: function visitTryCatchStmt(stmt, ctx) { try { return this.visitAllStatements(stmt.bodyStmts, ctx); } catch (e) { var childCtx = ctx.createChildWihtLocalVars(); childCtx.vars.set(CATCH_ERROR_VAR$2, e); childCtx.vars.set(CATCH_STACK_VAR$2, e.stack); return this.visitAllStatements(stmt.catchStmts, childCtx); } } }, { key: "visitThrowStmt", value: function visitThrowStmt(stmt, ctx) { throw stmt.error.visitExpression(this, ctx); } }, { key: "visitCommentStmt", value: function visitCommentStmt(stmt, context) { return null; } }, { key: "visitJSDocCommentStmt", value: function visitJSDocCommentStmt(stmt, context) { return null; } }, { key: "visitInstantiateExpr", value: function visitInstantiateExpr(ast, ctx) { var args = this.visitAllExpressions(ast.args, ctx); var clazz = ast.classExpr.visitExpression(this, ctx); return _construct(clazz, _toConsumableArray(args)); } }, { key: "visitLiteralExpr", value: function visitLiteralExpr(ast, ctx) { return ast.value; } }, { key: "visitExternalExpr", value: function visitExternalExpr(ast, ctx) { return this.reflector.resolveExternalReference(ast.value); } }, { key: "visitConditionalExpr", value: function visitConditionalExpr(ast, ctx) { if (ast.condition.visitExpression(this, ctx)) { return ast.trueCase.visitExpression(this, ctx); } else if (ast.falseCase != null) { return ast.falseCase.visitExpression(this, ctx); } return null; } }, { key: "visitNotExpr", value: function visitNotExpr(ast, ctx) { return !ast.condition.visitExpression(this, ctx); } }, { key: "visitAssertNotNullExpr", value: function visitAssertNotNullExpr(ast, ctx) { return ast.condition.visitExpression(this, ctx); } }, { key: "visitCastExpr", value: function visitCastExpr(ast, ctx) { return ast.value.visitExpression(this, ctx); } }, { key: "visitFunctionExpr", value: function visitFunctionExpr(ast, ctx) { var paramNames = ast.params.map(function (param) { return param.name; }); return _declareFn(paramNames, ast.statements, ctx, this); } }, { key: "visitDeclareFunctionStmt", value: function visitDeclareFunctionStmt(stmt, ctx) { var paramNames = stmt.params.map(function (param) { return param.name; }); ctx.vars.set(stmt.name, _declareFn(paramNames, stmt.statements, ctx, this)); if (stmt.hasModifier(StmtModifier.Exported)) { ctx.exports.push(stmt.name); } return null; } }, { key: "visitBinaryOperatorExpr", value: function visitBinaryOperatorExpr(ast, ctx) { var _this304 = this; var lhs = function lhs() { return ast.lhs.visitExpression(_this304, ctx); }; var rhs = function rhs() { return ast.rhs.visitExpression(_this304, ctx); }; switch (ast.operator) { case BinaryOperator.Equals: return lhs() == rhs(); case BinaryOperator.Identical: return lhs() === rhs(); case BinaryOperator.NotEquals: return lhs() != rhs(); case BinaryOperator.NotIdentical: return lhs() !== rhs(); case BinaryOperator.And: return lhs() && rhs(); case BinaryOperator.Or: return lhs() || rhs(); case BinaryOperator.Plus: return lhs() + rhs(); case BinaryOperator.Minus: return lhs() - rhs(); case BinaryOperator.Divide: return lhs() / rhs(); case BinaryOperator.Multiply: return lhs() * rhs(); case BinaryOperator.Modulo: return lhs() % rhs(); case BinaryOperator.Lower: return lhs() < rhs(); case BinaryOperator.LowerEquals: return lhs() <= rhs(); case BinaryOperator.Bigger: return lhs() > rhs(); case BinaryOperator.BiggerEquals: return lhs() >= rhs(); default: throw new Error("Unknown operator ".concat(ast.operator)); } } }, { key: "visitReadPropExpr", value: function visitReadPropExpr(ast, ctx) { var result; var receiver = ast.receiver.visitExpression(this, ctx); result = receiver[ast.name]; return result; } }, { key: "visitReadKeyExpr", value: function visitReadKeyExpr(ast, ctx) { var receiver = ast.receiver.visitExpression(this, ctx); var prop = ast.index.visitExpression(this, ctx); return receiver[prop]; } }, { key: "visitLiteralArrayExpr", value: function visitLiteralArrayExpr(ast, ctx) { return this.visitAllExpressions(ast.entries, ctx); } }, { key: "visitLiteralMapExpr", value: function visitLiteralMapExpr(ast, ctx) { var _this305 = this; var result = {}; ast.entries.forEach(function (entry) { return result[entry.key] = entry.value.visitExpression(_this305, ctx); }); return result; } }, { key: "visitCommaExpr", value: function visitCommaExpr(ast, context) { var values = this.visitAllExpressions(ast.parts, context); return values[values.length - 1]; } }, { key: "visitAllExpressions", value: function visitAllExpressions(expressions, ctx) { var _this306 = this; return expressions.map(function (expr) { return expr.visitExpression(_this306, ctx); }); } }, { key: "visitAllStatements", value: function visitAllStatements(statements, ctx) { for (var i = 0; i < statements.length; i++) { var stmt = statements[i]; var val = stmt.visitStatement(this, ctx); if (val instanceof ReturnValue) { return val; } } return null; } }]); return StatementInterpreter; }(); function _declareFn(varNames, statements, ctx, visitor) { return function () { for (var _len7 = arguments.length, args = new Array(_len7), _key8 = 0; _key8 < _len7; _key8++) { args[_key8] = arguments[_key8]; } return _executeFunctionStatements(varNames, args, statements, ctx, visitor); }; } var CATCH_ERROR_VAR$2 = 'error'; var CATCH_STACK_VAR$2 = 'stack'; /** * @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 internal module of the Angular compiler that begins with component types, * extracts templates, and eventually produces a compiled version of the component * ready for linking into an application. * * @security When compiling templates at runtime, you must ensure that the entire template comes * from a trusted source. Attacker-controlled data introduced by a template could expose your * application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security). */ var JitCompiler = /*#__PURE__*/function () { function JitCompiler(_metadataResolver, _templateParser, _styleCompiler, _viewCompiler, _ngModuleCompiler, _summaryResolver, _reflector, _jitEvaluator, _compilerConfig, _console, getExtraNgModuleProviders) { _classCallCheck(this, JitCompiler); this._metadataResolver = _metadataResolver; this._templateParser = _templateParser; this._styleCompiler = _styleCompiler; this._viewCompiler = _viewCompiler; this._ngModuleCompiler = _ngModuleCompiler; this._summaryResolver = _summaryResolver; this._reflector = _reflector; this._jitEvaluator = _jitEvaluator; this._compilerConfig = _compilerConfig; this._console = _console; this.getExtraNgModuleProviders = getExtraNgModuleProviders; this._compiledTemplateCache = new Map(); this._compiledHostTemplateCache = new Map(); this._compiledDirectiveWrapperCache = new Map(); this._compiledNgModuleCache = new Map(); this._sharedStylesheetCount = 0; this._addedAotSummaries = new Set(); } _createClass2(JitCompiler, [{ key: "compileModuleSync", value: function compileModuleSync(moduleType) { return SyncAsync.assertSync(this._compileModuleAndComponents(moduleType, true)); } }, { key: "compileModuleAsync", value: function compileModuleAsync(moduleType) { return Promise.resolve(this._compileModuleAndComponents(moduleType, false)); } }, { key: "compileModuleAndAllComponentsSync", value: function compileModuleAndAllComponentsSync(moduleType) { return SyncAsync.assertSync(this._compileModuleAndAllComponents(moduleType, true)); } }, { key: "compileModuleAndAllComponentsAsync", value: function compileModuleAndAllComponentsAsync(moduleType) { return Promise.resolve(this._compileModuleAndAllComponents(moduleType, false)); } }, { key: "getComponentFactory", value: function getComponentFactory(component) { var summary = this._metadataResolver.getDirectiveSummary(component); return summary.componentFactory; } }, { key: "loadAotSummaries", value: function loadAotSummaries(summaries) { this.clearCache(); this._addAotSummaries(summaries); } }, { key: "_addAotSummaries", value: function _addAotSummaries(fn) { if (this._addedAotSummaries.has(fn)) { return; } this._addedAotSummaries.add(fn); var summaries = fn(); for (var i = 0; i < summaries.length; i++) { var entry = summaries[i]; if (typeof entry === 'function') { this._addAotSummaries(entry); } else { var summary = entry; this._summaryResolver.addSummary({ symbol: summary.type.reference, metadata: null, type: summary }); } } } }, { key: "hasAotSummary", value: function hasAotSummary(ref) { return !!this._summaryResolver.resolveSummary(ref); } }, { key: "_filterJitIdentifiers", value: function _filterJitIdentifiers(ids) { var _this307 = this; return ids.map(function (mod) { return mod.reference; }).filter(function (ref) { return !_this307.hasAotSummary(ref); }); } }, { key: "_compileModuleAndComponents", value: function _compileModuleAndComponents(moduleType, isSync) { var _this308 = this; return SyncAsync.then(this._loadModules(moduleType, isSync), function () { _this308._compileComponents(moduleType, null); return _this308._compileModule(moduleType); }); } }, { key: "_compileModuleAndAllComponents", value: function _compileModuleAndAllComponents(moduleType, isSync) { var _this309 = this; return SyncAsync.then(this._loadModules(moduleType, isSync), function () { var componentFactories = []; _this309._compileComponents(moduleType, componentFactories); return { ngModuleFactory: _this309._compileModule(moduleType), componentFactories: componentFactories }; }); } }, { key: "_loadModules", value: function _loadModules(mainModule, isSync) { var _this310 = this; var loading = []; var mainNgModule = this._metadataResolver.getNgModuleMetadata(mainModule); // Note: for runtime compilation, we want to transitively compile all modules, // so we also need to load the declared directives / pipes for all nested modules. this._filterJitIdentifiers(mainNgModule.transitiveModule.modules).forEach(function (nestedNgModule) { // getNgModuleMetadata only returns null if the value passed in is not an NgModule var moduleMeta = _this310._metadataResolver.getNgModuleMetadata(nestedNgModule); _this310._filterJitIdentifiers(moduleMeta.declaredDirectives).forEach(function (ref) { var promise = _this310._metadataResolver.loadDirectiveMetadata(moduleMeta.type.reference, ref, isSync); if (promise) { loading.push(promise); } }); _this310._filterJitIdentifiers(moduleMeta.declaredPipes).forEach(function (ref) { return _this310._metadataResolver.getOrLoadPipeMetadata(ref); }); }); return SyncAsync.all(loading); } }, { key: "_compileModule", value: function _compileModule(moduleType) { var ngModuleFactory = this._compiledNgModuleCache.get(moduleType); if (!ngModuleFactory) { var moduleMeta = this._metadataResolver.getNgModuleMetadata(moduleType); // Always provide a bound Compiler var extraProviders = this.getExtraNgModuleProviders(moduleMeta.type.reference); var outputCtx = createOutputContext(); var compileResult = this._ngModuleCompiler.compile(outputCtx, moduleMeta, extraProviders); ngModuleFactory = this._interpretOrJit(ngModuleJitUrl(moduleMeta), outputCtx.statements)[compileResult.ngModuleFactoryVar]; this._compiledNgModuleCache.set(moduleMeta.type.reference, ngModuleFactory); } return ngModuleFactory; } /** * @internal */ }, { key: "_compileComponents", value: function _compileComponents(mainModule, allComponentFactories) { var _this311 = this; var ngModule = this._metadataResolver.getNgModuleMetadata(mainModule); var moduleByJitDirective = new Map(); var templates = new Set(); var transJitModules = this._filterJitIdentifiers(ngModule.transitiveModule.modules); transJitModules.forEach(function (localMod) { var localModuleMeta = _this311._metadataResolver.getNgModuleMetadata(localMod); _this311._filterJitIdentifiers(localModuleMeta.declaredDirectives).forEach(function (dirRef) { moduleByJitDirective.set(dirRef, localModuleMeta); var dirMeta = _this311._metadataResolver.getDirectiveMetadata(dirRef); if (dirMeta.isComponent) { templates.add(_this311._createCompiledTemplate(dirMeta, localModuleMeta)); if (allComponentFactories) { var template = _this311._createCompiledHostTemplate(dirMeta.type.reference, localModuleMeta); templates.add(template); allComponentFactories.push(dirMeta.componentFactory); } } }); }); transJitModules.forEach(function (localMod) { var localModuleMeta = _this311._metadataResolver.getNgModuleMetadata(localMod); _this311._filterJitIdentifiers(localModuleMeta.declaredDirectives).forEach(function (dirRef) { var dirMeta = _this311._metadataResolver.getDirectiveMetadata(dirRef); if (dirMeta.isComponent) { dirMeta.entryComponents.forEach(function (entryComponentType) { var moduleMeta = moduleByJitDirective.get(entryComponentType.componentType); templates.add(_this311._createCompiledHostTemplate(entryComponentType.componentType, moduleMeta)); }); } }); localModuleMeta.entryComponents.forEach(function (entryComponentType) { if (!_this311.hasAotSummary(entryComponentType.componentType)) { var moduleMeta = moduleByJitDirective.get(entryComponentType.componentType); templates.add(_this311._createCompiledHostTemplate(entryComponentType.componentType, moduleMeta)); } }); }); templates.forEach(function (template) { return _this311._compileTemplate(template); }); } }, { key: "clearCacheFor", value: function clearCacheFor(type) { this._compiledNgModuleCache["delete"](type); this._metadataResolver.clearCacheFor(type); this._compiledHostTemplateCache["delete"](type); var compiledTemplate = this._compiledTemplateCache.get(type); if (compiledTemplate) { this._compiledTemplateCache["delete"](type); } } }, { key: "clearCache", value: function clearCache() { // Note: don't clear the _addedAotSummaries, as they don't change! this._metadataResolver.clearCache(); this._compiledTemplateCache.clear(); this._compiledHostTemplateCache.clear(); this._compiledNgModuleCache.clear(); } }, { key: "_createCompiledHostTemplate", value: function _createCompiledHostTemplate(compType, ngModule) { if (!ngModule) { throw new Error("Component ".concat(stringify(compType), " is not part of any NgModule or the module has not been imported into your module.")); } var compiledTemplate = this._compiledHostTemplateCache.get(compType); if (!compiledTemplate) { var compMeta = this._metadataResolver.getDirectiveMetadata(compType); assertComponent(compMeta); var hostMeta = this._metadataResolver.getHostComponentMetadata(compMeta, compMeta.componentFactory.viewDefFactory); compiledTemplate = new CompiledTemplate(true, compMeta.type, hostMeta, ngModule, [compMeta.type]); this._compiledHostTemplateCache.set(compType, compiledTemplate); } return compiledTemplate; } }, { key: "_createCompiledTemplate", value: function _createCompiledTemplate(compMeta, ngModule) { var compiledTemplate = this._compiledTemplateCache.get(compMeta.type.reference); if (!compiledTemplate) { assertComponent(compMeta); compiledTemplate = new CompiledTemplate(false, compMeta.type, compMeta, ngModule, ngModule.transitiveModule.directives); this._compiledTemplateCache.set(compMeta.type.reference, compiledTemplate); } return compiledTemplate; } }, { key: "_compileTemplate", value: function _compileTemplate(template) { var _this312 = this; if (template.isCompiled) { return; } var compMeta = template.compMeta; var externalStylesheetsByModuleUrl = new Map(); var outputContext = createOutputContext(); var componentStylesheet = this._styleCompiler.compileComponent(outputContext, compMeta); compMeta.template.externalStylesheets.forEach(function (stylesheetMeta) { var compiledStylesheet = _this312._styleCompiler.compileStyles(createOutputContext(), compMeta, stylesheetMeta); externalStylesheetsByModuleUrl.set(stylesheetMeta.moduleUrl, compiledStylesheet); }); this._resolveStylesCompileResult(componentStylesheet, externalStylesheetsByModuleUrl); var pipes = template.ngModule.transitiveModule.pipes.map(function (pipe) { return _this312._metadataResolver.getPipeSummary(pipe.reference); }); var _this$_parseTemplate3 = this._parseTemplate(compMeta, template.ngModule, template.directives), parsedTemplate = _this$_parseTemplate3.template, usedPipes = _this$_parseTemplate3.pipes; var compileResult = this._viewCompiler.compileComponent(outputContext, compMeta, parsedTemplate, variable(componentStylesheet.stylesVar), usedPipes); var evalResult = this._interpretOrJit(templateJitUrl(template.ngModule.type, template.compMeta), outputContext.statements); var viewClass = evalResult[compileResult.viewClassVar]; var rendererType = evalResult[compileResult.rendererTypeVar]; template.compiled(viewClass, rendererType); } }, { key: "_parseTemplate", value: function _parseTemplate(compMeta, ngModule, directiveIdentifiers) { var _this313 = this; // Note: ! is ok here as components always have a template. var preserveWhitespaces = compMeta.template.preserveWhitespaces; var directives = directiveIdentifiers.map(function (dir) { return _this313._metadataResolver.getDirectiveSummary(dir.reference); }); var pipes = ngModule.transitiveModule.pipes.map(function (pipe) { return _this313._metadataResolver.getPipeSummary(pipe.reference); }); return this._templateParser.parse(compMeta, compMeta.template.htmlAst, directives, pipes, ngModule.schemas, templateSourceUrl(ngModule.type, compMeta, compMeta.template), preserveWhitespaces); } }, { key: "_resolveStylesCompileResult", value: function _resolveStylesCompileResult(result, externalStylesheetsByModuleUrl) { var _this314 = this; result.dependencies.forEach(function (dep, i) { var nestedCompileResult = externalStylesheetsByModuleUrl.get(dep.moduleUrl); var nestedStylesArr = _this314._resolveAndEvalStylesCompileResult(nestedCompileResult, externalStylesheetsByModuleUrl); dep.setValue(nestedStylesArr); }); } }, { key: "_resolveAndEvalStylesCompileResult", value: function _resolveAndEvalStylesCompileResult(result, externalStylesheetsByModuleUrl) { this._resolveStylesCompileResult(result, externalStylesheetsByModuleUrl); return this._interpretOrJit(sharedStylesheetJitUrl(result.meta, this._sharedStylesheetCount++), result.outputCtx.statements)[result.stylesVar]; } }, { key: "_interpretOrJit", value: function _interpretOrJit(sourceUrl, statements) { if (!this._compilerConfig.useJit) { return interpretStatements(statements, this._reflector); } else { return this._jitEvaluator.evaluateStatements(sourceUrl, statements, this._reflector, this._compilerConfig.jitDevMode); } } }]); return JitCompiler; }(); var CompiledTemplate = /*#__PURE__*/function () { function CompiledTemplate(isHost, compType, compMeta, ngModule, directives) { _classCallCheck(this, CompiledTemplate); this.isHost = isHost; this.compType = compType; this.compMeta = compMeta; this.ngModule = ngModule; this.directives = directives; this._viewClass = null; this.isCompiled = false; } _createClass2(CompiledTemplate, [{ key: "compiled", value: function compiled(viewClass, rendererType) { this._viewClass = viewClass; this.compMeta.componentViewType.setDelegate(viewClass); for (var prop in rendererType) { this.compMeta.rendererType[prop] = rendererType[prop]; } this.isCompiled = true; } }]); return CompiledTemplate; }(); function assertComponent(meta) { if (!meta.isComponent) { throw new Error("Could not compile '".concat(identifierName(meta.type), "' because it is not a component.")); } } function createOutputContext() { var importExpr$1 = function importExpr$1(symbol) { return importExpr({ name: identifierName(symbol), moduleName: null, runtime: symbol }); }; return { statements: [], genFilePath: '', importExpr: importExpr$1, constantPool: new ConstantPool() }; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Provides access to reflection data about symbols that the compiler needs. */ var CompileReflector = function CompileReflector() { _classCallCheck(this, CompileReflector); }; /** * @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 */ /** * Create a {@link UrlResolver} with no package prefix. */ function createUrlResolverWithoutPackagePrefix() { return new UrlResolver(); } function createOfflineCompileUrlResolver() { return new UrlResolver('.'); } var UrlResolver = /*#__PURE__*/function () { function UrlResolverImpl() { var _packagePrefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; _classCallCheck(this, UrlResolverImpl); this._packagePrefix = _packagePrefix; } /** * Resolves the `url` given the `baseUrl`: * - when the `url` is null, the `baseUrl` is returned, * - if `url` is relative ('path/to/here', './path/to/here'), the resolved url is a combination of * `baseUrl` and `url`, * - if `url` is absolute (it has a scheme: 'http://', 'https://' or start with '/'), the `url` is * returned as is (ignoring the `baseUrl`) */ _createClass2(UrlResolverImpl, [{ key: "resolve", value: function resolve(baseUrl, url) { var resolvedUrl = url; if (baseUrl != null && baseUrl.length > 0) { resolvedUrl = _resolveUrl(baseUrl, resolvedUrl); } var resolvedParts = _split(resolvedUrl); var prefix = this._packagePrefix; if (prefix != null && resolvedParts != null && resolvedParts[_ComponentIndex.Scheme] == 'package') { var path = resolvedParts[_ComponentIndex.Path]; prefix = prefix.replace(/\/+$/, ''); path = path.replace(/^\/+/, ''); return "".concat(prefix, "/").concat(path); } return resolvedUrl; } }]); return UrlResolverImpl; }(); /** * Extract the scheme of a URL. */ function getUrlScheme(url) { var match = _split(url); return match && match[_ComponentIndex.Scheme] || ''; } // The code below is adapted from Traceur: // https://github.com/google/traceur-compiler/blob/9511c1dafa972bf0de1202a8a863bad02f0f95a8/src/runtime/url.js /** * Builds a URI string from already-encoded parts. * * No encoding is performed. Any component may be omitted as either null or * undefined. * * @param opt_scheme The scheme such as 'http'. * @param opt_userInfo The user name before the '@'. * @param opt_domain The domain such as 'www.google.com', already * URI-encoded. * @param opt_port The port number. * @param opt_path The path, already URI-encoded. If it is not * empty, it must begin with a slash. * @param opt_queryData The URI-encoded query data. * @param opt_fragment The URI-encoded fragment identifier. * @return The fully combined URI. */ function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) { var out = []; if (opt_scheme != null) { out.push(opt_scheme + ':'); } if (opt_domain != null) { out.push('//'); if (opt_userInfo != null) { out.push(opt_userInfo + '@'); } out.push(opt_domain); if (opt_port != null) { out.push(':' + opt_port); } } if (opt_path != null) { out.push(opt_path); } if (opt_queryData != null) { out.push('?' + opt_queryData); } if (opt_fragment != null) { out.push('#' + opt_fragment); } return out.join(''); } /** * A regular expression for breaking a URI into its component parts. * * {@link http://www.gbiv.com/protocols/uri/rfc/rfc3986.html#RFC2234} says * As the "first-match-wins" algorithm is identical to the "greedy" * disambiguation method used by POSIX regular expressions, it is natural and * commonplace to use a regular expression for parsing the potential five * components of a URI reference. * * The following line is the regular expression for breaking-down a * well-formed URI reference into its components. * * <pre> * ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))? * 12 3 4 5 6 7 8 9 * </pre> * * The numbers in the second line above are only to assist readability; they * indicate the reference points for each subexpression (i.e., each paired * parenthesis). We refer to the value matched for subexpression <n> as $<n>. * For example, matching the above expression to * <pre> * http://www.ics.uci.edu/pub/ietf/uri/#Related * </pre> * results in the following subexpression matches: * <pre> * $1 = http: * $2 = http * $3 = //www.ics.uci.edu * $4 = www.ics.uci.edu * $5 = /pub/ietf/uri/ * $6 = <undefined> * $7 = <undefined> * $8 = #Related * $9 = Related * </pre> * where <undefined> indicates that the component is not present, as is the * case for the query component in the above example. Therefore, we can * determine the value of the five components as * <pre> * scheme = $2 * authority = $4 * path = $5 * query = $7 * fragment = $9 * </pre> * * The regular expression has been modified slightly to expose the * userInfo, domain, and port separately from the authority. * The modified version yields * <pre> * $1 = http scheme * $2 = <undefined> userInfo -\ * $3 = www.ics.uci.edu domain | authority * $4 = <undefined> port -/ * $5 = /pub/ietf/uri/ path * $6 = <undefined> query without ? * $7 = Related fragment without # * </pre> * @internal */ var _splitRe = new RegExp('^' + '(?:' + '([^:/?#.]+)' + // scheme - ignore special characters // used by other URL parts such as :, // ?, /, #, and . ':)?' + '(?://' + '(?:([^/?#]*)@)?' + // userInfo "([\\w\\d\\-\\u0100-\\uffff.%]*)" + // domain - restrict to letters, // digits, dashes, dots, percent // escapes, and unicode characters. '(?::([0-9]+))?' + // port ')?' + '([^?#]+)?' + // path '(?:\\?([^#]*))?' + // query '(?:#(.*))?' + // fragment '$'); /** * The index of each URI component in the return value of goog.uri.utils.split. * @enum {number} */ var _ComponentIndex; (function (_ComponentIndex) { _ComponentIndex[_ComponentIndex["Scheme"] = 1] = "Scheme"; _ComponentIndex[_ComponentIndex["UserInfo"] = 2] = "UserInfo"; _ComponentIndex[_ComponentIndex["Domain"] = 3] = "Domain"; _ComponentIndex[_ComponentIndex["Port"] = 4] = "Port"; _ComponentIndex[_ComponentIndex["Path"] = 5] = "Path"; _ComponentIndex[_ComponentIndex["QueryData"] = 6] = "QueryData"; _ComponentIndex[_ComponentIndex["Fragment"] = 7] = "Fragment"; })(_ComponentIndex || (_ComponentIndex = {})); /** * Splits a URI into its component parts. * * Each component can be accessed via the component indices; for example: * <pre> * goog.uri.utils.split(someStr)[goog.uri.utils.CompontentIndex.QUERY_DATA]; * </pre> * * @param uri The URI string to examine. * @return Each component still URI-encoded. * Each component that is present will contain the encoded value, whereas * components that are not present will be undefined or empty, depending * on the browser's regular expression implementation. Never null, since * arbitrary strings may still look like path names. */ function _split(uri) { return uri.match(_splitRe); } /** * Removes dot segments in given path component, as described in * RFC 3986, section 5.2.4. * * @param path A non-empty path component. * @return Path component with removed dot segments. */ function _removeDotSegments(path) { if (path == '/') return '/'; var leadingSlash = path[0] == '/' ? '/' : ''; var trailingSlash = path[path.length - 1] === '/' ? '/' : ''; var segments = path.split('/'); var out = []; var up = 0; for (var pos = 0; pos < segments.length; pos++) { var segment = segments[pos]; switch (segment) { case '': case '.': break; case '..': if (out.length > 0) { out.pop(); } else { up++; } break; default: out.push(segment); } } if (leadingSlash == '') { while (up-- > 0) { out.unshift('..'); } if (out.length === 0) out.push('.'); } return leadingSlash + out.join('/') + trailingSlash; } /** * Takes an array of the parts from split and canonicalizes the path part * and then joins all the parts. */ function _joinAndCanonicalizePath(parts) { var path = parts[_ComponentIndex.Path]; path = path == null ? '' : _removeDotSegments(path); parts[_ComponentIndex.Path] = path; return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]); } /** * Resolves a URL. * @param base The URL acting as the base URL. * @param to The URL to resolve. */ function _resolveUrl(base, url) { var parts = _split(encodeURI(url)); var baseParts = _split(base); if (parts[_ComponentIndex.Scheme] != null) { return _joinAndCanonicalizePath(parts); } else { parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme]; } for (var i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) { if (parts[i] == null) { parts[i] = baseParts[i]; } } if (parts[_ComponentIndex.Path][0] == '/') { return _joinAndCanonicalizePath(parts); } var path = baseParts[_ComponentIndex.Path]; if (path == null) path = '/'; var index = path.lastIndexOf('/'); path = path.substring(0, index + 1) + parts[_ComponentIndex.Path]; parts[_ComponentIndex.Path] = path; return _joinAndCanonicalizePath(parts); } /** * @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 Extractor = /*#__PURE__*/function () { function Extractor(host, staticSymbolResolver, messageBundle, metadataResolver) { _classCallCheck(this, Extractor); this.host = host; this.staticSymbolResolver = staticSymbolResolver; this.messageBundle = messageBundle; this.metadataResolver = metadataResolver; } _createClass2(Extractor, [{ key: "extract", value: function extract(rootFiles) { var _this315 = this; var _analyzeAndValidateNg = analyzeAndValidateNgModules(rootFiles, this.host, this.staticSymbolResolver, this.metadataResolver), files = _analyzeAndValidateNg.files, ngModules = _analyzeAndValidateNg.ngModules; return Promise.all(ngModules.map(function (ngModule) { return _this315.metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false); })).then(function () { var errors = []; files.forEach(function (file) { var compMetas = []; file.directives.forEach(function (directiveType) { var dirMeta = _this315.metadataResolver.getDirectiveMetadata(directiveType); if (dirMeta && dirMeta.isComponent) { compMetas.push(dirMeta); } }); compMetas.forEach(function (compMeta) { var html = compMeta.template.template; // Template URL points to either an HTML or TS file depending on // whether the file is used with `templateUrl:` or `template:`, // respectively. var templateUrl = compMeta.template.templateUrl; var interpolationConfig = InterpolationConfig.fromArray(compMeta.template.interpolation); errors.push.apply(errors, _toConsumableArray(_this315.messageBundle.updateFromTemplate(html, templateUrl, interpolationConfig))); }); }); if (errors.length) { throw new Error(errors.map(function (e) { return e.toString(); }).join('\n')); } return _this315.messageBundle; }); } }], [{ key: "create", value: function create(host, locale) { var htmlParser = new HtmlParser(); var urlResolver = createAotUrlResolver(host); var symbolCache = new StaticSymbolCache(); var summaryResolver = new AotSummaryResolver(host, symbolCache); var staticSymbolResolver = new StaticSymbolResolver(host, symbolCache, summaryResolver); var staticReflector = new StaticReflector(summaryResolver, staticSymbolResolver); var config = new CompilerConfig({ defaultEncapsulation: ViewEncapsulation.Emulated, useJit: false }); var normalizer = new DirectiveNormalizer({ get: function get(url) { return host.loadResource(url); } }, urlResolver, htmlParser, config); var elementSchemaRegistry = new DomElementSchemaRegistry(); var resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector); // TODO(vicb): implicit tags & attributes var messageBundle = new MessageBundle(htmlParser, [], {}, locale); var extractor = new Extractor(host, staticSymbolResolver, messageBundle, resolver); return { extractor: extractor, staticReflector: staticReflector }; } }]); return Extractor; }(); /** * @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 */ /** * Processes `Target`s with a given set of directives and performs a binding operation, which * returns an object similar to TypeScript's `ts.TypeChecker` that contains knowledge about the * target. */ var R3TargetBinder = /*#__PURE__*/function () { function R3TargetBinder(directiveMatcher) { _classCallCheck(this, R3TargetBinder); this.directiveMatcher = directiveMatcher; } /** * Perform a binding operation on the given `Target` and return a `BoundTarget` which contains * metadata about the types referenced in the template. */ _createClass2(R3TargetBinder, [{ key: "bind", value: function bind(target) { if (!target.template) { // TODO(alxhub): handle targets which contain things like HostBindings, etc. throw new Error('Binding without a template not yet supported'); } // First, parse the template into a `Scope` structure. This operation captures the syntactic // scopes in the template and makes them available for later use. var scope = Scope.apply(target.template); // Next, perform directive matching on the template using the `DirectiveBinder`. This returns: // - directives: Map of nodes (elements & ng-templates) to the directives on them. // - bindings: Map of inputs, outputs, and attributes to the directive/element that claims // them. TODO(alxhub): handle multiple directives claiming an input/output/etc. // - references: Map of #references to their targets. var _DirectiveBinder$appl = DirectiveBinder.apply(target.template, this.directiveMatcher), directives = _DirectiveBinder$appl.directives, bindings = _DirectiveBinder$appl.bindings, references = _DirectiveBinder$appl.references; // Finally, run the TemplateBinder to bind references, variables, and other entities within the // template. This extracts all the metadata that doesn't depend on directive matching. var _TemplateBinder$apply = TemplateBinder.apply(target.template, scope), expressions = _TemplateBinder$apply.expressions, symbols = _TemplateBinder$apply.symbols, nestingLevel = _TemplateBinder$apply.nestingLevel, usedPipes = _TemplateBinder$apply.usedPipes; return new R3BoundTarget(target, directives, bindings, references, expressions, symbols, nestingLevel, usedPipes); } }]); return R3TargetBinder; }(); /** * Represents a binding scope within a template. * * Any variables, references, or other named entities declared within the template will * be captured and available by name in `namedEntities`. Additionally, child templates will * be analyzed and have their child `Scope`s available in `childScopes`. */ var Scope = /*#__PURE__*/function () { function Scope(parentScope) { _classCallCheck(this, Scope); this.parentScope = parentScope; /** * Named members of the `Scope`, such as `Reference`s or `Variable`s. */ this.namedEntities = new Map(); /** * Child `Scope`s for immediately nested `Template`s. */ this.childScopes = new Map(); } /** * Process a template (either as a `Template` sub-template with variables, or a plain array of * template `Node`s) and construct its `Scope`. */ _createClass2(Scope, [{ key: "ingest", /** * Internal method to process the template and populate the `Scope`. */ value: function ingest(template) { var _this316 = this; if (template instanceof Template) { // Variables on an <ng-template> are defined in the inner scope. template.variables.forEach(function (node) { return _this316.visitVariable(node); }); // Process the nodes of the template. template.children.forEach(function (node) { return node.visit(_this316); }); } else { // No overarching `Template` instance, so process the nodes directly. template.forEach(function (node) { return node.visit(_this316); }); } } }, { key: "visitElement", value: function visitElement(element) { var _this317 = this; // `Element`s in the template may have `Reference`s which are captured in the scope. element.references.forEach(function (node) { return _this317.visitReference(node); }); // Recurse into the `Element`'s children. element.children.forEach(function (node) { return node.visit(_this317); }); } }, { key: "visitTemplate", value: function visitTemplate(template) { var _this318 = this; // References on a <ng-template> are defined in the outer scope, so capture them before // processing the template's child scope. template.references.forEach(function (node) { return _this318.visitReference(node); }); // Next, create an inner scope and process the template within it. var scope = new Scope(this); scope.ingest(template); this.childScopes.set(template, scope); } }, { key: "visitVariable", value: function visitVariable(variable) { // Declare the variable if it's not already. this.maybeDeclare(variable); } }, { key: "visitReference", value: function visitReference(reference) { // Declare the variable if it's not already. this.maybeDeclare(reference); } // Unused visitors. }, { key: "visitContent", value: function visitContent(content) {} }, { key: "visitBoundAttribute", value: function visitBoundAttribute(attr) {} }, { key: "visitBoundEvent", value: function visitBoundEvent(event) {} }, { key: "visitBoundText", value: function visitBoundText(text) {} }, { key: "visitText", value: function visitText(text) {} }, { key: "visitTextAttribute", value: function visitTextAttribute(attr) {} }, { key: "visitIcu", value: function visitIcu(icu) {} }, { key: "maybeDeclare", value: function maybeDeclare(thing) { // Declare something with a name, as long as that name isn't taken. if (!this.namedEntities.has(thing.name)) { this.namedEntities.set(thing.name, thing); } } /** * Look up a variable within this `Scope`. * * This can recurse into a parent `Scope` if it's available. */ }, { key: "lookup", value: function lookup(name) { if (this.namedEntities.has(name)) { // Found in the local scope. return this.namedEntities.get(name); } else if (this.parentScope !== undefined) { // Not in the local scope, but there's a parent scope so check there. return this.parentScope.lookup(name); } else { // At the top level and it wasn't found. return null; } } /** * Get the child scope for a `Template`. * * This should always be defined. */ }, { key: "getChildScope", value: function getChildScope(template) { var res = this.childScopes.get(template); if (res === undefined) { throw new Error("Assertion error: child scope for ".concat(template, " not found")); } return res; } }], [{ key: "apply", value: function apply(template) { var scope = new Scope(); scope.ingest(template); return scope; } }]); return Scope; }(); /** * Processes a template and matches directives on nodes (elements and templates). * * Usually used via the static `apply()` method. */ var DirectiveBinder = /*#__PURE__*/function () { function DirectiveBinder(matcher, directives, bindings, references) { _classCallCheck(this, DirectiveBinder); this.matcher = matcher; this.directives = directives; this.bindings = bindings; this.references = references; } /** * Process a template (list of `Node`s) and perform directive matching against each node. * * @param template the list of template `Node`s to match (recursively). * @param selectorMatcher a `SelectorMatcher` containing the directives that are in scope for * this template. * @returns three maps which contain information about directives in the template: the * `directives` map which lists directives matched on each node, the `bindings` map which * indicates which directives claimed which bindings (inputs, outputs, etc), and the `references` * map which resolves #references (`Reference`s) within the template to the named directive or * template node. */ _createClass2(DirectiveBinder, [{ key: "ingest", value: function ingest(template) { var _this319 = this; template.forEach(function (node) { return node.visit(_this319); }); } }, { key: "visitElement", value: function visitElement(element) { this.visitElementOrTemplate(element.name, element); } }, { key: "visitTemplate", value: function visitTemplate(template) { this.visitElementOrTemplate('ng-template', template); } }, { key: "visitElementOrTemplate", value: function visitElementOrTemplate(tag, node) { var _this320 = this; // First, determine the HTML shape of the node for the purpose of directive matching. // Do this by building up a `CssSelector` for the node. var cssSelector = new CssSelector(); cssSelector.setElement(tag); // Add attributes to the CSS selector. var attrs = getAttrsForDirectiveMatching(node); Object.getOwnPropertyNames(attrs).forEach(function (name) { var value = attrs[name]; cssSelector.addAttribute(name, value); // Treat the 'class' attribute specially. if (name.toLowerCase() === 'class') { var classes = value.trim().split(/\s+/g); classes.forEach(function (className) { return cssSelector.addClassName(className); }); } }); // Next, use the `SelectorMatcher` to get the list of directives on the node. var directives = []; this.matcher.match(cssSelector, function (_, directive) { return directives.push(directive); }); if (directives.length > 0) { this.directives.set(node, directives); } // Resolve any references that are created on this node. node.references.forEach(function (ref) { var dirTarget = null; // If the reference expression is empty, then it matches the "primary" directive on the node // (if there is one). Otherwise it matches the host node itself (either an element or // <ng-template> node). if (ref.value.trim() === '') { // This could be a reference to a component if there is one. dirTarget = directives.find(function (dir) { return dir.isComponent; }) || null; } else { // This is a reference to a directive exported via exportAs. One should exist. dirTarget = directives.find(function (dir) { return dir.exportAs !== null && dir.exportAs.some(function (value) { return value === ref.value; }); }) || null; // Check if a matching directive was found, and error if it wasn't. if (dirTarget === null) { // TODO(alxhub): Return an error value here that can be used for template validation. throw new Error("Assertion error: failed to find directive with exportAs: ".concat(ref.value)); } } if (dirTarget !== null) { // This reference points to a directive. _this320.references.set(ref, { directive: dirTarget, node: node }); } else { // This reference points to the node itself. _this320.references.set(ref, node); } }); // Associate attributes/bindings on the node with directives or with the node itself. var processAttribute = function processAttribute(attribute) { var dir = directives.find(function (dir) { return dir.inputs.hasOwnProperty(attribute.name); }); if (dir !== undefined) { _this320.bindings.set(attribute, dir); } else { _this320.bindings.set(attribute, node); } }; node.attributes.forEach(processAttribute); node.inputs.forEach(processAttribute); node.outputs.forEach(processAttribute); if (node instanceof Template) { node.templateAttrs.forEach(processAttribute); } // Recurse into the node's children. node.children.forEach(function (child) { return child.visit(_this320); }); } // Unused visitors. }, { key: "visitContent", value: function visitContent(content) {} }, { key: "visitVariable", value: function visitVariable(variable) {} }, { key: "visitReference", value: function visitReference(reference) {} }, { key: "visitTextAttribute", value: function visitTextAttribute(attribute) {} }, { key: "visitBoundAttribute", value: function visitBoundAttribute(attribute) {} }, { key: "visitBoundEvent", value: function visitBoundEvent(attribute) {} }, { key: "visitBoundAttributeOrEvent", value: function visitBoundAttributeOrEvent(node) {} }, { key: "visitText", value: function visitText(text) {} }, { key: "visitBoundText", value: function visitBoundText(text) {} }, { key: "visitIcu", value: function visitIcu(icu) {} }], [{ key: "apply", value: function apply(template, selectorMatcher) { var directives = new Map(); var bindings = new Map(); var references = new Map(); var matcher = new DirectiveBinder(selectorMatcher, directives, bindings, references); matcher.ingest(template); return { directives: directives, bindings: bindings, references: references }; } }]); return DirectiveBinder; }(); /** * Processes a template and extract metadata about expressions and symbols within. * * This is a companion to the `DirectiveBinder` that doesn't require knowledge of directives matched * within the template in order to operate. * * Expressions are visited by the superclass `RecursiveAstVisitor`, with custom logic provided * by overridden methods from that visitor. */ var TemplateBinder = /*#__PURE__*/function (_RecursiveAstVisitor$2) { _inherits(TemplateBinder, _RecursiveAstVisitor$2); var _super106 = _createSuper(TemplateBinder); function TemplateBinder(bindings, symbols, usedPipes, nestingLevel, scope, template, level) { var _this321; _classCallCheck(this, TemplateBinder); _this321 = _super106.call(this); _this321.bindings = bindings; _this321.symbols = symbols; _this321.usedPipes = usedPipes; _this321.nestingLevel = nestingLevel; _this321.scope = scope; _this321.template = template; _this321.level = level; _this321.pipesUsed = []; // Save a bit of processing time by constructing this closure in advance. _this321.visitNode = function (node) { return node.visit(_assertThisInitialized(_this321)); }; return _this321; } /** * Process a template and extract metadata about expressions and symbols within. * * @param template the nodes of the template to process * @param scope the `Scope` of the template being processed. * @returns three maps which contain metadata about the template: `expressions` which interprets * special `AST` nodes in expressions as pointing to references or variables declared within the * template, `symbols` which maps those variables and references to the nested `Template` which * declares them, if any, and `nestingLevel` which associates each `Template` with a integer * nesting level (how many levels deep within the template structure the `Template` is), starting * at 1. */ _createClass2(TemplateBinder, [{ key: "ingest", value: function ingest(template) { if (template instanceof Template) { // For <ng-template>s, process only variables and child nodes. Inputs, outputs, templateAttrs, // and references were all processed in the scope of the containing template. template.variables.forEach(this.visitNode); template.children.forEach(this.visitNode); // Set the nesting level. this.nestingLevel.set(template, this.level); } else { // Visit each node from the top-level template. template.forEach(this.visitNode); } } }, { key: "visitElement", value: function visitElement(element) { // Visit the inputs, outputs, and children of the element. element.inputs.forEach(this.visitNode); element.outputs.forEach(this.visitNode); element.children.forEach(this.visitNode); } }, { key: "visitTemplate", value: function visitTemplate(template) { // First, visit inputs, outputs and template attributes of the template node. template.inputs.forEach(this.visitNode); template.outputs.forEach(this.visitNode); template.templateAttrs.forEach(this.visitNode); // References are also evaluated in the outer context. template.references.forEach(this.visitNode); // Next, recurse into the template using its scope, and bumping the nesting level up by one. var childScope = this.scope.getChildScope(template); var binder = new TemplateBinder(this.bindings, this.symbols, this.usedPipes, this.nestingLevel, childScope, template, this.level + 1); binder.ingest(template); } }, { key: "visitVariable", value: function visitVariable(variable) { // Register the `Variable` as a symbol in the current `Template`. if (this.template !== null) { this.symbols.set(variable, this.template); } } }, { key: "visitReference", value: function visitReference(reference) { // Register the `Reference` as a symbol in the current `Template`. if (this.template !== null) { this.symbols.set(reference, this.template); } } // Unused template visitors }, { key: "visitText", value: function visitText(text) {} }, { key: "visitContent", value: function visitContent(content) {} }, { key: "visitTextAttribute", value: function visitTextAttribute(attribute) {} }, { key: "visitIcu", value: function visitIcu(icu) {} // The remaining visitors are concerned with processing AST expressions within template bindings }, { key: "visitBoundAttribute", value: function visitBoundAttribute(attribute) { attribute.value.visit(this); } }, { key: "visitBoundEvent", value: function visitBoundEvent(event) { event.handler.visit(this); } }, { key: "visitBoundText", value: function visitBoundText(text) { text.value.visit(this); } }, { key: "visitPipe", value: function visitPipe(ast, context) { this.usedPipes.add(ast.name); return _get(_getPrototypeOf(TemplateBinder.prototype), "visitPipe", this).call(this, ast, context); } // These five types of AST expressions can refer to expression roots, which could be variables // or references in the current scope. }, { key: "visitPropertyRead", value: function visitPropertyRead(ast, context) { this.maybeMap(context, ast, ast.name); return _get(_getPrototypeOf(TemplateBinder.prototype), "visitPropertyRead", this).call(this, ast, context); } }, { key: "visitSafePropertyRead", value: function visitSafePropertyRead(ast, context) { this.maybeMap(context, ast, ast.name); return _get(_getPrototypeOf(TemplateBinder.prototype), "visitSafePropertyRead", this).call(this, ast, context); } }, { key: "visitPropertyWrite", value: function visitPropertyWrite(ast, context) { this.maybeMap(context, ast, ast.name); return _get(_getPrototypeOf(TemplateBinder.prototype), "visitPropertyWrite", this).call(this, ast, context); } }, { key: "visitMethodCall", value: function visitMethodCall(ast, context) { this.maybeMap(context, ast, ast.name); return _get(_getPrototypeOf(TemplateBinder.prototype), "visitMethodCall", this).call(this, ast, context); } }, { key: "visitSafeMethodCall", value: function visitSafeMethodCall(ast, context) { this.maybeMap(context, ast, ast.name); return _get(_getPrototypeOf(TemplateBinder.prototype), "visitSafeMethodCall", this).call(this, ast, context); } }, { key: "maybeMap", value: function maybeMap(scope, ast, name) { // If the receiver of the expression isn't the `ImplicitReceiver`, this isn't the root of an // `AST` expression that maps to a `Variable` or `Reference`. if (!(ast.receiver instanceof ImplicitReceiver)) { return; } // Check whether the name exists in the current scope. If so, map it. Otherwise, the name is // probably a property on the top-level component context. var target = this.scope.lookup(name); if (target !== null) { this.bindings.set(ast, target); } } }], [{ key: "apply", value: function apply(template, scope) { var expressions = new Map(); var symbols = new Map(); var nestingLevel = new Map(); var usedPipes = new Set(); // The top-level template has nesting level 0. var binder = new TemplateBinder(expressions, symbols, usedPipes, nestingLevel, scope, template instanceof Template ? template : null, 0); binder.ingest(template); return { expressions: expressions, symbols: symbols, nestingLevel: nestingLevel, usedPipes: usedPipes }; } }]); return TemplateBinder; }(RecursiveAstVisitor$1); /** * Metadata container for a `Target` that allows queries for specific bits of metadata. * * See `BoundTarget` for documentation on the individual methods. */ var R3BoundTarget = /*#__PURE__*/function () { function R3BoundTarget(target, directives, bindings, references, exprTargets, symbols, nestingLevel, usedPipes) { _classCallCheck(this, R3BoundTarget); this.target = target; this.directives = directives; this.bindings = bindings; this.references = references; this.exprTargets = exprTargets; this.symbols = symbols; this.nestingLevel = nestingLevel; this.usedPipes = usedPipes; } _createClass2(R3BoundTarget, [{ key: "getDirectivesOfNode", value: function getDirectivesOfNode(node) { return this.directives.get(node) || null; } }, { key: "getReferenceTarget", value: function getReferenceTarget(ref) { return this.references.get(ref) || null; } }, { key: "getConsumerOfBinding", value: function getConsumerOfBinding(binding) { return this.bindings.get(binding) || null; } }, { key: "getExpressionTarget", value: function getExpressionTarget(expr) { return this.exprTargets.get(expr) || null; } }, { key: "getTemplateOfSymbol", value: function getTemplateOfSymbol(symbol) { return this.symbols.get(symbol) || null; } }, { key: "getNestingLevel", value: function getNestingLevel(template) { return this.nestingLevel.get(template) || 0; } }, { key: "getUsedDirectives", value: function getUsedDirectives() { var set = new Set(); this.directives.forEach(function (dirs) { return dirs.forEach(function (dir) { return set.add(dir); }); }); return Array.from(set.values()); } }, { key: "getUsedPipes", value: function getUsedPipes() { return Array.from(this.usedPipes); } }]); return R3BoundTarget; }(); /** * @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 file only reexports content of the `src` folder. Keep it that way. // This function call has a global side effects and publishes the compiler into global namespace for // the late binding of the Compiler to the @angular/core for jit compilation. publishFacade(_global); /** * @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 file only reexports content of the `src` folder. Keep it that way. /** * @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 */ //# sourceMappingURL=compiler.js.map /***/ }, /***/ "./node_modules/@angular/core/fesm2015/core.js": /*!*****************************************************!*\ !*** ./node_modules/@angular/core/fesm2015/core.js ***! \*****************************************************/ /*! exports provided: ɵangular_packages_core_core_q, ɵangular_packages_core_core_n, ɵangular_packages_core_core_o, ɵangular_packages_core_core_p, ɵangular_packages_core_core_r, ɵangular_packages_core_core_f, ɵangular_packages_core_core_l, ɵangular_packages_core_core_m, ɵangular_packages_core_core_k, ɵangular_packages_core_core_j, ɵangular_packages_core_core_b, ɵangular_packages_core_core_a, ɵangular_packages_core_core_c, ɵangular_packages_core_core_d, ɵangular_packages_core_core_e, ɵangular_packages_core_core_i, ɵangular_packages_core_core_s, ɵangular_packages_core_core_u, ɵangular_packages_core_core_t, ɵangular_packages_core_core_x, ɵangular_packages_core_core_v, ɵangular_packages_core_core_w, ɵangular_packages_core_core_ba, ɵangular_packages_core_core_bb, ɵangular_packages_core_core_bc, ɵangular_packages_core_core_bd, ɵangular_packages_core_core_be, ɵangular_packages_core_core_bm, ɵangular_packages_core_core_bl, ɵangular_packages_core_core_g, ɵangular_packages_core_core_h, ɵangular_packages_core_core_bg, ɵangular_packages_core_core_bk, ɵangular_packages_core_core_bh, ɵangular_packages_core_core_bi, ɵangular_packages_core_core_bn, ɵangular_packages_core_core_y, ɵangular_packages_core_core_z, createPlatform, assertPlatform, destroyPlatform, getPlatform, PlatformRef, ApplicationRef, createPlatformFactory, NgProbeToken, enableProdMode, isDevMode, APP_ID, PACKAGE_ROOT_URL, PLATFORM_INITIALIZER, PLATFORM_ID, APP_BOOTSTRAP_LISTENER, APP_INITIALIZER, ApplicationInitStatus, DebugElement, DebugEventListener, DebugNode, asNativeElements, getDebugNode, Testability, TestabilityRegistry, setTestabilityGetter, TRANSLATIONS, TRANSLATIONS_FORMAT, LOCALE_ID, MissingTranslationStrategy, ApplicationModule, wtfCreateScope, wtfLeave, wtfStartTimeRange, wtfEndTimeRange, Type, EventEmitter, ErrorHandler, Sanitizer, SecurityContext, Attribute, ANALYZE_FOR_ENTRY_COMPONENTS, ContentChild, ContentChildren, Query, ViewChild, ViewChildren, Component, Directive, HostBinding, HostListener, Input, Output, Pipe, NgModule, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, ViewEncapsulation, Version, VERSION, InjectFlags, ɵɵdefineInjectable, defineInjectable, ɵɵdefineInjector, forwardRef, resolveForwardRef, Injectable, Injector, ɵɵinject, inject, INJECTOR, ReflectiveInjector, ResolvedReflectiveFactory, ReflectiveKey, InjectionToken, Inject, Optional, Self, SkipSelf, Host, NgZone, ɵNoopNgZone, RenderComponentType, Renderer, Renderer2, RendererFactory2, RendererStyleFlags2, RootRenderer, COMPILER_OPTIONS, Compiler, CompilerFactory, ModuleWithComponentFactories, ComponentFactory, ɵComponentFactory, ComponentRef, ComponentFactoryResolver, ElementRef, NgModuleFactory, NgModuleRef, NgModuleFactoryLoader, getModuleFactory, QueryList, SystemJsNgModuleLoader, SystemJsNgModuleLoaderConfig, TemplateRef, ViewContainerRef, EmbeddedViewRef, ViewRef, ChangeDetectionStrategy, ChangeDetectorRef, DefaultIterableDiffer, IterableDiffers, KeyValueDiffers, SimpleChange, WrappedValue, platformCore, ɵALLOW_MULTIPLE_PLATFORMS, ɵAPP_ID_RANDOM_PROVIDER, ɵdefaultIterableDiffers, ɵdefaultKeyValueDiffers, ɵdevModeEqual, ɵisListLikeIterable, ɵChangeDetectorStatus, ɵisDefaultChangeDetectionStrategy, ɵConsole, ɵsetCurrentInjector, ɵgetInjectableDef, ɵAPP_ROOT, ɵDEFAULT_LOCALE_ID, ɵivyEnabled, ɵCodegenComponentFactoryResolver, ɵclearResolutionOfComponentResourcesQueue, ɵresolveComponentResources, ɵReflectionCapabilities, ɵRenderDebugInfo, ɵ_sanitizeHtml, ɵ_sanitizeStyle, ɵ_sanitizeUrl, ɵglobal, ɵlooseIdentical, ɵstringify, ɵmakeDecorator, ɵisObservable, ɵisPromise, ɵclearOverrides, ɵinitServicesIfNeeded, ɵoverrideComponentView, ɵoverrideProvider, ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, ɵgetLocalePluralCase, ɵfindLocaleData, ɵLOCALE_DATA, ɵLocaleDataIndex, ɵɵattribute, ɵɵattributeInterpolate1, ɵɵattributeInterpolate2, ɵɵattributeInterpolate3, ɵɵattributeInterpolate4, ɵɵattributeInterpolate5, ɵɵattributeInterpolate6, ɵɵattributeInterpolate7, ɵɵattributeInterpolate8, ɵɵattributeInterpolateV, ɵɵdefineBase, ɵɵdefineComponent, ɵɵdefineDirective, ɵɵdefinePipe, ɵɵdefineNgModule, ɵdetectChanges, ɵrenderComponent, ɵRender3ComponentFactory, ɵRender3ComponentRef, ɵɵdirectiveInject, ɵɵinjectAttribute, ɵɵinjectPipeChangeDetectorRef, ɵɵgetFactoryOf, ɵɵgetInheritedFactory, ɵɵsetComponentScope, ɵɵsetNgModuleScope, ɵɵtemplateRefExtractor, ɵɵProvidersFeature, ɵɵInheritDefinitionFeature, ɵɵNgOnChangesFeature, ɵLifecycleHooksFeature, ɵRender3NgModuleRef, ɵmarkDirty, ɵNgModuleFactory, ɵNO_CHANGE, ɵɵcontainer, ɵɵnextContext, ɵɵelementStart, ɵɵnamespaceHTML, ɵɵnamespaceMathML, ɵɵnamespaceSVG, ɵɵelement, ɵɵlistener, ɵɵtext, ɵɵtextInterpolate, ɵɵtextInterpolate1, ɵɵtextInterpolate2, ɵɵtextInterpolate3, ɵɵtextInterpolate4, ɵɵtextInterpolate5, ɵɵtextInterpolate6, ɵɵtextInterpolate7, ɵɵtextInterpolate8, ɵɵtextInterpolateV, ɵɵembeddedViewStart, ɵɵprojection, ɵɵpipeBind1, ɵɵpipeBind2, ɵɵpipeBind3, ɵɵpipeBind4, ɵɵpipeBindV, ɵɵpureFunction0, ɵɵpureFunction1, ɵɵpureFunction2, ɵɵpureFunction3, ɵɵpureFunction4, ɵɵpureFunction5, ɵɵpureFunction6, ɵɵpureFunction7, ɵɵpureFunction8, ɵɵpureFunctionV, ɵɵgetCurrentView, ɵgetDirectives, ɵgetHostElement, ɵɵrestoreView, ɵɵcontainerRefreshStart, ɵɵcontainerRefreshEnd, ɵɵqueryRefresh, ɵɵviewQuery, ɵɵstaticViewQuery, ɵɵstaticContentQuery, ɵɵloadViewQuery, ɵɵcontentQuery, ɵɵloadContentQuery, ɵɵelementEnd, ɵɵhostProperty, ɵɵproperty, ɵɵpropertyInterpolate, ɵɵpropertyInterpolate1, ɵɵpropertyInterpolate2, ɵɵpropertyInterpolate3, ɵɵpropertyInterpolate4, ɵɵpropertyInterpolate5, ɵɵpropertyInterpolate6, ɵɵpropertyInterpolate7, ɵɵpropertyInterpolate8, ɵɵpropertyInterpolateV, ɵɵupdateSyntheticHostBinding, ɵɵcomponentHostSyntheticListener, ɵɵprojectionDef, ɵɵreference, ɵɵenableBindings, ɵɵdisableBindings, ɵɵallocHostVars, ɵɵelementContainerStart, ɵɵelementContainerEnd, ɵɵelementContainer, ɵɵstyling, ɵɵstyleMap, ɵɵstyleSanitizer, ɵɵclassMap, ɵɵclassMapInterpolate1, ɵɵclassMapInterpolate2, ɵɵclassMapInterpolate3, ɵɵclassMapInterpolate4, ɵɵclassMapInterpolate5, ɵɵclassMapInterpolate6, ɵɵclassMapInterpolate7, ɵɵclassMapInterpolate8, ɵɵclassMapInterpolateV, ɵɵstyleProp, ɵɵstylePropInterpolate1, ɵɵstylePropInterpolate2, ɵɵstylePropInterpolate3, ɵɵstylePropInterpolate4, ɵɵstylePropInterpolate5, ɵɵstylePropInterpolate6, ɵɵstylePropInterpolate7, ɵɵstylePropInterpolate8, ɵɵstylePropInterpolateV, ɵɵstylingApply, ɵɵclassProp, ɵɵelementHostAttrs, ɵɵselect, ɵɵtextBinding, ɵɵtemplate, ɵɵembeddedViewEnd, ɵstore, ɵɵload, ɵɵpipe, ɵwhenRendered, ɵɵi18n, ɵɵi18nAttributes, ɵɵi18nExp, ɵɵi18nStart, ɵɵi18nEnd, ɵɵi18nApply, ɵɵi18nPostprocess, ɵi18nConfigureLocalize, ɵɵi18nLocalize, ɵsetLocaleId, ɵsetClassMetadata, ɵɵresolveWindow, ɵɵresolveDocument, ɵɵresolveBody, ɵcompileComponent, ɵcompileDirective, ɵcompileNgModule, ɵcompileNgModuleDefs, ɵpatchComponentDefWithScope, ɵresetCompiledComponents, ɵflushModuleScopingQueueAsMuchAsPossible, ɵtransitiveScopesFor, ɵcompilePipe, ɵɵsanitizeHtml, ɵɵsanitizeStyle, ɵɵdefaultStyleSanitizer, ɵɵsanitizeScript, ɵɵsanitizeUrl, ɵɵsanitizeResourceUrl, ɵɵsanitizeUrlOrResourceUrl, ɵbypassSanitizationTrustHtml, ɵbypassSanitizationTrustStyle, ɵbypassSanitizationTrustScript, ɵbypassSanitizationTrustUrl, ɵbypassSanitizationTrustResourceUrl, ɵgetLContext, ɵNG_ELEMENT_ID, ɵNG_COMPONENT_DEF, ɵNG_DIRECTIVE_DEF, ɵNG_PIPE_DEF, ɵNG_MODULE_DEF, ɵNG_BASE_DEF, ɵNG_INJECTABLE_DEF, ɵNG_INJECTOR_DEF, ɵcompileNgModuleFactory__POST_R3__, ɵisBoundToModule__POST_R3__, ɵSWITCH_COMPILE_COMPONENT__POST_R3__, ɵSWITCH_COMPILE_DIRECTIVE__POST_R3__, ɵSWITCH_COMPILE_PIPE__POST_R3__, ɵSWITCH_COMPILE_NGMODULE__POST_R3__, ɵgetDebugNode__POST_R3__, ɵSWITCH_COMPILE_INJECTABLE__POST_R3__, ɵSWITCH_IVY_ENABLED__POST_R3__, ɵSWITCH_CHANGE_DETECTOR_REF_FACTORY__POST_R3__, ɵCompiler_compileModuleSync__POST_R3__, ɵCompiler_compileModuleAsync__POST_R3__, ɵCompiler_compileModuleAndAllComponentsSync__POST_R3__, ɵCompiler_compileModuleAndAllComponentsAsync__POST_R3__, ɵSWITCH_ELEMENT_REF_FACTORY__POST_R3__, ɵSWITCH_TEMPLATE_REF_FACTORY__POST_R3__, ɵSWITCH_VIEW_CONTAINER_REF_FACTORY__POST_R3__, ɵSWITCH_RENDERER2_FACTORY__POST_R3__, ɵgetModuleFactory__POST_R3__, ɵregisterNgModuleType, ɵpublishGlobalUtil, ɵpublishDefaultGlobalUtils, ɵcreateInjector, ɵINJECTOR_IMPL__POST_R3__, ɵregisterModuleFactory, ɵEMPTY_ARRAY, ɵEMPTY_MAP, ɵand, ɵccf, ɵcmf, ɵcrt, ɵdid, ɵeld, ɵgetComponentViewDefinitionFactory, ɵinlineInterpolate, ɵinterpolate, ɵmod, ɵmpd, ɵncd, ɵnov, ɵpid, ɵprd, ɵpad, ɵpod, ɵppd, ɵqud, ɵted, ɵunv, ɵvid */ /***/ function node_modulesAngularCoreFesm2015CoreJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_q", function () { return APPLICATION_MODULE_PROVIDERS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_n", function () { return _iterableDiffersFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_o", function () { return _keyValueDiffersFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_p", function () { return _localeFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_r", function () { return zoneSchedulerFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_f", function () { return _appIdRandomProviderFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_l", function () { return DefaultIterableDifferFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_m", function () { return DefaultKeyValueDifferFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_k", function () { return DebugElement__PRE_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_j", function () { return DebugNode__PRE_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_b", function () { return NullInjector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_a", function () { return injectInjectorOnly; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_c", function () { return ReflectiveInjector_; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_d", function () { return ReflectiveDependency; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_e", function () { return resolveReflectiveProviders; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_i", function () { return getModuleFactory__PRE_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_s", function () { return wtfEnabled; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_u", function () { return createScope; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_t", function () { return detectWTF; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_x", function () { return endTimeRange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_v", function () { return leave; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_w", function () { return startTimeRange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_ba", function () { return SCHEDULER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_bb", function () { return injectAttributeImpl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_bc", function () { return getLView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_bd", function () { return getPreviousOrParentTNode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_be", function () { return nextContextImpl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_bm", function () { return getRootContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_bl", function () { return loadInternal; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_g", function () { return createElementRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_h", function () { return createTemplateRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_bg", function () { return getUrlSanitizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_bk", function () { return noSideEffects; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_bh", function () { return makeParamDecorator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_bi", function () { return makePropDecorator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_bn", function () { return getClosureSafeProperty; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_y", function () { return _def; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_z", function () { return DebugContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPlatform", function () { return createPlatform; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assertPlatform", function () { return assertPlatform; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "destroyPlatform", function () { return destroyPlatform; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPlatform", function () { return getPlatform; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlatformRef", function () { return PlatformRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApplicationRef", function () { return ApplicationRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPlatformFactory", function () { return createPlatformFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgProbeToken", function () { return NgProbeToken; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enableProdMode", function () { return enableProdMode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isDevMode", function () { return isDevMode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_ID", function () { return APP_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PACKAGE_ROOT_URL", function () { return PACKAGE_ROOT_URL; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PLATFORM_INITIALIZER", function () { return PLATFORM_INITIALIZER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PLATFORM_ID", function () { return PLATFORM_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_BOOTSTRAP_LISTENER", function () { return APP_BOOTSTRAP_LISTENER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_INITIALIZER", function () { return APP_INITIALIZER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApplicationInitStatus", function () { return ApplicationInitStatus; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DebugElement", function () { return DebugElement; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DebugEventListener", function () { return DebugEventListener; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DebugNode", function () { return DebugNode$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asNativeElements", function () { return asNativeElements; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDebugNode", function () { return getDebugNode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Testability", function () { return Testability; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TestabilityRegistry", function () { return TestabilityRegistry; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTestabilityGetter", function () { return setTestabilityGetter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TRANSLATIONS", function () { return TRANSLATIONS$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TRANSLATIONS_FORMAT", function () { return TRANSLATIONS_FORMAT; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOCALE_ID", function () { return LOCALE_ID$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MissingTranslationStrategy", function () { return MissingTranslationStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApplicationModule", function () { return ApplicationModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wtfCreateScope", function () { return wtfCreateScope; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wtfLeave", function () { return wtfLeave; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wtfStartTimeRange", function () { return wtfStartTimeRange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wtfEndTimeRange", function () { return wtfEndTimeRange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Type", function () { return Type; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EventEmitter", function () { return EventEmitter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ErrorHandler", function () { return ErrorHandler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Sanitizer", function () { return Sanitizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SecurityContext", function () { return SecurityContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Attribute", function () { return Attribute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ANALYZE_FOR_ENTRY_COMPONENTS", function () { return ANALYZE_FOR_ENTRY_COMPONENTS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ContentChild", function () { return ContentChild; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ContentChildren", function () { return ContentChildren; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Query", function () { return Query; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewChild", function () { return ViewChild; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewChildren", function () { return ViewChildren; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Component", function () { return Component; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Directive", function () { return Directive; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HostBinding", function () { return HostBinding; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HostListener", function () { return HostListener; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Input", function () { return Input; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Output", function () { return Output; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Pipe", function () { return Pipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModule", function () { return NgModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CUSTOM_ELEMENTS_SCHEMA", function () { return CUSTOM_ELEMENTS_SCHEMA; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NO_ERRORS_SCHEMA", function () { return NO_ERRORS_SCHEMA; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewEncapsulation", function () { return ViewEncapsulation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Version", function () { return Version; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function () { return VERSION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InjectFlags", function () { return InjectFlags; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵdefineInjectable", function () { return ɵɵdefineInjectable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defineInjectable", function () { return defineInjectable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵdefineInjector", function () { return ɵɵdefineInjector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forwardRef", function () { return forwardRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resolveForwardRef", function () { return resolveForwardRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Injectable", function () { return Injectable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Injector", function () { return Injector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵinject", function () { return ɵɵinject; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function () { return inject; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "INJECTOR", function () { return INJECTOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReflectiveInjector", function () { return ReflectiveInjector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResolvedReflectiveFactory", function () { return ResolvedReflectiveFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReflectiveKey", function () { return ReflectiveKey; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InjectionToken", function () { return InjectionToken; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Inject", function () { return Inject; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Optional", function () { return Optional; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Self", function () { return Self; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SkipSelf", function () { return SkipSelf; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Host", function () { return Host; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgZone", function () { return NgZone; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNoopNgZone", function () { return NoopNgZone; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenderComponentType", function () { return RenderComponentType; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Renderer", function () { return Renderer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Renderer2", function () { return Renderer2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RendererFactory2", function () { return RendererFactory2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RendererStyleFlags2", function () { return RendererStyleFlags2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RootRenderer", function () { return RootRenderer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COMPILER_OPTIONS", function () { return COMPILER_OPTIONS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Compiler", function () { return Compiler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompilerFactory", function () { return CompilerFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ModuleWithComponentFactories", function () { return ModuleWithComponentFactories; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentFactory", function () { return ComponentFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵComponentFactory", function () { return ComponentFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentRef", function () { return ComponentRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentFactoryResolver", function () { return ComponentFactoryResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ElementRef", function () { return ElementRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModuleFactory", function () { return NgModuleFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModuleRef", function () { return NgModuleRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModuleFactoryLoader", function () { return NgModuleFactoryLoader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getModuleFactory", function () { return getModuleFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QueryList", function () { return QueryList; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SystemJsNgModuleLoader", function () { return SystemJsNgModuleLoader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SystemJsNgModuleLoaderConfig", function () { return SystemJsNgModuleLoaderConfig; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplateRef", function () { return TemplateRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewContainerRef", function () { return ViewContainerRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmbeddedViewRef", function () { return EmbeddedViewRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewRef", function () { return ViewRef$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChangeDetectionStrategy", function () { return ChangeDetectionStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChangeDetectorRef", function () { return ChangeDetectorRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultIterableDiffer", function () { return DefaultIterableDiffer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IterableDiffers", function () { return IterableDiffers; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyValueDiffers", function () { return KeyValueDiffers; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SimpleChange", function () { return SimpleChange; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WrappedValue", function () { return WrappedValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "platformCore", function () { return platformCore; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵALLOW_MULTIPLE_PLATFORMS", function () { return ALLOW_MULTIPLE_PLATFORMS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAPP_ID_RANDOM_PROVIDER", function () { return APP_ID_RANDOM_PROVIDER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdefaultIterableDiffers", function () { return defaultIterableDiffers; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdefaultKeyValueDiffers", function () { return defaultKeyValueDiffers; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdevModeEqual", function () { return devModeEqual$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisListLikeIterable", function () { return isListLikeIterable$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵChangeDetectorStatus", function () { return ChangeDetectorStatus; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisDefaultChangeDetectionStrategy", function () { return isDefaultChangeDetectionStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵConsole", function () { return Console; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsetCurrentInjector", function () { return setCurrentInjector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵgetInjectableDef", function () { return getInjectableDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAPP_ROOT", function () { return APP_ROOT; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDEFAULT_LOCALE_ID", function () { return DEFAULT_LOCALE_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵivyEnabled", function () { return ivyEnabled; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵCodegenComponentFactoryResolver", function () { return CodegenComponentFactoryResolver; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵclearResolutionOfComponentResourcesQueue", function () { return clearResolutionOfComponentResourcesQueue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵresolveComponentResources", function () { return resolveComponentResources; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵReflectionCapabilities", function () { return ReflectionCapabilities; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵRenderDebugInfo", function () { return RenderDebugInfo; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵ_sanitizeHtml", function () { return _sanitizeHtml; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵ_sanitizeStyle", function () { return _sanitizeStyle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵ_sanitizeUrl", function () { return _sanitizeUrl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵglobal", function () { return _global; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵlooseIdentical", function () { return looseIdentical; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵstringify", function () { return stringify; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵmakeDecorator", function () { return makeDecorator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisObservable", function () { return isObservable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisPromise", function () { return isPromise; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵclearOverrides", function () { return clearOverrides; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinitServicesIfNeeded", function () { return initServicesIfNeeded; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵoverrideComponentView", function () { return overrideComponentView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵoverrideProvider", function () { return overrideProvider; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR", function () { return NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵgetLocalePluralCase", function () { return getLocalePluralCase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵfindLocaleData", function () { return findLocaleData; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵLOCALE_DATA", function () { return LOCALE_DATA; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵLocaleDataIndex", function () { return LocaleDataIndex; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵattribute", function () { return ɵɵattribute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵattributeInterpolate1", function () { return ɵɵattributeInterpolate1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵattributeInterpolate2", function () { return ɵɵattributeInterpolate2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵattributeInterpolate3", function () { return ɵɵattributeInterpolate3; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵattributeInterpolate4", function () { return ɵɵattributeInterpolate4; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵattributeInterpolate5", function () { return ɵɵattributeInterpolate5; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵattributeInterpolate6", function () { return ɵɵattributeInterpolate6; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵattributeInterpolate7", function () { return ɵɵattributeInterpolate7; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵattributeInterpolate8", function () { return ɵɵattributeInterpolate8; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵattributeInterpolateV", function () { return ɵɵattributeInterpolateV; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵdefineBase", function () { return ɵɵdefineBase; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵdefineComponent", function () { return ɵɵdefineComponent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵdefineDirective", function () { return ɵɵdefineDirective; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵdefinePipe", function () { return ɵɵdefinePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵdefineNgModule", function () { return ɵɵdefineNgModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdetectChanges", function () { return detectChanges; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵrenderComponent", function () { return renderComponent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵRender3ComponentFactory", function () { return ComponentFactory$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵRender3ComponentRef", function () { return ComponentRef$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵdirectiveInject", function () { return ɵɵdirectiveInject; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵinjectAttribute", function () { return ɵɵinjectAttribute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵinjectPipeChangeDetectorRef", function () { return ɵɵinjectPipeChangeDetectorRef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵgetFactoryOf", function () { return ɵɵgetFactoryOf; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵgetInheritedFactory", function () { return ɵɵgetInheritedFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵsetComponentScope", function () { return ɵɵsetComponentScope; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵsetNgModuleScope", function () { return ɵɵsetNgModuleScope; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵtemplateRefExtractor", function () { return ɵɵtemplateRefExtractor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵProvidersFeature", function () { return ɵɵProvidersFeature; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵInheritDefinitionFeature", function () { return ɵɵInheritDefinitionFeature; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵNgOnChangesFeature", function () { return ɵɵNgOnChangesFeature; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵLifecycleHooksFeature", function () { return LifecycleHooksFeature; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵRender3NgModuleRef", function () { return NgModuleRef$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵmarkDirty", function () { return markDirty; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNgModuleFactory", function () { return NgModuleFactory$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNO_CHANGE", function () { return NO_CHANGE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵcontainer", function () { return ɵɵcontainer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵnextContext", function () { return ɵɵnextContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵelementStart", function () { return ɵɵelementStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵnamespaceHTML", function () { return ɵɵnamespaceHTML; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵnamespaceMathML", function () { return ɵɵnamespaceMathML; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵnamespaceSVG", function () { return ɵɵnamespaceSVG; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵelement", function () { return ɵɵelement; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵlistener", function () { return ɵɵlistener; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵtext", function () { return ɵɵtext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵtextInterpolate", function () { return ɵɵtextInterpolate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵtextInterpolate1", function () { return ɵɵtextInterpolate1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵtextInterpolate2", function () { return ɵɵtextInterpolate2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵtextInterpolate3", function () { return ɵɵtextInterpolate3; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵtextInterpolate4", function () { return ɵɵtextInterpolate4; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵtextInterpolate5", function () { return ɵɵtextInterpolate5; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵtextInterpolate6", function () { return ɵɵtextInterpolate6; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵtextInterpolate7", function () { return ɵɵtextInterpolate7; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵtextInterpolate8", function () { return ɵɵtextInterpolate8; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵtextInterpolateV", function () { return ɵɵtextInterpolateV; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵembeddedViewStart", function () { return ɵɵembeddedViewStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵprojection", function () { return ɵɵprojection; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpipeBind1", function () { return ɵɵpipeBind1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpipeBind2", function () { return ɵɵpipeBind2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpipeBind3", function () { return ɵɵpipeBind3; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpipeBind4", function () { return ɵɵpipeBind4; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpipeBindV", function () { return ɵɵpipeBindV; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpureFunction0", function () { return ɵɵpureFunction0; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpureFunction1", function () { return ɵɵpureFunction1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpureFunction2", function () { return ɵɵpureFunction2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpureFunction3", function () { return ɵɵpureFunction3; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpureFunction4", function () { return ɵɵpureFunction4; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpureFunction5", function () { return ɵɵpureFunction5; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpureFunction6", function () { return ɵɵpureFunction6; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpureFunction7", function () { return ɵɵpureFunction7; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpureFunction8", function () { return ɵɵpureFunction8; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpureFunctionV", function () { return ɵɵpureFunctionV; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵgetCurrentView", function () { return ɵɵgetCurrentView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵgetDirectives", function () { return getDirectives; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵgetHostElement", function () { return getHostElement; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵrestoreView", function () { return ɵɵrestoreView; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵcontainerRefreshStart", function () { return ɵɵcontainerRefreshStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵcontainerRefreshEnd", function () { return ɵɵcontainerRefreshEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵqueryRefresh", function () { return ɵɵqueryRefresh; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵviewQuery", function () { return ɵɵviewQuery; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵstaticViewQuery", function () { return ɵɵstaticViewQuery; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵstaticContentQuery", function () { return ɵɵstaticContentQuery; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵloadViewQuery", function () { return ɵɵloadViewQuery; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵcontentQuery", function () { return ɵɵcontentQuery; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵloadContentQuery", function () { return ɵɵloadContentQuery; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵelementEnd", function () { return ɵɵelementEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵhostProperty", function () { return ɵɵhostProperty; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵproperty", function () { return ɵɵproperty; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpropertyInterpolate", function () { return ɵɵpropertyInterpolate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpropertyInterpolate1", function () { return ɵɵpropertyInterpolate1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpropertyInterpolate2", function () { return ɵɵpropertyInterpolate2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpropertyInterpolate3", function () { return ɵɵpropertyInterpolate3; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpropertyInterpolate4", function () { return ɵɵpropertyInterpolate4; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpropertyInterpolate5", function () { return ɵɵpropertyInterpolate5; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpropertyInterpolate6", function () { return ɵɵpropertyInterpolate6; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpropertyInterpolate7", function () { return ɵɵpropertyInterpolate7; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpropertyInterpolate8", function () { return ɵɵpropertyInterpolate8; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpropertyInterpolateV", function () { return ɵɵpropertyInterpolateV; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵupdateSyntheticHostBinding", function () { return ɵɵupdateSyntheticHostBinding; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵcomponentHostSyntheticListener", function () { return ɵɵcomponentHostSyntheticListener; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵprojectionDef", function () { return ɵɵprojectionDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵreference", function () { return ɵɵreference; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵenableBindings", function () { return ɵɵenableBindings; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵdisableBindings", function () { return ɵɵdisableBindings; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵallocHostVars", function () { return ɵɵallocHostVars; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵelementContainerStart", function () { return ɵɵelementContainerStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵelementContainerEnd", function () { return ɵɵelementContainerEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵelementContainer", function () { return ɵɵelementContainer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵstyling", function () { return ɵɵstyling; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵstyleMap", function () { return ɵɵstyleMap; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵstyleSanitizer", function () { return ɵɵstyleSanitizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵclassMap", function () { return ɵɵclassMap; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵclassMapInterpolate1", function () { return ɵɵclassMapInterpolate1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵclassMapInterpolate2", function () { return ɵɵclassMapInterpolate2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵclassMapInterpolate3", function () { return ɵɵclassMapInterpolate3; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵclassMapInterpolate4", function () { return ɵɵclassMapInterpolate4; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵclassMapInterpolate5", function () { return ɵɵclassMapInterpolate5; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵclassMapInterpolate6", function () { return ɵɵclassMapInterpolate6; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵclassMapInterpolate7", function () { return ɵɵclassMapInterpolate7; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵclassMapInterpolate8", function () { return ɵɵclassMapInterpolate8; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵclassMapInterpolateV", function () { return ɵɵclassMapInterpolateV; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵstyleProp", function () { return ɵɵstyleProp; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵstylePropInterpolate1", function () { return ɵɵstylePropInterpolate1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵstylePropInterpolate2", function () { return ɵɵstylePropInterpolate2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵstylePropInterpolate3", function () { return ɵɵstylePropInterpolate3; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵstylePropInterpolate4", function () { return ɵɵstylePropInterpolate4; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵstylePropInterpolate5", function () { return ɵɵstylePropInterpolate5; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵstylePropInterpolate6", function () { return ɵɵstylePropInterpolate6; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵstylePropInterpolate7", function () { return ɵɵstylePropInterpolate7; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵstylePropInterpolate8", function () { return ɵɵstylePropInterpolate8; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵstylePropInterpolateV", function () { return ɵɵstylePropInterpolateV; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵstylingApply", function () { return ɵɵstylingApply; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵclassProp", function () { return ɵɵclassProp; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵelementHostAttrs", function () { return ɵɵelementHostAttrs; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵselect", function () { return ɵɵselect; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵtextBinding", function () { return ɵɵtextBinding; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵtemplate", function () { return ɵɵtemplate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵembeddedViewEnd", function () { return ɵɵembeddedViewEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵstore", function () { return store; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵload", function () { return ɵɵload; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵpipe", function () { return ɵɵpipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵwhenRendered", function () { return whenRendered; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵi18n", function () { return ɵɵi18n; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵi18nAttributes", function () { return ɵɵi18nAttributes; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵi18nExp", function () { return ɵɵi18nExp; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵi18nStart", function () { return ɵɵi18nStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵi18nEnd", function () { return ɵɵi18nEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵi18nApply", function () { return ɵɵi18nApply; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵi18nPostprocess", function () { return ɵɵi18nPostprocess; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵi18nConfigureLocalize", function () { return i18nConfigureLocalize; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵi18nLocalize", function () { return ɵɵi18nLocalize; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsetLocaleId", function () { return setLocaleId; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsetClassMetadata", function () { return setClassMetadata; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵresolveWindow", function () { return ɵɵresolveWindow; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵresolveDocument", function () { return ɵɵresolveDocument; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵresolveBody", function () { return ɵɵresolveBody; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcompileComponent", function () { return compileComponent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcompileDirective", function () { return compileDirective; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcompileNgModule", function () { return compileNgModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcompileNgModuleDefs", function () { return compileNgModuleDefs; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpatchComponentDefWithScope", function () { return patchComponentDefWithScope; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵresetCompiledComponents", function () { return resetCompiledComponents; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵflushModuleScopingQueueAsMuchAsPossible", function () { return flushModuleScopingQueueAsMuchAsPossible; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵtransitiveScopesFor", function () { return transitiveScopesFor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcompilePipe", function () { return compilePipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵsanitizeHtml", function () { return ɵɵsanitizeHtml; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵsanitizeStyle", function () { return ɵɵsanitizeStyle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵdefaultStyleSanitizer", function () { return ɵɵdefaultStyleSanitizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵsanitizeScript", function () { return ɵɵsanitizeScript; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵsanitizeUrl", function () { return ɵɵsanitizeUrl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵsanitizeResourceUrl", function () { return ɵɵsanitizeResourceUrl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵɵsanitizeUrlOrResourceUrl", function () { return ɵɵsanitizeUrlOrResourceUrl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbypassSanitizationTrustHtml", function () { return bypassSanitizationTrustHtml; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbypassSanitizationTrustStyle", function () { return bypassSanitizationTrustStyle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbypassSanitizationTrustScript", function () { return bypassSanitizationTrustScript; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbypassSanitizationTrustUrl", function () { return bypassSanitizationTrustUrl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbypassSanitizationTrustResourceUrl", function () { return bypassSanitizationTrustResourceUrl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵgetLContext", function () { return getLContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNG_ELEMENT_ID", function () { return NG_ELEMENT_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNG_COMPONENT_DEF", function () { return NG_COMPONENT_DEF; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNG_DIRECTIVE_DEF", function () { return NG_DIRECTIVE_DEF; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNG_PIPE_DEF", function () { return NG_PIPE_DEF; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNG_MODULE_DEF", function () { return NG_MODULE_DEF; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNG_BASE_DEF", function () { return NG_BASE_DEF; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNG_INJECTABLE_DEF", function () { return NG_INJECTABLE_DEF; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNG_INJECTOR_DEF", function () { return NG_INJECTOR_DEF; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcompileNgModuleFactory__POST_R3__", function () { return compileNgModuleFactory__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisBoundToModule__POST_R3__", function () { return isBoundToModule__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵSWITCH_COMPILE_COMPONENT__POST_R3__", function () { return SWITCH_COMPILE_COMPONENT__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵSWITCH_COMPILE_DIRECTIVE__POST_R3__", function () { return SWITCH_COMPILE_DIRECTIVE__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵSWITCH_COMPILE_PIPE__POST_R3__", function () { return SWITCH_COMPILE_PIPE__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵSWITCH_COMPILE_NGMODULE__POST_R3__", function () { return SWITCH_COMPILE_NGMODULE__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵgetDebugNode__POST_R3__", function () { return getDebugNode__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵSWITCH_COMPILE_INJECTABLE__POST_R3__", function () { return SWITCH_COMPILE_INJECTABLE__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵSWITCH_IVY_ENABLED__POST_R3__", function () { return SWITCH_IVY_ENABLED__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵSWITCH_CHANGE_DETECTOR_REF_FACTORY__POST_R3__", function () { return SWITCH_CHANGE_DETECTOR_REF_FACTORY__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵCompiler_compileModuleSync__POST_R3__", function () { return Compiler_compileModuleSync__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵCompiler_compileModuleAsync__POST_R3__", function () { return Compiler_compileModuleAsync__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵCompiler_compileModuleAndAllComponentsSync__POST_R3__", function () { return Compiler_compileModuleAndAllComponentsSync__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵCompiler_compileModuleAndAllComponentsAsync__POST_R3__", function () { return Compiler_compileModuleAndAllComponentsAsync__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵSWITCH_ELEMENT_REF_FACTORY__POST_R3__", function () { return SWITCH_ELEMENT_REF_FACTORY__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵSWITCH_TEMPLATE_REF_FACTORY__POST_R3__", function () { return SWITCH_TEMPLATE_REF_FACTORY__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵSWITCH_VIEW_CONTAINER_REF_FACTORY__POST_R3__", function () { return SWITCH_VIEW_CONTAINER_REF_FACTORY__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵSWITCH_RENDERER2_FACTORY__POST_R3__", function () { return SWITCH_RENDERER2_FACTORY__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵgetModuleFactory__POST_R3__", function () { return getModuleFactory__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵregisterNgModuleType", function () { return registerNgModuleType; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpublishGlobalUtil", function () { return publishGlobalUtil; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpublishDefaultGlobalUtils", function () { return publishDefaultGlobalUtils; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcreateInjector", function () { return createInjector; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵINJECTOR_IMPL__POST_R3__", function () { return INJECTOR_IMPL__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵregisterModuleFactory", function () { return registerModuleFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵEMPTY_ARRAY", function () { return EMPTY_ARRAY$3; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵEMPTY_MAP", function () { return EMPTY_MAP; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵand", function () { return anchorDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵccf", function () { return createComponentFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcmf", function () { return createNgModuleFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcrt", function () { return createRendererType2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdid", function () { return directiveDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵeld", function () { return elementDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵgetComponentViewDefinitionFactory", function () { return getComponentViewDefinitionFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinlineInterpolate", function () { return inlineInterpolate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinterpolate", function () { return interpolate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵmod", function () { return moduleDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵmpd", function () { return moduleProvideDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵncd", function () { return ngContentDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵnov", function () { return nodeValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpid", function () { return pipeDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵprd", function () { return providerDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpad", function () { return pureArrayDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpod", function () { return pureObjectDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵppd", function () { return purePipeDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵqud", function () { return queryDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵted", function () { return textDef; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵunv", function () { return unwrapValue; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵvid", function () { return viewDef; }); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! rxjs */ "./node_modules/rxjs/_esm2015/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! rxjs/operators */ "./node_modules/rxjs/_esm2015/operators/index.js"); /** * @license Angular v8.2.12 * (c) 2010-2019 Google LLC. 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 */ var ANNOTATIONS = '__annotations__'; var PARAMETERS = '__parameters__'; var PROP_METADATA = '__prop__metadata__'; /** * @suppress {globalThis} */ function makeDecorator(name, props, parentClass, additionalProcessing, typeFn) { var metaCtor = makeMetadataCtor(props); function DecoratorFactory() { for (var _len8 = arguments.length, args = new Array(_len8), _key9 = 0; _key9 < _len8; _key9++) { args[_key9] = arguments[_key9]; } if (this instanceof DecoratorFactory) { metaCtor.call.apply(metaCtor, [this].concat(args)); return this; } var annotationInstance = _construct(DecoratorFactory, args); return function TypeDecorator(cls) { if (typeFn) typeFn.apply(void 0, [cls].concat(args)); // Use of Object.defineProperty is important since it creates non-enumerable property which // prevents the property is copied during subclassing. var annotations = cls.hasOwnProperty(ANNOTATIONS) ? cls[ANNOTATIONS] : Object.defineProperty(cls, ANNOTATIONS, { value: [] })[ANNOTATIONS]; annotations.push(annotationInstance); if (additionalProcessing) additionalProcessing(cls); return cls; }; } if (parentClass) { DecoratorFactory.prototype = Object.create(parentClass.prototype); } DecoratorFactory.prototype.ngMetadataName = name; DecoratorFactory.annotationCls = DecoratorFactory; return DecoratorFactory; } function makeMetadataCtor(props) { return function ctor() { if (props) { var values = props.apply(void 0, arguments); for (var propName in values) { this[propName] = values[propName]; } } }; } function makeParamDecorator(name, props, parentClass) { var metaCtor = makeMetadataCtor(props); function ParamDecoratorFactory() { for (var _len9 = arguments.length, args = new Array(_len9), _key10 = 0; _key10 < _len9; _key10++) { args[_key10] = arguments[_key10]; } if (this instanceof ParamDecoratorFactory) { metaCtor.apply(this, args); return this; } var annotationInstance = _construct(ParamDecoratorFactory, args); ParamDecorator.annotation = annotationInstance; return ParamDecorator; function ParamDecorator(cls, unusedKey, index) { // Use of Object.defineProperty is important since it creates non-enumerable property which // prevents the property is copied during subclassing. var parameters = cls.hasOwnProperty(PARAMETERS) ? cls[PARAMETERS] : Object.defineProperty(cls, PARAMETERS, { value: [] })[PARAMETERS]; // there might be gaps if some in between parameters do not have annotations. // we pad with nulls. while (parameters.length <= index) { parameters.push(null); } (parameters[index] = parameters[index] || []).push(annotationInstance); return cls; } } if (parentClass) { ParamDecoratorFactory.prototype = Object.create(parentClass.prototype); } ParamDecoratorFactory.prototype.ngMetadataName = name; ParamDecoratorFactory.annotationCls = ParamDecoratorFactory; return ParamDecoratorFactory; } function makePropDecorator(name, props, parentClass, additionalProcessing) { var metaCtor = makeMetadataCtor(props); function PropDecoratorFactory() { for (var _len10 = arguments.length, args = new Array(_len10), _key11 = 0; _key11 < _len10; _key11++) { args[_key11] = arguments[_key11]; } if (this instanceof PropDecoratorFactory) { metaCtor.apply(this, args); return this; } var decoratorInstance = _construct(PropDecoratorFactory, args); function PropDecorator(target, name) { var constructor = target.constructor; // Use of Object.defineProperty is important since it creates non-enumerable property which // prevents the property is copied during subclassing. var meta = constructor.hasOwnProperty(PROP_METADATA) ? constructor[PROP_METADATA] : Object.defineProperty(constructor, PROP_METADATA, { value: {} })[PROP_METADATA]; meta[name] = meta.hasOwnProperty(name) && meta[name] || []; meta[name].unshift(decoratorInstance); if (additionalProcessing) additionalProcessing.apply(void 0, [target, name].concat(args)); } return PropDecorator; } if (parentClass) { PropDecoratorFactory.prototype = Object.create(parentClass.prototype); } PropDecoratorFactory.prototype.ngMetadataName = name; PropDecoratorFactory.annotationCls = PropDecoratorFactory; return PropDecoratorFactory; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Type of the Inject decorator / constructor function. * * \@publicApi * @record */ function InjectDecorator() {} // WARNING: interface has both a type and a value, skipping emit var ɵ0 = /** * @param {?} token * @return {?} */ function ɵ0(token) { return { token: token }; }; /** * Inject decorator and metadata. * * \@Annotation * \@publicApi * @type {?} */ var Inject = makeParamDecorator('Inject', ɵ0); /** * Type of the Optional decorator / constructor function. * * \@publicApi * @record */ function OptionalDecorator() {} // WARNING: interface has both a type and a value, skipping emit /** * Optional decorator and metadata. * * \@Annotation * \@publicApi * @type {?} */ var Optional = makeParamDecorator('Optional'); /** * Type of the Self decorator / constructor function. * * \@publicApi * @record */ function SelfDecorator() {} // WARNING: interface has both a type and a value, skipping emit /** * Self decorator and metadata. * * \@Annotation * \@publicApi * @type {?} */ var Self = makeParamDecorator('Self'); /** * Type of the SkipSelf decorator / constructor function. * * \@publicApi * @record */ function SkipSelfDecorator() {} // WARNING: interface has both a type and a value, skipping emit /** * SkipSelf decorator and metadata. * * \@Annotation * \@publicApi * @type {?} */ var SkipSelf = makeParamDecorator('SkipSelf'); /** * Type of the Host decorator / constructor function. * * \@publicApi * @record */ function HostDecorator() {} // WARNING: interface has both a type and a value, skipping emit /** * Host decorator and metadata. * * \@Annotation * \@publicApi * @type {?} */ var Host = makeParamDecorator('Host'); /** * Type of the Attribute decorator / constructor function. * * \@publicApi * @record */ function AttributeDecorator() {} // WARNING: interface has both a type and a value, skipping emit var ɵ1 = /** * @param {?=} attributeName * @return {?} */ function ɵ1(attributeName) { return { attributeName: attributeName }; }; /** * Attribute decorator and metadata. * * \@Annotation * \@publicApi * @type {?} */ var Attribute = makeParamDecorator('Attribute', ɵ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 */ /** * Injection flags for DI. * * @publicApi */ var InjectFlags; (function (InjectFlags) { // TODO(alxhub): make this 'const' when ngc no longer writes exports of it into ngfactory files. /** Check self and check parent injector if needed */ InjectFlags[InjectFlags["Default"] = 0] = "Default"; /** * Specifies that an injector should retrieve a dependency from any injector until reaching the * host element of the current component. (Only used with Element Injector) */ InjectFlags[InjectFlags["Host"] = 1] = "Host"; /** Don't ascend to ancestors of the node requesting injection. */ InjectFlags[InjectFlags["Self"] = 2] = "Self"; /** Skip the node that is requesting injection. */ InjectFlags[InjectFlags["SkipSelf"] = 4] = "SkipSelf"; /** Inject `defaultValue` instead if token not found. */ InjectFlags[InjectFlags["Optional"] = 8] = "Optional"; })(InjectFlags || (InjectFlags = {})); /** * @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 */ function getClosureSafeProperty(objWithPropertyToExtract) { for (var key in objWithPropertyToExtract) { if (objWithPropertyToExtract[key] === getClosureSafeProperty) { return key; } } throw Error('Could not find renamed property on target object.'); } /** * Sets properties on a target object from a source object, but only if * the property doesn't already exist on the target object. * @param target The target to set properties on * @param source The source of the property keys and values to set */ function fillProperties(target, source) { for (var key in source) { if (source.hasOwnProperty(key) && !target.hasOwnProperty(key)) { target[key] = source[key]; } } } /** * @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 */ /** * Construct an `InjectableDef` which defines how a token will be constructed by the DI system, and * in which injectors (if any) it will be available. * * This should be assigned to a static `ngInjectableDef` field on a type, which will then be an * `InjectableType`. * * Options: * * `providedIn` determines which injectors will include the injectable, by either associating it * with an `@NgModule` or other `InjectorType`, or by specifying that this injectable should be * provided in the `'root'` injector, which will be the application-level injector in most apps. * * `factory` gives the zero argument function which will create an instance of the injectable. * The factory can call `inject` to access the `Injector` and request injection of dependencies. * * @codeGenApi */ function ɵɵdefineInjectable(opts) { return { token: opts.token, providedIn: opts.providedIn || null, factory: opts.factory, value: undefined }; } /** * @deprecated in v8, delete after v10. This API should be used only be generated code, and that * code should now use ɵɵdefineInjectable instead. * @publicApi */ var defineInjectable = ɵɵdefineInjectable; /** * Construct an `InjectorDef` which configures an injector. * * This should be assigned to a static `ngInjectorDef` field on a type, which will then be an * `InjectorType`. * * Options: * * * `factory`: an `InjectorType` is an instantiable type, so a zero argument `factory` function to * create the type must be provided. If that factory function needs to inject arguments, it can * use the `inject` function. * * `providers`: an optional array of providers to add to the injector. Each provider must * either have a factory or point to a type which has an `ngInjectableDef` static property (the * type must be an `InjectableType`). * * `imports`: an optional array of imports of other `InjectorType`s or `InjectorTypeWithModule`s * whose providers will also be added to the injector. Locally provided types will override * providers from imports. * * @publicApi */ function ɵɵdefineInjector(options) { return { factory: options.factory, providers: options.providers || [], imports: options.imports || [] }; } /** * Read the `ngInjectableDef` for `type` in a way which is immune to accidentally reading inherited * value. * * @param type A type which may have its own (non-inherited) `ngInjectableDef`. */ function getInjectableDef(type) { var def = type[NG_INJECTABLE_DEF]; // The definition read above may come from a base class. `hasOwnProperty` is not sufficient to // distinguish this case, as in older browsers (e.g. IE10) static property inheritance is // implemented by copying the properties. // // Instead, the ngInjectableDef's token is compared to the type, and if they don't match then the // property was not defined directly on the type itself, and was likely inherited. The definition // is only returned if the type matches the def.token. return def && def.token === type ? def : null; } /** * Read the `ngInjectableDef` for `type` or read the `ngInjectableDef` from one of its ancestors. * * @param type A type which may have `ngInjectableDef`, via inheritance. * * @deprecated Will be removed in v10, where an error will occur in the scenario if we find the * `ngInjectableDef` on an ancestor only. */ function getInheritedInjectableDef(type) { if (type && type[NG_INJECTABLE_DEF]) { // TODO(FW-1307): Re-add ngDevMode when closure can handle it // ngDevMode && console.warn("DEPRECATED: DI is instantiating a token \"".concat(type.name, "\" that inherits its @Injectable decorator but does not provide one itself.\n") + "This will become an error in v10. Please add @Injectable() to the \"".concat(type.name, "\" class.")); return type[NG_INJECTABLE_DEF]; } else { return null; } } /** * Read the `ngInjectorDef` type in a way which is immune to accidentally reading inherited value. * * @param type type which may have `ngInjectorDef` */ function getInjectorDef(type) { return type && type.hasOwnProperty(NG_INJECTOR_DEF) ? type[NG_INJECTOR_DEF] : null; } var NG_INJECTABLE_DEF = getClosureSafeProperty({ ngInjectableDef: getClosureSafeProperty }); var NG_INJECTOR_DEF = getClosureSafeProperty({ ngInjectorDef: getClosureSafeProperty }); /** * @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 */ function stringify(token) { if (typeof token === 'string') { return token; } if (token instanceof Array) { return '[' + token.map(stringify).join(', ') + ']'; } if (token == null) { return '' + token; } if (token.overriddenName) { return "".concat(token.overriddenName); } if (token.name) { return "".concat(token.name); } var res = token.toString(); if (res == null) { return '' + res; } var newLineIndex = res.indexOf('\n'); return newLineIndex === -1 ? res : res.substring(0, newLineIndex); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * An interface that a function passed into {\@link forwardRef} has to implement. * * \@usageNotes * ### Example * * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref_fn'} * \@publicApi * @record */ function ForwardRefFn() {} /** @type {?} */ var __forward_ref__ = getClosureSafeProperty({ __forward_ref__: getClosureSafeProperty }); /** * Allows to refer to references which are not yet defined. * * For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of * DI is declared, but not yet defined. It is also used when the `token` which we use when creating * a query is not yet defined. * * \@usageNotes * ### Example * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'} * \@publicApi * @param {?} forwardRefFn * @return {?} */ function forwardRef(forwardRefFn) { /** @type {?} */ forwardRefFn.__forward_ref__ = forwardRef; /** @type {?} */ forwardRefFn.toString = /** * @return {?} */ function () { return stringify(this()); }; return ( /** @type {?} */ /** @type {?} */ forwardRefFn ); } /** * Lazily retrieves the reference value from a forwardRef. * * Acts as the identity function when given a non-forward-ref value. * * \@usageNotes * ### Example * * {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'} * * @see `forwardRef` * \@publicApi * @template T * @param {?} type * @return {?} */ function resolveForwardRef(type) { /** @type {?} */ var fn = type; if (typeof fn === 'function' && fn.hasOwnProperty(__forward_ref__) && fn.__forward_ref__ === forwardRef) { return fn(); } else { return type; } } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var __globalThis = typeof globalThis !== 'undefined' && globalThis; var __window = typeof window !== 'undefined' && window; var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope && self; var __global = typeof global !== 'undefined' && global; // Always use __globalThis if available, which is the spec-defined global variable across all // environments, then fallback to __global first, because in Node tests both __global and // __window may be defined and _global should be __global in that case. var _global = __globalThis || __global || __window || __self; /** * @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 R3ResolvedDependencyType; (function (R3ResolvedDependencyType) { R3ResolvedDependencyType[R3ResolvedDependencyType["Token"] = 0] = "Token"; R3ResolvedDependencyType[R3ResolvedDependencyType["Attribute"] = 1] = "Attribute"; R3ResolvedDependencyType[R3ResolvedDependencyType["ChangeDetectorRef"] = 2] = "ChangeDetectorRef"; })(R3ResolvedDependencyType || (R3ResolvedDependencyType = {})); /** * @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 */ function getCompilerFacade() { var globalNg = _global['ng']; if (!globalNg || !globalNg.ɵcompilerFacade) { throw new Error("Angular JIT compilation failed: '@angular/compiler' not loaded!\n" + " - JIT compilation is discouraged for production use-cases! Consider AOT mode instead.\n" + " - Did you bootstrap using '@angular/platform-browser-dynamic' or '@angular/platform-server'?\n" + " - Alternatively provide the compiler with 'import \"@angular/compiler\";' before bootstrapping."); } return globalNg.ɵcompilerFacade; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Creates a token that can be used in a DI Provider. * * Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a * runtime representation) such as when injecting an interface, callable type, array or * parameterized type. * * `InjectionToken` is parameterized on `T` which is the type of object which will be returned by * the `Injector`. This provides additional level of type safety. * * ``` * interface MyInterface {...} * var myInterface = injector.get(new InjectionToken<MyInterface>('SomeToken')); * // myInterface is inferred to be MyInterface. * ``` * * When creating an `InjectionToken`, you can optionally specify a factory function which returns * (possibly by creating) a default value of the parameterized type `T`. This sets up the * `InjectionToken` using this factory as a provider as if it was defined explicitly in the * application's root injector. If the factory function, which takes zero arguments, needs to inject * dependencies, it can do so using the `inject` function. See below for an example. * * Additionally, if a `factory` is specified you can also specify the `providedIn` option, which * overrides the above behavior and marks the token as belonging to a particular `\@NgModule`. As * mentioned above, `'root'` is the default value for `providedIn`. * * \@usageNotes * ### Basic Example * * ### Plain InjectionToken * * {\@example core/di/ts/injector_spec.ts region='InjectionToken'} * * ### Tree-shakable InjectionToken * * {\@example core/di/ts/injector_spec.ts region='ShakableInjectionToken'} * * * \@publicApi * @template T */ var InjectionToken = /*#__PURE__*/function () { /** * @param {?} _desc * @param {?=} options */ function InjectionToken(_desc, options) { _classCallCheck(this, InjectionToken); this._desc = _desc; /** * \@internal */ this.ngMetadataName = 'InjectionToken'; /** @nocollapse */ this.ngInjectableDef = undefined; if (typeof options == 'number') { // This is a special hack to assign __NG_ELEMENT_ID__ to this instance. // __NG_ELEMENT_ID__ is Used by Ivy to determine bloom filter id. // We are using it to assign `-1` which is used to identify `Injector`. /** @type {?} */ this.__NG_ELEMENT_ID__ = options; } else if (options !== undefined) { /** @nocollapse */ this.ngInjectableDef = ɵɵdefineInjectable({ token: this, providedIn: options.providedIn || 'root', factory: options.factory }); } } /** * @return {?} */ _createClass2(InjectionToken, [{ key: "toString", value: function toString() { return "InjectionToken ".concat(this._desc); } }]); return InjectionToken; }(); if (false) {} /** * @record * @template T */ function InjectableDefToken() {} if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * An InjectionToken that gets the current `Injector` for `createInjector()`-style injectors. * * Requesting this token instead of `Injector` allows `StaticInjector` to be tree-shaken from a * project. * * \@publicApi * @type {?} */ var INJECTOR = new InjectionToken('INJECTOR', /** @type {?} */ -1); /** @type {?} */ var _THROW_IF_NOT_FOUND = new Object(); /** @type {?} */ var THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND; /** @type {?} */ var NG_TEMP_TOKEN_PATH = 'ngTempTokenPath'; /** @type {?} */ var NG_TOKEN_PATH = 'ngTokenPath'; /** @type {?} */ var NEW_LINE = /\n/gm; /** @type {?} */ var NO_NEW_LINE = 'ɵ'; /** @type {?} */ var SOURCE = '__source'; var ɵ0$1 = getClosureSafeProperty; /** @type {?} */ var USE_VALUE = getClosureSafeProperty({ provide: String, useValue: ɵ0$1 }); /** * Current injector value used by `inject`. * - `undefined`: it is an error to call `inject` * - `null`: `inject` can be called but there is no injector (limp-mode). * - Injector instance: Use the injector for resolution. * @type {?} */ var _currentInjector = undefined; /** * @param {?} injector * @return {?} */ function setCurrentInjector(injector) { /** @type {?} */ var former = _currentInjector; _currentInjector = injector; return former; } /** * Current implementation of inject. * * By default, it is `injectInjectorOnly`, which makes it `Injector`-only aware. It can be changed * to `directiveInject`, which brings in the `NodeInjector` system of ivy. It is designed this * way for two reasons: * 1. `Injector` should not depend on ivy logic. * 2. To maintain tree shake-ability we don't want to bring in unnecessary code. * @type {?} */ var _injectImplementation; /** * Sets the current inject implementation. * @param {?} impl * @return {?} */ function setInjectImplementation(impl) { /** @type {?} */ var previous = _injectImplementation; _injectImplementation = impl; return previous; } /** * @template T * @param {?} token * @param {?=} flags * @return {?} */ function injectInjectorOnly(token) { var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : InjectFlags.Default; if (_currentInjector === undefined) { throw new Error("inject() must be called from an injection context"); } else if (_currentInjector === null) { return injectRootLimpMode(token, undefined, flags); } else { return _currentInjector.get(token, flags & InjectFlags.Optional ? null : undefined, flags); } } /** * @template T * @param {?} token * @param {?=} flags * @return {?} */ function ɵɵinject(token) { var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : InjectFlags.Default; return (_injectImplementation || injectInjectorOnly)(token, flags); } /** * Injects a token from the currently active injector. * * Must be used in the context of a factory function such as one defined for an * `InjectionToken`. Throws an error if not called from such a context. * * Within such a factory function, using this function to request injection of a dependency * is faster and more type-safe than providing an additional array of dependencies * (as has been common with `useFactory` providers). * * \@param token The injection token for the dependency to be injected. * \@param flags Optional flags that control how injection is executed. * The flags correspond to injection strategies that can be specified with * parameter decorators `\@Host`, `\@Self`, `\@SkipSef`, and `\@Optional`. * \@return True if injection is successful, null otherwise. * * \@usageNotes * * ### Example * * {\@example core/di/ts/injector_spec.ts region='ShakableInjectionToken'} * * \@publicApi * @type {?} */ var inject = ɵɵinject; /** * Injects `root` tokens in limp mode. * * If no injector exists, we can still inject tree-shakable providers which have `providedIn` set to * `"root"`. This is known as the limp mode injection. In such case the value is stored in the * `InjectableDef`. * @template T * @param {?} token * @param {?} notFoundValue * @param {?} flags * @return {?} */ function injectRootLimpMode(token, notFoundValue, flags) { /** @type {?} */ var injectableDef = getInjectableDef(token); if (injectableDef && injectableDef.providedIn == 'root') { return injectableDef.value === undefined ? injectableDef.value = injectableDef.factory() : injectableDef.value; } if (flags & InjectFlags.Optional) return null; if (notFoundValue !== undefined) return notFoundValue; throw new Error("Injector: NOT_FOUND [".concat(stringify(token), "]")); } /** * @param {?} types * @return {?} */ function injectArgs(types) { /** @type {?} */ var args = []; for (var i = 0; i < types.length; i++) { /** @type {?} */ var arg = resolveForwardRef(types[i]); if (Array.isArray(arg)) { if (arg.length === 0) { throw new Error('Arguments array must have arguments.'); } /** @type {?} */ var type = undefined; /** @type {?} */ var flags = InjectFlags.Default; for (var j = 0; j < arg.length; j++) { /** @type {?} */ var meta = arg[j]; if (meta instanceof Optional || meta.ngMetadataName === 'Optional' || meta === Optional) { flags |= InjectFlags.Optional; } else if (meta instanceof SkipSelf || meta.ngMetadataName === 'SkipSelf' || meta === SkipSelf) { flags |= InjectFlags.SkipSelf; } else if (meta instanceof Self || meta.ngMetadataName === 'Self' || meta === Self) { flags |= InjectFlags.Self; } else if (meta instanceof Inject || meta === Inject) { type = meta.token; } else { type = meta; } } args.push(ɵɵinject( /** @type {?} */ type, flags)); } else { args.push(ɵɵinject(arg)); } } return args; } var NullInjector = /*#__PURE__*/function () { function NullInjector() { _classCallCheck(this, NullInjector); } _createClass2(NullInjector, [{ key: "get", /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ value: function get(token) { var notFoundValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : THROW_IF_NOT_FOUND; if (notFoundValue === THROW_IF_NOT_FOUND) { // Intentionally left behind: With dev tools open the debugger will stop here. There is no // reason why correctly written application should cause this exception. // TODO(misko): uncomment the next line once `ngDevMode` works with closure. // if(ngDevMode) debugger; /** @type {?} */ var error = new Error("NullInjectorError: No provider for ".concat(stringify(token), "!")); error.name = 'NullInjectorError'; throw error; } return notFoundValue; } }]); return NullInjector; }(); /** * @param {?} e * @param {?} token * @param {?} injectorErrorName * @param {?} source * @return {?} */ function catchInjectorError(e, token, injectorErrorName, source) { /** @type {?} */ var tokenPath = e[NG_TEMP_TOKEN_PATH]; if (token[SOURCE]) { tokenPath.unshift(token[SOURCE]); } e.message = formatError('\n' + e.message, tokenPath, injectorErrorName, source); e[NG_TOKEN_PATH] = tokenPath; e[NG_TEMP_TOKEN_PATH] = null; throw e; } /** * @param {?} text * @param {?} obj * @param {?} injectorErrorName * @param {?=} source * @return {?} */ function formatError(text, obj, injectorErrorName) { var source = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; text = text && text.charAt(0) === '\n' && text.charAt(1) == NO_NEW_LINE ? text.substr(2) : text; /** @type {?} */ var context = stringify(obj); if (obj instanceof Array) { context = obj.map(stringify).join(' -> '); } else if (typeof obj === 'object') { /** @type {?} */ var parts = /** @type {?} */ []; for (var key in obj) { if (obj.hasOwnProperty(key)) { /** @type {?} */ var value = obj[key]; parts.push(key + ':' + (typeof value === 'string' ? JSON.stringify(value) : stringify(value))); } } context = "{".concat(parts.join(', '), "}"); } return "".concat(injectorErrorName).concat(source ? '(' + source + ')' : '', "[").concat(context, "]: ").concat(text.replace(NEW_LINE, '\n ')); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A mapping of the \@angular/core API surface used in generated expressions to the actual symbols. * * This should be kept up to date with the public exports of \@angular/core. * @type {?} */ var angularCoreDiEnv = { 'ɵɵdefineInjectable': ɵɵdefineInjectable, 'ɵɵdefineInjector': ɵɵdefineInjector, 'ɵɵinject': ɵɵinject, 'ɵɵgetFactoryOf': getFactoryOf }; /** * @template T * @param {?} type * @return {?} */ function getFactoryOf(type) { /** @type {?} */ var typeAny = /** @type {?} */ type; /** @type {?} */ var def = getInjectableDef(typeAny) || getInjectorDef(typeAny); if (!def || def.factory === undefined) { return null; } return def.factory; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Represents an instance of an NgModule created via a {\@link NgModuleFactory}. * * `NgModuleRef` provides access to the NgModule Instance as well other objects related to this * NgModule Instance. * * \@publicApi * @abstract * @template T */ var NgModuleRef = function NgModuleRef() { _classCallCheck(this, NgModuleRef); }; if (false) {} /** * @record * @template T */ function InternalNgModuleRef() {} if (false) {} /** * \@publicApi * @abstract * @template T */ var NgModuleFactory = function NgModuleFactory() { _classCallCheck(this, NgModuleFactory); }; if (false) {} /** * @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 */ /** * Equivalent to ES6 spread, add each item to an array. * * @param items The items to add * @param arr The array to which you want to add the items */ function addAllToArray(items, arr) { for (var i = 0; i < items.length; i++) { arr.push(items[i]); } } /** * Flattens an array. */ function flatten(list, dst) { if (dst === undefined) dst = list; for (var i = 0; i < list.length; i++) { var item = list[i]; if (Array.isArray(item)) { // we need to inline it. if (dst === list) { // Our assumption that the list was already flat was wrong and // we need to clone flat since we need to write to it. dst = list.slice(0, i); } flatten(item, dst); } else if (dst !== list) { dst.push(item); } } return dst; } function deepForEach(input, fn) { input.forEach(function (value) { return Array.isArray(value) ? deepForEach(value, fn) : fn(value); }); } function addToArray(arr, index, value) { // perf: array.push is faster than array.splice! if (index >= arr.length) { arr.push(value); } else { arr.splice(index, 0, value); } } function removeFromArray(arr, index) { // perf: array.pop is faster than array.splice! if (index >= arr.length - 1) { return arr.pop(); } else { return arr.splice(index, 1)[0]; } } /** * @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 */ function assertNumber(actual, msg) { if (typeof actual != 'number') { throwError(msg); } } function assertEqual(actual, expected, msg) { if (actual != expected) { throwError(msg); } } function assertNotEqual(actual, expected, msg) { if (actual == expected) { throwError(msg); } } function assertSame(actual, expected, msg) { if (actual !== expected) { throwError(msg); } } function assertNotSame(actual, expected, msg) { if (actual === expected) { throwError(msg); } } function assertLessThan(actual, expected, msg) { if (actual >= expected) { throwError(msg); } } function assertGreaterThan(actual, expected, msg) { if (actual <= expected) { throwError(msg); } } function assertNotDefined(actual, msg) { if (actual != null) { throwError(msg); } } function assertDefined(actual, msg) { if (actual == null) { throwError(msg); } } function throwError(msg) { // tslint:disable-next-line debugger; // Left intentionally for better debugger experience. throw new Error("ASSERTION ERROR: ".concat(msg)); } function assertDomNode(node) { // If we're in a worker, `Node` will not be defined. assertEqual(typeof Node !== 'undefined' && node instanceof Node || typeof node === 'object' && node != null && node.constructor.name === 'WebWorkerRenderNode', true, "The provided value must be an instance of a DOM Node but got ".concat(stringify(node))); } function assertDataInRange(arr, index) { var maxLen = arr ? arr.length : 0; assertLessThan(index, maxLen, "Index expected to be less than ".concat(maxLen, " but got ").concat(index)); } /** * @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 */ function ngDevModeResetPerfCounters() { var locationString = typeof location !== 'undefined' ? location.toString() : ''; var newCounters = { namedConstructors: locationString.indexOf('ngDevMode=namedConstructors') != -1, firstTemplatePass: 0, tNode: 0, tView: 0, rendererCreateTextNode: 0, rendererSetText: 0, rendererCreateElement: 0, rendererAddEventListener: 0, rendererSetAttribute: 0, rendererRemoveAttribute: 0, rendererSetProperty: 0, rendererSetClassName: 0, rendererAddClass: 0, rendererRemoveClass: 0, rendererSetStyle: 0, rendererRemoveStyle: 0, rendererDestroy: 0, rendererDestroyNode: 0, rendererMoveNode: 0, rendererRemoveNode: 0, rendererAppendChild: 0, rendererInsertBefore: 0, rendererCreateComment: 0, styleMap: 0, styleMapCacheMiss: 0, classMap: 0, classMapCacheMiss: 0, styleProp: 0, stylePropCacheMiss: 0, classProp: 0, classPropCacheMiss: 0, flushStyling: 0, classesApplied: 0, stylesApplied: 0, stylingWritePersistedState: 0, stylingReadPersistedState: 0 }; // Make sure to refer to ngDevMode as ['ngDevMode'] for closure. var allowNgDevModeTrue = locationString.indexOf('ngDevMode=false') === -1; _global['ngDevMode'] = allowNgDevModeTrue && newCounters; return newCounters; } /** * This checks to see if the `ngDevMode` has been set. If yes, * then we honor it, otherwise we default to dev mode with additional checks. * * The idea is that unless we are doing production build where we explicitly * set `ngDevMode == false` we should be helping the developer by providing * as much early warning and errors as possible. * * NOTE: changes to the `ngDevMode` name must be synced with `compiler-cli/src/tooling.ts`. */ if (typeof ngDevMode === 'undefined' || ngDevMode) { ngDevModeResetPerfCounters(); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** @enum {number} */ var ChangeDetectionStrategy = { /** * Use the `CheckOnce` strategy, meaning that automatic change detection is deactivated * until reactivated by setting the strategy to `Default` (`CheckAlways`). * Change detection can still be explicitly invoked. * This strategy applies to all child directives and cannot be overridden. */ OnPush: 0, /** * Use the default `CheckAlways` strategy, in which change detection is automatic until * explicitly deactivated. */ Default: 1 }; ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = 'OnPush'; ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = 'Default'; /** @enum {number} */ var ChangeDetectorStatus = { /** * A state in which, after calling `detectChanges()`, the change detector * state becomes `Checked`, and must be explicitly invoked or reactivated. */ CheckOnce: 0, /** * A state in which change detection is skipped until the change detector mode * becomes `CheckOnce`. */ Checked: 1, /** * A state in which change detection continues automatically until explicitly * deactivated. */ CheckAlways: 2, /** * A state in which a change detector sub tree is not a part of the main tree and * should be skipped. */ Detached: 3, /** * Indicates that the change detector encountered an error checking a binding * or calling a directive lifecycle method and is now in an inconsistent state. Change * detectors in this state do not detect changes. */ Errored: 4, /** * Indicates that the change detector has been destroyed. */ Destroyed: 5 }; ChangeDetectorStatus[ChangeDetectorStatus.CheckOnce] = 'CheckOnce'; ChangeDetectorStatus[ChangeDetectorStatus.Checked] = 'Checked'; ChangeDetectorStatus[ChangeDetectorStatus.CheckAlways] = 'CheckAlways'; ChangeDetectorStatus[ChangeDetectorStatus.Detached] = 'Detached'; ChangeDetectorStatus[ChangeDetectorStatus.Errored] = 'Errored'; ChangeDetectorStatus[ChangeDetectorStatus.Destroyed] = 'Destroyed'; /** * Reports whether a given strategy is currently the default for change detection. * @see `ChangeDetectorStatus` / `ChangeDetectorRef` * @param {?} changeDetectionStrategy The strategy to check. * @return {?} True if the given strategy is the current default, false otherwise. */ function isDefaultChangeDetectionStrategy(changeDetectionStrategy) { return changeDetectionStrategy == null || changeDetectionStrategy === ChangeDetectionStrategy.Default; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** @enum {number} */ var ViewEncapsulation = { /** * Emulate `Native` scoping of styles by adding an attribute containing surrogate id to the Host * Element and pre-processing the style rules provided via {@link Component#styles styles} or * {@link Component#styleUrls styleUrls}, and adding the new Host Element attribute to all * selectors. * * This is the default option. */ Emulated: 0, /** * @deprecated v6.1.0 - use {ViewEncapsulation.ShadowDom} instead. * Use the native encapsulation mechanism of the renderer. * * For the DOM this means using the deprecated [Shadow DOM * v0](https://w3c.github.io/webcomponents/spec/shadow/) and * creating a ShadowRoot for Component's Host Element. */ Native: 1, /** * Don't provide any template or style encapsulation. */ None: 2, /** * Use Shadow DOM to encapsulate styles. * * For the DOM this means using modern [Shadow * DOM](https://w3c.github.io/webcomponents/spec/shadow/) and * creating a ShadowRoot for Component's Host Element. */ ShadowDom: 3 }; ViewEncapsulation[ViewEncapsulation.Emulated] = 'Emulated'; ViewEncapsulation[ViewEncapsulation.Native] = 'Native'; ViewEncapsulation[ViewEncapsulation.None] = 'None'; ViewEncapsulation[ViewEncapsulation.ShadowDom] = 'ShadowDom'; /** * @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 */ /** * Convince closure compiler that the wrapped function has no side-effects. * * Closure compiler always assumes that `toString` has no side-effects. We use this quirk to * allow us to execute a function but have closure compiler mark the call as no-side-effects. * It is important that the return value for the `noSideEffects` function be assigned * to something which is retained otherwise the call to `noSideEffects` will be removed by closure * compiler. */ function noSideEffects(fn) { return '' + { toString: fn }; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * This file contains reuseable "empty" symbols that can be used as default return values * in different parts of the rendering code. Because the same symbols are returned, this * allows for identity checks against these values to be consistently used by the framework * code. * @type {?} */ var EMPTY_OBJ = {}; /** @type {?} */ var EMPTY_ARRAY = []; // freezing the values prevents any code from accidentally inserting new values in if (typeof ngDevMode !== 'undefined' && ngDevMode) { // These property accesses can be ignored because ngDevMode will be set to false // when optimizing code and the whole if statement will be dropped. // tslint:disable-next-line:no-toplevel-property-access Object.freeze(EMPTY_OBJ); // tslint:disable-next-line:no-toplevel-property-access Object.freeze(EMPTY_ARRAY); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var NG_COMPONENT_DEF = getClosureSafeProperty({ ngComponentDef: getClosureSafeProperty }); /** @type {?} */ var NG_DIRECTIVE_DEF = getClosureSafeProperty({ ngDirectiveDef: getClosureSafeProperty }); /** @type {?} */ var NG_PIPE_DEF = getClosureSafeProperty({ ngPipeDef: getClosureSafeProperty }); /** @type {?} */ var NG_MODULE_DEF = getClosureSafeProperty({ ngModuleDef: getClosureSafeProperty }); /** @type {?} */ var NG_LOCALE_ID_DEF = getClosureSafeProperty({ ngLocaleIdDef: getClosureSafeProperty }); /** @type {?} */ var NG_BASE_DEF = getClosureSafeProperty({ ngBaseDef: getClosureSafeProperty }); // TODO(misko): This is wrong. The NG_ELEMENT_ID should never be minified. /** * If a directive is diPublic, bloomAdd sets a property on the type with this constant as * the key and the directive's unique ID as the value. This allows us to map directives to their * bloom filter bit for DI. * @type {?} */ var NG_ELEMENT_ID = getClosureSafeProperty({ __NG_ELEMENT_ID__: getClosureSafeProperty }); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var _renderCompCount = 0; /** * Create a component definition object. * * * # Example * ``` * class MyDirective { * // Generated by Angular Template Compiler * // [Symbol] syntax will not be supported by TypeScript until v2.7 * static ngComponentDef = defineComponent({ * ... * }); * } * ``` * \@codeGenApi * @template T * @param {?} componentDefinition * @return {?} */ function ɵɵdefineComponent(componentDefinition) { /** @type {?} */ var type = componentDefinition.type; /** @type {?} */ var typePrototype = type.prototype; /** @type {?} */ var declaredInputs = /** @type {?} */ {}; /** @type {?} */ var def = { type: type, providersResolver: null, consts: componentDefinition.consts, vars: componentDefinition.vars, factory: componentDefinition.factory, template: componentDefinition.template || /** @type {?} */ null, ngContentSelectors: componentDefinition.ngContentSelectors, hostBindings: componentDefinition.hostBindings || null, contentQueries: componentDefinition.contentQueries || null, declaredInputs: declaredInputs, inputs: /** @type {?} */ null, // assigned in noSideEffects outputs: /** @type {?} */ null, // assigned in noSideEffects exportAs: componentDefinition.exportAs || null, onChanges: null, onInit: typePrototype.ngOnInit || null, doCheck: typePrototype.ngDoCheck || null, afterContentInit: typePrototype.ngAfterContentInit || null, afterContentChecked: typePrototype.ngAfterContentChecked || null, afterViewInit: typePrototype.ngAfterViewInit || null, afterViewChecked: typePrototype.ngAfterViewChecked || null, onDestroy: typePrototype.ngOnDestroy || null, onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush, directiveDefs: /** @type {?} */ null, // assigned in noSideEffects pipeDefs: /** @type {?} */ null, // assigned in noSideEffects selectors: componentDefinition.selectors, viewQuery: componentDefinition.viewQuery || null, features: /** @type {?} */ componentDefinition.features || null, data: componentDefinition.data || {}, // TODO(misko): convert ViewEncapsulation into const enum so that it can be used directly in the // next line. Also `None` should be 0 not 2. encapsulation: componentDefinition.encapsulation || ViewEncapsulation.Emulated, id: 'c', styles: componentDefinition.styles || EMPTY_ARRAY, _: /** @type {?} */ null, setInput: null, schemas: componentDefinition.schemas || null, tView: null }; def._ = /** @type {?} */ noSideEffects( /** * @return {?} */ function () { /** @type {?} */ var directiveTypes = /** @type {?} */ componentDefinition.directives; /** @type {?} */ var feature = componentDefinition.features; /** @type {?} */ var pipeTypes = /** @type {?} */ componentDefinition.pipes; def.id += _renderCompCount++; def.inputs = invertObject(componentDefinition.inputs, declaredInputs), def.outputs = invertObject(componentDefinition.outputs), feature && feature.forEach( /** * @param {?} fn * @return {?} */ function (fn) { return fn(def); }); def.directiveDefs = directiveTypes ? /** * @return {?} */ function () { return (typeof directiveTypes === 'function' ? directiveTypes() : directiveTypes).map(extractDirectiveDef); } : null; def.pipeDefs = pipeTypes ? /** * @return {?} */ function () { return (typeof pipeTypes === 'function' ? pipeTypes() : pipeTypes).map(extractPipeDef); } : null; // Add ngInjectableDef so components are reachable through the module injector by default // (unless it has already been set by the @Injectable decorator). This is mostly to // support injecting components in tests. In real application code, components should // be retrieved through the node injector, so this isn't a problem. if (!type.hasOwnProperty(NG_INJECTABLE_DEF)) { /** @type {?} */ type[NG_INJECTABLE_DEF] = ɵɵdefineInjectable({ token: type, factory: /** @type {?} */ componentDefinition.factory }); } }); return ( /** @type {?} */ def ); } /** * \@codeGenApi * @param {?} type * @param {?} directives * @param {?} pipes * @return {?} */ function ɵɵsetComponentScope(type, directives, pipes) { /** @type {?} */ var def = /** @type {?} */ type.ngComponentDef; def.directiveDefs = /** * @return {?} */ function () { return directives.map(extractDirectiveDef); }; def.pipeDefs = /** * @return {?} */ function () { return pipes.map(extractPipeDef); }; } /** * @param {?} type * @return {?} */ function extractDirectiveDef(type) { /** @type {?} */ var def = getComponentDef(type) || getDirectiveDef(type); if (ngDevMode && !def) { throw new Error("'".concat(type.name, "' is neither 'ComponentType' or 'DirectiveType'.")); } return ( /** @type {?} */ def ); } /** * @param {?} type * @return {?} */ function extractPipeDef(type) { /** @type {?} */ var def = getPipeDef(type); if (ngDevMode && !def) { throw new Error("'".concat(type.name, "' is not a 'PipeType'.")); } return ( /** @type {?} */ def ); } /** * \@codeGenApi * @template T * @param {?} def * @return {?} */ function ɵɵdefineNgModule(def) { /** @type {?} */ var res = { type: def.type, bootstrap: def.bootstrap || EMPTY_ARRAY, declarations: def.declarations || EMPTY_ARRAY, imports: def.imports || EMPTY_ARRAY, exports: def.exports || EMPTY_ARRAY, transitiveCompileScopes: null, schemas: def.schemas || null, id: def.id || null }; return ( /** @type {?} */ res ); } /** * Adds the module metadata that is necessary to compute the module's transitive scope to an * existing module definition. * * Scope metadata of modules is not used in production builds, so calls to this function can be * marked pure to tree-shake it from the bundle, allowing for all referenced declarations * to become eligible for tree-shaking as well. * * \@codeGenApi * @param {?} type * @param {?} scope * @return {?} */ function ɵɵsetNgModuleScope(type, scope) { return ( /** @type {?} */ noSideEffects( /** * @return {?} */ function () { /** @type {?} */ /** @nocollapse */ var ngModuleDef = getNgModuleDef(type, true); ngModuleDef.declarations = scope.declarations || EMPTY_ARRAY; ngModuleDef.imports = scope.imports || EMPTY_ARRAY; ngModuleDef.exports = scope.exports || EMPTY_ARRAY; }) ); } /** * Inverts an inputs or outputs lookup such that the keys, which were the * minified keys, are part of the values, and the values are parsed so that * the publicName of the property is the new key * * e.g. for * * ``` * class Comp { * \@Input() * propName1: string; * * \@Input('publicName2') * declaredPropName2: number; * } * ``` * * will be serialized as * * ``` * { * propName1: 'propName1', * declaredPropName2: ['publicName2', 'declaredPropName2'], * } * ``` * * which is than translated by the minifier as: * * ``` * { * minifiedPropName1: 'propName1', * minifiedPropName2: ['publicName2', 'declaredPropName2'], * } * ``` * * becomes: (public name => minifiedName) * * ``` * { * 'propName1': 'minifiedPropName1', * 'publicName2': 'minifiedPropName2', * } * ``` * * Optionally the function can take `secondary` which will result in: (public name => declared name) * * ``` * { * 'propName1': 'propName1', * 'publicName2': 'declaredPropName2', * } * ``` * * @template T * @param {?=} obj * @param {?=} secondary * @return {?} */ function invertObject(obj, secondary) { if (obj == null) return ( /** @type {?} */ EMPTY_OBJ ); /** @type {?} */ var newLookup = {}; for (var minifiedKey in obj) { if (obj.hasOwnProperty(minifiedKey)) { /** @type {?} */ var publicName = /** @type {?} */ obj[minifiedKey]; /** @type {?} */ var declaredName = publicName; if (Array.isArray(publicName)) { declaredName = publicName[1]; publicName = publicName[0]; } newLookup[publicName] = minifiedKey; if (secondary) { secondary[publicName] = /** @type {?} */ declaredName; } } } return newLookup; } /** * Create a base definition * * # Example * ```ts * class ShouldBeInherited { * static ngBaseDef = ɵɵdefineBase({ * ... * }) * } * ``` * * \@codeGenApi * @template T * @param {?} baseDefinition The base definition parameters * * @return {?} */ function ɵɵdefineBase(baseDefinition) { /** @type {?} */ var declaredInputs = /** @type {?} */ {}; return { inputs: invertObject( /** @type {?} */ baseDefinition.inputs, declaredInputs), declaredInputs: declaredInputs, outputs: invertObject( /** @type {?} */ baseDefinition.outputs), viewQuery: baseDefinition.viewQuery || null, contentQueries: baseDefinition.contentQueries || null, hostBindings: baseDefinition.hostBindings || null }; } /** * Create a directive definition object. * * # Example * ```ts * class MyDirective { * // Generated by Angular Template Compiler * // [Symbol] syntax will not be supported by TypeScript until v2.7 * static ngDirectiveDef = ɵɵdefineDirective({ * ... * }); * } * ``` * * \@codeGenApi * @type {?} */ var ɵɵdefineDirective = /** @type {?} */ /** @type {?} */ ɵɵdefineComponent; /** * Create a pipe definition object. * * # Example * ``` * class MyPipe implements PipeTransform { * // Generated by Angular Template Compiler * static ngPipeDef = definePipe({ * ... * }); * } * ``` * \@codeGenApi * @template T * @param {?} pipeDef Pipe definition generated by the compiler * * @return {?} */ function ɵɵdefinePipe(pipeDef) { return ( /** @type {?} */ /** @type {?} */ { name: pipeDef.name, factory: pipeDef.factory, pure: pipeDef.pure !== false, onDestroy: pipeDef.type.prototype.ngOnDestroy || null } ); } /** * The following getter methods retrieve the definition form the type. Currently the retrieval * honors inheritance, but in the future we may change the rule to require that definitions are * explicit. This would require some sort of migration strategy. * @template T * @param {?} type * @return {?} */ function getComponentDef(type) { return ( /** @type {?} */ type[NG_COMPONENT_DEF] || null ); } /** * @template T * @param {?} type * @return {?} */ function getDirectiveDef(type) { return ( /** @type {?} */ type[NG_DIRECTIVE_DEF] || null ); } /** * @template T * @param {?} type * @return {?} */ function getPipeDef(type) { return ( /** @type {?} */ type[NG_PIPE_DEF] || null ); } /** * @template T * @param {?} type * @return {?} */ function getBaseDef(type) { return ( /** @type {?} */ type[NG_BASE_DEF] || null ); } /** * @template T * @param {?} type * @param {?=} throwNotFound * @return {?} */ function getNgModuleDef(type, throwNotFound) { /** @type {?} */ /** @nocollapse */ var ngModuleDef = /** @type {?} */ type[NG_MODULE_DEF] || null; if (!ngModuleDef && throwNotFound === true) { throw new Error("Type ".concat(stringify(type), " does not have 'ngModuleDef' property.")); } return ngModuleDef; } /** * @param {?} type * @return {?} */ function getNgLocaleIdDef(type) { return ( /** @type {?} */ type[NG_LOCALE_ID_DEF] || null ); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ // Below are constants for LView indices to help us look up LView members // without having to remember the specific indices. // Uglify will inline these when minifying so there shouldn't be a cost. /** @type {?} */ var HOST = 0; /** @type {?} */ var TVIEW = 1; /** @type {?} */ var FLAGS = 2; /** @type {?} */ var PARENT = 3; /** @type {?} */ var NEXT = 4; /** @type {?} */ var QUERIES = 5; /** @type {?} */ var T_HOST = 6; /** @type {?} */ var BINDING_INDEX = 7; /** @type {?} */ var CLEANUP = 8; /** @type {?} */ var CONTEXT = 9; /** @type {?} */ var INJECTOR$1 = 10; /** @type {?} */ var RENDERER_FACTORY = 11; /** @type {?} */ var RENDERER = 12; /** @type {?} */ var SANITIZER = 13; /** @type {?} */ var CHILD_HEAD = 14; /** @type {?} */ var CHILD_TAIL = 15; /** @type {?} */ var DECLARATION_VIEW = 16; /** @type {?} */ var DECLARATION_LCONTAINER = 17; /** @type {?} */ var PREORDER_HOOK_FLAGS = 18; /** * Size of LView's header. Necessary to adjust for it when setting slots. * @type {?} */ var HEADER_OFFSET = 19; /** * @record */ function OpaqueViewState() {} if (false) {} /** * `LView` stores all of the information needed to process the instructions as * they are invoked from the template. Each embedded view and component view has its * own `LView`. When processing a particular view, we set the `viewData` to that * `LView`. When that view is done processing, the `viewData` is set back to * whatever the original `viewData` was before (the parent `LView`). * * Keeping separate state for each view facilities view insertion / deletion, so we * don't have to edit the data array based on which views are present. * @record */ function LView() {} if (false) {} /** @enum {number} */ var LViewFlags = { /** The state of the init phase on the first 2 bits */ InitPhaseStateIncrementer: 1, InitPhaseStateMask: 3, /** * Whether or not the view is in creationMode. * * This must be stored in the view rather than using `data` as a marker so that * we can properly support embedded views. Otherwise, when exiting a child view * back into the parent view, `data` will be defined and `creationMode` will be * improperly reported as false. */ CreationMode: 4, /** * Whether or not this LView instance is on its first processing pass. * * An LView instance is considered to be on its "first pass" until it * has completed one creation mode run and one update mode run. At this * time, the flag is turned off. */ FirstLViewPass: 8, /** Whether this view has default change detection strategy (checks always) or onPush */ CheckAlways: 16, /** * Whether or not manual change detection is turned on for onPush components. * * This is a special mode that only marks components dirty in two cases: * 1) There has been a change to an @Input property * 2) `markDirty()` has been called manually by the user * * Note that in this mode, the firing of events does NOT mark components * dirty automatically. * * Manual mode is turned off by default for backwards compatibility, as events * automatically mark OnPush components dirty in View Engine. * * TODO: Add a public API to ChangeDetectionStrategy to turn this mode on */ ManualOnPush: 32, /** Whether or not this view is currently dirty (needing check) */ Dirty: 64, /** Whether or not this view is currently attached to change detection tree. */ Attached: 128, /** Whether or not this view is destroyed. */ Destroyed: 256, /** Whether or not this view is the root view */ IsRoot: 512, /** * Index of the current init phase on last 22 bits */ IndexWithinInitPhaseIncrementer: 1024, IndexWithinInitPhaseShift: 10, IndexWithinInitPhaseReset: 1023 }; /** @enum {number} */ var InitPhaseState = { OnInitHooksToBeRun: 0, AfterContentInitHooksToBeRun: 1, AfterViewInitHooksToBeRun: 2, InitPhaseCompleted: 3 }; /** @enum {number} */ var PreOrderHookFlags = { /** The index of the next pre-order hook to be called in the hooks array, on the first 16 bits */ IndexOfTheNextPreOrderHookMaskMask: 65535, /** * The number of init hooks that have already been called, on the last 16 bits */ NumberOfInitHooksCalledIncrementer: 65536, NumberOfInitHooksCalledShift: 16, NumberOfInitHooksCalledMask: 4294901760 }; /** * Set of instructions used to process host bindings efficiently. * * See VIEW_DATA.md for more information. * @record */ function ExpandoInstructions() {} /** * The static data for an LView (shared between all templates of a * given type). * * Stored on the `ComponentDef.tView`. * @record */ function TView() {} if (false) {} /** @enum {number} */ var RootContextFlags = { Empty: 0, DetectChanges: 1, FlushPlayers: 2 }; /** * RootContext contains information which is shared for all components which * were bootstrapped with {\@link renderComponent}. * @record */ function RootContext() {} if (false) {} // Note: This hack is necessary so we don't erroneously get a circular dependency // failure based on types. /** @type {?} */ var unusedValueExportToPlacateAjd = 1; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Special location which allows easy identification of type. If we have an array which was * retrieved from the `LView` and that array has `true` at `TYPE` location, we know it is * `LContainer`. * @type {?} */ var TYPE = 1; /** * Below are constants for LContainer indices to help us look up LContainer members * without having to remember the specific indices. * Uglify will inline these when minifying so there shouldn't be a cost. * @type {?} */ var ACTIVE_INDEX = 2; // PARENT and NEXT are indices 3 and 4 // As we already have these constants in LView, we don't need to re-create them. /** @type {?} */ var MOVED_VIEWS = 5; // T_HOST is index 6 // We already have this constants in LView, we don't need to re-create it. /** @type {?} */ var NATIVE = 7; /** @type {?} */ var VIEW_REFS = 8; /** * Size of LContainer's header. Represents the index after which all views in the * container will be inserted. We need to keep a record of current views so we know * which views are already in the DOM (and don't need to be re-added) and so we can * remove views from the DOM when they are no longer required. * @type {?} */ var CONTAINER_HEADER_OFFSET = 9; /** * The state associated with a container. * * This is an array so that its structure is closer to LView. This helps * when traversing the view tree (which is a mix of containers and component * views), so we can jump to viewOrContainer[NEXT] in the same way regardless * of type. * @record */ function LContainer() {} if (false) {} // Note: This hack is necessary so we don't erroneously get a circular dependency // failure based on types. /** @type {?} */ var unusedValueExportToPlacateAjd$1 = 1; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * True if `value` is `LView`. * @param {?} value wrapped value of `RNode`, `LView`, `LContainer` * @return {?} */ function isLView(value) { return Array.isArray(value) && typeof value[TYPE] === 'object'; } /** * True if `value` is `LContainer`. * @param {?} value wrapped value of `RNode`, `LView`, `LContainer` * @return {?} */ function isLContainer(value) { return Array.isArray(value) && value[TYPE] === true; } /** * @param {?} tNode * @return {?} */ function isContentQueryHost(tNode) { return (tNode.flags & 4 /* hasContentQuery */ ) !== 0; } /** * @param {?} tNode * @return {?} */ function isComponent(tNode) { return (tNode.flags & 1 /* isComponent */ ) === 1 /* isComponent */ ; } /** * @template T * @param {?} def * @return {?} */ function isComponentDef(def) { return ( /** @type {?} */ def.template !== null ); } /** * @param {?} target * @return {?} */ function isRootView(target) { return (target[FLAGS] & 512 /* IsRoot */ ) !== 0; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} tNode * @param {?} lView * @return {?} */ function assertTNodeForLView(tNode, lView) { tNode.hasOwnProperty('tView_') && assertEqual( /** @type {?} */ /** @type {?} */ tNode.tView_, lView[TVIEW], 'This TNode does not belong to this LView.'); } /** * @param {?} actual * @param {?=} msg * @return {?} */ function assertComponentType(actual) { var msg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Type passed in is not ComponentType, it does not have \'ngComponentDef\' property.'; if (!getComponentDef(actual)) { throwError(msg); } } /** * @param {?} actual * @param {?=} msg * @return {?} */ function assertNgModuleType(actual) { var msg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'Type passed in is not NgModuleType, it does not have \'ngModuleDef\' property.'; if (!getNgModuleDef(actual)) { throwError(msg); } } /** * @param {?} isParent * @return {?} */ function assertPreviousIsParent(isParent) { assertEqual(isParent, true, 'previousOrParentTNode should be a parent'); } /** * @param {?} tNode * @return {?} */ function assertHasParent(tNode) { assertDefined(tNode, 'previousOrParentTNode should exist!'); assertDefined( /** @type {?} */ tNode.parent, 'previousOrParentTNode should have a parent'); } /** * @param {?} lView * @param {?} index * @param {?=} arr * @return {?} */ function assertDataNext(lView, index, arr) { if (arr == null) arr = lView; assertEqual(arr.length, index, "index ".concat(index, " expected to be at the end of arr (length ").concat(arr.length, ")")); } /** * @param {?} value * @return {?} */ function assertLContainerOrUndefined(value) { value && assertEqual(isLContainer(value), true, 'Expecting LContainer or undefined or null'); } /** * @param {?} value * @return {?} */ function assertLContainer(value) { assertDefined(value, 'LContainer must be defined'); assertEqual(isLContainer(value), true, 'Expecting LContainer'); } /** * @param {?} value * @return {?} */ function assertLViewOrUndefined(value) { value && assertEqual(isLView(value), true, 'Expecting LView or undefined or null'); } /** * @param {?} value * @return {?} */ function assertLView(value) { assertDefined(value, 'LView must be defined'); assertEqual(isLView(value), true, 'Expecting LView'); } /** * @param {?} tView * @param {?} errMessage * @return {?} */ function assertFirstTemplatePass(tView, errMessage) { assertEqual(tView.firstTemplatePass, true, errMessage); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** @type {?} */ var TNODE = 8; /** @type {?} */ var PARENT_INJECTOR = 8; /** @type {?} */ var INJECTOR_BLOOM_PARENT_SIZE = 9; /** * Represents a relative location of parent injector. * * The interfaces encodes number of parents `LView`s to traverse and index in the `LView` * pointing to the parent injector. * @record */ function RelativeInjectorLocation() {} if (false) {} /** @enum {number} */ var RelativeInjectorLocationFlags = { InjectorIndexMask: 32767, ViewOffsetShift: 16, NO_PARENT: -1 }; /** @type {?} */ var NO_PARENT_INJECTOR = /** @type {?} */ -1; /** * Each injector is saved in 9 contiguous slots in `LView` and 9 contiguous slots in * `TView.data`. This allows us to store information about the current node's tokens (which * can be shared in `TView`) as well as the tokens of its ancestor nodes (which cannot be * shared, so they live in `LView`). * * Each of these slots (aside from the last slot) contains a bloom filter. This bloom filter * determines whether a directive is available on the associated node or not. This prevents us * from searching the directives array at this level unless it's probable the directive is in it. * * See: https://en.wikipedia.org/wiki/Bloom_filter for more about bloom filters. * * Because all injectors have been flattened into `LView` and `TViewData`, they cannot typed * using interfaces as they were previously. The start index of each `LInjector` and `TInjector` * will differ based on where it is flattened into the main array, so it's not possible to know * the indices ahead of time and save their types here. The interfaces are still included here * for documentation purposes. * * export interface LInjector extends Array<any> { * * // Cumulative bloom for directive IDs 0-31 (IDs are % BLOOM_SIZE) * [0]: number; * * // Cumulative bloom for directive IDs 32-63 * [1]: number; * * // Cumulative bloom for directive IDs 64-95 * [2]: number; * * // Cumulative bloom for directive IDs 96-127 * [3]: number; * * // Cumulative bloom for directive IDs 128-159 * [4]: number; * * // Cumulative bloom for directive IDs 160 - 191 * [5]: number; * * // Cumulative bloom for directive IDs 192 - 223 * [6]: number; * * // Cumulative bloom for directive IDs 224 - 255 * [7]: number; * * // We need to store a reference to the injector's parent so DI can keep looking up * // the injector tree until it finds the dependency it's looking for. * [PARENT_INJECTOR]: number; * } * * export interface TInjector extends Array<any> { * * // Shared node bloom for directive IDs 0-31 (IDs are % BLOOM_SIZE) * [0]: number; * * // Shared node bloom for directive IDs 32-63 * [1]: number; * * // Shared node bloom for directive IDs 64-95 * [2]: number; * * // Shared node bloom for directive IDs 96-127 * [3]: number; * * // Shared node bloom for directive IDs 128-159 * [4]: number; * * // Shared node bloom for directive IDs 160 - 191 * [5]: number; * * // Shared node bloom for directive IDs 192 - 223 * [6]: number; * * // Shared node bloom for directive IDs 224 - 255 * [7]: number; * * // Necessary to find directive indices for a particular node. * [TNODE]: TElementNode|TElementContainerNode|TContainerNode; * } */ /** * Factory for creating instances of injectors in the NodeInjector. * * This factory is complicated by the fact that it can resolve `multi` factories as well. * * NOTE: Some of the fields are optional which means that this class has two hidden classes. * - One without `multi` support (most common) * - One with `multi` values, (rare). * * Since VMs can cache up to 4 inline hidden classes this is OK. * * - Single factory: Only `resolving` and `factory` is defined. * - `providers` factory: `componentProviders` is a number and `index = -1`. * - `viewProviders` factory: `componentProviders` is a number and `index` points to `providers`. */ var NodeInjectorFactory = /** * @param {?} factory * @param {?} isViewProvider * @param {?} injectImplementation */ function NodeInjectorFactory(factory, /** * Set to `true` if the token is declared in `viewProviders` (or if it is component). */ isViewProvider, injectImplementation) { _classCallCheck(this, NodeInjectorFactory); this.factory = factory; /** * Marker set to true during factory invocation to see if we get into recursive loop. * Recursive loop causes an error to be displayed. */ this.resolving = false; this.canSeeViewProviders = isViewProvider; this.injectImpl = injectImplementation; }; if (false) {} /** * @param {?} obj * @return {?} */ function isFactory(obj) { // See: https://jsperf.com/instanceof-vs-getprototypeof return obj !== null && typeof obj == 'object' && Object.getPrototypeOf(obj) == NodeInjectorFactory.prototype; } // Note: This hack is necessary so we don't erroneously get a circular dependency // failure based on types. /** @type {?} */ var unusedValueExportToPlacateAjd$2 = 1; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} tNode * @param {?} type * @return {?} */ function assertNodeType(tNode, type) { assertDefined(tNode, 'should be called with a TNode'); assertEqual(tNode.type, type, "should be a ".concat(typeName(type))); } /** * @param {?} tNode * @param {...?} types * @return {?} */ function assertNodeOfPossibleTypes(tNode) { assertDefined(tNode, 'should be called with a TNode'); /** @type {?} */ for (var _len11 = arguments.length, types = new Array(_len11 > 1 ? _len11 - 1 : 0), _key12 = 1; _key12 < _len11; _key12++) { types[_key12 - 1] = arguments[_key12]; } var found = types.some( /** * @param {?} type * @return {?} */ function (type) { return tNode.type === type; }); assertEqual(found, true, "Should be one of ".concat(types.map(typeName).join(', '), " but got ").concat(typeName(tNode.type))); } /** * @param {?} type * @return {?} */ function typeName(type) { if (type == 1 /* Projection */ ) return 'Projection'; if (type == 0 /* Container */ ) return 'Container'; if (type == 2 /* View */ ) return 'View'; if (type == 3 /* Element */ ) return 'Element'; if (type == 4 /* ElementContainer */ ) return 'ElementContainer'; return '<unknown>'; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Adds all directive lifecycle hooks from the given `DirectiveDef` to the given `TView`. * * Must be run *only* on the first template pass. * * Sets up the pre-order hooks on the provided `tView`, * see {\@link HookData} for details about the data structure. * * @param {?} directiveIndex The index of the directive in LView * @param {?} directiveDef The definition containing the hooks to setup in tView * @param {?} tView The current TView * @param {?} nodeIndex The index of the node to which the directive is attached * @param {?} initialPreOrderHooksLength the number of pre-order hooks already registered before the * current process, used to know if the node index has to be added to the array. If it is -1, * the node index is never added. * @param {?} initialPreOrderCheckHooksLength same as previous for pre-order check hooks * @return {?} */ function registerPreOrderHooks(directiveIndex, directiveDef, tView, nodeIndex, initialPreOrderHooksLength, initialPreOrderCheckHooksLength) { ngDevMode && assertEqual(tView.firstTemplatePass, true, 'Should only be called on first template pass'); var onChanges = directiveDef.onChanges, onInit = directiveDef.onInit, doCheck = directiveDef.doCheck; if (initialPreOrderHooksLength >= 0 && (!tView.preOrderHooks || initialPreOrderHooksLength === tView.preOrderHooks.length) && (onChanges || onInit || doCheck)) { (tView.preOrderHooks || (tView.preOrderHooks = [])).push(nodeIndex); } if (initialPreOrderCheckHooksLength >= 0 && (!tView.preOrderCheckHooks || initialPreOrderCheckHooksLength === tView.preOrderCheckHooks.length) && (onChanges || doCheck)) { (tView.preOrderCheckHooks || (tView.preOrderCheckHooks = [])).push(nodeIndex); } if (onChanges) { (tView.preOrderHooks || (tView.preOrderHooks = [])).push(directiveIndex, onChanges); (tView.preOrderCheckHooks || (tView.preOrderCheckHooks = [])).push(directiveIndex, onChanges); } if (onInit) { (tView.preOrderHooks || (tView.preOrderHooks = [])).push(-directiveIndex, onInit); } if (doCheck) { (tView.preOrderHooks || (tView.preOrderHooks = [])).push(directiveIndex, doCheck); (tView.preOrderCheckHooks || (tView.preOrderCheckHooks = [])).push(directiveIndex, doCheck); } } /** * * Loops through the directives on the provided `tNode` and queues hooks to be * run that are not initialization hooks. * * Should be executed during `elementEnd()` and similar to * preserve hook execution order. Content, view, and destroy hooks for projected * components and directives must be called *before* their hosts. * * Sets up the content, view, and destroy hooks on the provided `tView`, * see {\@link HookData} for details about the data structure. * * NOTE: This does not set up `onChanges`, `onInit` or `doCheck`, those are set up * separately at `elementStart`. * * @param {?} tView The current TView * @param {?} tNode The TNode whose directives are to be searched for hooks to queue * @return {?} */ function registerPostOrderHooks(tView, tNode) { if (tView.firstTemplatePass) { // It's necessary to loop through the directives at elementEnd() (rather than processing in // directiveCreate) so we can preserve the current hook order. Content, view, and destroy // hooks for projected components and directives must be called *before* their hosts. for (var i = tNode.directiveStart, end = tNode.directiveEnd; i < end; i++) { /** @type {?} */ var _directiveDef = /** @type {?} */ tView.data[i]; if (_directiveDef.afterContentInit) { (tView.contentHooks || (tView.contentHooks = [])).push(-i, _directiveDef.afterContentInit); } if (_directiveDef.afterContentChecked) { (tView.contentHooks || (tView.contentHooks = [])).push(i, _directiveDef.afterContentChecked); (tView.contentCheckHooks || (tView.contentCheckHooks = [])).push(i, _directiveDef.afterContentChecked); } if (_directiveDef.afterViewInit) { (tView.viewHooks || (tView.viewHooks = [])).push(-i, _directiveDef.afterViewInit); } if (_directiveDef.afterViewChecked) { (tView.viewHooks || (tView.viewHooks = [])).push(i, _directiveDef.afterViewChecked); (tView.viewCheckHooks || (tView.viewCheckHooks = [])).push(i, _directiveDef.afterViewChecked); } if (_directiveDef.onDestroy != null) { (tView.destroyHooks || (tView.destroyHooks = [])).push(i, _directiveDef.onDestroy); } } } } /** * Executing hooks requires complex logic as we need to deal with 2 constraints. * * 1. Init hooks (ngOnInit, ngAfterContentInit, ngAfterViewInit) must all be executed once and only * once, across many change detection cycles. This must be true even if some hooks throw, or if * some recursively trigger a change detection cycle. * To solve that, it is required to track the state of the execution of these init hooks. * This is done by storing and maintaining flags in the view: the {@link InitPhaseState}, * and the index within that phase. They can be seen as a cursor in the following structure: * [[onInit1, onInit2], [afterContentInit1], [afterViewInit1, afterViewInit2, afterViewInit3]] * They are are stored as flags in LView[FLAGS]. * * 2. Pre-order hooks can be executed in batches, because of the select instruction. * To be able to pause and resume their execution, we also need some state about the hook's array * that is being processed: * - the index of the next hook to be executed * - the number of init hooks already found in the processed part of the array * They are are stored as flags in LView[PREORDER_HOOK_FLAGS]. */ /** * Executes necessary hooks at the start of executing a template. * * Executes hooks that are to be run during the initialization of a directive such * as `onChanges`, `onInit`, and `doCheck`. * * @param {?} currentView * @param {?} tView Static data for the view containing the hooks to be executed * @param {?} checkNoChangesMode Whether or not we're in checkNoChanges mode. * @param {?} currentNodeIndex * @return {?} */ function executePreOrderHooks(currentView, tView, checkNoChangesMode, currentNodeIndex) { if (!checkNoChangesMode) { executeHooks(currentView, tView.preOrderHooks, tView.preOrderCheckHooks, checkNoChangesMode, 0 /* OnInitHooksToBeRun */ , currentNodeIndex !== undefined ? currentNodeIndex : null); } } /** * Executes hooks against the given `LView` based off of whether or not * This is the first pass. * * @param {?} currentView The view instance data to run the hooks against * @param {?} firstPassHooks An array of hooks to run if we're in the first view pass * @param {?} checkHooks An Array of hooks to run if we're not in the first view pass. * @param {?} checkNoChangesMode Whether or not we're in no changes mode. * @param {?} initPhaseState the current state of the init phase * @param {?} currentNodeIndex 3 cases depending the the value: * - undefined: all hooks from the array should be executed (post-order case) * - null: execute hooks only from the saved index until the end of the array (pre-order case, when * flushing the remaining hooks) * - number: execute hooks only from the saved index until that node index exclusive (pre-order * case, when executing select(number)) * @return {?} */ function executeHooks(currentView, firstPassHooks, checkHooks, checkNoChangesMode, initPhaseState, currentNodeIndex) { if (checkNoChangesMode) return; /** @type {?} */ var hooksToCall = (currentView[FLAGS] & 3 /* InitPhaseStateMask */ ) === initPhaseState ? firstPassHooks : checkHooks; if (hooksToCall) { callHooks(currentView, hooksToCall, initPhaseState, currentNodeIndex); } // The init phase state must be always checked here as it may have been recursively updated if (currentNodeIndex == null && (currentView[FLAGS] & 3 /* InitPhaseStateMask */ ) === initPhaseState && initPhaseState !== 3 /* InitPhaseCompleted */ ) { currentView[FLAGS] &= 1023 /* IndexWithinInitPhaseReset */ ; currentView[FLAGS] += 1 /* InitPhaseStateIncrementer */ ; } } /** * Calls lifecycle hooks with their contexts, skipping init hooks if it's not * the first LView pass * * @param {?} currentView The current view * @param {?} arr The array in which the hooks are found * @param {?} initPhase * @param {?} currentNodeIndex 3 cases depending the the value: * - undefined: all hooks from the array should be executed (post-order case) * - null: execute hooks only from the saved index until the end of the array (pre-order case, when * flushing the remaining hooks) * - number: execute hooks only from the saved index until that node index exclusive (pre-order * case, when executing select(number)) * @return {?} */ function callHooks(currentView, arr, initPhase, currentNodeIndex) { /** @type {?} */ var startIndex = currentNodeIndex !== undefined ? currentView[PREORDER_HOOK_FLAGS] & 65535 /* IndexOfTheNextPreOrderHookMaskMask */ : 0; /** @type {?} */ var nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1; /** @type {?} */ var lastNodeIndexFound = 0; for (var i = startIndex; i < arr.length; i++) { /** @type {?} */ var hook = /** @type {?} */ arr[i + 1]; if (typeof hook === 'number') { lastNodeIndexFound = /** @type {?} */ arr[i]; if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) { break; } } else { /** @type {?} */ var isInitHook = arr[i] < 0; if (isInitHook) currentView[PREORDER_HOOK_FLAGS] += 65536 /* NumberOfInitHooksCalledIncrementer */ ; if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) { callHook(currentView, initPhase, arr, i); currentView[PREORDER_HOOK_FLAGS] = (currentView[PREORDER_HOOK_FLAGS] & 4294901760 /* NumberOfInitHooksCalledMask */ ) + i + 2; } i++; } } } /** * Execute one hook against the current `LView`. * * @param {?} currentView The current view * @param {?} initPhase * @param {?} arr The array in which the hooks are found * @param {?} i The current index within the hook data array * @return {?} */ function callHook(currentView, initPhase, arr, i) { /** @type {?} */ var isInitHook = arr[i] < 0; /** @type {?} */ var hook = /** @type {?} */ arr[i + 1]; /** @type {?} */ var directiveIndex = isInitHook ? -arr[i] : /** @type {?} */ arr[i]; /** @type {?} */ var directive = currentView[directiveIndex]; if (isInitHook) { /** @type {?} */ var indexWithintInitPhase = currentView[FLAGS] >> 10 /* IndexWithinInitPhaseShift */ ; // The init phase state must be always checked here as it may have been recursively // updated if (indexWithintInitPhase < currentView[PREORDER_HOOK_FLAGS] >> 16 /* NumberOfInitHooksCalledShift */ && (currentView[FLAGS] & 3 /* InitPhaseStateMask */ ) === initPhase) { currentView[FLAGS] += 1024 /* IndexWithinInitPhaseIncrementer */ ; hook.call(directive); } } else { hook.call(directive); } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** * -------- * * // TODO(matsko): add updateMask info * * This file contains all state-based logic for styling in Angular. * * Styling in Angular is evaluated with a series of styling-specific * template instructions which are called one after another each time * change detection occurs in Angular. * * Styling makes use of various temporary, state-based variables between * instructions so that it can better cache and optimize its values. * These values are usually populated and cleared when an element is * exited in change detection (once all the instructions are run for * that element). * * There are, however, situations where the state-based values * need to be stored and used at a later point. This ONLY occurs when * there are template-level as well as host-binding-level styling * instructions on the same element. The example below shows exactly * what could be: * * ```html * <!-- two sources of styling: the template and the directive --> * <div [style.width]="width" dir-that-sets-height></div> * ``` * * If and when this situation occurs, the current styling state is * stored in a storage map value and then later accessed once the * host bindings are evaluated. Once styling for the current element * is over then the map entry will be cleared. * * To learn more about the algorithm see `TStylingContext`. * * -------- */ /** @type {?} */ var _stylingState = null; /** @type {?} */ var _stateStorage = new Map(); // this value is not used outside this file and is only here // as a caching check for when the element changes. /** @type {?} */ var _stylingElement = null; /** * Used as a state reference for update values between style/class binding instructions. * @record */ function StylingState() {} if (false) {} /** @type {?} */ var STYLING_INDEX_START_VALUE = 1; /** @type {?} */ var BIT_MASK_START_VALUE = 0; /** * @param {?} element * @param {?=} readFromMap * @return {?} */ function getStylingState(element, readFromMap) { if (!_stylingElement || element !== _stylingElement) { _stylingElement = element; if (readFromMap) { _stylingState = _stateStorage.get(element) || null; ngDevMode && ngDevMode.stylingReadPersistedState++; } _stylingState = _stylingState || { classesBitMask: BIT_MASK_START_VALUE, classesIndex: STYLING_INDEX_START_VALUE, stylesBitMask: BIT_MASK_START_VALUE, stylesIndex: STYLING_INDEX_START_VALUE }; } return ( /** @type {?} */ _stylingState ); } /** * @return {?} */ function resetStylingState() { _stylingState = null; _stylingElement = null; } /** * @param {?} element * @param {?} state * @return {?} */ function storeStylingState(element, state) { ngDevMode && ngDevMode.stylingWritePersistedState++; _stateStorage.set(element, state); } /** * @param {?} element * @return {?} */ function deleteStylingStateFromStorage(element) { _stateStorage["delete"](element); } /** * @return {?} */ function resetAllStylingState() { resetStylingState(); _stateStorage.clear(); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 property will be monkey-patched on elements, components and directives * @type {?} */ var MONKEY_PATCH_KEY_NAME = '__ngContext__'; /** * The internal view context which is specific to a given DOM element, directive or * component instance. Each value in here (besides the LView and element node details) * can be present, null or undefined. If undefined then it implies the value has not been * looked up yet, otherwise, if null, then a lookup was executed and nothing was found. * * Each value will get filled when the respective value is examined within the getContext * function. The component, element and each directive instance will share the same instance * of the context. * @record */ function LContext() {} if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * For efficiency reasons we often put several different data types (`RNode`, `LView`, `LContainer`) * in same location in `LView`. This is because we don't want to pre-allocate space for it * because the storage is sparse. This file contains utilities for dealing with such data types. * * How do we know what is stored at a given location in `LView`. * - `Array.isArray(value) === false` => `RNode` (The normal storage value) * - `Array.isArray(value) === true` => then the `value[0]` represents the wrapped value. * - `typeof value[TYPE] === 'object'` => `LView` * - This happens when we have a component at a given location * - `typeof value[TYPE] === true` => `LContainer` * - This happens when we have `LContainer` binding at a given location. * * * NOTE: it is assumed that `Array.isArray` and `typeof` operations are very efficient. */ /** * Returns `RNode`. * @param {?} value wrapped value of `RNode`, `LView`, `LContainer` * @return {?} */ function unwrapRNode(value) { while (Array.isArray(value)) { value = /** @type {?} */ value[HOST]; } return ( /** @type {?} */ value ); } /** * Returns `LView` or `null` if not found. * @param {?} value wrapped value of `RNode`, `LView`, `LContainer` * @return {?} */ function unwrapLView(value) { while (Array.isArray(value)) { // This check is same as `isLView()` but we don't call at as we don't want to call // `Array.isArray()` twice and give JITer more work for inlining. if (typeof value[TYPE] === 'object') return ( /** @type {?} */ value ); value = /** @type {?} */ value[HOST]; } return null; } /** * Returns `LContainer` or `null` if not found. * @param {?} value wrapped value of `RNode`, `LView`, `LContainer` * @return {?} */ function unwrapLContainer(value) { while (Array.isArray(value)) { // This check is same as `isLContainer()` but we don't call at as we don't want to call // `Array.isArray()` twice and give JITer more work for inlining. if (value[TYPE] === true) return ( /** @type {?} */ value ); value = /** @type {?} */ value[HOST]; } return null; } /** * Retrieves an element value from the provided `viewData`, by unwrapping * from any containers, component views, or style contexts. * @param {?} index * @param {?} lView * @return {?} */ function getNativeByIndex(index, lView) { return unwrapRNode(lView[index + HEADER_OFFSET]); } /** * Retrieve an `RNode` for a given `TNode` and `LView`. * * This function guarantees in dev mode to retrieve a non-null `RNode`. * * @param {?} tNode * @param {?} lView * @return {?} */ function getNativeByTNode(tNode, lView) { ngDevMode && assertTNodeForLView(tNode, lView); ngDevMode && assertDataInRange(lView, tNode.index); /** @type {?} */ var node = unwrapRNode(lView[tNode.index]); ngDevMode && assertDomNode(node); return node; } /** * Retrieve an `RNode` or `null` for a given `TNode` and `LView`. * * Some `TNode`s don't have associated `RNode`s. For example `Projection` * * @param {?} tNode * @param {?} lView * @return {?} */ function getNativeByTNodeOrNull(tNode, lView) { ngDevMode && assertTNodeForLView(tNode, lView); /** @type {?} */ var index = tNode.index; /** @type {?} */ var node = index == -1 ? null : unwrapRNode(lView[index]); ngDevMode && node !== null && assertDomNode(node); return node; } /** * A helper function that returns `true` if a given `TNode` has any matching directives. * @param {?} tNode * @return {?} */ function hasDirectives(tNode) { return tNode.directiveEnd > tNode.directiveStart; } /** * @param {?} index * @param {?} view * @return {?} */ function getTNode(index, view) { ngDevMode && assertGreaterThan(index, -1, 'wrong index for TNode'); ngDevMode && assertLessThan(index, view[TVIEW].data.length, 'wrong index for TNode'); return ( /** @type {?} */ view[TVIEW].data[index + HEADER_OFFSET] ); } /** * Retrieves a value from any `LView` or `TData`. * @template T * @param {?} view * @param {?} index * @return {?} */ function loadInternal(view, index) { ngDevMode && assertDataInRange(view, index + HEADER_OFFSET); return view[index + HEADER_OFFSET]; } /** * @param {?} nodeIndex * @param {?} hostView * @return {?} */ function getComponentViewByIndex(nodeIndex, hostView) { // Could be an LView or an LContainer. If LContainer, unwrap to find LView. /** @type {?} */ var slotValue = hostView[nodeIndex]; /** @type {?} */ var lView = isLView(slotValue) ? slotValue : slotValue[HOST]; return lView; } /** * Returns the monkey-patch value data present on the target (which could be * a component, directive or a DOM node). * @param {?} target * @return {?} */ function readPatchedData(target) { ngDevMode && assertDefined(target, 'Target expected'); return target[MONKEY_PATCH_KEY_NAME]; } /** * @param {?} target * @return {?} */ function readPatchedLView(target) { /** @type {?} */ var value = readPatchedData(target); if (value) { return Array.isArray(value) ? value : /** @type {?} */ value.lView; } return null; } /** * Returns a boolean for whether the view is attached to the change detection tree. * * Note: This determines whether a view should be checked, not whether it's inserted * into a container. For that, you'll want `viewAttachedToContainer` below. * @param {?} view * @return {?} */ function viewAttachedToChangeDetector(view) { return (view[FLAGS] & 128 /* Attached */ ) === 128 /* Attached */ ; } /** * Returns a boolean for whether the view is attached to a container. * @param {?} view * @return {?} */ function viewAttachedToContainer(view) { return isLContainer(view[PARENT]); } /** * Resets the pre-order hook flags of the view. * @param {?} lView the LView on which the flags are reset * @return {?} */ function resetPreOrderHookFlags(lView) { lView[PREORDER_HOOK_FLAGS] = 0; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Store the element depth count. This is used to identify the root elements of the template * so that we can than attach `LView` to only those elements. * @type {?} */ var elementDepthCount; /** * @return {?} */ function getElementDepthCount() { // top level variables should not be exported for performance reasons (PERF_NOTES.md) return elementDepthCount; } /** * @return {?} */ function increaseElementDepthCount() { elementDepthCount++; } /** * @return {?} */ function decreaseElementDepthCount() { elementDepthCount--; } /** @type {?} */ var currentDirectiveDef = null; /** * @return {?} */ function getCurrentDirectiveDef() { // top level variables should not be exported for performance reasons (PERF_NOTES.md) return currentDirectiveDef; } /** * @param {?} def * @return {?} */ function setCurrentDirectiveDef(def) { currentDirectiveDef = def; } /** * Stores whether directives should be matched to elements. * * When template contains `ngNonBindable` than we need to prevent the runtime form matching * directives on children of that element. * * Example: * ``` * <my-comp my-directive> * Should match component / directive. * </my-comp> * <div ngNonBindable> * <my-comp my-directive> * Should not match component / directive because we are in ngNonBindable. * </my-comp> * </div> * ``` * @type {?} */ var bindingsEnabled; /** * @return {?} */ function getBindingsEnabled() { // top level variables should not be exported for performance reasons (PERF_NOTES.md) return bindingsEnabled; } /** * Enables directive matching on elements. * * * Example: * ``` * <my-comp my-directive> * Should match component / directive. * </my-comp> * <div ngNonBindable> * <!-- ɵɵdisableBindings() --> * <my-comp my-directive> * Should not match component / directive because we are in ngNonBindable. * </my-comp> * <!-- ɵɵenableBindings() --> * </div> * ``` * * \@codeGenApi * @return {?} */ function ɵɵenableBindings() { bindingsEnabled = true; } /** * Disables directive matching on element. * * * Example: * ``` * <my-comp my-directive> * Should match component / directive. * </my-comp> * <div ngNonBindable> * <!-- ɵɵdisableBindings() --> * <my-comp my-directive> * Should not match component / directive because we are in ngNonBindable. * </my-comp> * <!-- ɵɵenableBindings() --> * </div> * ``` * * \@codeGenApi * @return {?} */ function ɵɵdisableBindings() { bindingsEnabled = false; } /** * @return {?} */ function getLView() { return lView; } /** * Used as the starting directive id value. * * All subsequent directives are incremented from this value onwards. * The reason why this value is `1` instead of `0` is because the `0` * value is reserved for the template. * @type {?} */ var MIN_DIRECTIVE_ID = 1; /** @type {?} */ var activeDirectiveId = MIN_DIRECTIVE_ID; /** * Position depth (with respect from leaf to root) in a directive sub-class inheritance chain. * @type {?} */ var activeDirectiveSuperClassDepthPosition = 0; /** * Total count of how many directives are a part of an inheritance chain. * * When directives are sub-classed (extended) from one to another, Angular * needs to keep track of exactly how many were encountered so it can accurately * generate the next directive id (once the next directive id is visited). * Normally the next directive id just a single incremented value from the * previous one, however, if the previous directive is a part of an inheritance * chain (a series of sub-classed directives) then the incremented value must * also take into account the total amount of sub-classed values. * * Note that this value resets back to zero once the next directive is * visited (when `incrementActiveDirectiveId` or `setActiveHostElement` * is called). * @type {?} */ var activeDirectiveSuperClassHeight = 0; /** * Sets the active directive host element and resets the directive id value * (when the provided elementIndex value has changed). * * @param {?=} elementIndex the element index value for the host element where * the directive/component instance lives * @return {?} */ function setActiveHostElement() { var elementIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; if (_selectedIndex !== elementIndex) { setSelectedIndex(elementIndex == null ? -1 : elementIndex); activeDirectiveId = elementIndex == null ? 0 : MIN_DIRECTIVE_ID; activeDirectiveSuperClassDepthPosition = 0; activeDirectiveSuperClassHeight = 0; } } /** * Returns the current id value of the current directive. * * For example we have an element that has two directives on it: * <div dir-one dir-two></div> * * dirOne->hostBindings() (id == 1) * dirTwo->hostBindings() (id == 2) * * Note that this is only active when `hostBinding` functions are being processed. * * Note that directive id values are specific to an element (this means that * the same id value could be present on another element with a completely * different set of directives). * @return {?} */ function getActiveDirectiveId() { return activeDirectiveId; } /** * Increments the current directive id value. * * For example we have an element that has two directives on it: * <div dir-one dir-two></div> * * dirOne->hostBindings() (index = 1) * // increment * dirTwo->hostBindings() (index = 2) * * Depending on whether or not a previous directive had any inherited * directives present, that value will be incremented in addition * to the id jumping up by one. * * Note that this is only active when `hostBinding` functions are being processed. * * Note that directive id values are specific to an element (this means that * the same id value could be present on another element with a completely * different set of directives). * @return {?} */ function incrementActiveDirectiveId() { activeDirectiveId += 1 + activeDirectiveSuperClassHeight; // because we are dealing with a new directive this // means we have exited out of the inheritance chain activeDirectiveSuperClassDepthPosition = 0; activeDirectiveSuperClassHeight = 0; } /** * Set the current super class (reverse inheritance) position depth for a directive. * * For example we have two directives: Child and Other (but Child is a sub-class of Parent) * <div child-dir other-dir></div> * * // increment * parentInstance->hostBindings() (depth = 1) * // decrement * childInstance->hostBindings() (depth = 0) * otherInstance->hostBindings() (depth = 0 b/c it's a different directive) * * Note that this is only active when `hostBinding` functions are being processed. * @param {?} delta * @return {?} */ function adjustActiveDirectiveSuperClassDepthPosition(delta) { activeDirectiveSuperClassDepthPosition += delta; // we keep track of the height value so that when the next directive is visited // then Angular knows to generate a new directive id value which has taken into // account how many sub-class directives were a part of the previous directive. activeDirectiveSuperClassHeight = Math.max(activeDirectiveSuperClassHeight, activeDirectiveSuperClassDepthPosition); } /** * Returns he current depth of the super/sub class inheritance chain. * * This will return how many inherited directive/component classes * exist in the current chain. * * ```typescript * \@Directive({ selector: '[super-dir]' }) * class SuperDir {} * / selector: '[sub-dir]' }) * class SubDir extends SuperDir {} * * // if `<div sub-dir>` is used then the super class height is `1` * // if `<div super-dir>` is used then the super class height is `0` * ``` * @return {?} */ function getActiveDirectiveSuperClassHeight() { return activeDirectiveSuperClassHeight; } /** * Returns the current super class (reverse inheritance) depth for a directive. * * This is designed to help instruction code distinguish different hostBindings * calls from each other when a directive has extended from another directive. * Normally using the directive id value is enough, but with the case * of parent/sub-class directive inheritance more information is required. * * Note that this is only active when `hostBinding` functions are being processed. * @return {?} */ function getActiveDirectiveSuperClassDepth() { return activeDirectiveSuperClassDepthPosition; } /** * Restores `contextViewData` to the given OpaqueViewState instance. * * Used in conjunction with the getCurrentView() instruction to save a snapshot * of the current view and restore it when listeners are invoked. This allows * walking the declaration view tree in listeners to get vars from parent views. * * \@codeGenApi * @param {?} viewToRestore The OpaqueViewState instance to restore. * * @return {?} */ function ɵɵrestoreView(viewToRestore) { contextLView = /** @type {?} */ /** @type {?} */ viewToRestore; } /** * Used to set the parent property when nodes are created and track query results. * @type {?} */ var previousOrParentTNode; /** * @return {?} */ function getPreviousOrParentTNode() { // top level variables should not be exported for performance reasons (PERF_NOTES.md) return previousOrParentTNode; } /** * @param {?} tNode * @param {?} _isParent * @return {?} */ function setPreviousOrParentTNode(tNode, _isParent) { previousOrParentTNode = tNode; isParent = _isParent; } /** * @param {?} tNode * @param {?} view * @return {?} */ function setTNodeAndViewData(tNode, view) { ngDevMode && assertLViewOrUndefined(view); previousOrParentTNode = tNode; lView = view; } /** * If `isParent` is: * - `true`: then `previousOrParentTNode` points to a parent node. * - `false`: then `previousOrParentTNode` points to previous node (sibling). * @type {?} */ var isParent; /** * @return {?} */ function getIsParent() { // top level variables should not be exported for performance reasons (PERF_NOTES.md) return isParent; } /** * @return {?} */ function setIsNotParent() { isParent = false; } /** * @return {?} */ function setIsParent() { isParent = true; } /** * Checks whether a given view is in creation mode * @param {?=} view * @return {?} */ function isCreationMode() { var view = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : lView; return (view[FLAGS] & 4 /* CreationMode */ ) === 4 /* CreationMode */ ; } /** * State of the current view being processed. * * An array of nodes (text, element, container, etc), pipes, their bindings, and * any local variables that need to be stored between invocations. * @type {?} */ var lView; /** * The last viewData retrieved by nextContext(). * Allows building nextContext() and reference() calls. * * e.g. const inner = x().$implicit; const outer = x().$implicit; * @type {?} */ var contextLView = /** @type {?} */ null; /** * @return {?} */ function getContextLView() { // top level variables should not be exported for performance reasons (PERF_NOTES.md) return contextLView; } /** * In this mode, any changes in bindings will throw an ExpressionChangedAfterChecked error. * * Necessary to support ChangeDetectorRef.checkNoChanges(). * @type {?} */ var checkNoChangesMode = false; /** * @return {?} */ function getCheckNoChangesMode() { // top level variables should not be exported for performance reasons (PERF_NOTES.md) return checkNoChangesMode; } /** * @param {?} mode * @return {?} */ function setCheckNoChangesMode(mode) { checkNoChangesMode = mode; } /** * The root index from which pure function instructions should calculate their binding * indices. In component views, this is TView.bindingStartIndex. In a host binding * context, this is the TView.expandoStartIndex + any dirs/hostVars before the given dir. * @type {?} */ var bindingRootIndex = -1; // top level variables should not be exported for performance reasons (PERF_NOTES.md) /** * @return {?} */ function getBindingRoot() { return bindingRootIndex; } /** * @param {?} value * @return {?} */ function setBindingRoot(value) { bindingRootIndex = value; } /** * Current index of a View or Content Query which needs to be processed next. * We iterate over the list of Queries and increment current query index at every step. * @type {?} */ var currentQueryIndex = 0; /** * @return {?} */ function getCurrentQueryIndex() { // top level variables should not be exported for performance reasons (PERF_NOTES.md) return currentQueryIndex; } /** * @param {?} value * @return {?} */ function setCurrentQueryIndex(value) { currentQueryIndex = value; } /** * Swap the current state with a new state. * * For performance reasons we store the state in the top level of the module. * This way we minimize the number of properties to read. Whenever a new view * is entered we have to store the state for later, and when the view is * exited the state has to be restored * * @param {?} newView New state to become active * @param {?} hostTNode * @return {?} the previous state; */ function enterView(newView, hostTNode) { ngDevMode && assertLViewOrUndefined(newView); /** @type {?} */ var oldView = lView; if (newView) { /** @type {?} */ var tView = newView[TVIEW]; bindingRootIndex = tView.bindingStartIndex; } previousOrParentTNode = /** @type {?} */ hostTNode; isParent = true; lView = contextLView = newView; return oldView; } /** * @template T * @param {?=} level * @return {?} */ function nextContextImpl() { var level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; contextLView = walkUpViews(level, /** @type {?} */ contextLView); return ( /** @type {?} */ contextLView[CONTEXT] ); } /** * @param {?} nestingLevel * @param {?} currentView * @return {?} */ function walkUpViews(nestingLevel, currentView) { while (nestingLevel > 0) { ngDevMode && assertDefined(currentView[DECLARATION_VIEW], 'Declaration view should be defined if nesting level is greater than 0.'); currentView = /** @type {?} */ currentView[DECLARATION_VIEW]; nestingLevel--; } return currentView; } /** * Resets the application state. * @return {?} */ function resetComponentState() { isParent = false; previousOrParentTNode = /** @type {?} */ null; elementDepthCount = 0; bindingsEnabled = true; setCurrentStyleSanitizer(null); resetAllStylingState(); } /** * Used in lieu of enterView to make it clear when we are exiting a child view. This makes * the direction of traversal (up or down the view tree) a bit clearer. * * @param {?} newView New state to become active * @param {?} safeToRunHooks Whether the runtime is in a state where running lifecycle hooks is valid. * This is not always the case (for example, the application may have crashed and `leaveView` is * being executed while unwinding the call stack). * @return {?} */ function leaveView(newView, safeToRunHooks) { /** @type {?} */ var tView = lView[TVIEW]; if (isCreationMode(lView)) { lView[FLAGS] &= ~4 /* CreationMode */ ; } else { try { resetPreOrderHookFlags(lView); safeToRunHooks && executeHooks(lView, tView.viewHooks, tView.viewCheckHooks, checkNoChangesMode, 2 /* AfterViewInitHooksToBeRun */ , undefined); } finally { // Views are clean and in update mode after being checked, so these bits are cleared lView[FLAGS] &= ~(64 /* Dirty */ | 8 /* FirstLViewPass */ ); lView[BINDING_INDEX] = tView.bindingStartIndex; } } enterView(newView, null); } /** @type {?} */ var _selectedIndex = -1; /** * Gets the most recent index passed to {\@link select} * * Used with {\@link property} instruction (and more in the future) to identify the index in the * current `LView` to act on. * @return {?} */ function getSelectedIndex() { return _selectedIndex; } /** * Sets the most recent index passed to {\@link select} * * Used with {\@link property} instruction (and more in the future) to identify the index in the * current `LView` to act on. * @param {?} index * @return {?} */ function setSelectedIndex(index) { _selectedIndex = index; // we have now jumped to another element // therefore the state is stale resetStylingState(); } /** @type {?} */ var _currentNamespace = null; /** * Sets the namespace used to create elements to `'http://www.w3.org/2000/svg'` in global state. * * \@codeGenApi * @return {?} */ function ɵɵnamespaceSVG() { _currentNamespace = 'http://www.w3.org/2000/svg'; } /** * Sets the namespace used to create elements to `'http://www.w3.org/1998/MathML/'` in global state. * * \@codeGenApi * @return {?} */ function ɵɵnamespaceMathML() { _currentNamespace = 'http://www.w3.org/1998/MathML/'; } /** * Sets the namespace used to create elements to `null`, which forces element creation to use * `createElement` rather than `createElementNS`. * * \@codeGenApi * @return {?} */ function ɵɵnamespaceHTML() { namespaceHTMLInternal(); } /** * Sets the namespace used to create elements to `null`, which forces element creation to use * `createElement` rather than `createElementNS`. * @return {?} */ function namespaceHTMLInternal() { _currentNamespace = null; } /** * @return {?} */ function getNamespace() { return _currentNamespace; } /** @type {?} */ var _currentSanitizer; /** * @param {?} sanitizer * @return {?} */ function setCurrentStyleSanitizer(sanitizer) { _currentSanitizer = sanitizer; } /** * @return {?} */ function getCurrentStyleSanitizer() { return _currentSanitizer; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Returns whether the values are different from a change detection stand point. * * Constraints are relaxed in checkNoChanges mode. See `devModeEqual` for details. * @param {?} a * @param {?} b * @return {?} */ function isDifferent(a, b) { // NaN is the only value that is not equal to itself so the first // test checks if both a and b are not NaN return !(a !== a && b !== b) && a !== b; } /** * Used for stringify render output in Ivy. * Important! This function is very performance-sensitive and we should * be extra careful not to introduce megamorphic reads in it. * @param {?} value * @return {?} */ function renderStringify(value) { if (typeof value === 'string') return value; if (value == null) return ''; return '' + value; } /** * Used to stringify a value so that it can be displayed in an error message. * Important! This function contains a megamorphic read and should only be * used for error messages. * @param {?} value * @return {?} */ function stringifyForError(value) { if (typeof value === 'function') return value.name || value.toString(); if (typeof value === 'object' && value != null && typeof value.type === 'function') { return value.type.name || value.type.toString(); } return renderStringify(value); } var ɵ0$2 = /** * @return {?} */ function ɵ0$2() { return (typeof requestAnimationFrame !== 'undefined' && requestAnimationFrame || // browser only setTimeout // everything else ).bind(_global); }; /** @type {?} */ var defaultScheduler = ɵ0$2(); /** * * \@codeGenApi * @param {?} element * @return {?} */ function ɵɵresolveWindow(element) { return { name: 'window', target: element.ownerDocument.defaultView }; } /** * * \@codeGenApi * @param {?} element * @return {?} */ function ɵɵresolveDocument(element) { return { name: 'document', target: element.ownerDocument }; } /** * * \@codeGenApi * @param {?} element * @return {?} */ function ɵɵresolveBody(element) { return { name: 'body', target: element.ownerDocument.body }; } /** * The special delimiter we use to separate property names, prefixes, and suffixes * in property binding metadata. See storeBindingMetadata(). * * We intentionally use the Unicode "REPLACEMENT CHARACTER" (U+FFFD) as a delimiter * because it is a very uncommon character that is unlikely to be part of a user's * property names or interpolation strings. If it is in fact used in a property * binding, DebugElement.properties will not return the correct value for that * binding. However, there should be no runtime effect for real applications. * * This character is typically rendered as a question mark inside of a diamond. * See https://en.wikipedia.org/wiki/Specials_(Unicode_block) * * @type {?} */ var INTERPOLATION_DELIMITER = "\uFFFD"; /** * Determines whether or not the given string is a property metadata string. * See storeBindingMetadata(). * @param {?} str * @return {?} */ function isPropMetadataString(str) { return str.indexOf(INTERPOLATION_DELIMITER) >= 0; } /** * Unwrap a value which might be behind a closure (for forward declaration reasons). * @template T * @param {?} value * @return {?} */ function maybeUnwrapFn(value) { if (value instanceof Function) { return value(); } else { return value; } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var MAP_BASED_ENTRY_PROP_NAME = '--MAP--'; /** @type {?} */ var TEMPLATE_DIRECTIVE_INDEX = 0; /** * Creates a new instance of the `TStylingContext`. * * The `TStylingContext` is used as a manifest of all style or all class bindings on * an element. Because it is a T-level data-structure, it is only created once per * tNode for styles and for classes. This function allocates a new instance of a * `TStylingContext` with the initial values (see `interfaces.ts` for more info). * @param {?=} initialStyling * @return {?} */ function allocTStylingContext(initialStyling) { // because map-based bindings deal with a dynamic set of values, there // is no way to know ahead of time whether or not sanitization is required. // For this reason the configuration will always mark sanitization as active // (this means that when map-based values are applied then sanitization will // be checked against each property). /** @type {?} */ var mapBasedConfig = 1 /* SanitizationRequired */ ; return [initialStyling || [''], 0 /* Initial */ , TEMPLATE_DIRECTIVE_INDEX, mapBasedConfig, 0, MAP_BASED_ENTRY_PROP_NAME]; } /** * Sets the provided directive as the last directive index in the provided `TStylingContext`. * * Styling in Angular can be applied from the template as well as multiple sources of * host bindings. This means that each binding function (the template function or the * hostBindings functions) will generate styling instructions as well as a styling * apply function (i.e. `stylingApply()`). Because host bindings functions and the * template function are independent from one another this means that the styling apply * function will be called multiple times. By tracking the last directive index (which * is what happens in this function) the styling algorithm knows exactly when to flush * styling (which is when the last styling apply function is executed). * @param {?} context * @param {?} lastDirectiveIndex * @return {?} */ function updateLastDirectiveIndex(context, lastDirectiveIndex) { if (lastDirectiveIndex === TEMPLATE_DIRECTIVE_INDEX) { /** @type {?} */ var currentValue = context[2 /* LastDirectiveIndexPosition */ ]; if (currentValue > TEMPLATE_DIRECTIVE_INDEX) { // This means that a directive or two contained a host bindings function, but // now the template function also contains styling. When this combination of sources // comes up then we need to tell the context to store the state between updates // (because host bindings evaluation happens after template binding evaluation). markContextToPersistState(context); } } else { context[2 /* LastDirectiveIndexPosition */ ] = lastDirectiveIndex; } } /** * @param {?} context * @return {?} */ function getConfig(context) { return context[1 /* ConfigPosition */ ]; } /** * @param {?} context * @param {?} value * @return {?} */ function setConfig(context, value) { context[1 /* ConfigPosition */ ] = value; } /** * @param {?} context * @param {?} index * @return {?} */ function getProp(context, index) { return ( /** @type {?} */ context[index + 2 /* PropOffset */ ] ); } /** * @param {?} context * @param {?} index * @return {?} */ function getPropConfig(context, index) { return ( /** @type {?} */ context[index + 0 /* ConfigAndGuardOffset */ ] & 1 /* Mask */ ); } /** * @param {?} context * @param {?} index * @return {?} */ function isSanitizationRequired(context, index) { return (getPropConfig(context, index) & 1 /* SanitizationRequired */ ) > 0; } /** * @param {?} context * @param {?} index * @return {?} */ function getGuardMask(context, index) { /** @type {?} */ var configGuardValue = /** @type {?} */ context[index + 0 /* ConfigAndGuardOffset */ ]; return configGuardValue >> 1 /* TotalBits */ ; } /** * @param {?} context * @param {?} index * @param {?} maskValue * @return {?} */ function setGuardMask(context, index, maskValue) { /** @type {?} */ var config = getPropConfig(context, index); /** @type {?} */ var guardMask = maskValue << 1 /* TotalBits */ ; context[index + 0 /* ConfigAndGuardOffset */ ] = config | guardMask; } /** * @param {?} context * @param {?} index * @return {?} */ function getValuesCount(context, index) { return ( /** @type {?} */ context[index + 1 /* ValuesCountOffset */ ] ); } /** * @param {?} context * @param {?} index * @param {?} offset * @return {?} */ function getBindingValue(context, index, offset) { return ( /** @type {?} */ context[index + 3 /* BindingsStartOffset */ + offset] ); } /** * @param {?} context * @param {?} index * @return {?} */ function getDefaultValue(context, index) { /** @type {?} */ var valuesCount = getValuesCount(context, index); return ( /** @type {?} */ context[index + 3 /* BindingsStartOffset */ + valuesCount - 1] ); } /** * Temporary function which determines whether or not a context is * allowed to be flushed based on the provided directive index. * @param {?} context * @param {?} index * @return {?} */ function allowStylingFlush(context, index) { return context && index === context[2 /* LastDirectiveIndexPosition */ ] ? true : false; } /** * @param {?} context * @return {?} */ function lockContext(context) { setConfig(context, getConfig(context) | 1 /* Locked */ ); } /** * @param {?} context * @return {?} */ function isContextLocked(context) { return (getConfig(context) & 1 /* Locked */ ) > 0; } /** * @param {?} context * @return {?} */ function stateIsPersisted(context) { return (getConfig(context) & 2 /* PersistStateValues */ ) > 0; } /** * @param {?} context * @return {?} */ function markContextToPersistState(context) { setConfig(context, getConfig(context) | 2 /* PersistStateValues */ ); } /** * @param {?} context * @return {?} */ function getPropValuesStartPosition(context) { return 6 /* MapBindingsBindingsStartPosition */ + context[4 /* MapBindingsValuesCountPosition */ ]; } /** * @param {?} prop * @return {?} */ function isMapBased(prop) { return prop === MAP_BASED_ENTRY_PROP_NAME; } /** * @param {?} a * @param {?} b * @return {?} */ function hasValueChanged(a, b) { /** @type {?} */ var compareValueA = Array.isArray(a) ? a[0 /* RawValuePosition */ ] : a; /** @type {?} */ var compareValueB = Array.isArray(b) ? b[0 /* RawValuePosition */ ] : b; // these are special cases for String based values (which are created as artifacts // when sanitization is bypassed on a particular value) if (compareValueA instanceof String) { compareValueA = compareValueA.toString(); } if (compareValueB instanceof String) { compareValueB = compareValueB.toString(); } return isDifferent(compareValueA, compareValueB); } /** * Determines whether the provided styling value is truthy or falsy. * @param {?} value * @return {?} */ function isStylingValueDefined(value) { // the reason why null is compared against is because // a CSS class value that is set to `false` must be // respected (otherwise it would be treated as falsy). // Empty string values are because developers usually // set a value to an empty string to remove it. return value != null && value !== ''; } /** * @param {?} a * @param {?} b * @param {?=} separator * @return {?} */ function concatString(a, b) { var separator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ' '; return a + (b.length && a.length ? separator : '') + b; } /** * @param {?} value * @return {?} */ function hyphenate(value) { return value.replace(/[a-z][A-Z]/g, /** * @param {?} v * @return {?} */ function (v) { return v.charAt(0) + '-' + v.charAt(1); }).toLowerCase(); } /** * Returns an instance of `StylingMapArray`. * * This function is designed to find an instance of `StylingMapArray` in case it is stored * inside of an instance of `TStylingContext`. When a styling context is created it * will copy over an initial styling values from the tNode (which are stored as a * `StylingMapArray` on the `tNode.classes` or `tNode.styles` values). * @param {?} value * @return {?} */ function getStylingMapArray(value) { return isStylingContext(value) ? /** @type {?} */ value[0 /* InitialStylingValuePosition */ ] : value; } /** * @param {?} value * @return {?} */ function isStylingContext(value) { // the StylingMapArray is in the format of [initial, prop, string, prop, string] // and this is the defining value to distinguish between arrays return Array.isArray(value) && value.length >= 6 /* MapBindingsBindingsStartPosition */ && typeof value[1] !== 'string'; } /** * @param {?} context * @return {?} */ function getInitialStylingValue(context) { /** @type {?} */ var map = getStylingMapArray(context); return map && /** @type {?} */ map[0 /* RawValuePosition */ ] || ''; } /** * @param {?} tNode * @return {?} */ function hasClassInput(tNode) { return (tNode.flags & 8 /* hasClassInput */ ) !== 0; } /** * @param {?} tNode * @return {?} */ function hasStyleInput(tNode) { return (tNode.flags & 16 /* hasStyleInput */ ) !== 0; } /** * @param {?} map * @param {?} index * @return {?} */ function getMapProp(map, index) { return ( /** @type {?} */ map[index + 0 /* PropOffset */ ] ); } /** * @param {?} map * @param {?} index * @param {?} value * @return {?} */ function setMapValue(map, index, value) { map[index + 1 /* ValueOffset */ ] = value; } /** * @param {?} map * @param {?} index * @return {?} */ function getMapValue(map, index) { return ( /** @type {?} */ map[index + 1 /* ValueOffset */ ] ); } /** * @param {?} classes * @return {?} */ function forceClassesAsString(classes) { if (classes && typeof classes !== 'string') { classes = Object.keys(classes).join(' '); } return ( /** @type {?} */ classes || '' ); } /** * @param {?} styles * @return {?} */ function forceStylesAsString(styles) { /** @type {?} */ var str = ''; if (styles) { /** @type {?} */ var props = Object.keys(styles); for (var i = 0; i < props.length; i++) { /** @type {?} */ var prop = props[i]; str = concatString(str, "".concat(prop, ":").concat(styles[prop]), ';'); } } return str; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 goal here is to make sure that the browser DOM API is the Renderer. * We do this by defining a subset of DOM API to be the renderer and than * use that time for rendering. * * At runtime we can then use the DOM api directly, in server or web-worker * it will be easy to implement such API. */ /** @enum {number} */ var RendererStyleFlags3 = { Important: 1, DashCase: 2 }; RendererStyleFlags3[RendererStyleFlags3.Important] = 'Important'; RendererStyleFlags3[RendererStyleFlags3.DashCase] = 'DashCase'; /** * Object Oriented style of API needed to create elements and text nodes. * * This is the native browser API style, e.g. operations are methods on individual objects * like HTMLElement. With this style, no additional code is needed as a facade * (reducing payload size). * * @record */ function ObjectOrientedRenderer3() {} if (false) {} /** * Returns whether the `renderer` is a `ProceduralRenderer3` * @param {?} renderer * @return {?} */ function isProceduralRenderer(renderer) { return !! /** @type {?} */ renderer.listen; } /** * Procedural style of API needed to create elements and text nodes. * * In non-native browser environments (e.g. platforms such as web-workers), this is the * facade that enables element manipulation. This also facilitates backwards compatibility * with Renderer2. * @record */ function ProceduralRenderer3() {} if (false) {} /** * @record */ function RendererFactory3() {} if (false) {} var ɵ0$3 = /** * @param {?} hostElement * @param {?} rendererType * @return {?} */ function ɵ0$3(hostElement, rendererType) { return document; }; /** @type {?} */ var domRendererFactory3 = { createRenderer: ɵ0$3 }; /** * Subset of API needed for appending elements and text nodes. * @record */ function RNode() {} if (false) {} /** * Subset of API needed for writing attributes, properties, and setting up * listeners on Element. * @record */ function RElement() {} if (false) {} /** * @record */ function RCssStyleDeclaration() {} if (false) {} /** * @record */ function RDomTokenList() {} if (false) {} /** * @record */ function RText() {} if (false) {} /** * @record */ function RComment() {} if (false) {} // Note: This hack is necessary so we don't erroneously get a circular dependency // failure based on types. /** @type {?} */ var unusedValueExportToPlacateAjd$3 = 1; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Assigns all attribute values to the provided element via the inferred renderer. * * This function accepts two forms of attribute entries: * * default: (key, value): * attrs = [key1, value1, key2, value2] * * namespaced: (NAMESPACE_MARKER, uri, name, value) * attrs = [NAMESPACE_MARKER, uri, name, value, NAMESPACE_MARKER, uri, name, value] * * The `attrs` array can contain a mix of both the default and namespaced entries. * The "default" values are set without a marker, but if the function comes across * a marker value then it will attempt to set a namespaced value. If the marker is * not of a namespaced value then the function will quit and return the index value * where it stopped during the iteration of the attrs array. * * See [AttributeMarker] to understand what the namespace marker value is. * * Note that this instruction does not support assigning style and class values to * an element. See `elementStart` and `elementHostAttrs` to learn how styling values * are applied to an element. * * @param {?} native The element that the attributes will be assigned to * @param {?} attrs The attribute array of values that will be assigned to the element * @return {?} the index value that was last accessed in the attributes array */ function setUpAttributes(_native, attrs) { /** @type {?} */ var renderer = getLView()[RENDERER]; /** @type {?} */ var isProc = isProceduralRenderer(renderer); /** @type {?} */ var i = 0; while (i < attrs.length) { /** @type {?} */ var value = attrs[i]; if (typeof value === 'number') { // only namespaces are supported. Other value types (such as style/class // entries) are not supported in this function. if (value !== 0 /* NamespaceURI */ ) { break; } // we just landed on the marker value ... therefore // we should skip to the next entry i++; /** @type {?} */ var namespaceURI = /** @type {?} */ attrs[i++]; /** @type {?} */ var attrName = /** @type {?} */ attrs[i++]; /** @type {?} */ var attrVal = /** @type {?} */ attrs[i++]; ngDevMode && ngDevMode.rendererSetAttribute++; isProc ? /** @type {?} */ renderer.setAttribute(_native, attrName, attrVal, namespaceURI) : _native.setAttributeNS(namespaceURI, attrName, attrVal); } else { // attrName is string; /** @type {?} */ var _attrName = /** @type {?} */ value; /** @type {?} */ var _attrVal = attrs[++i]; // Standard attributes ngDevMode && ngDevMode.rendererSetAttribute++; if (isAnimationProp(_attrName)) { if (isProc) { /** @type {?} */ renderer.setProperty(_native, _attrName, _attrVal); } } else { isProc ? /** @type {?} */ renderer.setAttribute(_native, /** @type {?} */ _attrName, /** @type {?} */ _attrVal) : _native.setAttribute( /** @type {?} */ _attrName, /** @type {?} */ _attrVal); } i++; } } // another piece of code may iterate over the same attributes array. Therefore // it may be helpful to return the exact spot where the attributes array exited // whether by running into an unsupported marker or if all the static values were // iterated over. return i; } /** * @param {?} attrs * @param {?} startIndex * @return {?} */ function attrsStylingIndexOf(attrs, startIndex) { for (var i = startIndex; i < attrs.length; i++) { /** @type {?} */ var val = attrs[i]; if (val === 1 /* Classes */ || val === 2 /* Styles */ ) { return i; } } return -1; } /** * Test whether the given value is a marker that indicates that the following * attribute values in a `TAttributes` array are only the names of attributes, * and not name-value pairs. * @param {?} marker The attribute marker to test. * @return {?} true if the marker is a "name-only" marker (e.g. `Bindings`, `Template` or `I18n`). */ function isNameOnlyAttributeMarker(marker) { return marker === 3 /* Bindings */ || marker === 4 /* Template */ || marker === 6 /* I18n */ ; } /** @type {?} */ var ANIMATION_PROP_PREFIX = '@'; /** * @param {?} name * @return {?} */ function isAnimationProp(name) { return name[0] === ANIMATION_PROP_PREFIX; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /// Parent Injector Utils /////////////////////////////////////////////////////////////// /** * @param {?} parentLocation * @return {?} */ function hasParentInjector(parentLocation) { return parentLocation !== NO_PARENT_INJECTOR; } /** * @param {?} parentLocation * @return {?} */ function getParentInjectorIndex(parentLocation) { return ( /** @type {?} */ /** @type {?} */ parentLocation & 32767 /* InjectorIndexMask */ ); } /** * @param {?} parentLocation * @return {?} */ function getParentInjectorViewOffset(parentLocation) { return ( /** @type {?} */ /** @type {?} */ parentLocation >> 16 /* ViewOffsetShift */ ); } /** * Unwraps a parent injector location number to find the view offset from the current injector, * then walks up the declaration view tree until the view is found that contains the parent * injector. * * @param {?} location The location of the parent injector, which contains the view offset * @param {?} startView The LView instance from which to start walking up the view tree * @return {?} The LView instance that contains the parent injector */ function getParentInjectorView(location, startView) { /** @type {?} */ var viewOffset = getParentInjectorViewOffset(location); /** @type {?} */ var parentView = startView; // For most cases, the parent injector can be found on the host node (e.g. for component // or container), but we must keep the loop here to support the rarer case of deeply nested // <ng-template> tags or inline views, where the parent injector might live many views // above the child injector. while (viewOffset > 0) { parentView = /** @type {?} */ parentView[DECLARATION_VIEW]; viewOffset--; } return parentView; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Gets the parent LView of the passed LView, if the PARENT is an LContainer, will get the parent of * that LContainer, which is an LView * @param {?} lView the lView whose parent to get * @return {?} */ function getLViewParent(lView) { ngDevMode && assertLView(lView); /** @type {?} */ var parent = lView[PARENT]; return isLContainer(parent) ? /** @type {?} */ parent[PARENT] : parent; } /** * Retrieve the root view from any component or `LView` by walking the parent `LView` until * reaching the root `LView`. * * @param {?} componentOrLView any component or `LView` * @return {?} */ function getRootView(componentOrLView) { ngDevMode && assertDefined(componentOrLView, 'component'); /** @type {?} */ var lView = isLView(componentOrLView) ? componentOrLView : /** @type {?} */ readPatchedLView(componentOrLView); while (lView && !(lView[FLAGS] & 512 /* IsRoot */ )) { lView = /** @type {?} */ getLViewParent(lView); } ngDevMode && assertLView(lView); return lView; } /** * Given an `LView`, find the closest declaration view which is not an embedded view. * * This method searches for the `LView` associated with the component which declared the `LView`. * * This function may return itself if the `LView` passed in is not an embedded `LView`. Otherwise * it walks the declaration parents until it finds a component view (non-embedded-view.) * * @param {?} lView LView for which we want a host element node * @return {?} The host node */ function findComponentView(lView) { /** @type {?} */ var rootTNode = lView[T_HOST]; while (rootTNode !== null && rootTNode.type === 2 /* View */ ) { ngDevMode && assertDefined(lView[DECLARATION_VIEW], 'lView[DECLARATION_VIEW]'); lView = /** @type {?} */ lView[DECLARATION_VIEW]; rootTNode = lView[T_HOST]; } ngDevMode && assertLView(lView); return lView; } /** * Returns the `RootContext` instance that is associated with * the application where the target is situated. It does this by walking the parent views until it * gets to the root view, then getting the context off of that. * * @param {?} viewOrComponent the `LView` or component to get the root context for. * @return {?} */ function getRootContext(viewOrComponent) { /** @type {?} */ var rootView = getRootView(viewOrComponent); ngDevMode && assertDefined(rootView[CONTEXT], 'RootView has no context. Perhaps it is disconnected?'); return ( /** @type {?} */ rootView[CONTEXT] ); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Defines if the call to `inject` should include `viewProviders` in its resolution. * * This is set to true when we try to instantiate a component. This value is reset in * `getNodeInjectable` to a value which matches the declaration location of the token about to be * instantiated. This is done so that if we are injecting a token which was declared outside of * `viewProviders` we don't accidentally pull `viewProviders` in. * * Example: * * ``` * \@Injectable() * class MyService { * constructor(public value: String) {} * } * * \@Component({ * providers: [ * MyService, * {provide: String, value: 'providers' } * ] * viewProviders: [ * {provide: String, value: 'viewProviders'} * ] * }) * class MyComponent { * constructor(myService: MyService, value: String) { * // We expect that Component can see into `viewProviders`. * expect(value).toEqual('viewProviders'); * // `MyService` was not declared in `viewProviders` hence it can't see it. * expect(myService.value).toEqual('providers'); * } * } * * ``` * @type {?} */ var includeViewProviders = true; /** * @param {?} v * @return {?} */ function setIncludeViewProviders(v) { /** @type {?} */ var oldValue = includeViewProviders; includeViewProviders = v; return oldValue; } /** * The number of slots in each bloom filter (used by DI). The larger this number, the fewer * directives that will share slots, and thus, the fewer false positives when checking for * the existence of a directive. * @type {?} */ var BLOOM_SIZE = 256; /** @type {?} */ var BLOOM_MASK = BLOOM_SIZE - 1; /** * Counter used to generate unique IDs for directives. * @type {?} */ var nextNgElementId = 0; /** * Registers this directive as present in its node's injector by flipping the directive's * corresponding bit in the injector's bloom filter. * * @param {?} injectorIndex The index of the node injector where this token should be registered * @param {?} tView The TView for the injector's bloom filters * @param {?} type The directive token to register * @return {?} */ function bloomAdd(injectorIndex, tView, type) { ngDevMode && assertEqual(tView.firstTemplatePass, true, 'expected firstTemplatePass to be true'); /** @type {?} */ var id = typeof type !== 'string' ? /** @type {?} */ type[NG_ELEMENT_ID] : type.charCodeAt(0) || 0; // Set a unique ID on the directive type, so if something tries to inject the directive, // we can easily retrieve the ID and hash it into the bloom bit that should be checked. if (id == null) { id = /** @type {?} */ type[NG_ELEMENT_ID] = nextNgElementId++; } // We only have BLOOM_SIZE (256) slots in our bloom filter (8 buckets * 32 bits each), // so all unique IDs must be modulo-ed into a number from 0 - 255 to fit into the filter. /** @type {?} */ var bloomBit = id & BLOOM_MASK; // Create a mask that targets the specific bit associated with the directive. // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding // to bit positions 0 - 31 in a 32 bit integer. /** @type {?} */ var mask = 1 << bloomBit; // Use the raw bloomBit number to determine which bloom filter bucket we should check // e.g: bf0 = [0 - 31], bf1 = [32 - 63], bf2 = [64 - 95], bf3 = [96 - 127], etc /** @type {?} */ var b7 = bloomBit & 0x80; /** @type {?} */ var b6 = bloomBit & 0x40; /** @type {?} */ var b5 = bloomBit & 0x20; /** @type {?} */ var tData = /** @type {?} */ tView.data; if (b7) { b6 ? b5 ? tData[injectorIndex + 7] |= mask : tData[injectorIndex + 6] |= mask : b5 ? tData[injectorIndex + 5] |= mask : tData[injectorIndex + 4] |= mask; } else { b6 ? b5 ? tData[injectorIndex + 3] |= mask : tData[injectorIndex + 2] |= mask : b5 ? tData[injectorIndex + 1] |= mask : tData[injectorIndex] |= mask; } } /** * Creates (or gets an existing) injector for a given element or container. * * @param {?} tNode for which an injector should be retrieved / created. * @param {?} hostView View where the node is stored * @return {?} Node injector */ function getOrCreateNodeInjectorForNode(tNode, hostView) { /** @type {?} */ var existingInjectorIndex = getInjectorIndex(tNode, hostView); if (existingInjectorIndex !== -1) { return existingInjectorIndex; } /** @type {?} */ var tView = hostView[TVIEW]; if (tView.firstTemplatePass) { tNode.injectorIndex = hostView.length; insertBloom(tView.data, tNode); // foundation for node bloom insertBloom(hostView, null); // foundation for cumulative bloom insertBloom(tView.blueprint, null); ngDevMode && assertEqual(tNode.flags === 0 || tNode.flags === 1 /* isComponent */ , true, 'expected tNode.flags to not be initialized'); } /** @type {?} */ var parentLoc = getParentInjectorLocation(tNode, hostView); /** @type {?} */ var parentIndex = getParentInjectorIndex(parentLoc); /** @type {?} */ var parentLView = getParentInjectorView(parentLoc, hostView); /** @type {?} */ var injectorIndex = tNode.injectorIndex; // If a parent injector can't be found, its location is set to -1. // In that case, we don't need to set up a cumulative bloom if (hasParentInjector(parentLoc)) { /** @type {?} */ var parentData = /** @type {?} */ parentLView[TVIEW].data; // Creates a cumulative bloom filter that merges the parent's bloom filter // and its own cumulative bloom (which contains tokens for all ancestors) for (var i = 0; i < 8; i++) { hostView[injectorIndex + i] = parentLView[parentIndex + i] | parentData[parentIndex + i]; } } hostView[injectorIndex + PARENT_INJECTOR] = parentLoc; return injectorIndex; } /** * @param {?} arr * @param {?} footer * @return {?} */ function insertBloom(arr, footer) { arr.push(0, 0, 0, 0, 0, 0, 0, 0, footer); } /** * @param {?} tNode * @param {?} hostView * @return {?} */ function getInjectorIndex(tNode, hostView) { if (tNode.injectorIndex === -1 || // If the injector index is the same as its parent's injector index, then the index has been // copied down from the parent node. No injector has been created yet on this node. tNode.parent && tNode.parent.injectorIndex === tNode.injectorIndex || // After the first template pass, the injector index might exist but the parent values // might not have been calculated yet for this instance hostView[tNode.injectorIndex + PARENT_INJECTOR] == null) { return -1; } else { return tNode.injectorIndex; } } /** * Finds the index of the parent injector, with a view offset if applicable. Used to set the * parent injector initially. * * Returns a combination of number of `ViewData` we have to go up and index in that `Viewdata` * @param {?} tNode * @param {?} view * @return {?} */ function getParentInjectorLocation(tNode, view) { if (tNode.parent && tNode.parent.injectorIndex !== -1) { return ( /** @type {?} */ tNode.parent.injectorIndex ); // ViewOffset is 0 } // For most cases, the parent injector index can be found on the host node (e.g. for component // or container), so this loop will be skipped, but we must keep the loop here to support // the rarer case of deeply nested <ng-template> tags or inline views. /** @type {?} */ var hostTNode = view[T_HOST]; /** @type {?} */ var viewOffset = 1; while (hostTNode && hostTNode.injectorIndex === -1) { view = /** @type {?} */ view[DECLARATION_VIEW]; hostTNode = view ? view[T_HOST] : null; viewOffset++; } return hostTNode ? hostTNode.injectorIndex | viewOffset << 16 /* ViewOffsetShift */ : /** @type {?} */ -1; } /** * Makes a type or an injection token public to the DI system by adding it to an * injector's bloom filter. * * @param {?} injectorIndex * @param {?} tView * @param {?} token The type or the injection token to be made public * @return {?} */ function diPublicInInjector(injectorIndex, tView, token) { bloomAdd(injectorIndex, tView, token); } /** * Inject static attribute value into directive constructor. * * This method is used with `factory` functions which are generated as part of * `defineDirective` or `defineComponent`. The method retrieves the static value * of an attribute. (Dynamic attributes are not supported since they are not resolved * at the time of injection and can change over time.) * * # Example * Given: * ``` * \@Component(...) * class MyComponent { * constructor(\@Attribute('title') title: string) { ... } * } * ``` * When instantiated with * ``` * <my-component title="Hello"></my-component> * ``` * * Then factory method generated is: * ``` * MyComponent.ngComponentDef = defineComponent({ * factory: () => new MyComponent(injectAttribute('title')) * ... * }) * ``` * * \@publicApi * @param {?} tNode * @param {?} attrNameToInject * @return {?} */ function injectAttributeImpl(tNode, attrNameToInject) { ngDevMode && assertNodeOfPossibleTypes(tNode, 0 /* Container */ , 3 /* Element */ , 4 /* ElementContainer */ ); ngDevMode && assertDefined(tNode, 'expecting tNode'); if (attrNameToInject === 'class') { return getInitialStylingValue(tNode.classes); } if (attrNameToInject === 'style') { return getInitialStylingValue(tNode.styles); } /** @type {?} */ var attrs = tNode.attrs; if (attrs) { /** @type {?} */ var attrsLength = attrs.length; /** @type {?} */ var i = 0; while (i < attrsLength) { /** @type {?} */ var value = attrs[i]; // If we hit a `Bindings` or `Template` marker then we are done. if (isNameOnlyAttributeMarker(value)) break; // Skip namespaced attributes if (value === 0 /* NamespaceURI */ ) { // we skip the next two values // as namespaced attributes looks like // [..., AttributeMarker.NamespaceURI, 'http://someuri.com/test', 'test:exist', // 'existValue', ...] i = i + 2; } else if (typeof value === 'number') { // Skip to the first value of the marked attribute. i++; while (i < attrsLength && typeof attrs[i] === 'string') { i++; } } else if (value === attrNameToInject) { return ( /** @type {?} */ attrs[i + 1] ); } else { i = i + 2; } } } return null; } /** * Returns the value associated to the given token from the NodeInjectors => ModuleInjector. * * Look for the injector providing the token by walking up the node injector tree and then * the module injector tree. * * This function patches `token` with `__NG_ELEMENT_ID__` which contains the id for the bloom * filter. Negative values are reserved for special objects. * - `-1` is reserved for injecting `Injector` (implemented by `NodeInjector`) * * @template T * @param {?} tNode The Node where the search for the injector should start * @param {?} lView The `LView` that contains the `tNode` * @param {?} token The token to look for * @param {?=} flags Injection flags * @param {?=} notFoundValue The value to return when the injection flags is `InjectFlags.Optional` * @return {?} the value from the injector, `null` when not found, or `notFoundValue` if provided */ function getOrCreateInjectable(tNode, lView, token) { var flags = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : InjectFlags.Default; var notFoundValue = arguments.length > 4 ? arguments[4] : undefined; if (tNode) { /** @type {?} */ var bloomHash = bloomHashBitOrFactory(token); // If the ID stored here is a function, this is a special object like ElementRef or TemplateRef // so just call the factory function to create it. if (typeof bloomHash === 'function') { /** @type {?} */ var savePreviousOrParentTNode = getPreviousOrParentTNode(); /** @type {?} */ var saveLView = getLView(); setTNodeAndViewData(tNode, lView); try { /** @type {?} */ var value = bloomHash(); if (value == null && !(flags & InjectFlags.Optional)) { throw new Error("No provider for ".concat(stringifyForError(token), "!")); } else { return value; } } finally { setTNodeAndViewData(savePreviousOrParentTNode, saveLView); } } else if (typeof bloomHash == 'number') { if (bloomHash === -1) { // `-1` is a special value used to identify `Injector` types. return ( /** @type {?} */ new NodeInjector(tNode, lView) ); } // If the token has a bloom hash, then it is a token which could be in NodeInjector. // A reference to the previous injector TView that was found while climbing the element // injector tree. This is used to know if viewProviders can be accessed on the current // injector. /** @type {?} */ var previousTView = null; /** @type {?} */ var injectorIndex = getInjectorIndex(tNode, lView); /** @type {?} */ var parentLocation = NO_PARENT_INJECTOR; /** @type {?} */ var hostTElementNode = flags & InjectFlags.Host ? findComponentView(lView)[T_HOST] : null; // If we should skip this injector, or if there is no injector on this node, start by // searching // the parent injector. if (injectorIndex === -1 || flags & InjectFlags.SkipSelf) { parentLocation = injectorIndex === -1 ? getParentInjectorLocation(tNode, lView) : lView[injectorIndex + PARENT_INJECTOR]; if (!shouldSearchParent(flags, false)) { injectorIndex = -1; } else { previousTView = lView[TVIEW]; injectorIndex = getParentInjectorIndex(parentLocation); lView = getParentInjectorView(parentLocation, lView); } } // Traverse up the injector tree until we find a potential match or until we know there // *isn't* a match. while (injectorIndex !== -1) { parentLocation = lView[injectorIndex + PARENT_INJECTOR]; // Check the current injector. If it matches, see if it contains token. /** @type {?} */ var tView = lView[TVIEW]; if (bloomHasToken(bloomHash, injectorIndex, tView.data)) { // At this point, we have an injector which *may* contain the token, so we step through // the providers and directives associated with the injector's corresponding node to get // the instance. /** @type {?} */ var instance = searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode); if (instance !== NOT_FOUND) { return instance; } } if (shouldSearchParent(flags, lView[TVIEW].data[injectorIndex + TNODE] === hostTElementNode) && bloomHasToken(bloomHash, injectorIndex, lView)) { // The def wasn't found anywhere on this node, so it was a false positive. // Traverse up the tree and continue searching. previousTView = tView; injectorIndex = getParentInjectorIndex(parentLocation); lView = getParentInjectorView(parentLocation, lView); } else { // If we should not search parent OR If the ancestor bloom filter value does not have the // bit corresponding to the directive we can give up on traversing up to find the specific // injector. injectorIndex = -1; } } } } if (flags & InjectFlags.Optional && notFoundValue === undefined) { // This must be set or the NullInjector will throw for optional deps notFoundValue = null; } if ((flags & (InjectFlags.Self | InjectFlags.Host)) === 0) { /** @type {?} */ var moduleInjector = lView[INJECTOR$1]; // switch to `injectInjectorOnly` implementation for module injector, since module injector // should not have access to Component/Directive DI scope (that may happen through // `directiveInject` implementation) /** @type {?} */ var previousInjectImplementation = setInjectImplementation(undefined); try { if (moduleInjector) { return moduleInjector.get(token, notFoundValue, flags & InjectFlags.Optional); } else { return injectRootLimpMode(token, notFoundValue, flags & InjectFlags.Optional); } } finally { setInjectImplementation(previousInjectImplementation); } } if (flags & InjectFlags.Optional) { return notFoundValue; } else { throw new Error("NodeInjector: NOT_FOUND [".concat(stringifyForError(token), "]")); } } /** @type {?} */ var NOT_FOUND = {}; /** * @template T * @param {?} injectorIndex * @param {?} lView * @param {?} token * @param {?} previousTView * @param {?} flags * @param {?} hostTElementNode * @return {?} */ function searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode) { /** @type {?} */ var currentTView = lView[TVIEW]; /** @type {?} */ var tNode = /** @type {?} */ currentTView.data[injectorIndex + TNODE]; // First, we need to determine if view providers can be accessed by the starting element. // There are two possibities /** @type {?} */ var canAccessViewProviders = previousTView == null ? // 1) This is the first invocation `previousTView == null` which means that we are at the // `TNode` of where injector is starting to look. In such a case the only time we are allowed // to look into the ViewProviders is if: // - we are on a component // - AND the injector set `includeViewProviders` to true (implying that the token can see // ViewProviders because it is the Component or a Service which itself was declared in // ViewProviders) isComponent(tNode) && includeViewProviders : // 2) `previousTView != null` which means that we are now walking across the parent nodes. // In such a case we are only allowed to look into the ViewProviders if: // - We just crossed from child View to Parent View `previousTView != currentTView` // - AND the parent TNode is an Element. // This means that we just came from the Component's View and therefore are allowed to see // into the ViewProviders. previousTView != currentTView && tNode.type === 3 /* Element */ ; // This special case happens when there is a @host on the inject and when we are searching // on the host element node. /** @type {?} */ var isHostSpecialCase = flags & InjectFlags.Host && hostTElementNode === tNode; /** @type {?} */ var injectableIdx = locateDirectiveOrProvider(tNode, currentTView, token, canAccessViewProviders, isHostSpecialCase); if (injectableIdx !== null) { return getNodeInjectable(currentTView.data, lView, injectableIdx, /** @type {?} */ tNode); } else { return NOT_FOUND; } } /** * Searches for the given token among the node's directives and providers. * * @template T * @param {?} tNode TNode on which directives are present. * @param {?} tView The tView we are currently processing * @param {?} token Provider token or type of a directive to look for. * @param {?} canAccessViewProviders Whether view providers should be considered. * @param {?} isHostSpecialCase Whether the host special case applies. * @return {?} Index of a found directive or provider, or null when none found. */ function locateDirectiveOrProvider(tNode, tView, token, canAccessViewProviders, isHostSpecialCase) { /** @type {?} */ var nodeProviderIndexes = tNode.providerIndexes; /** @type {?} */ var tInjectables = tView.data; /** @type {?} */ var injectablesStart = nodeProviderIndexes & 65535 /* ProvidersStartIndexMask */ ; /** @type {?} */ var directivesStart = tNode.directiveStart; /** @type {?} */ var directiveEnd = tNode.directiveEnd; /** @type {?} */ var cptViewProvidersCount = nodeProviderIndexes >> 16 /* CptViewProvidersCountShift */ ; /** @type {?} */ var startingIndex = canAccessViewProviders ? injectablesStart : injectablesStart + cptViewProvidersCount; // When the host special case applies, only the viewProviders and the component are visible /** @type {?} */ var endIndex = isHostSpecialCase ? injectablesStart + cptViewProvidersCount : directiveEnd; for (var i = startingIndex; i < endIndex; i++) { /** @type {?} */ var providerTokenOrDef = /** @type {?} */ tInjectables[i]; if (i < directivesStart && token === providerTokenOrDef || i >= directivesStart && /** @type {?} */ providerTokenOrDef.type === token) { return i; } } if (isHostSpecialCase) { /** @type {?} */ var dirDef = /** @type {?} */ tInjectables[directivesStart]; if (dirDef && isComponentDef(dirDef) && dirDef.type === token) { return directivesStart; } } return null; } /** * Retrieve or instantiate the injectable from the `lData` at particular `index`. * * This function checks to see if the value has already been instantiated and if so returns the * cached `injectable`. Otherwise if it detects that the value is still a factory it * instantiates the `injectable` and caches the value. * @param {?} tData * @param {?} lData * @param {?} index * @param {?} tNode * @return {?} */ function getNodeInjectable(tData, lData, index, tNode) { /** @type {?} */ var value = lData[index]; if (isFactory(value)) { /** @type {?} */ var factory = value; if (factory.resolving) { throw new Error("Circular dep for ".concat(stringifyForError(tData[index]))); } /** @type {?} */ var previousIncludeViewProviders = setIncludeViewProviders(factory.canSeeViewProviders); factory.resolving = true; /** @type {?} */ var previousInjectImplementation; if (factory.injectImpl) { previousInjectImplementation = setInjectImplementation(factory.injectImpl); } /** @type {?} */ var savePreviousOrParentTNode = getPreviousOrParentTNode(); /** @type {?} */ var saveLView = getLView(); setTNodeAndViewData(tNode, lData); try { value = lData[index] = factory.factory(undefined, tData, lData, tNode); } finally { if (factory.injectImpl) setInjectImplementation(previousInjectImplementation); setIncludeViewProviders(previousIncludeViewProviders); factory.resolving = false; setTNodeAndViewData(savePreviousOrParentTNode, saveLView); } } return value; } /** * Returns the bit in an injector's bloom filter that should be used to determine whether or not * the directive might be provided by the injector. * * When a directive is public, it is added to the bloom filter and given a unique ID that can be * retrieved on the Type. When the directive isn't public or the token is not a directive `null` * is returned as the node injector can not possibly provide that token. * * @param {?} token the injection token * @return {?} the matching bit to check in the bloom filter or `null` if the token is not known. * When the returned value is negative then it represents special values such as `Injector`. */ function bloomHashBitOrFactory(token) { ngDevMode && assertDefined(token, 'token must be defined'); if (typeof token === 'string') { return token.charCodeAt(0) || 0; } /** @type {?} */ var tokenId = /** @type {?} */ token[NG_ELEMENT_ID]; // Negative token IDs are used for special objects such as `Injector` return typeof tokenId === 'number' && tokenId > 0 ? tokenId & BLOOM_MASK : tokenId; } /** * @param {?} bloomHash * @param {?} injectorIndex * @param {?} injectorView * @return {?} */ function bloomHasToken(bloomHash, injectorIndex, injectorView) { // Create a mask that targets the specific bit associated with the directive we're looking for. // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding // to bit positions 0 - 31 in a 32 bit integer. /** @type {?} */ var mask = 1 << bloomHash; /** @type {?} */ var b7 = bloomHash & 0x80; /** @type {?} */ var b6 = bloomHash & 0x40; /** @type {?} */ var b5 = bloomHash & 0x20; // Our bloom filter size is 256 bits, which is eight 32-bit bloom filter buckets: // bf0 = [0 - 31], bf1 = [32 - 63], bf2 = [64 - 95], bf3 = [96 - 127], etc. // Get the bloom filter value from the appropriate bucket based on the directive's bloomBit. /** @type {?} */ var value; if (b7) { value = b6 ? b5 ? injectorView[injectorIndex + 7] : injectorView[injectorIndex + 6] : b5 ? injectorView[injectorIndex + 5] : injectorView[injectorIndex + 4]; } else { value = b6 ? b5 ? injectorView[injectorIndex + 3] : injectorView[injectorIndex + 2] : b5 ? injectorView[injectorIndex + 1] : injectorView[injectorIndex]; } // If the bloom filter value has the bit corresponding to the directive's bloomBit flipped on, // this injector is a potential match. return !!(value & mask); } /** * Returns true if flags prevent parent injector from being searched for tokens * @param {?} flags * @param {?} isFirstHostTNode * @return {?} */ function shouldSearchParent(flags, isFirstHostTNode) { return !(flags & InjectFlags.Self) && !(flags & InjectFlags.Host && isFirstHostTNode); } var NodeInjector = /*#__PURE__*/function () { /** * @param {?} _tNode * @param {?} _lView */ function NodeInjector(_tNode, _lView) { _classCallCheck(this, NodeInjector); this._tNode = _tNode; this._lView = _lView; } /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ _createClass2(NodeInjector, [{ key: "get", value: function get(token, notFoundValue) { return getOrCreateInjectable(this._tNode, this._lView, token, undefined, notFoundValue); } }]); return NodeInjector; }(); if (false) {} /** * \@codeGenApi * @template T * @param {?} type * @return {?} */ function ɵɵgetFactoryOf(type) { /** @type {?} */ var typeAny = /** @type {?} */ type; /** @type {?} */ var def = getComponentDef(typeAny) || getDirectiveDef(typeAny) || getPipeDef(typeAny) || getInjectableDef(typeAny) || getInjectorDef(typeAny); if (!def || def.factory === undefined) { return null; } return def.factory; } /** * \@codeGenApi * @template T * @param {?} type * @return {?} */ function ɵɵgetInheritedFactory(type) { /** @type {?} */ var proto = /** @type {?} */ Object.getPrototypeOf(type.prototype).constructor; /** @type {?} */ var factory = ɵɵgetFactoryOf(proto); if (factory !== null) { return factory; } else { // There is no factory defined. Either this was improper usage of inheritance // (no Angular decorator on the superclass) or there is no constructor at all // in the inheritance chain. Since the two cases cannot be distinguished, the // latter has to be assumed. return ( /** * @param {?} t * @return {?} */ function (t) { return new t(); } ); } } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var ERROR_TYPE = 'ngType'; var ERROR_DEBUG_CONTEXT = 'ngDebugContext'; var ERROR_ORIGINAL_ERROR = 'ngOriginalError'; var ERROR_LOGGER = 'ngErrorLogger'; function wrappedError(message, originalError) { var msg = "".concat(message, " caused by: ").concat(originalError instanceof Error ? originalError.message : originalError); var error = Error(msg); error[ERROR_ORIGINAL_ERROR] = originalError; return error; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} error * @return {?} */ function getType(error) { return ( /** @type {?} */ error[ERROR_TYPE] ); } /** * @param {?} error * @return {?} */ function getDebugContext(error) { return ( /** @type {?} */ error[ERROR_DEBUG_CONTEXT] ); } /** * @param {?} error * @return {?} */ function getOriginalError(error) { return ( /** @type {?} */ error[ERROR_ORIGINAL_ERROR] ); } /** * @param {?} error * @return {?} */ function getErrorLogger(error) { return ( /** @type {?} */ error[ERROR_LOGGER] || defaultErrorLogger ); } /** * @param {?} console * @param {...?} values * @return {?} */ function defaultErrorLogger(console) { for (var _len12 = arguments.length, values = new Array(_len12 > 1 ? _len12 - 1 : 0), _key13 = 1; _key13 < _len12; _key13++) { values[_key13 - 1] = arguments[_key13]; } /** @type {?} */ console.error.apply(console, values); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Provides a hook for centralized exception handling. * * The default implementation of `ErrorHandler` prints error messages to the `console`. To * intercept error handling, write a custom exception handler that replaces this default as * appropriate for your app. * * \@usageNotes * ### Example * * ``` * class MyErrorHandler implements ErrorHandler { * handleError(error) { * // do something with the exception * } * } * * \@NgModule({ * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}] * }) * class MyModule {} * ``` * * \@publicApi */ var ErrorHandler = /*#__PURE__*/function () { function ErrorHandler() { _classCallCheck(this, ErrorHandler); /** * \@internal */ this._console = console; } /** * @param {?} error * @return {?} */ _createClass2(ErrorHandler, [{ key: "handleError", value: function handleError(error) { /** @type {?} */ var originalError = this._findOriginalError(error); /** @type {?} */ var context = this._findContext(error); // Note: Browser consoles show the place from where console.error was called. // We can use this to give users additional information about the error. /** @type {?} */ var errorLogger = getErrorLogger(error); errorLogger(this._console, "ERROR", error); if (originalError) { errorLogger(this._console, "ORIGINAL ERROR", originalError); } if (context) { errorLogger(this._console, 'ERROR CONTEXT', context); } } /** * \@internal * @param {?} error * @return {?} */ }, { key: "_findContext", value: function _findContext(error) { if (error) { return getDebugContext(error) ? getDebugContext(error) : this._findContext(getOriginalError(error)); } return null; } /** * \@internal * @param {?} error * @return {?} */ }, { key: "_findOriginalError", value: function _findOriginalError(error) { /** @type {?} */ var e = getOriginalError(error); while (e && getOriginalError(e)) { e = getOriginalError(e); } return e; } }]); return ErrorHandler; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 schema definition associated with an NgModule. * * @see `\@NgModule`, `CUSTOM_ELEMENTS_SCHEMA`, `NO_ERRORS_SCHEMA` * * @param name The name of a defined schema. * * \@publicApi * @record */ function SchemaMetadata() {} if (false) {} /** * Defines a schema that allows an NgModule to contain the following: * - Non-Angular elements named with dash case (`-`). * - Element properties named with dash case (`-`). * Dash case is the naming convention for custom elements. * * \@publicApi * @type {?} */ var CUSTOM_ELEMENTS_SCHEMA = { name: 'custom-elements' }; /** * Defines a schema that allows any property on any element. * * \@publicApi * @type {?} */ var NO_ERRORS_SCHEMA = { name: 'no-errors-schema' }; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** @type {?} */ var BRAND = '__SANITIZER_TRUSTED_BRAND__'; /** @enum {string} */ var BypassType = { Url: 'Url', Html: 'Html', ResourceUrl: 'ResourceUrl', Script: 'Script', Style: 'Style' }; /** * A branded trusted string used with sanitization. * * See: {\@link TrustedHtmlString}, {\@link TrustedResourceUrlString}, {\@link TrustedScriptString}, * {\@link TrustedStyleString}, {\@link TrustedUrlString} * @record */ function TrustedString() {} if (false) {} /** * A branded trusted string used with sanitization of `html` strings. * * See: {\@link bypassSanitizationTrustHtml} and {\@link htmlSanitizer}. * @record */ function TrustedHtmlString() {} if (false) {} /** * A branded trusted string used with sanitization of `style` strings. * * See: {\@link bypassSanitizationTrustStyle} and {\@link styleSanitizer}. * @record */ function TrustedStyleString() {} if (false) {} /** * A branded trusted string used with sanitization of `url` strings. * * See: {\@link bypassSanitizationTrustScript} and {\@link scriptSanitizer}. * @record */ function TrustedScriptString() {} if (false) {} /** * A branded trusted string used with sanitization of `url` strings. * * See: {\@link bypassSanitizationTrustUrl} and {\@link urlSanitizer}. * @record */ function TrustedUrlString() {} if (false) {} /** * A branded trusted string used with sanitization of `resourceUrl` strings. * * See: {\@link bypassSanitizationTrustResourceUrl} and {\@link resourceUrlSanitizer}. * @record */ function TrustedResourceUrlString() {} if (false) {} /** * @param {?} value * @param {?} type * @return {?} */ function allowSanitizationBypass(value, type) { return value instanceof String && /** @type {?} */ value[BRAND] === type; } /** * Mark `html` string as trusted. * * This function wraps the trusted string in `String` and brands it in a way which makes it * recognizable to {\@link htmlSanitizer} to be trusted implicitly. * * @param {?} trustedHtml `html` string which needs to be implicitly trusted. * @return {?} a `html` `String` which has been branded to be implicitly trusted. */ function bypassSanitizationTrustHtml(trustedHtml) { return bypassSanitizationTrustString(trustedHtml, "Html" /* Html */ ); } /** * Mark `style` string as trusted. * * This function wraps the trusted string in `String` and brands it in a way which makes it * recognizable to {\@link styleSanitizer} to be trusted implicitly. * * @param {?} trustedStyle `style` string which needs to be implicitly trusted. * @return {?} a `style` `String` which has been branded to be implicitly trusted. */ function bypassSanitizationTrustStyle(trustedStyle) { return bypassSanitizationTrustString(trustedStyle, "Style" /* Style */ ); } /** * Mark `script` string as trusted. * * This function wraps the trusted string in `String` and brands it in a way which makes it * recognizable to {\@link scriptSanitizer} to be trusted implicitly. * * @param {?} trustedScript `script` string which needs to be implicitly trusted. * @return {?} a `script` `String` which has been branded to be implicitly trusted. */ function bypassSanitizationTrustScript(trustedScript) { return bypassSanitizationTrustString(trustedScript, "Script" /* Script */ ); } /** * Mark `url` string as trusted. * * This function wraps the trusted string in `String` and brands it in a way which makes it * recognizable to {\@link urlSanitizer} to be trusted implicitly. * * @param {?} trustedUrl `url` string which needs to be implicitly trusted. * @return {?} a `url` `String` which has been branded to be implicitly trusted. */ function bypassSanitizationTrustUrl(trustedUrl) { return bypassSanitizationTrustString(trustedUrl, "Url" /* Url */ ); } /** * Mark `url` string as trusted. * * This function wraps the trusted string in `String` and brands it in a way which makes it * recognizable to {\@link resourceUrlSanitizer} to be trusted implicitly. * * @param {?} trustedResourceUrl `url` string which needs to be implicitly trusted. * @return {?} a `url` `String` which has been branded to be implicitly trusted. */ function bypassSanitizationTrustResourceUrl(trustedResourceUrl) { return bypassSanitizationTrustString(trustedResourceUrl, "ResourceUrl" /* ResourceUrl */ ); } /** * @param {?} trustedString * @param {?} mode * @return {?} */ function bypassSanitizationTrustString(trustedString, mode) { // tslint:disable-next-line /** @type {?} */ var trusted = /** @type {?} */ new String(trustedString); trusted[BRAND] = mode; return trusted; } /** * @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 file is used to control if the default rendering pipeline should be `ViewEngine` or `Ivy`. * * For more information on how to run and debug tests with either Ivy or View Engine (legacy), * please see [BAZEL.md](./docs/BAZEL.md). */ var _devMode = true; var _runModeLocked = false; /** * Returns whether Angular is in development mode. After called once, * the value is locked and won't change any more. * * By default, this is true, unless a user calls `enableProdMode` before calling this. * * @publicApi */ function isDevMode() { _runModeLocked = true; return _devMode; } /** * Disable Angular's development mode, which turns off assertions and other * checks within the framework. * * One important assertion this disables verifies that a change detection pass * does not result in additional changes to any bindings (also known as * unidirectional data flow). * * @publicApi */ function enableProdMode() { if (_runModeLocked) { throw new Error('Cannot enable prod mode after platform setup.'); } _devMode = false; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 helper class is used to get hold of an inert tree of DOM elements containing dirty HTML * that needs sanitizing. * Depending upon browser support we must use one of three strategies for doing this. * Support: Safari 10.x -> XHR strategy * Support: Firefox -> DomParser strategy * Default: InertDocument strategy */ var InertBodyHelper = /*#__PURE__*/function () { /** * @param {?} defaultDoc */ function InertBodyHelper(defaultDoc) { _classCallCheck(this, InertBodyHelper); this.defaultDoc = defaultDoc; this.inertDocument = this.defaultDoc.implementation.createHTMLDocument('sanitization-inert'); this.inertBodyElement = this.inertDocument.body; if (this.inertBodyElement == null) { // usually there should be only one body element in the document, but IE doesn't have any, so // we need to create one. /** @type {?} */ var inertHtml = this.inertDocument.createElement('html'); this.inertDocument.appendChild(inertHtml); this.inertBodyElement = this.inertDocument.createElement('body'); inertHtml.appendChild(this.inertBodyElement); } this.inertBodyElement.innerHTML = '<svg><g onload="this.parentNode.remove()"></g></svg>'; if (this.inertBodyElement.querySelector && !this.inertBodyElement.querySelector('svg')) { // We just hit the Safari 10.1 bug - which allows JS to run inside the SVG G element // so use the XHR strategy. this.getInertBodyElement = this.getInertBodyElement_XHR; return; } this.inertBodyElement.innerHTML = '<svg><p><style><img src="</style><img src=x onerror=alert(1)//">'; if (this.inertBodyElement.querySelector && this.inertBodyElement.querySelector('svg img')) { // We just hit the Firefox bug - which prevents the inner img JS from being sanitized // so use the DOMParser strategy, if it is available. // If the DOMParser is not available then we are not in Firefox (Server/WebWorker?) so we // fall through to the default strategy below. if (isDOMParserAvailable()) { this.getInertBodyElement = this.getInertBodyElement_DOMParser; return; } } // None of the bugs were hit so it is safe for us to use the default InertDocument strategy this.getInertBodyElement = this.getInertBodyElement_InertDocument; } /** * Use XHR to create and fill an inert body element (on Safari 10.1) * See * https://github.com/cure53/DOMPurify/blob/a992d3a75031cb8bb032e5ea8399ba972bdf9a65/src/purify.js#L439-L449 * @private * @param {?} html * @return {?} */ _createClass2(InertBodyHelper, [{ key: "getInertBodyElement_XHR", value: function getInertBodyElement_XHR(html) { // We add these extra elements to ensure that the rest of the content is parsed as expected // e.g. leading whitespace is maintained and tags like `<meta>` do not get hoisted to the // `<head>` tag. html = '<body><remove></remove>' + html + '</body>'; try { html = encodeURI(html); } catch (_a) { return null; } /** @type {?} */ var xhr = new XMLHttpRequest(); xhr.responseType = 'document'; xhr.open('GET', 'data:text/html;charset=utf-8,' + html, false); xhr.send(undefined); /** @type {?} */ var body = xhr.response.body; body.removeChild( /** @type {?} */ body.firstChild); return body; } /** * Use DOMParser to create and fill an inert body element (on Firefox) * See https://github.com/cure53/DOMPurify/releases/tag/0.6.7 * * @private * @param {?} html * @return {?} */ }, { key: "getInertBodyElement_DOMParser", value: function getInertBodyElement_DOMParser(html) { // We add these extra elements to ensure that the rest of the content is parsed as expected // e.g. leading whitespace is maintained and tags like `<meta>` do not get hoisted to the // `<head>` tag. html = '<body><remove></remove>' + html + '</body>'; try { /** @type {?} */ var body = /** @type {?} */ new /** @type {?} */ window.DOMParser().parseFromString(html, 'text/html').body; body.removeChild( /** @type {?} */ body.firstChild); return body; } catch (_a) { return null; } } /** * Use an HTML5 `template` element, if supported, or an inert body element created via * `createHtmlDocument` to create and fill an inert DOM element. * This is the default sane strategy to use if the browser does not require one of the specialised * strategies above. * @private * @param {?} html * @return {?} */ }, { key: "getInertBodyElement_InertDocument", value: function getInertBodyElement_InertDocument(html) { // Prefer using <template> element if supported. /** @type {?} */ var templateEl = this.inertDocument.createElement('template'); if ('content' in templateEl) { templateEl.innerHTML = html; return templateEl; } this.inertBodyElement.innerHTML = html; // Support: IE 9-11 only // strip custom-namespaced attributes on IE<=11 if ( /** @type {?} */ this.defaultDoc.documentMode) { this.stripCustomNsAttrs(this.inertBodyElement); } return this.inertBodyElement; } /** * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' * attribute to declare ns1 namespace and prefixes the attribute with 'ns1' (e.g. * 'ns1:xlink:foo'). * * This is undesirable since we don't want to allow any of these custom attributes. This method * strips them all. * @private * @param {?} el * @return {?} */ }, { key: "stripCustomNsAttrs", value: function stripCustomNsAttrs(el) { /** @type {?} */ var elAttrs = el.attributes; // loop backwards so that we can support removals. for (var i = elAttrs.length - 1; 0 < i; i--) { /** @type {?} */ var attrib = elAttrs.item(i); /** @type {?} */ var attrName = /** @type {?} */ attrib.name; if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) { el.removeAttribute(attrName); } } /** @type {?} */ var childNode = /** @type {?} */ el.firstChild; while (childNode) { if (childNode.nodeType === Node.ELEMENT_NODE) this.stripCustomNsAttrs( /** @type {?} */ childNode); childNode = childNode.nextSibling; } } }]); return InertBodyHelper; }(); if (false) {} /** * We need to determine whether the DOMParser exists in the global context. * The try-catch is because, on some browsers, trying to access this property * on window can actually throw an error. * * @suppress {uselessCode} * @return {?} */ function isDOMParserAvailable() { try { return !! /** @type {?} */ window.DOMParser; } catch (_a) { return false; } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A pattern that recognizes a commonly useful subset of URLs that are safe. * * This regular expression matches a subset of URLs that will not cause script * execution if used in URL context within a HTML document. Specifically, this * regular expression matches if (comment from here on and regex copied from * Soy's EscapingConventions): * (1) Either an allowed protocol (http, https, mailto or ftp). * (2) or no protocol. A protocol must be followed by a colon. The below * allows that by allowing colons only after one of the characters [/?#]. * A colon after a hash (#) must be in the fragment. * Otherwise, a colon after a (?) must be in a query. * Otherwise, a colon after a single solidus (/) must be in a path. * Otherwise, a colon after a double solidus (//) must be in the authority * (before port). * * The pattern disallows &, used in HTML entity declarations before * one of the characters in [/?#]. This disallows HTML entities used in the * protocol name, which should never happen, e.g. "http" for "http". * It also disallows HTML entities in the first path part of a relative path, * e.g. "foo<bar/baz". Our existing escaping functions should not produce * that. More importantly, it disallows masking of a colon, * e.g. "javascript:...". * * This regular expression was taken from the Closure sanitization library. * @type {?} */ var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi; /* A pattern that matches safe srcset values */ /** @type {?} */ var SAFE_SRCSET_PATTERN = /^(?:(?:https?|file):|[^&:/?#]*(?:[/?#]|$))/gi; /** * A pattern that matches safe data URLs. Only matches image, video and audio types. * @type {?} */ var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+\/]+=*$/i; /** * @param {?} url * @return {?} */ function _sanitizeUrl(url) { url = String(url); if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN)) return url; if (isDevMode()) { console.warn("WARNING: sanitizing unsafe URL value ".concat(url, " (see http://g.co/ng/security#xss)")); } return 'unsafe:' + url; } /** * @param {?} srcset * @return {?} */ function sanitizeSrcset(srcset) { srcset = String(srcset); return srcset.split(',').map( /** * @param {?} srcset * @return {?} */ function (srcset) { return _sanitizeUrl(srcset.trim()); }).join(', '); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} tags * @return {?} */ function tagSet(tags) { /** @type {?} */ var res = {}; var _iterator35 = _createForOfIteratorHelper(tags.split(',')), _step35; try { for (_iterator35.s(); !(_step35 = _iterator35.n()).done;) { var t = _step35.value; res[t] = true; } } catch (err) { _iterator35.e(err); } finally { _iterator35.f(); } return res; } /** * @param {...?} sets * @return {?} */ function merge() { /** @type {?} */ var res = {}; for (var _len13 = arguments.length, sets = new Array(_len13), _key14 = 0; _key14 < _len13; _key14++) { sets[_key14] = arguments[_key14]; } for (var _i13 = 0, _sets = sets; _i13 < _sets.length; _i13++) { var s = _sets[_i13]; for (var v in s) { if (s.hasOwnProperty(v)) res[v] = true; } } return res; } // Good source of info about elements and attributes // http://dev.w3.org/html5/spec/Overview.html#semantics // http://simon.html5.org/html-elements // Safe Void Elements - HTML5 // http://dev.w3.org/html5/spec/Overview.html#void-elements /** @type {?} */ var VOID_ELEMENTS = tagSet('area,br,col,hr,img,wbr'); // Elements that you can, intentionally, leave open (and which close themselves) // http://dev.w3.org/html5/spec/Overview.html#optional-tags /** @type {?} */ var OPTIONAL_END_TAG_BLOCK_ELEMENTS = tagSet('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr'); /** @type {?} */ var OPTIONAL_END_TAG_INLINE_ELEMENTS = tagSet('rp,rt'); /** @type {?} */ var OPTIONAL_END_TAG_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS); // Safe Block Elements - HTML5 /** @type {?} */ var BLOCK_ELEMENTS = merge(OPTIONAL_END_TAG_BLOCK_ELEMENTS, tagSet('address,article,' + 'aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' + 'h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul')); // Inline Elements - HTML5 /** @type {?} */ var INLINE_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet('a,abbr,acronym,audio,b,' + 'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,' + 'samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video')); /** @type {?} */ var VALID_ELEMENTS = merge(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS); // Attributes that have href and hence need to be sanitized /** @type {?} */ var URI_ATTRS = tagSet('background,cite,href,itemtype,longdesc,poster,src,xlink:href'); // Attributes that have special href set hence need to be sanitized /** @type {?} */ var SRCSET_ATTRS = tagSet('srcset'); /** @type {?} */ var HTML_ATTRS = tagSet('abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,' + 'compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,' + 'ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,' + 'scope,scrolling,shape,size,sizes,span,srclang,start,summary,tabindex,target,title,translate,type,usemap,' + 'valign,value,vspace,width'); // Accessibility attributes as per WAI-ARIA 1.1 (W3C Working Draft 14 December 2018) /** @type {?} */ var ARIA_ATTRS = tagSet('aria-activedescendant,aria-atomic,aria-autocomplete,aria-busy,aria-checked,aria-colcount,aria-colindex,' + 'aria-colspan,aria-controls,aria-current,aria-describedby,aria-details,aria-disabled,aria-dropeffect,' + 'aria-errormessage,aria-expanded,aria-flowto,aria-grabbed,aria-haspopup,aria-hidden,aria-invalid,' + 'aria-keyshortcuts,aria-label,aria-labelledby,aria-level,aria-live,aria-modal,aria-multiline,' + 'aria-multiselectable,aria-orientation,aria-owns,aria-placeholder,aria-posinset,aria-pressed,aria-readonly,' + 'aria-relevant,aria-required,aria-roledescription,aria-rowcount,aria-rowindex,aria-rowspan,aria-selected,' + 'aria-setsize,aria-sort,aria-valuemax,aria-valuemin,aria-valuenow,aria-valuetext'); // NB: This currently consciously doesn't support SVG. SVG sanitization has had several security // issues in the past, so it seems safer to leave it out if possible. If support for binding SVG via // innerHTML is required, SVG attributes should be added here. // NB: Sanitization does not allow <form> elements or other active elements (<button> etc). Those // can be sanitized, but they increase security surface area without a legitimate use case, so they // are left out here. /** @type {?} */ var VALID_ATTRS = merge(URI_ATTRS, SRCSET_ATTRS, HTML_ATTRS, ARIA_ATTRS); // Elements whose content should not be traversed/preserved, if the elements themselves are invalid. // // Typically, `<invalid>Some content</invalid>` would traverse (and in this case preserve) // `Some content`, but strip `invalid-element` opening/closing tags. For some elements, though, we // don't want to preserve the content, if the elements themselves are going to be removed. /** @type {?} */ var SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS = tagSet('script,style,template'); /** * SanitizingHtmlSerializer serializes a DOM fragment, stripping out any unsafe elements and unsafe * attributes. */ var SanitizingHtmlSerializer = /*#__PURE__*/function () { function SanitizingHtmlSerializer() { _classCallCheck(this, SanitizingHtmlSerializer); // Explicitly track if something was stripped, to avoid accidentally warning of sanitization just // because characters were re-encoded. this.sanitizedSomething = false; this.buf = []; } /** * @param {?} el * @return {?} */ _createClass2(SanitizingHtmlSerializer, [{ key: "sanitizeChildren", value: function sanitizeChildren(el) { // This cannot use a TreeWalker, as it has to run on Angular's various DOM adapters. // However this code never accesses properties off of `document` before deleting its contents // again, so it shouldn't be vulnerable to DOM clobbering. /** @type {?} */ var current = /** @type {?} */ el.firstChild; /** @type {?} */ var traverseContent = true; while (current) { if (current.nodeType === Node.ELEMENT_NODE) { traverseContent = this.startElement( /** @type {?} */ current); } else if (current.nodeType === Node.TEXT_NODE) { this.chars( /** @type {?} */ current.nodeValue); } else { // Strip non-element, non-text nodes. this.sanitizedSomething = true; } if (traverseContent && current.firstChild) { current = /** @type {?} */ current.firstChild; continue; } while (current) { // Leaving the element. Walk up and to the right, closing tags as we go. if (current.nodeType === Node.ELEMENT_NODE) { this.endElement( /** @type {?} */ current); } /** @type {?} */ var next = this.checkClobberedElement(current, /** @type {?} */ current.nextSibling); if (next) { current = next; break; } current = this.checkClobberedElement(current, /** @type {?} */ current.parentNode); } } return this.buf.join(''); } /** * Sanitizes an opening element tag (if valid) and returns whether the element's contents should * be traversed. Element content must always be traversed (even if the element itself is not * valid/safe), unless the element is one of `SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS`. * * @private * @param {?} element The element to sanitize. * @return {?} True if the element's contents should be traversed. */ }, { key: "startElement", value: function startElement(element) { /** @type {?} */ var tagName = element.nodeName.toLowerCase(); if (!VALID_ELEMENTS.hasOwnProperty(tagName)) { this.sanitizedSomething = true; return !SKIP_TRAVERSING_CONTENT_IF_INVALID_ELEMENTS.hasOwnProperty(tagName); } this.buf.push('<'); this.buf.push(tagName); /** @type {?} */ var elAttrs = element.attributes; for (var i = 0; i < elAttrs.length; i++) { /** @type {?} */ var elAttr = elAttrs.item(i); /** @type {?} */ var attrName = /** @type {?} */ elAttr.name; /** @type {?} */ var lower = attrName.toLowerCase(); if (!VALID_ATTRS.hasOwnProperty(lower)) { this.sanitizedSomething = true; continue; } /** @type {?} */ var value = /** @type {?} */ elAttr.value; // TODO(martinprobst): Special case image URIs for data:image/... if (URI_ATTRS[lower]) value = _sanitizeUrl(value); if (SRCSET_ATTRS[lower]) value = sanitizeSrcset(value); this.buf.push(' ', attrName, '="', encodeEntities(value), '"'); } this.buf.push('>'); return true; } /** * @private * @param {?} current * @return {?} */ }, { key: "endElement", value: function endElement(current) { /** @type {?} */ var tagName = current.nodeName.toLowerCase(); if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) { this.buf.push('</'); this.buf.push(tagName); this.buf.push('>'); } } /** * @private * @param {?} chars * @return {?} */ }, { key: "chars", value: function chars(_chars) { this.buf.push(encodeEntities(_chars)); } /** * @param {?} node * @param {?} nextNode * @return {?} */ }, { key: "checkClobberedElement", value: function checkClobberedElement(node, nextNode) { if (nextNode && (node.compareDocumentPosition(nextNode) & Node.DOCUMENT_POSITION_CONTAINED_BY) === Node.DOCUMENT_POSITION_CONTAINED_BY) { throw new Error("Failed to sanitize html because the element is clobbered: ".concat( /** @type {?} */ node.outerHTML)); } return nextNode; } }]); return SanitizingHtmlSerializer; }(); if (false) {} // Regular Expressions for parsing tags and attributes /** @type {?} */ var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; // ! to ~ is the ASCII range. /** @type {?} */ var NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g; /** * Escapes all potentially dangerous characters, so that the * resulting string can be safely inserted into attribute or * element text. * @param {?} value * @return {?} */ function encodeEntities(value) { return value.replace(/&/g, '&').replace(SURROGATE_PAIR_REGEXP, /** * @param {?} match * @return {?} */ function (match) { /** @type {?} */ var hi = match.charCodeAt(0); /** @type {?} */ var low = match.charCodeAt(1); return '&#' + ((hi - 0xD800) * 0x400 + (low - 0xDC00) + 0x10000) + ';'; }).replace(NON_ALPHANUMERIC_REGEXP, /** * @param {?} match * @return {?} */ function (match) { return '&#' + match.charCodeAt(0) + ';'; }).replace(/</g, '<').replace(/>/g, '>'); } /** @type {?} */ var inertBodyHelper; /** * Sanitizes the given unsafe, untrusted HTML fragment, and returns HTML text that is safe to add to * the DOM in a browser environment. * @param {?} defaultDoc * @param {?} unsafeHtmlInput * @return {?} */ function _sanitizeHtml(defaultDoc, unsafeHtmlInput) { /** @type {?} */ var inertBodyElement = null; try { inertBodyHelper = inertBodyHelper || new InertBodyHelper(defaultDoc); // Make sure unsafeHtml is actually a string (TypeScript types are not enforced at runtime). /** @type {?} */ var unsafeHtml = unsafeHtmlInput ? String(unsafeHtmlInput) : ''; inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml); // mXSS protection. Repeatedly parse the document to make sure it stabilizes, so that a browser // trying to auto-correct incorrect HTML cannot cause formerly inert HTML to become dangerous. /** @type {?} */ var mXSSAttempts = 5; /** @type {?} */ var parsedHtml = unsafeHtml; do { if (mXSSAttempts === 0) { throw new Error('Failed to sanitize html because the input is unstable'); } mXSSAttempts--; unsafeHtml = parsedHtml; parsedHtml = /** @type {?} */ inertBodyElement.innerHTML; inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml); } while (unsafeHtml !== parsedHtml); /** @type {?} */ var sanitizer = new SanitizingHtmlSerializer(); /** @type {?} */ var safeHtml = sanitizer.sanitizeChildren( /** @type {?} */ getTemplateContent( /** @type {?} */ inertBodyElement) || inertBodyElement); if (isDevMode() && sanitizer.sanitizedSomething) { console.warn('WARNING: sanitizing HTML stripped some content, see http://g.co/ng/security#xss'); } return safeHtml; } finally { // In case anything goes wrong, clear out inertElement to reset the entire DOM structure. if (inertBodyElement) { /** @type {?} */ var parent = getTemplateContent(inertBodyElement) || inertBodyElement; while (parent.firstChild) { parent.removeChild(parent.firstChild); } } } } /** * @param {?} el * @return {?} */ function getTemplateContent(el) { return 'content' in /** @type {?} */ el && isTemplateElement(el) ? el.content : null; } /** * @param {?} el * @return {?} */ function isTemplateElement(el) { return el.nodeType === Node.ELEMENT_NODE && el.nodeName === 'TEMPLATE'; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** @enum {number} */ var SecurityContext = { NONE: 0, HTML: 1, STYLE: 2, SCRIPT: 3, URL: 4, RESOURCE_URL: 5 }; SecurityContext[SecurityContext.NONE] = 'NONE'; SecurityContext[SecurityContext.HTML] = 'HTML'; SecurityContext[SecurityContext.STYLE] = 'STYLE'; SecurityContext[SecurityContext.SCRIPT] = 'SCRIPT'; SecurityContext[SecurityContext.URL] = 'URL'; SecurityContext[SecurityContext.RESOURCE_URL] = 'RESOURCE_URL'; /** * Sanitizer is used by the views to sanitize potentially dangerous values. * * \@publicApi * @abstract */ var Sanitizer = function Sanitizer() { _classCallCheck(this, Sanitizer); }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Regular expression for safe style values. * * Quotes (" and ') are allowed, but a check must be done elsewhere to ensure they're balanced. * * ',' allows multiple values to be assigned to the same property (e.g. background-attachment or * font-family) and hence could allow multiple values to get injected, but that should pose no risk * of XSS. * * The function expression checks only for XSS safety, not for CSS validity. * * This regular expression was taken from the Closure sanitization library, and augmented for * transformation values. * @type {?} */ var VALUES = '[-,."\'%_!# a-zA-Z0-9]+'; /** @type {?} */ var TRANSFORMATION_FNS = '(?:matrix|translate|scale|rotate|skew|perspective)(?:X|Y|Z|3d)?'; /** @type {?} */ var COLOR_FNS = '(?:rgb|hsl)a?'; /** @type {?} */ var GRADIENTS = '(?:repeating-)?(?:linear|radial)-gradient'; /** @type {?} */ var CSS3_FNS = '(?:calc|attr)'; /** @type {?} */ var FN_ARGS = '\\([-0-9.%, #a-zA-Z]+\\)'; /** @type {?} */ var SAFE_STYLE_VALUE = new RegExp("^(".concat(VALUES, "|") + "(?:".concat(TRANSFORMATION_FNS, "|").concat(COLOR_FNS, "|").concat(GRADIENTS, "|").concat(CSS3_FNS, ")") + "".concat(FN_ARGS, ")$"), 'g'); /** * Matches a `url(...)` value with an arbitrary argument as long as it does * not contain parentheses. * * The URL value still needs to be sanitized separately. * * `url(...)` values are a very common use case, e.g. for `background-image`. With carefully crafted * CSS style rules, it is possible to construct an information leak with `url` values in CSS, e.g. * by observing whether scroll bars are displayed, or character ranges used by a font face * definition. * * Angular only allows binding CSS values (as opposed to entire CSS rules), so it is unlikely that * binding a URL value without further cooperation from the page will cause an information leak, and * if so, it is just a leak, not a full blown XSS vulnerability. * * Given the common use case, low likelihood of attack vector, and low impact of an attack, this * code is permissive and allows URLs that sanitize otherwise. * @type {?} */ var URL_RE = /^url\(([^)]+)\)$/; /** * Checks that quotes (" and ') are properly balanced inside a string. Assumes * that neither escape (\) nor any other character that could result in * breaking out of a string parsing context are allowed; * see http://www.w3.org/TR/css3-syntax/#string-token-diagram. * * This code was taken from the Closure sanitization library. * @param {?} value * @return {?} */ function hasBalancedQuotes(value) { /** @type {?} */ var outsideSingle = true; /** @type {?} */ var outsideDouble = true; for (var i = 0; i < value.length; i++) { /** @type {?} */ var c = value.charAt(i); if (c === '\'' && outsideDouble) { outsideSingle = !outsideSingle; } else if (c === '"' && outsideSingle) { outsideDouble = !outsideDouble; } } return outsideSingle && outsideDouble; } /** * Sanitizes the given untrusted CSS style property value (i.e. not an entire object, just a single * value) and returns a value that is safe to use in a browser environment. * @param {?} value * @return {?} */ function _sanitizeStyle(value) { value = String(value).trim(); // Make sure it's actually a string. if (!value) return ''; // Single url(...) values are supported, but only for URLs that sanitize cleanly. See above for // reasoning behind this. /** @type {?} */ var urlMatch = value.match(URL_RE); if (urlMatch && _sanitizeUrl(urlMatch[1]) === urlMatch[1] || value.match(SAFE_STYLE_VALUE) && hasBalancedQuotes(value)) { return value; // Safe style values. } if (isDevMode()) { console.warn("WARNING: sanitizing unsafe style value ".concat(value, " (see http://g.co/ng/security#xss).")); } return 'unsafe'; } /** @enum {number} */ var StyleSanitizeMode = { /** Just check to see if the property is required to be sanitized or not */ ValidateProperty: 1, /** Skip checking the property; just sanitize the value */ SanitizeOnly: 2, /** Check the property and (if true) then sanitize the value */ ValidateAndSanitize: 3 }; /** * Used to intercept and sanitize style values before they are written to the renderer. * * This function is designed to be called in two modes. When a value is not provided * then the function will return a boolean whether a property will be sanitized later. * If a value is provided then the sanitized version of that will be returned. * @record */ function StyleSanitizeFn() {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * An `html` sanitizer which converts untrusted `html` **string** into trusted string by removing * dangerous content. * * This method parses the `html` and locates potentially dangerous content (such as urls and * javascript) and removes it. * * It is possible to mark a string as trusted by calling {\@link bypassSanitizationTrustHtml}. * * \@publicApi * @param {?} unsafeHtml untrusted `html`, typically from the user. * @return {?} `html` string which is safe to display to user, because all of the dangerous javascript * and urls have been removed. * */ function ɵɵsanitizeHtml(unsafeHtml) { /** @type {?} */ var sanitizer = getSanitizer(); if (sanitizer) { return sanitizer.sanitize(SecurityContext.HTML, unsafeHtml) || ''; } if (allowSanitizationBypass(unsafeHtml, "Html" /* Html */ )) { return unsafeHtml.toString(); } return _sanitizeHtml(document, renderStringify(unsafeHtml)); } /** * A `style` sanitizer which converts untrusted `style` **string** into trusted string by removing * dangerous content. * * This method parses the `style` and locates potentially dangerous content (such as urls and * javascript) and removes it. * * It is possible to mark a string as trusted by calling {\@link bypassSanitizationTrustStyle}. * * \@publicApi * @param {?} unsafeStyle untrusted `style`, typically from the user. * @return {?} `style` string which is safe to bind to the `style` properties, because all of the * dangerous javascript and urls have been removed. * */ function ɵɵsanitizeStyle(unsafeStyle) { /** @type {?} */ var sanitizer = getSanitizer(); if (sanitizer) { return sanitizer.sanitize(SecurityContext.STYLE, unsafeStyle) || ''; } if (allowSanitizationBypass(unsafeStyle, "Style" /* Style */ )) { return unsafeStyle.toString(); } return _sanitizeStyle(renderStringify(unsafeStyle)); } /** * A `url` sanitizer which converts untrusted `url` **string** into trusted string by removing * dangerous * content. * * This method parses the `url` and locates potentially dangerous content (such as javascript) and * removes it. * * It is possible to mark a string as trusted by calling {\@link bypassSanitizationTrustUrl}. * * \@publicApi * @param {?} unsafeUrl untrusted `url`, typically from the user. * @return {?} `url` string which is safe to bind to the `src` properties such as `<img src>`, because * all of the dangerous javascript has been removed. * */ function ɵɵsanitizeUrl(unsafeUrl) { /** @type {?} */ var sanitizer = getSanitizer(); if (sanitizer) { return sanitizer.sanitize(SecurityContext.URL, unsafeUrl) || ''; } if (allowSanitizationBypass(unsafeUrl, "Url" /* Url */ )) { return unsafeUrl.toString(); } return _sanitizeUrl(renderStringify(unsafeUrl)); } /** * A `url` sanitizer which only lets trusted `url`s through. * * This passes only `url`s marked trusted by calling {\@link bypassSanitizationTrustResourceUrl}. * * \@publicApi * @param {?} unsafeResourceUrl untrusted `url`, typically from the user. * @return {?} `url` string which is safe to bind to the `src` properties such as `<img src>`, because * only trusted `url`s have been allowed to pass. * */ function ɵɵsanitizeResourceUrl(unsafeResourceUrl) { /** @type {?} */ var sanitizer = getSanitizer(); if (sanitizer) { return sanitizer.sanitize(SecurityContext.RESOURCE_URL, unsafeResourceUrl) || ''; } if (allowSanitizationBypass(unsafeResourceUrl, "ResourceUrl" /* ResourceUrl */ )) { return unsafeResourceUrl.toString(); } throw new Error('unsafe value used in a resource URL context (see http://g.co/ng/security#xss)'); } /** * A `script` sanitizer which only lets trusted javascript through. * * This passes only `script`s marked trusted by calling {\@link * bypassSanitizationTrustScript}. * * \@publicApi * @param {?} unsafeScript untrusted `script`, typically from the user. * @return {?} `url` string which is safe to bind to the `<script>` element such as `<img src>`, * because only trusted `scripts` have been allowed to pass. * */ function ɵɵsanitizeScript(unsafeScript) { /** @type {?} */ var sanitizer = getSanitizer(); if (sanitizer) { return sanitizer.sanitize(SecurityContext.SCRIPT, unsafeScript) || ''; } if (allowSanitizationBypass(unsafeScript, "Script" /* Script */ )) { return unsafeScript.toString(); } throw new Error('unsafe value used in a script context'); } /** * Detects which sanitizer to use for URL property, based on tag name and prop name. * * The rules are based on the RESOURCE_URL context config from * `packages/compiler/src/schema/dom_security_schema.ts`. * If tag and prop names don't match Resource URL schema, use URL sanitizer. * @param {?} tag * @param {?} prop * @return {?} */ function getUrlSanitizer(tag, prop) { if (prop === 'src' && (tag === 'embed' || tag === 'frame' || tag === 'iframe' || tag === 'media' || tag === 'script') || prop === 'href' && (tag === 'base' || tag === 'link')) { return ɵɵsanitizeResourceUrl; } return ɵɵsanitizeUrl; } /** * Sanitizes URL, selecting sanitizer function based on tag and property names. * * This function is used in case we can't define security context at compile time, when only prop * name is available. This happens when we generate host bindings for Directives/Components. The * host element is unknown at compile time, so we defer calculation of specific sanitizer to * runtime. * * \@publicApi * @param {?} unsafeUrl untrusted `url`, typically from the user. * @param {?} tag target element tag name. * @param {?} prop name of the property that contains the value. * @return {?} `url` string which is safe to bind. * */ function ɵɵsanitizeUrlOrResourceUrl(unsafeUrl, tag, prop) { return getUrlSanitizer(tag, prop)(unsafeUrl); } /** * The default style sanitizer will handle sanitization for style properties by * sanitizing any CSS property that can include a `url` value (usually image-based properties) * * \@publicApi * @type {?} */ var ɵɵdefaultStyleSanitizer = /** @type {?} */ /** * @param {?} prop * @param {?} value * @param {?=} mode * @return {?} */ function ɵɵdefaultStyleSanitizer(prop, value, mode) { mode = mode || 3 /* ValidateAndSanitize */ ; /** @type {?} */ var doSanitizeValue = true; if (mode & 1 /* ValidateProperty */ ) { doSanitizeValue = prop === 'background-image' || prop === 'background' || prop === 'border-image' || prop === 'filter' || prop === 'list-style' || prop === 'list-style-image' || prop === 'clip-path'; } if (mode & 2 /* SanitizeOnly */ ) { return doSanitizeValue ? ɵɵsanitizeStyle(value) : value; } else { return doSanitizeValue; } }; /** * @param {?} name * @return {?} */ function validateAgainstEventProperties(name) { if (name.toLowerCase().startsWith('on')) { /** @type {?} */ var msg = "Binding to event property '".concat(name, "' is disallowed for security reasons, ") + "please use (".concat(name.slice(2), ")=...") + "\nIf '".concat(name, "' is a directive input, make sure the directive is imported by the") + " current module."; throw new Error(msg); } } /** * @param {?} name * @return {?} */ function validateAgainstEventAttributes(name) { if (name.toLowerCase().startsWith('on')) { /** @type {?} */ var msg = "Binding to event attribute '".concat(name, "' is disallowed for security reasons, ") + "please use (".concat(name.slice(2), ")=..."); throw new Error(msg); } } /** * @return {?} */ function getSanitizer() { /** @type {?} */ var lView = getLView(); return lView && lView[SANITIZER]; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * THIS FILE CONTAINS CODE WHICH SHOULD BE TREE SHAKEN AND NEVER CALLED FROM PRODUCTION CODE!!! */ /** * Creates an `Array` construction with a given name. This is useful when * looking for memory consumption to see what time of array it is. * * * @param name Name to give to the constructor * @returns A subclass of `Array` if possible. This can only be done in * environments which support `class` construct. */ function createNamedArrayType(name) { // This should never be called in prod mode, so let's verify that is the case. if (ngDevMode) { try { // We need to do it this way so that TypeScript does not down-level the below code. var FunctionConstructor = createNamedArrayType.constructor; return new FunctionConstructor('Array', "return class ABC extends Array{}")(Array); } catch (e) { // If it does not work just give up and fall back to regular Array. return Array; } } else { throw new Error('Looks like we are in \'prod mode\', but we are creating a named Array type, which is wrong! Check your code'); } } /** * @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 */ function normalizeDebugBindingName(name) { // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers name = camelCaseToDashCase(name.replace(/[$@]/g, '_')); return "ng-reflect-".concat(name); } var CAMEL_CASE_REGEXP = /([A-Z])/g; function camelCaseToDashCase(input) { return input.replace(CAMEL_CASE_REGEXP, function () { for (var _len14 = arguments.length, m = new Array(_len14), _key15 = 0; _key15 < _len14; _key15++) { m[_key15] = arguments[_key15]; } return '-' + m[1].toLowerCase(); }); } function normalizeDebugBindingValue(value) { try { // Limit the size of the value as otherwise the DOM just gets polluted. return value != null ? value.toString().slice(0, 30) : value; } catch (e) { return '[ERROR] Exception while trying to serialize the value'; } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Returns the matching `LContext` data for a given DOM node, directive or component instance. * * This function will examine the provided DOM element, component, or directive instance\'s * monkey-patched property to derive the `LContext` data. Once called then the monkey-patched * value will be that of the newly created `LContext`. * * If the monkey-patched value is the `LView` instance then the context value for that * target will be created and the monkey-patch reference will be updated. Therefore when this * function is called it may mutate the provided element\'s, component\'s or any of the associated * directive\'s monkey-patch values. * * If the monkey-patch value is not detected then the code will walk up the DOM until an element * is found which contains a monkey-patch reference. When that occurs then the provided element * will be updated with a new context (which is then returned). If the monkey-patch value is not * detected for a component/directive instance then it will throw an error (all components and * directives should be automatically monkey-patched by ivy). * * @param {?} target Component, Directive or DOM Node. * @return {?} */ function getLContext(target) { /** @type {?} */ var mpValue = readPatchedData(target); if (mpValue) { // only when it's an array is it considered an LView instance // ... otherwise it's an already constructed LContext instance if (Array.isArray(mpValue)) { /** @type {?} */ var _lView2 = /** @type {?} */ mpValue; /** @type {?} */ var nodeIndex; /** @type {?} */ var component = undefined; /** @type {?} */ var directives = undefined; if (isComponentInstance(target)) { nodeIndex = findViaComponent(_lView2, target); if (nodeIndex == -1) { throw new Error('The provided component was not found in the application'); } component = target; } else if (isDirectiveInstance(target)) { nodeIndex = findViaDirective(_lView2, target); if (nodeIndex == -1) { throw new Error('The provided directive was not found in the application'); } directives = getDirectivesAtNodeIndex(nodeIndex, _lView2, false); } else { nodeIndex = findViaNativeElement(_lView2, /** @type {?} */ target); if (nodeIndex == -1) { return null; } } // the goal is not to fill the entire context full of data because the lookups // are expensive. Instead, only the target data (the element, component, container, ICU // expression or directive details) are filled into the context. If called multiple times // with different target values then the missing target data will be filled in. /** @type {?} */ var _native2 = unwrapRNode(_lView2[nodeIndex]); /** @type {?} */ var existingCtx = readPatchedData(_native2); /** @type {?} */ var context = existingCtx && !Array.isArray(existingCtx) ? existingCtx : createLContext(_lView2, nodeIndex, _native2); // only when the component has been discovered then update the monkey-patch if (component && context.component === undefined) { context.component = component; attachPatchData(context.component, context); } // only when the directives have been discovered then update the monkey-patch if (directives && context.directives === undefined) { context.directives = directives; for (var i = 0; i < directives.length; i++) { attachPatchData(directives[i], context); } } attachPatchData(context["native"], context); mpValue = context; } } else { /** @type {?} */ var rElement = /** @type {?} */ target; ngDevMode && assertDomNode(rElement); // if the context is not found then we need to traverse upwards up the DOM // to find the nearest element that has already been monkey patched with data /** @type {?} */ var parent = /** @type {?} */ rElement; while (parent = parent.parentNode) { /** @type {?} */ var parentContext = readPatchedData(parent); if (parentContext) { /** @type {?} */ var _lView3 = void 0; if (Array.isArray(parentContext)) { _lView3 = /** @type {?} */ parentContext; } else { _lView3 = parentContext.lView; } // the edge of the app was also reached here through another means // (maybe because the DOM was changed manually). if (!_lView3) { return null; } /** @type {?} */ var index = findViaNativeElement(_lView3, rElement); if (index >= 0) { /** @type {?} */ var _native3 = unwrapRNode(_lView3[index]); /** @type {?} */ var _context2 = createLContext(_lView3, index, _native3); attachPatchData(_native3, _context2); mpValue = _context2; break; } } } } return ( /** @type {?} */ mpValue || null ); } /** * Creates an empty instance of a `LContext` context * @param {?} lView * @param {?} nodeIndex * @param {?} native * @return {?} */ function createLContext(lView, nodeIndex, _native4) { return { lView: lView, nodeIndex: nodeIndex, "native": _native4, component: undefined, directives: undefined, localRefs: undefined }; } /** * Takes a component instance and returns the view for that component. * * @param {?} componentInstance * @return {?} The component's view */ function getComponentViewByInstance(componentInstance) { /** @type {?} */ var lView = readPatchedData(componentInstance); /** @type {?} */ var view; if (Array.isArray(lView)) { /** @type {?} */ var nodeIndex = findViaComponent(lView, componentInstance); view = getComponentViewByIndex(nodeIndex, lView); /** @type {?} */ var context = createLContext(lView, nodeIndex, /** @type {?} */ view[HOST]); context.component = componentInstance; attachPatchData(componentInstance, context); attachPatchData(context["native"], context); } else { /** @type {?} */ var _context3 = /** @type {?} */ /** @type {?} */ lView; view = getComponentViewByIndex(_context3.nodeIndex, _context3.lView); } return view; } /** * Assigns the given data to the given target (which could be a component, * directive or DOM node instance) using monkey-patching. * @param {?} target * @param {?} data * @return {?} */ function attachPatchData(target, data) { target[MONKEY_PATCH_KEY_NAME] = data; } /** * @param {?} instance * @return {?} */ function isComponentInstance(instance) { return instance && instance.constructor && instance.constructor.ngComponentDef; } /** * @param {?} instance * @return {?} */ function isDirectiveInstance(instance) { return instance && instance.constructor && instance.constructor.ngDirectiveDef; } /** * Locates the element within the given LView and returns the matching index * @param {?} lView * @param {?} target * @return {?} */ function findViaNativeElement(lView, target) { /** @type {?} */ var tNode = lView[TVIEW].firstChild; while (tNode) { /** @type {?} */ var _native5 = /** @type {?} */ getNativeByTNodeOrNull(tNode, lView); if (_native5 === target) { return tNode.index; } tNode = traverseNextElement(tNode); } return -1; } /** * Locates the next tNode (child, sibling or parent). * @param {?} tNode * @return {?} */ function traverseNextElement(tNode) { if (tNode.child) { return tNode.child; } else if (tNode.next) { return tNode.next; } else { // Let's take the following template: <div><span>text</span></div><component/> // After checking the text node, we need to find the next parent that has a "next" TNode, // in this case the parent `div`, so that we can find the component. while (tNode.parent && !tNode.parent.next) { tNode = tNode.parent; } return tNode.parent && tNode.parent.next; } } /** * Locates the component within the given LView and returns the matching index * @param {?} lView * @param {?} componentInstance * @return {?} */ function findViaComponent(lView, componentInstance) { /** @type {?} */ var componentIndices = lView[TVIEW].components; if (componentIndices) { for (var i = 0; i < componentIndices.length; i++) { /** @type {?} */ var elementComponentIndex = componentIndices[i]; /** @type {?} */ var componentView = getComponentViewByIndex(elementComponentIndex, lView); if (componentView[CONTEXT] === componentInstance) { return elementComponentIndex; } } } else { /** @type {?} */ var rootComponentView = getComponentViewByIndex(HEADER_OFFSET, lView); /** @type {?} */ var rootComponent = rootComponentView[CONTEXT]; if (rootComponent === componentInstance) { // we are dealing with the root element here therefore we know that the // element is the very first element after the HEADER data in the lView return HEADER_OFFSET; } } return -1; } /** * Locates the directive within the given LView and returns the matching index * @param {?} lView * @param {?} directiveInstance * @return {?} */ function findViaDirective(lView, directiveInstance) { // if a directive is monkey patched then it will (by default) // have a reference to the LView of the current view. The // element bound to the directive being search lives somewhere // in the view data. We loop through the nodes and check their // list of directives for the instance. /** @type {?} */ var tNode = lView[TVIEW].firstChild; while (tNode) { /** @type {?} */ var directiveIndexStart = tNode.directiveStart; /** @type {?} */ var directiveIndexEnd = tNode.directiveEnd; for (var i = directiveIndexStart; i < directiveIndexEnd; i++) { if (lView[i] === directiveInstance) { return tNode.index; } } tNode = traverseNextElement(tNode); } return -1; } /** * Returns a list of directives extracted from the given view based on the * provided list of directive index values. * * @param {?} nodeIndex The node index * @param {?} lView The target view data * @param {?} includeComponents Whether or not to include components in returned directives * @return {?} */ function getDirectivesAtNodeIndex(nodeIndex, lView, includeComponents) { /** @type {?} */ var tNode = /** @type {?} */ lView[TVIEW].data[nodeIndex]; /** @type {?} */ var directiveStartIndex = tNode.directiveStart; if (directiveStartIndex == 0) return EMPTY_ARRAY; /** @type {?} */ var directiveEndIndex = tNode.directiveEnd; if (!includeComponents && tNode.flags & 1 /* isComponent */ ) directiveStartIndex++; return lView.slice(directiveStartIndex, directiveEndIndex); } /** * @param {?} nodeIndex * @param {?} lView * @return {?} */ function getComponentAtNodeIndex(nodeIndex, lView) { /** @type {?} */ var tNode = /** @type {?} */ lView[TVIEW].data[nodeIndex]; /** @type {?} */ var directiveStartIndex = tNode.directiveStart; return tNode.flags & 1 /* isComponent */ ? lView[directiveStartIndex] : null; } /** * Returns a map of local references (local reference name => element or directive instance) that * exist on a given element. * @param {?} lView * @param {?} nodeIndex * @return {?} */ function discoverLocalRefs(lView, nodeIndex) { /** @type {?} */ var tNode = /** @type {?} */ lView[TVIEW].data[nodeIndex]; if (tNode && tNode.localNames) { /** @type {?} */ var result = {}; /** @type {?} */ var localIndex = tNode.index + 1; for (var i = 0; i < tNode.localNames.length; i += 2) { result[tNode.localNames[i]] = lView[localIndex]; localIndex++; } return result; } return null; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Called when directives inject each other (creating a circular dependency) * @param {?} token * @return {?} */ function throwCyclicDependencyError(token) { throw new Error("Cannot instantiate cyclic dependency! ".concat(token)); } /** * Called when there are multiple component selectors that match a given node * @param {?} tNode * @return {?} */ function throwMultipleComponentError(tNode) { throw new Error("Multiple components match node with tagname ".concat(tNode.tagName)); } /** * Throws an ExpressionChangedAfterChecked error if checkNoChanges mode is on. * @param {?} creationMode * @param {?} oldValue * @param {?} currValue * @return {?} */ function throwErrorIfNoChangesMode(creationMode, oldValue, currValue) { /** @type {?} */ var msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '".concat(oldValue, "'. Current value: '").concat(currValue, "'."); if (creationMode) { msg += " It seems like the view has been created after its parent and its children have been dirty checked." + " Has it been created in a change detection hook ?"; } // TODO: include debug context throw new Error(msg); } /** * @return {?} */ function throwMixedMultiProviderError() { throw new Error("Cannot mix multi providers and regular providers"); } /** * @param {?=} ngModuleType * @param {?=} providers * @param {?=} provider * @return {?} */ function throwInvalidProviderError(ngModuleType, providers, provider) { /** @type {?} */ var ngModuleDetail = ''; if (ngModuleType && providers) { /** @type {?} */ var providerDetail = providers.map( /** * @param {?} v * @return {?} */ function (v) { return v == provider ? '?' + provider + '?' : '...'; }); ngModuleDetail = " - only instances of Provider and Type are allowed, got: [".concat(providerDetail.join(', '), "]"); } throw new Error("Invalid provider for the NgModule '".concat(stringify(ngModuleType), "'") + ngModuleDetail); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @enum {number} */ var TNodeType = { /** * The TNode contains information about an {@link LContainer} for embedded views. */ Container: 0, /** * The TNode contains information about an `<ng-content>` projection */ Projection: 1, /** * The TNode contains information about an {@link LView} */ View: 2, /** * The TNode contains information about a DOM element aka {@link RNode}. */ Element: 3, /** * The TNode contains information about an `<ng-container>` element {@link RNode}. */ ElementContainer: 4, /** * The TNode contains information about an ICU comment used in `i18n`. */ IcuContainer: 5 }; /** @enum {number} */ var TNodeFlags = { /** This bit is set if the node is a component */ isComponent: 1, /** This bit is set if the node has been projected */ isProjected: 2, /** This bit is set if any directive on this node has content queries */ hasContentQuery: 4, /** This bit is set if the node has any "class" inputs */ hasClassInput: 8, /** This bit is set if the node has any "style" inputs */ hasStyleInput: 16, /** This bit is set if the node has been detached by i18n */ isDetached: 32 }; /** @enum {number} */ var TNodeProviderIndexes = { /** The index of the first provider on this node is encoded on the least significant bits */ ProvidersStartIndexMask: 65535, /** The count of view providers from the component on this node is encoded on the 16 most significant bits */ CptViewProvidersCountShift: 16, CptViewProvidersCountShifter: 65536 }; /** @enum {number} */ var AttributeMarker = { /** * Marker indicates that the following 3 values in the attributes array are: * namespaceUri, attributeName, attributeValue * in that order. */ NamespaceURI: 0, /** * Signals class declaration. * * Each value following `Classes` designates a class name to include on the element. * ## Example: * * Given: * ``` * <div class="foo bar baz">...<d/vi> * ``` * * the generated code is: * ``` * var _c1 = [AttributeMarker.Classes, 'foo', 'bar', 'baz']; * ``` */ Classes: 1, /** * Signals style declaration. * * Each pair of values following `Styles` designates a style name and value to include on the * element. * ## Example: * * Given: * ``` * <div style="width:100px; height:200px; color:red">...</div> * ``` * * the generated code is: * ``` * var _c1 = [AttributeMarker.Styles, 'width', '100px', 'height'. '200px', 'color', 'red']; * ``` */ Styles: 2, /** * Signals that the following attribute names were extracted from input or output bindings. * * For example, given the following HTML: * * ``` * <div moo="car" [foo]="exp" (bar)="doSth()"> * ``` * * the generated code is: * * ``` * var _c1 = ['moo', 'car', AttributeMarker.Bindings, 'foo', 'bar']; * ``` */ Bindings: 3, /** * Signals that the following attribute names were hoisted from an inline-template declaration. * * For example, given the following HTML: * * ``` * <div *ngFor="let value of values; trackBy:trackBy" dirA [dirB]="value"> * ``` * * the generated code for the `template()` instruction would include: * * ``` * ['dirA', '', AttributeMarker.Bindings, 'dirB', AttributeMarker.Template, 'ngFor', 'ngForOf', * 'ngForTrackBy', 'let-value'] * ``` * * while the generated code for the `element()` instruction inside the template function would * include: * * ``` * ['dirA', '', AttributeMarker.Bindings, 'dirB'] * ``` */ Template: 4, /** * Signals that the following attribute is `ngProjectAs` and its value is a parsed `CssSelector`. * * For example, given the following HTML: * * ``` * <h1 attr="value" ngProjectAs="[title]"> * ``` * * the generated code for the `element()` instruction would include: * * ``` * ['attr', 'value', AttributeMarker.ProjectAs, ['', 'title', '']] * ``` */ ProjectAs: 5, /** * Signals that the following attribute will be translated by runtime i18n * * For example, given the following HTML: * * ``` * <div moo="car" foo="value" i18n-foo [bar]="binding" i18n-bar> * ``` * * the generated code is: * * ``` * var _c1 = ['moo', 'car', AttributeMarker.I18n, 'foo', 'bar']; */ I18n: 6 }; /** * Binding data (flyweight) for a particular node that is shared between all templates * of a specific type. * * If a property is: * - PropertyAliases: that property's data was generated and this is it * - Null: that property's data was already generated and nothing was found. * - Undefined: that property's data has not yet been generated * * see: https://en.wikipedia.org/wiki/Flyweight_pattern for more on the Flyweight pattern * @record */ function TNode() {} if (false) {} /** * Static data for an element * @record */ function TElementNode() {} if (false) {} /** * Static data for a text node * @record */ function TTextNode() {} if (false) {} /** * Static data for an LContainer * @record */ function TContainerNode() {} if (false) {} /** * Static data for an <ng-container> * @record */ function TElementContainerNode() {} if (false) {} /** * Static data for an ICU expression * @record */ function TIcuContainerNode() {} if (false) {} /** * Static data for a view * @record */ function TViewNode() {} if (false) {} /** * Static data for an LProjectionNode * @record */ function TProjectionNode() {} if (false) {} // Note: This hack is necessary so we don't erroneously get a circular dependency // failure based on types. /** @type {?} */ var unusedValueExportToPlacateAjd$4 = 1; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** @enum {number} */ var SelectorFlags = { /** Indicates this is the beginning of a new negative selector */ NOT: 1, /** Mode for matching attributes */ ATTRIBUTE: 2, /** Mode for matching tag names */ ELEMENT: 4, /** Mode for matching class names */ CLASS: 8 }; // Note: This hack is necessary so we don't erroneously get a circular dependency // failure based on types. /** @type {?} */ var unusedValueExportToPlacateAjd$5 = 1; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var unusedValueToPlacateAjd = unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$5; /** @type {?} */ var NG_TEMPLATE_SELECTOR = 'ng-template'; /** * @param {?} nodeClassAttrVal * @param {?} cssClassToMatch * @return {?} */ function isCssClassMatching(nodeClassAttrVal, cssClassToMatch) { /** @type {?} */ var nodeClassesLen = nodeClassAttrVal.length; /** @type {?} */ var matchIndex = /** @type {?} */ nodeClassAttrVal.indexOf(cssClassToMatch); /** @type {?} */ var matchEndIdx = matchIndex + cssClassToMatch.length; if (matchIndex === -1 // no match || matchIndex > 0 && /** @type {?} */ nodeClassAttrVal[matchIndex - 1] !== ' ' // no space before || matchEndIdx < nodeClassesLen && /** @type {?} */ nodeClassAttrVal[matchEndIdx] !== ' ') // no space after { return false; } return true; } /** * Function that checks whether a given tNode matches tag-based selector and has a valid type. * * Matching can be performed in 2 modes: projection mode (when we project nodes) and regular * directive matching mode: * - in the "directive matching" mode we do _not_ take TContainer's tagName into account if it is * different from NG_TEMPLATE_SELECTOR (value different from NG_TEMPLATE_SELECTOR indicates that a * tag name was extracted from * syntax so we would match the same directive twice); * - in the "projection" mode, we use a tag name potentially extracted from the * syntax processing * (applicable to TNodeType.Container only). * @param {?} tNode * @param {?} currentSelector * @param {?} isProjectionMode * @return {?} */ function hasTagAndTypeMatch(tNode, currentSelector, isProjectionMode) { /** @type {?} */ var tagNameToCompare = tNode.type === 0 /* Container */ && !isProjectionMode ? NG_TEMPLATE_SELECTOR : tNode.tagName; return currentSelector === tagNameToCompare; } /** * A utility function to match an Ivy node static data against a simple CSS selector * * @param {?} tNode * @param {?} selector The selector to try matching against the node. * @param {?} isProjectionMode if `true` we are matching for content projection, otherwise we are doing * directive matching. * @return {?} true if node matches the selector. */ function isNodeMatchingSelector(tNode, selector, isProjectionMode) { ngDevMode && assertDefined(selector[0], 'Selector should have a tag name'); /** @type {?} */ var mode = 4 /* ELEMENT */ ; /** @type {?} */ var nodeAttrs = tNode.attrs || []; // Find the index of first attribute that has no value, only a name. /** @type {?} */ var nameOnlyMarkerIdx = getNameOnlyMarkerIndex(nodeAttrs); // When processing ":not" selectors, we skip to the next ":not" if the // current one doesn't match /** @type {?} */ var skipToNextSelector = false; for (var i = 0; i < selector.length; i++) { /** @type {?} */ var current = selector[i]; if (typeof current === 'number') { // If we finish processing a :not selector and it hasn't failed, return false if (!skipToNextSelector && !isPositive(mode) && !isPositive( /** @type {?} */ current)) { return false; } // If we are skipping to the next :not() and this mode flag is positive, // it's a part of the current :not() selector, and we should keep skipping if (skipToNextSelector && isPositive(current)) continue; skipToNextSelector = false; mode = /** @type {?} */ current | mode & 1 /* NOT */ ; continue; } if (skipToNextSelector) continue; if (mode & 4 /* ELEMENT */ ) { mode = 2 /* ATTRIBUTE */ | mode & 1 /* NOT */ ; if (current !== '' && !hasTagAndTypeMatch(tNode, current, isProjectionMode) || current === '' && selector.length === 1) { if (isPositive(mode)) return false; skipToNextSelector = true; } } else { /** @type {?} */ var selectorAttrValue = mode & 8 /* CLASS */ ? current : selector[++i]; // special case for matching against classes when a tNode has been instantiated with // class and style values as separate attribute values (e.g. ['title', CLASS, 'foo']) if (mode & 8 /* CLASS */ && tNode.classes) { if (!isCssClassMatching(getInitialStylingValue(tNode.classes), /** @type {?} */ selectorAttrValue)) { if (isPositive(mode)) return false; skipToNextSelector = true; } continue; } /** @type {?} */ var isInlineTemplate = tNode.type == 0 /* Container */ && tNode.tagName !== NG_TEMPLATE_SELECTOR; /** @type {?} */ var attrName = mode & 8 /* CLASS */ ? 'class' : current; /** @type {?} */ var attrIndexInNode = findAttrIndexInNode(attrName, nodeAttrs, isInlineTemplate, isProjectionMode); if (attrIndexInNode === -1) { if (isPositive(mode)) return false; skipToNextSelector = true; continue; } if (selectorAttrValue !== '') { /** @type {?} */ var nodeAttrValue = void 0; if (attrIndexInNode > nameOnlyMarkerIdx) { nodeAttrValue = ''; } else { ngDevMode && assertNotEqual(nodeAttrs[attrIndexInNode], 0 /* NamespaceURI */ , 'We do not match directives on namespaced attributes'); nodeAttrValue = /** @type {?} */ nodeAttrs[attrIndexInNode + 1]; } /** @type {?} */ var compareAgainstClassName = mode & 8 /* CLASS */ ? nodeAttrValue : null; if (compareAgainstClassName && !isCssClassMatching(compareAgainstClassName, /** @type {?} */ selectorAttrValue) || mode & 2 /* ATTRIBUTE */ && selectorAttrValue !== nodeAttrValue) { if (isPositive(mode)) return false; skipToNextSelector = true; } } } } return isPositive(mode) || skipToNextSelector; } /** * @param {?} mode * @return {?} */ function isPositive(mode) { return (mode & 1 /* NOT */ ) === 0; } /** * Examines the attribute's definition array for a node to find the index of the * attribute that matches the given `name`. * * NOTE: This will not match namespaced attributes. * * Attribute matching depends upon `isInlineTemplate` and `isProjectionMode`. * The following table summarizes which types of attributes we attempt to match: * * =========================================================================================================== * Modes | Normal Attributes | Bindings Attributes | Template Attributes | I18n * Attributes * =========================================================================================================== * Inline + Projection | YES | YES | NO | YES * ----------------------------------------------------------------------------------------------------------- * Inline + Directive | NO | NO | YES | NO * ----------------------------------------------------------------------------------------------------------- * Non-inline + Projection | YES | YES | NO | YES * ----------------------------------------------------------------------------------------------------------- * Non-inline + Directive | YES | YES | NO | YES * =========================================================================================================== * * @param {?} name the name of the attribute to find * @param {?} attrs the attribute array to examine * @param {?} isInlineTemplate true if the node being matched is an inline template (e.g. `*ngFor`) * rather than a manually expanded template node (e.g `<ng-template>`). * @param {?} isProjectionMode true if we are matching against content projection otherwise we are * matching against directives. * @return {?} */ function findAttrIndexInNode(name, attrs, isInlineTemplate, isProjectionMode) { if (attrs === null) return -1; /** @type {?} */ var i = 0; if (isProjectionMode || !isInlineTemplate) { /** @type {?} */ var bindingsMode = false; while (i < attrs.length) { /** @type {?} */ var maybeAttrName = attrs[i]; if (maybeAttrName === name) { return i; } else if (maybeAttrName === 3 /* Bindings */ || maybeAttrName === 6 /* I18n */ ) { bindingsMode = true; } else if (maybeAttrName === 1 /* Classes */ ) { /** @type {?} */ var value = attrs[++i]; // We should skip classes here because we have a separate mechanism for // matching classes in projection mode. while (typeof value === 'string') { value = attrs[++i]; } continue; } else if (maybeAttrName === 4 /* Template */ ) { // We do not care about Template attributes in this scenario. break; } else if (maybeAttrName === 0 /* NamespaceURI */ ) { // Skip the whole namespaced attribute and value. This is by design. i += 4; continue; } // In binding mode there are only names, rather than name-value pairs. i += bindingsMode ? 1 : 2; } // We did not match the attribute return -1; } else { return matchTemplateAttribute(attrs, name); } } /** * @param {?} tNode * @param {?} selector * @param {?=} isProjectionMode * @return {?} */ function isNodeMatchingSelectorList(tNode, selector) { var isProjectionMode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; for (var i = 0; i < selector.length; i++) { if (isNodeMatchingSelector(tNode, selector[i], isProjectionMode)) { return true; } } return false; } /** * @param {?} tNode * @return {?} */ function getProjectAsAttrValue(tNode) { /** @type {?} */ var nodeAttrs = tNode.attrs; if (nodeAttrs != null) { /** @type {?} */ var ngProjectAsAttrIdx = nodeAttrs.indexOf(5 /* ProjectAs */ ); // only check for ngProjectAs in attribute names, don't accidentally match attribute's value // (attribute names are stored at even indexes) if ((ngProjectAsAttrIdx & 1) === 0) { return ( /** @type {?} */ nodeAttrs[ngProjectAsAttrIdx + 1] ); } } return null; } /** * @param {?} nodeAttrs * @return {?} */ function getNameOnlyMarkerIndex(nodeAttrs) { for (var i = 0; i < nodeAttrs.length; i++) { /** @type {?} */ var nodeAttr = nodeAttrs[i]; if (isNameOnlyAttributeMarker(nodeAttr)) { return i; } } return nodeAttrs.length; } /** * @param {?} attrs * @param {?} name * @return {?} */ function matchTemplateAttribute(attrs, name) { /** @type {?} */ var i = attrs.indexOf(4 /* Template */ ); if (i > -1) { i++; while (i < attrs.length) { if (attrs[i] === name) return i; i++; } } return -1; } /** * Checks whether a selector is inside a CssSelectorList * @param {?} selector Selector to be checked. * @param {?} list List in which to look for the selector. * @return {?} */ function isSelectorInSelectorList(selector, list) { selectorListLoop: for (var i = 0; i < list.length; i++) { /** @type {?} */ var currentSelectorInList = list[i]; if (selector.length !== currentSelectorInList.length) { continue; } for (var j = 0; j < selector.length; j++) { if (selector[j] !== currentSelectorInList[j]) { continue selectorListLoop; } } return true; } return false; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // The first bit value reflects a map-based binding value's bit. // The reason why it's always activated for every entry in the map // is so that if any map-binding values update then all other prop // based bindings will pass the guard check automatically without // any extra code or flags. /** * -------- * * This file contains the core logic for styling in Angular. * * All styling bindings (i.e. `[style]`, `[style.prop]`, `[class]` and `[class.name]`) * will have their values be applied through the logic in this file. * * When a binding is encountered (e.g. `<div [style.width]="w">`) then * the binding data will be populated into a `TStylingContext` data-structure. * There is only one `TStylingContext` per `TNode` and each element instance * will update its style/class binding values in concert with the styling * context. * * To learn more about the algorithm see `TStylingContext`. * * -------- * @type {?} */ var DEFAULT_GUARD_MASK_VALUE = 1; /** * The guard/update mask bit index location for map-based bindings. * * All map-based bindings (i.e. `[style]` and `[class]` ) * @type {?} */ var STYLING_INDEX_FOR_MAP_BINDING = 0; /** * Default fallback value for a styling binding. * * A value of `null` is used here which signals to the styling algorithm that * the styling value is not present. This way if there are no other values * detected then it will be removed once the style/class property is dirty and * diffed within the styling algorithm present in `flushStyling`. * @type {?} */ var DEFAULT_BINDING_VALUE = null; /** * Default size count value for a new entry in a context. * * A value of `1` is used here because each entry in the context has a default * property. * @type {?} */ var DEFAULT_SIZE_VALUE = 1; /** @type {?} */ var deferredBindingQueue = []; /** * Visits a class-based binding and updates the new value (if changed). * * This function is called each time a class-based styling instruction * is executed. It's important that it's always called (even if the value * has not changed) so that the inner counter index value is incremented. * This way, each instruction is always guaranteed to get the same counter * state each time it's called (which then allows the `TStylingContext` * and the bit mask values to be in sync). * @param {?} context * @param {?} data * @param {?} element * @param {?} prop * @param {?} bindingIndex * @param {?} value * @param {?} deferRegistration * @param {?} forceUpdate * @return {?} */ function updateClassBinding(context, data, element, prop, bindingIndex, value, deferRegistration, forceUpdate) { /** @type {?} */ var isMapBased = !prop; /** @type {?} */ var state = getStylingState(element, stateIsPersisted(context)); /** @type {?} */ var index = isMapBased ? STYLING_INDEX_FOR_MAP_BINDING : state.classesIndex++; /** @type {?} */ var updated = updateBindingData(context, data, index, prop, bindingIndex, value, deferRegistration, forceUpdate, false); if (updated || forceUpdate) { // We flip the bit in the bitMask to reflect that the binding // at the `index` slot has changed. This identifies to the flushing // phase that the bindings for this particular CSS class need to be // applied again because on or more of the bindings for the CSS // class have changed. state.classesBitMask |= 1 << index; return true; } return false; } /** * Visits a style-based binding and updates the new value (if changed). * * This function is called each time a style-based styling instruction * is executed. It's important that it's always called (even if the value * has not changed) so that the inner counter index value is incremented. * This way, each instruction is always guaranteed to get the same counter * state each time it's called (which then allows the `TStylingContext` * and the bit mask values to be in sync). * @param {?} context * @param {?} data * @param {?} element * @param {?} prop * @param {?} bindingIndex * @param {?} value * @param {?} sanitizer * @param {?} deferRegistration * @param {?} forceUpdate * @return {?} */ function updateStyleBinding(context, data, element, prop, bindingIndex, value, sanitizer, deferRegistration, forceUpdate) { /** @type {?} */ var isMapBased = !prop; /** @type {?} */ var state = getStylingState(element, stateIsPersisted(context)); /** @type {?} */ var index = isMapBased ? STYLING_INDEX_FOR_MAP_BINDING : state.stylesIndex++; /** @type {?} */ var sanitizationRequired = isMapBased ? true : sanitizer ? sanitizer( /** @type {?} */ prop, null, 1 /* ValidateProperty */ ) : false; /** @type {?} */ var updated = updateBindingData(context, data, index, prop, bindingIndex, value, deferRegistration, forceUpdate, sanitizationRequired); if (updated || forceUpdate) { // We flip the bit in the bitMask to reflect that the binding // at the `index` slot has changed. This identifies to the flushing // phase that the bindings for this particular property need to be // applied again because on or more of the bindings for the CSS // property have changed. state.stylesBitMask |= 1 << index; return true; } return false; } /** * Called each time a binding value has changed within the provided `TStylingContext`. * * This function is designed to be called from `updateStyleBinding` and `updateClassBinding`. * If called during the first update pass, the binding will be registered in the context. * If the binding does get registered and the `deferRegistration` flag is true then the * binding data will be queued up until the context is later flushed in `applyStyling`. * * This function will also update binding slot in the provided `LStylingData` with the * new binding entry (if it has changed). * * @param {?} context * @param {?} data * @param {?} counterIndex * @param {?} prop * @param {?} bindingIndex * @param {?} value * @param {?} deferRegistration * @param {?} forceUpdate * @param {?} sanitizationRequired * @return {?} whether or not the binding value was updated in the `LStylingData`. */ function updateBindingData(context, data, counterIndex, prop, bindingIndex, value, deferRegistration, forceUpdate, sanitizationRequired) { if (!isContextLocked(context)) { if (deferRegistration) { deferBindingRegistration(context, counterIndex, prop, bindingIndex, sanitizationRequired); } else { deferredBindingQueue.length && flushDeferredBindings(); // this will only happen during the first update pass of the // context. The reason why we can't use `tNode.firstTemplatePass` // here is because its not guaranteed to be true when the first // update pass is executed (remember that all styling instructions // are run in the update phase, and, as a result, are no more // styling instructions that are run in the creation phase). registerBinding(context, counterIndex, prop, bindingIndex, sanitizationRequired); } } /** @type {?} */ var changed = forceUpdate || hasValueChanged(data[bindingIndex], value); if (changed) { data[bindingIndex] = value; } return changed; } /** * Schedules a binding registration to be run at a later point. * * The reasoning for this feature is to ensure that styling * bindings are registered in the correct order for when * directives/components have a super/sub class inheritance * chains. Each directive's styling bindings must be * registered into the context in reverse order. Therefore all * bindings will be buffered in reverse order and then applied * after the inheritance chain exits. * @param {?} context * @param {?} counterIndex * @param {?} prop * @param {?} bindingIndex * @param {?} sanitizationRequired * @return {?} */ function deferBindingRegistration(context, counterIndex, prop, bindingIndex, sanitizationRequired) { deferredBindingQueue.unshift(context, counterIndex, prop, bindingIndex, sanitizationRequired); } /** * Flushes the collection of deferred bindings and causes each entry * to be registered into the context. * @return {?} */ function flushDeferredBindings() { /** @type {?} */ var i = 0; while (i < deferredBindingQueue.length) { /** @type {?} */ var context = /** @type {?} */ deferredBindingQueue[i++]; /** @type {?} */ var count = /** @type {?} */ deferredBindingQueue[i++]; /** @type {?} */ var prop = /** @type {?} */ deferredBindingQueue[i++]; /** @type {?} */ var bindingIndex = /** @type {?} */ deferredBindingQueue[i++]; /** @type {?} */ var sanitizationRequired = /** @type {?} */ deferredBindingQueue[i++]; registerBinding(context, count, prop, bindingIndex, sanitizationRequired); } deferredBindingQueue.length = 0; } /** * Registers the provided binding (prop + bindingIndex) into the context. * * This function is shared between bindings that are assigned immediately * (via `updateBindingData`) and at a deferred stage. When called, it will * figure out exactly where to place the binding data in the context. * * It is needed because it will either update or insert a styling property * into the context at the correct spot. * * When called, one of two things will happen: * * 1) If the property already exists in the context then it will just add * the provided `bindingValue` to the end of the binding sources region * for that particular property. * * - If the binding value is a number then it will be added as a new * binding index source next to the other binding sources for the property. * * - Otherwise, if the binding value is a string/boolean/null type then it will * replace the default value for the property if the default value is `null`. * * 2) If the property does not exist then it will be inserted into the context. * The styling context relies on all properties being stored in alphabetical * order, so it knows exactly where to store it. * * When inserted, a default `null` value is created for the property which exists * as the default value for the binding. If the bindingValue property is inserted * and it is either a string, number or null value then that will replace the default * value. * * Note that this function is also used for map-based styling bindings. They are treated * much the same as prop-based bindings, but, because they do not have a property value * (since it's a map), all map-based entries are stored in an already populated area of * the context at the top (which is reserved for map-based entries). * @param {?} context * @param {?} countId * @param {?} prop * @param {?} bindingValue * @param {?=} sanitizationRequired * @return {?} */ function registerBinding(context, countId, prop, bindingValue, sanitizationRequired) { /** @type {?} */ var registered = false; if (prop) { // prop-based bindings (e.g `<div [style.width]="w" [class.foo]="f">`) /** @type {?} */ var found = false; /** @type {?} */ var i = getPropValuesStartPosition(context); while (i < context.length) { /** @type {?} */ var valuesCount = getValuesCount(context, i); /** @type {?} */ var p = getProp(context, i); found = prop <= p; if (found) { // all style/class bindings are sorted by property name if (prop < p) { allocateNewContextEntry(context, i, prop, sanitizationRequired); } addBindingIntoContext(context, false, i, bindingValue, countId); break; } i += 3 /* BindingsStartOffset */ + valuesCount; } if (!found) { allocateNewContextEntry(context, context.length, prop, sanitizationRequired); addBindingIntoContext(context, false, i, bindingValue, countId); registered = true; } } else { // map-based bindings (e.g `<div [style]="s" [class]="{className:true}">`) // there is no need to allocate the map-based binding region into the context // since it is already there when the context is first created. addBindingIntoContext(context, true, 3 /* MapBindingsPosition */ , bindingValue, countId); registered = true; } return registered; } /** * @param {?} context * @param {?} index * @param {?} prop * @param {?=} sanitizationRequired * @return {?} */ function allocateNewContextEntry(context, index, prop, sanitizationRequired) { // 1,2: splice index locations // 3: each entry gets a config value (guard mask + flags) // 4. each entry gets a size value (which is always one because there is always a default binding // value) // 5. the property that is getting allocated into the context // 6. the default binding value (usually `null`) /** @type {?} */ var config = sanitizationRequired ? 1 /* SanitizationRequired */ : 0 /* Default */ ; context.splice(index, 0, config, DEFAULT_SIZE_VALUE, prop, DEFAULT_BINDING_VALUE); setGuardMask(context, index, DEFAULT_GUARD_MASK_VALUE); } /** * Inserts a new binding value into a styling property tuple in the `TStylingContext`. * * A bindingValue is inserted into a context during the first update pass * of a template or host bindings function. When this occurs, two things * happen: * * - If the bindingValue value is a number then it is treated as a bindingIndex * value (a index in the `LView`) and it will be inserted next to the other * binding index entries. * * - Otherwise the binding value will update the default value for the property * and this will only happen if the default value is `null`. * * Note that this function also handles map-based bindings and will insert them * at the top of the context. * @param {?} context * @param {?} isMapBased * @param {?} index * @param {?} bindingValue * @param {?} countId * @return {?} */ function addBindingIntoContext(context, isMapBased, index, bindingValue, countId) { /** @type {?} */ var valuesCount = getValuesCount(context, index); /** @type {?} */ var firstValueIndex = index + 3 /* BindingsStartOffset */ ; /** @type {?} */ var lastValueIndex = firstValueIndex + valuesCount; if (!isMapBased) { // prop-based values all have default values, but map-based entries do not. // we want to access the index for the default value in this case and not just // the bindings... lastValueIndex--; } if (typeof bindingValue === 'number') { // the loop here will check to see if the binding already exists // for the property in the context. Why? The reason for this is // because the styling context is not "locked" until the first // flush has occurred. This means that if a repeated element // registers its styling bindings then it will register each // binding more than once (since its duplicated). This check // will prevent that from happening. Note that this only happens // when a binding is first encountered and not each time it is // updated. for (var i = firstValueIndex; i <= lastValueIndex; i++) { /** @type {?} */ var indexAtPosition = context[i]; if (indexAtPosition === bindingValue) return; } context.splice(lastValueIndex, 0, bindingValue); /** @type {?} */context[index + 1 /* ValuesCountOffset */]++; // now that a new binding index has been added to the property // the guard mask bit value (at the `countId` position) needs // to be included into the existing mask value. /** @type {?} */ var guardMask = getGuardMask(context, index) | 1 << countId; setGuardMask(context, index, guardMask); } else if (bindingValue !== null && context[lastValueIndex] == null) { context[lastValueIndex] = bindingValue; } } /** * Applies all pending style and class bindings to the provided element. * * This function will attempt to flush styling via the provided `classesContext` * and `stylesContext` context values. This function is designed to be run from * the `stylingApply()` instruction (which is run at the very end of styling * change detection) and will rely on any state values that are set from when * any styling bindings update. * * This function may be called multiple times on the same element because it can * be called from the template code as well as from host bindings. In order for * styling to be successfully flushed to the element (which will only happen once * despite this being called multiple times), the following criteria must be met: * * - `flushStyling` is called from the very last directive that has styling for * the element (see `allowStylingFlush()`). * - one or more bindings for classes or styles has updated (this is checked by * examining the classes or styles bit mask). * * If the style and class values are successfully applied to the element then * the temporary state values for the element will be cleared. Otherwise, if * this did not occur then the styling state is persisted (see `state.ts` for * more information on how this works). * @param {?} renderer * @param {?} data * @param {?} classesContext * @param {?} stylesContext * @param {?} element * @param {?} directiveIndex * @param {?} styleSanitizer * @return {?} */ function flushStyling(renderer, data, classesContext, stylesContext, element, directiveIndex, styleSanitizer) { ngDevMode && ngDevMode.flushStyling++; /** @type {?} */ var persistState = classesContext ? stateIsPersisted(classesContext) : stylesContext ? stateIsPersisted(stylesContext) : false; /** @type {?} */ var allowFlushClasses = allowStylingFlush(classesContext, directiveIndex); /** @type {?} */ var allowFlushStyles = allowStylingFlush(stylesContext, directiveIndex); // deferred bindings are bindings which are scheduled to register with // the context at a later point. These bindings can only registered when // the context will be 100% flushed to the element. if (deferredBindingQueue.length && (allowFlushClasses || allowFlushStyles)) { flushDeferredBindings(); } /** @type {?} */ var state = getStylingState(element, persistState); /** @type {?} */ var classesFlushed = maybeApplyStyling(renderer, element, data, classesContext, allowFlushClasses, state.classesBitMask, setClass, null); /** @type {?} */ var stylesFlushed = maybeApplyStyling(renderer, element, data, stylesContext, allowFlushStyles, state.stylesBitMask, setStyle, styleSanitizer); if (classesFlushed && stylesFlushed) { resetStylingState(); if (persistState) { deleteStylingStateFromStorage(element); } } else if (persistState) { storeStylingState(element, state); } } /** * @param {?} renderer * @param {?} element * @param {?} data * @param {?} context * @param {?} allowFlush * @param {?} bitMask * @param {?} styleSetter * @param {?} styleSanitizer * @return {?} */ function maybeApplyStyling(renderer, element, data, context, allowFlush, bitMask, styleSetter, styleSanitizer) { if (allowFlush && context) { lockAndFinalizeContext(context); if (contextHasUpdates(context, bitMask)) { ngDevMode && (styleSanitizer ? ngDevMode.stylesApplied++ : ngDevMode.classesApplied++); applyStyling( /** @type {?} */ context, renderer, element, data, bitMask, styleSetter, styleSanitizer); return true; } } return allowFlush; } /** * @param {?} context * @param {?} bitMask * @return {?} */ function contextHasUpdates(context, bitMask) { return context && bitMask > BIT_MASK_START_VALUE; } /** * Locks the context (so no more bindings can be added) and also copies over initial class/style * values into their binding areas. * * There are two main actions that take place in this function: * * - Locking the context: * Locking the context is required so that the style/class instructions know NOT to * register a binding again after the first update pass has run. If a locking bit was * not used then it would need to scan over the context each time an instruction is run * (which is expensive). * * - Patching initial values: * Directives and component host bindings may include static class/style values which are * bound to the host element. When this happens, the styling context will need to be informed * so it can use these static styling values as defaults when a matching binding is falsy. * These initial styling values are read from the initial styling values slot within the * provided `TStylingContext` (which is an instance of a `StylingMapArray`). This inner map will * be updated each time a host binding applies its static styling values (via `elementHostAttrs`) * so these values are only read at this point because this is the very last point before the * first style/class values are flushed to the element. * @param {?} context * @return {?} */ function lockAndFinalizeContext(context) { if (!isContextLocked(context)) { /** @type {?} */ var initialValues = getStylingMapArray(context); if (initialValues) { updateInitialStylingOnContext(context, initialValues); } lockContext(context); } } /** * Runs through the provided styling context and applies each value to * the provided element (via the renderer) if one or more values are present. * * This function will iterate over all entries present in the provided * `TStylingContext` array (both prop-based and map-based bindings).- * * Each entry, within the `TStylingContext` array, is stored alphabetically * and this means that each prop/value entry will be applied in order * (so long as it is marked dirty in the provided `bitMask` value). * * If there are any map-based entries present (which are applied to the * element via the `[style]` and `[class]` bindings) then those entries * will be applied as well. However, the code for that is not a part of * this function. Instead, each time a property is visited, then the * code below will call an external function called `stylingMapsSyncFn` * and, if present, it will keep the application of styling values in * map-based bindings up to sync with the application of prop-based * bindings. * * Visit `styling_next/map_based_bindings.ts` to learn more about how the * algorithm works for map-based styling bindings. * * Note that this function is not designed to be called in isolation (use * `applyClasses` and `applyStyles` to actually apply styling values). * @param {?} context * @param {?} renderer * @param {?} element * @param {?} bindingData * @param {?} bitMaskValue * @param {?} applyStylingFn * @param {?} sanitizer * @return {?} */ function applyStyling(context, renderer, element, bindingData, bitMaskValue, applyStylingFn, sanitizer) { /** @type {?} */ var bitMask = normalizeBitMaskValue(bitMaskValue); /** @type {?} */ var stylingMapsSyncFn = getStylingMapsSyncFn(); /** @type {?} */ var mapsGuardMask = getGuardMask(context, 3 /* MapBindingsPosition */ ); /** @type {?} */ var applyAllValues = (bitMask & mapsGuardMask) > 0; /** @type {?} */ var mapsMode = applyAllValues ? 1 /* ApplyAllValues */ : 0 /* TraverseValues */ ; /** @type {?} */ var i = getPropValuesStartPosition(context); while (i < context.length) { /** @type {?} */ var valuesCount = getValuesCount(context, i); /** @type {?} */ var guardMask = getGuardMask(context, i); if (bitMask & guardMask) { /** @type {?} */ var valueApplied = false; /** @type {?} */ var prop = getProp(context, i); /** @type {?} */ var valuesCountUpToDefault = valuesCount - 1; /** @type {?} */ var defaultValue = /** @type {?} */ getBindingValue(context, i, valuesCountUpToDefault); // case 1: apply prop-based values // try to apply the binding values and see if a non-null // value gets set for the styling binding for (var j = 0; j < valuesCountUpToDefault; j++) { /** @type {?} */ var bindingIndex = /** @type {?} */ getBindingValue(context, i, j); /** @type {?} */ var value = bindingData[bindingIndex]; if (isStylingValueDefined(value)) { /** @type {?} */ var finalValue = sanitizer && isSanitizationRequired(context, i) ? sanitizer(prop, value, 2 /* SanitizeOnly */ ) : value; applyStylingFn(renderer, element, prop, finalValue, bindingIndex); valueApplied = true; break; } } // case 2: apply map-based values // traverse through each map-based styling binding and update all values up to // the provided `prop` value. If the property was not applied in the loop above // then it will be attempted to be applied in the maps sync code below. if (stylingMapsSyncFn) { // determine whether or not to apply the target property or to skip it /** @type {?} */ var mode = mapsMode | (valueApplied ? 4 /* SkipTargetProp */ : 2 /* ApplyTargetProp */ ); /** @type {?} */ var valueAppliedWithinMap = stylingMapsSyncFn(context, renderer, element, bindingData, applyStylingFn, sanitizer, mode, prop, defaultValue); valueApplied = valueApplied || valueAppliedWithinMap; } // case 3: apply the default value // if the value has not yet been applied then a truthy value does not exist in the // prop-based or map-based bindings code. If and when this happens, just apply the // default value (even if the default value is `null`). if (!valueApplied) { applyStylingFn(renderer, element, prop, defaultValue); } } i += 3 /* BindingsStartOffset */ + valuesCount; } // the map-based styling entries may have not applied all their // values. For this reason, one more call to the sync function // needs to be issued at the end. if (stylingMapsSyncFn) { stylingMapsSyncFn(context, renderer, element, bindingData, applyStylingFn, sanitizer, mapsMode); } } /** * @param {?} value * @return {?} */ function normalizeBitMaskValue(value) { // if pass => apply all values (-1 implies that all bits are flipped to true) if (value === true) return -1; // if pass => skip all values if (value === false) return 0; // return the bit mask value as is return value; } /** @type {?} */ var _activeStylingMapApplyFn = null; /** * @return {?} */ function getStylingMapsSyncFn() { return _activeStylingMapApplyFn; } /** * @param {?} fn * @return {?} */ function setStylingMapsSyncFn(fn) { _activeStylingMapApplyFn = fn; } /** * Assigns a style value to a style property for the given element. * @type {?} */ var setStyle = /** * @param {?} renderer * @param {?} native * @param {?} prop * @param {?} value * @return {?} */ function setStyle(renderer, _native6, prop, value) { // the reason why this may be `null` is either because // it's a container element or it's a part of a test // environment that doesn't have styling. In either // case it's safe not to apply styling to the element. /** @type {?} */ var nativeStyle = _native6.style; if (value) { // opacity, z-index and flexbox all have number values // and these need to be converted into strings so that // they can be assigned properly. value = value.toString(); ngDevMode && ngDevMode.rendererSetStyle++; renderer && isProceduralRenderer(renderer) ? renderer.setStyle(_native6, prop, value, RendererStyleFlags3.DashCase) : nativeStyle && nativeStyle.setProperty(prop, value); } else { ngDevMode && ngDevMode.rendererRemoveStyle++; renderer && isProceduralRenderer(renderer) ? renderer.removeStyle(_native6, prop, RendererStyleFlags3.DashCase) : nativeStyle && nativeStyle.removeProperty(prop); } }; var ɵ0$4 = setStyle; /** * Adds/removes the provided className value to the provided element. * @type {?} */ var setClass = /** * @param {?} renderer * @param {?} native * @param {?} className * @param {?} value * @return {?} */ function setClass(renderer, _native7, className, value) { if (className !== '') { // the reason why this may be `null` is either because // it's a container element or it's a part of a test // environment that doesn't have styling. In either // case it's safe not to apply styling to the element. /** @type {?} */ var classList = _native7.classList; if (value) { ngDevMode && ngDevMode.rendererAddClass++; renderer && isProceduralRenderer(renderer) ? renderer.addClass(_native7, className) : classList && classList.add(className); } else { ngDevMode && ngDevMode.rendererRemoveClass++; renderer && isProceduralRenderer(renderer) ? renderer.removeClass(_native7, className) : classList && classList.remove(className); } } }; var ɵ1$1 = setClass; /** * Iterates over all provided styling entries and renders them on the element. * * This function is used alongside a `StylingMapArray` entry. This entry is not * the same as the `TStylingContext` and is only really used when an element contains * initial styling values (e.g. `<div style="width:200px">`), but no style/class bindings * are present. If and when that happens then this function will be called to render all * initial styling values on an element. * @param {?} renderer * @param {?} element * @param {?} stylingValues * @param {?} isClassBased * @return {?} */ function renderStylingMap(renderer, element, stylingValues, isClassBased) { /** @type {?} */ var stylingMapArr = getStylingMapArray(stylingValues); if (stylingMapArr) { for (var i = 1 /* ValuesStartPosition */ ; i < stylingMapArr.length; i += 2 /* TupleSize */ ) { /** @type {?} */ var prop = getMapProp(stylingMapArr, i); /** @type {?} */ var value = getMapValue(stylingMapArr, i); if (isClassBased) { setClass(renderer, element, prop, value, null); } else { setStyle(renderer, element, prop, value, null); } } } } /** * Registers all initial styling entries into the provided context. * * This function will iterate over all entries in the provided `initialStyling` ar}ray and register * them as default (initial) values in the provided context. Initial styling values in a context are * the default values that are to be applied unless overwritten by a binding. * * The reason why this function exists and isn't a part of the context construction is because * host binding is evaluated at a later stage after the element is created. This means that * if a directive or component contains any initial styling code (i.e. `<div class="foo">`) * then that initial styling data can only be applied once the styling for that element * is first applied (at the end of the update phase). Once that happens then the context will * update itself with the complete initial styling for the element. * @param {?} context * @param {?} initialStyling * @return {?} */ function updateInitialStylingOnContext(context, initialStyling) { // `-1` is used here because all initial styling data is not a spart // of a binding (since it's static) /** @type {?} */ var INITIAL_STYLING_COUNT_ID = -1; for (var i = 1 /* ValuesStartPosition */ ; i < initialStyling.length; i += 2 /* TupleSize */ ) { /** @type {?} */ var value = getMapValue(initialStyling, i); if (value) { /** @type {?} */ var prop = getMapProp(initialStyling, i); registerBinding(context, INITIAL_STYLING_COUNT_ID, prop, value, false); } } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ // WARNING: interface has both a type and a value, skipping emit /** * A special value which designates that a value has not changed. * @type {?} */ var NO_CHANGE = /** @type {?} */ {}; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** @enum {number} */ var I18nMutateOpCode = { /** * Stores shift amount for bits 17-3 that contain reference index. */ SHIFT_REF: 3, /** * Stores shift amount for bits 31-17 that contain parent index. */ SHIFT_PARENT: 17, /** * Mask for OpCode */ MASK_OPCODE: 7, /** * OpCode to select a node. (next OpCode will contain the operation.) */ Select: 0, /** * OpCode to append the current node to `PARENT`. */ AppendChild: 1, /** * OpCode to remove the `REF` node from `PARENT`. */ Remove: 3, /** * OpCode to set the attribute of a node. */ Attr: 4, /** * OpCode to simulate elementEnd() */ ElementEnd: 5, /** * OpCode to read the remove OpCodes for the nested ICU */ RemoveNestedIcu: 6 }; /** * Marks that the next string is for element. * * See `I18nMutateOpCodes` documentation. * @type {?} */ var ELEMENT_MARKER = { marker: 'element' }; // WARNING: interface has both a type and a value, skipping emit /** * Marks that the next string is for comment. * * See `I18nMutateOpCodes` documentation. * @type {?} */ var COMMENT_MARKER = { marker: 'comment' }; // WARNING: interface has both a type and a value, skipping emit /** * Array storing OpCode for dynamically creating `i18n` blocks. * * Example: * ```ts * <I18nCreateOpCode>[ * // For adding text nodes * // --------------------- * // Equivalent to: * // const node = lView[index++] = document.createTextNode('abc'); * // lView[1].insertBefore(node, lView[2]); * 'abc', 1 << SHIFT_PARENT | 2 << SHIFT_REF | InsertBefore, * * // Equivalent to: * // const node = lView[index++] = document.createTextNode('xyz'); * // lView[1].appendChild(node); * 'xyz', 1 << SHIFT_PARENT | AppendChild, * * // For adding element nodes * // --------------------- * // Equivalent to: * // const node = lView[index++] = document.createElement('div'); * // lView[1].insertBefore(node, lView[2]); * ELEMENT_MARKER, 'div', 1 << SHIFT_PARENT | 2 << SHIFT_REF | InsertBefore, * * // Equivalent to: * // const node = lView[index++] = document.createElement('div'); * // lView[1].appendChild(node); * ELEMENT_MARKER, 'div', 1 << SHIFT_PARENT | AppendChild, * * // For adding comment nodes * // --------------------- * // Equivalent to: * // const node = lView[index++] = document.createComment(''); * // lView[1].insertBefore(node, lView[2]); * COMMENT_MARKER, '', 1 << SHIFT_PARENT | 2 << SHIFT_REF | InsertBefore, * * // Equivalent to: * // const node = lView[index++] = document.createComment(''); * // lView[1].appendChild(node); * COMMENT_MARKER, '', 1 << SHIFT_PARENT | AppendChild, * * // For moving existing nodes to a different location * // -------------------------------------------------- * // Equivalent to: * // const node = lView[1]; * // lView[2].insertBefore(node, lView[3]); * 1 << SHIFT_REF | Select, 2 << SHIFT_PARENT | 3 << SHIFT_REF | InsertBefore, * * // Equivalent to: * // const node = lView[1]; * // lView[2].appendChild(node); * 1 << SHIFT_REF | Select, 2 << SHIFT_PARENT | AppendChild, * * // For removing existing nodes * // -------------------------------------------------- * // const node = lView[1]; * // removeChild(tView.data(1), node, lView); * 1 << SHIFT_REF | Remove, * * // For writing attributes * // -------------------------------------------------- * // const node = lView[1]; * // node.setAttribute('attr', 'value'); * 1 << SHIFT_REF | Select, 'attr', 'value' * // NOTE: Select followed by two string (vs select followed by OpCode) * ]; * ``` * NOTE: * - `index` is initial location where the extra nodes should be stored in the EXPANDO section of * `LVIewData`. * * See: `applyI18nCreateOpCodes`; * @record */ function I18nMutateOpCodes() {} /** @enum {number} */ var I18nUpdateOpCode = { /** * Stores shift amount for bits 17-2 that contain reference index. */ SHIFT_REF: 2, /** * Mask for OpCode */ MASK_OPCODE: 3, /** * OpCode to update a text node. */ Text: 0, /** * OpCode to update a attribute of a node. */ Attr: 1, /** * OpCode to switch the current ICU case. */ IcuSwitch: 2, /** * OpCode to update the current ICU case. */ IcuUpdate: 3 }; /** * Stores DOM operations which need to be applied to update DOM render tree due to changes in * expressions. * * The basic idea is that `i18nExp` OpCodes capture expression changes and update a change * mask bit. (Bit 1 for expression 1, bit 2 for expression 2 etc..., bit 32 for expression 32 and * higher.) The OpCodes then compare its own change mask against the expression change mask to * determine if the OpCodes should execute. * * These OpCodes can be used by both the i18n block as well as ICU sub-block. * * ## Example * * Assume * ```ts * if (rf & RenderFlags.Update) { * i18nExp(bind(ctx.exp1)); // If changed set mask bit 1 * i18nExp(bind(ctx.exp2)); // If changed set mask bit 2 * i18nExp(bind(ctx.exp3)); // If changed set mask bit 3 * i18nExp(bind(ctx.exp4)); // If changed set mask bit 4 * i18nApply(0); // Apply all changes by executing the OpCodes. * } * ``` * We can assume that each call to `i18nExp` sets an internal `changeMask` bit depending on the * index of `i18nExp`. * * ### OpCodes * ```ts * <I18nUpdateOpCodes>[ * // The following OpCodes represent: `<div i18n-title="pre{{exp1}}in{{exp2}}post">` * // If `changeMask & 0b11` * // has changed then execute update OpCodes. * // has NOT changed then skip `7` values and start processing next OpCodes. * 0b11, 7, * // Concatenate `newValue = 'pre'+lView[bindIndex-4]+'in'+lView[bindIndex-3]+'post';`. * 'pre', -4, 'in', -3, 'post', * // Update attribute: `elementAttribute(1, 'title', sanitizerFn(newValue));` * 1 << SHIFT_REF | Attr, 'title', sanitizerFn, * * // The following OpCodes represent: `<div i18n>Hello {{exp3}}!">` * // If `changeMask & 0b100` * // has changed then execute update OpCodes. * // has NOT changed then skip `4` values and start processing next OpCodes. * 0b100, 4, * // Concatenate `newValue = 'Hello ' + lView[bindIndex -2] + '!';`. * 'Hello ', -2, '!', * // Update text: `lView[1].textContent = newValue;` * 1 << SHIFT_REF | Text, * * // The following OpCodes represent: `<div i18n>{exp4, plural, ... }">` * // If `changeMask & 0b1000` * // has changed then execute update OpCodes. * // has NOT changed then skip `4` values and start processing next OpCodes. * 0b1000, 4, * // Concatenate `newValue = lView[bindIndex -1];`. * -1, * // Switch ICU: `icuSwitchCase(lView[1], 0, newValue);` * 0 << SHIFT_ICU | 1 << SHIFT_REF | IcuSwitch, * * // Note `changeMask & -1` is always true, so the IcuUpdate will always execute. * -1, 1, * // Update ICU: `icuUpdateCase(lView[1], 0);` * 0 << SHIFT_ICU | 1 << SHIFT_REF | IcuUpdate, * * ]; * ``` * * @record */ function I18nUpdateOpCodes() {} /** * Store information for the i18n translation block. * @record */ function TI18n() {} if (false) {} /** @enum {number} */ var IcuType = { select: 0, plural: 1 }; /** * @record */ function TIcu() {} if (false) {} // Note: This hack is necessary so we don't erroneously get a circular dependency // failure based on types. /** @type {?} */ var unusedValueExportToPlacateAjd$6 = 1; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 {?} obj * @param {?} debug * @return {?} */ function attachDebugObject(obj, debug) { Object.defineProperty(obj, 'debug', { value: debug, enumerable: false }); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Used to apply styling values presently within any map-based bindings on an element. * * Angular supports map-based styling bindings which can be applied via the * `[style]` and `[class]` bindings which can be placed on any HTML element. * These bindings can work independently, together or alongside prop-based * styling bindings (e.g. `<div [style]="x" [style.width]="w">`). * * If a map-based styling binding is detected by the compiler, the following * AOT code is produced: * * ```typescript * styleMap(ctx.styles); // styles = {key:value} * classMap(ctx.classes); // classes = {key:value}|string * ``` * * If and when either of the instructions above are evaluated, then the code * present in this file is included into the bundle. The mechanism used, to * activate support for map-based bindings at runtime is possible via the * `activeStylingMapFeature` function (which is also present in this file). * * # The Algorithm * Whenever a map-based binding updates (which is when the identity of the * map-value changes) then the map is iterated over and a `StylingMapArray` array * is produced. The `StylingMapArray` instance is stored in the binding location * where the `BINDING_INDEX` is situated when the `styleMap()` or `classMap()` * instruction were called. Once the binding changes, then the internal `bitMask` * value is marked as dirty. * * Styling values are applied once CD exits the element (which happens when * the `select(n)` instruction is called or the template function exits). When * this occurs, all prop-based bindings are applied. If a map-based binding is * present then a special flushing function (called a sync function) is made * available and it will be called each time a styling property is flushed. * * The flushing algorithm is designed to apply styling for a property (which is * a CSS property or a className value) one by one. If map-based bindings * are present, then the flushing algorithm will keep calling the maps styling * sync function each time a property is visited. This way, the flushing * behavior of map-based bindings will always be at the same property level * as the current prop-based property being iterated over (because everything * is alphabetically sorted). * * Let's imagine we have the following HTML template code: * * ```html * <div [style]="{width:'100px', height:'200px', 'z-index':'10'}" * [style.width.px]="200">...</div> * ``` * * When CD occurs, both the `[style]` and `[style.width]` bindings * are evaluated. Then when the styles are flushed on screen, the * following operations happen: * * 1. `[style.width]` is attempted to be written to the element. * * 2. Once that happens, the algorithm instructs the map-based * entries (`[style]` in this case) to "catch up" and apply * all values up to the `width` value. When this happens the * `height` value is applied to the element (since it is * alphabetically situated before the `width` property). * * 3. Since there are no more prop-based entries anymore, the * loop exits and then, just before the flushing ends, it * instructs all map-based bindings to "finish up" applying * their values. * * 4. The only remaining value within the map-based entries is * the `z-index` value (`width` got skipped because it was * successfully applied via the prop-based `[style.width]` * binding). Since all map-based entries are told to "finish up", * the `z-index` value is iterated over and it is then applied * to the element. * * The most important thing to take note of here is that prop-based * bindings are evaluated in order alongside map-based bindings. * This allows all styling across an element to be applied in O(n) * time (a similar algorithm is that of the array merge algorithm * in merge sort). * @type {?} */ var syncStylingMap = /** * @param {?} context * @param {?} renderer * @param {?} element * @param {?} data * @param {?} applyStylingFn * @param {?} sanitizer * @param {?} mode * @param {?=} targetProp * @param {?=} defaultValue * @return {?} */ function syncStylingMap(context, renderer, element, data, applyStylingFn, sanitizer, mode, targetProp, defaultValue) { /** @type {?} */ var targetPropValueWasApplied = false; // once the map-based styling code is activate it is never deactivated. For this reason a // check to see if the current styling context has any map based bindings is required. /** @type {?} */ var totalMaps = getValuesCount(context, 3 /* MapBindingsPosition */ ); if (totalMaps) { /** @type {?} */ var runTheSyncAlgorithm = true; /** @type {?} */ var loopUntilEnd = !targetProp; // If the code is told to finish up (run until the end), but the mode // hasn't been flagged to apply values (it only traverses values) then // there is no point in iterating over the array because nothing will // be applied to the element. if (loopUntilEnd && mode & ~1 /* ApplyAllValues */ ) { runTheSyncAlgorithm = false; targetPropValueWasApplied = true; } if (runTheSyncAlgorithm) { targetPropValueWasApplied = innerSyncStylingMap(context, renderer, element, data, applyStylingFn, sanitizer, mode, targetProp || null, 0, defaultValue || null); } if (loopUntilEnd) { resetSyncCursors(); } } return targetPropValueWasApplied; }; /** * Recursive function designed to apply map-based styling to an element one map at a time. * * This function is designed to be called from the `syncStylingMap` function and will * apply map-based styling data one map at a time to the provided `element`. * * This function is recursive and it will call itself if a follow-up map value is to be * processed. To learn more about how the algorithm works, see `syncStylingMap`. * @param {?} context * @param {?} renderer * @param {?} element * @param {?} data * @param {?} applyStylingFn * @param {?} sanitizer * @param {?} mode * @param {?} targetProp * @param {?} currentMapIndex * @param {?} defaultValue * @return {?} */ function innerSyncStylingMap(context, renderer, element, data, applyStylingFn, sanitizer, mode, targetProp, currentMapIndex, defaultValue) { /** @type {?} */ var targetPropValueWasApplied = false; /** @type {?} */ var totalMaps = getValuesCount(context, 3 /* MapBindingsPosition */ ); if (currentMapIndex < totalMaps) { /** @type {?} */ var bindingIndex = /** @type {?} */ getBindingValue(context, 3 /* MapBindingsPosition */ , currentMapIndex); /** @type {?} */ var stylingMapArr = /** @type {?} */ data[bindingIndex]; /** @type {?} */ var cursor = getCurrentSyncCursor(currentMapIndex); while (cursor < stylingMapArr.length) { /** @type {?} */ var prop = getMapProp(stylingMapArr, cursor); /** @type {?} */ var iteratedTooFar = targetProp && prop > targetProp; /** @type {?} */ var isTargetPropMatched = !iteratedTooFar && prop === targetProp; /** @type {?} */ var value = getMapValue(stylingMapArr, cursor); /** @type {?} */ var valueIsDefined = isStylingValueDefined(value); // the recursive code is designed to keep applying until // it reaches or goes past the target prop. If and when // this happens then it will stop processing values, but // all other map values must also catch up to the same // point. This is why a recursive call is still issued // even if the code has iterated too far. /** @type {?} */ var innerMode = iteratedTooFar ? mode : resolveInnerMapMode(mode, valueIsDefined, isTargetPropMatched); /** @type {?} */ var innerProp = iteratedTooFar ? targetProp : prop; /** @type {?} */ var valueApplied = innerSyncStylingMap(context, renderer, element, data, applyStylingFn, sanitizer, innerMode, innerProp, currentMapIndex + 1, defaultValue); if (iteratedTooFar) { if (!targetPropValueWasApplied) { targetPropValueWasApplied = valueApplied; } break; } if (!valueApplied && isValueAllowedToBeApplied(mode, isTargetPropMatched)) { /** @type {?} */ var useDefault = isTargetPropMatched && !valueIsDefined; /** @type {?} */ var valueToApply = useDefault ? defaultValue : value; /** @type {?} */ var bindingIndexToApply = useDefault ? bindingIndex : null; /** @type {?} */ var finalValue = sanitizer ? sanitizer(prop, valueToApply, 3 /* ValidateAndSanitize */ ) : valueToApply; applyStylingFn(renderer, element, prop, finalValue, bindingIndexToApply); valueApplied = true; } targetPropValueWasApplied = valueApplied && isTargetPropMatched; cursor += 2 /* TupleSize */ ; } setCurrentSyncCursor(currentMapIndex, cursor); // this is a fallback case in the event that the styling map is `null` for this // binding but there are other map-based bindings that need to be evaluated // afterwards. If the `prop` value is falsy then the intention is to cycle // through all of the properties in the remaining maps as well. If the current // styling map is too short then there are no values to iterate over. In either // case the follow-up maps need to be iterated over. if (stylingMapArr.length === 1 /* ValuesStartPosition */ || !targetProp) { return innerSyncStylingMap(context, renderer, element, data, applyStylingFn, sanitizer, mode, targetProp, currentMapIndex + 1, defaultValue); } } return targetPropValueWasApplied; } /** * Enables support for map-based styling bindings (e.g. `[style]` and `[class]` bindings). * @return {?} */ function activateStylingMapFeature() { setStylingMapsSyncFn(syncStylingMap); } /** * Used to determine the mode for the inner recursive call. * * If an inner map is iterated on then this is done so for one * of two reasons: * * - value is being applied: * if the value is being applied from this current styling * map then there is no need to apply it in a deeper map. * * - value is being not applied: * apply the value if it is found in a deeper map. * * When these reasons are encountered the flags will for the * inner map mode will be configured. * @param {?} currentMode * @param {?} valueIsDefined * @param {?} isExactMatch * @return {?} */ function resolveInnerMapMode(currentMode, valueIsDefined, isExactMatch) { /** @type {?} */ var innerMode = currentMode; if (!valueIsDefined && !(currentMode & 4 /* SkipTargetProp */ ) && (isExactMatch || currentMode & 1 /* ApplyAllValues */ )) { // case 1: set the mode to apply the targeted prop value if it // ends up being encountered in another map value innerMode |= 2 /* ApplyTargetProp */ ; innerMode &= ~4 /* SkipTargetProp */ ; } else { // case 2: set the mode to skip the targeted prop value if it // ends up being encountered in another map value innerMode |= 4 /* SkipTargetProp */ ; innerMode &= ~2 /* ApplyTargetProp */ ; } return innerMode; } /** * Decides whether or not a prop/value entry will be applied to an element. * * To determine whether or not a value is to be applied, * the following procedure is evaluated: * * First check to see the current `mode` status: * 1. If the mode value permits all props to be applied then allow. * - But do not allow if the current prop is set to be skipped. * 2. Otherwise if the current prop is permitted then allow. * @param {?} mode * @param {?} isTargetPropMatched * @return {?} */ function isValueAllowedToBeApplied(mode, isTargetPropMatched) { /** @type {?} */ var doApplyValue = (mode & 1 /* ApplyAllValues */ ) > 0; if (!doApplyValue) { if (mode & 2 /* ApplyTargetProp */ ) { doApplyValue = isTargetPropMatched; } } else if (mode & 4 /* SkipTargetProp */ && isTargetPropMatched) { doApplyValue = false; } return doApplyValue; } /** * Used to keep track of concurrent cursor values for multiple map-based styling bindings present on * an element. * @type {?} */ var MAP_CURSORS = []; /** * Used to reset the state of each cursor value being used to iterate over map-based styling * bindings. * @return {?} */ function resetSyncCursors() { for (var i = 0; i < MAP_CURSORS.length; i++) { MAP_CURSORS[i] = 1 /* ValuesStartPosition */ ; } } /** * Returns an active cursor value at a given mapIndex location. * @param {?} mapIndex * @return {?} */ function getCurrentSyncCursor(mapIndex) { if (mapIndex >= MAP_CURSORS.length) { MAP_CURSORS.push(1 /* ValuesStartPosition */ ); } return MAP_CURSORS[mapIndex]; } /** * Sets a cursor value at a given mapIndex location. * @param {?} mapIndex * @param {?} indexValue * @return {?} */ function setCurrentSyncCursor(mapIndex, indexValue) { MAP_CURSORS[mapIndex] = indexValue; } /** * Used to convert a {key:value} map into a `StylingMapArray` array. * * This function will either generate a new `StylingMapArray` instance * or it will patch the provided `newValues` map value into an * existing `StylingMapArray` value (this only happens if `bindingValue` * is an instance of `StylingMapArray`). * * If a new key/value map is provided with an old `StylingMapArray` * value then all properties will be overwritten with their new * values or with `null`. This means that the array will never * shrink in size (but it will also not be created and thrown * away whenever the {key:value} map entries change). * @param {?} bindingValue * @param {?} newValues * @param {?=} normalizeProps * @return {?} */ function normalizeIntoStylingMap(bindingValue, newValues, normalizeProps) { /** @type {?} */ var stylingMapArr = Array.isArray(bindingValue) ? bindingValue : [null]; stylingMapArr[0 /* RawValuePosition */ ] = newValues || null; // because the new values may not include all the properties // that the old ones had, all values are set to `null` before // the new values are applied. This way, when flushed, the // styling algorithm knows exactly what style/class values // to remove from the element (since they are `null`). for (var j = 1 /* ValuesStartPosition */ ; j < stylingMapArr.length; j += 2 /* TupleSize */ ) { setMapValue(stylingMapArr, j, null); } /** @type {?} */ var props = null; /** @type {?} */ var map; /** @type {?} */ var allValuesTrue = false; if (typeof newValues === 'string') { // [class] bindings allow string values if (newValues.length) { props = newValues.split(/\s+/); allValuesTrue = true; } } else { props = newValues ? Object.keys(newValues) : null; map = newValues; } if (props) { for (var i = 0; i < props.length; i++) { /** @type {?} */ var prop = /** @type {?} */ props[i]; /** @type {?} */ var newProp = normalizeProps ? hyphenate(prop) : prop; /** @type {?} */ var value = allValuesTrue ? true : /** @type {?} */ map[prop]; addItemToStylingMap(stylingMapArr, newProp, value, true); } } return stylingMapArr; } /** * Inserts the provided item into the provided styling array at the right spot. * * The `StylingMapArray` type is a sorted key/value array of entries. This means * that when a new entry is inserted it must be placed at the right spot in the * array. This function figures out exactly where to place it. * @param {?} stylingMapArr * @param {?} prop * @param {?} value * @param {?=} allowOverwrite * @return {?} */ function addItemToStylingMap(stylingMapArr, prop, value, allowOverwrite) { for (var j = 1 /* ValuesStartPosition */ ; j < stylingMapArr.length; j += 2 /* TupleSize */ ) { /** @type {?} */ var propAtIndex = getMapProp(stylingMapArr, j); if (prop <= propAtIndex) { /** @type {?} */ var applied = false; if (propAtIndex === prop) { /** @type {?} */ var valueAtIndex = stylingMapArr[j]; if (allowOverwrite || !isStylingValueDefined(valueAtIndex)) { applied = true; setMapValue(stylingMapArr, j, value); } } else { applied = true; stylingMapArr.splice(j, 0, prop, value); } return applied; } } stylingMapArr.push(prop, value); return true; } /** * Converts the provided styling map array into a string. * * Classes => `one two three` * Styles => `prop:value; prop2:value2` * @param {?} map * @param {?} isClassBased * @return {?} */ function stylingMapToString(map, isClassBased) { /** @type {?} */ var str = ''; for (var i = 1 /* ValuesStartPosition */ ; i < map.length; i += 2 /* TupleSize */ ) { /** @type {?} */ var prop = getMapProp(map, i); /** @type {?} */ var value = /** @type {?} */ getMapValue(map, i); /** @type {?} */ var attrValue = concatString(prop, isClassBased ? '' : value, ':'); str = concatString(str, attrValue, isClassBased ? ' ' : '; '); } return str; } /** * Converts the provided styling map array into a key value map. * @param {?} map * @return {?} */ function stylingMapToStringMap(map) { /** @type {?} */ var stringMap = {}; if (map) { for (var i = 1 /* ValuesStartPosition */ ; i < map.length; i += 2 /* TupleSize */ ) { /** @type {?} */ var prop = getMapProp(map, i); /** @type {?} */ var value = /** @type {?} */ getMapValue(map, i); stringMap[prop] = value; } } return stringMap; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A debug/testing-oriented summary of a styling entry. * * A value such as this is generated as an artifact of the `DebugStyling` * summary. * @record */ function LStylingSummary() {} if (false) {} /** * A debug/testing-oriented summary of all styling entries for a `DebugNode` instance. * @record */ function DebugStyling() {} if (false) {} /** * A debug/testing-oriented summary of all styling entries within a `TStylingContext`. * @record */ function TStylingTupleSummary() {} if (false) {} /** * Instantiates and attaches an instance of `TStylingContextDebug` to the provided context. * @param {?} context * @return {?} */ function attachStylingDebugObject(context) { /** @type {?} */ var debug = new TStylingContextDebug(context); attachDebugObject(context, debug); return debug; } /** * A human-readable debug summary of the styling data present within `TStylingContext`. * * This class is designed to be used within testing code or when an * application has `ngDevMode` activated. */ var TStylingContextDebug = /*#__PURE__*/function () { /** * @param {?} context */ function TStylingContextDebug(context) { _classCallCheck(this, TStylingContextDebug); this.context = context; } /** * @return {?} */ _createClass2(TStylingContextDebug, [{ key: "isLocked", get: function get() { return isContextLocked(this.context); } /** * Returns a detailed summary of each styling entry in the context. * * See `TStylingTupleSummary`. * @return {?} */ }, { key: "entries", get: function get() { /** @type {?} */ var context = this.context; /** @type {?} */ var entries = {}; /** @type {?} */ var start = 3 /* MapBindingsPosition */ ; /** @type {?} */ var i = start; while (i < context.length) { /** @type {?} */ var valuesCount = getValuesCount(context, i); // the context may contain placeholder values which are populated ahead of time, // but contain no actual binding values. In this situation there is no point in // classifying this as an "entry" since no real data is stored here yet. if (valuesCount) { /** @type {?} */ var prop = getProp(context, i); /** @type {?} */ var guardMask = getGuardMask(context, i); /** @type {?} */ var defaultValue = getDefaultValue(context, i); /** @type {?} */ var sanitizationRequired = isSanitizationRequired(context, i); /** @type {?} */ var bindingsStartPosition = i + 3 /* BindingsStartOffset */ ; /** @type {?} */ var sources = []; for (var j = 0; j < valuesCount; j++) { sources.push( /** @type {?} */ context[bindingsStartPosition + j]); } entries[prop] = { prop: prop, guardMask: guardMask, sanitizationRequired: sanitizationRequired, valuesCount: valuesCount, defaultValue: defaultValue, sources: sources }; } i += 3 /* BindingsStartOffset */ + valuesCount; } return entries; } }]); return TStylingContextDebug; }(); if (false) {} /** * A human-readable debug summary of the styling data present for a `DebugNode` instance. * * This class is designed to be used within testing code or when an * application has `ngDevMode` activated. */ var NodeStylingDebug = /*#__PURE__*/function () { /** * @param {?} context * @param {?} _data * @param {?=} _isClassBased */ function NodeStylingDebug(context, _data, _isClassBased) { _classCallCheck(this, NodeStylingDebug); this.context = context; this._data = _data; this._isClassBased = _isClassBased; this._sanitizer = null; } /** * Overrides the sanitizer used to process styles. * @param {?} sanitizer * @return {?} */ _createClass2(NodeStylingDebug, [{ key: "overrideSanitizer", value: function overrideSanitizer(sanitizer) { this._sanitizer = sanitizer; } /** * Returns a detailed summary of each styling entry in the context and * what their runtime representation is. * * See `LStylingSummary`. * @return {?} */ }, { key: "_mapValues", /** * @private * @param {?} fn * @return {?} */ value: function _mapValues(fn) { // there is no need to store/track an element instance. The // element is only used when the styling algorithm attempts to // style the value (and we mock out the stylingApplyFn anyway). /** @type {?} */ var mockElement = /** @type {?} */ {}; /** @type {?} */ var hasMaps = getValuesCount(this.context, 3 /* MapBindingsPosition */ ) > 0; if (hasMaps) { activateStylingMapFeature(); } /** @type {?} */ var mapFn = /** * @param {?} renderer * @param {?} element * @param {?} prop * @param {?} value * @param {?=} bindingIndex * @return {?} */ function mapFn(renderer, element, prop, value, bindingIndex) { fn(prop, value, bindingIndex || null); }; /** @type {?} */ var sanitizer = this._isClassBased ? null : this._sanitizer || getCurrentStyleSanitizer(); applyStyling(this.context, null, mockElement, this._data, true, mapFn, sanitizer); } }, { key: "summary", get: function get() { /** @type {?} */ var entries = {}; this._mapValues( /** * @param {?} prop * @param {?} value * @param {?} bindingIndex * @return {?} */ function (prop, value, bindingIndex) { entries[prop] = { prop: prop, value: value, bindingIndex: bindingIndex }; }); return entries; } /** * Returns a key/value map of all the styles/classes that were last applied to the element. * @return {?} */ }, { key: "values", get: function get() { /** @type {?} */ var entries = {}; this._mapValues( /** * @param {?} prop * @param {?} value * @return {?} */ function (prop, value) { entries[prop] = value; }); return entries; } }]); return NodeStylingDebug; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /* * This file contains conditionally attached classes which provide human readable (debug) level * information for `LView`, `LContainer` and other internal data structures. These data structures * are stored internally as array which makes it very difficult during debugging to reason about the * current state of the system. * * Patching the array with extra property does change the array's hidden class' but it does not * change the cost of access, therefore this patching should not have significant if any impact in * `ngDevMode` mode. (see: https://jsperf.com/array-vs-monkey-patch-array) * * So instead of seeing: * ``` * Array(30) [Object, 659, null, …] * ``` * * You get to see: * ``` * LViewDebug { * views: [...], * flags: {attached: true, ...} * nodes: [ * {html: '<div id="123">', ..., nodes: [ * {html: '<span>', ..., nodes: null} * ]} * ] * } * ``` */ /** @type {?} */ var LViewArray = ngDevMode && createNamedArrayType('LView'); /** @type {?} */ var LVIEW_EMPTY; // can't initialize here or it will not be tree shaken, because `LView` // constructor could have side-effects. /** * This function clones a blueprint and creates LView. * * Simple slice will keep the same type, and we need it to be LView * @param {?} list * @return {?} */ function cloneToLView(list) { if (LVIEW_EMPTY === undefined) LVIEW_EMPTY = new /** @type {?} */ LViewArray(); return ( /** @type {?} */ LVIEW_EMPTY.concat(list) ); } /** * This class is a debug version of Object literal so that we can have constructor name show up in * debug tools in ngDevMode. * @type {?} */ var TViewConstructor = /** * @param {?} id * @param {?} blueprint * @param {?} template * @param {?} queries * @param {?} viewQuery * @param {?} node * @param {?} data * @param {?} bindingStartIndex * @param {?} expandoStartIndex * @param {?} expandoInstructions * @param {?} firstTemplatePass * @param {?} staticViewQueries * @param {?} staticContentQueries * @param {?} preOrderHooks * @param {?} preOrderCheckHooks * @param {?} contentHooks * @param {?} contentCheckHooks * @param {?} viewHooks * @param {?} viewCheckHooks * @param {?} destroyHooks * @param {?} cleanup * @param {?} contentQueries * @param {?} components * @param {?} directiveRegistry * @param {?} pipeRegistry * @param {?} firstChild * @param {?} schemas */ function TView(id, // blueprint, // template, // queries, // viewQuery, // node, // data, // bindingStartIndex, // expandoStartIndex, // expandoInstructions, // firstTemplatePass, // staticViewQueries, // staticContentQueries, // preOrderHooks, // preOrderCheckHooks, // contentHooks, // contentCheckHooks, // viewHooks, // viewCheckHooks, // destroyHooks, // cleanup, // contentQueries, // components, // directiveRegistry, // pipeRegistry, // firstChild, // schemas) { _classCallCheck(this, TView); this.id = id; this.blueprint = blueprint; this.template = template; this.queries = queries; this.viewQuery = viewQuery; this.node = node; this.data = data; this.bindingStartIndex = bindingStartIndex; this.expandoStartIndex = expandoStartIndex; this.expandoInstructions = expandoInstructions; this.firstTemplatePass = firstTemplatePass; this.staticViewQueries = staticViewQueries; this.staticContentQueries = staticContentQueries; this.preOrderHooks = preOrderHooks; this.preOrderCheckHooks = preOrderCheckHooks; this.contentHooks = contentHooks; this.contentCheckHooks = contentCheckHooks; this.viewHooks = viewHooks; this.viewCheckHooks = viewCheckHooks; this.destroyHooks = destroyHooks; this.cleanup = cleanup; this.contentQueries = contentQueries; this.components = components; this.directiveRegistry = directiveRegistry; this.pipeRegistry = pipeRegistry; this.firstChild = firstChild; this.schemas = schemas; }; /** @type {?} */ var TNodeConstructor = /*#__PURE__*/function () { /** * @param {?} tView_ * @param {?} type * @param {?} index * @param {?} injectorIndex * @param {?} directiveStart * @param {?} directiveEnd * @param {?} propertyMetadataStartIndex * @param {?} propertyMetadataEndIndex * @param {?} flags * @param {?} providerIndexes * @param {?} tagName * @param {?} attrs * @param {?} localNames * @param {?} initialInputs * @param {?} inputs * @param {?} outputs * @param {?} tViews * @param {?} next * @param {?} projectionNext * @param {?} child * @param {?} parent * @param {?} projection * @param {?} styles * @param {?} classes */ function TNode(tView_, // type, // index, // injectorIndex, // directiveStart, // directiveEnd, // propertyMetadataStartIndex, // propertyMetadataEndIndex, // flags, // providerIndexes, // tagName, // attrs, // localNames, // initialInputs, // inputs, // outputs, // tViews, // next, // projectionNext, // child, // parent, // projection, // styles, // classes) { _classCallCheck(this, TNode); this.tView_ = tView_; this.type = type; this.index = index; this.injectorIndex = injectorIndex; this.directiveStart = directiveStart; this.directiveEnd = directiveEnd; this.propertyMetadataStartIndex = propertyMetadataStartIndex; this.propertyMetadataEndIndex = propertyMetadataEndIndex; this.flags = flags; this.providerIndexes = providerIndexes; this.tagName = tagName; this.attrs = attrs; this.localNames = localNames; this.initialInputs = initialInputs; this.inputs = inputs; this.outputs = outputs; this.tViews = tViews; this.next = next; this.projectionNext = projectionNext; this.child = child; this.parent = parent; this.projection = projection; this.styles = styles; this.classes = classes; } /** * @return {?} */ _createClass2(TNode, [{ key: "type_", get: function get() { switch (this.type) { case 0 /* Container */ : return 'TNodeType.Container'; case 3 /* Element */ : return 'TNodeType.Element'; case 4 /* ElementContainer */ : return 'TNodeType.ElementContainer'; case 5 /* IcuContainer */ : return 'TNodeType.IcuContainer'; case 1 /* Projection */ : return 'TNodeType.Projection'; case 2 /* View */ : return 'TNodeType.View'; default: return 'TNodeType.???'; } } /** * @return {?} */ }, { key: "flags_", get: function get() { /** @type {?} */ var flags = []; if (this.flags & 8 /* hasClassInput */ ) flags.push('TNodeFlags.hasClassInput'); if (this.flags & 4 /* hasContentQuery */ ) flags.push('TNodeFlags.hasContentQuery'); if (this.flags & 16 /* hasStyleInput */ ) flags.push('TNodeFlags.hasStyleInput'); if (this.flags & 1 /* isComponent */ ) flags.push('TNodeFlags.isComponent'); if (this.flags & 32 /* isDetached */ ) flags.push('TNodeFlags.isDetached'); if (this.flags & 2 /* isProjected */ ) flags.push('TNodeFlags.isProjected'); return flags.join('|'); } }]); return TNode; }(); /** @type {?} */ var TViewData = ngDevMode && createNamedArrayType('TViewData'); /** @type {?} */ var TVIEWDATA_EMPTY; // can't initialize here or it will not be tree shaken, because `LView` // constructor could have side-effects. /** * This function clones a blueprint and creates TData. * * Simple slice will keep the same type, and we need it to be TData * @param {?} list * @return {?} */ function cloneToTViewData(list) { if (TVIEWDATA_EMPTY === undefined) TVIEWDATA_EMPTY = new /** @type {?} */ TViewData(); return ( /** @type {?} */ TVIEWDATA_EMPTY.concat(list) ); } /** @type {?} */ var LViewBlueprint = ngDevMode && createNamedArrayType('LViewBlueprint'); /** @type {?} */ var MatchesArray = ngDevMode && createNamedArrayType('MatchesArray'); /** @type {?} */ var TViewComponents = ngDevMode && createNamedArrayType('TViewComponents'); /** @type {?} */ var TNodeLocalNames = ngDevMode && createNamedArrayType('TNodeLocalNames'); /** @type {?} */ var TNodeInitialInputs = ngDevMode && createNamedArrayType('TNodeInitialInputs'); /** @type {?} */ var TNodeInitialData = ngDevMode && createNamedArrayType('TNodeInitialData'); /** @type {?} */ var LCleanup = ngDevMode && createNamedArrayType('LCleanup'); /** @type {?} */ var TCleanup = ngDevMode && createNamedArrayType('TCleanup'); /** * @param {?} lView * @return {?} */ function attachLViewDebug(lView) { attachDebugObject(lView, new LViewDebug(lView)); } /** * @param {?} lContainer * @return {?} */ function attachLContainerDebug(lContainer) { attachDebugObject(lContainer, new LContainerDebug(lContainer)); } /** * @param {?} obj * @return {?} */ function toDebug(obj) { if (obj) { /** @type {?} */ var debug = /** @type {?} */ obj.debug; assertDefined(debug, 'Object does not have a debug representation.'); return debug; } else { return obj; } } /** * Use this method to unwrap a native element in `LView` and convert it into HTML for easier * reading. * * @param {?} value possibly wrapped native DOM node. * @param {?=} includeChildren If `true` then the serialized HTML form will include child elements (same * as `outerHTML`). If `false` then the serialized HTML form will only contain the element itself * (will not serialize child elements). * @return {?} */ function toHtml(value) { var includeChildren = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; /** @type {?} */ var node = /** @type {?} */ unwrapRNode(value); if (node) { /** @type {?} */ var isTextNode = node.nodeType === Node.TEXT_NODE; /** @type {?} */ var outerHTML = (isTextNode ? node.textContent : node.outerHTML) || ''; if (includeChildren || isTextNode) { return outerHTML; } else { /** @type {?} */ var innerHTML = node.innerHTML; return outerHTML.split(innerHTML)[0] || null; } } else { return null; } } var LViewDebug = /*#__PURE__*/function () { /** * @param {?} _raw_lView */ function LViewDebug(_raw_lView) { _classCallCheck(this, LViewDebug); this._raw_lView = _raw_lView; } /** * Flags associated with the `LView` unpacked into a more readable state. * @return {?} */ _createClass2(LViewDebug, [{ key: "flags", get: function get() { /** @type {?} */ var flags = this._raw_lView[FLAGS]; return { __raw__flags__: flags, initPhaseState: flags & 3 /* InitPhaseStateMask */ , creationMode: !!(flags & 4 /* CreationMode */ ), firstViewPass: !!(flags & 8 /* FirstLViewPass */ ), checkAlways: !!(flags & 16 /* CheckAlways */ ), dirty: !!(flags & 64 /* Dirty */ ), attached: !!(flags & 128 /* Attached */ ), destroyed: !!(flags & 256 /* Destroyed */ ), isRoot: !!(flags & 512 /* IsRoot */ ), indexWithinInitPhase: flags >> 10 /* IndexWithinInitPhaseShift */ }; } /** * @return {?} */ }, { key: "parent", get: function get() { return toDebug(this._raw_lView[PARENT]); } /** * @return {?} */ }, { key: "host", get: function get() { return toHtml(this._raw_lView[HOST], true); } /** * @return {?} */ }, { key: "context", get: function get() { return this._raw_lView[CONTEXT]; } /** * The tree of nodes associated with the current `LView`. The nodes have been normalized into a * tree structure with relevant details pulled out for readability. * @return {?} */ }, { key: "nodes", get: function get() { /** @type {?} */ var lView = this._raw_lView; /** @type {?} */ var tNode = lView[TVIEW].firstChild; return toDebugNodes(tNode, lView); } /** * Additional information which is hidden behind a property. The extra level of indirection is * done so that the debug view would not be cluttered with properties which are only rarely * relevant to the developer. * @return {?} */ }, { key: "__other__", get: function get() { return { tView: this._raw_lView[TVIEW], cleanup: this._raw_lView[CLEANUP], injector: this._raw_lView[INJECTOR$1], rendererFactory: this._raw_lView[RENDERER_FACTORY], renderer: this._raw_lView[RENDERER], sanitizer: this._raw_lView[SANITIZER], childHead: toDebug(this._raw_lView[CHILD_HEAD]), next: toDebug(this._raw_lView[NEXT]), childTail: toDebug(this._raw_lView[CHILD_TAIL]), declarationView: toDebug(this._raw_lView[DECLARATION_VIEW]), queries: null, tHost: this._raw_lView[T_HOST], bindingIndex: this._raw_lView[BINDING_INDEX] }; } /** * Normalized view of child views (and containers) attached at this location. * @return {?} */ }, { key: "childViews", get: function get() { /** @type {?} */ var childViews = []; /** @type {?} */ var child = this.__other__.childHead; while (child) { childViews.push(child); child = child.__other__.next; } return childViews; } }]); return LViewDebug; }(); if (false) {} /** * @record */ function DebugNode() {} if (false) {} /** * Turns a flat list of nodes into a tree by walking the associated `TNode` tree. * * @param {?} tNode * @param {?} lView * @return {?} */ function toDebugNodes(tNode, lView) { if (tNode) { /** @type {?} */ var debugNodes = []; /** @type {?} */ var tNodeCursor = tNode; while (tNodeCursor) { /** @type {?} */ var rawValue = lView[tNode.index]; /** @type {?} */ var _native8 = unwrapRNode(rawValue); /** @type {?} */ var componentLViewDebug = toDebug(readLViewValue(rawValue)); /** @type {?} */ var styles = isStylingContext(tNode.styles) ? new NodeStylingDebug( /** @type {?} */ /** @type {?} */ tNode.styles, lView) : null; /** @type {?} */ var classes = isStylingContext(tNode.classes) ? new NodeStylingDebug( /** @type {?} */ /** @type {?} */ tNode.classes, lView, true) : null; debugNodes.push({ html: toHtml(_native8), "native": /** @type {?} */ _native8, styles: styles, classes: classes, nodes: toDebugNodes(tNode.child, lView), component: componentLViewDebug }); tNodeCursor = tNodeCursor.next; } return debugNodes; } else { return null; } } var LContainerDebug = /*#__PURE__*/function () { /** * @param {?} _raw_lContainer */ function LContainerDebug(_raw_lContainer) { _classCallCheck(this, LContainerDebug); this._raw_lContainer = _raw_lContainer; } /** * @return {?} */ _createClass2(LContainerDebug, [{ key: "activeIndex", get: function get() { return this._raw_lContainer[ACTIVE_INDEX]; } /** * @return {?} */ }, { key: "views", get: function get() { return this._raw_lContainer.slice(CONTAINER_HEADER_OFFSET).map( /** @type {?} */ toDebug); } /** * @return {?} */ }, { key: "parent", get: function get() { return toDebug(this._raw_lContainer[PARENT]); } /** * @return {?} */ }, { key: "movedViews", get: function get() { return this._raw_lContainer[MOVED_VIEWS]; } /** * @return {?} */ }, { key: "host", get: function get() { return this._raw_lContainer[HOST]; } /** * @return {?} */ }, { key: "native", get: function get() { return this._raw_lContainer[NATIVE]; } /** * @return {?} */ }, { key: "__other__", get: function get() { return { next: toDebug(this._raw_lContainer[NEXT]) }; } }]); return LContainerDebug; }(); if (false) {} /** * Return an `LView` value if found. * * @param {?} value `LView` if any * @return {?} */ function readLViewValue(value) { while (Array.isArray(value)) { // This check is not quite right, as it does not take into account `StylingContext` // This is why it is in debug, not in util.ts if (value.length >= HEADER_OFFSET - 1) return ( /** @type {?} */ value ); value = value[HOST]; } return null; } var I18NDebugItem = /*#__PURE__*/function () { /** * @param {?} __raw_opCode * @param {?} _lView * @param {?} nodeIndex * @param {?} type */ function I18NDebugItem(__raw_opCode, _lView, nodeIndex, type) { _classCallCheck(this, I18NDebugItem); this.__raw_opCode = __raw_opCode; this._lView = _lView; this.nodeIndex = nodeIndex; this.type = type; } /** * @return {?} */ _createClass2(I18NDebugItem, [{ key: "tNode", get: function get() { return getTNode(this.nodeIndex, this._lView); } }]); return I18NDebugItem; }(); if (false) {} /** * Turns a list of "Create" & "Update" OpCodes into a human-readable list of operations for * debugging purposes. * @param {?} mutateOpCodes mutation opCodes to read * @param {?} updateOpCodes update opCodes to read * @param {?} icus list of ICU expressions * @param {?} lView The view the opCodes are acting on * @return {?} */ function attachI18nOpCodesDebug(mutateOpCodes, updateOpCodes, icus, lView) { attachDebugObject(mutateOpCodes, new I18nMutateOpCodesDebug(mutateOpCodes, lView)); attachDebugObject(updateOpCodes, new I18nUpdateOpCodesDebug(updateOpCodes, icus, lView)); if (icus) { icus.forEach( /** * @param {?} icu * @return {?} */ function (icu) { icu.create.forEach( /** * @param {?} icuCase * @return {?} */ function (icuCase) { attachDebugObject(icuCase, new I18nMutateOpCodesDebug(icuCase, lView)); }); icu.update.forEach( /** * @param {?} icuCase * @return {?} */ function (icuCase) { attachDebugObject(icuCase, new I18nUpdateOpCodesDebug(icuCase, icus, lView)); }); }); } } var I18nMutateOpCodesDebug = /*#__PURE__*/function () { /** * @param {?} __raw_opCodes * @param {?} __lView */ function I18nMutateOpCodesDebug(__raw_opCodes, __lView) { _classCallCheck(this, I18nMutateOpCodesDebug); this.__raw_opCodes = __raw_opCodes; this.__lView = __lView; } /** * A list of operation information about how the OpCodes will act on the view. * @return {?} */ _createClass2(I18nMutateOpCodesDebug, [{ key: "operations", get: function get() { var __lView = this.__lView, __raw_opCodes = this.__raw_opCodes; /** @type {?} */ var results = []; for (var i = 0; i < __raw_opCodes.length; i++) { /** @type {?} */ var opCode = __raw_opCodes[i]; /** @type {?} */ var result = void 0; if (typeof opCode === 'string') { result = { __raw_opCode: opCode, type: 'Create Text Node', nodeIndex: __raw_opCodes[++i], text: opCode }; } if (typeof opCode === 'number') { switch (opCode & 7 /* MASK_OPCODE */ ) { case 1 /* AppendChild */ : /** @type {?} */ var destinationNodeIndex = opCode >>> 17 /* SHIFT_PARENT */ ; result = new I18NDebugItem(opCode, __lView, destinationNodeIndex, 'AppendChild'); break; case 0 /* Select */ : /** @type {?} */ var nodeIndex = opCode >>> 3 /* SHIFT_REF */ ; result = new I18NDebugItem(opCode, __lView, nodeIndex, 'Select'); break; case 5 /* ElementEnd */ : /** @type {?} */ var elementIndex = opCode >>> 3 /* SHIFT_REF */ ; result = new I18NDebugItem(opCode, __lView, elementIndex, 'ElementEnd'); break; case 4 /* Attr */ : elementIndex = opCode >>> 3 /* SHIFT_REF */ ; result = new I18NDebugItem(opCode, __lView, elementIndex, 'Attr'); result['attrName'] = __raw_opCodes[++i]; result['attrValue'] = __raw_opCodes[++i]; break; } } if (!result) { switch (opCode) { case COMMENT_MARKER: result = { __raw_opCode: opCode, type: 'COMMENT_MARKER', commentValue: __raw_opCodes[++i], nodeIndex: __raw_opCodes[++i] }; break; case ELEMENT_MARKER: result = { __raw_opCode: opCode, type: 'ELEMENT_MARKER' }; break; } } if (!result) { result = { __raw_opCode: opCode, type: 'Unknown Op Code', code: opCode }; } results.push(result); } return results; } }]); return I18nMutateOpCodesDebug; }(); if (false) {} var I18nUpdateOpCodesDebug = /*#__PURE__*/function () { /** * @param {?} __raw_opCodes * @param {?} icus * @param {?} __lView */ function I18nUpdateOpCodesDebug(__raw_opCodes, icus, __lView) { _classCallCheck(this, I18nUpdateOpCodesDebug); this.__raw_opCodes = __raw_opCodes; this.icus = icus; this.__lView = __lView; } /** * A list of operation information about how the OpCodes will act on the view. * @return {?} */ _createClass2(I18nUpdateOpCodesDebug, [{ key: "operations", get: function get() { var __lView = this.__lView, __raw_opCodes = this.__raw_opCodes, icus = this.icus; /** @type {?} */ var results = []; for (var i = 0; i < __raw_opCodes.length; i++) { // bit code to check if we should apply the next update /** @type {?} */ var checkBit = /** @type {?} */ __raw_opCodes[i]; // Number of opCodes to skip until next set of update codes /** @type {?} */ var skipCodes = /** @type {?} */ __raw_opCodes[++i]; /** @type {?} */ var value = ''; for (var j = i + 1; j <= i + skipCodes; j++) { /** @type {?} */ var opCode = __raw_opCodes[j]; if (typeof opCode === 'string') { value += opCode; } else if (typeof opCode == 'number') { if (opCode < 0) { // It's a binding index whose value is negative // We cannot know the value of the binding so we only show the index value += "\uFFFD".concat(-opCode - 1, "\uFFFD"); } else { /** @type {?} */ var nodeIndex = opCode >>> 2 /* SHIFT_REF */ ; /** @type {?} */ var tIcuIndex = void 0; /** @type {?} */ var tIcu = void 0; switch (opCode & 3 /* MASK_OPCODE */ ) { case 1 /* Attr */ : /** @type {?} */ var attrName = /** @type {?} */ __raw_opCodes[++j]; /** @type {?} */ var sanitizeFn = __raw_opCodes[++j]; results.push({ __raw_opCode: opCode, checkBit: checkBit, type: 'Attr', attrValue: value, attrName: attrName, sanitizeFn: sanitizeFn }); break; case 0 /* Text */ : results.push({ __raw_opCode: opCode, checkBit: checkBit, type: 'Text', nodeIndex: nodeIndex, text: value }); break; case 2 /* IcuSwitch */ : tIcuIndex = /** @type {?} */ __raw_opCodes[++j]; tIcu = /** @type {?} */ icus[tIcuIndex]; /** @type {?} */ var result = new I18NDebugItem(opCode, __lView, nodeIndex, 'IcuSwitch'); result['tIcuIndex'] = tIcuIndex; result['checkBit'] = checkBit; result['mainBinding'] = value; result['tIcu'] = tIcu; results.push(result); break; case 3 /* IcuUpdate */ : tIcuIndex = /** @type {?} */ __raw_opCodes[++j]; tIcu = /** @type {?} */ icus[tIcuIndex]; result = new I18NDebugItem(opCode, __lView, nodeIndex, 'IcuUpdate'); result['tIcuIndex'] = tIcuIndex; result['checkBit'] = checkBit; result['tIcu'] = tIcu; results.push(result); break; } } } } i += skipCodes; } return results; } }]); return I18nUpdateOpCodesDebug; }(); if (false) {} /** * @record */ function I18nOpCodesDebug() {} if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Selects an element for later binding instructions. * * Used in conjunction with instructions like {\@link property} to act on elements with specified * indices, for example those created with {\@link element} or {\@link elementStart}. * * ```ts * (rf: RenderFlags, ctx: any) => { * if (rf & 1) { * element(0, 'div'); * } * if (rf & 2) { * select(0); // Select the <div/> created above. * property('title', 'test'); * } * } * ``` * \@codeGenApi * @param {?} index the index of the item to act on with the following instructions * * @return {?} */ function ɵɵselect(index) { ngDevMode && assertGreaterThan(index, -1, 'Invalid index'); ngDevMode && assertLessThan(index, getLView().length - HEADER_OFFSET, 'Should be within range for the view data'); /** @type {?} */ var lView = getLView(); selectInternal(lView, index); } /** * @param {?} lView * @param {?} index * @return {?} */ function selectInternal(lView, index) { // Flush the initial hooks for elements in the view that have been added up to this point. executePreOrderHooks(lView, lView[TVIEW], getCheckNoChangesMode(), index); // We must set the selected index *after* running the hooks, because hooks may have side-effects // that cause other template functions to run, thus updating the selected index, which is global // state. If we run `setSelectedIndex` *before* we run the hooks, in some cases the selected index // will be altered by the time we leave the `ɵɵselect` instruction. setSelectedIndex(index); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ɵ0$5 = /** * @return {?} */ function ɵ0$5() { return Promise.resolve(null); }; /** * A permanent marker promise which signifies that the current CD tree is * clean. * @type {?} */ var _CLEAN_PROMISE = ɵ0$5(); /** @enum {number} */ var BindingDirection = { Input: 0, Output: 1 }; /** * Refreshes the view, executing the following steps in that order: * triggers init hooks, refreshes dynamic embedded views, triggers content hooks, sets host * bindings, refreshes child components. * Note: view hooks are triggered later when leaving the view. * @param {?} lView * @return {?} */ function refreshDescendantViews(lView) { /** @type {?} */ var tView = lView[TVIEW]; /** @type {?} */ var creationMode = isCreationMode(lView); // This needs to be set before children are processed to support recursive components tView.firstTemplatePass = false; // Resetting the bindingIndex of the current LView as the next steps may trigger change detection. lView[BINDING_INDEX] = tView.bindingStartIndex; // If this is a creation pass, we should not call lifecycle hooks or evaluate bindings. // This will be done in the update pass. if (!creationMode) { /** @type {?} */ var _checkNoChangesMode = getCheckNoChangesMode(); executePreOrderHooks(lView, tView, _checkNoChangesMode, undefined); refreshDynamicEmbeddedViews(lView); // Content query results must be refreshed before content hooks are called. refreshContentQueries(tView, lView); resetPreOrderHookFlags(lView); executeHooks(lView, tView.contentHooks, tView.contentCheckHooks, _checkNoChangesMode, 1 /* AfterContentInitHooksToBeRun */ , undefined); setHostBindings(tView, lView); } // We resolve content queries specifically marked as `static` in creation mode. Dynamic // content queries are resolved during change detection (i.e. update mode), after embedded // views are refreshed (see block above). if (creationMode && tView.staticContentQueries) { refreshContentQueries(tView, lView); } // We must materialize query results before child components are processed // in case a child component has projected a container. The LContainer needs // to exist so the embedded views are properly attached by the container. if (!creationMode || tView.staticViewQueries) { executeViewQueryFn(2 /* Update */ , tView, lView[CONTEXT]); } refreshChildComponents(lView, tView.components); } /** * Sets the host bindings for the current view. * @param {?} tView * @param {?} viewData * @return {?} */ function setHostBindings(tView, viewData) { /** @type {?} */ var selectedIndex = getSelectedIndex(); try { if (tView.expandoInstructions) { /** @type {?} */ var _bindingRootIndex = viewData[BINDING_INDEX] = tView.expandoStartIndex; setBindingRoot(_bindingRootIndex); /** @type {?} */ var currentDirectiveIndex = -1; /** @type {?} */ var currentElementIndex = -1; for (var i = 0; i < tView.expandoInstructions.length; i++) { /** @type {?} */ var instruction = tView.expandoInstructions[i]; if (typeof instruction === 'number') { if (instruction <= 0) { // Negative numbers mean that we are starting new EXPANDO block and need to update // the current element and directive index. currentElementIndex = -instruction; setActiveHostElement(currentElementIndex); // Injector block and providers are taken into account. /** @type {?} */ var providerCount = /** @type {?} */ tView.expandoInstructions[++i]; _bindingRootIndex += INJECTOR_BLOOM_PARENT_SIZE + providerCount; currentDirectiveIndex = _bindingRootIndex; } else { // This is either the injector size (so the binding root can skip over directives // and get to the first set of host bindings on this node) or the host var count // (to get to the next set of host bindings on this node). _bindingRootIndex += instruction; } setBindingRoot(_bindingRootIndex); } else { // If it's not a number, it's a host binding function that needs to be executed. if (instruction !== null) { viewData[BINDING_INDEX] = _bindingRootIndex; /** @type {?} */ var hostCtx = unwrapRNode(viewData[currentDirectiveIndex]); instruction(2 /* Update */ , hostCtx, currentElementIndex); // Each directive gets a uniqueId value that is the same for both // create and update calls when the hostBindings function is called. The // directive uniqueId is not set anywhere--it is just incremented between // each hostBindings call and is useful for helping instruction code // uniquely determine which directive is currently active when executed. incrementActiveDirectiveId(); } currentDirectiveIndex++; } } } } finally { setActiveHostElement(selectedIndex); } } /** * Refreshes all content queries declared by directives in a given view * @param {?} tView * @param {?} lView * @return {?} */ function refreshContentQueries(tView, lView) { /** @type {?} */ var contentQueries = tView.contentQueries; if (contentQueries !== null) { for (var i = 0; i < contentQueries.length; i += 2) { /** @type {?} */ var queryStartIdx = contentQueries[i]; /** @type {?} */ var directiveDefIdx = contentQueries[i + 1]; if (directiveDefIdx !== -1) { /** @type {?} */ var _directiveDef2 = /** @type {?} */ tView.data[directiveDefIdx]; ngDevMode && assertDefined(_directiveDef2.contentQueries, 'contentQueries function should be defined'); setCurrentQueryIndex(queryStartIdx); /** @type {?} */ _directiveDef2.contentQueries(2 /* Update */ , lView[directiveDefIdx], directiveDefIdx); } } } } /** * Refreshes child components in the current view. * @param {?} hostLView * @param {?} components * @return {?} */ function refreshChildComponents(hostLView, components) { if (components != null) { for (var i = 0; i < components.length; i++) { componentRefresh(hostLView, components[i]); } } } /** * Creates a native element from a tag name, using a renderer. * @param {?} name the tag name * @param {?=} overriddenRenderer Optional A renderer to override the default one * @return {?} the element created */ function elementCreate(name, overriddenRenderer) { /** @type {?} */ var _native9; /** @type {?} */ var rendererToUse = overriddenRenderer || getLView()[RENDERER]; /** @type {?} */ var namespace = getNamespace(); if (isProceduralRenderer(rendererToUse)) { _native9 = rendererToUse.createElement(name, namespace); } else { if (namespace === null) { _native9 = rendererToUse.createElement(name); } else { _native9 = rendererToUse.createElementNS(namespace, name); } } return _native9; } /** * @template T * @param {?} parentLView * @param {?} tView * @param {?} context * @param {?} flags * @param {?} host * @param {?} tHostNode * @param {?=} rendererFactory * @param {?=} renderer * @param {?=} sanitizer * @param {?=} injector * @return {?} */ function createLView(parentLView, tView, context, flags, host, tHostNode, rendererFactory, renderer, sanitizer, injector) { /** @type {?} */ var lView = ngDevMode ? cloneToLView(tView.blueprint) : /** @type {?} */ tView.blueprint.slice(); lView[HOST] = host; lView[FLAGS] = flags | 4 /* CreationMode */ | 128 /* Attached */ | 8 /* FirstLViewPass */ ; resetPreOrderHookFlags(lView); lView[PARENT] = lView[DECLARATION_VIEW] = parentLView; lView[CONTEXT] = context; lView[RENDERER_FACTORY] = /** @type {?} */ rendererFactory || parentLView && parentLView[RENDERER_FACTORY]; ngDevMode && assertDefined(lView[RENDERER_FACTORY], 'RendererFactory is required'); lView[RENDERER] = /** @type {?} */ renderer || parentLView && parentLView[RENDERER]; ngDevMode && assertDefined(lView[RENDERER], 'Renderer is required'); lView[SANITIZER] = sanitizer || parentLView && parentLView[SANITIZER] || /** @type {?} */ null; lView[ /** @type {?} */ INJECTOR$1] = injector || parentLView && parentLView[INJECTOR$1] || null; lView[T_HOST] = tHostNode; ngDevMode && attachLViewDebug(lView); return lView; } /** * @param {?} tView * @param {?} tHostNode * @param {?} index * @param {?} type * @param {?} name * @param {?} attrs * @return {?} */ function getOrCreateTNode(tView, tHostNode, index, type, name, attrs) { // Keep this function short, so that the VM will inline it. /** @type {?} */ var adjustedIndex = index + HEADER_OFFSET; /** @type {?} */ var tNode = /** @type {?} */ tView.data[adjustedIndex] || createTNodeAtIndex(tView, tHostNode, adjustedIndex, type, name, attrs, index); setPreviousOrParentTNode(tNode, true); return ( /** @type {?} */ tNode ); } /** * @param {?} tView * @param {?} tHostNode * @param {?} adjustedIndex * @param {?} type * @param {?} name * @param {?} attrs * @param {?} index * @return {?} */ function createTNodeAtIndex(tView, tHostNode, adjustedIndex, type, name, attrs, index) { /** @type {?} */ var previousOrParentTNode = getPreviousOrParentTNode(); /** @type {?} */ var isParent = getIsParent(); /** @type {?} */ var parent = isParent ? previousOrParentTNode : previousOrParentTNode && previousOrParentTNode.parent; // Parents cannot cross component boundaries because components will be used in multiple places, // so it's only set if the view is the same. /** @type {?} */ var parentInSameView = parent && parent !== tHostNode; /** @type {?} */ var tParentNode = parentInSameView ? /** @type {?} */ parent : null; /** @type {?} */ var tNode = tView.data[adjustedIndex] = createTNode(tView, tParentNode, type, adjustedIndex, name, attrs); // The first node is not always the one at index 0, in case of i18n, index 0 can be the // instruction `i18nStart` and the first node has the index 1 or more if (index === 0 || !tView.firstChild) { tView.firstChild = tNode; } // Now link ourselves into the tree. if (previousOrParentTNode) { if (isParent && previousOrParentTNode.child == null && (tNode.parent !== null || previousOrParentTNode.type === 2 /* View */ )) { // We are in the same view, which means we are adding content node to the parent view. previousOrParentTNode.child = tNode; } else if (!isParent) { previousOrParentTNode.next = tNode; } } return tNode; } /** * @param {?} tView * @param {?} tParentNode * @param {?} index * @param {?} lView * @return {?} */ function assignTViewNodeToLView(tView, tParentNode, index, lView) { // View nodes are not stored in data because they can be added / removed at runtime (which // would cause indices to change). Their TNodes are instead stored in tView.node. /** @type {?} */ var tNode = tView.node; if (tNode == null) { ngDevMode && tParentNode && assertNodeOfPossibleTypes(tParentNode, 3 /* Element */ , 0 /* Container */ ); tView.node = tNode = /** @type {?} */ createTNode(tView, /** @type {?} */ tParentNode, // 2 /* View */ , index, null, null); } return lView[T_HOST] = /** @type {?} */ tNode; } /** * When elements are created dynamically after a view blueprint is created (e.g. through * i18nApply() or ComponentFactory.create), we need to adjust the blueprint for future * template passes. * * @param {?} view The LView containing the blueprint to adjust * @param {?} numSlotsToAlloc The number of slots to alloc in the LView, should be >0 * @return {?} */ function allocExpando(view, numSlotsToAlloc) { ngDevMode && assertGreaterThan(numSlotsToAlloc, 0, 'The number of slots to alloc should be greater than 0'); if (numSlotsToAlloc > 0) { /** @type {?} */ var tView = view[TVIEW]; if (tView.firstTemplatePass) { for (var i = 0; i < numSlotsToAlloc; i++) { tView.blueprint.push(null); tView.data.push(null); view.push(null); } // We should only increment the expando start index if there aren't already directives // and injectors saved in the "expando" section if (!tView.expandoInstructions) { tView.expandoStartIndex += numSlotsToAlloc; } else { // Since we're adding the dynamic nodes into the expando section, we need to let the host // bindings know that they should skip x slots tView.expandoInstructions.push(numSlotsToAlloc); } } } } ////////////////////////// //// Render ////////////////////////// /** * Used for creating the LViewNode of a dynamic embedded view, * either through ViewContainerRef.createEmbeddedView() or TemplateRef.createEmbeddedView(). * Such lViewNode will then be renderer with renderEmbeddedTemplate() (see below). * @template T * @param {?} tView * @param {?} context * @param {?} declarationView * @param {?} injectorIndex * @return {?} */ function createEmbeddedViewAndNode(tView, context, declarationView, injectorIndex) { /** @type {?} */ var _isParent = getIsParent(); /** @type {?} */ var _previousOrParentTNode = getPreviousOrParentTNode(); setPreviousOrParentTNode( /** @type {?} */ null, true); /** @type {?} */ var lView = createLView(declarationView, tView, context, 16 /* CheckAlways */ , null, null); lView[DECLARATION_VIEW] = declarationView; assignTViewNodeToLView(tView, null, -1, lView); if (tView.firstTemplatePass) { /** @type {?} */ tView.node.injectorIndex = injectorIndex; } setPreviousOrParentTNode(_previousOrParentTNode, _isParent); return lView; } /** * Used for rendering embedded views (e.g. dynamically created views) * * Dynamically created views must store/retrieve their TViews differently from component views * because their template functions are nested in the template functions of their hosts, creating * closures. If their host template happens to be an embedded template in a loop (e.g. ngFor * inside * an ngFor), the nesting would mean we'd have multiple instances of the template function, so we * can't store TViews in the template function itself (as we do for comps). Instead, we store the * TView for dynamically created views on their host TNode, which only has one instance. * @template T * @param {?} viewToRender * @param {?} tView * @param {?} context * @return {?} */ function renderEmbeddedTemplate(viewToRender, tView, context) { /** @type {?} */ var _isParent = getIsParent(); /** @type {?} */ var _previousOrParentTNode = getPreviousOrParentTNode(); /** @type {?} */ var oldView; if (viewToRender[FLAGS] & 512 /* IsRoot */ ) { // This is a root view inside the view tree tickRootContext(getRootContext(viewToRender)); } else { // Will become true if the `try` block executes with no errors. /** @type {?} */ var safeToRunHooks = false; try { setPreviousOrParentTNode( /** @type {?} */ null, true); oldView = enterView(viewToRender, viewToRender[T_HOST]); resetPreOrderHookFlags(viewToRender); executeTemplate(viewToRender, /** @type {?} */ tView.template, getRenderFlags(viewToRender), context); // This must be set to false immediately after the first creation run because in an // ngFor loop, all the views will be created together before update mode runs and turns // off firstTemplatePass. If we don't set it here, instances will perform directive // matching, etc again and again. tView.firstTemplatePass = false; refreshDescendantViews(viewToRender); safeToRunHooks = true; } finally { leaveView( /** @type {?} */ oldView, safeToRunHooks); setPreviousOrParentTNode(_previousOrParentTNode, _isParent); } } } /** * @template T * @param {?} hostView * @param {?} context * @param {?=} templateFn * @return {?} */ function renderComponentOrTemplate(hostView, context, templateFn) { /** @type {?} */ var rendererFactory = hostView[RENDERER_FACTORY]; /** @type {?} */ var oldView = enterView(hostView, hostView[T_HOST]); /** @type {?} */ var normalExecutionPath = !getCheckNoChangesMode(); /** @type {?} */ var creationModeIsActive = isCreationMode(hostView); // Will become true if the `try` block executes with no errors. /** @type {?} */ var safeToRunHooks = false; try { if (normalExecutionPath && !creationModeIsActive && rendererFactory.begin) { rendererFactory.begin(); } if (creationModeIsActive) { // creation mode pass templateFn && executeTemplate(hostView, templateFn, 1 /* Create */ , context); refreshDescendantViews(hostView); hostView[FLAGS] &= ~4 /* CreationMode */ ; } // update mode pass resetPreOrderHookFlags(hostView); templateFn && executeTemplate(hostView, templateFn, 2 /* Update */ , context); refreshDescendantViews(hostView); safeToRunHooks = true; } finally { if (normalExecutionPath && !creationModeIsActive && rendererFactory.end) { rendererFactory.end(); } leaveView(oldView, safeToRunHooks); } } /** * @template T * @param {?} lView * @param {?} templateFn * @param {?} rf * @param {?} context * @return {?} */ function executeTemplate(lView, templateFn, rf, context) { namespaceHTMLInternal(); /** @type {?} */ var prevSelectedIndex = getSelectedIndex(); try { setActiveHostElement(null); if (rf & 2 /* Update */ ) { // When we're updating, have an inherent ɵɵselect(0) so we don't have to generate that // instruction for most update blocks selectInternal(lView, 0); } templateFn(rf, context); } finally { setSelectedIndex(prevSelectedIndex); } } /** * This function returns the default configuration of rendering flags depending on when the * template is in creation mode or update mode. Update block and create block are * always run separately. * @param {?} view * @return {?} */ function getRenderFlags(view) { return isCreationMode(view) ? 1 /* Create */ : 2 /* Update */ ; } ////////////////////////// //// Element ////////////////////////// /** * @param {?} tView * @param {?} tNode * @param {?} lView * @return {?} */ function executeContentQueries(tView, tNode, lView) { if (isContentQueryHost(tNode)) { /** @type {?} */ var start = tNode.directiveStart; /** @type {?} */ var end = tNode.directiveEnd; for (var directiveIndex = start; directiveIndex < end; directiveIndex++) { /** @type {?} */ var def = /** @type {?} */ tView.data[directiveIndex]; if (def.contentQueries) { def.contentQueries(1 /* Create */ , lView[directiveIndex], directiveIndex); } } } } /** * Creates directive instances and populates local refs. * * @param {?} tView * @param {?} lView * @param {?} tNode * @param {?=} localRefExtractor mapping function that extracts local ref value from TNode * @return {?} */ function createDirectivesAndLocals(tView, lView, tNode) { var localRefExtractor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : getNativeByTNode; if (!getBindingsEnabled()) return; instantiateAllDirectives(tView, lView, tNode); invokeDirectivesHostBindings(tView, lView, tNode); saveResolvedLocalsInData(lView, tNode, localRefExtractor); setActiveHostElement(null); } /** * Takes a list of local names and indices and pushes the resolved local variable values * to LView in the same order as they are loaded in the template with load(). * @param {?} viewData * @param {?} tNode * @param {?} localRefExtractor * @return {?} */ function saveResolvedLocalsInData(viewData, tNode, localRefExtractor) { /** @type {?} */ var localNames = tNode.localNames; if (localNames) { /** @type {?} */ var localIndex = tNode.index + 1; for (var i = 0; i < localNames.length; i += 2) { /** @type {?} */ var index = /** @type {?} */ localNames[i + 1]; /** @type {?} */ var value = index === -1 ? localRefExtractor( /** @type {?} */ tNode, viewData) : viewData[index]; viewData[localIndex++] = value; } } } /** * Gets TView from a template function or creates a new TView * if it doesn't already exist. * * @param {?} def ComponentDef * @return {?} TView */ function getOrCreateTView(def) { return def.tView || (def.tView = createTView(-1, def.template, def.consts, def.vars, def.directiveDefs, def.pipeDefs, def.viewQuery, def.schemas)); } /** * Creates a TView instance * * @param {?} viewIndex The viewBlockId for inline views, or -1 if it's a component/dynamic * @param {?} templateFn Template function * @param {?} consts The number of nodes, local refs, and pipes in this template * @param {?} vars * @param {?} directives Registry of directives for this view * @param {?} pipes Registry of pipes for this view * @param {?} viewQuery View queries for this view * @param {?} schemas Schemas for this view * @return {?} */ function createTView(viewIndex, templateFn, consts, vars, directives, pipes, viewQuery, schemas) { ngDevMode && ngDevMode.tView++; /** @type {?} */ var bindingStartIndex = HEADER_OFFSET + consts; // This length does not yet contain host bindings from child directives because at this point, // we don't know which directives are active on this template. As soon as a directive is matched // that has a host binding, we will update the blueprint with that def's hostVars count. /** @type {?} */ var initialViewLength = bindingStartIndex + vars; /** @type {?} */ var blueprint = createViewBlueprint(bindingStartIndex, initialViewLength); return blueprint[ /** @type {?} */ TVIEW] = ngDevMode ? new TViewConstructor(viewIndex, // id: number, blueprint, // blueprint: LView, templateFn, // template: ComponentTemplate<{}>|null, null, // queries: TQueries|null viewQuery, /** @type {?} */ null, // node: TViewNode|TElementNode|null, cloneToTViewData(blueprint).fill(null, bindingStartIndex), // data: TData, bindingStartIndex, // bindingStartIndex: number, initialViewLength, // expandoStartIndex: number, null, // expandoInstructions: ExpandoInstructions|null, true, // firstTemplatePass: boolean, false, // staticViewQueries: boolean, false, // staticContentQueries: boolean, null, // preOrderHooks: HookData|null, null, // preOrderCheckHooks: HookData|null, null, // contentHooks: HookData|null, null, // contentCheckHooks: HookData|null, null, // viewHooks: HookData|null, null, // viewCheckHooks: HookData|null, null, // destroyHooks: HookData|null, null, // cleanup: any[]|null, null, // contentQueries: number[]|null, null, // components: number[]|null, typeof directives === 'function' ? directives() : directives, // directiveRegistry: DirectiveDefList|null, typeof pipes === 'function' ? pipes() : pipes, // pipeRegistry: PipeDefList|null, null, // firstChild: TNode|null, schemas) : { id: viewIndex, blueprint: blueprint, template: templateFn, queries: null, viewQuery: viewQuery, node: /** @type {?} */ null, data: blueprint.slice().fill(null, bindingStartIndex), bindingStartIndex: bindingStartIndex, expandoStartIndex: initialViewLength, expandoInstructions: null, firstTemplatePass: true, staticViewQueries: false, staticContentQueries: false, preOrderHooks: null, preOrderCheckHooks: null, contentHooks: null, contentCheckHooks: null, viewHooks: null, viewCheckHooks: null, destroyHooks: null, cleanup: null, contentQueries: null, components: null, directiveRegistry: typeof directives === 'function' ? directives() : directives, pipeRegistry: typeof pipes === 'function' ? pipes() : pipes, firstChild: null, schemas: schemas }; } /** * @param {?} bindingStartIndex * @param {?} initialViewLength * @return {?} */ function createViewBlueprint(bindingStartIndex, initialViewLength) { /** @type {?} */ var blueprint = /** @type {?} */ new (ngDevMode ? /** @type {?} */ LViewBlueprint : Array)(initialViewLength).fill(null, 0, bindingStartIndex).fill(NO_CHANGE, bindingStartIndex); blueprint[BINDING_INDEX] = bindingStartIndex; return blueprint; } /** * @param {?} text * @param {?} token * @return {?} */ function createError(text, token) { return new Error("Renderer: ".concat(text, " [").concat(stringifyForError(token), "]")); } /** * Locates the host native element, used for bootstrapping existing nodes into rendering pipeline. * * @param {?} factory * @param {?} elementOrSelector Render element or CSS selector to locate the element. * @return {?} */ function locateHostElement(factory, elementOrSelector) { /** @type {?} */ var defaultRenderer = factory.createRenderer(null, null); /** @type {?} */ var rNode = typeof elementOrSelector === 'string' ? isProceduralRenderer(defaultRenderer) ? defaultRenderer.selectRootElement(elementOrSelector) : defaultRenderer.querySelector(elementOrSelector) : elementOrSelector; if (ngDevMode && !rNode) { if (typeof elementOrSelector === 'string') { throw createError('Host node with selector not found:', elementOrSelector); } else { throw createError('Host node is required:', elementOrSelector); } } return rNode; } /** * Saves context for this cleanup function in LView.cleanupInstances. * * On the first template pass, saves in TView: * - Cleanup function * - Index of context we just saved in LView.cleanupInstances * @param {?} lView * @param {?} context * @param {?} cleanupFn * @return {?} */ function storeCleanupWithContext(lView, context, cleanupFn) { /** @type {?} */ var lCleanup = getCleanup(lView); lCleanup.push(context); if (lView[TVIEW].firstTemplatePass) { getTViewCleanup(lView).push(cleanupFn, lCleanup.length - 1); } } /** * Saves the cleanup function itself in LView.cleanupInstances. * * This is necessary for functions that are wrapped with their contexts, like in renderer2 * listeners. * * On the first template pass, the index of the cleanup function is saved in TView. * @param {?} view * @param {?} cleanupFn * @return {?} */ function storeCleanupFn(view, cleanupFn) { getCleanup(view).push(cleanupFn); if (view[TVIEW].firstTemplatePass) { getTViewCleanup(view).push( /** @type {?} */ view[CLEANUP].length - 1, null); } } /** * Constructs a TNode object from the arguments. * * @param {?} tView `TView` to which this `TNode` belongs (used only in `ngDevMode`) * @param {?} tParent * @param {?} type The type of the node * @param {?} adjustedIndex The index of the TNode in TView.data, adjusted for HEADER_OFFSET * @param {?} tagName The tag name of the node * @param {?} attrs The attributes defined on this node * @return {?} the TNode object */ function createTNode(tView, tParent, type, adjustedIndex, tagName, attrs) { ngDevMode && ngDevMode.tNode++; /** @type {?} */ var injectorIndex = tParent ? tParent.injectorIndex : -1; return ngDevMode ? new TNodeConstructor(tView, // tView_: TView type, // type: TNodeType adjustedIndex, // index: number injectorIndex, // injectorIndex: number -1, // directiveStart: number -1, // directiveEnd: number -1, // propertyMetadataStartIndex: number -1, // propertyMetadataEndIndex: number 0, // flags: TNodeFlags 0, // providerIndexes: TNodeProviderIndexes tagName, // tagName: string|null attrs, // attrs: (string|AttributeMarker|(string|SelectorFlags)[])[]|null null, // localNames: (string|number)[]|null undefined, // initialInputs: (string[]|null)[]|null|undefined undefined, // inputs: PropertyAliases|null|undefined undefined, // outputs: PropertyAliases|null|undefined null, // tViews: ITView|ITView[]|null null, // next: ITNode|null null, // projectionNext: ITNode|null null, // child: ITNode|null tParent, // parent: TElementNode|TContainerNode|null null, // projection: number|(ITNode|RNode[])[]|null null, // styles: TStylingContext|null null) : { type: type, index: adjustedIndex, injectorIndex: injectorIndex, directiveStart: -1, directiveEnd: -1, propertyMetadataStartIndex: -1, propertyMetadataEndIndex: -1, flags: 0, providerIndexes: 0, tagName: tagName, attrs: attrs, localNames: null, initialInputs: undefined, inputs: undefined, outputs: undefined, tViews: null, next: null, projectionNext: null, child: null, parent: tParent, projection: null, styles: null, classes: null }; } /** * Consolidates all inputs or outputs of all directives on this logical node. * * @param {?} tNode * @param {?} direction whether to consider inputs or outputs * @return {?} PropertyAliases|null aggregate of all properties if any, `null` otherwise */ function generatePropertyAliases(tNode, direction) { /** @type {?} */ var tView = getLView()[TVIEW]; /** @type {?} */ var propStore = null; /** @type {?} */ var start = tNode.directiveStart; /** @type {?} */ var end = tNode.directiveEnd; if (end > start) { /** @type {?} */ var isInput = direction === 0 /* Input */ ; /** @type {?} */ var defs = tView.data; for (var i = start; i < end; i++) { /** @type {?} */ var _directiveDef3 = /** @type {?} */ defs[i]; /** @type {?} */ var propertyAliasMap = isInput ? _directiveDef3.inputs : _directiveDef3.outputs; for (var publicName in propertyAliasMap) { if (propertyAliasMap.hasOwnProperty(publicName)) { propStore = propStore || {}; /** @type {?} */ var internalName = propertyAliasMap[publicName]; /** @type {?} */ var hasProperty = propStore.hasOwnProperty(publicName); hasProperty ? propStore[publicName].push(i, publicName, internalName) : propStore[publicName] = [i, publicName, internalName]; } } } } return propStore; } /** * Mapping between attributes names that don't correspond to their element property names. * Note: this mapping has to be kept in sync with the equally named mapping in the template * type-checking machinery of ngtsc. * @type {?} */ var ATTR_TO_PROP = { 'class': 'className', 'for': 'htmlFor', 'formaction': 'formAction', 'innerHtml': 'innerHTML', 'readonly': 'readOnly', 'tabindex': 'tabIndex' }; /** * @template T * @param {?} index * @param {?} propName * @param {?} value * @param {?=} sanitizer * @param {?=} nativeOnly * @param {?=} loadRendererFn * @return {?} */ function elementPropertyInternal(index, propName, value, sanitizer, nativeOnly, loadRendererFn) { ngDevMode && assertNotSame(value, /** @type {?} */ NO_CHANGE, 'Incoming value should never be NO_CHANGE.'); /** @type {?} */ var lView = getLView(); /** @type {?} */ var element = /** @type {?} */ getNativeByIndex(index, lView); /** @type {?} */ var tNode = getTNode(index, lView); /** @type {?} */ var inputData; /** @type {?} */ var dataValue; if (!nativeOnly && (inputData = initializeTNodeInputs(tNode)) && (dataValue = inputData[propName])) { setInputsForProperty(lView, dataValue, value); if (isComponent(tNode)) markDirtyIfOnPush(lView, index + HEADER_OFFSET); if (ngDevMode) { if (tNode.type === 3 /* Element */ || tNode.type === 0 /* Container */ ) { /** * dataValue is an array containing runtime input or output names for the directives: * i+0: directive instance index * i+1: publicName * i+2: privateName * * e.g. [0, 'change', 'change-minified'] * we want to set the reflected property with the privateName: dataValue[i+2] */ for (var i = 0; i < dataValue.length; i += 3) { setNgReflectProperty(lView, element, tNode.type, /** @type {?} */ dataValue[i + 2], value); } } } } else if (tNode.type === 3 /* Element */ ) { propName = ATTR_TO_PROP[propName] || propName; if (ngDevMode) { validateAgainstEventProperties(propName); validateAgainstUnknownProperties(lView, element, propName, tNode); ngDevMode.rendererSetProperty++; } savePropertyDebugData(tNode, lView, propName, lView[TVIEW].data, nativeOnly); /** @type {?} */ var renderer = loadRendererFn ? loadRendererFn(tNode, lView) : lView[RENDERER]; // It is assumed that the sanitizer is only added when the compiler determines that the // property // is risky, so sanitization can be done without further checks. value = sanitizer != null ? /** @type {?} */ sanitizer(value, tNode.tagName || '', propName) : value; if (isProceduralRenderer(renderer)) { renderer.setProperty( /** @type {?} */ element, propName, value); } else if (!isAnimationProp(propName)) { /** @type {?} */ element.setProperty ? /** @type {?} */ element.setProperty(propName, value) : /** @type {?} */ element[propName] = value; } } else if (tNode.type === 0 /* Container */ ) { // If the node is a container and the property didn't // match any of the inputs or schemas we should throw. if (ngDevMode && !matchingSchemas(lView, tNode.tagName)) { throw createUnknownPropertyError(propName, tNode); } } } /** * If node is an OnPush component, marks its LView dirty. * @param {?} lView * @param {?} viewIndex * @return {?} */ function markDirtyIfOnPush(lView, viewIndex) { ngDevMode && assertLView(lView); /** @type {?} */ var childComponentLView = getComponentViewByIndex(viewIndex, lView); if (!(childComponentLView[FLAGS] & 16 /* CheckAlways */ )) { childComponentLView[FLAGS] |= 64 /* Dirty */ ; } } /** * @param {?} lView * @param {?} element * @param {?} type * @param {?} attrName * @param {?} value * @return {?} */ function setNgReflectProperty(lView, element, type, attrName, value) { /** @type {?} */ var renderer = lView[RENDERER]; attrName = normalizeDebugBindingName(attrName); /** @type {?} */ var debugValue = normalizeDebugBindingValue(value); if (type === 3 /* Element */ ) { if (value == null) { isProceduralRenderer(renderer) ? renderer.removeAttribute( /** @type {?} */ element, attrName) : /** @type {?} */ element.removeAttribute(attrName); } else { isProceduralRenderer(renderer) ? renderer.setAttribute( /** @type {?} */ element, attrName, debugValue) : /** @type {?} */ element.setAttribute(attrName, debugValue); } } else { /** @type {?} */ var textContent = "bindings=".concat(JSON.stringify(_defineProperty({}, attrName, debugValue), null, 2)); if (isProceduralRenderer(renderer)) { renderer.setValue( /** @type {?} */ element, textContent); } else { /** @type {?} */ element.textContent = textContent; } } } /** * @param {?} hostView * @param {?} element * @param {?} propName * @param {?} tNode * @return {?} */ function validateAgainstUnknownProperties(hostView, element, propName, tNode) { // If the tag matches any of the schemas we shouldn't throw. if (matchingSchemas(hostView, tNode.tagName)) { return; } // If prop is not a known property of the HTML element... if (!(propName in element) && // and we are in a browser context... (web worker nodes should be skipped) typeof Node === 'function' && element instanceof Node && // and isn't a synthetic animation property... propName[0] !== ANIMATION_PROP_PREFIX) { // ... it is probably a user error and we should throw. throw createUnknownPropertyError(propName, tNode); } } /** * @param {?} hostView * @param {?} tagName * @return {?} */ function matchingSchemas(hostView, tagName) { /** @type {?} */ var schemas = hostView[TVIEW].schemas; if (schemas !== null) { for (var i = 0; i < schemas.length; i++) { /** @type {?} */ var schema = schemas[i]; if (schema === NO_ERRORS_SCHEMA || schema === CUSTOM_ELEMENTS_SCHEMA && tagName && tagName.indexOf('-') > -1) { return true; } } } return false; } /** * Stores debugging data for this property binding on first template pass. * This enables features like DebugElement.properties. * @param {?} tNode * @param {?} lView * @param {?} propName * @param {?} tData * @param {?} nativeOnly * @return {?} */ function savePropertyDebugData(tNode, lView, propName, tData, nativeOnly) { /** @type {?} */ var lastBindingIndex = lView[BINDING_INDEX] - 1; // Bind/interpolation functions save binding metadata in the last binding index, // but leave the property name blank. If the interpolation delimiter is at the 0 // index, we know that this is our first pass and the property name still needs to // be set. /** @type {?} */ var bindingMetadata = /** @type {?} */ tData[lastBindingIndex]; if (bindingMetadata[0] == INTERPOLATION_DELIMITER) { tData[lastBindingIndex] = propName + bindingMetadata; // We don't want to store indices for host bindings because they are stored in a // different part of LView (the expando section). if (!nativeOnly) { if (tNode.propertyMetadataStartIndex == -1) { tNode.propertyMetadataStartIndex = lastBindingIndex; } tNode.propertyMetadataEndIndex = lastBindingIndex + 1; } } } /** * Creates an error that should be thrown when encountering an unknown property on an element. * @param {?} propName Name of the invalid property. * @param {?} tNode Node on which we encountered the error. * @return {?} */ function createUnknownPropertyError(propName, tNode) { return new Error("Template error: Can't bind to '".concat(propName, "' since it isn't a known property of '").concat(tNode.tagName, "'.")); } /** * Instantiate a root component. * @template T * @param {?} tView * @param {?} viewData * @param {?} def * @return {?} */ function instantiateRootComponent(tView, viewData, def) { /** @type {?} */ var rootTNode = getPreviousOrParentTNode(); if (tView.firstTemplatePass) { if (def.providersResolver) def.providersResolver(def); generateExpandoInstructionBlock(tView, rootTNode, 1); baseResolveDirective(tView, viewData, def, def.factory); } /** @type {?} */ var directive = getNodeInjectable(tView.data, viewData, viewData.length - 1, /** @type {?} */ rootTNode); postProcessBaseDirective(viewData, rootTNode, directive); return directive; } /** * Resolve the matched directives on a node. * @param {?} tView * @param {?} lView * @param {?} tNode * @param {?} localRefs * @return {?} */ function resolveDirectives(tView, lView, tNode, localRefs) { // Please make sure to have explicit type for `exportsMap`. Inferred type triggers bug in // tsickle. ngDevMode && assertEqual(tView.firstTemplatePass, true, 'should run on first template pass only'); if (!getBindingsEnabled()) return; /** @type {?} */ var directives = findDirectiveMatches(tView, lView, tNode); /** @type {?} */ var exportsMap = localRefs ? { '': -1 } : null; if (directives) { initNodeFlags(tNode, tView.data.length, directives.length); // When the same token is provided by several directives on the same node, some rules apply in // the viewEngine: // - viewProviders have priority over providers // - the last directive in NgModule.declarations has priority over the previous one // So to match these rules, the order in which providers are added in the arrays is very // important. for (var i = 0; i < directives.length; i++) { /** @type {?} */ var def = /** @type {?} */ directives[i]; if (def.providersResolver) def.providersResolver(def); } generateExpandoInstructionBlock(tView, tNode, directives.length); /** @type {?} */ var initialPreOrderHooksLength = tView.preOrderHooks && tView.preOrderHooks.length || 0; /** @type {?} */ var initialPreOrderCheckHooksLength = tView.preOrderCheckHooks && tView.preOrderCheckHooks.length || 0; /** @type {?} */ var nodeIndex = tNode.index - HEADER_OFFSET; for (var _i14 = 0; _i14 < directives.length; _i14++) { /** @type {?} */ var _def2 = /** @type {?} */ directives[_i14]; /** @type {?} */ var directiveDefIdx = tView.data.length; baseResolveDirective(tView, lView, _def2, _def2.factory); saveNameToExportMap( /** @type {?} */ tView.data.length - 1, _def2, exportsMap); // Init hooks are queued now so ngOnInit is called in host components before // any projected components. registerPreOrderHooks(directiveDefIdx, _def2, tView, nodeIndex, initialPreOrderHooksLength, initialPreOrderCheckHooksLength); } } if (exportsMap) cacheMatchingLocalNames(tNode, localRefs, exportsMap); } /** * Instantiate all the directives that were previously resolved on the current node. * @param {?} tView * @param {?} lView * @param {?} tNode * @return {?} */ function instantiateAllDirectives(tView, lView, tNode) { /** @type {?} */ var start = tNode.directiveStart; /** @type {?} */ var end = tNode.directiveEnd; if (!tView.firstTemplatePass && start < end) { getOrCreateNodeInjectorForNode( /** @type {?} */ tNode, lView); } for (var i = start; i < end; i++) { /** @type {?} */ var def = /** @type {?} */ tView.data[i]; if (isComponentDef(def)) { addComponentLogic(lView, tNode, /** @type {?} */ def); } /** @type {?} */ var directive = getNodeInjectable(tView.data, /** @type {?} */ lView, i, /** @type {?} */ tNode); postProcessDirective(lView, directive, def, i); } } /** * @param {?} tView * @param {?} viewData * @param {?} tNode * @return {?} */ function invokeDirectivesHostBindings(tView, viewData, tNode) { /** @type {?} */ var start = tNode.directiveStart; /** @type {?} */ var end = tNode.directiveEnd; /** @type {?} */ var expando = /** @type {?} */ tView.expandoInstructions; /** @type {?} */ var firstTemplatePass = tView.firstTemplatePass; /** @type {?} */ var elementIndex = tNode.index - HEADER_OFFSET; /** @type {?} */ var selectedIndex = getSelectedIndex(); try { setActiveHostElement(elementIndex); for (var i = start; i < end; i++) { /** @type {?} */ var def = /** @type {?} */ tView.data[i]; /** @type {?} */ var directive = viewData[i]; if (def.hostBindings) { invokeHostBindingsInCreationMode(def, expando, directive, tNode, firstTemplatePass); // Each directive gets a uniqueId value that is the same for both // create and update calls when the hostBindings function is called. The // directive uniqueId is not set anywhere--it is just incremented between // each hostBindings call and is useful for helping instruction code // uniquely determine which directive is currently active when executed. incrementActiveDirectiveId(); } else if (firstTemplatePass) { expando.push(null); } } } finally { setActiveHostElement(selectedIndex); } } /** * @param {?} def * @param {?} expando * @param {?} directive * @param {?} tNode * @param {?} firstTemplatePass * @return {?} */ function invokeHostBindingsInCreationMode(def, expando, directive, tNode, firstTemplatePass) { /** @type {?} */ var previousExpandoLength = expando.length; setCurrentDirectiveDef(def); /** @type {?} */ var elementIndex = tNode.index - HEADER_OFFSET; /** @type {?} */ def.hostBindings(1 /* Create */ , directive, elementIndex); setCurrentDirectiveDef(null); // `hostBindings` function may or may not contain `allocHostVars` call // (e.g. it may not if it only contains host listeners), so we need to check whether // `expandoInstructions` has changed and if not - we still push `hostBindings` to // expando block, to make sure we execute it for DI cycle if (previousExpandoLength === expando.length && firstTemplatePass) { expando.push(def.hostBindings); } } /** * Generates a new block in TView.expandoInstructions for this node. * * Each expando block starts with the element index (turned negative so we can distinguish * it from the hostVar count) and the directive count. See more in VIEW_DATA.md. * @param {?} tView * @param {?} tNode * @param {?} directiveCount * @return {?} */ function generateExpandoInstructionBlock(tView, tNode, directiveCount) { ngDevMode && assertEqual(tView.firstTemplatePass, true, 'Expando block should only be generated on first template pass.'); /** @type {?} */ var elementIndex = -(tNode.index - HEADER_OFFSET); /** @type {?} */ var providerStartIndex = tNode.providerIndexes & 65535 /* ProvidersStartIndexMask */ ; /** @type {?} */ var providerCount = tView.data.length - providerStartIndex; (tView.expandoInstructions || (tView.expandoInstructions = [])).push(elementIndex, providerCount, directiveCount); } /** * Process a directive on the current node after its creation. * @template T * @param {?} viewData * @param {?} directive * @param {?} def * @param {?} directiveDefIdx * @return {?} */ function postProcessDirective(viewData, directive, def, directiveDefIdx) { /** @type {?} */ var previousOrParentTNode = getPreviousOrParentTNode(); postProcessBaseDirective(viewData, previousOrParentTNode, directive); ngDevMode && assertDefined(previousOrParentTNode, 'previousOrParentTNode'); if (previousOrParentTNode && previousOrParentTNode.attrs) { setInputsFromAttrs(directiveDefIdx, directive, def, previousOrParentTNode); } if (viewData[TVIEW].firstTemplatePass && def.contentQueries) { previousOrParentTNode.flags |= 4 /* hasContentQuery */ ; } if (isComponentDef(def)) { /** @type {?} */ var componentView = getComponentViewByIndex(previousOrParentTNode.index, viewData); componentView[CONTEXT] = directive; } } /** * A lighter version of postProcessDirective() that is used for the root component. * @template T * @param {?} lView * @param {?} previousOrParentTNode * @param {?} directive * @return {?} */ function postProcessBaseDirective(lView, previousOrParentTNode, directive) { /** @type {?} */ var _native10 = getNativeByTNode(previousOrParentTNode, lView); ngDevMode && assertEqual(lView[BINDING_INDEX], lView[TVIEW].bindingStartIndex, 'directives should be created before any bindings'); ngDevMode && assertPreviousIsParent(getIsParent()); attachPatchData(directive, lView); if (_native10) { attachPatchData(_native10, lView); } } /** * Matches the current node against all available selectors. * If a component is matched (at most one), it is returned in first position in the array. * @param {?} tView * @param {?} viewData * @param {?} tNode * @return {?} */ function findDirectiveMatches(tView, viewData, tNode) { ngDevMode && assertEqual(tView.firstTemplatePass, true, 'should run on first template pass only'); /** @type {?} */ var registry = tView.directiveRegistry; /** @type {?} */ var matches = null; if (registry) { for (var i = 0; i < registry.length; i++) { /** @type {?} */ var def = /** @type {?} */ registry[i]; if (isNodeMatchingSelectorList(tNode, /** @type {?} */ def.selectors, /* isProjectionMode */ false)) { matches || (matches = ngDevMode ? new /** @type {?} */ MatchesArray() : []); diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, viewData), tView, def.type); if (isComponentDef(def)) { if (tNode.flags & 1 /* isComponent */ ) throwMultipleComponentError(tNode); tNode.flags = 1 /* isComponent */ ; // The component is always stored first with directives after. matches.unshift(def); } else { matches.push(def); } } } } return matches; } /** * Stores index of component's host element so it will be queued for view refresh during CD. * @param {?} previousOrParentTNode * @return {?} */ function queueComponentIndexForCheck(previousOrParentTNode) { /** @type {?} */ var tView = getLView()[TVIEW]; ngDevMode && assertEqual(tView.firstTemplatePass, true, 'Should only be called in first template pass.'); (tView.components || (tView.components = ngDevMode ? new /** @type {?} */ TViewComponents() : [])).push(previousOrParentTNode.index); } /** * Caches local names and their matching directive indices for query and template lookups. * @param {?} tNode * @param {?} localRefs * @param {?} exportsMap * @return {?} */ function cacheMatchingLocalNames(tNode, localRefs, exportsMap) { if (localRefs) { /** @type {?} */ var localNames = tNode.localNames = ngDevMode ? new /** @type {?} */ TNodeLocalNames() : []; // Local names must be stored in tNode in the same order that localRefs are defined // in the template to ensure the data is loaded in the same slots as their refs // in the template (for template queries). for (var i = 0; i < localRefs.length; i += 2) { /** @type {?} */ var index = exportsMap[localRefs[i + 1]]; if (index == null) throw new Error("Export of name '".concat(localRefs[i + 1], "' not found!")); localNames.push(localRefs[i], index); } } } /** * Builds up an export map as directives are created, so local refs can be quickly mapped * to their directive instances. * @param {?} index * @param {?} def * @param {?} exportsMap * @return {?} */ function saveNameToExportMap(index, def, exportsMap) { if (exportsMap) { if (def.exportAs) { for (var i = 0; i < def.exportAs.length; i++) { exportsMap[def.exportAs[i]] = index; } } if ( /** @type {?} */ def.template) exportsMap[''] = index; } } /** * Initializes the flags on the current node, setting all indices to the initial index, * the directive count to 0, and adding the isComponent flag. * @param {?} tNode * @param {?} index the initial index * @param {?} numberOfDirectives * @return {?} */ function initNodeFlags(tNode, index, numberOfDirectives) { /** @type {?} */ var flags = tNode.flags; ngDevMode && assertEqual(flags === 0 || flags === 1 /* isComponent */ , true, 'expected node flags to not be initialized'); ngDevMode && assertNotEqual(numberOfDirectives, tNode.directiveEnd - tNode.directiveStart, 'Reached the max number of directives'); // When the first directive is created on a node, save the index tNode.flags = flags & 1 /* isComponent */ ; tNode.directiveStart = index; tNode.directiveEnd = index + numberOfDirectives; tNode.providerIndexes = index; } /** * @template T * @param {?} tView * @param {?} viewData * @param {?} def * @param {?} directiveFactory * @return {?} */ function baseResolveDirective(tView, viewData, def, directiveFactory) { tView.data.push(def); /** @type {?} */ var nodeInjectorFactory = new NodeInjectorFactory(directiveFactory, isComponentDef(def), null); tView.blueprint.push(nodeInjectorFactory); viewData.push(nodeInjectorFactory); } /** * @template T * @param {?} lView * @param {?} previousOrParentTNode * @param {?} def * @return {?} */ function addComponentLogic(lView, previousOrParentTNode, def) { /** @type {?} */ var _native11 = getNativeByTNode(previousOrParentTNode, lView); /** @type {?} */ var tView = getOrCreateTView(def); // Only component views should be added to the view tree directly. Embedded views are // accessed through their containers because they may be removed / re-added later. /** @type {?} */ var rendererFactory = lView[RENDERER_FACTORY]; /** @type {?} */ var componentView = addToViewTree(lView, createLView(lView, tView, null, def.onPush ? 64 /* Dirty */ : 16 /* CheckAlways */ , lView[previousOrParentTNode.index], /** @type {?} */ previousOrParentTNode, rendererFactory, rendererFactory.createRenderer( /** @type {?} */ _native11, def))); componentView[T_HOST] = /** @type {?} */ previousOrParentTNode; // Component view will always be created before any injected LContainers, // so this is a regular element, wrap it with the component view lView[previousOrParentTNode.index] = componentView; if (lView[TVIEW].firstTemplatePass) { queueComponentIndexForCheck(previousOrParentTNode); } } /** * @param {?} index * @param {?} name * @param {?} value * @param {?} lView * @param {?=} sanitizer * @param {?=} namespace * @return {?} */ function elementAttributeInternal(index, name, value, lView, sanitizer, namespace) { ngDevMode && assertNotSame(value, /** @type {?} */ NO_CHANGE, 'Incoming value should never be NO_CHANGE.'); ngDevMode && validateAgainstEventAttributes(name); /** @type {?} */ var element = /** @type {?} */ getNativeByIndex(index, lView); /** @type {?} */ var renderer = lView[RENDERER]; if (value == null) { ngDevMode && ngDevMode.rendererRemoveAttribute++; isProceduralRenderer(renderer) ? renderer.removeAttribute(element, name, namespace) : element.removeAttribute(name); } else { ngDevMode && ngDevMode.rendererSetAttribute++; /** @type {?} */ var tNode = getTNode(index, lView); /** @type {?} */ var strValue = sanitizer == null ? renderStringify(value) : sanitizer(value, tNode.tagName || '', name); if (isProceduralRenderer(renderer)) { renderer.setAttribute(element, name, strValue, namespace); } else { namespace ? element.setAttributeNS(namespace, name, strValue) : element.setAttribute(name, strValue); } } } /** * Sets initial input properties on directive instances from attribute data * * @template T * @param {?} directiveIndex Index of the directive in directives array * @param {?} instance Instance of the directive on which to set the initial inputs * @param {?} def The directive def that contains the list of inputs * @param {?} tNode The static data for this node * @return {?} */ function setInputsFromAttrs(directiveIndex, instance, def, tNode) { /** @type {?} */ var initialInputData = /** @type {?} */ tNode.initialInputs; if (initialInputData === undefined || directiveIndex >= initialInputData.length) { initialInputData = generateInitialInputs(directiveIndex, def.inputs, tNode); } /** @type {?} */ var initialInputs = initialInputData[directiveIndex]; if (initialInputs) { /** @type {?} */ var setInput = def.setInput; for (var i = 0; i < initialInputs.length;) { /** @type {?} */ var publicName = initialInputs[i++]; /** @type {?} */ var privateName = initialInputs[i++]; /** @type {?} */ var value = initialInputs[i++]; if (setInput) { /** @type {?} */ def.setInput(instance, value, publicName, privateName); } else { /** @type {?} */ instance[privateName] = value; } if (ngDevMode) { /** @type {?} */ var _lView4 = getLView(); /** @type {?} */ var nativeElement = /** @type {?} */ getNativeByTNode(tNode, _lView4); setNgReflectProperty(_lView4, nativeElement, tNode.type, privateName, value); } } } } /** * Generates initialInputData for a node and stores it in the template's static storage * so subsequent template invocations don't have to recalculate it. * * initialInputData is an array containing values that need to be set as input properties * for directives on this node, but only once on creation. We need this array to support * the case where you set an \@Input property of a directive using attribute-like syntax. * e.g. if you have a `name` \@Input, you can set it once like this: * * <my-component name="Bess"></my-component> * * @param {?} directiveIndex Index to store the initial input data * @param {?} inputs The list of inputs from the directive def * @param {?} tNode The static data on this node * @return {?} */ function generateInitialInputs(directiveIndex, inputs, tNode) { /** @type {?} */ var initialInputData = tNode.initialInputs || (tNode.initialInputs = ngDevMode ? new /** @type {?} */ TNodeInitialInputs() : []); // Ensure that we don't create sparse arrays for (var _i15 = initialInputData.length; _i15 <= directiveIndex; _i15++) { initialInputData.push(null); } /** @type {?} */ var attrs = /** @type {?} */ tNode.attrs; /** @type {?} */ var i = 0; while (i < attrs.length) { /** @type {?} */ var attrName = attrs[i]; if (attrName === 0 /* NamespaceURI */ ) { // We do not allow inputs on namespaced attributes. i += 4; continue; } else if (attrName === 5 /* ProjectAs */ ) { // Skip over the `ngProjectAs` value. i += 2; continue; } // If we hit any other attribute markers, we're done anyway. None of those are valid inputs. if (typeof attrName === 'number') break; /** @type {?} */ var minifiedInputName = inputs[ /** @type {?} */ attrName]; /** @type {?} */ var attrValue = attrs[i + 1]; if (minifiedInputName !== undefined) { /** @type {?} */ var inputsToStore = initialInputData[directiveIndex] || (initialInputData[directiveIndex] = ngDevMode ? new /** @type {?} */ TNodeInitialData() : []); inputsToStore.push( /** @type {?} */ attrName, minifiedInputName, /** @type {?} */ attrValue); } i += 2; } return initialInputData; } ////////////////////////// //// ViewContainer & View ////////////////////////// // Not sure why I need to do `any` here but TS complains later. /** @type {?} */ var LContainerArray = ngDevMode && createNamedArrayType('LContainer'); /** * Creates a LContainer, either from a container instruction, or for a ViewContainerRef. * * @param {?} hostNative The host element for the LContainer * @param {?} currentView The parent view of the LContainer * @param {?} native The native comment element * @param {?} tNode * @param {?=} isForViewContainerRef Optional a flag indicating the ViewContainerRef case * @return {?} LContainer */ function createLContainer(hostNative, currentView, _native12, tNode, isForViewContainerRef) { ngDevMode && assertDomNode(_native12); ngDevMode && assertLView(currentView); // https://jsperf.com/array-literal-vs-new-array-really /** @type {?} */ var lContainer = new (ngDevMode ? LContainerArray : Array)(hostNative, // host native true, // Boolean `true` in this position signifies that this is an `LContainer` isForViewContainerRef ? -1 : 0, // active index currentView, // parent null, // next null, // queries tNode, // t_host _native12, // native, null); ngDevMode && attachLContainerDebug(lContainer); return lContainer; } /** * Goes over dynamic embedded views (ones created through ViewContainerRef APIs) and refreshes * them * by executing an associated template function. * @param {?} lView * @return {?} */ function refreshDynamicEmbeddedViews(lView) { for (var current = lView[CHILD_HEAD]; current !== null; current = current[NEXT]) { // Note: current can be an LView or an LContainer instance, but here we are only interested // in LContainer. We can tell it's an LContainer because its length is less than the LView // header. if (current[ACTIVE_INDEX] === -1 && isLContainer(current)) { for (var i = CONTAINER_HEADER_OFFSET; i < current.length; i++) { /** @type {?} */ var dynamicViewData = current[i]; // The directives and pipes are not needed here as an existing view is only being // refreshed. ngDevMode && assertDefined(dynamicViewData[TVIEW], 'TView must be allocated'); renderEmbeddedTemplate(dynamicViewData, dynamicViewData[TVIEW], /** @type {?} */ dynamicViewData[CONTEXT]); } } } } ///////////// /** * Refreshes components by entering the component view and processing its bindings, queries, etc. * * @param {?} hostLView * @param {?} adjustedElementIndex Element index in LView[] (adjusted for HEADER_OFFSET) * @return {?} */ function componentRefresh(hostLView, adjustedElementIndex) { ngDevMode && assertDataInRange(hostLView, adjustedElementIndex); /** @type {?} */ var componentView = getComponentViewByIndex(adjustedElementIndex, hostLView); ngDevMode && assertNodeType( /** @type {?} */ hostLView[TVIEW].data[adjustedElementIndex], 3 /* Element */ ); // Only components in creation mode, attached CheckAlways // components or attached, dirty OnPush components should be checked if ((viewAttachedToChangeDetector(componentView) || isCreationMode(hostLView)) && componentView[FLAGS] & (16 /* CheckAlways */ | 64 /* Dirty */ )) { syncViewWithBlueprint(componentView); checkView(componentView, componentView[CONTEXT]); } } /** * Syncs an LView instance with its blueprint if they have gotten out of sync. * * Typically, blueprints and their view instances should always be in sync, so the loop here * will be skipped. However, consider this case of two components side-by-side: * * App template: * ``` * <comp></comp> * <comp></comp> * ``` * * The following will happen: * 1. App template begins processing. * 2. First <comp> is matched as a component and its LView is created. * 3. Second <comp> is matched as a component and its LView is created. * 4. App template completes processing, so it's time to check child templates. * 5. First <comp> template is checked. It has a directive, so its def is pushed to blueprint. * 6. Second <comp> template is checked. Its blueprint has been updated by the first * <comp> template, but its LView was created before this update, so it is out of sync. * * Note that embedded views inside ngFor loops will never be out of sync because these views * are processed as soon as they are created. * * @param {?} componentView The view to sync * @return {?} */ function syncViewWithBlueprint(componentView) { /** @type {?} */ var componentTView = componentView[TVIEW]; for (var i = componentView.length; i < componentTView.blueprint.length; i++) { componentView[i] = componentTView.blueprint[i]; } } /** * Adds LView or LContainer to the end of the current view tree. * * This structure will be used to traverse through nested views to remove listeners * and call onDestroy callbacks. * * @template T * @param {?} lView The view where LView or LContainer should be added * @param {?} lViewOrLContainer The LView or LContainer to add to the view tree * @return {?} The state passed in */ function addToViewTree(lView, lViewOrLContainer) { // TODO(benlesh/misko): This implementation is incorrect, because it always adds the LContainer // to // the end of the queue, which means if the developer retrieves the LContainers from RNodes out // of // order, the change detection will run out of order, as the act of retrieving the the // LContainer // from the RNode is what adds it to the queue. if (lView[CHILD_HEAD]) { /** @type {?} */ lView[CHILD_TAIL][NEXT] = lViewOrLContainer; } else { lView[CHILD_HEAD] = lViewOrLContainer; } lView[CHILD_TAIL] = lViewOrLContainer; return lViewOrLContainer; } /////////////////////////////// //// Change detection /////////////////////////////// /** * Marks current view and all ancestors dirty. * * Returns the root view because it is found as a byproduct of marking the view tree * dirty, and can be used by methods that consume markViewDirty() to easily schedule * change detection. Otherwise, such methods would need to traverse up the view tree * an additional time to get the root view and schedule a tick on it. * * @param {?} lView The starting LView to mark dirty * @return {?} the root LView */ function markViewDirty(lView) { while (lView) { lView[FLAGS] |= 64 /* Dirty */ ; /** @type {?} */ var parent = getLViewParent(lView); // Stop traversing up as soon as you find a root view that wasn't attached to any container if (isRootView(lView) && !parent) { return lView; } // continue otherwise lView = /** @type {?} */ parent; } return null; } /** * Used to schedule change detection on the whole application. * * Unlike `tick`, `scheduleTick` coalesces multiple calls into one change detection run. * It is usually called indirectly by calling `markDirty` when the view needs to be * re-rendered. * * Typically `scheduleTick` uses `requestAnimationFrame` to coalesce multiple * `scheduleTick` requests. The scheduling function can be overridden in * `renderComponent`'s `scheduler` option. * @param {?} rootContext * @param {?} flags * @return {?} */ function scheduleTick(rootContext, flags) { /** @type {?} */ var nothingScheduled = rootContext.flags === 0 /* Empty */ ; rootContext.flags |= flags; if (nothingScheduled && rootContext.clean == _CLEAN_PROMISE) { /** @type {?} */ var res; rootContext.clean = new Promise( /** * @param {?} r * @return {?} */ function (r) { return res = r; }); rootContext.scheduler( /** * @return {?} */ function () { if (rootContext.flags & 1 /* DetectChanges */ ) { rootContext.flags &= ~1 /* DetectChanges */ ; tickRootContext(rootContext); } if (rootContext.flags & 2 /* FlushPlayers */ ) { rootContext.flags &= ~2 /* FlushPlayers */ ; /** @type {?} */ var playerHandler = rootContext.playerHandler; if (playerHandler) { playerHandler.flushPlayers(); } } rootContext.clean = _CLEAN_PROMISE; /** @type {?} */ res(null); }); } } /** * @param {?} rootContext * @return {?} */ function tickRootContext(rootContext) { for (var i = 0; i < rootContext.components.length; i++) { /** @type {?} */ var rootComponent = rootContext.components[i]; renderComponentOrTemplate( /** @type {?} */ readPatchedLView(rootComponent), rootComponent); } } /** * @template T * @param {?} view * @param {?} context * @return {?} */ function detectChangesInternal(view, context) { /** @type {?} */ var rendererFactory = view[RENDERER_FACTORY]; if (rendererFactory.begin) rendererFactory.begin(); try { if (isCreationMode(view)) { checkView(view, context); // creation mode pass } checkView(view, context); // update mode pass } catch (error) { handleError(view, error); throw error; } finally { if (rendererFactory.end) rendererFactory.end(); } } /** * Synchronously perform change detection on a root view and its components. * * @param {?} lView The view which the change detection should be performed on. * @return {?} */ function detectChangesInRootView(lView) { tickRootContext( /** @type {?} */ lView[CONTEXT]); } /** * Checks the change detector and its children, and throws if any changes are detected. * * This is used in development mode to verify that running change detection doesn't * introduce other changes. * @template T * @param {?} component * @return {?} */ function checkNoChanges(component) { /** @type {?} */ var view = getComponentViewByInstance(component); checkNoChangesInternal(view, component); } /** * @template T * @param {?} view * @param {?} context * @return {?} */ function checkNoChangesInternal(view, context) { setCheckNoChangesMode(true); try { detectChangesInternal(view, context); } finally { setCheckNoChangesMode(false); } } /** * Checks the change detector on a root view and its components, and throws if any changes are * detected. * * This is used in development mode to verify that running change detection doesn't * introduce other changes. * * @param {?} lView The view which the change detection should be checked on. * @return {?} */ function checkNoChangesInRootView(lView) { setCheckNoChangesMode(true); try { detectChangesInRootView(lView); } finally { setCheckNoChangesMode(false); } } /** * Checks the view of the component provided. Does not gate on dirty checks or execute doCheck. * @template T * @param {?} hostView * @param {?} component * @return {?} */ function checkView(hostView, component) { /** @type {?} */ var hostTView = hostView[TVIEW]; /** @type {?} */ var oldView = enterView(hostView, hostView[T_HOST]); /** @type {?} */ var templateFn = /** @type {?} */ hostTView.template; /** @type {?} */ var creationMode = isCreationMode(hostView); // Will become true if the `try` block executes with no errors. /** @type {?} */ var safeToRunHooks = false; try { resetPreOrderHookFlags(hostView); creationMode && executeViewQueryFn(1 /* Create */ , hostTView, component); executeTemplate(hostView, templateFn, getRenderFlags(hostView), component); refreshDescendantViews(hostView); safeToRunHooks = true; } finally { leaveView(oldView, safeToRunHooks); } } /** * @template T * @param {?} flags * @param {?} tView * @param {?} component * @return {?} */ function executeViewQueryFn(flags, tView, component) { /** @type {?} */ var viewQuery = tView.viewQuery; if (viewQuery !== null) { setCurrentQueryIndex(0); viewQuery(flags, component); } } /////////////////////////////// //// Bindings & interpolations /////////////////////////////// /** * Creates binding metadata for a particular binding and stores it in * TView.data. These are generated in order to support DebugElement.properties. * * Each binding / interpolation will have one (including attribute bindings) * because at the time of binding, we don't know to which instruction the binding * belongs. It is always stored in TView.data at the index of the last binding * value in LView (e.g. for interpolation8, it would be stored at the index of * the 8th value). * * @param {?} lView The LView that contains the current binding index. * @param {?=} prefix The static prefix string * @param {?=} suffix The static suffix string * * @return {?} Newly created binding metadata string for this binding or null */ function storeBindingMetadata(lView) { var prefix = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; var suffix = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ''; /** @type {?} */ var tData = lView[TVIEW].data; /** @type {?} */ var lastBindingIndex = lView[BINDING_INDEX] - 1; /** @type {?} */ var value = INTERPOLATION_DELIMITER + prefix + INTERPOLATION_DELIMITER + suffix; return tData[lastBindingIndex] == null ? tData[lastBindingIndex] = value : null; } /** @type {?} */ var CLEAN_PROMISE = _CLEAN_PROMISE; /** * @param {?} tNode * @return {?} */ function initializeTNodeInputs(tNode) { // If tNode.inputs is undefined, a listener has created outputs, but inputs haven't // yet been checked. if (tNode.inputs === undefined) { // mark inputs as checked tNode.inputs = generatePropertyAliases(tNode, 0 /* Input */ ); } return tNode.inputs; } /** * @param {?} view * @return {?} */ function getCleanup(view) { // top level variables should not be exported for performance reasons (PERF_NOTES.md) return view[CLEANUP] || (view[CLEANUP] = ngDevMode ? new /** @type {?} */ LCleanup() : []); } /** * @param {?} view * @return {?} */ function getTViewCleanup(view) { return view[TVIEW].cleanup || (view[TVIEW].cleanup = ngDevMode ? new /** @type {?} */ TCleanup() : []); } /** * There are cases where the sub component's renderer needs to be included * instead of the current renderer (see the componentSyntheticHost* instructions). * @param {?} tNode * @param {?} lView * @return {?} */ function loadComponentRenderer(tNode, lView) { /** @type {?} */ var componentLView = /** @type {?} */ lView[tNode.index]; return componentLView[RENDERER]; } /** * Handles an error thrown in an LView. * @param {?} lView * @param {?} error * @return {?} */ function handleError(lView, error) { /** @type {?} */ var injector = lView[INJECTOR$1]; /** @type {?} */ var errorHandler = injector ? injector.get(ErrorHandler, null) : null; errorHandler && errorHandler.handleError(error); } /** * Set the inputs of directives at the current node to corresponding value. * * @param {?} lView the `LView` which contains the directives. * @param {?} inputs mapping between the public "input" name and privately-known, * possibly minified, property names to write to. * @param {?} value Value to set. * @return {?} */ function setInputsForProperty(lView, inputs, value) { /** @type {?} */ var tView = lView[TVIEW]; for (var i = 0; i < inputs.length;) { /** @type {?} */ var index = /** @type {?} */ inputs[i++]; /** @type {?} */ var publicName = /** @type {?} */ inputs[i++]; /** @type {?} */ var privateName = /** @type {?} */ inputs[i++]; /** @type {?} */ var instance = lView[index]; ngDevMode && assertDataInRange(lView, index); /** @type {?} */ var def = /** @type {?} */ tView.data[index]; /** @type {?} */ var setInput = def.setInput; if (setInput) { /** @type {?} */ def.setInput(instance, value, publicName, privateName); } else { instance[privateName] = value; } } } /** * Updates a text binding at a given index in a given LView. * @param {?} lView * @param {?} index * @param {?} value * @return {?} */ function textBindingInternal(lView, index, value) { ngDevMode && assertNotSame(value, /** @type {?} */ NO_CHANGE, 'value should not be NO_CHANGE'); ngDevMode && assertDataInRange(lView, index + HEADER_OFFSET); /** @type {?} */ var element = /** @type {?} */ /** @type {?} */ getNativeByIndex(index, lView); ngDevMode && assertDefined(element, 'native element should exist'); ngDevMode && ngDevMode.rendererSetText++; /** @type {?} */ var renderer = lView[RENDERER]; isProceduralRenderer(renderer) ? renderer.setValue(element, value) : element.textContent = value; } /** * Renders all initial styling (class and style values) on to the element from the tNode. * * All initial styling data (i.e. any values extracted from the `style` or `class` attributes * on an element) are collected into the `tNode.styles` and `tNode.classes` data structures. * These values are populated during the creation phase of an element and are then later * applied once the element is instantiated. This function applies each of the static * style and class entries to the element. * @param {?} renderer * @param {?} native * @param {?} tNode * @return {?} */ function renderInitialStyling(renderer, _native13, tNode) { renderStylingMap(renderer, _native13, tNode.classes, true); renderStylingMap(renderer, _native13, tNode.styles, false); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var unusedValueToPlacateAjd$1 = unusedValueExportToPlacateAjd$1 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$5 + unusedValueExportToPlacateAjd$3 + unusedValueExportToPlacateAjd; /** * @param {?} tNode * @param {?} embeddedView * @return {?} */ function getLContainer(tNode, embeddedView) { ngDevMode && assertLView(embeddedView); /** @type {?} */ var container = /** @type {?} */ embeddedView[PARENT]; if (tNode.index === -1) { // This is a dynamically created view inside a dynamic container. // The parent isn't an LContainer if the embedded view hasn't been attached yet. return isLContainer(container) ? container : null; } else { ngDevMode && assertLContainer(container); // This is a inline view node (e.g. embeddedViewStart) return container; } } /** * Retrieves render parent for a given view. * Might be null if a view is not yet attached to any container. * @param {?} tViewNode * @param {?} view * @return {?} */ function getContainerRenderParent(tViewNode, view) { /** @type {?} */ var container = getLContainer(tViewNode, view); return container ? nativeParentNode(view[RENDERER], container[NATIVE]) : null; } /** @enum {number} */ var WalkTNodeTreeAction = { /** node insert in the native environment */ Insert: 0, /** node detach from the native environment */ Detach: 1, /** node destruction using the renderer's API */ Destroy: 2 }; /** * NOTE: for performance reasons, the possible actions are inlined within the function instead of * being passed as an argument. * @param {?} action * @param {?} renderer * @param {?} parent * @param {?} lNodeToHandle * @param {?=} beforeNode * @return {?} */ function executeActionOnElementOrContainer(action, renderer, parent, lNodeToHandle, beforeNode) { // If this slot was allocated for a text node dynamically created by i18n, the text node itself // won't be created until i18nApply() in the update block, so this node should be skipped. // For more info, see "ICU expressions should work inside an ngTemplateOutlet inside an ngFor" // in `i18n_spec.ts`. if (lNodeToHandle != null) { /** @type {?} */ var lContainer; /** @type {?} */ var _isComponent = false; // We are expecting an RNode, but in the case of a component or LContainer the `RNode` is // wrapped // in an array which needs to be unwrapped. We need to know if it is a component and if // it has LContainer so that we can process all of those cases appropriately. if (isLContainer(lNodeToHandle)) { lContainer = lNodeToHandle; } else if (isLView(lNodeToHandle)) { _isComponent = true; ngDevMode && assertDefined(lNodeToHandle[HOST], 'HOST must be defined for a component LView'); lNodeToHandle = /** @type {?} */ lNodeToHandle[HOST]; } /** @type {?} */ var rNode = unwrapRNode(lNodeToHandle); ngDevMode && assertDomNode(rNode); if (action === 0 /* Insert */ ) { nativeInsertBefore(renderer, /** @type {?} */ parent, rNode, beforeNode || null); } else if (action === 1 /* Detach */ ) { nativeRemoveNode(renderer, rNode, _isComponent); } else if (action === 2 /* Destroy */ ) { ngDevMode && ngDevMode.rendererDestroyNode++; /** @type {?} */ /** @type {?} */ renderer.destroyNode(rNode); } if (lContainer != null) { executeActionOnContainer(renderer, action, lContainer, parent, beforeNode); } } } /** * @param {?} value * @param {?} renderer * @return {?} */ function createTextNode(value, renderer) { return isProceduralRenderer(renderer) ? renderer.createText(renderStringify(value)) : renderer.createTextNode(renderStringify(value)); } /** * @param {?} lView * @param {?} insertMode * @param {?=} beforeNode * @return {?} */ function addRemoveViewFromContainer(lView, insertMode, beforeNode) { /** @type {?} */ var renderParent = getContainerRenderParent( /** @type {?} */ lView[TVIEW].node, lView); ngDevMode && assertNodeType( /** @type {?} */ lView[TVIEW].node, 2 /* View */ ); if (renderParent) { /** @type {?} */ var renderer = lView[RENDERER]; /** @type {?} */ var action = insertMode ? 0 /* Insert */ : 1 /* Detach */ ; executeActionOnView(renderer, action, lView, renderParent, beforeNode); } } /** * Detach a `LView` from the DOM by detaching its nodes. * * @param {?} lView the `LView` to be detached. * @return {?} */ function renderDetachView(lView) { executeActionOnView(lView[RENDERER], 1 /* Detach */ , lView, null, null); } /** * Traverses down and up the tree of views and containers to remove listeners and * call onDestroy callbacks. * * Notes: * - Because it's used for onDestroy calls, it needs to be bottom-up. * - Must process containers instead of their views to avoid splicing * when views are destroyed and re-added. * - Using a while loop because it's faster than recursion * - Destroy only called on movement to sibling or movement to parent (laterally or up) * * @param {?} rootView The view to destroy * @return {?} */ function destroyViewTree(rootView) { // If the view has no children, we can clean it up and return early. /** @type {?} */ var lViewOrLContainer = rootView[CHILD_HEAD]; if (!lViewOrLContainer) { return cleanUpView(rootView); } while (lViewOrLContainer) { /** @type {?} */ var next = null; if (isLView(lViewOrLContainer)) { // If LView, traverse down to child. next = lViewOrLContainer[CHILD_HEAD]; } else { ngDevMode && assertLContainer(lViewOrLContainer); // If container, traverse down to its first LView. /** @type {?} */ var firstView = lViewOrLContainer[CONTAINER_HEADER_OFFSET]; if (firstView) next = firstView; } if (!next) { // Only clean up view when moving to the side or up, as destroy hooks // should be called in order from the bottom up. while (lViewOrLContainer && ! /** @type {?} */ lViewOrLContainer[NEXT] && lViewOrLContainer !== rootView) { cleanUpView(lViewOrLContainer); lViewOrLContainer = getParentState(lViewOrLContainer, rootView); } cleanUpView(lViewOrLContainer || rootView); next = lViewOrLContainer && /** @type {?} */ lViewOrLContainer[NEXT]; } lViewOrLContainer = next; } } /** * Inserts a view into a container. * * This adds the view to the container's array of active views in the correct * position. It also adds the view's elements to the DOM if the container isn't a * root node of another view (in that case, the view's elements will be added when * the container's parent view is added later). * * @param {?} lView The view to insert * @param {?} lContainer The container into which the view should be inserted * @param {?} index Which index in the container to insert the child view into * @return {?} */ function insertView(lView, lContainer, index) { ngDevMode && assertLView(lView); ngDevMode && assertLContainer(lContainer); /** @type {?} */ var indexInContainer = CONTAINER_HEADER_OFFSET + index; /** @type {?} */ var containerLength = lContainer.length; if (index > 0) { // This is a new view, we need to add it to the children. lContainer[indexInContainer - 1][NEXT] = lView; } if (index < containerLength - CONTAINER_HEADER_OFFSET) { lView[NEXT] = lContainer[indexInContainer]; addToArray(lContainer, CONTAINER_HEADER_OFFSET + index, lView); } else { lContainer.push(lView); lView[NEXT] = null; } lView[PARENT] = lContainer; // track views where declaration and insertion points are different /** @type {?} */ var declarationLContainer = lView[DECLARATION_LCONTAINER]; if (declarationLContainer !== null && lContainer !== declarationLContainer) { trackMovedView(declarationLContainer, lView); } // notify query that a new view has been added /** @type {?} */ var lQueries = lView[QUERIES]; if (lQueries !== null) { lQueries.insertView(lView[TVIEW]); } // Sets the attached flag lView[FLAGS] |= 128 /* Attached */ ; } /** * Track views created from the declaration container (TemplateRef) and inserted into a * different LContainer. * @param {?} declarationContainer * @param {?} lView * @return {?} */ function trackMovedView(declarationContainer, lView) { ngDevMode && assertLContainer(declarationContainer); /** @type {?} */ var declaredViews = declarationContainer[MOVED_VIEWS]; if (declaredViews === null) { declarationContainer[MOVED_VIEWS] = [lView]; } else { declaredViews.push(lView); } } /** * @param {?} declarationContainer * @param {?} lView * @return {?} */ function detachMovedView(declarationContainer, lView) { ngDevMode && assertLContainer(declarationContainer); ngDevMode && assertDefined(declarationContainer[MOVED_VIEWS], 'A projected view should belong to a non-empty projected views collection'); /** @type {?} */ var projectedViews = /** @type {?} */ declarationContainer[MOVED_VIEWS]; /** @type {?} */ var declaredViewIndex = projectedViews.indexOf(lView); projectedViews.splice(declaredViewIndex, 1); } /** * Detaches a view from a container. * * This method removes the view from the container's array of active views. It also * removes the view's elements from the DOM. * * @param {?} lContainer The container from which to detach a view * @param {?} removeIndex The index of the view to detach * @return {?} Detached LView instance. */ function detachView(lContainer, removeIndex) { if (lContainer.length <= CONTAINER_HEADER_OFFSET) return; /** @type {?} */ var indexInContainer = CONTAINER_HEADER_OFFSET + removeIndex; /** @type {?} */ var viewToDetach = lContainer[indexInContainer]; if (viewToDetach) { /** @type {?} */ var declarationLContainer = viewToDetach[DECLARATION_LCONTAINER]; if (declarationLContainer !== null && declarationLContainer !== lContainer) { detachMovedView(declarationLContainer, viewToDetach); } if (removeIndex > 0) { lContainer[indexInContainer - 1][NEXT] = /** @type {?} */ viewToDetach[NEXT]; } /** @type {?} */ var removedLView = removeFromArray(lContainer, CONTAINER_HEADER_OFFSET + removeIndex); addRemoveViewFromContainer(viewToDetach, false); // notify query that a view has been removed /** @type {?} */ var lQueries = removedLView[QUERIES]; if (lQueries !== null) { lQueries.detachView(removedLView[TVIEW]); } viewToDetach[PARENT] = null; viewToDetach[NEXT] = null; // Unsets the attached flag viewToDetach[FLAGS] &= ~128 /* Attached */ ; } return viewToDetach; } /** * Removes a view from a container, i.e. detaches it and then destroys the underlying LView. * * @param {?} lContainer The container from which to remove a view * @param {?} removeIndex The index of the view to remove * @return {?} */ function removeView(lContainer, removeIndex) { /** @type {?} */ var detachedView = detachView(lContainer, removeIndex); detachedView && destroyLView(detachedView); } /** * A standalone function which destroys an LView, * conducting cleanup (e.g. removing listeners, calling onDestroys). * * @param {?} lView The view to be destroyed. * @return {?} */ function destroyLView(lView) { if (!(lView[FLAGS] & 256 /* Destroyed */ )) { /** @type {?} */ var renderer = lView[RENDERER]; if (isProceduralRenderer(renderer) && renderer.destroyNode) { executeActionOnView(renderer, 2 /* Destroy */ , lView, null, null); } destroyViewTree(lView); } } /** * Determines which LViewOrLContainer to jump to when traversing back up the * tree in destroyViewTree. * * Normally, the view's parent LView should be checked, but in the case of * embedded views, the container (which is the view node's parent, but not the * LView's parent) needs to be checked for a possible next property. * * @param {?} lViewOrLContainer The LViewOrLContainer for which we need a parent state * @param {?} rootView The rootView, so we don't propagate too far up the view tree * @return {?} The correct parent LViewOrLContainer */ function getParentState(lViewOrLContainer, rootView) { /** @type {?} */ var tNode; if (isLView(lViewOrLContainer) && (tNode = lViewOrLContainer[T_HOST]) && tNode.type === 2 /* View */ ) { // if it's an embedded view, the state needs to go up to the container, in case the // container has a next return getLContainer( /** @type {?} */ tNode, lViewOrLContainer); } else { // otherwise, use parent view for containers or component views return lViewOrLContainer[PARENT] === rootView ? null : lViewOrLContainer[PARENT]; } } /** * Calls onDestroys hooks for all directives and pipes in a given view and then removes all * listeners. Listeners are removed as the last step so events delivered in the onDestroys hooks * can be propagated to \@Output listeners. * * @param {?} view The LView to clean up * @return {?} */ function cleanUpView(view) { if (isLView(view) && !(view[FLAGS] & 256 /* Destroyed */ )) { // Usually the Attached flag is removed when the view is detached from its parent, however // if it's a root view, the flag won't be unset hence why we're also removing on destroy. view[FLAGS] &= ~128 /* Attached */ ; // Mark the LView as destroyed *before* executing the onDestroy hooks. An onDestroy hook // runs arbitrary user code, which could include its own `viewRef.destroy()` (or similar). If // We don't flag the view as destroyed before the hooks, this could lead to an infinite loop. // This also aligns with the ViewEngine behavior. It also means that the onDestroy hook is // really more of an "afterDestroy" hook if you think about it. view[FLAGS] |= 256 /* Destroyed */ ; executeOnDestroys(view); removeListeners(view); /** @type {?} */ var hostTNode = view[T_HOST]; // For component views only, the local renderer is destroyed as clean up time. if (hostTNode && hostTNode.type === 3 /* Element */ && isProceduralRenderer(view[RENDERER])) { ngDevMode && ngDevMode.rendererDestroy++; /** @type {?} */ view[RENDERER].destroy(); } /** @type {?} */ var declarationContainer = view[DECLARATION_LCONTAINER]; // we are dealing with an embedded view that is still inserted into a container if (declarationContainer !== null && isLContainer(view[PARENT])) { // and this is a projected view if (declarationContainer !== view[PARENT]) { detachMovedView(declarationContainer, view); } // For embedded views still attached to a container: remove query result from this view. /** @type {?} */ var lQueries = view[QUERIES]; if (lQueries !== null) { lQueries.detachView(view[TVIEW]); } } } } /** * Removes listeners and unsubscribes from output subscriptions * @param {?} lView * @return {?} */ function removeListeners(lView) { /** @type {?} */ var tCleanup = lView[TVIEW].cleanup; if (tCleanup !== null) { /** @type {?} */ var lCleanup = /** @type {?} */ lView[CLEANUP]; for (var i = 0; i < tCleanup.length - 1; i += 2) { if (typeof tCleanup[i] === 'string') { // This is a native DOM listener /** @type {?} */ var idxOrTargetGetter = tCleanup[i + 1]; /** @type {?} */ var target = typeof idxOrTargetGetter === 'function' ? idxOrTargetGetter(lView) : unwrapRNode(lView[idxOrTargetGetter]); /** @type {?} */ var listener = lCleanup[tCleanup[i + 2]]; /** @type {?} */ var useCaptureOrSubIdx = tCleanup[i + 3]; if (typeof useCaptureOrSubIdx === 'boolean') { // native DOM listener registered with Renderer3 target.removeEventListener(tCleanup[i], listener, useCaptureOrSubIdx); } else { if (useCaptureOrSubIdx >= 0) { // unregister lCleanup[useCaptureOrSubIdx](); } else { // Subscription lCleanup[-useCaptureOrSubIdx].unsubscribe(); } } i += 2; } else { // This is a cleanup function that is grouped with the index of its context /** @type {?} */ var context = lCleanup[tCleanup[i + 1]]; tCleanup[i].call(context); } } lView[CLEANUP] = null; } } /** * Calls onDestroy hooks for this view * @param {?} view * @return {?} */ function executeOnDestroys(view) { /** @type {?} */ var tView = view[TVIEW]; /** @type {?} */ var destroyHooks; if (tView != null && (destroyHooks = tView.destroyHooks) != null) { for (var i = 0; i < destroyHooks.length; i += 2) { /** @type {?} */ var context = view[ /** @type {?} */ destroyHooks[i]]; // Only call the destroy hook if the context has been requested. if (!(context instanceof NodeInjectorFactory)) { /** @type {?} */ destroyHooks[i + 1].call(context); } } } } /** * Returns a native element if a node can be inserted into the given parent. * * There are two reasons why we may not be able to insert a element immediately. * - Projection: When creating a child content element of a component, we have to skip the * insertion because the content of a component will be projected. * `<component><content>delayed due to projection</content></component>` * - Parent container is disconnected: This can happen when we are inserting a view into * parent container, which itself is disconnected. For example the parent container is part * of a View which has not be inserted or is made for projection but has not been inserted * into destination. * @param {?} tNode * @param {?} currentView * @return {?} */ function getRenderParent(tNode, currentView) { // Nodes of the top-most view can be inserted eagerly. if (isRootView(currentView)) { return nativeParentNode(currentView[RENDERER], getNativeByTNode(tNode, currentView)); } // Skip over element and ICU containers as those are represented by a comment node and // can't be used as a render parent. /** @type {?} */ var parent = getHighestElementOrICUContainer(tNode); /** @type {?} */ var renderParent = parent.parent; // If the parent is null, then we are inserting across views: either into an embedded view or a // component view. if (renderParent == null) { /** @type {?} */ var hostTNode = /** @type {?} */ currentView[T_HOST]; if (hostTNode.type === 2 /* View */ ) { // We are inserting a root element of an embedded view We might delay insertion of children // for a given view if it is disconnected. This might happen for 2 main reasons: // - view is not inserted into any container(view was created but not inserted yet) // - view is inserted into a container but the container itself is not inserted into the DOM // (container might be part of projection or child of a view that is not inserted yet). // In other words we can insert children of a given view if this view was inserted into a // container and the container itself has its render parent determined. return getContainerRenderParent( /** @type {?} */ hostTNode, currentView); } else { // We are inserting a root element of the component view into the component host element and // it should always be eager. return getHostNative(currentView); } } else { /** @type {?} */ var isIcuCase = parent && parent.type === 5 /* IcuContainer */ ; // If the parent of this node is an ICU container, then it is represented by comment node and we // need to use it as an anchor. If it is projected then its direct parent node is the renderer. if (isIcuCase && parent.flags & 2 /* isProjected */ ) { return ( /** @type {?} */ getNativeByTNode(parent, currentView).parentNode ); } ngDevMode && assertNodeType(renderParent, 3 /* Element */ ); if (renderParent.flags & 1 /* isComponent */ && !isIcuCase) { /** @type {?} */ var tData = currentView[TVIEW].data; /** @type {?} */ var _tNode2 = /** @type {?} */ tData[renderParent.index]; /** @type {?} */ var encapsulation = /** @type {?} */ tData[_tNode2.directiveStart].encapsulation; // We've got a parent which is an element in the current view. We just need to verify if the // parent element is not a component. Component's content nodes are not inserted immediately // because they will be projected, and so doing insert at this point would be wasteful. // Since the projection would then move it to its final destination. Note that we can't // make this assumption when using the Shadow DOM, because the native projection placeholders // (<content> or <slot>) have to be in place as elements are being inserted. if (encapsulation !== ViewEncapsulation.ShadowDom && encapsulation !== ViewEncapsulation.Native) { return null; } } return ( /** @type {?} */ getNativeByTNode(renderParent, currentView) ); } } /** * Gets the native host element for a given view. Will return null if the current view does not have * a host element. * @param {?} currentView * @return {?} */ function getHostNative(currentView) { ngDevMode && assertLView(currentView); /** @type {?} */ var hostTNode = currentView[T_HOST]; return hostTNode && hostTNode.type === 3 /* Element */ ? /** @type {?} */ getNativeByTNode(hostTNode, /** @type {?} */ getLViewParent(currentView)) : null; } /** * Inserts a native node before another native node for a given parent using {\@link Renderer3}. * This is a utility function that can be used when native nodes were determined - it abstracts an * actual renderer being used. * @param {?} renderer * @param {?} parent * @param {?} child * @param {?} beforeNode * @return {?} */ function nativeInsertBefore(renderer, parent, child, beforeNode) { ngDevMode && ngDevMode.rendererInsertBefore++; if (isProceduralRenderer(renderer)) { renderer.insertBefore(parent, child, beforeNode); } else { parent.insertBefore(child, beforeNode, true); } } /** * @param {?} renderer * @param {?} parent * @param {?} child * @return {?} */ function nativeAppendChild(renderer, parent, child) { ngDevMode && ngDevMode.rendererAppendChild++; if (isProceduralRenderer(renderer)) { renderer.appendChild(parent, child); } else { parent.appendChild(child); } } /** * @param {?} renderer * @param {?} parent * @param {?} child * @param {?} beforeNode * @return {?} */ function nativeAppendOrInsertBefore(renderer, parent, child, beforeNode) { if (beforeNode !== null) { nativeInsertBefore(renderer, parent, child, beforeNode); } else { nativeAppendChild(renderer, parent, child); } } /** * Removes a node from the DOM given its native parent. * @param {?} renderer * @param {?} parent * @param {?} child * @param {?=} isHostElement * @return {?} */ function nativeRemoveChild(renderer, parent, child, isHostElement) { if (isProceduralRenderer(renderer)) { renderer.removeChild(parent, child, isHostElement); } else { parent.removeChild(child); } } /** * Returns a native parent of a given native node. * @param {?} renderer * @param {?} node * @return {?} */ function nativeParentNode(renderer, node) { return ( /** @type {?} */ isProceduralRenderer(renderer) ? renderer.parentNode(node) : node.parentNode ); } /** * Returns a native sibling of a given native node. * @param {?} renderer * @param {?} node * @return {?} */ function nativeNextSibling(renderer, node) { return isProceduralRenderer(renderer) ? renderer.nextSibling(node) : node.nextSibling; } /** * Finds a native "anchor" node for cases where we can't append a native child directly * (`appendChild`) and need to use a reference (anchor) node for the `insertBefore` operation. * @param {?} parentTNode * @param {?} lView * @return {?} */ function getNativeAnchorNode(parentTNode, lView) { if (parentTNode.type === 2 /* View */ ) { /** @type {?} */ var lContainer = /** @type {?} */ getLContainer( /** @type {?} */ parentTNode, lView); /** @type {?} */ var index = lContainer.indexOf(lView, CONTAINER_HEADER_OFFSET) - CONTAINER_HEADER_OFFSET; return getBeforeNodeForView(index, lContainer); } else if (parentTNode.type === 4 /* ElementContainer */ || parentTNode.type === 5 /* IcuContainer */ ) { return getNativeByTNode(parentTNode, lView); } return null; } /** * Appends the `child` native node (or a collection of nodes) to the `parent`. * * The element insertion might be delayed {\@link canInsertNativeNode}. * * @param {?} childEl The native child (or children) that should be appended * @param {?} childTNode The TNode of the child element * @param {?} currentView The current LView * @return {?} Whether or not the child was appended */ function appendChild(childEl, childTNode, currentView) { /** @type {?} */ var renderParent = getRenderParent(childTNode, currentView); if (renderParent != null) { /** @type {?} */ var renderer = currentView[RENDERER]; /** @type {?} */ var parentTNode = childTNode.parent || /** @type {?} */ currentView[T_HOST]; /** @type {?} */ var anchorNode = getNativeAnchorNode(parentTNode, currentView); if (Array.isArray(childEl)) { var _iterator36 = _createForOfIteratorHelper(childEl), _step36; try { for (_iterator36.s(); !(_step36 = _iterator36.n()).done;) { var nativeNode = _step36.value; nativeAppendOrInsertBefore(renderer, renderParent, nativeNode, anchorNode); } } catch (err) { _iterator36.e(err); } finally { _iterator36.f(); } } else { nativeAppendOrInsertBefore(renderer, renderParent, childEl, anchorNode); } } } /** * Gets the top-level element or an ICU container if those containers are nested. * * @param {?} tNode The starting TNode for which we should skip element and ICU containers * @return {?} The TNode of the highest level ICU container or element container */ function getHighestElementOrICUContainer(tNode) { while (tNode.parent != null && (tNode.parent.type === 4 /* ElementContainer */ || tNode.parent.type === 5 /* IcuContainer */ )) { tNode = tNode.parent; } return tNode; } /** * @param {?} viewIndexInContainer * @param {?} lContainer * @return {?} */ function getBeforeNodeForView(viewIndexInContainer, lContainer) { /** @type {?} */ var nextViewIndex = CONTAINER_HEADER_OFFSET + viewIndexInContainer + 1; if (nextViewIndex < lContainer.length) { /** @type {?} */ var _lView5 = /** @type {?} */ lContainer[nextViewIndex]; ngDevMode && assertDefined(_lView5[T_HOST], 'Missing Host TNode'); /** @type {?} */ var tViewNodeChild = /** @type {?} */ _lView5[T_HOST].child; return tViewNodeChild !== null ? getNativeByTNodeOrNull(tViewNodeChild, _lView5) : lContainer[NATIVE]; } else { return lContainer[NATIVE]; } } /** * Removes a native node itself using a given renderer. To remove the node we are looking up its * parent from the native tree as not all platforms / browsers support the equivalent of * node.remove(). * * @param {?} renderer A renderer to be used * @param {?} rNode The native node that should be removed * @param {?=} isHostElement A flag indicating if a node to be removed is a host of a component. * @return {?} */ function nativeRemoveNode(renderer, rNode, isHostElement) { /** @type {?} */ var nativeParent = nativeParentNode(renderer, rNode); if (nativeParent) { nativeRemoveChild(renderer, nativeParent, rNode, isHostElement); } } /** * Appends nodes to a target projection place. Nodes to insert were previously re-distribution and * stored on a component host level. * @param {?} lView A LView where nodes are inserted (target LView) * @param {?} tProjectionNode A projection node where previously re-distribution should be appended * (target insertion place) * @param {?} selectorIndex A bucket from where nodes to project should be taken * @param {?} componentView A where projectable nodes were initially created (source view) * @return {?} */ function appendProjectedNodes(lView, tProjectionNode, selectorIndex, componentView) { /** @type {?} */ var projectedView = /** @type {?} */ /** @type {?} */ componentView[PARENT]; /** @type {?} */ var componentNode = /** @type {?} */ componentView[T_HOST]; /** @type {?} */ var nodeToProject = /** @type {?} */ componentNode.projection[selectorIndex]; if (Array.isArray(nodeToProject)) { appendChild(nodeToProject, tProjectionNode, lView); } else { while (nodeToProject) { if (!(nodeToProject.flags & 32 /* isDetached */ )) { if (nodeToProject.type === 1 /* Projection */ ) { appendProjectedNodes(lView, tProjectionNode, /** @type {?} */ nodeToProject.projection, findComponentView(projectedView)); } else { // This flag must be set now or we won't know that this node is projected // if the nodes are inserted into a container later. nodeToProject.flags |= 2 /* isProjected */ ; appendProjectedNode(nodeToProject, tProjectionNode, lView, projectedView); } } nodeToProject = nodeToProject.projectionNext; } } } /** * Loops over all children of a TNode container and appends them to the DOM * * @param {?} ngContainerChildTNode The first child of the TNode container * @param {?} tProjectionNode The projection (ng-content) TNode * @param {?} currentView Current LView * @param {?} projectionView Projection view (view above current) * @return {?} */ function appendProjectedChildren(ngContainerChildTNode, tProjectionNode, currentView, projectionView) { while (ngContainerChildTNode) { appendProjectedNode(ngContainerChildTNode, tProjectionNode, currentView, projectionView); ngContainerChildTNode = ngContainerChildTNode.next; } } /** * Appends a projected node to the DOM, or in the case of a projected container, * appends the nodes from all of the container's active views to the DOM. * * @param {?} projectedTNode The TNode to be projected * @param {?} tProjectionNode The projection (ng-content) TNode * @param {?} currentView Current LView * @param {?} projectionView Projection view (view above current) * @return {?} */ function appendProjectedNode(projectedTNode, tProjectionNode, currentView, projectionView) { /** @type {?} */ var _native14 = getNativeByTNode(projectedTNode, projectionView); appendChild(_native14, tProjectionNode, currentView); // the projected contents are processed while in the shadow view (which is the currentView) // therefore we need to extract the view where the host element lives since it's the // logical container of the content projected views attachPatchData(_native14, projectionView); /** @type {?} */ var nodeOrContainer = projectionView[projectedTNode.index]; if (projectedTNode.type === 0 /* Container */ ) { // The node we are adding is a container and we are adding it to an element which // is not a component (no more re-projection). // Alternatively a container is projected at the root of a component's template // and can't be re-projected (as not content of any component). // Assign the final projection location in those cases. for (var i = CONTAINER_HEADER_OFFSET; i < nodeOrContainer.length; i++) { addRemoveViewFromContainer(nodeOrContainer[i], true, nodeOrContainer[NATIVE]); } } else if (projectedTNode.type === 5 /* IcuContainer */ ) { // The node we are adding is an ICU container which is why we also need to project all the // children nodes that might have been created previously and are linked to this anchor /** @type {?} */ var ngContainerChildTNode = /** @type {?} */ projectedTNode.child; appendProjectedChildren(ngContainerChildTNode, ngContainerChildTNode, projectionView, projectionView); } else { if (projectedTNode.type === 4 /* ElementContainer */ ) { appendProjectedChildren(projectedTNode.child, tProjectionNode, currentView, projectionView); } if (isLContainer(nodeOrContainer)) { appendChild(nodeOrContainer[NATIVE], tProjectionNode, currentView); } } } /** * `executeActionOnView` performs an operation on the view as specified in `action` (insert, detach, * destroy) * * Inserting a view without projection or containers at top level is simple. Just iterate over the * root nodes of the View, and for each node perform the `action`. * * Things get more complicated with containers and projections. That is because coming across: * - Container: implies that we have to insert/remove/destroy the views of that container as well * which in turn can have their own Containers at the View roots. * - Projection: implies that we have to insert/remove/destroy the nodes of the projection. The * complication is that the nodes we are projecting can themselves have Containers * or other Projections. * * As you can see this is a very recursive problem. While the recursive implementation is not the * most efficient one, trying to unroll the nodes non-recursively results in very complex code that * is very hard (to maintain). We are sacrificing a bit of performance for readability using a * recursive implementation. * * @param {?} renderer Renderer to use * @param {?} action action to perform (insert, detach, destroy) * @param {?} lView The LView which needs to be inserted, detached, destroyed. * @param {?} renderParent parent DOM element for insertion/removal. * @param {?} beforeNode Before which node the insertions should happen. * @return {?} */ function executeActionOnView(renderer, action, lView, renderParent, beforeNode) { /** @type {?} */ var tView = lView[TVIEW]; ngDevMode && assertNodeType( /** @type {?} */ tView.node, 2 /* View */ ); /** @type {?} */ var viewRootTNode = /** @type {?} */ tView.node.child; while (viewRootTNode !== null) { executeActionOnNode(renderer, action, lView, viewRootTNode, renderParent, beforeNode); viewRootTNode = viewRootTNode.next; } } /** * `executeActionOnProjection` performs an operation on the projection specified by `action` * (insert, detach, destroy). * * Inserting a projection requires us to locate the projected nodes from the parent component. The * complication is that those nodes themselves could be re-projected from their parent component. * * @param {?} renderer Renderer to use * @param {?} action action to perform (insert, detach, destroy) * @param {?} lView The LView which needs to be inserted, detached, destroyed. * @param {?} tProjectionNode projection TNode to process * @param {?} renderParent parent DOM element for insertion/removal. * @param {?} beforeNode Before which node the insertions should happen. * @return {?} */ function executeActionOnProjection(renderer, action, lView, tProjectionNode, renderParent, beforeNode) { /** @type {?} */ var componentLView = findComponentView(lView); /** @type {?} */ var componentNode = /** @type {?} */ componentLView[T_HOST]; ngDevMode && assertDefined(componentNode.projection, 'Element nodes for which projection is processed must have projection defined.'); /** @type {?} */ var nodeToProject = /** @type {?} */ componentNode.projection[tProjectionNode.projection]; if (nodeToProject !== undefined) { if (Array.isArray(nodeToProject)) { for (var i = 0; i < nodeToProject.length; i++) { /** @type {?} */ var rNode = nodeToProject[i]; ngDevMode && assertDomNode(rNode); executeActionOnElementOrContainer(action, renderer, renderParent, rNode, beforeNode); } } else { /** @type {?} */ var projectionTNode = nodeToProject; /** @type {?} */ var projectedComponentLView = /** @type {?} */ componentLView[PARENT]; while (projectionTNode !== null) { executeActionOnNode(renderer, action, projectedComponentLView, projectionTNode, renderParent, beforeNode); projectionTNode = projectionTNode.projectionNext; } } } } /** * `executeActionOnContainer` performs an operation on the container and its views as specified by * `action` (insert, detach, destroy) * * Inserting a Container is complicated by the fact that the container may have Views which * themselves have containers or projections. * * @param {?} renderer Renderer to use * @param {?} action action to perform (insert, detach, destroy) * @param {?} lContainer The LContainer which needs to be inserted, detached, destroyed. * @param {?} renderParent parent DOM element for insertion/removal. * @param {?} beforeNode Before which node the insertions should happen. * @return {?} */ function executeActionOnContainer(renderer, action, lContainer, renderParent, beforeNode) { ngDevMode && assertLContainer(lContainer); /** @type {?} */ var anchor = lContainer[NATIVE]; // LContainer has its own before node. /** @type {?} */ var _native15 = unwrapRNode(lContainer); // An LContainer can be created dynamically on any node by injecting ViewContainerRef. // Asking for a ViewContainerRef on an element will result in a creation of a separate anchor node // (comment in the DOM) that will be different from the LContainer's host node. In this particular // case we need to execute action on 2 nodes: // - container's host node (this is done in the executeNodeAction) // - container's host node (this is done here) if (anchor !== _native15) { executeActionOnElementOrContainer(action, renderer, renderParent, anchor, beforeNode); } for (var i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) { /** @type {?} */ var _lView6 = /** @type {?} */ lContainer[i]; executeActionOnView(renderer, action, _lView6, renderParent, anchor); } } /** * `executeActionOnElementContainerOrIcuContainer` performs an operation on the ng-container node * and its child nodes as specified by the `action` (insert, detach, destroy). * * @param {?} renderer Renderer to use * @param {?} action action to perform (insert, detach, destroy) * @param {?} lView The LView which needs to be inserted, detached, destroyed. * @param {?} tNode The TNode associated with the `ElementContainer` or `IcuContainer`. * @param {?} renderParent parent DOM element for insertion/removal. * @param {?} beforeNode Before which node the insertions should happen. * @return {?} */ function executeActionOnElementContainerOrIcuContainer(renderer, action, lView, tNode, renderParent, beforeNode) { /** @type {?} */ var node = lView[tNode.index]; executeActionOnElementOrContainer(action, renderer, renderParent, node, beforeNode); /** @type {?} */ var childTNode = tNode.child; while (childTNode) { executeActionOnNode(renderer, action, lView, childTNode, renderParent, beforeNode); childTNode = childTNode.next; } } /** * @param {?} renderer * @param {?} action * @param {?} lView * @param {?} tNode * @param {?} renderParent * @param {?} beforeNode * @return {?} */ function executeActionOnNode(renderer, action, lView, tNode, renderParent, beforeNode) { /** @type {?} */ var nodeType = tNode.type; if (!(tNode.flags & 32 /* isDetached */ )) { if (nodeType === 4 /* ElementContainer */ || nodeType === 5 /* IcuContainer */ ) { executeActionOnElementContainerOrIcuContainer(renderer, action, lView, /** @type {?} */ tNode, renderParent, beforeNode); } else if (nodeType === 1 /* Projection */ ) { executeActionOnProjection(renderer, action, lView, /** @type {?} */ tNode, renderParent, beforeNode); } else { ngDevMode && assertNodeOfPossibleTypes(tNode, 3 /* Element */ , 0 /* Container */ ); executeActionOnElementOrContainer(action, renderer, renderParent, lView[tNode.index], beforeNode); } } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Unwraps a parent injector location number to find the view offset from the current injector, * then walks up the declaration view tree until the TNode of the parent injector is found. * * @param {?} location The location of the parent injector, which contains the view offset * @param {?} startView The LView instance from which to start walking up the view tree * @param {?} startTNode The TNode instance of the starting element * @return {?} The TNode of the parent injector */ function getParentInjectorTNode(location, startView, startTNode) { if (startTNode.parent && startTNode.parent.injectorIndex !== -1) { // view offset is 0 /** @type {?} */ var injectorIndex = startTNode.parent.injectorIndex; /** @type {?} */ var _parentTNode = startTNode.parent; while (_parentTNode.parent != null && injectorIndex == _parentTNode.injectorIndex) { _parentTNode = _parentTNode.parent; } return _parentTNode; } /** @type {?} */ var viewOffset = getParentInjectorViewOffset(location); // view offset is 1 /** @type {?} */ var parentView = startView; /** @type {?} */ var parentTNode = /** @type {?} */ startView[T_HOST]; // view offset is superior to 1 while (viewOffset > 1) { parentView = /** @type {?} */ parentView[DECLARATION_VIEW]; parentTNode = /** @type {?} */ parentView[T_HOST]; viewOffset--; } return parentTNode; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function viewEngine_ChangeDetectorRef_interface() {} /** * @template T */ var ViewRef = /*#__PURE__*/function () { /** * @param {?} _lView * @param {?} _context * @param {?} _componentIndex */ function ViewRef(_lView, _context, _componentIndex) { _classCallCheck(this, ViewRef); this._context = _context; this._componentIndex = _componentIndex; this._appRef = null; this._viewContainerRef = null; /** * \@internal */ this._tViewNode = null; this._lView = _lView; } /** * @return {?} */ _createClass2(ViewRef, [{ key: "destroy", /** * @return {?} */ value: function destroy() { if (this._appRef) { this._appRef.detachView(this); } else if (this._viewContainerRef) { /** @type {?} */ var index = this._viewContainerRef.indexOf(this); if (index > -1) { this._viewContainerRef.detach(index); } this._viewContainerRef = null; } destroyLView(this._lView); } /** * @param {?} callback * @return {?} */ }, { key: "onDestroy", value: function onDestroy(callback) { storeCleanupFn(this._lView, callback); } /** * Marks a view and all of its ancestors dirty. * * It also triggers change detection by calling `scheduleTick` internally, which coalesces * multiple `markForCheck` calls to into one change detection run. * * This can be used to ensure an {\@link ChangeDetectionStrategy#OnPush OnPush} component is * checked when it needs to be re-rendered but the two normal triggers haven't marked it * dirty (i.e. inputs haven't changed and events haven't fired in the view). * * <!-- TODO: Add a link to a chapter on OnPush components --> * * \@usageNotes * ### Example * * ```typescript * \@Component({ * selector: 'my-app', * template: `Number of ticks: {{numberOfTicks}}` * changeDetection: ChangeDetectionStrategy.OnPush, * }) * class AppComponent { * numberOfTicks = 0; * * constructor(private ref: ChangeDetectorRef) { * setInterval(() => { * this.numberOfTicks++; * // the following is required, otherwise the view will not be updated * this.ref.markForCheck(); * }, 1000); * } * } * ``` * @return {?} */ }, { key: "markForCheck", value: function markForCheck() { markViewDirty(this._lView); } /** * Detaches the view from the change detection tree. * * Detached views will not be checked during change detection runs until they are * re-attached, even if they are dirty. `detach` can be used in combination with * {\@link ChangeDetectorRef#detectChanges detectChanges} to implement local change * detection checks. * * <!-- TODO: Add a link to a chapter on detach/reattach/local digest --> * <!-- TODO: Add a live demo once ref.detectChanges is merged into master --> * * \@usageNotes * ### Example * * The following example defines a component with a large list of readonly data. * Imagine the data changes constantly, many times per second. For performance reasons, * we want to check and update the list every five seconds. We can do that by detaching * the component's change detector and doing a local check every five seconds. * * ```typescript * class DataProvider { * // in a real application the returned data will be different every time * get data() { * return [1,2,3,4,5]; * } * } * * \@Component({ * selector: 'giant-list', * template: ` * <li *ngFor="let d of dataProvider.data">Data {{d}}</li> * `, * }) * class GiantList { * constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) { * ref.detach(); * setInterval(() => { * this.ref.detectChanges(); * }, 5000); * } * } * / * selector: 'app', * providers: [DataProvider], * template: ` * <giant-list><giant-list> * `, * }) * class App { * } * ``` * @return {?} */ }, { key: "detach", value: function detach() { this._lView[FLAGS] &= ~128 /* Attached */ ; } /** * Re-attaches a view to the change detection tree. * * This can be used to re-attach views that were previously detached from the tree * using {\@link ChangeDetectorRef#detach detach}. Views are attached to the tree by default. * * <!-- TODO: Add a link to a chapter on detach/reattach/local digest --> * * \@usageNotes * ### Example * * The following example creates a component displaying `live` data. The component will detach * its change detector from the main change detector tree when the component's live property * is set to false. * * ```typescript * class DataProvider { * data = 1; * * constructor() { * setInterval(() => { * this.data = this.data * 2; * }, 500); * } * } * * \@Component({ * selector: 'live-data', * inputs: ['live'], * template: 'Data: {{dataProvider.data}}' * }) * class LiveData { * constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {} * * set live(value) { * if (value) { * this.ref.reattach(); * } else { * this.ref.detach(); * } * } * } * / * selector: 'my-app', * providers: [DataProvider], * template: ` * Live Update: <input type="checkbox" [(ngModel)]="live"> * <live-data [live]="live"><live-data> * `, * }) * class AppComponent { * live = true; * } * ``` * @return {?} */ }, { key: "reattach", value: function reattach() { this._lView[FLAGS] |= 128 /* Attached */ ; } /** * Checks the view and its children. * * This can also be used in combination with {\@link ChangeDetectorRef#detach detach} to implement * local change detection checks. * * <!-- TODO: Add a link to a chapter on detach/reattach/local digest --> * <!-- TODO: Add a live demo once ref.detectChanges is merged into master --> * * \@usageNotes * ### Example * * The following example defines a component with a large list of readonly data. * Imagine, the data changes constantly, many times per second. For performance reasons, * we want to check and update the list every five seconds. * * We can do that by detaching the component's change detector and doing a local change detection * check every five seconds. * * See {\@link ChangeDetectorRef#detach detach} for more information. * @return {?} */ }, { key: "detectChanges", value: function detectChanges() { detectChangesInternal(this._lView, this.context); } /** * Checks the change detector and its children, and throws if any changes are detected. * * This is used in development mode to verify that running change detection doesn't * introduce other changes. * @return {?} */ }, { key: "checkNoChanges", value: function checkNoChanges() { checkNoChangesInternal(this._lView, this.context); } /** * @param {?} vcRef * @return {?} */ }, { key: "attachToViewContainerRef", value: function attachToViewContainerRef(vcRef) { if (this._appRef) { throw new Error('This view is already attached directly to the ApplicationRef!'); } this._viewContainerRef = vcRef; } /** * @return {?} */ }, { key: "detachFromAppRef", value: function detachFromAppRef() { this._appRef = null; renderDetachView(this._lView); } /** * @param {?} appRef * @return {?} */ }, { key: "attachToAppRef", value: function attachToAppRef(appRef) { if (this._viewContainerRef) { throw new Error('This view is already attached to a ViewContainer!'); } this._appRef = appRef; } /** * @private * @return {?} */ }, { key: "_lookUpContext", value: function _lookUpContext() { return this._context = /** @type {?} */ /** @type {?} */ getLViewParent(this._lView)[this._componentIndex]; } }, { key: "rootNodes", get: function get() { if (this._lView[HOST] == null) { /** @type {?} */ var tView = /** @type {?} */ this._lView[T_HOST]; return collectNativeNodes(this._lView, tView, []); } return []; } /** * @return {?} */ }, { key: "context", get: function get() { return this._context ? this._context : this._lookUpContext(); } /** * @return {?} */ }, { key: "destroyed", get: function get() { return (this._lView[FLAGS] & 256 /* Destroyed */ ) === 256 /* Destroyed */ ; } }]); return ViewRef; }(); if (false) {} /** * \@internal * @template T */ var RootViewRef = /*#__PURE__*/function (_ViewRef) { _inherits(RootViewRef, _ViewRef); var _super107 = _createSuper(RootViewRef); /** * @param {?} _view */ function RootViewRef(_view) { var _this322; _classCallCheck(this, RootViewRef); _this322 = _super107.call(this, _view, null, -1); _this322._view = _view; return _this322; } /** * @return {?} */ _createClass2(RootViewRef, [{ key: "detectChanges", value: function detectChanges() { detectChangesInRootView(this._view); } /** * @return {?} */ }, { key: "checkNoChanges", value: function checkNoChanges() { checkNoChangesInRootView(this._view); } /** * @return {?} */ }, { key: "context", get: function get() { return ( /** @type {?} */ null ); } }]); return RootViewRef; }(ViewRef); if (false) {} /** * @param {?} lView * @param {?} parentTNode * @param {?} result * @return {?} */ function collectNativeNodes(lView, parentTNode, result) { /** @type {?} */ var tNodeChild = parentTNode.child; while (tNodeChild) { /** @type {?} */ var nativeNode = getNativeByTNodeOrNull(tNodeChild, lView); nativeNode && result.push(nativeNode); if (tNodeChild.type === 4 /* ElementContainer */ ) { collectNativeNodes(lView, tNodeChild, result); } else if (tNodeChild.type === 1 /* Projection */ ) { /** @type {?} */ var componentView = findComponentView(lView); /** @type {?} */ var componentHost = /** @type {?} */ componentView[T_HOST]; /** @type {?} */ var parentView = getLViewParent(componentView); /** @type {?} */ var currentProjectedNode = /** @type {?} */ componentHost.projection[ /** @type {?} */ tNodeChild.projection]; while (currentProjectedNode && parentView) { result.push(getNativeByTNode(currentProjectedNode, parentView)); currentProjectedNode = currentProjectedNode.next; } } tNodeChild = tNodeChild.next; } return result; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Creates an ElementRef from the most recent node. * * @param {?} ElementRefToken * @return {?} The ElementRef instance to use */ function injectElementRef(ElementRefToken) { return createElementRef(ElementRefToken, getPreviousOrParentTNode(), getLView()); } /** @type {?} */ var R3ElementRef; /** * Creates an ElementRef given a node. * * @param {?} ElementRefToken The ElementRef type * @param {?} tNode The node for which you'd like an ElementRef * @param {?} view The view to which the node belongs * @return {?} The ElementRef instance to use */ function createElementRef(ElementRefToken, tNode, view) { if (!R3ElementRef) { // TODO: Fix class name, should be ElementRef, but there appears to be a rollup bug R3ElementRef = /*#__PURE__*/function (_ElementRefToken) { _inherits(ElementRef_, _ElementRefToken); var _super108 = _createSuper(ElementRef_); function ElementRef_() { _classCallCheck(this, ElementRef_); return _super108.apply(this, arguments); } return ElementRef_; }(ElementRefToken); } return new R3ElementRef( /** @type {?} */ getNativeByTNode(tNode, view)); } /** @type {?} */ var R3TemplateRef; /** * Creates a TemplateRef given a node. * * @template T * @param {?} TemplateRefToken * @param {?} ElementRefToken * @return {?} The TemplateRef instance to use */ function injectTemplateRef(TemplateRefToken, ElementRefToken) { return createTemplateRef(TemplateRefToken, ElementRefToken, getPreviousOrParentTNode(), getLView()); } /** * Creates a TemplateRef and stores it on the injector. * * @template T * @param {?} TemplateRefToken The TemplateRef type * @param {?} ElementRefToken The ElementRef type * @param {?} hostTNode The node on which a TemplateRef is requested * @param {?} hostView The view to which the node belongs * @return {?} The TemplateRef instance or null if we can't create a TemplateRef on a given node type */ function createTemplateRef(TemplateRefToken, ElementRefToken, hostTNode, hostView) { if (!R3TemplateRef) { // TODO: Fix class name, should be TemplateRef, but there appears to be a rollup bug R3TemplateRef = /*#__PURE__*/function (_TemplateRefToken) { _inherits(TemplateRef_, _TemplateRefToken); var _super109 = _createSuper(TemplateRef_); /** * @param {?} _declarationView * @param {?} _declarationTContainer * @param {?} elementRef */ function TemplateRef_(_declarationView, _declarationTContainer, elementRef) { var _this323; _classCallCheck(this, TemplateRef_); _this323 = _super109.call(this); _this323._declarationView = _declarationView; _this323._declarationTContainer = _declarationTContainer; _this323.elementRef = elementRef; return _this323; } /** * @param {?} context * @return {?} */ _createClass2(TemplateRef_, [{ key: "createEmbeddedView", value: function createEmbeddedView(context) { /** @type {?} */ var embeddedTView = /** @type {?} */ this._declarationTContainer.tViews; /** @type {?} */ var lView = createEmbeddedViewAndNode(embeddedTView, context, this._declarationView, this._declarationTContainer.injectorIndex); /** @type {?} */ var declarationLContainer = this._declarationView[this._declarationTContainer.index]; ngDevMode && assertLContainer(declarationLContainer); lView[DECLARATION_LCONTAINER] = declarationLContainer; /** @type {?} */ var declarationViewLQueries = this._declarationView[QUERIES]; if (declarationViewLQueries !== null) { lView[QUERIES] = declarationViewLQueries.createEmbeddedView(embeddedTView); } renderEmbeddedTemplate(lView, embeddedTView, context); /** @type {?} */ var viewRef = new ViewRef(lView, context, -1); viewRef._tViewNode = /** @type {?} */ lView[T_HOST]; return viewRef; } }]); return TemplateRef_; }(TemplateRefToken); } if (hostTNode.type === 0 /* Container */ ) { ngDevMode && assertDefined(hostTNode.tViews, 'TView must be allocated'); return new R3TemplateRef(hostView, /** @type {?} */ hostTNode, createElementRef(ElementRefToken, hostTNode, hostView)); } else { return null; } } /** @type {?} */ var R3ViewContainerRef; /** * Creates a ViewContainerRef and stores it on the injector. Or, if the ViewContainerRef * already exists, retrieves the existing ViewContainerRef. * * @param {?} ViewContainerRefToken * @param {?} ElementRefToken * @return {?} The ViewContainerRef instance to use */ function injectViewContainerRef(ViewContainerRefToken, ElementRefToken) { /** @type {?} */ var previousTNode = /** @type {?} */ getPreviousOrParentTNode(); return createContainerRef(ViewContainerRefToken, ElementRefToken, previousTNode, getLView()); } /** * Creates a ViewContainerRef and stores it on the injector. * * @param {?} ViewContainerRefToken The ViewContainerRef type * @param {?} ElementRefToken The ElementRef type * @param {?} hostTNode The node that is requesting a ViewContainerRef * @param {?} hostView The view to which the node belongs * @return {?} The ViewContainerRef instance to use */ function createContainerRef(ViewContainerRefToken, ElementRefToken, hostTNode, hostView) { if (!R3ViewContainerRef) { // TODO: Fix class name, should be ViewContainerRef, but there appears to be a rollup bug R3ViewContainerRef = /*#__PURE__*/function (_ViewContainerRefToke) { _inherits(ViewContainerRef_, _ViewContainerRefToke); var _super110 = _createSuper(ViewContainerRef_); /** * @param {?} _lContainer * @param {?} _hostTNode * @param {?} _hostView */ function ViewContainerRef_(_lContainer, _hostTNode, _hostView) { var _this324; _classCallCheck(this, ViewContainerRef_); _this324 = _super110.call(this); _this324._lContainer = _lContainer; _this324._hostTNode = _hostTNode; _this324._hostView = _hostView; return _this324; } /** * @return {?} */ _createClass2(ViewContainerRef_, [{ key: "clear", /** * @return {?} */ value: function clear() { while (this.length > 0) { this.remove(this.length - 1); } } /** * @param {?} index * @return {?} */ }, { key: "get", value: function get(index) { return this._lContainer[VIEW_REFS] !== null && /** @type {?} */ this._lContainer[VIEW_REFS][index] || null; } /** * @return {?} */ }, { key: "createEmbeddedView", /** * @template C * @param {?} templateRef * @param {?=} context * @param {?=} index * @return {?} */ value: function createEmbeddedView(templateRef, context, index) { /** @type {?} */ var viewRef = templateRef.createEmbeddedView(context || /** @type {?} */ {}); this.insert(viewRef, index); return viewRef; } /** * @template C * @param {?} componentFactory * @param {?=} index * @param {?=} injector * @param {?=} projectableNodes * @param {?=} ngModuleRef * @return {?} */ }, { key: "createComponent", value: function createComponent(componentFactory, index, injector, projectableNodes, ngModuleRef) { /** @type {?} */ var contextInjector = injector || this.parentInjector; if (!ngModuleRef && /** @type {?} */ componentFactory.ngModule == null && contextInjector) { ngModuleRef = contextInjector.get(NgModuleRef, null); } /** @type {?} */ var componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef); this.insert(componentRef.hostView, index); return componentRef; } /** * @param {?} viewRef * @param {?=} index * @return {?} */ }, { key: "insert", value: function insert(viewRef, index) { if (viewRef.destroyed) { throw new Error('Cannot insert a destroyed View in a ViewContainer!'); } this.allocateContainerIfNeeded(); /** @type {?} */ var lView = /** @type {?} */ /** @type {?} */ viewRef._lView; /** @type {?} */ var adjustedIdx = this._adjustIndex(index); if (viewAttachedToContainer(lView)) { // If view is already attached, fall back to move() so we clean up // references appropriately. return this.move(viewRef, adjustedIdx); } insertView(lView, this._lContainer, adjustedIdx); /** @type {?} */ var beforeNode = getBeforeNodeForView(adjustedIdx, this._lContainer); addRemoveViewFromContainer(lView, true, beforeNode); /** @type {?} */ viewRef.attachToViewContainerRef(this); addToArray( /** @type {?} */ this._lContainer[VIEW_REFS], adjustedIdx, viewRef); return viewRef; } /** * @param {?} viewRef * @param {?} newIndex * @return {?} */ }, { key: "move", value: function move(viewRef, newIndex) { if (viewRef.destroyed) { throw new Error('Cannot move a destroyed View in a ViewContainer!'); } /** @type {?} */ var index = this.indexOf(viewRef); if (index !== -1) this.detach(index); this.insert(viewRef, newIndex); return viewRef; } /** * @param {?} viewRef * @return {?} */ }, { key: "indexOf", value: function indexOf(viewRef) { return this._lContainer[VIEW_REFS] !== null ? /** @type {?} */ this._lContainer[VIEW_REFS].indexOf(viewRef) : 0; } /** * @param {?=} index * @return {?} */ }, { key: "remove", value: function remove(index) { this.allocateContainerIfNeeded(); /** @type {?} */ var adjustedIdx = this._adjustIndex(index, -1); removeView(this._lContainer, adjustedIdx); removeFromArray( /** @type {?} */ this._lContainer[VIEW_REFS], adjustedIdx); } /** * @param {?=} index * @return {?} */ }, { key: "detach", value: function detach(index) { this.allocateContainerIfNeeded(); /** @type {?} */ var adjustedIdx = this._adjustIndex(index, -1); /** @type {?} */ var view = detachView(this._lContainer, adjustedIdx); /** @type {?} */ var wasDetached = view && removeFromArray( /** @type {?} */ this._lContainer[VIEW_REFS], adjustedIdx) != null; return wasDetached ? new ViewRef( /** @type {?} */ view, /** @type {?} */ view[CONTEXT], -1) : null; } /** * @private * @param {?=} index * @param {?=} shift * @return {?} */ }, { key: "_adjustIndex", value: function _adjustIndex(index) { var shift = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; if (index == null) { return this.length + shift; } if (ngDevMode) { assertGreaterThan(index, -1, 'index must be positive'); // +1 because it's legal to insert at the end. assertLessThan(index, this.length + 1 + shift, 'index'); } return index; } /** * @private * @return {?} */ }, { key: "allocateContainerIfNeeded", value: function allocateContainerIfNeeded() { if (this._lContainer[VIEW_REFS] === null) { this._lContainer[VIEW_REFS] = []; } } }, { key: "element", get: function get() { return createElementRef(ElementRefToken, this._hostTNode, this._hostView); } /** * @return {?} */ }, { key: "injector", get: function get() { return new NodeInjector(this._hostTNode, this._hostView); } /** * @deprecated No replacement * @return {?} */ }, { key: "parentInjector", get: function get() { /** @type {?} */ var parentLocation = getParentInjectorLocation(this._hostTNode, this._hostView); /** @type {?} */ var parentView = getParentInjectorView(parentLocation, this._hostView); /** @type {?} */ var parentTNode = getParentInjectorTNode(parentLocation, this._hostView, this._hostTNode); return !hasParentInjector(parentLocation) || parentTNode == null ? new NodeInjector(null, this._hostView) : new NodeInjector(parentTNode, parentView); } }, { key: "length", get: function get() { return this._lContainer.length - CONTAINER_HEADER_OFFSET; } }]); return ViewContainerRef_; }(ViewContainerRefToken); } ngDevMode && assertNodeOfPossibleTypes(hostTNode, 0 /* Container */ , 3 /* Element */ , 4 /* ElementContainer */ ); /** @type {?} */ var lContainer; /** @type {?} */ var slotValue = hostView[hostTNode.index]; if (isLContainer(slotValue)) { // If the host is a container, we don't need to create a new LContainer lContainer = slotValue; lContainer[ACTIVE_INDEX] = -1; } else { /** @type {?} */ var commentNode; // If the host is an element container, the native host element is guaranteed to be a // comment and we can reuse that comment as anchor element for the new LContainer. if (hostTNode.type === 4 /* ElementContainer */ ) { commentNode = /** @type {?} */ unwrapRNode(slotValue); } else { ngDevMode && ngDevMode.rendererCreateComment++; commentNode = hostView[RENDERER].createComment(ngDevMode ? 'container' : ''); } // A container can be created on the root (topmost / bootstrapped) component and in this case we // can't use LTree to insert container's marker node (both parent of a comment node and the // commend node itself is located outside of elements hold by LTree). In this specific case we // use low-level DOM manipulation to insert container's marker (comment) node. if (isRootView(hostView)) { /** @type {?} */ var renderer = hostView[RENDERER]; /** @type {?} */ var hostNative = /** @type {?} */ getNativeByTNode(hostTNode, hostView); /** @type {?} */ var parentOfHostNative = nativeParentNode(renderer, hostNative); nativeInsertBefore(renderer, /** @type {?} */ parentOfHostNative, commentNode, nativeNextSibling(renderer, hostNative)); } else { appendChild(commentNode, hostTNode, hostView); } hostView[hostTNode.index] = lContainer = createLContainer(slotValue, hostView, commentNode, hostTNode, true); addToViewTree(hostView, lContainer); } return new R3ViewContainerRef(lContainer, hostTNode, hostView); } /** * Returns a ChangeDetectorRef (a.k.a. a ViewRef) * @param {?=} isPipe * @return {?} */ function injectChangeDetectorRef() { var isPipe = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; return createViewRef(getPreviousOrParentTNode(), getLView(), isPipe); } /** * Creates a ViewRef and stores it on the injector as ChangeDetectorRef (public alias). * * @param {?} hostTNode The node that is requesting a ChangeDetectorRef * @param {?} hostView The view to which the node belongs * @param {?} isPipe Whether the view is being injected into a pipe. * @return {?} The ChangeDetectorRef to use */ function createViewRef(hostTNode, hostView, isPipe) { if (isComponent(hostTNode) && !isPipe) { /** @type {?} */ var componentIndex = hostTNode.directiveStart; /** @type {?} */ var componentView = getComponentViewByIndex(hostTNode.index, hostView); return new ViewRef(componentView, null, componentIndex); } else if (hostTNode.type === 3 /* Element */ || hostTNode.type === 0 /* Container */ || hostTNode.type === 4 /* ElementContainer */ ) { /** @type {?} */ var hostComponentView = findComponentView(hostView); return new ViewRef(hostComponentView, hostComponentView[CONTEXT], -1); } return ( /** @type {?} */ null ); } /** * Returns a Renderer2 (or throws when application was bootstrapped with Renderer3) * @param {?} view * @return {?} */ function getOrCreateRenderer2(view) { /** @type {?} */ var renderer = view[RENDERER]; if (isProceduralRenderer(renderer)) { return ( /** @type {?} */ renderer ); } else { throw new Error('Cannot inject Renderer2 when the application uses Renderer3!'); } } /** * Injects a Renderer2 for the current component. * @return {?} */ function injectRenderer2() { // We need the Renderer to be based on the component that it's being injected into, however since // DI happens before we've entered its view, `getLView` will return the parent view instead. /** @type {?} */ var lView = getLView(); /** @type {?} */ var tNode = getPreviousOrParentTNode(); /** @type {?} */ var nodeAtIndex = getComponentViewByIndex(tNode.index, lView); return getOrCreateRenderer2(isLView(nodeAtIndex) ? nodeAtIndex : lView); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Base class for Angular Views, provides change detection functionality. * A change-detection tree collects all views that are to be checked for changes. * Use the methods to add and remove views from the tree, initiate change-detection, * and explicitly mark views as _dirty_, meaning that they have changed and need to be rerendered. * * \@usageNotes * * The following examples demonstrate how to modify default change-detection behavior * to perform explicit detection when needed. * * ### Use `markForCheck()` with `CheckOnce` strategy * * The following example sets the `OnPush` change-detection strategy for a component * (`CheckOnce`, rather than the default `CheckAlways`), then forces a second check * after an interval. See [live demo](http://plnkr.co/edit/GC512b?p=preview). * * <code-example path="core/ts/change_detect/change-detection.ts" * region="mark-for-check"></code-example> * * ### Detach change detector to limit how often check occurs * * The following example defines a component with a large list of read-only data * that is expected to change constantly, many times per second. * To improve performance, we want to check and update the list * less often than the changes actually occur. To do that, we detach * the component's change detector and perform an explicit local check every five seconds. * * <code-example path="core/ts/change_detect/change-detection.ts" region="detach"></code-example> * * * ### Reattaching a detached component * * The following example creates a component displaying live data. * The component detaches its change detector from the main change detector tree * when the `live` property is set to false, and reattaches it when the property * becomes true. * * <code-example path="core/ts/change_detect/change-detection.ts" region="reattach"></code-example> * * \@publicApi * @abstract */ var ChangeDetectorRef = function ChangeDetectorRef() { _classCallCheck(this, ChangeDetectorRef); }; /** * \@internal * @nocollapse */ ChangeDetectorRef.__NG_ELEMENT_ID__ = /** * @return {?} */ function () { return SWITCH_CHANGE_DETECTOR_REF_FACTORY(); }; if (false) {} /** @type {?} */ var SWITCH_CHANGE_DETECTOR_REF_FACTORY__POST_R3__ = injectChangeDetectorRef; /** @type {?} */ var SWITCH_CHANGE_DETECTOR_REF_FACTORY__PRE_R3__ = /** * @param {...?} args * @return {?} */ function SWITCH_CHANGE_DETECTOR_REF_FACTORY__PRE_R3__() {}; var ɵ0$6 = SWITCH_CHANGE_DETECTOR_REF_FACTORY__PRE_R3__; /** @type {?} */ var SWITCH_CHANGE_DETECTOR_REF_FACTORY = SWITCH_CHANGE_DETECTOR_REF_FACTORY__PRE_R3__; /** * @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 */ /** * @description * * Represents a type that a Component or other object is instances of. * * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by * the `MyCustomComponent` constructor function. * * @publicApi */ var Type = Function; function isType(v) { return typeof v === 'function'; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Attention: These regex has to hold even if the code is minified! */ var DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*arguments\)/; var INHERITED_CLASS = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{/; var INHERITED_CLASS_WITH_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(/; var INHERITED_CLASS_WITH_DELEGATE_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[^{]+{[\s\S]*constructor\s*\(\)\s*{\s+super\(\.\.\.arguments\)/; /** * Determine whether a stringified type is a class which delegates its constructor * to its parent. * * This is not trivial since compiled code can actually contain a constructor function * even if the original source code did not. For instance, when the child class contains * an initialized instance property. */ function isDelegateCtor(typeStr) { return DELEGATE_CTOR.test(typeStr) || INHERITED_CLASS_WITH_DELEGATE_CTOR.test(typeStr) || INHERITED_CLASS.test(typeStr) && !INHERITED_CLASS_WITH_CTOR.test(typeStr); } var ReflectionCapabilities = /*#__PURE__*/function () { function ReflectionCapabilities(reflect) { _classCallCheck(this, ReflectionCapabilities); this._reflect = reflect || _global['Reflect']; } _createClass2(ReflectionCapabilities, [{ key: "isReflectionEnabled", value: function isReflectionEnabled() { return true; } }, { key: "factory", value: function factory(t) { return function () { for (var _len15 = arguments.length, args = new Array(_len15), _key16 = 0; _key16 < _len15; _key16++) { args[_key16] = arguments[_key16]; } return _construct(t, args); }; } /** @internal */ }, { key: "_zipTypesAndAnnotations", value: function _zipTypesAndAnnotations(paramTypes, paramAnnotations) { var result; if (typeof paramTypes === 'undefined') { result = new Array(paramAnnotations.length); } else { result = new Array(paramTypes.length); } for (var i = 0; i < result.length; i++) { // TS outputs Object for parameters without types, while Traceur omits // the annotations. For now we preserve the Traceur behavior to aid // migration, but this can be revisited. if (typeof paramTypes === 'undefined') { result[i] = []; } else if (paramTypes[i] && paramTypes[i] != Object) { result[i] = [paramTypes[i]]; } else { result[i] = []; } if (paramAnnotations && paramAnnotations[i] != null) { result[i] = result[i].concat(paramAnnotations[i]); } } return result; } }, { key: "_ownParameters", value: function _ownParameters(type, parentCtor) { var typeStr = type.toString(); // If we have no decorators, we only have function.length as metadata. // In that case, to detect whether a child class declared an own constructor or not, // we need to look inside of that constructor to check whether it is // just calling the parent. // This also helps to work around for https://github.com/Microsoft/TypeScript/issues/12439 // that sets 'design:paramtypes' to [] // if a class inherits from another class but has no ctor declared itself. if (isDelegateCtor(typeStr)) { return null; } // Prefer the direct API. if (type.parameters && type.parameters !== parentCtor.parameters) { return type.parameters; } // API of tsickle for lowering decorators to properties on the class. var tsickleCtorParams = type.ctorParameters; if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) { // Newer tsickle uses a function closure // Retain the non-function case for compatibility with older tsickle var ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams; var _paramTypes = ctorParameters.map(function (ctorParam) { return ctorParam && ctorParam.type; }); var _paramAnnotations = ctorParameters.map(function (ctorParam) { return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators); }); return this._zipTypesAndAnnotations(_paramTypes, _paramAnnotations); } // API for metadata created by invoking the decorators. var paramAnnotations = type.hasOwnProperty(PARAMETERS) && type[PARAMETERS]; var paramTypes = this._reflect && this._reflect.getOwnMetadata && this._reflect.getOwnMetadata('design:paramtypes', type); if (paramTypes || paramAnnotations) { return this._zipTypesAndAnnotations(paramTypes, paramAnnotations); } // If a class has no decorators, at least create metadata // based on function.length. // Note: We know that this is a real constructor as we checked // the content of the constructor above. return new Array(type.length).fill(undefined); } }, { key: "parameters", value: function parameters(type) { // Note: only report metadata if we have at least one class decorator // to stay in sync with the static reflector. if (!isType(type)) { return []; } var parentCtor = getParentCtor(type); var parameters = this._ownParameters(type, parentCtor); if (!parameters && parentCtor !== Object) { parameters = this.parameters(parentCtor); } return parameters || []; } }, { key: "_ownAnnotations", value: function _ownAnnotations(typeOrFunc, parentCtor) { // Prefer the direct API. if (typeOrFunc.annotations && typeOrFunc.annotations !== parentCtor.annotations) { var annotations = typeOrFunc.annotations; if (typeof annotations === 'function' && annotations.annotations) { annotations = annotations.annotations; } return annotations; } // API of tsickle for lowering decorators to properties on the class. if (typeOrFunc.decorators && typeOrFunc.decorators !== parentCtor.decorators) { return convertTsickleDecoratorIntoMetadata(typeOrFunc.decorators); } // API for metadata created by invoking the decorators. if (typeOrFunc.hasOwnProperty(ANNOTATIONS)) { return typeOrFunc[ANNOTATIONS]; } return null; } }, { key: "annotations", value: function annotations(typeOrFunc) { if (!isType(typeOrFunc)) { return []; } var parentCtor = getParentCtor(typeOrFunc); var ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || []; var parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : []; return parentAnnotations.concat(ownAnnotations); } }, { key: "_ownPropMetadata", value: function _ownPropMetadata(typeOrFunc, parentCtor) { // Prefer the direct API. if (typeOrFunc.propMetadata && typeOrFunc.propMetadata !== parentCtor.propMetadata) { var propMetadata = typeOrFunc.propMetadata; if (typeof propMetadata === 'function' && propMetadata.propMetadata) { propMetadata = propMetadata.propMetadata; } return propMetadata; } // API of tsickle for lowering decorators to properties on the class. if (typeOrFunc.propDecorators && typeOrFunc.propDecorators !== parentCtor.propDecorators) { var propDecorators = typeOrFunc.propDecorators; var _propMetadata = {}; Object.keys(propDecorators).forEach(function (prop) { _propMetadata[prop] = convertTsickleDecoratorIntoMetadata(propDecorators[prop]); }); return _propMetadata; } // API for metadata created by invoking the decorators. if (typeOrFunc.hasOwnProperty(PROP_METADATA)) { return typeOrFunc[PROP_METADATA]; } return null; } }, { key: "propMetadata", value: function propMetadata(typeOrFunc) { if (!isType(typeOrFunc)) { return {}; } var parentCtor = getParentCtor(typeOrFunc); var propMetadata = {}; if (parentCtor !== Object) { var parentPropMetadata = this.propMetadata(parentCtor); Object.keys(parentPropMetadata).forEach(function (propName) { propMetadata[propName] = parentPropMetadata[propName]; }); } var ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor); if (ownPropMetadata) { Object.keys(ownPropMetadata).forEach(function (propName) { var decorators = []; if (propMetadata.hasOwnProperty(propName)) { decorators.push.apply(decorators, _toConsumableArray(propMetadata[propName])); } decorators.push.apply(decorators, _toConsumableArray(ownPropMetadata[propName])); propMetadata[propName] = decorators; }); } return propMetadata; } }, { key: "ownPropMetadata", value: function ownPropMetadata(typeOrFunc) { if (!isType(typeOrFunc)) { return {}; } return this._ownPropMetadata(typeOrFunc, getParentCtor(typeOrFunc)) || {}; } }, { key: "hasLifecycleHook", value: function hasLifecycleHook(type, lcProperty) { return type instanceof Type && lcProperty in type.prototype; } }, { key: "guards", value: function guards(type) { return {}; } }, { key: "getter", value: function getter(name) { return new Function('o', 'return o.' + name + ';'); } }, { key: "setter", value: function setter(name) { return new Function('o', 'v', 'return o.' + name + ' = v;'); } }, { key: "method", value: function method(name) { var functionBody = "if (!o.".concat(name, ") throw new Error('\"").concat(name, "\" is undefined');\n return o.").concat(name, ".apply(o, args);"); return new Function('o', 'args', functionBody); } // There is not a concept of import uri in Js, but this is useful in developing Dart applications. }, { key: "importUri", value: function importUri(type) { // StaticSymbol if (typeof type === 'object' && type['filePath']) { return type['filePath']; } // Runtime type return "./".concat(stringify(type)); } }, { key: "resourceUri", value: function resourceUri(type) { return "./".concat(stringify(type)); } }, { key: "resolveIdentifier", value: function resolveIdentifier(name, moduleUrl, members, runtime) { return runtime; } }, { key: "resolveEnum", value: function resolveEnum(enumIdentifier, name) { return enumIdentifier[name]; } }]); return ReflectionCapabilities; }(); function convertTsickleDecoratorIntoMetadata(decoratorInvocations) { if (!decoratorInvocations) { return []; } return decoratorInvocations.map(function (decoratorInvocation) { var decoratorType = decoratorInvocation.type; var annotationCls = decoratorType.annotationCls; var annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : []; return _construct(annotationCls, _toConsumableArray(annotationArgs)); }); } function getParentCtor(ctor) { var parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null; var parentCtor = parentProto ? parentProto.constructor : null; // Note: We always use `Object` as the null value // to simplify checking later on. return parentCtor || Object; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var _reflect = null; /** * @return {?} */ function getReflect() { return _reflect = _reflect || new ReflectionCapabilities(); } /** * @param {?} type * @return {?} */ function reflectDependencies(type) { return convertDependencies(getReflect().parameters(type)); } /** * @param {?} deps * @return {?} */ function convertDependencies(deps) { /** @type {?} */ var compiler = getCompilerFacade(); return deps.map( /** * @param {?} dep * @return {?} */ function (dep) { return reflectDependency(compiler, dep); }); } /** * @param {?} compiler * @param {?} dep * @return {?} */ function reflectDependency(compiler, dep) { /** @type {?} */ var meta = { token: null, host: false, optional: false, resolved: compiler.R3ResolvedDependencyType.Token, self: false, skipSelf: false }; /** * @param {?} token * @return {?} */ function setTokenAndResolvedType(token) { meta.resolved = compiler.R3ResolvedDependencyType.Token; meta.token = token; } if (Array.isArray(dep)) { if (dep.length === 0) { throw new Error('Dependency array must have arguments.'); } for (var j = 0; j < dep.length; j++) { /** @type {?} */ var param = dep[j]; if (param === undefined) { // param may be undefined if type of dep is not set by ngtsc continue; } else if (param instanceof Optional || param.__proto__.ngMetadataName === 'Optional') { meta.optional = true; } else if (param instanceof SkipSelf || param.__proto__.ngMetadataName === 'SkipSelf') { meta.skipSelf = true; } else if (param instanceof Self || param.__proto__.ngMetadataName === 'Self') { meta.self = true; } else if (param instanceof Host || param.__proto__.ngMetadataName === 'Host') { meta.host = true; } else if (param instanceof Inject) { meta.token = param.token; } else if (param instanceof Attribute) { if (param.attributeName === undefined) { throw new Error("Attribute name must be defined."); } meta.token = param.attributeName; meta.resolved = compiler.R3ResolvedDependencyType.Attribute; } else if (param === ChangeDetectorRef) { meta.token = param; meta.resolved = compiler.R3ResolvedDependencyType.ChangeDetectorRef; } else { setTokenAndResolvedType(param); } } } else { setTokenAndResolvedType(dep); } return meta; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Compile an Angular injectable according to its `Injectable` metadata, and patch the resulting * `ngInjectableDef` onto the injectable type. * @param {?} type * @param {?=} srcMeta * @return {?} */ function compileInjectable(type, srcMeta) { /** @type {?} */ var def = null; // if NG_INJECTABLE_DEF is already defined on this class then don't overwrite it if (type.hasOwnProperty(NG_INJECTABLE_DEF)) return; Object.defineProperty(type, NG_INJECTABLE_DEF, { get: /** * @return {?} */ function get() { if (def === null) { // Allow the compilation of a class with a `@Injectable()` decorator without parameters /** @type {?} */ var meta = srcMeta || { providedIn: null }; /** @type {?} */ var hasAProvider = isUseClassProvider(meta) || isUseFactoryProvider(meta) || isUseValueProvider(meta) || isUseExistingProvider(meta); /** @type {?} */ var compilerMeta = { name: type.name, type: type, typeArgumentCount: 0, providedIn: meta.providedIn, ctorDeps: reflectDependencies(type), userDeps: undefined }; if ((isUseClassProvider(meta) || isUseFactoryProvider(meta)) && meta.deps !== undefined) { compilerMeta.userDeps = convertDependencies(meta.deps); } if (!hasAProvider) { // In the case the user specifies a type provider, treat it as {provide: X, useClass: X}. // The deps will have been reflected above, causing the factory to create the class by // calling // its constructor with injected deps. compilerMeta.useClass = type; } else if (isUseClassProvider(meta)) { // The user explicitly specified useClass, and may or may not have provided deps. compilerMeta.useClass = meta.useClass; } else if (isUseValueProvider(meta)) { // The user explicitly specified useValue. compilerMeta.useValue = meta.useValue; } else if (isUseFactoryProvider(meta)) { // The user explicitly specified useFactory. compilerMeta.useFactory = meta.useFactory; } else if (isUseExistingProvider(meta)) { // The user explicitly specified useExisting. compilerMeta.useExisting = meta.useExisting; } else { // Can't happen - either hasAProvider will be false, or one of the providers will be set. throw new Error("Unreachable state."); } def = getCompilerFacade().compileInjectable(angularCoreDiEnv, "ng:///".concat(type.name, "/ngInjectableDef.js"), compilerMeta); } return def; } }); } var ɵ0$7 = getClosureSafeProperty; /** @type {?} */ var USE_VALUE$1 = getClosureSafeProperty({ provide: String, useValue: ɵ0$7 }); /** * @param {?} meta * @return {?} */ function isUseClassProvider(meta) { return ( /** @type {?} */ meta.useClass !== undefined ); } /** * @param {?} meta * @return {?} */ function isUseValueProvider(meta) { return USE_VALUE$1 in meta; } /** * @param {?} meta * @return {?} */ function isUseFactoryProvider(meta) { return ( /** @type {?} */ meta.useFactory !== undefined ); } /** * @param {?} meta * @return {?} */ function isUseExistingProvider(meta) { return ( /** @type {?} */ meta.useExisting !== undefined ); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ɵ0$8 = getClosureSafeProperty; /** @type {?} */ var USE_VALUE$2 = getClosureSafeProperty({ provide: String, useValue: ɵ0$8 }); /** @type {?} */ var EMPTY_ARRAY$1 = []; /** * @param {?} type * @param {?=} provider * @return {?} */ function convertInjectableProviderToFactory(type, provider) { if (!provider) { /** @type {?} */ var reflectionCapabilities = new ReflectionCapabilities(); /** @type {?} */ var deps = reflectionCapabilities.parameters(type); // TODO - convert to flags. return ( /** * @return {?} */ function () { return _construct(type, _toConsumableArray(injectArgs( /** @type {?} */ deps))); } ); } if (USE_VALUE$2 in provider) { /** @type {?} */ var valueProvider = /** @type {?} */ provider; return ( /** * @return {?} */ function () { return valueProvider.useValue; } ); } else if ( /** @type {?} */ provider.useExisting) { /** @type {?} */ var existingProvider = /** @type {?} */ provider; return ( /** * @return {?} */ function () { return ɵɵinject(existingProvider.useExisting); } ); } else if ( /** @type {?} */ provider.useFactory) { /** @type {?} */ var factoryProvider = /** @type {?} */ provider; return ( /** * @return {?} */ function () { return factoryProvider.useFactory.apply(factoryProvider, _toConsumableArray(injectArgs(factoryProvider.deps || EMPTY_ARRAY$1))); } ); } else if ( /** @type {?} */ provider.useClass) { /** @type {?} */ var classProvider = /** @type {?} */ provider; /** @type {?} */ var _deps3 = /** @type {?} */ provider.deps; if (!_deps3) { /** @type {?} */ var _reflectionCapabilities = new ReflectionCapabilities(); _deps3 = _reflectionCapabilities.parameters(type); } return ( /** * @return {?} */ function () { return _construct(classProvider.useClass, _toConsumableArray(injectArgs(_deps3))); } ); } else { /** @type {?} */ var _deps4 = /** @type {?} */ provider.deps; if (!_deps4) { /** @type {?} */ var _reflectionCapabilities2 = new ReflectionCapabilities(); _deps4 = _reflectionCapabilities2.parameters(type); } return ( /** * @return {?} */ function () { return _construct(type, _toConsumableArray(injectArgs( /** @type {?} */ _deps4))); } ); } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Type of the Injectable decorator / constructor function. * * \@publicApi * @record */ function InjectableDecorator() {} // WARNING: interface has both a type and a value, skipping emit var ɵ0$9 = /** * @param {?} type * @param {?} meta * @return {?} */ function ɵ0$9(type, meta) { return SWITCH_COMPILE_INJECTABLE( /** @type {?} */ type, meta); }; /** * Injectable decorator and metadata. * * \@Annotation * \@publicApi * @type {?} */ var Injectable = makeDecorator('Injectable', undefined, undefined, undefined, ɵ0$9); /** * Type representing injectable service. * * \@publicApi * @record * @template T */ function InjectableType() {} if (false) {} /** * Supports \@Injectable() in JIT mode for Render2. * @param {?} injectableType * @param {?=} options * @return {?} */ function render2CompileInjectable(injectableType, options) { if (options && options.providedIn !== undefined && !getInjectableDef(injectableType)) { /** @type {?} */ injectableType.ngInjectableDef = ɵɵdefineInjectable({ token: injectableType, providedIn: options.providedIn, factory: convertInjectableProviderToFactory(injectableType, options) }); } } /** @type {?} */ var SWITCH_COMPILE_INJECTABLE__POST_R3__ = compileInjectable; /** @type {?} */ var SWITCH_COMPILE_INJECTABLE__PRE_R3__ = render2CompileInjectable; /** @type {?} */ var SWITCH_COMPILE_INJECTABLE = SWITCH_COMPILE_INJECTABLE__PRE_R3__; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * An internal token whose presence in an injector indicates that the injector should treat itself * as a root scoped injector when processing requests for unknown tokens which may indicate * they are provided in the root scope. * @type {?} */ var APP_ROOT = new InjectionToken('The presence of this token marks an injector as being the root injector.'); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Marker which indicates that a value has not yet been created from the factory function. * @type {?} */ var NOT_YET = {}; /** * Marker which indicates that the factory function for a token is in the process of being called. * * If the injector is asked to inject a token with its value set to CIRCULAR, that indicates * injection of a dependency has recursively attempted to inject the original token, and there is * a circular dependency among the providers. * @type {?} */ var CIRCULAR = {}; /** @type {?} */ var EMPTY_ARRAY$2 = /** @type {?} */ []; /** * A lazily initialized NullInjector. * @type {?} */ var NULL_INJECTOR = undefined; /** * @return {?} */ function getNullInjector() { if (NULL_INJECTOR === undefined) { NULL_INJECTOR = new NullInjector(); } return NULL_INJECTOR; } /** * An entry in the injector which tracks information about the given token, including a possible * current value. * @record * @template T */ function Record() {} if (false) {} /** * Create a new `Injector` which is configured using a `defType` of `InjectorType<any>`s. * * \@publicApi * @param {?} defType * @param {?=} parent * @param {?=} additionalProviders * @param {?=} name * @return {?} */ function createInjector(defType) { var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; var additionalProviders = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var name = arguments.length > 3 ? arguments[3] : undefined; parent = parent || getNullInjector(); return new R3Injector(defType, additionalProviders, parent, name); } var R3Injector = /*#__PURE__*/function () { /** * @param {?} def * @param {?} additionalProviders * @param {?} parent * @param {?=} source */ function R3Injector(def, additionalProviders, parent) { var _this325 = this; var source = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; _classCallCheck(this, R3Injector); this.parent = parent; /** * Map of tokens to records which contain the instances of those tokens. */ this.records = new Map(); /** * The transitive set of `InjectorType`s which define this injector. */ this.injectorDefTypes = new Set(); /** * Set of values instantiated by this injector which contain `ngOnDestroy` lifecycle hooks. */ this.onDestroy = new Set(); this._destroyed = false; // Start off by creating Records for every provider declared in every InjectorType // included transitively in `def`. /** @type {?} */ var dedupStack = []; deepForEach([def], /** * @param {?} injectorDef * @return {?} */ function (injectorDef) { return _this325.processInjectorType(injectorDef, [], dedupStack); }); additionalProviders && deepForEach(additionalProviders, /** * @param {?} provider * @return {?} */ function (provider) { return _this325.processProvider(provider, def, additionalProviders); }); // Make sure the INJECTOR token provides this injector. this.records.set(INJECTOR, makeRecord(undefined, this)); // Detect whether this injector has the APP_ROOT_SCOPE token and thus should provide // any injectable scoped to APP_ROOT_SCOPE. this.isRootInjector = this.records.has(APP_ROOT); // Eagerly instantiate the InjectorType classes themselves. this.injectorDefTypes.forEach( /** * @param {?} defType * @return {?} */ function (defType) { return _this325.get(defType); }); // Source name, used for debugging this.source = source || (typeof def === 'object' ? null : stringify(def)); } /** * Flag indicating that this injector was previously destroyed. * @return {?} */ _createClass2(R3Injector, [{ key: "destroy", /** * Destroy the injector and release references to every instance or provider associated with it. * * Also calls the `OnDestroy` lifecycle hooks of every instance that was created for which a * hook was found. * @return {?} */ value: function destroy() { this.assertNotDestroyed(); // Set destroyed = true first, in case lifecycle hooks re-enter destroy(). this._destroyed = true; try { // Call all the lifecycle hooks. this.onDestroy.forEach( /** * @param {?} service * @return {?} */ function (service) { return service.ngOnDestroy(); }); } finally { // Release all references. this.records.clear(); this.onDestroy.clear(); this.injectorDefTypes.clear(); } } /** * @template T * @param {?} token * @param {?=} notFoundValue * @param {?=} flags * @return {?} */ }, { key: "get", value: function get(token) { var notFoundValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : THROW_IF_NOT_FOUND; var flags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : InjectFlags.Default; this.assertNotDestroyed(); // Set the injection context. /** @type {?} */ var previousInjector = setCurrentInjector(this); try { // Check for the SkipSelf flag. if (!(flags & InjectFlags.SkipSelf)) { // SkipSelf isn't set, check if the record belongs to this injector. /** @type {?} */ var record = this.records.get(token); if (record === undefined) { // No record, but maybe the token is scoped to this injector. Look for an ngInjectableDef // with a scope matching this injector. /** @type {?} */ var def = couldBeInjectableType(token) && getInjectableDef(token); if (def && this.injectableDefInScope(def)) { // Found an ngInjectableDef and it's scoped to this injector. Pretend as if it was here // all along. record = makeRecord(injectableDefOrInjectorDefFactory(token), NOT_YET); this.records.set(token, record); } } // If a record was found, get the instance for it and return it. if (record !== undefined) { return this.hydrate(token, record); } } // Select the next injector based on the Self flag - if self is set, the next injector is // the NullInjector, otherwise it's the parent. /** @type {?} */ var nextInjector = !(flags & InjectFlags.Self) ? this.parent : getNullInjector(); return nextInjector.get(token, flags & InjectFlags.Optional ? null : notFoundValue); } catch (e) { if (e.name === 'NullInjectorError') { /** @type {?} */ var path = e[NG_TEMP_TOKEN_PATH] = e[NG_TEMP_TOKEN_PATH] || []; path.unshift(stringify(token)); if (previousInjector) { // We still have a parent injector, keep throwing throw e; } else { // Format & throw the final error message when we don't have any previous injector return catchInjectorError(e, token, 'R3InjectorError', this.source); } } else { throw e; } } finally { // Lastly, clean up the state by restoring the previous injector. setCurrentInjector(previousInjector); } } /** * @return {?} */ }, { key: "toString", value: function toString() { /** @type {?} */ var tokens = /** @type {?} */ []; /** @type {?} */ var records = this.records; records.forEach( /** * @param {?} v * @param {?} token * @return {?} */ function (v, token) { return tokens.push(stringify(token)); }); return "R3Injector[".concat(tokens.join(', '), "]"); } /** * @private * @return {?} */ }, { key: "assertNotDestroyed", value: function assertNotDestroyed() { if (this._destroyed) { throw new Error('Injector has already been destroyed.'); } } /** * Add an `InjectorType` or `InjectorTypeWithProviders` and all of its transitive providers * to this injector. * * If an `InjectorTypeWithProviders` that declares providers besides the type is specified, * the function will return "true" to indicate that the providers of the type definition need * to be processed. This allows us to process providers of injector types after all imports of * an injector definition are processed. (following View Engine semantics: see FW-1349) * @private * @param {?} defOrWrappedDef * @param {?} parents * @param {?} dedupStack * @return {?} */ }, { key: "processInjectorType", value: function processInjectorType(defOrWrappedDef, parents, dedupStack) { var _this326 = this; defOrWrappedDef = resolveForwardRef(defOrWrappedDef); if (!defOrWrappedDef) return false; // Either the defOrWrappedDef is an InjectorType (with ngInjectorDef) or an // InjectorDefTypeWithProviders (aka ModuleWithProviders). Detecting either is a megamorphic // read, so care is taken to only do the read once. // First attempt to read the ngInjectorDef. /** @type {?} */ var def = getInjectorDef(defOrWrappedDef); // If that's not present, then attempt to read ngModule from the InjectorDefTypeWithProviders. /** @type {?} */ var ngModule = def == null && /** @type {?} */ defOrWrappedDef.ngModule || undefined; // Determine the InjectorType. In the case where `defOrWrappedDef` is an `InjectorType`, // then this is easy. In the case of an InjectorDefTypeWithProviders, then the definition type // is the `ngModule`. /** @type {?} */ var defType = ngModule === undefined ? /** @type {?} */ defOrWrappedDef : ngModule; // Check for circular dependencies. if (ngDevMode && parents.indexOf(defType) !== -1) { /** @type {?} */ var defName = stringify(defType); throw new Error("Circular dependency in DI detected for type ".concat(defName, ". Dependency path: ").concat(parents.map( /** * @param {?} defType * @return {?} */ function (defType) { return stringify(defType); }).join(' > '), " > ").concat(defName, ".")); } // Check for multiple imports of the same module /** @type {?} */ var isDuplicate = dedupStack.indexOf(defType) !== -1; // Finally, if defOrWrappedType was an `InjectorDefTypeWithProviders`, then the actual // `InjectorDef` is on its `ngModule`. if (ngModule !== undefined) { def = getInjectorDef(ngModule); } // If no definition was found, it might be from exports. Remove it. if (def == null) { return false; } // Track the InjectorType and add a provider for it. this.injectorDefTypes.add(defType); this.records.set(defType, makeRecord(def.factory, NOT_YET)); // Add providers in the same way that @NgModule resolution did: // First, include providers from any imports. if (def.imports != null && !isDuplicate) { // Before processing defType's imports, add it to the set of parents. This way, if it ends // up deeply importing itself, this can be detected. ngDevMode && parents.push(defType); // Add it to the set of dedups. This way we can detect multiple imports of the same module dedupStack.push(defType); /** @type {?} */ var importTypesWithProviders; try { deepForEach(def.imports, /** * @param {?} imported * @return {?} */ function (imported) { if (_this326.processInjectorType(imported, parents, dedupStack)) { if (importTypesWithProviders === undefined) importTypesWithProviders = []; // If the processed import is an injector type with providers, we store it in the // list of import types with providers, so that we can process those afterwards. importTypesWithProviders.push(imported); } }); } finally { // Remove it from the parents set when finished. ngDevMode && parents.pop(); } // Imports which are declared with providers (TypeWithProviders) need to be processed // after all imported modules are processed. This is similar to how View Engine // processes/merges module imports in the metadata resolver. See: FW-1349. if (importTypesWithProviders !== undefined) { var _loop4 = function _loop4(i) { var _importTypesWithProvi = importTypesWithProviders[i], ngModule = _importTypesWithProvi.ngModule, providers = _importTypesWithProvi.providers; deepForEach( /** @type {?} */ providers, /** * @param {?} provider * @return {?} */ function (provider) { return _this326.processProvider(provider, ngModule, providers || EMPTY_ARRAY$2); }); }; for (var i = 0; i < importTypesWithProviders.length; i++) { _loop4(i); } } } // Next, include providers listed on the definition itself. /** @type {?} */ var defProviders = def.providers; if (defProviders != null && !isDuplicate) { /** @type {?} */ var injectorType = /** @type {?} */ defOrWrappedDef; deepForEach(defProviders, /** * @param {?} provider * @return {?} */ function (provider) { return _this326.processProvider(provider, injectorType, defProviders); }); } return ngModule !== undefined && /** @type {?} */ defOrWrappedDef.providers !== undefined; } /** * Process a `SingleProvider` and add it. * @private * @param {?} provider * @param {?} ngModuleType * @param {?} providers * @return {?} */ }, { key: "processProvider", value: function processProvider(provider, ngModuleType, providers) { // Determine the token from the provider. Either it's its own token, or has a {provide: ...} // property. provider = resolveForwardRef(provider); /** @type {?} */ var token = isTypeProvider(provider) ? provider : resolveForwardRef(provider && provider.provide); // Construct a `Record` for the provider. /** @type {?} */ var record = providerToRecord(provider, ngModuleType, providers); if (!isTypeProvider(provider) && provider.multi === true) { // If the provider indicates that it's a multi-provider, process it specially. // First check whether it's been defined already. /** @type {?} */ var multiRecord = this.records.get(token); if (multiRecord) { // It has. Throw a nice error if if (multiRecord.multi === undefined) { throwMixedMultiProviderError(); } } else { multiRecord = makeRecord(undefined, NOT_YET, true); multiRecord.factory = /** * @return {?} */ function () { return injectArgs( /** @type {?} */ /** @type {?} */ multiRecord.multi); }; this.records.set(token, multiRecord); } token = provider; /** @type {?} */ multiRecord.multi.push(provider); } else { /** @type {?} */ var existing = this.records.get(token); if (existing && existing.multi !== undefined) { throwMixedMultiProviderError(); } } this.records.set(token, record); } /** * @private * @template T * @param {?} token * @param {?} record * @return {?} */ }, { key: "hydrate", value: function hydrate(token, record) { if (record.value === CIRCULAR) { throwCyclicDependencyError(stringify(token)); } else if (record.value === NOT_YET) { record.value = CIRCULAR; record.value = /** @type {?} */ record.factory(); } if (typeof record.value === 'object' && record.value && hasOnDestroy(record.value)) { this.onDestroy.add(record.value); } return ( /** @type {?} */ record.value ); } /** * @private * @param {?} def * @return {?} */ }, { key: "injectableDefInScope", value: function injectableDefInScope(def) { if (!def.providedIn) { return false; } else if (typeof def.providedIn === 'string') { return def.providedIn === 'any' || def.providedIn === 'root' && this.isRootInjector; } else { return this.injectorDefTypes.has(def.providedIn); } } }, { key: "destroyed", get: function get() { return this._destroyed; } }]); return R3Injector; }(); if (false) {} /** * @param {?} token * @return {?} */ function injectableDefOrInjectorDefFactory(token) { // Most tokens will have an ngInjectableDef directly on them, which specifies a factory directly. /** @type {?} */ var injectableDef = getInjectableDef(token); if (injectableDef !== null) { return injectableDef.factory; } // If the token is an NgModule, it's also injectable but the factory is on its ngInjectorDef. /** @type {?} */ var injectorDef = getInjectorDef(token); if (injectorDef !== null) { return injectorDef.factory; } // InjectionTokens should have an ngInjectableDef and thus should be handled above. // If it's missing that, it's an error. if (token instanceof InjectionToken) { throw new Error("Token ".concat(stringify(token), " is missing an ngInjectableDef definition.")); } // Undecorated types can sometimes be created if they have no constructor arguments. if (token instanceof Function) { return getUndecoratedInjectableFactory(token); } // There was no way to resolve a factory for this token. throw new Error('unreachable'); } /** * @param {?} token * @return {?} */ function getUndecoratedInjectableFactory(token) { // If the token has parameters then it has dependencies that we cannot resolve implicitly. /** @type {?} */ var paramLength = token.length; if (paramLength > 0) { /** @type {?} */ var args = new Array(paramLength).fill('?'); throw new Error("Can't resolve all parameters for ".concat(stringify(token), ": (").concat(args.join(', '), ").")); } // The constructor function appears to have no parameters. // This might be because it inherits from a super-class. In which case, use an ngInjectableDef // from an ancestor if there is one. // Otherwise this really is a simple class with no dependencies, so return a factory that // just instantiates the zero-arg constructor. /** @type {?} */ var inheritedInjectableDef = getInheritedInjectableDef(token); if (inheritedInjectableDef !== null) { return ( /** * @return {?} */ function () { return inheritedInjectableDef.factory( /** @type {?} */ token); } ); } else { return ( /** * @return {?} */ function () { return new /** @type {?} */ token(); } ); } } /** * @param {?} provider * @param {?} ngModuleType * @param {?} providers * @return {?} */ function providerToRecord(provider, ngModuleType, providers) { /** @type {?} */ var factory = providerToFactory(provider, ngModuleType, providers); if (isValueProvider(provider)) { return makeRecord(undefined, provider.useValue); } else { return makeRecord(factory, NOT_YET); } } /** * Converts a `SingleProvider` into a factory function. * * @param {?} provider provider to convert to factory * @param {?=} ngModuleType * @param {?=} providers * @return {?} */ function providerToFactory(provider, ngModuleType, providers) { /** @type {?} */ var factory = undefined; if (isTypeProvider(provider)) { return injectableDefOrInjectorDefFactory(resolveForwardRef(provider)); } else { if (isValueProvider(provider)) { factory = /** * @return {?} */ function factory() { return resolveForwardRef(provider.useValue); }; } else if (isExistingProvider(provider)) { factory = /** * @return {?} */ function factory() { return ɵɵinject(resolveForwardRef(provider.useExisting)); }; } else if (isFactoryProvider(provider)) { factory = /** * @return {?} */ function factory() { return provider.useFactory.apply(provider, _toConsumableArray(injectArgs(provider.deps || []))); }; } else { /** @type {?} */ var classRef = resolveForwardRef(provider && ( /** @type {?} */ provider.useClass || provider.provide)); if (!classRef) { throwInvalidProviderError(ngModuleType, providers, provider); } if (hasDeps(provider)) { factory = /** * @return {?} */ function factory() { return _construct(classRef, _toConsumableArray(injectArgs(provider.deps))); }; } else { return injectableDefOrInjectorDefFactory(classRef); } } } return factory; } /** * @template T * @param {?} factory * @param {?} value * @param {?=} multi * @return {?} */ function makeRecord(factory, value) { var multi = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; return { factory: factory, value: value, multi: multi ? [] : undefined }; } /** * @param {?} value * @return {?} */ function isValueProvider(value) { return value !== null && typeof value == 'object' && USE_VALUE in value; } /** * @param {?} value * @return {?} */ function isExistingProvider(value) { return !!(value && /** @type {?} */ value.useExisting); } /** * @param {?} value * @return {?} */ function isFactoryProvider(value) { return !!(value && /** @type {?} */ value.useFactory); } /** * @param {?} value * @return {?} */ function isTypeProvider(value) { return typeof value === 'function'; } /** * @param {?} value * @return {?} */ function isClassProvider(value) { return !! /** @type {?} */ value.useClass; } /** * @param {?} value * @return {?} */ function hasDeps(value) { return !! /** @type {?} */ value.deps; } /** * @param {?} value * @return {?} */ function hasOnDestroy(value) { return value !== null && typeof value === 'object' && typeof /** @type {?} */ value.ngOnDestroy === 'function'; } /** * @param {?} value * @return {?} */ function couldBeInjectableType(value) { return typeof value === 'function' || typeof value === 'object' && value instanceof InjectionToken; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} providers * @param {?} parent * @param {?} name * @return {?} */ function INJECTOR_IMPL__PRE_R3__(providers, parent, name) { return new StaticInjector(providers, parent, name); } /** * @param {?} providers * @param {?} parent * @param {?} name * @return {?} */ function INJECTOR_IMPL__POST_R3__(providers, parent, name) { return createInjector({ name: name }, parent, providers, name); } /** @type {?} */ var INJECTOR_IMPL = INJECTOR_IMPL__PRE_R3__; /** * Concrete injectors implement this interface. * * For more details, see the ["Dependency Injection Guide"](guide/dependency-injection). * * \@usageNotes * ### Example * * {\@example core/di/ts/injector_spec.ts region='Injector'} * * `Injector` returns itself when given `Injector` as a token: * * {\@example core/di/ts/injector_spec.ts region='injectInjector'} * * \@publicApi * @abstract */ var Injector = /*#__PURE__*/function () { function Injector() { _classCallCheck(this, Injector); } _createClass2(Injector, null, [{ key: "create", /** * Create a new Injector which is configure using `StaticProvider`s. * * \@usageNotes * ### Example * * {\@example core/di/ts/provider_spec.ts region='ConstructorProvider'} * @param {?} options * @param {?=} parent * @return {?} */ value: function create(options, parent) { if (Array.isArray(options)) { return INJECTOR_IMPL(options, parent, ''); } else { return INJECTOR_IMPL(options.providers, options.parent, options.name || ''); } } }]); return Injector; }(); Injector.THROW_IF_NOT_FOUND = THROW_IF_NOT_FOUND; Injector.NULL = new NullInjector(); /** @nocollapse */ /** @nocollapse */ Injector.ngInjectableDef = ɵɵdefineInjectable({ token: Injector, providedIn: /** @type {?} */ 'any', factory: /** * @return {?} */ function factory() { return ɵɵinject(INJECTOR); } }); /** * \@internal * @nocollapse */ Injector.__NG_ELEMENT_ID__ = -1; if (false) {} /** @type {?} */ var IDENT = /** * @template T * @param {?} value * @return {?} */ function IDENT(value) { return value; }; var ɵ0$a = IDENT; /** @type {?} */ var EMPTY = /** @type {?} */ []; /** @type {?} */ var CIRCULAR$1 = IDENT; /** @type {?} */ var MULTI_PROVIDER_FN = /** * @return {?} */ function MULTI_PROVIDER_FN() { return Array.prototype.slice.call(arguments); }; var ɵ1$2 = MULTI_PROVIDER_FN; /** @enum {number} */ var OptionFlags = { Optional: 1, CheckSelf: 2, CheckParent: 4, Default: 6 }; /** @type {?} */ var NO_NEW_LINE$1 = 'ɵ'; var StaticInjector = /*#__PURE__*/function () { /** * @param {?} providers * @param {?=} parent * @param {?=} source */ function StaticInjector(providers) { var parent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Injector.NULL; var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; _classCallCheck(this, StaticInjector); this.parent = parent; this.source = source; /** @type {?} */ var records = this._records = new Map(); records.set(Injector, /** @type {?} */ { token: Injector, fn: IDENT, deps: EMPTY, value: this, useNew: false }); records.set(INJECTOR, /** @type {?} */ { token: INJECTOR, fn: IDENT, deps: EMPTY, value: this, useNew: false }); recursivelyProcessProviders(records, providers); } /** * @param {?} token * @param {?=} notFoundValue * @param {?=} flags * @return {?} */ _createClass2(StaticInjector, [{ key: "get", value: function get(token, notFoundValue) { var flags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : InjectFlags.Default; /** @type {?} */ var record = this._records.get(token); try { return tryResolveToken(token, record, this._records, this.parent, notFoundValue, flags); } catch (e) { return catchInjectorError(e, token, 'StaticInjectorError', this.source); } } /** * @return {?} */ }, { key: "toString", value: function toString() { /** @type {?} */ var tokens = /** @type {?} */ []; /** @type {?} */ var records = this._records; records.forEach( /** * @param {?} v * @param {?} token * @return {?} */ function (v, token) { return tokens.push(stringify(token)); }); return "StaticInjector[".concat(tokens.join(', '), "]"); } }]); return StaticInjector; }(); if (false) {} /** * @record */ function Record$1() {} if (false) {} /** * @record */ function DependencyRecord() {} if (false) {} /** * @param {?} provider * @return {?} */ function resolveProvider(provider) { /** @type {?} */ var deps = computeDeps(provider); /** @type {?} */ var fn = IDENT; /** @type {?} */ var value = EMPTY; /** @type {?} */ var useNew = false; /** @type {?} */ var provide = resolveForwardRef(provider.provide); if (USE_VALUE in provider) { // We need to use USE_VALUE in provider since provider.useValue could be defined as undefined. value = /** @type {?} */ provider.useValue; } else if ( /** @type {?} */ provider.useFactory) { fn = /** @type {?} */ provider.useFactory; } else if ( /** @type {?} */ provider.useExisting) {// Just use IDENT } else if ( /** @type {?} */ provider.useClass) { useNew = true; fn = resolveForwardRef( /** @type {?} */ provider.useClass); } else if (typeof provide == 'function') { useNew = true; fn = provide; } else { throw staticError('StaticProvider does not have [useValue|useFactory|useExisting|useClass] or [provide] is not newable', provider); } return { deps: deps, fn: fn, useNew: useNew, value: value }; } /** * @param {?} token * @return {?} */ function multiProviderMixError(token) { return staticError('Cannot mix multi providers and regular providers', token); } /** * @param {?} records * @param {?} provider * @return {?} */ function recursivelyProcessProviders(records, provider) { if (provider) { provider = resolveForwardRef(provider); if (provider instanceof Array) { // if we have an array recurse into the array for (var i = 0; i < provider.length; i++) { recursivelyProcessProviders(records, provider[i]); } } else if (typeof provider === 'function') { // Functions were supported in ReflectiveInjector, but are not here. For safety give useful // error messages throw staticError('Function/Class not supported', provider); } else if (provider && typeof provider === 'object' && provider.provide) { // At this point we have what looks like a provider: {provide: ?, ....} /** @type {?} */ var token = resolveForwardRef(provider.provide); /** @type {?} */ var resolvedProvider = resolveProvider(provider); if (provider.multi === true) { // This is a multi provider. /** @type {?} */ var multiProvider = records.get(token); if (multiProvider) { if (multiProvider.fn !== MULTI_PROVIDER_FN) { throw multiProviderMixError(token); } } else { // Create a placeholder factory which will look up the constituents of the multi provider. records.set(token, multiProvider = /** @type {?} */ { token: provider.provide, deps: [], useNew: false, fn: MULTI_PROVIDER_FN, value: EMPTY }); } // Treat the provider as the token. token = provider; multiProvider.deps.push({ token: token, options: 6 /* Default */ }); } /** @type {?} */ var record = records.get(token); if (record && record.fn == MULTI_PROVIDER_FN) { throw multiProviderMixError(token); } records.set(token, resolvedProvider); } else { throw staticError('Unexpected provider', provider); } } } /** * @param {?} token * @param {?} record * @param {?} records * @param {?} parent * @param {?} notFoundValue * @param {?} flags * @return {?} */ function tryResolveToken(token, record, records, parent, notFoundValue, flags) { try { return resolveToken(token, record, records, parent, notFoundValue, flags); } catch (e) { // ensure that 'e' is of type Error. if (!(e instanceof Error)) { e = new Error(e); } /** @type {?} */ var path = e[NG_TEMP_TOKEN_PATH] = e[NG_TEMP_TOKEN_PATH] || []; path.unshift(token); if (record && record.value == CIRCULAR$1) { // Reset the Circular flag. record.value = EMPTY; } throw e; } } /** * @param {?} token * @param {?} record * @param {?} records * @param {?} parent * @param {?} notFoundValue * @param {?} flags * @return {?} */ function resolveToken(token, record, records, parent, notFoundValue, flags) { /** @type {?} */ var value; if (record && !(flags & InjectFlags.SkipSelf)) { // If we don't have a record, this implies that we don't own the provider hence don't know how // to resolve it. value = record.value; if (value == CIRCULAR$1) { throw Error(NO_NEW_LINE$1 + 'Circular dependency'); } else if (value === EMPTY) { record.value = CIRCULAR$1; /** @type {?} */ var obj = undefined; /** @type {?} */ var useNew = record.useNew; /** @type {?} */ var fn = record.fn; /** @type {?} */ var depRecords = record.deps; /** @type {?} */ var deps = EMPTY; if (depRecords.length) { deps = []; for (var i = 0; i < depRecords.length; i++) { /** @type {?} */ var depRecord = depRecords[i]; /** @type {?} */ var options = depRecord.options; /** @type {?} */ var childRecord = options & 2 /* CheckSelf */ ? records.get(depRecord.token) : undefined; deps.push(tryResolveToken( // Current Token to resolve depRecord.token, // A record which describes how to resolve the token. // If undefined, this means we don't have such a record childRecord, // Other records we know about. records, // If we don't know how to resolve dependency and we should not check parent for it, // than pass in Null injector. !childRecord && !(options & 4 /* CheckParent */ ) ? Injector.NULL : parent, options & 1 /* Optional */ ? null : Injector.THROW_IF_NOT_FOUND, InjectFlags.Default)); } } record.value = value = useNew ? _construct( /** @type {?} */ fn, _toConsumableArray(deps)) : fn.apply(obj, deps); } } else if (!(flags & InjectFlags.Self)) { value = parent.get(token, notFoundValue, InjectFlags.Default); } return value; } /** * @param {?} provider * @return {?} */ function computeDeps(provider) { /** @type {?} */ var deps = EMPTY; /** @type {?} */ var providerDeps = /** @type {?} */ provider.deps; if (providerDeps && providerDeps.length) { deps = []; for (var i = 0; i < providerDeps.length; i++) { /** @type {?} */ var options = 6 /* Default */ ; /** @type {?} */ var token = resolveForwardRef(providerDeps[i]); if (token instanceof Array) { for (var j = 0, annotations = token; j < annotations.length; j++) { /** @type {?} */ var annotation = annotations[j]; if (annotation instanceof Optional || annotation == Optional) { options = options | 1 /* Optional */ ; } else if (annotation instanceof SkipSelf || annotation == SkipSelf) { options = options & ~2 /* CheckSelf */ ; } else if (annotation instanceof Self || annotation == Self) { options = options & ~4 /* CheckParent */ ; } else if (annotation instanceof Inject) { token = /** @type {?} */ annotation.token; } else { token = resolveForwardRef(annotation); } } } deps.push({ token: token, options: options }); } } else if ( /** @type {?} */ provider.useExisting) { /** @type {?} */ var _token = resolveForwardRef( /** @type {?} */ provider.useExisting); deps = [{ token: _token, options: 6 /* Default */ }]; } else if (!providerDeps && !(USE_VALUE in provider)) { // useValue & useExisting are the only ones which are exempt from deps all others need it. throw staticError('\'deps\' required', provider); } return deps; } /** * @param {?} text * @param {?} obj * @return {?} */ function staticError(text, obj) { return new Error(formatError(text, obj, 'StaticInjectorError')); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} keys * @return {?} */ function findFirstClosedCycle(keys) { /** @type {?} */ var res = []; for (var i = 0; i < keys.length; ++i) { if (res.indexOf(keys[i]) > -1) { res.push(keys[i]); return res; } res.push(keys[i]); } return res; } /** * @param {?} keys * @return {?} */ function constructResolvingPath(keys) { if (keys.length > 1) { /** @type {?} */ var reversed = findFirstClosedCycle(keys.slice().reverse()); /** @type {?} */ var tokenStrs = reversed.map( /** * @param {?} k * @return {?} */ function (k) { return stringify(k.token); }); return ' (' + tokenStrs.join(' -> ') + ')'; } return ''; } /** * @record */ function InjectionError() {} if (false) {} /** * @param {?} injector * @param {?} key * @param {?} constructResolvingMessage * @param {?=} originalError * @return {?} */ function injectionError(injector, key, constructResolvingMessage, originalError) { /** @type {?} */ var keys = [key]; /** @type {?} */ var errMsg = constructResolvingMessage(keys); /** @type {?} */ var error = /** @type {?} */ originalError ? wrappedError(errMsg, originalError) : Error(errMsg); error.addKey = addKey; error.keys = keys; error.injectors = [injector]; error.constructResolvingMessage = constructResolvingMessage; /** @type {?} */ error[ERROR_ORIGINAL_ERROR] = originalError; return error; } /** * @this {?} * @param {?} injector * @param {?} key * @return {?} */ function addKey(injector, key) { this.injectors.push(injector); this.keys.push(key); // Note: This updated message won't be reflected in the `.stack` property this.message = this.constructResolvingMessage(this.keys); } /** * Thrown when trying to retrieve a dependency by key from {\@link Injector}, but the * {\@link Injector} does not have a {\@link Provider} for the given key. * * \@usageNotes * ### Example * * ```typescript * class A { * constructor(b:B) {} * } * * expect(() => Injector.resolveAndCreate([A])).toThrowError(); * ``` * @param {?} injector * @param {?} key * @return {?} */ function noProviderError(injector, key) { return injectionError(injector, key, /** * @param {?} keys * @return {?} */ function (keys) { /** @type {?} */ var first = stringify(keys[0].token); return "No provider for ".concat(first, "!").concat(constructResolvingPath(keys)); }); } /** * Thrown when dependencies form a cycle. * * \@usageNotes * ### Example * * ```typescript * var injector = Injector.resolveAndCreate([ * {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]}, * {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]} * ]); * * expect(() => injector.get("one")).toThrowError(); * ``` * * Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed. * @param {?} injector * @param {?} key * @return {?} */ function cyclicDependencyError(injector, key) { return injectionError(injector, key, /** * @param {?} keys * @return {?} */ function (keys) { return "Cannot instantiate cyclic dependency!".concat(constructResolvingPath(keys)); }); } /** * Thrown when a constructing type returns with an Error. * * The `InstantiationError` class contains the original error plus the dependency graph which caused * this object to be instantiated. * * \@usageNotes * ### Example * * ```typescript * class A { * constructor() { * throw new Error('message'); * } * } * * var injector = Injector.resolveAndCreate([A]); * try { * injector.get(A); * } catch (e) { * expect(e instanceof InstantiationError).toBe(true); * expect(e.originalException.message).toEqual("message"); * expect(e.originalStack).toBeDefined(); * } * ``` * @param {?} injector * @param {?} originalException * @param {?} originalStack * @param {?} key * @return {?} */ function instantiationError(injector, originalException, originalStack, key) { return injectionError(injector, key, /** * @param {?} keys * @return {?} */ function (keys) { /** @type {?} */ var first = stringify(keys[0].token); return "".concat(originalException.message, ": Error during instantiation of ").concat(first, "!").concat(constructResolvingPath(keys), "."); }, originalException); } /** * Thrown when an object other then {\@link Provider} (or `Type`) is passed to {\@link Injector} * creation. * * \@usageNotes * ### Example * * ```typescript * expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError(); * ``` * @param {?} provider * @return {?} */ function invalidProviderError(provider) { return Error("Invalid provider - only instances of Provider and Type are allowed, got: ".concat(provider)); } /** * Thrown when the class has no annotation information. * * Lack of annotation information prevents the {\@link Injector} from determining which dependencies * need to be injected into the constructor. * * \@usageNotes * ### Example * * ```typescript * class A { * constructor(b) {} * } * * expect(() => Injector.resolveAndCreate([A])).toThrowError(); * ``` * * This error is also thrown when the class not marked with {\@link Injectable} has parameter types. * * ```typescript * class B {} * * class A { * constructor(b:B) {} // no information about the parameter types of A is available at runtime. * } * * expect(() => Injector.resolveAndCreate([A,B])).toThrowError(); * ``` * * @param {?} typeOrFunc * @param {?} params * @return {?} */ function noAnnotationError(typeOrFunc, params) { /** @type {?} */ var signature = []; for (var i = 0, ii = params.length; i < ii; i++) { /** @type {?} */ var parameter = params[i]; if (!parameter || parameter.length == 0) { signature.push('?'); } else { signature.push(parameter.map(stringify).join(' ')); } } return Error('Cannot resolve all parameters for \'' + stringify(typeOrFunc) + '\'(' + signature.join(', ') + '). ' + 'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' + stringify(typeOrFunc) + '\' is decorated with Injectable.'); } /** * Thrown when getting an object by index. * * \@usageNotes * ### Example * * ```typescript * class A {} * * var injector = Injector.resolveAndCreate([A]); * * expect(() => injector.getAt(100)).toThrowError(); * ``` * * @param {?} index * @return {?} */ function outOfBoundsError(index) { return Error("Index ".concat(index, " is out-of-bounds.")); } // TODO: add a working example after alpha38 is released /** * Thrown when a multi provider and a regular provider are bound to the same token. * * \@usageNotes * ### Example * * ```typescript * expect(() => Injector.resolveAndCreate([ * { provide: "Strings", useValue: "string1", multi: true}, * { provide: "Strings", useValue: "string2", multi: false} * ])).toThrowError(); * ``` * @param {?} provider1 * @param {?} provider2 * @return {?} */ function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) { return Error("Cannot mix multi providers and regular providers, got: ".concat(provider1, " ").concat(provider2)); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A unique object used for retrieving items from the {\@link ReflectiveInjector}. * * Keys have: * - a system-wide unique `id`. * - a `token`. * * `Key` is used internally by {\@link ReflectiveInjector} because its system-wide unique `id` allows * the * injector to store created objects in a more efficient way. * * `Key` should not be created directly. {\@link ReflectiveInjector} creates keys automatically when * resolving * providers. * * @deprecated No replacement * \@publicApi */ var ReflectiveKey = /*#__PURE__*/function () { /** * Private * @param {?} token * @param {?} id */ function ReflectiveKey(token, id) { _classCallCheck(this, ReflectiveKey); this.token = token; this.id = id; if (!token) { throw new Error('Token must be defined!'); } this.displayName = stringify(this.token); } /** * Retrieves a `Key` for a token. * @param {?} token * @return {?} */ _createClass2(ReflectiveKey, null, [{ key: "get", value: function get(token) { return _globalKeyRegistry.get(resolveForwardRef(token)); } /** * @return {?} the number of keys registered in the system. */ }, { key: "numberOfKeys", get: function get() { return _globalKeyRegistry.numberOfKeys; } }]); return ReflectiveKey; }(); if (false) {} var KeyRegistry = /*#__PURE__*/function () { function KeyRegistry() { _classCallCheck(this, KeyRegistry); this._allKeys = new Map(); } /** * @param {?} token * @return {?} */ _createClass2(KeyRegistry, [{ key: "get", value: function get(token) { if (token instanceof ReflectiveKey) return token; if (this._allKeys.has(token)) { return ( /** @type {?} */ this._allKeys.get(token) ); } /** @type {?} */ var newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys); this._allKeys.set(token, newKey); return newKey; } /** * @return {?} */ }, { key: "numberOfKeys", get: function get() { return this._allKeys.size; } }]); return KeyRegistry; }(); if (false) {} /** @type {?} */ var _globalKeyRegistry = new KeyRegistry(); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Provides access to reflection data about symbols. Used internally by Angular * to power dependency injection and compilation. */ var Reflector = /*#__PURE__*/function () { function Reflector(reflectionCapabilities) { _classCallCheck(this, Reflector); this.reflectionCapabilities = reflectionCapabilities; } _createClass2(Reflector, [{ key: "updateCapabilities", value: function updateCapabilities(caps) { this.reflectionCapabilities = caps; } }, { key: "factory", value: function factory(type) { return this.reflectionCapabilities.factory(type); } }, { key: "parameters", value: function parameters(typeOrFunc) { return this.reflectionCapabilities.parameters(typeOrFunc); } }, { key: "annotations", value: function annotations(typeOrFunc) { return this.reflectionCapabilities.annotations(typeOrFunc); } }, { key: "propMetadata", value: function propMetadata(typeOrFunc) { return this.reflectionCapabilities.propMetadata(typeOrFunc); } }, { key: "hasLifecycleHook", value: function hasLifecycleHook(type, lcProperty) { return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty); } }, { key: "getter", value: function getter(name) { return this.reflectionCapabilities.getter(name); } }, { key: "setter", value: function setter(name) { return this.reflectionCapabilities.setter(name); } }, { key: "method", value: function method(name) { return this.reflectionCapabilities.method(name); } }, { key: "importUri", value: function importUri(type) { return this.reflectionCapabilities.importUri(type); } }, { key: "resourceUri", value: function resourceUri(type) { return this.reflectionCapabilities.resourceUri(type); } }, { key: "resolveIdentifier", value: function resolveIdentifier(name, moduleUrl, members, runtime) { return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime); } }, { key: "resolveEnum", value: function resolveEnum(identifier, name) { return this.reflectionCapabilities.resolveEnum(identifier, name); } }]); return Reflector; }(); /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * The {@link Reflector} used internally in Angular to access metadata * about symbols. */ var reflector = new Reflector(new ReflectionCapabilities()); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function NormalizedProvider() {} /** * `Dependency` is used by the framework to extend DI. * This is internal to Angular and should not be used directly. */ var ReflectiveDependency = /*#__PURE__*/function () { /** * @param {?} key * @param {?} optional * @param {?} visibility */ function ReflectiveDependency(key, optional, visibility) { _classCallCheck(this, ReflectiveDependency); this.key = key; this.optional = optional; this.visibility = visibility; } /** * @param {?} key * @return {?} */ _createClass2(ReflectiveDependency, null, [{ key: "fromKey", value: function fromKey(key) { return new ReflectiveDependency(key, false, null); } }]); return ReflectiveDependency; }(); if (false) {} /** @type {?} */ var _EMPTY_LIST = []; /** * An internal resolved representation of a `Provider` used by the `Injector`. * * \@usageNotes * This is usually created automatically by `Injector.resolveAndCreate`. * * It can be created manually, as follows: * * ### Example * * ```typescript * var resolvedProviders = Injector.resolve([{ provide: 'message', useValue: 'Hello' }]); * var injector = Injector.fromResolvedProviders(resolvedProviders); * * expect(injector.get('message')).toEqual('Hello'); * ``` * * \@publicApi * @record */ function ResolvedReflectiveProvider() {} if (false) {} var ResolvedReflectiveProvider_ = /** * @param {?} key * @param {?} resolvedFactories * @param {?} multiProvider */ function ResolvedReflectiveProvider_(key, resolvedFactories, multiProvider) { _classCallCheck(this, ResolvedReflectiveProvider_); this.key = key; this.resolvedFactories = resolvedFactories; this.multiProvider = multiProvider; this.resolvedFactory = this.resolvedFactories[0]; }; if (false) {} /** * An internal resolved representation of a factory function created by resolving `Provider`. * \@publicApi */ var ResolvedReflectiveFactory = /** * @param {?} factory * @param {?} dependencies */ function ResolvedReflectiveFactory(factory, dependencies) { _classCallCheck(this, ResolvedReflectiveFactory); this.factory = factory; this.dependencies = dependencies; }; if (false) {} /** * Resolve a single provider. * @param {?} provider * @return {?} */ function resolveReflectiveFactory(provider) { /** @type {?} */ var factoryFn; /** @type {?} */ var resolvedDeps; if (provider.useClass) { /** @type {?} */ var useClass = resolveForwardRef(provider.useClass); factoryFn = reflector.factory(useClass); resolvedDeps = _dependenciesFor(useClass); } else if (provider.useExisting) { factoryFn = /** * @param {?} aliasInstance * @return {?} */ function factoryFn(aliasInstance) { return aliasInstance; }; resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))]; } else if (provider.useFactory) { factoryFn = provider.useFactory; resolvedDeps = constructDependencies(provider.useFactory, provider.deps); } else { factoryFn = /** * @return {?} */ function factoryFn() { return provider.useValue; }; resolvedDeps = _EMPTY_LIST; } return new ResolvedReflectiveFactory(factoryFn, resolvedDeps); } /** * Converts the `Provider` into `ResolvedProvider`. * * `Injector` internally only uses `ResolvedProvider`, `Provider` contains convenience provider * syntax. * @param {?} provider * @return {?} */ function resolveReflectiveProvider(provider) { return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false); } /** * Resolve a list of Providers. * @param {?} providers * @return {?} */ function resolveReflectiveProviders(providers) { /** @type {?} */ var normalized = _normalizeProviders(providers, []); /** @type {?} */ var resolved = normalized.map(resolveReflectiveProvider); /** @type {?} */ var resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map()); return Array.from(resolvedProviderMap.values()); } /** * Merges a list of ResolvedProviders into a list where each key is contained exactly once and * multi providers have been merged. * @param {?} providers * @param {?} normalizedProvidersMap * @return {?} */ function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) { for (var i = 0; i < providers.length; i++) { /** @type {?} */ var provider = providers[i]; /** @type {?} */ var existing = normalizedProvidersMap.get(provider.key.id); if (existing) { if (provider.multiProvider !== existing.multiProvider) { throw mixingMultiProvidersWithRegularProvidersError(existing, provider); } if (provider.multiProvider) { for (var j = 0; j < provider.resolvedFactories.length; j++) { existing.resolvedFactories.push(provider.resolvedFactories[j]); } } else { normalizedProvidersMap.set(provider.key.id, provider); } } else { /** @type {?} */ var resolvedProvider = void 0; if (provider.multiProvider) { resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider); } else { resolvedProvider = provider; } normalizedProvidersMap.set(provider.key.id, resolvedProvider); } } return normalizedProvidersMap; } /** * @param {?} providers * @param {?} res * @return {?} */ function _normalizeProviders(providers, res) { providers.forEach( /** * @param {?} b * @return {?} */ function (b) { if (b instanceof Type) { res.push( /** @type {?} */ { provide: b, useClass: b }); } else if (b && typeof b == 'object' && /** @type {?} */ b.provide !== undefined) { res.push( /** @type {?} */ b); } else if (b instanceof Array) { _normalizeProviders(b, res); } else { throw invalidProviderError(b); } }); return res; } /** * @param {?} typeOrFunc * @param {?=} dependencies * @return {?} */ function constructDependencies(typeOrFunc, dependencies) { if (!dependencies) { return _dependenciesFor(typeOrFunc); } else { /** @type {?} */ var params = dependencies.map( /** * @param {?} t * @return {?} */ function (t) { return [t]; }); return dependencies.map( /** * @param {?} t * @return {?} */ function (t) { return _extractToken(typeOrFunc, t, params); }); } } /** * @param {?} typeOrFunc * @return {?} */ function _dependenciesFor(typeOrFunc) { /** @type {?} */ var params = reflector.parameters(typeOrFunc); if (!params) return []; if (params.some( /** * @param {?} p * @return {?} */ function (p) { return p == null; })) { throw noAnnotationError(typeOrFunc, params); } return params.map( /** * @param {?} p * @return {?} */ function (p) { return _extractToken(typeOrFunc, p, params); }); } /** * @param {?} typeOrFunc * @param {?} metadata * @param {?} params * @return {?} */ function _extractToken(typeOrFunc, metadata, params) { /** @type {?} */ var token = null; /** @type {?} */ var optional = false; if (!Array.isArray(metadata)) { if (metadata instanceof Inject) { return _createDependency(metadata.token, optional, null); } else { return _createDependency(metadata, optional, null); } } /** @type {?} */ var visibility = null; for (var i = 0; i < metadata.length; ++i) { /** @type {?} */ var paramMetadata = metadata[i]; if (paramMetadata instanceof Type) { token = paramMetadata; } else if (paramMetadata instanceof Inject) { token = paramMetadata.token; } else if (paramMetadata instanceof Optional) { optional = true; } else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) { visibility = paramMetadata; } else if (paramMetadata instanceof InjectionToken) { token = paramMetadata; } } token = resolveForwardRef(token); if (token != null) { return _createDependency(token, optional, visibility); } else { throw noAnnotationError(typeOrFunc, params); } } /** * @param {?} token * @param {?} optional * @param {?} visibility * @return {?} */ function _createDependency(token, optional, visibility) { return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // Threshold for the dynamic version /** @type {?} */ var UNDEFINED = new Object(); /** * A ReflectiveDependency injection container used for instantiating objects and resolving * dependencies. * * An `Injector` is a replacement for a `new` operator, which can automatically resolve the * constructor dependencies. * * In typical use, application code asks for the dependencies in the constructor and they are * resolved by the `Injector`. * * \@usageNotes * ### Example * * The following example creates an `Injector` configured to create `Engine` and `Car`. * * ```typescript * \@Injectable() * class Engine { * } * * \@Injectable() * class Car { * constructor(public engine:Engine) {} * } * * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]); * var car = injector.get(Car); * expect(car instanceof Car).toBe(true); * expect(car.engine instanceof Engine).toBe(true); * ``` * * Notice, we don't use the `new` operator because we explicitly want to have the `Injector` * resolve all of the object's dependencies automatically. * * @deprecated from v5 - slow and brings in a lot of code, Use `Injector.create` instead. * \@publicApi * @abstract */ var ReflectiveInjector = /*#__PURE__*/function () { function ReflectiveInjector() { _classCallCheck(this, ReflectiveInjector); } _createClass2(ReflectiveInjector, null, [{ key: "resolve", /** * Turns an array of provider definitions into an array of resolved providers. * * A resolution is a process of flattening multiple nested arrays and converting individual * providers into an array of `ResolvedReflectiveProvider`s. * * \@usageNotes * ### Example * * ```typescript * \@Injectable() * class Engine { * } * / * class Car { * constructor(public engine:Engine) {} * } * * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]); * * expect(providers.length).toEqual(2); * * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true); * expect(providers[0].key.displayName).toBe("Car"); * expect(providers[0].dependencies.length).toEqual(1); * expect(providers[0].factory).toBeDefined(); * * expect(providers[1].key.displayName).toBe("Engine"); * }); * ``` * * @param {?} providers * @return {?} */ value: function resolve(providers) { return resolveReflectiveProviders(providers); } /** * Resolves an array of providers and creates an injector from those providers. * * The passed-in providers can be an array of `Type`, `Provider`, * or a recursive array of more providers. * * \@usageNotes * ### Example * * ```typescript * \@Injectable() * class Engine { * } * / * class Car { * constructor(public engine:Engine) {} * } * * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]); * expect(injector.get(Car) instanceof Car).toBe(true); * ``` * @param {?} providers * @param {?=} parent * @return {?} */ }, { key: "resolveAndCreate", value: function resolveAndCreate(providers, parent) { /** @type {?} */ var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers); return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent); } /** * Creates an injector from previously resolved providers. * * This API is the recommended way to construct injectors in performance-sensitive parts. * * \@usageNotes * ### Example * * ```typescript * \@Injectable() * class Engine { * } * / * class Car { * constructor(public engine:Engine) {} * } * * var providers = ReflectiveInjector.resolve([Car, Engine]); * var injector = ReflectiveInjector.fromResolvedProviders(providers); * expect(injector.get(Car) instanceof Car).toBe(true); * ``` * @param {?} providers * @param {?=} parent * @return {?} */ }, { key: "fromResolvedProviders", value: function fromResolvedProviders(providers, parent) { return new ReflectiveInjector_(providers, parent); } }]); return ReflectiveInjector; }(); if (false) {} var ReflectiveInjector_ = /*#__PURE__*/function () { /** * Private * @param {?} _providers * @param {?=} _parent */ function ReflectiveInjector_(_providers, _parent) { _classCallCheck(this, ReflectiveInjector_); /** * \@internal */ this._constructionCounter = 0; this._providers = _providers; this.parent = _parent || null; /** @type {?} */ var len = _providers.length; this.keyIds = new Array(len); this.objs = new Array(len); for (var i = 0; i < len; i++) { this.keyIds[i] = _providers[i].key.id; this.objs[i] = UNDEFINED; } } /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ _createClass2(ReflectiveInjector_, [{ key: "get", value: function get(token) { var notFoundValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : THROW_IF_NOT_FOUND; return this._getByKey(ReflectiveKey.get(token), null, notFoundValue); } /** * @param {?} providers * @return {?} */ }, { key: "resolveAndCreateChild", value: function resolveAndCreateChild(providers) { /** @type {?} */ var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers); return this.createChildFromResolved(ResolvedReflectiveProviders); } /** * @param {?} providers * @return {?} */ }, { key: "createChildFromResolved", value: function createChildFromResolved(providers) { /** @type {?} */ var inj = new ReflectiveInjector_(providers); /** @type {?} */ inj.parent = this; return inj; } /** * @param {?} provider * @return {?} */ }, { key: "resolveAndInstantiate", value: function resolveAndInstantiate(provider) { return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]); } /** * @param {?} provider * @return {?} */ }, { key: "instantiateResolved", value: function instantiateResolved(provider) { return this._instantiateProvider(provider); } /** * @param {?} index * @return {?} */ }, { key: "getProviderAtIndex", value: function getProviderAtIndex(index) { if (index < 0 || index >= this._providers.length) { throw outOfBoundsError(index); } return this._providers[index]; } /** * \@internal * @param {?} provider * @return {?} */ }, { key: "_new", value: function _new(provider) { if (this._constructionCounter++ > this._getMaxNumberOfObjects()) { throw cyclicDependencyError(this, provider.key); } return this._instantiateProvider(provider); } /** * @private * @return {?} */ }, { key: "_getMaxNumberOfObjects", value: function _getMaxNumberOfObjects() { return this.objs.length; } /** * @private * @param {?} provider * @return {?} */ }, { key: "_instantiateProvider", value: function _instantiateProvider(provider) { if (provider.multiProvider) { /** @type {?} */ var res = new Array(provider.resolvedFactories.length); for (var i = 0; i < provider.resolvedFactories.length; ++i) { res[i] = this._instantiate(provider, provider.resolvedFactories[i]); } return res; } else { return this._instantiate(provider, provider.resolvedFactories[0]); } } /** * @private * @param {?} provider * @param {?} ResolvedReflectiveFactory * @return {?} */ }, { key: "_instantiate", value: function _instantiate(provider, ResolvedReflectiveFactory) { var _this327 = this; /** @type {?} */ var factory = ResolvedReflectiveFactory.factory; /** @type {?} */ var deps; try { deps = ResolvedReflectiveFactory.dependencies.map( /** * @param {?} dep * @return {?} */ function (dep) { return _this327._getByReflectiveDependency(dep); }); } catch (e) { if (e.addKey) { e.addKey(this, provider.key); } throw e; } /** @type {?} */ var obj; try { obj = factory.apply(void 0, _toConsumableArray(deps)); } catch (e) { throw instantiationError(this, e, e.stack, provider.key); } return obj; } /** * @private * @param {?} dep * @return {?} */ }, { key: "_getByReflectiveDependency", value: function _getByReflectiveDependency(dep) { return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND); } /** * @private * @param {?} key * @param {?} visibility * @param {?} notFoundValue * @return {?} */ }, { key: "_getByKey", value: function _getByKey(key, visibility, notFoundValue) { if (key === ReflectiveInjector_.INJECTOR_KEY) { return this; } if (visibility instanceof Self) { return this._getByKeySelf(key, notFoundValue); } else { return this._getByKeyDefault(key, notFoundValue, visibility); } } /** * @private * @param {?} keyId * @return {?} */ }, { key: "_getObjByKeyId", value: function _getObjByKeyId(keyId) { for (var i = 0; i < this.keyIds.length; i++) { if (this.keyIds[i] === keyId) { if (this.objs[i] === UNDEFINED) { this.objs[i] = this._new(this._providers[i]); } return this.objs[i]; } } return UNDEFINED; } /** * \@internal * @param {?} key * @param {?} notFoundValue * @return {?} */ }, { key: "_throwOrNull", value: function _throwOrNull(key, notFoundValue) { if (notFoundValue !== THROW_IF_NOT_FOUND) { return notFoundValue; } else { throw noProviderError(this, key); } } /** * \@internal * @param {?} key * @param {?} notFoundValue * @return {?} */ }, { key: "_getByKeySelf", value: function _getByKeySelf(key, notFoundValue) { /** @type {?} */ var obj = this._getObjByKeyId(key.id); return obj !== UNDEFINED ? obj : this._throwOrNull(key, notFoundValue); } /** * \@internal * @param {?} key * @param {?} notFoundValue * @param {?} visibility * @return {?} */ }, { key: "_getByKeyDefault", value: function _getByKeyDefault(key, notFoundValue, visibility) { /** @type {?} */ var inj; if (visibility instanceof SkipSelf) { inj = this.parent; } else { inj = this; } while (inj instanceof ReflectiveInjector_) { /** @type {?} */ var inj_ = /** @type {?} */ inj; /** @type {?} */ var obj = inj_._getObjByKeyId(key.id); if (obj !== UNDEFINED) return obj; inj = inj_.parent; } if (inj !== null) { return inj.get(key.token, notFoundValue); } else { return this._throwOrNull(key, notFoundValue); } } /** * @return {?} */ }, { key: "toString", /** * @return {?} */ value: function toString() { return this.displayName; } }, { key: "displayName", get: function get() { /** @type {?} */ var providers = _mapProviders(this, /** * @param {?} b * @return {?} */ function (b) { return ' "' + b.key.displayName + '" '; }).join(', '); return "ReflectiveInjector(providers: [".concat(providers, "])"); } }]); return ReflectiveInjector_; }(); ReflectiveInjector_.INJECTOR_KEY = ReflectiveKey.get(Injector); if (false) {} /** * @param {?} injector * @param {?} fn * @return {?} */ function _mapProviders(injector, fn) { /** @type {?} */ var res = new Array(injector._providers.length); for (var i = 0; i < injector._providers.length; ++i) { res[i] = fn(injector.getProviderAtIndex(i)); } return res; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A DI token that you can use to create a virtual [provider](guide/glossary#provider) * that will populate the `entryComponents` field of components and NgModules * based on its `useValue` property value. * All components that are referenced in the `useValue` value (either directly * or in a nested array or map) are added to the `entryComponents` property. * * \@usageNotes * * The following example shows how the router can populate the `entryComponents` * field of an NgModule based on a router configuration that refers * to components. * * ```typescript * // helper function inside the router * function provideRoutes(routes) { * return [ * {provide: ROUTES, useValue: routes}, * {provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: routes, multi: true} * ]; * } * * // user code * let routes = [ * {path: '/root', component: RootComp}, * {path: '/teams', component: TeamsComp} * ]; * * \@NgModule({ * providers: [provideRoutes(routes)] * }) * class ModuleWithRoutes {} * ``` * * \@publicApi * @type {?} */ var ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken('AnalyzeForEntryComponents'); /** * Type of the `Attribute` decorator / constructor function. * * \@publicApi * @record */ function AttributeDecorator$1() {} /** * Type of the Attribute metadata. * * \@publicApi * @record */ function Attribute$1() {} if (false) {} // WARNING: interface has both a type and a value, skipping emit /** * Base class for query metadata. * * @see `ContentChildren`. * @see `ContentChild`. * @see `ViewChildren`. * @see `ViewChild`. * * \@publicApi * @abstract */ var Query = function Query() { _classCallCheck(this, Query); }; /** * Type of the ContentChildren decorator / constructor function. * * @see `ContentChildren`. * \@publicApi * @record */ function ContentChildrenDecorator() {} var ɵ0$b = /** * @param {?=} selector * @param {?=} data * @return {?} */ function ɵ0$b(selector) { var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return Object.assign({ selector: selector, first: false, isViewQuery: false, descendants: false }, data); }; /** * ContentChildren decorator and metadata. * * * \@Annotation * \@publicApi * @type {?} */ var ContentChildren = makePropDecorator('ContentChildren', ɵ0$b, Query); /** * Type of the ContentChild decorator / constructor function. * * \@publicApi * @record */ function ContentChildDecorator() {} var ɵ1$3 = /** * @param {?=} selector * @param {?=} data * @return {?} */ function ɵ1$3(selector) { var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return Object.assign({ selector: selector, first: true, isViewQuery: false, descendants: true }, data); }; /** * ContentChild decorator and metadata. * * * \@Annotation * * \@publicApi * @type {?} */ var ContentChild = makePropDecorator('ContentChild', ɵ1$3, Query); /** * Type of the ViewChildren decorator / constructor function. * * @see `ViewChildren`. * * \@publicApi * @record */ function ViewChildrenDecorator() {} var ɵ2 = /** * @param {?=} selector * @param {?=} data * @return {?} */ function ɵ2(selector) { var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return Object.assign({ selector: selector, first: false, isViewQuery: true, descendants: true }, data); }; /** * ViewChildren decorator and metadata. * * \@Annotation * \@publicApi * @type {?} */ var ViewChildren = makePropDecorator('ViewChildren', ɵ2, Query); /** * Type of the ViewChild decorator / constructor function. * * @see `ViewChild`. * \@publicApi * @record */ function ViewChildDecorator() {} var ɵ3 = /** * @param {?} selector * @param {?} data * @return {?} */ function ɵ3(selector, data) { return Object.assign({ selector: selector, first: true, isViewQuery: true, descendants: true }, data); }; /** * ViewChild decorator and metadata. * * \@Annotation * \@publicApi * @type {?} */ var ViewChild = makePropDecorator('ViewChild', ɵ3, Query); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Used to resolve resource URLs on `\@Component` when used with JIT compilation. * * Example: * ``` * \@Component({ * selector: 'my-comp', * templateUrl: 'my-comp.html', // This requires asynchronous resolution * }) * class MyComponent{ * } * * // Calling `renderComponent` will fail because `renderComponent` is a synchronous process * // and `MyComponent`'s `\@Component.templateUrl` needs to be resolved asynchronously. * * // Calling `resolveComponentResources()` will resolve `\@Component.templateUrl` into * // `\@Component.template`, which allows `renderComponent` to proceed in a synchronous manner. * * // Use browser's `fetch()` function as the default resource resolution strategy. * resolveComponentResources(fetch).then(() => { * // After resolution all URLs have been converted into `template` strings. * renderComponent(MyComponent); * }); * * ``` * * NOTE: In AOT the resolution happens during compilation, and so there should be no need * to call this method outside JIT mode. * * @param {?} resourceResolver a function which is responsible for returning a `Promise` to the * contents of the resolved URL. Browser's `fetch()` method is a good default implementation. * @return {?} */ function resolveComponentResources(resourceResolver) { // Store all promises which are fetching the resources. /** @type {?} */ var componentResolved = []; // Cache so that we don't fetch the same resource more than once. /** @type {?} */ var urlMap = new Map(); /** * @param {?} url * @return {?} */ function cachedResourceResolve(url) { /** @type {?} */ var promise = urlMap.get(url); if (!promise) { /** @type {?} */ var resp = resourceResolver(url); urlMap.set(url, promise = resp.then(unwrapResponse)); } return promise; } componentResourceResolutionQueue.forEach( /** * @param {?} component * @param {?} type * @return {?} */ function (component, type) { /** @type {?} */ var promises = []; if (component.templateUrl) { promises.push(cachedResourceResolve(component.templateUrl).then( /** * @param {?} template * @return {?} */ function (template) { component.template = template; })); } /** @type {?} */ var styleUrls = component.styleUrls; /** @type {?} */ var styles = component.styles || (component.styles = []); /** @type {?} */ var styleOffset = component.styles.length; styleUrls && styleUrls.forEach( /** * @param {?} styleUrl * @param {?} index * @return {?} */ function (styleUrl, index) { styles.push(''); // pre-allocate array. promises.push(cachedResourceResolve(styleUrl).then( /** * @param {?} style * @return {?} */ function (style) { styles[styleOffset + index] = style; styleUrls.splice(styleUrls.indexOf(styleUrl), 1); if (styleUrls.length == 0) { component.styleUrls = undefined; } })); }); /** @type {?} */ var fullyResolved = Promise.all(promises).then( /** * @return {?} */ function () { return componentDefResolved(type); }); componentResolved.push(fullyResolved); }); clearResolutionOfComponentResourcesQueue(); return Promise.all(componentResolved).then( /** * @return {?} */ function () { return undefined; }); } /** @type {?} */ var componentResourceResolutionQueue = new Map(); // Track when existing ngComponentDef for a Type is waiting on resources. /** @type {?} */ var componentDefPendingResolution = new Set(); /** * @param {?} type * @param {?} metadata * @return {?} */ function maybeQueueResolutionOfComponentResources(type, metadata) { if (componentNeedsResolution(metadata)) { componentResourceResolutionQueue.set(type, metadata); componentDefPendingResolution.add(type); } } /** * @param {?} type * @return {?} */ function isComponentDefPendingResolution(type) { return componentDefPendingResolution.has(type); } /** * @param {?} component * @return {?} */ function componentNeedsResolution(component) { return !!(component.templateUrl && !component.hasOwnProperty('template') || component.styleUrls && component.styleUrls.length); } /** * @return {?} */ function clearResolutionOfComponentResourcesQueue() { /** @type {?} */ var old = componentResourceResolutionQueue; componentResourceResolutionQueue = new Map(); return old; } /** * @param {?} queue * @return {?} */ function restoreComponentResolutionQueue(queue) { componentDefPendingResolution.clear(); queue.forEach( /** * @param {?} _ * @param {?} type * @return {?} */ function (_, type) { return componentDefPendingResolution.add(type); }); componentResourceResolutionQueue = queue; } /** * @return {?} */ function isComponentResourceResolutionQueueEmpty() { return componentResourceResolutionQueue.size === 0; } /** * @param {?} response * @return {?} */ function unwrapResponse(response) { return typeof response == 'string' ? response : response.text(); } /** * @param {?} type * @return {?} */ function componentDefResolved(type) { componentDefPendingResolution["delete"](type); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Allocates the necessary amount of slots for host vars. * * \@codeGenApi * @param {?} count Amount of vars to be allocated * * @return {?} */ function ɵɵallocHostVars(count) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var tView = lView[TVIEW]; if (!tView.firstTemplatePass) return; queueHostBindingForCheck(tView, /** @type {?} */ getCurrentDirectiveDef(), count); prefillHostVars(tView, lView, count); } /** * Stores host binding fn and number of host vars so it will be queued for binding refresh during * CD. * @param {?} tView * @param {?} def * @param {?} hostVars * @return {?} */ function queueHostBindingForCheck(tView, def, hostVars) { ngDevMode && assertEqual(tView.firstTemplatePass, true, 'Should only be called in first template pass.'); /** @type {?} */ var expando = /** @type {?} */ tView.expandoInstructions; /** @type {?} */ var length = expando.length; // Check whether a given `hostBindings` function already exists in expandoInstructions, // which can happen in case directive definition was extended from base definition (as a part of // the `InheritDefinitionFeature` logic). If we found the same `hostBindings` function in the // list, we just increase the number of host vars associated with that function, but do not add it // into the list again. if (length >= 2 && expando[length - 2] === def.hostBindings) { expando[length - 1] = /** @type {?} */ expando[length - 1] + hostVars; } else { expando.push( /** @type {?} */ def.hostBindings, hostVars); } } /** * On the first template pass, we need to reserve space for host binding values * after directives are matched (so all directives are saved, then bindings). * Because we are updating the blueprint, we only need to do this once. * @param {?} tView * @param {?} lView * @param {?} totalHostVars * @return {?} */ function prefillHostVars(tView, lView, totalHostVars) { ngDevMode && assertEqual(tView.firstTemplatePass, true, 'Should only be called in first template pass.'); for (var i = 0; i < totalHostVars; i++) { lView.push(NO_CHANGE); tView.blueprint.push(NO_CHANGE); tView.data.push(null); } } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var _symbolIterator = null; function getSymbolIterator() { if (!_symbolIterator) { var _Symbol = _global['Symbol']; if (_Symbol && _Symbol.iterator) { _symbolIterator = _Symbol.iterator; } else { // es6-shim specific logic var keys = Object.getOwnPropertyNames(Map.prototype); for (var i = 0; i < keys.length; ++i) { var key = keys[i]; if (key !== 'entries' && key !== 'size' && Map.prototype[key] === Map.prototype['entries']) { _symbolIterator = key; } } } } return _symbolIterator; } /** * @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 */ function isListLikeIterable(obj) { if (!isJsObject(obj)) return false; return Array.isArray(obj) || !(obj instanceof Map) && // JS Map are iterables but return entries as [k, v] getSymbolIterator() in obj; // JS Iterable have a Symbol.iterator prop } function areIterablesEqual(a, b, comparator) { var iterator1 = a[getSymbolIterator()](); var iterator2 = b[getSymbolIterator()](); while (true) { var item1 = iterator1.next(); var item2 = iterator2.next(); if (item1.done && item2.done) return true; if (item1.done || item2.done) return false; if (!comparator(item1.value, item2.value)) return false; } } function iterateListLike(obj, fn) { if (Array.isArray(obj)) { for (var i = 0; i < obj.length; i++) { fn(obj[i]); } } else { var iterator = obj[getSymbolIterator()](); var item; while (!(item = iterator.next()).done) { fn(item.value); } } } function isJsObject(o) { return o !== null && (typeof o === 'function' || typeof o === 'object'); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ // JS has NaN !== NaN function looseIdentical(a, b) { return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b); } function devModeEqual(a, b) { var isListLikeIterableA = isListLikeIterable(a); var isListLikeIterableB = isListLikeIterable(b); if (isListLikeIterableA && isListLikeIterableB) { return areIterablesEqual(a, b, devModeEqual); } else { var isAObject = a && (typeof a === 'object' || typeof a === 'function'); var isBObject = b && (typeof b === 'object' || typeof b === 'function'); if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) { return true; } else { return looseIdentical(a, b); } } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} a * @param {?} b * @return {?} */ function devModeEqual$1(a, b) { /** @type {?} */ var isListLikeIterableA = isListLikeIterable$1(a); /** @type {?} */ var isListLikeIterableB = isListLikeIterable$1(b); if (isListLikeIterableA && isListLikeIterableB) { return areIterablesEqual$1(a, b, devModeEqual$1); } else { /** @type {?} */ var isAObject = a && (typeof a === 'object' || typeof a === 'function'); /** @type {?} */ var isBObject = b && (typeof b === 'object' || typeof b === 'function'); if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) { return true; } else { return looseIdentical(a, b); } } } /** * Indicates that the result of a {\@link Pipe} transformation has changed even though the * reference has not changed. * * Wrapped values are unwrapped automatically during the change detection, and the unwrapped value * is stored. * * Example: * * ``` * if (this._latestValue === this._latestReturnedValue) { * return this._latestReturnedValue; * } else { * this._latestReturnedValue = this._latestValue; * return WrappedValue.wrap(this._latestValue); // this will force update * } * ``` * * \@publicApi */ var WrappedValue = /*#__PURE__*/function () { /** * @param {?} value */ function WrappedValue(value) { _classCallCheck(this, WrappedValue); this.wrapped = value; } /** * Creates a wrapped value. * @param {?} value * @return {?} */ _createClass2(WrappedValue, null, [{ key: "wrap", value: function wrap(value) { return new WrappedValue(value); } /** * Returns the underlying value of a wrapped value. * Returns the given `value` when it is not wrapped. * * @param {?} value * @return {?} */ }, { key: "unwrap", value: function unwrap(value) { return WrappedValue.isWrapped(value) ? value.wrapped : value; } /** * Returns true if `value` is a wrapped value. * @param {?} value * @return {?} */ }, { key: "isWrapped", value: function isWrapped(value) { return value instanceof WrappedValue; } }]); return WrappedValue; }(); if (false) {} /** * @param {?} obj * @return {?} */ function isListLikeIterable$1(obj) { if (!isJsObject$1(obj)) return false; return Array.isArray(obj) || !(obj instanceof Map) && // JS Map are iterables but return entries as [k, v] getSymbolIterator() in obj; // JS Iterable have a Symbol.iterator prop } /** * @param {?} a * @param {?} b * @param {?} comparator * @return {?} */ function areIterablesEqual$1(a, b, comparator) { /** @type {?} */ var iterator1 = a[getSymbolIterator()](); /** @type {?} */ var iterator2 = b[getSymbolIterator()](); while (true) { /** @type {?} */ var item1 = iterator1.next(); /** @type {?} */ var item2 = iterator2.next(); if (item1.done && item2.done) return true; if (item1.done || item2.done) return false; if (!comparator(item1.value, item2.value)) return false; } } /** * @param {?} obj * @param {?} fn * @return {?} */ function iterateListLike$1(obj, fn) { if (Array.isArray(obj)) { for (var i = 0; i < obj.length; i++) { fn(obj[i]); } } else { /** @type {?} */ var iterator = obj[getSymbolIterator()](); /** @type {?} */ var item; while (!(item = iterator.next()).done) { fn(item.value); } } } /** * @param {?} o * @return {?} */ function isJsObject$1(o) { return o !== null && (typeof o === 'function' || typeof o === 'object'); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ // TODO(misko): consider inlining /** * Updates binding and returns the value. * @param {?} lView * @param {?} bindingIndex * @param {?} value * @return {?} */ function updateBinding(lView, bindingIndex, value) { return lView[bindingIndex] = value; } /** * Gets the current binding value. * @param {?} lView * @param {?} bindingIndex * @return {?} */ function getBinding(lView, bindingIndex) { ngDevMode && assertDataInRange(lView, bindingIndex); ngDevMode && assertNotSame(lView[bindingIndex], NO_CHANGE, 'Stored value should never be NO_CHANGE.'); return lView[bindingIndex]; } /** * Updates binding if changed, then returns whether it was updated. * @param {?} lView * @param {?} bindingIndex * @param {?} value * @return {?} */ function bindingUpdated(lView, bindingIndex, value) { ngDevMode && assertNotSame(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.'); ngDevMode && assertLessThan(bindingIndex, lView.length, "Slot should have been initialized to NO_CHANGE"); /** @type {?} */ var oldValue = lView[bindingIndex]; if (isDifferent(oldValue, value)) { if (ngDevMode && getCheckNoChangesMode()) { // View engine didn't report undefined values as changed on the first checkNoChanges pass // (before the change detection was run). /** @type {?} */ var oldValueToCompare = oldValue !== NO_CHANGE ? oldValue : undefined; if (!devModeEqual$1(oldValueToCompare, value)) { throwErrorIfNoChangesMode(oldValue === NO_CHANGE, oldValueToCompare, value); } } lView[bindingIndex] = value; return true; } return false; } /** * Updates 2 bindings if changed, then returns whether either was updated. * @param {?} lView * @param {?} bindingIndex * @param {?} exp1 * @param {?} exp2 * @return {?} */ function bindingUpdated2(lView, bindingIndex, exp1, exp2) { /** @type {?} */ var different = bindingUpdated(lView, bindingIndex, exp1); return bindingUpdated(lView, bindingIndex + 1, exp2) || different; } /** * Updates 3 bindings if changed, then returns whether any was updated. * @param {?} lView * @param {?} bindingIndex * @param {?} exp1 * @param {?} exp2 * @param {?} exp3 * @return {?} */ function bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) { /** @type {?} */ var different = bindingUpdated2(lView, bindingIndex, exp1, exp2); return bindingUpdated(lView, bindingIndex + 2, exp3) || different; } /** * Updates 4 bindings if changed, then returns whether any was updated. * @param {?} lView * @param {?} bindingIndex * @param {?} exp1 * @param {?} exp2 * @param {?} exp3 * @param {?} exp4 * @return {?} */ function bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) { /** @type {?} */ var different = bindingUpdated2(lView, bindingIndex, exp1, exp2); return bindingUpdated2(lView, bindingIndex + 2, exp3, exp4) || different; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Update a property on a selected element. * * Operates on the element selected by index via the {\@link select} instruction. * * If the property name also exists as an input property on one of the element's directives, * the component property will be set instead of the element property. This check must * be conducted at runtime so child components that add new `\@Inputs` don't have to be re-compiled * * \@codeGenApi * @template T * @param {?} propName Name of property. Because it is going to DOM, this is not subject to * renaming as part of minification. * @param {?} value New value to write. * @param {?=} sanitizer An optional function used to sanitize the value. * @return {?} This function returns itself so that it may be chained * (e.g. `property('name', ctx.name)('title', ctx.title)`) * */ function ɵɵproperty(propName, value, sanitizer) { /** @type {?} */ var index = getSelectedIndex(); ngDevMode && assertNotEqual(index, -1, 'selected index cannot be -1'); /** @type {?} */ var lView = getLView(); /** @type {?} */ var bindReconciledValue = bind(lView, value); if (bindReconciledValue !== NO_CHANGE) { elementPropertyInternal(index, propName, bindReconciledValue, sanitizer); } return ɵɵproperty; } /** * Creates a single value binding. * * @template T * @param {?} lView Current view * @param {?} value Value to diff * @return {?} */ function bind(lView, value) { /** @type {?} */ var bindingIndex = lView[BINDING_INDEX]++; storeBindingMetadata(lView); return bindingUpdated(lView, bindingIndex, value) ? value : NO_CHANGE; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Updates the value of or removes a bound attribute on an Element. * * Used in the case of `[attr.title]="value"` * * \@codeGenApi * @param {?} name name The name of the attribute. * @param {?} value value The attribute is removed when value is `null` or `undefined`. * Otherwise the attribute value is set to the stringified value. * @param {?=} sanitizer An optional function used to sanitize the value. * @param {?=} namespace Optional namespace to use when setting the attribute. * * @return {?} */ function ɵɵattribute(name, value, sanitizer, namespace) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var bound = bind(lView, value); if (bound !== NO_CHANGE) { elementAttributeInternal(index, name, bound, lView, sanitizer, namespace); } return ɵɵattribute; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Create interpolation bindings with a variable number of expressions. * * If there are 1 to 8 expressions `interpolation1()` to `interpolation8()` should be used instead. * Those are faster because there is no need to create an array of expressions and iterate over it. * * `values`: * - has static text at even indexes, * - has evaluated expressions at odd indexes. * * Returns the concatenated string when any of the arguments changes, `NO_CHANGE` otherwise. * @param {?} lView * @param {?} values * @return {?} */ function interpolationV(lView, values) { ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values'); ngDevMode && assertEqual(values.length % 2, 1, 'should have an odd number of values'); /** @type {?} */ var isBindingUpdated = false; /** @type {?} */ var tData = lView[TVIEW].data; /** @type {?} */ var bindingIndex = lView[BINDING_INDEX]; if (tData[bindingIndex] == null) { // 2 is the index of the first static interstitial value (ie. not prefix) for (var i = 2; i < values.length; i += 2) { tData[bindingIndex++] = values[i]; } bindingIndex = lView[BINDING_INDEX]; } for (var _i16 = 1; _i16 < values.length; _i16 += 2) { // Check if bindings (odd indexes) have changed isBindingUpdated = bindingUpdated(lView, bindingIndex++, values[_i16]) || isBindingUpdated; } lView[BINDING_INDEX] = bindingIndex; storeBindingMetadata(lView, values[0], values[values.length - 1]); if (!isBindingUpdated) { return NO_CHANGE; } // Build the updated content /** @type {?} */ var content = values[0]; for (var _i17 = 1; _i17 < values.length; _i17 += 2) { content += renderStringify(values[_i17]) + values[_i17 + 1]; } return content; } /** * Creates an interpolation binding with 1 expression. * * @param {?} lView * @param {?} prefix static value used for concatenation only. * @param {?} v0 value checked for change. * @param {?} suffix static value used for concatenation only. * @return {?} */ function interpolation1(lView, prefix, v0, suffix) { /** @type {?} */ var different = bindingUpdated(lView, lView[BINDING_INDEX]++, v0); storeBindingMetadata(lView, prefix, suffix); return different ? prefix + renderStringify(v0) + suffix : NO_CHANGE; } /** * Creates an interpolation binding with 2 expressions. * @param {?} lView * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} suffix * @return {?} */ function interpolation2(lView, prefix, v0, i0, v1, suffix) { /** @type {?} */ var bindingIndex = lView[BINDING_INDEX]; /** @type {?} */ var different = bindingUpdated2(lView, bindingIndex, v0, v1); lView[BINDING_INDEX] += 2; // Only set static strings the first time (data will be null subsequent runs). /** @type {?} */ var data = storeBindingMetadata(lView, prefix, suffix); if (data) { lView[TVIEW].data[bindingIndex] = i0; } return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + suffix : NO_CHANGE; } /** * Creates an interpolation binding with 3 expressions. * @param {?} lView * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} suffix * @return {?} */ function interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix) { /** @type {?} */ var bindingIndex = lView[BINDING_INDEX]; /** @type {?} */ var different = bindingUpdated3(lView, bindingIndex, v0, v1, v2); lView[BINDING_INDEX] += 3; // Only set static strings the first time (data will be null subsequent runs). /** @type {?} */ var data = storeBindingMetadata(lView, prefix, suffix); if (data) { /** @type {?} */ var tData = lView[TVIEW].data; tData[bindingIndex] = i0; tData[bindingIndex + 1] = i1; } return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + suffix : NO_CHANGE; } /** * Create an interpolation binding with 4 expressions. * @param {?} lView * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} i2 * @param {?} v3 * @param {?} suffix * @return {?} */ function interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix) { /** @type {?} */ var bindingIndex = lView[BINDING_INDEX]; /** @type {?} */ var different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3); lView[BINDING_INDEX] += 4; // Only set static strings the first time (data will be null subsequent runs). /** @type {?} */ var data = storeBindingMetadata(lView, prefix, suffix); if (data) { /** @type {?} */ var tData = lView[TVIEW].data; tData[bindingIndex] = i0; tData[bindingIndex + 1] = i1; tData[bindingIndex + 2] = i2; } return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 + renderStringify(v3) + suffix : NO_CHANGE; } /** * Creates an interpolation binding with 5 expressions. * @param {?} lView * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} i2 * @param {?} v3 * @param {?} i3 * @param {?} v4 * @param {?} suffix * @return {?} */ function interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) { /** @type {?} */ var bindingIndex = lView[BINDING_INDEX]; /** @type {?} */ var different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3); different = bindingUpdated(lView, bindingIndex + 4, v4) || different; lView[BINDING_INDEX] += 5; // Only set static strings the first time (data will be null subsequent runs). /** @type {?} */ var data = storeBindingMetadata(lView, prefix, suffix); if (data) { /** @type {?} */ var tData = lView[TVIEW].data; tData[bindingIndex] = i0; tData[bindingIndex + 1] = i1; tData[bindingIndex + 2] = i2; tData[bindingIndex + 3] = i3; } return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + suffix : NO_CHANGE; } /** * Creates an interpolation binding with 6 expressions. * @param {?} lView * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} i2 * @param {?} v3 * @param {?} i3 * @param {?} v4 * @param {?} i4 * @param {?} v5 * @param {?} suffix * @return {?} */ function interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) { /** @type {?} */ var bindingIndex = lView[BINDING_INDEX]; /** @type {?} */ var different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3); different = bindingUpdated2(lView, bindingIndex + 4, v4, v5) || different; lView[BINDING_INDEX] += 6; // Only set static strings the first time (data will be null subsequent runs). /** @type {?} */ var data = storeBindingMetadata(lView, prefix, suffix); if (data) { /** @type {?} */ var tData = lView[TVIEW].data; tData[bindingIndex] = i0; tData[bindingIndex + 1] = i1; tData[bindingIndex + 2] = i2; tData[bindingIndex + 3] = i3; tData[bindingIndex + 4] = i4; } return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + suffix : NO_CHANGE; } /** * Creates an interpolation binding with 7 expressions. * @param {?} lView * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} i2 * @param {?} v3 * @param {?} i3 * @param {?} v4 * @param {?} i4 * @param {?} v5 * @param {?} i5 * @param {?} v6 * @param {?} suffix * @return {?} */ function interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) { /** @type {?} */ var bindingIndex = lView[BINDING_INDEX]; /** @type {?} */ var different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3); different = bindingUpdated3(lView, bindingIndex + 4, v4, v5, v6) || different; lView[BINDING_INDEX] += 7; // Only set static strings the first time (data will be null subsequent runs). /** @type {?} */ var data = storeBindingMetadata(lView, prefix, suffix); if (data) { /** @type {?} */ var tData = lView[TVIEW].data; tData[bindingIndex] = i0; tData[bindingIndex + 1] = i1; tData[bindingIndex + 2] = i2; tData[bindingIndex + 3] = i3; tData[bindingIndex + 4] = i4; tData[bindingIndex + 5] = i5; } return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + i5 + renderStringify(v6) + suffix : NO_CHANGE; } /** * Creates an interpolation binding with 8 expressions. * @param {?} lView * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} i2 * @param {?} v3 * @param {?} i3 * @param {?} v4 * @param {?} i4 * @param {?} v5 * @param {?} i5 * @param {?} v6 * @param {?} i6 * @param {?} v7 * @param {?} suffix * @return {?} */ function interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) { /** @type {?} */ var bindingIndex = lView[BINDING_INDEX]; /** @type {?} */ var different = bindingUpdated4(lView, bindingIndex, v0, v1, v2, v3); different = bindingUpdated4(lView, bindingIndex + 4, v4, v5, v6, v7) || different; lView[BINDING_INDEX] += 8; // Only set static strings the first time (data will be null subsequent runs). /** @type {?} */ var data = storeBindingMetadata(lView, prefix, suffix); if (data) { /** @type {?} */ var tData = lView[TVIEW].data; tData[bindingIndex] = i0; tData[bindingIndex + 1] = i1; tData[bindingIndex + 2] = i2; tData[bindingIndex + 3] = i3; tData[bindingIndex + 4] = i4; tData[bindingIndex + 5] = i5; tData[bindingIndex + 6] = i6; } return different ? prefix + renderStringify(v0) + i0 + renderStringify(v1) + i1 + renderStringify(v2) + i2 + renderStringify(v3) + i3 + renderStringify(v4) + i4 + renderStringify(v5) + i5 + renderStringify(v6) + i6 + renderStringify(v7) + suffix : NO_CHANGE; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * * Update an interpolated attribute on an element with single bound value surrounded by text. * * Used when the value passed to a property has 1 interpolated value in it: * * ```html * <div attr.title="prefix{{v0}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵattributeInterpolate1('title', 'prefix', v0, 'suffix'); * ``` * * \@codeGenApi * @param {?} attrName The name of the attribute to update * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} sanitizer An optional sanitizer function * @param {?=} namespace * @return {?} itself, so that it may be chained. */ function ɵɵattributeInterpolate1(attrName, prefix, v0, suffix, sanitizer, namespace) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation1(lView, prefix, v0, suffix); if (interpolatedValue !== NO_CHANGE) { elementAttributeInternal(index, attrName, interpolatedValue, lView, sanitizer, namespace); } return ɵɵattributeInterpolate1; } /** * * Update an interpolated attribute on an element with 2 bound values surrounded by text. * * Used when the value passed to a property has 2 interpolated values in it: * * ```html * <div attr.title="prefix{{v0}}-{{v1}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵattributeInterpolate2('title', 'prefix', v0, '-', v1, 'suffix'); * ``` * * \@codeGenApi * @param {?} attrName The name of the attribute to update * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} sanitizer An optional sanitizer function * @param {?=} namespace * @return {?} itself, so that it may be chained. */ function ɵɵattributeInterpolate2(attrName, prefix, v0, i0, v1, suffix, sanitizer, namespace) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix); if (interpolatedValue !== NO_CHANGE) { elementAttributeInternal(index, attrName, interpolatedValue, lView, sanitizer, namespace); } return ɵɵattributeInterpolate2; } /** * * Update an interpolated attribute on an element with 3 bound values surrounded by text. * * Used when the value passed to a property has 3 interpolated values in it: * * ```html * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵattributeInterpolate3( * 'title', 'prefix', v0, '-', v1, '-', v2, 'suffix'); * ``` * * \@codeGenApi * @param {?} attrName The name of the attribute to update * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} sanitizer An optional sanitizer function * @param {?=} namespace * @return {?} itself, so that it may be chained. */ function ɵɵattributeInterpolate3(attrName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer, namespace) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix); if (interpolatedValue !== NO_CHANGE) { elementAttributeInternal(index, attrName, interpolatedValue, lView, sanitizer, namespace); } return ɵɵattributeInterpolate3; } /** * * Update an interpolated attribute on an element with 4 bound values surrounded by text. * * Used when the value passed to a property has 4 interpolated values in it: * * ```html * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵattributeInterpolate4( * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, 'suffix'); * ``` * * \@codeGenApi * @param {?} attrName The name of the attribute to update * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} sanitizer An optional sanitizer function * @param {?=} namespace * @return {?} itself, so that it may be chained. */ function ɵɵattributeInterpolate4(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, sanitizer, namespace) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix); if (interpolatedValue !== NO_CHANGE) { elementAttributeInternal(index, attrName, interpolatedValue, lView, sanitizer, namespace); } return ɵɵattributeInterpolate4; } /** * * Update an interpolated attribute on an element with 5 bound values surrounded by text. * * Used when the value passed to a property has 5 interpolated values in it: * * ```html * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵattributeInterpolate5( * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, 'suffix'); * ``` * * \@codeGenApi * @param {?} attrName The name of the attribute to update * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} i3 Static value used for concatenation only. * @param {?} v4 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} sanitizer An optional sanitizer function * @param {?=} namespace * @return {?} itself, so that it may be chained. */ function ɵɵattributeInterpolate5(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, sanitizer, namespace) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix); if (interpolatedValue !== NO_CHANGE) { elementAttributeInternal(index, attrName, interpolatedValue, lView, sanitizer, namespace); } return ɵɵattributeInterpolate5; } /** * * Update an interpolated attribute on an element with 6 bound values surrounded by text. * * Used when the value passed to a property has 6 interpolated values in it: * * ```html * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵattributeInterpolate6( * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, 'suffix'); * ``` * * \@codeGenApi * @param {?} attrName The name of the attribute to update * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} i3 Static value used for concatenation only. * @param {?} v4 Value checked for change. * @param {?} i4 Static value used for concatenation only. * @param {?} v5 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} sanitizer An optional sanitizer function * @param {?=} namespace * @return {?} itself, so that it may be chained. */ function ɵɵattributeInterpolate6(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix, sanitizer, namespace) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix); if (interpolatedValue !== NO_CHANGE) { elementAttributeInternal(index, attrName, interpolatedValue, lView, sanitizer, namespace); } return ɵɵattributeInterpolate6; } /** * * Update an interpolated attribute on an element with 7 bound values surrounded by text. * * Used when the value passed to a property has 7 interpolated values in it: * * ```html * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}-{{v6}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵattributeInterpolate7( * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, '-', v6, 'suffix'); * ``` * * \@codeGenApi * @param {?} attrName The name of the attribute to update * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} i3 Static value used for concatenation only. * @param {?} v4 Value checked for change. * @param {?} i4 Static value used for concatenation only. * @param {?} v5 Value checked for change. * @param {?} i5 Static value used for concatenation only. * @param {?} v6 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} sanitizer An optional sanitizer function * @param {?=} namespace * @return {?} itself, so that it may be chained. */ function ɵɵattributeInterpolate7(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix, sanitizer, namespace) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix); if (interpolatedValue !== NO_CHANGE) { elementAttributeInternal(index, attrName, interpolatedValue, lView, sanitizer, namespace); } return ɵɵattributeInterpolate7; } /** * * Update an interpolated attribute on an element with 8 bound values surrounded by text. * * Used when the value passed to a property has 8 interpolated values in it: * * ```html * <div attr.title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}-{{v6}}-{{v7}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵattributeInterpolate8( * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, '-', v6, '-', v7, 'suffix'); * ``` * * \@codeGenApi * @param {?} attrName The name of the attribute to update * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} i3 Static value used for concatenation only. * @param {?} v4 Value checked for change. * @param {?} i4 Static value used for concatenation only. * @param {?} v5 Value checked for change. * @param {?} i5 Static value used for concatenation only. * @param {?} v6 Value checked for change. * @param {?} i6 Static value used for concatenation only. * @param {?} v7 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} sanitizer An optional sanitizer function * @param {?=} namespace * @return {?} itself, so that it may be chained. */ function ɵɵattributeInterpolate8(attrName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix, sanitizer, namespace) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix); if (interpolatedValue !== NO_CHANGE) { elementAttributeInternal(index, attrName, interpolatedValue, lView, sanitizer, namespace); } return ɵɵattributeInterpolate8; } /** * Update an interpolated attribute on an element with 8 or more bound values surrounded by text. * * Used when the number of interpolated values exceeds 7. * * ```html * <div * title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}-{{v6}}-{{v7}}-{{v8}}-{{v9}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵattributeInterpolateV( * 'title', ['prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, '-', v6, '-', v7, '-', v9, * 'suffix']); * ``` * * \@codeGenApi * @param {?} attrName The name of the attribute to update. * @param {?} values The a collection of values and the strings in-between those values, beginning with * a string prefix and ending with a string suffix. * (e.g. `['prefix', value0, '-', value1, '-', value2, ..., value99, 'suffix']`) * @param {?=} sanitizer An optional sanitizer function * @param {?=} namespace * @return {?} itself, so that it may be chained. */ function ɵɵattributeInterpolateV(attrName, values, sanitizer, namespace) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolated = interpolationV(lView, values); if (interpolated !== NO_CHANGE) { elementAttributeInternal(index, attrName, interpolated, lView, sanitizer, namespace); } return ɵɵattributeInterpolateV; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Synchronously perform change detection on a component (and possibly its sub-components). * * This function triggers change detection in a synchronous way on a component. There should * be very little reason to call this function directly since a preferred way to do change * detection is to {\@link markDirty} the component and wait for the scheduler to call this method * at some future point in time. This is because a single user action often results in many * components being invalidated and calling change detection on each component synchronously * would be inefficient. It is better to wait until all components are marked as dirty and * then perform single change detection across all of the components * * @template T * @param {?} component The component which the change detection should be performed on. * @return {?} */ function detectChanges(component) { /** @type {?} */ var view = getComponentViewByInstance(component); detectChangesInternal(view, component); } /** * Mark the component as dirty (needing change detection). * * Marking a component dirty will schedule a change detection on this * component at some point in the future. Marking an already dirty * component as dirty is a noop. Only one outstanding change detection * can be scheduled per component tree. (Two components bootstrapped with * separate `renderComponent` will have separate schedulers) * * When the root component is bootstrapped with `renderComponent`, a scheduler * can be provided. * * \@publicApi * @template T * @param {?} component Component to mark as dirty. * * @return {?} */ function markDirty(component) { ngDevMode && assertDefined(component, 'component'); /** @type {?} */ var rootView = /** @type {?} */ markViewDirty(getComponentViewByInstance(component)); ngDevMode && assertDefined(rootView[CONTEXT], 'rootContext should be defined'); scheduleTick( /** @type {?} */ rootView[CONTEXT], 1 /* DetectChanges */ ); } /** * Used to perform change detection on the whole application. * * This is equivalent to `detectChanges`, but invoked on root component. Additionally, `tick` * executes lifecycle hooks and conditionally checks components based on their * `ChangeDetectionStrategy` and dirtiness. * * The preferred way to trigger change detection is to call `markDirty`. `markDirty` internally * schedules `tick` using a scheduler in order to coalesce multiple `markDirty` calls into a * single change detection run. By default, the scheduler is `requestAnimationFrame`, but can * be changed when calling `renderComponent` and providing the `scheduler` option. * @template T * @param {?} component * @return {?} */ function tick(component) { /** @type {?} */ var rootView = getRootView(component); /** @type {?} */ var rootContext = /** @type {?} */ rootView[CONTEXT]; tickRootContext(rootContext); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Creates an LContainer for inline views, e.g. * * % if (showing) { * <div></div> * % } * * \@codeGenApi * @param {?} index The index of the container in the data array * * @return {?} */ function ɵɵcontainer(index) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var tNode = containerInternal(lView, index, null, null); if (lView[TVIEW].firstTemplatePass) { tNode.tViews = []; } setIsNotParent(); } /** * Creates an LContainer for an ng-template (dynamically-inserted view), e.g. * * <ng-template #foo> * <div></div> * </ng-template> * * \@codeGenApi * @param {?} index The index of the container in the data array * @param {?} templateFn Inline template * @param {?} consts The number of nodes, local refs, and pipes for this template * @param {?} vars The number of bindings for this template * @param {?=} tagName The name of the container element, if applicable * @param {?=} attrs The attrs attached to the container, if applicable * @param {?=} localRefs A set of local reference bindings on the element. * @param {?=} localRefExtractor A function which extracts local-refs values from the template. * Defaults to the current element associated with the local-ref. * * @return {?} */ function ɵɵtemplate(index, templateFn, consts, vars, tagName, attrs, localRefs, localRefExtractor) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var tView = lView[TVIEW]; // TODO: consider a separate node type for templates /** @type {?} */ var tContainerNode = containerInternal(lView, index, tagName || null, attrs || null); if (tView.firstTemplatePass) { ngDevMode && ngDevMode.firstTemplatePass++; resolveDirectives(tView, lView, tContainerNode, localRefs || null); /** @type {?} */ var embeddedTView = tContainerNode.tViews = createTView(-1, templateFn, consts, vars, tView.directiveRegistry, tView.pipeRegistry, null, null); if (tView.queries !== null) { tView.queries.template(tView, tContainerNode); embeddedTView.queries = tView.queries.embeddedTView(tContainerNode); } } createDirectivesAndLocals(tView, lView, tContainerNode, localRefExtractor); attachPatchData(getNativeByTNode(tContainerNode, lView), lView); registerPostOrderHooks(tView, tContainerNode); setIsNotParent(); } /** * Sets a container up to receive views. * * \@codeGenApi * @param {?} index The index of the container in the data array * * @return {?} */ function ɵɵcontainerRefreshStart(index) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var tView = lView[TVIEW]; /** @type {?} */ var previousOrParentTNode = /** @type {?} */ loadInternal(tView.data, index); ngDevMode && assertNodeType(previousOrParentTNode, 0 /* Container */ ); setPreviousOrParentTNode(previousOrParentTNode, true); lView[index + HEADER_OFFSET][ACTIVE_INDEX] = 0; // We need to execute init hooks here so ngOnInit hooks are called in top level views // before they are called in embedded views (for backwards compatibility). executePreOrderHooks(lView, tView, getCheckNoChangesMode(), undefined); } /** * Marks the end of the LContainer. * * Marking the end of LContainer is the time when to child views get inserted or removed. * * \@codeGenApi * @return {?} */ function ɵɵcontainerRefreshEnd() { /** @type {?} */ var previousOrParentTNode = getPreviousOrParentTNode(); if (getIsParent()) { setIsNotParent(); } else { ngDevMode && assertNodeType(previousOrParentTNode, 2 /* View */ ); ngDevMode && assertHasParent(previousOrParentTNode); previousOrParentTNode = /** @type {?} */ previousOrParentTNode.parent; setPreviousOrParentTNode(previousOrParentTNode, false); } ngDevMode && assertNodeType(previousOrParentTNode, 0 /* Container */ ); /** @type {?} */ var lContainer = getLView()[previousOrParentTNode.index]; /** @type {?} */ var nextIndex = lContainer[ACTIVE_INDEX]; // remove extra views at the end of the container while (nextIndex < lContainer.length - CONTAINER_HEADER_OFFSET) { removeView(lContainer, nextIndex); } } /** * @param {?} lView * @param {?} nodeIndex * @param {?} tagName * @param {?} attrs * @return {?} */ function containerInternal(lView, nodeIndex, tagName, attrs) { ngDevMode && assertEqual(lView[BINDING_INDEX], lView[TVIEW].bindingStartIndex, 'container nodes should be created before any bindings'); /** @type {?} */ var adjustedIndex = nodeIndex + HEADER_OFFSET; ngDevMode && assertDataInRange(lView, nodeIndex + HEADER_OFFSET); ngDevMode && ngDevMode.rendererCreateComment++; /** @type {?} */ var comment = lView[adjustedIndex] = lView[RENDERER].createComment(ngDevMode ? 'container' : ''); /** @type {?} */ var tNode = getOrCreateTNode(lView[TVIEW], lView[T_HOST], nodeIndex, 0 /* Container */ , tagName, attrs); /** @type {?} */ var lContainer = lView[adjustedIndex] = createLContainer(comment, lView, comment, tNode); appendChild(comment, tNode, lView); // Containers are added to the current view tree instead of their embedded views // because views can be removed and re-inserted. addToViewTree(lView, lContainer); ngDevMode && assertNodeType(getPreviousOrParentTNode(), 0 /* Container */ ); return tNode; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Store a value in the `data` at a given `index`. * @template T * @param {?} index * @param {?} value * @return {?} */ function store(index, value) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var tView = lView[TVIEW]; // We don't store any static data for local variables, so the first time // we see the template, we should store as null to avoid a sparse array /** @type {?} */ var adjustedIndex = index + HEADER_OFFSET; if (adjustedIndex >= tView.data.length) { tView.data[adjustedIndex] = null; tView.blueprint[adjustedIndex] = null; } lView[adjustedIndex] = value; } /** * Retrieves a local reference from the current contextViewData. * * If the reference to retrieve is in a parent view, this instruction is used in conjunction * with a nextContext() call, which walks up the tree and updates the contextViewData instance. * * \@codeGenApi * @template T * @param {?} index The index of the local ref in contextViewData. * * @return {?} */ function ɵɵreference(index) { /** @type {?} */ var contextLView = getContextLView(); return loadInternal(contextLView, index); } /** * Retrieves a value from current `viewData`. * * \@codeGenApi * @template T * @param {?} index * @return {?} */ function ɵɵload(index) { return loadInternal(getLView(), index); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @template T * @param {?} token * @param {?=} flags * @return {?} */ function ɵɵdirectiveInject(token) { var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : InjectFlags.Default; token = resolveForwardRef(token); /** @type {?} */ var lView = getLView(); // Fall back to inject() if view hasn't been created. This situation can happen in tests // if inject utilities are used before bootstrapping. if (lView == null) return ɵɵinject(token, flags); return getOrCreateInjectable( /** @type {?} */ getPreviousOrParentTNode(), lView, token, flags); } /** * Facade for the attribute injection from DI. * * \@codeGenApi * @param {?} attrNameToInject * @return {?} */ function ɵɵinjectAttribute(attrNameToInject) { return injectAttributeImpl(getPreviousOrParentTNode(), attrNameToInject); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * -------- * * This file contains the core logic for how styling instructions are processed in Angular. * * To learn more about the algorithm see `TStylingContext`. * * -------- */ /** * Temporary function to bridge styling functionality between this new * refactor (which is here inside of `styling_next/`) and the old * implementation (which lives inside of `styling/`). * * This function is executed during the creation block of an element. * Because the existing styling implementation issues a call to the * `styling()` instruction, this instruction will also get run. The * central idea here is that the directive index values are bound * into the context. The directive index is temporary and is only * required until the `select(n)` instruction is fully functional. * * \@codeGenApi * @return {?} */ function ɵɵstyling() { /** @type {?} */ var tView = getLView()[TVIEW]; if (tView.firstTemplatePass) { updateLastDirectiveIndex$1(getPreviousOrParentTNode(), getActiveDirectiveStylingIndex()); } } /** * Sets the current style sanitizer function which will then be used * within all follow-up prop and map-based style binding instructions * for the given element. * * Note that once styling has been applied to the element (i.e. once * `select(n)` is executed or the hostBindings/template function exits) * then the active `sanitizerFn` will be set to `null`. This means that * once styling is applied to another element then a another call to * `styleSanitizer` will need to be made. * * \@codeGenApi * @param {?} sanitizer * @return {?} */ function ɵɵstyleSanitizer(sanitizer) { setCurrentStyleSanitizer(sanitizer); } /** * Update a style binding on an element with the provided value. * * If the style value is falsy then it will be removed from the element * (or assigned a different value depending if there are any styles placed * on the element with `styleMap` or any static styles that are * present from when the element was created with `styling`). * * Note that the styling element is updated as part of `stylingApply`. * * \@codeGenApi * @param {?} prop A valid CSS property. * @param {?} value New value to write (`null` or an empty string to remove). * @param {?=} suffix Optional suffix. Used with scalar values to add unit such as `px`. * Note that when a suffix is provided then the underlying sanitizer will * be ignored. * * Note that this will apply the provided style value to the host element if this function is called * within a host binding. * * @return {?} */ function ɵɵstyleProp(prop, value, suffix) { stylePropInternal(getSelectedIndex(), prop, value, suffix); } /** * @param {?} elementIndex * @param {?} prop * @param {?} value * @param {?=} suffix * @return {?} */ function stylePropInternal(elementIndex, prop, value, suffix) { /** @type {?} */ var lView = getLView(); // if a value is interpolated then it may render a `NO_CHANGE` value. // in this case we do not need to do anything, but the binding index // still needs to be incremented because all styling binding values // are stored inside of the lView. /** @type {?} */ var bindingIndex = lView[BINDING_INDEX]++; /** @type {?} */ var updated = _stylingProp(elementIndex, bindingIndex, prop, resolveStylePropValue(value, suffix), false, deferStylingUpdate()); if (ngDevMode) { ngDevMode.styleProp++; if (updated) { ngDevMode.stylePropCacheMiss++; } } } /** * Update a class binding on an element with the provided value. * * This instruction is meant to handle the `[class.foo]="exp"` case and, * therefore, the class binding itself must already be allocated using * `styling` within the creation block. * * \@codeGenApi * @param {?} className * @param {?} value A true/false value which will turn the class on or off. * * Note that this will apply the provided class value to the host element if this function * is called within a host binding. * * @return {?} */ function ɵɵclassProp(className, value) { /** @type {?} */ var lView = getLView(); // if a value is interpolated then it may render a `NO_CHANGE` value. // in this case we do not need to do anything, but the binding index // still needs to be incremented because all styling binding values // are stored inside of the lView. /** @type {?} */ var bindingIndex = lView[BINDING_INDEX]++; /** @type {?} */ var updated = _stylingProp(getSelectedIndex(), bindingIndex, className, value, true, deferStylingUpdate()); if (ngDevMode) { ngDevMode.classProp++; if (updated) { ngDevMode.classPropCacheMiss++; } } } /** * Shared function used to update a prop-based styling binding for an element. * @param {?} elementIndex * @param {?} bindingIndex * @param {?} prop * @param {?} value * @param {?} isClassBased * @param {?} defer * @return {?} */ function _stylingProp(elementIndex, bindingIndex, prop, value, isClassBased, defer) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var tNode = getTNode(elementIndex, lView); /** @type {?} */ var _native16 = /** @type {?} */ getNativeByTNode(tNode, lView); /** @type {?} */ var updated = false; if (value !== NO_CHANGE) { if (isClassBased) { updated = updateClassBinding(getClassesContext(tNode), lView, _native16, prop, bindingIndex, /** @type {?} */ value, defer, false); } else { /** @type {?} */ var sanitizer = getCurrentStyleSanitizer(); updated = updateStyleBinding(getStylesContext(tNode), lView, _native16, prop, bindingIndex, /** @type {?} */ value, sanitizer, defer, false); } } return updated; } /** * Update style bindings using an object literal on an element. * * This instruction is meant to apply styling via the `[style]="exp"` template bindings. * When styles are applied to the element they will then be updated with respect to * any styles/classes set via `styleProp`. If any styles are set to falsy * then they will be removed from the element. * * Note that the styling instruction will not be applied until `stylingApply` is called. * * \@codeGenApi * @param {?} styles A key/value style map of the styles that will be applied to the given element. * Any missing styles (that have already been applied to the element beforehand) will be * removed (unset) from the element's styling. * * Note that this will apply the provided styleMap value to the host element if this function * is called within a host binding. * * @return {?} */ function ɵɵstyleMap(styles) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var tNode = getTNode(index, lView); /** @type {?} */ var context = getStylesContext(tNode); /** @type {?} */ var directiveIndex = getActiveDirectiveStylingIndex(); // if a value is interpolated then it may render a `NO_CHANGE` value. // in this case we do not need to do anything, but the binding index // still needs to be incremented because all styling binding values // are stored inside of the lView. /** @type {?} */ var bindingIndex = lView[BINDING_INDEX]++; // inputs are only evaluated from a template binding into a directive, therefore, // there should not be a situation where a directive host bindings function // evaluates the inputs (this should only happen in the template function) if (!directiveIndex && hasStyleInput(tNode) && styles !== NO_CHANGE) { updateDirectiveInputValue(context, lView, tNode, bindingIndex, styles, false); styles = NO_CHANGE; } /** @type {?} */ var updated = _stylingMap(index, context, bindingIndex, styles, false, deferStylingUpdate()); if (ngDevMode) { ngDevMode.styleMap++; if (updated) { ngDevMode.styleMapCacheMiss++; } } } /** * Update class bindings using an object literal or class-string on an element. * * This instruction is meant to apply styling via the `[class]="exp"` template bindings. * When classes are applied to the element they will then be updated with * respect to any styles/classes set via `classProp`. If any * classes are set to falsy then they will be removed from the element. * * Note that the styling instruction will not be applied until `stylingApply` is called. * Note that this will the provided classMap value to the host element if this function is called * within a host binding. * * \@codeGenApi * @param {?} classes A key/value map or string of CSS classes that will be added to the * given element. Any missing classes (that have already been applied to the element * beforehand) will be removed (unset) from the element's list of CSS classes. * * @return {?} */ function ɵɵclassMap(classes) { classMapInternal(getSelectedIndex(), classes); } /** * @param {?} elementIndex * @param {?} classes * @return {?} */ function classMapInternal(elementIndex, classes) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var tNode = getTNode(elementIndex, lView); /** @type {?} */ var context = getClassesContext(tNode); /** @type {?} */ var directiveIndex = getActiveDirectiveStylingIndex(); // if a value is interpolated then it may render a `NO_CHANGE` value. // in this case we do not need to do anything, but the binding index // still needs to be incremented because all styling binding values // are stored inside of the lView. /** @type {?} */ var bindingIndex = lView[BINDING_INDEX]++; // inputs are only evaluated from a template binding into a directive, therefore, // there should not be a situation where a directive host bindings function // evaluates the inputs (this should only happen in the template function) if (!directiveIndex && hasClassInput(tNode) && classes !== NO_CHANGE) { updateDirectiveInputValue(context, lView, tNode, bindingIndex, classes, true); classes = NO_CHANGE; } /** @type {?} */ var updated = _stylingMap(elementIndex, context, bindingIndex, classes, true, deferStylingUpdate()); if (ngDevMode) { ngDevMode.classMap++; if (updated) { ngDevMode.classMapCacheMiss++; } } } /** * Shared function used to update a map-based styling binding for an element. * * When this function is called it will activate support for `[style]` and * `[class]` bindings in Angular. * @param {?} elementIndex * @param {?} context * @param {?} bindingIndex * @param {?} value * @param {?} isClassBased * @param {?} defer * @return {?} */ function _stylingMap(elementIndex, context, bindingIndex, value, isClassBased, defer) { activateStylingMapFeature(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var valueHasChanged = false; if (value !== NO_CHANGE) { /** @type {?} */ var tNode = getTNode(elementIndex, lView); /** @type {?} */ var _native17 = /** @type {?} */ getNativeByTNode(tNode, lView); /** @type {?} */ var oldValue = lView[bindingIndex]; valueHasChanged = hasValueChanged(oldValue, value); /** @type {?} */ var stylingMapArr = normalizeIntoStylingMap(oldValue, value, !isClassBased); if (isClassBased) { updateClassBinding(context, lView, _native17, null, bindingIndex, stylingMapArr, defer, valueHasChanged); } else { /** @type {?} */ var sanitizer = getCurrentStyleSanitizer(); updateStyleBinding(context, lView, _native17, null, bindingIndex, stylingMapArr, sanitizer, defer, valueHasChanged); } } return valueHasChanged; } /** * Writes a value to a directive's `style` or `class` input binding (if it has changed). * * If a directive has a `\@Input` binding that is set on `style` or `class` then that value * will take priority over the underlying style/class styling bindings. This value will * be updated for the binding each time during change detection. * * When this occurs this function will attempt to write the value to the input binding * depending on the following situations: * * - If `oldValue !== newValue` * - If `newValue` is `null` (but this is skipped if it is during the first update pass-- * which is when the context is not locked yet) * @param {?} context * @param {?} lView * @param {?} tNode * @param {?} bindingIndex * @param {?} newValue * @param {?} isClassBased * @return {?} */ function updateDirectiveInputValue(context, lView, tNode, bindingIndex, newValue, isClassBased) { /** @type {?} */ var oldValue = lView[bindingIndex]; if (oldValue !== newValue) { // even if the value has changed we may not want to emit it to the // directive input(s) in the event that it is falsy during the // first update pass. if (newValue || isContextLocked(context)) { /** @type {?} */ var inputs = /** @type {?} */ /** @type {?} */ tNode.inputs[isClassBased ? 'class' : 'style']; /** @type {?} */ var initialValue = getInitialStylingValue(context); /** @type {?} */ var value = normalizeStylingDirectiveInputValue(initialValue, newValue, isClassBased); setInputsForProperty(lView, inputs, value); } lView[bindingIndex] = newValue; } } /** * Returns the appropriate directive input value for `style` or `class`. * * Earlier versions of Angular expect a binding value to be passed into directive code * exactly as it is unless there is a static value present (in which case both values * will be stringified and concatenated). * @param {?} initialValue * @param {?} bindingValue * @param {?} isClassBased * @return {?} */ function normalizeStylingDirectiveInputValue(initialValue, bindingValue, isClassBased) { /** @type {?} */ var value = bindingValue; // we only concat values if there is an initial value, otherwise we return the value as is. // Note that this is to satisfy backwards-compatibility in Angular. if (initialValue.length > 0) { if (isClassBased) { value = concatString(initialValue, forceClassesAsString(bindingValue)); } else { value = concatString(initialValue, forceStylesAsString( /** @type {?} */ bindingValue), ';'); } } return value; } /** * Flushes all styling code to the element. * * This function is designed to be called from the template and hostBindings * functions and may be called multiple times depending whether multiple * sources of styling exist. If called multiple times, only the last call * to `stlyingApply()` will render styling to the element. * * \@codeGenApi * @return {?} */ function ɵɵstylingApply() { /** @type {?} */ var elementIndex = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var tNode = getTNode(elementIndex, lView); /** @type {?} */ var renderer = getRenderer(tNode, lView); /** @type {?} */ var _native18 = /** @type {?} */ getNativeByTNode(tNode, lView); /** @type {?} */ var directiveIndex = getActiveDirectiveStylingIndex(); /** @type {?} */ var sanitizer = getCurrentStyleSanitizer(); flushStyling(renderer, lView, getClassesContext(tNode), getStylesContext(tNode), _native18, directiveIndex, sanitizer); setCurrentStyleSanitizer(null); } /** * @param {?} tNode * @param {?} lView * @return {?} */ function getRenderer(tNode, lView) { return tNode.type === 3 /* Element */ ? lView[RENDERER] : null; } /** * Searches and assigns provided all static style/class entries (found in the `attrs` value) * and registers them in their respective styling contexts. * @param {?} tNode * @param {?} attrs * @param {?} startIndex * @return {?} */ function registerInitialStylingOnTNode(tNode, attrs, startIndex) { /** @type {?} */ var hasAdditionalInitialStyling = false; /** @type {?} */ var styles = getStylingMapArray(tNode.styles); /** @type {?} */ var classes = getStylingMapArray(tNode.classes); /** @type {?} */ var mode = -1; for (var i = startIndex; i < attrs.length; i++) { /** @type {?} */ var attr = /** @type {?} */ attrs[i]; if (typeof attr == 'number') { mode = attr; } else if (mode == 1 /* Classes */ ) { classes = classes || ['']; addItemToStylingMap(classes, attr, true); hasAdditionalInitialStyling = true; } else if (mode == 2 /* Styles */ ) { /** @type {?} */ var value = /** @type {?} */ attrs[++i]; styles = styles || ['']; addItemToStylingMap(styles, attr, value); hasAdditionalInitialStyling = true; } } if (classes && classes.length > 1 /* ValuesStartPosition */ ) { if (!tNode.classes) { tNode.classes = classes; } updateRawValueOnContext(tNode.classes, stylingMapToString(classes, true)); } if (styles && styles.length > 1 /* ValuesStartPosition */ ) { if (!tNode.styles) { tNode.styles = styles; } updateRawValueOnContext(tNode.styles, stylingMapToString(styles, false)); } return hasAdditionalInitialStyling; } /** * @param {?} context * @param {?} value * @return {?} */ function updateRawValueOnContext(context, value) { /** @type {?} */ var stylingMapArr = /** @type {?} */ getStylingMapArray(context); stylingMapArr[0 /* RawValuePosition */ ] = value; } /** * @return {?} */ function getActiveDirectiveStylingIndex() { // whenever a directive's hostBindings function is called a uniqueId value // is assigned. Normally this is enough to help distinguish one directive // from another for the styling context, but there are situations where a // sub-class directive could inherit and assign styling in concert with a // parent directive. To help the styling code distinguish between a parent // sub-classed directive the inheritance depth is taken into account as well. return getActiveDirectiveId() + getActiveDirectiveSuperClassDepth(); } /** * Temporary function that will update the max directive index value in * both the classes and styles contexts present on the provided `tNode`. * * This code is only used because the `select(n)` code functionality is not * yet 100% functional. The `select(n)` instruction cannot yet evaluate host * bindings function code in sync with the associated template function code. * For this reason the styling algorithm needs to track the last directive index * value so that it knows exactly when to render styling to the element since * `stylingApply()` is called multiple times per CD (`stylingApply` will be * removed once `select(n)` is fixed). * @param {?} tNode * @param {?} directiveIndex * @return {?} */ function updateLastDirectiveIndex$1(tNode, directiveIndex) { updateLastDirectiveIndex(getClassesContext(tNode), directiveIndex); updateLastDirectiveIndex(getStylesContext(tNode), directiveIndex); } /** * @param {?} tNode * @return {?} */ function getStylesContext(tNode) { return getContext(tNode, false); } /** * @param {?} tNode * @return {?} */ function getClassesContext(tNode) { return getContext(tNode, true); } /** * Returns/instantiates a styling context from/to a `tNode` instance. * @param {?} tNode * @param {?} isClassBased * @return {?} */ function getContext(tNode, isClassBased) { /** @type {?} */ var context = isClassBased ? tNode.classes : tNode.styles; if (!isStylingContext(context)) { context = allocTStylingContext(context); if (ngDevMode) { attachStylingDebugObject( /** @type {?} */ context); } if (isClassBased) { tNode.classes = context; } else { tNode.styles = context; } } return ( /** @type {?} */ context ); } /** * @param {?} value * @param {?} suffix * @return {?} */ function resolveStylePropValue(value, suffix) { if (value === NO_CHANGE) return value; /** @type {?} */ var resolvedValue = null; if (value !== null) { if (suffix) { // when a suffix is applied then it will bypass // sanitization entirely (b/c a new string is created) resolvedValue = renderStringify(value) + suffix; } else { // sanitization happens by dealing with a String value // this means that the string value will be passed through // into the style rendering later (which is where the value // will be sanitized before it is applied) resolvedValue = /** @type {?} */ /** @type {?} */ value; } } return resolvedValue; } /** * Whether or not a style/class binding update should be applied later. * * This function will decide whether a binding should be applied immediately * or later (just before the styles/classes are flushed to the element). The * reason why this feature exists is because of super/sub directive inheritance. * Angular will evaluate host bindings on the super directive first and the sub * directive, but the styling bindings on the sub directive are of higher priority * than the super directive. For this reason all styling bindings that take place * in this circumstance will need to be deferred until later so that they can be * applied together and in a different order (the algorithm handles that part). * @return {?} */ function deferStylingUpdate() { return getActiveDirectiveSuperClassHeight() > 0; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Create DOM element. The instruction must later be followed by `elementEnd()` call. * * \@codeGenApi * @param {?} index Index of the element in the LView array * @param {?} name Name of the DOM Node * @param {?=} attrs Statically bound set of attributes, classes, and styles to be written into the DOM * element on creation. Use [AttributeMarker] to denote the meaning of this array. * @param {?=} localRefs A set of local reference bindings on the element. * * Attributes and localRefs are passed as an array of strings where elements with an even index * hold an attribute name and elements with an odd index hold an attribute value, ex.: * ['id', 'warning5', 'class', 'alert'] * * @return {?} */ function ɵɵelementStart(index, name, attrs, localRefs) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var tView = lView[TVIEW]; ngDevMode && assertEqual(lView[BINDING_INDEX], tView.bindingStartIndex, 'elements should be created before any bindings '); ngDevMode && ngDevMode.rendererCreateElement++; ngDevMode && assertDataInRange(lView, index + HEADER_OFFSET); /** @type {?} */ var _native19 = lView[index + HEADER_OFFSET] = elementCreate(name); /** @type {?} */ var renderer = lView[RENDERER]; /** @type {?} */ var tNode = getOrCreateTNode(tView, lView[T_HOST], index, 3 /* Element */ , name, attrs || null); if (attrs != null) { /** @type {?} */ var lastAttrIndex = setUpAttributes(_native19, attrs); if (tView.firstTemplatePass) { registerInitialStylingOnTNode(tNode, attrs, lastAttrIndex); } } renderInitialStyling(renderer, _native19, tNode); appendChild(_native19, tNode, lView); // any immediate children of a component or template container must be pre-emptively // monkey-patched with the component view data so that the element can be inspected // later on using any element discovery utility methods (see `element_discovery.ts`) if (getElementDepthCount() === 0) { attachPatchData(_native19, lView); } increaseElementDepthCount(); // if a directive contains a host binding for "class" then all class-based data will // flow through that (except for `[class.prop]` bindings). This also includes initial // static class values as well. (Note that this will be fixed once map-based `[style]` // and `[class]` bindings work for multiple directives.) if (tView.firstTemplatePass) { ngDevMode && ngDevMode.firstTemplatePass++; resolveDirectives(tView, lView, tNode, localRefs || null); /** @type {?} */ var inputData = initializeTNodeInputs(tNode); if (inputData && inputData.hasOwnProperty('class')) { tNode.flags |= 8 /* hasClassInput */ ; } if (inputData && inputData.hasOwnProperty('style')) { tNode.flags |= 16 /* hasStyleInput */ ; } if (tView.queries !== null) { tView.queries.elementStart(tView, tNode); } } createDirectivesAndLocals(tView, lView, tNode); executeContentQueries(tView, tNode, lView); } /** * Mark the end of the element. * * \@codeGenApi * @return {?} */ function ɵɵelementEnd() { /** @type {?} */ var previousOrParentTNode = getPreviousOrParentTNode(); ngDevMode && assertDefined(previousOrParentTNode, 'No parent node to close.'); if (getIsParent()) { setIsNotParent(); } else { ngDevMode && assertHasParent(getPreviousOrParentTNode()); previousOrParentTNode = /** @type {?} */ previousOrParentTNode.parent; setPreviousOrParentTNode(previousOrParentTNode, false); } /** @type {?} */ var tNode = previousOrParentTNode; ngDevMode && assertNodeType(tNode, 3 /* Element */ ); /** @type {?} */ var lView = getLView(); /** @type {?} */ var tView = lView[TVIEW]; registerPostOrderHooks(tView, previousOrParentTNode); decreaseElementDepthCount(); if (tView.firstTemplatePass && tView.queries !== null && isContentQueryHost(previousOrParentTNode)) { /** @type {?} */ tView.queries.elementEnd(previousOrParentTNode); } if (hasClassInput(tNode) && tNode.classes) { setDirectiveStylingInput(tNode.classes, lView, /** @type {?} */ tNode.inputs['class']); } if (hasStyleInput(tNode) && tNode.styles) { setDirectiveStylingInput(tNode.styles, lView, /** @type {?} */ tNode.inputs['style']); } } /** * Creates an empty element using {\@link elementStart} and {\@link elementEnd} * * \@codeGenApi * @param {?} index Index of the element in the data array * @param {?} name Name of the DOM Node * @param {?=} attrs Statically bound set of attributes, classes, and styles to be written into the DOM * element on creation. Use [AttributeMarker] to denote the meaning of this array. * @param {?=} localRefs A set of local reference bindings on the element. * * @return {?} */ function ɵɵelement(index, name, attrs, localRefs) { ɵɵelementStart(index, name, attrs, localRefs); ɵɵelementEnd(); } /** * Assign static attribute values to a host element. * * This instruction will assign static attribute values as well as class and style * values to an element within the host bindings function. Since attribute values * can consist of different types of values, the `attrs` array must include the values in * the following format: * * attrs = [ * // static attributes (like `title`, `name`, `id`...) * attr1, value1, attr2, value, * * // a single namespace value (like `x:id`) * NAMESPACE_MARKER, namespaceUri1, name1, value1, * * // another single namespace value (like `x:name`) * NAMESPACE_MARKER, namespaceUri2, name2, value2, * * // a series of CSS classes that will be applied to the element (no spaces) * CLASSES_MARKER, class1, class2, class3, * * // a series of CSS styles (property + value) that will be applied to the element * STYLES_MARKER, prop1, value1, prop2, value2 * ] * * All non-class and non-style attributes must be defined at the start of the list * first before all class and style values are set. When there is a change in value * type (like when classes and styles are introduced) a marker must be used to separate * the entries. The marker values themselves are set via entries found in the * [AttributeMarker] enum. * * NOTE: This instruction is meant to used from `hostBindings` function only. * * \@codeGenApi * @param {?} attrs An array of static values (attributes, classes and styles) with the correct marker * values. * * @return {?} */ function ɵɵelementHostAttrs(attrs) { /** @type {?} */ var hostElementIndex = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var tView = lView[TVIEW]; /** @type {?} */ var tNode = getTNode(hostElementIndex, lView); // non-element nodes (e.g. `<ng-container>`) are not rendered as actual // element nodes and adding styles/classes on to them will cause runtime // errors... if (tNode.type === 3 /* Element */ ) { /** @type {?} */ var _native20 = /** @type {?} */ getNativeByTNode(tNode, lView); /** @type {?} */ var lastAttrIndex = setUpAttributes(_native20, attrs); if (tView.firstTemplatePass) { /** @type {?} */ var stylingNeedsToBeRendered = registerInitialStylingOnTNode(tNode, attrs, lastAttrIndex); // this is only called during the first template pass in the // event that this current directive assigned initial style/class // host attribute values to the element. Because initial styling // values are applied before directives are first rendered (within // `createElement`) this means that initial styling for any directives // still needs to be applied. Note that this will only happen during // the first template pass and not each time a directive applies its // attribute values to the element. if (stylingNeedsToBeRendered) { /** @type {?} */ var renderer = lView[RENDERER]; renderInitialStyling(renderer, _native20, tNode); } } } } /** * @param {?} context * @param {?} lView * @param {?} stylingInputs * @return {?} */ function setDirectiveStylingInput(context, lView, stylingInputs) { // older versions of Angular treat the input as `null` in the // event that the value does not exist at all. For this reason // we can't have a styling value be an empty string. /** @type {?} */ var value = getInitialStylingValue(context) || null; // Ivy does an extra `[class]` write with a falsy value since the value // is applied during creation mode. This is a deviation from VE and should // be (Jira Issue = FW-1467). setInputsForProperty(lView, stylingInputs, value); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Creates a logical container for other nodes (<ng-container>) backed by a comment node in the DOM. * The instruction must later be followed by `elementContainerEnd()` call. * * \@codeGenApi * @param {?} index Index of the element in the LView array * @param {?=} attrs Set of attributes to be used when matching directives. * @param {?=} localRefs A set of local reference bindings on the element. * * Even if this instruction accepts a set of attributes no actual attribute values are propagated to * the DOM (as a comment node can't have attributes). Attributes are here only for directive * matching purposes and setting initial inputs of directives. * * @return {?} */ function ɵɵelementContainerStart(index, attrs, localRefs) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var tView = lView[TVIEW]; /** @type {?} */ var renderer = lView[RENDERER]; /** @type {?} */ var tagName = 'ng-container'; ngDevMode && assertEqual(lView[BINDING_INDEX], tView.bindingStartIndex, 'element containers should be created before any bindings'); ngDevMode && ngDevMode.rendererCreateComment++; ngDevMode && assertDataInRange(lView, index + HEADER_OFFSET); /** @type {?} */ var _native21 = lView[index + HEADER_OFFSET] = renderer.createComment(ngDevMode ? tagName : ''); ngDevMode && assertDataInRange(lView, index - 1); /** @type {?} */ var tNode = getOrCreateTNode(tView, lView[T_HOST], index, 4 /* ElementContainer */ , tagName, attrs || null); if (attrs && tView.firstTemplatePass) { // While ng-container doesn't necessarily support styling, we use the style context to identify // and execute directives on the ng-container. registerInitialStylingOnTNode(tNode, /** @type {?} */ attrs, 0); } appendChild(_native21, tNode, lView); if (tView.firstTemplatePass) { ngDevMode && ngDevMode.firstTemplatePass++; resolveDirectives(tView, lView, tNode, localRefs || null); if (tView.queries) { tView.queries.elementStart(tView, tNode); } } createDirectivesAndLocals(tView, lView, tNode); attachPatchData(_native21, lView); executeContentQueries(tView, tNode, lView); } /** * Mark the end of the <ng-container>. * * \@codeGenApi * @return {?} */ function ɵɵelementContainerEnd() { /** @type {?} */ var previousOrParentTNode = getPreviousOrParentTNode(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var tView = lView[TVIEW]; if (getIsParent()) { setIsNotParent(); } else { ngDevMode && assertHasParent(previousOrParentTNode); previousOrParentTNode = /** @type {?} */ previousOrParentTNode.parent; setPreviousOrParentTNode(previousOrParentTNode, false); } ngDevMode && assertNodeType(previousOrParentTNode, 4 /* ElementContainer */ ); registerPostOrderHooks(tView, previousOrParentTNode); if (tView.firstTemplatePass && tView.queries !== null && isContentQueryHost(previousOrParentTNode)) { tView.queries.elementEnd(previousOrParentTNode); } } /** * Creates an empty logical container using {\@link elementContainerStart} * and {\@link elementContainerEnd} * * \@codeGenApi * @param {?} index Index of the element in the LView array * @param {?=} attrs Set of attributes to be used when matching directives. * @param {?=} localRefs A set of local reference bindings on the element. * * @return {?} */ function ɵɵelementContainer(index, attrs, localRefs) { ɵɵelementContainerStart(index, attrs, localRefs); ɵɵelementContainerEnd(); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Marks the start of an embedded view. * * \@codeGenApi * @param {?} viewBlockId The ID of this view * @param {?} consts * @param {?} vars * @return {?} boolean Whether or not this view is in creation mode * */ function ɵɵembeddedViewStart(viewBlockId, consts, vars) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var previousOrParentTNode = getPreviousOrParentTNode(); // The previous node can be a view node if we are processing an inline for loop /** @type {?} */ var containerTNode = previousOrParentTNode.type === 2 /* View */ ? /** @type {?} */ previousOrParentTNode.parent : previousOrParentTNode; /** @type {?} */ var lContainer = /** @type {?} */ lView[containerTNode.index]; ngDevMode && assertNodeType(containerTNode, 0 /* Container */ ); /** @type {?} */ var viewToRender = scanForView(lContainer, /** @type {?} */ lContainer[ACTIVE_INDEX], viewBlockId); if (viewToRender) { setIsParent(); enterView(viewToRender, viewToRender[TVIEW].node); } else { // When we create a new LView, we always reset the state of the instructions. viewToRender = createLView(lView, getOrCreateEmbeddedTView(viewBlockId, consts, vars, /** @type {?} */ containerTNode), null, 16 /* CheckAlways */ , null, null); /** @type {?} */ var tParentNode = getIsParent() ? previousOrParentTNode : previousOrParentTNode && previousOrParentTNode.parent; assignTViewNodeToLView(viewToRender[TVIEW], tParentNode, viewBlockId, viewToRender); enterView(viewToRender, viewToRender[TVIEW].node); } if (lContainer) { if (isCreationMode(viewToRender)) { // it is a new view, insert it into collection of views for a given container insertView(viewToRender, lContainer, /** @type {?} */ lContainer[ACTIVE_INDEX]); } /** @type {?} */lContainer[ACTIVE_INDEX]++; } return isCreationMode(viewToRender) ? 1 /* Create */ | 2 /* Update */ : 2 /* Update */ ; } /** * Initialize the TView (e.g. static data) for the active embedded view. * * Each embedded view block must create or retrieve its own TView. Otherwise, the embedded view's * static data for a particular node would overwrite the static data for a node in the view above * it with the same index (since it's in the same template). * * @param {?} viewIndex The index of the TView in TNode.tViews * @param {?} consts The number of nodes, local refs, and pipes in this template * @param {?} vars The number of bindings and pure function bindings in this template * @param {?} parent * @return {?} TView */ function getOrCreateEmbeddedTView(viewIndex, consts, vars, parent) { /** @type {?} */ var tView = getLView()[TVIEW]; ngDevMode && assertNodeType(parent, 0 /* Container */ ); /** @type {?} */ var containerTViews = /** @type {?} */ parent.tViews; ngDevMode && assertDefined(containerTViews, 'TView expected'); ngDevMode && assertEqual(Array.isArray(containerTViews), true, 'TViews should be in an array'); if (viewIndex >= containerTViews.length || containerTViews[viewIndex] == null) { containerTViews[viewIndex] = createTView(viewIndex, null, consts, vars, tView.directiveRegistry, tView.pipeRegistry, null, null); } return containerTViews[viewIndex]; } /** * Looks for a view with a given view block id inside a provided LContainer. * Removes views that need to be deleted in the process. * * @param {?} lContainer to search for views * @param {?} startIdx starting index in the views array to search from * @param {?} viewBlockId exact view block id to look for * @return {?} */ function scanForView(lContainer, startIdx, viewBlockId) { for (var i = startIdx + CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) { /** @type {?} */ var viewAtPositionId = lContainer[i][TVIEW].id; if (viewAtPositionId === viewBlockId) { return lContainer[i]; } else if (viewAtPositionId < viewBlockId) { // found a view that should not be at this position - remove removeView(lContainer, i - CONTAINER_HEADER_OFFSET); } else { // found a view with id greater than the one we are searching for // which means that required view doesn't exist and can't be found at // later positions in the views array - stop the searchdef.cont here break; } } return null; } /** * Marks the end of an embedded view. * * \@codeGenApi * @return {?} */ function ɵɵembeddedViewEnd() { /** @type {?} */ var lView = getLView(); /** @type {?} */ var viewHost = lView[T_HOST]; if (isCreationMode(lView)) { refreshDescendantViews(lView); // creation mode pass lView[FLAGS] &= ~4 /* CreationMode */ ; } resetPreOrderHookFlags(lView); refreshDescendantViews(lView); // update mode pass // update mode pass /** @type {?} */ var lContainer = /** @type {?} */ lView[PARENT]; ngDevMode && assertLContainerOrUndefined(lContainer); // It's always safe to run hooks here, as `leaveView` is not called during the 'finally' block // of a try-catch-finally statement, so it can never be reached while unwinding the stack due to // an error being thrown. leaveView( /** @type {?} */ lContainer[PARENT], /* safeToRunHooks */ true); setPreviousOrParentTNode( /** @type {?} */ viewHost, false); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Returns the current OpaqueViewState instance. * * Used in conjunction with the restoreView() instruction to save a snapshot * of the current view and restore it when listeners are invoked. This allows * walking the declaration view tree in listeners to get vars from parent views. * * \@codeGenApi * @return {?} */ function ɵɵgetCurrentView() { return ( /** @type {?} */ /** @type {?} */ getLView() ); } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Determine if the argument is shaped like a Promise */ function isPromise(obj) { // allow any Promise/A+ compliant thenable. // It's up to the caller to ensure that obj.then conforms to the spec return !!obj && typeof obj.then === 'function'; } /** * Determine if the argument is an Observable */ function isObservable(obj) { // TODO: use isObservable once we update pass rxjs 6.1 // https://github.com/ReactiveX/rxjs/blob/master/CHANGELOG.md#610-2018-05-03 return !!obj && typeof obj.subscribe === 'function'; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Adds an event listener to the current node. * * If an output exists on one of the node's directives, it also subscribes to the output * and saves the subscription for later cleanup. * * \@codeGenApi * @param {?} eventName Name of the event * @param {?} listenerFn The function to be called when event emits * @param {?=} useCapture Whether or not to use capture in event listener * @param {?=} eventTargetResolver Function that returns global target information in case this listener * should be attached to a global object like window, document or body * * @return {?} */ function ɵɵlistener(eventName, listenerFn) { var useCapture = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var eventTargetResolver = arguments.length > 3 ? arguments[3] : undefined; listenerInternal(eventName, listenerFn, useCapture, eventTargetResolver); } /** * Registers a synthetic host listener (e.g. `(\@foo.start)`) on a component. * * This instruction is for compatibility purposes and is designed to ensure that a * synthetic host listener (e.g. `\@HostListener('\@foo.start')`) properly gets rendered * in the component's renderer. Normally all host listeners are evaluated with the * parent component's renderer, but, in the case of animation \@triggers, they need * to be evaluated with the sub component's renderer (because that's where the * animation triggers are defined). * * Do not use this instruction as a replacement for `listener`. This instruction * only exists to ensure compatibility with the ViewEngine's host binding behavior. * * \@codeGenApi * @param {?} eventName Name of the event * @param {?} listenerFn The function to be called when event emits * @param {?=} useCapture Whether or not to use capture in event listener * @param {?=} eventTargetResolver Function that returns global target information in case this listener * should be attached to a global object like window, document or body * * @return {?} */ function ɵɵcomponentHostSyntheticListener(eventName, listenerFn) { var useCapture = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var eventTargetResolver = arguments.length > 3 ? arguments[3] : undefined; listenerInternal(eventName, listenerFn, useCapture, eventTargetResolver, loadComponentRenderer); } /** * A utility function that checks if a given element has already an event handler registered for an * event with a specified name. The TView.cleanup data structure is used to find out which events * are registered for a given element. * @param {?} lView * @param {?} eventName * @param {?} tNodeIdx * @return {?} */ function findExistingListener(lView, eventName, tNodeIdx) { /** @type {?} */ var tView = lView[TVIEW]; /** @type {?} */ var tCleanup = tView.cleanup; if (tCleanup != null) { for (var i = 0; i < tCleanup.length - 1; i += 2) { /** @type {?} */ var cleanupEventName = tCleanup[i]; if (cleanupEventName === eventName && tCleanup[i + 1] === tNodeIdx) { // We have found a matching event name on the same node but it might not have been // registered yet, so we must explicitly verify entries in the LView cleanup data // structures. /** @type {?} */ var lCleanup = /** @type {?} */ lView[CLEANUP]; /** @type {?} */ var listenerIdxInLCleanup = tCleanup[i + 2]; return lCleanup.length > listenerIdxInLCleanup ? lCleanup[listenerIdxInLCleanup] : null; } // TView.cleanup can have a mix of 4-elements entries (for event handler cleanups) or // 2-element entries (for directive and queries destroy hooks). As such we can encounter // blocks of 4 or 2 items in the tView.cleanup and this is why we iterate over 2 elements // first and jump another 2 elements if we detect listeners cleanup (4 elements). Also check // documentation of TView.cleanup for more details of this data structure layout. if (typeof cleanupEventName === 'string') { i += 2; } } } return null; } /** * @param {?} eventName * @param {?} listenerFn * @param {?=} useCapture * @param {?=} eventTargetResolver * @param {?=} loadRendererFn * @return {?} */ function listenerInternal(eventName, listenerFn) { var useCapture = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var eventTargetResolver = arguments.length > 3 ? arguments[3] : undefined; var loadRendererFn = arguments.length > 4 ? arguments[4] : undefined; /** @type {?} */ var lView = getLView(); /** @type {?} */ var tNode = getPreviousOrParentTNode(); /** @type {?} */ var tView = lView[TVIEW]; /** @type {?} */ var firstTemplatePass = tView.firstTemplatePass; /** @type {?} */ var tCleanup = firstTemplatePass && (tView.cleanup || (tView.cleanup = [])); ngDevMode && assertNodeOfPossibleTypes(tNode, 3 /* Element */ , 0 /* Container */ , 4 /* ElementContainer */ ); /** @type {?} */ var processOutputs = true; // add native event listener - applicable to elements only if (tNode.type === 3 /* Element */ ) { /** @type {?} */ var _native22 = /** @type {?} */ getNativeByTNode(tNode, lView); /** @type {?} */ var resolved = eventTargetResolver ? eventTargetResolver(_native22) : /** @type {?} */ EMPTY_OBJ; /** @type {?} */ var target = resolved.target || _native22; /** @type {?} */ var renderer = loadRendererFn ? loadRendererFn(tNode, lView) : lView[RENDERER]; /** @type {?} */ var lCleanup = getCleanup(lView); /** @type {?} */ var lCleanupIndex = lCleanup.length; /** @type {?} */ var idxOrTargetGetter = eventTargetResolver ? /** * @param {?} _lView * @return {?} */ function (_lView) { return eventTargetResolver(unwrapRNode(_lView[tNode.index])).target; } : tNode.index; // In order to match current behavior, native DOM event listeners must be added for all // events (including outputs). if (isProceduralRenderer(renderer)) { // There might be cases where multiple directives on the same element try to register an event // handler function for the same event. In this situation we want to avoid registration of // several native listeners as each registration would be intercepted by NgZone and // trigger change detection. This would mean that a single user action would result in several // change detections being invoked. To avoid this situation we want to have only one call to // native handler registration (for the same element and same type of event). // // In order to have just one native event handler in presence of multiple handler functions, // we just register a first handler function as a native event listener and then chain // (coalesce) other handler functions on top of the first native handler function. /** @type {?} */ var existingListener = null; // Please note that the coalescing described here doesn't happen for events specifying an // alternative target (ex. (document:click)) - this is to keep backward compatibility with the // view engine. // Also, we don't have to search for existing listeners is there are no directives // matching on a given node as we can't register multiple event handlers for the same event in // a template (this would mean having duplicate attributes). if (!eventTargetResolver && hasDirectives(tNode)) { existingListener = findExistingListener(lView, eventName, tNode.index); } if (existingListener !== null) { // Attach a new listener at the head of the coalesced listeners list. /** @type {?} */ listenerFn.__ngNextListenerFn__ = /** @type {?} */ existingListener.__ngNextListenerFn__; /** @type {?} */ existingListener.__ngNextListenerFn__ = listenerFn; processOutputs = false; } else { // The first argument of `listen` function in Procedural Renderer is: // - either a target name (as a string) in case of global target (window, document, body) // - or element reference (in all other cases) listenerFn = wrapListener(tNode, lView, listenerFn, false /** preventDefault */ ); /** @type {?} */ var cleanupFn = renderer.listen(resolved.name || target, eventName, listenerFn); ngDevMode && ngDevMode.rendererAddEventListener++; lCleanup.push(listenerFn, cleanupFn); tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, lCleanupIndex + 1); } } else { listenerFn = wrapListener(tNode, lView, listenerFn, true /** preventDefault */ ); target.addEventListener(eventName, listenerFn, useCapture); ngDevMode && ngDevMode.rendererAddEventListener++; lCleanup.push(listenerFn); tCleanup && tCleanup.push(eventName, idxOrTargetGetter, lCleanupIndex, useCapture); } } // subscribe to directive outputs if (tNode.outputs === undefined) { // if we create TNode here, inputs must be undefined so we know they still need to be // checked tNode.outputs = generatePropertyAliases(tNode, 1 /* Output */ ); } /** @type {?} */ var outputs = tNode.outputs; /** @type {?} */ var props; if (processOutputs && outputs && (props = outputs[eventName])) { /** @type {?} */ var propsLength = props.length; if (propsLength) { /** @type {?} */ var _lCleanup = getCleanup(lView); for (var i = 0; i < propsLength; i += 3) { /** @type {?} */ var index = /** @type {?} */ props[i]; ngDevMode && assertDataInRange(lView, index); /** @type {?} */ var minifiedName = props[i + 2]; /** @type {?} */ var directiveInstance = lView[index]; /** @type {?} */ var output = directiveInstance[minifiedName]; if (ngDevMode && !isObservable(output)) { throw new Error("@Output ".concat(minifiedName, " not initialized in '").concat(directiveInstance.constructor.name, "'.")); } /** @type {?} */ var subscription = output.subscribe(listenerFn); /** @type {?} */ var idx = _lCleanup.length; _lCleanup.push(listenerFn, subscription); tCleanup && tCleanup.push(eventName, tNode.index, idx, -(idx + 1)); } } } } /** * @param {?} lView * @param {?} listenerFn * @param {?} e * @return {?} */ function executeListenerWithErrorHandling(lView, listenerFn, e) { try { // Only explicitly returning false from a listener should preventDefault return listenerFn(e) !== false; } catch (error) { handleError(lView, error); return false; } } /** * Wraps an event listener with a function that marks ancestors dirty and prevents default behavior, * if applicable. * * @param {?} tNode The TNode associated with this listener * @param {?} lView The LView that contains this listener * @param {?} listenerFn The listener function to call * @param {?} wrapWithPreventDefault Whether or not to prevent default behavior * (the procedural renderer does this already, so in those cases, we should skip) * @return {?} */ function wrapListener(tNode, lView, listenerFn, wrapWithPreventDefault) { // Note: we are performing most of the work in the listener function itself // to optimize listener registration. return ( /** * @param {?} e * @return {?} */ function wrapListenerIn_markDirtyAndPreventDefault(e) { // In order to be backwards compatible with View Engine, events on component host nodes // must also mark the component view itself dirty (i.e. the view that it owns). /** @type {?} */ var startView = tNode.flags & 1 /* isComponent */ ? getComponentViewByIndex(tNode.index, lView) : lView; // See interfaces/view.ts for more on LViewFlags.ManualOnPush if ((lView[FLAGS] & 32 /* ManualOnPush */ ) === 0) { markViewDirty(startView); } /** @type {?} */ var result = executeListenerWithErrorHandling(lView, listenerFn, e); // A just-invoked listener function might have coalesced listeners so we need to check for // their presence and invoke as needed. /** @type {?} */ var nextListenerFn = /** @type {?} */ wrapListenerIn_markDirtyAndPreventDefault.__ngNextListenerFn__; while (nextListenerFn) { // We should prevent default if any of the listeners explicitly return false result = executeListenerWithErrorHandling(lView, nextListenerFn, e) && result; nextListenerFn = /** @type {?} */ nextListenerFn.__ngNextListenerFn__; } if (wrapWithPreventDefault && result === false) { e.preventDefault(); // Necessary for legacy browsers that don't support preventDefault (e.g. IE) e.returnValue = false; } return result; } ); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Retrieves a context at the level specified and saves it as the global, contextViewData. * Will get the next level up if level is not specified. * * This is used to save contexts of parent views so they can be bound in embedded views, or * in conjunction with reference() to bind a ref from a parent view. * * \@codeGenApi * @template T * @param {?=} level The relative level of the view from which to grab context compared to contextVewData * @return {?} context * */ function ɵɵnextContext() { var level = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1; return nextContextImpl(level); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Checks a given node against matching projection slots and returns the * determined slot index. Returns "null" if no slot matched the given node. * * This function takes into account the parsed ngProjectAs selector from the * node's attributes. If present, it will check whether the ngProjectAs selector * matches any of the projection slot selectors. * @param {?} tNode * @param {?} projectionSlots * @return {?} */ function matchingProjectionSlotIndex(tNode, projectionSlots) { /** @type {?} */ var wildcardNgContentIndex = null; /** @type {?} */ var ngProjectAsAttrVal = getProjectAsAttrValue(tNode); for (var i = 0; i < projectionSlots.length; i++) { /** @type {?} */ var slotValue = projectionSlots[i]; // The last wildcard projection slot should match all nodes which aren't matching // any selector. This is necessary to be backwards compatible with view engine. if (slotValue === '*') { wildcardNgContentIndex = i; continue; } // If we ran into an `ngProjectAs` attribute, we should match its parsed selector // to the list of selectors, otherwise we fall back to matching against the node. if (ngProjectAsAttrVal === null ? isNodeMatchingSelectorList(tNode, slotValue, /* isProjectionMode */ true) : isSelectorInSelectorList(ngProjectAsAttrVal, slotValue)) { return i; // first matching selector "captures" a given node } } return wildcardNgContentIndex; } /** * Instruction to distribute projectable nodes among <ng-content> occurrences in a given template. * It takes all the selectors from the entire component's template and decides where * each projected node belongs (it re-distributes nodes among "buckets" where each "bucket" is * backed by a selector). * * This function requires CSS selectors to be provided in 2 forms: parsed (by a compiler) and text, * un-parsed form. * * The parsed form is needed for efficient matching of a node against a given CSS selector. * The un-parsed, textual form is needed for support of the ngProjectAs attribute. * * Having a CSS selector in 2 different formats is not ideal, but alternatives have even more * drawbacks: * - having only a textual form would require runtime parsing of CSS selectors; * - we can't have only a parsed as we can't re-construct textual form from it (as entered by a * template author). * * \@codeGenApi * @param {?=} projectionSlots * @return {?} */ function ɵɵprojectionDef(projectionSlots) { /** @type {?} */ var componentNode = /** @type {?} */ findComponentView(getLView())[T_HOST]; if (!componentNode.projection) { // If no explicit projection slots are defined, fall back to a single // projection slot with the wildcard selector. /** @type {?} */ var numProjectionSlots = projectionSlots ? projectionSlots.length : 1; /** @type {?} */ var projectionHeads = componentNode.projection = new Array(numProjectionSlots).fill(null); /** @type {?} */ var tails = projectionHeads.slice(); /** @type {?} */ var componentChild = componentNode.child; while (componentChild !== null) { /** @type {?} */ var slotIndex = projectionSlots ? matchingProjectionSlotIndex(componentChild, projectionSlots) : 0; if (slotIndex !== null) { if (tails[slotIndex]) { /** @type {?} */ tails[slotIndex].projectionNext = componentChild; } else { projectionHeads[slotIndex] = componentChild; } tails[slotIndex] = componentChild; } componentChild = componentChild.next; } } } /** @type {?} */ var delayProjection = false; /** * @param {?} value * @return {?} */ function setDelayProjection(value) { delayProjection = value; } /** * Inserts previously re-distributed projected nodes. This instruction must be preceded by a call * to the projectionDef instruction. * * \@codeGenApi * @param {?} nodeIndex * @param {?=} selectorIndex * @param {?=} attrs * @return {?} */ function ɵɵprojection(nodeIndex) { var selectorIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var attrs = arguments.length > 2 ? arguments[2] : undefined; /** @type {?} */ var lView = getLView(); /** @type {?} */ var tProjectionNode = getOrCreateTNode(lView[TVIEW], lView[T_HOST], nodeIndex, 1 /* Projection */ , null, attrs || null); // We can't use viewData[HOST_NODE] because projection nodes can be nested in embedded views. if (tProjectionNode.projection === null) tProjectionNode.projection = selectorIndex; // `<ng-content>` has no content setIsNotParent(); // We might need to delay the projection of nodes if they are in the middle of an i18n block if (!delayProjection) { // re-distribution of projectable nodes is stored on a component's view level appendProjectedNodes(lView, tProjectionNode, selectorIndex, findComponentView(lView)); } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * * Update an interpolated property on an element with a lone bound value * * Used when the value passed to a property has 1 interpolated value in it, an no additional text * surrounds that interpolated value: * * ```html * <div title="{{v0}}"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵpropertyInterpolate('title', v0); * ``` * * If the property name also exists as an input property on one of the element's directives, * the component property will be set instead of the element property. This check must * be conducted at runtime so child components that add new `\@Inputs` don't have to be re-compiled. * * \@codeGenApi * @param {?} propName The name of the property to update * @param {?} v0 Value checked for change. * @param {?=} sanitizer An optional sanitizer function * @return {?} itself, so that it may be chained. */ function ɵɵpropertyInterpolate(propName, v0, sanitizer) { ɵɵpropertyInterpolate1(propName, '', v0, '', sanitizer); return ɵɵpropertyInterpolate; } /** * * Update an interpolated property on an element with single bound value surrounded by text. * * Used when the value passed to a property has 1 interpolated value in it: * * ```html * <div title="prefix{{v0}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵpropertyInterpolate1('title', 'prefix', v0, 'suffix'); * ``` * * If the property name also exists as an input property on one of the element's directives, * the component property will be set instead of the element property. This check must * be conducted at runtime so child components that add new `\@Inputs` don't have to be re-compiled. * * \@codeGenApi * @param {?} propName The name of the property to update * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} sanitizer An optional sanitizer function * @return {?} itself, so that it may be chained. */ function ɵɵpropertyInterpolate1(propName, prefix, v0, suffix, sanitizer) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var interpolatedValue = interpolation1(getLView(), prefix, v0, suffix); if (interpolatedValue !== NO_CHANGE) { elementPropertyInternal(index, propName, interpolatedValue, sanitizer); } return ɵɵpropertyInterpolate1; } /** * * Update an interpolated property on an element with 2 bound values surrounded by text. * * Used when the value passed to a property has 2 interpolated values in it: * * ```html * <div title="prefix{{v0}}-{{v1}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵpropertyInterpolate2('title', 'prefix', v0, '-', v1, 'suffix'); * ``` * * If the property name also exists as an input property on one of the element's directives, * the component property will be set instead of the element property. This check must * be conducted at runtime so child components that add new `\@Inputs` don't have to be re-compiled. * * \@codeGenApi * @param {?} propName The name of the property to update * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} sanitizer An optional sanitizer function * @return {?} itself, so that it may be chained. */ function ɵɵpropertyInterpolate2(propName, prefix, v0, i0, v1, suffix, sanitizer) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var interpolatedValue = interpolation2(getLView(), prefix, v0, i0, v1, suffix); if (interpolatedValue !== NO_CHANGE) { elementPropertyInternal(index, propName, interpolatedValue, sanitizer); } return ɵɵpropertyInterpolate2; } /** * * Update an interpolated property on an element with 3 bound values surrounded by text. * * Used when the value passed to a property has 3 interpolated values in it: * * ```html * <div title="prefix{{v0}}-{{v1}}-{{v2}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵpropertyInterpolate3( * 'title', 'prefix', v0, '-', v1, '-', v2, 'suffix'); * ``` * * If the property name also exists as an input property on one of the element's directives, * the component property will be set instead of the element property. This check must * be conducted at runtime so child components that add new `\@Inputs` don't have to be re-compiled. * * \@codeGenApi * @param {?} propName The name of the property to update * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} sanitizer An optional sanitizer function * @return {?} itself, so that it may be chained. */ function ɵɵpropertyInterpolate3(propName, prefix, v0, i0, v1, i1, v2, suffix, sanitizer) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var interpolatedValue = interpolation3(getLView(), prefix, v0, i0, v1, i1, v2, suffix); if (interpolatedValue !== NO_CHANGE) { elementPropertyInternal(index, propName, interpolatedValue, sanitizer); } return ɵɵpropertyInterpolate3; } /** * * Update an interpolated property on an element with 4 bound values surrounded by text. * * Used when the value passed to a property has 4 interpolated values in it: * * ```html * <div title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵpropertyInterpolate4( * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, 'suffix'); * ``` * * If the property name also exists as an input property on one of the element's directives, * the component property will be set instead of the element property. This check must * be conducted at runtime so child components that add new `\@Inputs` don't have to be re-compiled. * * \@codeGenApi * @param {?} propName The name of the property to update * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} sanitizer An optional sanitizer function * @return {?} itself, so that it may be chained. */ function ɵɵpropertyInterpolate4(propName, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, sanitizer) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var interpolatedValue = interpolation4(getLView(), prefix, v0, i0, v1, i1, v2, i2, v3, suffix); if (interpolatedValue !== NO_CHANGE) { elementPropertyInternal(index, propName, interpolatedValue, sanitizer); } return ɵɵpropertyInterpolate4; } /** * * Update an interpolated property on an element with 5 bound values surrounded by text. * * Used when the value passed to a property has 5 interpolated values in it: * * ```html * <div title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵpropertyInterpolate5( * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, 'suffix'); * ``` * * If the property name also exists as an input property on one of the element's directives, * the component property will be set instead of the element property. This check must * be conducted at runtime so child components that add new `\@Inputs` don't have to be re-compiled. * * \@codeGenApi * @param {?} propName The name of the property to update * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} i3 Static value used for concatenation only. * @param {?} v4 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} sanitizer An optional sanitizer function * @return {?} itself, so that it may be chained. */ function ɵɵpropertyInterpolate5(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, sanitizer) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var interpolatedValue = interpolation5(getLView(), prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix); if (interpolatedValue !== NO_CHANGE) { elementPropertyInternal(index, propName, interpolatedValue, sanitizer); } return ɵɵpropertyInterpolate5; } /** * * Update an interpolated property on an element with 6 bound values surrounded by text. * * Used when the value passed to a property has 6 interpolated values in it: * * ```html * <div title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵpropertyInterpolate6( * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, 'suffix'); * ``` * * If the property name also exists as an input property on one of the element's directives, * the component property will be set instead of the element property. This check must * be conducted at runtime so child components that add new `\@Inputs` don't have to be re-compiled. * * \@codeGenApi * @param {?} propName The name of the property to update * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} i3 Static value used for concatenation only. * @param {?} v4 Value checked for change. * @param {?} i4 Static value used for concatenation only. * @param {?} v5 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} sanitizer An optional sanitizer function * @return {?} itself, so that it may be chained. */ function ɵɵpropertyInterpolate6(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix, sanitizer) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var interpolatedValue = interpolation6(getLView(), prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix); if (interpolatedValue !== NO_CHANGE) { elementPropertyInternal(index, propName, interpolatedValue, sanitizer); } return ɵɵpropertyInterpolate6; } /** * * Update an interpolated property on an element with 7 bound values surrounded by text. * * Used when the value passed to a property has 7 interpolated values in it: * * ```html * <div title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}-{{v6}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵpropertyInterpolate7( * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, '-', v6, 'suffix'); * ``` * * If the property name also exists as an input property on one of the element's directives, * the component property will be set instead of the element property. This check must * be conducted at runtime so child components that add new `\@Inputs` don't have to be re-compiled. * * \@codeGenApi * @param {?} propName The name of the property to update * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} i3 Static value used for concatenation only. * @param {?} v4 Value checked for change. * @param {?} i4 Static value used for concatenation only. * @param {?} v5 Value checked for change. * @param {?} i5 Static value used for concatenation only. * @param {?} v6 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} sanitizer An optional sanitizer function * @return {?} itself, so that it may be chained. */ function ɵɵpropertyInterpolate7(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix, sanitizer) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var interpolatedValue = interpolation7(getLView(), prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix); if (interpolatedValue !== NO_CHANGE) { elementPropertyInternal(index, propName, interpolatedValue, sanitizer); } return ɵɵpropertyInterpolate7; } /** * * Update an interpolated property on an element with 8 bound values surrounded by text. * * Used when the value passed to a property has 8 interpolated values in it: * * ```html * <div title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}-{{v6}}-{{v7}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵpropertyInterpolate8( * 'title', 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, '-', v6, '-', v7, 'suffix'); * ``` * * If the property name also exists as an input property on one of the element's directives, * the component property will be set instead of the element property. This check must * be conducted at runtime so child components that add new `\@Inputs` don't have to be re-compiled. * * \@codeGenApi * @param {?} propName The name of the property to update * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} i3 Static value used for concatenation only. * @param {?} v4 Value checked for change. * @param {?} i4 Static value used for concatenation only. * @param {?} v5 Value checked for change. * @param {?} i5 Static value used for concatenation only. * @param {?} v6 Value checked for change. * @param {?} i6 Static value used for concatenation only. * @param {?} v7 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} sanitizer An optional sanitizer function * @return {?} itself, so that it may be chained. */ function ɵɵpropertyInterpolate8(propName, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix, sanitizer) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var interpolatedValue = interpolation8(getLView(), prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix); if (interpolatedValue !== NO_CHANGE) { elementPropertyInternal(index, propName, interpolatedValue, sanitizer); } return ɵɵpropertyInterpolate8; } /** * Update an interpolated property on an element with 8 or more bound values surrounded by text. * * Used when the number of interpolated values exceeds 7. * * ```html * <div * title="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}-{{v6}}-{{v7}}-{{v8}}-{{v9}}suffix"></div> * ``` * * Its compiled representation is:: * * ```ts * ɵɵpropertyInterpolateV( * 'title', ['prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, '-', v6, '-', v7, '-', v9, * 'suffix']); * ``` * * If the property name also exists as an input property on one of the element's directives, * the component property will be set instead of the element property. This check must * be conducted at runtime so child components that add new `\@Inputs` don't have to be re-compiled. * * \@codeGenApi * @param {?} propName The name of the property to update. * @param {?} values The a collection of values and the strings inbetween those values, beginning with a * string prefix and ending with a string suffix. * (e.g. `['prefix', value0, '-', value1, '-', value2, ..., value99, 'suffix']`) * @param {?=} sanitizer An optional sanitizer function * @return {?} itself, so that it may be chained. */ function ɵɵpropertyInterpolateV(propName, values, sanitizer) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var interpolatedValue = interpolationV(getLView(), values); if (interpolatedValue !== NO_CHANGE) { elementPropertyInternal(index, propName, interpolatedValue, sanitizer); } return ɵɵpropertyInterpolateV; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Create static text node * * \@codeGenApi * @param {?} index Index of the node in the data array * @param {?=} value Value to write. This value will be stringified. * * @return {?} */ function ɵɵtext(index, value) { /** @type {?} */ var lView = getLView(); ngDevMode && assertEqual(lView[BINDING_INDEX], lView[TVIEW].bindingStartIndex, 'text nodes should be created before any bindings'); ngDevMode && ngDevMode.rendererCreateTextNode++; ngDevMode && assertDataInRange(lView, index + HEADER_OFFSET); /** @type {?} */ var textNative = lView[index + HEADER_OFFSET] = createTextNode(value, lView[RENDERER]); ngDevMode && ngDevMode.rendererSetText++; /** @type {?} */ var tNode = getOrCreateTNode(lView[TVIEW], lView[T_HOST], index, 3 /* Element */ , null, null); // Text nodes are self closing. setIsNotParent(); appendChild(textNative, tNode, lView); } /** * Create text node with binding * Bindings should be handled externally with the proper interpolation(1-8) method * * \@codeGenApi * @template T * @param {?} value Stringified value to write. * * @return {?} */ function ɵɵtextBinding(value) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var bound = bind(lView, value); if (bound !== NO_CHANGE) { textBindingInternal(lView, index, renderStringify(bound)); } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * * Update text content with a lone bound value * * Used when a text node has 1 interpolated value in it, an no additional text * surrounds that interpolated value: * * ```html * <div>{{v0}}</div> * ``` * * Its compiled representation is: * * ```ts * ɵɵtextInterpolate(v0); * ``` * @see textInterpolateV * \@codeGenApi * @param {?} v0 * @return {?} itself, so that it may be chained. */ function ɵɵtextInterpolate(v0) { ɵɵtextInterpolate1('', v0, ''); return ɵɵtextInterpolate; } /** * * Update text content with single bound value surrounded by other text. * * Used when a text node has 1 interpolated value in it: * * ```html * <div>prefix{{v0}}suffix</div> * ``` * * Its compiled representation is: * * ```ts * ɵɵtextInterpolate1('prefix', v0, 'suffix'); * ``` * @see textInterpolateV * \@codeGenApi * @param {?} prefix * @param {?} v0 * @param {?} suffix * @return {?} itself, so that it may be chained. */ function ɵɵtextInterpolate1(prefix, v0, suffix) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolated = interpolation1(lView, prefix, v0, suffix); if (interpolated !== NO_CHANGE) { textBindingInternal(lView, index, /** @type {?} */ interpolated); } return ɵɵtextInterpolate1; } /** * * Update text content with 2 bound values surrounded by other text. * * Used when a text node has 2 interpolated values in it: * * ```html * <div>prefix{{v0}}-{{v1}}suffix</div> * ``` * * Its compiled representation is: * * ```ts * ɵɵtextInterpolate2('prefix', v0, '-', v1, 'suffix'); * ``` * @see textInterpolateV * \@codeGenApi * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} suffix * @return {?} itself, so that it may be chained. */ function ɵɵtextInterpolate2(prefix, v0, i0, v1, suffix) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolated = interpolation2(lView, prefix, v0, i0, v1, suffix); if (interpolated !== NO_CHANGE) { textBindingInternal(lView, index, /** @type {?} */ interpolated); } return ɵɵtextInterpolate2; } /** * * Update text content with 3 bound values surrounded by other text. * * Used when a text node has 3 interpolated values in it: * * ```html * <div>prefix{{v0}}-{{v1}}-{{v2}}suffix</div> * ``` * * Its compiled representation is: * * ```ts * ɵɵtextInterpolate3( * 'prefix', v0, '-', v1, '-', v2, 'suffix'); * ``` * @see textInterpolateV * \@codeGenApi * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} suffix * @return {?} itself, so that it may be chained. */ function ɵɵtextInterpolate3(prefix, v0, i0, v1, i1, v2, suffix) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolated = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix); if (interpolated !== NO_CHANGE) { textBindingInternal(lView, index, /** @type {?} */ interpolated); } return ɵɵtextInterpolate3; } /** * * Update text content with 4 bound values surrounded by other text. * * Used when a text node has 4 interpolated values in it: * * ```html * <div>prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}suffix</div> * ``` * * Its compiled representation is: * * ```ts * ɵɵtextInterpolate4( * 'prefix', v0, '-', v1, '-', v2, '-', v3, 'suffix'); * ``` * @see ɵɵtextInterpolateV * \@codeGenApi * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} i2 * @param {?} v3 * @param {?} suffix * @return {?} itself, so that it may be chained. */ function ɵɵtextInterpolate4(prefix, v0, i0, v1, i1, v2, i2, v3, suffix) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolated = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix); if (interpolated !== NO_CHANGE) { textBindingInternal(lView, index, /** @type {?} */ interpolated); } return ɵɵtextInterpolate4; } /** * * Update text content with 5 bound values surrounded by other text. * * Used when a text node has 5 interpolated values in it: * * ```html * <div>prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}suffix</div> * ``` * * Its compiled representation is: * * ```ts * ɵɵtextInterpolate5( * 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, 'suffix'); * ``` * @see textInterpolateV * \@codeGenApi * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} i2 * @param {?} v3 * @param {?} i3 * @param {?} v4 * @param {?} suffix * @return {?} itself, so that it may be chained. */ function ɵɵtextInterpolate5(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolated = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix); if (interpolated !== NO_CHANGE) { textBindingInternal(lView, index, /** @type {?} */ interpolated); } return ɵɵtextInterpolate5; } /** * * Update text content with 6 bound values surrounded by other text. * * Used when a text node has 6 interpolated values in it: * * ```html * <div>prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}suffix</div> * ``` * * Its compiled representation is: * * ```ts * ɵɵtextInterpolate6( * 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, 'suffix'); * ``` * * @see textInterpolateV * \@codeGenApi * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} i2 * @param {?} v3 * @param {?} i3 * @param {?} v4 * @param {?} i4 Static value used for concatenation only. * @param {?} v5 Value checked for change. \@returns itself, so that it may be chained. * @param {?} suffix * @return {?} */ function ɵɵtextInterpolate6(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolated = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix); if (interpolated !== NO_CHANGE) { textBindingInternal(lView, index, /** @type {?} */ interpolated); } return ɵɵtextInterpolate6; } /** * * Update text content with 7 bound values surrounded by other text. * * Used when a text node has 7 interpolated values in it: * * ```html * <div>prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}-{{v6}}suffix</div> * ``` * * Its compiled representation is: * * ```ts * ɵɵtextInterpolate7( * 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, '-', v6, 'suffix'); * ``` * @see textInterpolateV * \@codeGenApi * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} i2 * @param {?} v3 * @param {?} i3 * @param {?} v4 * @param {?} i4 * @param {?} v5 * @param {?} i5 * @param {?} v6 * @param {?} suffix * @return {?} itself, so that it may be chained. */ function ɵɵtextInterpolate7(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolated = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix); if (interpolated !== NO_CHANGE) { textBindingInternal(lView, index, /** @type {?} */ interpolated); } return ɵɵtextInterpolate7; } /** * * Update text content with 8 bound values surrounded by other text. * * Used when a text node has 8 interpolated values in it: * * ```html * <div>prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}-{{v6}}-{{v7}}suffix</div> * ``` * * Its compiled representation is: * * ```ts * ɵɵtextInterpolate8( * 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, '-', v6, '-', v7, 'suffix'); * ``` * @see textInterpolateV * \@codeGenApi * @param {?} prefix * @param {?} v0 * @param {?} i0 * @param {?} v1 * @param {?} i1 * @param {?} v2 * @param {?} i2 * @param {?} v3 * @param {?} i3 * @param {?} v4 * @param {?} i4 * @param {?} v5 * @param {?} i5 * @param {?} v6 * @param {?} i6 * @param {?} v7 * @param {?} suffix * @return {?} itself, so that it may be chained. */ function ɵɵtextInterpolate8(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolated = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix); if (interpolated !== NO_CHANGE) { textBindingInternal(lView, index, /** @type {?} */ interpolated); } return ɵɵtextInterpolate8; } /** * Update text content with 9 or more bound values other surrounded by text. * * Used when the number of interpolated values exceeds 8. * * ```html * <div>prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}-{{v6}}-{{v7}}-{{v8}}-{{v9}}suffix</div> * ``` * * Its compiled representation is: * * ```ts * ɵɵtextInterpolateV( * ['prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, '-', v6, '-', v7, '-', v9, * 'suffix']); * ``` * . * \@codeGenApi * @param {?} values The a collection of values and the strings in between those values, beginning with * a string prefix and ending with a string suffix. * (e.g. `['prefix', value0, '-', value1, '-', value2, ..., value99, 'suffix']`) * * @return {?} itself, so that it may be chained. */ function ɵɵtextInterpolateV(values) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolated = interpolationV(lView, values); if (interpolated !== NO_CHANGE) { textBindingInternal(lView, index, /** @type {?} */ interpolated); } return ɵɵtextInterpolateV; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * * Update an interpolated class on an element with single bound value surrounded by text. * * Used when the value passed to a property has 1 interpolated value in it: * * ```html * <div class="prefix{{v0}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵclassMapInterpolate1('prefix', v0, 'suffix'); * ``` * * \@codeGenApi * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @return {?} */ function ɵɵclassMapInterpolate1(prefix, v0, suffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation1(lView, prefix, v0, suffix); classMapInternal(getSelectedIndex(), interpolatedValue); } /** * * Update an interpolated class on an element with 2 bound values surrounded by text. * * Used when the value passed to a property has 2 interpolated values in it: * * ```html * <div class="prefix{{v0}}-{{v1}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵclassMapInterpolate2('prefix', v0, '-', v1, 'suffix'); * ``` * * \@codeGenApi * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @return {?} */ function ɵɵclassMapInterpolate2(prefix, v0, i0, v1, suffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix); classMapInternal(getSelectedIndex(), interpolatedValue); } /** * * Update an interpolated class on an element with 3 bound values surrounded by text. * * Used when the value passed to a property has 3 interpolated values in it: * * ```html * <div class="prefix{{v0}}-{{v1}}-{{v2}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵclassMapInterpolate3( * 'prefix', v0, '-', v1, '-', v2, 'suffix'); * ``` * * \@codeGenApi * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @return {?} */ function ɵɵclassMapInterpolate3(prefix, v0, i0, v1, i1, v2, suffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix); classMapInternal(getSelectedIndex(), interpolatedValue); } /** * * Update an interpolated class on an element with 4 bound values surrounded by text. * * Used when the value passed to a property has 4 interpolated values in it: * * ```html * <div class="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵclassMapInterpolate4( * 'prefix', v0, '-', v1, '-', v2, '-', v3, 'suffix'); * ``` * * \@codeGenApi * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @return {?} */ function ɵɵclassMapInterpolate4(prefix, v0, i0, v1, i1, v2, i2, v3, suffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix); classMapInternal(getSelectedIndex(), interpolatedValue); } /** * * Update an interpolated class on an element with 5 bound values surrounded by text. * * Used when the value passed to a property has 5 interpolated values in it: * * ```html * <div class="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵclassMapInterpolate5( * 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, 'suffix'); * ``` * * \@codeGenApi * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} i3 Static value used for concatenation only. * @param {?} v4 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @return {?} */ function ɵɵclassMapInterpolate5(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix); classMapInternal(getSelectedIndex(), interpolatedValue); } /** * * Update an interpolated class on an element with 6 bound values surrounded by text. * * Used when the value passed to a property has 6 interpolated values in it: * * ```html * <div class="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵclassMapInterpolate6( * 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, 'suffix'); * ``` * * \@codeGenApi * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} i3 Static value used for concatenation only. * @param {?} v4 Value checked for change. * @param {?} i4 Static value used for concatenation only. * @param {?} v5 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @return {?} */ function ɵɵclassMapInterpolate6(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix); classMapInternal(getSelectedIndex(), interpolatedValue); } /** * * Update an interpolated class on an element with 7 bound values surrounded by text. * * Used when the value passed to a property has 7 interpolated values in it: * * ```html * <div class="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}-{{v6}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵclassMapInterpolate7( * 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, '-', v6, 'suffix'); * ``` * * \@codeGenApi * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} i3 Static value used for concatenation only. * @param {?} v4 Value checked for change. * @param {?} i4 Static value used for concatenation only. * @param {?} v5 Value checked for change. * @param {?} i5 Static value used for concatenation only. * @param {?} v6 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @return {?} */ function ɵɵclassMapInterpolate7(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix); classMapInternal(getSelectedIndex(), interpolatedValue); } /** * * Update an interpolated class on an element with 8 bound values surrounded by text. * * Used when the value passed to a property has 8 interpolated values in it: * * ```html * <div class="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}-{{v6}}-{{v7}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵclassMapInterpolate8( * 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, '-', v6, '-', v7, 'suffix'); * ``` * * \@codeGenApi * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} i3 Static value used for concatenation only. * @param {?} v4 Value checked for change. * @param {?} i4 Static value used for concatenation only. * @param {?} v5 Value checked for change. * @param {?} i5 Static value used for concatenation only. * @param {?} v6 Value checked for change. * @param {?} i6 Static value used for concatenation only. * @param {?} v7 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @return {?} */ function ɵɵclassMapInterpolate8(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix); classMapInternal(getSelectedIndex(), interpolatedValue); } /** * Update an interpolated class on an element with 8 or more bound values surrounded by text. * * Used when the number of interpolated values exceeds 7. * * ```html * <div * class="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}-{{v6}}-{{v7}}-{{v8}}-{{v9}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵclassMapInterpolateV( * ['prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, '-', v6, '-', v7, '-', v9, * 'suffix']); * ``` * . * \@codeGenApi * @param {?} values The a collection of values and the strings in-between those values, beginning with * a string prefix and ending with a string suffix. * (e.g. `['prefix', value0, '-', value1, '-', value2, ..., value99, 'suffix']`) * @return {?} */ function ɵɵclassMapInterpolateV(values) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolationV(lView, values); classMapInternal(getSelectedIndex(), interpolatedValue); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * * Update an interpolated style property on an element with single bound value surrounded by text. * * Used when the value passed to a property has 1 interpolated value in it: * * ```html * <div style.color="prefix{{v0}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵstylePropInterpolate1(0, 'prefix', v0, 'suffix'); * ``` * * \@codeGenApi * @param {?} prop * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} valueSuffix Optional suffix. Used with scalar values to add unit such as `px`. * @return {?} itself, so that it may be chained. */ function ɵɵstylePropInterpolate1(prop, prefix, v0, suffix, valueSuffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation1(lView, prefix, v0, suffix); stylePropInternal(getSelectedIndex(), prop, /** @type {?} */ interpolatedValue, valueSuffix); return ɵɵstylePropInterpolate1; } /** * * Update an interpolated style property on an element with 2 bound values surrounded by text. * * Used when the value passed to a property has 2 interpolated values in it: * * ```html * <div style.color="prefix{{v0}}-{{v1}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵstylePropInterpolate2(0, 'prefix', v0, '-', v1, 'suffix'); * ``` * * \@codeGenApi * @param {?} prop * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} valueSuffix Optional suffix. Used with scalar values to add unit such as `px`. * @return {?} itself, so that it may be chained. */ function ɵɵstylePropInterpolate2(prop, prefix, v0, i0, v1, suffix, valueSuffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation2(lView, prefix, v0, i0, v1, suffix); stylePropInternal(getSelectedIndex(), prop, /** @type {?} */ interpolatedValue, valueSuffix); return ɵɵstylePropInterpolate2; } /** * * Update an interpolated style property on an element with 3 bound values surrounded by text. * * Used when the value passed to a property has 3 interpolated values in it: * * ```html * <div style.color="prefix{{v0}}-{{v1}}-{{v2}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵstylePropInterpolate3(0, 'prefix', v0, '-', v1, '-', v2, 'suffix'); * ``` * * \@codeGenApi * @param {?} prop * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} valueSuffix Optional suffix. Used with scalar values to add unit such as `px`. * @return {?} itself, so that it may be chained. */ function ɵɵstylePropInterpolate3(prop, prefix, v0, i0, v1, i1, v2, suffix, valueSuffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation3(lView, prefix, v0, i0, v1, i1, v2, suffix); stylePropInternal(getSelectedIndex(), prop, /** @type {?} */ interpolatedValue, valueSuffix); return ɵɵstylePropInterpolate3; } /** * * Update an interpolated style property on an element with 4 bound values surrounded by text. * * Used when the value passed to a property has 4 interpolated values in it: * * ```html * <div style.color="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵstylePropInterpolate4(0, 'prefix', v0, '-', v1, '-', v2, '-', v3, 'suffix'); * ``` * * \@codeGenApi * @param {?} prop * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} valueSuffix Optional suffix. Used with scalar values to add unit such as `px`. * @return {?} itself, so that it may be chained. */ function ɵɵstylePropInterpolate4(prop, prefix, v0, i0, v1, i1, v2, i2, v3, suffix, valueSuffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation4(lView, prefix, v0, i0, v1, i1, v2, i2, v3, suffix); stylePropInternal(getSelectedIndex(), prop, /** @type {?} */ interpolatedValue, valueSuffix); return ɵɵstylePropInterpolate4; } /** * * Update an interpolated style property on an element with 5 bound values surrounded by text. * * Used when the value passed to a property has 5 interpolated values in it: * * ```html * <div style.color="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵstylePropInterpolate5(0, 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, 'suffix'); * ``` * * \@codeGenApi * @param {?} prop * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} i3 Static value used for concatenation only. * @param {?} v4 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} valueSuffix Optional suffix. Used with scalar values to add unit such as `px`. * @return {?} itself, so that it may be chained. */ function ɵɵstylePropInterpolate5(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix, valueSuffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation5(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix); stylePropInternal(getSelectedIndex(), prop, /** @type {?} */ interpolatedValue, valueSuffix); return ɵɵstylePropInterpolate5; } /** * * Update an interpolated style property on an element with 6 bound values surrounded by text. * * Used when the value passed to a property has 6 interpolated values in it: * * ```html * <div style.color="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵstylePropInterpolate6(0, 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, 'suffix'); * ``` * * \@codeGenApi * @param {?} prop * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} i3 Static value used for concatenation only. * @param {?} v4 Value checked for change. * @param {?} i4 Static value used for concatenation only. * @param {?} v5 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} valueSuffix Optional suffix. Used with scalar values to add unit such as `px`. * @return {?} itself, so that it may be chained. */ function ɵɵstylePropInterpolate6(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix, valueSuffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation6(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix); stylePropInternal(getSelectedIndex(), prop, /** @type {?} */ interpolatedValue, valueSuffix); return ɵɵstylePropInterpolate6; } /** * * Update an interpolated style property on an element with 7 bound values surrounded by text. * * Used when the value passed to a property has 7 interpolated values in it: * * ```html * <div style.color="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}-{{v6}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵstylePropInterpolate7( * 0, 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, '-', v6, 'suffix'); * ``` * * \@codeGenApi * @param {?} prop * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} i3 Static value used for concatenation only. * @param {?} v4 Value checked for change. * @param {?} i4 Static value used for concatenation only. * @param {?} v5 Value checked for change. * @param {?} i5 Static value used for concatenation only. * @param {?} v6 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} valueSuffix Optional suffix. Used with scalar values to add unit such as `px`. * @return {?} itself, so that it may be chained. */ function ɵɵstylePropInterpolate7(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix, valueSuffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation7(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix); stylePropInternal(getSelectedIndex(), prop, /** @type {?} */ interpolatedValue, valueSuffix); return ɵɵstylePropInterpolate7; } /** * * Update an interpolated style property on an element with 8 bound values surrounded by text. * * Used when the value passed to a property has 8 interpolated values in it: * * ```html * <div style.color="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}-{{v6}}-{{v7}}suffix"></div> * ``` * * Its compiled representation is: * * ```ts * ɵɵstylePropInterpolate8(0, 'prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, '-', v6, * '-', v7, 'suffix'); * ``` * * \@codeGenApi * @param {?} prop * @param {?} prefix Static value used for concatenation only. * @param {?} v0 Value checked for change. * @param {?} i0 Static value used for concatenation only. * @param {?} v1 Value checked for change. * @param {?} i1 Static value used for concatenation only. * @param {?} v2 Value checked for change. * @param {?} i2 Static value used for concatenation only. * @param {?} v3 Value checked for change. * @param {?} i3 Static value used for concatenation only. * @param {?} v4 Value checked for change. * @param {?} i4 Static value used for concatenation only. * @param {?} v5 Value checked for change. * @param {?} i5 Static value used for concatenation only. * @param {?} v6 Value checked for change. * @param {?} i6 Static value used for concatenation only. * @param {?} v7 Value checked for change. * @param {?} suffix Static value used for concatenation only. * @param {?=} valueSuffix Optional suffix. Used with scalar values to add unit such as `px`. * @return {?} itself, so that it may be chained. */ function ɵɵstylePropInterpolate8(prop, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix, valueSuffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolation8(lView, prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix); stylePropInternal(getSelectedIndex(), prop, /** @type {?} */ interpolatedValue, valueSuffix); return ɵɵstylePropInterpolate8; } /** * Update an interpolated style property on an element with 8 or more bound values surrounded by * text. * * Used when the number of interpolated values exceeds 7. * * ```html * <div * style.color="prefix{{v0}}-{{v1}}-{{v2}}-{{v3}}-{{v4}}-{{v5}}-{{v6}}-{{v7}}-{{v8}}-{{v9}}suffix"> * </div> * ``` * * Its compiled representation is: * * ```ts * ɵɵstylePropInterpolateV( * 0, ['prefix', v0, '-', v1, '-', v2, '-', v3, '-', v4, '-', v5, '-', v6, '-', v7, '-', v9, * 'suffix']); * ``` * * \@codeGenApi * @param {?} prop * @param {?} values The a collection of values and the strings in-between those values, beginning with * a string prefix and ending with a string suffix. * (e.g. `['prefix', value0, '-', value1, '-', value2, ..., value99, 'suffix']`) * @param {?=} valueSuffix Optional suffix. Used with scalar values to add unit such as `px`. * @return {?} itself, so that it may be chained. */ function ɵɵstylePropInterpolateV(prop, values, valueSuffix) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var interpolatedValue = interpolationV(lView, values); stylePropInternal(getSelectedIndex(), prop, /** @type {?} */ interpolatedValue, valueSuffix); return ɵɵstylePropInterpolateV; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Update a property on a host element. Only applies to native node properties, not inputs. * * Operates on the element selected by index via the {\@link select} instruction. * * \@codeGenApi * @template T * @param {?} propName Name of property. Because it is going to DOM, this is not subject to * renaming as part of minification. * @param {?} value New value to write. * @param {?=} sanitizer An optional function used to sanitize the value. * @return {?} This function returns itself so that it may be chained * (e.g. `property('name', ctx.name)('title', ctx.title)`) * */ function ɵɵhostProperty(propName, value, sanitizer) { /** @type {?} */ var index = getSelectedIndex(); ngDevMode && assertNotEqual(index, -1, 'selected index cannot be -1'); /** @type {?} */ var lView = getLView(); /** @type {?} */ var bindReconciledValue = bind(lView, value); if (bindReconciledValue !== NO_CHANGE) { elementPropertyInternal(index, propName, bindReconciledValue, sanitizer, true); } return ɵɵhostProperty; } /** * Updates a synthetic host binding (e.g. `[\@foo]`) on a component. * * This instruction is for compatibility purposes and is designed to ensure that a * synthetic host binding (e.g. `\@HostBinding('\@foo')`) properly gets rendered in * the component's renderer. Normally all host bindings are evaluated with the parent * component's renderer, but, in the case of animation \@triggers, they need to be * evaluated with the sub component's renderer (because that's where the animation * triggers are defined). * * Do not use this instruction as a replacement for `elementProperty`. This instruction * only exists to ensure compatibility with the ViewEngine's host binding behavior. * * \@codeGenApi * @template T * @param {?} propName Name of property. Because it is going to DOM, this is not subject to * renaming as part of minification. * @param {?} value New value to write. * @param {?=} sanitizer An optional function used to sanitize the value. * * @return {?} */ function ɵɵupdateSyntheticHostBinding(propName, value, sanitizer) { /** @type {?} */ var index = getSelectedIndex(); /** @type {?} */ var lView = getLView(); // TODO(benlesh): remove bind call here. /** @type {?} */ var bound = bind(lView, value); if (bound !== NO_CHANGE) { elementPropertyInternal(index, propName, bound, sanitizer, true, loadComponentRenderer); } return ɵɵupdateSyntheticHostBinding; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Returns the component instance associated with a given DOM host element. * Elements which don't represent components return `null`. * * \@publicApi * @template T * @param {?} element Host DOM element from which the component should be retrieved. * * ``` * <my-app> * #VIEW * <div> * <child-comp></child-comp> * </div> * </mp-app> * * expect(getComponent(<child-comp>) instanceof ChildComponent).toBeTruthy(); * expect(getComponent(<my-app>) instanceof MyApp).toBeTruthy(); * ``` * * @return {?} */ function getComponent(element) { /** @type {?} */ var context = loadLContextFromNode(element); if (context.component === undefined) { context.component = getComponentAtNodeIndex(context.nodeIndex, context.lView); } return ( /** @type {?} */ context.component ); } /** * Returns the component instance associated with a given DOM host element. * Elements which don't represent components return `null`. * * \@publicApi * @template T * @param {?} element Host DOM element from which the component should be retrieved. * * ``` * <my-app> * #VIEW * <div> * <child-comp></child-comp> * </div> * </mp-app> * * expect(getComponent(<child-comp>) instanceof ChildComponent).toBeTruthy(); * expect(getComponent(<my-app>) instanceof MyApp).toBeTruthy(); * ``` * * @return {?} */ function getContext$1(element) { /** @type {?} */ var context = /** @type {?} */ loadLContextFromNode(element); return ( /** @type {?} */ context.lView[CONTEXT] ); } /** * Returns the component instance associated with view which owns the DOM element (`null` * otherwise). * * \@publicApi * @template T * @param {?} element DOM element which is owned by an existing component's view. * * ``` * <my-app> * #VIEW * <div> * <child-comp></child-comp> * </div> * </mp-app> * * expect(getViewComponent(<child-comp>) instanceof MyApp).toBeTruthy(); * expect(getViewComponent(<my-app>)).toEqual(null); * ``` * * @return {?} */ function getViewComponent(element) { /** @type {?} */ var context = /** @type {?} */ loadLContext(element); /** @type {?} */ var lView = context.lView; /** @type {?} */ var parent; ngDevMode && assertLView(lView); while (lView[HOST] === null && (parent = /** @type {?} */ getLViewParent(lView))) { // As long as lView[HOST] is null we know we are part of sub-template such as `*ngIf` lView = parent; } return lView[FLAGS] & 512 /* IsRoot */ ? null : /** @type {?} */ lView[CONTEXT]; } /** * Retrieve all root components. * * Root components are those which have been bootstrapped by Angular. * * \@publicApi * @param {?} target A DOM element, component or directive instance. * * @return {?} */ function getRootComponents(target) { return _toConsumableArray(getRootContext(target).components); } /** * Retrieves an `Injector` associated with the element, component or directive. * * \@publicApi * @param {?} target A DOM element, component or directive instance. * * @return {?} */ function getInjector(target) { /** @type {?} */ var context = loadLContext(target); /** @type {?} */ var tNode = /** @type {?} */ context.lView[TVIEW].data[context.nodeIndex]; return new NodeInjector(tNode, context.lView); } /** * Retrieve a set of injection tokens at a given DOM node. * * \@publicApi * @param {?} element Element for which the injection tokens should be retrieved. * @return {?} */ function getInjectionTokens(element) { /** @type {?} */ var context = loadLContext(element, false); if (!context) return []; /** @type {?} */ var lView = context.lView; /** @type {?} */ var tView = lView[TVIEW]; /** @type {?} */ var tNode = /** @type {?} */ tView.data[context.nodeIndex]; /** @type {?} */ var providerTokens = []; /** @type {?} */ var startIndex = tNode.providerIndexes & 65535 /* ProvidersStartIndexMask */ ; /** @type {?} */ var endIndex = tNode.directiveEnd; for (var i = startIndex; i < endIndex; i++) { /** @type {?} */ var value = tView.data[i]; if (isDirectiveDefHack(value)) { // The fact that we sometimes store Type and sometimes DirectiveDef in this location is a // design flaw. We should always store same type so that we can be monomorphic. The issue // is that for Components/Directives we store the def instead the type. The correct behavior // is that we should always be storing injectable type in this location. value = value.type; } providerTokens.push(value); } return providerTokens; } /** * Retrieves directives associated with a given DOM host element. * * \@publicApi * @param {?} target A DOM element, component or directive instance. * * @return {?} */ function getDirectives(target) { /** @type {?} */ var context = /** @type {?} */ loadLContext(target); if (context.directives === undefined) { context.directives = getDirectivesAtNodeIndex(context.nodeIndex, context.lView, false); } return context.directives || []; } /** * @param {?} target * @param {?=} throwOnNotFound * @return {?} */ function loadLContext(target) { var throwOnNotFound = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; /** @type {?} */ var context = getLContext(target); if (!context && throwOnNotFound) { throw new Error(ngDevMode ? "Unable to find context associated with ".concat(stringifyForError(target)) : 'Invalid ng target'); } return context; } /** * Retrieve map of local references. * * The references are retrieved as a map of local reference name to element or directive instance. * * \@publicApi * @param {?} target A DOM element, component or directive instance. * * @return {?} */ function getLocalRefs(target) { /** @type {?} */ var context = /** @type {?} */ loadLContext(target); if (context.localRefs === undefined) { context.localRefs = discoverLocalRefs(context.lView, context.nodeIndex); } return context.localRefs || {}; } /** * Retrieve the host element of the component. * * Use this function to retrieve the host element of the component. The host * element is the element which the component is associated with. * * \@publicApi * @template T * @param {?} directive Component or Directive for which the host element should be retrieved. * * @return {?} */ function getHostElement(directive) { return ( /** @type {?} */ /** @type {?} */ /** @type {?} */ getLContext(directive)["native"] ); } /** * Retrieves the rendered text for a given component. * * This function retrieves the host element of a component and * and then returns the `textContent` for that element. This implies * that the text returned will include re-projected content of * the component as well. * * @param {?} component The component to return the content text for. * @return {?} */ function getRenderedText(component) { /** @type {?} */ var hostElement = getHostElement(component); return hostElement.textContent || ''; } /** * @param {?} node * @return {?} */ function loadLContextFromNode(node) { if (!(node instanceof Node)) throw new Error('Expecting instance of DOM Node'); return ( /** @type {?} */ loadLContext(node) ); } /** * @record */ function Listener() {} if (false) {} /** * @param {?} listener * @return {?} */ function isBrowserEvents(listener) { // Browser events are those which don't have `useCapture` as boolean. return typeof listener.useCapture === 'boolean'; } /** * Retrieves a list of DOM listeners. * * ``` * <my-app> * #VIEW * <div (click)="doSomething()"> * </div> * </mp-app> * * expect(getListeners(<div>)).toEqual({ * name: 'click', * element: <div>, * callback: () => doSomething(), * useCapture: false * }); * ``` * * \@publicApi * @param {?} element Element for which the DOM listeners should be retrieved. * @return {?} */ function getListeners(element) { /** @type {?} */ var lContext = loadLContextFromNode(element); /** @type {?} */ var lView = lContext.lView; /** @type {?} */ var tView = lView[TVIEW]; /** @type {?} */ var lCleanup = lView[CLEANUP]; /** @type {?} */ var tCleanup = tView.cleanup; /** @type {?} */ var listeners = []; if (tCleanup && lCleanup) { for (var i = 0; i < tCleanup.length;) { /** @type {?} */ var firstParam = tCleanup[i++]; /** @type {?} */ var secondParam = tCleanup[i++]; if (typeof firstParam === 'string') { /** @type {?} */ var name = firstParam; /** @type {?} */ var listenerElement = /** @type {?} */ /** @type {?} */ unwrapRNode(lView[secondParam]); /** @type {?} */ var callback = lCleanup[tCleanup[i++]]; /** @type {?} */ var useCaptureOrIndx = tCleanup[i++]; // if useCaptureOrIndx is boolean then report it as is. // if useCaptureOrIndx is positive number then it in unsubscribe method // if useCaptureOrIndx is negative number then it is a Subscription /** @type {?} */ var useCapture = typeof useCaptureOrIndx === 'boolean' ? useCaptureOrIndx : useCaptureOrIndx >= 0 ? false : null; if (element == listenerElement) { listeners.push({ element: element, name: name, callback: callback, useCapture: useCapture }); } } } } listeners.sort(sortListeners); return listeners; } /** * @param {?} a * @param {?} b * @return {?} */ function sortListeners(a, b) { if (a.name == b.name) return 0; return a.name < b.name ? -1 : 1; } /** * This function should not exist because it is megamorphic and only mostly correct. * * See call site for more info. * @param {?} obj * @return {?} */ function isDirectiveDefHack(obj) { return obj.type !== undefined && obj.template !== undefined && obj.declaredInputs !== undefined; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * This value reflects the property on the window where the dev * tools are patched (window.ng). * * @type {?} */ var GLOBAL_PUBLISH_EXPANDO_KEY = 'ng'; /** @type {?} */ var _published = false; /** * Publishes a collection of default debug tools onto`window.ng`. * * These functions are available globally when Angular is in development * mode and are automatically stripped away from prod mode is on. * @return {?} */ function publishDefaultGlobalUtils() { if (!_published) { _published = true; publishGlobalUtil('getComponent', getComponent); publishGlobalUtil('getContext', getContext$1); publishGlobalUtil('getListeners', getListeners); publishGlobalUtil('getViewComponent', getViewComponent); publishGlobalUtil('getHostElement', getHostElement); publishGlobalUtil('getInjector', getInjector); publishGlobalUtil('getRootComponents', getRootComponents); publishGlobalUtil('getDirectives', getDirectives); publishGlobalUtil('markDirty', markDirty); } } /** * Publishes the given function to `window.ng` so that it can be * used from the browser console when an application is not in production. * @param {?} name * @param {?} fn * @return {?} */ function publishGlobalUtil(name, fn) { /** @type {?} */ var w = /** @type {?} */ /** @type {?} */ _global; ngDevMode && assertDefined(fn, 'function not defined'); if (w) { /** @type {?} */ var container = w[GLOBAL_PUBLISH_EXPANDO_KEY]; if (!container) { container = w[GLOBAL_PUBLISH_EXPANDO_KEY] = {}; } container[name] = fn; } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Options that control how the component should be bootstrapped. * @record */ function CreateComponentOptions() {} if (false) {} // TODO: A hack to not pull in the NullInjector from @angular/core. var ɵ0$c = /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ function ɵ0$c(token, notFoundValue) { throw new Error('NullInjector: Not found: ' + stringifyForError(token)); }; /** @type {?} */ var NULL_INJECTOR$1 = { get: ɵ0$c }; /** * Bootstraps a Component into an existing host element and returns an instance * of the component. * * Use this function to bootstrap a component into the DOM tree. Each invocation * of this function will create a separate tree of components, injectors and * change detection cycles and lifetimes. To dynamically insert a new component * into an existing tree such that it shares the same injection, change detection * and object lifetime, use {\@link ViewContainer#createComponent}. * * @template T * @param {?} componentType Component to bootstrap * @param {?=} opts * @return {?} */ function renderComponent(componentType /* Type as workaround for: Microsoft/TypeScript/issues/4881 */ ) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; ngDevMode && publishDefaultGlobalUtils(); ngDevMode && assertComponentType(componentType); // this is preemptively set to avoid having test and debug code accidentally // read data from a previous application state... setActiveHostElement(null); /** @type {?} */ var rendererFactory = opts.rendererFactory || domRendererFactory3; /** @type {?} */ var sanitizer = opts.sanitizer || null; /** @type {?} */ var componentDef = /** @type {?} */ getComponentDef(componentType); if (componentDef.type != componentType) componentDef.type = componentType; // The first index of the first selector is the tag name. /** @type {?} */ var componentTag = /** @type {?} */ /** @type {?} */ /** @type {?} */ componentDef.selectors[0][0]; /** @type {?} */ var hostRNode = locateHostElement(rendererFactory, opts.host || componentTag); /** @type {?} */ var rootFlags = componentDef.onPush ? 64 /* Dirty */ | 512 /* IsRoot */ : 16 /* CheckAlways */ | 512 /* IsRoot */ ; /** @type {?} */ var rootContext = createRootContext(opts.scheduler, opts.playerHandler); /** @type {?} */ var renderer = rendererFactory.createRenderer(hostRNode, componentDef); /** @type {?} */ var rootView = createLView(null, createTView(-1, null, 1, 0, null, null, null, null), rootContext, rootFlags, null, null, rendererFactory, renderer, undefined, opts.injector || null); /** @type {?} */ var oldView = enterView(rootView, null); /** @type {?} */ var component; // Will become true if the `try` block executes with no errors. /** @type {?} */ var safeToRunHooks = false; try { if (rendererFactory.begin) rendererFactory.begin(); /** @type {?} */ var componentView = createRootComponentView(hostRNode, componentDef, rootView, rendererFactory, renderer, sanitizer); component = createRootComponent(componentView, componentDef, rootView, rootContext, opts.hostFeatures || null); addToViewTree(rootView, componentView); refreshDescendantViews(rootView); // creation mode pass rootView[FLAGS] &= ~4 /* CreationMode */ ; resetPreOrderHookFlags(rootView); refreshDescendantViews(rootView); // update mode pass safeToRunHooks = true; } finally { leaveView(oldView, safeToRunHooks); if (rendererFactory.end) rendererFactory.end(); } return component; } /** * Creates the root component view and the root component node. * * @param {?} rNode Render host element. * @param {?} def ComponentDef * @param {?} rootView The parent view where the host node is stored * @param {?} rendererFactory * @param {?} renderer The current renderer * @param {?=} sanitizer The sanitizer, if provided * * @return {?} Component view created */ function createRootComponentView(rNode, def, rootView, rendererFactory, renderer, sanitizer) { resetComponentState(); /** @type {?} */ var tView = rootView[TVIEW]; ngDevMode && assertDataInRange(rootView, 0 + HEADER_OFFSET); rootView[0 + HEADER_OFFSET] = rNode; /** @type {?} */ var tNode = getOrCreateTNode(tView, null, 0, 3 /* Element */ , null, null); /** @type {?} */ var componentView = createLView(rootView, getOrCreateTView(def), null, def.onPush ? 64 /* Dirty */ : 16 /* CheckAlways */ , rootView[HEADER_OFFSET], tNode, rendererFactory, renderer, sanitizer); if (tView.firstTemplatePass) { diPublicInInjector(getOrCreateNodeInjectorForNode(tNode, rootView), tView, def.type); tNode.flags = 1 /* isComponent */ ; initNodeFlags(tNode, rootView.length, 1); queueComponentIndexForCheck(tNode); } // Store component view at node index, with node as the HOST return rootView[HEADER_OFFSET] = componentView; } /** * Creates a root component and sets it up with features and host bindings. Shared by * renderComponent() and ViewContainerRef.createComponent(). * @template T * @param {?} componentView * @param {?} componentDef * @param {?} rootView * @param {?} rootContext * @param {?} hostFeatures * @return {?} */ function createRootComponent(componentView, componentDef, rootView, rootContext, hostFeatures) { /** @type {?} */ var tView = rootView[TVIEW]; // Create directive instance with factory() and store at next index in viewData /** @type {?} */ var component = instantiateRootComponent(tView, rootView, componentDef); rootContext.components.push(component); componentView[CONTEXT] = component; hostFeatures && hostFeatures.forEach( /** * @param {?} feature * @return {?} */ function (feature) { return feature(component, componentDef); }); // We want to generate an empty QueryList for root content queries for backwards // compatibility with ViewEngine. if (componentDef.contentQueries) { componentDef.contentQueries(1 /* Create */ , component, rootView.length - 1); } /** @type {?} */ var rootTNode = getPreviousOrParentTNode(); if (tView.firstTemplatePass && componentDef.hostBindings) { /** @type {?} */ var elementIndex = rootTNode.index - HEADER_OFFSET; setActiveHostElement(elementIndex); /** @type {?} */ var expando = /** @type {?} */ tView.expandoInstructions; invokeHostBindingsInCreationMode(componentDef, expando, component, rootTNode, tView.firstTemplatePass); setActiveHostElement(null); } return component; } /** * @param {?=} scheduler * @param {?=} playerHandler * @return {?} */ function createRootContext(scheduler, playerHandler) { return { components: [], scheduler: scheduler || defaultScheduler, clean: CLEAN_PROMISE, playerHandler: playerHandler || null, flags: 0 /* Empty */ }; } /** * Used to enable lifecycle hooks on the root component. * * Include this feature when calling `renderComponent` if the root component * you are rendering has lifecycle hooks defined. Otherwise, the hooks won't * be called properly. * * Example: * * ``` * renderComponent(AppComponent, {features: [RootLifecycleHooks]}); * ``` * @param {?} component * @param {?} def * @return {?} */ function LifecycleHooksFeature(component, def) { /** @type {?} */ var rootTView = /** @type {?} */ readPatchedLView(component)[TVIEW]; /** @type {?} */ var dirIndex = rootTView.data.length - 1; registerPreOrderHooks(dirIndex, def, rootTView, -1, -1, -1); // TODO(misko): replace `as TNode` with createTNode call. (needs refactoring to lose dep on // LNode). registerPostOrderHooks(rootTView, /** @type {?} */ { directiveStart: dirIndex, directiveEnd: dirIndex + 1 }); } /** * Wait on component until it is rendered. * * This function returns a `Promise` which is resolved when the component's * change detection is executed. This is determined by finding the scheduler * associated with the `component`'s render tree and waiting until the scheduler * flushes. If nothing is scheduled, the function returns a resolved promise. * * Example: * ``` * await whenRendered(myComponent); * ``` * * @param {?} component Component to wait upon * @return {?} Promise which resolves when the component is rendered. */ function whenRendered(component) { return getRootContext(component).clean; } /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Represents a basic change from a previous to a new value for a single * property on a directive instance. Passed as a value in a * {@link SimpleChanges} object to the `ngOnChanges` hook. * * @see `OnChanges` * * @publicApi */ var SimpleChange = /*#__PURE__*/function () { function SimpleChange(previousValue, currentValue, firstChange) { _classCallCheck(this, SimpleChange); this.previousValue = previousValue; this.currentValue = currentValue; this.firstChange = firstChange; } /** * Check whether the new value is the first value assigned. */ _createClass2(SimpleChange, [{ key: "isFirstChange", value: function isFirstChange() { return this.firstChange; } }]); return SimpleChange; }(); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var PRIVATE_PREFIX = '__ngOnChanges_'; /** * The NgOnChangesFeature decorates a component with support for the ngOnChanges * lifecycle hook, so it should be included in any component that implements * that hook. * * If the component or directive uses inheritance, the NgOnChangesFeature MUST * be included as a feature AFTER {\@link InheritDefinitionFeature}, otherwise * inherited properties will not be propagated to the ngOnChanges lifecycle * hook. * * Example usage: * * ``` * static ngComponentDef = defineComponent({ * ... * inputs: {name: 'publicName'}, * features: [NgOnChangesFeature()] * }); * ``` * * \@codeGenApi * @template T * @return {?} */ function ɵɵNgOnChangesFeature() { // This option ensures that the ngOnChanges lifecycle hook will be inherited // from superclasses (in InheritDefinitionFeature). /** @type {?} */ NgOnChangesFeatureImpl.ngInherit = true; return NgOnChangesFeatureImpl; } /** * @template T * @param {?} definition * @return {?} */ function NgOnChangesFeatureImpl(definition) { if (definition.type.prototype.ngOnChanges) { definition.setInput = ngOnChangesSetInput; definition.onChanges = wrapOnChanges(); } } /** * @return {?} */ function wrapOnChanges() { return ( /** * @this {?} * @return {?} */ function wrapOnChangesHook_inPreviousChangesStorage() { /** @type {?} */ var simpleChangesStore = getSimpleChangesStore(this); /** @type {?} */ var current = simpleChangesStore && simpleChangesStore.current; if (current) { /** @type {?} */ var previous = /** @type {?} */ simpleChangesStore.previous; if (previous === EMPTY_OBJ) { /** @type {?} */ simpleChangesStore.previous = current; } else { // New changes are copied to the previous store, so that we don't lose history for inputs // which were not changed this time for (var key in current) { previous[key] = current[key]; } } /** @type {?} */ simpleChangesStore.current = null; this.ngOnChanges(current); } } ); } /** * @template T * @this {?} * @param {?} instance * @param {?} value * @param {?} publicName * @param {?} privateName * @return {?} */ function ngOnChangesSetInput(instance, value, publicName, privateName) { /** @type {?} */ var simpleChangesStore = getSimpleChangesStore(instance) || setSimpleChangesStore(instance, { previous: EMPTY_OBJ, current: null }); /** @type {?} */ var current = simpleChangesStore.current || (simpleChangesStore.current = {}); /** @type {?} */ var previous = simpleChangesStore.previous; /** @type {?} */ var declaredName = /** @type {?} */ this.declaredInputs[publicName]; /** @type {?} */ var previousChange = previous[declaredName]; current[declaredName] = new SimpleChange(previousChange && previousChange.currentValue, value, previous === EMPTY_OBJ); /** @type {?} */ instance[privateName] = value; } /** @type {?} */ var SIMPLE_CHANGES_STORE = '__ngSimpleChanges__'; /** * @param {?} instance * @return {?} */ function getSimpleChangesStore(instance) { return instance[SIMPLE_CHANGES_STORE] || null; } /** * @param {?} instance * @param {?} store * @return {?} */ function setSimpleChangesStore(instance, store) { return instance[SIMPLE_CHANGES_STORE] = store; } /** * @record */ function NgSimpleChangesStore() {} if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} type * @return {?} */ function getSuperType(type) { return Object.getPrototypeOf(type.prototype).constructor; } /** * Merges the definition from a super class to a sub class. * \@codeGenApi * @param {?} definition The definition that is a SubClass of another directive of component * * @return {?} */ function ɵɵInheritDefinitionFeature(definition) { /** @type {?} */ var superType = getSuperType(definition.type); while (superType) { /** @type {?} */ var superDef = undefined; if (isComponentDef(definition)) { // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance. superDef = superType.ngComponentDef || superType.ngDirectiveDef; } else { if (superType.ngComponentDef) { throw new Error('Directives cannot inherit Components'); } // Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance. superDef = superType.ngDirectiveDef; } /** @nocollapse @type {?} */ var baseDef = /** @type {?} */ superType.ngBaseDef; // Some fields in the definition may be empty, if there were no values to put in them that // would've justified object creation. Unwrap them if necessary. if (baseDef || superDef) { /** @type {?} */ var writeableDef = /** @type {?} */ definition; writeableDef.inputs = maybeUnwrapEmpty(definition.inputs); writeableDef.declaredInputs = maybeUnwrapEmpty(definition.declaredInputs); writeableDef.outputs = maybeUnwrapEmpty(definition.outputs); } if (baseDef) { /** @type {?} */ var baseViewQuery = baseDef.viewQuery; /** @type {?} */ var baseContentQueries = baseDef.contentQueries; /** @type {?} */ var baseHostBindings = baseDef.hostBindings; baseHostBindings && inheritHostBindings(definition, baseHostBindings); baseViewQuery && inheritViewQuery(definition, baseViewQuery); baseContentQueries && inheritContentQueries(definition, baseContentQueries); fillProperties(definition.inputs, baseDef.inputs); fillProperties(definition.declaredInputs, baseDef.declaredInputs); fillProperties(definition.outputs, baseDef.outputs); } if (superDef) { // Merge hostBindings /** @type {?} */ var superHostBindings = superDef.hostBindings; superHostBindings && inheritHostBindings(definition, superHostBindings); // Merge queries /** @type {?} */ var superViewQuery = superDef.viewQuery; /** @type {?} */ var superContentQueries = superDef.contentQueries; superViewQuery && inheritViewQuery(definition, superViewQuery); superContentQueries && inheritContentQueries(definition, superContentQueries); // Merge inputs and outputs fillProperties(definition.inputs, superDef.inputs); fillProperties(definition.declaredInputs, superDef.declaredInputs); fillProperties(definition.outputs, superDef.outputs); // Inherit hooks // Assume super class inheritance feature has already run. definition.afterContentChecked = definition.afterContentChecked || superDef.afterContentChecked; definition.afterContentInit = definition.afterContentInit || superDef.afterContentInit; definition.afterViewChecked = definition.afterViewChecked || superDef.afterViewChecked; definition.afterViewInit = definition.afterViewInit || superDef.afterViewInit; definition.doCheck = definition.doCheck || superDef.doCheck; definition.onDestroy = definition.onDestroy || superDef.onDestroy; definition.onInit = definition.onInit || superDef.onInit; // Run parent features /** @type {?} */ var features = superDef.features; if (features) { var _iterator37 = _createForOfIteratorHelper(features), _step37; try { for (_iterator37.s(); !(_step37 = _iterator37.n()).done;) { var feature = _step37.value; if (feature && feature.ngInherit) { /** @type {?} */ feature(definition); } } } catch (err) { _iterator37.e(err); } finally { _iterator37.f(); } } } else { // Even if we don't have a definition, check the type for the hooks and use those if need be /** @type {?} */ var superPrototype = superType.prototype; if (superPrototype) { definition.afterContentChecked = definition.afterContentChecked || superPrototype.ngAfterContentChecked; definition.afterContentInit = definition.afterContentInit || superPrototype.ngAfterContentInit; definition.afterViewChecked = definition.afterViewChecked || superPrototype.ngAfterViewChecked; definition.afterViewInit = definition.afterViewInit || superPrototype.ngAfterViewInit; definition.doCheck = definition.doCheck || superPrototype.ngDoCheck; definition.onDestroy = definition.onDestroy || superPrototype.ngOnDestroy; definition.onInit = definition.onInit || superPrototype.ngOnInit; if (superPrototype.ngOnChanges) { ɵɵNgOnChangesFeature()(definition); } } } superType = Object.getPrototypeOf(superType); } } /** * @param {?} value * @return {?} */ function maybeUnwrapEmpty(value) { if (value === EMPTY_OBJ) { return {}; } else if (value === EMPTY_ARRAY) { return []; } else { return value; } } /** * @param {?} definition * @param {?} superViewQuery * @return {?} */ function inheritViewQuery(definition, superViewQuery) { /** @type {?} */ var prevViewQuery = definition.viewQuery; if (prevViewQuery) { definition.viewQuery = /** * @param {?} rf * @param {?} ctx * @return {?} */ function (rf, ctx) { superViewQuery(rf, ctx); prevViewQuery(rf, ctx); }; } else { definition.viewQuery = superViewQuery; } } /** * @param {?} definition * @param {?} superContentQueries * @return {?} */ function inheritContentQueries(definition, superContentQueries) { /** @type {?} */ var prevContentQueries = definition.contentQueries; if (prevContentQueries) { definition.contentQueries = /** * @param {?} rf * @param {?} ctx * @param {?} directiveIndex * @return {?} */ function (rf, ctx, directiveIndex) { superContentQueries(rf, ctx, directiveIndex); prevContentQueries(rf, ctx, directiveIndex); }; } else { definition.contentQueries = superContentQueries; } } /** * @param {?} definition * @param {?} superHostBindings * @return {?} */ function inheritHostBindings(definition, superHostBindings) { /** @type {?} */ var prevHostBindings = definition.hostBindings; // If the subclass does not have a host bindings function, we set the subclass host binding // function to be the superclass's (in this feature). We should check if they're the same here // to ensure we don't inherit it twice. if (superHostBindings !== prevHostBindings) { if (prevHostBindings) { // because inheritance is unknown during compile time, the runtime code // needs to be informed of the super-class depth so that instruction code // can distinguish one host bindings function from another. The reason why // relying on the directive uniqueId exclusively is not enough is because the // uniqueId value and the directive instance stay the same between hostBindings // calls throughout the directive inheritance chain. This means that without // a super-class depth value, there is no way to know whether a parent or // sub-class host bindings function is currently being executed. definition.hostBindings = /** * @param {?} rf * @param {?} ctx * @param {?} elementIndex * @return {?} */ function (rf, ctx, elementIndex) { // The reason why we increment first and then decrement is so that parent // hostBindings calls have a higher id value compared to sub-class hostBindings // calls (this way the leaf directive is always at a super-class depth of 0). adjustActiveDirectiveSuperClassDepthPosition(1); try { superHostBindings(rf, ctx, elementIndex); } finally { adjustActiveDirectiveSuperClassDepthPosition(-1); } prevHostBindings(rf, ctx, elementIndex); }; } else { definition.hostBindings = superHostBindings; } } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Resolves the providers which are defined in the DirectiveDef. * * When inserting the tokens and the factories in their respective arrays, we can assume that * this method is called first for the component (if any), and then for other directives on the same * node. * As a consequence,the providers are always processed in that order: * 1) The view providers of the component * 2) The providers of the component * 3) The providers of the other directives * This matches the structure of the injectables arrays of a view (for each node). * So the tokens and the factories can be pushed at the end of the arrays, except * in one case for multi providers. * * @template T * @param {?} def the directive definition * @param {?} providers * @param {?} viewProviders * @return {?} */ function providersResolver(def, providers, viewProviders) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var tView = lView[TVIEW]; if (tView.firstTemplatePass) { /** @type {?} */ var _isComponent2 = isComponentDef(def); // The list of view providers is processed first, and the flags are updated resolveProvider$1(viewProviders, tView.data, tView.blueprint, _isComponent2, true); // Then, the list of providers is processed, and the flags are updated resolveProvider$1(providers, tView.data, tView.blueprint, _isComponent2, false); } } /** * Resolves a provider and publishes it to the DI system. * @param {?} provider * @param {?} tInjectables * @param {?} lInjectablesBlueprint * @param {?} isComponent * @param {?} isViewProvider * @return {?} */ function resolveProvider$1(provider, tInjectables, lInjectablesBlueprint, isComponent, isViewProvider) { provider = resolveForwardRef(provider); if (Array.isArray(provider)) { // Recursively call `resolveProvider` // Recursion is OK in this case because this code will not be in hot-path once we implement // cloning of the initial state. for (var i = 0; i < provider.length; i++) { resolveProvider$1(provider[i], tInjectables, lInjectablesBlueprint, isComponent, isViewProvider); } } else { /** @type {?} */ var _lView7 = getLView(); /** @type {?} */ var tView = _lView7[TVIEW]; /** @type {?} */ var token = isTypeProvider(provider) ? provider : resolveForwardRef(provider.provide); /** @type {?} */ var providerFactory = providerToFactory(provider); /** @type {?} */ var tNode = getPreviousOrParentTNode(); /** @type {?} */ var beginIndex = tNode.providerIndexes & 65535 /* ProvidersStartIndexMask */ ; /** @type {?} */ var endIndex = tNode.directiveStart; /** @type {?} */ var cptViewProvidersCount = tNode.providerIndexes >> 16 /* CptViewProvidersCountShift */ ; if (isClassProvider(provider) || isTypeProvider(provider)) { /** @type {?} */ var prototype = ( /** @type {?} */ provider.useClass || provider).prototype; /** @type {?} */ var ngOnDestroy = prototype.ngOnDestroy; if (ngOnDestroy) { (tView.destroyHooks || (tView.destroyHooks = [])).push(tInjectables.length, ngOnDestroy); } } if (isTypeProvider(provider) || !provider.multi) { // Single provider case: the factory is created and pushed immediately /** @type {?} */ var factory = new NodeInjectorFactory(providerFactory, isViewProvider, ɵɵdirectiveInject); /** @type {?} */ var existingFactoryIndex = indexOf(token, tInjectables, isViewProvider ? beginIndex : beginIndex + cptViewProvidersCount, endIndex); if (existingFactoryIndex == -1) { diPublicInInjector(getOrCreateNodeInjectorForNode( /** @type {?} */ tNode, _lView7), tView, token); tInjectables.push(token); tNode.directiveStart++; tNode.directiveEnd++; if (isViewProvider) { tNode.providerIndexes += 65536 /* CptViewProvidersCountShifter */ ; } lInjectablesBlueprint.push(factory); _lView7.push(factory); } else { lInjectablesBlueprint[existingFactoryIndex] = factory; _lView7[existingFactoryIndex] = factory; } } else { // Multi provider case: // We create a multi factory which is going to aggregate all the values. // Since the output of such a factory depends on content or view injection, // we create two of them, which are linked together. // // The first one (for view providers) is always in the first block of the injectables array, // and the second one (for providers) is always in the second block. // This is important because view providers have higher priority. When a multi token // is being looked up, the view providers should be found first. // Note that it is not possible to have a multi factory in the third block (directive block). // // The algorithm to process multi providers is as follows: // 1) If the multi provider comes from the `viewProviders` of the component: // a) If the special view providers factory doesn't exist, it is created and pushed. // b) Else, the multi provider is added to the existing multi factory. // 2) If the multi provider comes from the `providers` of the component or of another // directive: // a) If the multi factory doesn't exist, it is created and provider pushed into it. // It is also linked to the multi factory for view providers, if it exists. // b) Else, the multi provider is added to the existing multi factory. /** @type {?} */ var existingProvidersFactoryIndex = indexOf(token, tInjectables, beginIndex + cptViewProvidersCount, endIndex); /** @type {?} */ var existingViewProvidersFactoryIndex = indexOf(token, tInjectables, beginIndex, beginIndex + cptViewProvidersCount); /** @type {?} */ var doesProvidersFactoryExist = existingProvidersFactoryIndex >= 0 && lInjectablesBlueprint[existingProvidersFactoryIndex]; /** @type {?} */ var doesViewProvidersFactoryExist = existingViewProvidersFactoryIndex >= 0 && lInjectablesBlueprint[existingViewProvidersFactoryIndex]; if (isViewProvider && !doesViewProvidersFactoryExist || !isViewProvider && !doesProvidersFactoryExist) { // Cases 1.a and 2.a diPublicInInjector(getOrCreateNodeInjectorForNode( /** @type {?} */ tNode, _lView7), tView, token); /** @type {?} */ var _factory2 = multiFactory(isViewProvider ? multiViewProvidersFactoryResolver : multiProvidersFactoryResolver, lInjectablesBlueprint.length, isViewProvider, isComponent, providerFactory); if (!isViewProvider && doesViewProvidersFactoryExist) { lInjectablesBlueprint[existingViewProvidersFactoryIndex].providerFactory = _factory2; } tInjectables.push(token); tNode.directiveStart++; tNode.directiveEnd++; if (isViewProvider) { tNode.providerIndexes += 65536 /* CptViewProvidersCountShifter */ ; } lInjectablesBlueprint.push(_factory2); _lView7.push(_factory2); } else { // Cases 1.b and 2.b multiFactoryAdd( /** @type {?} */ lInjectablesBlueprint[isViewProvider ? existingViewProvidersFactoryIndex : existingProvidersFactoryIndex], providerFactory, !isViewProvider && isComponent); } if (!isViewProvider && isComponent && doesViewProvidersFactoryExist) { /** @type {?} */lInjectablesBlueprint[existingViewProvidersFactoryIndex].componentProviders++; } } } } /** * Add a factory in a multi factory. * @param {?} multiFactory * @param {?} factory * @param {?} isComponentProvider * @return {?} */ function multiFactoryAdd(multiFactory, factory, isComponentProvider) { /** @type {?} */ multiFactory.multi.push(factory); if (isComponentProvider) { /** @type {?} */multiFactory.componentProviders++; } } /** * Returns the index of item in the array, but only in the begin to end range. * @param {?} item * @param {?} arr * @param {?} begin * @param {?} end * @return {?} */ function indexOf(item, arr, begin, end) { for (var i = begin; i < end; i++) { if (arr[i] === item) return i; } return -1; } /** * Use this with `multi` `providers`. * @this {?} * @param {?} _ * @param {?} tData * @param {?} lData * @param {?} tNode * @return {?} */ function multiProvidersFactoryResolver(_, tData, lData, tNode) { return multiResolve( /** @type {?} */ this.multi, []); } /** * Use this with `multi` `viewProviders`. * * This factory knows how to concatenate itself with the existing `multi` `providers`. * @this {?} * @param {?} _ * @param {?} tData * @param {?} lData * @param {?} tNode * @return {?} */ function multiViewProvidersFactoryResolver(_, tData, lData, tNode) { /** @type {?} */ var factories = /** @type {?} */ this.multi; /** @type {?} */ var result; if (this.providerFactory) { /** @type {?} */ var componentCount = /** @type {?} */ this.providerFactory.componentProviders; /** @type {?} */ var multiProviders = getNodeInjectable(tData, lData, /** @type {?} */ /** @type {?} */ this.providerFactory.index, tNode); // Copy the section of the array which contains `multi` `providers` from the component result = multiProviders.slice(0, componentCount); // Insert the `viewProvider` instances. multiResolve(factories, result); // Copy the section of the array which contains `multi` `providers` from other directives for (var i = componentCount; i < multiProviders.length; i++) { result.push(multiProviders[i]); } } else { result = []; // Insert the `viewProvider` instances. multiResolve(factories, result); } return result; } /** * Maps an array of factories into an array of values. * @param {?} factories * @param {?} result * @return {?} */ function multiResolve(factories, result) { for (var i = 0; i < factories.length; i++) { /** @type {?} */ var factory = /** @type {?} */ /** @type {?} */ factories[i]; result.push(factory()); } return result; } /** * Creates a multi factory. * @param {?} factoryFn * @param {?} index * @param {?} isViewProvider * @param {?} isComponent * @param {?} f * @return {?} */ function multiFactory(factoryFn, index, isViewProvider, isComponent, f) { /** @type {?} */ var factory = new NodeInjectorFactory(factoryFn, isViewProvider, ɵɵdirectiveInject); factory.multi = []; factory.index = index; factory.componentProviders = 0; multiFactoryAdd(factory, f, isComponent && !isViewProvider); return factory; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * This feature resolves the providers of a directive (or component), * and publish them into the DI system, making it visible to others for injection. * * For example: * ```ts * class ComponentWithProviders { * constructor(private greeter: GreeterDE) {} * * static ngComponentDef = defineComponent({ * type: ComponentWithProviders, * selectors: [['component-with-providers']], * factory: () => new ComponentWithProviders(directiveInject(GreeterDE as any)), * consts: 1, * vars: 1, * template: function(fs: RenderFlags, ctx: ComponentWithProviders) { * if (fs & RenderFlags.Create) { * ɵɵtext(0); * } * if (fs & RenderFlags.Update) { * ɵɵselect(0); * ɵɵtextBinding(ctx.greeter.greet()); * } * }, * features: [ProvidersFeature([GreeterDE])] * }); * } * ``` * * \@codeGenApi * @template T * @param {?} providers * @param {?=} viewProviders * @return {?} */ function ɵɵProvidersFeature(providers) { var viewProviders = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; return ( /** * @param {?} definition * @return {?} */ function (definition) { definition.providersResolver = /** * @param {?} def * @param {?=} processProvidersFn * @return {?} */ function (def, processProvidersFn) { return providersResolver(def, // processProvidersFn ? processProvidersFn(providers) : providers, // viewProviders); }; } ); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Represents a component created by a `ComponentFactory`. * Provides access to the component instance and related objects, * and provides the means of destroying the instance. * * \@publicApi * @abstract * @template C */ var ComponentRef = function ComponentRef() { _classCallCheck(this, ComponentRef); }; if (false) {} /** * Base class for a factory that can create a component dynamically. * Instantiate a factory for a given type of component with `resolveComponentFactory()`. * Use the resulting `ComponentFactory.create()` method to create a component of that type. * * @see [Dynamic Components](guide/dynamic-component-loader) * * \@publicApi * @abstract * @template C */ var ComponentFactory = function ComponentFactory() { _classCallCheck(this, ComponentFactory); }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} component * @return {?} */ function noComponentFactoryError(component) { /** @type {?} */ var error = Error("No component factory found for ".concat(stringify(component), ". Did you add it to @NgModule.entryComponents?")); /** @type {?} */ error[ERROR_COMPONENT] = component; return error; } /** @type {?} */ var ERROR_COMPONENT = 'ngComponent'; /** * @param {?} error * @return {?} */ function getComponent$1(error) { return ( /** @type {?} */ error[ERROR_COMPONENT] ); } var _NullComponentFactoryResolver = /*#__PURE__*/function () { function _NullComponentFactoryResolver() { _classCallCheck(this, _NullComponentFactoryResolver); } _createClass2(_NullComponentFactoryResolver, [{ key: "resolveComponentFactory", /** * @template T * @param {?} component * @return {?} */ value: function resolveComponentFactory(component) { throw noComponentFactoryError(component); } }]); return _NullComponentFactoryResolver; }(); /** * A simple registry that maps `Components` to generated `ComponentFactory` classes * that can be used to create instances of components. * Use to obtain the factory for a given component type, * then use the factory's `create()` method to create a component of that type. * * @see [Dynamic Components](guide/dynamic-component-loader) * \@publicApi * @abstract */ var ComponentFactoryResolver = function ComponentFactoryResolver() { _classCallCheck(this, ComponentFactoryResolver); }; ComponentFactoryResolver.NULL = new _NullComponentFactoryResolver(); if (false) {} var CodegenComponentFactoryResolver = /*#__PURE__*/function () { /** * @param {?} factories * @param {?} _parent * @param {?} _ngModule */ function CodegenComponentFactoryResolver(factories, _parent, _ngModule) { _classCallCheck(this, CodegenComponentFactoryResolver); this._parent = _parent; this._ngModule = _ngModule; this._factories = new Map(); for (var i = 0; i < factories.length; i++) { /** @type {?} */ var factory = factories[i]; this._factories.set(factory.componentType, factory); } } /** * @template T * @param {?} component * @return {?} */ _createClass2(CodegenComponentFactoryResolver, [{ key: "resolveComponentFactory", value: function resolveComponentFactory(component) { /** @type {?} */ var factory = this._factories.get(component); if (!factory && this._parent) { factory = this._parent.resolveComponentFactory(component); } if (!factory) { throw noComponentFactoryError(component); } return new ComponentFactoryBoundToModule(factory, this._ngModule); } }]); return CodegenComponentFactoryResolver; }(); if (false) {} /** * @template C */ var ComponentFactoryBoundToModule = /*#__PURE__*/function (_ComponentFactory) { _inherits(ComponentFactoryBoundToModule, _ComponentFactory); var _super111 = _createSuper(ComponentFactoryBoundToModule); /** * @param {?} factory * @param {?} ngModule */ function ComponentFactoryBoundToModule(factory, ngModule) { var _this328; _classCallCheck(this, ComponentFactoryBoundToModule); _this328 = _super111.call(this); _this328.factory = factory; _this328.ngModule = ngModule; _this328.selector = factory.selector; _this328.componentType = factory.componentType; _this328.ngContentSelectors = factory.ngContentSelectors; _this328.inputs = factory.inputs; _this328.outputs = factory.outputs; return _this328; } /** * @param {?} injector * @param {?=} projectableNodes * @param {?=} rootSelectorOrNode * @param {?=} ngModule * @return {?} */ _createClass2(ComponentFactoryBoundToModule, [{ key: "create", value: function create(injector, projectableNodes, rootSelectorOrNode, ngModule) { return this.factory.create(injector, projectableNodes, rootSelectorOrNode, ngModule || this.ngModule); } }]); return ComponentFactoryBoundToModule; }(ComponentFactory); if (false) {} /** * @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 */ function noop() {} // Do nothing. /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A wrapper around a native element inside of a View. * * An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM * element. * * \@security Permitting direct access to the DOM can make your application more vulnerable to * XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the * [Security Guide](http://g.co/ng/security). * * \@publicApi * @template T */ // Note: We don't expose things like `Injector`, `ViewContainer`, ... here, // i.e. users have to ask for what they need. With that, we can build better analysis tools // and could do better codegen in the future. var ElementRef = /** * @param {?} nativeElement */ function ElementRef(nativeElement) { _classCallCheck(this, ElementRef); this.nativeElement = nativeElement; }; /** * \@internal * @nocollapse */ ElementRef.__NG_ELEMENT_ID__ = /** * @return {?} */ function () { return SWITCH_ELEMENT_REF_FACTORY(ElementRef); }; if (false) {} /** @type {?} */ var SWITCH_ELEMENT_REF_FACTORY__POST_R3__ = injectElementRef; /** @type {?} */ var SWITCH_ELEMENT_REF_FACTORY__PRE_R3__ = noop; /** @type {?} */ var SWITCH_ELEMENT_REF_FACTORY = SWITCH_ELEMENT_REF_FACTORY__PRE_R3__; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @deprecated Use `RendererType2` (and `Renderer2`) instead. * \@publicApi */ var RenderComponentType = /** * @param {?} id * @param {?} templateUrl * @param {?} slotCount * @param {?} encapsulation * @param {?} styles * @param {?} animations */ function RenderComponentType(id, templateUrl, slotCount, encapsulation, styles, animations) { _classCallCheck(this, RenderComponentType); this.id = id; this.templateUrl = templateUrl; this.slotCount = slotCount; this.encapsulation = encapsulation; this.styles = styles; this.animations = animations; }; if (false) {} /** * @deprecated Debug info is handled internally in the view engine now. * @abstract */ var RenderDebugInfo = function RenderDebugInfo() { _classCallCheck(this, RenderDebugInfo); }; if (false) {} /** * @deprecated Use the `Renderer2` instead. * @record */ function DirectRenderer() {} if (false) {} /** * @deprecated Use the `Renderer2` instead. * \@publicApi * @abstract */ var Renderer = function Renderer() { _classCallCheck(this, Renderer); }; if (false) {} /** @type {?} */ var Renderer2Interceptor = new InjectionToken('Renderer2Interceptor'); /** * Injectable service that provides a low-level interface for modifying the UI. * * Use this service to bypass Angular's templating and make custom UI changes that can't be * expressed declaratively. For example if you need to set a property or an attribute whose name is * not statically known, use {\@link Renderer#setElementProperty setElementProperty} or * {\@link Renderer#setElementAttribute setElementAttribute} respectively. * * If you are implementing a custom renderer, you must implement this interface. * * The default Renderer implementation is `DomRenderer`. Also available is `WebWorkerRenderer`. * * @deprecated Use `RendererFactory2` instead. * \@publicApi * @abstract */ var RootRenderer = function RootRenderer() { _classCallCheck(this, RootRenderer); }; if (false) {} /** * Used by `RendererFactory2` to associate custom rendering data and styles * with a rendering implementation. * \@publicApi * @record */ function RendererType2() {} if (false) {} /** * Creates and initializes a custom renderer that implements the `Renderer2` base class. * * \@publicApi * @abstract */ var RendererFactory2 = function RendererFactory2() { _classCallCheck(this, RendererFactory2); }; if (false) {} /** @enum {number} */ var RendererStyleFlags2 = { /** * Marks a style as important. */ Important: 1, /** * Marks a style as using dash case naming (this-is-dash-case). */ DashCase: 2 }; RendererStyleFlags2[RendererStyleFlags2.Important] = 'Important'; RendererStyleFlags2[RendererStyleFlags2.DashCase] = 'DashCase'; /** * Extend this base class to implement custom rendering. By default, Angular * renders a template into DOM. You can use custom rendering to intercept * rendering calls, or to render to something other than DOM. * * Create your custom renderer using `RendererFactory2`. * * Use a custom renderer to bypass Angular's templating and * make custom UI changes that can't be expressed declaratively. * For example if you need to set a property or an attribute whose name is * not statically known, use the `setProperty()` or * `setAttribute()` method. * * \@publicApi * @abstract */ var Renderer2 = function Renderer2() { _classCallCheck(this, Renderer2); }; /** * \@internal * @nocollapse */ Renderer2.__NG_ELEMENT_ID__ = /** * @return {?} */ function () { return SWITCH_RENDERER2_FACTORY(); }; if (false) {} /** @type {?} */ var SWITCH_RENDERER2_FACTORY__POST_R3__ = injectRenderer2; /** @type {?} */ var SWITCH_RENDERER2_FACTORY__PRE_R3__ = noop; /** @type {?} */ var SWITCH_RENDERER2_FACTORY = SWITCH_RENDERER2_FACTORY__PRE_R3__; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** * \@description Represents the version of Angular * * \@publicApi */ var Version = /** * @param {?} full */ function Version(full) { _classCallCheck(this, Version); this.full = full; this.major = full.split('.')[0]; this.minor = full.split('.')[1]; this.patch = full.split('.').slice(2).join('.'); }; if (false) {} /** * \@publicApi * @type {?} */ var VERSION = new Version('8.2.12'); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var DefaultIterableDifferFactory = /*#__PURE__*/function () { function DefaultIterableDifferFactory() { _classCallCheck(this, DefaultIterableDifferFactory); } /** * @param {?} obj * @return {?} */ _createClass2(DefaultIterableDifferFactory, [{ key: "supports", value: function supports(obj) { return isListLikeIterable$1(obj); } /** * @template V * @param {?=} trackByFn * @return {?} */ }, { key: "create", value: function create(trackByFn) { return new DefaultIterableDiffer(trackByFn); } }]); return DefaultIterableDifferFactory; }(); /** @type {?} */ var trackByIdentity = /** * @param {?} index * @param {?} item * @return {?} */ function trackByIdentity(index, item) { return item; }; var ɵ0$d = trackByIdentity; /** * @deprecated v4.0.0 - Should not be part of public API. * \@publicApi * @template V */ var DefaultIterableDiffer = /*#__PURE__*/function () { /** * @param {?=} trackByFn */ function DefaultIterableDiffer(trackByFn) { _classCallCheck(this, DefaultIterableDiffer); this.length = 0; // Keeps track of the used records at any point in time (during & across `_check()` calls) this._linkedRecords = null; // Keeps track of the removed records at any point in time during `_check()` calls. this._unlinkedRecords = null; this._previousItHead = null; this._itHead = null; this._itTail = null; this._additionsHead = null; this._additionsTail = null; this._movesHead = null; this._movesTail = null; this._removalsHead = null; this._removalsTail = null; // Keeps track of records where custom track by is the same, but item identity has changed this._identityChangesHead = null; this._identityChangesTail = null; this._trackByFn = trackByFn || trackByIdentity; } /** * @param {?} fn * @return {?} */ _createClass2(DefaultIterableDiffer, [{ key: "forEachItem", value: function forEachItem(fn) { /** @type {?} */ var record; for (record = this._itHead; record !== null; record = record._next) { fn(record); } } /** * @param {?} fn * @return {?} */ }, { key: "forEachOperation", value: function forEachOperation(fn) { /** @type {?} */ var nextIt = this._itHead; /** @type {?} */ var nextRemove = this._removalsHead; /** @type {?} */ var addRemoveOffset = 0; /** @type {?} */ var moveOffsets = null; while (nextIt || nextRemove) { // Figure out which is the next record to process // Order: remove, add, move /** @type {?} */ var record = !nextRemove || nextIt && /** @type {?} */ nextIt.currentIndex < getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ? /** @type {?} */ nextIt : nextRemove; /** @type {?} */ var adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets); /** @type {?} */ var currentIndex = record.currentIndex; // consume the item, and adjust the addRemoveOffset and update moveDistance if necessary if (record === nextRemove) { addRemoveOffset--; nextRemove = nextRemove._nextRemoved; } else { nextIt = /** @type {?} */ nextIt._next; if (record.previousIndex == null) { addRemoveOffset++; } else { // INVARIANT: currentIndex < previousIndex if (!moveOffsets) moveOffsets = []; /** @type {?} */ var localMovePreviousIndex = adjPreviousIndex - addRemoveOffset; /** @type {?} */ var localCurrentIndex = /** @type {?} */ currentIndex - addRemoveOffset; if (localMovePreviousIndex != localCurrentIndex) { for (var i = 0; i < localMovePreviousIndex; i++) { /** @type {?} */ var offset = i < moveOffsets.length ? moveOffsets[i] : moveOffsets[i] = 0; /** @type {?} */ var index = offset + i; if (localCurrentIndex <= index && index < localMovePreviousIndex) { moveOffsets[i] = offset + 1; } } /** @type {?} */ var previousIndex = record.previousIndex; moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex; } } } if (adjPreviousIndex !== currentIndex) { fn(record, adjPreviousIndex, currentIndex); } } } /** * @param {?} fn * @return {?} */ }, { key: "forEachPreviousItem", value: function forEachPreviousItem(fn) { /** @type {?} */ var record; for (record = this._previousItHead; record !== null; record = record._nextPrevious) { fn(record); } } /** * @param {?} fn * @return {?} */ }, { key: "forEachAddedItem", value: function forEachAddedItem(fn) { /** @type {?} */ var record; for (record = this._additionsHead; record !== null; record = record._nextAdded) { fn(record); } } /** * @param {?} fn * @return {?} */ }, { key: "forEachMovedItem", value: function forEachMovedItem(fn) { /** @type {?} */ var record; for (record = this._movesHead; record !== null; record = record._nextMoved) { fn(record); } } /** * @param {?} fn * @return {?} */ }, { key: "forEachRemovedItem", value: function forEachRemovedItem(fn) { /** @type {?} */ var record; for (record = this._removalsHead; record !== null; record = record._nextRemoved) { fn(record); } } /** * @param {?} fn * @return {?} */ }, { key: "forEachIdentityChange", value: function forEachIdentityChange(fn) { /** @type {?} */ var record; for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) { fn(record); } } /** * @param {?} collection * @return {?} */ }, { key: "diff", value: function diff(collection) { if (collection == null) collection = []; if (!isListLikeIterable$1(collection)) { throw new Error("Error trying to diff '".concat(stringify(collection), "'. Only arrays and iterables are allowed")); } if (this.check(collection)) { return this; } else { return null; } } /** * @return {?} */ }, { key: "onDestroy", value: function onDestroy() {} /** * @param {?} collection * @return {?} */ }, { key: "check", value: function check(collection) { var _this329 = this; this._reset(); /** @type {?} */ var record = this._itHead; /** @type {?} */ var mayBeDirty = false; /** @type {?} */ var index; /** @type {?} */ var item; /** @type {?} */ var itemTrackBy; if (Array.isArray(collection)) { /** @type {?} */ this.length = collection.length; for (var _index = 0; _index < this.length; _index++) { item = collection[_index]; itemTrackBy = this._trackByFn(_index, item); if (record === null || !looseIdentical(record.trackById, itemTrackBy)) { record = this._mismatch(record, item, itemTrackBy, _index); mayBeDirty = true; } else { if (mayBeDirty) { // TODO(misko): can we limit this to duplicates only? record = this._verifyReinsertion(record, item, itemTrackBy, _index); } if (!looseIdentical(record.item, item)) this._addIdentityChange(record, item); } record = record._next; } } else { index = 0; iterateListLike$1(collection, /** * @param {?} item * @return {?} */ function (item) { itemTrackBy = _this329._trackByFn(index, item); if (record === null || !looseIdentical(record.trackById, itemTrackBy)) { record = _this329._mismatch(record, item, itemTrackBy, index); mayBeDirty = true; } else { if (mayBeDirty) { // TODO(misko): can we limit this to duplicates only? record = _this329._verifyReinsertion(record, item, itemTrackBy, index); } if (!looseIdentical(record.item, item)) _this329._addIdentityChange(record, item); } record = record._next; index++; }); /** @type {?} */ this.length = index; } this._truncate(record); /** @type {?} */ this.collection = collection; return this.isDirty; } /* CollectionChanges is considered dirty if it has any additions, moves, removals, or identity * changes. */ /** * @return {?} */ }, { key: "_reset", /** * Reset the state of the change objects to show no changes. This means set previousKey to * currentKey, and clear all of the queues (additions, moves, removals). * Set the previousIndexes of moved and added items to their currentIndexes * Reset the list of additions, moves and removals * * \@internal * @return {?} */ value: function _reset() { if (this.isDirty) { /** @type {?} */ var record; /** @type {?} */ var nextRecord; for (record = this._previousItHead = this._itHead; record !== null; record = record._next) { record._nextPrevious = record._next; } for (record = this._additionsHead; record !== null; record = record._nextAdded) { record.previousIndex = record.currentIndex; } this._additionsHead = this._additionsTail = null; for (record = this._movesHead; record !== null; record = nextRecord) { record.previousIndex = record.currentIndex; nextRecord = record._nextMoved; } this._movesHead = this._movesTail = null; this._removalsHead = this._removalsTail = null; this._identityChangesHead = this._identityChangesTail = null; // TODO(vicb): when assert gets supported // assert(!this.isDirty); } } /** * This is the core function which handles differences between collections. * * - `record` is the record which we saw at this position last time. If null then it is a new * item. * - `item` is the current item in the collection * - `index` is the position of the item in the collection * * \@internal * @param {?} record * @param {?} item * @param {?} itemTrackBy * @param {?} index * @return {?} */ }, { key: "_mismatch", value: function _mismatch(record, item, itemTrackBy, index) { // The previous record after which we will append the current one. /** @type {?} */ var previousRecord; if (record === null) { previousRecord = this._itTail; } else { previousRecord = record._prev; // Remove the record from the collection since we know it does not match the item. this._remove(record); } // Attempt to see if we have seen the item before. record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index); if (record !== null) { // We have seen this before, we need to move it forward in the collection. // But first we need to check if identity changed, so we can update in view if necessary if (!looseIdentical(record.item, item)) this._addIdentityChange(record, item); this._moveAfter(record, previousRecord, index); } else { // Never seen it, check evicted list. record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null); if (record !== null) { // It is an item which we have evicted earlier: reinsert it back into the list. // But first we need to check if identity changed, so we can update in view if necessary if (!looseIdentical(record.item, item)) this._addIdentityChange(record, item); this._reinsertAfter(record, previousRecord, index); } else { // It is a new item: add it. record = this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index); } } return record; } /** * This check is only needed if an array contains duplicates. (Short circuit of nothing dirty) * * Use case: `[a, a]` => `[b, a, a]` * * If we did not have this check then the insertion of `b` would: * 1) evict first `a` * 2) insert `b` at `0` index. * 3) leave `a` at index `1` as is. <-- this is wrong! * 3) reinsert `a` at index 2. <-- this is wrong! * * The correct behavior is: * 1) evict first `a` * 2) insert `b` at `0` index. * 3) reinsert `a` at index 1. * 3) move `a` at from `1` to `2`. * * * Double check that we have not evicted a duplicate item. We need to check if the item type may * have already been removed: * The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted * at the end. Which will show up as the two 'a's switching position. This is incorrect, since a * better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a' * at the end. * * \@internal * @param {?} record * @param {?} item * @param {?} itemTrackBy * @param {?} index * @return {?} */ }, { key: "_verifyReinsertion", value: function _verifyReinsertion(record, item, itemTrackBy, index) { /** @type {?} */ var reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null); if (reinsertRecord !== null) { record = this._reinsertAfter(reinsertRecord, /** @type {?} */ record._prev, index); } else if (record.currentIndex != index) { record.currentIndex = index; this._addToMoves(record, index); } return record; } /** * Get rid of any excess {\@link IterableChangeRecord_}s from the previous collection * * - `record` The first excess {\@link IterableChangeRecord_}. * * \@internal * @param {?} record * @return {?} */ }, { key: "_truncate", value: function _truncate(record) { // Anything after that needs to be removed; while (record !== null) { /** @type {?} */ var nextRecord = record._next; this._addToRemovals(this._unlink(record)); record = nextRecord; } if (this._unlinkedRecords !== null) { this._unlinkedRecords.clear(); } if (this._additionsTail !== null) { this._additionsTail._nextAdded = null; } if (this._movesTail !== null) { this._movesTail._nextMoved = null; } if (this._itTail !== null) { this._itTail._next = null; } if (this._removalsTail !== null) { this._removalsTail._nextRemoved = null; } if (this._identityChangesTail !== null) { this._identityChangesTail._nextIdentityChange = null; } } /** * \@internal * @param {?} record * @param {?} prevRecord * @param {?} index * @return {?} */ }, { key: "_reinsertAfter", value: function _reinsertAfter(record, prevRecord, index) { if (this._unlinkedRecords !== null) { this._unlinkedRecords.remove(record); } /** @type {?} */ var prev = record._prevRemoved; /** @type {?} */ var next = record._nextRemoved; if (prev === null) { this._removalsHead = next; } else { prev._nextRemoved = next; } if (next === null) { this._removalsTail = prev; } else { next._prevRemoved = prev; } this._insertAfter(record, prevRecord, index); this._addToMoves(record, index); return record; } /** * \@internal * @param {?} record * @param {?} prevRecord * @param {?} index * @return {?} */ }, { key: "_moveAfter", value: function _moveAfter(record, prevRecord, index) { this._unlink(record); this._insertAfter(record, prevRecord, index); this._addToMoves(record, index); return record; } /** * \@internal * @param {?} record * @param {?} prevRecord * @param {?} index * @return {?} */ }, { key: "_addAfter", value: function _addAfter(record, prevRecord, index) { this._insertAfter(record, prevRecord, index); if (this._additionsTail === null) { // TODO(vicb): // assert(this._additionsHead === null); this._additionsTail = this._additionsHead = record; } else { // TODO(vicb): // assert(_additionsTail._nextAdded === null); // assert(record._nextAdded === null); this._additionsTail = this._additionsTail._nextAdded = record; } return record; } /** * \@internal * @param {?} record * @param {?} prevRecord * @param {?} index * @return {?} */ }, { key: "_insertAfter", value: function _insertAfter(record, prevRecord, index) { // TODO(vicb): // assert(record != prevRecord); // assert(record._next === null); // assert(record._prev === null); // TODO(vicb): // assert(record != prevRecord); // assert(record._next === null); // assert(record._prev === null); /** @type {?} */ var next = prevRecord === null ? this._itHead : prevRecord._next; // TODO(vicb): // assert(next != record); // assert(prevRecord != record); record._next = next; record._prev = prevRecord; if (next === null) { this._itTail = record; } else { next._prev = record; } if (prevRecord === null) { this._itHead = record; } else { prevRecord._next = record; } if (this._linkedRecords === null) { this._linkedRecords = new _DuplicateMap(); } this._linkedRecords.put(record); record.currentIndex = index; return record; } /** * \@internal * @param {?} record * @return {?} */ }, { key: "_remove", value: function _remove(record) { return this._addToRemovals(this._unlink(record)); } /** * \@internal * @param {?} record * @return {?} */ }, { key: "_unlink", value: function _unlink(record) { if (this._linkedRecords !== null) { this._linkedRecords.remove(record); } /** @type {?} */ var prev = record._prev; /** @type {?} */ var next = record._next; // TODO(vicb): // assert((record._prev = null) === null); // assert((record._next = null) === null); if (prev === null) { this._itHead = next; } else { prev._next = next; } if (next === null) { this._itTail = prev; } else { next._prev = prev; } return record; } /** * \@internal * @param {?} record * @param {?} toIndex * @return {?} */ }, { key: "_addToMoves", value: function _addToMoves(record, toIndex) { // TODO(vicb): // assert(record._nextMoved === null); if (record.previousIndex === toIndex) { return record; } if (this._movesTail === null) { // TODO(vicb): // assert(_movesHead === null); this._movesTail = this._movesHead = record; } else { // TODO(vicb): // assert(_movesTail._nextMoved === null); this._movesTail = this._movesTail._nextMoved = record; } return record; } /** * @private * @param {?} record * @return {?} */ }, { key: "_addToRemovals", value: function _addToRemovals(record) { if (this._unlinkedRecords === null) { this._unlinkedRecords = new _DuplicateMap(); } this._unlinkedRecords.put(record); record.currentIndex = null; record._nextRemoved = null; if (this._removalsTail === null) { // TODO(vicb): // assert(_removalsHead === null); this._removalsTail = this._removalsHead = record; record._prevRemoved = null; } else { // TODO(vicb): // assert(_removalsTail._nextRemoved === null); // assert(record._nextRemoved === null); record._prevRemoved = this._removalsTail; this._removalsTail = this._removalsTail._nextRemoved = record; } return record; } /** * \@internal * @param {?} record * @param {?} item * @return {?} */ }, { key: "_addIdentityChange", value: function _addIdentityChange(record, item) { record.item = item; if (this._identityChangesTail === null) { this._identityChangesTail = this._identityChangesHead = record; } else { this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record; } return record; } }, { key: "isDirty", get: function get() { return this._additionsHead !== null || this._movesHead !== null || this._removalsHead !== null || this._identityChangesHead !== null; } }]); return DefaultIterableDiffer; }(); if (false) {} /** * @template V */ var IterableChangeRecord_ = /** * @param {?} item * @param {?} trackById */ function IterableChangeRecord_(item, trackById) { _classCallCheck(this, IterableChangeRecord_); this.item = item; this.trackById = trackById; this.currentIndex = null; this.previousIndex = null; /** * \@internal */ this._nextPrevious = null; /** * \@internal */ this._prev = null; /** * \@internal */ this._next = null; /** * \@internal */ this._prevDup = null; /** * \@internal */ this._nextDup = null; /** * \@internal */ this._prevRemoved = null; /** * \@internal */ this._nextRemoved = null; /** * \@internal */ this._nextAdded = null; /** * \@internal */ this._nextMoved = null; /** * \@internal */ this._nextIdentityChange = null; }; if (false) {} // A linked list of CollectionChangeRecords with the same IterableChangeRecord_.item /** * @template V */ var _DuplicateItemRecordList = /*#__PURE__*/function () { function _DuplicateItemRecordList() { _classCallCheck(this, _DuplicateItemRecordList); /** * \@internal */ this._head = null; /** * \@internal */ this._tail = null; } /** * Append the record to the list of duplicates. * * Note: by design all records in the list of duplicates hold the same value in record.item. * @param {?} record * @return {?} */ _createClass2(_DuplicateItemRecordList, [{ key: "add", value: function add(record) { if (this._head === null) { this._head = this._tail = record; record._nextDup = null; record._prevDup = null; } else { // TODO(vicb): // assert(record.item == _head.item || // record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN); /** @type {?} */ this._tail._nextDup = record; record._prevDup = this._tail; record._nextDup = null; this._tail = record; } } // Returns a IterableChangeRecord_ having IterableChangeRecord_.trackById == trackById and // IterableChangeRecord_.currentIndex >= atOrAfterIndex /** * @param {?} trackById * @param {?} atOrAfterIndex * @return {?} */ }, { key: "get", value: function get(trackById, atOrAfterIndex) { /** @type {?} */ var record; for (record = this._head; record !== null; record = record._nextDup) { if ((atOrAfterIndex === null || atOrAfterIndex <= /** @type {?} */ record.currentIndex) && looseIdentical(record.trackById, trackById)) { return record; } } return null; } /** * Remove one {\@link IterableChangeRecord_} from the list of duplicates. * * Returns whether the list of duplicates is empty. * @param {?} record * @return {?} */ }, { key: "remove", value: function remove(record) { // TODO(vicb): // assert(() { // // verify that the record being removed is in the list. // for (IterableChangeRecord_ cursor = _head; cursor != null; cursor = cursor._nextDup) { // if (identical(cursor, record)) return true; // } // return false; //}); // TODO(vicb): // assert(() { // // verify that the record being removed is in the list. // for (IterableChangeRecord_ cursor = _head; cursor != null; cursor = cursor._nextDup) { // if (identical(cursor, record)) return true; // } // return false; //}); /** @type {?} */ var prev = record._prevDup; /** @type {?} */ var next = record._nextDup; if (prev === null) { this._head = next; } else { prev._nextDup = next; } if (next === null) { this._tail = prev; } else { next._prevDup = prev; } return this._head === null; } }]); return _DuplicateItemRecordList; }(); if (false) {} /** * @template V */ var _DuplicateMap = /*#__PURE__*/function () { function _DuplicateMap() { _classCallCheck(this, _DuplicateMap); this.map = new Map(); } /** * @param {?} record * @return {?} */ _createClass2(_DuplicateMap, [{ key: "put", value: function put(record) { /** @type {?} */ var key = record.trackById; /** @type {?} */ var duplicates = this.map.get(key); if (!duplicates) { duplicates = new _DuplicateItemRecordList(); this.map.set(key, duplicates); } duplicates.add(record); } /** * Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we * have already iterated over, we use the `atOrAfterIndex` to pretend it is not there. * * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we * have any more `a`s needs to return the second `a`. * @param {?} trackById * @param {?} atOrAfterIndex * @return {?} */ }, { key: "get", value: function get(trackById, atOrAfterIndex) { /** @type {?} */ var key = trackById; /** @type {?} */ var recordList = this.map.get(key); return recordList ? recordList.get(trackById, atOrAfterIndex) : null; } /** * Removes a {\@link IterableChangeRecord_} from the list of duplicates. * * The list of duplicates also is removed from the map if it gets empty. * @param {?} record * @return {?} */ }, { key: "remove", value: function remove(record) { /** @type {?} */ var key = record.trackById; /** @type {?} */ var recordList = /** @type {?} */ this.map.get(key); // Remove the list of duplicates when it gets empty if (recordList.remove(record)) { this.map["delete"](key); } return record; } /** * @return {?} */ }, { key: "clear", /** * @return {?} */ value: function clear() { this.map.clear(); } }, { key: "isEmpty", get: function get() { return this.map.size === 0; } }]); return _DuplicateMap; }(); if (false) {} /** * @param {?} item * @param {?} addRemoveOffset * @param {?} moveOffsets * @return {?} */ function getPreviousIndex(item, addRemoveOffset, moveOffsets) { /** @type {?} */ var previousIndex = item.previousIndex; if (previousIndex === null) return previousIndex; /** @type {?} */ var moveOffset = 0; if (moveOffsets && previousIndex < moveOffsets.length) { moveOffset = moveOffsets[previousIndex]; } return previousIndex + addRemoveOffset + moveOffset; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @template K, V */ var DefaultKeyValueDifferFactory = /*#__PURE__*/function () { function DefaultKeyValueDifferFactory() { _classCallCheck(this, DefaultKeyValueDifferFactory); } /** * @param {?} obj * @return {?} */ _createClass2(DefaultKeyValueDifferFactory, [{ key: "supports", value: function supports(obj) { return obj instanceof Map || isJsObject$1(obj); } /** * @template K, V * @return {?} */ }, { key: "create", value: function create() { return new DefaultKeyValueDiffer(); } }]); return DefaultKeyValueDifferFactory; }(); /** * @template K, V */ var DefaultKeyValueDiffer = /*#__PURE__*/function () { function DefaultKeyValueDiffer() { _classCallCheck(this, DefaultKeyValueDiffer); this._records = new Map(); this._mapHead = null; // _appendAfter is used in the check loop this._appendAfter = null; this._previousMapHead = null; this._changesHead = null; this._changesTail = null; this._additionsHead = null; this._additionsTail = null; this._removalsHead = null; this._removalsTail = null; } /** * @return {?} */ _createClass2(DefaultKeyValueDiffer, [{ key: "forEachItem", /** * @param {?} fn * @return {?} */ value: function forEachItem(fn) { /** @type {?} */ var record; for (record = this._mapHead; record !== null; record = record._next) { fn(record); } } /** * @param {?} fn * @return {?} */ }, { key: "forEachPreviousItem", value: function forEachPreviousItem(fn) { /** @type {?} */ var record; for (record = this._previousMapHead; record !== null; record = record._nextPrevious) { fn(record); } } /** * @param {?} fn * @return {?} */ }, { key: "forEachChangedItem", value: function forEachChangedItem(fn) { /** @type {?} */ var record; for (record = this._changesHead; record !== null; record = record._nextChanged) { fn(record); } } /** * @param {?} fn * @return {?} */ }, { key: "forEachAddedItem", value: function forEachAddedItem(fn) { /** @type {?} */ var record; for (record = this._additionsHead; record !== null; record = record._nextAdded) { fn(record); } } /** * @param {?} fn * @return {?} */ }, { key: "forEachRemovedItem", value: function forEachRemovedItem(fn) { /** @type {?} */ var record; for (record = this._removalsHead; record !== null; record = record._nextRemoved) { fn(record); } } /** * @param {?=} map * @return {?} */ }, { key: "diff", value: function diff(map) { if (!map) { map = new Map(); } else if (!(map instanceof Map || isJsObject$1(map))) { throw new Error("Error trying to diff '".concat(stringify(map), "'. Only maps and objects are allowed")); } return this.check(map) ? this : null; } /** * @return {?} */ }, { key: "onDestroy", value: function onDestroy() {} /** * Check the current state of the map vs the previous. * The algorithm is optimised for when the keys do no change. * @param {?} map * @return {?} */ }, { key: "check", value: function check(map) { var _this330 = this; this._reset(); /** @type {?} */ var insertBefore = this._mapHead; this._appendAfter = null; this._forEach(map, /** * @param {?} value * @param {?} key * @return {?} */ function (value, key) { if (insertBefore && insertBefore.key === key) { _this330._maybeAddToChanges(insertBefore, value); _this330._appendAfter = insertBefore; insertBefore = insertBefore._next; } else { /** @type {?} */ var record = _this330._getOrCreateRecordForKey(key, value); insertBefore = _this330._insertBeforeOrAppend(insertBefore, record); } }); // Items remaining at the end of the list have been deleted if (insertBefore) { if (insertBefore._prev) { insertBefore._prev._next = null; } this._removalsHead = insertBefore; for (var record = insertBefore; record !== null; record = record._nextRemoved) { if (record === this._mapHead) { this._mapHead = null; } this._records["delete"](record.key); record._nextRemoved = record._next; record.previousValue = record.currentValue; record.currentValue = null; record._prev = null; record._next = null; } } // Make sure tails have no next records from previous runs if (this._changesTail) this._changesTail._nextChanged = null; if (this._additionsTail) this._additionsTail._nextAdded = null; return this.isDirty; } /** * Inserts a record before `before` or append at the end of the list when `before` is null. * * Notes: * - This method appends at `this._appendAfter`, * - This method updates `this._appendAfter`, * - The return value is the new value for the insertion pointer. * @private * @param {?} before * @param {?} record * @return {?} */ }, { key: "_insertBeforeOrAppend", value: function _insertBeforeOrAppend(before, record) { if (before) { /** @type {?} */ var prev = before._prev; record._next = before; record._prev = prev; before._prev = record; if (prev) { prev._next = record; } if (before === this._mapHead) { this._mapHead = record; } this._appendAfter = before; return before; } if (this._appendAfter) { this._appendAfter._next = record; record._prev = this._appendAfter; } else { this._mapHead = record; } this._appendAfter = record; return null; } /** * @private * @param {?} key * @param {?} value * @return {?} */ }, { key: "_getOrCreateRecordForKey", value: function _getOrCreateRecordForKey(key, value) { if (this._records.has(key)) { /** @type {?} */ var _record = /** @type {?} */ this._records.get(key); this._maybeAddToChanges(_record, value); /** @type {?} */ var prev = _record._prev; /** @type {?} */ var next = _record._next; if (prev) { prev._next = next; } if (next) { next._prev = prev; } _record._next = null; _record._prev = null; return _record; } /** @type {?} */ var record = new KeyValueChangeRecord_(key); this._records.set(key, record); record.currentValue = value; this._addToAdditions(record); return record; } /** * \@internal * @return {?} */ }, { key: "_reset", value: function _reset() { if (this.isDirty) { /** @type {?} */ var record; // let `_previousMapHead` contain the state of the map before the changes this._previousMapHead = this._mapHead; for (record = this._previousMapHead; record !== null; record = record._next) { record._nextPrevious = record._next; } // Update `record.previousValue` with the value of the item before the changes // We need to update all changed items (that's those which have been added and changed) for (record = this._changesHead; record !== null; record = record._nextChanged) { record.previousValue = record.currentValue; } for (record = this._additionsHead; record != null; record = record._nextAdded) { record.previousValue = record.currentValue; } this._changesHead = this._changesTail = null; this._additionsHead = this._additionsTail = null; this._removalsHead = null; } } // Add the record or a given key to the list of changes only when the value has actually changed /** * @private * @param {?} record * @param {?} newValue * @return {?} */ }, { key: "_maybeAddToChanges", value: function _maybeAddToChanges(record, newValue) { if (!looseIdentical(newValue, record.currentValue)) { record.previousValue = record.currentValue; record.currentValue = newValue; this._addToChanges(record); } } /** * @private * @param {?} record * @return {?} */ }, { key: "_addToAdditions", value: function _addToAdditions(record) { if (this._additionsHead === null) { this._additionsHead = this._additionsTail = record; } else { /** @type {?} */ this._additionsTail._nextAdded = record; this._additionsTail = record; } } /** * @private * @param {?} record * @return {?} */ }, { key: "_addToChanges", value: function _addToChanges(record) { if (this._changesHead === null) { this._changesHead = this._changesTail = record; } else { /** @type {?} */ this._changesTail._nextChanged = record; this._changesTail = record; } } /** * \@internal * @private * @template K, V * @param {?} obj * @param {?} fn * @return {?} */ }, { key: "_forEach", value: function _forEach(obj, fn) { if (obj instanceof Map) { obj.forEach(fn); } else { Object.keys(obj).forEach( /** * @param {?} k * @return {?} */ function (k) { return fn(obj[k], k); }); } } }, { key: "isDirty", get: function get() { return this._additionsHead !== null || this._changesHead !== null || this._removalsHead !== null; } }]); return DefaultKeyValueDiffer; }(); if (false) {} /** * @template K, V */ var KeyValueChangeRecord_ = /** * @param {?} key */ function KeyValueChangeRecord_(key) { _classCallCheck(this, KeyValueChangeRecord_); this.key = key; this.previousValue = null; this.currentValue = null; /** * \@internal */ this._nextPrevious = null; /** * \@internal */ this._next = null; /** * \@internal */ this._prev = null; /** * \@internal */ this._nextAdded = null; /** * \@internal */ this._nextRemoved = null; /** * \@internal */ this._nextChanged = null; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A strategy for tracking changes over time to an iterable. Used by {\@link NgForOf} to * respond to changes in an iterable by effecting equivalent changes in the DOM. * * \@publicApi * @record * @template V */ function IterableDiffer() {} if (false) {} /** * An object describing the changes in the `Iterable` collection since last time * `IterableDiffer#diff()` was invoked. * * \@publicApi * @record * @template V */ function IterableChanges() {} if (false) {} /** * Record representing the item change information. * * \@publicApi * @record * @template V */ function IterableChangeRecord() {} if (false) {} /** * @deprecated v4.0.0 - Use IterableChangeRecord instead. * \@publicApi * @record * @template V */ function CollectionChangeRecord() {} /** * An optional function passed into the `NgForOf` directive that defines how to track * changes for items in an iterable. * The function takes the iteration index and item ID. * When supplied, Angular tracks changes by the return value of the function. * * \@publicApi * @record * @template T */ function TrackByFunction() {} /** * Provides a factory for {\@link IterableDiffer}. * * \@publicApi * @record */ function IterableDifferFactory() {} if (false) {} /** * A repository of different iterable diffing strategies used by NgFor, NgClass, and others. * * \@publicApi */ var IterableDiffers = /*#__PURE__*/function () { /** * @param {?} factories */ function IterableDiffers(factories) { _classCallCheck(this, IterableDiffers); this.factories = factories; } /** * @param {?} factories * @param {?=} parent * @return {?} */ _createClass2(IterableDiffers, [{ key: "find", /** * @param {?} iterable * @return {?} */ value: function find(iterable) { /** @type {?} */ var factory = this.factories.find( /** * @param {?} f * @return {?} */ function (f) { return f.supports(iterable); }); if (factory != null) { return factory; } else { throw new Error("Cannot find a differ supporting object '".concat(iterable, "' of type '").concat(getTypeNameForDebugging(iterable), "'")); } } }], [{ key: "create", value: function create(factories, parent) { if (parent != null) { /** @type {?} */ var copied = parent.factories.slice(); factories = factories.concat(copied); } return new IterableDiffers(factories); } /** * Takes an array of {\@link IterableDifferFactory} and returns a provider used to extend the * inherited {\@link IterableDiffers} instance with the provided factories and return a new * {\@link IterableDiffers} instance. * * \@usageNotes * ### Example * * The following example shows how to extend an existing list of factories, * which will only be applied to the injector for this component and its children. * This step is all that's required to make a new {\@link IterableDiffer} available. * * ``` * \@Component({ * viewProviders: [ * IterableDiffers.extend([new ImmutableListDiffer()]) * ] * }) * ``` * @param {?} factories * @return {?} */ }, { key: "extend", value: function extend(factories) { return { provide: IterableDiffers, useFactory: /** * @param {?} parent * @return {?} */ function useFactory(parent) { if (!parent) { // Typically would occur when calling IterableDiffers.extend inside of dependencies passed // to // bootstrap(), which would override default pipes instead of extending them. throw new Error('Cannot extend IterableDiffers without a parent injector'); } return IterableDiffers.create(factories, parent); }, // Dependency technically isn't optional, but we can provide a better error message this way. deps: [[IterableDiffers, new SkipSelf(), new Optional()]] }; } }]); return IterableDiffers; }(); /** @nocollapse */ /** @nocollapse */ IterableDiffers.ngInjectableDef = ɵɵdefineInjectable({ token: IterableDiffers, providedIn: 'root', factory: /** * @nocollapse @return {?} */ function factory() { return new IterableDiffers([new DefaultIterableDifferFactory()]); } }); if (false) {} /** * @param {?} type * @return {?} */ function getTypeNameForDebugging(type) { return type['name'] || typeof type; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A differ that tracks changes made to an object over time. * * \@publicApi * @record * @template K, V */ function KeyValueDiffer() {} if (false) {} /** * An object describing the changes in the `Map` or `{[k:string]: string}` since last time * `KeyValueDiffer#diff()` was invoked. * * \@publicApi * @record * @template K, V */ function KeyValueChanges() {} if (false) {} /** * Record representing the item change information. * * \@publicApi * @record * @template K, V */ function KeyValueChangeRecord() {} if (false) {} /** * Provides a factory for {\@link KeyValueDiffer}. * * \@publicApi * @record */ function KeyValueDifferFactory() {} if (false) {} /** * A repository of different Map diffing strategies used by NgClass, NgStyle, and others. * * \@publicApi */ var KeyValueDiffers = /*#__PURE__*/function () { /** * @param {?} factories */ function KeyValueDiffers(factories) { _classCallCheck(this, KeyValueDiffers); this.factories = factories; } /** * @template S * @param {?} factories * @param {?=} parent * @return {?} */ _createClass2(KeyValueDiffers, [{ key: "find", /** * @param {?} kv * @return {?} */ value: function find(kv) { /** @type {?} */ var factory = this.factories.find( /** * @param {?} f * @return {?} */ function (f) { return f.supports(kv); }); if (factory) { return factory; } throw new Error("Cannot find a differ supporting object '".concat(kv, "'")); } }], [{ key: "create", value: function create(factories, parent) { if (parent) { /** @type {?} */ var copied = parent.factories.slice(); factories = factories.concat(copied); } return new KeyValueDiffers(factories); } /** * Takes an array of {\@link KeyValueDifferFactory} and returns a provider used to extend the * inherited {\@link KeyValueDiffers} instance with the provided factories and return a new * {\@link KeyValueDiffers} instance. * * \@usageNotes * ### Example * * The following example shows how to extend an existing list of factories, * which will only be applied to the injector for this component and its children. * This step is all that's required to make a new {\@link KeyValueDiffer} available. * * ``` * \@Component({ * viewProviders: [ * KeyValueDiffers.extend([new ImmutableMapDiffer()]) * ] * }) * ``` * @template S * @param {?} factories * @return {?} */ }, { key: "extend", value: function extend(factories) { return { provide: KeyValueDiffers, useFactory: /** * @param {?} parent * @return {?} */ function useFactory(parent) { if (!parent) { // Typically would occur when calling KeyValueDiffers.extend inside of dependencies passed // to bootstrap(), which would override default pipes instead of extending them. throw new Error('Cannot extend KeyValueDiffers without a parent injector'); } return KeyValueDiffers.create(factories, parent); }, // Dependency technically isn't optional, but we can provide a better error message this way. deps: [[KeyValueDiffers, new SkipSelf(), new Optional()]] }; } }]); return KeyValueDiffers; }(); /** @nocollapse */ /** @nocollapse */ KeyValueDiffers.ngInjectableDef = ɵɵdefineInjectable({ token: KeyValueDiffers, providedIn: 'root', factory: /** * @nocollapse @return {?} */ function factory() { return new KeyValueDiffers([new DefaultKeyValueDifferFactory()]); } }); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Structural diffing for `Object`s and `Map`s. * @type {?} */ var keyValDiff = [new DefaultKeyValueDifferFactory()]; /** * Structural diffing for `Iterable` types such as `Array`s. * @type {?} */ var iterableDiff = [new DefaultIterableDifferFactory()]; /** @type {?} */ var defaultIterableDiffers = new IterableDiffers(iterableDiff); /** @type {?} */ var defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Represents an embedded template that can be used to instantiate embedded views. * To instantiate embedded views based on a template, use the `ViewContainerRef` * method `createEmbeddedView()`. * * Access a `TemplateRef` instance by placing a directive on an `<ng-template>` * element (or directive prefixed with `*`). The `TemplateRef` for the embedded view * is injected into the constructor of the directive, * using the `TemplateRef` token. * * You can also use a `Query` to find a `TemplateRef` associated with * a component or a directive. * * @see `ViewContainerRef` * @see [Navigate the Component Tree with DI](guide/dependency-injection-navtree) * * \@publicApi * @abstract * @template C */ var TemplateRef = function TemplateRef() { _classCallCheck(this, TemplateRef); }; /** * \@internal * @nocollapse */ TemplateRef.__NG_ELEMENT_ID__ = /** * @return {?} */ function () { return SWITCH_TEMPLATE_REF_FACTORY(TemplateRef, ElementRef); }; if (false) {} /** @type {?} */ var SWITCH_TEMPLATE_REF_FACTORY__POST_R3__ = injectTemplateRef; /** @type {?} */ var SWITCH_TEMPLATE_REF_FACTORY__PRE_R3__ = noop; /** @type {?} */ var SWITCH_TEMPLATE_REF_FACTORY = SWITCH_TEMPLATE_REF_FACTORY__PRE_R3__; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Represents a container where one or more views can be attached to a component. * * Can contain *host views* (created by instantiating a * component with the `createComponent()` method), and *embedded views* * (created by instantiating a `TemplateRef` with the `createEmbeddedView()` method). * * A view container instance can contain other view containers, * creating a [view hierarchy](guide/glossary#view-tree). * * @see `ComponentRef` * @see `EmbeddedViewRef` * * \@publicApi * @abstract */ var ViewContainerRef = function ViewContainerRef() { _classCallCheck(this, ViewContainerRef); }; /** * \@internal * @nocollapse */ ViewContainerRef.__NG_ELEMENT_ID__ = /** * @return {?} */ function () { return SWITCH_VIEW_CONTAINER_REF_FACTORY(ViewContainerRef, ElementRef); }; if (false) {} /** @type {?} */ var SWITCH_VIEW_CONTAINER_REF_FACTORY__POST_R3__ = injectViewContainerRef; /** @type {?} */ var SWITCH_VIEW_CONTAINER_REF_FACTORY__PRE_R3__ = noop; /** @type {?} */ var SWITCH_VIEW_CONTAINER_REF_FACTORY = SWITCH_VIEW_CONTAINER_REF_FACTORY__PRE_R3__; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} context * @param {?} oldValue * @param {?} currValue * @param {?} isFirstCheck * @return {?} */ function expressionChangedAfterItHasBeenCheckedError(context, oldValue, currValue, isFirstCheck) { /** @type {?} */ var msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '".concat(oldValue, "'. Current value: '").concat(currValue, "'."); if (isFirstCheck) { msg += " It seems like the view has been created after its parent and its children have been dirty checked." + " Has it been created in a change detection hook ?"; } return viewDebugError(msg, context); } /** * @param {?} err * @param {?} context * @return {?} */ function viewWrappedDebugError(err, context) { if (!(err instanceof Error)) { // errors that are not Error instances don't have a stack, // so it is ok to wrap them into a new Error object... err = new Error(err.toString()); } _addDebugContext(err, context); return err; } /** * @param {?} msg * @param {?} context * @return {?} */ function viewDebugError(msg, context) { /** @type {?} */ var err = new Error(msg); _addDebugContext(err, context); return err; } /** * @param {?} err * @param {?} context * @return {?} */ function _addDebugContext(err, context) { /** @type {?} */ err[ERROR_DEBUG_CONTEXT] = context; /** @type {?} */ err[ERROR_LOGGER] = context.logError.bind(context); } /** * @param {?} err * @return {?} */ function isViewDebugError(err) { return !!getDebugContext(err); } /** * @param {?} action * @return {?} */ function viewDestroyedError(action) { return new Error("ViewDestroyedError: Attempt to use a destroyed view: ".concat(action)); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** * Factory for ViewDefinitions/NgModuleDefinitions. * We use a function so we can reexeute it in case an error happens and use the given logger * function to log the error from the definition of the node, which is shown in all browser * logs. * @record * @template D */ function DefinitionFactory() {} /** * Function to call console.error at the right source location. This is an indirection * via another function as browser will log the location that actually called * `console.error`. * @record */ function NodeLogger() {} /** * @record * @template DF */ function Definition() {} if (false) {} /** * @record */ function NgModuleDefinition() {} if (false) {} /** * @record */ function NgModuleDefinitionFactory() {} /** * @record */ function ViewDefinition() {} if (false) {} /** * @record */ function ViewDefinitionFactory() {} /** * @record */ function ViewUpdateFn() {} /** * @record */ function NodeCheckFn() {} /** @enum {number} */ var ArgumentType = { Inline: 0, Dynamic: 1 }; /** * @record */ function ViewHandleEventFn() {} /** @enum {number} */ var ViewFlags = { None: 0, OnPush: 2 }; /** * A node definition in the view. * * Note: We use one type for all nodes so that loops that loop over all nodes * of a ViewDefinition stay monomorphic! * @record */ function NodeDef() {} if (false) {} /** @enum {number} */ var NodeFlags = { None: 0, TypeElement: 1, TypeText: 2, ProjectedTemplate: 4, CatRenderNode: 3, TypeNgContent: 8, TypePipe: 16, TypePureArray: 32, TypePureObject: 64, TypePurePipe: 128, CatPureExpression: 224, TypeValueProvider: 256, TypeClassProvider: 512, TypeFactoryProvider: 1024, TypeUseExistingProvider: 2048, LazyProvider: 4096, PrivateProvider: 8192, TypeDirective: 16384, Component: 32768, CatProviderNoDirective: 3840, CatProvider: 20224, OnInit: 65536, OnDestroy: 131072, DoCheck: 262144, OnChanges: 524288, AfterContentInit: 1048576, AfterContentChecked: 2097152, AfterViewInit: 4194304, AfterViewChecked: 8388608, EmbeddedViews: 16777216, ComponentView: 33554432, TypeContentQuery: 67108864, TypeViewQuery: 134217728, StaticQuery: 268435456, DynamicQuery: 536870912, TypeNgModule: 1073741824, CatQuery: 201326592, // mutually exclusive values... Types: 201347067 }; /** * @record */ function BindingDef() {} if (false) {} /** @enum {number} */ var BindingFlags = { TypeElementAttribute: 1, TypeElementClass: 2, TypeElementStyle: 4, TypeProperty: 8, SyntheticProperty: 16, SyntheticHostProperty: 32, CatSyntheticProperty: 48, // mutually exclusive values... Types: 15 }; /** * @record */ function OutputDef() {} if (false) {} /** @enum {number} */ var OutputType = { ElementOutput: 0, DirectiveOutput: 1 }; /** @enum {number} */ var QueryValueType = { ElementRef: 0, RenderElement: 1, TemplateRef: 2, ViewContainerRef: 3, Provider: 4 }; /** * @record */ function ElementDef() {} if (false) {} /** * @record */ function ElementHandleEventFn() {} /** * @record */ function ProviderDef() {} if (false) {} /** * @record */ function NgModuleProviderDef() {} if (false) {} /** * @record */ function DepDef() {} if (false) {} /** @enum {number} */ var DepFlags = { None: 0, SkipSelf: 1, Optional: 2, Self: 4, Value: 8 }; /** * @record */ function TextDef() {} if (false) {} /** * @record */ function QueryDef() {} if (false) {} /** * @record */ function QueryBindingDef() {} if (false) {} /** @enum {number} */ var QueryBindingType = { First: 0, All: 1 }; /** * @record */ function NgContentDef() {} if (false) {} /** * @record */ function NgModuleData() {} if (false) {} /** * View instance data. * Attention: Adding fields to this is performance sensitive! * @record */ function ViewData() {} if (false) {} /** @enum {number} */ var ViewState = { BeforeFirstCheck: 1, FirstCheck: 2, Attached: 4, ChecksEnabled: 8, IsProjectedView: 16, CheckProjectedView: 32, CheckProjectedViews: 64, Destroyed: 128, // InitState Uses 3 bits InitState_Mask: 1792, InitState_BeforeInit: 0, InitState_CallingOnInit: 256, InitState_CallingAfterContentInit: 512, InitState_CallingAfterViewInit: 768, InitState_AfterInit: 1024, CatDetectChanges: 12, CatInit: 13 }; // Called before each cycle of a view's check to detect whether this is in the // initState for which we need to call ngOnInit, ngAfterContentInit or ngAfterViewInit // lifecycle methods. Returns true if this check cycle should call lifecycle // methods. /** * @param {?} view * @param {?} priorInitState * @param {?} newInitState * @return {?} */ function shiftInitState(view, priorInitState, newInitState) { // Only update the InitState if we are currently in the prior state. // For example, only move into CallingInit if we are in BeforeInit. Only // move into CallingContentInit if we are in CallingInit. Normally this will // always be true because of how checkCycle is called in checkAndUpdateView. // However, if checkAndUpdateView is called recursively or if an exception is // thrown while checkAndUpdateView is running, checkAndUpdateView starts over // from the beginning. This ensures the state is monotonically increasing, // terminating in the AfterInit state, which ensures the Init methods are called // at least once and only once. /** @type {?} */ var state = view.state; /** @type {?} */ var initState = state & 1792 /* InitState_Mask */ ; if (initState === priorInitState) { view.state = state & ~1792 /* InitState_Mask */ | newInitState; view.initIndex = -1; return true; } return initState === newInitState; } // Returns true if the lifecycle init method should be called for the node with // the given init index. /** * @param {?} view * @param {?} initState * @param {?} index * @return {?} */ function shouldCallLifecycleInitHook(view, initState, index) { if ((view.state & 1792 /* InitState_Mask */ ) === initState && view.initIndex <= index) { view.initIndex = index + 1; return true; } return false; } /** * @record */ function DisposableFn() {} /** * Node instance data. * * We have a separate type per NodeType to save memory * (TextData | ElementData | ProviderData | PureExpressionData | QueryList<any>) * * To keep our code monomorphic, * we prohibit using `NodeData` directly but enforce the use of accessors (`asElementData`, ...). * This way, no usage site can get a `NodeData` from view.nodes and then use it for different * purposes. */ var NodeData = function NodeData() { _classCallCheck(this, NodeData); }; if (false) {} /** * Data for an instantiated NodeType.Text. * * Attention: Adding fields to this is performance sensitive! * @record */ function TextData() {} if (false) {} /** * Accessor for view.nodes, enforcing that every usage site stays monomorphic. * @param {?} view * @param {?} index * @return {?} */ function asTextData(view, index) { return ( /** @type {?} */ view.nodes[index] ); } /** * Data for an instantiated NodeType.Element. * * Attention: Adding fields to this is performance sensitive! * @record */ function ElementData() {} if (false) {} /** * @record */ function ViewContainerData() {} if (false) {} /** * @record */ function TemplateData() {} if (false) {} /** * Accessor for view.nodes, enforcing that every usage site stays monomorphic. * @param {?} view * @param {?} index * @return {?} */ function asElementData(view, index) { return ( /** @type {?} */ view.nodes[index] ); } /** * Data for an instantiated NodeType.Provider. * * Attention: Adding fields to this is performance sensitive! * @record */ function ProviderData() {} if (false) {} /** * Accessor for view.nodes, enforcing that every usage site stays monomorphic. * @param {?} view * @param {?} index * @return {?} */ function asProviderData(view, index) { return ( /** @type {?} */ view.nodes[index] ); } /** * Data for an instantiated NodeType.PureExpression. * * Attention: Adding fields to this is performance sensitive! * @record */ function PureExpressionData() {} if (false) {} /** * Accessor for view.nodes, enforcing that every usage site stays monomorphic. * @param {?} view * @param {?} index * @return {?} */ function asPureExpressionData(view, index) { return ( /** @type {?} */ view.nodes[index] ); } /** * Accessor for view.nodes, enforcing that every usage site stays monomorphic. * @param {?} view * @param {?} index * @return {?} */ function asQueryList(view, index) { return ( /** @type {?} */ view.nodes[index] ); } /** * @record */ function RootData() {} if (false) {} /** * @abstract */ var DebugContext = function DebugContext() { _classCallCheck(this, DebugContext); }; if (false) {} /** @enum {number} */ var CheckType = { CheckAndUpdate: 0, CheckNoChanges: 1 }; /** * @record */ function ProviderOverride() {} if (false) {} // WARNING: interface has both a type and a value, skipping emit /** * This object is used to prevent cycles in the source files and to have a place where * debug mode can hook it. It is lazily filled when `isDevMode` is known. * @type {?} */ var Services = { setCurrentNode: /** @type {?} */ undefined, createRootView: /** @type {?} */ undefined, createEmbeddedView: /** @type {?} */ undefined, createComponentView: /** @type {?} */ undefined, createNgModuleRef: /** @type {?} */ undefined, overrideProvider: /** @type {?} */ undefined, overrideComponentView: /** @type {?} */ undefined, clearOverrides: /** @type {?} */ undefined, checkAndUpdateView: /** @type {?} */ undefined, checkNoChangesView: /** @type {?} */ undefined, destroyView: /** @type {?} */ undefined, resolveDep: /** @type {?} */ undefined, createDebugContext: /** @type {?} */ undefined, handleEvent: /** @type {?} */ undefined, updateDirectives: /** @type {?} */ undefined, updateRenderer: /** @type {?} */ undefined, dirtyParentQueries: /** @type {?} */ undefined }; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var NOOP = /** * @return {?} */ function NOOP() {}; /** @type {?} */ var _tokenKeyCache = new Map(); /** * @param {?} token * @return {?} */ function tokenKey(token) { /** @type {?} */ var key = _tokenKeyCache.get(token); if (!key) { key = stringify(token) + '_' + _tokenKeyCache.size; _tokenKeyCache.set(token, key); } return key; } /** * @param {?} view * @param {?} nodeIdx * @param {?} bindingIdx * @param {?} value * @return {?} */ function unwrapValue(view, nodeIdx, bindingIdx, value) { if (WrappedValue.isWrapped(value)) { value = WrappedValue.unwrap(value); /** @type {?} */ var globalBindingIdx = view.def.nodes[nodeIdx].bindingIndex + bindingIdx; /** @type {?} */ var oldValue = WrappedValue.unwrap(view.oldValues[globalBindingIdx]); view.oldValues[globalBindingIdx] = new WrappedValue(oldValue); } return value; } /** @type {?} */ var UNDEFINED_RENDERER_TYPE_ID = '$$undefined'; /** @type {?} */ var EMPTY_RENDERER_TYPE_ID = '$$empty'; // Attention: this function is called as top level function. // Putting any logic in here will destroy closure tree shaking! /** * @param {?} values * @return {?} */ function createRendererType2(values) { return { id: UNDEFINED_RENDERER_TYPE_ID, styles: values.styles, encapsulation: values.encapsulation, data: values.data }; } /** @type {?} */ var _renderCompCount$1 = 0; /** * @param {?=} type * @return {?} */ function resolveRendererType2(type) { if (type && type.id === UNDEFINED_RENDERER_TYPE_ID) { // first time we see this RendererType2. Initialize it... /** @type {?} */ var isFilled = type.encapsulation != null && type.encapsulation !== ViewEncapsulation.None || type.styles.length || Object.keys(type.data).length; if (isFilled) { type.id = "c".concat(_renderCompCount$1++); } else { type.id = EMPTY_RENDERER_TYPE_ID; } } if (type && type.id === EMPTY_RENDERER_TYPE_ID) { type = null; } return type || null; } /** * @param {?} view * @param {?} def * @param {?} bindingIdx * @param {?} value * @return {?} */ function checkBinding(view, def, bindingIdx, value) { /** @type {?} */ var oldValues = view.oldValues; if (view.state & 2 /* FirstCheck */ || !looseIdentical(oldValues[def.bindingIndex + bindingIdx], value)) { return true; } return false; } /** * @param {?} view * @param {?} def * @param {?} bindingIdx * @param {?} value * @return {?} */ function checkAndUpdateBinding(view, def, bindingIdx, value) { if (checkBinding(view, def, bindingIdx, value)) { view.oldValues[def.bindingIndex + bindingIdx] = value; return true; } return false; } /** * @param {?} view * @param {?} def * @param {?} bindingIdx * @param {?} value * @return {?} */ function checkBindingNoChanges(view, def, bindingIdx, value) { /** @type {?} */ var oldValue = view.oldValues[def.bindingIndex + bindingIdx]; if (view.state & 1 /* BeforeFirstCheck */ || !devModeEqual$1(oldValue, value)) { /** @type {?} */ var bindingName = def.bindings[bindingIdx].name; throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, def.nodeIndex), "".concat(bindingName, ": ").concat(oldValue), "".concat(bindingName, ": ").concat(value), (view.state & 1 /* BeforeFirstCheck */ ) !== 0); } } /** * @param {?} view * @return {?} */ function markParentViewsForCheck(view) { /** @type {?} */ var currView = view; while (currView) { if (currView.def.flags & 2 /* OnPush */ ) { currView.state |= 8 /* ChecksEnabled */ ; } currView = currView.viewContainerParent || currView.parent; } } /** * @param {?} view * @param {?} endView * @return {?} */ function markParentViewsForCheckProjectedViews(view, endView) { /** @type {?} */ var currView = view; while (currView && currView !== endView) { currView.state |= 64 /* CheckProjectedViews */ ; currView = currView.viewContainerParent || currView.parent; } } /** * @param {?} view * @param {?} nodeIndex * @param {?} eventName * @param {?} event * @return {?} */ function dispatchEvent(view, nodeIndex, eventName, event) { try { /** @type {?} */ var nodeDef = view.def.nodes[nodeIndex]; /** @type {?} */ var startView = nodeDef.flags & 33554432 /* ComponentView */ ? asElementData(view, nodeIndex).componentView : view; markParentViewsForCheck(startView); return Services.handleEvent(view, nodeIndex, eventName, event); } catch (e) { // Attention: Don't rethrow, as it would cancel Observable subscriptions! view.root.errorHandler.handleError(e); } } /** * @param {?} view * @return {?} */ function declaredViewContainer(view) { if (view.parent) { /** @type {?} */ var parentView = view.parent; return asElementData(parentView, /** @type {?} */ view.parentNodeDef.nodeIndex); } return null; } /** * for component views, this is the host element. * for embedded views, this is the index of the parent node * that contains the view container. * @param {?} view * @return {?} */ function viewParentEl(view) { /** @type {?} */ var parentView = view.parent; if (parentView) { return ( /** @type {?} */ view.parentNodeDef.parent ); } else { return null; } } /** * @param {?} view * @param {?} def * @return {?} */ function renderNode(view, def) { switch (def.flags & 201347067 /* Types */ ) { case 1 /* TypeElement */ : return asElementData(view, def.nodeIndex).renderElement; case 2 /* TypeText */ : return asTextData(view, def.nodeIndex).renderText; } } /** * @param {?} target * @param {?} name * @return {?} */ function elementEventFullName(target, name) { return target ? "".concat(target, ":").concat(name) : name; } /** * @param {?} view * @return {?} */ function isComponentView(view) { return !!view.parent && !!( /** @type {?} */ view.parentNodeDef.flags & 32768 /* Component */ ); } /** * @param {?} view * @return {?} */ function isEmbeddedView(view) { return !!view.parent && !( /** @type {?} */ view.parentNodeDef.flags & 32768 /* Component */ ); } /** * @param {?} queryId * @return {?} */ function filterQueryId(queryId) { return 1 << queryId % 32; } /** * @param {?} matchedQueriesDsl * @return {?} */ function splitMatchedQueriesDsl(matchedQueriesDsl) { /** @type {?} */ var matchedQueries = {}; /** @type {?} */ var matchedQueryIds = 0; /** @type {?} */ var references = {}; if (matchedQueriesDsl) { matchedQueriesDsl.forEach( /** * @param {?} __0 * @return {?} */ function (_ref61) { var _ref62 = _slicedToArray(_ref61, 2), queryId = _ref62[0], valueType = _ref62[1]; if (typeof queryId === 'number') { matchedQueries[queryId] = valueType; matchedQueryIds |= filterQueryId(queryId); } else { references[queryId] = valueType; } }); } return { matchedQueries: matchedQueries, references: references, matchedQueryIds: matchedQueryIds }; } /** * @param {?} deps * @param {?=} sourceName * @return {?} */ function splitDepsDsl(deps, sourceName) { return deps.map( /** * @param {?} value * @return {?} */ function (value) { /** @type {?} */ var token; /** @type {?} */ var flags; if (Array.isArray(value)) { var _value10 = _slicedToArray(value, 2); flags = _value10[0]; token = _value10[1]; } else { flags = 0 /* None */ ; token = value; } if (token && (typeof token === 'function' || typeof token === 'object') && sourceName) { Object.defineProperty(token, SOURCE, { value: sourceName, configurable: true }); } return { flags: flags, token: token, tokenKey: tokenKey(token) }; }); } /** * @param {?} view * @param {?} renderHost * @param {?} def * @return {?} */ function getParentRenderElement(view, renderHost, def) { /** @type {?} */ var renderParent = def.renderParent; if (renderParent) { if ((renderParent.flags & 1 /* TypeElement */ ) === 0 || (renderParent.flags & 33554432 /* ComponentView */ ) === 0 || /** @type {?} */ renderParent.element.componentRendererType && /** @type {?} */ /** @type {?} */ renderParent.element.componentRendererType.encapsulation === ViewEncapsulation.Native) { // only children of non components, or children of components with native encapsulation should // be attached. return asElementData(view, /** @type {?} */ def.renderParent.nodeIndex).renderElement; } } else { return renderHost; } } /** @type {?} */ var DEFINITION_CACHE = new WeakMap(); /** * @template D * @param {?} factory * @return {?} */ function resolveDefinition(factory) { /** @type {?} */ var value = /** @type {?} */ /** @type {?} */ DEFINITION_CACHE.get(factory); if (!value) { value = factory( /** * @return {?} */ function () { return NOOP; }); value.factory = factory; DEFINITION_CACHE.set(factory, value); } return value; } /** * @param {?} view * @return {?} */ function rootRenderNodes(view) { /** @type {?} */ var renderNodes = []; visitRootRenderNodes(view, 0 /* Collect */ , undefined, undefined, renderNodes); return renderNodes; } /** @enum {number} */ var RenderNodeAction = { Collect: 0, AppendChild: 1, InsertBefore: 2, RemoveChild: 3 }; /** * @param {?} view * @param {?} action * @param {?} parentNode * @param {?} nextSibling * @param {?=} target * @return {?} */ function visitRootRenderNodes(view, action, parentNode, nextSibling, target) { // We need to re-compute the parent node in case the nodes have been moved around manually if (action === 3 /* RemoveChild */ ) { parentNode = view.renderer.parentNode(renderNode(view, /** @type {?} */ view.def.lastRenderRootNode)); } visitSiblingRenderNodes(view, action, 0, view.def.nodes.length - 1, parentNode, nextSibling, target); } /** * @param {?} view * @param {?} action * @param {?} startIndex * @param {?} endIndex * @param {?} parentNode * @param {?} nextSibling * @param {?=} target * @return {?} */ function visitSiblingRenderNodes(view, action, startIndex, endIndex, parentNode, nextSibling, target) { for (var i = startIndex; i <= endIndex; i++) { /** @type {?} */ var nodeDef = view.def.nodes[i]; if (nodeDef.flags & (1 /* TypeElement */ | 2 /* TypeText */ | 8 /* TypeNgContent */ )) { visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target); } // jump to next sibling i += nodeDef.childCount; } } /** * @param {?} view * @param {?} ngContentIndex * @param {?} action * @param {?} parentNode * @param {?} nextSibling * @param {?=} target * @return {?} */ function visitProjectedRenderNodes(view, ngContentIndex, action, parentNode, nextSibling, target) { /** @type {?} */ var compView = view; while (compView && !isComponentView(compView)) { compView = compView.parent; } /** @type {?} */ var hostView = /** @type {?} */ compView.parent; /** @type {?} */ var hostElDef = viewParentEl( /** @type {?} */ compView); /** @type {?} */ var startIndex = /** @type {?} */ hostElDef.nodeIndex + 1; /** @type {?} */ var endIndex = /** @type {?} */ hostElDef.nodeIndex + /** @type {?} */ hostElDef.childCount; for (var i = startIndex; i <= endIndex; i++) { /** @type {?} */ var nodeDef = /** @type {?} */ hostView.def.nodes[i]; if (nodeDef.ngContentIndex === ngContentIndex) { visitRenderNode( /** @type {?} */ hostView, nodeDef, action, parentNode, nextSibling, target); } // jump to next sibling i += nodeDef.childCount; } if (! /** @type {?} */ hostView.parent) { // a root view /** @type {?} */ var projectedNodes = view.root.projectableNodes[ngContentIndex]; if (projectedNodes) { for (var _i18 = 0; _i18 < projectedNodes.length; _i18++) { execRenderNodeAction(view, projectedNodes[_i18], action, parentNode, nextSibling, target); } } } } /** * @param {?} view * @param {?} nodeDef * @param {?} action * @param {?} parentNode * @param {?} nextSibling * @param {?=} target * @return {?} */ function visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target) { if (nodeDef.flags & 8 /* TypeNgContent */ ) { visitProjectedRenderNodes(view, /** @type {?} */ nodeDef.ngContent.index, action, parentNode, nextSibling, target); } else { /** @type {?} */ var rn = renderNode(view, nodeDef); if (action === 3 /* RemoveChild */ && nodeDef.flags & 33554432 /* ComponentView */ && nodeDef.bindingFlags & 48 /* CatSyntheticProperty */ ) { // Note: we might need to do both actions. if (nodeDef.bindingFlags & 16 /* SyntheticProperty */ ) { execRenderNodeAction(view, rn, action, parentNode, nextSibling, target); } if (nodeDef.bindingFlags & 32 /* SyntheticHostProperty */ ) { /** @type {?} */ var compView = asElementData(view, nodeDef.nodeIndex).componentView; execRenderNodeAction(compView, rn, action, parentNode, nextSibling, target); } } else { execRenderNodeAction(view, rn, action, parentNode, nextSibling, target); } if (nodeDef.flags & 16777216 /* EmbeddedViews */ ) { /** @type {?} */ var embeddedViews = /** @type {?} */ asElementData(view, nodeDef.nodeIndex).viewContainer._embeddedViews; for (var k = 0; k < embeddedViews.length; k++) { visitRootRenderNodes(embeddedViews[k], action, parentNode, nextSibling, target); } } if (nodeDef.flags & 1 /* TypeElement */ && ! /** @type {?} */ nodeDef.element.name) { visitSiblingRenderNodes(view, action, nodeDef.nodeIndex + 1, nodeDef.nodeIndex + nodeDef.childCount, parentNode, nextSibling, target); } } } /** * @param {?} view * @param {?} renderNode * @param {?} action * @param {?} parentNode * @param {?} nextSibling * @param {?=} target * @return {?} */ function execRenderNodeAction(view, renderNode, action, parentNode, nextSibling, target) { /** @type {?} */ var renderer = view.renderer; switch (action) { case 1 /* AppendChild */ : renderer.appendChild(parentNode, renderNode); break; case 2 /* InsertBefore */ : renderer.insertBefore(parentNode, renderNode, nextSibling); break; case 3 /* RemoveChild */ : renderer.removeChild(parentNode, renderNode); break; case 0 /* Collect */ : /** @type {?} */ target.push(renderNode); break; } } /** @type {?} */ var NS_PREFIX_RE = /^:([^:]+):(.+)$/; /** * @param {?} name * @return {?} */ function splitNamespace(name) { if (name[0] === ':') { /** @type {?} */ var match = /** @type {?} */ name.match(NS_PREFIX_RE); return [match[1], match[2]]; } return ['', name]; } /** * @param {?} bindings * @return {?} */ function calcBindingFlags(bindings) { /** @type {?} */ var flags = 0; for (var i = 0; i < bindings.length; i++) { flags |= bindings[i].flags; } return flags; } /** * @param {?} valueCount * @param {?} constAndInterp * @return {?} */ function interpolate(valueCount, constAndInterp) { /** @type {?} */ var result = ''; for (var i = 0; i < valueCount * 2; i = i + 2) { result = result + constAndInterp[i] + _toStringWithNull(constAndInterp[i + 1]); } return result + constAndInterp[valueCount * 2]; } /** * @param {?} valueCount * @param {?} c0 * @param {?} a1 * @param {?} c1 * @param {?=} a2 * @param {?=} c2 * @param {?=} a3 * @param {?=} c3 * @param {?=} a4 * @param {?=} c4 * @param {?=} a5 * @param {?=} c5 * @param {?=} a6 * @param {?=} c6 * @param {?=} a7 * @param {?=} c7 * @param {?=} a8 * @param {?=} c8 * @param {?=} a9 * @param {?=} c9 * @return {?} */ function inlineInterpolate(valueCount, c0, a1, c1, a2, c2, a3, c3, a4, c4, a5, c5, a6, c6, a7, c7, a8, c8, a9, c9) { switch (valueCount) { case 1: return c0 + _toStringWithNull(a1) + c1; case 2: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2; case 3: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3; case 4: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4; case 5: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5; case 6: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6; case 7: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6 + _toStringWithNull(a7) + c7; case 8: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8; case 9: return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) + c9; default: throw new Error("Does not support more than 9 expressions"); } } /** * @param {?} v * @return {?} */ function _toStringWithNull(v) { return v != null ? v.toString() : ''; } /** @type {?} */ var EMPTY_ARRAY$3 = []; /** @type {?} */ var EMPTY_MAP = {}; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var UNDEFINED_VALUE = new Object(); /** @type {?} */ var InjectorRefTokenKey = tokenKey(Injector); /** @type {?} */ var INJECTORRefTokenKey = tokenKey(INJECTOR); /** @type {?} */ var NgModuleRefTokenKey = tokenKey(NgModuleRef); /** * @param {?} flags * @param {?} token * @param {?} value * @param {?} deps * @return {?} */ function moduleProvideDef(flags, token, value, deps) { // Need to resolve forwardRefs as e.g. for `useValue` we // lowered the expression and then stopped evaluating it, // i.e. also didn't unwrap it. value = resolveForwardRef(value); /** @type {?} */ var depDefs = splitDepsDsl(deps, stringify(token)); return { // will bet set by the module definition index: -1, deps: depDefs, flags: flags, token: token, value: value }; } /** * @param {?} providers * @return {?} */ function moduleDef(providers) { /** @type {?} */ var providersByKey = {}; /** @type {?} */ var modules = []; /** @type {?} */ var isRoot = false; for (var i = 0; i < providers.length; i++) { /** @type {?} */ var provider = providers[i]; if (provider.token === APP_ROOT && provider.value === true) { isRoot = true; } if (provider.flags & 1073741824 /* TypeNgModule */ ) { modules.push(provider.token); } provider.index = i; providersByKey[tokenKey(provider.token)] = provider; } return { // Will be filled later... factory: null, providersByKey: providersByKey, providers: providers, modules: modules, isRoot: isRoot }; } /** * @param {?} data * @return {?} */ function initNgModule(data) { /** @type {?} */ var def = data._def; /** @type {?} */ var providers = data._providers = new Array(def.providers.length); for (var i = 0; i < def.providers.length; i++) { /** @type {?} */ var provDef = def.providers[i]; if (!(provDef.flags & 4096 /* LazyProvider */ )) { // Make sure the provider has not been already initialized outside this loop. if (providers[i] === undefined) { providers[i] = _createProviderInstance(data, provDef); } } } } /** * @param {?} data * @param {?} depDef * @param {?=} notFoundValue * @return {?} */ function resolveNgModuleDep(data, depDef) { var notFoundValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Injector.THROW_IF_NOT_FOUND; /** @type {?} */ var former = setCurrentInjector(data); try { if (depDef.flags & 8 /* Value */ ) { return depDef.token; } if (depDef.flags & 2 /* Optional */ ) { notFoundValue = null; } if (depDef.flags & 1 /* SkipSelf */ ) { return data._parent.get(depDef.token, notFoundValue); } /** @type {?} */ var _tokenKey = depDef.tokenKey; switch (_tokenKey) { case InjectorRefTokenKey: case INJECTORRefTokenKey: case NgModuleRefTokenKey: return data; } /** @type {?} */ var _providerDef2 = data._def.providersByKey[_tokenKey]; /** @type {?} */ var injectableDef; if (_providerDef2) { /** @type {?} */ var providerInstance = data._providers[_providerDef2.index]; if (providerInstance === undefined) { providerInstance = data._providers[_providerDef2.index] = _createProviderInstance(data, _providerDef2); } return providerInstance === UNDEFINED_VALUE ? undefined : providerInstance; } else if ((injectableDef = getInjectableDef(depDef.token)) && targetsModule(data, injectableDef)) { /** @type {?} */ var index = data._providers.length; data._def.providers[index] = data._def.providersByKey[depDef.tokenKey] = { flags: 1024 /* TypeFactoryProvider */ | 4096 /* LazyProvider */ , value: injectableDef.factory, deps: [], index: index, token: depDef.token }; data._providers[index] = UNDEFINED_VALUE; return data._providers[index] = _createProviderInstance(data, data._def.providersByKey[depDef.tokenKey]); } else if (depDef.flags & 4 /* Self */ ) { return notFoundValue; } return data._parent.get(depDef.token, notFoundValue); } finally { setCurrentInjector(former); } } /** * @param {?} ngModule * @param {?} scope * @return {?} */ function moduleTransitivelyPresent(ngModule, scope) { return ngModule._def.modules.indexOf(scope) > -1; } /** * @param {?} ngModule * @param {?} def * @return {?} */ function targetsModule(ngModule, def) { return def.providedIn != null && (moduleTransitivelyPresent(ngModule, def.providedIn) || def.providedIn === 'root' && ngModule._def.isRoot); } /** * @param {?} ngModule * @param {?} providerDef * @return {?} */ function _createProviderInstance(ngModule, providerDef) { /** @type {?} */ var injectable; switch (providerDef.flags & 201347067 /* Types */ ) { case 512 /* TypeClassProvider */ : injectable = _createClass(ngModule, providerDef.value, providerDef.deps); break; case 1024 /* TypeFactoryProvider */ : injectable = _callFactory(ngModule, providerDef.value, providerDef.deps); break; case 2048 /* TypeUseExistingProvider */ : injectable = resolveNgModuleDep(ngModule, providerDef.deps[0]); break; case 256 /* TypeValueProvider */ : injectable = providerDef.value; break; } // The read of `ngOnDestroy` here is slightly expensive as it's megamorphic, so it should be // avoided if possible. The sequence of checks here determines whether ngOnDestroy needs to be // checked. It might not if the `injectable` isn't an object or if NodeFlags.OnDestroy is already // set (ngOnDestroy was detected statically). if (injectable !== UNDEFINED_VALUE && injectable !== null && typeof injectable === 'object' && !(providerDef.flags & 131072 /* OnDestroy */ ) && typeof injectable.ngOnDestroy === 'function') { providerDef.flags |= 131072 /* OnDestroy */ ; } return injectable === undefined ? UNDEFINED_VALUE : injectable; } /** * @param {?} ngModule * @param {?} ctor * @param {?} deps * @return {?} */ function _createClass(ngModule, ctor, deps) { /** @type {?} */ var len = deps.length; switch (len) { case 0: return new ctor(); case 1: return new ctor(resolveNgModuleDep(ngModule, deps[0])); case 2: return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1])); case 3: return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2])); default: /** @type {?} */ var depValues = new Array(len); for (var i = 0; i < len; i++) { depValues[i] = resolveNgModuleDep(ngModule, deps[i]); } return _construct(ctor, depValues); } } /** * @param {?} ngModule * @param {?} factory * @param {?} deps * @return {?} */ function _callFactory(ngModule, factory, deps) { /** @type {?} */ var len = deps.length; switch (len) { case 0: return factory(); case 1: return factory(resolveNgModuleDep(ngModule, deps[0])); case 2: return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1])); case 3: return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2])); default: /** @type {?} */ var depValues = Array(len); for (var i = 0; i < len; i++) { depValues[i] = resolveNgModuleDep(ngModule, deps[i]); } return factory.apply(void 0, depValues); } } /** * @param {?} ngModule * @param {?} lifecycles * @return {?} */ function callNgModuleLifecycle(ngModule, lifecycles) { /** @type {?} */ var def = ngModule._def; /** @type {?} */ var destroyed = new Set(); for (var i = 0; i < def.providers.length; i++) { /** @type {?} */ var provDef = def.providers[i]; if (provDef.flags & 131072 /* OnDestroy */ ) { /** @type {?} */ var instance = ngModule._providers[i]; if (instance && instance !== UNDEFINED_VALUE) { /** @type {?} */ var onDestroy = instance.ngOnDestroy; if (typeof onDestroy === 'function' && !destroyed.has(instance)) { onDestroy.apply(instance); destroyed.add(instance); } } } } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} parentView * @param {?} elementData * @param {?} viewIndex * @param {?} view * @return {?} */ function attachEmbeddedView(parentView, elementData, viewIndex, view) { /** @type {?} */ var embeddedViews = /** @type {?} */ elementData.viewContainer._embeddedViews; if (viewIndex === null || viewIndex === undefined) { viewIndex = embeddedViews.length; } view.viewContainerParent = parentView; addToArray(embeddedViews, /** @type {?} */ viewIndex, view); attachProjectedView(elementData, view); Services.dirtyParentQueries(view); /** @type {?} */ var prevView = /** @type {?} */ viewIndex > 0 ? embeddedViews[ /** @type {?} */ viewIndex - 1] : null; renderAttachEmbeddedView(elementData, prevView, view); } /** * @param {?} vcElementData * @param {?} view * @return {?} */ function attachProjectedView(vcElementData, view) { /** @type {?} */ var dvcElementData = declaredViewContainer(view); if (!dvcElementData || dvcElementData === vcElementData || view.state & 16 /* IsProjectedView */ ) { return; } // Note: For performance reasons, we // - add a view to template._projectedViews only 1x throughout its lifetime, // and remove it not until the view is destroyed. // (hard, as when a parent view is attached/detached we would need to attach/detach all // nested projected views as well, even across component boundaries). // - don't track the insertion order of views in the projected views array // (hard, as when the views of the same template are inserted different view containers) view.state |= 16 /* IsProjectedView */ ; /** @type {?} */ var projectedViews = dvcElementData.template._projectedViews; if (!projectedViews) { projectedViews = dvcElementData.template._projectedViews = []; } projectedViews.push(view); // Note: we are changing the NodeDef here as we cannot calculate // the fact whether a template is used for projection during compilation. markNodeAsProjectedTemplate( /** @type {?} */ view.parent.def, /** @type {?} */ view.parentNodeDef); } /** * @param {?} viewDef * @param {?} nodeDef * @return {?} */ function markNodeAsProjectedTemplate(viewDef, nodeDef) { if (nodeDef.flags & 4 /* ProjectedTemplate */ ) { return; } viewDef.nodeFlags |= 4 /* ProjectedTemplate */ ; nodeDef.flags |= 4 /* ProjectedTemplate */ ; /** @type {?} */ var parentNodeDef = nodeDef.parent; while (parentNodeDef) { parentNodeDef.childFlags |= 4 /* ProjectedTemplate */ ; parentNodeDef = parentNodeDef.parent; } } /** * @param {?} elementData * @param {?=} viewIndex * @return {?} */ function detachEmbeddedView(elementData, viewIndex) { /** @type {?} */ var embeddedViews = /** @type {?} */ elementData.viewContainer._embeddedViews; if (viewIndex == null || viewIndex >= embeddedViews.length) { viewIndex = embeddedViews.length - 1; } if (viewIndex < 0) { return null; } /** @type {?} */ var view = embeddedViews[viewIndex]; view.viewContainerParent = null; removeFromArray(embeddedViews, viewIndex); // See attachProjectedView for why we don't update projectedViews here. Services.dirtyParentQueries(view); renderDetachView$1(view); return view; } /** * @param {?} view * @return {?} */ function detachProjectedView(view) { if (!(view.state & 16 /* IsProjectedView */ )) { return; } /** @type {?} */ var dvcElementData = declaredViewContainer(view); if (dvcElementData) { /** @type {?} */ var projectedViews = dvcElementData.template._projectedViews; if (projectedViews) { removeFromArray(projectedViews, projectedViews.indexOf(view)); Services.dirtyParentQueries(view); } } } /** * @param {?} elementData * @param {?} oldViewIndex * @param {?} newViewIndex * @return {?} */ function moveEmbeddedView(elementData, oldViewIndex, newViewIndex) { /** @type {?} */ var embeddedViews = /** @type {?} */ elementData.viewContainer._embeddedViews; /** @type {?} */ var view = embeddedViews[oldViewIndex]; removeFromArray(embeddedViews, oldViewIndex); if (newViewIndex == null) { newViewIndex = embeddedViews.length; } addToArray(embeddedViews, newViewIndex, view); // Note: Don't need to change projectedViews as the order in there // as always invalid... Services.dirtyParentQueries(view); renderDetachView$1(view); /** @type {?} */ var prevView = newViewIndex > 0 ? embeddedViews[newViewIndex - 1] : null; renderAttachEmbeddedView(elementData, prevView, view); return view; } /** * @param {?} elementData * @param {?} prevView * @param {?} view * @return {?} */ function renderAttachEmbeddedView(elementData, prevView, view) { /** @type {?} */ var prevRenderNode = prevView ? renderNode(prevView, /** @type {?} */ prevView.def.lastRenderRootNode) : elementData.renderElement; /** @type {?} */ var parentNode = view.renderer.parentNode(prevRenderNode); /** @type {?} */ var nextSibling = view.renderer.nextSibling(prevRenderNode); // Note: We can't check if `nextSibling` is present, as on WebWorkers it will always be! // However, browsers automatically do `appendChild` when there is no `nextSibling`. visitRootRenderNodes(view, 2 /* InsertBefore */ , parentNode, nextSibling, undefined); } /** * @param {?} view * @return {?} */ function renderDetachView$1(view) { visitRootRenderNodes(view, 3 /* RemoveChild */ , null, null, undefined); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var EMPTY_CONTEXT = new Object(); // Attention: this function is called as top level function. // Putting any logic in here will destroy closure tree shaking! /** * @param {?} selector * @param {?} componentType * @param {?} viewDefFactory * @param {?} inputs * @param {?} outputs * @param {?} ngContentSelectors * @return {?} */ function createComponentFactory(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors) { return new ComponentFactory_(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors); } /** * @param {?} componentFactory * @return {?} */ function getComponentViewDefinitionFactory(componentFactory) { return ( /** @type {?} */ componentFactory.viewDefFactory ); } var ComponentFactory_ = /*#__PURE__*/function (_ComponentFactory2) { _inherits(ComponentFactory_, _ComponentFactory2); var _super112 = _createSuper(ComponentFactory_); /** * @param {?} selector * @param {?} componentType * @param {?} viewDefFactory * @param {?} _inputs * @param {?} _outputs * @param {?} ngContentSelectors */ function ComponentFactory_(selector, componentType, viewDefFactory, _inputs, _outputs, ngContentSelectors) { var _this331; _classCallCheck(this, ComponentFactory_); // Attention: this ctor is called as top level function. // Putting any logic in here will destroy closure tree shaking! _this331 = _super112.call(this); _this331.selector = selector; _this331.componentType = componentType; _this331._inputs = _inputs; _this331._outputs = _outputs; _this331.ngContentSelectors = ngContentSelectors; _this331.viewDefFactory = viewDefFactory; return _this331; } /** * @return {?} */ _createClass2(ComponentFactory_, [{ key: "create", /** * Creates a new component. * @param {?} injector * @param {?=} projectableNodes * @param {?=} rootSelectorOrNode * @param {?=} ngModule * @return {?} */ value: function create(injector, projectableNodes, rootSelectorOrNode, ngModule) { if (!ngModule) { throw new Error('ngModule should be provided'); } /** @type {?} */ var viewDef = resolveDefinition(this.viewDefFactory); /** @type {?} */ var componentNodeIndex = /** @type {?} */ /** @type {?} */ viewDef.nodes[0].element.componentProvider.nodeIndex; /** @type {?} */ var view = Services.createRootView(injector, projectableNodes || [], rootSelectorOrNode, viewDef, ngModule, EMPTY_CONTEXT); /** @type {?} */ var component = asProviderData(view, componentNodeIndex).instance; if (rootSelectorOrNode) { view.renderer.setAttribute(asElementData(view, 0).renderElement, 'ng-version', VERSION.full); } return new ComponentRef_(view, new ViewRef_(view), component); } }, { key: "inputs", get: function get() { /** @type {?} */ var inputsArr = []; /** @type {?} */ var inputs = /** @type {?} */ this._inputs; for (var propName in inputs) { /** @type {?} */ var templateName = inputs[propName]; inputsArr.push({ propName: propName, templateName: templateName }); } return inputsArr; } /** * @return {?} */ }, { key: "outputs", get: function get() { /** @type {?} */ var outputsArr = []; for (var propName in this._outputs) { /** @type {?} */ var templateName = this._outputs[propName]; outputsArr.push({ propName: propName, templateName: templateName }); } return outputsArr; } }]); return ComponentFactory_; }(ComponentFactory); if (false) {} var ComponentRef_ = /*#__PURE__*/function (_ComponentRef) { _inherits(ComponentRef_, _ComponentRef); var _super113 = _createSuper(ComponentRef_); /** * @param {?} _view * @param {?} _viewRef * @param {?} _component */ function ComponentRef_(_view, _viewRef, _component) { var _this332; _classCallCheck(this, ComponentRef_); _this332 = _super113.call(this); _this332._view = _view; _this332._viewRef = _viewRef; _this332._component = _component; _this332._elDef = _this332._view.def.nodes[0]; _this332.hostView = _viewRef; _this332.changeDetectorRef = _viewRef; _this332.instance = _component; return _this332; } /** * @return {?} */ _createClass2(ComponentRef_, [{ key: "destroy", /** * @return {?} */ value: function destroy() { this._viewRef.destroy(); } /** * @param {?} callback * @return {?} */ }, { key: "onDestroy", value: function onDestroy(callback) { this._viewRef.onDestroy(callback); } }, { key: "location", get: function get() { return new ElementRef(asElementData(this._view, this._elDef.nodeIndex).renderElement); } /** * @return {?} */ }, { key: "injector", get: function get() { return new Injector_(this._view, this._elDef); } /** * @return {?} */ }, { key: "componentType", get: function get() { return ( /** @type {?} */ this._component.constructor ); } }]); return ComponentRef_; }(ComponentRef); if (false) {} /** * @param {?} view * @param {?} elDef * @param {?} elData * @return {?} */ function createViewContainerData(view, elDef, elData) { return new ViewContainerRef_(view, elDef, elData); } var ViewContainerRef_ = /*#__PURE__*/function () { /** * @param {?} _view * @param {?} _elDef * @param {?} _data */ function ViewContainerRef_(_view, _elDef, _data) { _classCallCheck(this, ViewContainerRef_); this._view = _view; this._elDef = _elDef; this._data = _data; /** * \@internal */ this._embeddedViews = []; } /** * @return {?} */ _createClass2(ViewContainerRef_, [{ key: "clear", /** * @return {?} */ value: function clear() { /** @type {?} */ var len = this._embeddedViews.length; for (var i = len - 1; i >= 0; i--) { /** @type {?} */ var view = /** @type {?} */ detachEmbeddedView(this._data, i); Services.destroyView(view); } } /** * @param {?} index * @return {?} */ }, { key: "get", value: function get(index) { /** @type {?} */ var view = this._embeddedViews[index]; if (view) { /** @type {?} */ var ref = new ViewRef_(view); ref.attachToViewContainerRef(this); return ref; } return null; } /** * @return {?} */ }, { key: "createEmbeddedView", /** * @template C * @param {?} templateRef * @param {?=} context * @param {?=} index * @return {?} */ value: function createEmbeddedView(templateRef, context, index) { /** @type {?} */ var viewRef = templateRef.createEmbeddedView(context || /** @type {?} */ {}); this.insert(viewRef, index); return viewRef; } /** * @template C * @param {?} componentFactory * @param {?=} index * @param {?=} injector * @param {?=} projectableNodes * @param {?=} ngModuleRef * @return {?} */ }, { key: "createComponent", value: function createComponent(componentFactory, index, injector, projectableNodes, ngModuleRef) { /** @type {?} */ var contextInjector = injector || this.parentInjector; if (!ngModuleRef && !(componentFactory instanceof ComponentFactoryBoundToModule)) { ngModuleRef = contextInjector.get(NgModuleRef); } /** @type {?} */ var componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef); this.insert(componentRef.hostView, index); return componentRef; } /** * @param {?} viewRef * @param {?=} index * @return {?} */ }, { key: "insert", value: function insert(viewRef, index) { if (viewRef.destroyed) { throw new Error('Cannot insert a destroyed View in a ViewContainer!'); } /** @type {?} */ var viewRef_ = /** @type {?} */ viewRef; /** @type {?} */ var viewData = viewRef_._view; attachEmbeddedView(this._view, this._data, index, viewData); viewRef_.attachToViewContainerRef(this); return viewRef; } /** * @param {?} viewRef * @param {?} currentIndex * @return {?} */ }, { key: "move", value: function move(viewRef, currentIndex) { if (viewRef.destroyed) { throw new Error('Cannot move a destroyed View in a ViewContainer!'); } /** @type {?} */ var previousIndex = this._embeddedViews.indexOf(viewRef._view); moveEmbeddedView(this._data, previousIndex, currentIndex); return viewRef; } /** * @param {?} viewRef * @return {?} */ }, { key: "indexOf", value: function indexOf(viewRef) { return this._embeddedViews.indexOf( /** @type {?} */ viewRef._view); } /** * @param {?=} index * @return {?} */ }, { key: "remove", value: function remove(index) { /** @type {?} */ var viewData = detachEmbeddedView(this._data, index); if (viewData) { Services.destroyView(viewData); } } /** * @param {?=} index * @return {?} */ }, { key: "detach", value: function detach(index) { /** @type {?} */ var view = detachEmbeddedView(this._data, index); return view ? new ViewRef_(view) : null; } }, { key: "element", get: function get() { return new ElementRef(this._data.renderElement); } /** * @return {?} */ }, { key: "injector", get: function get() { return new Injector_(this._view, this._elDef); } /** * @deprecated No replacement * @return {?} */ }, { key: "parentInjector", get: function get() { /** @type {?} */ var view = this._view; /** @type {?} */ var elDef = this._elDef.parent; while (!elDef && view) { elDef = viewParentEl(view); view = /** @type {?} */ view.parent; } return view ? new Injector_(view, elDef) : new Injector_(this._view, null); } }, { key: "length", get: function get() { return this._embeddedViews.length; } }]); return ViewContainerRef_; }(); if (false) {} /** * @param {?} view * @return {?} */ function createChangeDetectorRef(view) { return new ViewRef_(view); } var ViewRef_ = /*#__PURE__*/function () { /** * @param {?} _view */ function ViewRef_(_view) { _classCallCheck(this, ViewRef_); this._view = _view; this._viewContainerRef = null; this._appRef = null; } /** * @return {?} */ _createClass2(ViewRef_, [{ key: "markForCheck", /** * @return {?} */ value: function markForCheck() { markParentViewsForCheck(this._view); } /** * @return {?} */ }, { key: "detach", value: function detach() { this._view.state &= ~4 /* Attached */ ; } /** * @return {?} */ }, { key: "detectChanges", value: function detectChanges() { /** @type {?} */ var fs = this._view.root.rendererFactory; if (fs.begin) { fs.begin(); } try { Services.checkAndUpdateView(this._view); } finally { if (fs.end) { fs.end(); } } } /** * @return {?} */ }, { key: "checkNoChanges", value: function checkNoChanges() { Services.checkNoChangesView(this._view); } /** * @return {?} */ }, { key: "reattach", value: function reattach() { this._view.state |= 4 /* Attached */ ; } /** * @param {?} callback * @return {?} */ }, { key: "onDestroy", value: function onDestroy(callback) { if (!this._view.disposables) { this._view.disposables = []; } this._view.disposables.push( /** @type {?} */ callback); } /** * @return {?} */ }, { key: "destroy", value: function destroy() { if (this._appRef) { this._appRef.detachView(this); } else if (this._viewContainerRef) { this._viewContainerRef.detach(this._viewContainerRef.indexOf(this)); } Services.destroyView(this._view); } /** * @return {?} */ }, { key: "detachFromAppRef", value: function detachFromAppRef() { this._appRef = null; renderDetachView$1(this._view); Services.dirtyParentQueries(this._view); } /** * @param {?} appRef * @return {?} */ }, { key: "attachToAppRef", value: function attachToAppRef(appRef) { if (this._viewContainerRef) { throw new Error('This view is already attached to a ViewContainer!'); } this._appRef = appRef; } /** * @param {?} vcRef * @return {?} */ }, { key: "attachToViewContainerRef", value: function attachToViewContainerRef(vcRef) { if (this._appRef) { throw new Error('This view is already attached directly to the ApplicationRef!'); } this._viewContainerRef = vcRef; } }, { key: "rootNodes", get: function get() { return rootRenderNodes(this._view); } /** * @return {?} */ }, { key: "context", get: function get() { return this._view.context; } /** * @return {?} */ }, { key: "destroyed", get: function get() { return (this._view.state & 128 /* Destroyed */ ) !== 0; } }]); return ViewRef_; }(); if (false) {} /** * @param {?} view * @param {?} def * @return {?} */ function createTemplateData(view, def) { return new TemplateRef_(view, def); } var TemplateRef_ = /*#__PURE__*/function (_TemplateRef) { _inherits(TemplateRef_, _TemplateRef); var _super114 = _createSuper(TemplateRef_); /** * @param {?} _parentView * @param {?} _def */ function TemplateRef_(_parentView, _def) { var _this333; _classCallCheck(this, TemplateRef_); _this333 = _super114.call(this); _this333._parentView = _parentView; _this333._def = _def; return _this333; } /** * @param {?} context * @return {?} */ _createClass2(TemplateRef_, [{ key: "createEmbeddedView", value: function createEmbeddedView(context) { return new ViewRef_(Services.createEmbeddedView(this._parentView, this._def, /** @type {?} */ /** @type {?} */ this._def.element.template, context)); } /** * @return {?} */ }, { key: "elementRef", get: function get() { return new ElementRef(asElementData(this._parentView, this._def.nodeIndex).renderElement); } }]); return TemplateRef_; }(TemplateRef); if (false) {} /** * @param {?} view * @param {?} elDef * @return {?} */ function createInjector$1(view, elDef) { return new Injector_(view, elDef); } var Injector_ = /*#__PURE__*/function () { /** * @param {?} view * @param {?} elDef */ function Injector_(view, elDef) { _classCallCheck(this, Injector_); this.view = view; this.elDef = elDef; } /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ _createClass2(Injector_, [{ key: "get", value: function get(token) { var notFoundValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Injector.THROW_IF_NOT_FOUND; /** @type {?} */ var allowPrivateServices = this.elDef ? (this.elDef.flags & 33554432 /* ComponentView */ ) !== 0 : false; return Services.resolveDep(this.view, this.elDef, allowPrivateServices, { flags: 0 /* None */ , token: token, tokenKey: tokenKey(token) }, notFoundValue); } }]); return Injector_; }(); if (false) {} /** * @param {?} view * @param {?} index * @return {?} */ function nodeValue(view, index) { /** @type {?} */ var def = view.def.nodes[index]; if (def.flags & 1 /* TypeElement */ ) { /** @type {?} */ var elData = asElementData(view, def.nodeIndex); return ( /** @type {?} */ def.element.template ? elData.template : elData.renderElement ); } else if (def.flags & 2 /* TypeText */ ) { return asTextData(view, def.nodeIndex).renderText; } else if (def.flags & (20224 /* CatProvider */ | 16 /* TypePipe */ )) { return asProviderData(view, def.nodeIndex).instance; } throw new Error("Illegal state: read nodeValue for node index ".concat(index)); } /** * @param {?} view * @return {?} */ function createRendererV1(view) { return new RendererAdapter(view.renderer); } var RendererAdapter = /*#__PURE__*/function () { /** * @param {?} delegate */ function RendererAdapter(delegate) { _classCallCheck(this, RendererAdapter); this.delegate = delegate; } /** * @param {?} selectorOrNode * @return {?} */ _createClass2(RendererAdapter, [{ key: "selectRootElement", value: function selectRootElement(selectorOrNode) { return this.delegate.selectRootElement(selectorOrNode); } /** * @param {?} parent * @param {?} namespaceAndName * @return {?} */ }, { key: "createElement", value: function createElement(parent, namespaceAndName) { var _splitNamespace = splitNamespace(namespaceAndName), _splitNamespace2 = _slicedToArray(_splitNamespace, 2), ns = _splitNamespace2[0], name = _splitNamespace2[1]; /** @type {?} */ var el = this.delegate.createElement(name, ns); if (parent) { this.delegate.appendChild(parent, el); } return el; } /** * @param {?} hostElement * @return {?} */ }, { key: "createViewRoot", value: function createViewRoot(hostElement) { return hostElement; } /** * @param {?} parentElement * @return {?} */ }, { key: "createTemplateAnchor", value: function createTemplateAnchor(parentElement) { /** @type {?} */ var comment = this.delegate.createComment(''); if (parentElement) { this.delegate.appendChild(parentElement, comment); } return comment; } /** * @param {?} parentElement * @param {?} value * @return {?} */ }, { key: "createText", value: function createText(parentElement, value) { /** @type {?} */ var node = this.delegate.createText(value); if (parentElement) { this.delegate.appendChild(parentElement, node); } return node; } /** * @param {?} parentElement * @param {?} nodes * @return {?} */ }, { key: "projectNodes", value: function projectNodes(parentElement, nodes) { for (var i = 0; i < nodes.length; i++) { this.delegate.appendChild(parentElement, nodes[i]); } } /** * @param {?} node * @param {?} viewRootNodes * @return {?} */ }, { key: "attachViewAfter", value: function attachViewAfter(node, viewRootNodes) { /** @type {?} */ var parentElement = this.delegate.parentNode(node); /** @type {?} */ var nextSibling = this.delegate.nextSibling(node); for (var i = 0; i < viewRootNodes.length; i++) { this.delegate.insertBefore(parentElement, viewRootNodes[i], nextSibling); } } /** * @param {?} viewRootNodes * @return {?} */ }, { key: "detachView", value: function detachView(viewRootNodes) { for (var i = 0; i < viewRootNodes.length; i++) { /** @type {?} */ var node = viewRootNodes[i]; /** @type {?} */ var parentElement = this.delegate.parentNode(node); this.delegate.removeChild(parentElement, node); } } /** * @param {?} hostElement * @param {?} viewAllNodes * @return {?} */ }, { key: "destroyView", value: function destroyView(hostElement, viewAllNodes) { for (var i = 0; i < viewAllNodes.length; i++) { /** @type {?} */ this.delegate.destroyNode(viewAllNodes[i]); } } /** * @param {?} renderElement * @param {?} name * @param {?} callback * @return {?} */ }, { key: "listen", value: function listen(renderElement, name, callback) { return this.delegate.listen(renderElement, name, /** @type {?} */ callback); } /** * @param {?} target * @param {?} name * @param {?} callback * @return {?} */ }, { key: "listenGlobal", value: function listenGlobal(target, name, callback) { return this.delegate.listen(target, name, /** @type {?} */ callback); } /** * @param {?} renderElement * @param {?} propertyName * @param {?} propertyValue * @return {?} */ }, { key: "setElementProperty", value: function setElementProperty(renderElement, propertyName, propertyValue) { this.delegate.setProperty(renderElement, propertyName, propertyValue); } /** * @param {?} renderElement * @param {?} namespaceAndName * @param {?=} attributeValue * @return {?} */ }, { key: "setElementAttribute", value: function setElementAttribute(renderElement, namespaceAndName, attributeValue) { var _splitNamespace3 = splitNamespace(namespaceAndName), _splitNamespace4 = _slicedToArray(_splitNamespace3, 2), ns = _splitNamespace4[0], name = _splitNamespace4[1]; if (attributeValue != null) { this.delegate.setAttribute(renderElement, name, attributeValue, ns); } else { this.delegate.removeAttribute(renderElement, name, ns); } } /** * @param {?} renderElement * @param {?} propertyName * @param {?} propertyValue * @return {?} */ }, { key: "setBindingDebugInfo", value: function setBindingDebugInfo(renderElement, propertyName, propertyValue) {} /** * @param {?} renderElement * @param {?} className * @param {?} isAdd * @return {?} */ }, { key: "setElementClass", value: function setElementClass(renderElement, className, isAdd) { if (isAdd) { this.delegate.addClass(renderElement, className); } else { this.delegate.removeClass(renderElement, className); } } /** * @param {?} renderElement * @param {?} styleName * @param {?=} styleValue * @return {?} */ }, { key: "setElementStyle", value: function setElementStyle(renderElement, styleName, styleValue) { if (styleValue != null) { this.delegate.setStyle(renderElement, styleName, styleValue); } else { this.delegate.removeStyle(renderElement, styleName); } } /** * @param {?} renderElement * @param {?} methodName * @param {?} args * @return {?} */ }, { key: "invokeElementMethod", value: function invokeElementMethod(renderElement, methodName, args) { /** @type {?} */ renderElement[methodName].apply(renderElement, args); } /** * @param {?} renderNode * @param {?} text * @return {?} */ }, { key: "setText", value: function setText(renderNode, text) { this.delegate.setValue(renderNode, text); } /** * @return {?} */ }, { key: "animate", value: function animate() { throw new Error('Renderer.animate is no longer supported!'); } }]); return RendererAdapter; }(); if (false) {} /** * @param {?} moduleType * @param {?} parent * @param {?} bootstrapComponents * @param {?} def * @return {?} */ function createNgModuleRef(moduleType, parent, bootstrapComponents, def) { return new NgModuleRef_(moduleType, parent, bootstrapComponents, def); } var NgModuleRef_ = /*#__PURE__*/function () { /** * @param {?} _moduleType * @param {?} _parent * @param {?} _bootstrapComponents * @param {?} _def */ function NgModuleRef_(_moduleType, _parent, _bootstrapComponents, _def) { _classCallCheck(this, NgModuleRef_); this._moduleType = _moduleType; this._parent = _parent; this._bootstrapComponents = _bootstrapComponents; this._def = _def; this._destroyListeners = []; this._destroyed = false; this.injector = this; initNgModule(this); } /** * @param {?} token * @param {?=} notFoundValue * @param {?=} injectFlags * @return {?} */ _createClass2(NgModuleRef_, [{ key: "get", value: function get(token) { var notFoundValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Injector.THROW_IF_NOT_FOUND; var injectFlags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : InjectFlags.Default; /** @type {?} */ var flags = 0 /* None */ ; if (injectFlags & InjectFlags.SkipSelf) { flags |= 1 /* SkipSelf */ ; } else if (injectFlags & InjectFlags.Self) { flags |= 4 /* Self */ ; } return resolveNgModuleDep(this, { token: token, tokenKey: tokenKey(token), flags: flags }, notFoundValue); } /** * @return {?} */ }, { key: "destroy", /** * @return {?} */ value: function destroy() { if (this._destroyed) { throw new Error("The ng module ".concat(stringify(this.instance.constructor), " has already been destroyed.")); } this._destroyed = true; callNgModuleLifecycle(this, 131072 /* OnDestroy */ ); this._destroyListeners.forEach( /** * @param {?} listener * @return {?} */ function (listener) { return listener(); }); } /** * @param {?} callback * @return {?} */ }, { key: "onDestroy", value: function onDestroy(callback) { this._destroyListeners.push(callback); } }, { key: "instance", get: function get() { return this.get(this._moduleType); } /** * @return {?} */ }, { key: "componentFactoryResolver", get: function get() { return this.get(ComponentFactoryResolver); } }]); return NgModuleRef_; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var RendererV1TokenKey = tokenKey(Renderer); /** @type {?} */ var Renderer2TokenKey = tokenKey(Renderer2); /** @type {?} */ var ElementRefTokenKey = tokenKey(ElementRef); /** @type {?} */ var ViewContainerRefTokenKey = tokenKey(ViewContainerRef); /** @type {?} */ var TemplateRefTokenKey = tokenKey(TemplateRef); /** @type {?} */ var ChangeDetectorRefTokenKey = tokenKey(ChangeDetectorRef); /** @type {?} */ var InjectorRefTokenKey$1 = tokenKey(Injector); /** @type {?} */ var INJECTORRefTokenKey$1 = tokenKey(INJECTOR); /** * @param {?} checkIndex * @param {?} flags * @param {?} matchedQueries * @param {?} childCount * @param {?} ctor * @param {?} deps * @param {?=} props * @param {?=} outputs * @return {?} */ function directiveDef(checkIndex, flags, matchedQueries, childCount, ctor, deps, props, outputs) { /** @type {?} */ var bindings = []; if (props) { for (var prop in props) { var _props$prop = _slicedToArray(props[prop], 2), bindingIndex = _props$prop[0], nonMinifiedName = _props$prop[1]; bindings[bindingIndex] = { flags: 8 /* TypeProperty */ , name: prop, nonMinifiedName: nonMinifiedName, ns: null, securityContext: null, suffix: null }; } } /** @type {?} */ var outputDefs = []; if (outputs) { for (var propName in outputs) { outputDefs.push({ type: 1 /* DirectiveOutput */ , propName: propName, target: null, eventName: outputs[propName] }); } } flags |= 16384 /* TypeDirective */ ; return _def(checkIndex, flags, matchedQueries, childCount, ctor, ctor, deps, bindings, outputDefs); } /** * @param {?} flags * @param {?} ctor * @param {?} deps * @return {?} */ function pipeDef(flags, ctor, deps) { flags |= 16 /* TypePipe */ ; return _def(-1, flags, null, 0, ctor, ctor, deps); } /** * @param {?} flags * @param {?} matchedQueries * @param {?} token * @param {?} value * @param {?} deps * @return {?} */ function providerDef(flags, matchedQueries, token, value, deps) { return _def(-1, flags, matchedQueries, 0, token, value, deps); } /** * @param {?} checkIndex * @param {?} flags * @param {?} matchedQueriesDsl * @param {?} childCount * @param {?} token * @param {?} value * @param {?} deps * @param {?=} bindings * @param {?=} outputs * @return {?} */ function _def(checkIndex, flags, matchedQueriesDsl, childCount, token, value, deps, bindings, outputs) { var _splitMatchedQueriesD = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _splitMatchedQueriesD.matchedQueries, references = _splitMatchedQueriesD.references, matchedQueryIds = _splitMatchedQueriesD.matchedQueryIds; if (!outputs) { outputs = []; } if (!bindings) { bindings = []; } // Need to resolve forwardRefs as e.g. for `useValue` we // lowered the expression and then stopped evaluating it, // i.e. also didn't unwrap it. value = resolveForwardRef(value); /** @type {?} */ var depDefs = splitDepsDsl(deps, stringify(token)); return { // will bet set by the view definition nodeIndex: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values checkIndex: checkIndex, flags: flags, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: -1, childCount: childCount, bindings: bindings, bindingFlags: calcBindingFlags(bindings), outputs: outputs, element: null, provider: { token: token, value: value, deps: depDefs }, text: null, query: null, ngContent: null }; } /** * @param {?} view * @param {?} def * @return {?} */ function createProviderInstance(view, def) { return _createProviderInstance$1(view, def); } /** * @param {?} view * @param {?} def * @return {?} */ function createPipeInstance(view, def) { // deps are looked up from component. /** @type {?} */ var compView = view; while (compView.parent && !isComponentView(compView)) { compView = compView.parent; } // pipes can see the private services of the component /** @type {?} */ var allowPrivateServices = true; // pipes are always eager and classes! return createClass( /** @type {?} */ compView.parent, /** @type {?} */ viewParentEl(compView), allowPrivateServices, /** @type {?} */ def.provider.value, /** @type {?} */ def.provider.deps); } /** * @param {?} view * @param {?} def * @return {?} */ function createDirectiveInstance(view, def) { // components can see other private services, other directives can't. /** @type {?} */ var allowPrivateServices = (def.flags & 32768 /* Component */ ) > 0; // directives are always eager and classes! /** @type {?} */ var instance = createClass(view, /** @type {?} */ def.parent, allowPrivateServices, /** @type {?} */ def.provider.value, /** @type {?} */ def.provider.deps); if (def.outputs.length) { for (var i = 0; i < def.outputs.length; i++) { /** @type {?} */ var output = def.outputs[i]; /** @type {?} */ var outputObservable = instance[ /** @type {?} */ output.propName]; if (isObservable(outputObservable)) { /** @type {?} */ var subscription = outputObservable.subscribe(eventHandlerClosure(view, /** @type {?} */ def.parent.nodeIndex, output.eventName)); /** @type {?} */ view.disposables[def.outputIndex + i] = subscription.unsubscribe.bind(subscription); } else { throw new Error("@Output ".concat(output.propName, " not initialized in '").concat(instance.constructor.name, "'.")); } } } return instance; } /** * @param {?} view * @param {?} index * @param {?} eventName * @return {?} */ function eventHandlerClosure(view, index, eventName) { return ( /** * @param {?} event * @return {?} */ function (event) { return dispatchEvent(view, index, eventName, event); } ); } /** * @param {?} view * @param {?} def * @param {?} v0 * @param {?} v1 * @param {?} v2 * @param {?} v3 * @param {?} v4 * @param {?} v5 * @param {?} v6 * @param {?} v7 * @param {?} v8 * @param {?} v9 * @return {?} */ function checkAndUpdateDirectiveInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { /** @type {?} */ var providerData = asProviderData(view, def.nodeIndex); /** @type {?} */ var directive = providerData.instance; /** @type {?} */ var changed = false; /** @type {?} */ var changes = /** @type {?} */ undefined; /** @type {?} */ var bindLen = def.bindings.length; if (bindLen > 0 && checkBinding(view, def, 0, v0)) { changed = true; changes = updateProp(view, providerData, def, 0, v0, changes); } if (bindLen > 1 && checkBinding(view, def, 1, v1)) { changed = true; changes = updateProp(view, providerData, def, 1, v1, changes); } if (bindLen > 2 && checkBinding(view, def, 2, v2)) { changed = true; changes = updateProp(view, providerData, def, 2, v2, changes); } if (bindLen > 3 && checkBinding(view, def, 3, v3)) { changed = true; changes = updateProp(view, providerData, def, 3, v3, changes); } if (bindLen > 4 && checkBinding(view, def, 4, v4)) { changed = true; changes = updateProp(view, providerData, def, 4, v4, changes); } if (bindLen > 5 && checkBinding(view, def, 5, v5)) { changed = true; changes = updateProp(view, providerData, def, 5, v5, changes); } if (bindLen > 6 && checkBinding(view, def, 6, v6)) { changed = true; changes = updateProp(view, providerData, def, 6, v6, changes); } if (bindLen > 7 && checkBinding(view, def, 7, v7)) { changed = true; changes = updateProp(view, providerData, def, 7, v7, changes); } if (bindLen > 8 && checkBinding(view, def, 8, v8)) { changed = true; changes = updateProp(view, providerData, def, 8, v8, changes); } if (bindLen > 9 && checkBinding(view, def, 9, v9)) { changed = true; changes = updateProp(view, providerData, def, 9, v9, changes); } if (changes) { directive.ngOnChanges(changes); } if (def.flags & 65536 /* OnInit */ && shouldCallLifecycleInitHook(view, 256 /* InitState_CallingOnInit */ , def.nodeIndex)) { directive.ngOnInit(); } if (def.flags & 262144 /* DoCheck */ ) { directive.ngDoCheck(); } return changed; } /** * @param {?} view * @param {?} def * @param {?} values * @return {?} */ function checkAndUpdateDirectiveDynamic(view, def, values) { /** @type {?} */ var providerData = asProviderData(view, def.nodeIndex); /** @type {?} */ var directive = providerData.instance; /** @type {?} */ var changed = false; /** @type {?} */ var changes = /** @type {?} */ undefined; for (var i = 0; i < values.length; i++) { if (checkBinding(view, def, i, values[i])) { changed = true; changes = updateProp(view, providerData, def, i, values[i], changes); } } if (changes) { directive.ngOnChanges(changes); } if (def.flags & 65536 /* OnInit */ && shouldCallLifecycleInitHook(view, 256 /* InitState_CallingOnInit */ , def.nodeIndex)) { directive.ngOnInit(); } if (def.flags & 262144 /* DoCheck */ ) { directive.ngDoCheck(); } return changed; } /** * @param {?} view * @param {?} def * @return {?} */ function _createProviderInstance$1(view, def) { // private services can see other private services /** @type {?} */ var allowPrivateServices = (def.flags & 8192 /* PrivateProvider */ ) > 0; /** @type {?} */ var providerDef = def.provider; switch (def.flags & 201347067 /* Types */ ) { case 512 /* TypeClassProvider */ : return createClass(view, /** @type {?} */ def.parent, allowPrivateServices, /** @type {?} */ providerDef.value, /** @type {?} */ providerDef.deps); case 1024 /* TypeFactoryProvider */ : return callFactory(view, /** @type {?} */ def.parent, allowPrivateServices, /** @type {?} */ providerDef.value, /** @type {?} */ providerDef.deps); case 2048 /* TypeUseExistingProvider */ : return resolveDep(view, /** @type {?} */ def.parent, allowPrivateServices, /** @type {?} */ providerDef.deps[0]); case 256 /* TypeValueProvider */ : return ( /** @type {?} */ providerDef.value ); } } /** * @param {?} view * @param {?} elDef * @param {?} allowPrivateServices * @param {?} ctor * @param {?} deps * @return {?} */ function createClass(view, elDef, allowPrivateServices, ctor, deps) { /** @type {?} */ var len = deps.length; switch (len) { case 0: return new ctor(); case 1: return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0])); case 2: return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1])); case 3: return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2])); default: /** @type {?} */ var depValues = new Array(len); for (var i = 0; i < len; i++) { depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]); } return _construct(ctor, depValues); } } /** * @param {?} view * @param {?} elDef * @param {?} allowPrivateServices * @param {?} factory * @param {?} deps * @return {?} */ function callFactory(view, elDef, allowPrivateServices, factory, deps) { /** @type {?} */ var len = deps.length; switch (len) { case 0: return factory(); case 1: return factory(resolveDep(view, elDef, allowPrivateServices, deps[0])); case 2: return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1])); case 3: return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2])); default: /** @type {?} */ var depValues = Array(len); for (var i = 0; i < len; i++) { depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]); } return factory.apply(void 0, depValues); } } // This default value is when checking the hierarchy for a token. // // It means both: // - the token is not provided by the current injector, // - only the element injectors should be checked (ie do not check module injectors // // mod1 // / // el1 mod2 // \ / // el2 // // When requesting el2.injector.get(token), we should check in the following order and return the // first found value: // - el2.injector.get(token, default) // - el1.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) -> do not check the module // - mod2.injector.get(token, default) /** @type {?} */ var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {}; /** * @param {?} view * @param {?} elDef * @param {?} allowPrivateServices * @param {?} depDef * @param {?=} notFoundValue * @return {?} */ function resolveDep(view, elDef, allowPrivateServices, depDef) { var notFoundValue = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : Injector.THROW_IF_NOT_FOUND; if (depDef.flags & 8 /* Value */ ) { return depDef.token; } /** @type {?} */ var startView = view; if (depDef.flags & 2 /* Optional */ ) { notFoundValue = null; } /** @type {?} */ var tokenKey = depDef.tokenKey; if (tokenKey === ChangeDetectorRefTokenKey) { // directives on the same element as a component should be able to control the change detector // of that component as well. allowPrivateServices = !!(elDef && /** @type {?} */ elDef.element.componentView); } if (elDef && depDef.flags & 1 /* SkipSelf */ ) { allowPrivateServices = false; elDef = /** @type {?} */ elDef.parent; } /** @type {?} */ var searchView = view; while (searchView) { if (elDef) { switch (tokenKey) { case RendererV1TokenKey: { /** @type {?} */ var compView = findCompView(searchView, elDef, allowPrivateServices); return createRendererV1(compView); } case Renderer2TokenKey: { /** @type {?} */ var _compView = findCompView(searchView, elDef, allowPrivateServices); return _compView.renderer; } case ElementRefTokenKey: return new ElementRef(asElementData(searchView, elDef.nodeIndex).renderElement); case ViewContainerRefTokenKey: return asElementData(searchView, elDef.nodeIndex).viewContainer; case TemplateRefTokenKey: { if ( /** @type {?} */ elDef.element.template) { return asElementData(searchView, elDef.nodeIndex).template; } break; } case ChangeDetectorRefTokenKey: { /** @type {?} */ var cdView = findCompView(searchView, elDef, allowPrivateServices); return createChangeDetectorRef(cdView); } case InjectorRefTokenKey$1: case INJECTORRefTokenKey$1: return createInjector$1(searchView, elDef); default: /** @type {?} */ var _providerDef3 = ( /** @type {?} */ allowPrivateServices ? /** @type {?} */ elDef.element.allProviders : /** @type {?} */ elDef.element.publicProviders)[tokenKey]; if (_providerDef3) { /** @type {?} */ var providerData = asProviderData(searchView, _providerDef3.nodeIndex); if (!providerData) { providerData = { instance: _createProviderInstance$1(searchView, _providerDef3) }; searchView.nodes[_providerDef3.nodeIndex] = /** @type {?} */ providerData; } return providerData.instance; } } } allowPrivateServices = isComponentView(searchView); elDef = /** @type {?} */ viewParentEl(searchView); searchView = /** @type {?} */ searchView.parent; if (depDef.flags & 4 /* Self */ ) { searchView = null; } } /** @type {?} */ var value = startView.root.injector.get(depDef.token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR); if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR || notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) { // Return the value from the root element injector when // - it provides it // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) // - the module injector should not be checked // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) return value; } return startView.root.ngModule.injector.get(depDef.token, notFoundValue); } /** * @param {?} view * @param {?} elDef * @param {?} allowPrivateServices * @return {?} */ function findCompView(view, elDef, allowPrivateServices) { /** @type {?} */ var compView; if (allowPrivateServices) { compView = asElementData(view, elDef.nodeIndex).componentView; } else { compView = view; while (compView.parent && !isComponentView(compView)) { compView = compView.parent; } } return compView; } /** * @param {?} view * @param {?} providerData * @param {?} def * @param {?} bindingIdx * @param {?} value * @param {?} changes * @return {?} */ function updateProp(view, providerData, def, bindingIdx, value, changes) { if (def.flags & 32768 /* Component */ ) { /** @type {?} */ var compView = asElementData(view, /** @type {?} */ def.parent.nodeIndex).componentView; if (compView.def.flags & 2 /* OnPush */ ) { compView.state |= 8 /* ChecksEnabled */ ; } } /** @type {?} */ var binding = def.bindings[bindingIdx]; /** @type {?} */ var propName = /** @type {?} */ binding.name; // Note: This is still safe with Closure Compiler as // the user passed in the property name as an object has to `providerDef`, // so Closure Compiler will have renamed the property correctly already. providerData.instance[propName] = value; if (def.flags & 524288 /* OnChanges */ ) { changes = changes || {}; /** @type {?} */ var oldValue = WrappedValue.unwrap(view.oldValues[def.bindingIndex + bindingIdx]); /** @type {?} */ var _binding = def.bindings[bindingIdx]; changes[ /** @type {?} */ _binding.nonMinifiedName] = new SimpleChange(oldValue, value, (view.state & 2 /* FirstCheck */ ) !== 0); } view.oldValues[def.bindingIndex + bindingIdx] = value; return changes; } // This function calls the ngAfterContentCheck, ngAfterContentInit, // ngAfterViewCheck, and ngAfterViewInit lifecycle hooks (depending on the node // flags in lifecycle). Unlike ngDoCheck, ngOnChanges and ngOnInit, which are // called during a pre-order traversal of the view tree (that is calling the // parent hooks before the child hooks) these events are sent in using a // post-order traversal of the tree (children before parents). This changes the // meaning of initIndex in the view state. For ngOnInit, initIndex tracks the // expected nodeIndex which a ngOnInit should be called. When sending // ngAfterContentInit and ngAfterViewInit it is the expected count of // ngAfterContentInit or ngAfterViewInit methods that have been called. This // ensure that despite being called recursively or after picking up after an // exception, the ngAfterContentInit or ngAfterViewInit will be called on the // correct nodes. Consider for example, the following (where E is an element // and D is a directive) // Tree: pre-order index post-order index // E1 0 6 // E2 1 1 // D3 2 0 // E4 3 5 // E5 4 4 // E6 5 2 // E7 6 3 // As can be seen, the post-order index has an unclear relationship to the // pre-order index (postOrderIndex === preOrderIndex - parentCount + // childCount). Since number of calls to ngAfterContentInit and ngAfterViewInit // are stable (will be the same for the same view regardless of exceptions or // recursion) we just need to count them which will roughly correspond to the // post-order index (it skips elements and directives that do not have // lifecycle hooks). // // For example, if an exception is raised in the E6.onAfterViewInit() the // initIndex is left at 3 (by shouldCallLifecycleInitHook() which set it to // initIndex + 1). When checkAndUpdateView() is called again D3, E2 and E6 will // not have their ngAfterViewInit() called but, starting with E7, the rest of // the view will begin getting ngAfterViewInit() called until a check and // pass is complete. // // This algorthim also handles recursion. Consider if E4's ngAfterViewInit() // indirectly calls E1's ChangeDetectorRef.detectChanges(). The expected // initIndex is set to 6, the recusive checkAndUpdateView() starts walk again. // D3, E2, E6, E7, E5 and E4 are skipped, ngAfterViewInit() is called on E1. // When the recursion returns the initIndex will be 7 so E1 is skipped as it // has already been called in the recursively called checkAnUpdateView(). /** * @param {?} view * @param {?} lifecycles * @return {?} */ function callLifecycleHooksChildrenFirst(view, lifecycles) { if (!(view.def.nodeFlags & lifecycles)) { return; } /** @type {?} */ var nodes = view.def.nodes; /** @type {?} */ var initIndex = 0; for (var i = 0; i < nodes.length; i++) { /** @type {?} */ var nodeDef = nodes[i]; /** @type {?} */ var parent = nodeDef.parent; if (!parent && nodeDef.flags & lifecycles) { // matching root node (e.g. a pipe) callProviderLifecycles(view, i, nodeDef.flags & lifecycles, initIndex++); } if ((nodeDef.childFlags & lifecycles) === 0) { // no child matches one of the lifecycles i += nodeDef.childCount; } while (parent && parent.flags & 1 /* TypeElement */ && i === parent.nodeIndex + parent.childCount) { // last child of an element if (parent.directChildFlags & lifecycles) { initIndex = callElementProvidersLifecycles(view, parent, lifecycles, initIndex); } parent = parent.parent; } } } /** * @param {?} view * @param {?} elDef * @param {?} lifecycles * @param {?} initIndex * @return {?} */ function callElementProvidersLifecycles(view, elDef, lifecycles, initIndex) { for (var i = elDef.nodeIndex + 1; i <= elDef.nodeIndex + elDef.childCount; i++) { /** @type {?} */ var nodeDef = view.def.nodes[i]; if (nodeDef.flags & lifecycles) { callProviderLifecycles(view, i, nodeDef.flags & lifecycles, initIndex++); } // only visit direct children i += nodeDef.childCount; } return initIndex; } /** * @param {?} view * @param {?} index * @param {?} lifecycles * @param {?} initIndex * @return {?} */ function callProviderLifecycles(view, index, lifecycles, initIndex) { /** @type {?} */ var providerData = asProviderData(view, index); if (!providerData) { return; } /** @type {?} */ var provider = providerData.instance; if (!provider) { return; } Services.setCurrentNode(view, index); if (lifecycles & 1048576 /* AfterContentInit */ && shouldCallLifecycleInitHook(view, 512 /* InitState_CallingAfterContentInit */ , initIndex)) { provider.ngAfterContentInit(); } if (lifecycles & 2097152 /* AfterContentChecked */ ) { provider.ngAfterContentChecked(); } if (lifecycles & 4194304 /* AfterViewInit */ && shouldCallLifecycleInitHook(view, 768 /* InitState_CallingAfterViewInit */ , initIndex)) { provider.ngAfterViewInit(); } if (lifecycles & 8388608 /* AfterViewChecked */ ) { provider.ngAfterViewChecked(); } if (lifecycles & 131072 /* OnDestroy */ ) { provider.ngOnDestroy(); } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ComponentFactoryResolver$1 = /*#__PURE__*/function (_ComponentFactoryReso) { _inherits(ComponentFactoryResolver$1, _ComponentFactoryReso); var _super115 = _createSuper(ComponentFactoryResolver$1); /** * @param {?=} ngModule The NgModuleRef to which all resolved factories are bound. */ function ComponentFactoryResolver$1(ngModule) { var _this334; _classCallCheck(this, ComponentFactoryResolver$1); _this334 = _super115.call(this); _this334.ngModule = ngModule; return _this334; } /** * @template T * @param {?} component * @return {?} */ _createClass2(ComponentFactoryResolver$1, [{ key: "resolveComponentFactory", value: function resolveComponentFactory(component) { ngDevMode && assertComponentType(component); /** @type {?} */ var componentDef = /** @type {?} */ getComponentDef(component); return new ComponentFactory$1(componentDef, this.ngModule); } }]); return ComponentFactoryResolver$1; }(ComponentFactoryResolver); if (false) {} /** * @param {?} map * @return {?} */ function toRefArray(map) { /** @type {?} */ var array = []; for (var nonMinified in map) { if (map.hasOwnProperty(nonMinified)) { /** @type {?} */ var minified = map[nonMinified]; array.push({ propName: minified, templateName: nonMinified }); } } return array; } /** * A change detection scheduler token for {\@link RootContext}. This token is the default value used * for the default `RootContext` found in the {\@link ROOT_CONTEXT} token. * @type {?} */ var SCHEDULER = new InjectionToken('SCHEDULER_TOKEN', { providedIn: 'root', factory: /** * @return {?} */ function factory() { return defaultScheduler; } }); /** * @param {?} rootViewInjector * @param {?} moduleInjector * @return {?} */ function createChainedInjector(rootViewInjector, moduleInjector) { return { get: /** * @template T * @param {?} token * @param {?=} notFoundValue * @param {?=} flags * @return {?} */ function get(token, notFoundValue, flags) { /** @type {?} */ var value = rootViewInjector.get(token, /** @type {?} */ NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags); if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR || notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) { // Return the value from the root element injector when // - it provides it // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) // - the module injector should not be checked // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) return value; } return moduleInjector.get(token, notFoundValue, flags); } }; } /** * Render3 implementation of {\@link viewEngine_ComponentFactory}. * @template T */ var ComponentFactory$1 = /*#__PURE__*/function (_ComponentFactory3) { _inherits(ComponentFactory$1, _ComponentFactory3); var _super116 = _createSuper(ComponentFactory$1); /** * @param {?} componentDef The component definition. * @param {?=} ngModule The NgModuleRef to which the factory is bound. */ function ComponentFactory$1(componentDef, ngModule) { var _this335; _classCallCheck(this, ComponentFactory$1); _this335 = _super116.call(this); _this335.componentDef = componentDef; _this335.ngModule = ngModule; _this335.componentType = componentDef.type; // default to 'div' in case this component has an attribute selector _this335.selector = /** @type {?} */ componentDef.selectors[0][0] || 'div'; _this335.ngContentSelectors = componentDef.ngContentSelectors ? componentDef.ngContentSelectors : []; _this335.isBoundToModule = !!ngModule; return _this335; } /** * @return {?} */ _createClass2(ComponentFactory$1, [{ key: "create", /** * @param {?} injector * @param {?=} projectableNodes * @param {?=} rootSelectorOrNode * @param {?=} ngModule * @return {?} */ value: function create(injector, projectableNodes, rootSelectorOrNode, ngModule) { ngModule = ngModule || this.ngModule; /** @type {?} */ var rootViewInjector = ngModule ? createChainedInjector(injector, ngModule.injector) : injector; /** @type {?} */ var rendererFactory = /** @type {?} */ rootViewInjector.get(RendererFactory2, domRendererFactory3); /** @type {?} */ var sanitizer = rootViewInjector.get(Sanitizer, null); // Ensure that the namespace for the root node is correct, // otherwise the browser might not render out the element properly. namespaceHTMLInternal(); /** @type {?} */ var hostRNode = rootSelectorOrNode ? locateHostElement(rendererFactory, rootSelectorOrNode) : elementCreate(this.selector, rendererFactory.createRenderer(null, this.componentDef)); /** @type {?} */ var rootFlags = this.componentDef.onPush ? 64 /* Dirty */ | 512 /* IsRoot */ : 16 /* CheckAlways */ | 512 /* IsRoot */ ; // Check whether this Component needs to be isolated from other components, i.e. whether it // should be placed into its own (empty) root context or existing root context should be used. // Note: this is internal-only convention and might change in the future, so it should not be // relied upon externally. /** @type {?} */ var isIsolated = typeof rootSelectorOrNode === 'string' && /^#root-ng-internal-isolated-\d+/.test(rootSelectorOrNode); /** @type {?} */ var rootContext = createRootContext(); /** @type {?} */ var renderer = rendererFactory.createRenderer(hostRNode, this.componentDef); if (rootSelectorOrNode && hostRNode) { ngDevMode && ngDevMode.rendererSetAttribute++; isProceduralRenderer(renderer) ? renderer.setAttribute(hostRNode, 'ng-version', VERSION.full) : hostRNode.setAttribute('ng-version', VERSION.full); } // Create the root view. Uses empty TView and ContentTemplate. /** @type {?} */ var rootLView = createLView(null, createTView(-1, null, 1, 0, null, null, null, null), rootContext, rootFlags, null, null, rendererFactory, renderer, sanitizer, rootViewInjector); // rootView is the parent when bootstrapping /** @type {?} */ var oldLView = enterView(rootLView, null); /** @type {?} */ var component; /** @type {?} */ var tElementNode; // Will become true if the `try` block executes with no errors. /** @type {?} */ var safeToRunHooks = false; try { /** @type {?} */ var componentView = createRootComponentView(hostRNode, this.componentDef, rootLView, rendererFactory, renderer); tElementNode = /** @type {?} */ getTNode(0, rootLView); if (projectableNodes) { // projectable nodes can be passed as array of arrays or an array of iterables (ngUpgrade // case). Here we do normalize passed data structure to be an array of arrays to avoid // complex checks down the line. tElementNode.projection = projectableNodes.map( /** * @param {?} nodesforSlot * @return {?} */ function (nodesforSlot) { return Array.from(nodesforSlot); }); } // TODO: should LifecycleHooksFeature and other host features be generated by the compiler and // executed here? // Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref component = createRootComponent(componentView, this.componentDef, rootLView, rootContext, [LifecycleHooksFeature]); addToViewTree(rootLView, componentView); refreshDescendantViews(rootLView); safeToRunHooks = true; } finally { leaveView(oldLView, safeToRunHooks); } /** @type {?} */ var componentRef = new ComponentRef$1(this.componentType, component, createElementRef(ElementRef, tElementNode, rootLView), rootLView, tElementNode); if (!rootSelectorOrNode || isIsolated) { // The host element of the internal or isolated root view is attached to the component's host // view node. /** @type {?} */ componentRef.hostView._tViewNode.child = tElementNode; } return componentRef; } }, { key: "inputs", get: function get() { return toRefArray(this.componentDef.inputs); } /** * @return {?} */ }, { key: "outputs", get: function get() { return toRefArray(this.componentDef.outputs); } }]); return ComponentFactory$1; }(ComponentFactory); if (false) {} /** @type {?} */ var componentFactoryResolver = new ComponentFactoryResolver$1(); /** * Creates a ComponentFactoryResolver and stores it on the injector. Or, if the * ComponentFactoryResolver * already exists, retrieves the existing ComponentFactoryResolver. * * @return {?} The ComponentFactoryResolver instance to use */ function injectComponentFactoryResolver() { return componentFactoryResolver; } /** * Represents an instance of a Component created via a {\@link ComponentFactory}. * * `ComponentRef` provides access to the Component Instance as well other objects related to this * Component Instance and allows you to destroy the Component Instance via the {\@link #destroy} * method. * * @template T */ var ComponentRef$1 = /*#__PURE__*/function (_ComponentRef2) { _inherits(ComponentRef$1, _ComponentRef2); var _super117 = _createSuper(ComponentRef$1); /** * @param {?} componentType * @param {?} instance * @param {?} location * @param {?} _rootLView * @param {?} _tNode */ function ComponentRef$1(componentType, instance, location, _rootLView, _tNode) { var _this336; _classCallCheck(this, ComponentRef$1); _this336 = _super117.call(this); _this336.location = location; _this336._rootLView = _rootLView; _this336._tNode = _tNode; _this336.destroyCbs = []; _this336.instance = instance; _this336.hostView = _this336.changeDetectorRef = new RootViewRef(_rootLView); _this336.hostView._tViewNode = assignTViewNodeToLView(_rootLView[TVIEW], null, -1, _rootLView); _this336.componentType = componentType; return _this336; } /** * @return {?} */ _createClass2(ComponentRef$1, [{ key: "destroy", /** * @return {?} */ value: function destroy() { if (this.destroyCbs) { this.destroyCbs.forEach( /** * @param {?} fn * @return {?} */ function (fn) { return fn(); }); this.destroyCbs = null; !this.hostView.destroyed && this.hostView.destroy(); } } /** * @param {?} callback * @return {?} */ }, { key: "onDestroy", value: function onDestroy(callback) { if (this.destroyCbs) { this.destroyCbs.push(callback); } } }, { key: "injector", get: function get() { return new NodeInjector(this._tNode, this._rootLView); } }]); return ComponentRef$1; }(ComponentRef); if (false) {} /** * @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 */ /** * NOTE: changes to the `ngI18nClosureMode` name must be synced with `compiler-cli/src/tooling.ts`. */ if (typeof ngI18nClosureMode === 'undefined') { // These property accesses can be ignored because ngI18nClosureMode will be set to false // when optimizing code and the whole if statement will be dropped. // Make sure to refer to ngI18nClosureMode as ['ngI18nClosureMode'] for closure. // NOTE: we need to have it in IIFE so that the tree-shaker is happy. (function () { // tslint:disable-next-line:no-toplevel-property-access _global['ngI18nClosureMode'] = // TODO(FW-1250): validate that this actually, you know, works. // tslint:disable-next-line:no-toplevel-property-access typeof goog !== 'undefined' && typeof goog.getMsg === 'function'; })(); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 const is used to store the locale data registered with `registerLocaleData` * @type {?} */ var LOCALE_DATA = {}; /** @enum {number} */ var LocaleDataIndex = { LocaleId: 0, DayPeriodsFormat: 1, DayPeriodsStandalone: 2, DaysFormat: 3, DaysStandalone: 4, MonthsFormat: 5, MonthsStandalone: 6, Eras: 7, FirstDayOfWeek: 8, WeekendRange: 9, DateFormat: 10, TimeFormat: 11, DateTimeFormat: 12, NumberSymbols: 13, NumberFormats: 14, CurrencySymbol: 15, CurrencyName: 16, Currencies: 17, PluralCase: 18, ExtraData: 19 }; LocaleDataIndex[LocaleDataIndex.LocaleId] = 'LocaleId'; LocaleDataIndex[LocaleDataIndex.DayPeriodsFormat] = 'DayPeriodsFormat'; LocaleDataIndex[LocaleDataIndex.DayPeriodsStandalone] = 'DayPeriodsStandalone'; LocaleDataIndex[LocaleDataIndex.DaysFormat] = 'DaysFormat'; LocaleDataIndex[LocaleDataIndex.DaysStandalone] = 'DaysStandalone'; LocaleDataIndex[LocaleDataIndex.MonthsFormat] = 'MonthsFormat'; LocaleDataIndex[LocaleDataIndex.MonthsStandalone] = 'MonthsStandalone'; LocaleDataIndex[LocaleDataIndex.Eras] = 'Eras'; LocaleDataIndex[LocaleDataIndex.FirstDayOfWeek] = 'FirstDayOfWeek'; LocaleDataIndex[LocaleDataIndex.WeekendRange] = 'WeekendRange'; LocaleDataIndex[LocaleDataIndex.DateFormat] = 'DateFormat'; LocaleDataIndex[LocaleDataIndex.TimeFormat] = 'TimeFormat'; LocaleDataIndex[LocaleDataIndex.DateTimeFormat] = 'DateTimeFormat'; LocaleDataIndex[LocaleDataIndex.NumberSymbols] = 'NumberSymbols'; LocaleDataIndex[LocaleDataIndex.NumberFormats] = 'NumberFormats'; LocaleDataIndex[LocaleDataIndex.CurrencySymbol] = 'CurrencySymbol'; LocaleDataIndex[LocaleDataIndex.CurrencyName] = 'CurrencyName'; LocaleDataIndex[LocaleDataIndex.Currencies] = 'Currencies'; LocaleDataIndex[LocaleDataIndex.PluralCase] = 'PluralCase'; LocaleDataIndex[LocaleDataIndex.ExtraData] = 'ExtraData'; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js /** @type {?} */ var u = undefined; /** * @param {?} n * @return {?} */ function plural(n) { /** @type {?} */ var i = Math.floor(Math.abs(n)); /** @type {?} */ var v = n.toString().replace(/^[^.]*\.?/, '').length; if (i === 1 && v === 0) return 1; return 5; } var localeEn = ['en', [['a', 'p'], ['AM', 'PM'], u], [['AM', 'PM'], u, u], [['S', 'M', 'T', 'W', 'T', 'F', 'S'], ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']], u, [['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'], ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']], u, [['B', 'A'], ['BC', 'AD'], ['Before Christ', 'Anno Domini']], 0, [6, 0], ['M/d/yy', 'MMM d, y', 'MMMM d, y', 'EEEE, MMMM d, y'], ['h:mm a', 'h:mm:ss a', 'h:mm:ss a z', 'h:mm:ss a zzzz'], ['{1}, {0}', u, '{1} \'at\' {0}', u], ['.', ',', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'NaN', ':'], ['#,##0.###', '#,##0%', '¤#,##0.00', '#E0'], '$', 'US Dollar', {}, plural]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Retrieves the plural function used by ICU expressions to determine the plural case to use * for a given locale. * @see `NgPlural` / [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * @param {?} locale A locale code for the locale format rules to use. * @return {?} The plural function for the locale. */ function getLocalePluralCase(locale) { /** @type {?} */ var data = findLocaleData(locale); return data[LocaleDataIndex.PluralCase]; } /** * Finds the locale data for a given locale. * * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n) * @param {?} locale The locale code. * @return {?} The locale data. */ function findLocaleData(locale) { /** @type {?} */ var normalizedLocale = locale.toLowerCase().replace(/_/g, '-'); /** @type {?} */ var match = LOCALE_DATA[normalizedLocale]; if (match) { return match; } // let's try to find a parent locale /** @type {?} */ var parentLocale = normalizedLocale.split('-')[0]; match = LOCALE_DATA[parentLocale]; if (match) { return match; } if (parentLocale === 'en') { return localeEn; } throw new Error("Missing locale data for the locale \"".concat(locale, "\".")); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Returns the plural case based on the locale * @param {?} value * @param {?} locale * @return {?} */ function getPluralCase(value, locale) { /** @type {?} */ var plural = getLocalePluralCase(locale)(value); switch (plural) { case 0: return 'zero'; case 1: return 'one'; case 2: return 'two'; case 3: return 'few'; case 4: return 'many'; default: return 'other'; } } /** * The locale id that the application is using by default (for translations and ICU expressions). * @type {?} */ var DEFAULT_LOCALE_ID = 'en-US'; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var MARKER = "\uFFFD"; /** @type {?} */ var ICU_BLOCK_REGEXP = /^\s*(�\d+:?\d*�)\s*,\s*(select|plural)\s*,/; /** @type {?} */ var SUBTEMPLATE_REGEXP = /�\/?\*(\d+:\d+)�/gi; /** @type {?} */ var PH_REGEXP = /�(\/?[#*!]\d+):?\d*�/gi; /** @type {?} */ var BINDING_REGEXP = /�(\d+):?\d*�/gi; /** @type {?} */ var ICU_REGEXP = /({\s*�\d+:?\d*�\s*,\s*\S{6}\s*,[\s\S]*})/gi; /** @enum {string} */ var TagType = { ELEMENT: '#', TEMPLATE: '*', PROJECTION: '!' }; // i18nPostprocess consts /** @type {?} */ var ROOT_TEMPLATE_ID = 0; /** @type {?} */ var PP_MULTI_VALUE_PLACEHOLDERS_REGEXP = /\[(�.+?�?)\]/; /** @type {?} */ var PP_PLACEHOLDERS_REGEXP = /\[(�.+?�?)\]|(�\/?\*\d+:\d+�)/g; /** @type {?} */ var PP_ICU_VARS_REGEXP = /({\s*)(VAR_(PLURAL|SELECT)(_\d+)?)(\s*,)/g; /** @type {?} */ var PP_ICU_PLACEHOLDERS_REGEXP = /{([A-Z0-9_]+)}/g; /** @type {?} */ var PP_ICUS_REGEXP = /�I18N_EXP_(ICU(_\d+)?)�/g; /** @type {?} */ var PP_CLOSE_TEMPLATE_REGEXP = /\/\*/; /** @type {?} */ var PP_TEMPLATE_ID_REGEXP = /\d+\:(\d+)/; /** * @record */ function IcuExpression() {} if (false) {} /** * @record */ function IcuCase() {} if (false) {} /** * Breaks pattern into strings and top level {...} blocks. * Can be used to break a message into text and ICU expressions, or to break an ICU expression into * keys and cases. * Original code from closure library, modified for Angular. * * @param {?} pattern (sub)Pattern to be broken. * * @return {?} */ function extractParts(pattern) { if (!pattern) { return []; } /** @type {?} */ var prevPos = 0; /** @type {?} */ var braceStack = []; /** @type {?} */ var results = []; /** @type {?} */ var braces = /[{}]/g; // lastIndex doesn't get set to 0 so we have to. braces.lastIndex = 0; /** @type {?} */ var match; while (match = braces.exec(pattern)) { /** @type {?} */ var pos = match.index; if (match[0] == '}') { braceStack.pop(); if (braceStack.length == 0) { // End of the block. /** @type {?} */ var block = pattern.substring(prevPos, pos); if (ICU_BLOCK_REGEXP.test(block)) { results.push(parseICUBlock(block)); } else { results.push(block); } prevPos = pos + 1; } } else { if (braceStack.length == 0) { /** @type {?} */ var _substring = pattern.substring(prevPos, pos); results.push(_substring); prevPos = pos + 1; } braceStack.push('{'); } } /** @type {?} */ var substring = pattern.substring(prevPos); results.push(substring); return results; } /** * Parses text containing an ICU expression and produces a JSON object for it. * Original code from closure library, modified for Angular. * * @param {?} pattern Text containing an ICU expression that needs to be parsed. * * @return {?} */ function parseICUBlock(pattern) { /** @type {?} */ var cases = []; /** @type {?} */ var values = []; /** @type {?} */ var icuType = 1 /* plural */ ; /** @type {?} */ var mainBinding = 0; pattern = pattern.replace(ICU_BLOCK_REGEXP, /** * @param {?} str * @param {?} binding * @param {?} type * @return {?} */ function (str, binding, type) { if (type === 'select') { icuType = 0 /* select */ ; } else { icuType = 1 /* plural */ ; } mainBinding = parseInt(binding.substr(1), 10); return ''; }); /** @type {?} */ var parts = /** @type {?} */ extractParts(pattern); // Looking for (key block)+ sequence. One of the keys has to be "other". for (var pos = 0; pos < parts.length;) { /** @type {?} */ var key = parts[pos++].trim(); if (icuType === 1 /* plural */ ) { // Key can be "=x", we just want "x" key = key.replace(/\s*(?:=)?(\w+)\s*/, '$1'); } if (key.length) { cases.push(key); } /** @type {?} */ var blocks = /** @type {?} */ extractParts(parts[pos++]); if (cases.length > values.length) { values.push(blocks); } } assertGreaterThan(cases.indexOf('other'), -1, 'Missing key "other" in ICU statement.'); // TODO(ocombe): support ICU expressions in attributes, see #21615 return { type: icuType, mainBinding: mainBinding, cases: cases, values: values }; } /** * Removes everything inside the sub-templates of a message. * @param {?} message * @return {?} */ function removeInnerTemplateTranslation(message) { /** @type {?} */ var match; /** @type {?} */ var res = ''; /** @type {?} */ var index = 0; /** @type {?} */ var inTemplate = false; /** @type {?} */ var tagMatched; while ((match = SUBTEMPLATE_REGEXP.exec(message)) !== null) { if (!inTemplate) { res += message.substring(index, match.index + match[0].length); tagMatched = match[1]; inTemplate = true; } else { if (match[0] === "".concat(MARKER, "/*").concat(tagMatched).concat(MARKER)) { index = match.index; inTemplate = false; } } } ngDevMode && assertEqual(inTemplate, false, "Tag mismatch: unable to find the end of the sub-template in the translation \"".concat(message, "\"")); res += message.substr(index); return res; } /** * Extracts a part of a message and removes the rest. * * This method is used for extracting a part of the message associated with a template. A translated * message can span multiple templates. * * Example: * ``` * <div i18n>Translate <span *ngIf>me</span>!</div> * ``` * * @param {?} message The message to crop * @param {?=} subTemplateIndex Index of the sub-template to extract. If undefined it returns the * external template and removes all sub-templates. * @return {?} */ function getTranslationForTemplate(message, subTemplateIndex) { if (typeof subTemplateIndex !== 'number') { // We want the root template message, ignore all sub-templates return removeInnerTemplateTranslation(message); } else { // We want a specific sub-template /** @type {?} */ var start = message.indexOf(":".concat(subTemplateIndex).concat(MARKER)) + 2 + subTemplateIndex.toString().length; /** @type {?} */ var end = message.search(new RegExp("".concat(MARKER, "\\/\\*\\d+:").concat(subTemplateIndex).concat(MARKER))); return removeInnerTemplateTranslation(message.substring(start, end)); } } /** * Generate the OpCodes to update the bindings of a string. * * @param {?} str The string containing the bindings. * @param {?} destinationNode Index of the destination node which will receive the binding. * @param {?=} attrName Name of the attribute, if the string belongs to an attribute. * @param {?=} sanitizeFn Sanitization function used to sanitize the string after update, if necessary. * @return {?} */ function generateBindingUpdateOpCodes(str, destinationNode, attrName) { var sanitizeFn = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; /** @type {?} */ var updateOpCodes = [null, null]; // Alloc space for mask and size /** @type {?} */ var textParts = str.split(BINDING_REGEXP); /** @type {?} */ var mask = 0; for (var j = 0; j < textParts.length; j++) { /** @type {?} */ var textValue = textParts[j]; if (j & 1) { // Odd indexes are bindings /** @type {?} */ var bindingIndex = parseInt(textValue, 10); updateOpCodes.push(-1 - bindingIndex); mask = mask | toMaskBit(bindingIndex); } else if (textValue !== '') { // Even indexes are text updateOpCodes.push(textValue); } } updateOpCodes.push(destinationNode << 2 /* SHIFT_REF */ | (attrName ? 1 /* Attr */ : 0 /* Text */ )); if (attrName) { updateOpCodes.push(attrName, sanitizeFn); } updateOpCodes[0] = mask; updateOpCodes[1] = updateOpCodes.length - 2; return updateOpCodes; } /** * @param {?} icuExpression * @param {?=} mask * @return {?} */ function getBindingMask(icuExpression) { var mask = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; mask = mask | toMaskBit(icuExpression.mainBinding); /** @type {?} */ var match; for (var i = 0; i < icuExpression.values.length; i++) { /** @type {?} */ var valueArr = icuExpression.values[i]; for (var j = 0; j < valueArr.length; j++) { /** @type {?} */ var value = valueArr[j]; if (typeof value === 'string') { while (match = BINDING_REGEXP.exec(value)) { mask = mask | toMaskBit(parseInt(match[1], 10)); } } else { mask = getBindingMask( /** @type {?} */ value, mask); } } } return mask; } /** @type {?} */ var i18nIndexStack = []; /** @type {?} */ var i18nIndexStackPointer = -1; /** * Convert binding index to mask bit. * * Each index represents a single bit on the bit-mask. Because bit-mask only has 32 bits, we make * the 32nd bit share all masks for all bindings higher than 32. Since it is extremely rare to have * more than 32 bindings this will be hit very rarely. The downside of hitting this corner case is * that we will execute binding code more often than necessary. (penalty of performance) * @param {?} bindingIndex * @return {?} */ function toMaskBit(bindingIndex) { return 1 << Math.min(bindingIndex, 31); } /** @type {?} */ var parentIndexStack = []; /** * Marks a block of text as translatable. * * The instructions `i18nStart` and `i18nEnd` mark the translation block in the template. * The translation `message` is the value which is locale specific. The translation string may * contain placeholders which associate inner elements and sub-templates within the translation. * * The translation `message` placeholders are: * - `�{index}(:{block})�`: *Binding Placeholder*: Marks a location where an expression will be * interpolated into. The placeholder `index` points to the expression binding index. An optional * `block` that matches the sub-template in which it was declared. * - `�#{index}(:{block})�`/`�/#{index}(:{block})�`: *Element Placeholder*: Marks the beginning * and end of DOM element that were embedded in the original translation block. The placeholder * `index` points to the element index in the template instructions set. An optional `block` that * matches the sub-template in which it was declared. * - `�!{index}(:{block})�`/`�/!{index}(:{block})�`: *Projection Placeholder*: Marks the * beginning and end of <ng-content> that was embedded in the original translation block. * The placeholder `index` points to the element index in the template instructions set. * An optional `block` that matches the sub-template in which it was declared. * - `�*{index}:{block}�`/`�/*{index}:{block}�`: *Sub-template Placeholder*: Sub-templates must be * split up and translated separately in each angular template function. The `index` points to the * `template` instruction index. A `block` that matches the sub-template in which it was declared. * * \@codeGenApi * @param {?} index A unique index of the translation in the static block. * @param {?} message The translation message. * @param {?=} subTemplateIndex Optional sub-template index in the `message`. * * @return {?} */ function ɵɵi18nStart(index, message, subTemplateIndex) { /** @type {?} */ var tView = getLView()[TVIEW]; ngDevMode && assertDefined(tView, "tView should be defined"); i18nIndexStack[++i18nIndexStackPointer] = index; // We need to delay projections until `i18nEnd` setDelayProjection(true); if (tView.firstTemplatePass && tView.data[index + HEADER_OFFSET] === null) { i18nStartFirstPass(tView, index, message, subTemplateIndex); } } // Count for the number of vars that will be allocated for each i18n block. // It is global because this is used in multiple functions that include loops and recursive calls. // This is reset to 0 when `i18nStartFirstPass` is called. /** @type {?} */ var i18nVarsCount; /** * See `i18nStart` above. * @param {?} tView * @param {?} index * @param {?} message * @param {?=} subTemplateIndex * @return {?} */ function i18nStartFirstPass(tView, index, message, subTemplateIndex) { /** @type {?} */ var viewData = getLView(); /** @type {?} */ var startIndex = tView.blueprint.length - HEADER_OFFSET; i18nVarsCount = 0; /** @type {?} */ var previousOrParentTNode = getPreviousOrParentTNode(); /** @type {?} */ var parentTNode = getIsParent() ? getPreviousOrParentTNode() : previousOrParentTNode && previousOrParentTNode.parent; /** @type {?} */ var parentIndex = parentTNode && parentTNode !== viewData[T_HOST] ? parentTNode.index - HEADER_OFFSET : index; /** @type {?} */ var parentIndexPointer = 0; parentIndexStack[parentIndexPointer] = parentIndex; /** @type {?} */ var createOpCodes = []; // If the previous node wasn't the direct parent then we have a translation without top level // element and we need to keep a reference of the previous element if there is one if (index > 0 && previousOrParentTNode !== parentTNode) { // Create an OpCode to select the previous TNode createOpCodes.push(previousOrParentTNode.index << 3 /* SHIFT_REF */ | 0 /* Select */ ); } /** @type {?} */ var updateOpCodes = []; /** @type {?} */ var icuExpressions = []; /** @type {?} */ var templateTranslation = getTranslationForTemplate(message, subTemplateIndex); /** @type {?} */ var msgParts = replaceNgsp(templateTranslation).split(PH_REGEXP); for (var i = 0; i < msgParts.length; i++) { /** @type {?} */ var value = msgParts[i]; if (i & 1) { // Odd indexes are placeholders (elements and sub-templates) if (value.charAt(0) === '/') { // It is a closing tag if (value.charAt(1) === "#" /* ELEMENT */ ) { /** @type {?} */ var phIndex = parseInt(value.substr(2), 10); parentIndex = parentIndexStack[--parentIndexPointer]; createOpCodes.push(phIndex << 3 /* SHIFT_REF */ | 5 /* ElementEnd */ ); } } else { /** @type {?} */ var _phIndex = parseInt(value.substr(1), 10); // The value represents a placeholder that we move to the designated index createOpCodes.push(_phIndex << 3 /* SHIFT_REF */ | 0 /* Select */ , parentIndex << 17 /* SHIFT_PARENT */ | 1 /* AppendChild */ ); if (value.charAt(0) === "#" /* ELEMENT */ ) { parentIndexStack[++parentIndexPointer] = parentIndex = _phIndex; } } } else { // Even indexes are text (including bindings & ICU expressions) /** @type {?} */ var parts = extractParts(value); for (var j = 0; j < parts.length; j++) { if (j & 1) { // Odd indexes are ICU expressions // Create the comment node that will anchor the ICU expression /** @type {?} */ var icuNodeIndex = startIndex + i18nVarsCount++; createOpCodes.push(COMMENT_MARKER, ngDevMode ? "ICU ".concat(icuNodeIndex) : '', icuNodeIndex, parentIndex << 17 /* SHIFT_PARENT */ | 1 /* AppendChild */ ); // Update codes for the ICU expression /** @type {?} */ var icuExpression = /** @type {?} */ parts[j]; /** @type {?} */ var mask = getBindingMask(icuExpression); icuStart(icuExpressions, icuExpression, icuNodeIndex, icuNodeIndex); // Since this is recursive, the last TIcu that was pushed is the one we want /** @type {?} */ var tIcuIndex = icuExpressions.length - 1; updateOpCodes.push(toMaskBit(icuExpression.mainBinding), // mask of the main binding 3, // skip 3 opCodes if not changed -1 - icuExpression.mainBinding, icuNodeIndex << 2 /* SHIFT_REF */ | 2 /* IcuSwitch */ , tIcuIndex, mask, // mask of all the bindings of this ICU expression 2, // skip 2 opCodes if not changed icuNodeIndex << 2 /* SHIFT_REF */ | 3 /* IcuUpdate */ , tIcuIndex); } else if (parts[j] !== '') { /** @type {?} */ var text = /** @type {?} */ parts[j]; // Even indexes are text (including bindings) /** @type {?} */ var hasBinding = text.match(BINDING_REGEXP); // Create text nodes /** @type {?} */ var textNodeIndex = startIndex + i18nVarsCount++; createOpCodes.push( // If there is a binding, the value will be set during update hasBinding ? '' : text, textNodeIndex, parentIndex << 17 /* SHIFT_PARENT */ | 1 /* AppendChild */ ); if (hasBinding) { addAllToArray(generateBindingUpdateOpCodes(text, textNodeIndex), updateOpCodes); } } } } } if (i18nVarsCount > 0) { allocExpando(viewData, i18nVarsCount); } ngDevMode && attachI18nOpCodesDebug(createOpCodes, updateOpCodes, icuExpressions.length ? icuExpressions : null, viewData); // NOTE: local var needed to properly assert the type of `TI18n`. /** @type {?} */ var tI18n = { vars: i18nVarsCount, create: createOpCodes, update: updateOpCodes, icus: icuExpressions.length ? icuExpressions : null }; tView.data[index + HEADER_OFFSET] = tI18n; } /** * @param {?} tNode * @param {?} parentTNode * @param {?} previousTNode * @param {?} viewData * @return {?} */ function appendI18nNode(tNode, parentTNode, previousTNode, viewData) { ngDevMode && ngDevMode.rendererMoveNode++; /** @type {?} */ var nextNode = tNode.next; if (!previousTNode) { previousTNode = parentTNode; } // Re-organize node tree to put this node in the correct position. if (previousTNode === parentTNode && tNode !== parentTNode.child) { tNode.next = parentTNode.child; parentTNode.child = tNode; } else if (previousTNode !== parentTNode && tNode !== previousTNode.next) { tNode.next = previousTNode.next; previousTNode.next = tNode; } else { tNode.next = null; } if (parentTNode !== viewData[T_HOST]) { tNode.parent = /** @type {?} */ parentTNode; } // If tNode was moved around, we might need to fix a broken link. /** @type {?} */ var cursor = tNode.next; while (cursor) { if (cursor.next === tNode) { cursor.next = nextNode; } cursor = cursor.next; } // If the placeholder to append is a projection, we need to move the projected nodes instead if (tNode.type === 1 /* Projection */ ) { /** @type {?} */ var tProjectionNode = /** @type {?} */ tNode; appendProjectedNodes(viewData, tProjectionNode, tProjectionNode.projection, findComponentView(viewData)); return tNode; } appendChild(getNativeByTNode(tNode, viewData), tNode, viewData); /** @type {?} */ var slotValue = viewData[tNode.index]; if (tNode.type !== 0 /* Container */ && isLContainer(slotValue)) { // Nodes that inject ViewContainerRef also have a comment node that should be moved appendChild(slotValue[NATIVE], tNode, viewData); } return tNode; } /** * Handles message string post-processing for internationalization. * * Handles message string post-processing by transforming it from intermediate * format (that might contain some markers that we need to replace) to the final * form, consumable by i18nStart instruction. Post processing steps include: * * 1. Resolve all multi-value cases (like [�*1:1��#2:1�|�#4:1�|�5�]) * 2. Replace all ICU vars (like "VAR_PLURAL") * 3. Replace all placeholders used inside ICUs in a form of {PLACEHOLDER} * 4. Replace all ICU references with corresponding values (like �ICU_EXP_ICU_1�) * in case multiple ICUs have the same placeholder name * * \@codeGenApi * @param {?} message Raw translation string for post processing * @param {?=} replacements Set of replacements that should be applied * * @return {?} Transformed string that can be consumed by i18nStart instruction * */ function ɵɵi18nPostprocess(message) { var replacements = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; /** * Step 1: resolve all multi-value placeholders like [�#5�|�*1:1��#2:1�|�#4:1�] * * Note: due to the way we process nested templates (BFS), multi-value placeholders are typically * grouped by templates, for example: [�#5�|�#6�|�#1:1�|�#3:2�] where �#5� and �#6� belong to root * template, �#1:1� belong to nested template with index 1 and �#1:2� - nested template with index * 3. However in real templates the order might be different: i.e. �#1:1� and/or �#3:2� may go in * front of �#6�. The post processing step restores the right order by keeping track of the * template id stack and looks for placeholders that belong to the currently active template. * @type {?} */ var result = message; if (PP_MULTI_VALUE_PLACEHOLDERS_REGEXP.test(message)) { /** @type {?} */ var matches = {}; /** @type {?} */ var templateIdsStack = [ROOT_TEMPLATE_ID]; result = result.replace(PP_PLACEHOLDERS_REGEXP, /** * @param {?} m * @param {?} phs * @param {?} tmpl * @return {?} */ function (m, phs, tmpl) { /** @type {?} */ var content = phs || tmpl; /** @type {?} */ var placeholders = matches[content] || []; if (!placeholders.length) { content.split('|').forEach( /** * @param {?} placeholder * @return {?} */ function (placeholder) { /** @type {?} */ var match = placeholder.match(PP_TEMPLATE_ID_REGEXP); /** @type {?} */ var templateId = match ? parseInt(match[1], 10) : ROOT_TEMPLATE_ID; /** @type {?} */ var isCloseTemplateTag = PP_CLOSE_TEMPLATE_REGEXP.test(placeholder); placeholders.push([templateId, isCloseTemplateTag, placeholder]); }); matches[content] = placeholders; } if (!placeholders.length) { throw new Error("i18n postprocess: unmatched placeholder - ".concat(content)); } /** @type {?} */ var currentTemplateId = templateIdsStack[templateIdsStack.length - 1]; /** @type {?} */ var idx = 0; // find placeholder index that matches current template id for (var i = 0; i < placeholders.length; i++) { if (placeholders[i][0] === currentTemplateId) { idx = i; break; } } // update template id stack based on the current tag extracted var _placeholders$idx = _slicedToArray(placeholders[idx], 3), templateId = _placeholders$idx[0], isCloseTemplateTag = _placeholders$idx[1], placeholder = _placeholders$idx[2]; if (isCloseTemplateTag) { templateIdsStack.pop(); } else if (currentTemplateId !== templateId) { templateIdsStack.push(templateId); } // remove processed tag from the list placeholders.splice(idx, 1); return placeholder; }); } // return current result if no replacements specified if (!Object.keys(replacements).length) { return result; } /** * Step 2: replace all ICU vars (like "VAR_PLURAL") */ result = result.replace(PP_ICU_VARS_REGEXP, /** * @param {?} match * @param {?} start * @param {?} key * @param {?} _type * @param {?} _idx * @param {?} end * @return {?} */ function (match, start, key, _type, _idx, end) { return replacements.hasOwnProperty(key) ? "".concat(start).concat(replacements[key]).concat(end) : match; }); /** * Step 3: replace all placeholders used inside ICUs in a form of {PLACEHOLDER} */ result = result.replace(PP_ICU_PLACEHOLDERS_REGEXP, /** * @param {?} match * @param {?} key * @return {?} */ function (match, key) { return replacements.hasOwnProperty(key) ? /** @type {?} */ replacements[key] : match; }); /** * Step 4: replace all ICU references with corresponding values (like �ICU_EXP_ICU_1�) in case * multiple ICUs have the same placeholder name */ result = result.replace(PP_ICUS_REGEXP, /** * @param {?} match * @param {?} key * @return {?} */ function (match, key) { if (replacements.hasOwnProperty(key)) { /** @type {?} */ var list = /** @type {?} */ replacements[key]; if (!list.length) { throw new Error("i18n postprocess: unmatched ICU - ".concat(match, " with key: ").concat(key)); } return ( /** @type {?} */ list.shift() ); } return match; }); return result; } /** * Translates a translation block marked by `i18nStart` and `i18nEnd`. It inserts the text/ICU nodes * into the render tree, moves the placeholder nodes and removes the deleted nodes. * * \@codeGenApi * @return {?} */ function ɵɵi18nEnd() { /** @type {?} */ var tView = getLView()[TVIEW]; ngDevMode && assertDefined(tView, "tView should be defined"); i18nEndFirstPass(tView); // Stop delaying projections setDelayProjection(false); } /** * See `i18nEnd` above. * @param {?} tView * @return {?} */ function i18nEndFirstPass(tView) { /** @type {?} */ var viewData = getLView(); ngDevMode && assertEqual(viewData[BINDING_INDEX], viewData[TVIEW].bindingStartIndex, 'i18nEnd should be called before any binding'); /** @type {?} */ var rootIndex = i18nIndexStack[i18nIndexStackPointer--]; /** @type {?} */ var tI18n = /** @type {?} */ tView.data[rootIndex + HEADER_OFFSET]; ngDevMode && assertDefined(tI18n, "You should call i18nStart before i18nEnd"); // Find the last node that was added before `i18nEnd` /** @type {?} */ var lastCreatedNode = getPreviousOrParentTNode(); // Read the instructions to insert/move/remove DOM elements /** @type {?} */ var visitedNodes = readCreateOpCodes(rootIndex, tI18n.create, tI18n.icus, viewData); // Remove deleted nodes for (var i = rootIndex + 1; i <= lastCreatedNode.index - HEADER_OFFSET; i++) { if (visitedNodes.indexOf(i) === -1) { removeNode(i, viewData); } } } /** * Creates and stores the dynamic TNode, and unhooks it from the tree for now. * @param {?} lView * @param {?} index * @param {?} type * @param {?} native * @param {?} name * @return {?} */ function createDynamicNodeAtIndex(lView, index, type, _native23, name) { /** @type {?} */ var previousOrParentTNode = getPreviousOrParentTNode(); ngDevMode && assertDataInRange(lView, index + HEADER_OFFSET); lView[index + HEADER_OFFSET] = _native23; /** @type {?} */ var tNode = getOrCreateTNode(lView[TVIEW], lView[T_HOST], index, /** @type {?} */ type, name, null); // We are creating a dynamic node, the previous tNode might not be pointing at this node. // We will link ourselves into the tree later with `appendI18nNode`. if (previousOrParentTNode.next === tNode) { previousOrParentTNode.next = null; } return tNode; } /** * @param {?} index * @param {?} createOpCodes * @param {?} icus * @param {?} viewData * @return {?} */ function readCreateOpCodes(index, createOpCodes, icus, viewData) { /** @type {?} */ var renderer = getLView()[RENDERER]; /** @type {?} */ var currentTNode = null; /** @type {?} */ var previousTNode = null; /** @type {?} */ var visitedNodes = []; for (var i = 0; i < createOpCodes.length; i++) { /** @type {?} */ var opCode = createOpCodes[i]; if (typeof opCode == 'string') { /** @type {?} */ var textRNode = createTextNode(opCode, renderer); /** @type {?} */ var textNodeIndex = /** @type {?} */ createOpCodes[++i]; ngDevMode && ngDevMode.rendererCreateTextNode++; previousTNode = currentTNode; currentTNode = createDynamicNodeAtIndex(viewData, textNodeIndex, 3 /* Element */ , textRNode, null); visitedNodes.push(textNodeIndex); setIsNotParent(); } else if (typeof opCode == 'number') { switch (opCode & 7 /* MASK_OPCODE */ ) { case 1 /* AppendChild */ : /** @type {?} */ var destinationNodeIndex = opCode >>> 17 /* SHIFT_PARENT */ ; /** @type {?} */ var destinationTNode = void 0; if (destinationNodeIndex === index) { // If the destination node is `i18nStart`, we don't have a // top-level node and we should use the host node instead destinationTNode = /** @type {?} */ viewData[T_HOST]; } else { destinationTNode = getTNode(destinationNodeIndex, viewData); } ngDevMode && assertDefined( /** @type {?} */ currentTNode, "You need to create or select a node before you can insert it into the DOM"); previousTNode = appendI18nNode( /** @type {?} */ currentTNode, destinationTNode, previousTNode, viewData); break; case 0 /* Select */ : /** @type {?} */ var nodeIndex = opCode >>> 3 /* SHIFT_REF */ ; visitedNodes.push(nodeIndex); previousTNode = currentTNode; currentTNode = getTNode(nodeIndex, viewData); if (currentTNode) { setPreviousOrParentTNode(currentTNode, currentTNode.type === 3 /* Element */ ); } break; case 5 /* ElementEnd */ : /** @type {?} */ var elementIndex = opCode >>> 3 /* SHIFT_REF */ ; previousTNode = currentTNode = getTNode(elementIndex, viewData); setPreviousOrParentTNode(currentTNode, false); break; case 4 /* Attr */ : /** @type {?} */ var elementNodeIndex = opCode >>> 3 /* SHIFT_REF */ ; /** @type {?} */ var attrName = /** @type {?} */ createOpCodes[++i]; /** @type {?} */ var attrValue = /** @type {?} */ createOpCodes[++i]; // This code is used for ICU expressions only, since we don't support // directives/components in ICUs, we don't need to worry about inputs here elementAttributeInternal(elementNodeIndex, attrName, attrValue, viewData); break; default: throw new Error("Unable to determine the type of mutate operation for \"".concat(opCode, "\"")); } } else { switch (opCode) { case COMMENT_MARKER: /** @type {?} */ var commentValue = /** @type {?} */ createOpCodes[++i]; /** @type {?} */ var commentNodeIndex = /** @type {?} */ createOpCodes[++i]; ngDevMode && assertEqual(typeof commentValue, 'string', "Expected \"".concat(commentValue, "\" to be a comment node value")); /** @type {?} */ var commentRNode = renderer.createComment(commentValue); ngDevMode && ngDevMode.rendererCreateComment++; previousTNode = currentTNode; currentTNode = createDynamicNodeAtIndex(viewData, commentNodeIndex, 5 /* IcuContainer */ , commentRNode, null); visitedNodes.push(commentNodeIndex); attachPatchData(commentRNode, viewData); /** @type {?} */ currentTNode.activeCaseIndex = null; // We will add the case nodes later, during the update phase setIsNotParent(); break; case ELEMENT_MARKER: /** @type {?} */ var tagNameValue = /** @type {?} */ createOpCodes[++i]; /** @type {?} */ var _elementNodeIndex = /** @type {?} */ createOpCodes[++i]; ngDevMode && assertEqual(typeof tagNameValue, 'string', "Expected \"".concat(tagNameValue, "\" to be an element node tag name")); /** @type {?} */ var elementRNode = renderer.createElement(tagNameValue); ngDevMode && ngDevMode.rendererCreateElement++; previousTNode = currentTNode; currentTNode = createDynamicNodeAtIndex(viewData, _elementNodeIndex, 3 /* Element */ , elementRNode, tagNameValue); visitedNodes.push(_elementNodeIndex); break; default: throw new Error("Unable to determine the type of mutate operation for \"".concat(opCode, "\"")); } } } setIsNotParent(); return visitedNodes; } /** * @param {?} updateOpCodes * @param {?} icus * @param {?} bindingsStartIndex * @param {?} changeMask * @param {?} viewData * @param {?=} bypassCheckBit * @return {?} */ function readUpdateOpCodes(updateOpCodes, icus, bindingsStartIndex, changeMask, viewData) { var bypassCheckBit = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false; /** @type {?} */ var caseCreated = false; for (var i = 0; i < updateOpCodes.length; i++) { // bit code to check if we should apply the next update /** @type {?} */ var checkBit = /** @type {?} */ updateOpCodes[i]; // Number of opCodes to skip until next set of update codes /** @type {?} */ var skipCodes = /** @type {?} */ updateOpCodes[++i]; if (bypassCheckBit || checkBit & changeMask) { // The value has been updated since last checked /** @type {?} */ var value = ''; for (var j = i + 1; j <= i + skipCodes; j++) { /** @type {?} */ var opCode = updateOpCodes[j]; if (typeof opCode == 'string') { value += opCode; } else if (typeof opCode == 'number') { if (opCode < 0) { // It's a binding index whose value is negative value += renderStringify(viewData[bindingsStartIndex - opCode]); } else { /** @type {?} */ var nodeIndex = opCode >>> 2 /* SHIFT_REF */ ; /** @type {?} */ var tIcuIndex = void 0; /** @type {?} */ var tIcu = void 0; /** @type {?} */ var icuTNode = void 0; switch (opCode & 3 /* MASK_OPCODE */ ) { case 1 /* Attr */ : /** @type {?} */ var propName = /** @type {?} */ updateOpCodes[++j]; /** @type {?} */ var sanitizeFn = /** @type {?} */ updateOpCodes[++j]; elementPropertyInternal(nodeIndex, propName, value, sanitizeFn); break; case 0 /* Text */ : textBindingInternal(viewData, nodeIndex, value); break; case 2 /* IcuSwitch */ : tIcuIndex = /** @type {?} */ updateOpCodes[++j]; tIcu = /** @type {?} */ icus[tIcuIndex]; icuTNode = /** @type {?} */ getTNode(nodeIndex, viewData); // If there is an active case, delete the old nodes if (icuTNode.activeCaseIndex !== null) { /** @type {?} */ var removeCodes = tIcu.remove[icuTNode.activeCaseIndex]; for (var k = 0; k < removeCodes.length; k++) { /** @type {?} */ var removeOpCode = /** @type {?} */ removeCodes[k]; switch (removeOpCode & 7 /* MASK_OPCODE */ ) { case 3 /* Remove */ : /** @type {?} */ var _nodeIndex = removeOpCode >>> 3 /* SHIFT_REF */ ; removeNode(_nodeIndex, viewData); break; case 6 /* RemoveNestedIcu */ : /** @type {?} */ var nestedIcuNodeIndex = /** @type {?} */ removeCodes[k + 1] >>> 3 /* SHIFT_REF */ ; /** @type {?} */ var nestedIcuTNode = /** @type {?} */ getTNode(nestedIcuNodeIndex, viewData); /** @type {?} */ var activeIndex = nestedIcuTNode.activeCaseIndex; if (activeIndex !== null) { /** @type {?} */ var nestedIcuTIndex = removeOpCode >>> 3 /* SHIFT_REF */ ; /** @type {?} */ var nestedTIcu = /** @type {?} */ icus[nestedIcuTIndex]; addAllToArray(nestedTIcu.remove[activeIndex], removeCodes); } break; } } } // Update the active caseIndex /** @type {?} */ var caseIndex = getCaseIndex(tIcu, value); icuTNode.activeCaseIndex = caseIndex !== -1 ? caseIndex : null; // Add the nodes for the new case readCreateOpCodes(-1, tIcu.create[caseIndex], icus, viewData); caseCreated = true; break; case 3 /* IcuUpdate */ : tIcuIndex = /** @type {?} */ updateOpCodes[++j]; tIcu = /** @type {?} */ icus[tIcuIndex]; icuTNode = /** @type {?} */ getTNode(nodeIndex, viewData); readUpdateOpCodes(tIcu.update[ /** @type {?} */ icuTNode.activeCaseIndex], icus, bindingsStartIndex, changeMask, viewData, caseCreated); break; } } } } } i += skipCodes; } } /** * @param {?} index * @param {?} viewData * @return {?} */ function removeNode(index, viewData) { /** @type {?} */ var removedPhTNode = getTNode(index, viewData); /** @type {?} */ var removedPhRNode = getNativeByIndex(index, viewData); if (removedPhRNode) { nativeRemoveNode(viewData[RENDERER], removedPhRNode); } /** @type {?} */ var slotValue = /** @type {?} */ ɵɵload(index); if (isLContainer(slotValue)) { /** @type {?} */ var lContainer = /** @type {?} */ slotValue; if (removedPhTNode.type !== 0 /* Container */ ) { nativeRemoveNode(viewData[RENDERER], lContainer[NATIVE]); } } // Define this node as detached so that we don't risk projecting it removedPhTNode.flags |= 32 /* isDetached */ ; ngDevMode && ngDevMode.rendererRemoveNode++; } /** * * Use this instruction to create a translation block that doesn't contain any placeholder. * It calls both {\@link i18nStart} and {\@link i18nEnd} in one instruction. * * The translation `message` is the value which is locale specific. The translation string may * contain placeholders which associate inner elements and sub-templates within the translation. * * The translation `message` placeholders are: * - `�{index}(:{block})�`: *Binding Placeholder*: Marks a location where an expression will be * interpolated into. The placeholder `index` points to the expression binding index. An optional * `block` that matches the sub-template in which it was declared. * - `�#{index}(:{block})�`/`�/#{index}(:{block})�`: *Element Placeholder*: Marks the beginning * and end of DOM element that were embedded in the original translation block. The placeholder * `index` points to the element index in the template instructions set. An optional `block` that * matches the sub-template in which it was declared. * - `�*{index}:{block}�`/`�/*{index}:{block}�`: *Sub-template Placeholder*: Sub-templates must be * split up and translated separately in each angular template function. The `index` points to the * `template` instruction index. A `block` that matches the sub-template in which it was declared. * * \@codeGenApi * @param {?} index A unique index of the translation in the static block. * @param {?} message The translation message. * @param {?=} subTemplateIndex Optional sub-template index in the `message`. * * @return {?} */ function ɵɵi18n(index, message, subTemplateIndex) { ɵɵi18nStart(index, message, subTemplateIndex); ɵɵi18nEnd(); } /** * Marks a list of attributes as translatable. * * \@codeGenApi * @param {?} index A unique index in the static block * @param {?} values * * @return {?} */ function ɵɵi18nAttributes(index, values) { /** @type {?} */ var tView = getLView()[TVIEW]; ngDevMode && assertDefined(tView, "tView should be defined"); i18nAttributesFirstPass(tView, index, values); } /** * See `i18nAttributes` above. * @param {?} tView * @param {?} index * @param {?} values * @return {?} */ function i18nAttributesFirstPass(tView, index, values) { /** @type {?} */ var previousElement = getPreviousOrParentTNode(); /** @type {?} */ var previousElementIndex = previousElement.index - HEADER_OFFSET; /** @type {?} */ var updateOpCodes = []; for (var i = 0; i < values.length; i += 2) { /** @type {?} */ var attrName = values[i]; /** @type {?} */ var message = values[i + 1]; /** @type {?} */ var parts = message.split(ICU_REGEXP); for (var j = 0; j < parts.length; j++) { /** @type {?} */ var value = parts[j]; if (j & 1) { // Odd indexes are ICU expressions // TODO(ocombe): support ICU expressions in attributes throw new Error('ICU expressions are not yet supported in attributes'); } else if (value !== '') { // Even indexes are text (including bindings) /** @type {?} */ var hasBinding = !!value.match(BINDING_REGEXP); if (hasBinding) { if (tView.firstTemplatePass && tView.data[index + HEADER_OFFSET] === null) { addAllToArray(generateBindingUpdateOpCodes(value, previousElementIndex, attrName), updateOpCodes); } } else { /** @type {?} */ var _lView8 = getLView(); elementAttributeInternal(previousElementIndex, attrName, value, _lView8); // Check if that attribute is a directive input /** @type {?} */ var tNode = getTNode(previousElementIndex, _lView8); /** @type {?} */ var dataValue = tNode.inputs && tNode.inputs[attrName]; if (dataValue) { setInputsForProperty(_lView8, dataValue, value); } } } } } if (tView.firstTemplatePass && tView.data[index + HEADER_OFFSET] === null) { tView.data[index + HEADER_OFFSET] = updateOpCodes; } } /** @type {?} */ var changeMask = 0; /** @type {?} */ var shiftsCounter = 0; /** * Stores the values of the bindings during each update cycle in order to determine if we need to * update the translated nodes. * * \@codeGenApi * @template T * @param {?} value The binding's value * @return {?} This function returns itself so that it may be chained * (e.g. `i18nExp(ctx.name)(ctx.title)`) * */ function ɵɵi18nExp(value) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var expression = bind(lView, value); if (expression !== NO_CHANGE) { changeMask = changeMask | 1 << shiftsCounter; } shiftsCounter++; return ɵɵi18nExp; } /** * Updates a translation block or an i18n attribute when the bindings have changed. * * \@codeGenApi * @param {?} index Index of either {\@link i18nStart} (translation block) or {\@link i18nAttributes} * (i18n attribute) on which it should update the content. * * @return {?} */ function ɵɵi18nApply(index) { if (shiftsCounter) { /** @type {?} */ var _lView9 = getLView(); /** @type {?} */ var tView = _lView9[TVIEW]; ngDevMode && assertDefined(tView, "tView should be defined"); /** @type {?} */ var tI18n = tView.data[index + HEADER_OFFSET]; /** @type {?} */ var updateOpCodes; /** @type {?} */ var icus = null; if (Array.isArray(tI18n)) { updateOpCodes = /** @type {?} */ tI18n; } else { updateOpCodes = /** @type {?} */ tI18n.update; icus = /** @type {?} */ tI18n.icus; } /** @type {?} */ var bindingsStartIndex = _lView9[BINDING_INDEX] - shiftsCounter - 1; readUpdateOpCodes(updateOpCodes, icus, bindingsStartIndex, changeMask, _lView9); // Reset changeMask & maskBit to default for the next update cycle changeMask = 0; shiftsCounter = 0; } } /** * Returns the index of the current case of an ICU expression depending on the main binding value * * @param {?} icuExpression * @param {?} bindingValue The value of the main binding used by this ICU expression * @return {?} */ function getCaseIndex(icuExpression, bindingValue) { /** @type {?} */ var index = icuExpression.cases.indexOf(bindingValue); if (index === -1) { switch (icuExpression.type) { case 1 /* plural */ : { /** @type {?} */ var resolvedCase = getPluralCase(bindingValue, getLocaleId()); index = icuExpression.cases.indexOf(resolvedCase); if (index === -1 && resolvedCase !== 'other') { index = icuExpression.cases.indexOf('other'); } break; } case 0 /* select */ : { index = icuExpression.cases.indexOf('other'); break; } } } return index; } /** * Generate the OpCodes for ICU expressions. * * @param {?} tIcus * @param {?} icuExpression * @param {?} startIndex * @param {?} expandoStartIndex * @return {?} */ function icuStart(tIcus, icuExpression, startIndex, expandoStartIndex) { /** @type {?} */ var createCodes = []; /** @type {?} */ var removeCodes = []; /** @type {?} */ var updateCodes = []; /** @type {?} */ var vars = []; /** @type {?} */ var childIcus = []; for (var i = 0; i < icuExpression.values.length; i++) { // Each value is an array of strings & other ICU expressions /** @type {?} */ var valueArr = icuExpression.values[i]; /** @type {?} */ var nestedIcus = []; for (var j = 0; j < valueArr.length; j++) { /** @type {?} */ var value = valueArr[j]; if (typeof value !== 'string') { // It is an nested ICU expression /** @type {?} */ var icuIndex = nestedIcus.push( /** @type {?} */ value) - 1; // Replace nested ICU expression by a comment node valueArr[j] = "<!--\uFFFD".concat(icuIndex, "\uFFFD-->"); } } /** @type {?} */ var icuCase = parseIcuCase(valueArr.join(''), startIndex, nestedIcus, tIcus, expandoStartIndex); createCodes.push(icuCase.create); removeCodes.push(icuCase.remove); updateCodes.push(icuCase.update); vars.push(icuCase.vars); childIcus.push(icuCase.childIcus); } /** @type {?} */ var tIcu = { type: icuExpression.type, vars: vars, childIcus: childIcus, cases: icuExpression.cases, create: createCodes, remove: removeCodes, update: updateCodes }; tIcus.push(tIcu); // Adding the maximum possible of vars needed (based on the cases with the most vars) i18nVarsCount += Math.max.apply(Math, vars); } /** * Transforms a string template into an HTML template and a list of instructions used to update * attributes or nodes that contain bindings. * * @param {?} unsafeHtml The string to parse * @param {?} parentIndex * @param {?} nestedIcus * @param {?} tIcus * @param {?} expandoStartIndex * @return {?} */ function parseIcuCase(unsafeHtml, parentIndex, nestedIcus, tIcus, expandoStartIndex) { /** @type {?} */ var inertBodyHelper = new InertBodyHelper(document); /** @type {?} */ var inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml); if (!inertBodyElement) { throw new Error('Unable to generate inert body element'); } /** @type {?} */ var wrapper = /** @type {?} */ getTemplateContent( /** @type {?} */ inertBodyElement) || inertBodyElement; /** @type {?} */ var opCodes = { vars: 0, childIcus: [], create: [], remove: [], update: [] }; parseNodes(wrapper.firstChild, opCodes, parentIndex, nestedIcus, tIcus, expandoStartIndex); return opCodes; } /** @type {?} */ var NESTED_ICU = /�(\d+)�/; /** * Parses a node, its children and its siblings, and generates the mutate & update OpCodes. * * @param {?} currentNode The first node to parse * @param {?} icuCase The data for the ICU expression case that contains those nodes * @param {?} parentIndex Index of the current node's parent * @param {?} nestedIcus Data for the nested ICU expressions that this case contains * @param {?} tIcus Data for all ICU expressions of the current message * @param {?} expandoStartIndex Expando start index for the current ICU expression * @return {?} */ function parseNodes(currentNode, icuCase, parentIndex, nestedIcus, tIcus, expandoStartIndex) { if (currentNode) { /** @type {?} */ var nestedIcusToCreate = []; while (currentNode) { /** @type {?} */ var nextNode = currentNode.nextSibling; /** @type {?} */ var newIndex = expandoStartIndex + ++icuCase.vars; switch (currentNode.nodeType) { case Node.ELEMENT_NODE: /** @type {?} */ var element = /** @type {?} */ currentNode; /** @type {?} */ var tagName = element.tagName.toLowerCase(); if (!VALID_ELEMENTS.hasOwnProperty(tagName)) { // This isn't a valid element, we won't create an element for it icuCase.vars--; } else { icuCase.create.push(ELEMENT_MARKER, tagName, newIndex, parentIndex << 17 /* SHIFT_PARENT */ | 1 /* AppendChild */ ); /** @type {?} */ var elAttrs = element.attributes; for (var i = 0; i < elAttrs.length; i++) { /** @type {?} */ var attr = /** @type {?} */ elAttrs.item(i); /** @type {?} */ var lowerAttrName = attr.name.toLowerCase(); /** @type {?} */ var _hasBinding = !!attr.value.match(BINDING_REGEXP); // we assume the input string is safe, unless it's using a binding if (_hasBinding) { if (VALID_ATTRS.hasOwnProperty(lowerAttrName)) { if (URI_ATTRS[lowerAttrName]) { addAllToArray(generateBindingUpdateOpCodes(attr.value, newIndex, attr.name, _sanitizeUrl), icuCase.update); } else if (SRCSET_ATTRS[lowerAttrName]) { addAllToArray(generateBindingUpdateOpCodes(attr.value, newIndex, attr.name, sanitizeSrcset), icuCase.update); } else { addAllToArray(generateBindingUpdateOpCodes(attr.value, newIndex, attr.name), icuCase.update); } } else { ngDevMode && console.warn("WARNING: ignoring unsafe attribute value ".concat(lowerAttrName, " on element ").concat(tagName, " (see http://g.co/ng/security#xss)")); } } else { icuCase.create.push(newIndex << 3 /* SHIFT_REF */ | 4 /* Attr */ , attr.name, attr.value); } } // Parse the children of this node (if any) parseNodes(currentNode.firstChild, icuCase, newIndex, nestedIcus, tIcus, expandoStartIndex); // Remove the parent node after the children icuCase.remove.push(newIndex << 3 /* SHIFT_REF */ | 3 /* Remove */ ); } break; case Node.TEXT_NODE: /** @type {?} */ var value = currentNode.textContent || ''; /** @type {?} */ var hasBinding = value.match(BINDING_REGEXP); icuCase.create.push(hasBinding ? '' : value, newIndex, parentIndex << 17 /* SHIFT_PARENT */ | 1 /* AppendChild */ ); icuCase.remove.push(newIndex << 3 /* SHIFT_REF */ | 3 /* Remove */ ); if (hasBinding) { addAllToArray(generateBindingUpdateOpCodes(value, newIndex), icuCase.update); } break; case Node.COMMENT_NODE: // Check if the comment node is a placeholder for a nested ICU /** @type {?} */ var match = NESTED_ICU.exec(currentNode.textContent || ''); if (match) { /** @type {?} */ var nestedIcuIndex = parseInt(match[1], 10); /** @type {?} */ var newLocal = ngDevMode ? "nested ICU ".concat(nestedIcuIndex) : ''; // Create the comment node that will anchor the ICU expression icuCase.create.push(COMMENT_MARKER, newLocal, newIndex, parentIndex << 17 /* SHIFT_PARENT */ | 1 /* AppendChild */ ); /** @type {?} */ var nestedIcu = nestedIcus[nestedIcuIndex]; nestedIcusToCreate.push([nestedIcu, newIndex]); } else { // We do not handle any other type of comment icuCase.vars--; } break; default: // We do not handle any other type of element icuCase.vars--; } currentNode = /** @type {?} */ nextNode; } for (var _i19 = 0; _i19 < nestedIcusToCreate.length; _i19++) { /** @type {?} */ var _nestedIcu = nestedIcusToCreate[_i19][0]; /** @type {?} */ var nestedIcuNodeIndex = nestedIcusToCreate[_i19][1]; icuStart(tIcus, _nestedIcu, nestedIcuNodeIndex, expandoStartIndex + icuCase.vars); // Since this is recursive, the last TIcu that was pushed is the one we want /** @type {?} */ var nestTIcuIndex = tIcus.length - 1; icuCase.vars += Math.max.apply(Math, _toConsumableArray(tIcus[nestTIcuIndex].vars)); icuCase.childIcus.push(nestTIcuIndex); /** @type {?} */ var mask = getBindingMask(_nestedIcu); icuCase.update.push(toMaskBit(_nestedIcu.mainBinding), // mask of the main binding 3, // skip 3 opCodes if not changed -1 - _nestedIcu.mainBinding, nestedIcuNodeIndex << 2 /* SHIFT_REF */ | 2 /* IcuSwitch */ , nestTIcuIndex, mask, // mask of all the bindings of this ICU expression 2, // skip 2 opCodes if not changed nestedIcuNodeIndex << 2 /* SHIFT_REF */ | 3 /* IcuUpdate */ , nestTIcuIndex); icuCase.remove.push(nestTIcuIndex << 3 /* SHIFT_REF */ | 6 /* RemoveNestedIcu */ , nestedIcuNodeIndex << 3 /* SHIFT_REF */ | 3 /* Remove */ ); } } } /** * Angular Dart introduced &ngsp; as a placeholder for non-removable space, see: * https://github.com/dart-lang/angular/blob/0bb611387d29d65b5af7f9d2515ab571fd3fbee4/_tests/test/compiler/preserve_whitespace_test.dart#L25-L32 * In Angular Dart &ngsp; is converted to the 0xE500 PUA (Private Use Areas) unicode character * and later on replaced by a space. We are re-implementing the same idea here, since translations * might contain this special character. * @type {?} */ var NGSP_UNICODE_REGEXP = /\uE500/g; /** * @param {?} value * @return {?} */ function replaceNgsp(value) { return value.replace(NGSP_UNICODE_REGEXP, ' '); } /** @type {?} */ var TRANSLATIONS = {}; /** * @record */ function I18nLocalizeOptions() {} if (false) {} /** * Set the configuration for `i18nLocalize`. * * @deprecated this method is temporary & should not be used as it will be removed soon * @param {?=} options * @return {?} */ function i18nConfigureLocalize() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { translations: {} }; TRANSLATIONS = options.translations; } /** @type {?} */ var LOCALIZE_PH_REGEXP = /\{\$(.*?)\}/g; /** * A goog.getMsg-like function for users that do not use Closure. * * This method is required as a *temporary* measure to prevent i18n tests from being blocked while * running outside of Closure Compiler. This method will not be needed once runtime translation * service support is introduced. * * \@codeGenApi * @deprecated this method is temporary & should not be used as it will be removed soon * @param {?} input * @param {?=} placeholders * @return {?} */ function ɵɵi18nLocalize(input, placeholders) { if (typeof TRANSLATIONS[input] !== 'undefined') { // to account for empty string input = TRANSLATIONS[input]; } if (placeholders !== undefined && Object.keys(placeholders).length) { return input.replace(LOCALIZE_PH_REGEXP, /** * @param {?} _ * @param {?} key * @return {?} */ function (_, key) { return placeholders[key] || ''; }); } return input; } /** * The locale id that the application is currently using (for translations and ICU expressions). * This is the ivy version of `LOCALE_ID` that was defined as an injection token for the view engine * but is now defined as a global value. * @type {?} */ var LOCALE_ID = DEFAULT_LOCALE_ID; /** * Sets the locale id that will be used for translations and ICU expressions. * This is the ivy version of `LOCALE_ID` that was defined as an injection token for the view engine * but is now defined as a global value. * * @param {?} localeId * @return {?} */ function setLocaleId(localeId) { assertDefined(localeId, "Expected localeId to be defined"); if (typeof localeId === 'string') { LOCALE_ID = localeId.toLowerCase().replace(/_/g, '-'); } } /** * Gets the locale id that will be used for translations and ICU expressions. * This is the ivy version of `LOCALE_ID` that was defined as an injection token for the view engine * but is now defined as a global value. * @return {?} */ function getLocaleId() { return LOCALE_ID; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Map of module-id to the corresponding NgModule. * - In pre Ivy we track NgModuleFactory, * - In post Ivy we track the NgModuleType * @type {?} */ var modules = new Map(); /** * Registers a loaded module. Should only be called from generated NgModuleFactory code. * \@publicApi * @param {?} id * @param {?} factory * @return {?} */ function registerModuleFactory(id, factory) { /** @type {?} */ var existing = /** @type {?} */ modules.get(id); assertSameOrNotExisting(id, existing && existing.moduleType, factory.moduleType); modules.set(id, factory); } /** * @param {?} id * @param {?} type * @param {?} incoming * @return {?} */ function assertSameOrNotExisting(id, type, incoming) { if (type && type !== incoming) { throw new Error("Duplicate module registered for ".concat(id, " - ").concat(stringify(type), " vs ").concat(stringify(type.name))); } } /** * @param {?} ngModuleType * @return {?} */ function registerNgModuleType(ngModuleType) { if (ngModuleType.ngModuleDef.id !== null) { /** @type {?} */ var id = ngModuleType.ngModuleDef.id; /** @type {?} */ var existing = /** @type {?} */ modules.get(id); assertSameOrNotExisting(id, existing, ngModuleType); modules.set(id, ngModuleType); } /** @type {?} */ var imports = ngModuleType.ngModuleDef.imports; if (imports instanceof Function) { imports = imports(); } if (imports) { imports.forEach( /** * @param {?} i * @return {?} */ function (i) { return registerNgModuleType( /** @type {?} */ i); }); } } /** * @return {?} */ function clearModulesForTest() { modules.clear(); } /** * @param {?} id * @return {?} */ function getRegisteredNgModuleType(id) { return modules.get(id); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record * @template T */ function NgModuleType() {} if (false) {} /** @type {?} */ var COMPONENT_FACTORY_RESOLVER = { provide: ComponentFactoryResolver, useClass: ComponentFactoryResolver$1, deps: [NgModuleRef] }; /** * @template T */ var NgModuleRef$1 = /*#__PURE__*/function (_NgModuleRef) { _inherits(NgModuleRef$1, _NgModuleRef); var _super118 = _createSuper(NgModuleRef$1); /** * @param {?} ngModuleType * @param {?} _parent */ function NgModuleRef$1(ngModuleType, _parent) { var _this337; _classCallCheck(this, NgModuleRef$1); _this337 = _super118.call(this); _this337._parent = _parent; // tslint:disable-next-line:require-internal-with-underscore _this337._bootstrapComponents = []; _this337.injector = _assertThisInitialized(_this337); _this337.destroyCbs = []; /** @type {?} */ /** @nocollapse */ var ngModuleDef = getNgModuleDef(ngModuleType); ngDevMode && assertDefined(ngModuleDef, "NgModule '".concat(stringify(ngModuleType), "' is not a subtype of 'NgModuleType'.")); /** @type {?} */ var ngLocaleIdDef = getNgLocaleIdDef(ngModuleType); if (ngLocaleIdDef) { setLocaleId(ngLocaleIdDef); } _this337._bootstrapComponents = maybeUnwrapFn( /** @type {?} */ ngModuleDef.bootstrap); /** @type {?} */ var additionalProviders = [{ provide: NgModuleRef, useValue: _assertThisInitialized(_this337) }, COMPONENT_FACTORY_RESOLVER]; _this337._r3Injector = /** @type {?} */ createInjector(ngModuleType, _parent, additionalProviders, stringify(ngModuleType)); _this337.instance = _this337.get(ngModuleType); return _this337; } /** * @param {?} token * @param {?=} notFoundValue * @param {?=} injectFlags * @return {?} */ _createClass2(NgModuleRef$1, [{ key: "get", value: function get(token) { var notFoundValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Injector.THROW_IF_NOT_FOUND; var injectFlags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : InjectFlags.Default; if (token === Injector || token === NgModuleRef || token === INJECTOR) { return this; } return this._r3Injector.get(token, notFoundValue, injectFlags); } /** * @return {?} */ }, { key: "destroy", /** * @return {?} */ value: function destroy() { ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed'); /** @type {?} */ var injector = this._r3Injector; !injector.destroyed && injector.destroy(); /** @type {?} */ this.destroyCbs.forEach( /** * @param {?} fn * @return {?} */ function (fn) { return fn(); }); this.destroyCbs = null; } /** * @param {?} callback * @return {?} */ }, { key: "onDestroy", value: function onDestroy(callback) { ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed'); /** @type {?} */ this.destroyCbs.push(callback); } }, { key: "componentFactoryResolver", get: function get() { return this.get(ComponentFactoryResolver); } }]); return NgModuleRef$1; }(NgModuleRef); if (false) {} /** * @template T */ var NgModuleFactory$1 = /*#__PURE__*/function (_NgModuleFactory) { _inherits(NgModuleFactory$1, _NgModuleFactory); var _super119 = _createSuper(NgModuleFactory$1); /** * @param {?} moduleType */ function NgModuleFactory$1(moduleType) { var _this338; _classCallCheck(this, NgModuleFactory$1); _this338 = _super119.call(this); _this338.moduleType = moduleType; /** @type {?} */ /** @nocollapse */ var ngModuleDef = getNgModuleDef(moduleType); if (ngModuleDef !== null) { // Register the NgModule with Angular's module registry. The location (and hence timing) of // this call is critical to ensure this works correctly (modules get registered when expected) // without bloating bundles (modules are registered when otherwise not referenced). // // In View Engine, registration occurs in the .ngfactory.js file as a side effect. This has // several practical consequences: // // - If an .ngfactory file is not imported from, the module won't be registered (and can be // tree shaken). // - If an .ngfactory file is imported from, the module will be registered even if an instance // is not actually created (via `create` below). // - Since an .ngfactory file in View Engine references the .ngfactory files of the NgModule's // imports, // // In Ivy, things are a bit different. .ngfactory files still exist for compatibility, but are // not a required API to use - there are other ways to obtain an NgModuleFactory for a given // NgModule. Thus, relying on a side effect in the .ngfactory file is not sufficient. Instead, // the side effect of registration is added here, in the constructor of NgModuleFactory, // ensuring no matter how a factory is created, the module is registered correctly. // // An alternative would be to include the registration side effect inline following the actual // NgModule definition. This also has the correct timing, but breaks tree-shaking - modules // will be registered and retained even if they're otherwise never referenced. registerNgModuleType( /** @type {?} */ moduleType); } return _this338; } /** * @param {?} parentInjector * @return {?} */ _createClass2(NgModuleFactory$1, [{ key: "create", value: function create(parentInjector) { return new NgModuleRef$1(this.moduleType, parentInjector); } }]); return NgModuleFactory$1; }(NgModuleFactory); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function TypeWithMetadata() {} if (false) {} /** * Adds decorator, constructor, and property metadata to a given type via static metadata fields * on the type. * * These metadata fields can later be read with Angular's `ReflectionCapabilities` API. * * Calls to `setClassMetadata` can be marked as pure, resulting in the metadata assignments being * tree-shaken away during production builds. * @param {?} type * @param {?} decorators * @param {?} ctorParameters * @param {?} propDecorators * @return {?} */ function setClassMetadata(type, decorators, ctorParameters, propDecorators) { return ( /** @type {?} */ noSideEffects( /** * @return {?} */ function () { /** @type {?} */ var clazz = /** @type {?} */ type; // We determine whether a class has its own metadata by taking the metadata from the parent // constructor and checking whether it's the same as the subclass metadata below. We can't use // `hasOwnProperty` here because it doesn't work correctly in IE10 for static fields that are // defined by TS. See https://github.com/angular/angular/pull/28439#issuecomment-459349218. /** @type {?} */ var parentPrototype = clazz.prototype ? Object.getPrototypeOf(clazz.prototype) : null; /** @type {?} */ var parentConstructor = parentPrototype && parentPrototype.constructor; if (decorators !== null) { if (clazz.decorators !== undefined && (!parentConstructor || parentConstructor.decorators !== clazz.decorators)) { var _clazz$decorators; (_clazz$decorators = clazz.decorators).push.apply(_clazz$decorators, _toConsumableArray(decorators)); } else { clazz.decorators = decorators; } } if (ctorParameters !== null) { // Rather than merging, clobber the existing parameters. If other projects exist which use // tsickle-style annotations and reflect over them in the same way, this could cause issues, // but that is vanishingly unlikely. clazz.ctorParameters = ctorParameters; } if (propDecorators !== null) { // The property decorator objects are merged as it is possible different fields have different // decorator types. Decorators on individual fields are not merged, as it's also incredibly // unlikely that a field will be decorated both with an Angular decorator and a non-Angular // decorator that's also been downleveled. if (clazz.propDecorators !== undefined && (!parentConstructor || parentConstructor.propDecorators !== clazz.propDecorators)) { clazz.propDecorators = Object.assign({}, clazz.propDecorators, propDecorators); } else { clazz.propDecorators = propDecorators; } } }) ); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Bindings for pure functions are stored after regular bindings. * * |------consts------|---------vars---------| |----- hostVars (dir1) ------| * ------------------------------------------------------------------------------------------ * | nodes/refs/pipes | bindings | fn slots | injector | dir1 | host bindings | host slots | * ------------------------------------------------------------------------------------------ * ^ ^ * TView.bindingStartIndex TView.expandoStartIndex * * Pure function instructions are given an offset from the binding root. Adding the offset to the * binding root gives the first index where the bindings are stored. In component views, the binding * root is the bindingStartIndex. In host bindings, the binding root is the expandoStartIndex + * any directive instances + any hostVars in directives evaluated before it. * * See VIEW_DATA.md for more information about host binding resolution. */ /** * If the value hasn't been saved, calls the pure function to store and return the * value. If it has been saved, returns the saved value. * * \@codeGenApi * @template T * @param {?} slotOffset the offset from binding root to the reserved slot * @param {?} pureFn Function that returns a value * @param {?=} thisArg Optional calling context of pureFn * @return {?} value * */ function ɵɵpureFunction0(slotOffset, pureFn, thisArg) { // TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings /** @type {?} */ var bindingIndex = getBindingRoot() + slotOffset; /** @type {?} */ var lView = getLView(); return isCreationMode() ? updateBinding(lView, bindingIndex, thisArg ? pureFn.call(thisArg) : pureFn()) : getBinding(lView, bindingIndex); } /** * If the value of the provided exp has changed, calls the pure function to return * an updated value. Or if the value has not changed, returns cached value. * * \@codeGenApi * @param {?} slotOffset the offset from binding root to the reserved slot * @param {?} pureFn Function that returns an updated value * @param {?} exp Updated expression value * @param {?=} thisArg Optional calling context of pureFn * @return {?} Updated or cached value * */ function ɵɵpureFunction1(slotOffset, pureFn, exp, thisArg) { // TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings /** @type {?} */ var lView = getLView(); /** @type {?} */ var bindingIndex = getBindingRoot() + slotOffset; return bindingUpdated(lView, bindingIndex, exp) ? updateBinding(lView, bindingIndex + 1, thisArg ? pureFn.call(thisArg, exp) : pureFn(exp)) : getBinding(lView, bindingIndex + 1); } /** * If the value of any provided exp has changed, calls the pure function to return * an updated value. Or if no values have changed, returns cached value. * * \@codeGenApi * @param {?} slotOffset the offset from binding root to the reserved slot * @param {?} pureFn * @param {?} exp1 * @param {?} exp2 * @param {?=} thisArg Optional calling context of pureFn * @return {?} Updated or cached value * */ function ɵɵpureFunction2(slotOffset, pureFn, exp1, exp2, thisArg) { // TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings /** @type {?} */ var bindingIndex = getBindingRoot() + slotOffset; /** @type {?} */ var lView = getLView(); return bindingUpdated2(lView, bindingIndex, exp1, exp2) ? updateBinding(lView, bindingIndex + 2, thisArg ? pureFn.call(thisArg, exp1, exp2) : pureFn(exp1, exp2)) : getBinding(lView, bindingIndex + 2); } /** * If the value of any provided exp has changed, calls the pure function to return * an updated value. Or if no values have changed, returns cached value. * * \@codeGenApi * @param {?} slotOffset the offset from binding root to the reserved slot * @param {?} pureFn * @param {?} exp1 * @param {?} exp2 * @param {?} exp3 * @param {?=} thisArg Optional calling context of pureFn * @return {?} Updated or cached value * */ function ɵɵpureFunction3(slotOffset, pureFn, exp1, exp2, exp3, thisArg) { // TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings /** @type {?} */ var bindingIndex = getBindingRoot() + slotOffset; /** @type {?} */ var lView = getLView(); return bindingUpdated3(lView, bindingIndex, exp1, exp2, exp3) ? updateBinding(lView, bindingIndex + 3, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3) : pureFn(exp1, exp2, exp3)) : getBinding(lView, bindingIndex + 3); } /** * If the value of any provided exp has changed, calls the pure function to return * an updated value. Or if no values have changed, returns cached value. * * \@codeGenApi * @param {?} slotOffset the offset from binding root to the reserved slot * @param {?} pureFn * @param {?} exp1 * @param {?} exp2 * @param {?} exp3 * @param {?} exp4 * @param {?=} thisArg Optional calling context of pureFn * @return {?} Updated or cached value * */ function ɵɵpureFunction4(slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg) { // TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings /** @type {?} */ var bindingIndex = getBindingRoot() + slotOffset; /** @type {?} */ var lView = getLView(); return bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4) ? updateBinding(lView, bindingIndex + 4, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4) : pureFn(exp1, exp2, exp3, exp4)) : getBinding(lView, bindingIndex + 4); } /** * If the value of any provided exp has changed, calls the pure function to return * an updated value. Or if no values have changed, returns cached value. * * \@codeGenApi * @param {?} slotOffset the offset from binding root to the reserved slot * @param {?} pureFn * @param {?} exp1 * @param {?} exp2 * @param {?} exp3 * @param {?} exp4 * @param {?} exp5 * @param {?=} thisArg Optional calling context of pureFn * @return {?} Updated or cached value * */ function ɵɵpureFunction5(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, thisArg) { // TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings /** @type {?} */ var bindingIndex = getBindingRoot() + slotOffset; /** @type {?} */ var lView = getLView(); /** @type {?} */ var different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4); return bindingUpdated(lView, bindingIndex + 4, exp5) || different ? updateBinding(lView, bindingIndex + 5, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5) : pureFn(exp1, exp2, exp3, exp4, exp5)) : getBinding(lView, bindingIndex + 5); } /** * If the value of any provided exp has changed, calls the pure function to return * an updated value. Or if no values have changed, returns cached value. * * \@codeGenApi * @param {?} slotOffset the offset from binding root to the reserved slot * @param {?} pureFn * @param {?} exp1 * @param {?} exp2 * @param {?} exp3 * @param {?} exp4 * @param {?} exp5 * @param {?} exp6 * @param {?=} thisArg Optional calling context of pureFn * @return {?} Updated or cached value * */ function ɵɵpureFunction6(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, thisArg) { // TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings /** @type {?} */ var bindingIndex = getBindingRoot() + slotOffset; /** @type {?} */ var lView = getLView(); /** @type {?} */ var different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4); return bindingUpdated2(lView, bindingIndex + 4, exp5, exp6) || different ? updateBinding(lView, bindingIndex + 6, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6) : pureFn(exp1, exp2, exp3, exp4, exp5, exp6)) : getBinding(lView, bindingIndex + 6); } /** * If the value of any provided exp has changed, calls the pure function to return * an updated value. Or if no values have changed, returns cached value. * * \@codeGenApi * @param {?} slotOffset the offset from binding root to the reserved slot * @param {?} pureFn * @param {?} exp1 * @param {?} exp2 * @param {?} exp3 * @param {?} exp4 * @param {?} exp5 * @param {?} exp6 * @param {?} exp7 * @param {?=} thisArg Optional calling context of pureFn * @return {?} Updated or cached value * */ function ɵɵpureFunction7(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, exp7, thisArg) { // TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings /** @type {?} */ var bindingIndex = getBindingRoot() + slotOffset; /** @type {?} */ var lView = getLView(); /** @type {?} */ var different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4); return bindingUpdated3(lView, bindingIndex + 4, exp5, exp6, exp7) || different ? updateBinding(lView, bindingIndex + 7, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6, exp7) : pureFn(exp1, exp2, exp3, exp4, exp5, exp6, exp7)) : getBinding(lView, bindingIndex + 7); } /** * If the value of any provided exp has changed, calls the pure function to return * an updated value. Or if no values have changed, returns cached value. * * \@codeGenApi * @param {?} slotOffset the offset from binding root to the reserved slot * @param {?} pureFn * @param {?} exp1 * @param {?} exp2 * @param {?} exp3 * @param {?} exp4 * @param {?} exp5 * @param {?} exp6 * @param {?} exp7 * @param {?} exp8 * @param {?=} thisArg Optional calling context of pureFn * @return {?} Updated or cached value * */ function ɵɵpureFunction8(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8, thisArg) { // TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings /** @type {?} */ var bindingIndex = getBindingRoot() + slotOffset; /** @type {?} */ var lView = getLView(); /** @type {?} */ var different = bindingUpdated4(lView, bindingIndex, exp1, exp2, exp3, exp4); return bindingUpdated4(lView, bindingIndex + 4, exp5, exp6, exp7, exp8) || different ? updateBinding(lView, bindingIndex + 8, thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8) : pureFn(exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8)) : getBinding(lView, bindingIndex + 8); } /** * pureFunction instruction that can support any number of bindings. * * If the value of any provided exp has changed, calls the pure function to return * an updated value. Or if no values have changed, returns cached value. * * \@codeGenApi * @param {?} slotOffset the offset from binding root to the reserved slot * @param {?} pureFn A pure function that takes binding values and builds an object or array * containing those values. * @param {?} exps An array of binding values * @param {?=} thisArg Optional calling context of pureFn * @return {?} Updated or cached value * */ function ɵɵpureFunctionV(slotOffset, pureFn, exps, thisArg) { // TODO(kara): use bindingRoot instead of bindingStartIndex when implementing host bindings /** @type {?} */ var bindingIndex = getBindingRoot() + slotOffset; /** @type {?} */ var different = false; /** @type {?} */ var lView = getLView(); for (var i = 0; i < exps.length; i++) { bindingUpdated(lView, bindingIndex++, exps[i]) && (different = true); } return different ? updateBinding(lView, bindingIndex, pureFn.apply(thisArg, exps)) : getBinding(lView, bindingIndex); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Create a pipe. * * \@codeGenApi * @param {?} index Pipe index where the pipe will be stored. * @param {?} pipeName The name of the pipe * @return {?} T the instance of the pipe. * */ function ɵɵpipe(index, pipeName) { /** @type {?} */ var tView = getLView()[TVIEW]; /** @type {?} */ var pipeDef; /** @type {?} */ var adjustedIndex = index + HEADER_OFFSET; if (tView.firstTemplatePass) { pipeDef = getPipeDef$1(pipeName, tView.pipeRegistry); tView.data[adjustedIndex] = pipeDef; if (pipeDef.onDestroy) { (tView.destroyHooks || (tView.destroyHooks = [])).push(adjustedIndex, pipeDef.onDestroy); } } else { pipeDef = /** @type {?} */ tView.data[adjustedIndex]; } /** @type {?} */ var pipeInstance = pipeDef.factory(); store(index, pipeInstance); return pipeInstance; } /** * Searches the pipe registry for a pipe with the given name. If one is found, * returns the pipe. Otherwise, an error is thrown because the pipe cannot be resolved. * * \@publicApi * @param {?} name Name of pipe to resolve * @param {?} registry Full list of available pipes * @return {?} Matching PipeDef * */ function getPipeDef$1(name, registry) { if (registry) { for (var i = registry.length - 1; i >= 0; i--) { /** @type {?} */ var _pipeDef = registry[i]; if (name === _pipeDef.name) { return _pipeDef; } } } throw new Error("The pipe '".concat(name, "' could not be found!")); } /** * Invokes a pipe with 1 arguments. * * This instruction acts as a guard to {\@link PipeTransform#transform} invoking * the pipe only when an input to the pipe changes. * * \@codeGenApi * @param {?} index Pipe index where the pipe was stored on creation. * @param {?} slotOffset the offset in the reserved slot space * @param {?} v1 1st argument to {\@link PipeTransform#transform}. * * @return {?} */ function ɵɵpipeBind1(index, slotOffset, v1) { /** @type {?} */ var pipeInstance = ɵɵload(index); return unwrapValue$1(isPure(index) ? ɵɵpureFunction1(slotOffset, pipeInstance.transform, v1, pipeInstance) : pipeInstance.transform(v1)); } /** * Invokes a pipe with 2 arguments. * * This instruction acts as a guard to {\@link PipeTransform#transform} invoking * the pipe only when an input to the pipe changes. * * \@codeGenApi * @param {?} index Pipe index where the pipe was stored on creation. * @param {?} slotOffset the offset in the reserved slot space * @param {?} v1 1st argument to {\@link PipeTransform#transform}. * @param {?} v2 2nd argument to {\@link PipeTransform#transform}. * * @return {?} */ function ɵɵpipeBind2(index, slotOffset, v1, v2) { /** @type {?} */ var pipeInstance = ɵɵload(index); return unwrapValue$1(isPure(index) ? ɵɵpureFunction2(slotOffset, pipeInstance.transform, v1, v2, pipeInstance) : pipeInstance.transform(v1, v2)); } /** * Invokes a pipe with 3 arguments. * * This instruction acts as a guard to {\@link PipeTransform#transform} invoking * the pipe only when an input to the pipe changes. * * \@codeGenApi * @param {?} index Pipe index where the pipe was stored on creation. * @param {?} slotOffset the offset in the reserved slot space * @param {?} v1 1st argument to {\@link PipeTransform#transform}. * @param {?} v2 2nd argument to {\@link PipeTransform#transform}. * @param {?} v3 4rd argument to {\@link PipeTransform#transform}. * * @return {?} */ function ɵɵpipeBind3(index, slotOffset, v1, v2, v3) { /** @type {?} */ var pipeInstance = ɵɵload(index); return unwrapValue$1(isPure(index) ? ɵɵpureFunction3(slotOffset, pipeInstance.transform, v1, v2, v3, pipeInstance) : pipeInstance.transform(v1, v2, v3)); } /** * Invokes a pipe with 4 arguments. * * This instruction acts as a guard to {\@link PipeTransform#transform} invoking * the pipe only when an input to the pipe changes. * * \@codeGenApi * @param {?} index Pipe index where the pipe was stored on creation. * @param {?} slotOffset the offset in the reserved slot space * @param {?} v1 1st argument to {\@link PipeTransform#transform}. * @param {?} v2 2nd argument to {\@link PipeTransform#transform}. * @param {?} v3 3rd argument to {\@link PipeTransform#transform}. * @param {?} v4 4th argument to {\@link PipeTransform#transform}. * * @return {?} */ function ɵɵpipeBind4(index, slotOffset, v1, v2, v3, v4) { /** @type {?} */ var pipeInstance = ɵɵload(index); return unwrapValue$1(isPure(index) ? ɵɵpureFunction4(slotOffset, pipeInstance.transform, v1, v2, v3, v4, pipeInstance) : pipeInstance.transform(v1, v2, v3, v4)); } /** * Invokes a pipe with variable number of arguments. * * This instruction acts as a guard to {\@link PipeTransform#transform} invoking * the pipe only when an input to the pipe changes. * * \@codeGenApi * @param {?} index Pipe index where the pipe was stored on creation. * @param {?} slotOffset the offset in the reserved slot space * @param {?} values Array of arguments to pass to {\@link PipeTransform#transform} method. * * @return {?} */ function ɵɵpipeBindV(index, slotOffset, values) { /** @type {?} */ var pipeInstance = ɵɵload(index); return unwrapValue$1(isPure(index) ? ɵɵpureFunctionV(slotOffset, pipeInstance.transform, values, pipeInstance) : pipeInstance.transform.apply(pipeInstance, values)); } /** * @param {?} index * @return {?} */ function isPure(index) { return ( /** @type {?} */ getLView()[TVIEW].data[index + HEADER_OFFSET].pure ); } /** * Unwrap the output of a pipe transformation. * In order to trick change detection into considering that the new value is always different from * the old one, the old value is overwritten by NO_CHANGE. * * @param {?} newValue the pipe transformation output. * @return {?} */ function unwrapValue$1(newValue) { if (WrappedValue.isWrapped(newValue)) { newValue = WrappedValue.unwrap(newValue); /** @type {?} */ var _lView10 = getLView(); // The NO_CHANGE value needs to be written at the index where the impacted binding value is // stored /** @type {?} */ var bindingToInvalidateIdx = _lView10[BINDING_INDEX]; _lView10[bindingToInvalidateIdx] = NO_CHANGE; } return newValue; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Use in components with the `\@Output` directive to emit custom events * synchronously or asynchronously, and register handlers for those events * by subscribing to an instance. * * \@usageNotes * * Extends * [RxJS `Subject`](https://rxjs.dev/api/index/class/Subject) * for Angular by adding the `emit()` method. * * In the following example, a component defines two output properties * that create event emitters. When the title is clicked, the emitter * emits an open or close event to toggle the current visibility state. * * ```html * \@Component({ * selector: 'zippy', * template: ` * <div class="zippy"> * <div (click)="toggle()">Toggle</div> * <div [hidden]="!visible"> * <ng-content></ng-content> * </div> * </div>`}) * export class Zippy { * visible: boolean = true; * \@Output() open: EventEmitter<any> = new EventEmitter(); * \@Output() close: EventEmitter<any> = new EventEmitter(); * * toggle() { * this.visible = !this.visible; * if (this.visible) { * this.open.emit(null); * } else { * this.close.emit(null); * } * } * } * ``` * * Access the event object with the `$event` argument passed to the output event * handler: * * ```html * <zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy> * ``` * * @see [Observables in Angular](guide/observables-in-angular) * \@publicApi * @template T */ var EventEmitter = /*#__PURE__*/function (_rxjs__WEBPACK_IMPORT) { _inherits(EventEmitter, _rxjs__WEBPACK_IMPORT); var _super120 = _createSuper(EventEmitter); // tslint:disable-line /** * Creates an instance of this class that can * deliver events synchronously or asynchronously. * * @param {?=} isAsync When true, deliver events asynchronously. * */ function EventEmitter() { var _this339; var isAsync = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; _classCallCheck(this, EventEmitter); _this339 = _super120.call(this); _this339.__isAsync = isAsync; return _this339; } /** * Emits an event containing a given value. * @param {?=} value The value to emit. * @return {?} */ _createClass2(EventEmitter, [{ key: "emit", value: function emit(value) { _get(_getPrototypeOf(EventEmitter.prototype), "next", this).call(this, value); } /** * Registers handlers for events emitted by this instance. * @param {?=} generatorOrNext When supplied, a custom handler for emitted events. * @param {?=} error When supplied, a custom handler for an error notification * from this emitter. * @param {?=} complete When supplied, a custom handler for a completion * notification from this emitter. * @return {?} */ }, { key: "subscribe", value: function subscribe(generatorOrNext, error, complete) { /** @type {?} */ var schedulerFn; /** @type {?} */ var errorFn = /** * @param {?} err * @return {?} */ function errorFn(err) { return null; }; /** @type {?} */ var completeFn = /** * @return {?} */ function completeFn() { return null; }; if (generatorOrNext && typeof generatorOrNext === 'object') { schedulerFn = this.__isAsync ? /** * @param {?} value * @return {?} */ function (value) { setTimeout( /** * @return {?} */ function () { return generatorOrNext.next(value); }); } : /** * @param {?} value * @return {?} */ function (value) { generatorOrNext.next(value); }; if (generatorOrNext.error) { errorFn = this.__isAsync ? /** * @param {?} err * @return {?} */ function (err) { setTimeout( /** * @return {?} */ function () { return generatorOrNext.error(err); }); } : /** * @param {?} err * @return {?} */ function (err) { generatorOrNext.error(err); }; } if (generatorOrNext.complete) { completeFn = this.__isAsync ? /** * @return {?} */ function () { setTimeout( /** * @return {?} */ function () { return generatorOrNext.complete(); }); } : /** * @return {?} */ function () { generatorOrNext.complete(); }; } } else { schedulerFn = this.__isAsync ? /** * @param {?} value * @return {?} */ function (value) { setTimeout( /** * @return {?} */ function () { return generatorOrNext(value); }); } : /** * @param {?} value * @return {?} */ function (value) { generatorOrNext(value); }; if (error) { errorFn = this.__isAsync ? /** * @param {?} err * @return {?} */ function (err) { setTimeout( /** * @return {?} */ function () { return error(err); }); } : /** * @param {?} err * @return {?} */ function (err) { error(err); }; } if (complete) { completeFn = this.__isAsync ? /** * @return {?} */ function () { setTimeout( /** * @return {?} */ function () { return complete(); }); } : /** * @return {?} */ function () { complete(); }; } } /** @type {?} */ var sink = _get(_getPrototypeOf(EventEmitter.prototype), "subscribe", this).call(this, schedulerFn, errorFn, completeFn); if (generatorOrNext instanceof rxjs__WEBPACK_IMPORTED_MODULE_0__["Subscription"]) { generatorOrNext.add(sink); } return sink; } }]); return EventEmitter; }(rxjs__WEBPACK_IMPORTED_MODULE_0__["Subject"]); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @template T * @this {?} * @return {?} */ function symbolIterator() { return ( /** @type {?} */ /** @type {?} */ /** @type {?} */ this._results[getSymbolIterator()]() ); } /** * An unmodifiable list of items that Angular keeps up to date when the state * of the application changes. * * The type of object that {\@link ViewChildren}, {\@link ContentChildren}, and {\@link QueryList} * provide. * * Implements an iterable interface, therefore it can be used in both ES6 * javascript `for (var i of items)` loops as well as in Angular templates with * `*ngFor="let i of myList"`. * * Changes can be observed by subscribing to the changes `Observable`. * * NOTE: In the future this class will implement an `Observable` interface. * * \@usageNotes * ### Example * ```typescript * \@Component({...}) * class Container { * \@ViewChildren(Item) items:QueryList<Item>; * } * ``` * * \@publicApi * @template T */ var QueryList = /*#__PURE__*/function () { function QueryList() { _classCallCheck(this, QueryList); this.dirty = true; this._results = []; this.changes = new EventEmitter(); this.length = 0; // This function should be declared on the prototype, but doing so there will cause the class // declaration to have side-effects and become not tree-shakable. For this reason we do it in // the constructor. // [getSymbolIterator()](): Iterator<T> { ... } /** @type {?} */ var symbol = getSymbolIterator(); /** @type {?} */ var proto = /** @type {?} */ QueryList.prototype; if (!proto[symbol]) proto[symbol] = symbolIterator; } /** * See * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) * @template U * @param {?} fn * @return {?} */ _createClass2(QueryList, [{ key: "map", value: function map(fn) { return this._results.map(fn); } /** * See * [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) * @param {?} fn * @return {?} */ }, { key: "filter", value: function filter(fn) { return this._results.filter(fn); } /** * See * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) * @param {?} fn * @return {?} */ }, { key: "find", value: function find(fn) { return this._results.find(fn); } /** * See * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) * @template U * @param {?} fn * @param {?} init * @return {?} */ }, { key: "reduce", value: function reduce(fn, init) { return this._results.reduce(fn, init); } /** * See * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) * @param {?} fn * @return {?} */ }, { key: "forEach", value: function forEach(fn) { this._results.forEach(fn); } /** * See * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) * @param {?} fn * @return {?} */ }, { key: "some", value: function some(fn) { return this._results.some(fn); } /** * Returns a copy of the internal results list as an Array. * @return {?} */ }, { key: "toArray", value: function toArray() { return this._results.slice(); } /** * @return {?} */ }, { key: "toString", value: function toString() { return this._results.toString(); } /** * Updates the stored data of the query list, and resets the `dirty` flag to `false`, so that * on change detection, it will not notify of changes to the queries, unless a new change * occurs. * * @param {?} resultsTree The query results to store * @return {?} */ }, { key: "reset", value: function reset(resultsTree) { this._results = flatten(resultsTree); /** @type {?} */ this.dirty = false; /** @type {?} */ this.length = this._results.length; /** @type {?} */ this.last = this._results[this.length - 1]; /** @type {?} */ this.first = this._results[0]; } /** * Triggers a change event by emitting on the `changes` {\@link EventEmitter}. * @return {?} */ }, { key: "notifyOnChanges", value: function notifyOnChanges() { /** @type {?} */ this.changes.emit(this); } /** * internal * @return {?} */ }, { key: "setDirty", value: function setDirty() { /** @type {?} */ this.dirty = true; } /** * internal * @return {?} */ }, { key: "destroy", value: function destroy() { /** @type {?} */ this.changes.complete(); /** @type {?} */ this.changes.unsubscribe(); } }]); return QueryList; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** @enum {number} */ var RenderFlags = { /* Whether to run the creation block (e.g. create elements and directives) */ Create: 1, /* Whether to run the update block (e.g. refresh bindings) */ Update: 2 }; /** * A subclass of `Type` which has a static `ngComponentDef`:`ComponentDef` field making it * consumable for rendering. * @record * @template T */ function ComponentType() {} if (false) {} /** * A subclass of `Type` which has a static `ngDirectiveDef`:`DirectiveDef` field making it * consumable for rendering. * @record * @template T */ function DirectiveType() {} if (false) {} /** @enum {number} */ var DirectiveDefFlags = { ContentQuery: 2 }; /** * A subclass of `Type` which has a static `ngPipeDef`:`PipeDef` field making it * consumable for rendering. * @record * @template T */ function PipeType() {} if (false) {} /** * Runtime information for classes that are inherited by components or directives * that aren't defined as components or directives. * * This is an internal data structure used by the renderer to determine what inputs * and outputs should be inherited. * * See: {\@link defineBase} * * \@codeGenApi * @record * @template T */ function ɵɵBaseDef() {} if (false) {} /** * Runtime link information for Directives. * * This is internal data structure used by the render to link * directives into templates. * * NOTE: Always use `defineDirective` function to create this object, * never create the object directly since the shape of this object * can change between versions. * * @param Selector type metadata specifying the selector of the directive or component * * See: {\@link defineDirective} * @record * @template T */ function DirectiveDef() {} if (false) {} /** * Runtime link information for Components. * * This is internal data structure used by the render to link * components into templates. * * NOTE: Always use `defineComponent` function to create this object, * never create the object directly since the shape of this object * can change between versions. * * See: {\@link defineComponent} * @record * @template T */ function ComponentDef() {} if (false) {} /** * Runtime link information for Pipes. * * This is internal data structure used by the renderer to link * pipes into templates. * * NOTE: Always use `definePipe` function to create this object, * never create the object directly since the shape of this object * can change between versions. * * See: {\@link definePipe} * @record * @template T */ function PipeDef() {} if (false) {} /** * @record */ function DirectiveDefFeature() {} if (false) {} /** * @record */ function ComponentDefFeature() {} if (false) {} // Note: This hack is necessary so we don't erroneously get a circular dependency // failure based on types. /** @type {?} */ var unusedValueExportToPlacateAjd$7 = 1; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 object representing query metadata extracted from query annotations. * @record */ function TQueryMetadata() {} if (false) {} /** * TQuery objects represent all the query-related data that remain the same from one view instance * to another and can be determined on the very first template pass. Most notably TQuery holds all * the matches for a given view. * @record */ function TQuery() {} if (false) {} /** * TQueries represent a collection of individual TQuery objects tracked in a given view. Most of the * methods on this interface are simple proxy methods to the corresponding functionality on TQuery. * @record */ function TQueries() {} if (false) {} /** * An interface that represents query-related information specific to a view instance. Most notably * it contains: * - materialized query matches; * - a pointer to a QueryList where materialized query results should be reported. * @record * @template T */ function LQuery() {} if (false) {} /** * lQueries represent a collection of individual LQuery objects tracked in a given view. * @record */ function LQueries() {} if (false) {} // Note: This hack is necessary so we don't erroneously get a circular dependency // failure based on types. /** @type {?} */ var unusedValueExportToPlacateAjd$8 = 1; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var unusedValueToPlacateAjd$2 = unusedValueExportToPlacateAjd$7 + unusedValueExportToPlacateAjd$2 + unusedValueExportToPlacateAjd$4 + unusedValueExportToPlacateAjd$8; /** * @template T */ var LQuery_ = /*#__PURE__*/function () { /** * @param {?} queryList */ function LQuery_(queryList) { _classCallCheck(this, LQuery_); this.queryList = queryList; this.matches = null; } /** * @return {?} */ _createClass2(LQuery_, [{ key: "clone", value: function clone() { return new LQuery_(this.queryList); } /** * @return {?} */ }, { key: "setDirty", value: function setDirty() { this.queryList.setDirty(); } }]); return LQuery_; }(); if (false) {} var LQueries_ = /*#__PURE__*/function () { /** * @param {?=} queries */ function LQueries_() { var queries = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; _classCallCheck(this, LQueries_); this.queries = queries; } /** * @param {?} tView * @return {?} */ _createClass2(LQueries_, [{ key: "createEmbeddedView", value: function createEmbeddedView(tView) { /** @type {?} */ var tQueries = tView.queries; if (tQueries !== null) { /** @type {?} */ var noOfInheritedQueries = tView.contentQueries !== null ? tView.contentQueries[0] : tQueries.length; /** @type {?} */ var viewLQueries = new Array(noOfInheritedQueries); // An embedded view has queries propagated from a declaration view at the beginning of the // TQueries collection and up until a first content query declared in the embedded view. Only // propagated LQueries are created at this point (LQuery corresponding to declared content // queries will be instantiated from the content query instructions for each directive). for (var i = 0; i < noOfInheritedQueries; i++) { /** @type {?} */ var tQuery = tQueries.getByIndex(i); /** @type {?} */ var parentLQuery = this.queries[tQuery.indexInDeclarationView]; viewLQueries[i] = parentLQuery.clone(); } return new LQueries_(viewLQueries); } return null; } /** * @param {?} tView * @return {?} */ }, { key: "insertView", value: function insertView(tView) { this.dirtyQueriesWithMatches(tView); } /** * @param {?} tView * @return {?} */ }, { key: "detachView", value: function detachView(tView) { this.dirtyQueriesWithMatches(tView); } /** * @private * @param {?} tView * @return {?} */ }, { key: "dirtyQueriesWithMatches", value: function dirtyQueriesWithMatches(tView) { for (var i = 0; i < this.queries.length; i++) { if (getTQuery(tView, i).matches !== null) { this.queries[i].setDirty(); } } } }]); return LQueries_; }(); if (false) {} var TQueryMetadata_ = /** * @param {?} predicate * @param {?} descendants * @param {?} isStatic * @param {?=} read */ function TQueryMetadata_(predicate, descendants, isStatic) { var read = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; _classCallCheck(this, TQueryMetadata_); this.predicate = predicate; this.descendants = descendants; this.isStatic = isStatic; this.read = read; }; if (false) {} var TQueries_ = /*#__PURE__*/function () { /** * @param {?=} queries */ function TQueries_() { var queries = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; _classCallCheck(this, TQueries_); this.queries = queries; } /** * @param {?} tView * @param {?} tNode * @return {?} */ _createClass2(TQueries_, [{ key: "elementStart", value: function elementStart(tView, tNode) { ngDevMode && assertFirstTemplatePass(tView, 'Queries should collect results on the first template pass only'); var _iterator38 = _createForOfIteratorHelper(this.queries), _step38; try { for (_iterator38.s(); !(_step38 = _iterator38.n()).done;) { var query = _step38.value; query.elementStart(tView, tNode); } } catch (err) { _iterator38.e(err); } finally { _iterator38.f(); } } /** * @param {?} tNode * @return {?} */ }, { key: "elementEnd", value: function elementEnd(tNode) { var _iterator39 = _createForOfIteratorHelper(this.queries), _step39; try { for (_iterator39.s(); !(_step39 = _iterator39.n()).done;) { var query = _step39.value; query.elementEnd(tNode); } } catch (err) { _iterator39.e(err); } finally { _iterator39.f(); } } /** * @param {?} tNode * @return {?} */ }, { key: "embeddedTView", value: function embeddedTView(tNode) { /** @type {?} */ var queriesForTemplateRef = null; for (var i = 0; i < this.length; i++) { /** @type {?} */ var childQueryIndex = queriesForTemplateRef !== null ? queriesForTemplateRef.length : 0; /** @type {?} */ var tqueryClone = this.getByIndex(i).embeddedTView(tNode, childQueryIndex); if (tqueryClone) { tqueryClone.indexInDeclarationView = i; if (queriesForTemplateRef !== null) { queriesForTemplateRef.push(tqueryClone); } else { queriesForTemplateRef = [tqueryClone]; } } } return queriesForTemplateRef !== null ? new TQueries_(queriesForTemplateRef) : null; } /** * @param {?} tView * @param {?} tNode * @return {?} */ }, { key: "template", value: function template(tView, tNode) { ngDevMode && assertFirstTemplatePass(tView, 'Queries should collect results on the first template pass only'); var _iterator40 = _createForOfIteratorHelper(this.queries), _step40; try { for (_iterator40.s(); !(_step40 = _iterator40.n()).done;) { var query = _step40.value; query.template(tView, tNode); } } catch (err) { _iterator40.e(err); } finally { _iterator40.f(); } } /** * @param {?} index * @return {?} */ }, { key: "getByIndex", value: function getByIndex(index) { ngDevMode && assertDataInRange(this.queries, index); return this.queries[index]; } /** * @return {?} */ }, { key: "track", /** * @param {?} tquery * @return {?} */ value: function track(tquery) { this.queries.push(tquery); } }, { key: "length", get: function get() { return this.queries.length; } }]); return TQueries_; }(); if (false) {} var TQuery_ = /*#__PURE__*/function () { /** * @param {?} metadata * @param {?=} nodeIndex */ function TQuery_(metadata) { var nodeIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1; _classCallCheck(this, TQuery_); this.metadata = metadata; this.matches = null; this.indexInDeclarationView = -1; this.crossesNgTemplate = false; /** * A flag indicating if a given query still applies to nodes it is crossing. We use this flag * (alongside with _declarationNodeIndex) to know when to stop applying content queries to * elements in a template. */ this._appliesToNextNode = true; this._declarationNodeIndex = nodeIndex; } /** * @param {?} tView * @param {?} tNode * @return {?} */ _createClass2(TQuery_, [{ key: "elementStart", value: function elementStart(tView, tNode) { if (this.isApplyingToNode(tNode)) { this.matchTNode(tView, tNode); } } /** * @param {?} tNode * @return {?} */ }, { key: "elementEnd", value: function elementEnd(tNode) { if (this._declarationNodeIndex === tNode.index) { this._appliesToNextNode = false; } } /** * @param {?} tView * @param {?} tNode * @return {?} */ }, { key: "template", value: function template(tView, tNode) { this.elementStart(tView, tNode); } /** * @param {?} tNode * @param {?} childQueryIndex * @return {?} */ }, { key: "embeddedTView", value: function embeddedTView(tNode, childQueryIndex) { if (this.isApplyingToNode(tNode)) { this.crossesNgTemplate = true; // A marker indicating a `<ng-template>` element (a placeholder for query results from // embedded views created based on this `<ng-template>`). this.addMatch(-tNode.index, childQueryIndex); return new TQuery_(this.metadata); } return null; } /** * @private * @param {?} tNode * @return {?} */ }, { key: "isApplyingToNode", value: function isApplyingToNode(tNode) { if (this._appliesToNextNode && this.metadata.descendants === false) { return this._declarationNodeIndex === (tNode.parent ? tNode.parent.index : -1); } return this._appliesToNextNode; } /** * @private * @param {?} tView * @param {?} tNode * @return {?} */ }, { key: "matchTNode", value: function matchTNode(tView, tNode) { if (Array.isArray(this.metadata.predicate)) { /** @type {?} */ var localNames = /** @type {?} */ this.metadata.predicate; for (var i = 0; i < localNames.length; i++) { this.matchTNodeWithReadOption(tView, tNode, getIdxOfMatchingSelector(tNode, localNames[i])); } } else { /** @type {?} */ var typePredicate = /** @type {?} */ this.metadata.predicate; if (typePredicate === TemplateRef) { if (tNode.type === 0 /* Container */ ) { this.matchTNodeWithReadOption(tView, tNode, -1); } } else { this.matchTNodeWithReadOption(tView, tNode, locateDirectiveOrProvider(tNode, tView, typePredicate, false, false)); } } } /** * @private * @param {?} tView * @param {?} tNode * @param {?} nodeMatchIdx * @return {?} */ }, { key: "matchTNodeWithReadOption", value: function matchTNodeWithReadOption(tView, tNode, nodeMatchIdx) { if (nodeMatchIdx !== null) { /** @type {?} */ var read = this.metadata.read; if (read !== null) { if (read === ElementRef || read === ViewContainerRef || read === TemplateRef && tNode.type === 0 /* Container */ ) { this.addMatch(tNode.index, -2); } else { /** @type {?} */ var directiveOrProviderIdx = locateDirectiveOrProvider(tNode, tView, read, false, false); if (directiveOrProviderIdx !== null) { this.addMatch(tNode.index, directiveOrProviderIdx); } } } else { this.addMatch(tNode.index, nodeMatchIdx); } } } /** * @private * @param {?} tNodeIdx * @param {?} matchIdx * @return {?} */ }, { key: "addMatch", value: function addMatch(tNodeIdx, matchIdx) { if (this.matches === null) { this.matches = [tNodeIdx, matchIdx]; } else { this.matches.push(tNodeIdx, matchIdx); } } }]); return TQuery_; }(); if (false) {} /** * Iterates over local names for a given node and returns directive index * (or -1 if a local name points to an element). * * @param {?} tNode static data of a node to check * @param {?} selector selector to match * @return {?} directive index, -1 or null if a selector didn't match any of the local names */ function getIdxOfMatchingSelector(tNode, selector) { /** @type {?} */ var localNames = tNode.localNames; if (localNames !== null) { for (var i = 0; i < localNames.length; i += 2) { if (localNames[i] === selector) { return ( /** @type {?} */ localNames[i + 1] ); } } } return null; } /** * @param {?} tNode * @param {?} currentView * @return {?} */ function createResultByTNodeType(tNode, currentView) { if (tNode.type === 3 /* Element */ || tNode.type === 4 /* ElementContainer */ ) { return createElementRef(ElementRef, tNode, currentView); } else if (tNode.type === 0 /* Container */ ) { return createTemplateRef(TemplateRef, ElementRef, tNode, currentView); } return null; } /** * @param {?} lView * @param {?} tNode * @param {?} matchingIdx * @param {?} read * @return {?} */ function createResultForNode(lView, tNode, matchingIdx, read) { if (matchingIdx === -1) { // if read token and / or strategy is not specified, detect it using appropriate tNode type return createResultByTNodeType(tNode, lView); } else if (matchingIdx === -2) { // read a special token from a node injector return createSpecialToken(lView, tNode, read); } else { // read a token return getNodeInjectable(lView[TVIEW].data, lView, matchingIdx, /** @type {?} */ tNode); } } /** * @param {?} lView * @param {?} tNode * @param {?} read * @return {?} */ function createSpecialToken(lView, tNode, read) { if (read === ElementRef) { return createElementRef(ElementRef, tNode, lView); } else if (read === TemplateRef) { return createTemplateRef(TemplateRef, ElementRef, tNode, lView); } else if (read === ViewContainerRef) { ngDevMode && assertNodeOfPossibleTypes(tNode, 3 /* Element */ , 0 /* Container */ , 4 /* ElementContainer */ ); return createContainerRef(ViewContainerRef, ElementRef, /** @type {?} */ tNode, lView); } else { ngDevMode && throwError("Special token to read should be one of ElementRef, TemplateRef or ViewContainerRef but got ".concat(stringify(read), ".")); } } /** * A helper function that creates query results for a given view. This function is meant to do the * processing once and only once for a given view instance (a set of results for a given view * doesn't change). * @template T * @param {?} lView * @param {?} tQuery * @param {?} queryIndex * @return {?} */ function materializeViewResults(lView, tQuery, queryIndex) { /** @type {?} */ var lQuery = /** @type {?} */ /** @type {?} */ lView[QUERIES].queries[queryIndex]; if (lQuery.matches === null) { /** @type {?} */ var tViewData = lView[TVIEW].data; /** @type {?} */ var tQueryMatches = /** @type {?} */ tQuery.matches; /** @type {?} */ var result = new Array(tQueryMatches.length / 2); for (var i = 0; i < tQueryMatches.length; i += 2) { /** @type {?} */ var matchedNodeIdx = tQueryMatches[i]; if (matchedNodeIdx < 0) { // we at the <ng-template> marker which might have results in views created based on this // <ng-template> - those results will be in separate views though, so here we just leave // null as a placeholder result[i / 2] = null; } else { ngDevMode && assertDataInRange(tViewData, matchedNodeIdx); /** @type {?} */ var tNode = /** @type {?} */ tViewData[matchedNodeIdx]; result[i / 2] = createResultForNode(lView, tNode, tQueryMatches[i + 1], tQuery.metadata.read); } } lQuery.matches = result; } return lQuery.matches; } /** * A helper function that collects (already materialized) query results from a tree of views, * starting with a provided LView. * @template T * @param {?} lView * @param {?} queryIndex * @param {?} result * @return {?} */ function collectQueryResults(lView, queryIndex, result) { /** @type {?} */ var tQuery = /** @type {?} */ lView[TVIEW].queries.getByIndex(queryIndex); /** @type {?} */ var tQueryMatches = tQuery.matches; if (tQueryMatches !== null) { /** @type {?} */ var lViewResults = materializeViewResults(lView, tQuery, queryIndex); for (var i = 0; i < tQueryMatches.length; i += 2) { /** @type {?} */ var tNodeIdx = tQueryMatches[i]; if (tNodeIdx > 0) { /** @type {?} */ var viewResult = lViewResults[i / 2]; ngDevMode && assertDefined(viewResult, 'materialized query result should be defined'); result.push( /** @type {?} */ viewResult); } else { /** @type {?} */ var childQueryIndex = tQueryMatches[i + 1]; /** @type {?} */ var declarationLContainer = /** @type {?} */ lView[-tNodeIdx]; ngDevMode && assertLContainer(declarationLContainer); // collect matches for views inserted in this container for (var _i20 = CONTAINER_HEADER_OFFSET; _i20 < declarationLContainer.length; _i20++) { /** @type {?} */ var embeddedLView = declarationLContainer[_i20]; if (embeddedLView[DECLARATION_LCONTAINER] === embeddedLView[PARENT]) { collectQueryResults(embeddedLView, childQueryIndex, result); } } // collect matches for views created from this declaration container and inserted into // different containers if (declarationLContainer[MOVED_VIEWS] !== null) { var _iterator41 = _createForOfIteratorHelper( /** @type {?} */ declarationLContainer[MOVED_VIEWS]), _step41; try { for (_iterator41.s(); !(_step41 = _iterator41.n()).done;) { var _embeddedLView = _step41.value; collectQueryResults(_embeddedLView, childQueryIndex, result); } } catch (err) { _iterator41.e(err); } finally { _iterator41.f(); } } } } } return result; } /** * Refreshes a query by combining matches from all active views and removing matches from deleted * views. * * \@codeGenApi * @param {?} queryList * @return {?} `true` if a query got dirty during change detection or if this is a static query * resolving in creation mode, `false` otherwise. * */ function ɵɵqueryRefresh(queryList) { /** @type {?} */ var lView = getLView(); /** @type {?} */ var queryIndex = getCurrentQueryIndex(); setCurrentQueryIndex(queryIndex + 1); /** @type {?} */ var tQuery = getTQuery(lView[TVIEW], queryIndex); if (queryList.dirty && isCreationMode() === tQuery.metadata.isStatic) { if (tQuery.matches === null) { queryList.reset([]); } else { /** @type {?} */ var result = tQuery.crossesNgTemplate ? collectQueryResults(lView, queryIndex, []) : materializeViewResults(lView, tQuery, queryIndex); queryList.reset(result); queryList.notifyOnChanges(); } return true; } return false; } /** * Creates new QueryList for a static view query. * * \@codeGenApi * @template T * @param {?} predicate The type for which the query will search * @param {?} descend Whether or not to descend into children * @param {?=} read What to save in the query * * @return {?} */ function ɵɵstaticViewQuery(predicate, descend, read) { viewQueryInternal(getLView(), predicate, descend, read, true); } /** * Creates new QueryList, stores the reference in LView and returns QueryList. * * \@codeGenApi * @template T * @param {?} predicate The type for which the query will search * @param {?} descend Whether or not to descend into children * @param {?=} read What to save in the query * * @return {?} */ function ɵɵviewQuery(predicate, descend, read) { viewQueryInternal(getLView(), predicate, descend, read, false); } /** * @template T * @param {?} lView * @param {?} predicate * @param {?} descend * @param {?} read * @param {?} isStatic * @return {?} */ function viewQueryInternal(lView, predicate, descend, read, isStatic) { /** @type {?} */ var tView = lView[TVIEW]; if (tView.firstTemplatePass) { createTQuery(tView, new TQueryMetadata_(predicate, descend, isStatic, read), -1); if (isStatic) { tView.staticViewQueries = true; } } createLQuery(lView); } /** * Loads a QueryList corresponding to the current view query. * * \@codeGenApi * @template T * @return {?} */ function ɵɵloadViewQuery() { return loadQueryInternal(getLView(), getCurrentQueryIndex()); } /** * Registers a QueryList, associated with a content query, for later refresh (part of a view * refresh). * * \@codeGenApi * @template T * @param {?} directiveIndex Current directive index * @param {?} predicate The type for which the query will search * @param {?} descend Whether or not to descend into children * @param {?=} read What to save in the query * @return {?} QueryList<T> * */ function ɵɵcontentQuery(directiveIndex, predicate, descend, read) { contentQueryInternal(getLView(), predicate, descend, read, false, getPreviousOrParentTNode(), directiveIndex); } /** * Registers a QueryList, associated with a static content query, for later refresh * (part of a view refresh). * * \@codeGenApi * @template T * @param {?} directiveIndex Current directive index * @param {?} predicate The type for which the query will search * @param {?} descend Whether or not to descend into children * @param {?=} read What to save in the query * @return {?} QueryList<T> * */ function ɵɵstaticContentQuery(directiveIndex, predicate, descend, read) { contentQueryInternal(getLView(), predicate, descend, read, true, getPreviousOrParentTNode(), directiveIndex); } /** * @template T * @param {?} lView * @param {?} predicate * @param {?} descend * @param {?} read * @param {?} isStatic * @param {?} tNode * @param {?} directiveIndex * @return {?} */ function contentQueryInternal(lView, predicate, descend, read, isStatic, tNode, directiveIndex) { /** @type {?} */ var tView = lView[TVIEW]; if (tView.firstTemplatePass) { createTQuery(tView, new TQueryMetadata_(predicate, descend, isStatic, read), tNode.index); saveContentQueryAndDirectiveIndex(tView, directiveIndex); if (isStatic) { tView.staticContentQueries = true; } } createLQuery(lView); } /** * Loads a QueryList corresponding to the current content query. * * \@codeGenApi * @template T * @return {?} */ function ɵɵloadContentQuery() { return loadQueryInternal(getLView(), getCurrentQueryIndex()); } /** * @template T * @param {?} lView * @param {?} queryIndex * @return {?} */ function loadQueryInternal(lView, queryIndex) { ngDevMode && assertDefined(lView[QUERIES], 'LQueries should be defined when trying to load a query'); ngDevMode && assertDataInRange( /** @type {?} */ lView[QUERIES].queries, queryIndex); return ( /** @type {?} */ lView[QUERIES].queries[queryIndex].queryList ); } /** * @template T * @param {?} lView * @return {?} */ function createLQuery(lView) { /** @type {?} */ var queryList = new QueryList(); storeCleanupWithContext(lView, queryList, queryList.destroy); if (lView[QUERIES] === null) lView[QUERIES] = new LQueries_(); /** @type {?} */ lView[QUERIES].queries.push(new LQuery_(queryList)); } /** * @param {?} tView * @param {?} metadata * @param {?} nodeIndex * @return {?} */ function createTQuery(tView, metadata, nodeIndex) { if (tView.queries === null) tView.queries = new TQueries_(); tView.queries.track(new TQuery_(metadata, nodeIndex)); } /** * @param {?} tView * @param {?} directiveIndex * @return {?} */ function saveContentQueryAndDirectiveIndex(tView, directiveIndex) { /** @type {?} */ var tViewContentQueries = tView.contentQueries || (tView.contentQueries = []); /** @type {?} */ var lastSavedDirectiveIndex = tView.contentQueries.length ? tViewContentQueries[tViewContentQueries.length - 1] : -1; if (directiveIndex !== lastSavedDirectiveIndex) { tViewContentQueries.push( /** @type {?} */ tView.queries.length - 1, directiveIndex); } } /** * @param {?} tView * @param {?} index * @return {?} */ function getTQuery(tView, index) { ngDevMode && assertDefined(tView.queries, 'TQueries must be defined to retrieve a TQuery'); return ( /** @type {?} */ tView.queries.getByIndex(index) ); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Retrieves `TemplateRef` instance from `Injector` when a local reference is placed on the * `<ng-template>` element. * * \@codeGenApi * @param {?} tNode * @param {?} currentView * @return {?} */ function ɵɵtemplateRefExtractor(tNode, currentView) { return createTemplateRef(TemplateRef, ElementRef, tNode, currentView); } /** * Returns the appropriate `ChangeDetectorRef` for a pipe. * * \@codeGenApi * @param {?=} flags * @return {?} */ function ɵɵinjectPipeChangeDetectorRef() { var flags = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : InjectFlags.Default; /** @type {?} */ var value = injectChangeDetectorRef(true); if (value == null && !(flags & InjectFlags.Optional)) { throw new Error("No provider for ChangeDetectorRef!"); } else { return value; } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ɵ0$e = /** * @return {?} */ function ɵ0$e() { return { 'ɵɵattribute': ɵɵattribute, 'ɵɵattributeInterpolate1': ɵɵattributeInterpolate1, 'ɵɵattributeInterpolate2': ɵɵattributeInterpolate2, 'ɵɵattributeInterpolate3': ɵɵattributeInterpolate3, 'ɵɵattributeInterpolate4': ɵɵattributeInterpolate4, 'ɵɵattributeInterpolate5': ɵɵattributeInterpolate5, 'ɵɵattributeInterpolate6': ɵɵattributeInterpolate6, 'ɵɵattributeInterpolate7': ɵɵattributeInterpolate7, 'ɵɵattributeInterpolate8': ɵɵattributeInterpolate8, 'ɵɵattributeInterpolateV': ɵɵattributeInterpolateV, 'ɵɵdefineBase': ɵɵdefineBase, 'ɵɵdefineComponent': ɵɵdefineComponent, 'ɵɵdefineDirective': ɵɵdefineDirective, 'ɵɵdefineInjectable': ɵɵdefineInjectable, 'ɵɵdefineInjector': ɵɵdefineInjector, 'ɵɵdefineNgModule': ɵɵdefineNgModule, 'ɵɵdefinePipe': ɵɵdefinePipe, 'ɵɵdirectiveInject': ɵɵdirectiveInject, 'ɵɵgetFactoryOf': ɵɵgetFactoryOf, 'ɵɵgetInheritedFactory': ɵɵgetInheritedFactory, 'ɵɵinject': ɵɵinject, 'ɵɵinjectAttribute': ɵɵinjectAttribute, 'ɵɵinjectPipeChangeDetectorRef': ɵɵinjectPipeChangeDetectorRef, 'ɵɵtemplateRefExtractor': ɵɵtemplateRefExtractor, 'ɵɵNgOnChangesFeature': ɵɵNgOnChangesFeature, 'ɵɵProvidersFeature': ɵɵProvidersFeature, 'ɵɵInheritDefinitionFeature': ɵɵInheritDefinitionFeature, 'ɵɵcontainer': ɵɵcontainer, 'ɵɵnextContext': ɵɵnextContext, 'ɵɵcontainerRefreshStart': ɵɵcontainerRefreshStart, 'ɵɵcontainerRefreshEnd': ɵɵcontainerRefreshEnd, 'ɵɵnamespaceHTML': ɵɵnamespaceHTML, 'ɵɵnamespaceMathML': ɵɵnamespaceMathML, 'ɵɵnamespaceSVG': ɵɵnamespaceSVG, 'ɵɵenableBindings': ɵɵenableBindings, 'ɵɵdisableBindings': ɵɵdisableBindings, 'ɵɵallocHostVars': ɵɵallocHostVars, 'ɵɵelementStart': ɵɵelementStart, 'ɵɵelementEnd': ɵɵelementEnd, 'ɵɵelement': ɵɵelement, 'ɵɵelementContainerStart': ɵɵelementContainerStart, 'ɵɵelementContainerEnd': ɵɵelementContainerEnd, 'ɵɵelementContainer': ɵɵelementContainer, 'ɵɵpureFunction0': ɵɵpureFunction0, 'ɵɵpureFunction1': ɵɵpureFunction1, 'ɵɵpureFunction2': ɵɵpureFunction2, 'ɵɵpureFunction3': ɵɵpureFunction3, 'ɵɵpureFunction4': ɵɵpureFunction4, 'ɵɵpureFunction5': ɵɵpureFunction5, 'ɵɵpureFunction6': ɵɵpureFunction6, 'ɵɵpureFunction7': ɵɵpureFunction7, 'ɵɵpureFunction8': ɵɵpureFunction8, 'ɵɵpureFunctionV': ɵɵpureFunctionV, 'ɵɵgetCurrentView': ɵɵgetCurrentView, 'ɵɵrestoreView': ɵɵrestoreView, 'ɵɵlistener': ɵɵlistener, 'ɵɵload': ɵɵload, 'ɵɵprojection': ɵɵprojection, 'ɵɵupdateSyntheticHostBinding': ɵɵupdateSyntheticHostBinding, 'ɵɵcomponentHostSyntheticListener': ɵɵcomponentHostSyntheticListener, 'ɵɵpipeBind1': ɵɵpipeBind1, 'ɵɵpipeBind2': ɵɵpipeBind2, 'ɵɵpipeBind3': ɵɵpipeBind3, 'ɵɵpipeBind4': ɵɵpipeBind4, 'ɵɵpipeBindV': ɵɵpipeBindV, 'ɵɵprojectionDef': ɵɵprojectionDef, 'ɵɵhostProperty': ɵɵhostProperty, 'ɵɵproperty': ɵɵproperty, 'ɵɵpropertyInterpolate': ɵɵpropertyInterpolate, 'ɵɵpropertyInterpolate1': ɵɵpropertyInterpolate1, 'ɵɵpropertyInterpolate2': ɵɵpropertyInterpolate2, 'ɵɵpropertyInterpolate3': ɵɵpropertyInterpolate3, 'ɵɵpropertyInterpolate4': ɵɵpropertyInterpolate4, 'ɵɵpropertyInterpolate5': ɵɵpropertyInterpolate5, 'ɵɵpropertyInterpolate6': ɵɵpropertyInterpolate6, 'ɵɵpropertyInterpolate7': ɵɵpropertyInterpolate7, 'ɵɵpropertyInterpolate8': ɵɵpropertyInterpolate8, 'ɵɵpropertyInterpolateV': ɵɵpropertyInterpolateV, 'ɵɵpipe': ɵɵpipe, 'ɵɵqueryRefresh': ɵɵqueryRefresh, 'ɵɵviewQuery': ɵɵviewQuery, 'ɵɵstaticViewQuery': ɵɵstaticViewQuery, 'ɵɵstaticContentQuery': ɵɵstaticContentQuery, 'ɵɵloadViewQuery': ɵɵloadViewQuery, 'ɵɵcontentQuery': ɵɵcontentQuery, 'ɵɵloadContentQuery': ɵɵloadContentQuery, 'ɵɵreference': ɵɵreference, 'ɵɵelementHostAttrs': ɵɵelementHostAttrs, 'ɵɵclassMap': ɵɵclassMap, 'ɵɵclassMapInterpolate1': ɵɵclassMapInterpolate1, 'ɵɵclassMapInterpolate2': ɵɵclassMapInterpolate2, 'ɵɵclassMapInterpolate3': ɵɵclassMapInterpolate3, 'ɵɵclassMapInterpolate4': ɵɵclassMapInterpolate4, 'ɵɵclassMapInterpolate5': ɵɵclassMapInterpolate5, 'ɵɵclassMapInterpolate6': ɵɵclassMapInterpolate6, 'ɵɵclassMapInterpolate7': ɵɵclassMapInterpolate7, 'ɵɵclassMapInterpolate8': ɵɵclassMapInterpolate8, 'ɵɵclassMapInterpolateV': ɵɵclassMapInterpolateV, 'ɵɵstyling': ɵɵstyling, 'ɵɵstyleMap': ɵɵstyleMap, 'ɵɵstyleProp': ɵɵstyleProp, 'ɵɵstylePropInterpolate1': ɵɵstylePropInterpolate1, 'ɵɵstylePropInterpolate2': ɵɵstylePropInterpolate2, 'ɵɵstylePropInterpolate3': ɵɵstylePropInterpolate3, 'ɵɵstylePropInterpolate4': ɵɵstylePropInterpolate4, 'ɵɵstylePropInterpolate5': ɵɵstylePropInterpolate5, 'ɵɵstylePropInterpolate6': ɵɵstylePropInterpolate6, 'ɵɵstylePropInterpolate7': ɵɵstylePropInterpolate7, 'ɵɵstylePropInterpolate8': ɵɵstylePropInterpolate8, 'ɵɵstylePropInterpolateV': ɵɵstylePropInterpolateV, 'ɵɵstyleSanitizer': ɵɵstyleSanitizer, 'ɵɵstylingApply': ɵɵstylingApply, 'ɵɵclassProp': ɵɵclassProp, 'ɵɵselect': ɵɵselect, 'ɵɵtemplate': ɵɵtemplate, 'ɵɵtext': ɵɵtext, 'ɵɵtextBinding': ɵɵtextBinding, 'ɵɵtextInterpolate': ɵɵtextInterpolate, 'ɵɵtextInterpolate1': ɵɵtextInterpolate1, 'ɵɵtextInterpolate2': ɵɵtextInterpolate2, 'ɵɵtextInterpolate3': ɵɵtextInterpolate3, 'ɵɵtextInterpolate4': ɵɵtextInterpolate4, 'ɵɵtextInterpolate5': ɵɵtextInterpolate5, 'ɵɵtextInterpolate6': ɵɵtextInterpolate6, 'ɵɵtextInterpolate7': ɵɵtextInterpolate7, 'ɵɵtextInterpolate8': ɵɵtextInterpolate8, 'ɵɵtextInterpolateV': ɵɵtextInterpolateV, 'ɵɵembeddedViewStart': ɵɵembeddedViewStart, 'ɵɵembeddedViewEnd': ɵɵembeddedViewEnd, 'ɵɵi18n': ɵɵi18n, 'ɵɵi18nAttributes': ɵɵi18nAttributes, 'ɵɵi18nExp': ɵɵi18nExp, 'ɵɵi18nStart': ɵɵi18nStart, 'ɵɵi18nEnd': ɵɵi18nEnd, 'ɵɵi18nApply': ɵɵi18nApply, 'ɵɵi18nPostprocess': ɵɵi18nPostprocess, 'ɵɵi18nLocalize': ɵɵi18nLocalize, 'ɵɵresolveWindow': ɵɵresolveWindow, 'ɵɵresolveDocument': ɵɵresolveDocument, 'ɵɵresolveBody': ɵɵresolveBody, 'ɵɵsetComponentScope': ɵɵsetComponentScope, 'ɵɵsetNgModuleScope': ɵɵsetNgModuleScope, 'ɵɵsanitizeHtml': ɵɵsanitizeHtml, 'ɵɵsanitizeStyle': ɵɵsanitizeStyle, 'ɵɵdefaultStyleSanitizer': ɵɵdefaultStyleSanitizer, 'ɵɵsanitizeResourceUrl': ɵɵsanitizeResourceUrl, 'ɵɵsanitizeScript': ɵɵsanitizeScript, 'ɵɵsanitizeUrl': ɵɵsanitizeUrl, 'ɵɵsanitizeUrlOrResourceUrl': ɵɵsanitizeUrlOrResourceUrl }; }; /** * A mapping of the \@angular/core API surface used in generated expressions to the actual symbols. * * This should be kept up to date with the public exports of \@angular/core. * @type {?} */ var angularCoreEnv = ɵ0$e(); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var EMPTY_ARRAY$4 = []; /** * @record */ function ModuleQueueItem() {} if (false) {} /** @type {?} */ var moduleQueue = []; /** * Enqueues moduleDef to be checked later to see if scope can be set on its * component declarations. * @param {?} moduleType * @param {?} ngModule * @return {?} */ function enqueueModuleForDelayedScoping(moduleType, ngModule) { moduleQueue.push({ moduleType: moduleType, ngModule: ngModule }); } /** @type {?} */ var flushingModuleQueue = false; /** * Loops over queued module definitions, if a given module definition has all of its * declarations resolved, it dequeues that module definition and sets the scope on * its declarations. * @return {?} */ function flushModuleScopingQueueAsMuchAsPossible() { if (!flushingModuleQueue) { flushingModuleQueue = true; try { for (var i = moduleQueue.length - 1; i >= 0; i--) { var _moduleQueue$i = moduleQueue[i], moduleType = _moduleQueue$i.moduleType, ngModule = _moduleQueue$i.ngModule; if (ngModule.declarations && ngModule.declarations.every(isResolvedDeclaration)) { // dequeue moduleQueue.splice(i, 1); setScopeOnDeclaredComponents(moduleType, ngModule); } } } finally { flushingModuleQueue = false; } } } /** * Returns truthy if a declaration has resolved. If the declaration happens to be * an array of declarations, it will recurse to check each declaration in that array * (which may also be arrays). * @param {?} declaration * @return {?} */ function isResolvedDeclaration(declaration) { if (Array.isArray(declaration)) { return declaration.every(isResolvedDeclaration); } return !!resolveForwardRef(declaration); } /** * Compiles a module in JIT mode. * * This function automatically gets called when a class has a `\@NgModule` decorator. * @param {?} moduleType * @param {?=} ngModule * @return {?} */ function compileNgModule(moduleType) { var ngModule = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; compileNgModuleDefs( /** @type {?} */ moduleType, ngModule); // Because we don't know if all declarations have resolved yet at the moment the // NgModule decorator is executing, we're enqueueing the setting of module scope // on its declarations to be run at a later time when all declarations for the module, // including forward refs, have resolved. enqueueModuleForDelayedScoping(moduleType, ngModule); } /** * Compiles and adds the `ngModuleDef` and `ngInjectorDef` properties to the module class. * * It's possible to compile a module via this API which will allow duplicate declarations in its * root. * @param {?} moduleType * @param {?} ngModule * @param {?=} allowDuplicateDeclarationsInRoot * @return {?} */ function compileNgModuleDefs(moduleType, ngModule) { var allowDuplicateDeclarationsInRoot = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; ngDevMode && assertDefined(moduleType, 'Required value moduleType'); ngDevMode && assertDefined(ngModule, 'Required value ngModule'); /** @type {?} */ var declarations = flatten(ngModule.declarations || EMPTY_ARRAY$4); /** @type {?} */ /** @nocollapse */ var ngModuleDef = null; Object.defineProperty(moduleType, NG_MODULE_DEF, { configurable: true, get: /** * @return {?} */ function get() { if (ngModuleDef === null) { if (ngDevMode && ngModule.imports && ngModule.imports.indexOf(moduleType) > -1) { // We need to assert this immediately, because allowing it to continue will cause it to // go into an infinite loop before we've reached the point where we throw all the errors. throw new Error("'".concat(stringifyForError(moduleType), "' module can't import itself")); } ngModuleDef = getCompilerFacade().compileNgModule(angularCoreEnv, "ng:///".concat(moduleType.name, "/ngModuleDef.js"), { type: moduleType, bootstrap: flatten(ngModule.bootstrap || EMPTY_ARRAY$4).map(resolveForwardRef), declarations: declarations.map(resolveForwardRef), imports: flatten(ngModule.imports || EMPTY_ARRAY$4).map(resolveForwardRef).map(expandModuleWithProviders), exports: flatten(ngModule.exports || EMPTY_ARRAY$4).map(resolveForwardRef).map(expandModuleWithProviders), emitInline: true, schemas: ngModule.schemas ? flatten(ngModule.schemas) : null, id: ngModule.id || null }); } return ngModuleDef; } }); /** @type {?} */ /** @nocollapse */ var ngInjectorDef = null; Object.defineProperty(moduleType, NG_INJECTOR_DEF, { get: /** * @return {?} */ function get() { if (ngInjectorDef === null) { ngDevMode && verifySemanticsOfNgModuleDef( /** @type {?} */ /** @type {?} */ moduleType, allowDuplicateDeclarationsInRoot); /** @type {?} */ var meta = { name: moduleType.name, type: moduleType, deps: reflectDependencies(moduleType), providers: ngModule.providers || EMPTY_ARRAY$4, imports: [(ngModule.imports || EMPTY_ARRAY$4).map(resolveForwardRef), (ngModule.exports || EMPTY_ARRAY$4).map(resolveForwardRef)] }; ngInjectorDef = getCompilerFacade().compileInjector(angularCoreEnv, "ng:///".concat(moduleType.name, "/ngInjectorDef.js"), meta); } return ngInjectorDef; }, // Make the property configurable in dev mode to allow overriding in tests configurable: !!ngDevMode }); } /** * @param {?} moduleType * @param {?} allowDuplicateDeclarationsInRoot * @param {?=} importingModule * @return {?} */ function verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRoot, importingModule) { if (verifiedNgModule.get(moduleType)) return; verifiedNgModule.set(moduleType, true); moduleType = resolveForwardRef(moduleType); /** @type {?} */ var ngModuleDef; if (importingModule) { ngModuleDef = /** @type {?} */ getNgModuleDef(moduleType); if (!ngModuleDef) { throw new Error("Unexpected value '".concat(moduleType.name, "' imported by the module '").concat(importingModule.name, "'. Please add an @NgModule annotation.")); } } else { ngModuleDef = getNgModuleDef(moduleType, true); } /** @type {?} */ var errors = []; /** @type {?} */ var declarations = maybeUnwrapFn(ngModuleDef.declarations); /** @type {?} */ var imports = maybeUnwrapFn(ngModuleDef.imports); flatten(imports).map(unwrapModuleWithProvidersImports).forEach( /** * @param {?} mod * @return {?} */ function (mod) { verifySemanticsOfNgModuleImport(mod, moduleType); verifySemanticsOfNgModuleDef(mod, false, moduleType); }); /** @type {?} */ var exports = maybeUnwrapFn(ngModuleDef.exports); declarations.forEach(verifyDeclarationsHaveDefinitions); /** @type {?} */ var combinedDeclarations = [].concat(_toConsumableArray(declarations.map(resolveForwardRef)), _toConsumableArray(flatten(imports.map(computeCombinedExports)).map(resolveForwardRef))); exports.forEach(verifyExportsAreDeclaredOrReExported); declarations.forEach( /** * @param {?} decl * @return {?} */ function (decl) { return verifyDeclarationIsUnique(decl, allowDuplicateDeclarationsInRoot); }); declarations.forEach(verifyComponentEntryComponentsIsPartOfNgModule); /** @type {?} */ var ngModule = getAnnotation(moduleType, 'NgModule'); if (ngModule) { ngModule.imports && flatten(ngModule.imports).map(unwrapModuleWithProvidersImports).forEach( /** * @param {?} mod * @return {?} */ function (mod) { verifySemanticsOfNgModuleImport(mod, moduleType); verifySemanticsOfNgModuleDef(mod, false, moduleType); }); ngModule.bootstrap && deepForEach(ngModule.bootstrap, verifyCorrectBootstrapType); ngModule.bootstrap && deepForEach(ngModule.bootstrap, verifyComponentIsPartOfNgModule); ngModule.entryComponents && deepForEach(ngModule.entryComponents, verifyComponentIsPartOfNgModule); } // Throw Error if any errors were detected. if (errors.length) { throw new Error(errors.join('\n')); } //////////////////////////////////////////////////////////////////////////////////////////////// /** * @param {?} type * @return {?} */ function verifyDeclarationsHaveDefinitions(type) { type = resolveForwardRef(type); /** @type {?} */ var def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef(type); if (!def) { errors.push("Unexpected value '".concat(stringifyForError(type), "' declared by the module '").concat(stringifyForError(moduleType), "'. Please add a @Pipe/@Directive/@Component annotation.")); } } /** * @param {?} type * @return {?} */ function verifyExportsAreDeclaredOrReExported(type) { type = resolveForwardRef(type); /** @type {?} */ var kind = getComponentDef(type) && 'component' || getDirectiveDef(type) && 'directive' || getPipeDef(type) && 'pipe'; if (kind) { // only checked if we are declared as Component, Directive, or Pipe // Modules don't need to be declared or imported. if (combinedDeclarations.lastIndexOf(type) === -1) { // We are exporting something which we don't explicitly declare or import. errors.push("Can't export ".concat(kind, " ").concat(stringifyForError(type), " from ").concat(stringifyForError(moduleType), " as it was neither declared nor imported!")); } } } /** * @param {?} type * @param {?} suppressErrors * @return {?} */ function verifyDeclarationIsUnique(type, suppressErrors) { type = resolveForwardRef(type); /** @type {?} */ var existingModule = ownerNgModule.get(type); if (existingModule && existingModule !== moduleType) { if (!suppressErrors) { /** @type {?} */ var _modules = [existingModule, moduleType].map(stringifyForError).sort(); errors.push("Type ".concat(stringifyForError(type), " is part of the declarations of 2 modules: ").concat(_modules[0], " and ").concat(_modules[1], "! ") + "Please consider moving ".concat(stringifyForError(type), " to a higher module that imports ").concat(_modules[0], " and ").concat(_modules[1], ". ") + "You can also create a new NgModule that exports and includes ".concat(stringifyForError(type), " then import that NgModule in ").concat(_modules[0], " and ").concat(_modules[1], ".")); } } else { // Mark type as having owner. ownerNgModule.set(type, moduleType); } } /** * @param {?} type * @return {?} */ function verifyComponentIsPartOfNgModule(type) { type = resolveForwardRef(type); /** @type {?} */ var existingModule = ownerNgModule.get(type); if (!existingModule) { errors.push("Component ".concat(stringifyForError(type), " is not part of any NgModule or the module has not been imported into your module.")); } } /** * @param {?} type * @return {?} */ function verifyCorrectBootstrapType(type) { type = resolveForwardRef(type); if (!getComponentDef(type)) { errors.push("".concat(stringifyForError(type), " cannot be used as an entry component.")); } } /** * @param {?} type * @return {?} */ function verifyComponentEntryComponentsIsPartOfNgModule(type) { type = resolveForwardRef(type); if (getComponentDef(type)) { // We know we are component /** @type {?} */ var component = getAnnotation(type, 'Component'); if (component && component.entryComponents) { deepForEach(component.entryComponents, verifyComponentIsPartOfNgModule); } } } /** * @param {?} type * @param {?} importingModule * @return {?} */ function verifySemanticsOfNgModuleImport(type, importingModule) { type = resolveForwardRef(type); if (getComponentDef(type) || getDirectiveDef(type)) { throw new Error("Unexpected directive '".concat(type.name, "' imported by the module '").concat(importingModule.name, "'. Please add an @NgModule annotation.")); } if (getPipeDef(type)) { throw new Error("Unexpected pipe '".concat(type.name, "' imported by the module '").concat(importingModule.name, "'. Please add an @NgModule annotation.")); } } } /** * @param {?} typeOrWithProviders * @return {?} */ function unwrapModuleWithProvidersImports(typeOrWithProviders) { typeOrWithProviders = resolveForwardRef(typeOrWithProviders); return ( /** @type {?} */ typeOrWithProviders.ngModule || typeOrWithProviders ); } /** * @template T * @param {?} type * @param {?} name * @return {?} */ function getAnnotation(type, name) { /** @type {?} */ var annotation = null; collect(type.__annotations__); collect(type.decorators); return annotation; /** * @param {?} annotations * @return {?} */ function collect(annotations) { if (annotations) { annotations.forEach(readAnnotation); } } /** * @param {?} decorator * @return {?} */ function readAnnotation(decorator) { if (!annotation) { /** @type {?} */ var proto = Object.getPrototypeOf(decorator); if (proto.ngMetadataName == name) { annotation = /** @type {?} */ decorator; } else if (decorator.type) { /** @type {?} */ var _proto = Object.getPrototypeOf(decorator.type); if (_proto.ngMetadataName == name) { annotation = decorator.args[0]; } } } } } /** * Keep track of compiled components. This is needed because in tests we often want to compile the * same component with more than one NgModule. This would cause an error unless we reset which * NgModule the component belongs to. We keep the list of compiled components here so that the * TestBed can reset it later. * @type {?} */ var ownerNgModule = new Map(); /** @type {?} */ var verifiedNgModule = new Map(); /** * @return {?} */ function resetCompiledComponents() { ownerNgModule = new Map(); verifiedNgModule = new Map(); moduleQueue.length = 0; } /** * Computes the combined declarations of explicit declarations, as well as declarations inherited by * traversing the exports of imported modules. * @param {?} type * @return {?} */ function computeCombinedExports(type) { type = resolveForwardRef(type); /** @type {?} */ /** @nocollapse */ var ngModuleDef = getNgModuleDef(type, true); return _toConsumableArray(flatten(maybeUnwrapFn(ngModuleDef.exports).map( /** * @param {?} type * @return {?} */ function (type) { /** @type {?} */ /** @nocollapse */ var ngModuleDef = getNgModuleDef(type); if (ngModuleDef) { verifySemanticsOfNgModuleDef( /** @type {?} */ /** @type {?} */ type, false); return computeCombinedExports(type); } else { return type; } }))); } /** * Some declared components may be compiled asynchronously, and thus may not have their * ngComponentDef set yet. If this is the case, then a reference to the module is written into * the `ngSelectorScope` property of the declared type. * @param {?} moduleType * @param {?} ngModule * @return {?} */ function setScopeOnDeclaredComponents(moduleType, ngModule) { /** @type {?} */ var declarations = flatten(ngModule.declarations || EMPTY_ARRAY$4); /** @type {?} */ var transitiveScopes = transitiveScopesFor(moduleType); declarations.forEach( /** * @param {?} declaration * @return {?} */ function (declaration) { if (declaration.hasOwnProperty(NG_COMPONENT_DEF)) { // An `ngComponentDef` field exists - go ahead and patch the component directly. /** @type {?} */ var component = /** @type {?} */ declaration; /** @type {?} */ var componentDef = /** @type {?} */ getComponentDef(component); patchComponentDefWithScope(componentDef, transitiveScopes); } else if (!declaration.hasOwnProperty(NG_DIRECTIVE_DEF) && !declaration.hasOwnProperty(NG_PIPE_DEF)) { // Set `ngSelectorScope` for future reference when the component compilation finishes. /** @type {?} */ declaration.ngSelectorScope = moduleType; } }); } /** * Patch the definition of a component with directives and pipes from the compilation scope of * a given module. * @template C * @param {?} componentDef * @param {?} transitiveScopes * @return {?} */ function patchComponentDefWithScope(componentDef, transitiveScopes) { componentDef.directiveDefs = /** * @return {?} */ function () { return Array.from(transitiveScopes.compilation.directives).map( /** * @param {?} dir * @return {?} */ function (dir) { return dir.hasOwnProperty(NG_COMPONENT_DEF) ? /** @type {?} */ getComponentDef(dir) : /** @type {?} */ getDirectiveDef(dir); }).filter( /** * @param {?} def * @return {?} */ function (def) { return !!def; }); }; componentDef.pipeDefs = /** * @return {?} */ function () { return Array.from(transitiveScopes.compilation.pipes).map( /** * @param {?} pipe * @return {?} */ function (pipe) { return ( /** @type {?} */ getPipeDef(pipe) ); }); }; componentDef.schemas = transitiveScopes.schemas; // Since we avoid Components/Directives/Pipes recompiling in case there are no overrides, we // may face a problem where previously compiled defs available to a given Component/Directive // are cached in TView and may become stale (in case any of these defs gets recompiled). In // order to avoid this problem, we force fresh TView to be created. componentDef.tView = null; } /** * Compute the pair of transitive scopes (compilation scope and exported scope) for a given module. * * This operation is memoized and the result is cached on the module's definition. It can be called * on modules with components that have not fully compiled yet, but the result should not be used * until they have. * @template T * @param {?} moduleType * @param {?=} processNgModuleFn * @return {?} */ function transitiveScopesFor(moduleType, processNgModuleFn) { if (!isNgModule(moduleType)) { throw new Error("".concat(moduleType.name, " does not have an ngModuleDef")); } /** @type {?} */ var def = /** @type {?} */ getNgModuleDef(moduleType); if (def.transitiveCompileScopes !== null) { return def.transitiveCompileScopes; } /** @type {?} */ var scopes = { schemas: def.schemas || null, compilation: { directives: new Set(), pipes: new Set() }, exported: { directives: new Set(), pipes: new Set() } }; maybeUnwrapFn(def.declarations).forEach( /** * @param {?} declared * @return {?} */ function (declared) { /** @type {?} */ var declaredWithDefs = /** @type {?} */ declared; if (getPipeDef(declaredWithDefs)) { scopes.compilation.pipes.add(declared); } else { // Either declared has an ngComponentDef or ngDirectiveDef, or it's a component which hasn't // had its template compiled yet. In either case, it gets added to the compilation's // directives. scopes.compilation.directives.add(declared); } }); maybeUnwrapFn(def.imports).forEach( /** * @template I * @param {?} imported * @return {?} */ function (imported) { /** @type {?} */ var importedType = /** @type {?} */ imported; if (!isNgModule(importedType)) { throw new Error("Importing ".concat(importedType.name, " which does not have an ngModuleDef")); } if (processNgModuleFn) { processNgModuleFn( /** @type {?} */ importedType); } // When this module imports another, the imported module's exported directives and pipes are // added to the compilation scope of this module. /** @type {?} */ var importedScope = transitiveScopesFor(importedType, processNgModuleFn); importedScope.exported.directives.forEach( /** * @param {?} entry * @return {?} */ function (entry) { return scopes.compilation.directives.add(entry); }); importedScope.exported.pipes.forEach( /** * @param {?} entry * @return {?} */ function (entry) { return scopes.compilation.pipes.add(entry); }); }); maybeUnwrapFn(def.exports).forEach( /** * @template E * @param {?} exported * @return {?} */ function (exported) { /** @type {?} */ var exportedType = /** @type {?} */ exported; // Either the type is a module, a pipe, or a component/directive (which may not have an // ngComponentDef as it might be compiled asynchronously). if (isNgModule(exportedType)) { // When this module exports another, the exported module's exported directives and pipes are // added to both the compilation and exported scopes of this module. /** @type {?} */ var exportedScope = transitiveScopesFor(exportedType, processNgModuleFn); exportedScope.exported.directives.forEach( /** * @param {?} entry * @return {?} */ function (entry) { scopes.compilation.directives.add(entry); scopes.exported.directives.add(entry); }); exportedScope.exported.pipes.forEach( /** * @param {?} entry * @return {?} */ function (entry) { scopes.compilation.pipes.add(entry); scopes.exported.pipes.add(entry); }); } else if (getPipeDef(exportedType)) { scopes.exported.pipes.add(exportedType); } else { scopes.exported.directives.add(exportedType); } }); def.transitiveCompileScopes = scopes; return scopes; } /** * @param {?} value * @return {?} */ function expandModuleWithProviders(value) { if (isModuleWithProviders(value)) { return value.ngModule; } return value; } /** * @param {?} value * @return {?} */ function isModuleWithProviders(value) { return ( /** @type {?} */ value.ngModule !== undefined ); } /** * @template T * @param {?} value * @return {?} */ function isNgModule(value) { return !!getNgModuleDef(value); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Compile an Angular component according to its decorator metadata, and patch the resulting * ngComponentDef onto the component type. * * Compilation may be asynchronous (due to the need to resolve URLs for the component template or * other resources, for example). In the event that compilation is not immediate, `compileComponent` * will enqueue resource resolution into a global queue and will fail to return the `ngComponentDef` * until the global queue has been resolved with a call to `resolveComponentResources`. * @param {?} type * @param {?} metadata * @return {?} */ function compileComponent(type, metadata) { /** @type {?} */ /** @nocollapse */ var ngComponentDef = null; // Metadata may have resources which need to be resolved. maybeQueueResolutionOfComponentResources(type, metadata); Object.defineProperty(type, NG_COMPONENT_DEF, { get: /** * @return {?} */ function get() { /** @type {?} */ var compiler = getCompilerFacade(); if (ngComponentDef === null) { if (componentNeedsResolution(metadata)) { /** @type {?} */ var error = ["Component '".concat(type.name, "' is not resolved:")]; if (metadata.templateUrl) { error.push(" - templateUrl: ".concat(metadata.templateUrl)); } if (metadata.styleUrls && metadata.styleUrls.length) { error.push(" - styleUrls: ".concat(JSON.stringify(metadata.styleUrls))); } error.push("Did you run and wait for 'resolveComponentResources()'?"); throw new Error(error.join('\n')); } /** @type {?} */ var templateUrl = metadata.templateUrl || "ng:///".concat(type.name, "/template.html"); /** @type {?} */ var meta = Object.assign({}, directiveMetadata(type, metadata), { typeSourceSpan: compiler.createParseSourceSpan('Component', type.name, templateUrl), template: metadata.template || '', preserveWhitespaces: metadata.preserveWhitespaces || false, styles: metadata.styles || EMPTY_ARRAY, animations: metadata.animations, directives: [], changeDetection: metadata.changeDetection, pipes: new Map(), encapsulation: metadata.encapsulation || ViewEncapsulation.Emulated, interpolation: metadata.interpolation, viewProviders: metadata.viewProviders || null }); if (meta.usesInheritance) { addBaseDefToUndecoratedParents(type); } ngComponentDef = compiler.compileComponent(angularCoreEnv, templateUrl, meta); // When NgModule decorator executed, we enqueued the module definition such that // it would only dequeue and add itself as module scope to all of its declarations, // but only if if all of its declarations had resolved. This call runs the check // to see if any modules that are in the queue can be dequeued and add scope to // their declarations. flushModuleScopingQueueAsMuchAsPossible(); // If component compilation is async, then the @NgModule annotation which declares the // component may execute and set an ngSelectorScope property on the component type. This // allows the component to patch itself with directiveDefs from the module after it // finishes compiling. if (hasSelectorScope(type)) { /** @type {?} */ var scopes = transitiveScopesFor(type.ngSelectorScope); patchComponentDefWithScope(ngComponentDef, scopes); } } return ngComponentDef; }, // Make the property configurable in dev mode to allow overriding in tests configurable: !!ngDevMode }); // Add ngInjectableDef so components are reachable through the module injector by default // This is mostly to support injecting components in tests. In real application code, // components should be retrieved through the node injector, so this isn't a problem. compileInjectable(type); } /** * @template T * @param {?} component * @return {?} */ function hasSelectorScope(component) { return ( /** @type {?} */ component.ngSelectorScope !== undefined ); } /** * Compile an Angular directive according to its decorator metadata, and patch the resulting * ngDirectiveDef onto the component type. * * In the event that compilation is not immediate, `compileDirective` will return a `Promise` which * will resolve when compilation completes and the directive becomes usable. * @param {?} type * @param {?} directive * @return {?} */ function compileDirective(type, directive) { /** @type {?} */ /** @nocollapse */ var ngDirectiveDef = null; Object.defineProperty(type, NG_DIRECTIVE_DEF, { get: /** * @return {?} */ function get() { if (ngDirectiveDef === null) { /** @type {?} */ var name = type && type.name; /** @type {?} */ var sourceMapUrl = "ng:///".concat(name, "/ngDirectiveDef.js"); /** @type {?} */ var compiler = getCompilerFacade(); /** @type {?} */ var facade = directiveMetadata( /** @type {?} */ type, directive); facade.typeSourceSpan = compiler.createParseSourceSpan('Directive', name, sourceMapUrl); if (facade.usesInheritance) { addBaseDefToUndecoratedParents(type); } ngDirectiveDef = compiler.compileDirective(angularCoreEnv, sourceMapUrl, facade); } return ngDirectiveDef; }, // Make the property configurable in dev mode to allow overriding in tests configurable: !!ngDevMode }); // Add ngInjectableDef so directives are reachable through the module injector by default // This is mostly to support injecting directives in tests. In real application code, // directives should be retrieved through the node injector, so this isn't a problem. compileInjectable(type); } /** * @param {?} type * @return {?} */ function extendsDirectlyFromObject(type) { return Object.getPrototypeOf(type.prototype) === Object.prototype; } /** * Extract the `R3DirectiveMetadata` for a particular directive (either a `Directive` or a * `Component`). * @param {?} type * @param {?} metadata * @return {?} */ function directiveMetadata(type, metadata) { // Reflect inputs and outputs. /** @type {?} */ var propMetadata = getReflect().ownPropMetadata(type); return { name: type.name, type: type, typeArgumentCount: 0, selector: /** @type {?} */ metadata.selector, deps: reflectDependencies(type), host: metadata.host || EMPTY_OBJ, propMetadata: propMetadata, inputs: metadata.inputs || EMPTY_ARRAY, outputs: metadata.outputs || EMPTY_ARRAY, queries: extractQueriesMetadata(type, propMetadata, isContentQuery), lifecycle: { usesOnChanges: type.prototype.hasOwnProperty('ngOnChanges') }, typeSourceSpan: /** @type {?} */ null, usesInheritance: !extendsDirectlyFromObject(type), exportAs: extractExportAs(metadata.exportAs), providers: metadata.providers || null, viewQueries: extractQueriesMetadata(type, propMetadata, isViewQuery) }; } /** * Adds an `ngBaseDef` to all parent classes of a type that don't have an Angular decorator. * @param {?} type * @return {?} */ function addBaseDefToUndecoratedParents(type) { /** @type {?} */ var objPrototype = Object.prototype; /** @type {?} */ var parent = Object.getPrototypeOf(type); // Go up the prototype until we hit `Object`. while (parent && parent !== objPrototype) { // Since inheritance works if the class was annotated already, we only need to add // the base def if there are no annotations and the base def hasn't been created already. if (!getDirectiveDef(parent) && !getComponentDef(parent) && !getBaseDef(parent)) { /** @type {?} */ var facade = extractBaseDefMetadata(parent); facade && compileBase(parent, facade); } parent = Object.getPrototypeOf(parent); } } /** * Compiles the base metadata into a base definition. * @param {?} type * @param {?} facade * @return {?} */ function compileBase(type, facade) { /** @type {?} */ /** @nocollapse */ var ngBaseDef = null; Object.defineProperty(type, NG_BASE_DEF, { get: /** * @return {?} */ function get() { if (ngBaseDef === null) { /** @type {?} */ var name = type && type.name; /** @type {?} */ var sourceMapUrl = "ng://".concat(name, "/ngBaseDef.js"); /** @type {?} */ var compiler = getCompilerFacade(); ngBaseDef = compiler.compileBase(angularCoreEnv, sourceMapUrl, facade); } return ngBaseDef; }, // Make the property configurable in dev mode to allow overriding in tests configurable: !!ngDevMode }); } /** * Extracts the metadata necessary to construct an `ngBaseDef` from a class. * @param {?} type * @return {?} */ function extractBaseDefMetadata(type) { /** @type {?} */ var propMetadata = getReflect().ownPropMetadata(type); /** @type {?} */ var viewQueries = extractQueriesMetadata(type, propMetadata, isViewQuery); /** @type {?} */ var queries = extractQueriesMetadata(type, propMetadata, isContentQuery); /** @type {?} */ var inputs; /** @type {?} */ var outputs; // We only need to know whether there are any HostListener or HostBinding // decorators present, the parsing logic is in the compiler already. /** @type {?} */ var hasHostDecorators = false; var _loop5 = function _loop5(field) { propMetadata[field].forEach( /** * @param {?} ann * @return {?} */ function (ann) { /** @type {?} */ var metadataName = ann.ngMetadataName; if (metadataName === 'Input') { inputs = inputs || {}; inputs[field] = ann.bindingPropertyName ? [ann.bindingPropertyName, field] : field; } else if (metadataName === 'Output') { outputs = outputs || {}; outputs[field] = ann.bindingPropertyName || field; } else if (metadataName === 'HostBinding' || metadataName === 'HostListener') { hasHostDecorators = true; } }); }; for (var field in propMetadata) { _loop5(field); } // Only generate the base def if there's any info inside it. if (inputs || outputs || viewQueries.length || queries.length || hasHostDecorators) { return { name: type.name, type: type, inputs: inputs, outputs: outputs, viewQueries: viewQueries, queries: queries, propMetadata: propMetadata }; } return null; } /** * @param {?} selector * @return {?} */ function convertToR3QueryPredicate(selector) { return typeof selector === 'string' ? splitByComma(selector) : resolveForwardRef(selector); } /** * @param {?} propertyName * @param {?} ann * @return {?} */ function convertToR3QueryMetadata(propertyName, ann) { return { propertyName: propertyName, predicate: convertToR3QueryPredicate(ann.selector), descendants: ann.descendants, first: ann.first, read: ann.read ? ann.read : null, "static": !!ann["static"] }; } /** * @param {?} type * @param {?} propMetadata * @param {?} isQueryAnn * @return {?} */ function extractQueriesMetadata(type, propMetadata, isQueryAnn) { /** @type {?} */ var queriesMeta = []; var _loop6 = function _loop6(field) { if (propMetadata.hasOwnProperty(field)) { /** @type {?} */ var annotations = propMetadata[field]; annotations.forEach( /** * @param {?} ann * @return {?} */ function (ann) { if (isQueryAnn(ann)) { if (!ann.selector) { throw new Error("Can't construct a query for the property \"".concat(field, "\" of ") + "\"".concat(stringifyForError(type), "\" since the query selector wasn't defined.")); } if (annotations.some(isInputAnn)) { throw new Error("Cannot combine @Input decorators with query decorators"); } queriesMeta.push(convertToR3QueryMetadata(field, ann)); } }); } }; for (var field in propMetadata) { _loop6(field); } return queriesMeta; } /** * @param {?} exportAs * @return {?} */ function extractExportAs(exportAs) { if (exportAs === undefined) { return null; } return exportAs.split(',').map( /** * @param {?} part * @return {?} */ function (part) { return part.trim(); }); } /** * @param {?} value * @return {?} */ function isContentQuery(value) { /** @type {?} */ var name = value.ngMetadataName; return name === 'ContentChild' || name === 'ContentChildren'; } /** * @param {?} value * @return {?} */ function isViewQuery(value) { /** @type {?} */ var name = value.ngMetadataName; return name === 'ViewChild' || name === 'ViewChildren'; } /** * @param {?} value * @return {?} */ function isInputAnn(value) { return value.ngMetadataName === 'Input'; } /** * @param {?} value * @return {?} */ function splitByComma(value) { return value.split(',').map( /** * @param {?} piece * @return {?} */ function (piece) { return piece.trim(); }); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} type * @param {?} meta * @return {?} */ function compilePipe(type, meta) { /** @type {?} */ /** @nocollapse */ var ngPipeDef = null; Object.defineProperty(type, NG_PIPE_DEF, { get: /** * @return {?} */ function get() { if (ngPipeDef === null) { /** @type {?} */ var _typeName = type.name; ngPipeDef = getCompilerFacade().compilePipe(angularCoreEnv, "ng:///".concat(_typeName, "/ngPipeDef.js"), { type: type, typeArgumentCount: 0, name: _typeName, deps: reflectDependencies(type), pipeName: meta.name, pure: meta.pure !== undefined ? meta.pure : true }); } return ngPipeDef; }, // Make the property configurable in dev mode to allow overriding in tests configurable: !!ngDevMode }); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Type of the Directive decorator / constructor function. * \@publicApi * @record */ function DirectiveDecorator() {} // WARNING: interface has both a type and a value, skipping emit var ɵ0$f = /** * @param {?=} dir * @return {?} */ function ɵ0$f() { var dir = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return dir; }, ɵ1$4 = /** * @param {?} type * @param {?} meta * @return {?} */ function ɵ1$4(type, meta) { return SWITCH_COMPILE_DIRECTIVE(type, meta); }; /** * Type of the Directive metadata. * * \@publicApi * @type {?} */ var Directive = makeDecorator('Directive', ɵ0$f, undefined, undefined, ɵ1$4); /** * Component decorator interface * * \@publicApi * @record */ function ComponentDecorator() {} // WARNING: interface has both a type and a value, skipping emit var ɵ2$1 = /** * @param {?=} c * @return {?} */ function ɵ2$1() { var c = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return Object.assign({ changeDetection: ChangeDetectionStrategy.Default }, c); }, ɵ3$1 = /** * @param {?} type * @param {?} meta * @return {?} */ function ɵ3$1(type, meta) { return SWITCH_COMPILE_COMPONENT(type, meta); }; /** * Component decorator and metadata. * * \@Annotation * \@publicApi * @type {?} */ var Component = makeDecorator('Component', ɵ2$1, Directive, undefined, ɵ3$1); /** * Type of the Pipe decorator / constructor function. * * \@publicApi * @record */ function PipeDecorator() {} // WARNING: interface has both a type and a value, skipping emit var ɵ4 = /** * @param {?} p * @return {?} */ function ɵ4(p) { return Object.assign({ pure: true }, p); }, ɵ5 = /** * @param {?} type * @param {?} meta * @return {?} */ function ɵ5(type, meta) { return SWITCH_COMPILE_PIPE(type, meta); }; /** * \@Annotation * \@publicApi * @type {?} */ var Pipe = makeDecorator('Pipe', ɵ4, undefined, undefined, ɵ5); /** * \@publicApi * @record */ function InputDecorator() {} // WARNING: interface has both a type and a value, skipping emit var ɵ6 = /** * @param {?=} bindingPropertyName * @return {?} */ function ɵ6(bindingPropertyName) { return { bindingPropertyName: bindingPropertyName }; }; /** * \@Annotation * \@publicApi * @type {?} */ var Input = makePropDecorator('Input', ɵ6); /** * Type of the Output decorator / constructor function. * * \@publicApi * @record */ function OutputDecorator() {} // WARNING: interface has both a type and a value, skipping emit var ɵ7 = /** * @param {?=} bindingPropertyName * @return {?} */ function ɵ7(bindingPropertyName) { return { bindingPropertyName: bindingPropertyName }; }; /** * \@Annotation * \@publicApi * @type {?} */ var Output = makePropDecorator('Output', ɵ7); /** * Type of the HostBinding decorator / constructor function. * * \@publicApi * @record */ function HostBindingDecorator() {} // WARNING: interface has both a type and a value, skipping emit var ɵ8 = /** * @param {?=} hostPropertyName * @return {?} */ function ɵ8(hostPropertyName) { return { hostPropertyName: hostPropertyName }; }; /** * \@Annotation * \@publicApi * @type {?} */ var HostBinding = makePropDecorator('HostBinding', ɵ8); /** * Type of the HostListener decorator / constructor function. * * \@publicApi * @record */ function HostListenerDecorator() {} // WARNING: interface has both a type and a value, skipping emit var ɵ9 = /** * @param {?=} eventName * @param {?=} args * @return {?} */ function ɵ9(eventName, args) { return { eventName: eventName, args: args }; }; /** * Decorator that binds a DOM event to a host listener and supplies configuration metadata. * Angular invokes the supplied handler method when the host element emits the specified event, * and updates the bound element with the result. * * If the handler method returns false, applies `preventDefault` on the bound element. * * \@usageNotes * * The following example declares a directive * that attaches a click listener to a button and counts clicks. * * ```ts * \@Directive({selector: 'button[counting]'}) * class CountClicks { * numberOfClicks = 0; * * \@HostListener('click', ['$event.target']) * onClick(btn) { * console.log('button', btn, 'number of clicks:', this.numberOfClicks++); * } * } * * \@Component({ * selector: 'app', * template: '<button counting>Increment</button>', * }) * class App {} * ``` * * \@Annotation * \@publicApi * @type {?} */ var HostListener = makePropDecorator('HostListener', ɵ9); /** @type {?} */ var SWITCH_COMPILE_COMPONENT__POST_R3__ = compileComponent; /** @type {?} */ var SWITCH_COMPILE_DIRECTIVE__POST_R3__ = compileDirective; /** @type {?} */ var SWITCH_COMPILE_PIPE__POST_R3__ = compilePipe; /** @type {?} */ var SWITCH_COMPILE_COMPONENT__PRE_R3__ = noop; /** @type {?} */ var SWITCH_COMPILE_DIRECTIVE__PRE_R3__ = noop; /** @type {?} */ var SWITCH_COMPILE_PIPE__PRE_R3__ = noop; /** @type {?} */ var SWITCH_COMPILE_COMPONENT = SWITCH_COMPILE_COMPONENT__PRE_R3__; /** @type {?} */ var SWITCH_COMPILE_DIRECTIVE = SWITCH_COMPILE_DIRECTIVE__PRE_R3__; /** @type {?} */ var SWITCH_COMPILE_PIPE = SWITCH_COMPILE_PIPE__PRE_R3__; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Represents the expansion of an `NgModule` into its scopes. * * A scope is a set of directives and pipes that are visible in a particular context. Each * `NgModule` has two scopes. The `compilation` scope is the set of directives and pipes that will * be recognized in the templates of components declared by the module. The `exported` scope is the * set of directives and pipes exported by a module (that is, module B's exported scope gets added * to module A's compilation scope when module A imports B). * @record */ function NgModuleTransitiveScopes() {} if (false) {} /** * Runtime link information for NgModules. * * This is the internal data structure used by the runtime to assemble components, directives, * pipes, and injectors. * * NOTE: Always use `ɵɵdefineNgModule` function to create this object, * never create the object directly since the shape of this object * can change between versions. * @record * @template T */ function NgModuleDef() {} if (false) {} /** * A wrapper around an NgModule that associates it with the providers. * * @param T the module type. In Ivy applications, this must be explicitly * provided. * * \@publicApi * @record * @template T */ function ModuleWithProviders() {} if (false) {} /** * Type of the NgModule decorator / constructor function. * * \@publicApi * @record */ function NgModuleDecorator() {} // WARNING: interface has both a type and a value, skipping emit var ɵ0$g = /** * @param {?} ngModule * @return {?} */ function ɵ0$g(ngModule) { return ngModule; }, ɵ1$5 = /** * Decorator that marks the following class as an NgModule, and supplies * configuration metadata for it. * * * The `declarations` and `entryComponents` options configure the compiler * with information about what belongs to the NgModule. * * The `providers` options configures the NgModule's injector to provide * dependencies the NgModule members. * * The `imports` and `exports` options bring in members from other modules, and make * this module's members available to others. * @param {?} type * @param {?} meta * @return {?} */ function ɵ1$5(type, meta) { return SWITCH_COMPILE_NGMODULE(type, meta); }; /** * \@Annotation * \@publicApi * @type {?} */ var NgModule = makeDecorator('NgModule', ɵ0$g, undefined, undefined, ɵ1$5); /** * \@description * Hook for manual bootstrapping of the application instead of using bootstrap array in \@NgModule * annotation. * * Reference to the current application is provided as a parameter. * * See ["Bootstrapping"](guide/bootstrapping) and ["Entry components"](guide/entry-components). * * \@usageNotes * ```typescript * class AppModule implements DoBootstrap { * ngDoBootstrap(appRef: ApplicationRef) { * appRef.bootstrap(AppComponent); // Or some other component * } * } * ``` * * \@publicApi * @record */ function DoBootstrap() {} if (false) {} /** * @param {?} moduleType * @param {?=} metadata * @return {?} */ function preR3NgModuleCompile(moduleType, metadata) { /** @type {?} */ var imports = metadata && metadata.imports || []; if (metadata && metadata.exports) { imports = [].concat(_toConsumableArray(imports), [metadata.exports]); } /** @type {?} */ moduleType.ngInjectorDef = ɵɵdefineInjector({ factory: convertInjectableProviderToFactory(moduleType, { useClass: moduleType }), providers: metadata && metadata.providers, imports: imports }); } /** @type {?} */ var SWITCH_COMPILE_NGMODULE__POST_R3__ = compileNgModule; /** @type {?} */ var SWITCH_COMPILE_NGMODULE__PRE_R3__ = preR3NgModuleCompile; /** @type {?} */ var SWITCH_COMPILE_NGMODULE = SWITCH_COMPILE_NGMODULE__PRE_R3__; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A function that will be executed when an application is initialized. * * \@publicApi * @type {?} */ var APP_INITIALIZER = new InjectionToken('Application Initializer'); /** * A class that reflects the state of running {\@link APP_INITIALIZER}s. * * \@publicApi */ var ApplicationInitStatus = /*#__PURE__*/function () { /** * @param {?} appInits */ function ApplicationInitStatus(appInits) { var _this340 = this; _classCallCheck(this, ApplicationInitStatus); this.appInits = appInits; this.initialized = false; this.done = false; this.donePromise = new Promise( /** * @param {?} res * @param {?} rej * @return {?} */ function (res, rej) { _this340.resolve = res; _this340.reject = rej; }); } /** * \@internal * @return {?} */ _createClass2(ApplicationInitStatus, [{ key: "runInitializers", value: function runInitializers() { var _this341 = this; if (this.initialized) { return; } /** @type {?} */ var asyncInitPromises = []; /** @type {?} */ var complete = /** * @return {?} */ function complete() { /** @type {?} */ _this341.done = true; _this341.resolve(); }; if (this.appInits) { for (var i = 0; i < this.appInits.length; i++) { /** @type {?} */ var initResult = this.appInits[i](); if (isPromise(initResult)) { asyncInitPromises.push(initResult); } } } Promise.all(asyncInitPromises).then( /** * @return {?} */ function () { complete(); })["catch"]( /** * @param {?} e * @return {?} */ function (e) { _this341.reject(e); }); if (asyncInitPromises.length === 0) { complete(); } this.initialized = true; } }]); return ApplicationInitStatus; }(); ApplicationInitStatus.decorators = [{ type: Injectable }]; /** @nocollapse */ ApplicationInitStatus.ctorParameters = function () { return [{ type: Array, decorators: [{ type: Inject, args: [APP_INITIALIZER] }, { type: Optional }] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A DI Token representing a unique string id assigned to the application by Angular and used * primarily for prefixing application attributes and CSS styles when * {\@link ViewEncapsulation#Emulated ViewEncapsulation.Emulated} is being used. * * If you need to avoid randomly generated value to be used as an application id, you can provide * a custom value via a DI provider <!-- TODO: provider --> configuring the root {\@link Injector} * using this token. * \@publicApi * @type {?} */ var APP_ID = new InjectionToken('AppId'); /** * @return {?} */ function _appIdRandomProviderFactory() { return "".concat(_randomChar()).concat(_randomChar()).concat(_randomChar()); } /** * Providers that will generate a random APP_ID_TOKEN. * \@publicApi * @type {?} */ var APP_ID_RANDOM_PROVIDER = { provide: APP_ID, useFactory: _appIdRandomProviderFactory, deps: /** @type {?} */ [] }; /** * @return {?} */ function _randomChar() { return String.fromCharCode(97 + Math.floor(Math.random() * 25)); } /** * A function that will be executed when a platform is initialized. * \@publicApi * @type {?} */ var PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer'); /** * A token that indicates an opaque platform id. * \@publicApi * @type {?} */ var PLATFORM_ID = new InjectionToken('Platform ID'); /** * All callbacks provided via this token will be called for every component that is bootstrapped. * Signature of the callback: * * `(componentRef: ComponentRef) => void`. * * \@publicApi * @type {?} */ var APP_BOOTSTRAP_LISTENER = new InjectionToken('appBootstrapListener'); /** * A token which indicates the root directory of the application * \@publicApi * @type {?} */ var PACKAGE_ROOT_URL = new InjectionToken('Application Packages Root URL'); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var Console = /*#__PURE__*/function () { function Console() { _classCallCheck(this, Console); } _createClass2(Console, [{ key: "log", /** * @param {?} message * @return {?} */ value: function log(message) { // tslint:disable-next-line:no-console console.log(message); } // Note: for reporting errors use `DOM.logError()` as it is platform specific /** * @param {?} message * @return {?} */ }, { key: "warn", value: function warn(message) { // tslint:disable-next-line:no-console console.warn(message); } }]); return Console; }(); Console.decorators = [{ type: Injectable }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Provide this token to set the locale of your application. * It is used for i18n extraction, by i18n pipes (DatePipe, I18nPluralPipe, CurrencyPipe, * DecimalPipe and PercentPipe) and by ICU expressions. * * See the [i18n guide](guide/i18n#setting-up-locale) for more information. * * \@usageNotes * ### Example * * ```typescript * import { LOCALE_ID } from '\@angular/core'; * import { platformBrowserDynamic } from '\@angular/platform-browser-dynamic'; * import { AppModule } from './app/app.module'; * * platformBrowserDynamic().bootstrapModule(AppModule, { * providers: [{provide: LOCALE_ID, useValue: 'en-US' }] * }); * ``` * * \@publicApi * @type {?} */ var LOCALE_ID$1 = new InjectionToken('LocaleId'); /** * Use this token at bootstrap to provide the content of your translation file (`xtb`, * `xlf` or `xlf2`) when you want to translate your application in another language. * * See the [i18n guide](guide/i18n#merge) for more information. * * \@usageNotes * ### Example * * ```typescript * import { TRANSLATIONS } from '\@angular/core'; * import { platformBrowserDynamic } from '\@angular/platform-browser-dynamic'; * import { AppModule } from './app/app.module'; * * // content of your translation file * const translations = '....'; * * platformBrowserDynamic().bootstrapModule(AppModule, { * providers: [{provide: TRANSLATIONS, useValue: translations }] * }); * ``` * * \@publicApi * @type {?} */ var TRANSLATIONS$1 = new InjectionToken('Translations'); /** * Provide this token at bootstrap to set the format of your {\@link TRANSLATIONS}: `xtb`, * `xlf` or `xlf2`. * * See the [i18n guide](guide/i18n#merge) for more information. * * \@usageNotes * ### Example * * ```typescript * import { TRANSLATIONS_FORMAT } from '\@angular/core'; * import { platformBrowserDynamic } from '\@angular/platform-browser-dynamic'; * import { AppModule } from './app/app.module'; * * platformBrowserDynamic().bootstrapModule(AppModule, { * providers: [{provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }] * }); * ``` * * \@publicApi * @type {?} */ var TRANSLATIONS_FORMAT = new InjectionToken('TranslationsFormat'); /** @enum {number} */ var MissingTranslationStrategy = { Error: 0, Warning: 1, Ignore: 2 }; MissingTranslationStrategy[MissingTranslationStrategy.Error] = 'Error'; MissingTranslationStrategy[MissingTranslationStrategy.Warning] = 'Warning'; MissingTranslationStrategy[MissingTranslationStrategy.Ignore] = 'Ignore'; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** @type {?} */ var SWITCH_IVY_ENABLED__POST_R3__ = true; /** @type {?} */ var SWITCH_IVY_ENABLED__PRE_R3__ = false; /** @type {?} */ var ivyEnabled = SWITCH_IVY_ENABLED__PRE_R3__; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Combination of NgModuleFactory and ComponentFactorys. * * \@publicApi * @template T */ var ModuleWithComponentFactories = /** * @param {?} ngModuleFactory * @param {?} componentFactories */ function ModuleWithComponentFactories(ngModuleFactory, componentFactories) { _classCallCheck(this, ModuleWithComponentFactories); this.ngModuleFactory = ngModuleFactory; this.componentFactories = componentFactories; }; if (false) {} /** * @return {?} */ function _throwError() { throw new Error("Runtime compiler is not loaded"); } /** @type {?} */ var Compiler_compileModuleSync__PRE_R3__ = /** @type {?} */ _throwError; /** @type {?} */ var Compiler_compileModuleSync__POST_R3__ = /** * @template T * @param {?} moduleType * @return {?} */ function Compiler_compileModuleSync__POST_R3__(moduleType) { return new NgModuleFactory$1(moduleType); }; /** @type {?} */ var Compiler_compileModuleSync = Compiler_compileModuleSync__PRE_R3__; /** @type {?} */ var Compiler_compileModuleAsync__PRE_R3__ = /** @type {?} */ _throwError; /** @type {?} */ var Compiler_compileModuleAsync__POST_R3__ = /** * @template T * @param {?} moduleType * @return {?} */ function Compiler_compileModuleAsync__POST_R3__(moduleType) { return Promise.resolve(Compiler_compileModuleSync__POST_R3__(moduleType)); }; /** @type {?} */ var Compiler_compileModuleAsync = Compiler_compileModuleAsync__PRE_R3__; /** @type {?} */ var Compiler_compileModuleAndAllComponentsSync__PRE_R3__ = /** @type {?} */ _throwError; /** @type {?} */ var Compiler_compileModuleAndAllComponentsSync__POST_R3__ = /** * @template T * @param {?} moduleType * @return {?} */ function Compiler_compileModuleAndAllComponentsSync__POST_R3__(moduleType) { /** @type {?} */ var ngModuleFactory = Compiler_compileModuleSync__POST_R3__(moduleType); /** @type {?} */ var moduleDef = /** @type {?} */ getNgModuleDef(moduleType); /** @type {?} */ var componentFactories = maybeUnwrapFn(moduleDef.declarations).reduce( /** * @param {?} factories * @param {?} declaration * @return {?} */ function (factories, declaration) { /** @type {?} */ var componentDef = getComponentDef(declaration); componentDef && factories.push(new ComponentFactory$1(componentDef)); return factories; }, /** @type {?} */ []); return new ModuleWithComponentFactories(ngModuleFactory, componentFactories); }; /** @type {?} */ var Compiler_compileModuleAndAllComponentsSync = Compiler_compileModuleAndAllComponentsSync__PRE_R3__; /** @type {?} */ var Compiler_compileModuleAndAllComponentsAsync__PRE_R3__ = /** @type {?} */ _throwError; /** @type {?} */ var Compiler_compileModuleAndAllComponentsAsync__POST_R3__ = /** * @template T * @param {?} moduleType * @return {?} */ function Compiler_compileModuleAndAllComponentsAsync__POST_R3__(moduleType) { return Promise.resolve(Compiler_compileModuleAndAllComponentsSync__POST_R3__(moduleType)); }; /** @type {?} */ var Compiler_compileModuleAndAllComponentsAsync = Compiler_compileModuleAndAllComponentsAsync__PRE_R3__; /** * Low-level service for running the angular compiler during runtime * to create {\@link ComponentFactory}s, which * can later be used to create and render a Component instance. * * Each `\@NgModule` provides an own `Compiler` to its injector, * that will use the directives/pipes of the ng module for compilation * of components. * * \@publicApi */ var Compiler = /*#__PURE__*/function () { function Compiler() { _classCallCheck(this, Compiler); /** * Compiles the given NgModule and all of its components. All templates of the components listed * in `entryComponents` have to be inlined. */ this.compileModuleSync = Compiler_compileModuleSync; /** * Compiles the given NgModule and all of its components */ this.compileModuleAsync = Compiler_compileModuleAsync; /** * Same as {\@link #compileModuleSync} but also creates ComponentFactories for all components. */ this.compileModuleAndAllComponentsSync = Compiler_compileModuleAndAllComponentsSync; /** * Same as {\@link #compileModuleAsync} but also creates ComponentFactories for all components. */ this.compileModuleAndAllComponentsAsync = Compiler_compileModuleAndAllComponentsAsync; } /** * Clears all caches. * @return {?} */ _createClass2(Compiler, [{ key: "clearCache", value: function clearCache() {} /** * Clears the cache for the given component/ngModule. * @param {?} type * @return {?} */ }, { key: "clearCacheFor", value: function clearCacheFor(type) {} /** * Returns the id for a given NgModule, if one is defined and known to the compiler. * @param {?} moduleType * @return {?} */ }, { key: "getModuleId", value: function getModuleId(moduleType) { return undefined; } }]); return Compiler; }(); Compiler.decorators = [{ type: Injectable }]; if (false) {} /** * Token to provide CompilerOptions in the platform injector. * * \@publicApi * @type {?} */ var COMPILER_OPTIONS = new InjectionToken('compilerOptions'); /** * A factory for creating a Compiler * * \@publicApi * @abstract */ var CompilerFactory = function CompilerFactory() { _classCallCheck(this, CompilerFactory); }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A scope function for the Web Tracing Framework (WTF). * * \@publicApi * @deprecated the Web Tracing Framework is no longer supported in Angular * @record */ function WtfScopeFn() {} /** * @record */ function WTF() {} if (false) {} /** * @record */ function Trace() {} if (false) {} /** * @record */ function Range() {} /** * @record */ function Events() {} if (false) {} /** * @record */ function Scope() {} /** @type {?} */ var trace; /** @type {?} */ var events; /** * @return {?} */ function detectWTF() { /** @type {?} */ var wtf = /** @type {?} */ _global['wtf']; if (wtf) { trace = wtf['trace']; if (trace) { events = trace['events']; return true; } } return false; } /** * @param {?} signature * @param {?=} flags * @return {?} */ function createScope(signature) { var flags = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return events.createScope(signature, flags); } /** * @template T * @param {?} scope * @param {?=} returnValue * @return {?} */ function leave(scope, returnValue) { trace.leaveScope(scope, returnValue); return returnValue; } /** * @param {?} rangeType * @param {?} action * @return {?} */ function startTimeRange(rangeType, action) { return trace.beginTimeRange(rangeType, action); } /** * @param {?} range * @return {?} */ function endTimeRange(range) { trace.endTimeRange(range); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * True if WTF is enabled. * @type {?} */ var wtfEnabled = detectWTF(); /** * @param {?=} arg0 * @param {?=} arg1 * @return {?} */ function noopScope(arg0, arg1) { return null; } /** * Create trace scope. * * Scopes must be strictly nested and are analogous to stack frames, but * do not have to follow the stack frames. Instead it is recommended that they follow logical * nesting. You may want to use * [Event * Signatures](http://google.github.io/tracing-framework/instrumenting-code.html#custom-events) * as they are defined in WTF. * * Used to mark scope entry. The return value is used to leave the scope. * * var myScope = wtfCreateScope('MyClass#myMethod(ascii someVal)'); * * someMethod() { * var s = myScope('Foo'); // 'Foo' gets stored in tracing UI * // DO SOME WORK HERE * return wtfLeave(s, 123); // Return value 123 * } * * Note, adding try-finally block around the work to ensure that `wtfLeave` gets called can * negatively impact the performance of your application. For this reason we recommend that * you don't add them to ensure that `wtfLeave` gets called. In production `wtfLeave` is a noop and * so try-finally block has no value. When debugging perf issues, skipping `wtfLeave`, do to * exception, will produce incorrect trace, but presence of exception signifies logic error which * needs to be fixed before the app should be profiled. Add try-finally only when you expect that * an exception is expected during normal execution while profiling. * * \@publicApi * @deprecated the Web Tracing Framework is no longer supported in Angular * @type {?} */ var wtfCreateScope = wtfEnabled ? createScope : /** * @param {?} signature * @param {?=} flags * @return {?} */ function (signature, flags) { return noopScope; }; /** * Used to mark end of Scope. * * - `scope` to end. * - `returnValue` (optional) to be passed to the WTF. * * Returns the `returnValue for easy chaining. * \@publicApi * @deprecated the Web Tracing Framework is no longer supported in Angular * @type {?} */ var wtfLeave = wtfEnabled ? leave : /** * @param {?} s * @param {?=} r * @return {?} */ function (s, r) { return r; }; /** * Used to mark Async start. Async are similar to scope but they don't have to be strictly nested. * The return value is used in the call to [endAsync]. Async ranges only work if WTF has been * enabled. * * someMethod() { * var s = wtfStartTimeRange('HTTP:GET', 'some.url'); * var future = new Future.delay(5).then((_) { * wtfEndTimeRange(s); * }); * } * \@publicApi * @deprecated the Web Tracing Framework is no longer supported in Angular * @type {?} */ var wtfStartTimeRange = wtfEnabled ? startTimeRange : /** * @param {?} rangeType * @param {?} action * @return {?} */ function (rangeType, action) { return null; }; /** * Ends a async time range operation. * [range] is the return value from [wtfStartTimeRange] Async ranges only work if WTF has been * enabled. * \@publicApi * @deprecated the Web Tracing Framework is no longer supported in Angular * @type {?} */ var wtfEndTimeRange = wtfEnabled ? endTimeRange : /** * @param {?} r * @return {?} */ function (r) { return null; }; /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var promise = function () { return Promise.resolve(0); }(); function scheduleMicroTask(fn) { if (typeof Zone === 'undefined') { // use promise to schedule microTask instead of use Zone promise.then(function () { fn && fn.apply(null, null); }); } else { Zone.current.scheduleMicroTask('scheduleMicrotask', fn); } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * An injectable service for executing work inside or outside of the Angular zone. * * The most common use of this service is to optimize performance when starting a work consisting of * one or more asynchronous tasks that don't require UI updates or error handling to be handled by * Angular. Such tasks can be kicked off via {\@link #runOutsideAngular} and if needed, these tasks * can reenter the Angular zone via {\@link #run}. * * <!-- TODO: add/fix links to: * - docs explaining zones and the use of zones in Angular and change-detection * - link to runOutsideAngular/run (throughout this file!) * --> * * \@usageNotes * ### Example * * ``` * import {Component, NgZone} from '\@angular/core'; * import {NgIf} from '\@angular/common'; * * \@Component({ * selector: 'ng-zone-demo', * template: ` * <h2>Demo: NgZone</h2> * * <p>Progress: {{progress}}%</p> * <p *ngIf="progress >= 100">Done processing {{label}} of Angular zone!</p> * * <button (click)="processWithinAngularZone()">Process within Angular zone</button> * <button (click)="processOutsideOfAngularZone()">Process outside of Angular zone</button> * `, * }) * export class NgZoneDemo { * progress: number = 0; * label: string; * * constructor(private _ngZone: NgZone) {} * * // Loop inside the Angular zone * // so the UI DOES refresh after each setTimeout cycle * processWithinAngularZone() { * this.label = 'inside'; * this.progress = 0; * this._increaseProgress(() => console.log('Inside Done!')); * } * * // Loop outside of the Angular zone * // so the UI DOES NOT refresh after each setTimeout cycle * processOutsideOfAngularZone() { * this.label = 'outside'; * this.progress = 0; * this._ngZone.runOutsideAngular(() => { * this._increaseProgress(() => { * // reenter the Angular zone and display done * this._ngZone.run(() => { console.log('Outside Done!'); }); * }); * }); * } * * _increaseProgress(doneCallback: () => void) { * this.progress += 1; * console.log(`Current progress: ${this.progress}%`); * * if (this.progress < 100) { * window.setTimeout(() => this._increaseProgress(doneCallback), 10); * } else { * doneCallback(); * } * } * } * ``` * * \@publicApi */ var NgZone = /*#__PURE__*/function () { /** * @param {?} __0 */ function NgZone(_ref63) { var _ref63$enableLongStac = _ref63.enableLongStackTrace, enableLongStackTrace = _ref63$enableLongStac === void 0 ? false : _ref63$enableLongStac; _classCallCheck(this, NgZone); this.hasPendingMicrotasks = false; this.hasPendingMacrotasks = false; /** * Whether there are no outstanding microtasks or macrotasks. */ this.isStable = true; /** * Notifies when code enters Angular Zone. This gets fired first on VM Turn. */ this.onUnstable = new EventEmitter(false); /** * Notifies when there is no more microtasks enqueued in the current VM Turn. * This is a hint for Angular to do change detection, which may enqueue more microtasks. * For this reason this event can fire multiple times per VM Turn. */ this.onMicrotaskEmpty = new EventEmitter(false); /** * Notifies when the last `onMicrotaskEmpty` has run and there are no more microtasks, which * implies we are about to relinquish VM turn. * This event gets called just once. */ this.onStable = new EventEmitter(false); /** * Notifies that an error has been delivered. */ this.onError = new EventEmitter(false); if (typeof Zone == 'undefined') { throw new Error("In this configuration Angular requires Zone.js"); } Zone.assertZonePatched(); /** @type {?} */ var self = /** @type {?} */ /** @type {?} */ this; self._nesting = 0; self._outer = self._inner = Zone.current; if ( /** @type {?} */ Zone['wtfZoneSpec']) { self._inner = self._inner.fork( /** @type {?} */ Zone['wtfZoneSpec']); } if ( /** @type {?} */ Zone['TaskTrackingZoneSpec']) { self._inner = self._inner.fork(new /** @type {?} */ /** @type {?} */ Zone['TaskTrackingZoneSpec']()); } if (enableLongStackTrace && /** @type {?} */ Zone['longStackTraceZoneSpec']) { self._inner = self._inner.fork( /** @type {?} */ Zone['longStackTraceZoneSpec']); } forkInnerZoneWithAngularBehavior(self); } /** * @return {?} */ _createClass2(NgZone, [{ key: "run", /** * Executes the `fn` function synchronously within the Angular zone and returns value returned by * the function. * * Running functions via `run` allows you to reenter Angular zone from a task that was executed * outside of the Angular zone (typically started via {\@link #runOutsideAngular}). * * Any future tasks or microtasks scheduled from within this function will continue executing from * within the Angular zone. * * If a synchronous error happens it will be rethrown and not reported via `onError`. * @template T * @param {?} fn * @param {?=} applyThis * @param {?=} applyArgs * @return {?} */ value: function run(fn, applyThis, applyArgs) { return ( /** @type {?} */ /** @type {?} */ /** @type {?} */ this._inner.run(fn, applyThis, applyArgs) ); } /** * Executes the `fn` function synchronously within the Angular zone as a task and returns value * returned by the function. * * Running functions via `run` allows you to reenter Angular zone from a task that was executed * outside of the Angular zone (typically started via {\@link #runOutsideAngular}). * * Any future tasks or microtasks scheduled from within this function will continue executing from * within the Angular zone. * * If a synchronous error happens it will be rethrown and not reported via `onError`. * @template T * @param {?} fn * @param {?=} applyThis * @param {?=} applyArgs * @param {?=} name * @return {?} */ }, { key: "runTask", value: function runTask(fn, applyThis, applyArgs, name) { /** @type {?} */ var zone = /** @type {?} */ /** @type {?} */ this._inner; /** @type {?} */ var task = zone.scheduleEventTask('NgZoneEvent: ' + name, fn, EMPTY_PAYLOAD, noop$1, noop$1); try { return ( /** @type {?} */ zone.runTask(task, applyThis, applyArgs) ); } finally { zone.cancelTask(task); } } /** * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not * rethrown. * @template T * @param {?} fn * @param {?=} applyThis * @param {?=} applyArgs * @return {?} */ }, { key: "runGuarded", value: function runGuarded(fn, applyThis, applyArgs) { return ( /** @type {?} */ /** @type {?} */ /** @type {?} */ this._inner.runGuarded(fn, applyThis, applyArgs) ); } /** * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by * the function. * * Running functions via {\@link #runOutsideAngular} allows you to escape Angular's zone and do * work that * doesn't trigger Angular change-detection or is subject to Angular's error handling. * * Any future tasks or microtasks scheduled from within this function will continue executing from * outside of the Angular zone. * * Use {\@link #run} to reenter the Angular zone and do work that updates the application model. * @template T * @param {?} fn * @return {?} */ }, { key: "runOutsideAngular", value: function runOutsideAngular(fn) { return ( /** @type {?} */ /** @type {?} */ /** @type {?} */ this._outer.run(fn) ); } }], [{ key: "isInAngularZone", value: function isInAngularZone() { return Zone.current.get('isAngularZone') === true; } /** * @return {?} */ }, { key: "assertInAngularZone", value: function assertInAngularZone() { if (!NgZone.isInAngularZone()) { throw new Error('Expected to be in Angular Zone, but it is not!'); } } /** * @return {?} */ }, { key: "assertNotInAngularZone", value: function assertNotInAngularZone() { if (NgZone.isInAngularZone()) { throw new Error('Expected to not be in Angular Zone, but it is!'); } } }]); return NgZone; }(); if (false) {} /** * @return {?} */ function noop$1() {} /** @type {?} */ var EMPTY_PAYLOAD = {}; /** * @record */ function NgZonePrivate() {} if (false) {} /** * @param {?} zone * @return {?} */ function checkStable(zone) { if (zone._nesting == 0 && !zone.hasPendingMicrotasks && !zone.isStable) { try { zone._nesting++; zone.onMicrotaskEmpty.emit(null); } finally { zone._nesting--; if (!zone.hasPendingMicrotasks) { try { zone.runOutsideAngular( /** * @return {?} */ function () { return zone.onStable.emit(null); }); } finally { zone.isStable = true; } } } } } /** * @param {?} zone * @return {?} */ function forkInnerZoneWithAngularBehavior(zone) { zone._inner = zone._inner.fork({ name: 'angular', properties: /** @type {?} */ { 'isAngularZone': true }, onInvokeTask: /** * @param {?} delegate * @param {?} current * @param {?} target * @param {?} task * @param {?} applyThis * @param {?} applyArgs * @return {?} */ function onInvokeTask(delegate, current, target, task, applyThis, applyArgs) { try { onEnter(zone); return delegate.invokeTask(target, task, applyThis, applyArgs); } finally { onLeave(zone); } }, onInvoke: /** * @param {?} delegate * @param {?} current * @param {?} target * @param {?} callback * @param {?} applyThis * @param {?=} applyArgs * @param {?=} source * @return {?} */ function onInvoke(delegate, current, target, callback, applyThis, applyArgs, source) { try { onEnter(zone); return delegate.invoke(target, callback, applyThis, applyArgs, source); } finally { onLeave(zone); } }, onHasTask: /** * @param {?} delegate * @param {?} current * @param {?} target * @param {?} hasTaskState * @return {?} */ function onHasTask(delegate, current, target, hasTaskState) { delegate.hasTask(target, hasTaskState); if (current === target) { // We are only interested in hasTask events which originate from our zone // (A child hasTask event is not interesting to us) if (hasTaskState.change == 'microTask') { zone.hasPendingMicrotasks = hasTaskState.microTask; checkStable(zone); } else if (hasTaskState.change == 'macroTask') { zone.hasPendingMacrotasks = hasTaskState.macroTask; } } }, onHandleError: /** * @param {?} delegate * @param {?} current * @param {?} target * @param {?} error * @return {?} */ function onHandleError(delegate, current, target, error) { delegate.handleError(target, error); zone.runOutsideAngular( /** * @return {?} */ function () { return zone.onError.emit(error); }); return false; } }); } /** * @param {?} zone * @return {?} */ function onEnter(zone) { zone._nesting++; if (zone.isStable) { zone.isStable = false; zone.onUnstable.emit(null); } } /** * @param {?} zone * @return {?} */ function onLeave(zone) { zone._nesting--; checkStable(zone); } /** * Provides a noop implementation of `NgZone` which does nothing. This zone requires explicit calls * to framework to perform rendering. */ var NoopNgZone = /*#__PURE__*/function () { function NoopNgZone() { _classCallCheck(this, NoopNgZone); this.hasPendingMicrotasks = false; this.hasPendingMacrotasks = false; this.isStable = true; this.onUnstable = new EventEmitter(); this.onMicrotaskEmpty = new EventEmitter(); this.onStable = new EventEmitter(); this.onError = new EventEmitter(); } /** * @param {?} fn * @return {?} */ _createClass2(NoopNgZone, [{ key: "run", value: function run(fn) { return fn(); } /** * @param {?} fn * @return {?} */ }, { key: "runGuarded", value: function runGuarded(fn) { return fn(); } /** * @param {?} fn * @return {?} */ }, { key: "runOutsideAngular", value: function runOutsideAngular(fn) { return fn(); } /** * @template T * @param {?} fn * @return {?} */ }, { key: "runTask", value: function runTask(fn) { return fn(); } }]); return NoopNgZone; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @record */ function PendingMacrotask() {} if (false) {} /** * @record */ function TaskData() {} if (false) {} /** * @record */ function WaitCallback() {} if (false) {} /** * The Testability service provides testing hooks that can be accessed from * the browser and by services such as Protractor. Each bootstrapped Angular * application on the page will have an instance of Testability. * \@publicApi */ var Testability = /*#__PURE__*/function () { /** * @param {?} _ngZone */ function Testability(_ngZone) { var _this342 = this; _classCallCheck(this, Testability); this._ngZone = _ngZone; this._pendingCount = 0; this._isZoneStable = true; /** * Whether any work was done since the last 'whenStable' callback. This is * useful to detect if this could have potentially destabilized another * component while it is stabilizing. * \@internal */ this._didWork = false; this._callbacks = []; this.taskTrackingZone = null; this._watchAngularEvents(); _ngZone.run( /** * @return {?} */ function () { _this342.taskTrackingZone = typeof Zone == 'undefined' ? null : Zone.current.get('TaskTrackingZone'); }); } /** * @private * @return {?} */ _createClass2(Testability, [{ key: "_watchAngularEvents", value: function _watchAngularEvents() { var _this343 = this; this._ngZone.onUnstable.subscribe({ next: /** * @return {?} */ function next() { _this343._didWork = true; _this343._isZoneStable = false; } }); this._ngZone.runOutsideAngular( /** * @return {?} */ function () { _this343._ngZone.onStable.subscribe({ next: /** * @return {?} */ function next() { NgZone.assertNotInAngularZone(); scheduleMicroTask( /** * @return {?} */ function () { _this343._isZoneStable = true; _this343._runCallbacksIfReady(); }); } }); }); } /** * Increases the number of pending request * @deprecated pending requests are now tracked with zones. * @return {?} */ }, { key: "increasePendingRequestCount", value: function increasePendingRequestCount() { this._pendingCount += 1; this._didWork = true; return this._pendingCount; } /** * Decreases the number of pending request * @deprecated pending requests are now tracked with zones * @return {?} */ }, { key: "decreasePendingRequestCount", value: function decreasePendingRequestCount() { this._pendingCount -= 1; if (this._pendingCount < 0) { throw new Error('pending async requests below zero'); } this._runCallbacksIfReady(); return this._pendingCount; } /** * Whether an associated application is stable * @return {?} */ }, { key: "isStable", value: function isStable() { return this._isZoneStable && this._pendingCount === 0 && !this._ngZone.hasPendingMacrotasks; } /** * @private * @return {?} */ }, { key: "_runCallbacksIfReady", value: function _runCallbacksIfReady() { var _this344 = this; if (this.isStable()) { // Schedules the call backs in a new frame so that it is always async. scheduleMicroTask( /** * @return {?} */ function () { while (_this344._callbacks.length !== 0) { /** @type {?} */ var cb = /** @type {?} */ _this344._callbacks.pop(); clearTimeout(cb.timeoutId); cb.doneCb(_this344._didWork); } _this344._didWork = false; }); } else { // Still not stable, send updates. /** @type {?} */ var pending = this.getPendingTasks(); this._callbacks = this._callbacks.filter( /** * @param {?} cb * @return {?} */ function (cb) { if (cb.updateCb && cb.updateCb(pending)) { clearTimeout(cb.timeoutId); return false; } return true; }); this._didWork = true; } } /** * @private * @return {?} */ }, { key: "getPendingTasks", value: function getPendingTasks() { if (!this.taskTrackingZone) { return []; } // Copy the tasks data so that we don't leak tasks. return this.taskTrackingZone.macroTasks.map( /** * @param {?} t * @return {?} */ function (t) { return { source: t.source, // From TaskTrackingZone: // https://github.com/angular/zone.js/blob/master/lib/zone-spec/task-tracking.ts#L40 creationLocation: /** @type {?} */ /** @type {?} */ t.creationLocation, data: t.data }; }); } /** * @private * @param {?} cb * @param {?=} timeout * @param {?=} updateCb * @return {?} */ }, { key: "addCallback", value: function addCallback(cb, timeout, updateCb) { var _this345 = this; /** @type {?} */ var timeoutId = -1; if (timeout && timeout > 0) { timeoutId = setTimeout( /** * @return {?} */ function () { _this345._callbacks = _this345._callbacks.filter( /** * @param {?} cb * @return {?} */ function (cb) { return cb.timeoutId !== timeoutId; }); cb(_this345._didWork, _this345.getPendingTasks()); }, timeout); } this._callbacks.push( /** @type {?} */ { doneCb: cb, timeoutId: timeoutId, updateCb: updateCb }); } /** * Wait for the application to be stable with a timeout. If the timeout is reached before that * happens, the callback receives a list of the macro tasks that were pending, otherwise null. * * @param {?} doneCb The callback to invoke when Angular is stable or the timeout expires * whichever comes first. * @param {?=} timeout Optional. The maximum time to wait for Angular to become stable. If not * specified, whenStable() will wait forever. * @param {?=} updateCb Optional. If specified, this callback will be invoked whenever the set of * pending macrotasks changes. If this callback returns true doneCb will not be invoked * and no further updates will be issued. * @return {?} */ }, { key: "whenStable", value: function whenStable(doneCb, timeout, updateCb) { if (updateCb && !this.taskTrackingZone) { throw new Error('Task tracking zone is required when passing an update callback to ' + 'whenStable(). Is "zone.js/dist/task-tracking.js" loaded?'); } // These arguments are 'Function' above to keep the public API simple. this.addCallback( /** @type {?} */ doneCb, timeout, /** @type {?} */ updateCb); this._runCallbacksIfReady(); } /** * Get the number of pending requests * @deprecated pending requests are now tracked with zones * @return {?} */ }, { key: "getPendingRequestCount", value: function getPendingRequestCount() { return this._pendingCount; } /** * Find providers by name * @param {?} using The root element to search from * @param {?} provider The name of binding variable * @param {?} exactMatch Whether using exactMatch * @return {?} */ }, { key: "findProviders", value: function findProviders(using, provider, exactMatch) { // TODO(juliemr): implement. return []; } }]); return Testability; }(); Testability.decorators = [{ type: Injectable }]; /** @nocollapse */ Testability.ctorParameters = function () { return [{ type: NgZone }]; }; if (false) {} /** * A global registry of {\@link Testability} instances for specific elements. * \@publicApi */ var TestabilityRegistry = /*#__PURE__*/function () { function TestabilityRegistry() { _classCallCheck(this, TestabilityRegistry); /** * \@internal */ this._applications = new Map(); _testabilityGetter.addToWindow(this); } /** * Registers an application with a testability hook so that it can be tracked * @param {?} token token of application, root element * @param {?} testability Testability hook * @return {?} */ _createClass2(TestabilityRegistry, [{ key: "registerApplication", value: function registerApplication(token, testability) { this._applications.set(token, testability); } /** * Unregisters an application. * @param {?} token token of application, root element * @return {?} */ }, { key: "unregisterApplication", value: function unregisterApplication(token) { this._applications["delete"](token); } /** * Unregisters all applications * @return {?} */ }, { key: "unregisterAllApplications", value: function unregisterAllApplications() { this._applications.clear(); } /** * Get a testability hook associated with the application * @param {?} elem root element * @return {?} */ }, { key: "getTestability", value: function getTestability(elem) { return this._applications.get(elem) || null; } /** * Get all registered testabilities * @return {?} */ }, { key: "getAllTestabilities", value: function getAllTestabilities() { return Array.from(this._applications.values()); } /** * Get all registered applications(root elements) * @return {?} */ }, { key: "getAllRootElements", value: function getAllRootElements() { return Array.from(this._applications.keys()); } /** * Find testability of a node in the Tree * @param {?} elem node * @param {?=} findInAncestors whether finding testability in ancestors if testability was not found in * current node * @return {?} */ }, { key: "findTestabilityInTree", value: function findTestabilityInTree(elem) { var findInAncestors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; return _testabilityGetter.findTestabilityInTree(this, elem, findInAncestors); } }]); return TestabilityRegistry; }(); TestabilityRegistry.decorators = [{ type: Injectable }]; /** @nocollapse */ TestabilityRegistry.ctorParameters = function () { return []; }; if (false) {} /** * Adapter interface for retrieving the `Testability` service associated for a * particular context. * * \@publicApi * @record */ function GetTestability() {} if (false) {} var _NoopGetTestability = /*#__PURE__*/function () { function _NoopGetTestability() { _classCallCheck(this, _NoopGetTestability); } _createClass2(_NoopGetTestability, [{ key: "addToWindow", /** * @param {?} registry * @return {?} */ value: function addToWindow(registry) {} /** * @param {?} registry * @param {?} elem * @param {?} findInAncestors * @return {?} */ }, { key: "findTestabilityInTree", value: function findTestabilityInTree(registry, elem, findInAncestors) { return null; } }]); return _NoopGetTestability; }(); /** * Set the {\@link GetTestability} implementation used by the Angular testing framework. * \@publicApi * @param {?} getter * @return {?} */ function setTestabilityGetter(getter) { _testabilityGetter = getter; } /** @type {?} */ var _testabilityGetter = new _NoopGetTestability(); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var _platform; /** @type {?} */ var compileNgModuleFactory = compileNgModuleFactory__PRE_R3__; /** * @template M * @param {?} injector * @param {?} options * @param {?} moduleType * @return {?} */ function compileNgModuleFactory__PRE_R3__(injector, options, moduleType) { /** @type {?} */ var compilerFactory = injector.get(CompilerFactory); /** @type {?} */ var compiler = compilerFactory.createCompiler([options]); return compiler.compileModuleAsync(moduleType); } /** * @template M * @param {?} injector * @param {?} options * @param {?} moduleType * @return {?} */ function compileNgModuleFactory__POST_R3__(injector, options, moduleType) { ngDevMode && assertNgModuleType(moduleType); /** @type {?} */ var moduleFactory = new NgModuleFactory$1(moduleType); if (isComponentResourceResolutionQueueEmpty()) { return Promise.resolve(moduleFactory); } /** @type {?} */ var compilerOptions = injector.get(COMPILER_OPTIONS, []).concat(options); /** @type {?} */ var compilerProviders = _mergeArrays(compilerOptions.map( /** * @param {?} o * @return {?} */ function (o) { return ( /** @type {?} */ o.providers ); })); // In case there are no compiler providers, we just return the module factory as // there won't be any resource loader. This can happen with Ivy, because AOT compiled // modules can be still passed through "bootstrapModule". In that case we shouldn't // unnecessarily require the JIT compiler. if (compilerProviders.length === 0) { return Promise.resolve(moduleFactory); } /** @type {?} */ var compiler = getCompilerFacade(); /** @type {?} */ var compilerInjector = Injector.create({ providers: compilerProviders }); /** @type {?} */ var resourceLoader = compilerInjector.get(compiler.ResourceLoader); // The resource loader can also return a string while the "resolveComponentResources" // always expects a promise. Therefore we need to wrap the returned value in a promise. return resolveComponentResources( /** * @param {?} url * @return {?} */ function (url) { return Promise.resolve(resourceLoader.get(url)); }).then( /** * @return {?} */ function () { return moduleFactory; }); } /** @type {?} */ var isBoundToModule = isBoundToModule__PRE_R3__; /** * @template C * @param {?} cf * @return {?} */ function isBoundToModule__PRE_R3__(cf) { return cf instanceof ComponentFactoryBoundToModule; } /** * @template C * @param {?} cf * @return {?} */ function isBoundToModule__POST_R3__(cf) { return ( /** @type {?} */ cf.isBoundToModule ); } /** @type {?} */ var ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken'); /** * A token for third-party components that can register themselves with NgProbe. * * \@publicApi */ var NgProbeToken = /** * @param {?} name * @param {?} token */ function NgProbeToken(name, token) { _classCallCheck(this, NgProbeToken); this.name = name; this.token = token; }; if (false) {} /** * Creates a platform. * Platforms have to be eagerly created via this function. * * \@publicApi * @param {?} injector * @return {?} */ function createPlatform(injector) { if (_platform && !_platform.destroyed && !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) { throw new Error('There can be only one platform. Destroy the previous one to create a new one.'); } _platform = injector.get(PlatformRef); /** @type {?} */ var inits = injector.get(PLATFORM_INITIALIZER, null); if (inits) inits.forEach( /** * @param {?} init * @return {?} */ function (init) { return init(); }); return _platform; } /** * Creates a factory for a platform * * \@publicApi * @param {?} parentPlatformFactory * @param {?} name * @param {?=} providers * @return {?} */ function createPlatformFactory(parentPlatformFactory, name) { var providers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; /** @type {?} */ var desc = "Platform: ".concat(name); /** @type {?} */ var marker = new InjectionToken(desc); return ( /** * @param {?=} extraProviders * @return {?} */ function () { var extraProviders = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; /** @type {?} */ var platform = getPlatform(); if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) { if (parentPlatformFactory) { parentPlatformFactory(providers.concat(extraProviders).concat({ provide: marker, useValue: true })); } else { /** @type {?} */ var injectedProviders = providers.concat(extraProviders).concat({ provide: marker, useValue: true }); createPlatform(Injector.create({ providers: injectedProviders, name: desc })); } } return assertPlatform(marker); } ); } /** * Checks that there currently is a platform which contains the given token as a provider. * * \@publicApi * @param {?} requiredToken * @return {?} */ function assertPlatform(requiredToken) { /** @type {?} */ var platform = getPlatform(); if (!platform) { throw new Error('No platform exists!'); } if (!platform.injector.get(requiredToken, null)) { throw new Error('A platform with a different configuration has been created. Please destroy it first.'); } return platform; } /** * Destroy the existing platform. * * \@publicApi * @return {?} */ function destroyPlatform() { if (_platform && !_platform.destroyed) { _platform.destroy(); } } /** * Returns the current platform. * * \@publicApi * @return {?} */ function getPlatform() { return _platform && !_platform.destroyed ? _platform : null; } /** * Provides additional options to the bootstraping process. * * * @record */ function BootstrapOptions() {} if (false) {} /** * The Angular platform is the entry point for Angular on a web page. Each page * has exactly one platform, and services (such as reflection) which are common * to every Angular application running on the page are bound in its scope. * * A page's platform is initialized implicitly when a platform is created via a platform factory * (e.g. {\@link platformBrowser}), or explicitly by calling the {\@link createPlatform} function. * * \@publicApi */ var PlatformRef = /*#__PURE__*/function () { /** * \@internal * @param {?} _injector */ function PlatformRef(_injector) { _classCallCheck(this, PlatformRef); this._injector = _injector; this._modules = []; this._destroyListeners = []; this._destroyed = false; } /** * Creates an instance of an `\@NgModule` for the given platform * for offline compilation. * * \@usageNotes * ### Simple Example * * ```typescript * my_module.ts: * * \@NgModule({ * imports: [BrowserModule] * }) * class MyModule {} * * main.ts: * import {MyModuleNgFactory} from './my_module.ngfactory'; * import {platformBrowser} from '\@angular/platform-browser'; * * let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory); * ``` * @template M * @param {?} moduleFactory * @param {?=} options * @return {?} */ _createClass2(PlatformRef, [{ key: "bootstrapModuleFactory", value: function bootstrapModuleFactory(moduleFactory, options) { var _this346 = this; // Note: We need to create the NgZone _before_ we instantiate the module, // as instantiating the module creates some providers eagerly. // So we create a mini parent injector that just contains the new NgZone and // pass that as parent to the NgModuleFactory. /** @type {?} */ var ngZoneOption = options ? options.ngZone : undefined; /** @type {?} */ var ngZone = getNgZone(ngZoneOption); /** @type {?} */ var providers = [{ provide: NgZone, useValue: ngZone }]; // Attention: Don't use ApplicationRef.run here, // as we want to be sure that all possible constructor calls are inside `ngZone.run`! return ngZone.run( /** * @return {?} */ function () { /** @type {?} */ var ngZoneInjector = Injector.create({ providers: providers, parent: _this346.injector, name: moduleFactory.moduleType.name }); /** @type {?} */ var moduleRef = /** @type {?} */ moduleFactory.create(ngZoneInjector); /** @type {?} */ var exceptionHandler = moduleRef.injector.get(ErrorHandler, null); if (!exceptionHandler) { throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?'); } // If the `LOCALE_ID` provider is defined at bootstrap we set the value for runtime i18n (ivy) if (ivyEnabled) { /** @type {?} */ var localeId = moduleRef.injector.get(LOCALE_ID$1, DEFAULT_LOCALE_ID); setLocaleId(localeId || DEFAULT_LOCALE_ID); } moduleRef.onDestroy( /** * @return {?} */ function () { return remove(_this346._modules, moduleRef); }); /** @type {?} */ ngZone.runOutsideAngular( /** * @return {?} */ function () { return ( /** @type {?} */ ngZone.onError.subscribe({ next: /** * @param {?} error * @return {?} */ function next(error) { exceptionHandler.handleError(error); } }) ); }); return _callAndReportToErrorHandler(exceptionHandler, /** @type {?} */ ngZone, /** * @return {?} */ function () { /** @type {?} */ var initStatus = moduleRef.injector.get(ApplicationInitStatus); initStatus.runInitializers(); return initStatus.donePromise.then( /** * @return {?} */ function () { _this346._moduleDoBootstrap(moduleRef); return moduleRef; }); }); }); } /** * Creates an instance of an `\@NgModule` for a given platform using the given runtime compiler. * * \@usageNotes * ### Simple Example * * ```typescript * \@NgModule({ * imports: [BrowserModule] * }) * class MyModule {} * * let moduleRef = platformBrowser().bootstrapModule(MyModule); * ``` * * @template M * @param {?} moduleType * @param {?=} compilerOptions * @return {?} */ }, { key: "bootstrapModule", value: function bootstrapModule(moduleType) { var _this347 = this; var compilerOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; /** @type {?} */ var options = optionsReducer({}, compilerOptions); return compileNgModuleFactory(this.injector, options, moduleType).then( /** * @param {?} moduleFactory * @return {?} */ function (moduleFactory) { return _this347.bootstrapModuleFactory(moduleFactory, options); }); } /** * @private * @param {?} moduleRef * @return {?} */ }, { key: "_moduleDoBootstrap", value: function _moduleDoBootstrap(moduleRef) { /** @type {?} */ var appRef = /** @type {?} */ moduleRef.injector.get(ApplicationRef); if (moduleRef._bootstrapComponents.length > 0) { moduleRef._bootstrapComponents.forEach( /** * @param {?} f * @return {?} */ function (f) { return appRef.bootstrap(f); }); } else if (moduleRef.instance.ngDoBootstrap) { moduleRef.instance.ngDoBootstrap(appRef); } else { throw new Error("The module ".concat(stringify(moduleRef.instance.constructor), " was bootstrapped, but it does not declare \"@NgModule.bootstrap\" components nor a \"ngDoBootstrap\" method. ") + "Please define one of these."); } this._modules.push(moduleRef); } /** * Register a listener to be called when the platform is disposed. * @param {?} callback * @return {?} */ }, { key: "onDestroy", value: function onDestroy(callback) { this._destroyListeners.push(callback); } /** * Retrieve the platform {\@link Injector}, which is the parent injector for * every Angular application on the page and provides singleton providers. * @return {?} */ }, { key: "destroy", /** * Destroy the Angular platform and all Angular applications on the page. * @return {?} */ value: function destroy() { if (this._destroyed) { throw new Error('The platform has already been destroyed!'); } this._modules.slice().forEach( /** * @param {?} module * @return {?} */ function (module) { return module.destroy(); }); this._destroyListeners.forEach( /** * @param {?} listener * @return {?} */ function (listener) { return listener(); }); this._destroyed = true; } /** * @return {?} */ }, { key: "injector", get: function get() { return this._injector; } }, { key: "destroyed", get: function get() { return this._destroyed; } }]); return PlatformRef; }(); PlatformRef.decorators = [{ type: Injectable }]; /** @nocollapse */ PlatformRef.ctorParameters = function () { return [{ type: Injector }]; }; if (false) {} /** * @param {?=} ngZoneOption * @return {?} */ function getNgZone(ngZoneOption) { /** @type {?} */ var ngZone; if (ngZoneOption === 'noop') { ngZone = new NoopNgZone(); } else { ngZone = (ngZoneOption === 'zone.js' ? undefined : ngZoneOption) || new NgZone({ enableLongStackTrace: isDevMode() }); } return ngZone; } /** * @param {?} errorHandler * @param {?} ngZone * @param {?} callback * @return {?} */ function _callAndReportToErrorHandler(errorHandler, ngZone, callback) { try { /** @type {?} */ var result = callback(); if (isPromise(result)) { return result["catch"]( /** * @param {?} e * @return {?} */ function (e) { ngZone.runOutsideAngular( /** * @return {?} */ function () { return errorHandler.handleError(e); }); // rethrow as the exception handler might not do it throw e; }); } return result; } catch (e) { ngZone.runOutsideAngular( /** * @return {?} */ function () { return errorHandler.handleError(e); }); // rethrow as the exception handler might not do it throw e; } } /** * @template T * @param {?} dst * @param {?} objs * @return {?} */ function optionsReducer(dst, objs) { if (Array.isArray(objs)) { dst = objs.reduce(optionsReducer, dst); } else { dst = Object.assign({}, dst, /** @type {?} */ objs); } return dst; } /** * A reference to an Angular application running on a page. * * \@usageNotes * * {\@a is-stable-examples} * ### isStable examples and caveats * * Note two important points about `isStable`, demonstrated in the examples below: * - the application will never be stable if you start any kind * of recurrent asynchronous task when the application starts * (for example for a polling process, started with a `setInterval`, a `setTimeout` * or using RxJS operators like `interval`); * - the `isStable` Observable runs outside of the Angular zone. * * Let's imagine that you start a recurrent task * (here incrementing a counter, using RxJS `interval`), * and at the same time subscribe to `isStable`. * * ``` * constructor(appRef: ApplicationRef) { * appRef.isStable.pipe( * filter(stable => stable) * ).subscribe(() => console.log('App is stable now'); * interval(1000).subscribe(counter => console.log(counter)); * } * ``` * In this example, `isStable` will never emit `true`, * and the trace "App is stable now" will never get logged. * * If you want to execute something when the app is stable, * you have to wait for the application to be stable * before starting your polling process. * * ``` * constructor(appRef: ApplicationRef) { * appRef.isStable.pipe( * first(stable => stable), * tap(stable => console.log('App is stable now')), * switchMap(() => interval(1000)) * ).subscribe(counter => console.log(counter)); * } * ``` * In this example, the trace "App is stable now" will be logged * and then the counter starts incrementing every second. * * Note also that this Observable runs outside of the Angular zone, * which means that the code in the subscription * to this Observable will not trigger the change detection. * * Let's imagine that instead of logging the counter value, * you update a field of your component * and display it in its template. * * ``` * constructor(appRef: ApplicationRef) { * appRef.isStable.pipe( * first(stable => stable), * switchMap(() => interval(1000)) * ).subscribe(counter => this.value = counter); * } * ``` * As the `isStable` Observable runs outside the zone, * the `value` field will be updated properly, * but the template will not be refreshed! * * You'll have to manually trigger the change detection to update the template. * * ``` * constructor(appRef: ApplicationRef, cd: ChangeDetectorRef) { * appRef.isStable.pipe( * first(stable => stable), * switchMap(() => interval(1000)) * ).subscribe(counter => { * this.value = counter; * cd.detectChanges(); * }); * } * ``` * * Or make the subscription callback run inside the zone. * * ``` * constructor(appRef: ApplicationRef, zone: NgZone) { * appRef.isStable.pipe( * first(stable => stable), * switchMap(() => interval(1000)) * ).subscribe(counter => zone.run(() => this.value = counter)); * } * ``` * * \@publicApi */ var ApplicationRef = /*#__PURE__*/function () { /** * \@internal * @param {?} _zone * @param {?} _console * @param {?} _injector * @param {?} _exceptionHandler * @param {?} _componentFactoryResolver * @param {?} _initStatus */ function ApplicationRef(_zone, _console, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus) { var _this348 = this; _classCallCheck(this, ApplicationRef); this._zone = _zone; this._console = _console; this._injector = _injector; this._exceptionHandler = _exceptionHandler; this._componentFactoryResolver = _componentFactoryResolver; this._initStatus = _initStatus; this._bootstrapListeners = []; this._views = []; this._runningTick = false; this._enforceNoNewChanges = false; this._stable = true; /** * Get a list of component types registered to this application. * This list is populated even before the component is created. */ this.componentTypes = []; /** * Get a list of components registered to this application. */ this.components = []; this._enforceNoNewChanges = isDevMode(); this._zone.onMicrotaskEmpty.subscribe({ next: /** * @return {?} */ function next() { _this348._zone.run( /** * @return {?} */ function () { _this348.tick(); }); } }); /** @type {?} */ var isCurrentlyStable = new rxjs__WEBPACK_IMPORTED_MODULE_0__["Observable"]( /** * @param {?} observer * @return {?} */ function (observer) { _this348._stable = _this348._zone.isStable && !_this348._zone.hasPendingMacrotasks && !_this348._zone.hasPendingMicrotasks; _this348._zone.runOutsideAngular( /** * @return {?} */ function () { observer.next(_this348._stable); observer.complete(); }); }); /** @type {?} */ var isStable = new rxjs__WEBPACK_IMPORTED_MODULE_0__["Observable"]( /** * @param {?} observer * @return {?} */ function (observer) { // Create the subscription to onStable outside the Angular Zone so that // the callback is run outside the Angular Zone. /** @type {?} */ var stableSub; _this348._zone.runOutsideAngular( /** * @return {?} */ function () { stableSub = _this348._zone.onStable.subscribe( /** * @return {?} */ function () { NgZone.assertNotInAngularZone(); // Check whether there are no pending macro/micro tasks in the next tick // to allow for NgZone to update the state. scheduleMicroTask( /** * @return {?} */ function () { if (!_this348._stable && !_this348._zone.hasPendingMacrotasks && !_this348._zone.hasPendingMicrotasks) { _this348._stable = true; observer.next(true); } }); }); }); /** @type {?} */ var unstableSub = _this348._zone.onUnstable.subscribe( /** * @return {?} */ function () { NgZone.assertInAngularZone(); if (_this348._stable) { _this348._stable = false; _this348._zone.runOutsideAngular( /** * @return {?} */ function () { observer.next(false); }); } }); return ( /** * @return {?} */ function () { stableSub.unsubscribe(); unstableSub.unsubscribe(); } ); }); /** @type {?} */ this.isStable = Object(rxjs__WEBPACK_IMPORTED_MODULE_0__["merge"])(isCurrentlyStable, isStable.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_1__["share"])())); } /** * Bootstrap a new component at the root level of the application. * * \@usageNotes * ### Bootstrap process * * When bootstrapping a new root component into an application, Angular mounts the * specified application component onto DOM elements identified by the componentType's * selector and kicks off automatic change detection to finish initializing the component. * * Optionally, a component can be mounted onto a DOM element that does not match the * componentType's selector. * * ### Example * {\@example core/ts/platform/platform.ts region='longform'} * @template C * @param {?} componentOrFactory * @param {?=} rootSelectorOrNode * @return {?} */ _createClass2(ApplicationRef, [{ key: "bootstrap", value: function bootstrap(componentOrFactory, rootSelectorOrNode) { var _this349 = this; if (!this._initStatus.done) { throw new Error('Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.'); } /** @type {?} */ var componentFactory; if (componentOrFactory instanceof ComponentFactory) { componentFactory = componentOrFactory; } else { componentFactory = /** @type {?} */ this._componentFactoryResolver.resolveComponentFactory(componentOrFactory); } this.componentTypes.push(componentFactory.componentType); // Create a factory associated with the current module if it's not bound to some other /** @type {?} */ var ngModule = isBoundToModule(componentFactory) ? null : this._injector.get(NgModuleRef); /** @type {?} */ var selectorOrNode = rootSelectorOrNode || componentFactory.selector; /** @type {?} */ var compRef = componentFactory.create(Injector.NULL, [], selectorOrNode, ngModule); compRef.onDestroy( /** * @return {?} */ function () { _this349._unloadComponent(compRef); }); /** @type {?} */ var testability = compRef.injector.get(Testability, null); if (testability) { compRef.injector.get(TestabilityRegistry).registerApplication(compRef.location.nativeElement, testability); } this._loadComponent(compRef); if (isDevMode()) { this._console.log("Angular is running in the development mode. Call enableProdMode() to enable the production mode."); } return compRef; } /** * Invoke this method to explicitly process change detection and its side-effects. * * In development mode, `tick()` also performs a second change detection cycle to ensure that no * further changes are detected. If additional changes are picked up during this second cycle, * bindings in the app have side-effects that cannot be resolved in a single change detection * pass. * In this case, Angular throws an error, since an Angular application can only have one change * detection pass during which all change detection must complete. * @return {?} */ }, { key: "tick", value: function tick() { var _this350 = this; if (this._runningTick) { throw new Error('ApplicationRef.tick is called recursively'); } /** @type {?} */ var scope = ApplicationRef._tickScope(); try { this._runningTick = true; var _iterator42 = _createForOfIteratorHelper(this._views), _step42; try { for (_iterator42.s(); !(_step42 = _iterator42.n()).done;) { var _view3 = _step42.value; _view3.detectChanges(); } } catch (err) { _iterator42.e(err); } finally { _iterator42.f(); } if (this._enforceNoNewChanges) { var _iterator43 = _createForOfIteratorHelper(this._views), _step43; try { for (_iterator43.s(); !(_step43 = _iterator43.n()).done;) { var view = _step43.value; view.checkNoChanges(); } } catch (err) { _iterator43.e(err); } finally { _iterator43.f(); } } } catch (e) { // Attention: Don't rethrow as it could cancel subscriptions to Observables! this._zone.runOutsideAngular( /** * @return {?} */ function () { return _this350._exceptionHandler.handleError(e); }); } finally { this._runningTick = false; wtfLeave(scope); } } /** * Attaches a view so that it will be dirty checked. * The view will be automatically detached when it is destroyed. * This will throw if the view is already attached to a ViewContainer. * @param {?} viewRef * @return {?} */ }, { key: "attachView", value: function attachView(viewRef) { /** @type {?} */ var view = /** @type {?} */ viewRef; this._views.push(view); view.attachToAppRef(this); } /** * Detaches a view from dirty checking again. * @param {?} viewRef * @return {?} */ }, { key: "detachView", value: function detachView(viewRef) { /** @type {?} */ var view = /** @type {?} */ viewRef; remove(this._views, view); view.detachFromAppRef(); } /** * @private * @param {?} componentRef * @return {?} */ }, { key: "_loadComponent", value: function _loadComponent(componentRef) { this.attachView(componentRef.hostView); this.tick(); this.components.push(componentRef); // Get the listeners lazily to prevent DI cycles. /** @type {?} */ var listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []).concat(this._bootstrapListeners); listeners.forEach( /** * @param {?} listener * @return {?} */ function (listener) { return listener(componentRef); }); } /** * @private * @param {?} componentRef * @return {?} */ }, { key: "_unloadComponent", value: function _unloadComponent(componentRef) { this.detachView(componentRef.hostView); remove(this.components, componentRef); } /** * \@internal * @return {?} */ }, { key: "ngOnDestroy", value: function ngOnDestroy() { // TODO(alxhub): Dispose of the NgZone. this._views.slice().forEach( /** * @param {?} view * @return {?} */ function (view) { return view.destroy(); }); } /** * Returns the number of attached views. * @return {?} */ }, { key: "viewCount", get: function get() { return this._views.length; } }]); return ApplicationRef; }(); /** * \@internal */ ApplicationRef._tickScope = wtfCreateScope('ApplicationRef#tick()'); ApplicationRef.decorators = [{ type: Injectable }]; /** @nocollapse */ ApplicationRef.ctorParameters = function () { return [{ type: NgZone }, { type: Console }, { type: Injector }, { type: ErrorHandler }, { type: ComponentFactoryResolver }, { type: ApplicationInitStatus }]; }; if (false) {} /** * @template T * @param {?} list * @param {?} el * @return {?} */ function remove(list, el) { /** @type {?} */ var index = list.indexOf(el); if (index > -1) { list.splice(index, 1); } } /** * @param {?} parts * @return {?} */ function _mergeArrays(parts) { /** @type {?} */ var result = []; parts.forEach( /** * @param {?} part * @return {?} */ function (part) { return part && result.push.apply(result, _toConsumableArray(part)); }); return result; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Used to load ng module factories. * * \@publicApi * @deprecated the `string` form of `loadChildren` is deprecated, and `NgModuleFactoryLoader` is * part of its implementation. See `LoadChildren` for more details. * @abstract */ var NgModuleFactoryLoader = function NgModuleFactoryLoader() { _classCallCheck(this, NgModuleFactoryLoader); }; if (false) {} /** * @param {?} id * @return {?} */ function getModuleFactory__PRE_R3__(id) { /** @type {?} */ var factory = /** @type {?} */ getRegisteredNgModuleType(id); if (!factory) throw noModuleError(id); return factory; } /** * @param {?} id * @return {?} */ function getModuleFactory__POST_R3__(id) { /** @type {?} */ var type = /** @type {?} */ getRegisteredNgModuleType(id); if (!type) throw noModuleError(id); return new NgModuleFactory$1(type); } /** * Returns the NgModuleFactory with the given id, if it exists and has been loaded. * Factories for modules that do not specify an `id` cannot be retrieved. Throws if the module * cannot be found. * \@publicApi * @type {?} */ var getModuleFactory = getModuleFactory__PRE_R3__; /** * @param {?} id * @return {?} */ function noModuleError(id) { return new Error("No module with ID ".concat(id, " loaded")); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var _SEPARATOR = '#'; /** @type {?} */ var FACTORY_CLASS_SUFFIX = 'NgFactory'; /** * Configuration for SystemJsNgModuleLoader. * token. * * \@publicApi * @deprecated the `string` form of `loadChildren` is deprecated, and `SystemJsNgModuleLoaderConfig` * is part of its implementation. See `LoadChildren` for more details. * @abstract */ var SystemJsNgModuleLoaderConfig = function SystemJsNgModuleLoaderConfig() { _classCallCheck(this, SystemJsNgModuleLoaderConfig); }; if (false) {} /** @type {?} */ var DEFAULT_CONFIG = { factoryPathPrefix: '', factoryPathSuffix: '.ngfactory' }; /** * NgModuleFactoryLoader that uses SystemJS to load NgModuleFactory * \@publicApi * @deprecated the `string` form of `loadChildren` is deprecated, and `SystemJsNgModuleLoader` is * part of its implementation. See `LoadChildren` for more details. */ var SystemJsNgModuleLoader = /*#__PURE__*/function () { /** * @param {?} _compiler * @param {?=} config */ function SystemJsNgModuleLoader(_compiler, config) { _classCallCheck(this, SystemJsNgModuleLoader); this._compiler = _compiler; this._config = config || DEFAULT_CONFIG; } /** * @param {?} path * @return {?} */ _createClass2(SystemJsNgModuleLoader, [{ key: "load", value: function load(path) { /** @type {?} */ var legacyOfflineMode = !ivyEnabled && this._compiler instanceof Compiler; return legacyOfflineMode ? this.loadFactory(path) : this.loadAndCompile(path); } /** * @private * @param {?} path * @return {?} */ }, { key: "loadAndCompile", value: function loadAndCompile(path) { var _this351 = this; var _path$split = path.split(_SEPARATOR), _path$split2 = _slicedToArray(_path$split, 2), module = _path$split2[0], exportName = _path$split2[1]; if (exportName === undefined) { exportName = 'default'; } return __webpack_require__("./src/$$_lazy_route_resource lazy recursive")(module).then( /** * @param {?} module * @return {?} */ function (module) { return module[exportName]; }).then( /** * @param {?} type * @return {?} */ function (type) { return checkNotEmpty(type, module, exportName); }).then( /** * @param {?} type * @return {?} */ function (type) { return _this351._compiler.compileModuleAsync(type); }); } /** * @private * @param {?} path * @return {?} */ }, { key: "loadFactory", value: function loadFactory(path) { var _path$split3 = path.split(_SEPARATOR), _path$split4 = _slicedToArray(_path$split3, 2), module = _path$split4[0], exportName = _path$split4[1]; /** @type {?} */ var factoryClassSuffix = FACTORY_CLASS_SUFFIX; if (exportName === undefined) { exportName = 'default'; factoryClassSuffix = ''; } return __webpack_require__("./src/$$_lazy_route_resource lazy recursive")(this._config.factoryPathPrefix + module + this._config.factoryPathSuffix).then( /** * @param {?} module * @return {?} */ function (module) { return module[exportName + factoryClassSuffix]; }).then( /** * @param {?} factory * @return {?} */ function (factory) { return checkNotEmpty(factory, module, exportName); }); } }]); return SystemJsNgModuleLoader; }(); SystemJsNgModuleLoader.decorators = [{ type: Injectable }]; /** @nocollapse */ SystemJsNgModuleLoader.ctorParameters = function () { return [{ type: Compiler }, { type: SystemJsNgModuleLoaderConfig, decorators: [{ type: Optional }] }]; }; if (false) {} /** * @param {?} value * @param {?} modulePath * @param {?} exportName * @return {?} */ function checkNotEmpty(value, modulePath, exportName) { if (!value) { throw new Error("Cannot find '".concat(exportName, "' in '").concat(modulePath, "'")); } return value; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Represents an Angular [view](guide/glossary#view), * specifically the [host view](guide/glossary#view-tree) that is defined by a component. * Also serves as the base class * that adds destroy methods for [embedded views](guide/glossary#view-tree). * * @see `EmbeddedViewRef` * * \@publicApi * @abstract */ var ViewRef$1 = /*#__PURE__*/function (_ChangeDetectorRef) { _inherits(ViewRef$1, _ChangeDetectorRef); var _super121 = _createSuper(ViewRef$1); function ViewRef$1() { _classCallCheck(this, ViewRef$1); return _super121.apply(this, arguments); } return ViewRef$1; }(ChangeDetectorRef); if (false) {} /** * Represents an Angular [view](guide/glossary#view) in a view container. * An [embedded view](guide/glossary#view-tree) can be referenced from a component * other than the hosting component whose template defines it, or it can be defined * independently by a `TemplateRef`. * * Properties of elements in a view can change, but the structure (number and order) of elements in * a view cannot. Change the structure of elements by inserting, moving, or * removing nested views in a view container. * * @see `ViewContainerRef` * * \@usageNotes * * The following template breaks down into two separate `TemplateRef` instances, * an outer one and an inner one. * * ``` * Count: {{items.length}} * <ul> * <li *ngFor="let item of items">{{item}}</li> * </ul> * ``` * * This is the outer `TemplateRef`: * * ``` * Count: {{items.length}} * <ul> * <ng-template ngFor let-item [ngForOf]="items"></ng-template> * </ul> * ``` * * This is the inner `TemplateRef`: * * ``` * <li>{{item}}</li> * ``` * * The outer and inner `TemplateRef` instances are assembled into views as follows: * * ``` * <!-- ViewRef: outer-0 --> * Count: 2 * <ul> * <ng-template view-container-ref></ng-template> * <!-- ViewRef: inner-1 --><li>first</li><!-- /ViewRef: inner-1 --> * <!-- ViewRef: inner-2 --><li>second</li><!-- /ViewRef: inner-2 --> * </ul> * <!-- /ViewRef: outer-0 --> * ``` * \@publicApi * @abstract * @template C */ var EmbeddedViewRef = /*#__PURE__*/function (_ViewRef$) { _inherits(EmbeddedViewRef, _ViewRef$); var _super122 = _createSuper(EmbeddedViewRef); function EmbeddedViewRef() { _classCallCheck(this, EmbeddedViewRef); return _super122.apply(this, arguments); } return EmbeddedViewRef; }(ViewRef$1); if (false) {} /** * @record */ function InternalViewRef() {} if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@publicApi */ var DebugEventListener = /** * @param {?} name * @param {?} callback */ function DebugEventListener(name, callback) { _classCallCheck(this, DebugEventListener); this.name = name; this.callback = callback; }; if (false) {} // WARNING: interface has both a type and a value, skipping emit var DebugNode__PRE_R3__ = /*#__PURE__*/function () { /** * @param {?} nativeNode * @param {?} parent * @param {?} _debugContext */ function DebugNode__PRE_R3__(nativeNode, parent, _debugContext) { _classCallCheck(this, DebugNode__PRE_R3__); this.listeners = []; this.parent = null; this._debugContext = _debugContext; this.nativeNode = nativeNode; if (parent && parent instanceof DebugElement__PRE_R3__) { parent.addChild(this); } } /** * @return {?} */ _createClass2(DebugNode__PRE_R3__, [{ key: "injector", get: function get() { return this._debugContext.injector; } /** * @return {?} */ }, { key: "componentInstance", get: function get() { return this._debugContext.component; } /** * @return {?} */ }, { key: "context", get: function get() { return this._debugContext.context; } /** * @return {?} */ }, { key: "references", get: function get() { return this._debugContext.references; } /** * @return {?} */ }, { key: "providerTokens", get: function get() { return this._debugContext.providerTokens; } }]); return DebugNode__PRE_R3__; }(); if (false) {} // WARNING: interface has both a type and a value, skipping emit var DebugElement__PRE_R3__ = /*#__PURE__*/function (_DebugNode__PRE_R3__) { _inherits(DebugElement__PRE_R3__, _DebugNode__PRE_R3__); var _super123 = _createSuper(DebugElement__PRE_R3__); /** * @param {?} nativeNode * @param {?} parent * @param {?} _debugContext */ function DebugElement__PRE_R3__(nativeNode, parent, _debugContext) { var _this352; _classCallCheck(this, DebugElement__PRE_R3__); _this352 = _super123.call(this, nativeNode, parent, _debugContext); _this352.properties = {}; _this352.attributes = {}; _this352.classes = {}; _this352.styles = {}; _this352.childNodes = []; _this352.nativeElement = nativeNode; return _this352; } /** * @param {?} child * @return {?} */ _createClass2(DebugElement__PRE_R3__, [{ key: "addChild", value: function addChild(child) { if (child) { this.childNodes.push(child); /** @type {?} */ child.parent = this; } } /** * @param {?} child * @return {?} */ }, { key: "removeChild", value: function removeChild(child) { /** @type {?} */ var childIndex = this.childNodes.indexOf(child); if (childIndex !== -1) { /** @type {?} */ child.parent = null; this.childNodes.splice(childIndex, 1); } } /** * @param {?} child * @param {?} newChildren * @return {?} */ }, { key: "insertChildrenAfter", value: function insertChildrenAfter(child, newChildren) { var _this353 = this; /** @type {?} */ var siblingIndex = this.childNodes.indexOf(child); if (siblingIndex !== -1) { var _this$childNodes; (_this$childNodes = this.childNodes).splice.apply(_this$childNodes, [siblingIndex + 1, 0].concat(_toConsumableArray(newChildren))); newChildren.forEach( /** * @param {?} c * @return {?} */ function (c) { if (c.parent) { /** @type {?} */ c.parent.removeChild(c); } /** @type {?} */ child.parent = _this353; }); } } /** * @param {?} refChild * @param {?} newChild * @return {?} */ }, { key: "insertBefore", value: function insertBefore(refChild, newChild) { /** @type {?} */ var refIndex = this.childNodes.indexOf(refChild); if (refIndex === -1) { this.addChild(newChild); } else { if (newChild.parent) { /** @type {?} */ newChild.parent.removeChild(newChild); } /** @type {?} */ newChild.parent = this; this.childNodes.splice(refIndex, 0, newChild); } } /** * @param {?} predicate * @return {?} */ }, { key: "query", value: function query(predicate) { /** @type {?} */ var results = this.queryAll(predicate); return results[0] || null; } /** * @param {?} predicate * @return {?} */ }, { key: "queryAll", value: function queryAll(predicate) { /** @type {?} */ var matches = []; _queryElementChildren(this, predicate, matches); return matches; } /** * @param {?} predicate * @return {?} */ }, { key: "queryAllNodes", value: function queryAllNodes(predicate) { /** @type {?} */ var matches = []; _queryNodeChildren(this, predicate, matches); return matches; } /** * @return {?} */ }, { key: "triggerEventHandler", /** * @param {?} eventName * @param {?} eventObj * @return {?} */ value: function triggerEventHandler(eventName, eventObj) { this.listeners.forEach( /** * @param {?} listener * @return {?} */ function (listener) { if (listener.name == eventName) { listener.callback(eventObj); } }); } }, { key: "children", get: function get() { return ( /** @type {?} */ this.childNodes // .filter( /** * @param {?} node * @return {?} */ function (node) { return node instanceof DebugElement__PRE_R3__; }) ); } }]); return DebugElement__PRE_R3__; }(DebugNode__PRE_R3__); if (false) {} /** * \@publicApi * @param {?} debugEls * @return {?} */ function asNativeElements(debugEls) { return debugEls.map( /** * @param {?} el * @return {?} */ function (el) { return el.nativeElement; }); } /** * @param {?} element * @param {?} predicate * @param {?} matches * @return {?} */ function _queryElementChildren(element, predicate, matches) { element.childNodes.forEach( /** * @param {?} node * @return {?} */ function (node) { if (node instanceof DebugElement__PRE_R3__) { if (predicate(node)) { matches.push(node); } _queryElementChildren(node, predicate, matches); } }); } /** * @param {?} parentNode * @param {?} predicate * @param {?} matches * @return {?} */ function _queryNodeChildren(parentNode, predicate, matches) { if (parentNode instanceof DebugElement__PRE_R3__) { parentNode.childNodes.forEach( /** * @param {?} node * @return {?} */ function (node) { if (predicate(node)) { matches.push(node); } if (node instanceof DebugElement__PRE_R3__) { _queryNodeChildren(node, predicate, matches); } }); } } var DebugNode__POST_R3__ = /*#__PURE__*/function () { /** * @param {?} nativeNode */ function DebugNode__POST_R3__(nativeNode) { _classCallCheck(this, DebugNode__POST_R3__); this.nativeNode = nativeNode; } /** * @return {?} */ _createClass2(DebugNode__POST_R3__, [{ key: "parent", get: function get() { /** @type {?} */ var parent = /** @type {?} */ this.nativeNode.parentNode; return parent ? new DebugElement__POST_R3__(parent) : null; } /** * @return {?} */ }, { key: "injector", get: function get() { return getInjector(this.nativeNode); } /** * @return {?} */ }, { key: "componentInstance", get: function get() { /** @type {?} */ var nativeElement = this.nativeNode; return nativeElement && (getComponent( /** @type {?} */ nativeElement) || getViewComponent(nativeElement)); } /** * @return {?} */ }, { key: "context", get: function get() { return getComponent( /** @type {?} */ this.nativeNode) || getContext$1( /** @type {?} */ this.nativeNode); } /** * @return {?} */ }, { key: "listeners", get: function get() { return getListeners( /** @type {?} */ this.nativeNode).filter(isBrowserEvents); } /** * @return {?} */ }, { key: "references", get: function get() { return getLocalRefs(this.nativeNode); } /** * @return {?} */ }, { key: "providerTokens", get: function get() { return getInjectionTokens( /** @type {?} */ this.nativeNode); } }]); return DebugNode__POST_R3__; }(); if (false) {} var DebugElement__POST_R3__ = /*#__PURE__*/function (_DebugNode__POST_R3__) { _inherits(DebugElement__POST_R3__, _DebugNode__POST_R3__); var _super124 = _createSuper(DebugElement__POST_R3__); /** * @param {?} nativeNode */ function DebugElement__POST_R3__(nativeNode) { _classCallCheck(this, DebugElement__POST_R3__); ngDevMode && assertDomNode(nativeNode); return _super124.call(this, nativeNode); } /** * @return {?} */ _createClass2(DebugElement__POST_R3__, [{ key: "query", /** * @param {?} predicate * @return {?} */ value: function query(predicate) { /** @type {?} */ var results = this.queryAll(predicate); return results[0] || null; } /** * @param {?} predicate * @return {?} */ }, { key: "queryAll", value: function queryAll(predicate) { /** @type {?} */ var matches = []; _queryAllR3(this, predicate, matches, true); return matches; } /** * @param {?} predicate * @return {?} */ }, { key: "queryAllNodes", value: function queryAllNodes(predicate) { /** @type {?} */ var matches = []; _queryAllR3(this, predicate, matches, false); return matches; } /** * @param {?} eventName * @param {?} eventObj * @return {?} */ }, { key: "triggerEventHandler", value: function triggerEventHandler(eventName, eventObj) { this.listeners.forEach( /** * @param {?} listener * @return {?} */ function (listener) { if (listener.name === eventName) { listener.callback(eventObj); } }); } }, { key: "nativeElement", get: function get() { return this.nativeNode.nodeType == Node.ELEMENT_NODE ? /** @type {?} */ this.nativeNode : null; } /** * @return {?} */ }, { key: "name", get: function get() { return ( /** @type {?} */ this.nativeElement.nodeName ); } /** * Gets a map of property names to property values for an element. * * This map includes: * - Regular property bindings (e.g. `[id]="id"`) * - Host property bindings (e.g. `host: { '[id]': "id" }`) * - Interpolated property bindings (e.g. `id="{{ value }}") * * It does not include: * - input property bindings (e.g. `[myCustomInput]="value"`) * - attribute bindings (e.g. `[attr.role]="menu"`) * @return {?} */ }, { key: "properties", get: function get() { /** @type {?} */ var context = /** @type {?} */ loadLContext(this.nativeNode); /** @type {?} */ var lView = context.lView; /** @type {?} */ var tData = lView[TVIEW].data; /** @type {?} */ var tNode = /** @type {?} */ tData[context.nodeIndex]; /** @type {?} */ var properties = collectPropertyBindings(tNode, lView, tData); /** @type {?} */ var hostProperties = collectHostPropertyBindings(tNode, lView, tData); /** @type {?} */ var className = collectClassNames(this); /** @type {?} */ var output = Object.assign({}, properties, hostProperties); if (className) { output['className'] = output['className'] ? output['className'] + " ".concat(className) : className; } return output; } /** * @return {?} */ }, { key: "attributes", get: function get() { /** @type {?} */ var attributes = {}; /** @type {?} */ var element = this.nativeElement; if (!element) { return attributes; } /** @type {?} */ var context = loadLContext(element); /** @type {?} */ var lView = context.lView; /** @type {?} */ var tNodeAttrs = /** @type {?} */ lView[TVIEW].data[context.nodeIndex].attrs; /** @type {?} */ var lowercaseTNodeAttrs = []; // For debug nodes we take the element's attribute directly from the DOM since it allows us // to account for ones that weren't set via bindings (e.g. ViewEngine keeps track of the ones // that are set through `Renderer2`). The problem is that the browser will lowercase all names, // however since we have the attributes already on the TNode, we can preserve the case by going // through them once, adding them to the `attributes` map and putting their lower-cased name // into an array. Afterwards when we're going through the native DOM attributes, we can check // whether we haven't run into an attribute already through the TNode. if (tNodeAttrs) { /** @type {?} */ var i = 0; while (i < tNodeAttrs.length) { /** @type {?} */ var attrName = tNodeAttrs[i]; // Stop as soon as we hit a marker. We only care about the regular attributes. Everything // else will be handled below when we read the final attributes off the DOM. if (typeof attrName !== 'string') break; /** @type {?} */ var attrValue = tNodeAttrs[i + 1]; attributes[attrName] = /** @type {?} */ attrValue; lowercaseTNodeAttrs.push(attrName.toLowerCase()); i += 2; } } /** @type {?} */ var eAttrs = element.attributes; for (var _i21 = 0; _i21 < eAttrs.length; _i21++) { /** @type {?} */ var attr = eAttrs[_i21]; // Make sure that we don't assign the same attribute both in its // case-sensitive form and the lower-cased one from the browser. if (lowercaseTNodeAttrs.indexOf(attr.name) === -1) { attributes[attr.name] = attr.value; } } return attributes; } /** * @return {?} */ }, { key: "styles", get: function get() { return _getStylingDebugInfo(this.nativeElement, false); } /** * @return {?} */ }, { key: "classes", get: function get() { return _getStylingDebugInfo(this.nativeElement, true); } /** * @return {?} */ }, { key: "childNodes", get: function get() { /** @type {?} */ var childNodes = this.nativeNode.childNodes; /** @type {?} */ var children = []; for (var i = 0; i < childNodes.length; i++) { /** @type {?} */ var element = childNodes[i]; children.push(getDebugNode__POST_R3__(element)); } return children; } /** * @return {?} */ }, { key: "children", get: function get() { /** @type {?} */ var nativeElement = this.nativeElement; if (!nativeElement) return []; /** @type {?} */ var childNodes = nativeElement.children; /** @type {?} */ var children = []; for (var i = 0; i < childNodes.length; i++) { /** @type {?} */ var element = childNodes[i]; children.push(getDebugNode__POST_R3__(element)); } return children; } }]); return DebugElement__POST_R3__; }(DebugNode__POST_R3__); /** * @param {?} element * @param {?} isClassBased * @return {?} */ function _getStylingDebugInfo(element, isClassBased) { if (element) { /** @type {?} */ var context = loadLContextFromNode(element); /** @type {?} */ var _lView11 = context.lView; /** @type {?} */ var tData = _lView11[TVIEW].data; /** @type {?} */ var tNode = /** @type {?} */ tData[context.nodeIndex]; if (isClassBased) { return isStylingContext(tNode.classes) ? new NodeStylingDebug( /** @type {?} */ tNode.classes, _lView11, true).values : stylingMapToStringMap(tNode.classes); } else { return isStylingContext(tNode.styles) ? new NodeStylingDebug( /** @type {?} */ tNode.styles, _lView11, false).values : stylingMapToStringMap(tNode.styles); } } return {}; } /** * @param {?} parentElement * @param {?} predicate * @param {?} matches * @param {?} elementsOnly * @return {?} */ function _queryAllR3(parentElement, predicate, matches, elementsOnly) { /** @type {?} */ var context = /** @type {?} */ loadLContext(parentElement.nativeNode); /** @type {?} */ var parentTNode = /** @type {?} */ context.lView[TVIEW].data[context.nodeIndex]; _queryNodeChildrenR3(parentTNode, context.lView, predicate, matches, elementsOnly, parentElement.nativeNode); } /** * Recursively match the current TNode against the predicate, and goes on with the next ones. * * @param {?} tNode the current TNode * @param {?} lView the LView of this TNode * @param {?} predicate the predicate to match * @param {?} matches the list of positive matches * @param {?} elementsOnly whether only elements should be searched * @param {?} rootNativeNode the root native node on which predicate should not be matched * @return {?} */ function _queryNodeChildrenR3(tNode, lView, predicate, matches, elementsOnly, rootNativeNode) { /** @type {?} */ var nativeNode = getNativeByTNodeOrNull(tNode, lView); // For each type of TNode, specific logic is executed. if (tNode.type === 3 /* Element */ || tNode.type === 4 /* ElementContainer */ ) { // Case 1: the TNode is an element // The native node has to be checked. _addQueryMatchR3(nativeNode, predicate, matches, elementsOnly, rootNativeNode); if (isComponent(tNode)) { // If the element is the host of a component, then all nodes in its view have to be processed. // Note: the component's content (tNode.child) will be processed from the insertion points. /** @type {?} */ var componentView = getComponentViewByIndex(tNode.index, lView); if (componentView && componentView[TVIEW].firstChild) { _queryNodeChildrenR3( /** @type {?} */ componentView[TVIEW].firstChild, componentView, predicate, matches, elementsOnly, rootNativeNode); } } else { if (tNode.child) { // Otherwise, its children have to be processed. _queryNodeChildrenR3(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode); } // We also have to query the DOM directly in order to catch elements inserted through // Renderer2. Note that this is __not__ optimal, because we're walking similar trees multiple // times. ViewEngine could do it more efficiently, because all the insertions go through // Renderer2, however that's not the case in Ivy. This approach is being used because: // 1. Matching the ViewEngine behavior would mean potentially introducing a depedency // from `Renderer2` to Ivy which could bring Ivy code into ViewEngine. // 2. We would have to make `Renderer3` "know" about debug nodes. // 3. It allows us to capture nodes that were inserted directly via the DOM. nativeNode && _queryNativeNodeDescendants(nativeNode, predicate, matches, elementsOnly); } // In all cases, if a dynamic container exists for this node, each view inside it has to be // processed. /** @type {?} */ var nodeOrContainer = lView[tNode.index]; if (isLContainer(nodeOrContainer)) { _queryNodeChildrenInContainerR3(nodeOrContainer, predicate, matches, elementsOnly, rootNativeNode); } } else if (tNode.type === 0 /* Container */ ) { // Case 2: the TNode is a container // The native node has to be checked. /** @type {?} */ var lContainer = lView[tNode.index]; _addQueryMatchR3(lContainer[NATIVE], predicate, matches, elementsOnly, rootNativeNode); // Each view inside the container has to be processed. _queryNodeChildrenInContainerR3(lContainer, predicate, matches, elementsOnly, rootNativeNode); } else if (tNode.type === 1 /* Projection */ ) { // Case 3: the TNode is a projection insertion point (i.e. a <ng-content>). // The nodes projected at this location all need to be processed. /** @type {?} */ var _componentView = findComponentView( /** @type {?} */ lView); /** @type {?} */ var componentHost = /** @type {?} */ _componentView[T_HOST]; /** @type {?} */ var head = /** @type {?} */ componentHost.projection[ /** @type {?} */ tNode.projection]; if (Array.isArray(head)) { var _iterator44 = _createForOfIteratorHelper(head), _step44; try { for (_iterator44.s(); !(_step44 = _iterator44.n()).done;) { var _nativeNode = _step44.value; _addQueryMatchR3(_nativeNode, predicate, matches, elementsOnly, rootNativeNode); } } catch (err) { _iterator44.e(err); } finally { _iterator44.f(); } } else if (head) { /** @type {?} */ var nextLView = /** @type {?} */ /** @type {?} */ _componentView[PARENT]; /** @type {?} */ var nextTNode = /** @type {?} */ nextLView[TVIEW].data[head.index]; _queryNodeChildrenR3(nextTNode, nextLView, predicate, matches, elementsOnly, rootNativeNode); } } else if (tNode.child) { // Case 4: the TNode is a view. _queryNodeChildrenR3(tNode.child, lView, predicate, matches, elementsOnly, rootNativeNode); } // We don't want to go to the next sibling of the root node. if (rootNativeNode !== nativeNode) { // To determine the next node to be processed, we need to use the next or the projectionNext // link, depending on whether the current node has been projected. /** @type {?} */ var _nextTNode = tNode.flags & 2 /* isProjected */ ? tNode.projectionNext : tNode.next; if (_nextTNode) { _queryNodeChildrenR3(_nextTNode, lView, predicate, matches, elementsOnly, rootNativeNode); } } } /** * Process all TNodes in a given container. * * @param {?} lContainer the container to be processed * @param {?} predicate the predicate to match * @param {?} matches the list of positive matches * @param {?} elementsOnly whether only elements should be searched * @param {?} rootNativeNode the root native node on which predicate should not be matched * @return {?} */ function _queryNodeChildrenInContainerR3(lContainer, predicate, matches, elementsOnly, rootNativeNode) { for (var i = CONTAINER_HEADER_OFFSET; i < lContainer.length; i++) { /** @type {?} */ var childView = lContainer[i]; _queryNodeChildrenR3( /** @type {?} */ childView[TVIEW].node, childView, predicate, matches, elementsOnly, rootNativeNode); } } /** * Match the current native node against the predicate. * * @param {?} nativeNode the current native node * @param {?} predicate the predicate to match * @param {?} matches the list of positive matches * @param {?} elementsOnly whether only elements should be searched * @param {?} rootNativeNode the root native node on which predicate should not be matched * @return {?} */ function _addQueryMatchR3(nativeNode, predicate, matches, elementsOnly, rootNativeNode) { if (rootNativeNode !== nativeNode) { /** @type {?} */ var debugNode = getDebugNode(nativeNode); if (!debugNode) { return; } // Type of the "predicate and "matches" array are set based on the value of // the "elementsOnly" parameter. TypeScript is not able to properly infer these // types with generics, so we manually cast the parameters accordingly. if (elementsOnly && debugNode instanceof DebugElement__POST_R3__ && predicate(debugNode) && matches.indexOf(debugNode) === -1) { matches.push(debugNode); } else if (!elementsOnly && /** @type {?} */ predicate(debugNode) && /** @type {?} */ matches.indexOf(debugNode) === -1) { /** @type {?} */ matches.push(debugNode); } } } /** * Match all the descendants of a DOM node against a predicate. * * @param {?} parentNode * @param {?} predicate the predicate to match * @param {?} matches the list of positive matches * @param {?} elementsOnly whether only elements should be searched * @return {?} */ function _queryNativeNodeDescendants(parentNode, predicate, matches, elementsOnly) { /** @type {?} */ var nodes = parentNode.childNodes; /** @type {?} */ var length = nodes.length; for (var i = 0; i < length; i++) { /** @type {?} */ var node = nodes[i]; /** @type {?} */ var debugNode = getDebugNode(node); if (debugNode) { if (elementsOnly && debugNode instanceof DebugElement__POST_R3__ && predicate(debugNode) && matches.indexOf(debugNode) === -1) { matches.push(debugNode); } else if (!elementsOnly && /** @type {?} */ predicate(debugNode) && /** @type {?} */ matches.indexOf(debugNode) === -1) { /** @type {?} */ matches.push(debugNode); } _queryNativeNodeDescendants(node, predicate, matches, elementsOnly); } } } /** * Iterates through the property bindings for a given node and generates * a map of property names to values. This map only contains property bindings * defined in templates, not in host bindings. * @param {?} tNode * @param {?} lView * @param {?} tData * @return {?} */ function collectPropertyBindings(tNode, lView, tData) { /** @type {?} */ var properties = {}; /** @type {?} */ var bindingIndex = getFirstBindingIndex(tNode.propertyMetadataStartIndex, tData); while (bindingIndex < tNode.propertyMetadataEndIndex) { /** @type {?} */ var value = void 0; /** @type {?} */ var propMetadata = /** @type {?} */ tData[bindingIndex]; while (!isPropMetadataString(propMetadata)) { // This is the first value for an interpolation. We need to build up // the full interpolation by combining runtime values in LView with // the static interstitial values stored in TData. value = (value || '') + renderStringify(lView[bindingIndex]) + tData[bindingIndex]; propMetadata = /** @type {?} */ tData[++bindingIndex]; } value = value === undefined ? lView[bindingIndex] : value += lView[bindingIndex]; // Property metadata string has 3 parts: property name, prefix, and suffix /** @type {?} */ var metadataParts = propMetadata.split(INTERPOLATION_DELIMITER); /** @type {?} */ var propertyName = metadataParts[0]; // Attr bindings don't have property names and should be skipped if (propertyName) { // Wrap value with prefix and suffix (will be '' for normal bindings), if they're defined. // Avoid wrapping for normal bindings so that the value doesn't get cast to a string. properties[propertyName] = metadataParts[1] && metadataParts[2] ? metadataParts[1] + value + metadataParts[2] : value; } bindingIndex++; } return properties; } /** * Retrieves the first binding index that holds values for this property * binding. * * For normal bindings (e.g. `[id]="id"`), the binding index is the * same as the metadata index. For interpolations (e.g. `id="{{id}}-{{name}}"`), * there can be multiple binding values, so we might have to loop backwards * from the metadata index until we find the first one. * * @param {?} metadataIndex The index of the first property metadata string for * this node. * @param {?} tData The data array for the current TView * @return {?} The first binding index for this binding */ function getFirstBindingIndex(metadataIndex, tData) { /** @type {?} */ var currentBindingIndex = metadataIndex - 1; // If the slot before the metadata holds a string, we know that this // metadata applies to an interpolation with at least 2 bindings, and // we need to search further to access the first binding value. /** @type {?} */ var currentValue = tData[currentBindingIndex]; // We need to iterate until we hit either a: // - TNode (it is an element slot marking the end of `consts` section), OR a // - metadata string (slot is attribute metadata or a previous node's property metadata) while (typeof currentValue === 'string' && !isPropMetadataString(currentValue)) { currentValue = tData[--currentBindingIndex]; } return currentBindingIndex + 1; } /** * @param {?} tNode * @param {?} lView * @param {?} tData * @return {?} */ function collectHostPropertyBindings(tNode, lView, tData) { /** @type {?} */ var properties = {}; // Host binding values for a node are stored after directives on that node /** @type {?} */ var hostPropIndex = tNode.directiveEnd; /** @type {?} */ var propMetadata = /** @type {?} */ tData[hostPropIndex]; // When we reach a value in TView.data that is not a string, we know we've // hit the next node's providers and directives and should stop copying data. while (typeof propMetadata === 'string') { /** @type {?} */ var propertyName = propMetadata.split(INTERPOLATION_DELIMITER)[0]; properties[propertyName] = lView[hostPropIndex]; propMetadata = tData[++hostPropIndex]; } return properties; } /** * @param {?} debugElement * @return {?} */ function collectClassNames(debugElement) { /** @type {?} */ var classes = debugElement.classes; /** @type {?} */ var output = ''; for (var _i22 = 0, _Object$keys4 = Object.keys(classes); _i22 < _Object$keys4.length; _i22++) { var className = _Object$keys4[_i22]; if (classes[className]) { output = output ? output + " ".concat(className) : className; } } return output; } // Need to keep the nodes in a global Map so that multiple angular apps are supported. /** @type {?} */ var _nativeNodeToDebugNode = new Map(); /** * @param {?} nativeNode * @return {?} */ function getDebugNode__PRE_R3__(nativeNode) { return _nativeNodeToDebugNode.get(nativeNode) || null; } /** @type {?} */ var NG_DEBUG_PROPERTY = '__ng_debug__'; /** * @param {?} nativeNode * @return {?} */ function getDebugNode__POST_R3__(nativeNode) { if (nativeNode instanceof Node) { if (!nativeNode.hasOwnProperty(NG_DEBUG_PROPERTY)) { /** @type {?} */ nativeNode[NG_DEBUG_PROPERTY] = nativeNode.nodeType == Node.ELEMENT_NODE ? new DebugElement__POST_R3__( /** @type {?} */ nativeNode) : new DebugNode__POST_R3__(nativeNode); } return ( /** @type {?} */ nativeNode[NG_DEBUG_PROPERTY] ); } return null; } /** * \@publicApi * @type {?} */ var getDebugNode = getDebugNode__PRE_R3__; /** * @return {?} */ function getAllDebugNodes() { return Array.from(_nativeNodeToDebugNode.values()); } /** * @param {?} node * @return {?} */ function indexDebugNode(node) { _nativeNodeToDebugNode.set(node.nativeNode, node); } /** * @param {?} node * @return {?} */ function removeDebugNodeFromIndex(node) { _nativeNodeToDebugNode["delete"](node.nativeNode); } /** * A boolean-valued function over a value, possibly including context information * regarding that value's position in an array. * * \@publicApi * @record * @template T */ function Predicate() {} /** * \@publicApi * @type {?} */ var DebugNode$1 = DebugNode__PRE_R3__; /** * \@publicApi * @type {?} */ var DebugElement = DebugElement__PRE_R3__; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var _CORE_PLATFORM_PROVIDERS = [// Set a default platform name for platforms that don't set it explicitly. { provide: PLATFORM_ID, useValue: 'unknown' }, { provide: PlatformRef, deps: [Injector] }, { provide: TestabilityRegistry, deps: [] }, { provide: Console, deps: [] }]; /** * This platform has to be included in any other platform * * \@publicApi * @type {?} */ var platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @return {?} */ function _iterableDiffersFactory() { return defaultIterableDiffers; } /** * @return {?} */ function _keyValueDiffersFactory() { return defaultKeyValueDiffers; } /** * @param {?=} locale * @return {?} */ function _localeFactory(locale) { if (locale) { if (ivyEnabled) { setLocaleId(locale); } return locale; } // Use `goog.LOCALE` as default value for `LOCALE_ID` token for Closure Compiler. // Note: default `goog.LOCALE` value is `en`, when Angular used `en-US`. In order to preserve // backwards compatibility, we use Angular default value over Closure Compiler's one. if (ngI18nClosureMode && typeof goog !== 'undefined' && goog.LOCALE !== 'en') { if (ivyEnabled) { setLocaleId(goog.LOCALE); } return goog.LOCALE; } return DEFAULT_LOCALE_ID; } /** * A built-in [dependency injection token](guide/glossary#di-token) * that is used to configure the root injector for bootstrapping. * @type {?} */ var APPLICATION_MODULE_PROVIDERS = [{ provide: ApplicationRef, useClass: ApplicationRef, deps: [NgZone, Console, Injector, ErrorHandler, ComponentFactoryResolver, ApplicationInitStatus] }, { provide: SCHEDULER, deps: [NgZone], useFactory: zoneSchedulerFactory }, { provide: ApplicationInitStatus, useClass: ApplicationInitStatus, deps: [[new Optional(), APP_INITIALIZER]] }, { provide: Compiler, useClass: Compiler, deps: [] }, APP_ID_RANDOM_PROVIDER, { provide: IterableDiffers, useFactory: _iterableDiffersFactory, deps: [] }, { provide: KeyValueDiffers, useFactory: _keyValueDiffersFactory, deps: [] }, { provide: LOCALE_ID$1, useFactory: _localeFactory, deps: [[new Inject(LOCALE_ID$1), new Optional(), new SkipSelf()]] }]; /** * Schedule work at next available slot. * * In Ivy this is just `requestAnimationFrame`. For compatibility reasons when bootstrapped * using `platformRef.bootstrap` we need to use `NgZone.onStable` as the scheduling mechanism. * This overrides the scheduling mechanism in Ivy to `NgZone.onStable`. * * @param {?} ngZone NgZone to use for scheduling. * @return {?} */ function zoneSchedulerFactory(ngZone) { /** @type {?} */ var queue = []; ngZone.onStable.subscribe( /** * @return {?} */ function () { while (queue.length) { /** @type {?} */ queue.pop()(); } }); return ( /** * @param {?} fn * @return {?} */ function (fn) { queue.push(fn); } ); } /** * Configures the root injector for an app with * providers of `\@angular/core` dependencies that `ApplicationRef` needs * to bootstrap components. * * Re-exported by `BrowserModule`, which is included automatically in the root * `AppModule` when you create a new app with the CLI `new` command. * * \@publicApi */ var ApplicationModule = // Inject ApplicationRef to make it eager... /** * @param {?} appRef */ function ApplicationModule(appRef) { _classCallCheck(this, ApplicationModule); }; ApplicationModule.decorators = [{ type: NgModule, args: [{ providers: APPLICATION_MODULE_PROVIDERS }] }]; /** @nocollapse */ ApplicationModule.ctorParameters = function () { return [{ type: ApplicationRef }]; }; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} flags * @param {?} matchedQueriesDsl * @param {?} ngContentIndex * @param {?} childCount * @param {?=} handleEvent * @param {?=} templateFactory * @return {?} */ function anchorDef(flags, matchedQueriesDsl, ngContentIndex, childCount, handleEvent, templateFactory) { flags |= 1 /* TypeElement */ ; var _splitMatchedQueriesD2 = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _splitMatchedQueriesD2.matchedQueries, references = _splitMatchedQueriesD2.references, matchedQueryIds = _splitMatchedQueriesD2.matchedQueryIds; /** @type {?} */ var template = templateFactory ? resolveDefinition(templateFactory) : null; return { // will bet set by the view definition nodeIndex: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values flags: flags, checkIndex: -1, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount, bindings: [], bindingFlags: 0, outputs: [], element: { ns: null, name: null, attrs: null, template: template, componentProvider: null, componentView: null, componentRendererType: null, publicProviders: null, allProviders: null, handleEvent: handleEvent || NOOP }, provider: null, text: null, query: null, ngContent: null }; } /** * @param {?} checkIndex * @param {?} flags * @param {?} matchedQueriesDsl * @param {?} ngContentIndex * @param {?} childCount * @param {?} namespaceAndName * @param {?=} fixedAttrs * @param {?=} bindings * @param {?=} outputs * @param {?=} handleEvent * @param {?=} componentView * @param {?=} componentRendererType * @return {?} */ function elementDef(checkIndex, flags, matchedQueriesDsl, ngContentIndex, childCount, namespaceAndName) { var fixedAttrs = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : []; var bindings = arguments.length > 7 ? arguments[7] : undefined; var outputs = arguments.length > 8 ? arguments[8] : undefined; var handleEvent = arguments.length > 9 ? arguments[9] : undefined; var componentView = arguments.length > 10 ? arguments[10] : undefined; var componentRendererType = arguments.length > 11 ? arguments[11] : undefined; if (!handleEvent) { handleEvent = NOOP; } var _splitMatchedQueriesD3 = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _splitMatchedQueriesD3.matchedQueries, references = _splitMatchedQueriesD3.references, matchedQueryIds = _splitMatchedQueriesD3.matchedQueryIds; /** @type {?} */ var ns = /** @type {?} */ null; /** @type {?} */ var name = /** @type {?} */ null; if (namespaceAndName) { var _splitNamespace5 = splitNamespace(namespaceAndName); var _splitNamespace6 = _slicedToArray(_splitNamespace5, 2); ns = _splitNamespace6[0]; name = _splitNamespace6[1]; } bindings = bindings || []; /** @type {?} */ var bindingDefs = new Array(bindings.length); for (var i = 0; i < bindings.length; i++) { var _bindings$i = _slicedToArray(bindings[i], 3), bindingFlags = _bindings$i[0], _namespaceAndName = _bindings$i[1], suffixOrSecurityContext = _bindings$i[2]; var _splitNamespace7 = splitNamespace(_namespaceAndName), _splitNamespace8 = _slicedToArray(_splitNamespace7, 2), _ns = _splitNamespace8[0], _name2 = _splitNamespace8[1]; /** @type {?} */ var securityContext = /** @type {?} */ undefined; /** @type {?} */ var suffix = /** @type {?} */ undefined; switch (bindingFlags & 15 /* Types */ ) { case 4 /* TypeElementStyle */ : suffix = /** @type {?} */ suffixOrSecurityContext; break; case 1 /* TypeElementAttribute */ : case 8 /* TypeProperty */ : securityContext = /** @type {?} */ suffixOrSecurityContext; break; } bindingDefs[i] = { flags: bindingFlags, ns: _ns, name: _name2, nonMinifiedName: _name2, securityContext: securityContext, suffix: suffix }; } outputs = outputs || []; /** @type {?} */ var outputDefs = new Array(outputs.length); for (var _i23 = 0; _i23 < outputs.length; _i23++) { var _outputs$_i = _slicedToArray(outputs[_i23], 2), target = _outputs$_i[0], eventName = _outputs$_i[1]; outputDefs[_i23] = { type: 0 /* ElementOutput */ , target: /** @type {?} */ target, eventName: eventName, propName: null }; } fixedAttrs = fixedAttrs || []; /** @type {?} */ var attrs = /** @type {?} */ fixedAttrs.map( /** * @param {?} __0 * @return {?} */ function (_ref64) { var _ref65 = _slicedToArray(_ref64, 2), namespaceAndName = _ref65[0], value = _ref65[1]; var _splitNamespace9 = splitNamespace(namespaceAndName), _splitNamespace10 = _slicedToArray(_splitNamespace9, 2), ns = _splitNamespace10[0], name = _splitNamespace10[1]; return [ns, name, value]; }); componentRendererType = resolveRendererType2(componentRendererType); if (componentView) { flags |= 33554432 /* ComponentView */ ; } flags |= 1 /* TypeElement */ ; return { // will bet set by the view definition nodeIndex: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values checkIndex: checkIndex, flags: flags, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount, bindings: bindingDefs, bindingFlags: calcBindingFlags(bindingDefs), outputs: outputDefs, element: { ns: ns, name: name, attrs: attrs, template: null, // will bet set by the view definition componentProvider: null, componentView: componentView || null, componentRendererType: componentRendererType, publicProviders: null, allProviders: null, handleEvent: handleEvent || NOOP }, provider: null, text: null, query: null, ngContent: null }; } /** * @param {?} view * @param {?} renderHost * @param {?} def * @return {?} */ function createElement(view, renderHost, def) { /** @type {?} */ var elDef = /** @type {?} */ def.element; /** @type {?} */ var rootSelectorOrNode = view.root.selectorOrNode; /** @type {?} */ var renderer = view.renderer; /** @type {?} */ var el; if (view.parent || !rootSelectorOrNode) { if (elDef.name) { el = renderer.createElement(elDef.name, elDef.ns); } else { el = renderer.createComment(''); } /** @type {?} */ var parentEl = getParentRenderElement(view, renderHost, def); if (parentEl) { renderer.appendChild(parentEl, el); } } else { // when using native Shadow DOM, do not clear the root element contents to allow slot projection /** @type {?} */ var preserveContent = !!elDef.componentRendererType && elDef.componentRendererType.encapsulation === ViewEncapsulation.ShadowDom; el = renderer.selectRootElement(rootSelectorOrNode, preserveContent); } if (elDef.attrs) { for (var i = 0; i < elDef.attrs.length; i++) { var _elDef$attrs$i = _slicedToArray(elDef.attrs[i], 3), ns = _elDef$attrs$i[0], name = _elDef$attrs$i[1], value = _elDef$attrs$i[2]; renderer.setAttribute(el, name, value, ns); } } return el; } /** * @param {?} view * @param {?} compView * @param {?} def * @param {?} el * @return {?} */ function listenToElementOutputs(view, compView, def, el) { for (var i = 0; i < def.outputs.length; i++) { /** @type {?} */ var output = def.outputs[i]; /** @type {?} */ var handleEventClosure = renderEventHandlerClosure(view, def.nodeIndex, elementEventFullName(output.target, output.eventName)); /** @type {?} */ var listenTarget = output.target; /** @type {?} */ var listenerView = view; if (output.target === 'component') { listenTarget = null; listenerView = compView; } /** @type {?} */ var disposable = /** @type {?} */ listenerView.renderer.listen(listenTarget || el, output.eventName, handleEventClosure); /** @type {?} */ view.disposables[def.outputIndex + i] = disposable; } } /** * @param {?} view * @param {?} index * @param {?} eventName * @return {?} */ function renderEventHandlerClosure(view, index, eventName) { return ( /** * @param {?} event * @return {?} */ function (event) { return dispatchEvent(view, index, eventName, event); } ); } /** * @param {?} view * @param {?} def * @param {?} v0 * @param {?} v1 * @param {?} v2 * @param {?} v3 * @param {?} v4 * @param {?} v5 * @param {?} v6 * @param {?} v7 * @param {?} v8 * @param {?} v9 * @return {?} */ function checkAndUpdateElementInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { /** @type {?} */ var bindLen = def.bindings.length; /** @type {?} */ var changed = false; if (bindLen > 0 && checkAndUpdateElementValue(view, def, 0, v0)) changed = true; if (bindLen > 1 && checkAndUpdateElementValue(view, def, 1, v1)) changed = true; if (bindLen > 2 && checkAndUpdateElementValue(view, def, 2, v2)) changed = true; if (bindLen > 3 && checkAndUpdateElementValue(view, def, 3, v3)) changed = true; if (bindLen > 4 && checkAndUpdateElementValue(view, def, 4, v4)) changed = true; if (bindLen > 5 && checkAndUpdateElementValue(view, def, 5, v5)) changed = true; if (bindLen > 6 && checkAndUpdateElementValue(view, def, 6, v6)) changed = true; if (bindLen > 7 && checkAndUpdateElementValue(view, def, 7, v7)) changed = true; if (bindLen > 8 && checkAndUpdateElementValue(view, def, 8, v8)) changed = true; if (bindLen > 9 && checkAndUpdateElementValue(view, def, 9, v9)) changed = true; return changed; } /** * @param {?} view * @param {?} def * @param {?} values * @return {?} */ function checkAndUpdateElementDynamic(view, def, values) { /** @type {?} */ var changed = false; for (var i = 0; i < values.length; i++) { if (checkAndUpdateElementValue(view, def, i, values[i])) changed = true; } return changed; } /** * @param {?} view * @param {?} def * @param {?} bindingIdx * @param {?} value * @return {?} */ function checkAndUpdateElementValue(view, def, bindingIdx, value) { if (!checkAndUpdateBinding(view, def, bindingIdx, value)) { return false; } /** @type {?} */ var binding = def.bindings[bindingIdx]; /** @type {?} */ var elData = asElementData(view, def.nodeIndex); /** @type {?} */ var renderNode = elData.renderElement; /** @type {?} */ var name = /** @type {?} */ binding.name; switch (binding.flags & 15 /* Types */ ) { case 1 /* TypeElementAttribute */ : setElementAttribute(view, binding, renderNode, binding.ns, name, value); break; case 2 /* TypeElementClass */ : setElementClass(view, renderNode, name, value); break; case 4 /* TypeElementStyle */ : setElementStyle(view, binding, renderNode, name, value); break; case 8 /* TypeProperty */ : /** @type {?} */ var bindView = def.flags & 33554432 /* ComponentView */ && binding.flags & 32 /* SyntheticHostProperty */ ? elData.componentView : view; setElementProperty(bindView, binding, renderNode, name, value); break; } return true; } /** * @param {?} view * @param {?} binding * @param {?} renderNode * @param {?} ns * @param {?} name * @param {?} value * @return {?} */ function setElementAttribute(view, binding, renderNode, ns, name, value) { /** @type {?} */ var securityContext = binding.securityContext; /** @type {?} */ var renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value; renderValue = renderValue != null ? renderValue.toString() : null; /** @type {?} */ var renderer = view.renderer; if (value != null) { renderer.setAttribute(renderNode, name, renderValue, ns); } else { renderer.removeAttribute(renderNode, name, ns); } } /** * @param {?} view * @param {?} renderNode * @param {?} name * @param {?} value * @return {?} */ function setElementClass(view, renderNode, name, value) { /** @type {?} */ var renderer = view.renderer; if (value) { renderer.addClass(renderNode, name); } else { renderer.removeClass(renderNode, name); } } /** * @param {?} view * @param {?} binding * @param {?} renderNode * @param {?} name * @param {?} value * @return {?} */ function setElementStyle(view, binding, renderNode, name, value) { /** @type {?} */ var renderValue = view.root.sanitizer.sanitize(SecurityContext.STYLE, /** @type {?} */ value); if (renderValue != null) { renderValue = renderValue.toString(); /** @type {?} */ var unit = binding.suffix; if (unit != null) { renderValue = renderValue + unit; } } else { renderValue = null; } /** @type {?} */ var renderer = view.renderer; if (renderValue != null) { renderer.setStyle(renderNode, name, renderValue); } else { renderer.removeStyle(renderNode, name); } } /** * @param {?} view * @param {?} binding * @param {?} renderNode * @param {?} name * @param {?} value * @return {?} */ function setElementProperty(view, binding, renderNode, name, value) { /** @type {?} */ var securityContext = binding.securityContext; /** @type {?} */ var renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value; view.renderer.setProperty(renderNode, name, renderValue); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} flags * @param {?} id * @param {?} bindings * @return {?} */ function queryDef(flags, id, bindings) { /** @type {?} */ var bindingDefs = []; for (var propName in bindings) { /** @type {?} */ var bindingType = bindings[propName]; bindingDefs.push({ propName: propName, bindingType: bindingType }); } return { // will bet set by the view definition nodeIndex: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values // TODO(vicb): check checkIndex: -1, flags: flags, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, ngContentIndex: -1, matchedQueries: {}, matchedQueryIds: 0, references: {}, childCount: 0, bindings: [], bindingFlags: 0, outputs: [], element: null, provider: null, text: null, query: { id: id, filterId: filterQueryId(id), bindings: bindingDefs }, ngContent: null }; } /** * @return {?} */ function createQuery() { return new QueryList(); } /** * @param {?} view * @return {?} */ function dirtyParentQueries(view) { /** @type {?} */ var queryIds = view.def.nodeMatchedQueries; while (view.parent && isEmbeddedView(view)) { /** @type {?} */ var tplDef = /** @type {?} */ view.parentNodeDef; view = view.parent; // content queries /** @type {?} */ var end = tplDef.nodeIndex + tplDef.childCount; for (var i = 0; i <= end; i++) { /** @type {?} */ var nodeDef = view.def.nodes[i]; if (nodeDef.flags & 67108864 /* TypeContentQuery */ && nodeDef.flags & 536870912 /* DynamicQuery */ && ( /** @type {?} */ nodeDef.query.filterId & queryIds) === /** @type {?} */ nodeDef.query.filterId) { asQueryList(view, i).setDirty(); } if (nodeDef.flags & 1 /* TypeElement */ && i + nodeDef.childCount < tplDef.nodeIndex || !(nodeDef.childFlags & 67108864 /* TypeContentQuery */ ) || !(nodeDef.childFlags & 536870912 /* DynamicQuery */ )) { // skip elements that don't contain the template element or no query. i += nodeDef.childCount; } } } // view queries if (view.def.nodeFlags & 134217728 /* TypeViewQuery */ ) { for (var _i24 = 0; _i24 < view.def.nodes.length; _i24++) { /** @type {?} */ var _nodeDef = view.def.nodes[_i24]; if (_nodeDef.flags & 134217728 /* TypeViewQuery */ && _nodeDef.flags & 536870912 /* DynamicQuery */ ) { asQueryList(view, _i24).setDirty(); } // only visit the root nodes _i24 += _nodeDef.childCount; } } } /** * @param {?} view * @param {?} nodeDef * @return {?} */ function checkAndUpdateQuery(view, nodeDef) { /** @type {?} */ var queryList = asQueryList(view, nodeDef.nodeIndex); if (!queryList.dirty) { return; } /** @type {?} */ var directiveInstance; /** @type {?} */ var newValues = /** @type {?} */ undefined; if (nodeDef.flags & 67108864 /* TypeContentQuery */ ) { /** @type {?} */ var _elementDef = /** @type {?} */ /** @type {?} */ nodeDef.parent.parent; newValues = calcQueryValues(view, _elementDef.nodeIndex, _elementDef.nodeIndex + _elementDef.childCount, /** @type {?} */ nodeDef.query, []); directiveInstance = asProviderData(view, /** @type {?} */ nodeDef.parent.nodeIndex).instance; } else if (nodeDef.flags & 134217728 /* TypeViewQuery */ ) { newValues = calcQueryValues(view, 0, view.def.nodes.length - 1, /** @type {?} */ nodeDef.query, []); directiveInstance = view.component; } queryList.reset(newValues); /** @type {?} */ var bindings = /** @type {?} */ nodeDef.query.bindings; /** @type {?} */ var notify = false; for (var i = 0; i < bindings.length; i++) { /** @type {?} */ var binding = bindings[i]; /** @type {?} */ var boundValue = void 0; switch (binding.bindingType) { case 0 /* First */ : boundValue = queryList.first; break; case 1 /* All */ : boundValue = queryList; notify = true; break; } directiveInstance[binding.propName] = boundValue; } if (notify) { queryList.notifyOnChanges(); } } /** * @param {?} view * @param {?} startIndex * @param {?} endIndex * @param {?} queryDef * @param {?} values * @return {?} */ function calcQueryValues(view, startIndex, endIndex, queryDef, values) { for (var i = startIndex; i <= endIndex; i++) { /** @type {?} */ var nodeDef = view.def.nodes[i]; /** @type {?} */ var valueType = nodeDef.matchedQueries[queryDef.id]; if (valueType != null) { values.push(getQueryValue(view, nodeDef, valueType)); } if (nodeDef.flags & 1 /* TypeElement */ && /** @type {?} */ nodeDef.element.template && ( /** @type {?} */ /** @type {?} */ nodeDef.element.template.nodeMatchedQueries & queryDef.filterId) === queryDef.filterId) { /** @type {?} */ var elementData = asElementData(view, i); // check embedded views that were attached at the place of their template, // but process child nodes first if some match the query (see issue #16568) if ((nodeDef.childMatchedQueries & queryDef.filterId) === queryDef.filterId) { calcQueryValues(view, i + 1, i + nodeDef.childCount, queryDef, values); i += nodeDef.childCount; } if (nodeDef.flags & 16777216 /* EmbeddedViews */ ) { /** @type {?} */ var embeddedViews = /** @type {?} */ elementData.viewContainer._embeddedViews; for (var k = 0; k < embeddedViews.length; k++) { /** @type {?} */ var embeddedView = embeddedViews[k]; /** @type {?} */ var dvc = declaredViewContainer(embeddedView); if (dvc && dvc === elementData) { calcQueryValues(embeddedView, 0, embeddedView.def.nodes.length - 1, queryDef, values); } } } /** @type {?} */ var projectedViews = elementData.template._projectedViews; if (projectedViews) { for (var _k = 0; _k < projectedViews.length; _k++) { /** @type {?} */ var projectedView = projectedViews[_k]; calcQueryValues(projectedView, 0, projectedView.def.nodes.length - 1, queryDef, values); } } } if ((nodeDef.childMatchedQueries & queryDef.filterId) !== queryDef.filterId) { // if no child matches the query, skip the children. i += nodeDef.childCount; } } return values; } /** * @param {?} view * @param {?} nodeDef * @param {?} queryValueType * @return {?} */ function getQueryValue(view, nodeDef, queryValueType) { if (queryValueType != null) { // a match switch (queryValueType) { case 1 /* RenderElement */ : return asElementData(view, nodeDef.nodeIndex).renderElement; case 0 /* ElementRef */ : return new ElementRef(asElementData(view, nodeDef.nodeIndex).renderElement); case 2 /* TemplateRef */ : return asElementData(view, nodeDef.nodeIndex).template; case 3 /* ViewContainerRef */ : return asElementData(view, nodeDef.nodeIndex).viewContainer; case 4 /* Provider */ : return asProviderData(view, nodeDef.nodeIndex).instance; } } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} ngContentIndex * @param {?} index * @return {?} */ function ngContentDef(ngContentIndex, index) { return { // will bet set by the view definition nodeIndex: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values checkIndex: -1, flags: 8 /* TypeNgContent */ , childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: {}, matchedQueryIds: 0, references: {}, ngContentIndex: ngContentIndex, childCount: 0, bindings: [], bindingFlags: 0, outputs: [], element: null, provider: null, text: null, query: null, ngContent: { index: index } }; } /** * @param {?} view * @param {?} renderHost * @param {?} def * @return {?} */ function appendNgContent(view, renderHost, def) { /** @type {?} */ var parentEl = getParentRenderElement(view, renderHost, def); if (!parentEl) { // Nothing to do if there is no parent element. return; } /** @type {?} */ var ngContentIndex = /** @type {?} */ def.ngContent.index; visitProjectedRenderNodes(view, ngContentIndex, 1 /* AppendChild */ , parentEl, null, undefined); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} checkIndex * @param {?} argCount * @return {?} */ function purePipeDef(checkIndex, argCount) { // argCount + 1 to include the pipe as first arg return _pureExpressionDef(128 /* TypePurePipe */ , checkIndex, new Array(argCount + 1)); } /** * @param {?} checkIndex * @param {?} argCount * @return {?} */ function pureArrayDef(checkIndex, argCount) { return _pureExpressionDef(32 /* TypePureArray */ , checkIndex, new Array(argCount)); } /** * @param {?} checkIndex * @param {?} propToIndex * @return {?} */ function pureObjectDef(checkIndex, propToIndex) { /** @type {?} */ var keys = Object.keys(propToIndex); /** @type {?} */ var nbKeys = keys.length; /** @type {?} */ var propertyNames = new Array(nbKeys); for (var i = 0; i < nbKeys; i++) { /** @type {?} */ var key = keys[i]; /** @type {?} */ var index = propToIndex[key]; propertyNames[index] = key; } return _pureExpressionDef(64 /* TypePureObject */ , checkIndex, propertyNames); } /** * @param {?} flags * @param {?} checkIndex * @param {?} propertyNames * @return {?} */ function _pureExpressionDef(flags, checkIndex, propertyNames) { /** @type {?} */ var bindings = new Array(propertyNames.length); for (var i = 0; i < propertyNames.length; i++) { /** @type {?} */ var prop = propertyNames[i]; bindings[i] = { flags: 8 /* TypeProperty */ , name: prop, ns: null, nonMinifiedName: prop, securityContext: null, suffix: null }; } return { // will bet set by the view definition nodeIndex: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values checkIndex: checkIndex, flags: flags, childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: {}, matchedQueryIds: 0, references: {}, ngContentIndex: -1, childCount: 0, bindings: bindings, bindingFlags: calcBindingFlags(bindings), outputs: [], element: null, provider: null, text: null, query: null, ngContent: null }; } /** * @param {?} view * @param {?} def * @return {?} */ function createPureExpression(view, def) { return { value: undefined }; } /** * @param {?} view * @param {?} def * @param {?} v0 * @param {?} v1 * @param {?} v2 * @param {?} v3 * @param {?} v4 * @param {?} v5 * @param {?} v6 * @param {?} v7 * @param {?} v8 * @param {?} v9 * @return {?} */ function checkAndUpdatePureExpressionInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { /** @type {?} */ var bindings = def.bindings; /** @type {?} */ var changed = false; /** @type {?} */ var bindLen = bindings.length; if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0)) changed = true; if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1)) changed = true; if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2)) changed = true; if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3)) changed = true; if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4)) changed = true; if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5)) changed = true; if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6)) changed = true; if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7)) changed = true; if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8)) changed = true; if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9)) changed = true; if (changed) { /** @type {?} */ var data = asPureExpressionData(view, def.nodeIndex); /** @type {?} */ var value; switch (def.flags & 201347067 /* Types */ ) { case 32 /* TypePureArray */ : value = new Array(bindings.length); if (bindLen > 0) value[0] = v0; if (bindLen > 1) value[1] = v1; if (bindLen > 2) value[2] = v2; if (bindLen > 3) value[3] = v3; if (bindLen > 4) value[4] = v4; if (bindLen > 5) value[5] = v5; if (bindLen > 6) value[6] = v6; if (bindLen > 7) value[7] = v7; if (bindLen > 8) value[8] = v8; if (bindLen > 9) value[9] = v9; break; case 64 /* TypePureObject */ : value = {}; if (bindLen > 0) value[ /** @type {?} */ bindings[0].name] = v0; if (bindLen > 1) value[ /** @type {?} */ bindings[1].name] = v1; if (bindLen > 2) value[ /** @type {?} */ bindings[2].name] = v2; if (bindLen > 3) value[ /** @type {?} */ bindings[3].name] = v3; if (bindLen > 4) value[ /** @type {?} */ bindings[4].name] = v4; if (bindLen > 5) value[ /** @type {?} */ bindings[5].name] = v5; if (bindLen > 6) value[ /** @type {?} */ bindings[6].name] = v6; if (bindLen > 7) value[ /** @type {?} */ bindings[7].name] = v7; if (bindLen > 8) value[ /** @type {?} */ bindings[8].name] = v8; if (bindLen > 9) value[ /** @type {?} */ bindings[9].name] = v9; break; case 128 /* TypePurePipe */ : /** @type {?} */ var pipe = v0; switch (bindLen) { case 1: value = pipe.transform(v0); break; case 2: value = pipe.transform(v1); break; case 3: value = pipe.transform(v1, v2); break; case 4: value = pipe.transform(v1, v2, v3); break; case 5: value = pipe.transform(v1, v2, v3, v4); break; case 6: value = pipe.transform(v1, v2, v3, v4, v5); break; case 7: value = pipe.transform(v1, v2, v3, v4, v5, v6); break; case 8: value = pipe.transform(v1, v2, v3, v4, v5, v6, v7); break; case 9: value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8); break; case 10: value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8, v9); break; } break; } data.value = value; } return changed; } /** * @param {?} view * @param {?} def * @param {?} values * @return {?} */ function checkAndUpdatePureExpressionDynamic(view, def, values) { /** @type {?} */ var bindings = def.bindings; /** @type {?} */ var changed = false; for (var i = 0; i < values.length; i++) { // Note: We need to loop over all values, so that // the old values are updates as well! if (checkAndUpdateBinding(view, def, i, values[i])) { changed = true; } } if (changed) { /** @type {?} */ var data = asPureExpressionData(view, def.nodeIndex); /** @type {?} */ var value; switch (def.flags & 201347067 /* Types */ ) { case 32 /* TypePureArray */ : value = values; break; case 64 /* TypePureObject */ : value = {}; for (var _i25 = 0; _i25 < values.length; _i25++) { value[ /** @type {?} */ bindings[_i25].name] = values[_i25]; } break; case 128 /* TypePurePipe */ : /** @type {?} */ var pipe = values[0]; /** @type {?} */ var params = values.slice(1); value = /** @type {?} */ pipe.transform.apply(pipe, _toConsumableArray(params)); break; } data.value = value; } return changed; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} checkIndex * @param {?} ngContentIndex * @param {?} staticText * @return {?} */ function textDef(checkIndex, ngContentIndex, staticText) { /** @type {?} */ var bindings = new Array(staticText.length - 1); for (var i = 1; i < staticText.length; i++) { bindings[i - 1] = { flags: 8 /* TypeProperty */ , name: null, ns: null, nonMinifiedName: null, securityContext: null, suffix: staticText[i] }; } return { // will bet set by the view definition nodeIndex: -1, parent: null, renderParent: null, bindingIndex: -1, outputIndex: -1, // regular values checkIndex: checkIndex, flags: 2 /* TypeText */ , childFlags: 0, directChildFlags: 0, childMatchedQueries: 0, matchedQueries: {}, matchedQueryIds: 0, references: {}, ngContentIndex: ngContentIndex, childCount: 0, bindings: bindings, bindingFlags: 8 /* TypeProperty */ , outputs: [], element: null, provider: null, text: { prefix: staticText[0] }, query: null, ngContent: null }; } /** * @param {?} view * @param {?} renderHost * @param {?} def * @return {?} */ function createText(view, renderHost, def) { /** @type {?} */ var renderNode; /** @type {?} */ var renderer = view.renderer; renderNode = renderer.createText( /** @type {?} */ def.text.prefix); /** @type {?} */ var parentEl = getParentRenderElement(view, renderHost, def); if (parentEl) { renderer.appendChild(parentEl, renderNode); } return { renderText: renderNode }; } /** * @param {?} view * @param {?} def * @param {?} v0 * @param {?} v1 * @param {?} v2 * @param {?} v3 * @param {?} v4 * @param {?} v5 * @param {?} v6 * @param {?} v7 * @param {?} v8 * @param {?} v9 * @return {?} */ function checkAndUpdateTextInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { /** @type {?} */ var changed = false; /** @type {?} */ var bindings = def.bindings; /** @type {?} */ var bindLen = bindings.length; if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0)) changed = true; if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1)) changed = true; if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2)) changed = true; if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3)) changed = true; if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4)) changed = true; if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5)) changed = true; if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6)) changed = true; if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7)) changed = true; if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8)) changed = true; if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9)) changed = true; if (changed) { /** @type {?} */ var value = /** @type {?} */ def.text.prefix; if (bindLen > 0) value += _addInterpolationPart(v0, bindings[0]); if (bindLen > 1) value += _addInterpolationPart(v1, bindings[1]); if (bindLen > 2) value += _addInterpolationPart(v2, bindings[2]); if (bindLen > 3) value += _addInterpolationPart(v3, bindings[3]); if (bindLen > 4) value += _addInterpolationPart(v4, bindings[4]); if (bindLen > 5) value += _addInterpolationPart(v5, bindings[5]); if (bindLen > 6) value += _addInterpolationPart(v6, bindings[6]); if (bindLen > 7) value += _addInterpolationPart(v7, bindings[7]); if (bindLen > 8) value += _addInterpolationPart(v8, bindings[8]); if (bindLen > 9) value += _addInterpolationPart(v9, bindings[9]); /** @type {?} */ var _renderNode = asTextData(view, def.nodeIndex).renderText; view.renderer.setValue(_renderNode, value); } return changed; } /** * @param {?} view * @param {?} def * @param {?} values * @return {?} */ function checkAndUpdateTextDynamic(view, def, values) { /** @type {?} */ var bindings = def.bindings; /** @type {?} */ var changed = false; for (var i = 0; i < values.length; i++) { // Note: We need to loop over all values, so that // the old values are updates as well! if (checkAndUpdateBinding(view, def, i, values[i])) { changed = true; } } if (changed) { /** @type {?} */ var value = ''; for (var _i26 = 0; _i26 < values.length; _i26++) { value = value + _addInterpolationPart(values[_i26], bindings[_i26]); } value = /** @type {?} */ def.text.prefix + value; /** @type {?} */ var _renderNode2 = asTextData(view, def.nodeIndex).renderText; view.renderer.setValue(_renderNode2, value); } return changed; } /** * @param {?} value * @param {?} binding * @return {?} */ function _addInterpolationPart(value, binding) { /** @type {?} */ var valueStr = value != null ? value.toString() : ''; return valueStr + binding.suffix; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} flags * @param {?} nodes * @param {?=} updateDirectives * @param {?=} updateRenderer * @return {?} */ function viewDef(flags, nodes, updateDirectives, updateRenderer) { // clone nodes and set auto calculated values /** @type {?} */ var viewBindingCount = 0; /** @type {?} */ var viewDisposableCount = 0; /** @type {?} */ var viewNodeFlags = 0; /** @type {?} */ var viewRootNodeFlags = 0; /** @type {?} */ var viewMatchedQueries = 0; /** @type {?} */ var currentParent = null; /** @type {?} */ var currentRenderParent = null; /** @type {?} */ var currentElementHasPublicProviders = false; /** @type {?} */ var currentElementHasPrivateProviders = false; /** @type {?} */ var lastRenderRootNode = null; for (var i = 0; i < nodes.length; i++) { /** @type {?} */ var node = nodes[i]; node.nodeIndex = i; node.parent = currentParent; node.bindingIndex = viewBindingCount; node.outputIndex = viewDisposableCount; node.renderParent = currentRenderParent; viewNodeFlags |= node.flags; viewMatchedQueries |= node.matchedQueryIds; if (node.element) { /** @type {?} */ var elDef = node.element; elDef.publicProviders = currentParent ? /** @type {?} */ currentParent.element.publicProviders : Object.create(null); elDef.allProviders = elDef.publicProviders; // Note: We assume that all providers of an element are before any child element! currentElementHasPublicProviders = false; currentElementHasPrivateProviders = false; if (node.element.template) { viewMatchedQueries |= node.element.template.nodeMatchedQueries; } } validateNode(currentParent, node, nodes.length); viewBindingCount += node.bindings.length; viewDisposableCount += node.outputs.length; if (!currentRenderParent && node.flags & 3 /* CatRenderNode */ ) { lastRenderRootNode = node; } if (node.flags & 20224 /* CatProvider */ ) { if (!currentElementHasPublicProviders) { currentElementHasPublicProviders = true; // Use prototypical inheritance to not get O(n^2) complexity... /** @type {?} */ /** @type {?} */ currentParent.element.publicProviders = Object.create( /** @type {?} */ /** @type {?} */ currentParent.element.publicProviders); /** @type {?} */ /** @type {?} */ currentParent.element.allProviders = /** @type {?} */ /** @type {?} */ currentParent.element.publicProviders; } /** @type {?} */ var isPrivateService = (node.flags & 8192 /* PrivateProvider */ ) !== 0; /** @type {?} */ var _isComponent3 = (node.flags & 32768 /* Component */ ) !== 0; if (!isPrivateService || _isComponent3) { /** @type {?} */ /** @type {?} */ /** @type {?} */ currentParent.element.publicProviders[tokenKey( /** @type {?} */ node.provider.token)] = node; } else { if (!currentElementHasPrivateProviders) { currentElementHasPrivateProviders = true; // Use prototypical inheritance to not get O(n^2) complexity... /** @type {?} */ /** @type {?} */ currentParent.element.allProviders = Object.create( /** @type {?} */ /** @type {?} */ currentParent.element.publicProviders); } /** @type {?} */ /** @type {?} */ /** @type {?} */ currentParent.element.allProviders[tokenKey( /** @type {?} */ node.provider.token)] = node; } if (_isComponent3) { /** @type {?} */ /** @type {?} */ currentParent.element.componentProvider = node; } } if (currentParent) { currentParent.childFlags |= node.flags; currentParent.directChildFlags |= node.flags; currentParent.childMatchedQueries |= node.matchedQueryIds; if (node.element && node.element.template) { currentParent.childMatchedQueries |= node.element.template.nodeMatchedQueries; } } else { viewRootNodeFlags |= node.flags; } if (node.childCount > 0) { currentParent = node; if (!isNgContainer(node)) { currentRenderParent = node; } } else { // When the current node has no children, check if it is the last children of its parent. // When it is, propagate the flags up. // The loop is required because an element could be the last transitive children of several // elements. We loop to either the root or the highest opened element (= with remaining // children) while (currentParent && i === currentParent.nodeIndex + currentParent.childCount) { /** @type {?} */ var newParent = currentParent.parent; if (newParent) { newParent.childFlags |= currentParent.childFlags; newParent.childMatchedQueries |= currentParent.childMatchedQueries; } currentParent = newParent; // We also need to update the render parent & account for ng-container if (currentParent && isNgContainer(currentParent)) { currentRenderParent = currentParent.renderParent; } else { currentRenderParent = currentParent; } } } } /** @type {?} */ var handleEvent = /** * @param {?} view * @param {?} nodeIndex * @param {?} eventName * @param {?} event * @return {?} */ function handleEvent(view, nodeIndex, eventName, event) { return ( /** @type {?} */ /** @type {?} */ nodes[nodeIndex].element.handleEvent(view, eventName, event) ); }; return { // Will be filled later... factory: null, nodeFlags: viewNodeFlags, rootNodeFlags: viewRootNodeFlags, nodeMatchedQueries: viewMatchedQueries, flags: flags, nodes: nodes, updateDirectives: updateDirectives || NOOP, updateRenderer: updateRenderer || NOOP, handleEvent: handleEvent, bindingCount: viewBindingCount, outputCount: viewDisposableCount, lastRenderRootNode: lastRenderRootNode }; } /** * @param {?} node * @return {?} */ function isNgContainer(node) { return (node.flags & 1 /* TypeElement */ ) !== 0 && /** @type {?} */ node.element.name === null; } /** * @param {?} parent * @param {?} node * @param {?} nodeCount * @return {?} */ function validateNode(parent, node, nodeCount) { /** @type {?} */ var template = node.element && node.element.template; if (template) { if (!template.lastRenderRootNode) { throw new Error("Illegal State: Embedded templates without nodes are not allowed!"); } if (template.lastRenderRootNode && template.lastRenderRootNode.flags & 16777216 /* EmbeddedViews */ ) { throw new Error("Illegal State: Last root node of a template can't have embedded views, at index ".concat(node.nodeIndex, "!")); } } if (node.flags & 20224 /* CatProvider */ ) { /** @type {?} */ var parentFlags = parent ? parent.flags : 0; if ((parentFlags & 1 /* TypeElement */ ) === 0) { throw new Error("Illegal State: StaticProvider/Directive nodes need to be children of elements or anchors, at index ".concat(node.nodeIndex, "!")); } } if (node.query) { if (node.flags & 67108864 /* TypeContentQuery */ && (!parent || (parent.flags & 16384 /* TypeDirective */ ) === 0)) { throw new Error("Illegal State: Content Query nodes need to be children of directives, at index ".concat(node.nodeIndex, "!")); } if (node.flags & 134217728 /* TypeViewQuery */ && parent) { throw new Error("Illegal State: View Query nodes have to be top level nodes, at index ".concat(node.nodeIndex, "!")); } } if (node.childCount) { /** @type {?} */ var parentEnd = parent ? parent.nodeIndex + parent.childCount : nodeCount - 1; if (node.nodeIndex <= parentEnd && node.nodeIndex + node.childCount > parentEnd) { throw new Error("Illegal State: childCount of node leads outside of parent, at index ".concat(node.nodeIndex, "!")); } } } /** * @param {?} parent * @param {?} anchorDef * @param {?} viewDef * @param {?=} context * @return {?} */ function createEmbeddedView(parent, anchorDef, viewDef, context) { // embedded views are seen as siblings to the anchor, so we need // to get the parent of the anchor and use it as parentIndex. /** @type {?} */ var view = createView(parent.root, parent.renderer, parent, anchorDef, viewDef); initView(view, parent.component, context); createViewNodes(view); return view; } /** * @param {?} root * @param {?} def * @param {?=} context * @return {?} */ function createRootView(root, def, context) { /** @type {?} */ var view = createView(root, root.renderer, null, null, def); initView(view, context, context); createViewNodes(view); return view; } /** * @param {?} parentView * @param {?} nodeDef * @param {?} viewDef * @param {?} hostElement * @return {?} */ function createComponentView(parentView, nodeDef, viewDef, hostElement) { /** @type {?} */ var rendererType = /** @type {?} */ nodeDef.element.componentRendererType; /** @type {?} */ var compRenderer; if (!rendererType) { compRenderer = parentView.root.renderer; } else { compRenderer = parentView.root.rendererFactory.createRenderer(hostElement, rendererType); } return createView(parentView.root, compRenderer, parentView, /** @type {?} */ nodeDef.element.componentProvider, viewDef); } /** * @param {?} root * @param {?} renderer * @param {?} parent * @param {?} parentNodeDef * @param {?} def * @return {?} */ function createView(root, renderer, parent, parentNodeDef, def) { /** @type {?} */ var nodes = new Array(def.nodes.length); /** @type {?} */ var disposables = def.outputCount ? new Array(def.outputCount) : null; /** @type {?} */ var view = { def: def, parent: parent, viewContainerParent: null, parentNodeDef: parentNodeDef, context: null, component: null, nodes: nodes, state: 13 /* CatInit */ , root: root, renderer: renderer, oldValues: new Array(def.bindingCount), disposables: disposables, initIndex: -1 }; return view; } /** * @param {?} view * @param {?} component * @param {?} context * @return {?} */ function initView(view, component, context) { view.component = component; view.context = context; } /** * @param {?} view * @return {?} */ function createViewNodes(view) { /** @type {?} */ var renderHost; if (isComponentView(view)) { /** @type {?} */ var hostDef = view.parentNodeDef; renderHost = asElementData( /** @type {?} */ view.parent, /** @type {?} */ /** @type {?} */ hostDef.parent.nodeIndex).renderElement; } /** @type {?} */ var def = view.def; /** @type {?} */ var nodes = view.nodes; for (var i = 0; i < def.nodes.length; i++) { /** @type {?} */ var nodeDef = def.nodes[i]; Services.setCurrentNode(view, i); /** @type {?} */ var nodeData = void 0; switch (nodeDef.flags & 201347067 /* Types */ ) { case 1 /* TypeElement */ : /** @type {?} */ var el = /** @type {?} */ createElement(view, renderHost, nodeDef); /** @type {?} */ var componentView = /** @type {?} */ undefined; if (nodeDef.flags & 33554432 /* ComponentView */ ) { /** @type {?} */ var compViewDef = resolveDefinition( /** @type {?} */ /** @type {?} */ nodeDef.element.componentView); componentView = Services.createComponentView(view, nodeDef, compViewDef, el); } listenToElementOutputs(view, componentView, nodeDef, el); nodeData = /** @type {?} */ { renderElement: el, componentView: componentView, viewContainer: null, template: /** @type {?} */ nodeDef.element.template ? createTemplateData(view, nodeDef) : undefined }; if (nodeDef.flags & 16777216 /* EmbeddedViews */ ) { nodeData.viewContainer = createViewContainerData(view, nodeDef, nodeData); } break; case 2 /* TypeText */ : nodeData = /** @type {?} */ createText(view, renderHost, nodeDef); break; case 512 /* TypeClassProvider */ : case 1024 /* TypeFactoryProvider */ : case 2048 /* TypeUseExistingProvider */ : case 256 /* TypeValueProvider */ : { nodeData = nodes[i]; if (!nodeData && !(nodeDef.flags & 4096 /* LazyProvider */ )) { /** @type {?} */ var instance = createProviderInstance(view, nodeDef); nodeData = /** @type {?} */ { instance: instance }; } break; } case 16 /* TypePipe */ : { /** @type {?} */ var _instance = createPipeInstance(view, nodeDef); nodeData = /** @type {?} */ { instance: _instance }; break; } case 16384 /* TypeDirective */ : { nodeData = nodes[i]; if (!nodeData) { /** @type {?} */ var _instance2 = createDirectiveInstance(view, nodeDef); nodeData = /** @type {?} */ { instance: _instance2 }; } if (nodeDef.flags & 32768 /* Component */ ) { /** @type {?} */ var compView = asElementData(view, /** @type {?} */ nodeDef.parent.nodeIndex).componentView; initView(compView, nodeData.instance, nodeData.instance); } break; } case 32 /* TypePureArray */ : case 64 /* TypePureObject */ : case 128 /* TypePurePipe */ : nodeData = /** @type {?} */ createPureExpression(view, nodeDef); break; case 67108864 /* TypeContentQuery */ : case 134217728 /* TypeViewQuery */ : nodeData = /** @type {?} */ createQuery(); break; case 8 /* TypeNgContent */ : appendNgContent(view, renderHost, nodeDef); // no runtime data needed for NgContent... nodeData = undefined; break; } nodes[i] = nodeData; } // Create the ViewData.nodes of component views after we created everything else, // so that e.g. ng-content works execComponentViewsAction(view, ViewAction.CreateViewNodes); // fill static content and view queries execQueriesAction(view, 67108864 /* TypeContentQuery */ | 134217728 /* TypeViewQuery */ , 268435456 /* StaticQuery */ , 0 /* CheckAndUpdate */ ); } /** * @param {?} view * @return {?} */ function checkNoChangesView(view) { markProjectedViewsForCheck(view); Services.updateDirectives(view, 1 /* CheckNoChanges */ ); execEmbeddedViewsAction(view, ViewAction.CheckNoChanges); Services.updateRenderer(view, 1 /* CheckNoChanges */ ); execComponentViewsAction(view, ViewAction.CheckNoChanges); // Note: We don't check queries for changes as we didn't do this in v2.x. // TODO(tbosch): investigate if we can enable the check again in v5.x with a nicer error message. view.state &= ~(64 /* CheckProjectedViews */ | 32 /* CheckProjectedView */ ); } /** * @param {?} view * @return {?} */ function checkAndUpdateView(view) { if (view.state & 1 /* BeforeFirstCheck */ ) { view.state &= ~1 /* BeforeFirstCheck */ ; view.state |= 2 /* FirstCheck */ ; } else { view.state &= ~2 /* FirstCheck */ ; } shiftInitState(view, 0 /* InitState_BeforeInit */ , 256 /* InitState_CallingOnInit */ ); markProjectedViewsForCheck(view); Services.updateDirectives(view, 0 /* CheckAndUpdate */ ); execEmbeddedViewsAction(view, ViewAction.CheckAndUpdate); execQueriesAction(view, 67108864 /* TypeContentQuery */ , 536870912 /* DynamicQuery */ , 0 /* CheckAndUpdate */ ); /** @type {?} */ var callInit = shiftInitState(view, 256 /* InitState_CallingOnInit */ , 512 /* InitState_CallingAfterContentInit */ ); callLifecycleHooksChildrenFirst(view, 2097152 /* AfterContentChecked */ | (callInit ? 1048576 /* AfterContentInit */ : 0)); Services.updateRenderer(view, 0 /* CheckAndUpdate */ ); execComponentViewsAction(view, ViewAction.CheckAndUpdate); execQueriesAction(view, 134217728 /* TypeViewQuery */ , 536870912 /* DynamicQuery */ , 0 /* CheckAndUpdate */ ); callInit = shiftInitState(view, 512 /* InitState_CallingAfterContentInit */ , 768 /* InitState_CallingAfterViewInit */ ); callLifecycleHooksChildrenFirst(view, 8388608 /* AfterViewChecked */ | (callInit ? 4194304 /* AfterViewInit */ : 0)); if (view.def.flags & 2 /* OnPush */ ) { view.state &= ~8 /* ChecksEnabled */ ; } view.state &= ~(64 /* CheckProjectedViews */ | 32 /* CheckProjectedView */ ); shiftInitState(view, 768 /* InitState_CallingAfterViewInit */ , 1024 /* InitState_AfterInit */ ); } /** * @param {?} view * @param {?} nodeDef * @param {?} argStyle * @param {?=} v0 * @param {?=} v1 * @param {?=} v2 * @param {?=} v3 * @param {?=} v4 * @param {?=} v5 * @param {?=} v6 * @param {?=} v7 * @param {?=} v8 * @param {?=} v9 * @return {?} */ function checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { if (argStyle === 0 /* Inline */ ) { return checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); } else { return checkAndUpdateNodeDynamic(view, nodeDef, v0); } } /** * @param {?} view * @return {?} */ function markProjectedViewsForCheck(view) { /** @type {?} */ var def = view.def; if (!(def.nodeFlags & 4 /* ProjectedTemplate */ )) { return; } for (var i = 0; i < def.nodes.length; i++) { /** @type {?} */ var nodeDef = def.nodes[i]; if (nodeDef.flags & 4 /* ProjectedTemplate */ ) { /** @type {?} */ var projectedViews = asElementData(view, i).template._projectedViews; if (projectedViews) { for (var _i27 = 0; _i27 < projectedViews.length; _i27++) { /** @type {?} */ var projectedView = projectedViews[_i27]; projectedView.state |= 32 /* CheckProjectedView */ ; markParentViewsForCheckProjectedViews(projectedView, view); } } } else if ((nodeDef.childFlags & 4 /* ProjectedTemplate */ ) === 0) { // a parent with leafs // no child is a component, // then skip the children i += nodeDef.childCount; } } } /** * @param {?} view * @param {?} nodeDef * @param {?=} v0 * @param {?=} v1 * @param {?=} v2 * @param {?=} v3 * @param {?=} v4 * @param {?=} v5 * @param {?=} v6 * @param {?=} v7 * @param {?=} v8 * @param {?=} v9 * @return {?} */ function checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { switch (nodeDef.flags & 201347067 /* Types */ ) { case 1 /* TypeElement */ : return checkAndUpdateElementInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); case 2 /* TypeText */ : return checkAndUpdateTextInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); case 16384 /* TypeDirective */ : return checkAndUpdateDirectiveInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); case 32 /* TypePureArray */ : case 64 /* TypePureObject */ : case 128 /* TypePurePipe */ : return checkAndUpdatePureExpressionInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); default: throw 'unreachable'; } } /** * @param {?} view * @param {?} nodeDef * @param {?} values * @return {?} */ function checkAndUpdateNodeDynamic(view, nodeDef, values) { switch (nodeDef.flags & 201347067 /* Types */ ) { case 1 /* TypeElement */ : return checkAndUpdateElementDynamic(view, nodeDef, values); case 2 /* TypeText */ : return checkAndUpdateTextDynamic(view, nodeDef, values); case 16384 /* TypeDirective */ : return checkAndUpdateDirectiveDynamic(view, nodeDef, values); case 32 /* TypePureArray */ : case 64 /* TypePureObject */ : case 128 /* TypePurePipe */ : return checkAndUpdatePureExpressionDynamic(view, nodeDef, values); default: throw 'unreachable'; } } /** * @param {?} view * @param {?} nodeDef * @param {?} argStyle * @param {?=} v0 * @param {?=} v1 * @param {?=} v2 * @param {?=} v3 * @param {?=} v4 * @param {?=} v5 * @param {?=} v6 * @param {?=} v7 * @param {?=} v8 * @param {?=} v9 * @return {?} */ function checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { if (argStyle === 0 /* Inline */ ) { checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); } else { checkNoChangesNodeDynamic(view, nodeDef, v0); } // Returning false is ok here as we would have thrown in case of a change. return false; } /** * @param {?} view * @param {?} nodeDef * @param {?} v0 * @param {?} v1 * @param {?} v2 * @param {?} v3 * @param {?} v4 * @param {?} v5 * @param {?} v6 * @param {?} v7 * @param {?} v8 * @param {?} v9 * @return {?} */ function checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { /** @type {?} */ var bindLen = nodeDef.bindings.length; if (bindLen > 0) checkBindingNoChanges(view, nodeDef, 0, v0); if (bindLen > 1) checkBindingNoChanges(view, nodeDef, 1, v1); if (bindLen > 2) checkBindingNoChanges(view, nodeDef, 2, v2); if (bindLen > 3) checkBindingNoChanges(view, nodeDef, 3, v3); if (bindLen > 4) checkBindingNoChanges(view, nodeDef, 4, v4); if (bindLen > 5) checkBindingNoChanges(view, nodeDef, 5, v5); if (bindLen > 6) checkBindingNoChanges(view, nodeDef, 6, v6); if (bindLen > 7) checkBindingNoChanges(view, nodeDef, 7, v7); if (bindLen > 8) checkBindingNoChanges(view, nodeDef, 8, v8); if (bindLen > 9) checkBindingNoChanges(view, nodeDef, 9, v9); } /** * @param {?} view * @param {?} nodeDef * @param {?} values * @return {?} */ function checkNoChangesNodeDynamic(view, nodeDef, values) { for (var i = 0; i < values.length; i++) { checkBindingNoChanges(view, nodeDef, i, values[i]); } } /** * Workaround https://github.com/angular/tsickle/issues/497 * @suppress {misplacedTypeAnnotation} * @param {?} view * @param {?} nodeDef * @return {?} */ function checkNoChangesQuery(view, nodeDef) { /** @type {?} */ var queryList = asQueryList(view, nodeDef.nodeIndex); if (queryList.dirty) { throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, nodeDef.nodeIndex), "Query ".concat( /** @type {?} */ nodeDef.query.id, " not dirty"), "Query ".concat( /** @type {?} */ nodeDef.query.id, " dirty"), (view.state & 1 /* BeforeFirstCheck */ ) !== 0); } } /** * @param {?} view * @return {?} */ function destroyView(view) { if (view.state & 128 /* Destroyed */ ) { return; } execEmbeddedViewsAction(view, ViewAction.Destroy); execComponentViewsAction(view, ViewAction.Destroy); callLifecycleHooksChildrenFirst(view, 131072 /* OnDestroy */ ); if (view.disposables) { for (var i = 0; i < view.disposables.length; i++) { view.disposables[i](); } } detachProjectedView(view); if (view.renderer.destroyNode) { destroyViewNodes(view); } if (isComponentView(view)) { view.renderer.destroy(); } view.state |= 128 /* Destroyed */ ; } /** * @param {?} view * @return {?} */ function destroyViewNodes(view) { /** @type {?} */ var len = view.def.nodes.length; for (var i = 0; i < len; i++) { /** @type {?} */ var def = view.def.nodes[i]; if (def.flags & 1 /* TypeElement */ ) { /** @type {?} */ view.renderer.destroyNode(asElementData(view, i).renderElement); } else if (def.flags & 2 /* TypeText */ ) { /** @type {?} */ view.renderer.destroyNode(asTextData(view, i).renderText); } else if (def.flags & 67108864 /* TypeContentQuery */ || def.flags & 134217728 /* TypeViewQuery */ ) { asQueryList(view, i).destroy(); } } } /** @enum {number} */ var ViewAction = { CreateViewNodes: 0, CheckNoChanges: 1, CheckNoChangesProjectedViews: 2, CheckAndUpdate: 3, CheckAndUpdateProjectedViews: 4, Destroy: 5 }; ViewAction[ViewAction.CreateViewNodes] = 'CreateViewNodes'; ViewAction[ViewAction.CheckNoChanges] = 'CheckNoChanges'; ViewAction[ViewAction.CheckNoChangesProjectedViews] = 'CheckNoChangesProjectedViews'; ViewAction[ViewAction.CheckAndUpdate] = 'CheckAndUpdate'; ViewAction[ViewAction.CheckAndUpdateProjectedViews] = 'CheckAndUpdateProjectedViews'; ViewAction[ViewAction.Destroy] = 'Destroy'; /** * @param {?} view * @param {?} action * @return {?} */ function execComponentViewsAction(view, action) { /** @type {?} */ var def = view.def; if (!(def.nodeFlags & 33554432 /* ComponentView */ )) { return; } for (var i = 0; i < def.nodes.length; i++) { /** @type {?} */ var nodeDef = def.nodes[i]; if (nodeDef.flags & 33554432 /* ComponentView */ ) { // a leaf callViewAction(asElementData(view, i).componentView, action); } else if ((nodeDef.childFlags & 33554432 /* ComponentView */ ) === 0) { // a parent with leafs // no child is a component, // then skip the children i += nodeDef.childCount; } } } /** * @param {?} view * @param {?} action * @return {?} */ function execEmbeddedViewsAction(view, action) { /** @type {?} */ var def = view.def; if (!(def.nodeFlags & 16777216 /* EmbeddedViews */ )) { return; } for (var i = 0; i < def.nodes.length; i++) { /** @type {?} */ var nodeDef = def.nodes[i]; if (nodeDef.flags & 16777216 /* EmbeddedViews */ ) { // a leaf /** @type {?} */ var embeddedViews = /** @type {?} */ asElementData(view, i).viewContainer._embeddedViews; for (var k = 0; k < embeddedViews.length; k++) { callViewAction(embeddedViews[k], action); } } else if ((nodeDef.childFlags & 16777216 /* EmbeddedViews */ ) === 0) { // a parent with leafs // no child is a component, // then skip the children i += nodeDef.childCount; } } } /** * @param {?} view * @param {?} action * @return {?} */ function callViewAction(view, action) { /** @type {?} */ var viewState = view.state; switch (action) { case ViewAction.CheckNoChanges: if ((viewState & 128 /* Destroyed */ ) === 0) { if ((viewState & 12 /* CatDetectChanges */ ) === 12 /* CatDetectChanges */ ) { checkNoChangesView(view); } else if (viewState & 64 /* CheckProjectedViews */ ) { execProjectedViewsAction(view, ViewAction.CheckNoChangesProjectedViews); } } break; case ViewAction.CheckNoChangesProjectedViews: if ((viewState & 128 /* Destroyed */ ) === 0) { if (viewState & 32 /* CheckProjectedView */ ) { checkNoChangesView(view); } else if (viewState & 64 /* CheckProjectedViews */ ) { execProjectedViewsAction(view, action); } } break; case ViewAction.CheckAndUpdate: if ((viewState & 128 /* Destroyed */ ) === 0) { if ((viewState & 12 /* CatDetectChanges */ ) === 12 /* CatDetectChanges */ ) { checkAndUpdateView(view); } else if (viewState & 64 /* CheckProjectedViews */ ) { execProjectedViewsAction(view, ViewAction.CheckAndUpdateProjectedViews); } } break; case ViewAction.CheckAndUpdateProjectedViews: if ((viewState & 128 /* Destroyed */ ) === 0) { if (viewState & 32 /* CheckProjectedView */ ) { checkAndUpdateView(view); } else if (viewState & 64 /* CheckProjectedViews */ ) { execProjectedViewsAction(view, action); } } break; case ViewAction.Destroy: // Note: destroyView recurses over all views, // so we don't need to special case projected views here. destroyView(view); break; case ViewAction.CreateViewNodes: createViewNodes(view); break; } } /** * @param {?} view * @param {?} action * @return {?} */ function execProjectedViewsAction(view, action) { execEmbeddedViewsAction(view, action); execComponentViewsAction(view, action); } /** * @param {?} view * @param {?} queryFlags * @param {?} staticDynamicQueryFlag * @param {?} checkType * @return {?} */ function execQueriesAction(view, queryFlags, staticDynamicQueryFlag, checkType) { if (!(view.def.nodeFlags & queryFlags) || !(view.def.nodeFlags & staticDynamicQueryFlag)) { return; } /** @type {?} */ var nodeCount = view.def.nodes.length; for (var i = 0; i < nodeCount; i++) { /** @type {?} */ var nodeDef = view.def.nodes[i]; if (nodeDef.flags & queryFlags && nodeDef.flags & staticDynamicQueryFlag) { Services.setCurrentNode(view, nodeDef.nodeIndex); switch (checkType) { case 0 /* CheckAndUpdate */ : checkAndUpdateQuery(view, nodeDef); break; case 1 /* CheckNoChanges */ : checkNoChangesQuery(view, nodeDef); break; } } if (!(nodeDef.childFlags & queryFlags) || !(nodeDef.childFlags & staticDynamicQueryFlag)) { // no child has a matching query // then skip the children i += nodeDef.childCount; } } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var initialized = false; /** * @return {?} */ function initServicesIfNeeded() { if (initialized) { return; } initialized = true; /** @type {?} */ var services = isDevMode() ? createDebugServices() : createProdServices(); Services.setCurrentNode = services.setCurrentNode; Services.createRootView = services.createRootView; Services.createEmbeddedView = services.createEmbeddedView; Services.createComponentView = services.createComponentView; Services.createNgModuleRef = services.createNgModuleRef; Services.overrideProvider = services.overrideProvider; Services.overrideComponentView = services.overrideComponentView; Services.clearOverrides = services.clearOverrides; Services.checkAndUpdateView = services.checkAndUpdateView; Services.checkNoChangesView = services.checkNoChangesView; Services.destroyView = services.destroyView; Services.resolveDep = resolveDep; Services.createDebugContext = services.createDebugContext; Services.handleEvent = services.handleEvent; Services.updateDirectives = services.updateDirectives; Services.updateRenderer = services.updateRenderer; Services.dirtyParentQueries = dirtyParentQueries; } /** * @return {?} */ function createProdServices() { return { setCurrentNode: /** * @return {?} */ function setCurrentNode() {}, createRootView: createProdRootView, createEmbeddedView: createEmbeddedView, createComponentView: createComponentView, createNgModuleRef: createNgModuleRef, overrideProvider: NOOP, overrideComponentView: NOOP, clearOverrides: NOOP, checkAndUpdateView: checkAndUpdateView, checkNoChangesView: checkNoChangesView, destroyView: destroyView, createDebugContext: /** * @param {?} view * @param {?} nodeIndex * @return {?} */ function createDebugContext(view, nodeIndex) { return new DebugContext_(view, nodeIndex); }, handleEvent: /** * @param {?} view * @param {?} nodeIndex * @param {?} eventName * @param {?} event * @return {?} */ function handleEvent(view, nodeIndex, eventName, event) { return view.def.handleEvent(view, nodeIndex, eventName, event); }, updateDirectives: /** * @param {?} view * @param {?} checkType * @return {?} */ function updateDirectives(view, checkType) { return view.def.updateDirectives(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode : prodCheckNoChangesNode, view); }, updateRenderer: /** * @param {?} view * @param {?} checkType * @return {?} */ function updateRenderer(view, checkType) { return view.def.updateRenderer(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode : prodCheckNoChangesNode, view); } }; } /** * @return {?} */ function createDebugServices() { return { setCurrentNode: debugSetCurrentNode, createRootView: debugCreateRootView, createEmbeddedView: debugCreateEmbeddedView, createComponentView: debugCreateComponentView, createNgModuleRef: debugCreateNgModuleRef, overrideProvider: debugOverrideProvider, overrideComponentView: debugOverrideComponentView, clearOverrides: debugClearOverrides, checkAndUpdateView: debugCheckAndUpdateView, checkNoChangesView: debugCheckNoChangesView, destroyView: debugDestroyView, createDebugContext: /** * @param {?} view * @param {?} nodeIndex * @return {?} */ function createDebugContext(view, nodeIndex) { return new DebugContext_(view, nodeIndex); }, handleEvent: debugHandleEvent, updateDirectives: debugUpdateDirectives, updateRenderer: debugUpdateRenderer }; } /** * @param {?} elInjector * @param {?} projectableNodes * @param {?} rootSelectorOrNode * @param {?} def * @param {?} ngModule * @param {?=} context * @return {?} */ function createProdRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) { /** @type {?} */ var rendererFactory = ngModule.injector.get(RendererFactory2); return createRootView(createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode), def, context); } /** * @param {?} elInjector * @param {?} projectableNodes * @param {?} rootSelectorOrNode * @param {?} def * @param {?} ngModule * @param {?=} context * @return {?} */ function debugCreateRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) { /** @type {?} */ var rendererFactory = ngModule.injector.get(RendererFactory2); /** @type {?} */ var root = createRootData(elInjector, ngModule, new DebugRendererFactory2(rendererFactory), projectableNodes, rootSelectorOrNode); /** @type {?} */ var defWithOverride = applyProviderOverridesToView(def); return callWithDebugContext(DebugAction.create, createRootView, null, [root, defWithOverride, context]); } /** * @param {?} elInjector * @param {?} ngModule * @param {?} rendererFactory * @param {?} projectableNodes * @param {?} rootSelectorOrNode * @return {?} */ function createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode) { /** @type {?} */ var sanitizer = ngModule.injector.get(Sanitizer); /** @type {?} */ var errorHandler = ngModule.injector.get(ErrorHandler); /** @type {?} */ var renderer = rendererFactory.createRenderer(null, null); return { ngModule: ngModule, injector: elInjector, projectableNodes: projectableNodes, selectorOrNode: rootSelectorOrNode, sanitizer: sanitizer, rendererFactory: rendererFactory, renderer: renderer, errorHandler: errorHandler }; } /** * @param {?} parentView * @param {?} anchorDef * @param {?} viewDef * @param {?=} context * @return {?} */ function debugCreateEmbeddedView(parentView, anchorDef, viewDef, context) { /** @type {?} */ var defWithOverride = applyProviderOverridesToView(viewDef); return callWithDebugContext(DebugAction.create, createEmbeddedView, null, [parentView, anchorDef, defWithOverride, context]); } /** * @param {?} parentView * @param {?} nodeDef * @param {?} viewDef * @param {?} hostElement * @return {?} */ function debugCreateComponentView(parentView, nodeDef, viewDef, hostElement) { /** @type {?} */ var overrideComponentView = viewDefOverrides.get( /** @type {?} */ /** @type {?} */ /** @type {?} */ nodeDef.element.componentProvider.provider.token); if (overrideComponentView) { viewDef = overrideComponentView; } else { viewDef = applyProviderOverridesToView(viewDef); } return callWithDebugContext(DebugAction.create, createComponentView, null, [parentView, nodeDef, viewDef, hostElement]); } /** * @param {?} moduleType * @param {?} parentInjector * @param {?} bootstrapComponents * @param {?} def * @return {?} */ function debugCreateNgModuleRef(moduleType, parentInjector, bootstrapComponents, def) { /** @type {?} */ var defWithOverride = applyProviderOverridesToNgModule(def); return createNgModuleRef(moduleType, parentInjector, bootstrapComponents, defWithOverride); } /** @type {?} */ var providerOverrides = new Map(); /** @type {?} */ var providerOverridesWithScope = new Map(); /** @type {?} */ var viewDefOverrides = new Map(); /** * @param {?} override * @return {?} */ function debugOverrideProvider(override) { providerOverrides.set(override.token, override); /** @type {?} */ var injectableDef; if (typeof override.token === 'function' && (injectableDef = getInjectableDef(override.token)) && typeof injectableDef.providedIn === 'function') { providerOverridesWithScope.set( /** @type {?} */ override.token, override); } } /** * @param {?} comp * @param {?} compFactory * @return {?} */ function debugOverrideComponentView(comp, compFactory) { /** @type {?} */ var hostViewDef = resolveDefinition(getComponentViewDefinitionFactory(compFactory)); /** @type {?} */ var compViewDef = resolveDefinition( /** @type {?} */ /** @type {?} */ hostViewDef.nodes[0].element.componentView); viewDefOverrides.set(comp, compViewDef); } /** * @return {?} */ function debugClearOverrides() { providerOverrides.clear(); providerOverridesWithScope.clear(); viewDefOverrides.clear(); } // Notes about the algorithm: // 1) Locate the providers of an element and check if one of them was overwritten // 2) Change the providers of that element // // We only create new datastructures if we need to, to keep perf impact // reasonable. /** * @param {?} def * @return {?} */ function applyProviderOverridesToView(def) { if (providerOverrides.size === 0) { return def; } /** @type {?} */ var elementIndicesWithOverwrittenProviders = findElementIndicesWithOverwrittenProviders(def); if (elementIndicesWithOverwrittenProviders.length === 0) { return def; } // clone the whole view definition, // as it maintains references between the nodes that are hard to update. def = /** @type {?} */ def.factory( /** * @return {?} */ function () { return NOOP; }); for (var i = 0; i < elementIndicesWithOverwrittenProviders.length; i++) { applyProviderOverridesToElement(def, elementIndicesWithOverwrittenProviders[i]); } return def; /** * @param {?} def * @return {?} */ function findElementIndicesWithOverwrittenProviders(def) { /** @type {?} */ var elIndicesWithOverwrittenProviders = []; /** @type {?} */ var lastElementDef = null; for (var _i28 = 0; _i28 < def.nodes.length; _i28++) { /** @type {?} */ var nodeDef = def.nodes[_i28]; if (nodeDef.flags & 1 /* TypeElement */ ) { lastElementDef = nodeDef; } if (lastElementDef && nodeDef.flags & 3840 /* CatProviderNoDirective */ && providerOverrides.has( /** @type {?} */ nodeDef.provider.token)) { elIndicesWithOverwrittenProviders.push( /** @type {?} */ lastElementDef.nodeIndex); lastElementDef = null; } } return elIndicesWithOverwrittenProviders; } /** * @param {?} viewDef * @param {?} elIndex * @return {?} */ function applyProviderOverridesToElement(viewDef, elIndex) { for (var _i29 = elIndex + 1; _i29 < viewDef.nodes.length; _i29++) { /** @type {?} */ var nodeDef = viewDef.nodes[_i29]; if (nodeDef.flags & 1 /* TypeElement */ ) { // stop at the next element return; } if (nodeDef.flags & 3840 /* CatProviderNoDirective */ ) { /** @type {?} */ var provider = /** @type {?} */ nodeDef.provider; /** @type {?} */ var override = providerOverrides.get(provider.token); if (override) { nodeDef.flags = nodeDef.flags & ~3840 /* CatProviderNoDirective */ | override.flags; provider.deps = splitDepsDsl(override.deps); provider.value = override.value; } } } } } // Notes about the algorithm: // We only create new datastructures if we need to, to keep perf impact // reasonable. /** * @param {?} def * @return {?} */ function applyProviderOverridesToNgModule(def) { var _calcHasOverrides = calcHasOverrides(def), hasOverrides = _calcHasOverrides.hasOverrides, hasDeprecatedOverrides = _calcHasOverrides.hasDeprecatedOverrides; if (!hasOverrides) { return def; } // clone the whole view definition, // as it maintains references between the nodes that are hard to update. def = /** @type {?} */ def.factory( /** * @return {?} */ function () { return NOOP; }); applyProviderOverrides(def); return def; /** * @param {?} def * @return {?} */ function calcHasOverrides(def) { /** @type {?} */ var hasOverrides = false; /** @type {?} */ var hasDeprecatedOverrides = false; if (providerOverrides.size === 0) { return { hasOverrides: hasOverrides, hasDeprecatedOverrides: hasDeprecatedOverrides }; } def.providers.forEach( /** * @param {?} node * @return {?} */ function (node) { /** @type {?} */ var override = providerOverrides.get(node.token); if (node.flags & 3840 /* CatProviderNoDirective */ && override) { hasOverrides = true; hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior; } }); def.modules.forEach( /** * @param {?} module * @return {?} */ function (module) { providerOverridesWithScope.forEach( /** * @param {?} override * @param {?} token * @return {?} */ function (override, token) { if ( /** @type {?} */ getInjectableDef(token).providedIn === module) { hasOverrides = true; hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior; } }); }); return { hasOverrides: hasOverrides, hasDeprecatedOverrides: hasDeprecatedOverrides }; } /** * @param {?} def * @return {?} */ function applyProviderOverrides(def) { for (var i = 0; i < def.providers.length; i++) { /** @type {?} */ var provider = def.providers[i]; if (hasDeprecatedOverrides) { // We had a bug where me made // all providers lazy. Keep this logic behind a flag // for migrating existing users. provider.flags |= 4096 /* LazyProvider */ ; } /** @type {?} */ var override = providerOverrides.get(provider.token); if (override) { provider.flags = provider.flags & ~3840 /* CatProviderNoDirective */ | override.flags; provider.deps = splitDepsDsl(override.deps); provider.value = override.value; } } if (providerOverridesWithScope.size > 0) { /** @type {?} */ var moduleSet = new Set(def.modules); providerOverridesWithScope.forEach( /** * @param {?} override * @param {?} token * @return {?} */ function (override, token) { if (moduleSet.has( /** @type {?} */ getInjectableDef(token).providedIn)) { /** @type {?} */ var _provider = { token: token, flags: override.flags | (hasDeprecatedOverrides ? 4096 /* LazyProvider */ : 0 /* None */ ), deps: splitDepsDsl(override.deps), value: override.value, index: def.providers.length }; def.providers.push(_provider); def.providersByKey[tokenKey(token)] = _provider; } }); } } } /** * @param {?} view * @param {?} checkIndex * @param {?} argStyle * @param {?=} v0 * @param {?=} v1 * @param {?=} v2 * @param {?=} v3 * @param {?=} v4 * @param {?=} v5 * @param {?=} v6 * @param {?=} v7 * @param {?=} v8 * @param {?=} v9 * @return {?} */ function prodCheckAndUpdateNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { /** @type {?} */ var nodeDef = view.def.nodes[checkIndex]; checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); return nodeDef.flags & 224 /* CatPureExpression */ ? asPureExpressionData(view, checkIndex).value : undefined; } /** * @param {?} view * @param {?} checkIndex * @param {?} argStyle * @param {?=} v0 * @param {?=} v1 * @param {?=} v2 * @param {?=} v3 * @param {?=} v4 * @param {?=} v5 * @param {?=} v6 * @param {?=} v7 * @param {?=} v8 * @param {?=} v9 * @return {?} */ function prodCheckNoChangesNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { /** @type {?} */ var nodeDef = view.def.nodes[checkIndex]; checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); return nodeDef.flags & 224 /* CatPureExpression */ ? asPureExpressionData(view, checkIndex).value : undefined; } /** * @param {?} view * @return {?} */ function debugCheckAndUpdateView(view) { return callWithDebugContext(DebugAction.detectChanges, checkAndUpdateView, null, [view]); } /** * @param {?} view * @return {?} */ function debugCheckNoChangesView(view) { return callWithDebugContext(DebugAction.checkNoChanges, checkNoChangesView, null, [view]); } /** * @param {?} view * @return {?} */ function debugDestroyView(view) { return callWithDebugContext(DebugAction.destroy, destroyView, null, [view]); } /** @enum {number} */ var DebugAction = { create: 0, detectChanges: 1, checkNoChanges: 2, destroy: 3, handleEvent: 4 }; DebugAction[DebugAction.create] = 'create'; DebugAction[DebugAction.detectChanges] = 'detectChanges'; DebugAction[DebugAction.checkNoChanges] = 'checkNoChanges'; DebugAction[DebugAction.destroy] = 'destroy'; DebugAction[DebugAction.handleEvent] = 'handleEvent'; /** @type {?} */ var _currentAction; /** @type {?} */ var _currentView; /** @type {?} */ var _currentNodeIndex; /** * @param {?} view * @param {?} nodeIndex * @return {?} */ function debugSetCurrentNode(view, nodeIndex) { _currentView = view; _currentNodeIndex = nodeIndex; } /** * @param {?} view * @param {?} nodeIndex * @param {?} eventName * @param {?} event * @return {?} */ function debugHandleEvent(view, nodeIndex, eventName, event) { debugSetCurrentNode(view, nodeIndex); return callWithDebugContext(DebugAction.handleEvent, view.def.handleEvent, null, [view, nodeIndex, eventName, event]); } /** * @param {?} view * @param {?} checkType * @return {?} */ function debugUpdateDirectives(view, checkType) { if (view.state & 128 /* Destroyed */ ) { throw viewDestroyedError(DebugAction[_currentAction]); } debugSetCurrentNode(view, nextDirectiveWithBinding(view, 0)); return view.def.updateDirectives(debugCheckDirectivesFn, view); /** * @param {?} view * @param {?} nodeIndex * @param {?} argStyle * @param {...?} values * @return {?} */ function debugCheckDirectivesFn(view, nodeIndex, argStyle) { /** @type {?} */ var nodeDef = view.def.nodes[nodeIndex]; for (var _len16 = arguments.length, values = new Array(_len16 > 3 ? _len16 - 3 : 0), _key17 = 3; _key17 < _len16; _key17++) { values[_key17 - 3] = arguments[_key17]; } if (checkType === 0 /* CheckAndUpdate */ ) { debugCheckAndUpdateNode(view, nodeDef, argStyle, values); } else { debugCheckNoChangesNode(view, nodeDef, argStyle, values); } if (nodeDef.flags & 16384 /* TypeDirective */ ) { debugSetCurrentNode(view, nextDirectiveWithBinding(view, nodeIndex)); } return nodeDef.flags & 224 /* CatPureExpression */ ? asPureExpressionData(view, nodeDef.nodeIndex).value : undefined; } } /** * @param {?} view * @param {?} checkType * @return {?} */ function debugUpdateRenderer(view, checkType) { if (view.state & 128 /* Destroyed */ ) { throw viewDestroyedError(DebugAction[_currentAction]); } debugSetCurrentNode(view, nextRenderNodeWithBinding(view, 0)); return view.def.updateRenderer(debugCheckRenderNodeFn, view); /** * @param {?} view * @param {?} nodeIndex * @param {?} argStyle * @param {...?} values * @return {?} */ function debugCheckRenderNodeFn(view, nodeIndex, argStyle) { /** @type {?} */ var nodeDef = view.def.nodes[nodeIndex]; for (var _len17 = arguments.length, values = new Array(_len17 > 3 ? _len17 - 3 : 0), _key18 = 3; _key18 < _len17; _key18++) { values[_key18 - 3] = arguments[_key18]; } if (checkType === 0 /* CheckAndUpdate */ ) { debugCheckAndUpdateNode(view, nodeDef, argStyle, values); } else { debugCheckNoChangesNode(view, nodeDef, argStyle, values); } if (nodeDef.flags & 3 /* CatRenderNode */ ) { debugSetCurrentNode(view, nextRenderNodeWithBinding(view, nodeIndex)); } return nodeDef.flags & 224 /* CatPureExpression */ ? asPureExpressionData(view, nodeDef.nodeIndex).value : undefined; } } /** * @param {?} view * @param {?} nodeDef * @param {?} argStyle * @param {?} givenValues * @return {?} */ function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) { /** @type {?} */ var changed = /** @type {?} */ checkAndUpdateNode.apply(void 0, [view, nodeDef, argStyle].concat(_toConsumableArray(givenValues))); if (changed) { /** @type {?} */ var values = argStyle === 1 /* Dynamic */ ? givenValues[0] : givenValues; if (nodeDef.flags & 16384 /* TypeDirective */ ) { /** @type {?} */ var bindingValues = {}; for (var i = 0; i < nodeDef.bindings.length; i++) { /** @type {?} */ var binding = nodeDef.bindings[i]; /** @type {?} */ var value = values[i]; if (binding.flags & 8 /* TypeProperty */ ) { bindingValues[normalizeDebugBindingName( /** @type {?} */ binding.nonMinifiedName)] = normalizeDebugBindingValue(value); } } /** @type {?} */ var elDef = /** @type {?} */ nodeDef.parent; /** @type {?} */ var el = asElementData(view, elDef.nodeIndex).renderElement; if (! /** @type {?} */ elDef.element.name) { // a comment. view.renderer.setValue(el, "bindings=".concat(JSON.stringify(bindingValues, null, 2))); } else { // a regular element. for (var attr in bindingValues) { /** @type {?} */ var _value11 = bindingValues[attr]; if (_value11 != null) { view.renderer.setAttribute(el, attr, _value11); } else { view.renderer.removeAttribute(el, attr); } } } } } } /** * @param {?} view * @param {?} nodeDef * @param {?} argStyle * @param {?} values * @return {?} */ function debugCheckNoChangesNode(view, nodeDef, argStyle, values) { /** @type {?} */ checkNoChangesNode.apply(void 0, [view, nodeDef, argStyle].concat(_toConsumableArray(values))); } /** * @param {?} view * @param {?} nodeIndex * @return {?} */ function nextDirectiveWithBinding(view, nodeIndex) { for (var i = nodeIndex; i < view.def.nodes.length; i++) { /** @type {?} */ var nodeDef = view.def.nodes[i]; if (nodeDef.flags & 16384 /* TypeDirective */ && nodeDef.bindings && nodeDef.bindings.length) { return i; } } return null; } /** * @param {?} view * @param {?} nodeIndex * @return {?} */ function nextRenderNodeWithBinding(view, nodeIndex) { for (var i = nodeIndex; i < view.def.nodes.length; i++) { /** @type {?} */ var nodeDef = view.def.nodes[i]; if (nodeDef.flags & 3 /* CatRenderNode */ && nodeDef.bindings && nodeDef.bindings.length) { return i; } } return null; } var DebugContext_ = /*#__PURE__*/function () { /** * @param {?} view * @param {?} nodeIndex */ function DebugContext_(view, nodeIndex) { _classCallCheck(this, DebugContext_); this.view = view; this.nodeIndex = nodeIndex; if (nodeIndex == null) { this.nodeIndex = nodeIndex = 0; } this.nodeDef = view.def.nodes[nodeIndex]; /** @type {?} */ var elDef = this.nodeDef; /** @type {?} */ var elView = view; while (elDef && (elDef.flags & 1 /* TypeElement */ ) === 0) { elDef = /** @type {?} */ elDef.parent; } if (!elDef) { while (!elDef && elView) { elDef = /** @type {?} */ viewParentEl(elView); elView = /** @type {?} */ elView.parent; } } this.elDef = elDef; this.elView = elView; } /** * @private * @return {?} */ _createClass2(DebugContext_, [{ key: "logError", /** * @param {?} console * @param {...?} values * @return {?} */ value: function logError(console) { for (var _len18 = arguments.length, values = new Array(_len18 > 1 ? _len18 - 1 : 0), _key19 = 1; _key19 < _len18; _key19++) { values[_key19 - 1] = arguments[_key19]; } /** @type {?} */ var logViewDef; /** @type {?} */ var logNodeIndex; if (this.nodeDef.flags & 2 /* TypeText */ ) { logViewDef = this.view.def; logNodeIndex = this.nodeDef.nodeIndex; } else { logViewDef = this.elView.def; logNodeIndex = this.elDef.nodeIndex; } // Note: we only generate a log function for text and element nodes // to make the generated code as small as possible. /** @type {?} */ var renderNodeIndex = getRenderNodeIndex(logViewDef, logNodeIndex); /** @type {?} */ var currRenderNodeIndex = -1; /** @type {?} */ var nodeLogger = /** * @return {?} */ function nodeLogger() { currRenderNodeIndex++; if (currRenderNodeIndex === renderNodeIndex) { var _console$error; return (_console$error = console.error).bind.apply(_console$error, [console].concat(values)); } else { return NOOP; } }; /** @type {?} */ logViewDef.factory(nodeLogger); if (currRenderNodeIndex < renderNodeIndex) { console.error('Illegal state: the ViewDefinitionFactory did not call the logger!'); /** @type {?} */ console.error.apply(console, values); } } }, { key: "elOrCompView", get: function get() { // Has to be done lazily as we use the DebugContext also during creation of elements... return asElementData(this.elView, this.elDef.nodeIndex).componentView || this.view; } /** * @return {?} */ }, { key: "injector", get: function get() { return createInjector$1(this.elView, this.elDef); } /** * @return {?} */ }, { key: "component", get: function get() { return this.elOrCompView.component; } /** * @return {?} */ }, { key: "context", get: function get() { return this.elOrCompView.context; } /** * @return {?} */ }, { key: "providerTokens", get: function get() { /** @type {?} */ var tokens = []; if (this.elDef) { for (var i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) { /** @type {?} */ var childDef = this.elView.def.nodes[i]; if (childDef.flags & 20224 /* CatProvider */ ) { tokens.push( /** @type {?} */ childDef.provider.token); } i += childDef.childCount; } } return tokens; } /** * @return {?} */ }, { key: "references", get: function get() { /** @type {?} */ var references = {}; if (this.elDef) { collectReferences(this.elView, this.elDef, references); for (var i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) { /** @type {?} */ var childDef = this.elView.def.nodes[i]; if (childDef.flags & 20224 /* CatProvider */ ) { collectReferences(this.elView, childDef, references); } i += childDef.childCount; } } return references; } /** * @return {?} */ }, { key: "componentRenderElement", get: function get() { /** @type {?} */ var elData = findHostElement(this.elOrCompView); return elData ? elData.renderElement : undefined; } /** * @return {?} */ }, { key: "renderNode", get: function get() { return this.nodeDef.flags & 2 /* TypeText */ ? renderNode(this.view, this.nodeDef) : renderNode(this.elView, this.elDef); } }]); return DebugContext_; }(); if (false) {} /** * @param {?} viewDef * @param {?} nodeIndex * @return {?} */ function getRenderNodeIndex(viewDef, nodeIndex) { /** @type {?} */ var renderNodeIndex = -1; for (var i = 0; i <= nodeIndex; i++) { /** @type {?} */ var nodeDef = viewDef.nodes[i]; if (nodeDef.flags & 3 /* CatRenderNode */ ) { renderNodeIndex++; } } return renderNodeIndex; } /** * @param {?} view * @return {?} */ function findHostElement(view) { while (view && !isComponentView(view)) { view = /** @type {?} */ view.parent; } if (view.parent) { return asElementData(view.parent, /** @type {?} */ viewParentEl(view).nodeIndex); } return null; } /** * @param {?} view * @param {?} nodeDef * @param {?} references * @return {?} */ function collectReferences(view, nodeDef, references) { for (var refName in nodeDef.references) { references[refName] = getQueryValue(view, nodeDef, nodeDef.references[refName]); } } /** * @param {?} action * @param {?} fn * @param {?} self * @param {?} args * @return {?} */ function callWithDebugContext(action, fn, self, args) { /** @type {?} */ var oldAction = _currentAction; /** @type {?} */ var oldView = _currentView; /** @type {?} */ var oldNodeIndex = _currentNodeIndex; try { _currentAction = action; /** @type {?} */ var result = fn.apply(self, args); _currentView = oldView; _currentNodeIndex = oldNodeIndex; _currentAction = oldAction; return result; } catch (e) { if (isViewDebugError(e) || !_currentView) { throw e; } throw viewWrappedDebugError(e, /** @type {?} */ getCurrentDebugContext()); } } /** * @return {?} */ function getCurrentDebugContext() { return _currentView ? new DebugContext_(_currentView, _currentNodeIndex) : null; } var DebugRendererFactory2 = /*#__PURE__*/function () { /** * @param {?} delegate */ function DebugRendererFactory2(delegate) { _classCallCheck(this, DebugRendererFactory2); this.delegate = delegate; } /** * @param {?} element * @param {?} renderData * @return {?} */ _createClass2(DebugRendererFactory2, [{ key: "createRenderer", value: function createRenderer(element, renderData) { return new DebugRenderer2(this.delegate.createRenderer(element, renderData)); } /** * @return {?} */ }, { key: "begin", value: function begin() { if (this.delegate.begin) { this.delegate.begin(); } } /** * @return {?} */ }, { key: "end", value: function end() { if (this.delegate.end) { this.delegate.end(); } } /** * @return {?} */ }, { key: "whenRenderingDone", value: function whenRenderingDone() { if (this.delegate.whenRenderingDone) { return this.delegate.whenRenderingDone(); } return Promise.resolve(null); } }]); return DebugRendererFactory2; }(); if (false) {} var DebugRenderer2 = /*#__PURE__*/function () { /** * @param {?} delegate */ function DebugRenderer2(delegate) { _classCallCheck(this, DebugRenderer2); this.delegate = delegate; /** * Factory function used to create a `DebugContext` when a node is created. * * The `DebugContext` allows to retrieve information about the nodes that are useful in tests. * * The factory is configurable so that the `DebugRenderer2` could instantiate either a View Engine * or a Render context. */ this.debugContextFactory = getCurrentDebugContext; this.data = this.delegate.data; } /** * @private * @param {?} nativeElement * @return {?} */ _createClass2(DebugRenderer2, [{ key: "createDebugContext", value: function createDebugContext(nativeElement) { return this.debugContextFactory(nativeElement); } /** * @param {?} node * @return {?} */ }, { key: "destroyNode", value: function destroyNode(node) { /** @type {?} */ var debugNode = /** @type {?} */ getDebugNode(node); removeDebugNodeFromIndex(debugNode); if (debugNode instanceof DebugNode__PRE_R3__) { debugNode.listeners.length = 0; } if (this.delegate.destroyNode) { this.delegate.destroyNode(node); } } /** * @return {?} */ }, { key: "destroy", value: function destroy() { this.delegate.destroy(); } /** * @param {?} name * @param {?=} namespace * @return {?} */ }, { key: "createElement", value: function createElement(name, namespace) { /** @type {?} */ var el = this.delegate.createElement(name, namespace); /** @type {?} */ var debugCtx = this.createDebugContext(el); if (debugCtx) { /** @type {?} */ var debugEl = new DebugElement__PRE_R3__(el, null, debugCtx); /** @type {?} */ debugEl.name = name; indexDebugNode(debugEl); } return el; } /** * @param {?} value * @return {?} */ }, { key: "createComment", value: function createComment(value) { /** @type {?} */ var comment = this.delegate.createComment(value); /** @type {?} */ var debugCtx = this.createDebugContext(comment); if (debugCtx) { indexDebugNode(new DebugNode__PRE_R3__(comment, null, debugCtx)); } return comment; } /** * @param {?} value * @return {?} */ }, { key: "createText", value: function createText(value) { /** @type {?} */ var text = this.delegate.createText(value); /** @type {?} */ var debugCtx = this.createDebugContext(text); if (debugCtx) { indexDebugNode(new DebugNode__PRE_R3__(text, null, debugCtx)); } return text; } /** * @param {?} parent * @param {?} newChild * @return {?} */ }, { key: "appendChild", value: function appendChild(parent, newChild) { /** @type {?} */ var debugEl = getDebugNode(parent); /** @type {?} */ var debugChildEl = getDebugNode(newChild); if (debugEl && debugChildEl && debugEl instanceof DebugElement__PRE_R3__) { debugEl.addChild(debugChildEl); } this.delegate.appendChild(parent, newChild); } /** * @param {?} parent * @param {?} newChild * @param {?} refChild * @return {?} */ }, { key: "insertBefore", value: function insertBefore(parent, newChild, refChild) { /** @type {?} */ var debugEl = getDebugNode(parent); /** @type {?} */ var debugChildEl = getDebugNode(newChild); /** @type {?} */ var debugRefEl = /** @type {?} */ getDebugNode(refChild); if (debugEl && debugChildEl && debugEl instanceof DebugElement__PRE_R3__) { debugEl.insertBefore(debugRefEl, debugChildEl); } this.delegate.insertBefore(parent, newChild, refChild); } /** * @param {?} parent * @param {?} oldChild * @return {?} */ }, { key: "removeChild", value: function removeChild(parent, oldChild) { /** @type {?} */ var debugEl = getDebugNode(parent); /** @type {?} */ var debugChildEl = getDebugNode(oldChild); if (debugEl && debugChildEl && debugEl instanceof DebugElement__PRE_R3__) { debugEl.removeChild(debugChildEl); } this.delegate.removeChild(parent, oldChild); } /** * @param {?} selectorOrNode * @param {?=} preserveContent * @return {?} */ }, { key: "selectRootElement", value: function selectRootElement(selectorOrNode, preserveContent) { /** @type {?} */ var el = this.delegate.selectRootElement(selectorOrNode, preserveContent); /** @type {?} */ var debugCtx = getCurrentDebugContext(); if (debugCtx) { indexDebugNode(new DebugElement__PRE_R3__(el, null, debugCtx)); } return el; } /** * @param {?} el * @param {?} name * @param {?} value * @param {?=} namespace * @return {?} */ }, { key: "setAttribute", value: function setAttribute(el, name, value, namespace) { /** @type {?} */ var debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement__PRE_R3__) { /** @type {?} */ var fullName = namespace ? namespace + ':' + name : name; debugEl.attributes[fullName] = value; } this.delegate.setAttribute(el, name, value, namespace); } /** * @param {?} el * @param {?} name * @param {?=} namespace * @return {?} */ }, { key: "removeAttribute", value: function removeAttribute(el, name, namespace) { /** @type {?} */ var debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement__PRE_R3__) { /** @type {?} */ var fullName = namespace ? namespace + ':' + name : name; debugEl.attributes[fullName] = null; } this.delegate.removeAttribute(el, name, namespace); } /** * @param {?} el * @param {?} name * @return {?} */ }, { key: "addClass", value: function addClass(el, name) { /** @type {?} */ var debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement__PRE_R3__) { debugEl.classes[name] = true; } this.delegate.addClass(el, name); } /** * @param {?} el * @param {?} name * @return {?} */ }, { key: "removeClass", value: function removeClass(el, name) { /** @type {?} */ var debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement__PRE_R3__) { debugEl.classes[name] = false; } this.delegate.removeClass(el, name); } /** * @param {?} el * @param {?} style * @param {?} value * @param {?} flags * @return {?} */ }, { key: "setStyle", value: function setStyle(el, style, value, flags) { /** @type {?} */ var debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement__PRE_R3__) { debugEl.styles[style] = value; } this.delegate.setStyle(el, style, value, flags); } /** * @param {?} el * @param {?} style * @param {?} flags * @return {?} */ }, { key: "removeStyle", value: function removeStyle(el, style, flags) { /** @type {?} */ var debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement__PRE_R3__) { debugEl.styles[style] = null; } this.delegate.removeStyle(el, style, flags); } /** * @param {?} el * @param {?} name * @param {?} value * @return {?} */ }, { key: "setProperty", value: function setProperty(el, name, value) { /** @type {?} */ var debugEl = getDebugNode(el); if (debugEl && debugEl instanceof DebugElement__PRE_R3__) { debugEl.properties[name] = value; } this.delegate.setProperty(el, name, value); } /** * @param {?} target * @param {?} eventName * @param {?} callback * @return {?} */ }, { key: "listen", value: function listen(target, eventName, callback) { if (typeof target !== 'string') { /** @type {?} */ var debugEl = getDebugNode(target); if (debugEl) { debugEl.listeners.push(new DebugEventListener(eventName, callback)); } } return this.delegate.listen(target, eventName, callback); } /** * @param {?} node * @return {?} */ }, { key: "parentNode", value: function parentNode(node) { return this.delegate.parentNode(node); } /** * @param {?} node * @return {?} */ }, { key: "nextSibling", value: function nextSibling(node) { return this.delegate.nextSibling(node); } /** * @param {?} node * @param {?} value * @return {?} */ }, { key: "setValue", value: function setValue(node, value) { return this.delegate.setValue(node, value); } }]); return DebugRenderer2; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} override * @return {?} */ function overrideProvider(override) { initServicesIfNeeded(); return Services.overrideProvider(override); } /** * @param {?} comp * @param {?} componentFactory * @return {?} */ function overrideComponentView(comp, componentFactory) { initServicesIfNeeded(); return Services.overrideComponentView(comp, componentFactory); } /** * @return {?} */ function clearOverrides() { initServicesIfNeeded(); return Services.clearOverrides(); } // Attention: this function is called as top level function. // Putting any logic in here will destroy closure tree shaking! /** * @param {?} ngModuleType * @param {?} bootstrapComponents * @param {?} defFactory * @return {?} */ function createNgModuleFactory(ngModuleType, bootstrapComponents, defFactory) { return new NgModuleFactory_(ngModuleType, bootstrapComponents, defFactory); } /** * @param {?} def * @return {?} */ function cloneNgModuleDefinition(def) { /** @type {?} */ var providers = Array.from(def.providers); /** @type {?} */ var modules = Array.from(def.modules); /** @type {?} */ var providersByKey = {}; for (var key in def.providersByKey) { providersByKey[key] = def.providersByKey[key]; } return { factory: def.factory, isRoot: def.isRoot, providers: providers, modules: modules, providersByKey: providersByKey }; } var NgModuleFactory_ = /*#__PURE__*/function (_NgModuleFactory2) { _inherits(NgModuleFactory_, _NgModuleFactory2); var _super125 = _createSuper(NgModuleFactory_); /** * @param {?} moduleType * @param {?} _bootstrapComponents * @param {?} _ngModuleDefFactory */ function NgModuleFactory_(moduleType, _bootstrapComponents, _ngModuleDefFactory) { var _this354; _classCallCheck(this, NgModuleFactory_); // Attention: this ctor is called as top level function. // Putting any logic in here will destroy closure tree shaking! _this354 = _super125.call(this); _this354.moduleType = moduleType; _this354._bootstrapComponents = _bootstrapComponents; _this354._ngModuleDefFactory = _ngModuleDefFactory; return _this354; } /** * @param {?} parentInjector * @return {?} */ _createClass2(NgModuleFactory_, [{ key: "create", value: function create(parentInjector) { initServicesIfNeeded(); // Clone the NgModuleDefinition so that any tree shakeable provider definition // added to this instance of the NgModuleRef doesn't affect the cached copy. // See https://github.com/angular/angular/issues/25018. /** @type {?} */ var def = cloneNgModuleDefinition(resolveDefinition(this._ngModuleDefFactory)); return Services.createNgModuleRef(this.moduleType, parentInjector || Injector.NULL, this._bootstrapComponents, def); } }]); return NgModuleFactory_; }(NgModuleFactory); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=core.js.map /***/ }, /***/ "./node_modules/@angular/forms/fesm2015/forms.js": /*!*******************************************************!*\ !*** ./node_modules/@angular/forms/fesm2015/forms.js ***! \*******************************************************/ /*! exports provided: ɵangular_packages_forms_forms_d, ɵInternalFormsSharedModule, ɵangular_packages_forms_forms_c, ɵangular_packages_forms_forms_a, ɵangular_packages_forms_forms_b, ɵangular_packages_forms_forms_e, ɵangular_packages_forms_forms_f, ɵangular_packages_forms_forms_g, ɵangular_packages_forms_forms_h, ɵangular_packages_forms_forms_i, ɵangular_packages_forms_forms_j, ɵangular_packages_forms_forms_k, ɵangular_packages_forms_forms_l, ɵangular_packages_forms_forms_z, ɵNgNoValidate, ɵangular_packages_forms_forms_m, ɵangular_packages_forms_forms_n, ɵangular_packages_forms_forms_o, ɵangular_packages_forms_forms_p, ɵangular_packages_forms_forms_q, ɵangular_packages_forms_forms_r, ɵangular_packages_forms_forms_s, ɵangular_packages_forms_forms_t, ɵangular_packages_forms_forms_v, ɵangular_packages_forms_forms_u, ɵangular_packages_forms_forms_w, ɵangular_packages_forms_forms_y, ɵNgSelectMultipleOption, ɵangular_packages_forms_forms_x, ɵangular_packages_forms_forms_bb, ɵangular_packages_forms_forms_bc, ɵangular_packages_forms_forms_be, ɵangular_packages_forms_forms_bd, ɵangular_packages_forms_forms_bf, ɵangular_packages_forms_forms_ba, AbstractControlDirective, AbstractFormGroupDirective, CheckboxControlValueAccessor, ControlContainer, NG_VALUE_ACCESSOR, COMPOSITION_BUFFER_MODE, DefaultValueAccessor, NgControl, NgControlStatus, NgControlStatusGroup, NgForm, NgFormSelectorWarning, NgModel, NgModelGroup, NumberValueAccessor, RadioControlValueAccessor, RangeValueAccessor, FormControlDirective, FormControlName, FormGroupDirective, FormArrayName, FormGroupName, NgSelectOption, SelectControlValueAccessor, SelectMultipleControlValueAccessor, CheckboxRequiredValidator, EmailValidator, MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator, FormBuilder, AbstractControl, FormArray, FormControl, FormGroup, NG_ASYNC_VALIDATORS, NG_VALIDATORS, Validators, VERSION, FormsModule, ReactiveFormsModule */ /***/ function node_modulesAngularFormsFesm2015FormsJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_d", function () { return ɵInternalFormsSharedModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵInternalFormsSharedModule", function () { return ɵInternalFormsSharedModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_c", function () { return REACTIVE_DRIVEN_DIRECTIVES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_a", function () { return SHARED_FORM_DIRECTIVES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_b", function () { return TEMPLATE_DRIVEN_DIRECTIVES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_e", function () { return CHECKBOX_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_f", function () { return DEFAULT_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_g", function () { return AbstractControlStatus; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_h", function () { return ngControlStatusHost; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_i", function () { return formDirectiveProvider; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_j", function () { return NG_FORM_SELECTOR_WARNING; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_k", function () { return formControlBinding; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_l", function () { return modelGroupProvider; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_z", function () { return ɵNgNoValidate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNgNoValidate", function () { return ɵNgNoValidate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_m", function () { return NUMBER_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_n", function () { return RADIO_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_o", function () { return RadioControlRegistry; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_p", function () { return RANGE_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_q", function () { return NG_MODEL_WITH_FORM_CONTROL_WARNING; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_r", function () { return formControlBinding$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_s", function () { return controlNameBinding; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_t", function () { return formDirectiveProvider$1; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_v", function () { return formArrayNameProvider; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_u", function () { return formGroupNameProvider; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_w", function () { return SELECT_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_y", function () { return ɵNgSelectMultipleOption; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNgSelectMultipleOption", function () { return ɵNgSelectMultipleOption; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_x", function () { return SELECT_MULTIPLE_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_bb", function () { return CHECKBOX_REQUIRED_VALIDATOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_bc", function () { return EMAIL_VALIDATOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_be", function () { return MAX_LENGTH_VALIDATOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_bd", function () { return MIN_LENGTH_VALIDATOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_bf", function () { return PATTERN_VALIDATOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_ba", function () { return REQUIRED_VALIDATOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbstractControlDirective", function () { return AbstractControlDirective; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbstractFormGroupDirective", function () { return AbstractFormGroupDirective; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CheckboxControlValueAccessor", function () { return CheckboxControlValueAccessor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ControlContainer", function () { return ControlContainer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NG_VALUE_ACCESSOR", function () { return NG_VALUE_ACCESSOR; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COMPOSITION_BUFFER_MODE", function () { return COMPOSITION_BUFFER_MODE; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultValueAccessor", function () { return DefaultValueAccessor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgControl", function () { return NgControl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgControlStatus", function () { return NgControlStatus; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgControlStatusGroup", function () { return NgControlStatusGroup; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgForm", function () { return NgForm; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgFormSelectorWarning", function () { return NgFormSelectorWarning; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModel", function () { return NgModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModelGroup", function () { return NgModelGroup; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumberValueAccessor", function () { return NumberValueAccessor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RadioControlValueAccessor", function () { return RadioControlValueAccessor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RangeValueAccessor", function () { return RangeValueAccessor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormControlDirective", function () { return FormControlDirective; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormControlName", function () { return FormControlName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormGroupDirective", function () { return FormGroupDirective; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormArrayName", function () { return FormArrayName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormGroupName", function () { return FormGroupName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSelectOption", function () { return NgSelectOption; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectControlValueAccessor", function () { return SelectControlValueAccessor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectMultipleControlValueAccessor", function () { return SelectMultipleControlValueAccessor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CheckboxRequiredValidator", function () { return CheckboxRequiredValidator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmailValidator", function () { return EmailValidator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MaxLengthValidator", function () { return MaxLengthValidator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MinLengthValidator", function () { return MinLengthValidator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PatternValidator", function () { return PatternValidator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RequiredValidator", function () { return RequiredValidator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormBuilder", function () { return FormBuilder; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbstractControl", function () { return AbstractControl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormArray", function () { return FormArray; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormControl", function () { return FormControl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormGroup", function () { return FormGroup; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NG_ASYNC_VALIDATORS", function () { return NG_ASYNC_VALIDATORS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NG_VALIDATORS", function () { return NG_VALIDATORS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Validators", function () { return Validators; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function () { return VERSION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormsModule", function () { return FormsModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReactiveFormsModule", function () { return ReactiveFormsModule; }); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! @angular/core */ "./node_modules/@angular/core/fesm2015/core.js"); /* harmony import */ var _angular_platform_browser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! @angular/platform-browser */ "./node_modules/@angular/platform-browser/fesm2015/platform-browser.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! rxjs */ "./node_modules/rxjs/_esm2015/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! rxjs/operators */ "./node_modules/rxjs/_esm2015/operators/index.js"); /** * @license Angular v8.2.12 * (c) 2010-2019 Google LLC. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@description * Defines an interface that acts as a bridge between the Angular forms API and a * native element in the DOM. * * Implement this interface to create a custom form control directive * that integrates with Angular forms. * * @see DefaultValueAccessor * * \@publicApi * @record */ function ControlValueAccessor() {} if (false) {} /** * Used to provide a `ControlValueAccessor` for form controls. * * See `DefaultValueAccessor` for how to implement one. * * \@publicApi * @type {?} */ var NG_VALUE_ACCESSOR = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('NgValueAccessor'); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var CHECKBOX_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return CheckboxControlValueAccessor; }), multi: true }; /** * \@description * A `ControlValueAccessor` for writing a value and listening to changes on a checkbox input * element. * * \@usageNotes * * ### Using a checkbox with a reactive form. * * The following example shows how to use a checkbox with a reactive form. * * ```ts * const rememberLoginControl = new FormControl(); * ``` * * ``` * <input type="checkbox" [formControl]="rememberLoginControl"> * ``` * * \@ngModule ReactiveFormsModule * \@ngModule FormsModule * \@publicApi */ var CheckboxControlValueAccessor = /*#__PURE__*/function () { /** * @param {?} _renderer * @param {?} _elementRef */ function CheckboxControlValueAccessor(_renderer, _elementRef) { _classCallCheck(this, CheckboxControlValueAccessor); this._renderer = _renderer; this._elementRef = _elementRef; /** * \@description * The registered callback function called when a change event occurs on the input element. */ this.onChange = /** * @param {?} _ * @return {?} */ function (_) {}; /** * \@description * The registered callback function called when a blur event occurs on the input element. */ this.onTouched = /** * @return {?} */ function () {}; } /** * Sets the "checked" property on the input element. * * @param {?} value The checked value * @return {?} */ _createClass2(CheckboxControlValueAccessor, [{ key: "writeValue", value: function writeValue(value) { this._renderer.setProperty(this._elementRef.nativeElement, 'checked', value); } /** * \@description * Registers a function called when the control value changes. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnChange", value: function registerOnChange(fn) { this.onChange = fn; } /** * \@description * Registers a function called when the control is touched. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnTouched", value: function registerOnTouched(fn) { this.onTouched = fn; } /** * Sets the "disabled" property on the input element. * * @param {?} isDisabled The disabled value * @return {?} */ }, { key: "setDisabledState", value: function setDisabledState(isDisabled) { this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); } }]); return CheckboxControlValueAccessor; }(); CheckboxControlValueAccessor.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]', host: { '(change)': 'onChange($event.target.checked)', '(blur)': 'onTouched()' }, providers: [CHECKBOX_VALUE_ACCESSOR] }] }]; /** @nocollapse */ CheckboxControlValueAccessor.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var DEFAULT_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return DefaultValueAccessor; }), multi: true }; /** * We must check whether the agent is Android because composition events * behave differently between iOS and Android. * @return {?} */ function _isAndroid() { /** @type {?} */ var userAgent = Object(_angular_platform_browser__WEBPACK_IMPORTED_MODULE_1__["ɵgetDOM"])() ? Object(_angular_platform_browser__WEBPACK_IMPORTED_MODULE_1__["ɵgetDOM"])().getUserAgent() : ''; return /android (\d+)/.test(userAgent.toLowerCase()); } /** * \@description * Provide this token to control if form directives buffer IME input until * the "compositionend" event occurs. * \@publicApi * @type {?} */ var COMPOSITION_BUFFER_MODE = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('CompositionEventMode'); /** * \@description * The default `ControlValueAccessor` for writing a value and listening to changes on input * elements. The accessor is used by the `FormControlDirective`, `FormControlName`, and * `NgModel` directives. * * \@usageNotes * * ### Using the default value accessor * * The following example shows how to use an input element that activates the default value accessor * (in this case, a text field). * * ```ts * const firstNameControl = new FormControl(); * ``` * * ``` * <input type="text" [formControl]="firstNameControl"> * ``` * * \@ngModule ReactiveFormsModule * \@ngModule FormsModule * \@publicApi */ var DefaultValueAccessor = /*#__PURE__*/function () { /** * @param {?} _renderer * @param {?} _elementRef * @param {?} _compositionMode */ function DefaultValueAccessor(_renderer, _elementRef, _compositionMode) { _classCallCheck(this, DefaultValueAccessor); this._renderer = _renderer; this._elementRef = _elementRef; this._compositionMode = _compositionMode; /** * \@description * The registered callback function called when an input event occurs on the input element. */ this.onChange = /** * @param {?} _ * @return {?} */ function (_) {}; /** * \@description * The registered callback function called when a blur event occurs on the input element. */ this.onTouched = /** * @return {?} */ function () {}; /** * Whether the user is creating a composition string (IME events). */ this._composing = false; if (this._compositionMode == null) { this._compositionMode = !_isAndroid(); } } /** * Sets the "value" property on the input element. * * @param {?} value The checked value * @return {?} */ _createClass2(DefaultValueAccessor, [{ key: "writeValue", value: function writeValue(value) { /** @type {?} */ var normalizedValue = value == null ? '' : value; this._renderer.setProperty(this._elementRef.nativeElement, 'value', normalizedValue); } /** * \@description * Registers a function called when the control value changes. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnChange", value: function registerOnChange(fn) { this.onChange = fn; } /** * \@description * Registers a function called when the control is touched. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnTouched", value: function registerOnTouched(fn) { this.onTouched = fn; } /** * Sets the "disabled" property on the input element. * * @param {?} isDisabled The disabled value * @return {?} */ }, { key: "setDisabledState", value: function setDisabledState(isDisabled) { this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); } /** * \@internal * @param {?} value * @return {?} */ }, { key: "_handleInput", value: function _handleInput(value) { if (!this._compositionMode || this._compositionMode && !this._composing) { this.onChange(value); } } /** * \@internal * @return {?} */ }, { key: "_compositionStart", value: function _compositionStart() { this._composing = true; } /** * \@internal * @param {?} value * @return {?} */ }, { key: "_compositionEnd", value: function _compositionEnd(value) { this._composing = false; this._compositionMode && this.onChange(value); } }]); return DefaultValueAccessor; }(); DefaultValueAccessor.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]', // TODO: vsavkin replace the above selector with the one below it once // https://github.com/angular/angular/issues/3011 is implemented // selector: '[ngModel],[formControl],[formControlName]', host: { '(input)': '$any(this)._handleInput($event.target.value)', '(blur)': 'onTouched()', '(compositionstart)': '$any(this)._compositionStart()', '(compositionend)': '$any(this)._compositionEnd($event.target.value)' }, providers: [DEFAULT_VALUE_ACCESSOR] }] }]; /** @nocollapse */ DefaultValueAccessor.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: Boolean, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [COMPOSITION_BUFFER_MODE] }] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** * \@description * Base class for control directives. * * This class is only used internally in the `ReactiveFormsModule` and the `FormsModule`. * * \@publicApi * @abstract */ var AbstractControlDirective = /*#__PURE__*/function () { function AbstractControlDirective() { _classCallCheck(this, AbstractControlDirective); } _createClass2(AbstractControlDirective, [{ key: "reset", /** * \@description * Resets the control with the provided value if the control is present. * @param {?=} value * @return {?} */ value: function reset() { var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; if (this.control) this.control.reset(value); } /** * \@description * Reports whether the control with the given path has the error specified. * * \@usageNotes * For example, for the following `FormGroup`: * * ``` * form = new FormGroup({ * address: new FormGroup({ street: new FormControl() }) * }); * ``` * * The path to the 'street' control from the root form would be 'address' -> 'street'. * * It can be provided to this method in one of two formats: * * 1. An array of string control names, e.g. `['address', 'street']` * 1. A period-delimited list of control names in one string, e.g. `'address.street'` * * If no path is given, this method checks for the error on the current control. * * @param {?} errorCode The code of the error to check * @param {?=} path A list of control names that designates how to move from the current control * to the control that should be queried for errors. * * @return {?} whether the given error is present in the control at the given path. * * If the control is not present, false is returned. */ }, { key: "hasError", value: function hasError(errorCode, path) { return this.control ? this.control.hasError(errorCode, path) : false; } /** * \@description * Reports error data for the control with the given path. * * \@usageNotes * For example, for the following `FormGroup`: * * ``` * form = new FormGroup({ * address: new FormGroup({ street: new FormControl() }) * }); * ``` * * The path to the 'street' control from the root form would be 'address' -> 'street'. * * It can be provided to this method in one of two formats: * * 1. An array of string control names, e.g. `['address', 'street']` * 1. A period-delimited list of control names in one string, e.g. `'address.street'` * * @param {?} errorCode The code of the error to check * @param {?=} path A list of control names that designates how to move from the current control * to the control that should be queried for errors. * * @return {?} error data for that particular error. If the control or error is not present, * null is returned. */ }, { key: "getError", value: function getError(errorCode, path) { return this.control ? this.control.getError(errorCode, path) : null; } }, { key: "value", /** * \@description * Reports the value of the control if it is present, otherwise null. * @return {?} */ get: function get() { return this.control ? this.control.value : null; } /** * \@description * Reports whether the control is valid. A control is considered valid if no * validation errors exist with the current value. * If the control is not present, null is returned. * @return {?} */ }, { key: "valid", get: function get() { return this.control ? this.control.valid : null; } /** * \@description * Reports whether the control is invalid, meaning that an error exists in the input value. * If the control is not present, null is returned. * @return {?} */ }, { key: "invalid", get: function get() { return this.control ? this.control.invalid : null; } /** * \@description * Reports whether a control is pending, meaning that that async validation is occurring and * errors are not yet available for the input value. If the control is not present, null is * returned. * @return {?} */ }, { key: "pending", get: function get() { return this.control ? this.control.pending : null; } /** * \@description * Reports whether the control is disabled, meaning that the control is disabled * in the UI and is exempt from validation checks and excluded from aggregate * values of ancestor controls. If the control is not present, null is returned. * @return {?} */ }, { key: "disabled", get: function get() { return this.control ? this.control.disabled : null; } /** * \@description * Reports whether the control is enabled, meaning that the control is included in ancestor * calculations of validity or value. If the control is not present, null is returned. * @return {?} */ }, { key: "enabled", get: function get() { return this.control ? this.control.enabled : null; } /** * \@description * Reports the control's validation errors. If the control is not present, null is returned. * @return {?} */ }, { key: "errors", get: function get() { return this.control ? this.control.errors : null; } /** * \@description * Reports whether the control is pristine, meaning that the user has not yet changed * the value in the UI. If the control is not present, null is returned. * @return {?} */ }, { key: "pristine", get: function get() { return this.control ? this.control.pristine : null; } /** * \@description * Reports whether the control is dirty, meaning that the user has changed * the value in the UI. If the control is not present, null is returned. * @return {?} */ }, { key: "dirty", get: function get() { return this.control ? this.control.dirty : null; } /** * \@description * Reports whether the control is touched, meaning that the user has triggered * a `blur` event on it. If the control is not present, null is returned. * @return {?} */ }, { key: "touched", get: function get() { return this.control ? this.control.touched : null; } /** * \@description * Reports the validation status of the control. Possible values include: * 'VALID', 'INVALID', 'DISABLED', and 'PENDING'. * If the control is not present, null is returned. * @return {?} */ }, { key: "status", get: function get() { return this.control ? this.control.status : null; } /** * \@description * Reports whether the control is untouched, meaning that the user has not yet triggered * a `blur` event on it. If the control is not present, null is returned. * @return {?} */ }, { key: "untouched", get: function get() { return this.control ? this.control.untouched : null; } /** * \@description * Returns a multicasting observable that emits a validation status whenever it is * calculated for the control. If the control is not present, null is returned. * @return {?} */ }, { key: "statusChanges", get: function get() { return this.control ? this.control.statusChanges : null; } /** * \@description * Returns a multicasting observable of value changes for the control that emits every time the * value of the control changes in the UI or programmatically. * If the control is not present, null is returned. * @return {?} */ }, { key: "valueChanges", get: function get() { return this.control ? this.control.valueChanges : null; } /** * \@description * Returns an array that represents the path from the top-level form to this control. * Each index is the string name of the control on that level. * @return {?} */ }, { key: "path", get: function get() { return null; } }]); return AbstractControlDirective; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@description * A base class for directives that contain multiple registered instances of `NgControl`. * Only used by the forms module. * * \@publicApi * @abstract */ var ControlContainer = /*#__PURE__*/function (_AbstractControlDirec) { _inherits(ControlContainer, _AbstractControlDirec); var _super126 = _createSuper(ControlContainer); function ControlContainer() { _classCallCheck(this, ControlContainer); return _super126.apply(this, arguments); } _createClass2(ControlContainer, [{ key: "formDirective", /** * \@description * The top-level form directive for the control. * @return {?} */ get: function get() { return null; } /** * \@description * The path to this group. * @return {?} */ }, { key: "path", get: function get() { return null; } }]); return ControlContainer; }(AbstractControlDirective); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @return {?} */ function unimplemented() { throw new Error('unimplemented'); } /** * \@description * A base class that all control `FormControl`-based directives extend. It binds a `FormControl` * object to a DOM element. * * \@publicApi * @abstract */ var NgControl = /*#__PURE__*/function (_AbstractControlDirec2) { _inherits(NgControl, _AbstractControlDirec2); var _super127 = _createSuper(NgControl); function NgControl() { var _this355; _classCallCheck(this, NgControl); _this355 = _super127.apply(this, arguments); /** * \@description * The parent form for the control. * * \@internal */ _this355._parent = null; /** * \@description * The name for the control */ _this355.name = null; /** * \@description * The value accessor for the control */ _this355.valueAccessor = null; /** * \@description * The uncomposed array of synchronous validators for the control * * \@internal */ _this355._rawValidators = []; /** * \@description * The uncomposed array of async validators for the control * * \@internal */ _this355._rawAsyncValidators = []; return _this355; } /** * \@description * The registered synchronous validator function for the control * * @throws An exception that this method is not implemented * @return {?} */ _createClass2(NgControl, [{ key: "validator", get: function get() { return ( /** @type {?} */ unimplemented() ); } /** * \@description * The registered async validator function for the control * * @throws An exception that this method is not implemented * @return {?} */ }, { key: "asyncValidator", get: function get() { return ( /** @type {?} */ unimplemented() ); } }]); return NgControl; }(AbstractControlDirective); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var AbstractControlStatus = /*#__PURE__*/function () { /** * @param {?} cd */ function AbstractControlStatus(cd) { _classCallCheck(this, AbstractControlStatus); this._cd = cd; } /** * @return {?} */ _createClass2(AbstractControlStatus, [{ key: "ngClassUntouched", get: function get() { return this._cd.control ? this._cd.control.untouched : false; } /** * @return {?} */ }, { key: "ngClassTouched", get: function get() { return this._cd.control ? this._cd.control.touched : false; } /** * @return {?} */ }, { key: "ngClassPristine", get: function get() { return this._cd.control ? this._cd.control.pristine : false; } /** * @return {?} */ }, { key: "ngClassDirty", get: function get() { return this._cd.control ? this._cd.control.dirty : false; } /** * @return {?} */ }, { key: "ngClassValid", get: function get() { return this._cd.control ? this._cd.control.valid : false; } /** * @return {?} */ }, { key: "ngClassInvalid", get: function get() { return this._cd.control ? this._cd.control.invalid : false; } /** * @return {?} */ }, { key: "ngClassPending", get: function get() { return this._cd.control ? this._cd.control.pending : false; } }]); return AbstractControlStatus; }(); if (false) {} /** @type {?} */ var ngControlStatusHost = { '[class.ng-untouched]': 'ngClassUntouched', '[class.ng-touched]': 'ngClassTouched', '[class.ng-pristine]': 'ngClassPristine', '[class.ng-dirty]': 'ngClassDirty', '[class.ng-valid]': 'ngClassValid', '[class.ng-invalid]': 'ngClassInvalid', '[class.ng-pending]': 'ngClassPending' }; /** * \@description * Directive automatically applied to Angular form controls that sets CSS classes * based on control status. * * \@usageNotes * * ### CSS classes applied * * The following classes are applied as the properties become true: * * * ng-valid * * ng-invalid * * ng-pending * * ng-pristine * * ng-dirty * * ng-untouched * * ng-touched * * \@ngModule ReactiveFormsModule * \@ngModule FormsModule * \@publicApi */ var NgControlStatus = /*#__PURE__*/function (_AbstractControlStatu) { _inherits(NgControlStatus, _AbstractControlStatu); var _super128 = _createSuper(NgControlStatus); /** * @param {?} cd */ function NgControlStatus(cd) { _classCallCheck(this, NgControlStatus); return _super128.call(this, cd); } return NgControlStatus; }(AbstractControlStatus); NgControlStatus.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[formControlName],[ngModel],[formControl]', host: ngControlStatusHost }] }]; /** @nocollapse */ NgControlStatus.ctorParameters = function () { return [{ type: NgControl, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }] }]; }; /** * \@description * Directive automatically applied to Angular form groups that sets CSS classes * based on control status (valid/invalid/dirty/etc). * * @see `NgControlStatus` * * \@ngModule ReactiveFormsModule * \@ngModule FormsModule * \@publicApi */ var NgControlStatusGroup = /*#__PURE__*/function (_AbstractControlStatu2) { _inherits(NgControlStatusGroup, _AbstractControlStatu2); var _super129 = _createSuper(NgControlStatusGroup); /** * @param {?} cd */ function NgControlStatusGroup(cd) { _classCallCheck(this, NgControlStatusGroup); return _super129.call(this, cd); } return NgControlStatusGroup; }(AbstractControlStatus); NgControlStatusGroup.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]', host: ngControlStatusHost }] }]; /** @nocollapse */ NgControlStatusGroup.ctorParameters = function () { return [{ type: ControlContainer, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }] }]; }; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} value * @return {?} */ function isEmptyInputValue(value) { // we don't check for string here so it also works with arrays return value == null || value.length === 0; } /** * \@description * An `InjectionToken` for registering additional synchronous validators used with `AbstractControl`s. * * @see `NG_ASYNC_VALIDATORS` * * \@usageNotes * * ### Providing a custom validator * * The following example registers a custom validator directive. Adding the validator to the * existing collection of validators requires the `multi: true` option. * * ```typescript * \@Directive({ * selector: '[customValidator]', * providers: [{provide: NG_VALIDATORS, useExisting: CustomValidatorDirective, multi: true}] * }) * class CustomValidatorDirective implements Validator { * validate(control: AbstractControl): ValidationErrors | null { * return { 'custom': true }; * } * } * ``` * * \@publicApi * @type {?} */ var NG_VALIDATORS = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('NgValidators'); /** * \@description * An `InjectionToken` for registering additional asynchronous validators used with `AbstractControl`s. * * @see `NG_VALIDATORS` * * \@publicApi * @type {?} */ var NG_ASYNC_VALIDATORS = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('NgAsyncValidators'); /** * A regular expression that matches valid e-mail addresses. * * At a high level, this regexp matches e-mail addresses of the format `local-part\@tld`, where: * - `local-part` consists of one or more of the allowed characters (alphanumeric and some * punctuation symbols). * - `local-part` cannot begin or end with a period (`.`). * - `local-part` cannot be longer than 64 characters. * - `tld` consists of one or more `labels` separated by periods (`.`). For example `localhost` or * `foo.com`. * - A `label` consists of one or more of the allowed characters (alphanumeric, dashes (`-`) and * periods (`.`)). * - A `label` cannot begin or end with a dash (`-`) or a period (`.`). * - A `label` cannot be longer than 63 characters. * - The whole address cannot be longer than 254 characters. * * ## Implementation background * * This regexp was ported over from AngularJS (see there for git history): * https://github.com/angular/angular.js/blob/c133ef836/src/ng/directive/input.js#L27 * It is based on the * [WHATWG version](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address) with * some enhancements to incorporate more RFC rules (such as rules related to domain names and the * lengths of different parts of the address). The main differences from the WHATWG version are: * - Disallow `local-part` to begin or end with a period (`.`). * - Disallow `local-part` length to exceed 64 characters. * - Disallow total address length to exceed 254 characters. * * See [this commit](https://github.com/angular/angular.js/commit/f3f5cf72e) for more details. * @type {?} */ var EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/; /** * \@description * Provides a set of built-in validators that can be used by form controls. * * A validator is a function that processes a `FormControl` or collection of * controls and returns an error map or null. A null map means that validation has passed. * * @see [Form Validation](/guide/form-validation) * * \@publicApi */ var Validators = /*#__PURE__*/function () { function Validators() { _classCallCheck(this, Validators); } _createClass2(Validators, null, [{ key: "min", /** * \@description * Validator that requires the control's value to be greater than or equal to the provided number. * The validator exists only as a function and not as a directive. * * \@usageNotes * * ### Validate against a minimum of 3 * * ```typescript * const control = new FormControl(2, Validators.min(3)); * * console.log(control.errors); // {min: {min: 3, actual: 2}} * ``` * * @see `updateValueAndValidity()` * * @param {?} min * @return {?} A validator function that returns an error map with the * `min` property if the validation check fails, otherwise `null`. * */ value: function min(_min) { return ( /** * @param {?} control * @return {?} */ function (control) { if (isEmptyInputValue(control.value) || isEmptyInputValue(_min)) { return null; // don't validate empty values to allow optional controls } /** @type {?} */ var value = parseFloat(control.value); // Controls with NaN values after parsing should be treated as not having a // minimum, per the HTML forms spec: https://www.w3.org/TR/html5/forms.html#attr-input-min return !isNaN(value) && value < _min ? { 'min': { 'min': _min, 'actual': control.value } } : null; } ); } /** * \@description * Validator that requires the control's value to be less than or equal to the provided number. * The validator exists only as a function and not as a directive. * * \@usageNotes * * ### Validate against a maximum of 15 * * ```typescript * const control = new FormControl(16, Validators.max(15)); * * console.log(control.errors); // {max: {max: 15, actual: 16}} * ``` * * @see `updateValueAndValidity()` * * @param {?} max * @return {?} A validator function that returns an error map with the * `max` property if the validation check fails, otherwise `null`. * */ }, { key: "max", value: function max(_max) { return ( /** * @param {?} control * @return {?} */ function (control) { if (isEmptyInputValue(control.value) || isEmptyInputValue(_max)) { return null; // don't validate empty values to allow optional controls } /** @type {?} */ var value = parseFloat(control.value); // Controls with NaN values after parsing should be treated as not having a // maximum, per the HTML forms spec: https://www.w3.org/TR/html5/forms.html#attr-input-max return !isNaN(value) && value > _max ? { 'max': { 'max': _max, 'actual': control.value } } : null; } ); } /** * \@description * Validator that requires the control have a non-empty value. * * \@usageNotes * * ### Validate that the field is non-empty * * ```typescript * const control = new FormControl('', Validators.required); * * console.log(control.errors); // {required: true} * ``` * * @see `updateValueAndValidity()` * * @param {?} control * @return {?} An error map with the `required` property * if the validation check fails, otherwise `null`. * */ }, { key: "required", value: function required(control) { return isEmptyInputValue(control.value) ? { 'required': true } : null; } /** * \@description * Validator that requires the control's value be true. This validator is commonly * used for required checkboxes. * * \@usageNotes * * ### Validate that the field value is true * * ```typescript * const control = new FormControl('', Validators.requiredTrue); * * console.log(control.errors); // {required: true} * ``` * * @see `updateValueAndValidity()` * * @param {?} control * @return {?} An error map that contains the `required` property * set to `true` if the validation check fails, otherwise `null`. * */ }, { key: "requiredTrue", value: function requiredTrue(control) { return control.value === true ? null : { 'required': true }; } /** * \@description * Validator that requires the control's value pass an email validation test. * * Tests the value using a [regular expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions) * pattern suitable for common usecases. The pattern is based on the definition of a valid email * address in the [WHATWG HTML specification](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address) * with some enhancements to incorporate more RFC rules (such as rules related to domain names and * the lengths of different parts of the address). * * The differences from the WHATWG version include: * - Disallow `local-part` (the part before the `\@` symbol) to begin or end with a period (`.`). * - Disallow `local-part` to be longer than 64 characters. * - Disallow the whole address to be longer than 254 characters. * * If this pattern does not satisfy your business needs, you can use `Validators.pattern()` to * validate the value against a different pattern. * * \@usageNotes * * ### Validate that the field matches a valid email pattern * * ```typescript * const control = new FormControl('bad\@', Validators.email); * * console.log(control.errors); // {email: true} * ``` * * @see `updateValueAndValidity()` * * @param {?} control * @return {?} An error map with the `email` property * if the validation check fails, otherwise `null`. * */ }, { key: "email", value: function email(control) { if (isEmptyInputValue(control.value)) { return null; // don't validate empty values to allow optional controls } return EMAIL_REGEXP.test(control.value) ? null : { 'email': true }; } /** * \@description * Validator that requires the length of the control's value to be greater than or equal * to the provided minimum length. This validator is also provided by default if you use the * the HTML5 `minlength` attribute. * * \@usageNotes * * ### Validate that the field has a minimum of 3 characters * * ```typescript * const control = new FormControl('ng', Validators.minLength(3)); * * console.log(control.errors); // {minlength: {requiredLength: 3, actualLength: 2}} * ``` * * ```html * <input minlength="5"> * ``` * * @see `updateValueAndValidity()` * * @param {?} minLength * @return {?} A validator function that returns an error map with the * `minlength` if the validation check fails, otherwise `null`. * */ }, { key: "minLength", value: function minLength(_minLength) { return ( /** * @param {?} control * @return {?} */ function (control) { if (isEmptyInputValue(control.value)) { return null; // don't validate empty values to allow optional controls } /** @type {?} */ var length = control.value ? control.value.length : 0; return length < _minLength ? { 'minlength': { 'requiredLength': _minLength, 'actualLength': length } } : null; } ); } /** * \@description * Validator that requires the length of the control's value to be less than or equal * to the provided maximum length. This validator is also provided by default if you use the * the HTML5 `maxlength` attribute. * * \@usageNotes * * ### Validate that the field has maximum of 5 characters * * ```typescript * const control = new FormControl('Angular', Validators.maxLength(5)); * * console.log(control.errors); // {maxlength: {requiredLength: 5, actualLength: 7}} * ``` * * ```html * <input maxlength="5"> * ``` * * @see `updateValueAndValidity()` * * @param {?} maxLength * @return {?} A validator function that returns an error map with the * `maxlength` property if the validation check fails, otherwise `null`. * */ }, { key: "maxLength", value: function maxLength(_maxLength) { return ( /** * @param {?} control * @return {?} */ function (control) { /** @type {?} */ var length = control.value ? control.value.length : 0; return length > _maxLength ? { 'maxlength': { 'requiredLength': _maxLength, 'actualLength': length } } : null; } ); } /** * \@description * Validator that requires the control's value to match a regex pattern. This validator is also * provided by default if you use the HTML5 `pattern` attribute. * * \@usageNotes * * ### Validate that the field only contains letters or spaces * * ```typescript * const control = new FormControl('1', Validators.pattern('[a-zA-Z ]*')); * * console.log(control.errors); // {pattern: {requiredPattern: '^[a-zA-Z ]*$', actualValue: '1'}} * ``` * * ```html * <input pattern="[a-zA-Z ]*"> * ``` * * @see `updateValueAndValidity()` * * @param {?} pattern A regular expression to be used as is to test the values, or a string. * If a string is passed, the `^` character is prepended and the `$` character is * appended to the provided string (if not already present), and the resulting regular * expression is used to test the values. * * @return {?} A validator function that returns an error map with the * `pattern` property if the validation check fails, otherwise `null`. * */ }, { key: "pattern", value: function pattern(_pattern) { if (!_pattern) return Validators.nullValidator; /** @type {?} */ var regex; /** @type {?} */ var regexStr; if (typeof _pattern === 'string') { regexStr = ''; if (_pattern.charAt(0) !== '^') regexStr += '^'; regexStr += _pattern; if (_pattern.charAt(_pattern.length - 1) !== '$') regexStr += '$'; regex = new RegExp(regexStr); } else { regexStr = _pattern.toString(); regex = _pattern; } return ( /** * @param {?} control * @return {?} */ function (control) { if (isEmptyInputValue(control.value)) { return null; // don't validate empty values to allow optional controls } /** @type {?} */ var value = control.value; return regex.test(value) ? null : { 'pattern': { 'requiredPattern': regexStr, 'actualValue': value } }; } ); } /** * \@description * Validator that performs no operation. * * @see `updateValueAndValidity()` * * @param {?} control * @return {?} */ }, { key: "nullValidator", value: function nullValidator(control) { return null; } /** * @param {?} validators * @return {?} */ }, { key: "compose", value: function compose(validators) { if (!validators) return null; /** @type {?} */ var presentValidators = /** @type {?} */ validators.filter(isPresent); if (presentValidators.length == 0) return null; return ( /** * @param {?} control * @return {?} */ function (control) { return _mergeErrors(_executeValidators(control, presentValidators)); } ); } /** * \@description * Compose multiple async validators into a single function that returns the union * of the individual error objects for the provided control. * * @see `updateValueAndValidity()` * * @param {?} validators * @return {?} A validator function that returns an error map with the * merged error objects of the async validators if the validation check fails, otherwise `null`. * */ }, { key: "composeAsync", value: function composeAsync(validators) { if (!validators) return null; /** @type {?} */ var presentValidators = /** @type {?} */ validators.filter(isPresent); if (presentValidators.length == 0) return null; return ( /** * @param {?} control * @return {?} */ function (control) { /** @type {?} */ var observables = _executeAsyncValidators(control, presentValidators).map(toObservable); return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["forkJoin"])(observables).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(_mergeErrors)); } ); } }]); return Validators; }(); /** * @param {?} o * @return {?} */ function isPresent(o) { return o != null; } /** * @param {?} r * @return {?} */ function toObservable(r) { /** @type {?} */ var obs = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵisPromise"])(r) ? Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(r) : r; if (!Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵisObservable"])(obs)) { throw new Error("Expected validator to return Promise or Observable."); } return obs; } /** * @param {?} control * @param {?} validators * @return {?} */ function _executeValidators(control, validators) { return validators.map( /** * @param {?} v * @return {?} */ function (v) { return v(control); }); } /** * @param {?} control * @param {?} validators * @return {?} */ function _executeAsyncValidators(control, validators) { return validators.map( /** * @param {?} v * @return {?} */ function (v) { return v(control); }); } /** * @param {?} arrayOfErrors * @return {?} */ function _mergeErrors(arrayOfErrors) { /** @type {?} */ var res = arrayOfErrors.reduce( /** * @param {?} res * @param {?} errors * @return {?} */ function (res, errors) { return errors != null ? Object.assign({}, /** @type {?} */ res, errors) : /** @type {?} */ res; }, {}); return Object.keys(res).length === 0 ? null : res; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @param {?} validator * @return {?} */ function normalizeValidator(validator) { if ( /** @type {?} */ validator.validate) { return ( /** * @param {?} c * @return {?} */ function (c) { return ( /** @type {?} */ validator.validate(c) ); } ); } else { return ( /** @type {?} */ validator ); } } /** * @param {?} validator * @return {?} */ function normalizeAsyncValidator(validator) { if ( /** @type {?} */ validator.validate) { return ( /** * @param {?} c * @return {?} */ function (c) { return ( /** @type {?} */ validator.validate(c) ); } ); } else { return ( /** @type {?} */ validator ); } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var NUMBER_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return NumberValueAccessor; }), multi: true }; /** * \@description * The `ControlValueAccessor` for writing a number value and listening to number input changes. * The value accessor is used by the `FormControlDirective`, `FormControlName`, and `NgModel` * directives. * * \@usageNotes * * ### Using a number input with a reactive form. * * The following example shows how to use a number input with a reactive form. * * ```ts * const totalCountControl = new FormControl(); * ``` * * ``` * <input type="number" [formControl]="totalCountControl"> * ``` * * \@ngModule ReactiveFormsModule * \@ngModule FormsModule * \@publicApi */ var NumberValueAccessor = /*#__PURE__*/function () { /** * @param {?} _renderer * @param {?} _elementRef */ function NumberValueAccessor(_renderer, _elementRef) { _classCallCheck(this, NumberValueAccessor); this._renderer = _renderer; this._elementRef = _elementRef; /** * \@description * The registered callback function called when a change or input event occurs on the input * element. */ this.onChange = /** * @param {?} _ * @return {?} */ function (_) {}; /** * \@description * The registered callback function called when a blur event occurs on the input element. */ this.onTouched = /** * @return {?} */ function () {}; } /** * Sets the "value" property on the input element. * * @param {?} value The checked value * @return {?} */ _createClass2(NumberValueAccessor, [{ key: "writeValue", value: function writeValue(value) { // The value needs to be normalized for IE9, otherwise it is set to 'null' when null /** @type {?} */ var normalizedValue = value == null ? '' : value; this._renderer.setProperty(this._elementRef.nativeElement, 'value', normalizedValue); } /** * \@description * Registers a function called when the control value changes. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnChange", value: function registerOnChange(fn) { this.onChange = /** * @param {?} value * @return {?} */ function (value) { fn(value == '' ? null : parseFloat(value)); }; } /** * \@description * Registers a function called when the control is touched. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnTouched", value: function registerOnTouched(fn) { this.onTouched = fn; } /** * Sets the "disabled" property on the input element. * * @param {?} isDisabled The disabled value * @return {?} */ }, { key: "setDisabledState", value: function setDisabledState(isDisabled) { this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); } }]); return NumberValueAccessor; }(); NumberValueAccessor.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]', host: { '(change)': 'onChange($event.target.value)', '(input)': 'onChange($event.target.value)', '(blur)': 'onTouched()' }, providers: [NUMBER_VALUE_ACCESSOR] }] }]; /** @nocollapse */ NumberValueAccessor.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var RADIO_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return RadioControlValueAccessor; }), multi: true }; /** * \@description * Class used by Angular to track radio buttons. For internal use only. */ var RadioControlRegistry = /*#__PURE__*/function () { function RadioControlRegistry() { _classCallCheck(this, RadioControlRegistry); this._accessors = []; } /** * \@description * Adds a control to the internal registry. For internal use only. * @param {?} control * @param {?} accessor * @return {?} */ _createClass2(RadioControlRegistry, [{ key: "add", value: function add(control, accessor) { this._accessors.push([control, accessor]); } /** * \@description * Removes a control from the internal registry. For internal use only. * @param {?} accessor * @return {?} */ }, { key: "remove", value: function remove(accessor) { for (var i = this._accessors.length - 1; i >= 0; --i) { if (this._accessors[i][1] === accessor) { this._accessors.splice(i, 1); return; } } } /** * \@description * Selects a radio button. For internal use only. * @param {?} accessor * @return {?} */ }, { key: "select", value: function select(accessor) { var _this356 = this; this._accessors.forEach( /** * @param {?} c * @return {?} */ function (c) { if (_this356._isSameGroup(c, accessor) && c[1] !== accessor) { c[1].fireUncheck(accessor.value); } }); } /** * @private * @param {?} controlPair * @param {?} accessor * @return {?} */ }, { key: "_isSameGroup", value: function _isSameGroup(controlPair, accessor) { if (!controlPair[0].control) return false; return controlPair[0]._parent === accessor._control._parent && controlPair[1].name === accessor.name; } }]); return RadioControlRegistry; }(); RadioControlRegistry.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; if (false) {} /** * \@description * The `ControlValueAccessor` for writing radio control values and listening to radio control * changes. The value accessor is used by the `FormControlDirective`, `FormControlName`, and * `NgModel` directives. * * \@usageNotes * * ### Using radio buttons with reactive form directives * * The follow example shows how to use radio buttons in a reactive form. When using radio buttons in * a reactive form, radio buttons in the same group should have the same `formControlName`. * Providing a `name` attribute is optional. * * {\@example forms/ts/reactiveRadioButtons/reactive_radio_button_example.ts region='Reactive'} * * \@ngModule ReactiveFormsModule * \@ngModule FormsModule * \@publicApi */ var RadioControlValueAccessor = /*#__PURE__*/function () { /** * @param {?} _renderer * @param {?} _elementRef * @param {?} _registry * @param {?} _injector */ function RadioControlValueAccessor(_renderer, _elementRef, _registry, _injector) { _classCallCheck(this, RadioControlValueAccessor); this._renderer = _renderer; this._elementRef = _elementRef; this._registry = _registry; this._injector = _injector; /** * \@description * The registered callback function called when a change event occurs on the input element. */ this.onChange = /** * @return {?} */ function () {}; /** * \@description * The registered callback function called when a blur event occurs on the input element. */ this.onTouched = /** * @return {?} */ function () {}; } /** * \@description * A lifecycle method called when the directive is initialized. For internal use only. * @return {?} */ _createClass2(RadioControlValueAccessor, [{ key: "ngOnInit", value: function ngOnInit() { this._control = this._injector.get(NgControl); this._checkName(); this._registry.add(this._control, this); } /** * \@description * Lifecycle method called before the directive's instance is destroyed. For internal use only. * @return {?} */ }, { key: "ngOnDestroy", value: function ngOnDestroy() { this._registry.remove(this); } /** * \@description * Sets the "checked" property value on the radio input element. * * @param {?} value The checked value * @return {?} */ }, { key: "writeValue", value: function writeValue(value) { this._state = value === this.value; this._renderer.setProperty(this._elementRef.nativeElement, 'checked', this._state); } /** * \@description * Registers a function called when the control value changes. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnChange", value: function registerOnChange(fn) { var _this357 = this; this._fn = fn; this.onChange = /** * @return {?} */ function () { fn(_this357.value); _this357._registry.select(_this357); }; } /** * Sets the "value" on the radio input element and unchecks it. * * @param {?} value * @return {?} */ }, { key: "fireUncheck", value: function fireUncheck(value) { this.writeValue(value); } /** * \@description * Registers a function called when the control is touched. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnTouched", value: function registerOnTouched(fn) { this.onTouched = fn; } /** * Sets the "disabled" property on the input element. * * @param {?} isDisabled The disabled value * @return {?} */ }, { key: "setDisabledState", value: function setDisabledState(isDisabled) { this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); } /** * @private * @return {?} */ }, { key: "_checkName", value: function _checkName() { if (this.name && this.formControlName && this.name !== this.formControlName) { this._throwNameError(); } if (!this.name && this.formControlName) this.name = this.formControlName; } /** * @private * @return {?} */ }, { key: "_throwNameError", value: function _throwNameError() { throw new Error("\n If you define both a name and a formControlName attribute on your radio button, their values\n must match. Ex: <input type=\"radio\" formControlName=\"food\" name=\"food\">\n "); } }]); return RadioControlValueAccessor; }(); RadioControlValueAccessor.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]', host: { '(change)': 'onChange()', '(blur)': 'onTouched()' }, providers: [RADIO_VALUE_ACCESSOR] }] }]; /** @nocollapse */ RadioControlValueAccessor.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: RadioControlRegistry }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injector"] }]; }; RadioControlValueAccessor.propDecorators = { name: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], formControlName: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], value: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var RANGE_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return RangeValueAccessor; }), multi: true }; /** * \@description * The `ControlValueAccessor` for writing a range value and listening to range input changes. * The value accessor is used by the `FormControlDirective`, `FormControlName`, and `NgModel` * directives. * * \@usageNotes * * ### Using a range input with a reactive form * * The following example shows how to use a range input with a reactive form. * * ```ts * const ageControl = new FormControl(); * ``` * * ``` * <input type="range" [formControl]="ageControl"> * ``` * * \@ngModule ReactiveFormsModule * \@ngModule FormsModule * \@publicApi */ var RangeValueAccessor = /*#__PURE__*/function () { /** * @param {?} _renderer * @param {?} _elementRef */ function RangeValueAccessor(_renderer, _elementRef) { _classCallCheck(this, RangeValueAccessor); this._renderer = _renderer; this._elementRef = _elementRef; /** * \@description * The registered callback function called when a change or input event occurs on the input * element. */ this.onChange = /** * @param {?} _ * @return {?} */ function (_) {}; /** * \@description * The registered callback function called when a blur event occurs on the input element. */ this.onTouched = /** * @return {?} */ function () {}; } /** * Sets the "value" property on the input element. * * @param {?} value The checked value * @return {?} */ _createClass2(RangeValueAccessor, [{ key: "writeValue", value: function writeValue(value) { this._renderer.setProperty(this._elementRef.nativeElement, 'value', parseFloat(value)); } /** * \@description * Registers a function called when the control value changes. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnChange", value: function registerOnChange(fn) { this.onChange = /** * @param {?} value * @return {?} */ function (value) { fn(value == '' ? null : parseFloat(value)); }; } /** * \@description * Registers a function called when the control is touched. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnTouched", value: function registerOnTouched(fn) { this.onTouched = fn; } /** * Sets the "disabled" property on the range input element. * * @param {?} isDisabled The disabled value * @return {?} */ }, { key: "setDisabledState", value: function setDisabledState(isDisabled) { this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); } }]); return RangeValueAccessor; }(); RangeValueAccessor.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]', host: { '(change)': 'onChange($event.target.value)', '(input)': 'onChange($event.target.value)', '(blur)': 'onTouched()' }, providers: [RANGE_VALUE_ACCESSOR] }] }]; /** @nocollapse */ RangeValueAccessor.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** @type {?} */ var FormErrorExamples = { formControlName: "\n <div [formGroup]=\"myGroup\">\n <input formControlName=\"firstName\">\n </div>\n\n In your class:\n\n this.myGroup = new FormGroup({\n firstName: new FormControl()\n });", formGroupName: "\n <div [formGroup]=\"myGroup\">\n <div formGroupName=\"person\">\n <input formControlName=\"firstName\">\n </div>\n </div>\n\n In your class:\n\n this.myGroup = new FormGroup({\n person: new FormGroup({ firstName: new FormControl() })\n });", formArrayName: "\n <div [formGroup]=\"myGroup\">\n <div formArrayName=\"cities\">\n <div *ngFor=\"let city of cityArray.controls; index as i\">\n <input [formControlName]=\"i\">\n </div>\n </div>\n </div>\n\n In your class:\n\n this.cityArray = new FormArray([new FormControl('SF')]);\n this.myGroup = new FormGroup({\n cities: this.cityArray\n });", ngModelGroup: "\n <form>\n <div ngModelGroup=\"person\">\n <input [(ngModel)]=\"person.name\" name=\"firstName\">\n </div>\n </form>", ngModelWithFormGroup: "\n <div [formGroup]=\"myGroup\">\n <input formControlName=\"firstName\">\n <input [(ngModel)]=\"showMoreControls\" [ngModelOptions]=\"{standalone: true}\">\n </div>\n " }; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ReactiveErrors = /*#__PURE__*/function () { function ReactiveErrors() { _classCallCheck(this, ReactiveErrors); } _createClass2(ReactiveErrors, null, [{ key: "controlParentException", /** * @return {?} */ value: function controlParentException() { throw new Error("formControlName must be used with a parent formGroup directive. You'll want to add a formGroup\n directive and pass it an existing FormGroup instance (you can create one in your class).\n\n Example:\n\n ".concat(FormErrorExamples.formControlName)); } /** * @return {?} */ }, { key: "ngModelGroupException", value: function ngModelGroupException() { throw new Error("formControlName cannot be used with an ngModelGroup parent. It is only compatible with parents\n that also have a \"form\" prefix: formGroupName, formArrayName, or formGroup.\n\n Option 1: Update the parent to be formGroupName (reactive form strategy)\n\n ".concat(FormErrorExamples.formGroupName, "\n\n Option 2: Use ngModel instead of formControlName (template-driven strategy)\n\n ").concat(FormErrorExamples.ngModelGroup)); } /** * @return {?} */ }, { key: "missingFormException", value: function missingFormException() { throw new Error("formGroup expects a FormGroup instance. Please pass one in.\n\n Example:\n\n ".concat(FormErrorExamples.formControlName)); } /** * @return {?} */ }, { key: "groupParentException", value: function groupParentException() { throw new Error("formGroupName must be used with a parent formGroup directive. You'll want to add a formGroup\n directive and pass it an existing FormGroup instance (you can create one in your class).\n\n Example:\n\n ".concat(FormErrorExamples.formGroupName)); } /** * @return {?} */ }, { key: "arrayParentException", value: function arrayParentException() { throw new Error("formArrayName must be used with a parent formGroup directive. You'll want to add a formGroup\n directive and pass it an existing FormGroup instance (you can create one in your class).\n\n Example:\n\n ".concat(FormErrorExamples.formArrayName)); } /** * @return {?} */ }, { key: "disabledAttrWarning", value: function disabledAttrWarning() { console.warn("\n It looks like you're using the disabled attribute with a reactive form directive. If you set disabled to true\n when you set up this control in your component class, the disabled attribute will actually be set in the DOM for\n you. We recommend using this approach to avoid 'changed after checked' errors.\n \n Example: \n form = new FormGroup({\n first: new FormControl({value: 'Nancy', disabled: true}, Validators.required),\n last: new FormControl('Drew', Validators.required)\n });\n "); } /** * @param {?} directiveName * @return {?} */ }, { key: "ngModelWarning", value: function ngModelWarning(directiveName) { console.warn("\n It looks like you're using ngModel on the same form field as ".concat(directiveName, ". \n Support for using the ngModel input property and ngModelChange event with \n reactive form directives has been deprecated in Angular v6 and will be removed \n in Angular v7.\n \n For more information on this, see our API docs here:\n https://angular.io/api/forms/").concat(directiveName === 'formControl' ? 'FormControlDirective' : 'FormControlName', "#use-with-ngmodel\n ")); } }]); return ReactiveErrors; }(); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var SELECT_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return SelectControlValueAccessor; }), multi: true }; /** * @param {?} id * @param {?} value * @return {?} */ function _buildValueString(id, value) { if (id == null) return "".concat(value); if (value && typeof value === 'object') value = 'Object'; return "".concat(id, ": ").concat(value).slice(0, 50); } /** * @param {?} valueString * @return {?} */ function _extractId(valueString) { return valueString.split(':')[0]; } /** * \@description * The `ControlValueAccessor` for writing select control values and listening to select control * changes. The value accessor is used by the `FormControlDirective`, `FormControlName`, and * `NgModel` directives. * * \@usageNotes * * ### Using select controls in a reactive form * * The following examples show how to use a select control in a reactive form. * * {\@example forms/ts/reactiveSelectControl/reactive_select_control_example.ts region='Component'} * * ### Using select controls in a template-driven form * * To use a select in a template-driven form, simply add an `ngModel` and a `name` * attribute to the main `<select>` tag. * * {\@example forms/ts/selectControl/select_control_example.ts region='Component'} * * ### Customizing option selection * * Angular uses object identity to select option. It's possible for the identities of items * to change while the data does not. This can happen, for example, if the items are produced * from an RPC to the server, and that RPC is re-run. Even if the data hasn't changed, the * second response will produce objects with different identities. * * To customize the default option comparison algorithm, `<select>` supports `compareWith` input. * `compareWith` takes a **function** which has two arguments: `option1` and `option2`. * If `compareWith` is given, Angular selects option by the return value of the function. * * ```ts * const selectedCountriesControl = new FormControl(); * ``` * * ``` * <select [compareWith]="compareFn" [formControl]="selectedCountriesControl"> * <option *ngFor="let country of countries" [ngValue]="country"> * {{country.name}} * </option> * </select> * * compareFn(c1: Country, c2: Country): boolean { * return c1 && c2 ? c1.id === c2.id : c1 === c2; * } * ``` * * **Note:** We listen to the 'change' event because 'input' events aren't fired * for selects in Firefox and IE: * https://bugzilla.mozilla.org/show_bug.cgi?id=1024350 * https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/4660045/ * * \@ngModule ReactiveFormsModule * \@ngModule FormsModule * \@publicApi */ var SelectControlValueAccessor = /*#__PURE__*/function () { /** * @param {?} _renderer * @param {?} _elementRef */ function SelectControlValueAccessor(_renderer, _elementRef) { _classCallCheck(this, SelectControlValueAccessor); this._renderer = _renderer; this._elementRef = _elementRef; /** * \@internal */ this._optionMap = new Map(); /** * \@internal */ this._idCounter = 0; /** * \@description * The registered callback function called when a change event occurs on the input element. */ this.onChange = /** * @param {?} _ * @return {?} */ function (_) {}; /** * \@description * The registered callback function called when a blur event occurs on the input element. */ this.onTouched = /** * @return {?} */ function () {}; this._compareWith = _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵlooseIdentical"]; } /** * \@description * Tracks the option comparison algorithm for tracking identities when * checking for changes. * @param {?} fn * @return {?} */ _createClass2(SelectControlValueAccessor, [{ key: "writeValue", /** * Sets the "value" property on the input element. The "selectedIndex" * property is also set if an ID is provided on the option element. * * @param {?} value The checked value * @return {?} */ value: function writeValue(value) { this.value = value; /** @type {?} */ var id = this._getOptionId(value); if (id == null) { this._renderer.setProperty(this._elementRef.nativeElement, 'selectedIndex', -1); } /** @type {?} */ var valueString = _buildValueString(id, value); this._renderer.setProperty(this._elementRef.nativeElement, 'value', valueString); } /** * \@description * Registers a function called when the control value changes. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnChange", value: function registerOnChange(fn) { var _this358 = this; this.onChange = /** * @param {?} valueString * @return {?} */ function (valueString) { _this358.value = _this358._getOptionValue(valueString); fn(_this358.value); }; } /** * \@description * Registers a function called when the control is touched. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnTouched", value: function registerOnTouched(fn) { this.onTouched = fn; } /** * Sets the "disabled" property on the select input element. * * @param {?} isDisabled The disabled value * @return {?} */ }, { key: "setDisabledState", value: function setDisabledState(isDisabled) { this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); } /** * \@internal * @return {?} */ }, { key: "_registerOption", value: function _registerOption() { return (this._idCounter++).toString(); } /** * \@internal * @param {?} value * @return {?} */ }, { key: "_getOptionId", value: function _getOptionId(value) { for (var _i30 = 0, _Array$from = Array.from(this._optionMap.keys()); _i30 < _Array$from.length; _i30++) { var id = _Array$from[_i30]; if (this._compareWith(this._optionMap.get(id), value)) return id; } return null; } /** * \@internal * @param {?} valueString * @return {?} */ }, { key: "_getOptionValue", value: function _getOptionValue(valueString) { /** @type {?} */ var id = _extractId(valueString); return this._optionMap.has(id) ? this._optionMap.get(id) : valueString; } }, { key: "compareWith", set: function set(fn) { if (typeof fn !== 'function') { throw new Error("compareWith must be a function, but received ".concat(JSON.stringify(fn))); } this._compareWith = fn; } }]); return SelectControlValueAccessor; }(); SelectControlValueAccessor.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]', host: { '(change)': 'onChange($event.target.value)', '(blur)': 'onTouched()' }, providers: [SELECT_VALUE_ACCESSOR] }] }]; /** @nocollapse */ SelectControlValueAccessor.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }]; }; SelectControlValueAccessor.propDecorators = { compareWith: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; if (false) {} /** * \@description * Marks `<option>` as dynamic, so Angular can be notified when options change. * * @see `SelectControlValueAccessor` * * \@ngModule ReactiveFormsModule * \@ngModule FormsModule * \@publicApi */ var NgSelectOption = /*#__PURE__*/function () { /** * @param {?} _element * @param {?} _renderer * @param {?} _select */ function NgSelectOption(_element, _renderer, _select) { _classCallCheck(this, NgSelectOption); this._element = _element; this._renderer = _renderer; this._select = _select; if (this._select) this.id = this._select._registerOption(); } /** * \@description * Tracks the value bound to the option element. Unlike the value binding, * ngValue supports binding to objects. * @param {?} value * @return {?} */ _createClass2(NgSelectOption, [{ key: "_setElementValue", /** * \@internal * @param {?} value * @return {?} */ value: function _setElementValue(value) { this._renderer.setProperty(this._element.nativeElement, 'value', value); } /** * \@description * Lifecycle method called before the directive's instance is destroyed. For internal use only. * @return {?} */ }, { key: "ngOnDestroy", value: function ngOnDestroy() { if (this._select) { this._select._optionMap["delete"](this.id); this._select.writeValue(this._select.value); } } }, { key: "ngValue", set: function set(value) { if (this._select == null) return; this._select._optionMap.set(this.id, value); this._setElementValue(_buildValueString(this.id, value)); this._select.writeValue(this._select.value); } /** * \@description * Tracks simple string values bound to the option element. * For objects, use the `ngValue` input binding. * @param {?} value * @return {?} */ }, { key: "value", set: function set(value) { this._setElementValue(value); if (this._select) this._select.writeValue(this._select.value); } }]); return NgSelectOption; }(); NgSelectOption.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'option' }] }]; /** @nocollapse */ NgSelectOption.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"] }, { type: SelectControlValueAccessor, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Host"] }] }]; }; NgSelectOption.propDecorators = { ngValue: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['ngValue'] }], value: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['value'] }] }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var SELECT_MULTIPLE_VALUE_ACCESSOR = { provide: NG_VALUE_ACCESSOR, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return SelectMultipleControlValueAccessor; }), multi: true }; /** * @param {?} id * @param {?} value * @return {?} */ function _buildValueString$1(id, value) { if (id == null) return "".concat(value); if (typeof value === 'string') value = "'".concat(value, "'"); if (value && typeof value === 'object') value = 'Object'; return "".concat(id, ": ").concat(value).slice(0, 50); } /** * @param {?} valueString * @return {?} */ function _extractId$1(valueString) { return valueString.split(':')[0]; } /** * Mock interface for HTML Options * @record */ function HTMLOption() {} if (false) {} /** * Mock interface for HTMLCollection * @abstract */ var HTMLCollection = function HTMLCollection() { _classCallCheck(this, HTMLCollection); }; if (false) {} /** * \@description * The `ControlValueAccessor` for writing multi-select control values and listening to multi-select control * changes. The value accessor is used by the `FormControlDirective`, `FormControlName`, and `NgModel` * directives. * * @see `SelectControlValueAccessor` * * \@usageNotes * * ### Using a multi-select control * * The follow example shows you how to use a multi-select control with a reactive form. * * ```ts * const countryControl = new FormControl(); * ``` * * ``` * <select multiple name="countries" [formControl]="countryControl"> * <option *ngFor="let country of countries" [ngValue]="country"> * {{ country.name }} * </option> * </select> * ``` * * ### Customizing option selection * * To customize the default option comparison algorithm, `<select>` supports `compareWith` input. * See the `SelectControlValueAccessor` for usage. * * \@ngModule ReactiveFormsModule * \@ngModule FormsModule * \@publicApi */ var SelectMultipleControlValueAccessor = /*#__PURE__*/function () { /** * @param {?} _renderer * @param {?} _elementRef */ function SelectMultipleControlValueAccessor(_renderer, _elementRef) { _classCallCheck(this, SelectMultipleControlValueAccessor); this._renderer = _renderer; this._elementRef = _elementRef; /** * \@internal */ this._optionMap = new Map(); /** * \@internal */ this._idCounter = 0; /** * \@description * The registered callback function called when a change event occurs on the input element. */ this.onChange = /** * @param {?} _ * @return {?} */ function (_) {}; /** * \@description * The registered callback function called when a blur event occurs on the input element. */ this.onTouched = /** * @return {?} */ function () {}; this._compareWith = _angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵlooseIdentical"]; } /** * \@description * Tracks the option comparison algorithm for tracking identities when * checking for changes. * @param {?} fn * @return {?} */ _createClass2(SelectMultipleControlValueAccessor, [{ key: "writeValue", /** * \@description * Sets the "value" property on one or of more * of the select's options. * * @param {?} value The value * @return {?} */ value: function writeValue(value) { var _this359 = this; this.value = value; /** @type {?} */ var optionSelectedStateSetter; if (Array.isArray(value)) { // convert values to ids /** @type {?} */ var ids = value.map( /** * @param {?} v * @return {?} */ function (v) { return _this359._getOptionId(v); }); optionSelectedStateSetter = /** * @param {?} opt * @param {?} o * @return {?} */ function optionSelectedStateSetter(opt, o) { opt._setSelected(ids.indexOf(o.toString()) > -1); }; } else { optionSelectedStateSetter = /** * @param {?} opt * @param {?} o * @return {?} */ function optionSelectedStateSetter(opt, o) { opt._setSelected(false); }; } this._optionMap.forEach(optionSelectedStateSetter); } /** * \@description * Registers a function called when the control value changes * and writes an array of the selected options. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnChange", value: function registerOnChange(fn) { var _this360 = this; this.onChange = /** * @param {?} _ * @return {?} */ function (_) { /** @type {?} */ var selected = []; if (_.hasOwnProperty('selectedOptions')) { /** @type {?} */ var options = _.selectedOptions; for (var i = 0; i < options.length; i++) { /** @type {?} */ var opt = options.item(i); /** @type {?} */ var val = _this360._getOptionValue(opt.value); selected.push(val); } } // Degrade on IE else { /** @type {?} */ var _options3 = /** @type {?} */ _.options; for (var _i31 = 0; _i31 < _options3.length; _i31++) { /** @type {?} */ var _opt = _options3.item(_i31); if (_opt.selected) { /** @type {?} */ var _val = _this360._getOptionValue(_opt.value); selected.push(_val); } } } _this360.value = selected; fn(selected); }; } /** * \@description * Registers a function called when the control is touched. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnTouched", value: function registerOnTouched(fn) { this.onTouched = fn; } /** * Sets the "disabled" property on the select input element. * * @param {?} isDisabled The disabled value * @return {?} */ }, { key: "setDisabledState", value: function setDisabledState(isDisabled) { this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled); } /** * \@internal * @param {?} value * @return {?} */ }, { key: "_registerOption", value: function _registerOption(value) { /** @type {?} */ var id = (this._idCounter++).toString(); this._optionMap.set(id, value); return id; } /** * \@internal * @param {?} value * @return {?} */ }, { key: "_getOptionId", value: function _getOptionId(value) { for (var _i32 = 0, _Array$from2 = Array.from(this._optionMap.keys()); _i32 < _Array$from2.length; _i32++) { var id = _Array$from2[_i32]; if (this._compareWith( /** @type {?} */ this._optionMap.get(id)._value, value)) return id; } return null; } /** * \@internal * @param {?} valueString * @return {?} */ }, { key: "_getOptionValue", value: function _getOptionValue(valueString) { /** @type {?} */ var id = _extractId$1(valueString); return this._optionMap.has(id) ? /** @type {?} */ this._optionMap.get(id)._value : valueString; } }, { key: "compareWith", set: function set(fn) { if (typeof fn !== 'function') { throw new Error("compareWith must be a function, but received ".concat(JSON.stringify(fn))); } this._compareWith = fn; } }]); return SelectMultipleControlValueAccessor; }(); SelectMultipleControlValueAccessor.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]', host: { '(change)': 'onChange($event.target)', '(blur)': 'onTouched()' }, providers: [SELECT_MULTIPLE_VALUE_ACCESSOR] }] }]; /** @nocollapse */ SelectMultipleControlValueAccessor.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }]; }; SelectMultipleControlValueAccessor.propDecorators = { compareWith: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; if (false) {} /** * \@description * Marks `<option>` as dynamic, so Angular can be notified when options change. * * @see `SelectMultipleControlValueAccessor` * * \@ngModule ReactiveFormsModule * \@ngModule FormsModule * \@publicApi */ var ɵNgSelectMultipleOption = /*#__PURE__*/function () { /** * @param {?} _element * @param {?} _renderer * @param {?} _select */ function ɵNgSelectMultipleOption(_element, _renderer, _select) { _classCallCheck(this, ɵNgSelectMultipleOption); this._element = _element; this._renderer = _renderer; this._select = _select; if (this._select) { this.id = this._select._registerOption(this); } } /** * \@description * Tracks the value bound to the option element. Unlike the value binding, * ngValue supports binding to objects. * @param {?} value * @return {?} */ _createClass2(ɵNgSelectMultipleOption, [{ key: "_setElementValue", /** * \@internal * @param {?} value * @return {?} */ value: function _setElementValue(value) { this._renderer.setProperty(this._element.nativeElement, 'value', value); } /** * \@internal * @param {?} selected * @return {?} */ }, { key: "_setSelected", value: function _setSelected(selected) { this._renderer.setProperty(this._element.nativeElement, 'selected', selected); } /** * \@description * Lifecycle method called before the directive's instance is destroyed. For internal use only. * @return {?} */ }, { key: "ngOnDestroy", value: function ngOnDestroy() { if (this._select) { this._select._optionMap["delete"](this.id); this._select.writeValue(this._select.value); } } }, { key: "ngValue", set: function set(value) { if (this._select == null) return; this._value = value; this._setElementValue(_buildValueString$1(this.id, value)); this._select.writeValue(this._select.value); } /** * \@description * Tracks simple string values bound to the option element. * For objects, use the `ngValue` input binding. * @param {?} value * @return {?} */ }, { key: "value", set: function set(value) { if (this._select) { this._value = value; this._setElementValue(_buildValueString$1(this.id, value)); this._select.writeValue(this._select.value); } else { this._setElementValue(value); } } }]); return ɵNgSelectMultipleOption; }(); ɵNgSelectMultipleOption.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'option' }] }]; /** @nocollapse */ ɵNgSelectMultipleOption.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"] }, { type: SelectMultipleControlValueAccessor, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Host"] }] }]; }; ɵNgSelectMultipleOption.propDecorators = { ngValue: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['ngValue'] }], value: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['value'] }] }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} name * @param {?} parent * @return {?} */ function controlPath(name, parent) { return [].concat(_toConsumableArray( /** @type {?} */ parent.path), [name]); } /** * @param {?} control * @param {?} dir * @return {?} */ function setUpControl(control, dir) { if (!control) _throwError(dir, 'Cannot find control with'); if (!dir.valueAccessor) _throwError(dir, 'No value accessor for form control with'); control.validator = Validators.compose([ /** @type {?} */ control.validator, dir.validator]); control.asyncValidator = Validators.composeAsync([ /** @type {?} */ control.asyncValidator, dir.asyncValidator]); /** @type {?} */ dir.valueAccessor.writeValue(control.value); setUpViewChangePipeline(control, dir); setUpModelChangePipeline(control, dir); setUpBlurPipeline(control, dir); if ( /** @type {?} */ dir.valueAccessor.setDisabledState) { control.registerOnDisabledChange( /** * @param {?} isDisabled * @return {?} */ function (isDisabled) { /** @type {?} */ /** @type {?} */ dir.valueAccessor.setDisabledState(isDisabled); }); } // re-run validation when validator binding changes, e.g. minlength=3 -> minlength=4 dir._rawValidators.forEach( /** * @param {?} validator * @return {?} */ function (validator) { if ( /** @type {?} */ validator.registerOnValidatorChange) /** @type {?} */ /** @type {?} */ validator.registerOnValidatorChange( /** * @return {?} */ function () { return control.updateValueAndValidity(); }); }); dir._rawAsyncValidators.forEach( /** * @param {?} validator * @return {?} */ function (validator) { if ( /** @type {?} */ validator.registerOnValidatorChange) /** @type {?} */ /** @type {?} */ validator.registerOnValidatorChange( /** * @return {?} */ function () { return control.updateValueAndValidity(); }); }); } /** * @param {?} control * @param {?} dir * @return {?} */ function cleanUpControl(control, dir) { /** @type {?} */ dir.valueAccessor.registerOnChange( /** * @return {?} */ function () { return _noControlError(dir); }); /** @type {?} */ dir.valueAccessor.registerOnTouched( /** * @return {?} */ function () { return _noControlError(dir); }); dir._rawValidators.forEach( /** * @param {?} validator * @return {?} */ function (validator) { if (validator.registerOnValidatorChange) { validator.registerOnValidatorChange(null); } }); dir._rawAsyncValidators.forEach( /** * @param {?} validator * @return {?} */ function (validator) { if (validator.registerOnValidatorChange) { validator.registerOnValidatorChange(null); } }); if (control) control._clearChangeFns(); } /** * @param {?} control * @param {?} dir * @return {?} */ function setUpViewChangePipeline(control, dir) { /** @type {?} */ dir.valueAccessor.registerOnChange( /** * @param {?} newValue * @return {?} */ function (newValue) { control._pendingValue = newValue; control._pendingChange = true; control._pendingDirty = true; if (control.updateOn === 'change') updateControl(control, dir); }); } /** * @param {?} control * @param {?} dir * @return {?} */ function setUpBlurPipeline(control, dir) { /** @type {?} */ dir.valueAccessor.registerOnTouched( /** * @return {?} */ function () { control._pendingTouched = true; if (control.updateOn === 'blur' && control._pendingChange) updateControl(control, dir); if (control.updateOn !== 'submit') control.markAsTouched(); }); } /** * @param {?} control * @param {?} dir * @return {?} */ function updateControl(control, dir) { if (control._pendingDirty) control.markAsDirty(); control.setValue(control._pendingValue, { emitModelToViewChange: false }); dir.viewToModelUpdate(control._pendingValue); control._pendingChange = false; } /** * @param {?} control * @param {?} dir * @return {?} */ function setUpModelChangePipeline(control, dir) { control.registerOnChange( /** * @param {?} newValue * @param {?} emitModelEvent * @return {?} */ function (newValue, emitModelEvent) { // control -> view /** @type {?} */ dir.valueAccessor.writeValue(newValue); // control -> ngModel if (emitModelEvent) dir.viewToModelUpdate(newValue); }); } /** * @param {?} control * @param {?} dir * @return {?} */ function setUpFormContainer(control, dir) { if (control == null) _throwError(dir, 'Cannot find control with'); control.validator = Validators.compose([control.validator, dir.validator]); control.asyncValidator = Validators.composeAsync([control.asyncValidator, dir.asyncValidator]); } /** * @param {?} dir * @return {?} */ function _noControlError(dir) { return _throwError(dir, 'There is no FormControl instance attached to form control element with'); } /** * @param {?} dir * @param {?} message * @return {?} */ function _throwError(dir, message) { /** @type {?} */ var messageEnd; if ( /** @type {?} */ dir.path.length > 1) { messageEnd = "path: '".concat( /** @type {?} */ dir.path.join(' -> '), "'"); } else if ( /** @type {?} */ dir.path[0]) { messageEnd = "name: '".concat(dir.path, "'"); } else { messageEnd = 'unspecified name attribute'; } throw new Error("".concat(message, " ").concat(messageEnd)); } /** * @param {?} validators * @return {?} */ function composeValidators(validators) { return validators != null ? Validators.compose(validators.map(normalizeValidator)) : null; } /** * @param {?} validators * @return {?} */ function composeAsyncValidators(validators) { return validators != null ? Validators.composeAsync(validators.map(normalizeAsyncValidator)) : null; } /** * @param {?} changes * @param {?} viewModel * @return {?} */ function isPropertyUpdated(changes, viewModel) { if (!changes.hasOwnProperty('model')) return false; /** @type {?} */ var change = changes['model']; if (change.isFirstChange()) return true; return !Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵlooseIdentical"])(viewModel, change.currentValue); } /** @type {?} */ var BUILTIN_ACCESSORS = [CheckboxControlValueAccessor, RangeValueAccessor, NumberValueAccessor, SelectControlValueAccessor, SelectMultipleControlValueAccessor, RadioControlValueAccessor]; /** * @param {?} valueAccessor * @return {?} */ function isBuiltInAccessor(valueAccessor) { return BUILTIN_ACCESSORS.some( /** * @param {?} a * @return {?} */ function (a) { return valueAccessor.constructor === a; }); } /** * @param {?} form * @param {?} directives * @return {?} */ function syncPendingControls(form, directives) { form._syncPendingControls(); directives.forEach( /** * @param {?} dir * @return {?} */ function (dir) { /** @type {?} */ var control = /** @type {?} */ dir.control; if (control.updateOn === 'submit' && control._pendingChange) { dir.viewToModelUpdate(control._pendingValue); control._pendingChange = false; } }); } // TODO: vsavkin remove it once https://github.com/angular/angular/issues/3011 is implemented /** * @param {?} dir * @param {?} valueAccessors * @return {?} */ function selectValueAccessor(dir, valueAccessors) { if (!valueAccessors) return null; if (!Array.isArray(valueAccessors)) _throwError(dir, 'Value accessor was not provided as an array for form control with'); /** @type {?} */ var defaultAccessor = undefined; /** @type {?} */ var builtinAccessor = undefined; /** @type {?} */ var customAccessor = undefined; valueAccessors.forEach( /** * @param {?} v * @return {?} */ function (v) { if (v.constructor === DefaultValueAccessor) { defaultAccessor = v; } else if (isBuiltInAccessor(v)) { if (builtinAccessor) _throwError(dir, 'More than one built-in value accessor matches form control with'); builtinAccessor = v; } else { if (customAccessor) _throwError(dir, 'More than one custom value accessor matches form control with'); customAccessor = v; } }); if (customAccessor) return customAccessor; if (builtinAccessor) return builtinAccessor; if (defaultAccessor) return defaultAccessor; _throwError(dir, 'No valid value accessor for form control with'); return null; } /** * @template T * @param {?} list * @param {?} el * @return {?} */ function removeDir(list, el) { /** @type {?} */ var index = list.indexOf(el); if (index > -1) list.splice(index, 1); } // TODO(kara): remove after deprecation period /** * @param {?} name * @param {?} type * @param {?} instance * @param {?} warningConfig * @return {?} */ function _ngModelWarning(name, type, instance, warningConfig) { if (!Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["isDevMode"])() || warningConfig === 'never') return; if ((warningConfig === null || warningConfig === 'once') && !type._ngModelWarningSentOnce || warningConfig === 'always' && !instance._ngModelWarningSent) { ReactiveErrors.ngModelWarning(name); type._ngModelWarningSentOnce = true; instance._ngModelWarningSent = true; } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Reports that a FormControl is valid, meaning that no errors exist in the input value. * * @see `status` * @type {?} */ var VALID = 'VALID'; /** * Reports that a FormControl is invalid, meaning that an error exists in the input value. * * @see `status` * @type {?} */ var INVALID = 'INVALID'; /** * Reports that a FormControl is pending, meaning that that async validation is occurring and * errors are not yet available for the input value. * * @see `markAsPending` * @see `status` * @type {?} */ var PENDING = 'PENDING'; /** * Reports that a FormControl is disabled, meaning that the control is exempt from ancestor * calculations of validity or value. * * @see `markAsDisabled` * @see `status` * @type {?} */ var DISABLED = 'DISABLED'; /** * @param {?} control * @param {?} path * @param {?} delimiter * @return {?} */ function _find(control, path, delimiter) { if (path == null) return null; if (!(path instanceof Array)) { path = /** @type {?} */ path.split(delimiter); } if (path instanceof Array && path.length === 0) return null; return ( /** @type {?} */ path.reduce( /** * @param {?} v * @param {?} name * @return {?} */ function (v, name) { if (v instanceof FormGroup) { return v.controls.hasOwnProperty( /** @type {?} */ name) ? v.controls[name] : null; } if (v instanceof FormArray) { return v.at( /** @type {?} */ name) || null; } return null; }, control) ); } /** * @param {?=} validatorOrOpts * @return {?} */ function coerceToValidator(validatorOrOpts) { /** @type {?} */ var validator = /** @type {?} */ isOptionsObj(validatorOrOpts) ? /** @type {?} */ validatorOrOpts.validators : validatorOrOpts; return Array.isArray(validator) ? composeValidators(validator) : validator || null; } /** * @param {?=} asyncValidator * @param {?=} validatorOrOpts * @return {?} */ function coerceToAsyncValidator(asyncValidator, validatorOrOpts) { /** @type {?} */ var origAsyncValidator = /** @type {?} */ isOptionsObj(validatorOrOpts) ? /** @type {?} */ validatorOrOpts.asyncValidators : asyncValidator; return Array.isArray(origAsyncValidator) ? composeAsyncValidators(origAsyncValidator) : origAsyncValidator || null; } /** * Interface for options provided to an `AbstractControl`. * * \@publicApi * @record */ function AbstractControlOptions() {} if (false) {} /** * @param {?=} validatorOrOpts * @return {?} */ function isOptionsObj(validatorOrOpts) { return validatorOrOpts != null && !Array.isArray(validatorOrOpts) && typeof validatorOrOpts === 'object'; } /** * This is the base class for `FormControl`, `FormGroup`, and `FormArray`. * * It provides some of the shared behavior that all controls and groups of controls have, like * running validators, calculating status, and resetting state. It also defines the properties * that are shared between all sub-classes, like `value`, `valid`, and `dirty`. It shouldn't be * instantiated directly. * * @see [Forms Guide](/guide/forms) * @see [Reactive Forms Guide](/guide/reactive-forms) * @see [Dynamic Forms Guide](/guide/dynamic-form) * * \@publicApi * @abstract */ var AbstractControl = /*#__PURE__*/function () { /** * Initialize the AbstractControl instance. * * @param {?} validator The function that determines the synchronous validity of this control. * @param {?} asyncValidator The function that determines the asynchronous validity of this * control. */ function AbstractControl(validator, asyncValidator) { _classCallCheck(this, AbstractControl); this.validator = validator; this.asyncValidator = asyncValidator; /** * \@internal */ this._onCollectionChange = /** * @return {?} */ function () {}; /** * A control is `pristine` if the user has not yet changed * the value in the UI. * * @return True if the user has not yet changed the value in the UI; compare `dirty`. * Programmatic changes to a control's value do not mark it dirty. */ this.pristine = true; /** * True if the control is marked as `touched`. * * A control is marked `touched` once the user has triggered * a `blur` event on it. */ this.touched = false; /** * \@internal */ this._onDisabledChange = []; } /** * The parent control. * @return {?} */ _createClass2(AbstractControl, [{ key: "setValidators", /** * Sets the synchronous validators that are active on this control. Calling * this overwrites any existing sync validators. * * When you add or remove a validator at run time, you must call * `updateValueAndValidity()` for the new validation to take effect. * * @param {?} newValidator * @return {?} */ value: function setValidators(newValidator) { this.validator = coerceToValidator(newValidator); } /** * Sets the async validators that are active on this control. Calling this * overwrites any existing async validators. * * When you add or remove a validator at run time, you must call * `updateValueAndValidity()` for the new validation to take effect. * * @param {?} newValidator * @return {?} */ }, { key: "setAsyncValidators", value: function setAsyncValidators(newValidator) { this.asyncValidator = coerceToAsyncValidator(newValidator); } /** * Empties out the sync validator list. * * When you add or remove a validator at run time, you must call * `updateValueAndValidity()` for the new validation to take effect. * * @return {?} */ }, { key: "clearValidators", value: function clearValidators() { this.validator = null; } /** * Empties out the async validator list. * * When you add or remove a validator at run time, you must call * `updateValueAndValidity()` for the new validation to take effect. * * @return {?} */ }, { key: "clearAsyncValidators", value: function clearAsyncValidators() { this.asyncValidator = null; } /** * Marks the control as `touched`. A control is touched by focus and * blur events that do not change the value. * * @see `markAsUntouched()` / `markAsDirty()` / `markAsPristine()` * * @param {?=} opts Configuration options that determine how the control propagates changes * and emits events events after marking is applied. * * `onlySelf`: When true, mark only this control. When false or not supplied, * marks all direct ancestors. Default is false. * @return {?} */ }, { key: "markAsTouched", value: function markAsTouched() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; /** @type {?} */ this.touched = true; if (this._parent && !opts.onlySelf) { this._parent.markAsTouched(opts); } } /** * Marks the control and all its descendant controls as `touched`. * @see `markAsTouched()` * @return {?} */ }, { key: "markAllAsTouched", value: function markAllAsTouched() { this.markAsTouched({ onlySelf: true }); this._forEachChild( /** * @param {?} control * @return {?} */ function (control) { return control.markAllAsTouched(); }); } /** * Marks the control as `untouched`. * * If the control has any children, also marks all children as `untouched` * and recalculates the `touched` status of all parent controls. * * @see `markAsTouched()` / `markAsDirty()` / `markAsPristine()` * * @param {?=} opts Configuration options that determine how the control propagates changes * and emits events after the marking is applied. * * `onlySelf`: When true, mark only this control. When false or not supplied, * marks all direct ancestors. Default is false. * @return {?} */ }, { key: "markAsUntouched", value: function markAsUntouched() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; /** @type {?} */ this.touched = false; this._pendingTouched = false; this._forEachChild( /** * @param {?} control * @return {?} */ function (control) { control.markAsUntouched({ onlySelf: true }); }); if (this._parent && !opts.onlySelf) { this._parent._updateTouched(opts); } } /** * Marks the control as `dirty`. A control becomes dirty when * the control's value is changed through the UI; compare `markAsTouched`. * * @see `markAsTouched()` / `markAsUntouched()` / `markAsPristine()` * * @param {?=} opts Configuration options that determine how the control propagates changes * and emits events after marking is applied. * * `onlySelf`: When true, mark only this control. When false or not supplied, * marks all direct ancestors. Default is false. * @return {?} */ }, { key: "markAsDirty", value: function markAsDirty() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; /** @type {?} */ this.pristine = false; if (this._parent && !opts.onlySelf) { this._parent.markAsDirty(opts); } } /** * Marks the control as `pristine`. * * If the control has any children, marks all children as `pristine`, * and recalculates the `pristine` status of all parent * controls. * * @see `markAsTouched()` / `markAsUntouched()` / `markAsDirty()` * * @param {?=} opts Configuration options that determine how the control emits events after * marking is applied. * * `onlySelf`: When true, mark only this control. When false or not supplied, * marks all direct ancestors. Default is false.. * @return {?} */ }, { key: "markAsPristine", value: function markAsPristine() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; /** @type {?} */ this.pristine = true; this._pendingDirty = false; this._forEachChild( /** * @param {?} control * @return {?} */ function (control) { control.markAsPristine({ onlySelf: true }); }); if (this._parent && !opts.onlySelf) { this._parent._updatePristine(opts); } } /** * Marks the control as `pending`. * * A control is pending while the control performs async validation. * * @see {\@link AbstractControl.status} * * @param {?=} opts Configuration options that determine how the control propagates changes and * emits events after marking is applied. * * `onlySelf`: When true, mark only this control. When false or not supplied, * marks all direct ancestors. Default is false.. * * `emitEvent`: When true or not supplied (the default), the `statusChanges` * observable emits an event with the latest status the control is marked pending. * When false, no events are emitted. * * @return {?} */ }, { key: "markAsPending", value: function markAsPending() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; /** @type {?} */ this.status = PENDING; if (opts.emitEvent !== false) { /** @type {?} */ this.statusChanges.emit(this.status); } if (this._parent && !opts.onlySelf) { this._parent.markAsPending(opts); } } /** * Disables the control. This means the control is exempt from validation checks and * excluded from the aggregate value of any parent. Its status is `DISABLED`. * * If the control has children, all children are also disabled. * * @see {\@link AbstractControl.status} * * @param {?=} opts Configuration options that determine how the control propagates * changes and emits events after the control is disabled. * * `onlySelf`: When true, mark only this control. When false or not supplied, * marks all direct ancestors. Default is false.. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and * `valueChanges` * observables emit events with the latest status and value when the control is disabled. * When false, no events are emitted. * @return {?} */ }, { key: "disable", value: function disable() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; // If parent has been marked artificially dirty we don't want to re-calculate the // parent's dirtiness based on the children. /** @type {?} */ var skipPristineCheck = this._parentMarkedDirty(opts.onlySelf); /** @type {?} */ this.status = DISABLED; /** @type {?} */ this.errors = null; this._forEachChild( /** * @param {?} control * @return {?} */ function (control) { control.disable(Object.assign({}, opts, { onlySelf: true })); }); this._updateValue(); if (opts.emitEvent !== false) { /** @type {?} */ this.valueChanges.emit(this.value); /** @type {?} */ this.statusChanges.emit(this.status); } this._updateAncestors(Object.assign({}, opts, { skipPristineCheck: skipPristineCheck })); this._onDisabledChange.forEach( /** * @param {?} changeFn * @return {?} */ function (changeFn) { return changeFn(true); }); } /** * Enables the control. This means the control is included in validation checks and * the aggregate value of its parent. Its status recalculates based on its value and * its validators. * * By default, if the control has children, all children are enabled. * * @see {\@link AbstractControl.status} * * @param {?=} opts Configure options that control how the control propagates changes and * emits events when marked as untouched * * `onlySelf`: When true, mark only this control. When false or not supplied, * marks all direct ancestors. Default is false.. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and * `valueChanges` * observables emit events with the latest status and value when the control is enabled. * When false, no events are emitted. * @return {?} */ }, { key: "enable", value: function enable() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; // If parent has been marked artificially dirty we don't want to re-calculate the // parent's dirtiness based on the children. /** @type {?} */ var skipPristineCheck = this._parentMarkedDirty(opts.onlySelf); /** @type {?} */ this.status = VALID; this._forEachChild( /** * @param {?} control * @return {?} */ function (control) { control.enable(Object.assign({}, opts, { onlySelf: true })); }); this.updateValueAndValidity({ onlySelf: true, emitEvent: opts.emitEvent }); this._updateAncestors(Object.assign({}, opts, { skipPristineCheck: skipPristineCheck })); this._onDisabledChange.forEach( /** * @param {?} changeFn * @return {?} */ function (changeFn) { return changeFn(false); }); } /** * @private * @param {?} opts * @return {?} */ }, { key: "_updateAncestors", value: function _updateAncestors(opts) { if (this._parent && !opts.onlySelf) { this._parent.updateValueAndValidity(opts); if (!opts.skipPristineCheck) { this._parent._updatePristine(); } this._parent._updateTouched(); } } /** * @param {?} parent Sets the parent of the control * @return {?} */ }, { key: "setParent", value: function setParent(parent) { this._parent = parent; } /** * Recalculates the value and validation status of the control. * * By default, it also updates the value and validity of its ancestors. * * @param {?=} opts Configuration options determine how the control propagates changes and emits events * after updates and validity checks are applied. * * `onlySelf`: When true, only update this control. When false or not supplied, * update all direct ancestors. Default is false.. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and * `valueChanges` * observables emit events with the latest status and value when the control is updated. * When false, no events are emitted. * @return {?} */ }, { key: "updateValueAndValidity", value: function updateValueAndValidity() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; this._setInitialStatus(); this._updateValue(); if (this.enabled) { this._cancelExistingSubscription(); /** @type {?} */ this.errors = this._runValidator(); /** @type {?} */ this.status = this._calculateStatus(); if (this.status === VALID || this.status === PENDING) { this._runAsyncValidator(opts.emitEvent); } } if (opts.emitEvent !== false) { /** @type {?} */ this.valueChanges.emit(this.value); /** @type {?} */ this.statusChanges.emit(this.status); } if (this._parent && !opts.onlySelf) { this._parent.updateValueAndValidity(opts); } } /** * \@internal * @param {?=} opts * @return {?} */ }, { key: "_updateTreeValidity", value: function _updateTreeValidity() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { emitEvent: true }; this._forEachChild( /** * @param {?} ctrl * @return {?} */ function (ctrl) { return ctrl._updateTreeValidity(opts); }); this.updateValueAndValidity({ onlySelf: true, emitEvent: opts.emitEvent }); } /** * @private * @return {?} */ }, { key: "_setInitialStatus", value: function _setInitialStatus() { /** @type {?} */ this.status = this._allControlsDisabled() ? DISABLED : VALID; } /** * @private * @return {?} */ }, { key: "_runValidator", value: function _runValidator() { return this.validator ? this.validator(this) : null; } /** * @private * @param {?=} emitEvent * @return {?} */ }, { key: "_runAsyncValidator", value: function _runAsyncValidator(emitEvent) { var _this361 = this; if (this.asyncValidator) { /** @type {?} */ this.status = PENDING; /** @type {?} */ var obs = toObservable(this.asyncValidator(this)); this._asyncValidationSubscription = obs.subscribe( /** * @param {?} errors * @return {?} */ function (errors) { return _this361.setErrors(errors, { emitEvent: emitEvent }); }); } } /** * @private * @return {?} */ }, { key: "_cancelExistingSubscription", value: function _cancelExistingSubscription() { if (this._asyncValidationSubscription) { this._asyncValidationSubscription.unsubscribe(); } } /** * Sets errors on a form control when running validations manually, rather than automatically. * * Calling `setErrors` also updates the validity of the parent control. * * \@usageNotes * ### Manually set the errors for a control * * ``` * const login = new FormControl('someLogin'); * login.setErrors({ * notUnique: true * }); * * expect(login.valid).toEqual(false); * expect(login.errors).toEqual({ notUnique: true }); * * login.setValue('someOtherLogin'); * * expect(login.valid).toEqual(true); * ``` * @param {?} errors * @param {?=} opts * @return {?} */ }, { key: "setErrors", value: function setErrors(errors) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; /** @type {?} */ this.errors = errors; this._updateControlsErrors(opts.emitEvent !== false); } /** * Retrieves a child control given the control's name or path. * * \@usageNotes * ### Retrieve a nested control * * For example, to get a `name` control nested within a `person` sub-group: * * * `this.form.get('person.name');` * * -OR- * * * `this.form.get(['person', 'name']);` * @param {?} path A dot-delimited string or array of string/number values that define the path to the * control. * * @return {?} */ }, { key: "get", value: function get(path) { return _find(this, path, '.'); } /** * \@description * Reports error data for the control with the given path. * * \@usageNotes * For example, for the following `FormGroup`: * * ``` * form = new FormGroup({ * address: new FormGroup({ street: new FormControl() }) * }); * ``` * * The path to the 'street' control from the root form would be 'address' -> 'street'. * * It can be provided to this method in one of two formats: * * 1. An array of string control names, e.g. `['address', 'street']` * 1. A period-delimited list of control names in one string, e.g. `'address.street'` * * @param {?} errorCode The code of the error to check * @param {?=} path A list of control names that designates how to move from the current control * to the control that should be queried for errors. * * @return {?} error data for that particular error. If the control or error is not present, * null is returned. */ }, { key: "getError", value: function getError(errorCode, path) { /** @type {?} */ var control = path ? this.get(path) : this; return control && control.errors ? control.errors[errorCode] : null; } /** * \@description * Reports whether the control with the given path has the error specified. * * \@usageNotes * For example, for the following `FormGroup`: * * ``` * form = new FormGroup({ * address: new FormGroup({ street: new FormControl() }) * }); * ``` * * The path to the 'street' control from the root form would be 'address' -> 'street'. * * It can be provided to this method in one of two formats: * * 1. An array of string control names, e.g. `['address', 'street']` * 1. A period-delimited list of control names in one string, e.g. `'address.street'` * * If no path is given, this method checks for the error on the current control. * * @param {?} errorCode The code of the error to check * @param {?=} path A list of control names that designates how to move from the current control * to the control that should be queried for errors. * * @return {?} whether the given error is present in the control at the given path. * * If the control is not present, false is returned. */ }, { key: "hasError", value: function hasError(errorCode, path) { return !!this.getError(errorCode, path); } /** * Retrieves the top-level ancestor of this control. * @return {?} */ }, { key: "_updateControlsErrors", /** * \@internal * @param {?} emitEvent * @return {?} */ value: function _updateControlsErrors(emitEvent) { /** @type {?} */ this.status = this._calculateStatus(); if (emitEvent) { /** @type {?} */ this.statusChanges.emit(this.status); } if (this._parent) { this._parent._updateControlsErrors(emitEvent); } } /** * \@internal * @return {?} */ }, { key: "_initObservables", value: function _initObservables() { /** @type {?} */ this.valueChanges = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** @type {?} */ this.statusChanges = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); } /** * @private * @return {?} */ }, { key: "_calculateStatus", value: function _calculateStatus() { if (this._allControlsDisabled()) return DISABLED; if (this.errors) return INVALID; if (this._anyControlsHaveStatus(PENDING)) return PENDING; if (this._anyControlsHaveStatus(INVALID)) return INVALID; return VALID; } /** * \@internal * @param {?} status * @return {?} */ }, { key: "_anyControlsHaveStatus", value: function _anyControlsHaveStatus(status) { return this._anyControls( /** * @param {?} control * @return {?} */ function (control) { return control.status === status; }); } /** * \@internal * @return {?} */ }, { key: "_anyControlsDirty", value: function _anyControlsDirty() { return this._anyControls( /** * @param {?} control * @return {?} */ function (control) { return control.dirty; }); } /** * \@internal * @return {?} */ }, { key: "_anyControlsTouched", value: function _anyControlsTouched() { return this._anyControls( /** * @param {?} control * @return {?} */ function (control) { return control.touched; }); } /** * \@internal * @param {?=} opts * @return {?} */ }, { key: "_updatePristine", value: function _updatePristine() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; /** @type {?} */ this.pristine = !this._anyControlsDirty(); if (this._parent && !opts.onlySelf) { this._parent._updatePristine(opts); } } /** * \@internal * @param {?=} opts * @return {?} */ }, { key: "_updateTouched", value: function _updateTouched() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; /** @type {?} */ this.touched = this._anyControlsTouched(); if (this._parent && !opts.onlySelf) { this._parent._updateTouched(opts); } } /** * \@internal * @param {?} formState * @return {?} */ }, { key: "_isBoxedValue", value: function _isBoxedValue(formState) { return typeof formState === 'object' && formState !== null && Object.keys(formState).length === 2 && 'value' in formState && 'disabled' in formState; } /** * \@internal * @param {?} fn * @return {?} */ }, { key: "_registerOnCollectionChange", value: function _registerOnCollectionChange(fn) { this._onCollectionChange = fn; } /** * \@internal * @param {?=} opts * @return {?} */ }, { key: "_setUpdateStrategy", value: function _setUpdateStrategy(opts) { if (isOptionsObj(opts) && /** @type {?} */ opts.updateOn != null) { this._updateOn = /** @type {?} */ /** @type {?} */ opts.updateOn; } } /** * Check to see if parent has been marked artificially dirty. * * \@internal * @private * @param {?=} onlySelf * @return {?} */ }, { key: "_parentMarkedDirty", value: function _parentMarkedDirty(onlySelf) { /** @type {?} */ var parentDirty = this._parent && this._parent.dirty; return !onlySelf && parentDirty && !this._parent._anyControlsDirty(); } }, { key: "parent", get: function get() { return this._parent; } /** * A control is `valid` when its `status` is `VALID`. * * @see {\@link AbstractControl.status} * * @return {?} True if the control has passed all of its validation tests, * false otherwise. */ }, { key: "valid", get: function get() { return this.status === VALID; } /** * A control is `invalid` when its `status` is `INVALID`. * * @see {\@link AbstractControl.status} * * @return {?} True if this control has failed one or more of its validation checks, * false otherwise. */ }, { key: "invalid", get: function get() { return this.status === INVALID; } /** * A control is `pending` when its `status` is `PENDING`. * * @see {\@link AbstractControl.status} * * @return {?} True if this control is in the process of conducting a validation check, * false otherwise. */ }, { key: "pending", get: function get() { return this.status == PENDING; } /** * A control is `disabled` when its `status` is `DISABLED`. * * Disabled controls are exempt from validation checks and * are not included in the aggregate value of their ancestor * controls. * * @see {\@link AbstractControl.status} * * @return {?} True if the control is disabled, false otherwise. */ }, { key: "disabled", get: function get() { return this.status === DISABLED; } /** * A control is `enabled` as long as its `status` is not `DISABLED`. * * @see {\@link AbstractControl.status} * * @return {?} True if the control has any status other than 'DISABLED', * false if the status is 'DISABLED'. * */ }, { key: "enabled", get: function get() { return this.status !== DISABLED; } /** * A control is `dirty` if the user has changed the value * in the UI. * * @return {?} True if the user has changed the value of this control in the UI; compare `pristine`. * Programmatic changes to a control's value do not mark it dirty. */ }, { key: "dirty", get: function get() { return !this.pristine; } /** * True if the control has not been marked as touched * * A control is `untouched` if the user has not yet triggered * a `blur` event on it. * @return {?} */ }, { key: "untouched", get: function get() { return !this.touched; } /** * Reports the update strategy of the `AbstractControl` (meaning * the event on which the control updates itself). * Possible values: `'change'` | `'blur'` | `'submit'` * Default value: `'change'` * @return {?} */ }, { key: "updateOn", get: function get() { return this._updateOn ? this._updateOn : this.parent ? this.parent.updateOn : 'change'; } }, { key: "root", get: function get() { /** @type {?} */ var x = this; while (x._parent) { x = x._parent; } return x; } }]); return AbstractControl; }(); if (false) {} /** * Tracks the value and validation status of an individual form control. * * This is one of the three fundamental building blocks of Angular forms, along with * `FormGroup` and `FormArray`. It extends the `AbstractControl` class that * implements most of the base functionality for accessing the value, validation status, * user interactions and events. * * @see `AbstractControl` * @see [Reactive Forms Guide](guide/reactive-forms) * @see [Usage Notes](#usage-notes) * * \@usageNotes * * ### Initializing Form Controls * * Instantiate a `FormControl`, with an initial value. * * ```ts * const control = new FormControl('some value'); * console.log(control.value); // 'some value' * ``` * * The following example initializes the control with a form state object. The `value` * and `disabled` keys are required in this case. * * ```ts * const control = new FormControl({ value: 'n/a', disabled: true }); * console.log(control.value); // 'n/a' * console.log(control.status); // 'DISABLED' * ``` * * The following example initializes the control with a sync validator. * * ```ts * const control = new FormControl('', Validators.required); * console.log(control.value); // '' * console.log(control.status); // 'INVALID' * ``` * * The following example initializes the control using an options object. * * ```ts * const control = new FormControl('', { * validators: Validators.required, * asyncValidators: myAsyncValidator * }); * ``` * * ### Configure the control to update on a blur event * * Set the `updateOn` option to `'blur'` to update on the blur `event`. * * ```ts * const control = new FormControl('', { updateOn: 'blur' }); * ``` * * ### Configure the control to update on a submit event * * Set the `updateOn` option to `'submit'` to update on a submit `event`. * * ```ts * const control = new FormControl('', { updateOn: 'submit' }); * ``` * * ### Reset the control back to an initial value * * You reset to a specific form state by passing through a standalone * value or a form state object that contains both a value and a disabled state * (these are the only two properties that cannot be calculated). * * ```ts * const control = new FormControl('Nancy'); * * console.log(control.value); // 'Nancy' * * control.reset('Drew'); * * console.log(control.value); // 'Drew' * ``` * * ### Reset the control back to an initial value and disabled * * ``` * const control = new FormControl('Nancy'); * * console.log(control.value); // 'Nancy' * console.log(control.status); // 'VALID' * * control.reset({ value: 'Drew', disabled: true }); * * console.log(control.value); // 'Drew' * console.log(control.status); // 'DISABLED' * ``` * * \@publicApi */ var FormControl = /*#__PURE__*/function (_AbstractControl) { _inherits(FormControl, _AbstractControl); var _super130 = _createSuper(FormControl); /** * Creates a new `FormControl` instance. * * @param {?=} formState Initializes the control with an initial value, * or an object that defines the initial value and disabled state. * * @param {?=} validatorOrOpts A synchronous validator function, or an array of * such functions, or an `AbstractControlOptions` object that contains validation functions * and a validation trigger. * * @param {?=} asyncValidator A single async validator or array of async validator functions * */ function FormControl() { var _this362; var formState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var validatorOrOpts = arguments.length > 1 ? arguments[1] : undefined; var asyncValidator = arguments.length > 2 ? arguments[2] : undefined; _classCallCheck(this, FormControl); _this362 = _super130.call(this, coerceToValidator(validatorOrOpts), coerceToAsyncValidator(asyncValidator, validatorOrOpts)); /** * \@internal */ _this362._onChange = []; _this362._applyFormState(formState); _this362._setUpdateStrategy(validatorOrOpts); _this362.updateValueAndValidity({ onlySelf: true, emitEvent: false }); _this362._initObservables(); return _this362; } /** * Sets a new value for the form control. * * @param {?} value The new value for the control. * @param {?=} options Configuration options that determine how the control propagates changes * and emits events when the value changes. * The configuration options are passed to the {\@link AbstractControl#updateValueAndValidity * updateValueAndValidity} method. * * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is * false. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and * `valueChanges` * observables emit events with the latest status and value when the control value is updated. * When false, no events are emitted. * * `emitModelToViewChange`: When true or not supplied (the default), each change triggers an * `onChange` event to * update the view. * * `emitViewToModelChange`: When true or not supplied (the default), each change triggers an * `ngModelChange` * event to update the model. * * @return {?} */ _createClass2(FormControl, [{ key: "setValue", value: function setValue(value) { var _this363 = this; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; /** @type {?} */ this.value = this._pendingValue = value; if (this._onChange.length && options.emitModelToViewChange !== false) { this._onChange.forEach( /** * @param {?} changeFn * @return {?} */ function (changeFn) { return changeFn(_this363.value, options.emitViewToModelChange !== false); }); } this.updateValueAndValidity(options); } /** * Patches the value of a control. * * This function is functionally the same as {\@link FormControl#setValue setValue} at this level. * It exists for symmetry with {\@link FormGroup#patchValue patchValue} on `FormGroups` and * `FormArrays`, where it does behave differently. * * @see `setValue` for options * @param {?} value * @param {?=} options * @return {?} */ }, { key: "patchValue", value: function patchValue(value) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; this.setValue(value, options); } /** * Resets the form control, marking it `pristine` and `untouched`, and setting * the value to null. * * @param {?=} formState Resets the control with an initial value, * or an object that defines the initial value and disabled state. * * @param {?=} options Configuration options that determine how the control propagates changes * and emits events after the value changes. * * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is * false. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and * `valueChanges` * observables emit events with the latest status and value when the control is reset. * When false, no events are emitted. * * @return {?} */ }, { key: "reset", value: function reset() { var formState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; this._applyFormState(formState); this.markAsPristine(options); this.markAsUntouched(options); this.setValue(this.value, options); this._pendingChange = false; } /** * \@internal * @return {?} */ }, { key: "_updateValue", value: function _updateValue() {} /** * \@internal * @param {?} condition * @return {?} */ }, { key: "_anyControls", value: function _anyControls(condition) { return false; } /** * \@internal * @return {?} */ }, { key: "_allControlsDisabled", value: function _allControlsDisabled() { return this.disabled; } /** * Register a listener for change events. * * @param {?} fn The method that is called when the value changes * @return {?} */ }, { key: "registerOnChange", value: function registerOnChange(fn) { this._onChange.push(fn); } /** * \@internal * @return {?} */ }, { key: "_clearChangeFns", value: function _clearChangeFns() { this._onChange = []; this._onDisabledChange = []; this._onCollectionChange = /** * @return {?} */ function () {}; } /** * Register a listener for disabled events. * * @param {?} fn The method that is called when the disabled status changes. * @return {?} */ }, { key: "registerOnDisabledChange", value: function registerOnDisabledChange(fn) { this._onDisabledChange.push(fn); } /** * \@internal * @param {?} cb * @return {?} */ }, { key: "_forEachChild", value: function _forEachChild(cb) {} /** * \@internal * @return {?} */ }, { key: "_syncPendingControls", value: function _syncPendingControls() { if (this.updateOn === 'submit') { if (this._pendingDirty) this.markAsDirty(); if (this._pendingTouched) this.markAsTouched(); if (this._pendingChange) { this.setValue(this._pendingValue, { onlySelf: true, emitModelToViewChange: false }); return true; } } return false; } /** * @private * @param {?} formState * @return {?} */ }, { key: "_applyFormState", value: function _applyFormState(formState) { if (this._isBoxedValue(formState)) { /** @type {?} */ this.value = this._pendingValue = formState.value; formState.disabled ? this.disable({ onlySelf: true, emitEvent: false }) : this.enable({ onlySelf: true, emitEvent: false }); } else { /** @type {?} */ this.value = this._pendingValue = formState; } } }]); return FormControl; }(AbstractControl); if (false) {} /** * Tracks the value and validity state of a group of `FormControl` instances. * * A `FormGroup` aggregates the values of each child `FormControl` into one object, * with each control name as the key. It calculates its status by reducing the status values * of its children. For example, if one of the controls in a group is invalid, the entire * group becomes invalid. * * `FormGroup` is one of the three fundamental building blocks used to define forms in Angular, * along with `FormControl` and `FormArray`. * * When instantiating a `FormGroup`, pass in a collection of child controls as the first * argument. The key for each child registers the name for the control. * * \@usageNotes * * ### Create a form group with 2 controls * * ``` * const form = new FormGroup({ * first: new FormControl('Nancy', Validators.minLength(2)), * last: new FormControl('Drew'), * }); * * console.log(form.value); // {first: 'Nancy', last; 'Drew'} * console.log(form.status); // 'VALID' * ``` * * ### Create a form group with a group-level validator * * You include group-level validators as the second arg, or group-level async * validators as the third arg. These come in handy when you want to perform validation * that considers the value of more than one child control. * * ``` * const form = new FormGroup({ * password: new FormControl('', Validators.minLength(2)), * passwordConfirm: new FormControl('', Validators.minLength(2)), * }, passwordMatchValidator); * * * function passwordMatchValidator(g: FormGroup) { * return g.get('password').value === g.get('passwordConfirm').value * ? null : {'mismatch': true}; * } * ``` * * Like `FormControl` instances, you choose to pass in * validators and async validators as part of an options object. * * ``` * const form = new FormGroup({ * password: new FormControl('') * passwordConfirm: new FormControl('') * }, { validators: passwordMatchValidator, asyncValidators: otherValidator }); * ``` * * ### Set the updateOn property for all controls in a form group * * The options object is used to set a default value for each child * control's `updateOn` property. If you set `updateOn` to `'blur'` at the * group level, all child controls default to 'blur', unless the child * has explicitly specified a different `updateOn` value. * * ```ts * const c = new FormGroup({ * one: new FormControl() * }, { updateOn: 'blur' }); * ``` * * \@publicApi */ var FormGroup = /*#__PURE__*/function (_AbstractControl2) { _inherits(FormGroup, _AbstractControl2); var _super131 = _createSuper(FormGroup); /** * Creates a new `FormGroup` instance. * * @param {?} controls A collection of child controls. The key for each child is the name * under which it is registered. * * @param {?=} validatorOrOpts A synchronous validator function, or an array of * such functions, or an `AbstractControlOptions` object that contains validation functions * and a validation trigger. * * @param {?=} asyncValidator A single async validator or array of async validator functions * */ function FormGroup(controls, validatorOrOpts, asyncValidator) { var _this364; _classCallCheck(this, FormGroup); _this364 = _super131.call(this, coerceToValidator(validatorOrOpts), coerceToAsyncValidator(asyncValidator, validatorOrOpts)); _this364.controls = controls; _this364._initObservables(); _this364._setUpdateStrategy(validatorOrOpts); _this364._setUpControls(); _this364.updateValueAndValidity({ onlySelf: true, emitEvent: false }); return _this364; } /** * Registers a control with the group's list of controls. * * This method does not update the value or validity of the control. * Use {\@link FormGroup#addControl addControl} instead. * * @param {?} name The control name to register in the collection * @param {?} control Provides the control for the given name * @return {?} */ _createClass2(FormGroup, [{ key: "registerControl", value: function registerControl(name, control) { if (this.controls[name]) return this.controls[name]; this.controls[name] = control; control.setParent(this); control._registerOnCollectionChange(this._onCollectionChange); return control; } /** * Add a control to this group. * * This method also updates the value and validity of the control. * * @param {?} name The control name to add to the collection * @param {?} control Provides the control for the given name * @return {?} */ }, { key: "addControl", value: function addControl(name, control) { this.registerControl(name, control); this.updateValueAndValidity(); this._onCollectionChange(); } /** * Remove a control from this group. * * @param {?} name The control name to remove from the collection * @return {?} */ }, { key: "removeControl", value: function removeControl(name) { if (this.controls[name]) this.controls[name]._registerOnCollectionChange( /** * @return {?} */ function () {}); delete this.controls[name]; this.updateValueAndValidity(); this._onCollectionChange(); } /** * Replace an existing control. * * @param {?} name The control name to replace in the collection * @param {?} control Provides the control for the given name * @return {?} */ }, { key: "setControl", value: function setControl(name, control) { if (this.controls[name]) this.controls[name]._registerOnCollectionChange( /** * @return {?} */ function () {}); delete this.controls[name]; if (control) this.registerControl(name, control); this.updateValueAndValidity(); this._onCollectionChange(); } /** * Check whether there is an enabled control with the given name in the group. * * Reports false for disabled controls. If you'd like to check for existence in the group * only, use {\@link AbstractControl#get get} instead. * * @param {?} controlName The control name to check for existence in the collection * * @return {?} false for disabled controls, true otherwise. */ }, { key: "contains", value: function contains(controlName) { return this.controls.hasOwnProperty(controlName) && this.controls[controlName].enabled; } /** * Sets the value of the `FormGroup`. It accepts an object that matches * the structure of the group, with control names as keys. * * \@usageNotes * ### Set the complete value for the form group * * ``` * const form = new FormGroup({ * first: new FormControl(), * last: new FormControl() * }); * * console.log(form.value); // {first: null, last: null} * * form.setValue({first: 'Nancy', last: 'Drew'}); * console.log(form.value); // {first: 'Nancy', last: 'Drew'} * ``` * * @throws When strict checks fail, such as setting the value of a control * that doesn't exist or if you exclude a value of a control that does exist. * * @param {?} value The new value for the control that matches the structure of the group. * @param {?=} options Configuration options that determine how the control propagates changes * and emits events after the value changes. * The configuration options are passed to the {\@link AbstractControl#updateValueAndValidity * updateValueAndValidity} method. * * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is * false. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and * `valueChanges` * observables emit events with the latest status and value when the control value is updated. * When false, no events are emitted. * @return {?} */ }, { key: "setValue", value: function setValue(value) { var _this365 = this; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; this._checkAllValuesPresent(value); Object.keys(value).forEach( /** * @param {?} name * @return {?} */ function (name) { _this365._throwIfControlMissing(name); _this365.controls[name].setValue(value[name], { onlySelf: true, emitEvent: options.emitEvent }); }); this.updateValueAndValidity(options); } /** * Patches the value of the `FormGroup`. It accepts an object with control * names as keys, and does its best to match the values to the correct controls * in the group. * * It accepts both super-sets and sub-sets of the group without throwing an error. * * \@usageNotes * ### Patch the value for a form group * * ``` * const form = new FormGroup({ * first: new FormControl(), * last: new FormControl() * }); * console.log(form.value); // {first: null, last: null} * * form.patchValue({first: 'Nancy'}); * console.log(form.value); // {first: 'Nancy', last: null} * ``` * * @param {?} value The object that matches the structure of the group. * @param {?=} options Configuration options that determine how the control propagates changes and * emits events after the value is patched. * * `onlySelf`: When true, each change only affects this control and not its parent. Default is * true. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and * `valueChanges` * observables emit events with the latest status and value when the control value is updated. * When false, no events are emitted. * The configuration options are passed to the {\@link AbstractControl#updateValueAndValidity * updateValueAndValidity} method. * @return {?} */ }, { key: "patchValue", value: function patchValue(value) { var _this366 = this; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; Object.keys(value).forEach( /** * @param {?} name * @return {?} */ function (name) { if (_this366.controls[name]) { _this366.controls[name].patchValue(value[name], { onlySelf: true, emitEvent: options.emitEvent }); } }); this.updateValueAndValidity(options); } /** * Resets the `FormGroup`, marks all descendants are marked `pristine` and `untouched`, and * the value of all descendants to null. * * You reset to a specific form state by passing in a map of states * that matches the structure of your form, with control names as keys. The state * is a standalone value or a form state object with both a value and a disabled * status. * * \@usageNotes * * ### Reset the form group values * * ```ts * const form = new FormGroup({ * first: new FormControl('first name'), * last: new FormControl('last name') * }); * * console.log(form.value); // {first: 'first name', last: 'last name'} * * form.reset({ first: 'name', last: 'last name' }); * * console.log(form.value); // {first: 'name', last: 'last name'} * ``` * * ### Reset the form group values and disabled status * * ``` * const form = new FormGroup({ * first: new FormControl('first name'), * last: new FormControl('last name') * }); * * form.reset({ * first: {value: 'name', disabled: true}, * last: 'last' * }); * * console.log(this.form.value); // {first: 'name', last: 'last name'} * console.log(this.form.get('first').status); // 'DISABLED' * ``` * @param {?=} value Resets the control with an initial value, * or an object that defines the initial value and disabled state. * * @param {?=} options Configuration options that determine how the control propagates changes * and emits events when the group is reset. * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is * false. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and * `valueChanges` * observables emit events with the latest status and value when the control is reset. * When false, no events are emitted. * The configuration options are passed to the {\@link AbstractControl#updateValueAndValidity * updateValueAndValidity} method. * * @return {?} */ }, { key: "reset", value: function reset() { var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; this._forEachChild( /** * @param {?} control * @param {?} name * @return {?} */ function (control, name) { control.reset(value[name], { onlySelf: true, emitEvent: options.emitEvent }); }); this._updatePristine(options); this._updateTouched(options); this.updateValueAndValidity(options); } /** * The aggregate value of the `FormGroup`, including any disabled controls. * * Retrieves all values regardless of disabled status. * The `value` property is the best way to get the value of the group, because * it excludes disabled controls in the `FormGroup`. * @return {?} */ }, { key: "getRawValue", value: function getRawValue() { return this._reduceChildren({}, /** * @param {?} acc * @param {?} control * @param {?} name * @return {?} */ function (acc, control, name) { acc[name] = control instanceof FormControl ? control.value : /** @type {?} */ control.getRawValue(); return acc; }); } /** * \@internal * @return {?} */ }, { key: "_syncPendingControls", value: function _syncPendingControls() { /** @type {?} */ var subtreeUpdated = this._reduceChildren(false, /** * @param {?} updated * @param {?} child * @return {?} */ function (updated, child) { return child._syncPendingControls() ? true : updated; }); if (subtreeUpdated) this.updateValueAndValidity({ onlySelf: true }); return subtreeUpdated; } /** * \@internal * @param {?} name * @return {?} */ }, { key: "_throwIfControlMissing", value: function _throwIfControlMissing(name) { if (!Object.keys(this.controls).length) { throw new Error("\n There are no form controls registered with this group yet. If you're using ngModel,\n you may want to check next tick (e.g. use setTimeout).\n "); } if (!this.controls[name]) { throw new Error("Cannot find form control with name: ".concat(name, ".")); } } /** * \@internal * @param {?} cb * @return {?} */ }, { key: "_forEachChild", value: function _forEachChild(cb) { var _this367 = this; Object.keys(this.controls).forEach( /** * @param {?} k * @return {?} */ function (k) { return cb(_this367.controls[k], k); }); } /** * \@internal * @return {?} */ }, { key: "_setUpControls", value: function _setUpControls() { var _this368 = this; this._forEachChild( /** * @param {?} control * @return {?} */ function (control) { control.setParent(_this368); control._registerOnCollectionChange(_this368._onCollectionChange); }); } /** * \@internal * @return {?} */ }, { key: "_updateValue", value: function _updateValue() { /** @type {?} */ this.value = this._reduceValue(); } /** * \@internal * @param {?} condition * @return {?} */ }, { key: "_anyControls", value: function _anyControls(condition) { var _this369 = this; /** @type {?} */ var res = false; this._forEachChild( /** * @param {?} control * @param {?} name * @return {?} */ function (control, name) { res = res || _this369.contains(name) && condition(control); }); return res; } /** * \@internal * @return {?} */ }, { key: "_reduceValue", value: function _reduceValue() { var _this370 = this; return this._reduceChildren({}, /** * @param {?} acc * @param {?} control * @param {?} name * @return {?} */ function (acc, control, name) { if (control.enabled || _this370.disabled) { acc[name] = control.value; } return acc; }); } /** * \@internal * @param {?} initValue * @param {?} fn * @return {?} */ }, { key: "_reduceChildren", value: function _reduceChildren(initValue, fn) { /** @type {?} */ var res = initValue; this._forEachChild( /** * @param {?} control * @param {?} name * @return {?} */ function (control, name) { res = fn(res, control, name); }); return res; } /** * \@internal * @return {?} */ }, { key: "_allControlsDisabled", value: function _allControlsDisabled() { for (var _i33 = 0, _Object$keys5 = Object.keys(this.controls); _i33 < _Object$keys5.length; _i33++) { var controlName = _Object$keys5[_i33]; if (this.controls[controlName].enabled) { return false; } } return Object.keys(this.controls).length > 0 || this.disabled; } /** * \@internal * @param {?} value * @return {?} */ }, { key: "_checkAllValuesPresent", value: function _checkAllValuesPresent(value) { this._forEachChild( /** * @param {?} control * @param {?} name * @return {?} */ function (control, name) { if (value[name] === undefined) { throw new Error("Must supply a value for form control with name: '".concat(name, "'.")); } }); } }]); return FormGroup; }(AbstractControl); if (false) {} /** * Tracks the value and validity state of an array of `FormControl`, * `FormGroup` or `FormArray` instances. * * A `FormArray` aggregates the values of each child `FormControl` into an array. * It calculates its status by reducing the status values of its children. For example, if one of * the controls in a `FormArray` is invalid, the entire array becomes invalid. * * `FormArray` is one of the three fundamental building blocks used to define forms in Angular, * along with `FormControl` and `FormGroup`. * * \@usageNotes * * ### Create an array of form controls * * ``` * const arr = new FormArray([ * new FormControl('Nancy', Validators.minLength(2)), * new FormControl('Drew'), * ]); * * console.log(arr.value); // ['Nancy', 'Drew'] * console.log(arr.status); // 'VALID' * ``` * * ### Create a form array with array-level validators * * You include array-level validators and async validators. These come in handy * when you want to perform validation that considers the value of more than one child * control. * * The two types of validators are passed in separately as the second and third arg * respectively, or together as part of an options object. * * ``` * const arr = new FormArray([ * new FormControl('Nancy'), * new FormControl('Drew') * ], {validators: myValidator, asyncValidators: myAsyncValidator}); * ``` * * ### Set the updateOn property for all controls in a form array * * The options object is used to set a default value for each child * control's `updateOn` property. If you set `updateOn` to `'blur'` at the * array level, all child controls default to 'blur', unless the child * has explicitly specified a different `updateOn` value. * * ```ts * const arr = new FormArray([ * new FormControl() * ], {updateOn: 'blur'}); * ``` * * ### Adding or removing controls from a form array * * To change the controls in the array, use the `push`, `insert`, `removeAt` or `clear` methods * in `FormArray` itself. These methods ensure the controls are properly tracked in the * form's hierarchy. Do not modify the array of `AbstractControl`s used to instantiate * the `FormArray` directly, as that result in strange and unexpected behavior such * as broken change detection. * * \@publicApi */ var FormArray = /*#__PURE__*/function (_AbstractControl3) { _inherits(FormArray, _AbstractControl3); var _super132 = _createSuper(FormArray); /** * Creates a new `FormArray` instance. * * @param {?} controls An array of child controls. Each child control is given an index * where it is registered. * * @param {?=} validatorOrOpts A synchronous validator function, or an array of * such functions, or an `AbstractControlOptions` object that contains validation functions * and a validation trigger. * * @param {?=} asyncValidator A single async validator or array of async validator functions * */ function FormArray(controls, validatorOrOpts, asyncValidator) { var _this371; _classCallCheck(this, FormArray); _this371 = _super132.call(this, coerceToValidator(validatorOrOpts), coerceToAsyncValidator(asyncValidator, validatorOrOpts)); _this371.controls = controls; _this371._initObservables(); _this371._setUpdateStrategy(validatorOrOpts); _this371._setUpControls(); _this371.updateValueAndValidity({ onlySelf: true, emitEvent: false }); return _this371; } /** * Get the `AbstractControl` at the given `index` in the array. * * @param {?} index Index in the array to retrieve the control * @return {?} */ _createClass2(FormArray, [{ key: "at", value: function at(index) { return this.controls[index]; } /** * Insert a new `AbstractControl` at the end of the array. * * @param {?} control Form control to be inserted * @return {?} */ }, { key: "push", value: function push(control) { this.controls.push(control); this._registerControl(control); this.updateValueAndValidity(); this._onCollectionChange(); } /** * Insert a new `AbstractControl` at the given `index` in the array. * * @param {?} index Index in the array to insert the control * @param {?} control Form control to be inserted * @return {?} */ }, { key: "insert", value: function insert(index, control) { this.controls.splice(index, 0, control); this._registerControl(control); this.updateValueAndValidity(); } /** * Remove the control at the given `index` in the array. * * @param {?} index Index in the array to remove the control * @return {?} */ }, { key: "removeAt", value: function removeAt(index) { if (this.controls[index]) this.controls[index]._registerOnCollectionChange( /** * @return {?} */ function () {}); this.controls.splice(index, 1); this.updateValueAndValidity(); } /** * Replace an existing control. * * @param {?} index Index in the array to replace the control * @param {?} control The `AbstractControl` control to replace the existing control * @return {?} */ }, { key: "setControl", value: function setControl(index, control) { if (this.controls[index]) this.controls[index]._registerOnCollectionChange( /** * @return {?} */ function () {}); this.controls.splice(index, 1); if (control) { this.controls.splice(index, 0, control); this._registerControl(control); } this.updateValueAndValidity(); this._onCollectionChange(); } /** * Length of the control array. * @return {?} */ }, { key: "setValue", /** * Sets the value of the `FormArray`. It accepts an array that matches * the structure of the control. * * This method performs strict checks, and throws an error if you try * to set the value of a control that doesn't exist or if you exclude the * value of a control. * * \@usageNotes * ### Set the values for the controls in the form array * * ``` * const arr = new FormArray([ * new FormControl(), * new FormControl() * ]); * console.log(arr.value); // [null, null] * * arr.setValue(['Nancy', 'Drew']); * console.log(arr.value); // ['Nancy', 'Drew'] * ``` * * @param {?} value Array of values for the controls * @param {?=} options Configure options that determine how the control propagates changes and * emits events after the value changes * * * `onlySelf`: When true, each change only affects this control, and not its parent. Default * is false. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and * `valueChanges` * observables emit events with the latest status and value when the control value is updated. * When false, no events are emitted. * The configuration options are passed to the {\@link AbstractControl#updateValueAndValidity * updateValueAndValidity} method. * @return {?} */ value: function setValue(value) { var _this372 = this; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; this._checkAllValuesPresent(value); value.forEach( /** * @param {?} newValue * @param {?} index * @return {?} */ function (newValue, index) { _this372._throwIfControlMissing(index); _this372.at(index).setValue(newValue, { onlySelf: true, emitEvent: options.emitEvent }); }); this.updateValueAndValidity(options); } /** * Patches the value of the `FormArray`. It accepts an array that matches the * structure of the control, and does its best to match the values to the correct * controls in the group. * * It accepts both super-sets and sub-sets of the array without throwing an error. * * \@usageNotes * ### Patch the values for controls in a form array * * ``` * const arr = new FormArray([ * new FormControl(), * new FormControl() * ]); * console.log(arr.value); // [null, null] * * arr.patchValue(['Nancy']); * console.log(arr.value); // ['Nancy', null] * ``` * * @param {?} value Array of latest values for the controls * @param {?=} options Configure options that determine how the control propagates changes and * emits events after the value changes * * * `onlySelf`: When true, each change only affects this control, and not its parent. Default * is false. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and * `valueChanges` * observables emit events with the latest status and value when the control value is updated. * When false, no events are emitted. * The configuration options are passed to the {\@link AbstractControl#updateValueAndValidity * updateValueAndValidity} method. * @return {?} */ }, { key: "patchValue", value: function patchValue(value) { var _this373 = this; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; value.forEach( /** * @param {?} newValue * @param {?} index * @return {?} */ function (newValue, index) { if (_this373.at(index)) { _this373.at(index).patchValue(newValue, { onlySelf: true, emitEvent: options.emitEvent }); } }); this.updateValueAndValidity(options); } /** * Resets the `FormArray` and all descendants are marked `pristine` and `untouched`, and the * value of all descendants to null or null maps. * * You reset to a specific form state by passing in an array of states * that matches the structure of the control. The state is a standalone value * or a form state object with both a value and a disabled status. * * \@usageNotes * ### Reset the values in a form array * * ```ts * const arr = new FormArray([ * new FormControl(), * new FormControl() * ]); * arr.reset(['name', 'last name']); * * console.log(this.arr.value); // ['name', 'last name'] * ``` * * ### Reset the values in a form array and the disabled status for the first control * * ``` * this.arr.reset([ * {value: 'name', disabled: true}, * 'last' * ]); * * console.log(this.arr.value); // ['name', 'last name'] * console.log(this.arr.get(0).status); // 'DISABLED' * ``` * * @param {?=} value Array of values for the controls * @param {?=} options Configure options that determine how the control propagates changes and * emits events after the value changes * * * `onlySelf`: When true, each change only affects this control, and not its parent. Default * is false. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and * `valueChanges` * observables emit events with the latest status and value when the control is reset. * When false, no events are emitted. * The configuration options are passed to the {\@link AbstractControl#updateValueAndValidity * updateValueAndValidity} method. * @return {?} */ }, { key: "reset", value: function reset() { var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; this._forEachChild( /** * @param {?} control * @param {?} index * @return {?} */ function (control, index) { control.reset(value[index], { onlySelf: true, emitEvent: options.emitEvent }); }); this._updatePristine(options); this._updateTouched(options); this.updateValueAndValidity(options); } /** * The aggregate value of the array, including any disabled controls. * * Reports all values regardless of disabled status. * For enabled controls only, the `value` property is the best way to get the value of the array. * @return {?} */ }, { key: "getRawValue", value: function getRawValue() { return this.controls.map( /** * @param {?} control * @return {?} */ function (control) { return control instanceof FormControl ? control.value : /** @type {?} */ control.getRawValue(); }); } /** * Remove all controls in the `FormArray`. * * \@usageNotes * ### Remove all elements from a FormArray * * ```ts * const arr = new FormArray([ * new FormControl(), * new FormControl() * ]); * console.log(arr.length); // 2 * * arr.clear(); * console.log(arr.length); // 0 * ``` * * It's a simpler and more efficient alternative to removing all elements one by one: * * ```ts * const arr = new FormArray([ * new FormControl(), * new FormControl() * ]); * * while (arr.length) { * arr.removeAt(0); * } * ``` * @return {?} */ }, { key: "clear", value: function clear() { if (this.controls.length < 1) return; this._forEachChild( /** * @param {?} control * @return {?} */ function (control) { return control._registerOnCollectionChange( /** * @return {?} */ function () {}); }); this.controls.splice(0); this.updateValueAndValidity(); } /** * \@internal * @return {?} */ }, { key: "_syncPendingControls", value: function _syncPendingControls() { /** @type {?} */ var subtreeUpdated = this.controls.reduce( /** * @param {?} updated * @param {?} child * @return {?} */ function (updated, child) { return child._syncPendingControls() ? true : updated; }, false); if (subtreeUpdated) this.updateValueAndValidity({ onlySelf: true }); return subtreeUpdated; } /** * \@internal * @param {?} index * @return {?} */ }, { key: "_throwIfControlMissing", value: function _throwIfControlMissing(index) { if (!this.controls.length) { throw new Error("\n There are no form controls registered with this array yet. If you're using ngModel,\n you may want to check next tick (e.g. use setTimeout).\n "); } if (!this.at(index)) { throw new Error("Cannot find form control at index ".concat(index)); } } /** * \@internal * @param {?} cb * @return {?} */ }, { key: "_forEachChild", value: function _forEachChild(cb) { this.controls.forEach( /** * @param {?} control * @param {?} index * @return {?} */ function (control, index) { cb(control, index); }); } /** * \@internal * @return {?} */ }, { key: "_updateValue", value: function _updateValue() { var _this374 = this; /** @type {?} */ this.value = this.controls.filter( /** * @param {?} control * @return {?} */ function (control) { return control.enabled || _this374.disabled; }).map( /** * @param {?} control * @return {?} */ function (control) { return control.value; }); } /** * \@internal * @param {?} condition * @return {?} */ }, { key: "_anyControls", value: function _anyControls(condition) { return this.controls.some( /** * @param {?} control * @return {?} */ function (control) { return control.enabled && condition(control); }); } /** * \@internal * @return {?} */ }, { key: "_setUpControls", value: function _setUpControls() { var _this375 = this; this._forEachChild( /** * @param {?} control * @return {?} */ function (control) { return _this375._registerControl(control); }); } /** * \@internal * @param {?} value * @return {?} */ }, { key: "_checkAllValuesPresent", value: function _checkAllValuesPresent(value) { this._forEachChild( /** * @param {?} control * @param {?} i * @return {?} */ function (control, i) { if (value[i] === undefined) { throw new Error("Must supply a value for form control at index: ".concat(i, ".")); } }); } /** * \@internal * @return {?} */ }, { key: "_allControlsDisabled", value: function _allControlsDisabled() { var _iterator45 = _createForOfIteratorHelper(this.controls), _step45; try { for (_iterator45.s(); !(_step45 = _iterator45.n()).done;) { var control = _step45.value; if (control.enabled) return false; } } catch (err) { _iterator45.e(err); } finally { _iterator45.f(); } return this.controls.length > 0 || this.disabled; } /** * @private * @param {?} control * @return {?} */ }, { key: "_registerControl", value: function _registerControl(control) { control.setParent(this); control._registerOnCollectionChange(this._onCollectionChange); } }, { key: "length", get: function get() { return this.controls.length; } }]); return FormArray; }(AbstractControl); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var formDirectiveProvider = { provide: ControlContainer, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return NgForm; }) }; var ɵ0 = /** * @return {?} */ function ɵ0() { return Promise.resolve(null); }; /** @type {?} */ var resolvedPromise = ɵ0(); /** * \@description * Creates a top-level `FormGroup` instance and binds it to a form * to track aggregate form value and validation status. * * As soon as you import the `FormsModule`, this directive becomes active by default on * all `<form>` tags. You don't need to add a special selector. * * You optionally export the directive into a local template variable using `ngForm` as the key * (ex: `#myForm="ngForm"`). This is optional, but useful. Many properties from the underlying * `FormGroup` instance are duplicated on the directive itself, so a reference to it * gives you access to the aggregate value and validity status of the form, as well as * user interaction properties like `dirty` and `touched`. * * To register child controls with the form, use `NgModel` with a `name` * attribute. You may use `NgModelGroup` to create sub-groups within the form. * * If necessary, listen to the directive's `ngSubmit` event to be notified when the user has * triggered a form submission. The `ngSubmit` event emits the original form * submission event. * * In template driven forms, all `<form>` tags are automatically tagged as `NgForm`. * To import the `FormsModule` but skip its usage in some forms, * for example, to use native HTML5 validation, add the `ngNoForm` and the `<form>` * tags won't create an `NgForm` directive. In reactive forms, using `ngNoForm` is * unnecessary because the `<form>` tags are inert. In that case, you would * refrain from using the `formGroup` directive. * * \@usageNotes * * ### Migrating from deprecated ngForm selector * * Support for using `ngForm` element selector has been deprecated in Angular v6 and will be removed * in Angular v9. * * This has been deprecated to keep selectors consistent with other core Angular selectors, * as element selectors are typically written in kebab-case. * * Now deprecated: * ```html * <ngForm #myForm="ngForm"> * ``` * * After: * ```html * <ng-form #myForm="ngForm"> * ``` * * ### Listening for form submission * * The following example shows how to capture the form values from the "ngSubmit" event. * * {\@example forms/ts/simpleForm/simple_form_example.ts region='Component'} * * ### Setting the update options * * The following example shows you how to change the "updateOn" option from its default using * ngFormOptions. * * ```html * <form [ngFormOptions]="{updateOn: 'blur'}"> * <input name="one" ngModel> <!-- this ngModel will update on blur --> * </form> * ``` * * \@ngModule FormsModule * \@publicApi */ var NgForm = /*#__PURE__*/function (_ControlContainer) { _inherits(NgForm, _ControlContainer); var _super133 = _createSuper(NgForm); /** * @param {?} validators * @param {?} asyncValidators */ function NgForm(validators, asyncValidators) { var _this376; _classCallCheck(this, NgForm); _this376 = _super133.call(this); /** * \@description * Returns whether the form submission has been triggered. */ _this376.submitted = false; _this376._directives = []; /** * \@description * Event emitter for the "ngSubmit" event */ _this376.ngSubmit = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); _this376.form = new FormGroup({}, composeValidators(validators), composeAsyncValidators(asyncValidators)); return _this376; } /** * \@description * Lifecycle method called after the view is initialized. For internal use only. * @return {?} */ _createClass2(NgForm, [{ key: "ngAfterViewInit", value: function ngAfterViewInit() { this._setUpdateStrategy(); } /** * \@description * The directive instance. * @return {?} */ }, { key: "addControl", /** * \@description * Method that sets up the control directive in this group, re-calculates its value * and validity, and adds the instance to the internal list of directives. * * @param {?} dir The `NgModel` directive instance. * @return {?} */ value: function addControl(dir) { var _this377 = this; resolvedPromise.then( /** * @return {?} */ function () { /** @type {?} */ var container = _this377._findContainer(dir.path); /** @type {?} */ dir.control = /** @type {?} */ container.registerControl(dir.name, dir.control); setUpControl(dir.control, dir); dir.control.updateValueAndValidity({ emitEvent: false }); _this377._directives.push(dir); }); } /** * \@description * Retrieves the `FormControl` instance from the provided `NgModel` directive. * * @param {?} dir The `NgModel` directive instance. * @return {?} */ }, { key: "getControl", value: function getControl(dir) { return ( /** @type {?} */ this.form.get(dir.path) ); } /** * \@description * Removes the `NgModel` instance from the internal list of directives * * @param {?} dir The `NgModel` directive instance. * @return {?} */ }, { key: "removeControl", value: function removeControl(dir) { var _this378 = this; resolvedPromise.then( /** * @return {?} */ function () { /** @type {?} */ var container = _this378._findContainer(dir.path); if (container) { container.removeControl(dir.name); } removeDir(_this378._directives, dir); }); } /** * \@description * Adds a new `NgModelGroup` directive instance to the form. * * @param {?} dir The `NgModelGroup` directive instance. * @return {?} */ }, { key: "addFormGroup", value: function addFormGroup(dir) { var _this379 = this; resolvedPromise.then( /** * @return {?} */ function () { /** @type {?} */ var container = _this379._findContainer(dir.path); /** @type {?} */ var group = new FormGroup({}); setUpFormContainer(group, dir); container.registerControl(dir.name, group); group.updateValueAndValidity({ emitEvent: false }); }); } /** * \@description * Removes the `NgModelGroup` directive instance from the form. * * @param {?} dir The `NgModelGroup` directive instance. * @return {?} */ }, { key: "removeFormGroup", value: function removeFormGroup(dir) { var _this380 = this; resolvedPromise.then( /** * @return {?} */ function () { /** @type {?} */ var container = _this380._findContainer(dir.path); if (container) { container.removeControl(dir.name); } }); } /** * \@description * Retrieves the `FormGroup` for a provided `NgModelGroup` directive instance * * @param {?} dir The `NgModelGroup` directive instance. * @return {?} */ }, { key: "getFormGroup", value: function getFormGroup(dir) { return ( /** @type {?} */ this.form.get(dir.path) ); } /** * Sets the new value for the provided `NgControl` directive. * * @param {?} dir The `NgControl` directive instance. * @param {?} value The new value for the directive's control. * @return {?} */ }, { key: "updateModel", value: function updateModel(dir, value) { var _this381 = this; resolvedPromise.then( /** * @return {?} */ function () { /** @type {?} */ var ctrl = /** @type {?} */ _this381.form.get( /** @type {?} */ dir.path); ctrl.setValue(value); }); } /** * \@description * Sets the value for this `FormGroup`. * * @param {?} value The new value * @return {?} */ }, { key: "setValue", value: function setValue(value) { this.control.setValue(value); } /** * \@description * Method called when the "submit" event is triggered on the form. * Triggers the `ngSubmit` emitter to emit the "submit" event as its payload. * * @param {?} $event The "submit" event object * @return {?} */ }, { key: "onSubmit", value: function onSubmit($event) { /** @type {?} */ this.submitted = true; syncPendingControls(this.form, this._directives); this.ngSubmit.emit($event); return false; } /** * \@description * Method called when the "reset" event is triggered on the form. * @return {?} */ }, { key: "onReset", value: function onReset() { this.resetForm(); } /** * \@description * Resets the form to an initial value and resets its submitted status. * * @param {?=} value The new value for the form. * @return {?} */ }, { key: "resetForm", value: function resetForm() { var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; this.form.reset(value); /** @type {?} */ this.submitted = false; } /** * @private * @return {?} */ }, { key: "_setUpdateStrategy", value: function _setUpdateStrategy() { if (this.options && this.options.updateOn != null) { this.form._updateOn = this.options.updateOn; } } /** * \@internal * @param {?} path * @return {?} */ }, { key: "_findContainer", value: function _findContainer(path) { path.pop(); return path.length ? /** @type {?} */ this.form.get(path) : this.form; } }, { key: "formDirective", get: function get() { return this; } /** * \@description * The internal `FormGroup` instance. * @return {?} */ }, { key: "control", get: function get() { return this.form; } /** * \@description * Returns an array representing the path to this group. Because this directive * always lives at the top level of a form, it is always an empty array. * @return {?} */ }, { key: "path", get: function get() { return []; } /** * \@description * Returns a map of the controls in this group. * @return {?} */ }, { key: "controls", get: function get() { return this.form.controls; } }]); return NgForm; }(ControlContainer); NgForm.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'form:not([ngNoForm]):not([formGroup]),ngForm,ng-form,[ngForm]', providers: [formDirectiveProvider], host: { '(submit)': 'onSubmit($event)', '(reset)': 'onReset()' }, outputs: ['ngSubmit'], exportAs: 'ngForm' }] }]; /** @nocollapse */ NgForm.ctorParameters = function () { return [{ type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_VALIDATORS] }] }, { type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_ASYNC_VALIDATORS] }] }]; }; NgForm.propDecorators = { options: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['ngFormOptions'] }] }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var TemplateDrivenErrors = /*#__PURE__*/function () { function TemplateDrivenErrors() { _classCallCheck(this, TemplateDrivenErrors); } _createClass2(TemplateDrivenErrors, null, [{ key: "modelParentException", /** * @return {?} */ value: function modelParentException() { throw new Error("\n ngModel cannot be used to register form controls with a parent formGroup directive. Try using\n formGroup's partner directive \"formControlName\" instead. Example:\n\n ".concat(FormErrorExamples.formControlName, "\n\n Or, if you'd like to avoid registering this form control, indicate that it's standalone in ngModelOptions:\n\n Example:\n\n ").concat(FormErrorExamples.ngModelWithFormGroup)); } /** * @return {?} */ }, { key: "formGroupNameException", value: function formGroupNameException() { throw new Error("\n ngModel cannot be used to register form controls with a parent formGroupName or formArrayName directive.\n\n Option 1: Use formControlName instead of ngModel (reactive strategy):\n\n ".concat(FormErrorExamples.formGroupName, "\n\n Option 2: Update ngModel's parent be ngModelGroup (template-driven strategy):\n\n ").concat(FormErrorExamples.ngModelGroup)); } /** * @return {?} */ }, { key: "missingNameException", value: function missingNameException() { throw new Error("If ngModel is used within a form tag, either the name attribute must be set or the form\n control must be defined as 'standalone' in ngModelOptions.\n\n Example 1: <input [(ngModel)]=\"person.firstName\" name=\"first\">\n Example 2: <input [(ngModel)]=\"person.firstName\" [ngModelOptions]=\"{standalone: true}\">"); } /** * @return {?} */ }, { key: "modelGroupParentException", value: function modelGroupParentException() { throw new Error("\n ngModelGroup cannot be used with a parent formGroup directive.\n\n Option 1: Use formGroupName instead of ngModelGroup (reactive strategy):\n\n ".concat(FormErrorExamples.formGroupName, "\n\n Option 2: Use a regular form tag instead of the formGroup directive (template-driven strategy):\n\n ").concat(FormErrorExamples.ngModelGroup)); } /** * @return {?} */ }, { key: "ngFormWarning", value: function ngFormWarning() { console.warn("\n It looks like you're using 'ngForm'.\n\n Support for using the 'ngForm' element selector has been deprecated in Angular v6 and will be removed\n in Angular v9.\n\n Use 'ng-form' instead.\n\n Before:\n <ngForm #myForm=\"ngForm\">\n\n After:\n <ng-form #myForm=\"ngForm\">\n "); } }]); return TemplateDrivenErrors; }(); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@description * `InjectionToken` to provide to turn off the warning when using 'ngForm' deprecated selector. * @type {?} */ var NG_FORM_SELECTOR_WARNING = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('NgFormSelectorWarning'); /** * This directive is solely used to display warnings when the deprecated `ngForm` selector is used. * * @deprecated in Angular v6 and will be removed in Angular v9. * \@ngModule FormsModule * \@publicApi */ var NgFormSelectorWarning = /** * @param {?} ngFormWarning */ function NgFormSelectorWarning(ngFormWarning) { _classCallCheck(this, NgFormSelectorWarning); if ((!ngFormWarning || ngFormWarning === 'once') && !NgFormSelectorWarning._ngFormWarning || ngFormWarning === 'always') { TemplateDrivenErrors.ngFormWarning(); NgFormSelectorWarning._ngFormWarning = true; } }; /** * Static property used to track whether the deprecation warning for this selector has been sent. * Used to support warning config of "once". * * \@internal */ NgFormSelectorWarning._ngFormWarning = false; NgFormSelectorWarning.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'ngForm' }] }]; /** @nocollapse */ NgFormSelectorWarning.ctorParameters = function () { return [{ type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_FORM_SELECTOR_WARNING] }] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@description * A base class for code shared between the `NgModelGroup` and `FormGroupName` directives. * * \@publicApi */ var AbstractFormGroupDirective = /*#__PURE__*/function (_ControlContainer2) { _inherits(AbstractFormGroupDirective, _ControlContainer2); var _super134 = _createSuper(AbstractFormGroupDirective); function AbstractFormGroupDirective() { _classCallCheck(this, AbstractFormGroupDirective); return _super134.apply(this, arguments); } _createClass2(AbstractFormGroupDirective, [{ key: "ngOnInit", /** * \@description * An internal callback method triggered on the instance after the inputs are set. * Registers the group with its parent group. * @return {?} */ value: function ngOnInit() { this._checkParentType(); /** @type {?} */ this.formDirective.addFormGroup(this); } /** * \@description * An internal callback method triggered before the instance is destroyed. * Removes the group from its parent group. * @return {?} */ }, { key: "ngOnDestroy", value: function ngOnDestroy() { if (this.formDirective) { this.formDirective.removeFormGroup(this); } } /** * \@description * The `FormGroup` bound to this directive. * @return {?} */ }, { key: "_checkParentType", /** * \@internal * @return {?} */ value: function _checkParentType() {} }, { key: "control", get: function get() { return ( /** @type {?} */ this.formDirective.getFormGroup(this) ); } /** * \@description * The path to this group from the top-level directive. * @return {?} */ }, { key: "path", get: function get() { return controlPath(this.name, this._parent); } /** * \@description * The top-level directive for this group if present, otherwise null. * @return {?} */ }, { key: "formDirective", get: function get() { return this._parent ? this._parent.formDirective : null; } /** * \@description * The synchronous validators registered with this group. * @return {?} */ }, { key: "validator", get: function get() { return composeValidators(this._validators); } /** * \@description * The async validators registered with this group. * @return {?} */ }, { key: "asyncValidator", get: function get() { return composeAsyncValidators(this._asyncValidators); } }]); return AbstractFormGroupDirective; }(ControlContainer); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var modelGroupProvider = { provide: ControlContainer, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return NgModelGroup; }) }; /** * \@description * Creates and binds a `FormGroup` instance to a DOM element. * * This directive can only be used as a child of `NgForm` (within `<form>` tags). * * Use this directive to validate a sub-group of your form separately from the * rest of your form, or if some values in your domain model make more sense * to consume together in a nested object. * * Provide a name for the sub-group and it will become the key * for the sub-group in the form's full value. If you need direct access, export the directive into * a local template variable using `ngModelGroup` (ex: `#myGroup="ngModelGroup"`). * * \@usageNotes * * ### Consuming controls in a grouping * * The following example shows you how to combine controls together in a sub-group * of the form. * * {\@example forms/ts/ngModelGroup/ng_model_group_example.ts region='Component'} * * \@ngModule FormsModule * \@publicApi */ var NgModelGroup = /*#__PURE__*/function (_AbstractFormGroupDir) { _inherits(NgModelGroup, _AbstractFormGroupDir); var _super135 = _createSuper(NgModelGroup); /** * @param {?} parent * @param {?} validators * @param {?} asyncValidators */ function NgModelGroup(parent, validators, asyncValidators) { var _this382; _classCallCheck(this, NgModelGroup); _this382 = _super135.call(this); _this382._parent = parent; _this382._validators = validators; _this382._asyncValidators = asyncValidators; return _this382; } /** * \@internal * @return {?} */ _createClass2(NgModelGroup, [{ key: "_checkParentType", value: function _checkParentType() { if (!(this._parent instanceof NgModelGroup) && !(this._parent instanceof NgForm)) { TemplateDrivenErrors.modelGroupParentException(); } } }]); return NgModelGroup; }(AbstractFormGroupDirective); NgModelGroup.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[ngModelGroup]', providers: [modelGroupProvider], exportAs: 'ngModelGroup' }] }]; /** @nocollapse */ NgModelGroup.ctorParameters = function () { return [{ type: ControlContainer, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Host"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["SkipSelf"] }] }, { type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_VALIDATORS] }] }, { type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_ASYNC_VALIDATORS] }] }]; }; NgModelGroup.propDecorators = { name: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['ngModelGroup'] }] }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var formControlBinding = { provide: NgControl, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return NgModel; }) }; var ɵ0$1 = /** * @return {?} */ function ɵ0$1() { return Promise.resolve(null); }; /** * `ngModel` forces an additional change detection run when its inputs change: * E.g.: * ``` * <div>{{myModel.valid}}</div> * <input [(ngModel)]="myValue" #myModel="ngModel"> * ``` * I.e. `ngModel` can export itself on the element and then be used in the template. * Normally, this would result in expressions before the `input` that use the exported directive * to have and old value as they have been * dirty checked before. As this is a very common case for `ngModel`, we added this second change * detection run. * * Notes: * - this is just one extra run no matter how many `ngModel` have been changed. * - this is a general problem when using `exportAs` for directives! * @type {?} */ var resolvedPromise$1 = ɵ0$1(); /** * \@description * Creates a `FormControl` instance from a domain model and binds it * to a form control element. * * The `FormControl` instance tracks the value, user interaction, and * validation status of the control and keeps the view synced with the model. If used * within a parent form, the directive also registers itself with the form as a child * control. * * This directive is used by itself or as part of a larger form. Use the * `ngModel` selector to activate it. * * It accepts a domain model as an optional `Input`. If you have a one-way binding * to `ngModel` with `[]` syntax, changing the value of the domain model in the component * class sets the value in the view. If you have a two-way binding with `[()]` syntax * (also known as 'banana-box syntax'), the value in the UI always syncs back to * the domain model in your class. * * To inspect the properties of the associated `FormControl` (like validity state), * export the directive into a local template variable using `ngModel` as the key (ex: `#myVar="ngModel"`). * You then access the control using the directive's `control` property, * but most properties used (like `valid` and `dirty`) fall through to the control anyway for direct access. * See a full list of properties directly available in `AbstractControlDirective`. * * @see `RadioControlValueAccessor` * @see `SelectControlValueAccessor` * * \@usageNotes * * ### Using ngModel on a standalone control * * The following examples show a simple standalone control using `ngModel`: * * {\@example forms/ts/simpleNgModel/simple_ng_model_example.ts region='Component'} * * When using the `ngModel` within `<form>` tags, you'll also need to supply a `name` attribute * so that the control can be registered with the parent form under that name. * * In the context of a parent form, it's often unnecessary to include one-way or two-way binding, * as the parent form syncs the value for you. You access its properties by exporting it into a * local template variable using `ngForm` such as (`#f="ngForm"`). Use the variable where * needed on form submission. * * If you do need to populate initial values into your form, using a one-way binding for * `ngModel` tends to be sufficient as long as you use the exported form's value rather * than the domain model's value on submit. * * ### Using ngModel within a form * * The following example shows controls using `ngModel` within a form: * * {\@example forms/ts/simpleForm/simple_form_example.ts region='Component'} * * ### Using a standalone ngModel within a group * * The following example shows you how to use a standalone ngModel control * within a form. This controls the display of the form, but doesn't contain form data. * * ```html * <form> * <input name="login" ngModel placeholder="Login"> * <input type="checkbox" ngModel [ngModelOptions]="{standalone: true}"> Show more options? * </form> * <!-- form value: {login: ''} --> * ``` * * ### Setting the ngModel name attribute through options * * The following example shows you an alternate way to set the name attribute. The name attribute is used * within a custom form component, and the name `\@Input` property serves a different purpose. * * ```html * <form> * <my-person-control name="Nancy" ngModel [ngModelOptions]="{name: 'user'}"> * </my-person-control> * </form> * <!-- form value: {user: ''} --> * ``` * * \@ngModule FormsModule * \@publicApi */ var NgModel = /*#__PURE__*/function (_NgControl) { _inherits(NgModel, _NgControl); var _super136 = _createSuper(NgModel); /** * @param {?} parent * @param {?} validators * @param {?} asyncValidators * @param {?} valueAccessors */ function NgModel(parent, validators, asyncValidators, valueAccessors) { var _this383; _classCallCheck(this, NgModel); _this383 = _super136.call(this); _this383.control = new FormControl(); /** * \@internal */ _this383._registered = false; /** * \@description * Event emitter for producing the `ngModelChange` event after * the view model updates. */ _this383.update = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); _this383._parent = parent; _this383._rawValidators = validators || []; _this383._rawAsyncValidators = asyncValidators || []; _this383.valueAccessor = selectValueAccessor(_assertThisInitialized(_this383), valueAccessors); return _this383; } /** * \@description * A lifecycle method called when the directive's inputs change. For internal use * only. * * @param {?} changes A object of key/value pairs for the set of changed inputs. * @return {?} */ _createClass2(NgModel, [{ key: "ngOnChanges", value: function ngOnChanges(changes) { this._checkForErrors(); if (!this._registered) this._setUpControl(); if ('isDisabled' in changes) { this._updateDisabled(changes); } if (isPropertyUpdated(changes, this.viewModel)) { this._updateValue(this.model); this.viewModel = this.model; } } /** * \@description * Lifecycle method called before the directive's instance is destroyed. For internal * use only. * @return {?} */ }, { key: "ngOnDestroy", value: function ngOnDestroy() { this.formDirective && this.formDirective.removeControl(this); } /** * \@description * Returns an array that represents the path from the top-level form to this control. * Each index is the string name of the control on that level. * @return {?} */ }, { key: "viewToModelUpdate", /** * \@description * Sets the new value for the view model and emits an `ngModelChange` event. * * @param {?} newValue The new value emitted by `ngModelChange`. * @return {?} */ value: function viewToModelUpdate(newValue) { this.viewModel = newValue; this.update.emit(newValue); } /** * @private * @return {?} */ }, { key: "_setUpControl", value: function _setUpControl() { this._setUpdateStrategy(); this._isStandalone() ? this._setUpStandalone() : this.formDirective.addControl(this); this._registered = true; } /** * @private * @return {?} */ }, { key: "_setUpdateStrategy", value: function _setUpdateStrategy() { if (this.options && this.options.updateOn != null) { this.control._updateOn = this.options.updateOn; } } /** * @private * @return {?} */ }, { key: "_isStandalone", value: function _isStandalone() { return !this._parent || !!(this.options && this.options.standalone); } /** * @private * @return {?} */ }, { key: "_setUpStandalone", value: function _setUpStandalone() { setUpControl(this.control, this); this.control.updateValueAndValidity({ emitEvent: false }); } /** * @private * @return {?} */ }, { key: "_checkForErrors", value: function _checkForErrors() { if (!this._isStandalone()) { this._checkParentType(); } this._checkName(); } /** * @private * @return {?} */ }, { key: "_checkParentType", value: function _checkParentType() { if (!(this._parent instanceof NgModelGroup) && this._parent instanceof AbstractFormGroupDirective) { TemplateDrivenErrors.formGroupNameException(); } else if (!(this._parent instanceof NgModelGroup) && !(this._parent instanceof NgForm)) { TemplateDrivenErrors.modelParentException(); } } /** * @private * @return {?} */ }, { key: "_checkName", value: function _checkName() { if (this.options && this.options.name) this.name = this.options.name; if (!this._isStandalone() && !this.name) { TemplateDrivenErrors.missingNameException(); } } /** * @private * @param {?} value * @return {?} */ }, { key: "_updateValue", value: function _updateValue(value) { var _this384 = this; resolvedPromise$1.then( /** * @return {?} */ function () { _this384.control.setValue(value, { emitViewToModelChange: false }); }); } /** * @private * @param {?} changes * @return {?} */ }, { key: "_updateDisabled", value: function _updateDisabled(changes) { var _this385 = this; /** @type {?} */ var disabledValue = changes['isDisabled'].currentValue; /** @type {?} */ var isDisabled = disabledValue === '' || disabledValue && disabledValue !== 'false'; resolvedPromise$1.then( /** * @return {?} */ function () { if (isDisabled && !_this385.control.disabled) { _this385.control.disable(); } else if (!isDisabled && _this385.control.disabled) { _this385.control.enable(); } }); } }, { key: "path", get: function get() { return this._parent ? controlPath(this.name, this._parent) : [this.name]; } /** * \@description * The top-level directive for this control if present, otherwise null. * @return {?} */ }, { key: "formDirective", get: function get() { return this._parent ? this._parent.formDirective : null; } /** * \@description * Synchronous validator function composed of all the synchronous validators * registered with this directive. * @return {?} */ }, { key: "validator", get: function get() { return composeValidators(this._rawValidators); } /** * \@description * Async validator function composed of all the async validators registered with this * directive. * @return {?} */ }, { key: "asyncValidator", get: function get() { return composeAsyncValidators(this._rawAsyncValidators); } }]); return NgModel; }(NgControl); NgModel.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[ngModel]:not([formControlName]):not([formControl])', providers: [formControlBinding], exportAs: 'ngModel' }] }]; /** @nocollapse */ NgModel.ctorParameters = function () { return [{ type: ControlContainer, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Host"] }] }, { type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_VALIDATORS] }] }, { type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_ASYNC_VALIDATORS] }] }, { type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_VALUE_ACCESSOR] }] }]; }; NgModel.propDecorators = { name: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }], isDisabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['disabled'] }], model: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['ngModel'] }], options: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['ngModelOptions'] }], update: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"], args: ['ngModelChange'] }] }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@description * * Adds `novalidate` attribute to all forms by default. * * `novalidate` is used to disable browser's native form validation. * * If you want to use native validation with Angular forms, just add `ngNativeValidate` attribute: * * ``` * <form ngNativeValidate></form> * ``` * * \@publicApi * \@ngModule ReactiveFormsModule * \@ngModule FormsModule */ var ɵNgNoValidate = function ɵNgNoValidate() { _classCallCheck(this, ɵNgNoValidate); }; ɵNgNoValidate.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'form:not([ngNoForm]):not([ngNativeValidate])', host: { 'novalidate': '' } }] }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Token to provide to turn off the ngModel warning on formControl and formControlName. * @type {?} */ var NG_MODEL_WITH_FORM_CONTROL_WARNING = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('NgModelWithFormControlWarning'); /** @type {?} */ var formControlBinding$1 = { provide: NgControl, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return FormControlDirective; }) }; /** * \@description * * Syncs a standalone `FormControl` instance to a form control element. * * @see [Reactive Forms Guide](guide/reactive-forms) * @see `FormControl` * @see `AbstractControl` * * \@usageNotes * * ### Registering a single form control * * The following examples shows how to register a standalone control and set its value. * * {\@example forms/ts/simpleFormControl/simple_form_control_example.ts region='Component'} * * ### Use with ngModel * * Support for using the `ngModel` input property and `ngModelChange` event with reactive * form directives has been deprecated in Angular v6 and will be removed in Angular v7. * * Now deprecated: * * ```html * <input [formControl]="control" [(ngModel)]="value"> * ``` * * ```ts * this.value = 'some value'; * ``` * * This has been deprecated for a few reasons. First, developers have found this pattern * confusing. It seems like the actual `ngModel` directive is being used, but in fact it's * an input/output property named `ngModel` on the reactive form directive that simply * approximates (some of) its behavior. Specifically, it allows getting/setting the value * and intercepting value events. However, some of `ngModel`'s other features - like * delaying updates with`ngModelOptions` or exporting the directive - simply don't work, * which has understandably caused some confusion. * * In addition, this pattern mixes template-driven and reactive forms strategies, which * we generally don't recommend because it doesn't take advantage of the full benefits of * either strategy. Setting the value in the template violates the template-agnostic * principles behind reactive forms, whereas adding a `FormControl`/`FormGroup` layer in * the class removes the convenience of defining forms in the template. * * To update your code before v7, you'll want to decide whether to stick with reactive form * directives (and get/set values using reactive forms patterns) or switch over to * template-driven directives. * * After (choice 1 - use reactive forms): * * ```html * <input [formControl]="control"> * ``` * * ```ts * this.control.setValue('some value'); * ``` * * After (choice 2 - use template-driven forms): * * ```html * <input [(ngModel)]="value"> * ``` * * ```ts * this.value = 'some value'; * ``` * * By default, when you use this pattern, you will see a deprecation warning once in dev * mode. You can choose to silence this warning by providing a config for * `ReactiveFormsModule` at import time: * * ```ts * imports: [ * ReactiveFormsModule.withConfig({warnOnNgModelWithFormControl: 'never'}); * ] * ``` * * Alternatively, you can choose to surface a separate warning for each instance of this * pattern with a config value of `"always"`. This may help to track down where in the code * the pattern is being used as the code is being updated. * * \@ngModule ReactiveFormsModule * \@publicApi */ var FormControlDirective = /*#__PURE__*/function (_NgControl2) { _inherits(FormControlDirective, _NgControl2); var _super137 = _createSuper(FormControlDirective); /** * @param {?} validators * @param {?} asyncValidators * @param {?} valueAccessors * @param {?} _ngModelWarningConfig */ function FormControlDirective(validators, asyncValidators, valueAccessors, _ngModelWarningConfig) { var _this386; _classCallCheck(this, FormControlDirective); _this386 = _super137.call(this); _this386._ngModelWarningConfig = _ngModelWarningConfig; /** * @deprecated as of v6 */ _this386.update = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * \@description * Instance property used to track whether an ngModel warning has been sent out for this * particular `FormControlDirective` instance. Used to support warning config of "always". * * \@internal */ _this386._ngModelWarningSent = false; _this386._rawValidators = validators || []; _this386._rawAsyncValidators = asyncValidators || []; _this386.valueAccessor = selectValueAccessor(_assertThisInitialized(_this386), valueAccessors); return _this386; } /** * \@description * Triggers a warning that this input should not be used with reactive forms. * @param {?} isDisabled * @return {?} */ _createClass2(FormControlDirective, [{ key: "ngOnChanges", /** * \@description * A lifecycle method called when the directive's inputs change. For internal use * only. * * @param {?} changes A object of key/value pairs for the set of changed inputs. * @return {?} */ value: function ngOnChanges(changes) { if (this._isControlChanged(changes)) { setUpControl(this.form, this); if (this.control.disabled && /** @type {?} */ this.valueAccessor.setDisabledState) { /** @type {?} */ /** @type {?} */ this.valueAccessor.setDisabledState(true); } this.form.updateValueAndValidity({ emitEvent: false }); } if (isPropertyUpdated(changes, this.viewModel)) { _ngModelWarning('formControl', FormControlDirective, this, this._ngModelWarningConfig); this.form.setValue(this.model); this.viewModel = this.model; } } /** * \@description * Returns an array that represents the path from the top-level form to this control. * Each index is the string name of the control on that level. * @return {?} */ }, { key: "viewToModelUpdate", /** * \@description * Sets the new value for the view model and emits an `ngModelChange` event. * * @param {?} newValue The new value for the view model. * @return {?} */ value: function viewToModelUpdate(newValue) { this.viewModel = newValue; this.update.emit(newValue); } /** * @private * @param {?} changes * @return {?} */ }, { key: "_isControlChanged", value: function _isControlChanged(changes) { return changes.hasOwnProperty('form'); } }, { key: "isDisabled", set: function set(isDisabled) { ReactiveErrors.disabledAttrWarning(); } }, { key: "path", get: function get() { return []; } /** * \@description * Synchronous validator function composed of all the synchronous validators * registered with this directive. * @return {?} */ }, { key: "validator", get: function get() { return composeValidators(this._rawValidators); } /** * \@description * Async validator function composed of all the async validators registered with this * directive. * @return {?} */ }, { key: "asyncValidator", get: function get() { return composeAsyncValidators(this._rawAsyncValidators); } /** * \@description * The `FormControl` bound to this directive. * @return {?} */ }, { key: "control", get: function get() { return this.form; } }]); return FormControlDirective; }(NgControl); /** * \@description * Static property used to track whether any ngModel warnings have been sent across * all instances of FormControlDirective. Used to support warning config of "once". * * \@internal */ FormControlDirective._ngModelWarningSentOnce = false; FormControlDirective.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[formControl]', providers: [formControlBinding$1], exportAs: 'ngForm' }] }]; /** @nocollapse */ FormControlDirective.ctorParameters = function () { return [{ type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_VALIDATORS] }] }, { type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_ASYNC_VALIDATORS] }] }, { type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_VALUE_ACCESSOR] }] }, { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_MODEL_WITH_FORM_CONTROL_WARNING] }] }]; }; FormControlDirective.propDecorators = { form: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['formControl'] }], isDisabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['disabled'] }], model: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['ngModel'] }], update: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"], args: ['ngModelChange'] }] }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var formDirectiveProvider$1 = { provide: ControlContainer, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return FormGroupDirective; }) }; /** * \@description * * Binds an existing `FormGroup` to a DOM element. * * This directive accepts an existing `FormGroup` instance. It will then use this * `FormGroup` instance to match any child `FormControl`, `FormGroup`, * and `FormArray` instances to child `FormControlName`, `FormGroupName`, * and `FormArrayName` directives. * * @see [Reactive Forms Guide](guide/reactive-forms) * @see `AbstractControl` * * ### Register Form Group * * The following example registers a `FormGroup` with first name and last name controls, * and listens for the *ngSubmit* event when the button is clicked. * * {\@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'} * * \@ngModule ReactiveFormsModule * \@publicApi */ var FormGroupDirective = /*#__PURE__*/function (_ControlContainer3) { _inherits(FormGroupDirective, _ControlContainer3); var _super138 = _createSuper(FormGroupDirective); /** * @param {?} _validators * @param {?} _asyncValidators */ function FormGroupDirective(_validators, _asyncValidators) { var _this387; _classCallCheck(this, FormGroupDirective); _this387 = _super138.call(this); _this387._validators = _validators; _this387._asyncValidators = _asyncValidators; /** * \@description * Reports whether the form submission has been triggered. */ _this387.submitted = false; /** * \@description * Tracks the list of added `FormControlName` instances */ _this387.directives = []; /** * \@description * Tracks the `FormGroup` bound to this directive. */ _this387.form = /** @type {?} */ null; /** * \@description * Emits an event when the form submission has been triggered. */ _this387.ngSubmit = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); return _this387; } /** * \@description * A lifecycle method called when the directive's inputs change. For internal use only. * * @param {?} changes A object of key/value pairs for the set of changed inputs. * @return {?} */ _createClass2(FormGroupDirective, [{ key: "ngOnChanges", value: function ngOnChanges(changes) { this._checkFormPresent(); if (changes.hasOwnProperty('form')) { this._updateValidators(); this._updateDomValue(); this._updateRegistrations(); } } /** * \@description * Returns this directive's instance. * @return {?} */ }, { key: "addControl", /** * \@description * Method that sets up the control directive in this group, re-calculates its value * and validity, and adds the instance to the internal list of directives. * * @param {?} dir The `FormControlName` directive instance. * @return {?} */ value: function addControl(dir) { /** @type {?} */ var ctrl = this.form.get(dir.path); setUpControl(ctrl, dir); ctrl.updateValueAndValidity({ emitEvent: false }); this.directives.push(dir); return ctrl; } /** * \@description * Retrieves the `FormControl` instance from the provided `FormControlName` directive * * @param {?} dir The `FormControlName` directive instance. * @return {?} */ }, { key: "getControl", value: function getControl(dir) { return ( /** @type {?} */ this.form.get(dir.path) ); } /** * \@description * Removes the `FormControlName` instance from the internal list of directives * * @param {?} dir The `FormControlName` directive instance. * @return {?} */ }, { key: "removeControl", value: function removeControl(dir) { removeDir(this.directives, dir); } /** * Adds a new `FormGroupName` directive instance to the form. * * @param {?} dir The `FormGroupName` directive instance. * @return {?} */ }, { key: "addFormGroup", value: function addFormGroup(dir) { /** @type {?} */ var ctrl = this.form.get(dir.path); setUpFormContainer(ctrl, dir); ctrl.updateValueAndValidity({ emitEvent: false }); } /** * No-op method to remove the form group. * * @param {?} dir The `FormGroupName` directive instance. * @return {?} */ }, { key: "removeFormGroup", value: function removeFormGroup(dir) {} /** * \@description * Retrieves the `FormGroup` for a provided `FormGroupName` directive instance * * @param {?} dir The `FormGroupName` directive instance. * @return {?} */ }, { key: "getFormGroup", value: function getFormGroup(dir) { return ( /** @type {?} */ this.form.get(dir.path) ); } /** * Adds a new `FormArrayName` directive instance to the form. * * @param {?} dir The `FormArrayName` directive instance. * @return {?} */ }, { key: "addFormArray", value: function addFormArray(dir) { /** @type {?} */ var ctrl = this.form.get(dir.path); setUpFormContainer(ctrl, dir); ctrl.updateValueAndValidity({ emitEvent: false }); } /** * No-op method to remove the form array. * * @param {?} dir The `FormArrayName` directive instance. * @return {?} */ }, { key: "removeFormArray", value: function removeFormArray(dir) {} /** * \@description * Retrieves the `FormArray` for a provided `FormArrayName` directive instance. * * @param {?} dir The `FormArrayName` directive instance. * @return {?} */ }, { key: "getFormArray", value: function getFormArray(dir) { return ( /** @type {?} */ this.form.get(dir.path) ); } /** * Sets the new value for the provided `FormControlName` directive. * * @param {?} dir The `FormControlName` directive instance. * @param {?} value The new value for the directive's control. * @return {?} */ }, { key: "updateModel", value: function updateModel(dir, value) { /** @type {?} */ var ctrl = /** @type {?} */ this.form.get(dir.path); ctrl.setValue(value); } /** * \@description * Method called with the "submit" event is triggered on the form. * Triggers the `ngSubmit` emitter to emit the "submit" event as its payload. * * @param {?} $event The "submit" event object * @return {?} */ }, { key: "onSubmit", value: function onSubmit($event) { /** @type {?} */ this.submitted = true; syncPendingControls(this.form, this.directives); this.ngSubmit.emit($event); return false; } /** * \@description * Method called when the "reset" event is triggered on the form. * @return {?} */ }, { key: "onReset", value: function onReset() { this.resetForm(); } /** * \@description * Resets the form to an initial value and resets its submitted status. * * @param {?=} value The new value for the form. * @return {?} */ }, { key: "resetForm", value: function resetForm() { var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined; this.form.reset(value); /** @type {?} */ this.submitted = false; } /** * \@internal * @return {?} */ }, { key: "_updateDomValue", value: function _updateDomValue() { var _this388 = this; this.directives.forEach( /** * @param {?} dir * @return {?} */ function (dir) { /** @type {?} */ var newCtrl = _this388.form.get(dir.path); if (dir.control !== newCtrl) { cleanUpControl(dir.control, dir); if (newCtrl) setUpControl(newCtrl, dir); /** @type {?} */ dir.control = newCtrl; } }); this.form._updateTreeValidity({ emitEvent: false }); } /** * @private * @return {?} */ }, { key: "_updateRegistrations", value: function _updateRegistrations() { var _this389 = this; this.form._registerOnCollectionChange( /** * @return {?} */ function () { return _this389._updateDomValue(); }); if (this._oldForm) this._oldForm._registerOnCollectionChange( /** * @return {?} */ function () {}); this._oldForm = this.form; } /** * @private * @return {?} */ }, { key: "_updateValidators", value: function _updateValidators() { /** @type {?} */ var sync = composeValidators(this._validators); this.form.validator = Validators.compose([ /** @type {?} */ this.form.validator, /** @type {?} */ sync]); /** @type {?} */ var async = composeAsyncValidators(this._asyncValidators); this.form.asyncValidator = Validators.composeAsync([ /** @type {?} */ this.form.asyncValidator, /** @type {?} */ async]); } /** * @private * @return {?} */ }, { key: "_checkFormPresent", value: function _checkFormPresent() { if (!this.form) { ReactiveErrors.missingFormException(); } } }, { key: "formDirective", get: function get() { return this; } /** * \@description * Returns the `FormGroup` bound to this directive. * @return {?} */ }, { key: "control", get: function get() { return this.form; } /** * \@description * Returns an array representing the path to this group. Because this directive * always lives at the top level of a form, it always an empty array. * @return {?} */ }, { key: "path", get: function get() { return []; } }]); return FormGroupDirective; }(ControlContainer); FormGroupDirective.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[formGroup]', providers: [formDirectiveProvider$1], host: { '(submit)': 'onSubmit($event)', '(reset)': 'onReset()' }, exportAs: 'ngForm' }] }]; /** @nocollapse */ FormGroupDirective.ctorParameters = function () { return [{ type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_VALIDATORS] }] }, { type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_ASYNC_VALIDATORS] }] }]; }; FormGroupDirective.propDecorators = { form: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['formGroup'] }], ngSubmit: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] }] }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var formGroupNameProvider = { provide: ControlContainer, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return FormGroupName; }) }; /** * \@description * * Syncs a nested `FormGroup` to a DOM element. * * This directive can only be used with a parent `FormGroupDirective`. * * It accepts the string name of the nested `FormGroup` to link, and * looks for a `FormGroup` registered with that name in the parent * `FormGroup` instance you passed into `FormGroupDirective`. * * Use nested form groups to validate a sub-group of a * form separately from the rest or to group the values of certain * controls into their own nested object. * * @see [Reactive Forms Guide](guide/reactive-forms) * * \@usageNotes * * ### Access the group by name * * The following example uses the {\@link AbstractControl#get get} method to access the * associated `FormGroup` * * ```ts * this.form.get('name'); * ``` * * ### Access individual controls in the group * * The following example uses the {\@link AbstractControl#get get} method to access * individual controls within the group using dot syntax. * * ```ts * this.form.get('name.first'); * ``` * * ### Register a nested `FormGroup`. * * The following example registers a nested *name* `FormGroup` within an existing `FormGroup`, * and provides methods to retrieve the nested `FormGroup` and individual controls. * * {\@example forms/ts/nestedFormGroup/nested_form_group_example.ts region='Component'} * * \@ngModule ReactiveFormsModule * \@publicApi */ var FormGroupName = /*#__PURE__*/function (_AbstractFormGroupDir2) { _inherits(FormGroupName, _AbstractFormGroupDir2); var _super139 = _createSuper(FormGroupName); /** * @param {?} parent * @param {?} validators * @param {?} asyncValidators */ function FormGroupName(parent, validators, asyncValidators) { var _this390; _classCallCheck(this, FormGroupName); _this390 = _super139.call(this); _this390._parent = parent; _this390._validators = validators; _this390._asyncValidators = asyncValidators; return _this390; } /** * \@internal * @return {?} */ _createClass2(FormGroupName, [{ key: "_checkParentType", value: function _checkParentType() { if (_hasInvalidParent(this._parent)) { ReactiveErrors.groupParentException(); } } }]); return FormGroupName; }(AbstractFormGroupDirective); FormGroupName.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[formGroupName]', providers: [formGroupNameProvider] }] }]; /** @nocollapse */ FormGroupName.ctorParameters = function () { return [{ type: ControlContainer, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Host"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["SkipSelf"] }] }, { type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_VALIDATORS] }] }, { type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_ASYNC_VALIDATORS] }] }]; }; FormGroupName.propDecorators = { name: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['formGroupName'] }] }; if (false) {} /** @type {?} */ var formArrayNameProvider = { provide: ControlContainer, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return FormArrayName; }) }; /** * \@description * * Syncs a nested `FormArray` to a DOM element. * * This directive is designed to be used with a parent `FormGroupDirective` (selector: * `[formGroup]`). * * It accepts the string name of the nested `FormArray` you want to link, and * will look for a `FormArray` registered with that name in the parent * `FormGroup` instance you passed into `FormGroupDirective`. * * @see [Reactive Forms Guide](guide/reactive-forms) * @see `AbstractControl` * * \@usageNotes * * ### Example * * {\@example forms/ts/nestedFormArray/nested_form_array_example.ts region='Component'} * * \@ngModule ReactiveFormsModule * \@publicApi */ var FormArrayName = /*#__PURE__*/function (_ControlContainer4) { _inherits(FormArrayName, _ControlContainer4); var _super140 = _createSuper(FormArrayName); /** * @param {?} parent * @param {?} validators * @param {?} asyncValidators */ function FormArrayName(parent, validators, asyncValidators) { var _this391; _classCallCheck(this, FormArrayName); _this391 = _super140.call(this); _this391._parent = parent; _this391._validators = validators; _this391._asyncValidators = asyncValidators; return _this391; } /** * \@description * A lifecycle method called when the directive's inputs are initialized. For internal use only. * * @throws If the directive does not have a valid parent. * @return {?} */ _createClass2(FormArrayName, [{ key: "ngOnInit", value: function ngOnInit() { this._checkParentType(); /** @type {?} */ this.formDirective.addFormArray(this); } /** * \@description * A lifecycle method called before the directive's instance is destroyed. For internal use only. * @return {?} */ }, { key: "ngOnDestroy", value: function ngOnDestroy() { if (this.formDirective) { this.formDirective.removeFormArray(this); } } /** * \@description * The `FormArray` bound to this directive. * @return {?} */ }, { key: "_checkParentType", /** * @private * @return {?} */ value: function _checkParentType() { if (_hasInvalidParent(this._parent)) { ReactiveErrors.arrayParentException(); } } }, { key: "control", get: function get() { return ( /** @type {?} */ this.formDirective.getFormArray(this) ); } /** * \@description * The top-level directive for this group if present, otherwise null. * @return {?} */ }, { key: "formDirective", get: function get() { return this._parent ? /** @type {?} */ this._parent.formDirective : null; } /** * \@description * Returns an array that represents the path from the top-level form to this control. * Each index is the string name of the control on that level. * @return {?} */ }, { key: "path", get: function get() { return controlPath(this.name, this._parent); } /** * \@description * Synchronous validator function composed of all the synchronous validators registered with this * directive. * @return {?} */ }, { key: "validator", get: function get() { return composeValidators(this._validators); } /** * \@description * Async validator function composed of all the async validators registered with this directive. * @return {?} */ }, { key: "asyncValidator", get: function get() { return composeAsyncValidators(this._asyncValidators); } }]); return FormArrayName; }(ControlContainer); FormArrayName.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[formArrayName]', providers: [formArrayNameProvider] }] }]; /** @nocollapse */ FormArrayName.ctorParameters = function () { return [{ type: ControlContainer, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Host"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["SkipSelf"] }] }, { type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_VALIDATORS] }] }, { type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_ASYNC_VALIDATORS] }] }]; }; FormArrayName.propDecorators = { name: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['formArrayName'] }] }; if (false) {} /** * @param {?} parent * @return {?} */ function _hasInvalidParent(parent) { return !(parent instanceof FormGroupName) && !(parent instanceof FormGroupDirective) && !(parent instanceof FormArrayName); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var controlNameBinding = { provide: NgControl, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return FormControlName; }) }; /** * \@description * Syncs a `FormControl` in an existing `FormGroup` to a form control * element by name. * * @see [Reactive Forms Guide](guide/reactive-forms) * @see `FormControl` * @see `AbstractControl` * * \@usageNotes * * ### Register `FormControl` within a group * * The following example shows how to register multiple form controls within a form group * and set their value. * * {\@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'} * * To see `formControlName` examples with different form control types, see: * * * Radio buttons: `RadioControlValueAccessor` * * Selects: `SelectControlValueAccessor` * * ### Use with ngModel * * Support for using the `ngModel` input property and `ngModelChange` event with reactive * form directives has been deprecated in Angular v6 and will be removed in Angular v7. * * Now deprecated: * * ```html * <form [formGroup]="form"> * <input formControlName="first" [(ngModel)]="value"> * </form> * ``` * * ```ts * this.value = 'some value'; * ``` * * This has been deprecated for a few reasons. First, developers have found this pattern * confusing. It seems like the actual `ngModel` directive is being used, but in fact it's * an input/output property named `ngModel` on the reactive form directive that simply * approximates (some of) its behavior. Specifically, it allows getting/setting the value * and intercepting value events. However, some of `ngModel`'s other features - like * delaying updates with`ngModelOptions` or exporting the directive - simply don't work, * which has understandably caused some confusion. * * In addition, this pattern mixes template-driven and reactive forms strategies, which * we generally don't recommend because it doesn't take advantage of the full benefits of * either strategy. Setting the value in the template violates the template-agnostic * principles behind reactive forms, whereas adding a `FormControl`/`FormGroup` layer in * the class removes the convenience of defining forms in the template. * * To update your code before v7, you'll want to decide whether to stick with reactive form * directives (and get/set values using reactive forms patterns) or switch over to * template-driven directives. * * After (choice 1 - use reactive forms): * * ```html * <form [formGroup]="form"> * <input formControlName="first"> * </form> * ``` * * ```ts * this.form.get('first').setValue('some value'); * ``` * * After (choice 2 - use template-driven forms): * * ```html * <input [(ngModel)]="value"> * ``` * * ```ts * this.value = 'some value'; * ``` * * By default, when you use this pattern, you will see a deprecation warning once in dev * mode. You can choose to silence this warning by providing a config for * `ReactiveFormsModule` at import time: * * ```ts * imports: [ * ReactiveFormsModule.withConfig({warnOnNgModelWithFormControl: 'never'}) * ] * ``` * * Alternatively, you can choose to surface a separate warning for each instance of this * pattern with a config value of `"always"`. This may help to track down where in the code * the pattern is being used as the code is being updated. * * \@ngModule ReactiveFormsModule * \@publicApi */ var FormControlName = /*#__PURE__*/function (_NgControl3) { _inherits(FormControlName, _NgControl3); var _super141 = _createSuper(FormControlName); /** * @param {?} parent * @param {?} validators * @param {?} asyncValidators * @param {?} valueAccessors * @param {?} _ngModelWarningConfig */ function FormControlName(parent, validators, asyncValidators, valueAccessors, _ngModelWarningConfig) { var _this392; _classCallCheck(this, FormControlName); _this392 = _super141.call(this); _this392._ngModelWarningConfig = _ngModelWarningConfig; _this392._added = false; /** * @deprecated as of v6 */ _this392.update = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"](); /** * \@description * Instance property used to track whether an ngModel warning has been sent out for this * particular FormControlName instance. Used to support warning config of "always". * * \@internal */ _this392._ngModelWarningSent = false; _this392._parent = parent; _this392._rawValidators = validators || []; _this392._rawAsyncValidators = asyncValidators || []; _this392.valueAccessor = selectValueAccessor(_assertThisInitialized(_this392), valueAccessors); return _this392; } /** * \@description * Triggers a warning that this input should not be used with reactive forms. * @param {?} isDisabled * @return {?} */ _createClass2(FormControlName, [{ key: "ngOnChanges", /** * \@description * A lifecycle method called when the directive's inputs change. For internal use only. * * @param {?} changes A object of key/value pairs for the set of changed inputs. * @return {?} */ value: function ngOnChanges(changes) { if (!this._added) this._setUpControl(); if (isPropertyUpdated(changes, this.viewModel)) { _ngModelWarning('formControlName', FormControlName, this, this._ngModelWarningConfig); this.viewModel = this.model; this.formDirective.updateModel(this, this.model); } } /** * \@description * Lifecycle method called before the directive's instance is destroyed. For internal use only. * @return {?} */ }, { key: "ngOnDestroy", value: function ngOnDestroy() { if (this.formDirective) { this.formDirective.removeControl(this); } } /** * \@description * Sets the new value for the view model and emits an `ngModelChange` event. * * @param {?} newValue The new value for the view model. * @return {?} */ }, { key: "viewToModelUpdate", value: function viewToModelUpdate(newValue) { this.viewModel = newValue; this.update.emit(newValue); } /** * \@description * Returns an array that represents the path from the top-level form to this control. * Each index is the string name of the control on that level. * @return {?} */ }, { key: "_checkParentType", /** * @private * @return {?} */ value: function _checkParentType() { if (!(this._parent instanceof FormGroupName) && this._parent instanceof AbstractFormGroupDirective) { ReactiveErrors.ngModelGroupException(); } else if (!(this._parent instanceof FormGroupName) && !(this._parent instanceof FormGroupDirective) && !(this._parent instanceof FormArrayName)) { ReactiveErrors.controlParentException(); } } /** * @private * @return {?} */ }, { key: "_setUpControl", value: function _setUpControl() { this._checkParentType(); /** @type {?} */ this.control = this.formDirective.addControl(this); if (this.control.disabled && /** @type {?} */ this.valueAccessor.setDisabledState) { /** @type {?} */ /** @type {?} */ this.valueAccessor.setDisabledState(true); } this._added = true; } }, { key: "isDisabled", set: function set(isDisabled) { ReactiveErrors.disabledAttrWarning(); } }, { key: "path", get: function get() { return controlPath(this.name, /** @type {?} */ this._parent); } /** * \@description * The top-level directive for this group if present, otherwise null. * @return {?} */ }, { key: "formDirective", get: function get() { return this._parent ? this._parent.formDirective : null; } /** * \@description * Synchronous validator function composed of all the synchronous validators * registered with this directive. * @return {?} */ }, { key: "validator", get: function get() { return composeValidators(this._rawValidators); } /** * \@description * Async validator function composed of all the async validators registered with this * directive. * @return {?} */ }, { key: "asyncValidator", get: function get() { return ( /** @type {?} */ composeAsyncValidators(this._rawAsyncValidators) ); } }]); return FormControlName; }(NgControl); /** * \@description * Static property used to track whether any ngModel warnings have been sent across * all instances of FormControlName. Used to support warning config of "once". * * \@internal */ FormControlName._ngModelWarningSentOnce = false; FormControlName.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[formControlName]', providers: [controlNameBinding] }] }]; /** @nocollapse */ FormControlName.ctorParameters = function () { return [{ type: ControlContainer, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Host"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["SkipSelf"] }] }, { type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_VALIDATORS] }] }, { type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_ASYNC_VALIDATORS] }] }, { type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Self"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_VALUE_ACCESSOR] }] }, { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"], args: [NG_MODEL_WITH_FORM_CONTROL_WARNING] }] }]; }; FormControlName.propDecorators = { name: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['formControlName'] }], isDisabled: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['disabled'] }], model: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"], args: ['ngModel'] }], update: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"], args: ['ngModelChange'] }] }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@description * An interface implemented by classes that perform synchronous validation. * * \@usageNotes * * ### Provide a custom validator * * The following example implements the `Validator` interface to create a * validator directive with a custom error key. * * ```typescript * \@Directive({ * selector: '[customValidator]', * providers: [{provide: NG_VALIDATORS, useExisting: CustomValidatorDirective, multi: true}] * }) * class CustomValidatorDirective implements Validator { * validate(control: AbstractControl): ValidationErrors|null { * return {'custom': true}; * } * } * ``` * * \@publicApi * @record */ function Validator() {} if (false) {} /** * \@description * An interface implemented by classes that perform asynchronous validation. * * \@usageNotes * * ### Provide a custom async validator directive * * The following example implements the `AsyncValidator` interface to create an * async validator directive with a custom error key. * * ```typescript * import { of as observableOf } from 'rxjs'; * * \@Directive({ * selector: '[customAsyncValidator]', * providers: [{provide: NG_ASYNC_VALIDATORS, useExisting: CustomAsyncValidatorDirective, multi: * true}] * }) * class CustomAsyncValidatorDirective implements AsyncValidator { * validate(control: AbstractControl): Observable<ValidationErrors|null> { * return observableOf({'custom': true}); * } * } * ``` * * \@publicApi * @record */ function AsyncValidator() {} if (false) {} /** * \@description * Provider which adds `RequiredValidator` to the `NG_VALIDATORS` multi-provider list. * @type {?} */ var REQUIRED_VALIDATOR = { provide: NG_VALIDATORS, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return RequiredValidator; }), multi: true }; /** * \@description * Provider which adds `CheckboxRequiredValidator` to the `NG_VALIDATORS` multi-provider list. * @type {?} */ var CHECKBOX_REQUIRED_VALIDATOR = { provide: NG_VALIDATORS, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return CheckboxRequiredValidator; }), multi: true }; /** * \@description * A directive that adds the `required` validator to any controls marked with the * `required` attribute. The directive is provided with the `NG_VALIDATORS` multi-provider list. * * @see [Form Validation](guide/form-validation) * * \@usageNotes * * ### Adding a required validator using template-driven forms * * ``` * <input name="fullName" ngModel required> * ``` * * \@ngModule FormsModule * \@ngModule ReactiveFormsModule * \@publicApi */ var RequiredValidator = /*#__PURE__*/function () { function RequiredValidator() { _classCallCheck(this, RequiredValidator); } _createClass2(RequiredValidator, [{ key: "validate", /** * \@description * Method that validates whether the control is empty. * Returns the validation result if enabled, otherwise null. * @param {?} control * @return {?} */ value: function validate(control) { return this.required ? Validators.required(control) : null; } /** * \@description * Registers a callback function to call when the validator inputs change. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnValidatorChange", value: function registerOnValidatorChange(fn) { this._onChange = fn; } }, { key: "required", /** * \@description * Tracks changes to the required attribute bound to this directive. * @return {?} */ get: function get() { return this._required; } /** * @param {?} value * @return {?} */ , set: function set(value) { this._required = value != null && value !== false && "".concat(value) !== 'false'; if (this._onChange) this._onChange(); } }]); return RequiredValidator; }(); RequiredValidator.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: ':not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]', providers: [REQUIRED_VALIDATOR], host: { '[attr.required]': 'required ? "" : null' } }] }]; RequiredValidator.propDecorators = { required: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; if (false) {} /** * A Directive that adds the `required` validator to checkbox controls marked with the * `required` attribute. The directive is provided with the `NG_VALIDATORS` multi-provider list. * * @see [Form Validation](guide/form-validation) * * \@usageNotes * * ### Adding a required checkbox validator using template-driven forms * * The following example shows how to add a checkbox required validator to an input attached to an ngModel binding. * * ``` * <input type="checkbox" name="active" ngModel required> * ``` * * \@publicApi * \@ngModule FormsModule * \@ngModule ReactiveFormsModule */ var CheckboxRequiredValidator = /*#__PURE__*/function (_RequiredValidator) { _inherits(CheckboxRequiredValidator, _RequiredValidator); var _super142 = _createSuper(CheckboxRequiredValidator); function CheckboxRequiredValidator() { _classCallCheck(this, CheckboxRequiredValidator); return _super142.apply(this, arguments); } _createClass2(CheckboxRequiredValidator, [{ key: "validate", /** * \@description * Method that validates whether or not the checkbox has been checked. * Returns the validation result if enabled, otherwise null. * @param {?} control * @return {?} */ value: function validate(control) { return this.required ? Validators.requiredTrue(control) : null; } }]); return CheckboxRequiredValidator; }(RequiredValidator); CheckboxRequiredValidator.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: 'input[type=checkbox][required][formControlName],input[type=checkbox][required][formControl],input[type=checkbox][required][ngModel]', providers: [CHECKBOX_REQUIRED_VALIDATOR], host: { '[attr.required]': 'required ? "" : null' } }] }]; /** * \@description * Provider which adds `EmailValidator` to the `NG_VALIDATORS` multi-provider list. * @type {?} */ var EMAIL_VALIDATOR = { provide: NG_VALIDATORS, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return EmailValidator; }), multi: true }; /** * A directive that adds the `email` validator to controls marked with the * `email` attribute. The directive is provided with the `NG_VALIDATORS` multi-provider list. * * @see [Form Validation](guide/form-validation) * * \@usageNotes * * ### Adding an email validator * * The following example shows how to add an email validator to an input attached to an ngModel binding. * * ``` * <input type="email" name="email" ngModel email> * <input type="email" name="email" ngModel email="true"> * <input type="email" name="email" ngModel [email]="true"> * ``` * * \@publicApi * \@ngModule FormsModule * \@ngModule ReactiveFormsModule */ var EmailValidator = /*#__PURE__*/function () { function EmailValidator() { _classCallCheck(this, EmailValidator); } _createClass2(EmailValidator, [{ key: "validate", /** * \@description * Method that validates whether an email address is valid. * Returns the validation result if enabled, otherwise null. * @param {?} control * @return {?} */ value: function validate(control) { return this._enabled ? Validators.email(control) : null; } /** * \@description * Registers a callback function to call when the validator inputs change. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnValidatorChange", value: function registerOnValidatorChange(fn) { this._onChange = fn; } }, { key: "email", /** * \@description * Tracks changes to the email attribute bound to this directive. * @param {?} value * @return {?} */ set: function set(value) { this._enabled = value === '' || value === true || value === 'true'; if (this._onChange) this._onChange(); } }]); return EmailValidator; }(); EmailValidator.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[email][formControlName],[email][formControl],[email][ngModel]', providers: [EMAIL_VALIDATOR] }] }]; EmailValidator.propDecorators = { email: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; if (false) {} /** * \@description * A function that receives a control and synchronously returns a map of * validation errors if present, otherwise null. * * \@publicApi * @record */ function ValidatorFn() {} /** * \@description * A function that receives a control and returns a Promise or observable * that emits validation errors if present, otherwise null. * * \@publicApi * @record */ function AsyncValidatorFn() {} /** * \@description * Provider which adds `MinLengthValidator` to the `NG_VALIDATORS` multi-provider list. * @type {?} */ var MIN_LENGTH_VALIDATOR = { provide: NG_VALIDATORS, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return MinLengthValidator; }), multi: true }; /** * A directive that adds minimum length validation to controls marked with the * `minlength` attribute. The directive is provided with the `NG_VALIDATORS` mult-provider list. * * @see [Form Validation](guide/form-validation) * * \@usageNotes * * ### Adding a minimum length validator * * The following example shows how to add a minimum length validator to an input attached to an * ngModel binding. * * ```html * <input name="firstName" ngModel minlength="4"> * ``` * * \@ngModule ReactiveFormsModule * \@ngModule FormsModule * \@publicApi */ var MinLengthValidator = /*#__PURE__*/function () { function MinLengthValidator() { _classCallCheck(this, MinLengthValidator); } _createClass2(MinLengthValidator, [{ key: "ngOnChanges", /** * \@description * A lifecycle method called when the directive's inputs change. For internal use * only. * * @param {?} changes A object of key/value pairs for the set of changed inputs. * @return {?} */ value: function ngOnChanges(changes) { if ('minlength' in changes) { this._createValidator(); if (this._onChange) this._onChange(); } } /** * \@description * Method that validates whether the value meets a minimum length * requirement. Returns the validation result if enabled, otherwise null. * @param {?} control * @return {?} */ }, { key: "validate", value: function validate(control) { return this.minlength == null ? null : this._validator(control); } /** * \@description * Registers a callback function to call when the validator inputs change. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnValidatorChange", value: function registerOnValidatorChange(fn) { this._onChange = fn; } /** * @private * @return {?} */ }, { key: "_createValidator", value: function _createValidator() { this._validator = Validators.minLength(parseInt(this.minlength, 10)); } }]); return MinLengthValidator; }(); MinLengthValidator.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[minlength][formControlName],[minlength][formControl],[minlength][ngModel]', providers: [MIN_LENGTH_VALIDATOR], host: { '[attr.minlength]': 'minlength ? minlength : null' } }] }]; MinLengthValidator.propDecorators = { minlength: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; if (false) {} /** * \@description * Provider which adds `MaxLengthValidator` to the `NG_VALIDATORS` multi-provider list. * @type {?} */ var MAX_LENGTH_VALIDATOR = { provide: NG_VALIDATORS, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return MaxLengthValidator; }), multi: true }; /** * A directive that adds max length validation to controls marked with the * `maxlength` attribute. The directive is provided with the `NG_VALIDATORS` multi-provider list. * * @see [Form Validation](guide/form-validation) * * \@usageNotes * * ### Adding a maximum length validator * * The following example shows how to add a maximum length validator to an input attached to an * ngModel binding. * * ```html * <input name="firstName" ngModel maxlength="25"> * ``` * * \@ngModule ReactiveFormsModule * \@ngModule FormsModule * \@publicApi */ var MaxLengthValidator = /*#__PURE__*/function () { function MaxLengthValidator() { _classCallCheck(this, MaxLengthValidator); } _createClass2(MaxLengthValidator, [{ key: "ngOnChanges", /** * \@description * A lifecycle method called when the directive's inputs change. For internal use * only. * * @param {?} changes A object of key/value pairs for the set of changed inputs. * @return {?} */ value: function ngOnChanges(changes) { if ('maxlength' in changes) { this._createValidator(); if (this._onChange) this._onChange(); } } /** * \@description * Method that validates whether the value exceeds * the maximum length requirement. * @param {?} control * @return {?} */ }, { key: "validate", value: function validate(control) { return this.maxlength != null ? this._validator(control) : null; } /** * \@description * Registers a callback function to call when the validator inputs change. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnValidatorChange", value: function registerOnValidatorChange(fn) { this._onChange = fn; } /** * @private * @return {?} */ }, { key: "_createValidator", value: function _createValidator() { this._validator = Validators.maxLength(parseInt(this.maxlength, 10)); } }]); return MaxLengthValidator; }(); MaxLengthValidator.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]', providers: [MAX_LENGTH_VALIDATOR], host: { '[attr.maxlength]': 'maxlength ? maxlength : null' } }] }]; MaxLengthValidator.propDecorators = { maxlength: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; if (false) {} /** * \@description * Provider which adds `PatternValidator` to the `NG_VALIDATORS` multi-provider list. * @type {?} */ var PATTERN_VALIDATOR = { provide: NG_VALIDATORS, useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])( /** * @return {?} */ function () { return PatternValidator; }), multi: true }; /** * \@description * A directive that adds regex pattern validation to controls marked with the * `pattern` attribute. The regex must match the entire control value. * The directive is provided with the `NG_VALIDATORS` multi-provider list. * * @see [Form Validation](guide/form-validation) * * \@usageNotes * * ### Adding a pattern validator * * The following example shows how to add a pattern validator to an input attached to an * ngModel binding. * * ```html * <input name="firstName" ngModel pattern="[a-zA-Z ]*"> * ``` * * \@ngModule ReactiveFormsModule * \@ngModule FormsModule * \@publicApi */ var PatternValidator = /*#__PURE__*/function () { function PatternValidator() { _classCallCheck(this, PatternValidator); } _createClass2(PatternValidator, [{ key: "ngOnChanges", /** * \@description * A lifecycle method called when the directive's inputs change. For internal use * only. * * @param {?} changes A object of key/value pairs for the set of changed inputs. * @return {?} */ value: function ngOnChanges(changes) { if ('pattern' in changes) { this._createValidator(); if (this._onChange) this._onChange(); } } /** * \@description * Method that validates whether the value matches the * the pattern requirement. * @param {?} control * @return {?} */ }, { key: "validate", value: function validate(control) { return this._validator(control); } /** * \@description * Registers a callback function to call when the validator inputs change. * * @param {?} fn The callback function * @return {?} */ }, { key: "registerOnValidatorChange", value: function registerOnValidatorChange(fn) { this._onChange = fn; } /** * @private * @return {?} */ }, { key: "_createValidator", value: function _createValidator() { this._validator = Validators.pattern(this.pattern); } }]); return PatternValidator; }(); PatternValidator.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{ selector: '[pattern][formControlName],[pattern][formControl],[pattern][ngModel]', providers: [PATTERN_VALIDATOR], host: { '[attr.pattern]': 'pattern ? pattern : null' } }] }]; PatternValidator.propDecorators = { pattern: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] }] }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var SHARED_FORM_DIRECTIVES = [ɵNgNoValidate, NgSelectOption, ɵNgSelectMultipleOption, DefaultValueAccessor, NumberValueAccessor, RangeValueAccessor, CheckboxControlValueAccessor, SelectControlValueAccessor, SelectMultipleControlValueAccessor, RadioControlValueAccessor, NgControlStatus, NgControlStatusGroup, RequiredValidator, MinLengthValidator, MaxLengthValidator, PatternValidator, CheckboxRequiredValidator, EmailValidator]; /** @type {?} */ var TEMPLATE_DRIVEN_DIRECTIVES = [NgModel, NgModelGroup, NgForm, NgFormSelectorWarning]; /** @type {?} */ var REACTIVE_DRIVEN_DIRECTIVES = [FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName]; /** * Internal module used for sharing directives between FormsModule and ReactiveFormsModule */ var ɵInternalFormsSharedModule = function ɵInternalFormsSharedModule() { _classCallCheck(this, ɵInternalFormsSharedModule); }; ɵInternalFormsSharedModule.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ declarations: SHARED_FORM_DIRECTIVES, exports: SHARED_FORM_DIRECTIVES }] }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} options * @return {?} */ function isAbstractControlOptions(options) { return ( /** @type {?} */ options.asyncValidators !== undefined || /** @type {?} */ options.validators !== undefined || /** @type {?} */ options.updateOn !== undefined ); } /** * \@description * Creates an `AbstractControl` from a user-specified configuration. * * The `FormBuilder` provides syntactic sugar that shortens creating instances of a `FormControl`, * `FormGroup`, or `FormArray`. It reduces the amount of boilerplate needed to build complex * forms. * * @see [Reactive Forms Guide](/guide/reactive-forms) * * \@publicApi */ var FormBuilder = /*#__PURE__*/function () { function FormBuilder() { _classCallCheck(this, FormBuilder); } _createClass2(FormBuilder, [{ key: "group", /** * \@description * Construct a new `FormGroup` instance. * * @param {?} controlsConfig A collection of child controls. The key for each child is the name * under which it is registered. * * @param {?=} options Configuration options object for the `FormGroup`. The object can * have two shapes: * * 1) `AbstractControlOptions` object (preferred), which consists of: * * `validators`: A synchronous validator function, or an array of validator functions * * `asyncValidators`: A single async validator or array of async validator functions * * `updateOn`: The event upon which the control should be updated (options: 'change' | 'blur' | * submit') * * 2) Legacy configuration object, which consists of: * * `validator`: A synchronous validator function, or an array of validator functions * * `asyncValidator`: A single async validator or array of async validator functions * * @return {?} */ value: function group(controlsConfig) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; /** @type {?} */ var controls = this._reduceControls(controlsConfig); /** @type {?} */ var validators = null; /** @type {?} */ var asyncValidators = null; /** @type {?} */ var updateOn = undefined; if (options != null) { if (isAbstractControlOptions(options)) { // `options` are `AbstractControlOptions` validators = options.validators != null ? options.validators : null; asyncValidators = options.asyncValidators != null ? options.asyncValidators : null; updateOn = options.updateOn != null ? options.updateOn : undefined; } else { // `options` are legacy form group options validators = options['validator'] != null ? options['validator'] : null; asyncValidators = options['asyncValidator'] != null ? options['asyncValidator'] : null; } } return new FormGroup(controls, { asyncValidators: asyncValidators, updateOn: updateOn, validators: validators }); } /** * \@description * Construct a new `FormControl` with the given state, validators and options. * * \@usageNotes * * ### Initialize a control as disabled * * The following example returns a control with an initial value in a disabled state. * * <code-example path="forms/ts/formBuilder/form_builder_example.ts" region="disabled-control"> * </code-example> * @param {?} formState Initializes the control with an initial state value, or * with an object that contains both a value and a disabled status. * * @param {?=} validatorOrOpts A synchronous validator function, or an array of * such functions, or an `AbstractControlOptions` object that contains * validation functions and a validation trigger. * * @param {?=} asyncValidator A single async validator or array of async validator * functions. * * @return {?} */ }, { key: "control", value: function control(formState, validatorOrOpts, asyncValidator) { return new FormControl(formState, validatorOrOpts, asyncValidator); } /** * Constructs a new `FormArray` from the given array of configurations, * validators and options. * * @param {?} controlsConfig An array of child controls or control configs. Each * child control is given an index when it is registered. * * @param {?=} validatorOrOpts A synchronous validator function, or an array of * such functions, or an `AbstractControlOptions` object that contains * validation functions and a validation trigger. * * @param {?=} asyncValidator A single async validator or array of async validator * functions. * @return {?} */ }, { key: "array", value: function array(controlsConfig, validatorOrOpts, asyncValidator) { var _this393 = this; /** @type {?} */ var controls = controlsConfig.map( /** * @param {?} c * @return {?} */ function (c) { return _this393._createControl(c); }); return new FormArray(controls, validatorOrOpts, asyncValidator); } /** * \@internal * @param {?} controlsConfig * @return {?} */ }, { key: "_reduceControls", value: function _reduceControls(controlsConfig) { var _this394 = this; /** @type {?} */ var controls = {}; Object.keys(controlsConfig).forEach( /** * @param {?} controlName * @return {?} */ function (controlName) { controls[controlName] = _this394._createControl(controlsConfig[controlName]); }); return controls; } /** * \@internal * @param {?} controlConfig * @return {?} */ }, { key: "_createControl", value: function _createControl(controlConfig) { if (controlConfig instanceof FormControl || controlConfig instanceof FormGroup || controlConfig instanceof FormArray) { return controlConfig; } else if (Array.isArray(controlConfig)) { /** @type {?} */ var value = controlConfig[0]; /** @type {?} */ var validator = controlConfig.length > 1 ? controlConfig[1] : null; /** @type {?} */ var asyncValidator = controlConfig.length > 2 ? controlConfig[2] : null; return this.control(value, validator, asyncValidator); } else { return this.control(controlConfig); } } }]); return FormBuilder; }(); FormBuilder.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"] }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@publicApi * @type {?} */ var VERSION = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["Version"]('8.2.12'); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Exports the required providers and directives for template-driven forms, * making them available for import by NgModules that import this module. * * @see [Forms Guide](/guide/forms) * * \@publicApi */ var FormsModule = /*#__PURE__*/function () { function FormsModule() { _classCallCheck(this, FormsModule); } _createClass2(FormsModule, null, [{ key: "withConfig", /** * \@description * Provides options for configuring the template-driven forms module. * * @param {?} opts An object of configuration options * * `warnOnDeprecatedNgFormSelector` Configures when to emit a warning when the deprecated * `ngForm` selector is used. * @return {?} */ value: function withConfig(opts) { return { ngModule: FormsModule, providers: [{ provide: NG_FORM_SELECTOR_WARNING, useValue: opts.warnOnDeprecatedNgFormSelector }] }; } }]); return FormsModule; }(); FormsModule.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ declarations: TEMPLATE_DRIVEN_DIRECTIVES, providers: [RadioControlRegistry], exports: [ɵInternalFormsSharedModule, TEMPLATE_DRIVEN_DIRECTIVES] }] }]; /** * Exports the required infrastructure and directives for reactive forms, * making them available for import by NgModules that import this module. * @see [Forms](guide/reactive-forms) * * @see [Reactive Forms Guide](/guide/reactive-forms) * * \@publicApi */ var ReactiveFormsModule = /*#__PURE__*/function () { function ReactiveFormsModule() { _classCallCheck(this, ReactiveFormsModule); } _createClass2(ReactiveFormsModule, null, [{ key: "withConfig", /** * \@description * Provides options for configuring the reactive forms module. * * @param {?} opts An object of configuration options * * `warnOnNgModelWithFormControl` Configures when to emit a warning when an `ngModel` * binding is used with reactive form directives. * @return {?} */ value: function withConfig(opts) { return { ngModule: ReactiveFormsModule, providers: [{ provide: NG_MODEL_WITH_FORM_CONTROL_WARNING, useValue: opts.warnOnNgModelWithFormControl }] }; } }]); return ReactiveFormsModule; }(); ReactiveFormsModule.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{ declarations: [REACTIVE_DRIVEN_DIRECTIVES], providers: [FormBuilder, RadioControlRegistry], exports: [ɵInternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES] }] }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=forms.js.map /***/ }, /***/ "./node_modules/@angular/platform-browser-dynamic/fesm2015/platform-browser-dynamic.js": /*!*********************************************************************************************!*\ !*** ./node_modules/@angular/platform-browser-dynamic/fesm2015/platform-browser-dynamic.js ***! \*********************************************************************************************/ /*! exports provided: ɵangular_packages_platform_browser_dynamic_platform_browser_dynamic_a, VERSION, JitCompilerFactory, RESOURCE_CACHE_PROVIDER, platformBrowserDynamic, ɵCompilerImpl, ɵplatformCoreDynamic, ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, ɵResourceLoaderImpl */ /***/ function node_modulesAngularPlatformBrowserDynamicFesm2015PlatformBrowserDynamicJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_dynamic_platform_browser_dynamic_a", function () { return CachedResourceLoader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function () { return VERSION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JitCompilerFactory", function () { return JitCompilerFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RESOURCE_CACHE_PROVIDER", function () { return RESOURCE_CACHE_PROVIDER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "platformBrowserDynamic", function () { return platformBrowserDynamic; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵCompilerImpl", function () { return CompilerImpl; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵplatformCoreDynamic", function () { return platformCoreDynamic; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS", function () { return INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵResourceLoaderImpl", function () { return ResourceLoaderImpl; }); /* harmony import */ var _angular_compiler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! @angular/compiler */ "./node_modules/@angular/compiler/fesm2015/compiler.js"); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! @angular/core */ "./node_modules/@angular/core/fesm2015/core.js"); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! @angular/common */ "./node_modules/@angular/common/fesm2015/common.js"); /* harmony import */ var _angular_platform_browser__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! @angular/platform-browser */ "./node_modules/@angular/platform-browser/fesm2015/platform-browser.js"); /** * @license Angular v8.2.12 * (c) 2010-2019 Google LLC. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var MODULE_SUFFIX = ''; /** @type {?} */ var builtinExternalReferences = createBuiltinExternalReferencesMap(); var JitReflector = /*#__PURE__*/function () { function JitReflector() { _classCallCheck(this, JitReflector); this.reflectionCapabilities = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵReflectionCapabilities"](); } /** * @param {?} type * @param {?} cmpMetadata * @return {?} */ _createClass2(JitReflector, [{ key: "componentModuleUrl", value: function componentModuleUrl(type, cmpMetadata) { /** @type {?} */ var moduleId = cmpMetadata.moduleId; if (typeof moduleId === 'string') { /** @type {?} */ var scheme = Object(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["getUrlScheme"])(moduleId); return scheme ? moduleId : "package:".concat(moduleId).concat(MODULE_SUFFIX); } else if (moduleId !== null && moduleId !== void 0) { throw Object(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["syntaxError"])("moduleId should be a string in \"".concat(Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵstringify"])(type), "\". See https://goo.gl/wIDDiL for more information.\n") + "If you're using Webpack you should inline the template and the styles, see https://goo.gl/X2J8zc."); } return "./".concat(Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵstringify"])(type)); } /** * @param {?} typeOrFunc * @return {?} */ }, { key: "parameters", value: function parameters(typeOrFunc) { return this.reflectionCapabilities.parameters(typeOrFunc); } /** * @param {?} typeOrFunc * @return {?} */ }, { key: "tryAnnotations", value: function tryAnnotations(typeOrFunc) { return this.annotations(typeOrFunc); } /** * @param {?} typeOrFunc * @return {?} */ }, { key: "annotations", value: function annotations(typeOrFunc) { return this.reflectionCapabilities.annotations(typeOrFunc); } /** * @param {?} typeOrFunc * @return {?} */ }, { key: "shallowAnnotations", value: function shallowAnnotations(typeOrFunc) { throw new Error('Not supported in JIT mode'); } /** * @param {?} typeOrFunc * @return {?} */ }, { key: "propMetadata", value: function propMetadata(typeOrFunc) { return this.reflectionCapabilities.propMetadata(typeOrFunc); } /** * @param {?} type * @param {?} lcProperty * @return {?} */ }, { key: "hasLifecycleHook", value: function hasLifecycleHook(type, lcProperty) { return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty); } /** * @param {?} type * @return {?} */ }, { key: "guards", value: function guards(type) { return this.reflectionCapabilities.guards(type); } /** * @param {?} ref * @return {?} */ }, { key: "resolveExternalReference", value: function resolveExternalReference(ref) { return builtinExternalReferences.get(ref) || ref.runtime; } }]); return JitReflector; }(); if (false) {} /** * @return {?} */ function createBuiltinExternalReferencesMap() { /** @type {?} */ var map = new Map(); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ANALYZE_FOR_ENTRY_COMPONENTS, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ANALYZE_FOR_ENTRY_COMPONENTS"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ElementRef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].NgModuleRef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleRef"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ViewContainerRef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewContainerRef"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ChangeDetectorRef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectorRef"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].Renderer2, _angular_core__WEBPACK_IMPORTED_MODULE_1__["Renderer2"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].QueryList, _angular_core__WEBPACK_IMPORTED_MODULE_1__["QueryList"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].TemplateRef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["TemplateRef"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].CodegenComponentFactoryResolver, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵCodegenComponentFactoryResolver"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ComponentFactoryResolver, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ComponentFactoryResolver"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ComponentFactory, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ComponentFactory"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ComponentRef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ComponentRef"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].NgModuleFactory, _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleFactory"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].createModuleFactory, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵcmf"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].moduleDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵmod"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].moduleProviderDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵmpd"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].RegisterModuleFactoryFn, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵregisterModuleFactory"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].Injector, _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injector"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ViewEncapsulation, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ChangeDetectionStrategy, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectionStrategy"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].SecurityContext, _angular_core__WEBPACK_IMPORTED_MODULE_1__["SecurityContext"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].LOCALE_ID, _angular_core__WEBPACK_IMPORTED_MODULE_1__["LOCALE_ID"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].TRANSLATIONS_FORMAT, _angular_core__WEBPACK_IMPORTED_MODULE_1__["TRANSLATIONS_FORMAT"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].inlineInterpolate, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵinlineInterpolate"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].interpolate, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵinterpolate"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].EMPTY_ARRAY, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵEMPTY_ARRAY"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].EMPTY_MAP, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵEMPTY_MAP"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].Renderer, _angular_core__WEBPACK_IMPORTED_MODULE_1__["Renderer"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].viewDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵvid"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].elementDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵeld"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].anchorDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵand"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].textDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵted"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].directiveDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵdid"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].providerDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵprd"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].queryDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵqud"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].pureArrayDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵpad"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].pureObjectDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵpod"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].purePipeDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵppd"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].pipeDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵpid"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].nodeValue, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵnov"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ngContentDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵncd"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].unwrapValue, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵunv"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].createRendererType2, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵcrt"]); map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].createComponentFactory, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵccf"]); return map; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var ERROR_COLLECTOR_TOKEN = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('ErrorCollector'); /** * A default provider for {\@link PACKAGE_ROOT_URL} that maps to '/'. * @type {?} */ var DEFAULT_PACKAGE_URL_PROVIDER = { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["PACKAGE_ROOT_URL"], useValue: '/' }; /** @type {?} */ var _NO_RESOURCE_LOADER = { /** * @param {?} url * @return {?} */ get: function get(url) { throw new Error("No ResourceLoader implementation has been provided. Can't read the url \"".concat(url, "\"")); } }; /** @type {?} */ var baseHtmlParser = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('HtmlParser'); var CompilerImpl = /*#__PURE__*/function () { /** * @param {?} injector * @param {?} _metadataResolver * @param {?} templateParser * @param {?} styleCompiler * @param {?} viewCompiler * @param {?} ngModuleCompiler * @param {?} summaryResolver * @param {?} compileReflector * @param {?} jitEvaluator * @param {?} compilerConfig * @param {?} console */ function CompilerImpl(injector, _metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, jitEvaluator, compilerConfig, console) { _classCallCheck(this, CompilerImpl); this._metadataResolver = _metadataResolver; this._delegate = new _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["JitCompiler"](_metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, jitEvaluator, compilerConfig, console, this.getExtraNgModuleProviders.bind(this)); this.injector = injector; } /** * @private * @return {?} */ _createClass2(CompilerImpl, [{ key: "getExtraNgModuleProviders", value: function getExtraNgModuleProviders() { return [this._metadataResolver.getProviderMetadata(new _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ProviderMeta"](_angular_core__WEBPACK_IMPORTED_MODULE_1__["Compiler"], { useValue: this }))]; } /** * @template T * @param {?} moduleType * @return {?} */ }, { key: "compileModuleSync", value: function compileModuleSync(moduleType) { return ( /** @type {?} */ this._delegate.compileModuleSync(moduleType) ); } /** * @template T * @param {?} moduleType * @return {?} */ }, { key: "compileModuleAsync", value: function compileModuleAsync(moduleType) { return ( /** @type {?} */ this._delegate.compileModuleAsync(moduleType) ); } /** * @template T * @param {?} moduleType * @return {?} */ }, { key: "compileModuleAndAllComponentsSync", value: function compileModuleAndAllComponentsSync(moduleType) { /** @type {?} */ var result = this._delegate.compileModuleAndAllComponentsSync(moduleType); return { ngModuleFactory: /** @type {?} */ result.ngModuleFactory, componentFactories: /** @type {?} */ result.componentFactories }; } /** * @template T * @param {?} moduleType * @return {?} */ }, { key: "compileModuleAndAllComponentsAsync", value: function compileModuleAndAllComponentsAsync(moduleType) { return this._delegate.compileModuleAndAllComponentsAsync(moduleType).then( /** * @param {?} result * @return {?} */ function (result) { return { ngModuleFactory: /** @type {?} */ result.ngModuleFactory, componentFactories: /** @type {?} */ result.componentFactories }; }); } /** * @param {?} summaries * @return {?} */ }, { key: "loadAotSummaries", value: function loadAotSummaries(summaries) { this._delegate.loadAotSummaries(summaries); } /** * @param {?} ref * @return {?} */ }, { key: "hasAotSummary", value: function hasAotSummary(ref) { return this._delegate.hasAotSummary(ref); } /** * @template T * @param {?} component * @return {?} */ }, { key: "getComponentFactory", value: function getComponentFactory(component) { return ( /** @type {?} */ this._delegate.getComponentFactory(component) ); } /** * @return {?} */ }, { key: "clearCache", value: function clearCache() { this._delegate.clearCache(); } /** * @param {?} type * @return {?} */ }, { key: "clearCacheFor", value: function clearCacheFor(type) { this._delegate.clearCacheFor(type); } /** * @param {?} moduleType * @return {?} */ }, { key: "getModuleId", value: function getModuleId(moduleType) { /** @type {?} */ var meta = this._metadataResolver.getNgModuleMetadata(moduleType); return meta && meta.id || undefined; } }]); return CompilerImpl; }(); if (false) {} /** * A set of providers that provide `JitCompiler` and its dependencies to use for * template compilation. * @type {?} */ var COMPILER_PROVIDERS = /** @type {?} */ [{ provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"], useValue: new JitReflector() }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ResourceLoader"], useValue: _NO_RESOURCE_LOADER }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["JitSummaryResolver"], deps: [] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["SummaryResolver"], useExisting: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["JitSummaryResolver"] }, { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵConsole"], deps: [] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Lexer"], deps: [] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Parser"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Lexer"]] }, { provide: baseHtmlParser, useClass: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["HtmlParser"], deps: [] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["I18NHtmlParser"], useFactory: /** * @param {?} parser * @param {?} translations * @param {?} format * @param {?} config * @param {?} console * @return {?} */ function useFactory(parser, translations, format, config, console) { translations = translations || ''; /** @type {?} */ var missingTranslation = translations ? /** @type {?} */ config.missingTranslation : _angular_core__WEBPACK_IMPORTED_MODULE_1__["MissingTranslationStrategy"].Ignore; return new _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["I18NHtmlParser"](parser, translations, format, missingTranslation, console); }, deps: [baseHtmlParser, [new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"](), new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"](_angular_core__WEBPACK_IMPORTED_MODULE_1__["TRANSLATIONS"])], [new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"](), new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"](_angular_core__WEBPACK_IMPORTED_MODULE_1__["TRANSLATIONS_FORMAT"])], [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"]], [_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵConsole"]]] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["HtmlParser"], useExisting: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["I18NHtmlParser"] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["TemplateParser"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Parser"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ElementSchemaRegistry"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["I18NHtmlParser"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵConsole"]] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["JitEvaluator"], useClass: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["JitEvaluator"], deps: [] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["DirectiveNormalizer"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ResourceLoader"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["UrlResolver"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["HtmlParser"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"]] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileMetadataResolver"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["HtmlParser"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["NgModuleResolver"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["DirectiveResolver"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["PipeResolver"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["SummaryResolver"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ElementSchemaRegistry"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["DirectiveNormalizer"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵConsole"], [_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["StaticSymbolCache"]], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"], [_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"], ERROR_COLLECTOR_TOKEN]] }, DEFAULT_PACKAGE_URL_PROVIDER, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["StyleCompiler"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["UrlResolver"]] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ViewCompiler"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"]] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["NgModuleCompiler"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"]] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"], useValue: new _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"]() }, { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Compiler"], useClass: CompilerImpl, deps: [_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injector"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileMetadataResolver"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["TemplateParser"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["StyleCompiler"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ViewCompiler"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["NgModuleCompiler"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["SummaryResolver"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["JitEvaluator"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵConsole"]] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["DomElementSchemaRegistry"], deps: [] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ElementSchemaRegistry"], useExisting: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["DomElementSchemaRegistry"] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["UrlResolver"], deps: [_angular_core__WEBPACK_IMPORTED_MODULE_1__["PACKAGE_ROOT_URL"]] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["DirectiveResolver"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"]] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["PipeResolver"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"]] }, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["NgModuleResolver"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"]] }]; /** * \@publicApi */ var JitCompilerFactory = /*#__PURE__*/function () { /* @internal */ /** * @param {?} defaultOptions */ function JitCompilerFactory(defaultOptions) { _classCallCheck(this, JitCompilerFactory); /** @type {?} */ var compilerOptions = { useJit: true, defaultEncapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"].Emulated, missingTranslation: _angular_core__WEBPACK_IMPORTED_MODULE_1__["MissingTranslationStrategy"].Warning }; this._defaultOptions = [compilerOptions].concat(_toConsumableArray(defaultOptions)); } /** * @param {?=} options * @return {?} */ _createClass2(JitCompilerFactory, [{ key: "createCompiler", value: function createCompiler() { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; /** @type {?} */ var opts = _mergeOptions(this._defaultOptions.concat(options)); /** @type {?} */ var injector = _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injector"].create([COMPILER_PROVIDERS, { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"], useFactory: /** * @return {?} */ function useFactory() { return new _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"]({ // let explicit values from the compiler options overwrite options // from the app providers useJit: opts.useJit, jitDevMode: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["isDevMode"])(), // let explicit values from the compiler options overwrite options // from the app providers defaultEncapsulation: opts.defaultEncapsulation, missingTranslation: opts.missingTranslation, preserveWhitespaces: opts.preserveWhitespaces }); }, deps: [] }, /** @type {?} */ opts.providers]); return injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Compiler"]); } }]); return JitCompilerFactory; }(); if (false) {} /** * @param {?} optionsArr * @return {?} */ function _mergeOptions(optionsArr) { return { useJit: _lastDefined(optionsArr.map( /** * @param {?} options * @return {?} */ function (options) { return options.useJit; })), defaultEncapsulation: _lastDefined(optionsArr.map( /** * @param {?} options * @return {?} */ function (options) { return options.defaultEncapsulation; })), providers: _mergeArrays(optionsArr.map( /** * @param {?} options * @return {?} */ function (options) { return ( /** @type {?} */ options.providers ); })), missingTranslation: _lastDefined(optionsArr.map( /** * @param {?} options * @return {?} */ function (options) { return options.missingTranslation; })), preserveWhitespaces: _lastDefined(optionsArr.map( /** * @param {?} options * @return {?} */ function (options) { return options.preserveWhitespaces; })) }; } /** * @template T * @param {?} args * @return {?} */ function _lastDefined(args) { for (var i = args.length - 1; i >= 0; i--) { if (args[i] !== undefined) { return args[i]; } } return undefined; } /** * @param {?} parts * @return {?} */ function _mergeArrays(parts) { /** @type {?} */ var result = []; parts.forEach( /** * @param {?} part * @return {?} */ function (part) { return part && result.push.apply(result, _toConsumableArray(part)); }); return result; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ɵ0 = {}; /** * A platform that included corePlatform and the compiler. * * \@publicApi * @type {?} */ var platformCoreDynamic = Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["createPlatformFactory"])(_angular_core__WEBPACK_IMPORTED_MODULE_1__["platformCore"], 'coreDynamic', [{ provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["COMPILER_OPTIONS"], useValue: ɵ0, multi: true }, { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["CompilerFactory"], useClass: JitCompilerFactory, deps: [_angular_core__WEBPACK_IMPORTED_MODULE_1__["COMPILER_OPTIONS"]] }]); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ResourceLoaderImpl = /*#__PURE__*/function (_angular_compiler__WE) { _inherits(ResourceLoaderImpl, _angular_compiler__WE); var _super143 = _createSuper(ResourceLoaderImpl); function ResourceLoaderImpl() { _classCallCheck(this, ResourceLoaderImpl); return _super143.apply(this, arguments); } _createClass2(ResourceLoaderImpl, [{ key: "get", /** * @param {?} url * @return {?} */ value: function get(url) { /** @type {?} */ var resolve; /** @type {?} */ var reject; /** @type {?} */ var promise = new Promise( /** * @param {?} res * @param {?} rej * @return {?} */ function (res, rej) { resolve = res; reject = rej; }); /** @type {?} */ var xhr = new XMLHttpRequest(); xhr.open('GET', url, true); xhr.responseType = 'text'; xhr.onload = /** * @return {?} */ function () { // responseText is the old-school way of retrieving response (supported by IE8 & 9) // response/responseType properties were introduced in ResourceLoader Level2 spec (supported // by IE10) /** @type {?} */ var response = xhr.response || xhr.responseText; // normalize IE9 bug (http://bugs.jquery.com/ticket/1450) /** @type {?} */ var status = xhr.status === 1223 ? 204 : xhr.status; // fix status code when it is 0 (0 status is undocumented). // Occurs when accessing file resources or on Android 4.1 stock browser // while retrieving files from application cache. if (status === 0) { status = response ? 200 : 0; } if (200 <= status && status <= 300) { resolve(response); } else { reject("Failed to load ".concat(url)); } }; xhr.onerror = /** * @return {?} */ function () { reject("Failed to load ".concat(url)); }; xhr.send(); return promise; } }]); return ResourceLoaderImpl; }(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ResourceLoader"]); ResourceLoaderImpl.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"] }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ɵ0$1 = { providers: [{ provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ResourceLoader"], useClass: ResourceLoaderImpl, deps: [] }] }, ɵ1 = _angular_common__WEBPACK_IMPORTED_MODULE_2__["ɵPLATFORM_BROWSER_ID"]; /** * \@publicApi * @type {?} */ var INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS = [_angular_platform_browser__WEBPACK_IMPORTED_MODULE_3__["ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS"], { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["COMPILER_OPTIONS"], useValue: ɵ0$1, multi: true }, { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["PLATFORM_ID"], useValue: ɵ1 }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * An implementation of ResourceLoader that uses a template cache to avoid doing an actual * ResourceLoader. * * The template cache needs to be built and loaded into window.$templateCache * via a separate mechanism. * * \@publicApi */ var CachedResourceLoader = /*#__PURE__*/function (_angular_compiler__WE2) { _inherits(CachedResourceLoader, _angular_compiler__WE2); var _super144 = _createSuper(CachedResourceLoader); function CachedResourceLoader() { var _this395; _classCallCheck(this, CachedResourceLoader); _this395 = _super144.call(this); _this395._cache = /** @type {?} */ _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵglobal"].$templateCache; if (_this395._cache == null) { throw new Error('CachedResourceLoader: Template cache was not found in $templateCache.'); } return _this395; } /** * @param {?} url * @return {?} */ _createClass2(CachedResourceLoader, [{ key: "get", value: function get(url) { if (this._cache.hasOwnProperty(url)) { return Promise.resolve(this._cache[url]); } else { return ( /** @type {?} */ Promise.reject('CachedResourceLoader: Did not find cached template for ' + url) ); } } }]); return CachedResourceLoader; }(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ResourceLoader"]); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@publicApi * @type {?} */ var VERSION = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Version"]('8.2.12'); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@publicApi * @type {?} */ var RESOURCE_CACHE_PROVIDER = [{ provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ResourceLoader"], useClass: CachedResourceLoader, deps: [] }]; /** * \@publicApi * @type {?} */ var platformBrowserDynamic = Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["createPlatformFactory"])(platformCoreDynamic, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=platform-browser-dynamic.js.map /***/ }, /***/ "./node_modules/@angular/platform-browser/fesm2015/platform-browser.js": /*!*****************************************************************************!*\ !*** ./node_modules/@angular/platform-browser/fesm2015/platform-browser.js ***! \*****************************************************************************/ /*! exports provided: ɵangular_packages_platform_browser_platform_browser_c, ɵangular_packages_platform_browser_platform_browser_b, ɵangular_packages_platform_browser_platform_browser_a, ɵangular_packages_platform_browser_platform_browser_l, ɵangular_packages_platform_browser_platform_browser_d, ɵangular_packages_platform_browser_platform_browser_i, ɵangular_packages_platform_browser_platform_browser_h, ɵangular_packages_platform_browser_platform_browser_e, ɵangular_packages_platform_browser_platform_browser_f, ɵangular_packages_platform_browser_platform_browser_k, ɵangular_packages_platform_browser_platform_browser_j, ɵangular_packages_platform_browser_platform_browser_g, BrowserModule, platformBrowser, Meta, Title, disableDebugTools, enableDebugTools, BrowserTransferStateModule, TransferState, makeStateKey, By, EVENT_MANAGER_PLUGINS, EventManager, HAMMER_GESTURE_CONFIG, HAMMER_LOADER, HammerGestureConfig, DomSanitizer, VERSION, ɵELEMENT_PROBE_PROVIDERS__POST_R3__, ɵBROWSER_SANITIZATION_PROVIDERS, ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS, ɵinitDomAdapter, ɵBrowserDomAdapter, ɵBrowserPlatformLocation, ɵTRANSITION_ID, ɵBrowserGetTestability, ɵescapeHtml, ɵELEMENT_PROBE_PROVIDERS, ɵDomAdapter, ɵgetDOM, ɵsetRootDomAdapter, ɵDomRendererFactory2, ɵNAMESPACE_URIS, ɵflattenStyles, ɵshimContentAttribute, ɵshimHostAttribute, ɵDomEventsPlugin, ɵHammerGesturesPlugin, ɵKeyEventsPlugin, ɵDomSharedStylesHost, ɵSharedStylesHost, ɵDomSanitizerImpl */ /***/ function node_modulesAngularPlatformBrowserFesm2015PlatformBrowserJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_c", function () { return BROWSER_MODULE_PROVIDERS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_b", function () { return _document; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_a", function () { return errorHandler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_l", function () { return GenericBrowserDomAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_d", function () { return createMeta; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_i", function () { return SERVER_TRANSITION_PROVIDERS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_h", function () { return appInitializerFactory; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_e", function () { return createTitle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_f", function () { return initTransferState; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_k", function () { return ELEMENT_PROBE_PROVIDERS__PRE_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_j", function () { return _createNgProbe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_g", function () { return EventManagerPlugin; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BrowserModule", function () { return BrowserModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "platformBrowser", function () { return platformBrowser; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Meta", function () { return Meta; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Title", function () { return Title; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "disableDebugTools", function () { return disableDebugTools; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enableDebugTools", function () { return enableDebugTools; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BrowserTransferStateModule", function () { return BrowserTransferStateModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TransferState", function () { return TransferState; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeStateKey", function () { return makeStateKey; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "By", function () { return By; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EVENT_MANAGER_PLUGINS", function () { return EVENT_MANAGER_PLUGINS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EventManager", function () { return EventManager; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HAMMER_GESTURE_CONFIG", function () { return HAMMER_GESTURE_CONFIG; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HAMMER_LOADER", function () { return HAMMER_LOADER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HammerGestureConfig", function () { return HammerGestureConfig; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DomSanitizer", function () { return DomSanitizer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function () { return VERSION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵELEMENT_PROBE_PROVIDERS__POST_R3__", function () { return ELEMENT_PROBE_PROVIDERS__POST_R3__; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵBROWSER_SANITIZATION_PROVIDERS", function () { return BROWSER_SANITIZATION_PROVIDERS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS", function () { return INTERNAL_BROWSER_PLATFORM_PROVIDERS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinitDomAdapter", function () { return initDomAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵBrowserDomAdapter", function () { return BrowserDomAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵBrowserPlatformLocation", function () { return BrowserPlatformLocation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵTRANSITION_ID", function () { return TRANSITION_ID; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵBrowserGetTestability", function () { return BrowserGetTestability; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵescapeHtml", function () { return escapeHtml; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵELEMENT_PROBE_PROVIDERS", function () { return ELEMENT_PROBE_PROVIDERS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomAdapter", function () { return DomAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵgetDOM", function () { return getDOM; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsetRootDomAdapter", function () { return setRootDomAdapter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomRendererFactory2", function () { return DomRendererFactory2; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNAMESPACE_URIS", function () { return NAMESPACE_URIS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵflattenStyles", function () { return flattenStyles; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵshimContentAttribute", function () { return shimContentAttribute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵshimHostAttribute", function () { return shimHostAttribute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomEventsPlugin", function () { return DomEventsPlugin; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵHammerGesturesPlugin", function () { return HammerGesturesPlugin; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵKeyEventsPlugin", function () { return KeyEventsPlugin; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomSharedStylesHost", function () { return DomSharedStylesHost; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵSharedStylesHost", function () { return SharedStylesHost; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomSanitizerImpl", function () { return DomSanitizerImpl; }); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! @angular/common */ "./node_modules/@angular/common/fesm2015/common.js"); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! @angular/core */ "./node_modules/@angular/core/fesm2015/core.js"); /** * @license Angular v8.2.12 * (c) 2010-2019 Google LLC. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** @type {?} */ var _DOM = /** @type {?} */ null; /** * @return {?} */ function getDOM() { return _DOM; } /** * @param {?} adapter * @return {?} */ function setDOM(adapter) { _DOM = adapter; } /** * @param {?} adapter * @return {?} */ function setRootDomAdapter(adapter) { if (!_DOM) { _DOM = adapter; } } /* tslint:disable:requireParameterType */ /** * Provides DOM operations in an environment-agnostic way. * * \@security Tread carefully! Interacting with the DOM directly is dangerous and * can introduce XSS risks. * @abstract */ var DomAdapter = /*#__PURE__*/function () { function DomAdapter() { _classCallCheck(this, DomAdapter); this.resourceLoaderType = /** @type {?} */ null; } /** * Maps attribute names to their corresponding property names for cases * where attribute name doesn't match property name. * @return {?} */ _createClass2(DomAdapter, [{ key: "attrToPropMap", get: function get() { return this._attrToPropMap; } /** * @param {?} value * @return {?} */ , set: function set(value) { this._attrToPropMap = value; } }]); return DomAdapter; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Provides DOM operations in any browser environment. * * \@security Tread carefully! Interacting with the DOM directly is dangerous and * can introduce XSS risks. * @abstract */ var GenericBrowserDomAdapter = /*#__PURE__*/function (_DomAdapter) { _inherits(GenericBrowserDomAdapter, _DomAdapter); var _super145 = _createSuper(GenericBrowserDomAdapter); function GenericBrowserDomAdapter() { var _this396; _classCallCheck(this, GenericBrowserDomAdapter); _this396 = _super145.call(this); _this396._animationPrefix = null; _this396._transitionEnd = null; try { /** @type {?} */ var element = _this396.createElement('div', document); if (_this396.getStyle(element, 'animationName') != null) { _this396._animationPrefix = ''; } else { /** @type {?} */ var domPrefixes = ['Webkit', 'Moz', 'O', 'ms']; for (var i = 0; i < domPrefixes.length; i++) { if (_this396.getStyle(element, domPrefixes[i] + 'AnimationName') != null) { _this396._animationPrefix = '-' + domPrefixes[i].toLowerCase() + '-'; break; } } } /** @type {?} */ var transEndEventNames = { WebkitTransition: 'webkitTransitionEnd', MozTransition: 'transitionend', OTransition: 'oTransitionEnd otransitionend', transition: 'transitionend' }; Object.keys(transEndEventNames).forEach( /** * @param {?} key * @return {?} */ function (key) { if (_this396.getStyle(element, key) != null) { _this396._transitionEnd = transEndEventNames[key]; } }); } catch (_a) { _this396._animationPrefix = null; _this396._transitionEnd = null; } return _this396; } /** * @param {?} el * @return {?} */ _createClass2(GenericBrowserDomAdapter, [{ key: "getDistributedNodes", value: function getDistributedNodes(el) { return ( /** @type {?} */ el.getDistributedNodes() ); } /** * @param {?} el * @param {?} baseUrl * @param {?} href * @return {?} */ }, { key: "resolveAndSetHref", value: function resolveAndSetHref(el, baseUrl, href) { el.href = href == null ? baseUrl : baseUrl + '/../' + href; } /** * @return {?} */ }, { key: "supportsDOMEvents", value: function supportsDOMEvents() { return true; } /** * @return {?} */ }, { key: "supportsNativeShadowDOM", value: function supportsNativeShadowDOM() { return typeof /** @type {?} */ document.body.createShadowRoot === 'function'; } /** * @return {?} */ }, { key: "getAnimationPrefix", value: function getAnimationPrefix() { return this._animationPrefix ? this._animationPrefix : ''; } /** * @return {?} */ }, { key: "getTransitionEnd", value: function getTransitionEnd() { return this._transitionEnd ? this._transitionEnd : ''; } /** * @return {?} */ }, { key: "supportsAnimation", value: function supportsAnimation() { return this._animationPrefix != null && this._transitionEnd != null; } }]); return GenericBrowserDomAdapter; }(DomAdapter); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var _attrToPropMap = { 'class': 'className', 'innerHtml': 'innerHTML', 'readonly': 'readOnly', 'tabindex': 'tabIndex' }; /** @type {?} */ var DOM_KEY_LOCATION_NUMPAD = 3; // Map to convert some key or keyIdentifier values to what will be returned by getEventKey /** @type {?} */ var _keyMap = { // The following values are here for cross-browser compatibility and to match the W3C standard // cf http://www.w3.org/TR/DOM-Level-3-Events-key/ '\b': 'Backspace', '\t': 'Tab', '\x7F': 'Delete', '\x1B': 'Escape', 'Del': 'Delete', 'Esc': 'Escape', 'Left': 'ArrowLeft', 'Right': 'ArrowRight', 'Up': 'ArrowUp', 'Down': 'ArrowDown', 'Menu': 'ContextMenu', 'Scroll': 'ScrollLock', 'Win': 'OS' }; // There is a bug in Chrome for numeric keypad keys: // https://code.google.com/p/chromium/issues/detail?id=155654 // 1, 2, 3 ... are reported as A, B, C ... /** @type {?} */ var _chromeNumKeyPadMap = { 'A': '1', 'B': '2', 'C': '3', 'D': '4', 'E': '5', 'F': '6', 'G': '7', 'H': '8', 'I': '9', 'J': '*', 'K': '+', 'M': '-', 'N': '.', 'O': '/', '\x60': '0', '\x90': 'NumLock' }; var ɵ0 = /** * @return {?} */ function ɵ0() { if (_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵglobal"]['Node']) { return _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵglobal"]['Node'].prototype.contains || /** * @this {?} * @param {?} node * @return {?} */ function (node) { return !!(this.compareDocumentPosition(node) & 16); }; } return ( /** @type {?} */ undefined ); }; /** @type {?} */ var nodeContains = ɵ0(); /** * A `DomAdapter` powered by full browser DOM APIs. * * \@security Tread carefully! Interacting with the DOM directly is dangerous and * can introduce XSS risks. */ /* tslint:disable:requireParameterType no-console */ var BrowserDomAdapter = /*#__PURE__*/function (_GenericBrowserDomAda) { _inherits(BrowserDomAdapter, _GenericBrowserDomAda); var _super146 = _createSuper(BrowserDomAdapter); function BrowserDomAdapter() { _classCallCheck(this, BrowserDomAdapter); return _super146.apply(this, arguments); } _createClass2(BrowserDomAdapter, [{ key: "parse", /** * @param {?} templateHtml * @return {?} */ value: function parse(templateHtml) { throw new Error('parse not implemented'); } /** * @return {?} */ }, { key: "hasProperty", /** * @param {?} element * @param {?} name * @return {?} */ value: function hasProperty(element, name) { return name in element; } /** * @param {?} el * @param {?} name * @param {?} value * @return {?} */ }, { key: "setProperty", value: function setProperty(el, name, value) { /** @type {?} */ el[name] = value; } /** * @param {?} el * @param {?} name * @return {?} */ }, { key: "getProperty", value: function getProperty(el, name) { return ( /** @type {?} */ el[name] ); } /** * @param {?} el * @param {?} methodName * @param {?} args * @return {?} */ }, { key: "invoke", value: function invoke(el, methodName, args) { /** @type {?} */ el[methodName].apply(el, _toConsumableArray(args)); } // TODO(tbosch): move this into a separate environment class once we have it /** * @param {?} error * @return {?} */ }, { key: "logError", value: function logError(error) { if (window.console) { if (console.error) { console.error(error); } else { console.log(error); } } } /** * @param {?} error * @return {?} */ }, { key: "log", value: function log(error) { if (window.console) { window.console.log && window.console.log(error); } } /** * @param {?} error * @return {?} */ }, { key: "logGroup", value: function logGroup(error) { if (window.console) { window.console.group && window.console.group(error); } } /** * @return {?} */ }, { key: "logGroupEnd", value: function logGroupEnd() { if (window.console) { window.console.groupEnd && window.console.groupEnd(); } } /** * @return {?} */ }, { key: "contains", /** * @param {?} nodeA * @param {?} nodeB * @return {?} */ value: function contains(nodeA, nodeB) { return nodeContains.call(nodeA, nodeB); } /** * @param {?} el * @param {?} selector * @return {?} */ }, { key: "querySelector", value: function querySelector(el, selector) { return el.querySelector(selector); } /** * @param {?} el * @param {?} selector * @return {?} */ }, { key: "querySelectorAll", value: function querySelectorAll(el, selector) { return el.querySelectorAll(selector); } /** * @param {?} el * @param {?} evt * @param {?} listener * @return {?} */ }, { key: "on", value: function on(el, evt, listener) { el.addEventListener(evt, listener, false); } /** * @param {?} el * @param {?} evt * @param {?} listener * @return {?} */ }, { key: "onAndCancel", value: function onAndCancel(el, evt, listener) { el.addEventListener(evt, listener, false); // Needed to follow Dart's subscription semantic, until fix of // https://code.google.com/p/dart/issues/detail?id=17406 return ( /** * @return {?} */ function () { el.removeEventListener(evt, listener, false); } ); } /** * @param {?} el * @param {?} evt * @return {?} */ }, { key: "dispatchEvent", value: function dispatchEvent(el, evt) { el.dispatchEvent(evt); } /** * @param {?} eventType * @return {?} */ }, { key: "createMouseEvent", value: function createMouseEvent(eventType) { /** @type {?} */ var evt = this.getDefaultDocument().createEvent('MouseEvent'); evt.initEvent(eventType, true, true); return evt; } /** * @param {?} eventType * @return {?} */ }, { key: "createEvent", value: function createEvent(eventType) { /** @type {?} */ var evt = this.getDefaultDocument().createEvent('Event'); evt.initEvent(eventType, true, true); return evt; } /** * @param {?} evt * @return {?} */ }, { key: "preventDefault", value: function preventDefault(evt) { evt.preventDefault(); evt.returnValue = false; } /** * @param {?} evt * @return {?} */ }, { key: "isPrevented", value: function isPrevented(evt) { return evt.defaultPrevented || evt.returnValue != null && !evt.returnValue; } /** * @param {?} el * @return {?} */ }, { key: "getInnerHTML", value: function getInnerHTML(el) { return el.innerHTML; } /** * @param {?} el * @return {?} */ }, { key: "getTemplateContent", value: function getTemplateContent(el) { return 'content' in el && this.isTemplateElement(el) ? /** @type {?} */ el.content : null; } /** * @param {?} el * @return {?} */ }, { key: "getOuterHTML", value: function getOuterHTML(el) { return el.outerHTML; } /** * @param {?} node * @return {?} */ }, { key: "nodeName", value: function nodeName(node) { return node.nodeName; } /** * @param {?} node * @return {?} */ }, { key: "nodeValue", value: function nodeValue(node) { return node.nodeValue; } /** * @param {?} node * @return {?} */ }, { key: "type", value: function type(node) { return node.type; } /** * @param {?} node * @return {?} */ }, { key: "content", value: function content(node) { if (this.hasProperty(node, 'content')) { return ( /** @type {?} */ node.content ); } else { return node; } } /** * @param {?} el * @return {?} */ }, { key: "firstChild", value: function firstChild(el) { return el.firstChild; } /** * @param {?} el * @return {?} */ }, { key: "nextSibling", value: function nextSibling(el) { return el.nextSibling; } /** * @param {?} el * @return {?} */ }, { key: "parentElement", value: function parentElement(el) { return el.parentNode; } /** * @param {?} el * @return {?} */ }, { key: "childNodes", value: function childNodes(el) { return el.childNodes; } /** * @param {?} el * @return {?} */ }, { key: "childNodesAsList", value: function childNodesAsList(el) { /** @type {?} */ var childNodes = el.childNodes; /** @type {?} */ var res = new Array(childNodes.length); for (var i = 0; i < childNodes.length; i++) { res[i] = childNodes[i]; } return res; } /** * @param {?} el * @return {?} */ }, { key: "clearNodes", value: function clearNodes(el) { while (el.firstChild) { el.removeChild(el.firstChild); } } /** * @param {?} el * @param {?} node * @return {?} */ }, { key: "appendChild", value: function appendChild(el, node) { el.appendChild(node); } /** * @param {?} el * @param {?} node * @return {?} */ }, { key: "removeChild", value: function removeChild(el, node) { el.removeChild(node); } /** * @param {?} el * @param {?} newChild * @param {?} oldChild * @return {?} */ }, { key: "replaceChild", value: function replaceChild(el, newChild, oldChild) { el.replaceChild(newChild, oldChild); } /** * @param {?} node * @return {?} */ }, { key: "remove", value: function remove(node) { if (node.parentNode) { node.parentNode.removeChild(node); } return node; } /** * @param {?} parent * @param {?} ref * @param {?} node * @return {?} */ }, { key: "insertBefore", value: function insertBefore(parent, ref, node) { parent.insertBefore(node, ref); } /** * @param {?} parent * @param {?} ref * @param {?} nodes * @return {?} */ }, { key: "insertAllBefore", value: function insertAllBefore(parent, ref, nodes) { nodes.forEach( /** * @param {?} n * @return {?} */ function (n) { return parent.insertBefore(n, ref); }); } /** * @param {?} parent * @param {?} ref * @param {?} node * @return {?} */ }, { key: "insertAfter", value: function insertAfter(parent, ref, node) { parent.insertBefore(node, ref.nextSibling); } /** * @param {?} el * @param {?} value * @return {?} */ }, { key: "setInnerHTML", value: function setInnerHTML(el, value) { el.innerHTML = value; } /** * @param {?} el * @return {?} */ }, { key: "getText", value: function getText(el) { return el.textContent; } /** * @param {?} el * @param {?} value * @return {?} */ }, { key: "setText", value: function setText(el, value) { el.textContent = value; } /** * @param {?} el * @return {?} */ }, { key: "getValue", value: function getValue(el) { return el.value; } /** * @param {?} el * @param {?} value * @return {?} */ }, { key: "setValue", value: function setValue(el, value) { el.value = value; } /** * @param {?} el * @return {?} */ }, { key: "getChecked", value: function getChecked(el) { return el.checked; } /** * @param {?} el * @param {?} value * @return {?} */ }, { key: "setChecked", value: function setChecked(el, value) { el.checked = value; } /** * @param {?} text * @return {?} */ }, { key: "createComment", value: function createComment(text) { return this.getDefaultDocument().createComment(text); } /** * @param {?} html * @return {?} */ }, { key: "createTemplate", value: function createTemplate(html) { /** @type {?} */ var t = this.getDefaultDocument().createElement('template'); t.innerHTML = html; return t; } /** * @param {?} tagName * @param {?=} doc * @return {?} */ }, { key: "createElement", value: function createElement(tagName, doc) { doc = doc || this.getDefaultDocument(); return doc.createElement(tagName); } /** * @param {?} ns * @param {?} tagName * @param {?=} doc * @return {?} */ }, { key: "createElementNS", value: function createElementNS(ns, tagName, doc) { doc = doc || this.getDefaultDocument(); return doc.createElementNS(ns, tagName); } /** * @param {?} text * @param {?=} doc * @return {?} */ }, { key: "createTextNode", value: function createTextNode(text, doc) { doc = doc || this.getDefaultDocument(); return doc.createTextNode(text); } /** * @param {?} attrName * @param {?} attrValue * @param {?=} doc * @return {?} */ }, { key: "createScriptTag", value: function createScriptTag(attrName, attrValue, doc) { doc = doc || this.getDefaultDocument(); /** @type {?} */ var el = /** @type {?} */ doc.createElement('SCRIPT'); el.setAttribute(attrName, attrValue); return el; } /** * @param {?} css * @param {?=} doc * @return {?} */ }, { key: "createStyleElement", value: function createStyleElement(css, doc) { doc = doc || this.getDefaultDocument(); /** @type {?} */ var style = /** @type {?} */ doc.createElement('style'); this.appendChild(style, this.createTextNode(css, doc)); return style; } /** * @param {?} el * @return {?} */ }, { key: "createShadowRoot", value: function createShadowRoot(el) { return ( /** @type {?} */ el.createShadowRoot() ); } /** * @param {?} el * @return {?} */ }, { key: "getShadowRoot", value: function getShadowRoot(el) { return ( /** @type {?} */ el.shadowRoot ); } /** * @param {?} el * @return {?} */ }, { key: "getHost", value: function getHost(el) { return ( /** @type {?} */ el.host ); } /** * @param {?} node * @return {?} */ }, { key: "clone", value: function clone(node) { return node.cloneNode(true); } /** * @param {?} element * @param {?} name * @return {?} */ }, { key: "getElementsByClassName", value: function getElementsByClassName(element, name) { return element.getElementsByClassName(name); } /** * @param {?} element * @param {?} name * @return {?} */ }, { key: "getElementsByTagName", value: function getElementsByTagName(element, name) { return element.getElementsByTagName(name); } /** * @param {?} element * @return {?} */ }, { key: "classList", value: function classList(element) { return Array.prototype.slice.call(element.classList, 0); } /** * @param {?} element * @param {?} className * @return {?} */ }, { key: "addClass", value: function addClass(element, className) { element.classList.add(className); } /** * @param {?} element * @param {?} className * @return {?} */ }, { key: "removeClass", value: function removeClass(element, className) { element.classList.remove(className); } /** * @param {?} element * @param {?} className * @return {?} */ }, { key: "hasClass", value: function hasClass(element, className) { return element.classList.contains(className); } /** * @param {?} element * @param {?} styleName * @param {?} styleValue * @return {?} */ }, { key: "setStyle", value: function setStyle(element, styleName, styleValue) { element.style[styleName] = styleValue; } /** * @param {?} element * @param {?} stylename * @return {?} */ }, { key: "removeStyle", value: function removeStyle(element, stylename) { // IE requires '' instead of null // see https://github.com/angular/angular/issues/7916 element.style[stylename] = ''; } /** * @param {?} element * @param {?} stylename * @return {?} */ }, { key: "getStyle", value: function getStyle(element, stylename) { return element.style[stylename]; } /** * @param {?} element * @param {?} styleName * @param {?=} styleValue * @return {?} */ }, { key: "hasStyle", value: function hasStyle(element, styleName, styleValue) { /** @type {?} */ var value = this.getStyle(element, styleName) || ''; return styleValue ? value == styleValue : value.length > 0; } /** * @param {?} element * @return {?} */ }, { key: "tagName", value: function tagName(element) { return element.tagName; } /** * @param {?} element * @return {?} */ }, { key: "attributeMap", value: function attributeMap(element) { /** @type {?} */ var res = new Map(); /** @type {?} */ var elAttrs = element.attributes; for (var i = 0; i < elAttrs.length; i++) { /** @type {?} */ var attrib = elAttrs.item(i); res.set(attrib.name, attrib.value); } return res; } /** * @param {?} element * @param {?} attribute * @return {?} */ }, { key: "hasAttribute", value: function hasAttribute(element, attribute) { return element.hasAttribute(attribute); } /** * @param {?} element * @param {?} ns * @param {?} attribute * @return {?} */ }, { key: "hasAttributeNS", value: function hasAttributeNS(element, ns, attribute) { return element.hasAttributeNS(ns, attribute); } /** * @param {?} element * @param {?} attribute * @return {?} */ }, { key: "getAttribute", value: function getAttribute(element, attribute) { return element.getAttribute(attribute); } /** * @param {?} element * @param {?} ns * @param {?} name * @return {?} */ }, { key: "getAttributeNS", value: function getAttributeNS(element, ns, name) { return element.getAttributeNS(ns, name); } /** * @param {?} element * @param {?} name * @param {?} value * @return {?} */ }, { key: "setAttribute", value: function setAttribute(element, name, value) { element.setAttribute(name, value); } /** * @param {?} element * @param {?} ns * @param {?} name * @param {?} value * @return {?} */ }, { key: "setAttributeNS", value: function setAttributeNS(element, ns, name, value) { element.setAttributeNS(ns, name, value); } /** * @param {?} element * @param {?} attribute * @return {?} */ }, { key: "removeAttribute", value: function removeAttribute(element, attribute) { element.removeAttribute(attribute); } /** * @param {?} element * @param {?} ns * @param {?} name * @return {?} */ }, { key: "removeAttributeNS", value: function removeAttributeNS(element, ns, name) { element.removeAttributeNS(ns, name); } /** * @param {?} el * @return {?} */ }, { key: "templateAwareRoot", value: function templateAwareRoot(el) { return this.isTemplateElement(el) ? this.content(el) : el; } /** * @return {?} */ }, { key: "createHtmlDocument", value: function createHtmlDocument() { return document.implementation.createHTMLDocument('fakeTitle'); } /** * @return {?} */ }, { key: "getDefaultDocument", value: function getDefaultDocument() { return document; } /** * @param {?} el * @return {?} */ }, { key: "getBoundingClientRect", value: function getBoundingClientRect(el) { try { return el.getBoundingClientRect(); } catch (_a) { return { top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0 }; } } /** * @param {?} doc * @return {?} */ }, { key: "getTitle", value: function getTitle(doc) { return doc.title; } /** * @param {?} doc * @param {?} newTitle * @return {?} */ }, { key: "setTitle", value: function setTitle(doc, newTitle) { doc.title = newTitle || ''; } /** * @param {?} n * @param {?} selector * @return {?} */ }, { key: "elementMatches", value: function elementMatches(n, selector) { if (this.isElementNode(n)) { return n.matches && n.matches(selector) || n.msMatchesSelector && n.msMatchesSelector(selector) || n.webkitMatchesSelector && n.webkitMatchesSelector(selector); } return false; } /** * @param {?} el * @return {?} */ }, { key: "isTemplateElement", value: function isTemplateElement(el) { return this.isElementNode(el) && el.nodeName === 'TEMPLATE'; } /** * @param {?} node * @return {?} */ }, { key: "isTextNode", value: function isTextNode(node) { return node.nodeType === Node.TEXT_NODE; } /** * @param {?} node * @return {?} */ }, { key: "isCommentNode", value: function isCommentNode(node) { return node.nodeType === Node.COMMENT_NODE; } /** * @param {?} node * @return {?} */ }, { key: "isElementNode", value: function isElementNode(node) { return node.nodeType === Node.ELEMENT_NODE; } /** * @param {?} node * @return {?} */ }, { key: "hasShadowRoot", value: function hasShadowRoot(node) { return node.shadowRoot != null && node instanceof HTMLElement; } /** * @param {?} node * @return {?} */ }, { key: "isShadowRoot", value: function isShadowRoot(node) { return node instanceof DocumentFragment; } /** * @param {?} node * @return {?} */ }, { key: "importIntoDoc", value: function importIntoDoc(node) { return document.importNode(this.templateAwareRoot(node), true); } /** * @param {?} node * @return {?} */ }, { key: "adoptNode", value: function adoptNode(node) { return document.adoptNode(node); } /** * @param {?} el * @return {?} */ }, { key: "getHref", value: function getHref(el) { return ( /** @type {?} */ el.getAttribute('href') ); } /** * @param {?} event * @return {?} */ }, { key: "getEventKey", value: function getEventKey(event) { /** @type {?} */ var key = event.key; if (key == null) { key = event.keyIdentifier; // keyIdentifier is defined in the old draft of DOM Level 3 Events implemented by Chrome and // Safari cf // http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/events.html#Events-KeyboardEvents-Interfaces if (key == null) { return 'Unidentified'; } if (key.startsWith('U+')) { key = String.fromCharCode(parseInt(key.substring(2), 16)); if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) { // There is a bug in Chrome for numeric keypad keys: // https://code.google.com/p/chromium/issues/detail?id=155654 // 1, 2, 3 ... are reported as A, B, C ... key = /** @type {?} */ _chromeNumKeyPadMap[key]; } } } return _keyMap[key] || key; } /** * @param {?} doc * @param {?} target * @return {?} */ }, { key: "getGlobalEventTarget", value: function getGlobalEventTarget(doc, target) { if (target === 'window') { return window; } if (target === 'document') { return doc; } if (target === 'body') { return doc.body; } return null; } /** * @return {?} */ }, { key: "getHistory", value: function getHistory() { return window.history; } /** * @return {?} */ }, { key: "getLocation", value: function getLocation() { return window.location; } /** * @param {?} doc * @return {?} */ }, { key: "getBaseHref", value: function getBaseHref(doc) { /** @type {?} */ var href = getBaseElementHref(); return href == null ? null : relativePath(href); } /** * @return {?} */ }, { key: "resetBaseElement", value: function resetBaseElement() { baseElement = null; } /** * @return {?} */ }, { key: "getUserAgent", value: function getUserAgent() { return window.navigator.userAgent; } /** * @param {?} element * @param {?} name * @param {?} value * @return {?} */ }, { key: "setData", value: function setData(element, name, value) { this.setAttribute(element, 'data-' + name, value); } /** * @param {?} element * @param {?} name * @return {?} */ }, { key: "getData", value: function getData(element, name) { return this.getAttribute(element, 'data-' + name); } /** * @param {?} element * @return {?} */ }, { key: "getComputedStyle", value: function (_getComputedStyle) { function getComputedStyle(_x) { return _getComputedStyle.apply(this, arguments); } getComputedStyle.toString = function () { return _getComputedStyle.toString(); }; return getComputedStyle; }(function (element) { return getComputedStyle(element); }) // TODO(tbosch): move this into a separate environment class once we have it /** * @return {?} */ }, { key: "supportsWebAnimation", value: function supportsWebAnimation() { return typeof /** @type {?} */ Element.prototype['animate'] === 'function'; } /** * @return {?} */ }, { key: "performanceNow", value: function performanceNow() { // performance.now() is not available in all browsers, see // http://caniuse.com/#search=performance.now return window.performance && window.performance.now ? window.performance.now() : new Date().getTime(); } /** * @return {?} */ }, { key: "supportsCookies", value: function supportsCookies() { return true; } /** * @param {?} name * @return {?} */ }, { key: "getCookie", value: function getCookie(name) { return Object(_angular_common__WEBPACK_IMPORTED_MODULE_0__["ɵparseCookieValue"])(document.cookie, name); } /** * @param {?} name * @param {?} value * @return {?} */ }, { key: "setCookie", value: function setCookie(name, value) { // document.cookie is magical, assigning into it assigns/overrides one cookie value, but does // not clear other cookies. document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value); } }, { key: "attrToPropMap", get: function get() { return _attrToPropMap; } }], [{ key: "makeCurrent", value: function makeCurrent() { setRootDomAdapter(new BrowserDomAdapter()); } }]); return BrowserDomAdapter; }(GenericBrowserDomAdapter); /** @type {?} */ var baseElement = null; /** * @return {?} */ function getBaseElementHref() { if (!baseElement) { baseElement = /** @type {?} */ document.querySelector('base'); if (!baseElement) { return null; } } return baseElement.getAttribute('href'); } // based on urlUtils.js in AngularJS 1 /** @type {?} */ var urlParsingNode; /** * @param {?} url * @return {?} */ function relativePath(url) { if (!urlParsingNode) { urlParsingNode = document.createElement('a'); } urlParsingNode.setAttribute('href', url); return urlParsingNode.pathname.charAt(0) === '/' ? urlParsingNode.pathname : '/' + urlParsingNode.pathname; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * @return {?} */ function supportsState() { return !!window.history.pushState; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * `PlatformLocation` encapsulates all of the direct calls to platform APIs. * This class should not be used directly by an application developer. Instead, use * {\@link Location}. */ var BrowserPlatformLocation = /*#__PURE__*/function (_angular_common__WEBP) { _inherits(BrowserPlatformLocation, _angular_common__WEBP); var _super147 = _createSuper(BrowserPlatformLocation); /** * @param {?} _doc */ function BrowserPlatformLocation(_doc) { var _this397; _classCallCheck(this, BrowserPlatformLocation); _this397 = _super147.call(this); _this397._doc = _doc; _this397._init(); return _this397; } // This is moved to its own method so that `MockPlatformLocationStrategy` can overwrite it /** * \@internal * @return {?} */ _createClass2(BrowserPlatformLocation, [{ key: "_init", value: function _init() { /** @type {?} */ this.location = getDOM().getLocation(); this._history = getDOM().getHistory(); } /** * @return {?} */ }, { key: "getBaseHrefFromDOM", value: function getBaseHrefFromDOM() { return ( /** @type {?} */ getDOM().getBaseHref(this._doc) ); } /** * @param {?} fn * @return {?} */ }, { key: "onPopState", value: function onPopState(fn) { getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('popstate', fn, false); } /** * @param {?} fn * @return {?} */ }, { key: "onHashChange", value: function onHashChange(fn) { getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('hashchange', fn, false); } /** * @return {?} */ }, { key: "pushState", /** * @param {?} state * @param {?} title * @param {?} url * @return {?} */ value: function pushState(state, title, url) { if (supportsState()) { this._history.pushState(state, title, url); } else { this.location.hash = url; } } /** * @param {?} state * @param {?} title * @param {?} url * @return {?} */ }, { key: "replaceState", value: function replaceState(state, title, url) { if (supportsState()) { this._history.replaceState(state, title, url); } else { this.location.hash = url; } } /** * @return {?} */ }, { key: "forward", value: function forward() { this._history.forward(); } /** * @return {?} */ }, { key: "back", value: function back() { this._history.back(); } /** * @return {?} */ }, { key: "getState", value: function getState() { return this._history.state; } }, { key: "href", get: function get() { return this.location.href; } /** * @return {?} */ }, { key: "protocol", get: function get() { return this.location.protocol; } /** * @return {?} */ }, { key: "hostname", get: function get() { return this.location.hostname; } /** * @return {?} */ }, { key: "port", get: function get() { return this.location.port; } /** * @return {?} */ }, { key: "pathname", get: function get() { return this.location.pathname; } /** * @return {?} */ , /** * @param {?} newPath * @return {?} */ set: function set(newPath) { this.location.pathname = newPath; } }, { key: "search", get: function get() { return this.location.search; } /** * @return {?} */ }, { key: "hash", get: function get() { return this.location.hash; } }]); return BrowserPlatformLocation; }(_angular_common__WEBPACK_IMPORTED_MODULE_0__["PlatformLocation"]); BrowserPlatformLocation.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"] }]; /** @nocollapse */ BrowserPlatformLocation.ctorParameters = function () { return [{ type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"]] }] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * An id that identifies a particular application being bootstrapped, that should * match across the client/server boundary. * @type {?} */ var TRANSITION_ID = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('TRANSITION_ID'); /** * @param {?} transitionId * @param {?} document * @param {?} injector * @return {?} */ function appInitializerFactory(transitionId, document, injector) { return ( /** * @return {?} */ function () { // Wait for all application initializers to be completed before removing the styles set by // the server. injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ApplicationInitStatus"]).donePromise.then( /** * @return {?} */ function () { /** @type {?} */ var dom = getDOM(); /** @type {?} */ var styles = Array.prototype.slice.apply(dom.querySelectorAll(document, "style[ng-transition]")); styles.filter( /** * @param {?} el * @return {?} */ function (el) { return dom.getAttribute(el, 'ng-transition') === transitionId; }).forEach( /** * @param {?} el * @return {?} */ function (el) { return dom.remove(el); }); }); } ); } /** @type {?} */ var SERVER_TRANSITION_PROVIDERS = [{ provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["APP_INITIALIZER"], useFactory: appInitializerFactory, deps: [TRANSITION_ID, _angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injector"]], multi: true }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var BrowserGetTestability = /*#__PURE__*/function () { function BrowserGetTestability() { _classCallCheck(this, BrowserGetTestability); } _createClass2(BrowserGetTestability, [{ key: "addToWindow", /** * @param {?} registry * @return {?} */ value: function addToWindow(registry) { _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵglobal"]['getAngularTestability'] = /** * @param {?} elem * @param {?=} findInAncestors * @return {?} */ function (elem) { var findInAncestors = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; /** @type {?} */ var testability = registry.findTestabilityInTree(elem, findInAncestors); if (testability == null) { throw new Error('Could not find testability for element.'); } return testability; }; _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵglobal"]['getAllAngularTestabilities'] = /** * @return {?} */ function () { return registry.getAllTestabilities(); }; _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵglobal"]['getAllAngularRootElements'] = /** * @return {?} */ function () { return registry.getAllRootElements(); }; /** @type {?} */ var whenAllStable = /** * @param {?} callback * @return {?} */ function whenAllStable(callback /** TODO #9100 */ ) { /** @type {?} */ var testabilities = _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵglobal"]['getAllAngularTestabilities'](); /** @type {?} */ var count = testabilities.length; /** @type {?} */ var didWork = false; /** @type {?} */ var decrement = /** * @param {?} didWork_ * @return {?} */ function decrement(didWork_ /** TODO #9100 */ ) { didWork = didWork || didWork_; count--; if (count == 0) { callback(didWork); } }; testabilities.forEach( /** * @param {?} testability * @return {?} */ function (testability /** TODO #9100 */ ) { testability.whenStable(decrement); }); }; if (!_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵglobal"]['frameworkStabilizers']) { _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵglobal"]['frameworkStabilizers'] = []; } _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵglobal"]['frameworkStabilizers'].push(whenAllStable); } /** * @param {?} registry * @param {?} elem * @param {?} findInAncestors * @return {?} */ }, { key: "findTestabilityInTree", value: function findTestabilityInTree(registry, elem, findInAncestors) { if (elem == null) { return null; } /** @type {?} */ var t = registry.getTestability(elem); if (t != null) { return t; } else if (!findInAncestors) { return null; } if (getDOM().isShadowRoot(elem)) { return this.findTestabilityInTree(registry, getDOM().getHost(elem), true); } return this.findTestabilityInTree(registry, getDOM().parentElement(elem), true); } }], [{ key: "init", /** * @return {?} */ value: function init() { Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["setTestabilityGetter"])(new BrowserGetTestability()); } }]); return BrowserGetTestability; }(); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var CAMEL_CASE_REGEXP = /([A-Z])/g; /** @type {?} */ var DASH_CASE_REGEXP = /-([a-z])/g; /** * @param {?} input * @return {?} */ function camelCaseToDashCase(input) { return input.replace(CAMEL_CASE_REGEXP, /** * @param {...?} m * @return {?} */ function () { for (var _len19 = arguments.length, m = new Array(_len19), _key20 = 0; _key20 < _len19; _key20++) { m[_key20] = arguments[_key20]; } return '-' + m[1].toLowerCase(); }); } /** * @param {?} input * @return {?} */ function dashCaseToCamelCase(input) { return input.replace(DASH_CASE_REGEXP, /** * @param {...?} m * @return {?} */ function () { for (var _len20 = arguments.length, m = new Array(_len20), _key21 = 0; _key21 < _len20; _key21++) { m[_key21] = arguments[_key21]; } return m[1].toUpperCase(); }); } /** * Exports the value under a given `name` in the global property `ng`. For example `ng.probe` if * `name` is `'probe'`. * @param {?} name Name under which it will be exported. Keep in mind this will be a property of the * global `ng` object. * @param {?} value The value to export. * @return {?} */ function exportNgVar(name, value) { if (typeof COMPILED === 'undefined' || !COMPILED) { // Note: we can't export `ng` when using closure enhanced optimization as: // - closure declares globals itself for minified names, which sometimes clobber our `ng` global // - we can't declare a closure extern as the namespace `ng` is already used within Google // for typings for angularJS (via `goog.provide('ng....')`). /** @type {?} */ var ng = _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵglobal"]['ng'] = /** @type {?} */ _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵglobal"]['ng'] || {}; ng[name] = value; } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ɵ0$1 = /** * @return {?} */ function ɵ0$1() { return { 'ApplicationRef': _angular_core__WEBPACK_IMPORTED_MODULE_1__["ApplicationRef"], 'NgZone': _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"] }; }; /** @type {?} */ var CORE_TOKENS = ɵ0$1(); /** @type {?} */ var INSPECT_GLOBAL_NAME = 'probe'; /** @type {?} */ var CORE_TOKENS_GLOBAL_NAME = 'coreTokens'; /** * Returns a {\@link DebugElement} for the given native DOM element, or * null if the given native element does not have an Angular view associated * with it. * @param {?} element * @return {?} */ function inspectNativeElement(element) { return Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["getDebugNode"])(element); } /** * @param {?} coreTokens * @return {?} */ function _createNgProbe(coreTokens) { exportNgVar(INSPECT_GLOBAL_NAME, inspectNativeElement); exportNgVar(CORE_TOKENS_GLOBAL_NAME, Object.assign({}, CORE_TOKENS, _ngProbeTokensToMap(coreTokens || []))); return ( /** * @return {?} */ function () { return inspectNativeElement; } ); } /** * @param {?} tokens * @return {?} */ function _ngProbeTokensToMap(tokens) { return tokens.reduce( /** * @param {?} prev * @param {?} t * @return {?} */ function (prev, t) { return prev[t.name] = t.token, prev; }, {}); } /** * In Ivy, we don't support NgProbe because we have our own set of testing utilities * with more robust functionality. * * We shouldn't bring in NgProbe because it prevents DebugNode and friends from * tree-shaking properly. * @type {?} */ var ELEMENT_PROBE_PROVIDERS__POST_R3__ = []; /** * Providers which support debugging Angular applications (e.g. via `ng.probe`). * @type {?} */ var ELEMENT_PROBE_PROVIDERS__PRE_R3__ = [{ provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["APP_INITIALIZER"], useFactory: _createNgProbe, deps: [[_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgProbeToken"], new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"]()]], multi: true }]; /** @type {?} */ var ELEMENT_PROBE_PROVIDERS = ELEMENT_PROBE_PROVIDERS__PRE_R3__; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * The injection token for the event-manager plug-in service. * * \@publicApi * @type {?} */ var EVENT_MANAGER_PLUGINS = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('EventManagerPlugins'); /** * An injectable service that provides event management for Angular * through a browser plug-in. * * \@publicApi */ var EventManager = /*#__PURE__*/function () { /** * Initializes an instance of the event-manager service. * @param {?} plugins * @param {?} _zone */ function EventManager(plugins, _zone) { var _this398 = this; _classCallCheck(this, EventManager); this._zone = _zone; this._eventNameToPlugin = new Map(); plugins.forEach( /** * @template THIS * @this {THIS} * @param {?} p * @return {THIS} */ function (p) { return p.manager = _this398; }); this._plugins = plugins.slice().reverse(); } /** * Registers a handler for a specific element and event. * * @param {?} element The HTML element to receive event notifications. * @param {?} eventName The name of the event to listen for. * @param {?} handler A function to call when the notification occurs. Receives the * event object as an argument. * @return {?} A callback function that can be used to remove the handler. */ _createClass2(EventManager, [{ key: "addEventListener", value: function addEventListener(element, eventName, handler) { /** @type {?} */ var plugin = this._findPluginFor(eventName); return plugin.addEventListener(element, eventName, handler); } /** * Registers a global handler for an event in a target view. * * @param {?} target A target for global event notifications. One of "window", "document", or "body". * @param {?} eventName The name of the event to listen for. * @param {?} handler A function to call when the notification occurs. Receives the * event object as an argument. * @return {?} A callback function that can be used to remove the handler. */ }, { key: "addGlobalEventListener", value: function addGlobalEventListener(target, eventName, handler) { /** @type {?} */ var plugin = this._findPluginFor(eventName); return plugin.addGlobalEventListener(target, eventName, handler); } /** * Retrieves the compilation zone in which event listeners are registered. * @return {?} */ }, { key: "getZone", value: function getZone() { return this._zone; } /** * \@internal * @param {?} eventName * @return {?} */ }, { key: "_findPluginFor", value: function _findPluginFor(eventName) { /** @type {?} */ var plugin = this._eventNameToPlugin.get(eventName); if (plugin) { return plugin; } /** @type {?} */ var plugins = this._plugins; for (var i = 0; i < plugins.length; i++) { /** @type {?} */ var _plugin = plugins[i]; if (_plugin.supports(eventName)) { this._eventNameToPlugin.set(eventName, _plugin); return _plugin; } } throw new Error("No event manager plugin found for event ".concat(eventName)); } }]); return EventManager; }(); EventManager.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"] }]; /** @nocollapse */ EventManager.ctorParameters = function () { return [{ type: Array, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [EVENT_MANAGER_PLUGINS] }] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"] }]; }; if (false) {} /** * @abstract */ var EventManagerPlugin = /*#__PURE__*/function () { /** * @param {?} _doc */ function EventManagerPlugin(_doc) { _classCallCheck(this, EventManagerPlugin); this._doc = _doc; } /** * @param {?} element * @param {?} eventName * @param {?} handler * @return {?} */ _createClass2(EventManagerPlugin, [{ key: "addGlobalEventListener", value: function addGlobalEventListener(element, eventName, handler) { /** @type {?} */ var target = getDOM().getGlobalEventTarget(this._doc, element); if (!target) { throw new Error("Unsupported event target ".concat(target, " for event ").concat(eventName)); } return this.addEventListener(target, eventName, handler); } }]); return EventManagerPlugin; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var SharedStylesHost = /*#__PURE__*/function () { function SharedStylesHost() { _classCallCheck(this, SharedStylesHost); /** * \@internal */ this._stylesSet = new Set(); } /** * @param {?} styles * @return {?} */ _createClass2(SharedStylesHost, [{ key: "addStyles", value: function addStyles(styles) { var _this399 = this; /** @type {?} */ var additions = new Set(); styles.forEach( /** * @param {?} style * @return {?} */ function (style) { if (!_this399._stylesSet.has(style)) { _this399._stylesSet.add(style); additions.add(style); } }); this.onStylesAdded(additions); } /** * @param {?} additions * @return {?} */ }, { key: "onStylesAdded", value: function onStylesAdded(additions) {} /** * @return {?} */ }, { key: "getAllStyles", value: function getAllStyles() { return Array.from(this._stylesSet); } }]); return SharedStylesHost; }(); SharedStylesHost.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"] }]; if (false) {} var DomSharedStylesHost = /*#__PURE__*/function (_SharedStylesHost) { _inherits(DomSharedStylesHost, _SharedStylesHost); var _super148 = _createSuper(DomSharedStylesHost); /** * @param {?} _doc */ function DomSharedStylesHost(_doc) { var _this400; _classCallCheck(this, DomSharedStylesHost); _this400 = _super148.call(this); _this400._doc = _doc; _this400._hostNodes = new Set(); _this400._styleNodes = new Set(); _this400._hostNodes.add(_doc.head); return _this400; } /** * @private * @param {?} styles * @param {?} host * @return {?} */ _createClass2(DomSharedStylesHost, [{ key: "_addStylesToHost", value: function _addStylesToHost(styles, host) { var _this401 = this; styles.forEach( /** * @param {?} style * @return {?} */ function (style) { /** @type {?} */ var styleEl = _this401._doc.createElement('style'); styleEl.textContent = style; _this401._styleNodes.add(host.appendChild(styleEl)); }); } /** * @param {?} hostNode * @return {?} */ }, { key: "addHost", value: function addHost(hostNode) { this._addStylesToHost(this._stylesSet, hostNode); this._hostNodes.add(hostNode); } /** * @param {?} hostNode * @return {?} */ }, { key: "removeHost", value: function removeHost(hostNode) { this._hostNodes["delete"](hostNode); } /** * @param {?} additions * @return {?} */ }, { key: "onStylesAdded", value: function onStylesAdded(additions) { var _this402 = this; this._hostNodes.forEach( /** * @param {?} hostNode * @return {?} */ function (hostNode) { return _this402._addStylesToHost(additions, hostNode); }); } /** * @return {?} */ }, { key: "ngOnDestroy", value: function ngOnDestroy() { this._styleNodes.forEach( /** * @param {?} styleNode * @return {?} */ function (styleNode) { return getDOM().remove(styleNode); }); } }]); return DomSharedStylesHost; }(SharedStylesHost); DomSharedStylesHost.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"] }]; /** @nocollapse */ DomSharedStylesHost.ctorParameters = function () { return [{ type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"]] }] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var NAMESPACE_URIS = { 'svg': 'http://www.w3.org/2000/svg', 'xhtml': 'http://www.w3.org/1999/xhtml', 'xlink': 'http://www.w3.org/1999/xlink', 'xml': 'http://www.w3.org/XML/1998/namespace', 'xmlns': 'http://www.w3.org/2000/xmlns/' }; /** @type {?} */ var COMPONENT_REGEX = /%COMP%/g; /** @type {?} */ var COMPONENT_VARIABLE = '%COMP%'; /** @type {?} */ var HOST_ATTR = "_nghost-".concat(COMPONENT_VARIABLE); /** @type {?} */ var CONTENT_ATTR = "_ngcontent-".concat(COMPONENT_VARIABLE); /** * @param {?} componentShortId * @return {?} */ function shimContentAttribute(componentShortId) { return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId); } /** * @param {?} componentShortId * @return {?} */ function shimHostAttribute(componentShortId) { return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId); } /** * @param {?} compId * @param {?} styles * @param {?} target * @return {?} */ function flattenStyles(compId, styles, target) { for (var i = 0; i < styles.length; i++) { /** @type {?} */ var style = styles[i]; if (Array.isArray(style)) { flattenStyles(compId, style, target); } else { style = style.replace(COMPONENT_REGEX, compId); target.push(style); } } return target; } /** * @param {?} eventHandler * @return {?} */ function decoratePreventDefault(eventHandler) { return ( /** * @param {?} event * @return {?} */ function (event) { /** @type {?} */ var allowDefaultBehavior = eventHandler(event); if (allowDefaultBehavior === false) { // TODO(tbosch): move preventDefault into event plugins... event.preventDefault(); event.returnValue = false; } } ); } var DomRendererFactory2 = /*#__PURE__*/function () { /** * @param {?} eventManager * @param {?} sharedStylesHost * @param {?} appId */ function DomRendererFactory2(eventManager, sharedStylesHost, appId) { _classCallCheck(this, DomRendererFactory2); this.eventManager = eventManager; this.sharedStylesHost = sharedStylesHost; this.appId = appId; this.rendererByCompId = new Map(); this.defaultRenderer = new DefaultDomRenderer2(eventManager); } /** * @param {?} element * @param {?} type * @return {?} */ _createClass2(DomRendererFactory2, [{ key: "createRenderer", value: function createRenderer(element, type) { if (!element || !type) { return this.defaultRenderer; } switch (type.encapsulation) { case _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"].Emulated: { /** @type {?} */ var renderer = this.rendererByCompId.get(type.id); if (!renderer) { renderer = new EmulatedEncapsulationDomRenderer2(this.eventManager, this.sharedStylesHost, type, this.appId); this.rendererByCompId.set(type.id, renderer); } /** @type {?} */ renderer.applyToHost(element); return renderer; } case _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"].Native: case _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"].ShadowDom: return new ShadowDomRenderer(this.eventManager, this.sharedStylesHost, element, type); default: { if (!this.rendererByCompId.has(type.id)) { /** @type {?} */ var styles = flattenStyles(type.id, type.styles, []); this.sharedStylesHost.addStyles(styles); this.rendererByCompId.set(type.id, this.defaultRenderer); } return this.defaultRenderer; } } } /** * @return {?} */ }, { key: "begin", value: function begin() {} /** * @return {?} */ }, { key: "end", value: function end() {} }]); return DomRendererFactory2; }(); DomRendererFactory2.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"] }]; /** @nocollapse */ DomRendererFactory2.ctorParameters = function () { return [{ type: EventManager }, { type: DomSharedStylesHost }, { type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [_angular_core__WEBPACK_IMPORTED_MODULE_1__["APP_ID"]] }] }]; }; if (false) {} var DefaultDomRenderer2 = /*#__PURE__*/function () { /** * @param {?} eventManager */ function DefaultDomRenderer2(eventManager) { _classCallCheck(this, DefaultDomRenderer2); this.eventManager = eventManager; this.data = Object.create(null); } /** * @return {?} */ _createClass2(DefaultDomRenderer2, [{ key: "destroy", value: function destroy() {} /** * @param {?} name * @param {?=} namespace * @return {?} */ }, { key: "createElement", value: function createElement(name, namespace) { if (namespace) { // In cases where Ivy (not ViewEngine) is giving us the actual namespace, the look up by key // will result in undefined, so we just return the namespace here. return document.createElementNS(NAMESPACE_URIS[namespace] || namespace, name); } return document.createElement(name); } /** * @param {?} value * @return {?} */ }, { key: "createComment", value: function createComment(value) { return document.createComment(value); } /** * @param {?} value * @return {?} */ }, { key: "createText", value: function createText(value) { return document.createTextNode(value); } /** * @param {?} parent * @param {?} newChild * @return {?} */ }, { key: "appendChild", value: function appendChild(parent, newChild) { parent.appendChild(newChild); } /** * @param {?} parent * @param {?} newChild * @param {?} refChild * @return {?} */ }, { key: "insertBefore", value: function insertBefore(parent, newChild, refChild) { if (parent) { parent.insertBefore(newChild, refChild); } } /** * @param {?} parent * @param {?} oldChild * @return {?} */ }, { key: "removeChild", value: function removeChild(parent, oldChild) { if (parent) { parent.removeChild(oldChild); } } /** * @param {?} selectorOrNode * @param {?=} preserveContent * @return {?} */ }, { key: "selectRootElement", value: function selectRootElement(selectorOrNode, preserveContent) { /** @type {?} */ var el = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) : selectorOrNode; if (!el) { throw new Error("The selector \"".concat(selectorOrNode, "\" did not match any elements")); } if (!preserveContent) { el.textContent = ''; } return el; } /** * @param {?} node * @return {?} */ }, { key: "parentNode", value: function parentNode(node) { return node.parentNode; } /** * @param {?} node * @return {?} */ }, { key: "nextSibling", value: function nextSibling(node) { return node.nextSibling; } /** * @param {?} el * @param {?} name * @param {?} value * @param {?=} namespace * @return {?} */ }, { key: "setAttribute", value: function setAttribute(el, name, value, namespace) { if (namespace) { name = namespace + ':' + name; // TODO(benlesh): Ivy may cause issues here because it's passing around // full URIs for namespaces, therefore this lookup will fail. /** @type {?} */ var namespaceUri = NAMESPACE_URIS[namespace]; if (namespaceUri) { el.setAttributeNS(namespaceUri, name, value); } else { el.setAttribute(name, value); } } else { el.setAttribute(name, value); } } /** * @param {?} el * @param {?} name * @param {?=} namespace * @return {?} */ }, { key: "removeAttribute", value: function removeAttribute(el, name, namespace) { if (namespace) { // TODO(benlesh): Ivy may cause issues here because it's passing around // full URIs for namespaces, therefore this lookup will fail. /** @type {?} */ var namespaceUri = NAMESPACE_URIS[namespace]; if (namespaceUri) { el.removeAttributeNS(namespaceUri, name); } else { // TODO(benlesh): Since ivy is passing around full URIs for namespaces // this could result in properties like `http://www.w3.org/2000/svg:cx="123"`, // which is wrong. el.removeAttribute("".concat(namespace, ":").concat(name)); } } else { el.removeAttribute(name); } } /** * @param {?} el * @param {?} name * @return {?} */ }, { key: "addClass", value: function addClass(el, name) { el.classList.add(name); } /** * @param {?} el * @param {?} name * @return {?} */ }, { key: "removeClass", value: function removeClass(el, name) { el.classList.remove(name); } /** * @param {?} el * @param {?} style * @param {?} value * @param {?} flags * @return {?} */ }, { key: "setStyle", value: function setStyle(el, style, value, flags) { if (flags & _angular_core__WEBPACK_IMPORTED_MODULE_1__["RendererStyleFlags2"].DashCase) { el.style.setProperty(style, value, !!(flags & _angular_core__WEBPACK_IMPORTED_MODULE_1__["RendererStyleFlags2"].Important) ? 'important' : ''); } else { el.style[style] = value; } } /** * @param {?} el * @param {?} style * @param {?} flags * @return {?} */ }, { key: "removeStyle", value: function removeStyle(el, style, flags) { if (flags & _angular_core__WEBPACK_IMPORTED_MODULE_1__["RendererStyleFlags2"].DashCase) { el.style.removeProperty(style); } else { // IE requires '' instead of null // see https://github.com/angular/angular/issues/7916 el.style[style] = ''; } } /** * @param {?} el * @param {?} name * @param {?} value * @return {?} */ }, { key: "setProperty", value: function setProperty(el, name, value) { checkNoSyntheticProp(name, 'property'); el[name] = value; } /** * @param {?} node * @param {?} value * @return {?} */ }, { key: "setValue", value: function setValue(node, value) { node.nodeValue = value; } /** * @param {?} target * @param {?} event * @param {?} callback * @return {?} */ }, { key: "listen", value: function listen(target, event, callback) { checkNoSyntheticProp(event, 'listener'); if (typeof target === 'string') { return ( /** @type {?} */ this.eventManager.addGlobalEventListener(target, event, decoratePreventDefault(callback)) ); } return ( /** @type {?} */ /** @type {?} */ this.eventManager.addEventListener(target, event, decoratePreventDefault(callback)) ); } }]); return DefaultDomRenderer2; }(); if (false) {} var ɵ0$2 = /** * @return {?} */ function ɵ0$2() { return '@'.charCodeAt(0); }; /** @type {?} */ var AT_CHARCODE = ɵ0$2(); /** * @param {?} name * @param {?} nameKind * @return {?} */ function checkNoSyntheticProp(name, nameKind) { if (name.charCodeAt(0) === AT_CHARCODE) { throw new Error("Found the synthetic ".concat(nameKind, " ").concat(name, ". Please include either \"BrowserAnimationsModule\" or \"NoopAnimationsModule\" in your application.")); } } var EmulatedEncapsulationDomRenderer2 = /*#__PURE__*/function (_DefaultDomRenderer) { _inherits(EmulatedEncapsulationDomRenderer2, _DefaultDomRenderer); var _super149 = _createSuper(EmulatedEncapsulationDomRenderer2); /** * @param {?} eventManager * @param {?} sharedStylesHost * @param {?} component * @param {?} appId */ function EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, component, appId) { var _this403; _classCallCheck(this, EmulatedEncapsulationDomRenderer2); _this403 = _super149.call(this, eventManager); _this403.component = component; /** @type {?} */ var styles = flattenStyles(appId + '-' + component.id, component.styles, []); sharedStylesHost.addStyles(styles); _this403.contentAttr = shimContentAttribute(appId + '-' + component.id); _this403.hostAttr = shimHostAttribute(appId + '-' + component.id); return _this403; } /** * @param {?} element * @return {?} */ _createClass2(EmulatedEncapsulationDomRenderer2, [{ key: "applyToHost", value: function applyToHost(element) { _get(_getPrototypeOf(EmulatedEncapsulationDomRenderer2.prototype), "setAttribute", this).call(this, element, this.hostAttr, ''); } /** * @param {?} parent * @param {?} name * @return {?} */ }, { key: "createElement", value: function createElement(parent, name) { /** @type {?} */ var el = _get(_getPrototypeOf(EmulatedEncapsulationDomRenderer2.prototype), "createElement", this).call(this, parent, name); _get(_getPrototypeOf(EmulatedEncapsulationDomRenderer2.prototype), "setAttribute", this).call(this, el, this.contentAttr, ''); return el; } }]); return EmulatedEncapsulationDomRenderer2; }(DefaultDomRenderer2); if (false) {} var ShadowDomRenderer = /*#__PURE__*/function (_DefaultDomRenderer2) { _inherits(ShadowDomRenderer, _DefaultDomRenderer2); var _super150 = _createSuper(ShadowDomRenderer); /** * @param {?} eventManager * @param {?} sharedStylesHost * @param {?} hostEl * @param {?} component */ function ShadowDomRenderer(eventManager, sharedStylesHost, hostEl, component) { var _this404; _classCallCheck(this, ShadowDomRenderer); _this404 = _super150.call(this, eventManager); _this404.sharedStylesHost = sharedStylesHost; _this404.hostEl = hostEl; _this404.component = component; if (component.encapsulation === _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"].ShadowDom) { _this404.shadowRoot = /** @type {?} */ hostEl.attachShadow({ mode: 'open' }); } else { _this404.shadowRoot = /** @type {?} */ hostEl.createShadowRoot(); } _this404.sharedStylesHost.addHost(_this404.shadowRoot); /** @type {?} */ var styles = flattenStyles(component.id, component.styles, []); for (var i = 0; i < styles.length; i++) { /** @type {?} */ var styleEl = document.createElement('style'); styleEl.textContent = styles[i]; _this404.shadowRoot.appendChild(styleEl); } return _this404; } /** * @private * @param {?} node * @return {?} */ _createClass2(ShadowDomRenderer, [{ key: "nodeOrShadowRoot", value: function nodeOrShadowRoot(node) { return node === this.hostEl ? this.shadowRoot : node; } /** * @return {?} */ }, { key: "destroy", value: function destroy() { this.sharedStylesHost.removeHost(this.shadowRoot); } /** * @param {?} parent * @param {?} newChild * @return {?} */ }, { key: "appendChild", value: function appendChild(parent, newChild) { return _get(_getPrototypeOf(ShadowDomRenderer.prototype), "appendChild", this).call(this, this.nodeOrShadowRoot(parent), newChild); } /** * @param {?} parent * @param {?} newChild * @param {?} refChild * @return {?} */ }, { key: "insertBefore", value: function insertBefore(parent, newChild, refChild) { return _get(_getPrototypeOf(ShadowDomRenderer.prototype), "insertBefore", this).call(this, this.nodeOrShadowRoot(parent), newChild, refChild); } /** * @param {?} parent * @param {?} oldChild * @return {?} */ }, { key: "removeChild", value: function removeChild(parent, oldChild) { return _get(_getPrototypeOf(ShadowDomRenderer.prototype), "removeChild", this).call(this, this.nodeOrShadowRoot(parent), oldChild); } /** * @param {?} node * @return {?} */ }, { key: "parentNode", value: function parentNode(node) { return this.nodeOrShadowRoot(_get(_getPrototypeOf(ShadowDomRenderer.prototype), "parentNode", this).call(this, this.nodeOrShadowRoot(node))); } }]); return ShadowDomRenderer; }(DefaultDomRenderer2); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ɵ0$3 = /** * @return {?} */ function ɵ0$3() { return typeof Zone !== 'undefined' && /** @type {?} */ Zone['__symbol__'] || /** * @param {?} v * @return {?} */ function (v) { return '__zone_symbol__' + v; }; }; /** * Detect if Zone is present. If it is then use simple zone aware 'addEventListener' * since Angular can do much more * efficient bookkeeping than Zone can, because we have additional information. This speeds up * addEventListener by 3x. * @type {?} */ var __symbol__ = ɵ0$3(); /** @type {?} */ var ADD_EVENT_LISTENER = __symbol__('addEventListener'); /** @type {?} */ var REMOVE_EVENT_LISTENER = __symbol__('removeEventListener'); /** @type {?} */ var symbolNames = {}; /** @type {?} */ var FALSE = 'FALSE'; /** @type {?} */ var ANGULAR = 'ANGULAR'; /** @type {?} */ var NATIVE_ADD_LISTENER = 'addEventListener'; /** @type {?} */ var NATIVE_REMOVE_LISTENER = 'removeEventListener'; // use the same symbol string which is used in zone.js /** @type {?} */ var stopSymbol = '__zone_symbol__propagationStopped'; /** @type {?} */ var stopMethodSymbol = '__zone_symbol__stopImmediatePropagation'; var ɵ1 = /** * @return {?} */ function ɵ1() { /** @type {?} */ var blackListedEvents = typeof Zone !== 'undefined' && /** @type {?} */ Zone[__symbol__('BLACK_LISTED_EVENTS')]; if (blackListedEvents) { /** @type {?} */ var res = {}; blackListedEvents.forEach( /** * @param {?} eventName * @return {?} */ function (eventName) { res[eventName] = eventName; }); return res; } return undefined; }; /** @type {?} */ var blackListedMap = ɵ1(); /** @type {?} */ var isBlackListedEvent = /** * @param {?} eventName * @return {?} */ function isBlackListedEvent(eventName) { if (!blackListedMap) { return false; } return blackListedMap.hasOwnProperty(eventName); }; var ɵ2 = isBlackListedEvent; /** * @record */ function TaskData() {} if (false) {} // a global listener to handle all dom event, // so we do not need to create a closure every time /** @type {?} */ var globalListener = /** * @this {?} * @param {?} event * @return {?} */ function globalListener(event) { /** @type {?} */ var symbolName = symbolNames[event.type]; if (!symbolName) { return; } /** @type {?} */ var taskDatas = this[symbolName]; if (!taskDatas) { return; } /** @type {?} */ var args = [event]; if (taskDatas.length === 1) { // if taskDatas only have one element, just invoke it /** @type {?} */ var taskData = taskDatas[0]; if (taskData.zone !== Zone.current) { // only use Zone.run when Zone.current not equals to stored zone return taskData.zone.run(taskData.handler, this, args); } else { return taskData.handler.apply(this, args); } } else { // copy tasks as a snapshot to avoid event handlers remove // itself or others /** @type {?} */ var copiedTasks = taskDatas.slice(); for (var i = 0; i < copiedTasks.length; i++) { // if other listener call event.stopImmediatePropagation // just break if ( /** @type {?} */ event[stopSymbol] === true) { break; } /** @type {?} */ var _taskData = copiedTasks[i]; if (_taskData.zone !== Zone.current) { // only use Zone.run when Zone.current not equals to stored zone _taskData.zone.run(_taskData.handler, this, args); } else { _taskData.handler.apply(this, args); } } } }; var ɵ3 = globalListener; var DomEventsPlugin = /*#__PURE__*/function (_EventManagerPlugin) { _inherits(DomEventsPlugin, _EventManagerPlugin); var _super151 = _createSuper(DomEventsPlugin); /** * @param {?} doc * @param {?} ngZone * @param {?} platformId */ function DomEventsPlugin(doc, ngZone, platformId) { var _this405; _classCallCheck(this, DomEventsPlugin); _this405 = _super151.call(this, doc); _this405.ngZone = ngZone; if (!platformId || !Object(_angular_common__WEBPACK_IMPORTED_MODULE_0__["isPlatformServer"])(platformId)) { _this405.patchEvent(); } return _this405; } /** * @private * @return {?} */ _createClass2(DomEventsPlugin, [{ key: "patchEvent", value: function patchEvent() { if (typeof Event === 'undefined' || !Event || !Event.prototype) { return; } if ( /** @type {?} */ Event.prototype[stopMethodSymbol]) { // already patched by zone.js return; } /** @type {?} */ var delegate = /** @type {?} */ Event.prototype[stopMethodSymbol] = Event.prototype.stopImmediatePropagation; Event.prototype.stopImmediatePropagation = /** * @this {?} * @return {?} */ function () { if (this) { this[stopSymbol] = true; } // We should call native delegate in case in some environment part of // the application will not use the patched Event. Also we cast the // "arguments" to any since "stopImmediatePropagation" technically does not // accept any arguments, but we don't know what developers pass through the // function and we want to not break these calls. delegate && delegate.apply(this, /** @type {?} */ arguments); }; } // This plugin should come last in the list of plugins, because it accepts all // events. /** * @param {?} eventName * @return {?} */ }, { key: "supports", value: function supports(eventName) { return true; } /** * @param {?} element * @param {?} eventName * @param {?} handler * @return {?} */ }, { key: "addEventListener", value: function addEventListener(element, eventName, handler) { var _this406 = this; /** * This code is about to add a listener to the DOM. If Zone.js is present, than * `addEventListener` has been patched. The patched code adds overhead in both * memory and speed (3x slower) than native. For this reason if we detect that * Zone.js is present we use a simple version of zone aware addEventListener instead. * The result is faster registration and the zone will be restored. * But ZoneSpec.onScheduleTask, ZoneSpec.onInvokeTask, ZoneSpec.onCancelTask * will not be invoked * We also do manual zone restoration in element.ts renderEventHandlerClosure method. * * NOTE: it is possible that the element is from different iframe, and so we * have to check before we execute the method. * @type {?} */ var self = this; /** @type {?} */ var zoneJsLoaded = element[ADD_EVENT_LISTENER]; /** @type {?} */ var callback = /** @type {?} */ handler; // if zonejs is loaded and current zone is not ngZone // we keep Zone.current on target for later restoration. if (zoneJsLoaded && (!_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"].isInAngularZone() || isBlackListedEvent(eventName))) { /** @type {?} */ var symbolName = symbolNames[eventName]; if (!symbolName) { symbolName = symbolNames[eventName] = __symbol__(ANGULAR + eventName + FALSE); } /** @type {?} */ var taskDatas = /** @type {?} */ element[symbolName]; /** @type {?} */ var globalListenerRegistered = taskDatas && taskDatas.length > 0; if (!taskDatas) { taskDatas = /** @type {?} */ element[symbolName] = []; } /** @type {?} */ var zone = isBlackListedEvent(eventName) ? Zone.root : Zone.current; if (taskDatas.length === 0) { taskDatas.push({ zone: zone, handler: callback }); } else { /** @type {?} */ var callbackRegistered = false; for (var i = 0; i < taskDatas.length; i++) { if (taskDatas[i].handler === callback) { callbackRegistered = true; break; } } if (!callbackRegistered) { taskDatas.push({ zone: zone, handler: callback }); } } if (!globalListenerRegistered) { element[ADD_EVENT_LISTENER](eventName, globalListener, false); } } else { element[NATIVE_ADD_LISTENER](eventName, callback, false); } return ( /** * @return {?} */ function () { return _this406.removeEventListener(element, eventName, callback); } ); } /** * @param {?} target * @param {?} eventName * @param {?} callback * @return {?} */ }, { key: "removeEventListener", value: function removeEventListener(target, eventName, callback) { /** @type {?} */ var underlyingRemove = target[REMOVE_EVENT_LISTENER]; // zone.js not loaded, use native removeEventListener if (!underlyingRemove) { return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]); } /** @type {?} */ var symbolName = symbolNames[eventName]; /** @type {?} */ var taskDatas = symbolName && target[symbolName]; if (!taskDatas) { // addEventListener not using patched version // just call native removeEventListener return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]); } // fix issue 20532, should be able to remove // listener which was added inside of ngZone /** @type {?} */ var found = false; for (var i = 0; i < taskDatas.length; i++) { // remove listener from taskDatas if the callback equals if (taskDatas[i].handler === callback) { found = true; taskDatas.splice(i, 1); break; } } if (found) { if (taskDatas.length === 0) { // all listeners are removed, we can remove the globalListener from target underlyingRemove.apply(target, [eventName, globalListener, false]); } } else { // not found in taskDatas, the callback may be added inside of ngZone // use native remove listener to remove the callback target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]); } } }]); return DomEventsPlugin; }(EventManagerPlugin); DomEventsPlugin.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"] }]; /** @nocollapse */ DomEventsPlugin.ctorParameters = function () { return [{ type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"]] }] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"] }, { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [_angular_core__WEBPACK_IMPORTED_MODULE_1__["PLATFORM_ID"]] }] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Supported HammerJS recognizer event names. * @type {?} */ var EVENT_NAMES = { // pan 'pan': true, 'panstart': true, 'panmove': true, 'panend': true, 'pancancel': true, 'panleft': true, 'panright': true, 'panup': true, 'pandown': true, // pinch 'pinch': true, 'pinchstart': true, 'pinchmove': true, 'pinchend': true, 'pinchcancel': true, 'pinchin': true, 'pinchout': true, // press 'press': true, 'pressup': true, // rotate 'rotate': true, 'rotatestart': true, 'rotatemove': true, 'rotateend': true, 'rotatecancel': true, // swipe 'swipe': true, 'swipeleft': true, 'swiperight': true, 'swipeup': true, 'swipedown': true, // tap 'tap': true }; /** * DI token for providing [HammerJS](http://hammerjs.github.io/) support to Angular. * @see `HammerGestureConfig` * * \@publicApi * @type {?} */ var HAMMER_GESTURE_CONFIG = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('HammerGestureConfig'); /** * Injection token used to provide a {\@link HammerLoader} to Angular. * * \@publicApi * @type {?} */ var HAMMER_LOADER = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('HammerLoader'); /** * @record */ function HammerInstance() {} if (false) {} /** * An injectable [HammerJS Manager](http://hammerjs.github.io/api/#hammer.manager) * for gesture recognition. Configures specific event recognition. * \@publicApi */ var HammerGestureConfig = /*#__PURE__*/function () { function HammerGestureConfig() { _classCallCheck(this, HammerGestureConfig); /** * A set of supported event names for gestures to be used in Angular. * Angular supports all built-in recognizers, as listed in * [HammerJS documentation](http://hammerjs.github.io/). */ this.events = []; /** * Maps gesture event names to a set of configuration options * that specify overrides to the default values for specific properties. * * The key is a supported event name to be configured, * and the options object contains a set of properties, with override values * to be applied to the named recognizer event. * For example, to disable recognition of the rotate event, specify * `{"rotate": {"enable": false}}`. * * Properties that are not present take the HammerJS default values. * For information about which properties are supported for which events, * and their allowed and default values, see * [HammerJS documentation](http://hammerjs.github.io/). * */ this.overrides = {}; } /** * Creates a [HammerJS Manager](http://hammerjs.github.io/api/#hammer.manager) * and attaches it to a given HTML element. * @param {?} element The element that will recognize gestures. * @return {?} A HammerJS event-manager object. */ _createClass2(HammerGestureConfig, [{ key: "buildHammer", value: function buildHammer(element) { /** @type {?} */ var mc = new /** @type {?} */ Hammer(element, this.options); mc.get('pinch').set({ enable: true }); mc.get('rotate').set({ enable: true }); for (var eventName in this.overrides) { mc.get(eventName).set(this.overrides[eventName]); } return mc; } }]); return HammerGestureConfig; }(); HammerGestureConfig.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"] }]; if (false) {} var HammerGesturesPlugin = /*#__PURE__*/function (_EventManagerPlugin2) { _inherits(HammerGesturesPlugin, _EventManagerPlugin2); var _super152 = _createSuper(HammerGesturesPlugin); /** * @param {?} doc * @param {?} _config * @param {?} console * @param {?=} loader */ function HammerGesturesPlugin(doc, _config, console, loader) { var _this407; _classCallCheck(this, HammerGesturesPlugin); _this407 = _super152.call(this, doc); _this407._config = _config; _this407.console = console; _this407.loader = loader; return _this407; } /** * @param {?} eventName * @return {?} */ _createClass2(HammerGesturesPlugin, [{ key: "supports", value: function supports(eventName) { if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) { return false; } if (! /** @type {?} */ window.Hammer && !this.loader) { this.console.warn("The \"".concat(eventName, "\" event cannot be bound because Hammer.JS is not ") + "loaded and no custom loader has been specified."); return false; } return true; } /** * @param {?} element * @param {?} eventName * @param {?} handler * @return {?} */ }, { key: "addEventListener", value: function addEventListener(element, eventName, handler) { var _this408 = this; /** @type {?} */ var zone = this.manager.getZone(); eventName = eventName.toLowerCase(); // If Hammer is not present but a loader is specified, we defer adding the event listener // until Hammer is loaded. if (! /** @type {?} */ window.Hammer && this.loader) { // This `addEventListener` method returns a function to remove the added listener. // Until Hammer is loaded, the returned function needs to *cancel* the registration rather // than remove anything. /** @type {?} */ var cancelRegistration = false; /** @type {?} */ var deregister = /** * @return {?} */ function deregister() { cancelRegistration = true; }; this.loader().then( /** * @return {?} */ function () { // If Hammer isn't actually loaded when the custom loader resolves, give up. if (! /** @type {?} */ window.Hammer) { _this408.console.warn("The custom HAMMER_LOADER completed, but Hammer.JS is not present."); deregister = /** * @return {?} */ function deregister() {}; return; } if (!cancelRegistration) { // Now that Hammer is loaded and the listener is being loaded for real, // the deregistration function changes from canceling registration to removal. deregister = _this408.addEventListener(element, eventName, handler); } })["catch"]( /** * @return {?} */ function () { _this408.console.warn("The \"".concat(eventName, "\" event cannot be bound because the custom ") + "Hammer.JS loader failed."); deregister = /** * @return {?} */ function deregister() {}; }); // Return a function that *executes* `deregister` (and not `deregister` itself) so that we // can change the behavior of `deregister` once the listener is added. Using a closure in // this way allows us to avoid any additional data structures to track listener removal. return ( /** * @return {?} */ function () { deregister(); } ); } return zone.runOutsideAngular( /** * @return {?} */ function () { // Creating the manager bind events, must be done outside of angular /** @type {?} */ var mc = _this408._config.buildHammer(element); /** @type {?} */ var callback = /** * @param {?} eventObj * @return {?} */ function callback(eventObj) { zone.runGuarded( /** * @return {?} */ function () { handler(eventObj); }); }; mc.on(eventName, callback); return ( /** * @return {?} */ function () { mc.off(eventName, callback); // destroy mc to prevent memory leak if (typeof mc.destroy === 'function') { mc.destroy(); } } ); }); } /** * @param {?} eventName * @return {?} */ }, { key: "isCustomEvent", value: function isCustomEvent(eventName) { return this._config.events.indexOf(eventName) > -1; } }]); return HammerGesturesPlugin; }(EventManagerPlugin); HammerGesturesPlugin.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"] }]; /** @nocollapse */ HammerGesturesPlugin.ctorParameters = function () { return [{ type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"]] }] }, { type: HammerGestureConfig, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [HAMMER_GESTURE_CONFIG] }] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵConsole"] }, { type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [HAMMER_LOADER] }] }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Defines supported modifiers for key events. * @type {?} */ var MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift']; var ɵ0$4 = /** * @param {?} event * @return {?} */ function ɵ0$4(event) { return event.altKey; }, ɵ1$1 = /** * @param {?} event * @return {?} */ function ɵ1$1(event) { return event.ctrlKey; }, ɵ2$1 = /** * @param {?} event * @return {?} */ function ɵ2$1(event) { return event.metaKey; }, ɵ3$1 = /** * @param {?} event * @return {?} */ function ɵ3$1(event) { return event.shiftKey; }; /** * Retrieves modifiers from key-event objects. * @type {?} */ var MODIFIER_KEY_GETTERS = { 'alt': ɵ0$4, 'control': ɵ1$1, 'meta': ɵ2$1, 'shift': ɵ3$1 }; /** * \@publicApi * A browser plug-in that provides support for handling of key events in Angular. */ var KeyEventsPlugin = /*#__PURE__*/function (_EventManagerPlugin3) { _inherits(KeyEventsPlugin, _EventManagerPlugin3); var _super153 = _createSuper(KeyEventsPlugin); /** * Initializes an instance of the browser plug-in. * @param {?} doc The document in which key events will be detected. */ function KeyEventsPlugin(doc) { _classCallCheck(this, KeyEventsPlugin); return _super153.call(this, doc); } /** * Reports whether a named key event is supported. * @param {?} eventName The event name to query. * @return {?} True if the named key event is supported. */ _createClass2(KeyEventsPlugin, [{ key: "supports", value: function supports(eventName) { return KeyEventsPlugin.parseEventName(eventName) != null; } /** * Registers a handler for a specific element and key event. * @param {?} element The HTML element to receive event notifications. * @param {?} eventName The name of the key event to listen for. * @param {?} handler A function to call when the notification occurs. Receives the * event object as an argument. * @return {?} The key event that was registered. */ }, { key: "addEventListener", value: function addEventListener(element, eventName, handler) { /** @type {?} */ var parsedEvent = /** @type {?} */ KeyEventsPlugin.parseEventName(eventName); /** @type {?} */ var outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone()); return this.manager.getZone().runOutsideAngular( /** * @return {?} */ function () { return getDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler); }); } /** * @param {?} eventName * @return {?} */ }], [{ key: "parseEventName", value: function parseEventName(eventName) { /** @type {?} */ var parts = eventName.toLowerCase().split('.'); /** @type {?} */ var domEventName = parts.shift(); if (parts.length === 0 || !(domEventName === 'keydown' || domEventName === 'keyup')) { return null; } /** @type {?} */ var key = KeyEventsPlugin._normalizeKey( /** @type {?} */ parts.pop()); /** @type {?} */ var fullKey = ''; MODIFIER_KEYS.forEach( /** * @param {?} modifierName * @return {?} */ function (modifierName) { /** @type {?} */ var index = parts.indexOf(modifierName); if (index > -1) { parts.splice(index, 1); fullKey += modifierName + '.'; } }); fullKey += key; if (parts.length != 0 || key.length === 0) { // returning null instead of throwing to let another plugin process the event return null; } /** @type {?} */ var result = {}; result['domEventName'] = domEventName; result['fullKey'] = fullKey; return result; } /** * @param {?} event * @return {?} */ }, { key: "getEventFullKey", value: function getEventFullKey(event) { /** @type {?} */ var fullKey = ''; /** @type {?} */ var key = getDOM().getEventKey(event); key = key.toLowerCase(); if (key === ' ') { key = 'space'; // for readability } else if (key === '.') { key = 'dot'; // because '.' is used as a separator in event names } MODIFIER_KEYS.forEach( /** * @param {?} modifierName * @return {?} */ function (modifierName) { if (modifierName != key) { /** @type {?} */ var modifierGetter = MODIFIER_KEY_GETTERS[modifierName]; if (modifierGetter(event)) { fullKey += modifierName + '.'; } } }); fullKey += key; return fullKey; } /** * Configures a handler callback for a key event. * @param {?} fullKey The event name that combines all simultaneous keystrokes. * @param {?} handler The function that responds to the key event. * @param {?} zone The zone in which the event occurred. * @return {?} A callback function. */ }, { key: "eventCallback", value: function eventCallback(fullKey, handler, zone) { return ( /** * @param {?} event * @return {?} */ function (event /** TODO #9100 */ ) { if (KeyEventsPlugin.getEventFullKey(event) === fullKey) { zone.runGuarded( /** * @return {?} */ function () { return handler(event); }); } } ); } /** * \@internal * @param {?} keyName * @return {?} */ }, { key: "_normalizeKey", value: function _normalizeKey(keyName) { // TODO: switch to a Map if the mapping grows too much switch (keyName) { case 'esc': return 'escape'; default: return keyName; } } }]); return KeyEventsPlugin; }(EventManagerPlugin); KeyEventsPlugin.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"] }]; /** @nocollapse */ KeyEventsPlugin.ctorParameters = function () { return [{ type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"]] }] }]; }; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Marker interface for a value that's safe to use in a particular context. * * \@publicApi * @record */ function SafeValue() {} /** * Marker interface for a value that's safe to use as HTML. * * \@publicApi * @record */ function SafeHtml() {} /** * Marker interface for a value that's safe to use as style (CSS). * * \@publicApi * @record */ function SafeStyle() {} /** * Marker interface for a value that's safe to use as JavaScript. * * \@publicApi * @record */ function SafeScript() {} /** * Marker interface for a value that's safe to use as a URL linking to a document. * * \@publicApi * @record */ function SafeUrl() {} /** * Marker interface for a value that's safe to use as a URL to load executable code from. * * \@publicApi * @record */ function SafeResourceUrl() {} /** * DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing * values to be safe to use in the different DOM contexts. * * For example, when binding a URL in an `<a [href]="someValue">` hyperlink, `someValue` will be * sanitized so that an attacker cannot inject e.g. a `javascript:` URL that would execute code on * the website. * * In specific situations, it might be necessary to disable sanitization, for example if the * application genuinely needs to produce a `javascript:` style link with a dynamic value in it. * Users can bypass security by constructing a value with one of the `bypassSecurityTrust...` * methods, and then binding to that value from the template. * * These situations should be very rare, and extraordinary care must be taken to avoid creating a * Cross Site Scripting (XSS) security bug! * * When using `bypassSecurityTrust...`, make sure to call the method as early as possible and as * close as possible to the source of the value, to make it easy to verify no security bug is * created by its use. * * It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that * does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous * code. The sanitizer leaves safe values intact. * * \@security Calling any of the `bypassSecurityTrust...` APIs disables Angular's built-in * sanitization for the value passed in. Carefully check and audit all values and code paths going * into this call. Make sure any user data is appropriately escaped for this security context. * For more detail, see the [Security Guide](http://g.co/ng/security). * * \@publicApi * @abstract */ var DomSanitizer = function DomSanitizer() { _classCallCheck(this, DomSanitizer); }; if (false) {} var DomSanitizerImpl = /*#__PURE__*/function (_DomSanitizer) { _inherits(DomSanitizerImpl, _DomSanitizer); var _super154 = _createSuper(DomSanitizerImpl); /** * @param {?} _doc */ function DomSanitizerImpl(_doc) { var _this409; _classCallCheck(this, DomSanitizerImpl); _this409 = _super154.call(this); _this409._doc = _doc; return _this409; } /** * @param {?} ctx * @param {?} value * @return {?} */ _createClass2(DomSanitizerImpl, [{ key: "sanitize", value: function sanitize(ctx, value) { if (value == null) return null; switch (ctx) { case _angular_core__WEBPACK_IMPORTED_MODULE_1__["SecurityContext"].NONE: return ( /** @type {?} */ value ); case _angular_core__WEBPACK_IMPORTED_MODULE_1__["SecurityContext"].HTML: if (value instanceof SafeHtmlImpl) return value.changingThisBreaksApplicationSecurity; this.checkNotSafeValue(value, 'HTML'); return Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵ_sanitizeHtml"])(this._doc, String(value)); case _angular_core__WEBPACK_IMPORTED_MODULE_1__["SecurityContext"].STYLE: if (value instanceof SafeStyleImpl) return value.changingThisBreaksApplicationSecurity; this.checkNotSafeValue(value, 'Style'); return Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵ_sanitizeStyle"])( /** @type {?} */ value); case _angular_core__WEBPACK_IMPORTED_MODULE_1__["SecurityContext"].SCRIPT: if (value instanceof SafeScriptImpl) return value.changingThisBreaksApplicationSecurity; this.checkNotSafeValue(value, 'Script'); throw new Error('unsafe value used in a script context'); case _angular_core__WEBPACK_IMPORTED_MODULE_1__["SecurityContext"].URL: if (value instanceof SafeResourceUrlImpl || value instanceof SafeUrlImpl) { // Allow resource URLs in URL contexts, they are strictly more trusted. return value.changingThisBreaksApplicationSecurity; } this.checkNotSafeValue(value, 'URL'); return Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵ_sanitizeUrl"])(String(value)); case _angular_core__WEBPACK_IMPORTED_MODULE_1__["SecurityContext"].RESOURCE_URL: if (value instanceof SafeResourceUrlImpl) { return value.changingThisBreaksApplicationSecurity; } this.checkNotSafeValue(value, 'ResourceURL'); throw new Error('unsafe value used in a resource URL context (see http://g.co/ng/security#xss)'); default: throw new Error("Unexpected SecurityContext ".concat(ctx, " (see http://g.co/ng/security#xss)")); } } /** * @private * @param {?} value * @param {?} expectedType * @return {?} */ }, { key: "checkNotSafeValue", value: function checkNotSafeValue(value, expectedType) { if (value instanceof SafeValueImpl) { throw new Error("Required a safe ".concat(expectedType, ", got a ").concat(value.getTypeName(), " ") + "(see http://g.co/ng/security#xss)"); } } /** * @param {?} value * @return {?} */ }, { key: "bypassSecurityTrustHtml", value: function bypassSecurityTrustHtml(value) { return new SafeHtmlImpl(value); } /** * @param {?} value * @return {?} */ }, { key: "bypassSecurityTrustStyle", value: function bypassSecurityTrustStyle(value) { return new SafeStyleImpl(value); } /** * @param {?} value * @return {?} */ }, { key: "bypassSecurityTrustScript", value: function bypassSecurityTrustScript(value) { return new SafeScriptImpl(value); } /** * @param {?} value * @return {?} */ }, { key: "bypassSecurityTrustUrl", value: function bypassSecurityTrustUrl(value) { return new SafeUrlImpl(value); } /** * @param {?} value * @return {?} */ }, { key: "bypassSecurityTrustResourceUrl", value: function bypassSecurityTrustResourceUrl(value) { return new SafeResourceUrlImpl(value); } }]); return DomSanitizerImpl; }(DomSanitizer); DomSanitizerImpl.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"] }]; /** @nocollapse */ DomSanitizerImpl.ctorParameters = function () { return [{ type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"]] }] }]; }; if (false) {} /** * @abstract */ var SafeValueImpl = /*#__PURE__*/function () { /** * @param {?} changingThisBreaksApplicationSecurity */ function SafeValueImpl(changingThisBreaksApplicationSecurity) { _classCallCheck(this, SafeValueImpl); this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity; // empty } /** * @return {?} */ _createClass2(SafeValueImpl, [{ key: "toString", value: function toString() { return "SafeValue must use [property]=binding: ".concat(this.changingThisBreaksApplicationSecurity) + " (see http://g.co/ng/security#xss)"; } }]); return SafeValueImpl; }(); if (false) {} var SafeHtmlImpl = /*#__PURE__*/function (_SafeValueImpl) { _inherits(SafeHtmlImpl, _SafeValueImpl); var _super155 = _createSuper(SafeHtmlImpl); function SafeHtmlImpl() { _classCallCheck(this, SafeHtmlImpl); return _super155.apply(this, arguments); } _createClass2(SafeHtmlImpl, [{ key: "getTypeName", /** * @return {?} */ value: function getTypeName() { return 'HTML'; } }]); return SafeHtmlImpl; }(SafeValueImpl); var SafeStyleImpl = /*#__PURE__*/function (_SafeValueImpl2) { _inherits(SafeStyleImpl, _SafeValueImpl2); var _super156 = _createSuper(SafeStyleImpl); function SafeStyleImpl() { _classCallCheck(this, SafeStyleImpl); return _super156.apply(this, arguments); } _createClass2(SafeStyleImpl, [{ key: "getTypeName", /** * @return {?} */ value: function getTypeName() { return 'Style'; } }]); return SafeStyleImpl; }(SafeValueImpl); var SafeScriptImpl = /*#__PURE__*/function (_SafeValueImpl3) { _inherits(SafeScriptImpl, _SafeValueImpl3); var _super157 = _createSuper(SafeScriptImpl); function SafeScriptImpl() { _classCallCheck(this, SafeScriptImpl); return _super157.apply(this, arguments); } _createClass2(SafeScriptImpl, [{ key: "getTypeName", /** * @return {?} */ value: function getTypeName() { return 'Script'; } }]); return SafeScriptImpl; }(SafeValueImpl); var SafeUrlImpl = /*#__PURE__*/function (_SafeValueImpl4) { _inherits(SafeUrlImpl, _SafeValueImpl4); var _super158 = _createSuper(SafeUrlImpl); function SafeUrlImpl() { _classCallCheck(this, SafeUrlImpl); return _super158.apply(this, arguments); } _createClass2(SafeUrlImpl, [{ key: "getTypeName", /** * @return {?} */ value: function getTypeName() { return 'URL'; } }]); return SafeUrlImpl; }(SafeValueImpl); var SafeResourceUrlImpl = /*#__PURE__*/function (_SafeValueImpl5) { _inherits(SafeResourceUrlImpl, _SafeValueImpl5); var _super159 = _createSuper(SafeResourceUrlImpl); function SafeResourceUrlImpl() { _classCallCheck(this, SafeResourceUrlImpl); return _super159.apply(this, arguments); } _createClass2(SafeResourceUrlImpl, [{ key: "getTypeName", /** * @return {?} */ value: function getTypeName() { return 'ResourceURL'; } }]); return SafeResourceUrlImpl; }(SafeValueImpl); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ɵ0$5 = _angular_common__WEBPACK_IMPORTED_MODULE_0__["ɵPLATFORM_BROWSER_ID"]; /** @type {?} */ var INTERNAL_BROWSER_PLATFORM_PROVIDERS = [{ provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["PLATFORM_ID"], useValue: ɵ0$5 }, { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["PLATFORM_INITIALIZER"], useValue: initDomAdapter, multi: true }, { provide: _angular_common__WEBPACK_IMPORTED_MODULE_0__["PlatformLocation"], useClass: BrowserPlatformLocation, deps: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"]] }, { provide: _angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"], useFactory: _document, deps: [] }]; /** * \@security Replacing built-in sanitization providers exposes the application to XSS risks. * Attacker-controlled data introduced by an unsanitized provider could expose your * application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security). * \@publicApi * @type {?} */ var BROWSER_SANITIZATION_PROVIDERS = [{ provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Sanitizer"], useExisting: DomSanitizer }, { provide: DomSanitizer, useClass: DomSanitizerImpl, deps: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"]] }]; /** * \@publicApi * @type {?} */ var platformBrowser = Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["createPlatformFactory"])(_angular_core__WEBPACK_IMPORTED_MODULE_1__["platformCore"], 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS); /** * @return {?} */ function initDomAdapter() { BrowserDomAdapter.makeCurrent(); BrowserGetTestability.init(); } /** * @return {?} */ function errorHandler() { return new _angular_core__WEBPACK_IMPORTED_MODULE_1__["ErrorHandler"](); } /** * @return {?} */ function _document() { return document; } /** @type {?} */ var BROWSER_MODULE_PROVIDERS = [BROWSER_SANITIZATION_PROVIDERS, { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵAPP_ROOT"], useValue: true }, { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ErrorHandler"], useFactory: errorHandler, deps: [] }, { provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true, deps: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["PLATFORM_ID"]] }, { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true, deps: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"]] }, { provide: EVENT_MANAGER_PLUGINS, useClass: HammerGesturesPlugin, multi: true, deps: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"], HAMMER_GESTURE_CONFIG, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵConsole"], [new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"](), HAMMER_LOADER]] }, { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig, deps: [] }, { provide: DomRendererFactory2, useClass: DomRendererFactory2, deps: [EventManager, DomSharedStylesHost, _angular_core__WEBPACK_IMPORTED_MODULE_1__["APP_ID"]] }, { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["RendererFactory2"], useExisting: DomRendererFactory2 }, { provide: SharedStylesHost, useExisting: DomSharedStylesHost }, { provide: DomSharedStylesHost, useClass: DomSharedStylesHost, deps: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"]] }, { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Testability"], useClass: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Testability"], deps: [_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"]] }, { provide: EventManager, useClass: EventManager, deps: [EVENT_MANAGER_PLUGINS, _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"]] }, ELEMENT_PROBE_PROVIDERS]; /** * Exports required infrastructure for all Angular apps. * Included by default in all Angular apps created with the CLI * `new` command. * Re-exports `CommonModule` and `ApplicationModule`, making their * exports and providers available to all apps. * * \@publicApi */ var BrowserModule = /*#__PURE__*/function () { /** * @param {?} parentModule */ function BrowserModule(parentModule) { _classCallCheck(this, BrowserModule); if (parentModule) { throw new Error("BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead."); } } /** * Configures a browser-based app to transition from a server-rendered app, if * one is present on the page. * * @param {?} params An object containing an identifier for the app to transition. * The ID must match between the client and server versions of the app. * @return {?} The reconfigured `BrowserModule` to import into the app's root `AppModule`. */ _createClass2(BrowserModule, null, [{ key: "withServerTransition", value: function withServerTransition(params) { return { ngModule: BrowserModule, providers: [{ provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["APP_ID"], useValue: params.appId }, { provide: TRANSITION_ID, useExisting: _angular_core__WEBPACK_IMPORTED_MODULE_1__["APP_ID"] }, SERVER_TRANSITION_PROVIDERS] }; } }]); return BrowserModule; }(); BrowserModule.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"], args: [{ providers: BROWSER_MODULE_PROVIDERS, exports: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["CommonModule"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["ApplicationModule"]] }] }]; /** @nocollapse */ BrowserModule.ctorParameters = function () { return [{ type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["SkipSelf"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [BrowserModule] }] }]; }; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Factory to create Meta service. * @return {?} */ function createMeta() { return new Meta(Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵɵinject"])(_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"])); } /** * A service that can be used to get and add meta tags. * * \@publicApi */ var Meta = /*#__PURE__*/function () { /** * @param {?} _doc */ function Meta(_doc) { _classCallCheck(this, Meta); this._doc = _doc; this._dom = getDOM(); } /** * @param {?} tag * @param {?=} forceCreation * @return {?} */ _createClass2(Meta, [{ key: "addTag", value: function addTag(tag) { var forceCreation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; if (!tag) return null; return this._getOrCreateElement(tag, forceCreation); } /** * @param {?} tags * @param {?=} forceCreation * @return {?} */ }, { key: "addTags", value: function addTags(tags) { var _this410 = this; var forceCreation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; if (!tags) return []; return tags.reduce( /** * @param {?} result * @param {?} tag * @return {?} */ function (result, tag) { if (tag) { result.push(_this410._getOrCreateElement(tag, forceCreation)); } return result; }, []); } /** * @param {?} attrSelector * @return {?} */ }, { key: "getTag", value: function getTag(attrSelector) { if (!attrSelector) return null; return this._dom.querySelector(this._doc, "meta[".concat(attrSelector, "]")) || null; } /** * @param {?} attrSelector * @return {?} */ }, { key: "getTags", value: function getTags(attrSelector) { if (!attrSelector) return []; /** @type {?} */ var list /*NodeList*/ = this._dom.querySelectorAll(this._doc, "meta[".concat(attrSelector, "]")); return list ? [].slice.call(list) : []; } /** * @param {?} tag * @param {?=} selector * @return {?} */ }, { key: "updateTag", value: function updateTag(tag, selector) { if (!tag) return null; selector = selector || this._parseSelector(tag); /** @type {?} */ var meta = /** @type {?} */ this.getTag(selector); if (meta) { return this._setMetaElementAttributes(tag, meta); } return this._getOrCreateElement(tag, true); } /** * @param {?} attrSelector * @return {?} */ }, { key: "removeTag", value: function removeTag(attrSelector) { this.removeTagElement( /** @type {?} */ this.getTag(attrSelector)); } /** * @param {?} meta * @return {?} */ }, { key: "removeTagElement", value: function removeTagElement(meta) { if (meta) { this._dom.remove(meta); } } /** * @private * @param {?} meta * @param {?=} forceCreation * @return {?} */ }, { key: "_getOrCreateElement", value: function _getOrCreateElement(meta) { var forceCreation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; if (!forceCreation) { /** @type {?} */ var selector = this._parseSelector(meta); /** @type {?} */ var elem = /** @type {?} */ this.getTag(selector); // It's allowed to have multiple elements with the same name so it's not enough to // just check that element with the same name already present on the page. We also need to // check if element has tag attributes if (elem && this._containsAttributes(meta, elem)) return elem; } /** @type {?} */ var element = /** @type {?} */ this._dom.createElement('meta'); this._setMetaElementAttributes(meta, element); /** @type {?} */ var head = this._dom.getElementsByTagName(this._doc, 'head')[0]; this._dom.appendChild(head, element); return element; } /** * @private * @param {?} tag * @param {?} el * @return {?} */ }, { key: "_setMetaElementAttributes", value: function _setMetaElementAttributes(tag, el) { var _this411 = this; Object.keys(tag).forEach( /** * @param {?} prop * @return {?} */ function (prop) { return _this411._dom.setAttribute(el, prop, tag[prop]); }); return el; } /** * @private * @param {?} tag * @return {?} */ }, { key: "_parseSelector", value: function _parseSelector(tag) { /** @type {?} */ var attr = tag.name ? 'name' : 'property'; return "".concat(attr, "=\"").concat(tag[attr], "\""); } /** * @private * @param {?} tag * @param {?} elem * @return {?} */ }, { key: "_containsAttributes", value: function _containsAttributes(tag, elem) { var _this412 = this; return Object.keys(tag).every( /** * @param {?} key * @return {?} */ function (key) { return _this412._dom.getAttribute(elem, key) === tag[key]; }); } }]); return Meta; }(); Meta.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"], args: [{ providedIn: 'root', useFactory: createMeta, deps: [] }] }]; /** @nocollapse */ Meta.ctorParameters = function () { return [{ type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"]] }] }]; }; /** @nocollapse */ Meta.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵɵdefineInjectable"])({ factory: createMeta, token: Meta, providedIn: "root" }); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Factory to create Title service. * @return {?} */ function createTitle() { return new Title(Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵɵinject"])(_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"])); } /** * A service that can be used to get and set the title of a current HTML document. * * Since an Angular application can't be bootstrapped on the entire HTML document (`<html>` tag) * it is not possible to bind to the `text` property of the `HTMLTitleElement` elements * (representing the `<title>` tag). Instead, this service can be used to set and get the current * title value. * * \@publicApi */ var Title = /*#__PURE__*/function () { /** * @param {?} _doc */ function Title(_doc) { _classCallCheck(this, Title); this._doc = _doc; } /** * Get the title of the current HTML document. * @return {?} */ _createClass2(Title, [{ key: "getTitle", value: function getTitle() { return getDOM().getTitle(this._doc); } /** * Set the title of the current HTML document. * @param {?} newTitle * @return {?} */ }, { key: "setTitle", value: function setTitle(newTitle) { getDOM().setTitle(this._doc, newTitle); } }]); return Title; }(); Title.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"], args: [{ providedIn: 'root', useFactory: createTitle, deps: [] }] }]; /** @nocollapse */ Title.ctorParameters = function () { return [{ type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"]] }] }]; }; /** @nocollapse */ Title.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵɵdefineInjectable"])({ factory: createTitle, token: Title, providedIn: "root" }); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** @type {?} */ var win = typeof window !== 'undefined' && window || /** @type {?} */ {}; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var ChangeDetectionPerfRecord = /** * @param {?} msPerTick * @param {?} numTicks */ function ChangeDetectionPerfRecord(msPerTick, numTicks) { _classCallCheck(this, ChangeDetectionPerfRecord); this.msPerTick = msPerTick; this.numTicks = numTicks; }; if (false) {} /** * Entry point for all Angular profiling-related debug tools. This object * corresponds to the `ng.profiler` in the dev console. */ var AngularProfiler = /*#__PURE__*/function () { /** * @param {?} ref */ function AngularProfiler(ref) { _classCallCheck(this, AngularProfiler); this.appRef = ref.injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ApplicationRef"]); } // tslint:disable:no-console /** * Exercises change detection in a loop and then prints the average amount of * time in milliseconds how long a single round of change detection takes for * the current state of the UI. It runs a minimum of 5 rounds for a minimum * of 500 milliseconds. * * Optionally, a user may pass a `config` parameter containing a map of * options. Supported options are: * * `record` (boolean) - causes the profiler to record a CPU profile while * it exercises the change detector. Example: * * ``` * ng.profiler.timeChangeDetection({record: true}) * ``` * @param {?} config * @return {?} */ _createClass2(AngularProfiler, [{ key: "timeChangeDetection", value: function timeChangeDetection(config) { /** @type {?} */ var record = config && config['record']; /** @type {?} */ var profileName = 'Change Detection'; // Profiler is not available in Android browsers, nor in IE 9 without dev tools opened /** @type {?} */ var isProfilerAvailable = win.console.profile != null; if (record && isProfilerAvailable) { win.console.profile(profileName); } /** @type {?} */ var start = getDOM().performanceNow(); /** @type {?} */ var numTicks = 0; while (numTicks < 5 || getDOM().performanceNow() - start < 500) { this.appRef.tick(); numTicks++; } /** @type {?} */ var end = getDOM().performanceNow(); if (record && isProfilerAvailable) { win.console.profileEnd(profileName); } /** @type {?} */ var msPerTick = (end - start) / numTicks; win.console.log("ran ".concat(numTicks, " change detection cycles")); win.console.log("".concat(msPerTick.toFixed(2), " ms per check")); return new ChangeDetectionPerfRecord(msPerTick, numTicks); } }]); return AngularProfiler; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var PROFILER_GLOBAL_NAME = 'profiler'; /** * Enabled Angular debug tools that are accessible via your browser's * developer console. * * Usage: * * 1. Open developer console (e.g. in Chrome Ctrl + Shift + j) * 1. Type `ng.` (usually the console will show auto-complete suggestion) * 1. Try the change detection profiler `ng.profiler.timeChangeDetection()` * then hit Enter. * * \@publicApi * @template T * @param {?} ref * @return {?} */ function enableDebugTools(ref) { exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref)); return ref; } /** * Disables Angular tools. * * \@publicApi * @return {?} */ function disableDebugTools() { exportNgVar(PROFILER_GLOBAL_NAME, null); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} text * @return {?} */ function escapeHtml(text) { /** @type {?} */ var escapedText = { '&': '&a;', '"': '&q;', '\'': '&s;', '<': '&l;', '>': '&g;' }; return text.replace(/[&"'<>]/g, /** * @param {?} s * @return {?} */ function (s) { return escapedText[s]; }); } /** * @param {?} text * @return {?} */ function unescapeHtml(text) { /** @type {?} */ var unescapedText = { '&a;': '&', '&q;': '"', '&s;': '\'', '&l;': '<', '&g;': '>' }; return text.replace(/&[^;]+;/g, /** * @param {?} s * @return {?} */ function (s) { return unescapedText[s]; }); } /** * Create a `StateKey<T>` that can be used to store value of type T with `TransferState`. * * Example: * * ``` * const COUNTER_KEY = makeStateKey<number>('counter'); * let value = 10; * * transferState.set(COUNTER_KEY, value); * ``` * * \@publicApi * @template T * @param {?} key * @return {?} */ function makeStateKey(key) { return ( /** @type {?} */ key ); } /** * A key value store that is transferred from the application on the server side to the application * on the client side. * * `TransferState` will be available as an injectable token. To use it import * `ServerTransferStateModule` on the server and `BrowserTransferStateModule` on the client. * * The values in the store are serialized/deserialized using JSON.stringify/JSON.parse. So only * boolean, number, string, null and non-class objects will be serialized and deserialzied in a * non-lossy manner. * * \@publicApi */ var TransferState = /*#__PURE__*/function () { function TransferState() { _classCallCheck(this, TransferState); this.store = {}; this.onSerializeCallbacks = {}; } /** * \@internal * @param {?} initState * @return {?} */ _createClass2(TransferState, [{ key: "get", /** * Get the value corresponding to a key. Return `defaultValue` if key is not found. * @template T * @param {?} key * @param {?} defaultValue * @return {?} */ value: function get(key, defaultValue) { return this.store[key] !== undefined ? /** @type {?} */ this.store[key] : defaultValue; } /** * Set the value corresponding to a key. * @template T * @param {?} key * @param {?} value * @return {?} */ }, { key: "set", value: function set(key, value) { this.store[key] = value; } /** * Remove a key from the store. * @template T * @param {?} key * @return {?} */ }, { key: "remove", value: function remove(key) { delete this.store[key]; } /** * Test whether a key exists in the store. * @template T * @param {?} key * @return {?} */ }, { key: "hasKey", value: function hasKey(key) { return this.store.hasOwnProperty(key); } /** * Register a callback to provide the value for a key when `toJson` is called. * @template T * @param {?} key * @param {?} callback * @return {?} */ }, { key: "onSerialize", value: function onSerialize(key, callback) { this.onSerializeCallbacks[key] = callback; } /** * Serialize the current state of the store to JSON. * @return {?} */ }, { key: "toJson", value: function toJson() { // Call the onSerialize callbacks and put those values into the store. for (var key in this.onSerializeCallbacks) { if (this.onSerializeCallbacks.hasOwnProperty(key)) { try { this.store[key] = this.onSerializeCallbacks[key](); } catch (e) { console.warn('Exception in onSerialize callback: ', e); } } } return JSON.stringify(this.store); } }], [{ key: "init", value: function init(initState) { /** @type {?} */ var transferState = new TransferState(); transferState.store = initState; return transferState; } }]); return TransferState; }(); TransferState.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"] }]; if (false) {} /** * @param {?} doc * @param {?} appId * @return {?} */ function initTransferState(doc, appId) { // Locate the script tag with the JSON data transferred from the server. // The id of the script tag is set to the Angular appId + 'state'. /** @type {?} */ var script = doc.getElementById(appId + '-state'); /** @type {?} */ var initialState = {}; if (script && script.textContent) { try { initialState = JSON.parse(unescapeHtml(script.textContent)); } catch (e) { console.warn('Exception while restoring TransferState for app ' + appId, e); } } return TransferState.init(initialState); } /** * NgModule to install on the client side while using the `TransferState` to transfer state from * server to client. * * \@publicApi */ var BrowserTransferStateModule = function BrowserTransferStateModule() { _classCallCheck(this, BrowserTransferStateModule); }; BrowserTransferStateModule.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"], args: [{ providers: [{ provide: TransferState, useFactory: initTransferState, deps: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["DOCUMENT"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["APP_ID"]] }] }] }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Predicates for use with {\@link DebugElement}'s query functions. * * \@publicApi */ var By = /*#__PURE__*/function () { function By() { _classCallCheck(this, By); } _createClass2(By, null, [{ key: "all", /** * Match all nodes. * * \@usageNotes * ### Example * * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_all'} * @return {?} */ value: function all() { return ( /** * @return {?} */ function () { return true; } ); } /** * Match elements by the given CSS selector. * * \@usageNotes * ### Example * * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_css'} * @param {?} selector * @return {?} */ }, { key: "css", value: function css(selector) { return ( /** * @param {?} debugElement * @return {?} */ function (debugElement) { return debugElement.nativeElement != null ? getDOM().elementMatches(debugElement.nativeElement, selector) : false; } ); } /** * Match nodes that have the given directive present. * * \@usageNotes * ### Example * * {\@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'} * @param {?} type * @return {?} */ }, { key: "directive", value: function directive(type) { return ( /** * @param {?} debugNode * @return {?} */ function (debugNode) { return ( /** @type {?} */ debugNode.providerTokens.indexOf(type) !== -1 ); } ); } }]); return By; }(); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@publicApi * @type {?} */ var VERSION = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Version"]('8.2.12'); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=platform-browser.js.map /***/ }, /***/ "./node_modules/@angular/router/fesm2015/router.js": /*!*********************************************************!*\ !*** ./node_modules/@angular/router/fesm2015/router.js ***! \*********************************************************/ /*! exports provided: ɵangular_packages_router_router_l, ɵEmptyOutletComponent, ɵangular_packages_router_router_a, ɵangular_packages_router_router_h, ɵangular_packages_router_router_c, ɵangular_packages_router_router_i, ɵangular_packages_router_router_j, ɵangular_packages_router_router_e, ɵangular_packages_router_router_d, ɵangular_packages_router_router_k, ɵangular_packages_router_router_g, ɵangular_packages_router_router_b, ɵangular_packages_router_router_f, ɵangular_packages_router_router_o, ɵangular_packages_router_router_m, ɵangular_packages_router_router_n, RouterLink, RouterLinkWithHref, RouterLinkActive, RouterOutlet, ActivationEnd, ActivationStart, ChildActivationEnd, ChildActivationStart, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouterEvent, RoutesRecognized, Scroll, RouteReuseStrategy, Router, ROUTES, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, RouterModule, provideRoutes, ChildrenOutletContexts, OutletContext, NoPreloading, PreloadAllModules, PreloadingStrategy, RouterPreloader, ActivatedRoute, ActivatedRouteSnapshot, RouterState, RouterStateSnapshot, PRIMARY_OUTLET, convertToParamMap, UrlHandlingStrategy, DefaultUrlSerializer, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, ɵROUTER_PROVIDERS, ɵflatten */ /***/ function node_modulesAngularRouterFesm2015RouterJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_l", function () { return ɵEmptyOutletComponent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵEmptyOutletComponent", function () { return ɵEmptyOutletComponent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_a", function () { return ROUTER_FORROOT_GUARD; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_h", function () { return RouterInitializer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_c", function () { return createRouterScroller; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_i", function () { return getAppInitializer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_j", function () { return getBootstrapListener; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_e", function () { return provideForRootGuard; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_d", function () { return provideLocationStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_k", function () { return provideRouterInitializer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_g", function () { return rootRoute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_b", function () { return routerNgProbeToken; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_f", function () { return setupRouter; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_o", function () { return RouterScroller; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_m", function () { return Tree; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_n", function () { return TreeNode; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterLink", function () { return RouterLink; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterLinkWithHref", function () { return RouterLinkWithHref; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterLinkActive", function () { return RouterLinkActive; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterOutlet", function () { return RouterOutlet; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActivationEnd", function () { return ActivationEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActivationStart", function () { return ActivationStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChildActivationEnd", function () { return ChildActivationEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChildActivationStart", function () { return ChildActivationStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GuardsCheckEnd", function () { return GuardsCheckEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GuardsCheckStart", function () { return GuardsCheckStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NavigationCancel", function () { return NavigationCancel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NavigationEnd", function () { return NavigationEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NavigationError", function () { return NavigationError; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NavigationStart", function () { return NavigationStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResolveEnd", function () { return ResolveEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResolveStart", function () { return ResolveStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouteConfigLoadEnd", function () { return RouteConfigLoadEnd; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouteConfigLoadStart", function () { return RouteConfigLoadStart; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterEvent", function () { return RouterEvent; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RoutesRecognized", function () { return RoutesRecognized; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Scroll", function () { return Scroll; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouteReuseStrategy", function () { return RouteReuseStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Router", function () { return Router; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ROUTES", function () { return ROUTES; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ROUTER_CONFIGURATION", function () { return ROUTER_CONFIGURATION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ROUTER_INITIALIZER", function () { return ROUTER_INITIALIZER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterModule", function () { return RouterModule; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "provideRoutes", function () { return provideRoutes; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChildrenOutletContexts", function () { return ChildrenOutletContexts; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OutletContext", function () { return OutletContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NoPreloading", function () { return NoPreloading; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PreloadAllModules", function () { return PreloadAllModules; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PreloadingStrategy", function () { return PreloadingStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterPreloader", function () { return RouterPreloader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActivatedRoute", function () { return ActivatedRoute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActivatedRouteSnapshot", function () { return ActivatedRouteSnapshot; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterState", function () { return RouterState; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterStateSnapshot", function () { return RouterStateSnapshot; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PRIMARY_OUTLET", function () { return PRIMARY_OUTLET; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertToParamMap", function () { return convertToParamMap; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlHandlingStrategy", function () { return UrlHandlingStrategy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultUrlSerializer", function () { return DefaultUrlSerializer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlSegment", function () { return UrlSegment; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlSegmentGroup", function () { return UrlSegmentGroup; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlSerializer", function () { return UrlSerializer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlTree", function () { return UrlTree; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function () { return VERSION; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵROUTER_PROVIDERS", function () { return ROUTER_PROVIDERS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵflatten", function () { return flatten; }); /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! @angular/common */ "./node_modules/@angular/common/fesm2015/common.js"); /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! @angular/core */ "./node_modules/@angular/core/fesm2015/core.js"); /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! rxjs */ "./node_modules/rxjs/_esm2015/index.js"); /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! rxjs/operators */ "./node_modules/rxjs/_esm2015/operators/index.js"); /* harmony import */ var _angular_platform_browser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! @angular/platform-browser */ "./node_modules/@angular/platform-browser/fesm2015/platform-browser.js"); /** * @license Angular v8.2.12 * (c) 2010-2019 Google LLC. https://angular.io/ * License: MIT */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Base for events the router goes through, as opposed to events tied to a specific * route. Fired one time for any given navigation. * * \@usageNotes * * ```ts * class MyService { * constructor(public router: Router, logger: Logger) { * router.events.pipe( * filter(e => e instanceof RouterEvent) * ).subscribe(e => { * logger.log(e.id, e.url); * }); * } * } * ``` * * @see `Event` * \@publicApi */ var RouterEvent = /** * @param {?} id * @param {?} url */ function RouterEvent(id, url) { _classCallCheck(this, RouterEvent); this.id = id; this.url = url; }; if (false) {} /** * An event triggered when a navigation starts. * * \@publicApi */ var NavigationStart = /*#__PURE__*/function (_RouterEvent) { _inherits(NavigationStart, _RouterEvent); var _super160 = _createSuper(NavigationStart); /** * @param {?} id * @param {?} url * @param {?=} navigationTrigger * @param {?=} restoredState */ function NavigationStart( /** @docsNotRequired */ id, /** @docsNotRequired */ url) { var _this413; var navigationTrigger = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'imperative'; var restoredState = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; _classCallCheck(this, NavigationStart); _this413 = _super160.call(this, id, url); _this413.navigationTrigger = navigationTrigger; _this413.restoredState = restoredState; return _this413; } /** * \@docsNotRequired * @return {?} */ _createClass2(NavigationStart, [{ key: "toString", value: function toString() { return "NavigationStart(id: ".concat(this.id, ", url: '").concat(this.url, "')"); } }]); return NavigationStart; }(RouterEvent); if (false) {} /** * An event triggered when a navigation ends successfully. * * \@publicApi */ var NavigationEnd = /*#__PURE__*/function (_RouterEvent2) { _inherits(NavigationEnd, _RouterEvent2); var _super161 = _createSuper(NavigationEnd); /** * @param {?} id * @param {?} url * @param {?} urlAfterRedirects */ function NavigationEnd( /** @docsNotRequired */ id, /** @docsNotRequired */ url, urlAfterRedirects) { var _this414; _classCallCheck(this, NavigationEnd); _this414 = _super161.call(this, id, url); _this414.urlAfterRedirects = urlAfterRedirects; return _this414; } /** * \@docsNotRequired * @return {?} */ _createClass2(NavigationEnd, [{ key: "toString", value: function toString() { return "NavigationEnd(id: ".concat(this.id, ", url: '").concat(this.url, "', urlAfterRedirects: '").concat(this.urlAfterRedirects, "')"); } }]); return NavigationEnd; }(RouterEvent); if (false) {} /** * An event triggered when a navigation is canceled, directly or indirectly. * * This can happen when a [route guard](guide/router#milestone-5-route-guards) * returns `false` or initiates a redirect by returning a `UrlTree`. * * \@publicApi */ var NavigationCancel = /*#__PURE__*/function (_RouterEvent3) { _inherits(NavigationCancel, _RouterEvent3); var _super162 = _createSuper(NavigationCancel); /** * @param {?} id * @param {?} url * @param {?} reason */ function NavigationCancel( /** @docsNotRequired */ id, /** @docsNotRequired */ url, reason) { var _this415; _classCallCheck(this, NavigationCancel); _this415 = _super162.call(this, id, url); _this415.reason = reason; return _this415; } /** * \@docsNotRequired * @return {?} */ _createClass2(NavigationCancel, [{ key: "toString", value: function toString() { return "NavigationCancel(id: ".concat(this.id, ", url: '").concat(this.url, "')"); } }]); return NavigationCancel; }(RouterEvent); if (false) {} /** * An event triggered when a navigation fails due to an unexpected error. * * \@publicApi */ var NavigationError = /*#__PURE__*/function (_RouterEvent4) { _inherits(NavigationError, _RouterEvent4); var _super163 = _createSuper(NavigationError); /** * @param {?} id * @param {?} url * @param {?} error */ function NavigationError( /** @docsNotRequired */ id, /** @docsNotRequired */ url, error) { var _this416; _classCallCheck(this, NavigationError); _this416 = _super163.call(this, id, url); _this416.error = error; return _this416; } /** * \@docsNotRequired * @return {?} */ _createClass2(NavigationError, [{ key: "toString", value: function toString() { return "NavigationError(id: ".concat(this.id, ", url: '").concat(this.url, "', error: ").concat(this.error, ")"); } }]); return NavigationError; }(RouterEvent); if (false) {} /** * An event triggered when routes are recognized. * * \@publicApi */ var RoutesRecognized = /*#__PURE__*/function (_RouterEvent5) { _inherits(RoutesRecognized, _RouterEvent5); var _super164 = _createSuper(RoutesRecognized); /** * @param {?} id * @param {?} url * @param {?} urlAfterRedirects * @param {?} state */ function RoutesRecognized( /** @docsNotRequired */ id, /** @docsNotRequired */ url, urlAfterRedirects, state) { var _this417; _classCallCheck(this, RoutesRecognized); _this417 = _super164.call(this, id, url); _this417.urlAfterRedirects = urlAfterRedirects; _this417.state = state; return _this417; } /** * \@docsNotRequired * @return {?} */ _createClass2(RoutesRecognized, [{ key: "toString", value: function toString() { return "RoutesRecognized(id: ".concat(this.id, ", url: '").concat(this.url, "', urlAfterRedirects: '").concat(this.urlAfterRedirects, "', state: ").concat(this.state, ")"); } }]); return RoutesRecognized; }(RouterEvent); if (false) {} /** * An event triggered at the start of the Guard phase of routing. * * \@publicApi */ var GuardsCheckStart = /*#__PURE__*/function (_RouterEvent6) { _inherits(GuardsCheckStart, _RouterEvent6); var _super165 = _createSuper(GuardsCheckStart); /** * @param {?} id * @param {?} url * @param {?} urlAfterRedirects * @param {?} state */ function GuardsCheckStart( /** @docsNotRequired */ id, /** @docsNotRequired */ url, urlAfterRedirects, state) { var _this418; _classCallCheck(this, GuardsCheckStart); _this418 = _super165.call(this, id, url); _this418.urlAfterRedirects = urlAfterRedirects; _this418.state = state; return _this418; } /** * @return {?} */ _createClass2(GuardsCheckStart, [{ key: "toString", value: function toString() { return "GuardsCheckStart(id: ".concat(this.id, ", url: '").concat(this.url, "', urlAfterRedirects: '").concat(this.urlAfterRedirects, "', state: ").concat(this.state, ")"); } }]); return GuardsCheckStart; }(RouterEvent); if (false) {} /** * An event triggered at the end of the Guard phase of routing. * * \@publicApi */ var GuardsCheckEnd = /*#__PURE__*/function (_RouterEvent7) { _inherits(GuardsCheckEnd, _RouterEvent7); var _super166 = _createSuper(GuardsCheckEnd); /** * @param {?} id * @param {?} url * @param {?} urlAfterRedirects * @param {?} state * @param {?} shouldActivate */ function GuardsCheckEnd( /** @docsNotRequired */ id, /** @docsNotRequired */ url, urlAfterRedirects, state, shouldActivate) { var _this419; _classCallCheck(this, GuardsCheckEnd); _this419 = _super166.call(this, id, url); _this419.urlAfterRedirects = urlAfterRedirects; _this419.state = state; _this419.shouldActivate = shouldActivate; return _this419; } /** * @return {?} */ _createClass2(GuardsCheckEnd, [{ key: "toString", value: function toString() { return "GuardsCheckEnd(id: ".concat(this.id, ", url: '").concat(this.url, "', urlAfterRedirects: '").concat(this.urlAfterRedirects, "', state: ").concat(this.state, ", shouldActivate: ").concat(this.shouldActivate, ")"); } }]); return GuardsCheckEnd; }(RouterEvent); if (false) {} /** * An event triggered at the the start of the Resolve phase of routing. * * Runs in the "resolve" phase whether or not there is anything to resolve. * In future, may change to only run when there are things to be resolved. * * \@publicApi */ var ResolveStart = /*#__PURE__*/function (_RouterEvent8) { _inherits(ResolveStart, _RouterEvent8); var _super167 = _createSuper(ResolveStart); /** * @param {?} id * @param {?} url * @param {?} urlAfterRedirects * @param {?} state */ function ResolveStart( /** @docsNotRequired */ id, /** @docsNotRequired */ url, urlAfterRedirects, state) { var _this420; _classCallCheck(this, ResolveStart); _this420 = _super167.call(this, id, url); _this420.urlAfterRedirects = urlAfterRedirects; _this420.state = state; return _this420; } /** * @return {?} */ _createClass2(ResolveStart, [{ key: "toString", value: function toString() { return "ResolveStart(id: ".concat(this.id, ", url: '").concat(this.url, "', urlAfterRedirects: '").concat(this.urlAfterRedirects, "', state: ").concat(this.state, ")"); } }]); return ResolveStart; }(RouterEvent); if (false) {} /** * An event triggered at the end of the Resolve phase of routing. * @see `ResolveStart`. * * \@publicApi */ var ResolveEnd = /*#__PURE__*/function (_RouterEvent9) { _inherits(ResolveEnd, _RouterEvent9); var _super168 = _createSuper(ResolveEnd); /** * @param {?} id * @param {?} url * @param {?} urlAfterRedirects * @param {?} state */ function ResolveEnd( /** @docsNotRequired */ id, /** @docsNotRequired */ url, urlAfterRedirects, state) { var _this421; _classCallCheck(this, ResolveEnd); _this421 = _super168.call(this, id, url); _this421.urlAfterRedirects = urlAfterRedirects; _this421.state = state; return _this421; } /** * @return {?} */ _createClass2(ResolveEnd, [{ key: "toString", value: function toString() { return "ResolveEnd(id: ".concat(this.id, ", url: '").concat(this.url, "', urlAfterRedirects: '").concat(this.urlAfterRedirects, "', state: ").concat(this.state, ")"); } }]); return ResolveEnd; }(RouterEvent); if (false) {} /** * An event triggered before lazy loading a route configuration. * * \@publicApi */ var RouteConfigLoadStart = /*#__PURE__*/function () { /** * @param {?} route */ function RouteConfigLoadStart(route) { _classCallCheck(this, RouteConfigLoadStart); this.route = route; } /** * @return {?} */ _createClass2(RouteConfigLoadStart, [{ key: "toString", value: function toString() { return "RouteConfigLoadStart(path: ".concat(this.route.path, ")"); } }]); return RouteConfigLoadStart; }(); if (false) {} /** * An event triggered when a route has been lazy loaded. * * \@publicApi */ var RouteConfigLoadEnd = /*#__PURE__*/function () { /** * @param {?} route */ function RouteConfigLoadEnd(route) { _classCallCheck(this, RouteConfigLoadEnd); this.route = route; } /** * @return {?} */ _createClass2(RouteConfigLoadEnd, [{ key: "toString", value: function toString() { return "RouteConfigLoadEnd(path: ".concat(this.route.path, ")"); } }]); return RouteConfigLoadEnd; }(); if (false) {} /** * An event triggered at the start of the child-activation * part of the Resolve phase of routing. * @see `ChildActivationEnd` * @see `ResolveStart` * * \@publicApi */ var ChildActivationStart = /*#__PURE__*/function () { /** * @param {?} snapshot */ function ChildActivationStart(snapshot) { _classCallCheck(this, ChildActivationStart); this.snapshot = snapshot; } /** * @return {?} */ _createClass2(ChildActivationStart, [{ key: "toString", value: function toString() { /** @type {?} */ var path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || ''; return "ChildActivationStart(path: '".concat(path, "')"); } }]); return ChildActivationStart; }(); if (false) {} /** * An event triggered at the end of the child-activation part * of the Resolve phase of routing. * @see `ChildActivationStart` * @see `ResolveStart` * * \@publicApi */ var ChildActivationEnd = /*#__PURE__*/function () { /** * @param {?} snapshot */ function ChildActivationEnd(snapshot) { _classCallCheck(this, ChildActivationEnd); this.snapshot = snapshot; } /** * @return {?} */ _createClass2(ChildActivationEnd, [{ key: "toString", value: function toString() { /** @type {?} */ var path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || ''; return "ChildActivationEnd(path: '".concat(path, "')"); } }]); return ChildActivationEnd; }(); if (false) {} /** * An event triggered at the start of the activation part * of the Resolve phase of routing. * @see ActivationEnd` * @see `ResolveStart` * * \@publicApi */ var ActivationStart = /*#__PURE__*/function () { /** * @param {?} snapshot */ function ActivationStart(snapshot) { _classCallCheck(this, ActivationStart); this.snapshot = snapshot; } /** * @return {?} */ _createClass2(ActivationStart, [{ key: "toString", value: function toString() { /** @type {?} */ var path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || ''; return "ActivationStart(path: '".concat(path, "')"); } }]); return ActivationStart; }(); if (false) {} /** * An event triggered at the end of the activation part * of the Resolve phase of routing. * @see `ActivationStart` * @see `ResolveStart` * * \@publicApi */ var ActivationEnd = /*#__PURE__*/function () { /** * @param {?} snapshot */ function ActivationEnd(snapshot) { _classCallCheck(this, ActivationEnd); this.snapshot = snapshot; } /** * @return {?} */ _createClass2(ActivationEnd, [{ key: "toString", value: function toString() { /** @type {?} */ var path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || ''; return "ActivationEnd(path: '".concat(path, "')"); } }]); return ActivationEnd; }(); if (false) {} /** * An event triggered by scrolling. * * \@publicApi */ var Scroll = /*#__PURE__*/function () { /** * @param {?} routerEvent * @param {?} position * @param {?} anchor */ function Scroll(routerEvent, position, anchor) { _classCallCheck(this, Scroll); this.routerEvent = routerEvent; this.position = position; this.anchor = anchor; } /** * @return {?} */ _createClass2(Scroll, [{ key: "toString", value: function toString() { /** @type {?} */ var pos = this.position ? "".concat(this.position[0], ", ").concat(this.position[1]) : null; return "Scroll(anchor: '".concat(this.anchor, "', position: '").concat(pos, "')"); } }]); return Scroll; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * This component is used internally within the router to be a placeholder when an empty * router-outlet is needed. For example, with a config such as: * * `{path: 'parent', outlet: 'nav', children: [...]}` * * In order to render, there needs to be a component on this config, which will default * to this `EmptyOutletComponent`. */ var ɵEmptyOutletComponent = function ɵEmptyOutletComponent() { _classCallCheck(this, ɵEmptyOutletComponent); }; ɵEmptyOutletComponent.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"], args: [{ template: "<router-outlet></router-outlet>" }] }]; /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 primary routing outlet. * * \@publicApi * @type {?} */ var PRIMARY_OUTLET = 'primary'; /** * A map that provides access to the required and optional parameters * specific to a route. * The map supports retrieving a single value with `get()` * or multiple values with `getAll()`. * * @see [URLSearchParams](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams) * * \@publicApi * @record */ function ParamMap() {} if (false) {} var ParamsAsMap = /*#__PURE__*/function () { /** * @param {?} params */ function ParamsAsMap(params) { _classCallCheck(this, ParamsAsMap); this.params = params || {}; } /** * @param {?} name * @return {?} */ _createClass2(ParamsAsMap, [{ key: "has", value: function has(name) { return this.params.hasOwnProperty(name); } /** * @param {?} name * @return {?} */ }, { key: "get", value: function get(name) { if (this.has(name)) { /** @type {?} */ var v = this.params[name]; return Array.isArray(v) ? v[0] : v; } return null; } /** * @param {?} name * @return {?} */ }, { key: "getAll", value: function getAll(name) { if (this.has(name)) { /** @type {?} */ var v = this.params[name]; return Array.isArray(v) ? v : [v]; } return []; } /** * @return {?} */ }, { key: "keys", get: function get() { return Object.keys(this.params); } }]); return ParamsAsMap; }(); if (false) {} /** * Converts a `Params` instance to a `ParamMap`. * \@publicApi * @param {?} params The instance to convert. * @return {?} The new map instance. * */ function convertToParamMap(params) { return new ParamsAsMap(params); } /** @type {?} */ var NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError'; /** * @param {?} message * @return {?} */ function navigationCancelingError(message) { /** @type {?} */ var error = Error('NavigationCancelingError: ' + message); /** @type {?} */ error[NAVIGATION_CANCELING_ERROR] = true; return error; } /** * @param {?} error * @return {?} */ function isNavigationCancelingError(error) { return error && /** @type {?} */ error[NAVIGATION_CANCELING_ERROR]; } // Matches the route configuration (`route`) against the actual URL (`segments`). /** * @param {?} segments * @param {?} segmentGroup * @param {?} route * @return {?} */ function defaultUrlMatcher(segments, segmentGroup, route) { /** @type {?} */ var parts = /** @type {?} */ route.path.split('/'); if (parts.length > segments.length) { // The actual URL is shorter than the config, no match return null; } if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || parts.length < segments.length)) { // The config is longer than the actual URL but we are looking for a full match, return null return null; } /** @type {?} */ var posParams = {}; // Check each config part against the actual URL for (var index = 0; index < parts.length; index++) { /** @type {?} */ var part = parts[index]; /** @type {?} */ var segment = segments[index]; /** @type {?} */ var isParameter = part.startsWith(':'); if (isParameter) { posParams[part.substring(1)] = segment; } else if (part !== segment.path) { // The actual URL part does not match the config, no match return null; } } return { consumed: segments.slice(0, parts.length), posParams: posParams }; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * A configuration object that defines a single route. * A set of routes are collected in a `Routes` array to define a `Router` configuration. * The router attempts to match segments of a given URL against each route, * using the configuration options defined in this object. * * Supports static, parameterized, redirect, and wildcard routes, as well as * custom route data and resolve methods. * * For detailed usage information, see the [Routing Guide](guide/router). * * \@usageNotes * * ### Simple Configuration * * The following route specifies that when navigating to, for example, * `/team/11/user/bob`, the router creates the 'Team' component * with the 'User' child component in it. * * ``` * [{ * path: 'team/:id', * component: Team, * children: [{ * path: 'user/:name', * component: User * }] * }] * ``` * * ### Multiple Outlets * * The following route creates sibling components with multiple outlets. * When navigating to `/team/11(aux:chat/jim)`, the router creates the 'Team' component next to * the 'Chat' component. The 'Chat' component is placed into the 'aux' outlet. * * ``` * [{ * path: 'team/:id', * component: Team * }, { * path: 'chat/:user', * component: Chat * outlet: 'aux' * }] * ``` * * ### Wild Cards * * The following route uses wild-card notation to specify a component * that is always instantiated regardless of where you navigate to. * * ``` * [{ * path: '**', * component: WildcardComponent * }] * ``` * * ### Redirects * * The following route uses the `redirectTo` property to ignore a segment of * a given URL when looking for a child path. * * When navigating to '/team/11/legacy/user/jim', the router changes the URL segment * '/team/11/legacy/user/jim' to '/team/11/user/jim', and then instantiates * the Team component with the User child component in it. * * ``` * [{ * path: 'team/:id', * component: Team, * children: [{ * path: 'legacy/user/:name', * redirectTo: 'user/:name' * }, { * path: 'user/:name', * component: User * }] * }] * ``` * * The redirect path can be relative, as shown in this example, or absolute. * If we change the `redirectTo` value in the example to the absolute URL segment '/user/:name', * the result URL is also absolute, '/user/jim'. * ### Empty Path * * Empty-path route configurations can be used to instantiate components that do not 'consume' * any URL segments. * * In the following configuration, when navigating to * `/team/11`, the router instantiates the 'AllUsers' component. * * ``` * [{ * path: 'team/:id', * component: Team, * children: [{ * path: '', * component: AllUsers * }, { * path: 'user/:name', * component: User * }] * }] * ``` * * Empty-path routes can have children. In the following example, when navigating * to `/team/11/user/jim`, the router instantiates the wrapper component with * the user component in it. * * Note that an empty path route inherits its parent's parameters and data. * * ``` * [{ * path: 'team/:id', * component: Team, * children: [{ * path: '', * component: WrapperCmp, * children: [{ * path: 'user/:name', * component: User * }] * }] * }] * ``` * * ### Matching Strategy * * The default path-match strategy is 'prefix', which means that the router * checks URL elements from the left to see if the URL matches a specified path. * For example, '/team/11/user' matches 'team/:id'. * * ``` * [{ * path: '', * pathMatch: 'prefix', //default * redirectTo: 'main' * }, { * path: 'main', * component: Main * }] * ``` * * You can specify the path-match strategy 'full' to make sure that the path * covers the whole unconsumed URL. It is important to do this when redirecting * empty-path routes. Otherwise, because an empty path is a prefix of any URL, * the router would apply the redirect even when navigating to the redirect destination, * creating an endless loop. * * In the following example, supplying the 'full' `pathMatch` strategy ensures * that the router applies the redirect if and only if navigating to '/'. * * ``` * [{ * path: '', * pathMatch: 'full', * redirectTo: 'main' * }, { * path: 'main', * component: Main * }] * ``` * * ### Componentless Routes * * You can share parameters between sibling components. * For example, suppose that two sibling components should go next to each other, * and both of them require an ID parameter. You can accomplish this using a route * that does not specify a component at the top level. * * In the following example, 'MainChild' and 'AuxChild' are siblings. * When navigating to 'parent/10/(a//aux:b)', the route instantiates * the main child and aux child components next to each other. * For this to work, the application component must have the primary and aux outlets defined. * * ``` * [{ * path: 'parent/:id', * children: [ * { path: 'a', component: MainChild }, * { path: 'b', component: AuxChild, outlet: 'aux' } * ] * }] * ``` * * The router merges the parameters, data, and resolve of the componentless * parent into the parameters, data, and resolve of the children. * * This is especially useful when child components are defined * with an empty path string, as in the following example. * With this configuration, navigating to '/parent/10' creates * the main child and aux components. * * ``` * [{ * path: 'parent/:id', * children: [ * { path: '', component: MainChild }, * { path: '', component: AuxChild, outlet: 'aux' } * ] * }] * ``` * * ### Lazy Loading * * Lazy loading speeds up application load time by splitting the application * into multiple bundles and loading them on demand. * To use lazy loading, provide the `loadChildren` property instead of the `children` property. * * Given the following example route, the router will lazy load * the associated module on demand using the browser native import system. * * ``` * [{ * path: 'lazy', * loadChildren: () => import('./lazy-route/lazy.module').then(mod => mod.LazyModule), * }]; * ``` * * \@publicApi * @record */ function Route() {} if (false) {} var LoadedRouterConfig = /** * @param {?} routes * @param {?} module */ function LoadedRouterConfig(routes, module) { _classCallCheck(this, LoadedRouterConfig); this.routes = routes; this.module = module; }; if (false) {} /** * @param {?} config * @param {?=} parentPath * @return {?} */ function validateConfig(config) { var parentPath = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; // forEach doesn't iterate undefined values for (var i = 0; i < config.length; i++) { /** @type {?} */ var route = config[i]; /** @type {?} */ var fullPath = getFullPath(parentPath, route); validateNode(route, fullPath); } } /** * @param {?} route * @param {?} fullPath * @return {?} */ function validateNode(route, fullPath) { if (!route) { throw new Error("\n Invalid configuration of route '".concat(fullPath, "': Encountered undefined route.\n The reason might be an extra comma.\n\n Example:\n const routes: Routes = [\n { path: '', redirectTo: '/dashboard', pathMatch: 'full' },\n { path: 'dashboard', component: DashboardComponent },, << two commas\n { path: 'detail/:id', component: HeroDetailComponent }\n ];\n ")); } if (Array.isArray(route)) { throw new Error("Invalid configuration of route '".concat(fullPath, "': Array cannot be specified")); } if (!route.component && !route.children && !route.loadChildren && route.outlet && route.outlet !== PRIMARY_OUTLET) { throw new Error("Invalid configuration of route '".concat(fullPath, "': a componentless route without children or loadChildren cannot have a named outlet set")); } if (route.redirectTo && route.children) { throw new Error("Invalid configuration of route '".concat(fullPath, "': redirectTo and children cannot be used together")); } if (route.redirectTo && route.loadChildren) { throw new Error("Invalid configuration of route '".concat(fullPath, "': redirectTo and loadChildren cannot be used together")); } if (route.children && route.loadChildren) { throw new Error("Invalid configuration of route '".concat(fullPath, "': children and loadChildren cannot be used together")); } if (route.redirectTo && route.component) { throw new Error("Invalid configuration of route '".concat(fullPath, "': redirectTo and component cannot be used together")); } if (route.path && route.matcher) { throw new Error("Invalid configuration of route '".concat(fullPath, "': path and matcher cannot be used together")); } if (route.redirectTo === void 0 && !route.component && !route.children && !route.loadChildren) { throw new Error("Invalid configuration of route '".concat(fullPath, "'. One of the following must be provided: component, redirectTo, children or loadChildren")); } if (route.path === void 0 && route.matcher === void 0) { throw new Error("Invalid configuration of route '".concat(fullPath, "': routes must have either a path or a matcher specified")); } if (typeof route.path === 'string' && route.path.charAt(0) === '/') { throw new Error("Invalid configuration of route '".concat(fullPath, "': path cannot start with a slash")); } if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) { /** @type {?} */ var exp = "The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'."; throw new Error("Invalid configuration of route '{path: \"".concat(fullPath, "\", redirectTo: \"").concat(route.redirectTo, "\"}': please provide 'pathMatch'. ").concat(exp)); } if (route.pathMatch !== void 0 && route.pathMatch !== 'full' && route.pathMatch !== 'prefix') { throw new Error("Invalid configuration of route '".concat(fullPath, "': pathMatch can only be set to 'prefix' or 'full'")); } if (route.children) { validateConfig(route.children, fullPath); } } /** * @param {?} parentPath * @param {?} currentRoute * @return {?} */ function getFullPath(parentPath, currentRoute) { if (!currentRoute) { return parentPath; } if (!parentPath && !currentRoute.path) { return ''; } else if (parentPath && !currentRoute.path) { return "".concat(parentPath, "/"); } else if (!parentPath && currentRoute.path) { return currentRoute.path; } else { return "".concat(parentPath, "/").concat(currentRoute.path); } } /** * Makes a copy of the config and adds any default required properties. * @param {?} r * @return {?} */ function standardizeConfig(r) { /** @type {?} */ var children = r.children && r.children.map(standardizeConfig); /** @type {?} */ var c = children ? Object.assign({}, r, { children: children }) : Object.assign({}, r); if (!c.component && (children || c.loadChildren) && c.outlet && c.outlet !== PRIMARY_OUTLET) { c.component = ɵEmptyOutletComponent; } return c; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} a * @param {?} b * @return {?} */ function shallowEqualArrays(a, b) { if (a.length !== b.length) return false; for (var i = 0; i < a.length; ++i) { if (!shallowEqual(a[i], b[i])) return false; } return true; } /** * @param {?} a * @param {?} b * @return {?} */ function shallowEqual(a, b) { // Casting Object.keys return values to include `undefined` as there are some cases // in IE 11 where this can happen. Cannot provide a test because the behavior only // exists in certain circumstances in IE 11, therefore doing this cast ensures the // logic is correct for when this edge case is hit. /** @type {?} */ var k1 = /** @type {?} */ Object.keys(a); /** @type {?} */ var k2 = /** @type {?} */ Object.keys(b); if (!k1 || !k2 || k1.length != k2.length) { return false; } /** @type {?} */ var key; for (var i = 0; i < k1.length; i++) { key = k1[i]; if (a[key] !== b[key]) { return false; } } return true; } /** * Flattens single-level nested arrays. * @template T * @param {?} arr * @return {?} */ function flatten(arr) { return Array.prototype.concat.apply([], arr); } /** * Return the last element of an array. * @template T * @param {?} a * @return {?} */ function last(a) { return a.length > 0 ? a[a.length - 1] : null; } /** * Verifys all booleans in an array are `true`. * @param {?} bools * @return {?} */ function and(bools) { return !bools.some( /** * @param {?} v * @return {?} */ function (v) { return !v; }); } /** * @template K, V * @param {?} map * @param {?} callback * @return {?} */ function forEach(map, callback) { for (var prop in map) { if (map.hasOwnProperty(prop)) { callback(map[prop], prop); } } } /** * @template A, B * @param {?} obj * @param {?} fn * @return {?} */ function waitForMap(obj, fn) { if (Object.keys(obj).length === 0) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])({}); } /** @type {?} */ var waitHead = []; /** @type {?} */ var waitTail = []; /** @type {?} */ var res = {}; forEach(obj, /** * @param {?} a * @param {?} k * @return {?} */ function (a, k) { /** @type {?} */ var mapped = fn(k, a).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} r * @return {?} */ function (r) { return res[k] = r; })); if (k === PRIMARY_OUTLET) { waitHead.push(mapped); } else { waitTail.push(mapped); } }); // Closure compiler has problem with using spread operator here. So we use "Array.concat". // Note that we also need to cast the new promise because TypeScript cannot infer the type // when calling the "of" function through "Function.apply" return ( /** @type {?} */ rxjs__WEBPACK_IMPORTED_MODULE_2__["of"].apply(null, waitHead.concat(waitTail)).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["concatAll"])(), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["last"])(), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @return {?} */ function () { return res; })) ); } /** * @template T * @param {?} value * @return {?} */ function wrapIntoObservable(value) { if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵisObservable"])(value)) { return value; } if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵisPromise"])(value)) { // Use `Promise.resolve()` to wrap promise-like instances. // Required ie when a Resolver returns a AngularJS `$q` promise to correctly trigger the // change detection. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(Promise.resolve(value)); } return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(value); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @return {?} */ function createEmptyUrlTree() { return new UrlTree(new UrlSegmentGroup([], {}), {}, null); } /** * @param {?} container * @param {?} containee * @param {?} exact * @return {?} */ function containsTree(container, containee, exact) { if (exact) { return equalQueryParams(container.queryParams, containee.queryParams) && equalSegmentGroups(container.root, containee.root); } return containsQueryParams(container.queryParams, containee.queryParams) && containsSegmentGroup(container.root, containee.root); } /** * @param {?} container * @param {?} containee * @return {?} */ function equalQueryParams(container, containee) { // TODO: This does not handle array params correctly. return shallowEqual(container, containee); } /** * @param {?} container * @param {?} containee * @return {?} */ function equalSegmentGroups(container, containee) { if (!equalPath(container.segments, containee.segments)) return false; if (container.numberOfChildren !== containee.numberOfChildren) return false; for (var c in containee.children) { if (!container.children[c]) return false; if (!equalSegmentGroups(container.children[c], containee.children[c])) return false; } return true; } /** * @param {?} container * @param {?} containee * @return {?} */ function containsQueryParams(container, containee) { // TODO: This does not handle array params correctly. return Object.keys(containee).length <= Object.keys(container).length && Object.keys(containee).every( /** * @param {?} key * @return {?} */ function (key) { return containee[key] === container[key]; }); } /** * @param {?} container * @param {?} containee * @return {?} */ function containsSegmentGroup(container, containee) { return containsSegmentGroupHelper(container, containee, containee.segments); } /** * @param {?} container * @param {?} containee * @param {?} containeePaths * @return {?} */ function containsSegmentGroupHelper(container, containee, containeePaths) { if (container.segments.length > containeePaths.length) { /** @type {?} */ var current = container.segments.slice(0, containeePaths.length); if (!equalPath(current, containeePaths)) return false; if (containee.hasChildren()) return false; return true; } else if (container.segments.length === containeePaths.length) { if (!equalPath(container.segments, containeePaths)) return false; for (var c in containee.children) { if (!container.children[c]) return false; if (!containsSegmentGroup(container.children[c], containee.children[c])) return false; } return true; } else { /** @type {?} */ var _current = containeePaths.slice(0, container.segments.length); /** @type {?} */ var next = containeePaths.slice(container.segments.length); if (!equalPath(container.segments, _current)) return false; if (!container.children[PRIMARY_OUTLET]) return false; return containsSegmentGroupHelper(container.children[PRIMARY_OUTLET], containee, next); } } /** * \@description * * Represents the parsed URL. * * Since a router state is a tree, and the URL is nothing but a serialized state, the URL is a * serialized tree. * UrlTree is a data structure that provides a lot of affordances in dealing with URLs * * \@usageNotes * ### Example * * ``` * \@Component({templateUrl:'template.html'}) * class MyComponent { * constructor(router: Router) { * const tree: UrlTree = * router.parseUrl('/team/33/(user/victor//support:help)?debug=true#fragment'); * const f = tree.fragment; // return 'fragment' * const q = tree.queryParams; // returns {debug: 'true'} * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET]; * const s: UrlSegment[] = g.segments; // returns 2 segments 'team' and '33' * g.children[PRIMARY_OUTLET].segments; // returns 2 segments 'user' and 'victor' * g.children['support'].segments; // return 1 segment 'help' * } * } * ``` * * \@publicApi */ var UrlTree = /*#__PURE__*/function () { /** * \@internal * @param {?} root * @param {?} queryParams * @param {?} fragment */ function UrlTree(root, queryParams, fragment) { _classCallCheck(this, UrlTree); this.root = root; this.queryParams = queryParams; this.fragment = fragment; } /** * @return {?} */ _createClass2(UrlTree, [{ key: "toString", /** * \@docsNotRequired * @return {?} */ value: function toString() { return DEFAULT_SERIALIZER.serialize(this); } }, { key: "queryParamMap", get: function get() { if (!this._queryParamMap) { this._queryParamMap = convertToParamMap(this.queryParams); } return this._queryParamMap; } }]); return UrlTree; }(); if (false) {} /** * \@description * * Represents the parsed URL segment group. * * See `UrlTree` for more information. * * \@publicApi */ var UrlSegmentGroup = /*#__PURE__*/function () { /** * @param {?} segments * @param {?} children */ function UrlSegmentGroup(segments, children) { var _this422 = this; _classCallCheck(this, UrlSegmentGroup); this.segments = segments; this.children = children; /** * The parent node in the url tree */ this.parent = null; forEach(children, /** * @template THIS * @this {THIS} * @param {?} v * @param {?} k * @return {THIS} */ function (v, k) { return v.parent = _this422; }); } /** * Whether the segment has child segments * @return {?} */ _createClass2(UrlSegmentGroup, [{ key: "hasChildren", value: function hasChildren() { return this.numberOfChildren > 0; } /** * Number of child segments * @return {?} */ }, { key: "toString", /** * \@docsNotRequired * @return {?} */ value: function toString() { return serializePaths(this); } }, { key: "numberOfChildren", get: function get() { return Object.keys(this.children).length; } }]); return UrlSegmentGroup; }(); if (false) {} /** * \@description * * Represents a single URL segment. * * A UrlSegment is a part of a URL between the two slashes. It contains a path and the matrix * parameters associated with the segment. * * \@usageNotes * ### Example * * ``` * \@Component({templateUrl:'template.html'}) * class MyComponent { * constructor(router: Router) { * const tree: UrlTree = router.parseUrl('/team;id=33'); * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET]; * const s: UrlSegment[] = g.segments; * s[0].path; // returns 'team' * s[0].parameters; // returns {id: 33} * } * } * ``` * * \@publicApi */ var UrlSegment = /*#__PURE__*/function () { /** * @param {?} path * @param {?} parameters */ function UrlSegment(path, parameters) { _classCallCheck(this, UrlSegment); this.path = path; this.parameters = parameters; } /** * @return {?} */ _createClass2(UrlSegment, [{ key: "toString", /** * \@docsNotRequired * @return {?} */ value: function toString() { return serializePath(this); } }, { key: "parameterMap", get: function get() { if (!this._parameterMap) { this._parameterMap = convertToParamMap(this.parameters); } return this._parameterMap; } }]); return UrlSegment; }(); if (false) {} /** * @param {?} as * @param {?} bs * @return {?} */ function equalSegments(as, bs) { return equalPath(as, bs) && as.every( /** * @param {?} a * @param {?} i * @return {?} */ function (a, i) { return shallowEqual(a.parameters, bs[i].parameters); }); } /** * @param {?} as * @param {?} bs * @return {?} */ function equalPath(as, bs) { if (as.length !== bs.length) return false; return as.every( /** * @param {?} a * @param {?} i * @return {?} */ function (a, i) { return a.path === bs[i].path; }); } /** * @template T * @param {?} segment * @param {?} fn * @return {?} */ function mapChildrenIntoArray(segment, fn) { /** @type {?} */ var res = []; forEach(segment.children, /** * @param {?} child * @param {?} childOutlet * @return {?} */ function (child, childOutlet) { if (childOutlet === PRIMARY_OUTLET) { res = res.concat(fn(child, childOutlet)); } }); forEach(segment.children, /** * @param {?} child * @param {?} childOutlet * @return {?} */ function (child, childOutlet) { if (childOutlet !== PRIMARY_OUTLET) { res = res.concat(fn(child, childOutlet)); } }); return res; } /** * \@description * * Serializes and deserializes a URL string into a URL tree. * * The url serialization strategy is customizable. You can * make all URLs case insensitive by providing a custom UrlSerializer. * * See `DefaultUrlSerializer` for an example of a URL serializer. * * \@publicApi * @abstract */ var UrlSerializer = function UrlSerializer() { _classCallCheck(this, UrlSerializer); }; if (false) {} /** * \@description * * A default implementation of the `UrlSerializer`. * * Example URLs: * * ``` * /inbox/33(popup:compose) * /inbox/33;open=true/messages/44 * ``` * * DefaultUrlSerializer uses parentheses to serialize secondary segments (e.g., popup:compose), the * colon syntax to specify the outlet, and the ';parameter=value' syntax (e.g., open=true) to * specify route specific parameters. * * \@publicApi */ var DefaultUrlSerializer = /*#__PURE__*/function () { function DefaultUrlSerializer() { _classCallCheck(this, DefaultUrlSerializer); } _createClass2(DefaultUrlSerializer, [{ key: "parse", /** * Parses a url into a `UrlTree` * @param {?} url * @return {?} */ value: function parse(url) { /** @type {?} */ var p = new UrlParser(url); return new UrlTree(p.parseRootSegment(), p.parseQueryParams(), p.parseFragment()); } /** * Converts a `UrlTree` into a url * @param {?} tree * @return {?} */ }, { key: "serialize", value: function serialize(tree) { /** @type {?} */ var segment = "/".concat(serializeSegment(tree.root, true)); /** @type {?} */ var query = serializeQueryParams(tree.queryParams); /** @type {?} */ var fragment = typeof tree.fragment === "string" ? "#".concat(encodeUriFragment( /** @type {?} */ tree.fragment)) : ''; return "".concat(segment).concat(query).concat(fragment); } }]); return DefaultUrlSerializer; }(); /** @type {?} */ var DEFAULT_SERIALIZER = new DefaultUrlSerializer(); /** * @param {?} segment * @return {?} */ function serializePaths(segment) { return segment.segments.map( /** * @param {?} p * @return {?} */ function (p) { return serializePath(p); }).join('/'); } /** * @param {?} segment * @param {?} root * @return {?} */ function serializeSegment(segment, root) { if (!segment.hasChildren()) { return serializePaths(segment); } if (root) { /** @type {?} */ var primary = segment.children[PRIMARY_OUTLET] ? serializeSegment(segment.children[PRIMARY_OUTLET], false) : ''; /** @type {?} */ var children = []; forEach(segment.children, /** * @param {?} v * @param {?} k * @return {?} */ function (v, k) { if (k !== PRIMARY_OUTLET) { children.push("".concat(k, ":").concat(serializeSegment(v, false))); } }); return children.length > 0 ? "".concat(primary, "(").concat(children.join('//'), ")") : primary; } else { /** @type {?} */ var _children = mapChildrenIntoArray(segment, /** * @param {?} v * @param {?} k * @return {?} */ function (v, k) { if (k === PRIMARY_OUTLET) { return [serializeSegment(segment.children[PRIMARY_OUTLET], false)]; } return ["".concat(k, ":").concat(serializeSegment(v, false))]; }); return "".concat(serializePaths(segment), "/(").concat(_children.join('//'), ")"); } } /** * Encodes a URI string with the default encoding. This function will only ever be called from * `encodeUriQuery` or `encodeUriSegment` as it's the base set of encodings to be used. We need * a custom encoding because encodeURIComponent is too aggressive and encodes stuff that doesn't * have to be encoded per https://url.spec.whatwg.org. * @param {?} s * @return {?} */ function encodeUriString(s) { return encodeURIComponent(s).replace(/%40/g, '@').replace(/%3A/gi, ':').replace(/%24/g, '$').replace(/%2C/gi, ','); } /** * This function should be used to encode both keys and values in a query string key/value. In * the following URL, you need to call encodeUriQuery on "k" and "v": * * http://www.site.org/html;mk=mv?k=v#f * @param {?} s * @return {?} */ function encodeUriQuery(s) { return encodeUriString(s).replace(/%3B/gi, ';'); } /** * This function should be used to encode a URL fragment. In the following URL, you need to call * encodeUriFragment on "f": * * http://www.site.org/html;mk=mv?k=v#f * @param {?} s * @return {?} */ function encodeUriFragment(s) { return encodeURI(s); } /** * This function should be run on any URI segment as well as the key and value in a key/value * pair for matrix params. In the following URL, you need to call encodeUriSegment on "html", * "mk", and "mv": * * http://www.site.org/html;mk=mv?k=v#f * @param {?} s * @return {?} */ function encodeUriSegment(s) { return encodeUriString(s).replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/%26/gi, '&'); } /** * @param {?} s * @return {?} */ function decode(s) { return decodeURIComponent(s); } // Query keys/values should have the "+" replaced first, as "+" in a query string is " ". // decodeURIComponent function will not decode "+" as a space. /** * @param {?} s * @return {?} */ function decodeQuery(s) { return decode(s.replace(/\+/g, '%20')); } /** * @param {?} path * @return {?} */ function serializePath(path) { return "".concat(encodeUriSegment(path.path)).concat(serializeMatrixParams(path.parameters)); } /** * @param {?} params * @return {?} */ function serializeMatrixParams(params) { return Object.keys(params).map( /** * @param {?} key * @return {?} */ function (key) { return ";".concat(encodeUriSegment(key), "=").concat(encodeUriSegment(params[key])); }).join(''); } /** * @param {?} params * @return {?} */ function serializeQueryParams(params) { /** @type {?} */ var strParams = Object.keys(params).map( /** * @param {?} name * @return {?} */ function (name) { /** @type {?} */ var value = params[name]; return Array.isArray(value) ? value.map( /** * @param {?} v * @return {?} */ function (v) { return "".concat(encodeUriQuery(name), "=").concat(encodeUriQuery(v)); }).join('&') : "".concat(encodeUriQuery(name), "=").concat(encodeUriQuery(value)); }); return strParams.length ? "?".concat(strParams.join("&")) : ''; } /** @type {?} */ var SEGMENT_RE = /^[^\/()?;=#]+/; /** * @param {?} str * @return {?} */ function matchSegments(str) { /** @type {?} */ var match = str.match(SEGMENT_RE); return match ? match[0] : ''; } /** @type {?} */ var QUERY_PARAM_RE = /^[^=?&#]+/; // Return the name of the query param at the start of the string or an empty string /** * @param {?} str * @return {?} */ function matchQueryParams(str) { /** @type {?} */ var match = str.match(QUERY_PARAM_RE); return match ? match[0] : ''; } /** @type {?} */ var QUERY_PARAM_VALUE_RE = /^[^?&#]+/; // Return the value of the query param at the start of the string or an empty string /** * @param {?} str * @return {?} */ function matchUrlQueryParamValue(str) { /** @type {?} */ var match = str.match(QUERY_PARAM_VALUE_RE); return match ? match[0] : ''; } var UrlParser = /*#__PURE__*/function () { /** * @param {?} url */ function UrlParser(url) { _classCallCheck(this, UrlParser); this.url = url; this.remaining = url; } /** * @return {?} */ _createClass2(UrlParser, [{ key: "parseRootSegment", value: function parseRootSegment() { this.consumeOptional('/'); if (this.remaining === '' || this.peekStartsWith('?') || this.peekStartsWith('#')) { return new UrlSegmentGroup([], {}); } // The root segment group never has segments return new UrlSegmentGroup([], this.parseChildren()); } /** * @return {?} */ }, { key: "parseQueryParams", value: function parseQueryParams() { /** @type {?} */ var params = {}; if (this.consumeOptional('?')) { do { this.parseQueryParam(params); } while (this.consumeOptional('&')); } return params; } /** * @return {?} */ }, { key: "parseFragment", value: function parseFragment() { return this.consumeOptional('#') ? decodeURIComponent(this.remaining) : null; } /** * @private * @return {?} */ }, { key: "parseChildren", value: function parseChildren() { if (this.remaining === '') { return {}; } this.consumeOptional('/'); /** @type {?} */ var segments = []; if (!this.peekStartsWith('(')) { segments.push(this.parseSegment()); } while (this.peekStartsWith('/') && !this.peekStartsWith('//') && !this.peekStartsWith('/(')) { this.capture('/'); segments.push(this.parseSegment()); } /** @type {?} */ var children = {}; if (this.peekStartsWith('/(')) { this.capture('/'); children = this.parseParens(true); } /** @type {?} */ var res = {}; if (this.peekStartsWith('(')) { res = this.parseParens(false); } if (segments.length > 0 || Object.keys(children).length > 0) { res[PRIMARY_OUTLET] = new UrlSegmentGroup(segments, children); } return res; } // parse a segment with its matrix parameters // ie `name;k1=v1;k2` /** * @private * @return {?} */ }, { key: "parseSegment", value: function parseSegment() { /** @type {?} */ var path = matchSegments(this.remaining); if (path === '' && this.peekStartsWith(';')) { throw new Error("Empty path url segment cannot have parameters: '".concat(this.remaining, "'.")); } this.capture(path); return new UrlSegment(decode(path), this.parseMatrixParams()); } /** * @private * @return {?} */ }, { key: "parseMatrixParams", value: function parseMatrixParams() { /** @type {?} */ var params = {}; while (this.consumeOptional(';')) { this.parseParam(params); } return params; } /** * @private * @param {?} params * @return {?} */ }, { key: "parseParam", value: function parseParam(params) { /** @type {?} */ var key = matchSegments(this.remaining); if (!key) { return; } this.capture(key); /** @type {?} */ var value = ''; if (this.consumeOptional('=')) { /** @type {?} */ var valueMatch = matchSegments(this.remaining); if (valueMatch) { value = valueMatch; this.capture(value); } } params[decode(key)] = decode(value); } // Parse a single query parameter `name[=value]` /** * @private * @param {?} params * @return {?} */ }, { key: "parseQueryParam", value: function parseQueryParam(params) { /** @type {?} */ var key = matchQueryParams(this.remaining); if (!key) { return; } this.capture(key); /** @type {?} */ var value = ''; if (this.consumeOptional('=')) { /** @type {?} */ var valueMatch = matchUrlQueryParamValue(this.remaining); if (valueMatch) { value = valueMatch; this.capture(value); } } /** @type {?} */ var decodedKey = decodeQuery(key); /** @type {?} */ var decodedVal = decodeQuery(value); if (params.hasOwnProperty(decodedKey)) { // Append to existing values /** @type {?} */ var currentVal = params[decodedKey]; if (!Array.isArray(currentVal)) { currentVal = [currentVal]; params[decodedKey] = currentVal; } currentVal.push(decodedVal); } else { // Create a new value params[decodedKey] = decodedVal; } } // parse `(a/b//outlet_name:c/d)` /** * @private * @param {?} allowPrimary * @return {?} */ }, { key: "parseParens", value: function parseParens(allowPrimary) { /** @type {?} */ var segments = {}; this.capture('('); while (!this.consumeOptional(')') && this.remaining.length > 0) { /** @type {?} */ var path = matchSegments(this.remaining); /** @type {?} */ var next = this.remaining[path.length]; // if is is not one of these characters, then the segment was unescaped // or the group was not closed if (next !== '/' && next !== ')' && next !== ';') { throw new Error("Cannot parse url '".concat(this.url, "'")); } /** @type {?} */ var outletName = /** @type {?} */ undefined; if (path.indexOf(':') > -1) { outletName = path.substr(0, path.indexOf(':')); this.capture(outletName); this.capture(':'); } else if (allowPrimary) { outletName = PRIMARY_OUTLET; } /** @type {?} */ var children = this.parseChildren(); segments[outletName] = Object.keys(children).length === 1 ? children[PRIMARY_OUTLET] : new UrlSegmentGroup([], children); this.consumeOptional('//'); } return segments; } /** * @private * @param {?} str * @return {?} */ }, { key: "peekStartsWith", value: function peekStartsWith(str) { return this.remaining.startsWith(str); } // Consumes the prefix when it is present and returns whether it has been consumed /** * @private * @param {?} str * @return {?} */ }, { key: "consumeOptional", value: function consumeOptional(str) { if (this.peekStartsWith(str)) { this.remaining = this.remaining.substring(str.length); return true; } return false; } /** * @private * @param {?} str * @return {?} */ }, { key: "capture", value: function capture(str) { if (!this.consumeOptional(str)) { throw new Error("Expected \"".concat(str, "\".")); } } }]); return UrlParser; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** * @template T */ var Tree = /*#__PURE__*/function () { /** * @param {?} root */ function Tree(root) { _classCallCheck(this, Tree); this._root = root; } /** * @return {?} */ _createClass2(Tree, [{ key: "parent", /** * \@internal * @param {?} t * @return {?} */ value: function parent(t) { /** @type {?} */ var p = this.pathFromRoot(t); return p.length > 1 ? p[p.length - 2] : null; } /** * \@internal * @param {?} t * @return {?} */ }, { key: "children", value: function children(t) { /** @type {?} */ var n = findNode(t, this._root); return n ? n.children.map( /** * @param {?} t * @return {?} */ function (t) { return t.value; }) : []; } /** * \@internal * @param {?} t * @return {?} */ }, { key: "firstChild", value: function firstChild(t) { /** @type {?} */ var n = findNode(t, this._root); return n && n.children.length > 0 ? n.children[0].value : null; } /** * \@internal * @param {?} t * @return {?} */ }, { key: "siblings", value: function siblings(t) { /** @type {?} */ var p = findPath(t, this._root); if (p.length < 2) return []; /** @type {?} */ var c = p[p.length - 2].children.map( /** * @param {?} c * @return {?} */ function (c) { return c.value; }); return c.filter( /** * @param {?} cc * @return {?} */ function (cc) { return cc !== t; }); } /** * \@internal * @param {?} t * @return {?} */ }, { key: "pathFromRoot", value: function pathFromRoot(t) { return findPath(t, this._root).map( /** * @param {?} s * @return {?} */ function (s) { return s.value; }); } }, { key: "root", get: function get() { return this._root.value; } }]); return Tree; }(); if (false) {} // DFS for the node matching the value /** * @template T * @param {?} value * @param {?} node * @return {?} */ function findNode(value, node) { if (value === node.value) return node; var _iterator46 = _createForOfIteratorHelper(node.children), _step46; try { for (_iterator46.s(); !(_step46 = _iterator46.n()).done;) { var child = _step46.value; /** @type {?} */ var _node2 = findNode(value, child); if (_node2) return _node2; } } catch (err) { _iterator46.e(err); } finally { _iterator46.f(); } return null; } // Return the path to the node with the given value using DFS /** * @template T * @param {?} value * @param {?} node * @return {?} */ function findPath(value, node) { if (value === node.value) return [node]; var _iterator47 = _createForOfIteratorHelper(node.children), _step47; try { for (_iterator47.s(); !(_step47 = _iterator47.n()).done;) { var child = _step47.value; /** @type {?} */ var path = findPath(value, child); if (path.length) { path.unshift(node); return path; } } } catch (err) { _iterator47.e(err); } finally { _iterator47.f(); } return []; } /** * @template T */ var TreeNode = /*#__PURE__*/function () { /** * @param {?} value * @param {?} children */ function TreeNode(value, children) { _classCallCheck(this, TreeNode); this.value = value; this.children = children; } /** * @return {?} */ _createClass2(TreeNode, [{ key: "toString", value: function toString() { return "TreeNode(".concat(this.value, ")"); } }]); return TreeNode; }(); if (false) {} // Return the list of T indexed by outlet name /** * @template T * @param {?} node * @return {?} */ function nodeChildrenAsMap(node) { /** @type {?} */ var map = {}; if (node) { node.children.forEach( /** * @param {?} child * @return {?} */ function (child) { return map[child.value.outlet] = child; }); } return map; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Represents the state of the router as a tree of activated routes. * * \@usageNotes * * Every node in the route tree is an `ActivatedRoute` instance * that knows about the "consumed" URL segments, the extracted parameters, * and the resolved data. * Use the `ActivatedRoute` properties to traverse the tree from any node. * * ### Example * * ``` * \@Component({templateUrl:'template.html'}) * class MyComponent { * constructor(router: Router) { * const state: RouterState = router.routerState; * const root: ActivatedRoute = state.root; * const child = root.firstChild; * const id: Observable<string> = child.params.map(p => p.id); * //... * } * } * ``` * * @see `ActivatedRoute` * * \@publicApi */ var RouterState = /*#__PURE__*/function (_Tree) { _inherits(RouterState, _Tree); var _super169 = _createSuper(RouterState); /** * \@internal * @param {?} root * @param {?} snapshot */ function RouterState(root, snapshot) { var _this423; _classCallCheck(this, RouterState); _this423 = _super169.call(this, root); _this423.snapshot = snapshot; setRouterState( /** @type {?} */ _assertThisInitialized(_this423), root); return _this423; } /** * @return {?} */ _createClass2(RouterState, [{ key: "toString", value: function toString() { return this.snapshot.toString(); } }]); return RouterState; }(Tree); if (false) {} /** * @param {?} urlTree * @param {?} rootComponent * @return {?} */ function createEmptyState(urlTree, rootComponent) { /** @type {?} */ var snapshot = createEmptyStateSnapshot(urlTree, rootComponent); /** @type {?} */ var emptyUrl = new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"]([new UrlSegment('', {})]); /** @type {?} */ var emptyParams = new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"]({}); /** @type {?} */ var emptyData = new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"]({}); /** @type {?} */ var emptyQueryParams = new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"]({}); /** @type {?} */ var fragment = new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"](''); /** @type {?} */ var activated = new ActivatedRoute(emptyUrl, emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, snapshot.root); activated.snapshot = snapshot.root; return new RouterState(new TreeNode(activated, []), snapshot); } /** * @param {?} urlTree * @param {?} rootComponent * @return {?} */ function createEmptyStateSnapshot(urlTree, rootComponent) { /** @type {?} */ var emptyParams = {}; /** @type {?} */ var emptyData = {}; /** @type {?} */ var emptyQueryParams = {}; /** @type {?} */ var fragment = ''; /** @type {?} */ var activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, urlTree.root, -1, {}); return new RouterStateSnapshot('', new TreeNode(activated, [])); } /** * Provides access to information about a route associated with a component * that is loaded in an outlet. * Use to traverse the `RouterState` tree and extract information from nodes. * * {\@example router/activated-route/module.ts region="activated-route" * header="activated-route.component.ts"} * * \@publicApi */ var ActivatedRoute = /*#__PURE__*/function () { /** * \@internal * @param {?} url * @param {?} params * @param {?} queryParams * @param {?} fragment * @param {?} data * @param {?} outlet * @param {?} component * @param {?} futureSnapshot */ function ActivatedRoute(url, params, queryParams, fragment, data, outlet, component, futureSnapshot) { _classCallCheck(this, ActivatedRoute); this.url = url; this.params = params; this.queryParams = queryParams; this.fragment = fragment; this.data = data; this.outlet = outlet; this.component = component; this._futureSnapshot = futureSnapshot; } /** * The configuration used to match this route. * @return {?} */ _createClass2(ActivatedRoute, [{ key: "toString", /** * @return {?} */ value: function toString() { return this.snapshot ? this.snapshot.toString() : "Future(".concat(this._futureSnapshot, ")"); } }, { key: "routeConfig", get: function get() { return this._futureSnapshot.routeConfig; } /** * The root of the router state. * @return {?} */ }, { key: "root", get: function get() { return this._routerState.root; } /** * The parent of this route in the router state tree. * @return {?} */ }, { key: "parent", get: function get() { return this._routerState.parent(this); } /** * The first child of this route in the router state tree. * @return {?} */ }, { key: "firstChild", get: function get() { return this._routerState.firstChild(this); } /** * The children of this route in the router state tree. * @return {?} */ }, { key: "children", get: function get() { return this._routerState.children(this); } /** * The path from the root of the router state tree to this route. * @return {?} */ }, { key: "pathFromRoot", get: function get() { return this._routerState.pathFromRoot(this); } /** * An Observable that contains a map of the required and optional parameters * specific to the route. * The map supports retrieving single and multiple values from the same parameter. * @return {?} */ }, { key: "paramMap", get: function get() { if (!this._paramMap) { this._paramMap = this.params.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} p * @return {?} */ function (p) { return convertToParamMap(p); })); } return this._paramMap; } /** * An Observable that contains a map of the query parameters available to all routes. * The map supports retrieving single and multiple values from the query parameter. * @return {?} */ }, { key: "queryParamMap", get: function get() { if (!this._queryParamMap) { this._queryParamMap = this.queryParams.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} p * @return {?} */ function (p) { return convertToParamMap(p); })); } return this._queryParamMap; } }]); return ActivatedRoute; }(); if (false) {} /** * Returns the inherited params, data, and resolve for a given route. * By default, this only inherits values up to the nearest path-less or component-less route. * \@internal * @param {?} route * @param {?=} paramsInheritanceStrategy * @return {?} */ function inheritedParamsDataResolve(route) { var paramsInheritanceStrategy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'emptyOnly'; /** @type {?} */ var pathFromRoot = route.pathFromRoot; /** @type {?} */ var inheritingStartingFrom = 0; if (paramsInheritanceStrategy !== 'always') { inheritingStartingFrom = pathFromRoot.length - 1; while (inheritingStartingFrom >= 1) { /** @type {?} */ var current = pathFromRoot[inheritingStartingFrom]; /** @type {?} */ var parent = pathFromRoot[inheritingStartingFrom - 1]; // current route is an empty path => inherits its parent's params and data if (current.routeConfig && current.routeConfig.path === '') { inheritingStartingFrom--; // parent is componentless => current route should inherit its params and data } else if (!parent.component) { inheritingStartingFrom--; } else { break; } } } return flattenInherited(pathFromRoot.slice(inheritingStartingFrom)); } /** * \@internal * @param {?} pathFromRoot * @return {?} */ function flattenInherited(pathFromRoot) { return pathFromRoot.reduce( /** * @param {?} res * @param {?} curr * @return {?} */ function (res, curr) { /** @type {?} */ var params = Object.assign({}, res.params, curr.params); /** @type {?} */ var data = Object.assign({}, res.data, curr.data); /** @type {?} */ var resolve = Object.assign({}, res.resolve, curr._resolvedData); return { params: params, data: data, resolve: resolve }; }, /** @type {?} */ { params: {}, data: {}, resolve: {} }); } /** * \@description * * Contains the information about a route associated with a component loaded in an * outlet at a particular moment in time. ActivatedRouteSnapshot can also be used to * traverse the router state tree. * * ``` * \@Component({templateUrl:'./my-component.html'}) * class MyComponent { * constructor(route: ActivatedRoute) { * const id: string = route.snapshot.params.id; * const url: string = route.snapshot.url.join(''); * const user = route.snapshot.data.user; * } * } * ``` * * \@publicApi */ var ActivatedRouteSnapshot = /*#__PURE__*/function () { /** * \@internal * @param {?} url * @param {?} params * @param {?} queryParams * @param {?} fragment * @param {?} data * @param {?} outlet * @param {?} component * @param {?} routeConfig * @param {?} urlSegment * @param {?} lastPathIndex * @param {?} resolve */ function ActivatedRouteSnapshot(url, params, queryParams, fragment, data, outlet, component, routeConfig, urlSegment, lastPathIndex, resolve) { _classCallCheck(this, ActivatedRouteSnapshot); this.url = url; this.params = params; this.queryParams = queryParams; this.fragment = fragment; this.data = data; this.outlet = outlet; this.component = component; this.routeConfig = routeConfig; this._urlSegment = urlSegment; this._lastPathIndex = lastPathIndex; this._resolve = resolve; } /** * The root of the router state * @return {?} */ _createClass2(ActivatedRouteSnapshot, [{ key: "toString", /** * @return {?} */ value: function toString() { /** @type {?} */ var url = this.url.map( /** * @param {?} segment * @return {?} */ function (segment) { return segment.toString(); }).join('/'); /** @type {?} */ var matched = this.routeConfig ? this.routeConfig.path : ''; return "Route(url:'".concat(url, "', path:'").concat(matched, "')"); } }, { key: "root", get: function get() { return this._routerState.root; } /** * The parent of this route in the router state tree * @return {?} */ }, { key: "parent", get: function get() { return this._routerState.parent(this); } /** * The first child of this route in the router state tree * @return {?} */ }, { key: "firstChild", get: function get() { return this._routerState.firstChild(this); } /** * The children of this route in the router state tree * @return {?} */ }, { key: "children", get: function get() { return this._routerState.children(this); } /** * The path from the root of the router state tree to this route * @return {?} */ }, { key: "pathFromRoot", get: function get() { return this._routerState.pathFromRoot(this); } /** * @return {?} */ }, { key: "paramMap", get: function get() { if (!this._paramMap) { this._paramMap = convertToParamMap(this.params); } return this._paramMap; } /** * @return {?} */ }, { key: "queryParamMap", get: function get() { if (!this._queryParamMap) { this._queryParamMap = convertToParamMap(this.queryParams); } return this._queryParamMap; } }]); return ActivatedRouteSnapshot; }(); if (false) {} /** * \@description * * Represents the state of the router at a moment in time. * * This is a tree of activated route snapshots. Every node in this tree knows about * the "consumed" URL segments, the extracted parameters, and the resolved data. * * \@usageNotes * ### Example * * ``` * \@Component({templateUrl:'template.html'}) * class MyComponent { * constructor(router: Router) { * const state: RouterState = router.routerState; * const snapshot: RouterStateSnapshot = state.snapshot; * const root: ActivatedRouteSnapshot = snapshot.root; * const child = root.firstChild; * const id: Observable<string> = child.params.map(p => p.id); * //... * } * } * ``` * * \@publicApi */ var RouterStateSnapshot = /*#__PURE__*/function (_Tree2) { _inherits(RouterStateSnapshot, _Tree2); var _super170 = _createSuper(RouterStateSnapshot); /** * \@internal * @param {?} url * @param {?} root */ function RouterStateSnapshot(url, root) { var _this424; _classCallCheck(this, RouterStateSnapshot); _this424 = _super170.call(this, root); _this424.url = url; setRouterState( /** @type {?} */ _assertThisInitialized(_this424), root); return _this424; } /** * @return {?} */ _createClass2(RouterStateSnapshot, [{ key: "toString", value: function toString() { return serializeNode(this._root); } }]); return RouterStateSnapshot; }(Tree); if (false) {} /** * @template U, T * @param {?} state * @param {?} node * @return {?} */ function setRouterState(state, node) { node.value._routerState = state; node.children.forEach( /** * @param {?} c * @return {?} */ function (c) { return setRouterState(state, c); }); } /** * @param {?} node * @return {?} */ function serializeNode(node) { /** @type {?} */ var c = node.children.length > 0 ? " { ".concat(node.children.map(serializeNode).join(', '), " } ") : ''; return "".concat(node.value).concat(c); } /** * The expectation is that the activate route is created with the right set of parameters. * So we push new values into the observables only when they are not the initial values. * And we detect that by checking if the snapshot field is set. * @param {?} route * @return {?} */ function advanceActivatedRoute(route) { if (route.snapshot) { /** @type {?} */ var currentSnapshot = route.snapshot; /** @type {?} */ var nextSnapshot = route._futureSnapshot; route.snapshot = nextSnapshot; if (!shallowEqual(currentSnapshot.queryParams, nextSnapshot.queryParams)) { /** @type {?} */ route.queryParams.next(nextSnapshot.queryParams); } if (currentSnapshot.fragment !== nextSnapshot.fragment) { /** @type {?} */ route.fragment.next(nextSnapshot.fragment); } if (!shallowEqual(currentSnapshot.params, nextSnapshot.params)) { /** @type {?} */ route.params.next(nextSnapshot.params); } if (!shallowEqualArrays(currentSnapshot.url, nextSnapshot.url)) { /** @type {?} */ route.url.next(nextSnapshot.url); } if (!shallowEqual(currentSnapshot.data, nextSnapshot.data)) { /** @type {?} */ route.data.next(nextSnapshot.data); } } else { route.snapshot = route._futureSnapshot; // this is for resolved data /** @type {?} */ route.data.next(route._futureSnapshot.data); } } /** * @param {?} a * @param {?} b * @return {?} */ function equalParamsAndUrlSegments(a, b) { /** @type {?} */ var equalUrlParams = shallowEqual(a.params, b.params) && equalSegments(a.url, b.url); /** @type {?} */ var parentsMismatch = !a.parent !== !b.parent; return equalUrlParams && !parentsMismatch && (!a.parent || equalParamsAndUrlSegments(a.parent, /** @type {?} */ b.parent)); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} routeReuseStrategy * @param {?} curr * @param {?} prevState * @return {?} */ function createRouterState(routeReuseStrategy, curr, prevState) { /** @type {?} */ var root = createNode(routeReuseStrategy, curr._root, prevState ? prevState._root : undefined); return new RouterState(root, curr); } /** * @param {?} routeReuseStrategy * @param {?} curr * @param {?=} prevState * @return {?} */ function createNode(routeReuseStrategy, curr, prevState) { // reuse an activated route that is currently displayed on the screen if (prevState && routeReuseStrategy.shouldReuseRoute(curr.value, prevState.value.snapshot)) { /** @type {?} */ var value = prevState.value; value._futureSnapshot = curr.value; /** @type {?} */ var children = createOrReuseChildren(routeReuseStrategy, curr, prevState); return new TreeNode(value, children); // retrieve an activated route that is used to be displayed, but is not currently displayed } else { /** @type {?} */ var detachedRouteHandle = /** @type {?} */ routeReuseStrategy.retrieve(curr.value); if (detachedRouteHandle) { /** @type {?} */ var _tree = detachedRouteHandle.route; setFutureSnapshotsOfActivatedRoutes(curr, _tree); return _tree; } else { /** @type {?} */ var _value12 = createActivatedRoute(curr.value); /** @type {?} */ var _children2 = curr.children.map( /** * @param {?} c * @return {?} */ function (c) { return createNode(routeReuseStrategy, c); }); return new TreeNode(_value12, _children2); } } } /** * @param {?} curr * @param {?} result * @return {?} */ function setFutureSnapshotsOfActivatedRoutes(curr, result) { if (curr.value.routeConfig !== result.value.routeConfig) { throw new Error('Cannot reattach ActivatedRouteSnapshot created from a different route'); } if (curr.children.length !== result.children.length) { throw new Error('Cannot reattach ActivatedRouteSnapshot with a different number of children'); } result.value._futureSnapshot = curr.value; for (var i = 0; i < curr.children.length; ++i) { setFutureSnapshotsOfActivatedRoutes(curr.children[i], result.children[i]); } } /** * @param {?} routeReuseStrategy * @param {?} curr * @param {?} prevState * @return {?} */ function createOrReuseChildren(routeReuseStrategy, curr, prevState) { return curr.children.map( /** * @param {?} child * @return {?} */ function (child) { var _iterator48 = _createForOfIteratorHelper(prevState.children), _step48; try { for (_iterator48.s(); !(_step48 = _iterator48.n()).done;) { var p = _step48.value; if (routeReuseStrategy.shouldReuseRoute(p.value.snapshot, child.value)) { return createNode(routeReuseStrategy, child, p); } } } catch (err) { _iterator48.e(err); } finally { _iterator48.f(); } return createNode(routeReuseStrategy, child); }); } /** * @param {?} c * @return {?} */ function createActivatedRoute(c) { return new ActivatedRoute(new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"](c.url), new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"](c.params), new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"](c.queryParams), new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"](c.fragment), new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"](c.data), c.outlet, c.component, c); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} route * @param {?} urlTree * @param {?} commands * @param {?} queryParams * @param {?} fragment * @return {?} */ function _createUrlTree(route, urlTree, commands, queryParams, fragment) { if (commands.length === 0) { return tree(urlTree.root, urlTree.root, urlTree, queryParams, fragment); } /** @type {?} */ var nav = computeNavigation(commands); if (nav.toRoot()) { return tree(urlTree.root, new UrlSegmentGroup([], {}), urlTree, queryParams, fragment); } /** @type {?} */ var startingPosition = findStartingPosition(nav, urlTree, route); /** @type {?} */ var segmentGroup = startingPosition.processChildren ? updateSegmentGroupChildren(startingPosition.segmentGroup, startingPosition.index, nav.commands) : updateSegmentGroup(startingPosition.segmentGroup, startingPosition.index, nav.commands); return tree(startingPosition.segmentGroup, segmentGroup, urlTree, queryParams, fragment); } /** * @param {?} command * @return {?} */ function isMatrixParams(command) { return typeof command === 'object' && command != null && !command.outlets && !command.segmentPath; } /** * @param {?} oldSegmentGroup * @param {?} newSegmentGroup * @param {?} urlTree * @param {?} queryParams * @param {?} fragment * @return {?} */ function tree(oldSegmentGroup, newSegmentGroup, urlTree, queryParams, fragment) { /** @type {?} */ var qp = {}; if (queryParams) { forEach(queryParams, /** * @param {?} value * @param {?} name * @return {?} */ function (value, name) { qp[name] = Array.isArray(value) ? value.map( /** * @param {?} v * @return {?} */ function (v) { return "".concat(v); }) : "".concat(value); }); } if (urlTree.root === oldSegmentGroup) { return new UrlTree(newSegmentGroup, qp, fragment); } return new UrlTree(replaceSegment(urlTree.root, oldSegmentGroup, newSegmentGroup), qp, fragment); } /** * @param {?} current * @param {?} oldSegment * @param {?} newSegment * @return {?} */ function replaceSegment(current, oldSegment, newSegment) { /** @type {?} */ var children = {}; forEach(current.children, /** * @param {?} c * @param {?} outletName * @return {?} */ function (c, outletName) { if (c === oldSegment) { children[outletName] = newSegment; } else { children[outletName] = replaceSegment(c, oldSegment, newSegment); } }); return new UrlSegmentGroup(current.segments, children); } var Navigation = /*#__PURE__*/function () { /** * @param {?} isAbsolute * @param {?} numberOfDoubleDots * @param {?} commands */ function Navigation(isAbsolute, numberOfDoubleDots, commands) { _classCallCheck(this, Navigation); this.isAbsolute = isAbsolute; this.numberOfDoubleDots = numberOfDoubleDots; this.commands = commands; if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) { throw new Error('Root segment cannot have matrix parameters'); } /** @type {?} */ var cmdWithOutlet = commands.find( /** * @param {?} c * @return {?} */ function (c) { return typeof c === 'object' && c != null && c.outlets; }); if (cmdWithOutlet && cmdWithOutlet !== last(commands)) { throw new Error('{outlets:{}} has to be the last command'); } } /** * @return {?} */ _createClass2(Navigation, [{ key: "toRoot", value: function toRoot() { return this.isAbsolute && this.commands.length === 1 && this.commands[0] == '/'; } }]); return Navigation; }(); if (false) {} /** * Transforms commands to a normalized `Navigation` * @param {?} commands * @return {?} */ function computeNavigation(commands) { if (typeof commands[0] === 'string' && commands.length === 1 && commands[0] === '/') { return new Navigation(true, 0, commands); } /** @type {?} */ var numberOfDoubleDots = 0; /** @type {?} */ var isAbsolute = false; /** @type {?} */ var res = commands.reduce( /** * @param {?} res * @param {?} cmd * @param {?} cmdIdx * @return {?} */ function (res, cmd, cmdIdx) { if (typeof cmd === 'object' && cmd != null) { if (cmd.outlets) { /** @type {?} */ var outlets = {}; forEach(cmd.outlets, /** * @param {?} commands * @param {?} name * @return {?} */ function (commands, name) { outlets[name] = typeof commands === 'string' ? commands.split('/') : commands; }); return [].concat(_toConsumableArray(res), [{ outlets: outlets }]); } if (cmd.segmentPath) { return [].concat(_toConsumableArray(res), [cmd.segmentPath]); } } if (!(typeof cmd === 'string')) { return [].concat(_toConsumableArray(res), [cmd]); } if (cmdIdx === 0) { cmd.split('/').forEach( /** * @param {?} urlPart * @param {?} partIndex * @return {?} */ function (urlPart, partIndex) { if (partIndex == 0 && urlPart === '.') {// skip './a' } else if (partIndex == 0 && urlPart === '') { // '/a' isAbsolute = true; } else if (urlPart === '..') { // '../a' numberOfDoubleDots++; } else if (urlPart != '') { res.push(urlPart); } }); return res; } return [].concat(_toConsumableArray(res), [cmd]); }, []); return new Navigation(isAbsolute, numberOfDoubleDots, res); } var Position = /** * @param {?} segmentGroup * @param {?} processChildren * @param {?} index */ function Position(segmentGroup, processChildren, index) { _classCallCheck(this, Position); this.segmentGroup = segmentGroup; this.processChildren = processChildren; this.index = index; }; if (false) {} /** * @param {?} nav * @param {?} tree * @param {?} route * @return {?} */ function findStartingPosition(nav, tree, route) { if (nav.isAbsolute) { return new Position(tree.root, true, 0); } if (route.snapshot._lastPathIndex === -1) { return new Position(route.snapshot._urlSegment, true, 0); } /** @type {?} */ var modifier = isMatrixParams(nav.commands[0]) ? 0 : 1; /** @type {?} */ var index = route.snapshot._lastPathIndex + modifier; return createPositionApplyingDoubleDots(route.snapshot._urlSegment, index, nav.numberOfDoubleDots); } /** * @param {?} group * @param {?} index * @param {?} numberOfDoubleDots * @return {?} */ function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) { /** @type {?} */ var g = group; /** @type {?} */ var ci = index; /** @type {?} */ var dd = numberOfDoubleDots; while (dd > ci) { dd -= ci; g = /** @type {?} */ g.parent; if (!g) { throw new Error('Invalid number of \'../\''); } ci = g.segments.length; } return new Position(g, false, ci - dd); } /** * @param {?} command * @return {?} */ function getPath(command) { if (typeof command === 'object' && command != null && command.outlets) { return command.outlets[PRIMARY_OUTLET]; } return "".concat(command); } /** * @param {?} commands * @return {?} */ function getOutlets(commands) { if (!(typeof commands[0] === 'object')) return _defineProperty({}, PRIMARY_OUTLET, commands); if (commands[0].outlets === undefined) return _defineProperty({}, PRIMARY_OUTLET, commands); return commands[0].outlets; } /** * @param {?} segmentGroup * @param {?} startIndex * @param {?} commands * @return {?} */ function updateSegmentGroup(segmentGroup, startIndex, commands) { if (!segmentGroup) { segmentGroup = new UrlSegmentGroup([], {}); } if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) { return updateSegmentGroupChildren(segmentGroup, startIndex, commands); } /** @type {?} */ var m = prefixedWith(segmentGroup, startIndex, commands); /** @type {?} */ var slicedCommands = commands.slice(m.commandIndex); if (m.match && m.pathIndex < segmentGroup.segments.length) { /** @type {?} */ var g = new UrlSegmentGroup(segmentGroup.segments.slice(0, m.pathIndex), {}); g.children[PRIMARY_OUTLET] = new UrlSegmentGroup(segmentGroup.segments.slice(m.pathIndex), segmentGroup.children); return updateSegmentGroupChildren(g, 0, slicedCommands); } else if (m.match && slicedCommands.length === 0) { return new UrlSegmentGroup(segmentGroup.segments, {}); } else if (m.match && !segmentGroup.hasChildren()) { return createNewSegmentGroup(segmentGroup, startIndex, commands); } else if (m.match) { return updateSegmentGroupChildren(segmentGroup, 0, slicedCommands); } else { return createNewSegmentGroup(segmentGroup, startIndex, commands); } } /** * @param {?} segmentGroup * @param {?} startIndex * @param {?} commands * @return {?} */ function updateSegmentGroupChildren(segmentGroup, startIndex, commands) { if (commands.length === 0) { return new UrlSegmentGroup(segmentGroup.segments, {}); } else { /** @type {?} */ var outlets = getOutlets(commands); /** @type {?} */ var children = {}; forEach(outlets, /** * @param {?} commands * @param {?} outlet * @return {?} */ function (commands, outlet) { if (commands !== null) { children[outlet] = updateSegmentGroup(segmentGroup.children[outlet], startIndex, commands); } }); forEach(segmentGroup.children, /** * @param {?} child * @param {?} childOutlet * @return {?} */ function (child, childOutlet) { if (outlets[childOutlet] === undefined) { children[childOutlet] = child; } }); return new UrlSegmentGroup(segmentGroup.segments, children); } } /** * @param {?} segmentGroup * @param {?} startIndex * @param {?} commands * @return {?} */ function prefixedWith(segmentGroup, startIndex, commands) { /** @type {?} */ var currentCommandIndex = 0; /** @type {?} */ var currentPathIndex = startIndex; /** @type {?} */ var noMatch = { match: false, pathIndex: 0, commandIndex: 0 }; while (currentPathIndex < segmentGroup.segments.length) { if (currentCommandIndex >= commands.length) return noMatch; /** @type {?} */ var path = segmentGroup.segments[currentPathIndex]; /** @type {?} */ var curr = getPath(commands[currentCommandIndex]); /** @type {?} */ var next = currentCommandIndex < commands.length - 1 ? commands[currentCommandIndex + 1] : null; if (currentPathIndex > 0 && curr === undefined) break; if (curr && next && typeof next === 'object' && next.outlets === undefined) { if (!compare(curr, next, path)) return noMatch; currentCommandIndex += 2; } else { if (!compare(curr, {}, path)) return noMatch; currentCommandIndex++; } currentPathIndex++; } return { match: true, pathIndex: currentPathIndex, commandIndex: currentCommandIndex }; } /** * @param {?} segmentGroup * @param {?} startIndex * @param {?} commands * @return {?} */ function createNewSegmentGroup(segmentGroup, startIndex, commands) { /** @type {?} */ var paths = segmentGroup.segments.slice(0, startIndex); /** @type {?} */ var i = 0; while (i < commands.length) { if (typeof commands[i] === 'object' && commands[i].outlets !== undefined) { /** @type {?} */ var children = createNewSegmentChildren(commands[i].outlets); return new UrlSegmentGroup(paths, children); } // if we start with an object literal, we need to reuse the path part from the segment if (i === 0 && isMatrixParams(commands[0])) { /** @type {?} */ var p = segmentGroup.segments[startIndex]; paths.push(new UrlSegment(p.path, commands[0])); i++; continue; } /** @type {?} */ var curr = getPath(commands[i]); /** @type {?} */ var next = i < commands.length - 1 ? commands[i + 1] : null; if (curr && next && isMatrixParams(next)) { paths.push(new UrlSegment(curr, stringify(next))); i += 2; } else { paths.push(new UrlSegment(curr, {})); i++; } } return new UrlSegmentGroup(paths, {}); } /** * @param {?} outlets * @return {?} */ function createNewSegmentChildren(outlets) { /** @type {?} */ var children = {}; forEach(outlets, /** * @param {?} commands * @param {?} outlet * @return {?} */ function (commands, outlet) { if (commands !== null) { children[outlet] = createNewSegmentGroup(new UrlSegmentGroup([], {}), 0, commands); } }); return children; } /** * @param {?} params * @return {?} */ function stringify(params) { /** @type {?} */ var res = {}; forEach(params, /** * @param {?} v * @param {?} k * @return {?} */ function (v, k) { return res[k] = "".concat(v); }); return res; } /** * @param {?} path * @param {?} params * @param {?} segment * @return {?} */ function compare(path, params, segment) { return path == segment.path && shallowEqual(params, segment.parameters); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var activateRoutes = /** * @param {?} rootContexts * @param {?} routeReuseStrategy * @param {?} forwardEvent * @return {?} */ function activateRoutes(rootContexts, routeReuseStrategy, forwardEvent) { return Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} t * @return {?} */ function (t) { new ActivateRoutes(routeReuseStrategy, /** @type {?} */ t.targetRouterState, t.currentRouterState, forwardEvent).activate(rootContexts); return t; }); }; var ActivateRoutes = /*#__PURE__*/function () { /** * @param {?} routeReuseStrategy * @param {?} futureState * @param {?} currState * @param {?} forwardEvent */ function ActivateRoutes(routeReuseStrategy, futureState, currState, forwardEvent) { _classCallCheck(this, ActivateRoutes); this.routeReuseStrategy = routeReuseStrategy; this.futureState = futureState; this.currState = currState; this.forwardEvent = forwardEvent; } /** * @param {?} parentContexts * @return {?} */ _createClass2(ActivateRoutes, [{ key: "activate", value: function activate(parentContexts) { /** @type {?} */ var futureRoot = this.futureState._root; /** @type {?} */ var currRoot = this.currState ? this.currState._root : null; this.deactivateChildRoutes(futureRoot, currRoot, parentContexts); advanceActivatedRoute(this.futureState.root); this.activateChildRoutes(futureRoot, currRoot, parentContexts); } // De-activate the child route that are not re-used for the future state /** * @private * @param {?} futureNode * @param {?} currNode * @param {?} contexts * @return {?} */ }, { key: "deactivateChildRoutes", value: function deactivateChildRoutes(futureNode, currNode, contexts) { var _this425 = this; /** @type {?} */ var children = nodeChildrenAsMap(currNode); // Recurse on the routes active in the future state to de-activate deeper children futureNode.children.forEach( /** * @param {?} futureChild * @return {?} */ function (futureChild) { /** @type {?} */ var childOutletName = futureChild.value.outlet; _this425.deactivateRoutes(futureChild, children[childOutletName], contexts); delete children[childOutletName]; }); // De-activate the routes that will not be re-used forEach(children, /** * @param {?} v * @param {?} childName * @return {?} */ function (v, childName) { _this425.deactivateRouteAndItsChildren(v, contexts); }); } /** * @private * @param {?} futureNode * @param {?} currNode * @param {?} parentContext * @return {?} */ }, { key: "deactivateRoutes", value: function deactivateRoutes(futureNode, currNode, parentContext) { /** @type {?} */ var future = futureNode.value; /** @type {?} */ var curr = currNode ? currNode.value : null; if (future === curr) { // Reusing the node, check to see if the children need to be de-activated if (future.component) { // If we have a normal route, we need to go through an outlet. /** @type {?} */ var context = parentContext.getContext(future.outlet); if (context) { this.deactivateChildRoutes(futureNode, currNode, context.children); } } else { // if we have a componentless route, we recurse but keep the same outlet map. this.deactivateChildRoutes(futureNode, currNode, parentContext); } } else { if (curr) { // Deactivate the current route which will not be re-used this.deactivateRouteAndItsChildren(currNode, parentContext); } } } /** * @private * @param {?} route * @param {?} parentContexts * @return {?} */ }, { key: "deactivateRouteAndItsChildren", value: function deactivateRouteAndItsChildren(route, parentContexts) { if (this.routeReuseStrategy.shouldDetach(route.value.snapshot)) { this.detachAndStoreRouteSubtree(route, parentContexts); } else { this.deactivateRouteAndOutlet(route, parentContexts); } } /** * @private * @param {?} route * @param {?} parentContexts * @return {?} */ }, { key: "detachAndStoreRouteSubtree", value: function detachAndStoreRouteSubtree(route, parentContexts) { /** @type {?} */ var context = parentContexts.getContext(route.value.outlet); if (context && context.outlet) { /** @type {?} */ var componentRef = context.outlet.detach(); /** @type {?} */ var contexts = context.children.onOutletDeactivated(); this.routeReuseStrategy.store(route.value.snapshot, { componentRef: componentRef, route: route, contexts: contexts }); } } /** * @private * @param {?} route * @param {?} parentContexts * @return {?} */ }, { key: "deactivateRouteAndOutlet", value: function deactivateRouteAndOutlet(route, parentContexts) { var _this426 = this; /** @type {?} */ var context = parentContexts.getContext(route.value.outlet); if (context) { /** @type {?} */ var children = nodeChildrenAsMap(route); /** @type {?} */ var contexts = route.value.component ? context.children : parentContexts; forEach(children, /** * @param {?} v * @param {?} k * @return {?} */ function (v, k) { return _this426.deactivateRouteAndItsChildren(v, contexts); }); if (context.outlet) { // Destroy the component context.outlet.deactivate(); // Destroy the contexts for all the outlets that were in the component context.children.onOutletDeactivated(); } } } /** * @private * @param {?} futureNode * @param {?} currNode * @param {?} contexts * @return {?} */ }, { key: "activateChildRoutes", value: function activateChildRoutes(futureNode, currNode, contexts) { var _this427 = this; /** @type {?} */ var children = nodeChildrenAsMap(currNode); futureNode.children.forEach( /** * @param {?} c * @return {?} */ function (c) { _this427.activateRoutes(c, children[c.value.outlet], contexts); _this427.forwardEvent(new ActivationEnd(c.value.snapshot)); }); if (futureNode.children.length) { this.forwardEvent(new ChildActivationEnd(futureNode.value.snapshot)); } } /** * @private * @param {?} futureNode * @param {?} currNode * @param {?} parentContexts * @return {?} */ }, { key: "activateRoutes", value: function activateRoutes(futureNode, currNode, parentContexts) { /** @type {?} */ var future = futureNode.value; /** @type {?} */ var curr = currNode ? currNode.value : null; advanceActivatedRoute(future); // reusing the node if (future === curr) { if (future.component) { // If we have a normal route, we need to go through an outlet. /** @type {?} */ var context = parentContexts.getOrCreateContext(future.outlet); this.activateChildRoutes(futureNode, currNode, context.children); } else { // if we have a componentless route, we recurse but keep the same outlet map. this.activateChildRoutes(futureNode, currNode, parentContexts); } } else { if (future.component) { // if we have a normal route, we need to place the component into the outlet and recurse. /** @type {?} */ var _context4 = parentContexts.getOrCreateContext(future.outlet); if (this.routeReuseStrategy.shouldAttach(future.snapshot)) { /** @type {?} */ var stored = /** @type {?} */ this.routeReuseStrategy.retrieve(future.snapshot); this.routeReuseStrategy.store(future.snapshot, null); _context4.children.onOutletReAttached(stored.contexts); _context4.attachRef = stored.componentRef; _context4.route = stored.route.value; if (_context4.outlet) { // Attach right away when the outlet has already been instantiated // Otherwise attach from `RouterOutlet.ngOnInit` when it is instantiated _context4.outlet.attach(stored.componentRef, stored.route.value); } advanceActivatedRouteNodeAndItsChildren(stored.route); } else { /** @type {?} */ var config = parentLoadedConfig(future.snapshot); /** @type {?} */ var cmpFactoryResolver = config ? config.module.componentFactoryResolver : null; _context4.attachRef = null; _context4.route = future; _context4.resolver = cmpFactoryResolver; if (_context4.outlet) { // Activate the outlet when it has already been instantiated // Otherwise it will get activated from its `ngOnInit` when instantiated _context4.outlet.activateWith(future, cmpFactoryResolver); } this.activateChildRoutes(futureNode, null, _context4.children); } } else { // if we have a componentless route, we recurse but keep the same outlet map. this.activateChildRoutes(futureNode, null, parentContexts); } } } }]); return ActivateRoutes; }(); if (false) {} /** * @param {?} node * @return {?} */ function advanceActivatedRouteNodeAndItsChildren(node) { advanceActivatedRoute(node.value); node.children.forEach(advanceActivatedRouteNodeAndItsChildren); } /** * @param {?} snapshot * @return {?} */ function parentLoadedConfig(snapshot) { for (var s = snapshot.parent; s; s = s.parent) { /** @type {?} */ var route = s.routeConfig; if (route && route._loadedConfig) return route._loadedConfig; if (route && route.component) return null; } return null; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Simple function check, but generic so type inference will flow. Example: * * function product(a: number, b: number) { * return a * b; * } * * if (isFunction<product>(fn)) { * return fn(1, 2); * } else { * throw "Must provide the `product` function"; * } * @template T * @param {?} v * @return {?} */ function isFunction(v) { return typeof v === 'function'; } /** * @param {?} v * @return {?} */ function isBoolean(v) { return typeof v === 'boolean'; } /** * @param {?} v * @return {?} */ function isUrlTree(v) { return v instanceof UrlTree; } /** * @param {?} guard * @return {?} */ function isCanLoad(guard) { return guard && isFunction(guard.canLoad); } /** * @param {?} guard * @return {?} */ function isCanActivate(guard) { return guard && isFunction(guard.canActivate); } /** * @param {?} guard * @return {?} */ function isCanActivateChild(guard) { return guard && isFunction(guard.canActivateChild); } /** * @template T * @param {?} guard * @return {?} */ function isCanDeactivate(guard) { return guard && isFunction(guard.canDeactivate); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NoMatch = /** * @param {?=} segmentGroup */ function NoMatch(segmentGroup) { _classCallCheck(this, NoMatch); this.segmentGroup = segmentGroup || null; }; if (false) {} var AbsoluteRedirect = /** * @param {?} urlTree */ function AbsoluteRedirect(urlTree) { _classCallCheck(this, AbsoluteRedirect); this.urlTree = urlTree; }; if (false) {} /** * @param {?} segmentGroup * @return {?} */ function noMatch(segmentGroup) { return new rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"]( /** * @param {?} obs * @return {?} */ function (obs) { return obs.error(new NoMatch(segmentGroup)); }); } /** * @param {?} newTree * @return {?} */ function absoluteRedirect(newTree) { return new rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"]( /** * @param {?} obs * @return {?} */ function (obs) { return obs.error(new AbsoluteRedirect(newTree)); }); } /** * @param {?} redirectTo * @return {?} */ function namedOutletsRedirect(redirectTo) { return new rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"]( /** * @param {?} obs * @return {?} */ function (obs) { return obs.error(new Error("Only absolute redirects can have named outlets. redirectTo: '".concat(redirectTo, "'"))); }); } /** * @param {?} route * @return {?} */ function canLoadFails(route) { return new rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"]( /** * @param {?} obs * @return {?} */ function (obs) { return obs.error(navigationCancelingError("Cannot load children because the guard of the route \"path: '".concat(route.path, "'\" returned false"))); }); } /** * Returns the `UrlTree` with the redirection applied. * * Lazy modules are loaded along the way. * @param {?} moduleInjector * @param {?} configLoader * @param {?} urlSerializer * @param {?} urlTree * @param {?} config * @return {?} */ function applyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config) { return new ApplyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config).apply(); } var ApplyRedirects = /*#__PURE__*/function () { /** * @param {?} moduleInjector * @param {?} configLoader * @param {?} urlSerializer * @param {?} urlTree * @param {?} config */ function ApplyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config) { _classCallCheck(this, ApplyRedirects); this.configLoader = configLoader; this.urlSerializer = urlSerializer; this.urlTree = urlTree; this.config = config; this.allowRedirects = true; this.ngModule = moduleInjector.get(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleRef"]); } /** * @return {?} */ _createClass2(ApplyRedirects, [{ key: "apply", value: function apply() { var _this428 = this; /** @type {?} */ var expanded$ = this.expandSegmentGroup(this.ngModule, this.config, this.urlTree.root, PRIMARY_OUTLET); /** @type {?} */ var urlTrees$ = expanded$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} rootSegmentGroup * @return {?} */ function (rootSegmentGroup) { return _this428.createUrlTree(rootSegmentGroup, _this428.urlTree.queryParams, /** @type {?} */ _this428.urlTree.fragment); })); return urlTrees$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["catchError"])( /** * @param {?} e * @return {?} */ function (e) { if (e instanceof AbsoluteRedirect) { // after an absolute redirect we do not apply any more redirects! _this428.allowRedirects = false; // we need to run matching, so we can fetch all lazy-loaded modules return _this428.match(e.urlTree); } if (e instanceof NoMatch) { throw _this428.noMatchError(e); } throw e; })); } /** * @private * @param {?} tree * @return {?} */ }, { key: "match", value: function match(tree) { var _this429 = this; /** @type {?} */ var expanded$ = this.expandSegmentGroup(this.ngModule, this.config, tree.root, PRIMARY_OUTLET); /** @type {?} */ var mapped$ = expanded$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} rootSegmentGroup * @return {?} */ function (rootSegmentGroup) { return _this429.createUrlTree(rootSegmentGroup, tree.queryParams, /** @type {?} */ tree.fragment); })); return mapped$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["catchError"])( /** * @param {?} e * @return {?} */ function (e) { if (e instanceof NoMatch) { throw _this429.noMatchError(e); } throw e; })); } /** * @private * @param {?} e * @return {?} */ }, { key: "noMatchError", value: function noMatchError(e) { return new Error("Cannot match any routes. URL Segment: '".concat(e.segmentGroup, "'")); } /** * @private * @param {?} rootCandidate * @param {?} queryParams * @param {?} fragment * @return {?} */ }, { key: "createUrlTree", value: function createUrlTree(rootCandidate, queryParams, fragment) { /** @type {?} */ var root = rootCandidate.segments.length > 0 ? new UrlSegmentGroup([], _defineProperty({}, PRIMARY_OUTLET, rootCandidate)) : rootCandidate; return new UrlTree(root, queryParams, fragment); } /** * @private * @param {?} ngModule * @param {?} routes * @param {?} segmentGroup * @param {?} outlet * @return {?} */ }, { key: "expandSegmentGroup", value: function expandSegmentGroup(ngModule, routes, segmentGroup, outlet) { if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) { return this.expandChildren(ngModule, routes, segmentGroup).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} children * @return {?} */ function (children) { return new UrlSegmentGroup([], children); })); } return this.expandSegment(ngModule, segmentGroup, routes, segmentGroup.segments, outlet, true); } // Recursively expand segment groups for all the child outlets /** * @private * @param {?} ngModule * @param {?} routes * @param {?} segmentGroup * @return {?} */ }, { key: "expandChildren", value: function expandChildren(ngModule, routes, segmentGroup) { var _this430 = this; return waitForMap(segmentGroup.children, /** * @param {?} childOutlet * @param {?} child * @return {?} */ function (childOutlet, child) { return _this430.expandSegmentGroup(ngModule, routes, child, childOutlet); }); } /** * @private * @param {?} ngModule * @param {?} segmentGroup * @param {?} routes * @param {?} segments * @param {?} outlet * @param {?} allowRedirects * @return {?} */ }, { key: "expandSegment", value: function expandSegment(ngModule, segmentGroup, routes, segments, outlet, allowRedirects) { var _this431 = this; return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"]).apply(void 0, _toConsumableArray(routes)).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} r * @return {?} */ function (r) { /** @type {?} */ var expanded$ = _this431.expandSegmentAgainstRoute(ngModule, segmentGroup, routes, r, segments, outlet, allowRedirects); return expanded$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["catchError"])( /** * @param {?} e * @return {?} */ function (e) { if (e instanceof NoMatch) { // TODO(i): this return type doesn't match the declared Observable<UrlSegmentGroup> - // talk to Jason return ( /** @type {?} */ Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(null) ); } throw e; })); }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["concatAll"])(), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["first"])( /** * @param {?} s * @return {?} */ function (s) { return !!s; }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["catchError"])( /** * @param {?} e * @param {?} _ * @return {?} */ function (e, _) { if (e instanceof rxjs__WEBPACK_IMPORTED_MODULE_2__["EmptyError"] || e.name === 'EmptyError') { if (_this431.noLeftoversInUrl(segmentGroup, segments, outlet)) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(new UrlSegmentGroup([], {})); } throw new NoMatch(segmentGroup); } throw e; })); } /** * @private * @param {?} segmentGroup * @param {?} segments * @param {?} outlet * @return {?} */ }, { key: "noLeftoversInUrl", value: function noLeftoversInUrl(segmentGroup, segments, outlet) { return segments.length === 0 && !segmentGroup.children[outlet]; } /** * @private * @param {?} ngModule * @param {?} segmentGroup * @param {?} routes * @param {?} route * @param {?} paths * @param {?} outlet * @param {?} allowRedirects * @return {?} */ }, { key: "expandSegmentAgainstRoute", value: function expandSegmentAgainstRoute(ngModule, segmentGroup, routes, route, paths, outlet, allowRedirects) { if (getOutlet(route) !== outlet) { return noMatch(segmentGroup); } if (route.redirectTo === undefined) { return this.matchSegmentAgainstRoute(ngModule, segmentGroup, route, paths); } if (allowRedirects && this.allowRedirects) { return this.expandSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, paths, outlet); } return noMatch(segmentGroup); } /** * @private * @param {?} ngModule * @param {?} segmentGroup * @param {?} routes * @param {?} route * @param {?} segments * @param {?} outlet * @return {?} */ }, { key: "expandSegmentAgainstRouteUsingRedirect", value: function expandSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, segments, outlet) { if (route.path === '**') { return this.expandWildCardWithParamsAgainstRouteUsingRedirect(ngModule, routes, route, outlet); } return this.expandRegularSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, segments, outlet); } /** * @private * @param {?} ngModule * @param {?} routes * @param {?} route * @param {?} outlet * @return {?} */ }, { key: "expandWildCardWithParamsAgainstRouteUsingRedirect", value: function expandWildCardWithParamsAgainstRouteUsingRedirect(ngModule, routes, route, outlet) { var _this432 = this; /** @type {?} */ var newTree = this.applyRedirectCommands([], /** @type {?} */ route.redirectTo, {}); if ( /** @type {?} */ route.redirectTo.startsWith('/')) { return absoluteRedirect(newTree); } return this.lineralizeSegments(route, newTree).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])( /** * @param {?} newSegments * @return {?} */ function (newSegments) { /** @type {?} */ var group = new UrlSegmentGroup(newSegments, {}); return _this432.expandSegment(ngModule, group, routes, newSegments, outlet, false); })); } /** * @private * @param {?} ngModule * @param {?} segmentGroup * @param {?} routes * @param {?} route * @param {?} segments * @param {?} outlet * @return {?} */ }, { key: "expandRegularSegmentAgainstRouteUsingRedirect", value: function expandRegularSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, segments, outlet) { var _this433 = this; var _match = match(segmentGroup, route, segments), matched = _match.matched, consumedSegments = _match.consumedSegments, lastChild = _match.lastChild, positionalParamSegments = _match.positionalParamSegments; if (!matched) return noMatch(segmentGroup); /** @type {?} */ var newTree = this.applyRedirectCommands(consumedSegments, /** @type {?} */ route.redirectTo, /** @type {?} */ positionalParamSegments); if ( /** @type {?} */ route.redirectTo.startsWith('/')) { return absoluteRedirect(newTree); } return this.lineralizeSegments(route, newTree).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])( /** * @param {?} newSegments * @return {?} */ function (newSegments) { return _this433.expandSegment(ngModule, segmentGroup, routes, newSegments.concat(segments.slice(lastChild)), outlet, false); })); } /** * @private * @param {?} ngModule * @param {?} rawSegmentGroup * @param {?} route * @param {?} segments * @return {?} */ }, { key: "matchSegmentAgainstRoute", value: function matchSegmentAgainstRoute(ngModule, rawSegmentGroup, route, segments) { var _this434 = this; if (route.path === '**') { if (route.loadChildren) { return this.configLoader.load(ngModule.injector, route).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} cfg * @return {?} */ function (cfg) { route._loadedConfig = cfg; return new UrlSegmentGroup(segments, {}); })); } return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(new UrlSegmentGroup(segments, {})); } var _match2 = match(rawSegmentGroup, route, segments), matched = _match2.matched, consumedSegments = _match2.consumedSegments, lastChild = _match2.lastChild; if (!matched) return noMatch(rawSegmentGroup); /** @type {?} */ var rawSlicedSegments = segments.slice(lastChild); /** @type {?} */ var childConfig$ = this.getChildConfig(ngModule, route, segments); return childConfig$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])( /** * @param {?} routerConfig * @return {?} */ function (routerConfig) { /** @type {?} */ var childModule = routerConfig.module; /** @type {?} */ var childConfig = routerConfig.routes; var _split2 = split(rawSegmentGroup, consumedSegments, rawSlicedSegments, childConfig), segmentGroup = _split2.segmentGroup, slicedSegments = _split2.slicedSegments; if (slicedSegments.length === 0 && segmentGroup.hasChildren()) { /** @type {?} */ var _expanded$ = _this434.expandChildren(childModule, childConfig, segmentGroup); return _expanded$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} children * @return {?} */ function (children) { return new UrlSegmentGroup(consumedSegments, children); })); } if (childConfig.length === 0 && slicedSegments.length === 0) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(new UrlSegmentGroup(consumedSegments, {})); } /** @type {?} */ var expanded$ = _this434.expandSegment(childModule, segmentGroup, childConfig, slicedSegments, PRIMARY_OUTLET, true); return expanded$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} cs * @return {?} */ function (cs) { return new UrlSegmentGroup(consumedSegments.concat(cs.segments), cs.children); })); })); } /** * @private * @param {?} ngModule * @param {?} route * @param {?} segments * @return {?} */ }, { key: "getChildConfig", value: function getChildConfig(ngModule, route, segments) { var _this435 = this; if (route.children) { // The children belong to the same module return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(new LoadedRouterConfig(route.children, ngModule)); } if (route.loadChildren) { // lazy children belong to the loaded module if (route._loadedConfig !== undefined) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(route._loadedConfig); } return runCanLoadGuard(ngModule.injector, route, segments).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])( /** * @param {?} shouldLoad * @return {?} */ function (shouldLoad) { if (shouldLoad) { return _this435.configLoader.load(ngModule.injector, route).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} cfg * @return {?} */ function (cfg) { route._loadedConfig = cfg; return cfg; })); } return canLoadFails(route); })); } return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(new LoadedRouterConfig([], ngModule)); } /** * @private * @param {?} route * @param {?} urlTree * @return {?} */ }, { key: "lineralizeSegments", value: function lineralizeSegments(route, urlTree) { /** @type {?} */ var res = []; /** @type {?} */ var c = urlTree.root; while (true) { res = res.concat(c.segments); if (c.numberOfChildren === 0) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(res); } if (c.numberOfChildren > 1 || !c.children[PRIMARY_OUTLET]) { return namedOutletsRedirect( /** @type {?} */ route.redirectTo); } c = c.children[PRIMARY_OUTLET]; } } /** * @private * @param {?} segments * @param {?} redirectTo * @param {?} posParams * @return {?} */ }, { key: "applyRedirectCommands", value: function applyRedirectCommands(segments, redirectTo, posParams) { return this.applyRedirectCreatreUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams); } /** * @private * @param {?} redirectTo * @param {?} urlTree * @param {?} segments * @param {?} posParams * @return {?} */ }, { key: "applyRedirectCreatreUrlTree", value: function applyRedirectCreatreUrlTree(redirectTo, urlTree, segments, posParams) { /** @type {?} */ var newRoot = this.createSegmentGroup(redirectTo, urlTree.root, segments, posParams); return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment); } /** * @private * @param {?} redirectToParams * @param {?} actualParams * @return {?} */ }, { key: "createQueryParams", value: function createQueryParams(redirectToParams, actualParams) { /** @type {?} */ var res = {}; forEach(redirectToParams, /** * @param {?} v * @param {?} k * @return {?} */ function (v, k) { /** @type {?} */ var copySourceValue = typeof v === 'string' && v.startsWith(':'); if (copySourceValue) { /** @type {?} */ var sourceName = v.substring(1); res[k] = actualParams[sourceName]; } else { res[k] = v; } }); return res; } /** * @private * @param {?} redirectTo * @param {?} group * @param {?} segments * @param {?} posParams * @return {?} */ }, { key: "createSegmentGroup", value: function createSegmentGroup(redirectTo, group, segments, posParams) { var _this436 = this; /** @type {?} */ var updatedSegments = this.createSegments(redirectTo, group.segments, segments, posParams); /** @type {?} */ var children = {}; forEach(group.children, /** * @param {?} child * @param {?} name * @return {?} */ function (child, name) { children[name] = _this436.createSegmentGroup(redirectTo, child, segments, posParams); }); return new UrlSegmentGroup(updatedSegments, children); } /** * @private * @param {?} redirectTo * @param {?} redirectToSegments * @param {?} actualSegments * @param {?} posParams * @return {?} */ }, { key: "createSegments", value: function createSegments(redirectTo, redirectToSegments, actualSegments, posParams) { var _this437 = this; return redirectToSegments.map( /** * @param {?} s * @return {?} */ function (s) { return s.path.startsWith(':') ? _this437.findPosParam(redirectTo, s, posParams) : _this437.findOrReturn(s, actualSegments); }); } /** * @private * @param {?} redirectTo * @param {?} redirectToUrlSegment * @param {?} posParams * @return {?} */ }, { key: "findPosParam", value: function findPosParam(redirectTo, redirectToUrlSegment, posParams) { /** @type {?} */ var pos = posParams[redirectToUrlSegment.path.substring(1)]; if (!pos) throw new Error("Cannot redirect to '".concat(redirectTo, "'. Cannot find '").concat(redirectToUrlSegment.path, "'.")); return pos; } /** * @private * @param {?} redirectToUrlSegment * @param {?} actualSegments * @return {?} */ }, { key: "findOrReturn", value: function findOrReturn(redirectToUrlSegment, actualSegments) { /** @type {?} */ var idx = 0; var _iterator49 = _createForOfIteratorHelper(actualSegments), _step49; try { for (_iterator49.s(); !(_step49 = _iterator49.n()).done;) { var s = _step49.value; if (s.path === redirectToUrlSegment.path) { actualSegments.splice(idx); return s; } idx++; } } catch (err) { _iterator49.e(err); } finally { _iterator49.f(); } return redirectToUrlSegment; } }]); return ApplyRedirects; }(); if (false) {} /** * @param {?} moduleInjector * @param {?} route * @param {?} segments * @return {?} */ function runCanLoadGuard(moduleInjector, route, segments) { /** @type {?} */ var canLoad = route.canLoad; if (!canLoad || canLoad.length === 0) return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(true); /** @type {?} */ var obs = Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(canLoad).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} injectionToken * @return {?} */ function (injectionToken) { /** @type {?} */ var guard = moduleInjector.get(injectionToken); /** @type {?} */ var guardVal; if (isCanLoad(guard)) { guardVal = guard.canLoad(route, segments); } else if (isFunction(guard)) { guardVal = guard(route, segments); } else { throw new Error('Invalid CanLoad guard'); } return wrapIntoObservable(guardVal); })); return obs.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["concatAll"])(), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["every"])( /** * @param {?} result * @return {?} */ function (result) { return result === true; })); } /** * @param {?} segmentGroup * @param {?} route * @param {?} segments * @return {?} */ function match(segmentGroup, route, segments) { if (route.path === '') { if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || segments.length > 0)) { return { matched: false, consumedSegments: [], lastChild: 0, positionalParamSegments: {} }; } return { matched: true, consumedSegments: [], lastChild: 0, positionalParamSegments: {} }; } /** @type {?} */ var matcher = route.matcher || defaultUrlMatcher; /** @type {?} */ var res = matcher(segments, segmentGroup, route); if (!res) { return { matched: false, consumedSegments: /** @type {?} */ [], lastChild: 0, positionalParamSegments: {} }; } return { matched: true, consumedSegments: /** @type {?} */ res.consumed, lastChild: /** @type {?} */ res.consumed.length, positionalParamSegments: /** @type {?} */ res.posParams }; } /** * @param {?} segmentGroup * @param {?} consumedSegments * @param {?} slicedSegments * @param {?} config * @return {?} */ function split(segmentGroup, consumedSegments, slicedSegments, config) { if (slicedSegments.length > 0 && containsEmptyPathRedirectsWithNamedOutlets(segmentGroup, slicedSegments, config)) { /** @type {?} */ var s = new UrlSegmentGroup(consumedSegments, createChildrenForEmptySegments(config, new UrlSegmentGroup(slicedSegments, segmentGroup.children))); return { segmentGroup: mergeTrivialChildren(s), slicedSegments: [] }; } if (slicedSegments.length === 0 && containsEmptyPathRedirects(segmentGroup, slicedSegments, config)) { /** @type {?} */ var _s2 = new UrlSegmentGroup(segmentGroup.segments, addEmptySegmentsToChildrenIfNeeded(segmentGroup, slicedSegments, config, segmentGroup.children)); return { segmentGroup: mergeTrivialChildren(_s2), slicedSegments: slicedSegments }; } return { segmentGroup: segmentGroup, slicedSegments: slicedSegments }; } /** * @param {?} s * @return {?} */ function mergeTrivialChildren(s) { if (s.numberOfChildren === 1 && s.children[PRIMARY_OUTLET]) { /** @type {?} */ var c = s.children[PRIMARY_OUTLET]; return new UrlSegmentGroup(s.segments.concat(c.segments), c.children); } return s; } /** * @param {?} segmentGroup * @param {?} slicedSegments * @param {?} routes * @param {?} children * @return {?} */ function addEmptySegmentsToChildrenIfNeeded(segmentGroup, slicedSegments, routes, children) { /** @type {?} */ var res = {}; var _iterator50 = _createForOfIteratorHelper(routes), _step50; try { for (_iterator50.s(); !(_step50 = _iterator50.n()).done;) { var r = _step50.value; if (isEmptyPathRedirect(segmentGroup, slicedSegments, r) && !children[getOutlet(r)]) { res[getOutlet(r)] = new UrlSegmentGroup([], {}); } } } catch (err) { _iterator50.e(err); } finally { _iterator50.f(); } return Object.assign({}, children, res); } /** * @param {?} routes * @param {?} primarySegmentGroup * @return {?} */ function createChildrenForEmptySegments(routes, primarySegmentGroup) { /** @type {?} */ var res = {}; res[PRIMARY_OUTLET] = primarySegmentGroup; var _iterator51 = _createForOfIteratorHelper(routes), _step51; try { for (_iterator51.s(); !(_step51 = _iterator51.n()).done;) { var r = _step51.value; if (r.path === '' && getOutlet(r) !== PRIMARY_OUTLET) { res[getOutlet(r)] = new UrlSegmentGroup([], {}); } } } catch (err) { _iterator51.e(err); } finally { _iterator51.f(); } return res; } /** * @param {?} segmentGroup * @param {?} segments * @param {?} routes * @return {?} */ function containsEmptyPathRedirectsWithNamedOutlets(segmentGroup, segments, routes) { return routes.some( /** * @param {?} r * @return {?} */ function (r) { return isEmptyPathRedirect(segmentGroup, segments, r) && getOutlet(r) !== PRIMARY_OUTLET; }); } /** * @param {?} segmentGroup * @param {?} segments * @param {?} routes * @return {?} */ function containsEmptyPathRedirects(segmentGroup, segments, routes) { return routes.some( /** * @param {?} r * @return {?} */ function (r) { return isEmptyPathRedirect(segmentGroup, segments, r); }); } /** * @param {?} segmentGroup * @param {?} segments * @param {?} r * @return {?} */ function isEmptyPathRedirect(segmentGroup, segments, r) { if ((segmentGroup.hasChildren() || segments.length > 0) && r.pathMatch === 'full') { return false; } return r.path === '' && r.redirectTo !== undefined; } /** * @param {?} route * @return {?} */ function getOutlet(route) { return route.outlet || PRIMARY_OUTLET; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} moduleInjector * @param {?} configLoader * @param {?} urlSerializer * @param {?} config * @return {?} */ function applyRedirects$1(moduleInjector, configLoader, urlSerializer, config) { return ( /** * @param {?} source * @return {?} */ function (source) { return source.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["switchMap"])( /** * @param {?} t * @return {?} */ function (t) { return applyRedirects(moduleInjector, configLoader, urlSerializer, t.extractedUrl, config).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} urlAfterRedirects * @return {?} */ function (urlAfterRedirects) { return Object.assign({}, t, { urlAfterRedirects: urlAfterRedirects }); })); })); } ); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var CanActivate = /** * @param {?} path */ function CanActivate(path) { _classCallCheck(this, CanActivate); this.path = path; this.route = this.path[this.path.length - 1]; }; if (false) {} var CanDeactivate = /** * @param {?} component * @param {?} route */ function CanDeactivate(component, route) { _classCallCheck(this, CanDeactivate); this.component = component; this.route = route; }; if (false) {} /** * @param {?} future * @param {?} curr * @param {?} parentContexts * @return {?} */ function getAllRouteGuards(future, curr, parentContexts) { /** @type {?} */ var futureRoot = future._root; /** @type {?} */ var currRoot = curr ? curr._root : null; return getChildRouteGuards(futureRoot, currRoot, parentContexts, [futureRoot.value]); } /** * @param {?} p * @return {?} */ function getCanActivateChild(p) { /** @type {?} */ var canActivateChild = p.routeConfig ? p.routeConfig.canActivateChild : null; if (!canActivateChild || canActivateChild.length === 0) return null; return { node: p, guards: canActivateChild }; } /** * @param {?} token * @param {?} snapshot * @param {?} moduleInjector * @return {?} */ function getToken(token, snapshot, moduleInjector) { /** @type {?} */ var config = getClosestLoadedConfig(snapshot); /** @type {?} */ var injector = config ? config.module.injector : moduleInjector; return injector.get(token); } /** * @param {?} snapshot * @return {?} */ function getClosestLoadedConfig(snapshot) { if (!snapshot) return null; for (var s = snapshot.parent; s; s = s.parent) { /** @type {?} */ var route = s.routeConfig; if (route && route._loadedConfig) return route._loadedConfig; } return null; } /** * @param {?} futureNode * @param {?} currNode * @param {?} contexts * @param {?} futurePath * @param {?=} checks * @return {?} */ function getChildRouteGuards(futureNode, currNode, contexts, futurePath) { var checks = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : { canDeactivateChecks: [], canActivateChecks: [] }; /** @type {?} */ var prevChildren = nodeChildrenAsMap(currNode); // Process the children of the future route futureNode.children.forEach( /** * @param {?} c * @return {?} */ function (c) { getRouteGuards(c, prevChildren[c.value.outlet], contexts, futurePath.concat([c.value]), checks); delete prevChildren[c.value.outlet]; }); // Process any children left from the current route (not active for the future route) forEach(prevChildren, /** * @param {?} v * @param {?} k * @return {?} */ function (v, k) { return deactivateRouteAndItsChildren(v, /** @type {?} */ contexts.getContext(k), checks); }); return checks; } /** * @param {?} futureNode * @param {?} currNode * @param {?} parentContexts * @param {?} futurePath * @param {?=} checks * @return {?} */ function getRouteGuards(futureNode, currNode, parentContexts, futurePath) { var checks = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : { canDeactivateChecks: [], canActivateChecks: [] }; /** @type {?} */ var future = futureNode.value; /** @type {?} */ var curr = currNode ? currNode.value : null; /** @type {?} */ var context = parentContexts ? parentContexts.getContext(futureNode.value.outlet) : null; // reusing the node if (curr && future.routeConfig === curr.routeConfig) { /** @type {?} */ var shouldRun = shouldRunGuardsAndResolvers(curr, future, /** @type {?} */ future.routeConfig.runGuardsAndResolvers); if (shouldRun) { checks.canActivateChecks.push(new CanActivate(futurePath)); } else { // we need to set the data future.data = curr.data; future._resolvedData = curr._resolvedData; } // If we have a component, we need to go through an outlet. if (future.component) { getChildRouteGuards(futureNode, currNode, context ? context.children : null, futurePath, checks); // if we have a componentless route, we recurse but keep the same outlet map. } else { getChildRouteGuards(futureNode, currNode, parentContexts, futurePath, checks); } if (shouldRun) { /** @type {?} */ var component = context && context.outlet && context.outlet.component || null; checks.canDeactivateChecks.push(new CanDeactivate(component, curr)); } } else { if (curr) { deactivateRouteAndItsChildren(currNode, context, checks); } checks.canActivateChecks.push(new CanActivate(futurePath)); // If we have a component, we need to go through an outlet. if (future.component) { getChildRouteGuards(futureNode, null, context ? context.children : null, futurePath, checks); // if we have a componentless route, we recurse but keep the same outlet map. } else { getChildRouteGuards(futureNode, null, parentContexts, futurePath, checks); } } return checks; } /** * @param {?} curr * @param {?} future * @param {?} mode * @return {?} */ function shouldRunGuardsAndResolvers(curr, future, mode) { if (typeof mode === 'function') { return mode(curr, future); } switch (mode) { case 'pathParamsChange': return !equalPath(curr.url, future.url); case 'pathParamsOrQueryParamsChange': return !equalPath(curr.url, future.url) || !shallowEqual(curr.queryParams, future.queryParams); case 'always': return true; case 'paramsOrQueryParamsChange': return !equalParamsAndUrlSegments(curr, future) || !shallowEqual(curr.queryParams, future.queryParams); case 'paramsChange': default: return !equalParamsAndUrlSegments(curr, future); } } /** * @param {?} route * @param {?} context * @param {?} checks * @return {?} */ function deactivateRouteAndItsChildren(route, context, checks) { /** @type {?} */ var children = nodeChildrenAsMap(route); /** @type {?} */ var r = route.value; forEach(children, /** * @param {?} node * @param {?} childName * @return {?} */ function (node, childName) { if (!r.component) { deactivateRouteAndItsChildren(node, context, checks); } else if (context) { deactivateRouteAndItsChildren(node, context.children.getContext(childName), checks); } else { deactivateRouteAndItsChildren(node, null, checks); } }); if (!r.component) { checks.canDeactivateChecks.push(new CanDeactivate(null, r)); } else if (context && context.outlet && context.outlet.isActivated) { checks.canDeactivateChecks.push(new CanDeactivate(context.outlet.component, r)); } else { checks.canDeactivateChecks.push(new CanDeactivate(null, r)); } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** @type {?} */ var INITIAL_VALUE = Symbol('INITIAL_VALUE'); /** * @return {?} */ function prioritizedGuardValue() { return Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["switchMap"])( /** * @param {?} obs * @return {?} */ function (obs) { return ( /** @type {?} */ Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["combineLatest"]).apply(void 0, _toConsumableArray(obs.map( /** * @param {?} o * @return {?} */ function (o) { return o.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["take"])(1), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["startWith"])( /** @type {?} */ INITIAL_VALUE)); }))).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["scan"])( /** * @param {?} acc * @param {?} list * @return {?} */ function (acc, list) { /** @type {?} */ var isPending = false; return list.reduce( /** * @param {?} innerAcc * @param {?} val * @param {?} i * @return {?} */ function (innerAcc, val, i) { if (innerAcc !== INITIAL_VALUE) return innerAcc; // Toggle pending flag if any values haven't been set yet if (val === INITIAL_VALUE) isPending = true; // Any other return values are only valid if we haven't yet hit a pending call. // This guarantees that in the case of a guard at the bottom of the tree that // returns a redirect, we will wait for the higher priority guard at the top to // finish before performing the redirect. if (!isPending) { // Early return when we hit a `false` value as that should always cancel // navigation if (val === false) return val; if (i === list.length - 1 || isUrlTree(val)) { return val; } } return innerAcc; }, acc); }, INITIAL_VALUE), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["filter"])( /** * @param {?} item * @return {?} */ function (item) { return item !== INITIAL_VALUE; }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} item * @return {?} */ function (item) { return isUrlTree(item) ? item : item === true; }), // Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["take"])(1)) ); }); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} moduleInjector * @param {?=} forwardEvent * @return {?} */ function checkGuards(moduleInjector, forwardEvent) { return ( /** * @param {?} source * @return {?} */ function (source) { return source.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])( /** * @param {?} t * @return {?} */ function (t) { var targetSnapshot = t.targetSnapshot, currentSnapshot = t.currentSnapshot, _t$guards = t.guards, canActivateChecks = _t$guards.canActivateChecks, canDeactivateChecks = _t$guards.canDeactivateChecks; if (canDeactivateChecks.length === 0 && canActivateChecks.length === 0) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(Object.assign({}, t, { guardsResult: true })); } return runCanDeactivateChecks(canDeactivateChecks, /** @type {?} */ targetSnapshot, currentSnapshot, moduleInjector).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])( /** * @param {?} canDeactivate * @return {?} */ function (canDeactivate) { return canDeactivate && isBoolean(canDeactivate) ? runCanActivateChecks( /** @type {?} */ targetSnapshot, canActivateChecks, moduleInjector, forwardEvent) : Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(canDeactivate); }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} guardsResult * @return {?} */ function (guardsResult) { return Object.assign({}, t, { guardsResult: guardsResult }); })); })); } ); } /** * @param {?} checks * @param {?} futureRSS * @param {?} currRSS * @param {?} moduleInjector * @return {?} */ function runCanDeactivateChecks(checks, futureRSS, currRSS, moduleInjector) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(checks).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])( /** * @param {?} check * @return {?} */ function (check) { return runCanDeactivate(check.component, check.route, currRSS, futureRSS, moduleInjector); }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["first"])( /** * @param {?} result * @return {?} */ function (result) { return result !== true; }, /** @type {?} */ true)); } /** * @param {?} futureSnapshot * @param {?} checks * @param {?} moduleInjector * @param {?=} forwardEvent * @return {?} */ function runCanActivateChecks(futureSnapshot, checks, moduleInjector, forwardEvent) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(checks).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["concatMap"])( /** * @param {?} check * @return {?} */ function (check) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])([fireChildActivationStart(check.route.parent, forwardEvent), fireActivationStart(check.route, forwardEvent), runCanActivateChild(futureSnapshot, check.path, moduleInjector), runCanActivate(futureSnapshot, check.route, moduleInjector)]).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["concatAll"])(), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["first"])( /** * @param {?} result * @return {?} */ function (result) { return result !== true; }, /** @type {?} */ true)); }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["first"])( /** * @param {?} result * @return {?} */ function (result) { return result !== true; }, /** @type {?} */ true)); } /** * This should fire off `ActivationStart` events for each route being activated at this * level. * In other words, if you're activating `a` and `b` below, `path` will contain the * `ActivatedRouteSnapshot`s for both and we will fire `ActivationStart` for both. Always * return * `true` so checks continue to run. * @param {?} snapshot * @param {?=} forwardEvent * @return {?} */ function fireActivationStart(snapshot, forwardEvent) { if (snapshot !== null && forwardEvent) { forwardEvent(new ActivationStart(snapshot)); } return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(true); } /** * This should fire off `ChildActivationStart` events for each route being activated at this * level. * In other words, if you're activating `a` and `b` below, `path` will contain the * `ActivatedRouteSnapshot`s for both and we will fire `ChildActivationStart` for both. Always * return * `true` so checks continue to run. * @param {?} snapshot * @param {?=} forwardEvent * @return {?} */ function fireChildActivationStart(snapshot, forwardEvent) { if (snapshot !== null && forwardEvent) { forwardEvent(new ChildActivationStart(snapshot)); } return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(true); } /** * @param {?} futureRSS * @param {?} futureARS * @param {?} moduleInjector * @return {?} */ function runCanActivate(futureRSS, futureARS, moduleInjector) { /** @type {?} */ var canActivate = futureARS.routeConfig ? futureARS.routeConfig.canActivate : null; if (!canActivate || canActivate.length === 0) return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(true); /** @type {?} */ var canActivateObservables = canActivate.map( /** * @param {?} c * @return {?} */ function (c) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["defer"])( /** * @return {?} */ function () { /** @type {?} */ var guard = getToken(c, futureARS, moduleInjector); /** @type {?} */ var observable; if (isCanActivate(guard)) { observable = wrapIntoObservable(guard.canActivate(futureARS, futureRSS)); } else if (isFunction(guard)) { observable = wrapIntoObservable(guard(futureARS, futureRSS)); } else { throw new Error('Invalid CanActivate guard'); } return observable.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["first"])()); }); }); return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(canActivateObservables).pipe(prioritizedGuardValue()); } /** * @param {?} futureRSS * @param {?} path * @param {?} moduleInjector * @return {?} */ function runCanActivateChild(futureRSS, path, moduleInjector) { /** @type {?} */ var futureARS = path[path.length - 1]; /** @type {?} */ var canActivateChildGuards = path.slice(0, path.length - 1).reverse().map( /** * @param {?} p * @return {?} */ function (p) { return getCanActivateChild(p); }).filter( /** * @param {?} _ * @return {?} */ function (_) { return _ !== null; }); /** @type {?} */ var canActivateChildGuardsMapped = canActivateChildGuards.map( /** * @param {?} d * @return {?} */ function (d) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["defer"])( /** * @return {?} */ function () { /** @type {?} */ var guardsMapped = d.guards.map( /** * @param {?} c * @return {?} */ function (c) { /** @type {?} */ var guard = getToken(c, d.node, moduleInjector); /** @type {?} */ var observable; if (isCanActivateChild(guard)) { observable = wrapIntoObservable(guard.canActivateChild(futureARS, futureRSS)); } else if (isFunction(guard)) { observable = wrapIntoObservable(guard(futureARS, futureRSS)); } else { throw new Error('Invalid CanActivateChild guard'); } return observable.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["first"])()); }); return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(guardsMapped).pipe(prioritizedGuardValue()); }); }); return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(canActivateChildGuardsMapped).pipe(prioritizedGuardValue()); } /** * @param {?} component * @param {?} currARS * @param {?} currRSS * @param {?} futureRSS * @param {?} moduleInjector * @return {?} */ function runCanDeactivate(component, currARS, currRSS, futureRSS, moduleInjector) { /** @type {?} */ var canDeactivate = currARS && currARS.routeConfig ? currARS.routeConfig.canDeactivate : null; if (!canDeactivate || canDeactivate.length === 0) return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(true); /** @type {?} */ var canDeactivateObservables = canDeactivate.map( /** * @param {?} c * @return {?} */ function (c) { /** @type {?} */ var guard = getToken(c, currARS, moduleInjector); /** @type {?} */ var observable; if (isCanDeactivate(guard)) { observable = wrapIntoObservable(guard.canDeactivate( /** @type {?} */ component, currARS, currRSS, futureRSS)); } else if (isFunction(guard)) { observable = wrapIntoObservable(guard(component, currARS, currRSS, futureRSS)); } else { throw new Error('Invalid CanDeactivate guard'); } return observable.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["first"])()); }); return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(canDeactivateObservables).pipe(prioritizedGuardValue()); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var NoMatch$1 = function NoMatch$1() { _classCallCheck(this, NoMatch$1); }; /** * @param {?} rootComponentType * @param {?} config * @param {?} urlTree * @param {?} url * @param {?=} paramsInheritanceStrategy * @param {?=} relativeLinkResolution * @return {?} */ function recognize(rootComponentType, config, urlTree, url) { var paramsInheritanceStrategy = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'emptyOnly'; var relativeLinkResolution = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 'legacy'; return new Recognizer(rootComponentType, config, urlTree, url, paramsInheritanceStrategy, relativeLinkResolution).recognize(); } var Recognizer = /*#__PURE__*/function () { /** * @param {?} rootComponentType * @param {?} config * @param {?} urlTree * @param {?} url * @param {?} paramsInheritanceStrategy * @param {?} relativeLinkResolution */ function Recognizer(rootComponentType, config, urlTree, url, paramsInheritanceStrategy, relativeLinkResolution) { _classCallCheck(this, Recognizer); this.rootComponentType = rootComponentType; this.config = config; this.urlTree = urlTree; this.url = url; this.paramsInheritanceStrategy = paramsInheritanceStrategy; this.relativeLinkResolution = relativeLinkResolution; } /** * @return {?} */ _createClass2(Recognizer, [{ key: "recognize", value: function recognize() { try { /** @type {?} */ var rootSegmentGroup = split$1(this.urlTree.root, [], [], this.config, this.relativeLinkResolution).segmentGroup; /** @type {?} */ var children = this.processSegmentGroup(this.config, rootSegmentGroup, PRIMARY_OUTLET); /** @type {?} */ var root = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze(Object.assign({}, this.urlTree.queryParams)), /** @type {?} */ this.urlTree.fragment, {}, PRIMARY_OUTLET, this.rootComponentType, null, this.urlTree.root, -1, {}); /** @type {?} */ var rootNode = new TreeNode(root, children); /** @type {?} */ var routeState = new RouterStateSnapshot(this.url, rootNode); this.inheritParamsAndData(routeState._root); return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(routeState); } catch (e) { return new rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"]( /** * @param {?} obs * @return {?} */ function (obs) { return obs.error(e); }); } } /** * @param {?} routeNode * @return {?} */ }, { key: "inheritParamsAndData", value: function inheritParamsAndData(routeNode) { var _this438 = this; /** @type {?} */ var route = routeNode.value; /** @type {?} */ var i = inheritedParamsDataResolve(route, this.paramsInheritanceStrategy); route.params = Object.freeze(i.params); route.data = Object.freeze(i.data); routeNode.children.forEach( /** * @param {?} n * @return {?} */ function (n) { return _this438.inheritParamsAndData(n); }); } /** * @param {?} config * @param {?} segmentGroup * @param {?} outlet * @return {?} */ }, { key: "processSegmentGroup", value: function processSegmentGroup(config, segmentGroup, outlet) { if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) { return this.processChildren(config, segmentGroup); } return this.processSegment(config, segmentGroup, segmentGroup.segments, outlet); } /** * @param {?} config * @param {?} segmentGroup * @return {?} */ }, { key: "processChildren", value: function processChildren(config, segmentGroup) { var _this439 = this; /** @type {?} */ var children = mapChildrenIntoArray(segmentGroup, /** * @param {?} child * @param {?} childOutlet * @return {?} */ function (child, childOutlet) { return _this439.processSegmentGroup(config, child, childOutlet); }); checkOutletNameUniqueness(children); sortActivatedRouteSnapshots(children); return children; } /** * @param {?} config * @param {?} segmentGroup * @param {?} segments * @param {?} outlet * @return {?} */ }, { key: "processSegment", value: function processSegment(config, segmentGroup, segments, outlet) { var _iterator52 = _createForOfIteratorHelper(config), _step52; try { for (_iterator52.s(); !(_step52 = _iterator52.n()).done;) { var r = _step52.value; try { return this.processSegmentAgainstRoute(r, segmentGroup, segments, outlet); } catch (e) { if (!(e instanceof NoMatch$1)) throw e; } } } catch (err) { _iterator52.e(err); } finally { _iterator52.f(); } if (this.noLeftoversInUrl(segmentGroup, segments, outlet)) { return []; } throw new NoMatch$1(); } /** * @private * @param {?} segmentGroup * @param {?} segments * @param {?} outlet * @return {?} */ }, { key: "noLeftoversInUrl", value: function noLeftoversInUrl(segmentGroup, segments, outlet) { return segments.length === 0 && !segmentGroup.children[outlet]; } /** * @param {?} route * @param {?} rawSegment * @param {?} segments * @param {?} outlet * @return {?} */ }, { key: "processSegmentAgainstRoute", value: function processSegmentAgainstRoute(route, rawSegment, segments, outlet) { if (route.redirectTo) throw new NoMatch$1(); if ((route.outlet || PRIMARY_OUTLET) !== outlet) throw new NoMatch$1(); /** @type {?} */ var snapshot; /** @type {?} */ var consumedSegments = []; /** @type {?} */ var rawSlicedSegments = []; if (route.path === '**') { /** @type {?} */ var params = segments.length > 0 ? /** @type {?} */ last(segments).parameters : {}; snapshot = new ActivatedRouteSnapshot(segments, params, Object.freeze(Object.assign({}, this.urlTree.queryParams)), /** @type {?} */ this.urlTree.fragment, getData(route), outlet, /** @type {?} */ route.component, route, getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + segments.length, getResolve(route)); } else { /** @type {?} */ var result = match$1(rawSegment, route, segments); consumedSegments = result.consumedSegments; rawSlicedSegments = segments.slice(result.lastChild); snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze(Object.assign({}, this.urlTree.queryParams)), /** @type {?} */ this.urlTree.fragment, getData(route), outlet, /** @type {?} */ route.component, route, getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + consumedSegments.length, getResolve(route)); } /** @type {?} */ var childConfig = getChildConfig(route); var _split$ = split$1(rawSegment, consumedSegments, rawSlicedSegments, childConfig, this.relativeLinkResolution), segmentGroup = _split$.segmentGroup, slicedSegments = _split$.slicedSegments; if (slicedSegments.length === 0 && segmentGroup.hasChildren()) { /** @type {?} */ var _children3 = this.processChildren(childConfig, segmentGroup); return [new TreeNode(snapshot, _children3)]; } if (childConfig.length === 0 && slicedSegments.length === 0) { return [new TreeNode(snapshot, [])]; } /** @type {?} */ var children = this.processSegment(childConfig, segmentGroup, slicedSegments, PRIMARY_OUTLET); return [new TreeNode(snapshot, children)]; } }]); return Recognizer; }(); if (false) {} /** * @param {?} nodes * @return {?} */ function sortActivatedRouteSnapshots(nodes) { nodes.sort( /** * @param {?} a * @param {?} b * @return {?} */ function (a, b) { if (a.value.outlet === PRIMARY_OUTLET) return -1; if (b.value.outlet === PRIMARY_OUTLET) return 1; return a.value.outlet.localeCompare(b.value.outlet); }); } /** * @param {?} route * @return {?} */ function getChildConfig(route) { if (route.children) { return route.children; } if (route.loadChildren) { return ( /** @type {?} */ route._loadedConfig.routes ); } return []; } /** * @record */ function MatchResult() {} if (false) {} /** * @param {?} segmentGroup * @param {?} route * @param {?} segments * @return {?} */ function match$1(segmentGroup, route, segments) { if (route.path === '') { if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || segments.length > 0)) { throw new NoMatch$1(); } return { consumedSegments: [], lastChild: 0, parameters: {} }; } /** @type {?} */ var matcher = route.matcher || defaultUrlMatcher; /** @type {?} */ var res = matcher(segments, segmentGroup, route); if (!res) throw new NoMatch$1(); /** @type {?} */ var posParams = {}; forEach( /** @type {?} */ res.posParams, /** * @param {?} v * @param {?} k * @return {?} */ function (v, k) { posParams[k] = v.path; }); /** @type {?} */ var parameters = res.consumed.length > 0 ? Object.assign({}, posParams, res.consumed[res.consumed.length - 1].parameters) : posParams; return { consumedSegments: res.consumed, lastChild: res.consumed.length, parameters: parameters }; } /** * @param {?} nodes * @return {?} */ function checkOutletNameUniqueness(nodes) { /** @type {?} */ var names = {}; nodes.forEach( /** * @param {?} n * @return {?} */ function (n) { /** @type {?} */ var routeWithSameOutletName = names[n.value.outlet]; if (routeWithSameOutletName) { /** @type {?} */ var p = routeWithSameOutletName.url.map( /** * @param {?} s * @return {?} */ function (s) { return s.toString(); }).join('/'); /** @type {?} */ var c = n.value.url.map( /** * @param {?} s * @return {?} */ function (s) { return s.toString(); }).join('/'); throw new Error("Two segments cannot have the same outlet name: '".concat(p, "' and '").concat(c, "'.")); } names[n.value.outlet] = n.value; }); } /** * @param {?} segmentGroup * @return {?} */ function getSourceSegmentGroup(segmentGroup) { /** @type {?} */ var s = segmentGroup; while (s._sourceSegment) { s = s._sourceSegment; } return s; } /** * @param {?} segmentGroup * @return {?} */ function getPathIndexShift(segmentGroup) { /** @type {?} */ var s = segmentGroup; /** @type {?} */ var res = s._segmentIndexShift ? s._segmentIndexShift : 0; while (s._sourceSegment) { s = s._sourceSegment; res += s._segmentIndexShift ? s._segmentIndexShift : 0; } return res - 1; } /** * @param {?} segmentGroup * @param {?} consumedSegments * @param {?} slicedSegments * @param {?} config * @param {?} relativeLinkResolution * @return {?} */ function split$1(segmentGroup, consumedSegments, slicedSegments, config, relativeLinkResolution) { if (slicedSegments.length > 0 && containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, config)) { /** @type {?} */ var _s3 = new UrlSegmentGroup(consumedSegments, createChildrenForEmptyPaths(segmentGroup, consumedSegments, config, new UrlSegmentGroup(slicedSegments, segmentGroup.children))); _s3._sourceSegment = segmentGroup; _s3._segmentIndexShift = consumedSegments.length; return { segmentGroup: _s3, slicedSegments: [] }; } if (slicedSegments.length === 0 && containsEmptyPathMatches(segmentGroup, slicedSegments, config)) { /** @type {?} */ var _s4 = new UrlSegmentGroup(segmentGroup.segments, addEmptyPathsToChildrenIfNeeded(segmentGroup, consumedSegments, slicedSegments, config, segmentGroup.children, relativeLinkResolution)); _s4._sourceSegment = segmentGroup; _s4._segmentIndexShift = consumedSegments.length; return { segmentGroup: _s4, slicedSegments: slicedSegments }; } /** @type {?} */ var s = new UrlSegmentGroup(segmentGroup.segments, segmentGroup.children); s._sourceSegment = segmentGroup; s._segmentIndexShift = consumedSegments.length; return { segmentGroup: s, slicedSegments: slicedSegments }; } /** * @param {?} segmentGroup * @param {?} consumedSegments * @param {?} slicedSegments * @param {?} routes * @param {?} children * @param {?} relativeLinkResolution * @return {?} */ function addEmptyPathsToChildrenIfNeeded(segmentGroup, consumedSegments, slicedSegments, routes, children, relativeLinkResolution) { /** @type {?} */ var res = {}; var _iterator53 = _createForOfIteratorHelper(routes), _step53; try { for (_iterator53.s(); !(_step53 = _iterator53.n()).done;) { var r = _step53.value; if (emptyPathMatch(segmentGroup, slicedSegments, r) && !children[getOutlet$1(r)]) { /** @type {?} */ var s = new UrlSegmentGroup([], {}); s._sourceSegment = segmentGroup; if (relativeLinkResolution === 'legacy') { s._segmentIndexShift = segmentGroup.segments.length; } else { s._segmentIndexShift = consumedSegments.length; } res[getOutlet$1(r)] = s; } } } catch (err) { _iterator53.e(err); } finally { _iterator53.f(); } return Object.assign({}, children, res); } /** * @param {?} segmentGroup * @param {?} consumedSegments * @param {?} routes * @param {?} primarySegment * @return {?} */ function createChildrenForEmptyPaths(segmentGroup, consumedSegments, routes, primarySegment) { /** @type {?} */ var res = {}; res[PRIMARY_OUTLET] = primarySegment; primarySegment._sourceSegment = segmentGroup; primarySegment._segmentIndexShift = consumedSegments.length; var _iterator54 = _createForOfIteratorHelper(routes), _step54; try { for (_iterator54.s(); !(_step54 = _iterator54.n()).done;) { var r = _step54.value; if (r.path === '' && getOutlet$1(r) !== PRIMARY_OUTLET) { /** @type {?} */ var s = new UrlSegmentGroup([], {}); s._sourceSegment = segmentGroup; s._segmentIndexShift = consumedSegments.length; res[getOutlet$1(r)] = s; } } } catch (err) { _iterator54.e(err); } finally { _iterator54.f(); } return res; } /** * @param {?} segmentGroup * @param {?} slicedSegments * @param {?} routes * @return {?} */ function containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, routes) { return routes.some( /** * @param {?} r * @return {?} */ function (r) { return emptyPathMatch(segmentGroup, slicedSegments, r) && getOutlet$1(r) !== PRIMARY_OUTLET; }); } /** * @param {?} segmentGroup * @param {?} slicedSegments * @param {?} routes * @return {?} */ function containsEmptyPathMatches(segmentGroup, slicedSegments, routes) { return routes.some( /** * @param {?} r * @return {?} */ function (r) { return emptyPathMatch(segmentGroup, slicedSegments, r); }); } /** * @param {?} segmentGroup * @param {?} slicedSegments * @param {?} r * @return {?} */ function emptyPathMatch(segmentGroup, slicedSegments, r) { if ((segmentGroup.hasChildren() || slicedSegments.length > 0) && r.pathMatch === 'full') { return false; } return r.path === '' && r.redirectTo === undefined; } /** * @param {?} route * @return {?} */ function getOutlet$1(route) { return route.outlet || PRIMARY_OUTLET; } /** * @param {?} route * @return {?} */ function getData(route) { return route.data || {}; } /** * @param {?} route * @return {?} */ function getResolve(route) { return route.resolve || {}; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} rootComponentType * @param {?} config * @param {?} serializer * @param {?} paramsInheritanceStrategy * @param {?} relativeLinkResolution * @return {?} */ function recognize$1(rootComponentType, config, serializer, paramsInheritanceStrategy, relativeLinkResolution) { return ( /** * @param {?} source * @return {?} */ function (source) { return source.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])( /** * @param {?} t * @return {?} */ function (t) { return recognize(rootComponentType, config, t.urlAfterRedirects, serializer(t.urlAfterRedirects), paramsInheritanceStrategy, relativeLinkResolution).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} targetSnapshot * @return {?} */ function (targetSnapshot) { return Object.assign({}, t, { targetSnapshot: targetSnapshot }); })); })); } ); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @param {?} paramsInheritanceStrategy * @param {?} moduleInjector * @return {?} */ function resolveData(paramsInheritanceStrategy, moduleInjector) { return ( /** * @param {?} source * @return {?} */ function (source) { return source.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])( /** * @param {?} t * @return {?} */ function (t) { var targetSnapshot = t.targetSnapshot, canActivateChecks = t.guards.canActivateChecks; if (!canActivateChecks.length) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(t); } return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(canActivateChecks).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["concatMap"])( /** * @param {?} check * @return {?} */ function (check) { return runResolve(check.route, /** @type {?} */ targetSnapshot, paramsInheritanceStrategy, moduleInjector); }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["reduce"])( /** * @param {?} _ * @param {?} __ * @return {?} */ function (_, __) { return _; }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} _ * @return {?} */ function (_) { return t; })); })); } ); } /** * @param {?} futureARS * @param {?} futureRSS * @param {?} paramsInheritanceStrategy * @param {?} moduleInjector * @return {?} */ function runResolve(futureARS, futureRSS, paramsInheritanceStrategy, moduleInjector) { /** @type {?} */ var resolve = futureARS._resolve; return resolveNode(resolve, futureARS, futureRSS, moduleInjector).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} resolvedData * @return {?} */ function (resolvedData) { futureARS._resolvedData = resolvedData; futureARS.data = Object.assign({}, futureARS.data, inheritedParamsDataResolve(futureARS, paramsInheritanceStrategy).resolve); return null; })); } /** * @param {?} resolve * @param {?} futureARS * @param {?} futureRSS * @param {?} moduleInjector * @return {?} */ function resolveNode(resolve, futureARS, futureRSS, moduleInjector) { /** @type {?} */ var keys = Object.keys(resolve); if (keys.length === 0) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])({}); } if (keys.length === 1) { /** @type {?} */ var key = keys[0]; return getResolver(resolve[key], futureARS, futureRSS, moduleInjector).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} value * @return {?} */ function (value) { return _defineProperty({}, key, value); })); } /** @type {?} */ var data = {}; /** @type {?} */ var runningResolvers$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(keys).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])( /** * @param {?} key * @return {?} */ function (key) { return getResolver(resolve[key], futureARS, futureRSS, moduleInjector).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} value * @return {?} */ function (value) { data[key] = value; return value; })); })); return runningResolvers$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["last"])(), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @return {?} */ function () { return data; })); } /** * @param {?} injectionToken * @param {?} futureARS * @param {?} futureRSS * @param {?} moduleInjector * @return {?} */ function getResolver(injectionToken, futureARS, futureRSS, moduleInjector) { /** @type {?} */ var resolver = getToken(injectionToken, futureARS, moduleInjector); return resolver.resolve ? wrapIntoObservable(resolver.resolve(futureARS, futureRSS)) : wrapIntoObservable(resolver(futureARS, futureRSS)); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Perform a side effect through a switchMap for every emission on the source Observable, * but return an Observable that is identical to the source. It's essentially the same as * the `tap` operator, but if the side effectful `next` function returns an ObservableInput, * it will wait before continuing with the original value. * @template T * @param {?} next * @return {?} */ function switchTap(next) { return ( /** * @param {?} source * @return {?} */ function (source) { return source.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["switchMap"])( /** * @param {?} v * @return {?} */ function (v) { /** @type {?} */ var nextResult = next(v); if (nextResult) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(nextResult).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @return {?} */ function () { return v; })); } return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])([v]); })); } ); } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** * \@description * * Provides a way to customize when activated routes get reused. * * \@publicApi * @abstract */ var RouteReuseStrategy = function RouteReuseStrategy() { _classCallCheck(this, RouteReuseStrategy); }; if (false) {} /** * Does not detach any subtrees. Reuses routes as long as their route config is the same. */ var DefaultRouteReuseStrategy = /*#__PURE__*/function () { function DefaultRouteReuseStrategy() { _classCallCheck(this, DefaultRouteReuseStrategy); } _createClass2(DefaultRouteReuseStrategy, [{ key: "shouldDetach", /** * @param {?} route * @return {?} */ value: function shouldDetach(route) { return false; } /** * @param {?} route * @param {?} detachedTree * @return {?} */ }, { key: "store", value: function store(route, detachedTree) {} /** * @param {?} route * @return {?} */ }, { key: "shouldAttach", value: function shouldAttach(route) { return false; } /** * @param {?} route * @return {?} */ }, { key: "retrieve", value: function retrieve(route) { return null; } /** * @param {?} future * @param {?} curr * @return {?} */ }, { key: "shouldReuseRoute", value: function shouldReuseRoute(future, curr) { return future.routeConfig === curr.routeConfig; } }]); return DefaultRouteReuseStrategy; }(); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * The [DI token](guide/glossary/#di-token) for a router configuration. * @see `ROUTES` * \@publicApi * @type {?} */ var ROUTES = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('ROUTES'); var RouterConfigLoader = /*#__PURE__*/function () { /** * @param {?} loader * @param {?} compiler * @param {?=} onLoadStartListener * @param {?=} onLoadEndListener */ function RouterConfigLoader(loader, compiler, onLoadStartListener, onLoadEndListener) { _classCallCheck(this, RouterConfigLoader); this.loader = loader; this.compiler = compiler; this.onLoadStartListener = onLoadStartListener; this.onLoadEndListener = onLoadEndListener; } /** * @param {?} parentInjector * @param {?} route * @return {?} */ _createClass2(RouterConfigLoader, [{ key: "load", value: function load(parentInjector, route) { var _this440 = this; if (this.onLoadStartListener) { this.onLoadStartListener(route); } /** @type {?} */ var moduleFactory$ = this.loadModuleFactory( /** @type {?} */ route.loadChildren); return moduleFactory$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} factory * @return {?} */ function (factory) { if (_this440.onLoadEndListener) { _this440.onLoadEndListener(route); } /** @type {?} */ var module = factory.create(parentInjector); return new LoadedRouterConfig(flatten(module.injector.get(ROUTES)).map(standardizeConfig), module); })); } /** * @private * @param {?} loadChildren * @return {?} */ }, { key: "loadModuleFactory", value: function loadModuleFactory(loadChildren) { var _this441 = this; if (typeof loadChildren === 'string') { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(this.loader.load(loadChildren)); } else { return wrapIntoObservable(loadChildren()).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])( /** * @param {?} t * @return {?} */ function (t) { if (t instanceof _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleFactory"]) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(t); } else { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(_this441.compiler.compileModuleAsync(t)); } })); } } }]); return RouterConfigLoader; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** * \@description * * Provides a way to migrate AngularJS applications to Angular. * * \@publicApi * @abstract */ var UrlHandlingStrategy = function UrlHandlingStrategy() { _classCallCheck(this, UrlHandlingStrategy); }; if (false) {} /** * \@publicApi */ var DefaultUrlHandlingStrategy = /*#__PURE__*/function () { function DefaultUrlHandlingStrategy() { _classCallCheck(this, DefaultUrlHandlingStrategy); } _createClass2(DefaultUrlHandlingStrategy, [{ key: "shouldProcessUrl", /** * @param {?} url * @return {?} */ value: function shouldProcessUrl(url) { return true; } /** * @param {?} url * @return {?} */ }, { key: "extract", value: function extract(url) { return url; } /** * @param {?} newUrlPart * @param {?} wholeUrl * @return {?} */ }, { key: "merge", value: function merge(newUrlPart, wholeUrl) { return newUrlPart; } }]); return DefaultUrlHandlingStrategy; }(); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@description * * Options that modify the navigation strategy. * * \@publicApi * @record */ function NavigationExtras() {} if (false) {} /** * @param {?} error * @return {?} */ function defaultErrorHandler(error) { throw error; } /** * @param {?} error * @param {?} urlSerializer * @param {?} url * @return {?} */ function defaultMalformedUriErrorHandler(error, urlSerializer, url) { return urlSerializer.parse('/'); } /** * \@internal * @param {?} snapshot * @param {?} runExtras * @return {?} */ function defaultRouterHook(snapshot, runExtras) { return ( /** @type {?} */ Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(null) ); } /** * \@description * * A service that provides navigation and URL manipulation capabilities. * * @see `Route`. * @see [Routing and Navigation Guide](guide/router). * * \@ngModule RouterModule * * \@publicApi */ var Router = /*#__PURE__*/function () { /** * Creates the router service. * @param {?} rootComponentType * @param {?} urlSerializer * @param {?} rootContexts * @param {?} location * @param {?} injector * @param {?} loader * @param {?} compiler * @param {?} config */ // TODO: vsavkin make internal after the final is out. function Router(rootComponentType, urlSerializer, rootContexts, location, injector, loader, compiler, config) { var _this442 = this; _classCallCheck(this, Router); this.rootComponentType = rootComponentType; this.urlSerializer = urlSerializer; this.rootContexts = rootContexts; this.location = location; this.config = config; this.lastSuccessfulNavigation = null; this.currentNavigation = null; this.navigationId = 0; this.isNgZoneEnabled = false; /** * An event stream for routing events in this NgModule. */ this.events = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"](); /** * A handler for navigation errors in this NgModule. */ this.errorHandler = defaultErrorHandler; /** * A handler for errors thrown by `Router.parseUrl(url)` * when `url` contains an invalid character. * The most common case is a `%` sign * that's not encoded and is not part of a percent encoded sequence. */ this.malformedUriErrorHandler = defaultMalformedUriErrorHandler; /** * True if at least one navigation event has occurred, * false otherwise. */ this.navigated = false; this.lastSuccessfulId = -1; /** * Hooks that enable you to pause navigation, * either before or after the preactivation phase. * Used by `RouterModule`. * * \@internal */ this.hooks = { beforePreactivation: defaultRouterHook, afterPreactivation: defaultRouterHook }; /** * A strategy for extracting and merging URLs. * Used for AngularJS to Angular migrations. */ this.urlHandlingStrategy = new DefaultUrlHandlingStrategy(); /** * A strategy for re-using routes. */ this.routeReuseStrategy = new DefaultRouteReuseStrategy(); /** * How to handle a navigation request to the current URL. One of: * - `'ignore'` : The router ignores the request. * - `'reload'` : The router reloads the URL. Use to implement a "refresh" feature. */ this.onSameUrlNavigation = 'ignore'; /** * How to merge parameters, data, and resolved data from parent to child * routes. One of: * * - `'emptyOnly'` : Inherit parent parameters, data, and resolved data * for path-less or component-less routes. * - `'always'` : Inherit parent parameters, data, and resolved data * for all child routes. */ this.paramsInheritanceStrategy = 'emptyOnly'; /** * Determines when the router updates the browser URL. * By default (`"deferred"`), updates the browser URL after navigation has finished. * Set to `'eager'` to update the browser URL at the beginning of navigation. * You can choose to update early so that, if navigation fails, * you can show an error message with the URL that failed. */ this.urlUpdateStrategy = 'deferred'; /** * Enables a bug fix that corrects relative link resolution in components with empty paths. * @see `RouterModule` */ this.relativeLinkResolution = 'legacy'; /** @type {?} */ var onLoadStart = /** * @param {?} r * @return {?} */ function onLoadStart(r) { return _this442.triggerEvent(new RouteConfigLoadStart(r)); }; /** @type {?} */ var onLoadEnd = /** * @param {?} r * @return {?} */ function onLoadEnd(r) { return _this442.triggerEvent(new RouteConfigLoadEnd(r)); }; this.ngModule = injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleRef"]); this.console = injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵConsole"]); /** @type {?} */ var ngZone = injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"]); this.isNgZoneEnabled = ngZone instanceof _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"]; this.resetConfig(config); this.currentUrlTree = createEmptyUrlTree(); this.rawUrlTree = this.currentUrlTree; this.browserUrlTree = this.currentUrlTree; this.configLoader = new RouterConfigLoader(loader, compiler, onLoadStart, onLoadEnd); this.routerState = createEmptyState(this.currentUrlTree, this.rootComponentType); this.transitions = new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"]({ id: 0, currentUrlTree: this.currentUrlTree, currentRawUrl: this.currentUrlTree, extractedUrl: this.urlHandlingStrategy.extract(this.currentUrlTree), urlAfterRedirects: this.urlHandlingStrategy.extract(this.currentUrlTree), rawUrl: this.currentUrlTree, extras: {}, resolve: null, reject: null, promise: Promise.resolve(true), source: 'imperative', restoredState: null, currentSnapshot: this.routerState.snapshot, targetSnapshot: null, currentRouterState: this.routerState, targetRouterState: null, guards: { canActivateChecks: [], canDeactivateChecks: [] }, guardsResult: null }); this.navigations = this.setupNavigations(this.transitions); this.processNavigations(); } /** * @private * @param {?} transitions * @return {?} */ _createClass2(Router, [{ key: "setupNavigations", value: function setupNavigations(transitions) { var _this443 = this; /** @type {?} */ var eventsSubject = /** @type {?} */ this.events; return ( /** @type {?} */ /** @type {?} */ transitions.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["filter"])( /** * @param {?} t * @return {?} */ function (t) { return t.id !== 0; }), // Extract URL Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} t * @return {?} */ function (t) { return ( /** @type {?} */ Object.assign({}, t, { extractedUrl: _this443.urlHandlingStrategy.extract(t.rawUrl) }) ); }), // Using switchMap so we cancel executing navigations when a new one comes in Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["switchMap"])( /** * @param {?} t * @return {?} */ function (t) { /** @type {?} */ var completed = false; /** @type {?} */ var errored = false; return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(t).pipe( // Store the Navigation object Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["tap"])( /** * @param {?} t * @return {?} */ function (t) { _this443.currentNavigation = { id: t.id, initialUrl: t.currentRawUrl, extractedUrl: t.extractedUrl, trigger: t.source, extras: t.extras, previousNavigation: _this443.lastSuccessfulNavigation ? Object.assign({}, _this443.lastSuccessfulNavigation, { previousNavigation: null }) : null }; }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["switchMap"])( /** * @param {?} t * @return {?} */ function (t) { /** @type {?} */ var urlTransition = !_this443.navigated || t.extractedUrl.toString() !== _this443.browserUrlTree.toString(); /** @type {?} */ var processCurrentUrl = (_this443.onSameUrlNavigation === 'reload' ? true : urlTransition) && _this443.urlHandlingStrategy.shouldProcessUrl(t.rawUrl); if (processCurrentUrl) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(t).pipe( // Fire NavigationStart event Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["switchMap"])( /** * @param {?} t * @return {?} */ function (t) { /** @type {?} */ var transition = _this443.transitions.getValue(); eventsSubject.next(new NavigationStart(t.id, _this443.serializeUrl(t.extractedUrl), t.source, t.restoredState)); if (transition !== _this443.transitions.getValue()) { return rxjs__WEBPACK_IMPORTED_MODULE_2__["EMPTY"]; } return [t]; }), // This delay is required to match old behavior that forced navigation to // always be async Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["switchMap"])( /** * @param {?} t * @return {?} */ function (t) { return Promise.resolve(t); }), // ApplyRedirects applyRedirects$1(_this443.ngModule.injector, _this443.configLoader, _this443.urlSerializer, _this443.config), // Update the currentNavigation Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["tap"])( /** * @param {?} t * @return {?} */ function (t) { _this443.currentNavigation = Object.assign({}, /** @type {?} */ _this443.currentNavigation, { finalUrl: t.urlAfterRedirects }); }), // Recognize recognize$1(_this443.rootComponentType, _this443.config, /** * @param {?} url * @return {?} */ function (url) { return _this443.serializeUrl(url); }, _this443.paramsInheritanceStrategy, _this443.relativeLinkResolution), // Update URL if in `eager` update mode Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["tap"])( /** * @param {?} t * @return {?} */ function (t) { if (_this443.urlUpdateStrategy === 'eager') { if (!t.extras.skipLocationChange) { _this443.setBrowserUrl(t.urlAfterRedirects, !!t.extras.replaceUrl, t.id, t.extras.state); } _this443.browserUrlTree = t.urlAfterRedirects; } }), // Fire RoutesRecognized Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["tap"])( /** * @param {?} t * @return {?} */ function (t) { /** @type {?} */ var routesRecognized = new RoutesRecognized(t.id, _this443.serializeUrl(t.extractedUrl), _this443.serializeUrl(t.urlAfterRedirects), /** @type {?} */ t.targetSnapshot); eventsSubject.next(routesRecognized); })); } else { /** @type {?} */ var processPreviousUrl = urlTransition && _this443.rawUrlTree && _this443.urlHandlingStrategy.shouldProcessUrl(_this443.rawUrlTree); /* When the current URL shouldn't be processed, but the previous one was, we * handle this "error condition" by navigating to the previously successful URL, * but leaving the URL intact.*/ if (processPreviousUrl) { var id = t.id, extractedUrl = t.extractedUrl, source = t.source, restoredState = t.restoredState, extras = t.extras; /** @type {?} */ var navStart = new NavigationStart(id, _this443.serializeUrl(extractedUrl), source, restoredState); eventsSubject.next(navStart); /** @type {?} */ var targetSnapshot = createEmptyState(extractedUrl, _this443.rootComponentType).snapshot; return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(Object.assign({}, t, { targetSnapshot: targetSnapshot, urlAfterRedirects: extractedUrl, extras: Object.assign({}, extras, { skipLocationChange: false, replaceUrl: false }) })); } else { /* When neither the current or previous URL can be processed, do nothing other * than update router's internal reference to the current "settled" URL. This * way the next navigation will be coming from the current URL in the browser. */ _this443.rawUrlTree = t.rawUrl; _this443.browserUrlTree = t.urlAfterRedirects; t.resolve(null); return rxjs__WEBPACK_IMPORTED_MODULE_2__["EMPTY"]; } } }), // Before Preactivation switchTap( /** * @param {?} t * @return {?} */ function (t) { var targetSnapshot = t.targetSnapshot, navigationId = t.id, appliedUrlTree = t.extractedUrl, rawUrlTree = t.rawUrl, _t$extras = t.extras, skipLocationChange = _t$extras.skipLocationChange, replaceUrl = _t$extras.replaceUrl; return _this443.hooks.beforePreactivation( /** @type {?} */ targetSnapshot, { navigationId: navigationId, appliedUrlTree: appliedUrlTree, rawUrlTree: rawUrlTree, skipLocationChange: !!skipLocationChange, replaceUrl: !!replaceUrl }); }), // --- GUARDS --- Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["tap"])( /** * @param {?} t * @return {?} */ function (t) { /** @type {?} */ var guardsStart = new GuardsCheckStart(t.id, _this443.serializeUrl(t.extractedUrl), _this443.serializeUrl(t.urlAfterRedirects), /** @type {?} */ t.targetSnapshot); _this443.triggerEvent(guardsStart); }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} t * @return {?} */ function (t) { return Object.assign({}, t, { guards: getAllRouteGuards( /** @type {?} */ t.targetSnapshot, t.currentSnapshot, _this443.rootContexts) }); }), checkGuards(_this443.ngModule.injector, /** * @param {?} evt * @return {?} */ function (evt) { return _this443.triggerEvent(evt); }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["tap"])( /** * @param {?} t * @return {?} */ function (t) { if (isUrlTree(t.guardsResult)) { /** @type {?} */ var error = navigationCancelingError("Redirecting to \"".concat(_this443.serializeUrl(t.guardsResult), "\"")); error.url = t.guardsResult; throw error; } }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["tap"])( /** * @param {?} t * @return {?} */ function (t) { /** @type {?} */ var guardsEnd = new GuardsCheckEnd(t.id, _this443.serializeUrl(t.extractedUrl), _this443.serializeUrl(t.urlAfterRedirects), /** @type {?} */ t.targetSnapshot, !!t.guardsResult); _this443.triggerEvent(guardsEnd); }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["filter"])( /** * @param {?} t * @return {?} */ function (t) { if (!t.guardsResult) { _this443.resetUrlToCurrentUrlTree(); /** @type {?} */ var navCancel = new NavigationCancel(t.id, _this443.serializeUrl(t.extractedUrl), ''); eventsSubject.next(navCancel); t.resolve(false); return false; } return true; }), // --- RESOLVE --- switchTap( /** * @param {?} t * @return {?} */ function (t) { if (t.guards.canActivateChecks.length) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(t).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["tap"])( /** * @param {?} t * @return {?} */ function (t) { /** @type {?} */ var resolveStart = new ResolveStart(t.id, _this443.serializeUrl(t.extractedUrl), _this443.serializeUrl(t.urlAfterRedirects), /** @type {?} */ t.targetSnapshot); _this443.triggerEvent(resolveStart); }), resolveData(_this443.paramsInheritanceStrategy, _this443.ngModule.injector), // Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["tap"])( /** * @param {?} t * @return {?} */ function (t) { /** @type {?} */ var resolveEnd = new ResolveEnd(t.id, _this443.serializeUrl(t.extractedUrl), _this443.serializeUrl(t.urlAfterRedirects), /** @type {?} */ t.targetSnapshot); _this443.triggerEvent(resolveEnd); })); } return undefined; }), // --- AFTER PREACTIVATION --- switchTap( /** * @param {?} t * @return {?} */ function (t) { var targetSnapshot = t.targetSnapshot, navigationId = t.id, appliedUrlTree = t.extractedUrl, rawUrlTree = t.rawUrl, _t$extras2 = t.extras, skipLocationChange = _t$extras2.skipLocationChange, replaceUrl = _t$extras2.replaceUrl; return _this443.hooks.afterPreactivation( /** @type {?} */ targetSnapshot, { navigationId: navigationId, appliedUrlTree: appliedUrlTree, rawUrlTree: rawUrlTree, skipLocationChange: !!skipLocationChange, replaceUrl: !!replaceUrl }); }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} t * @return {?} */ function (t) { /** @type {?} */ var targetRouterState = createRouterState(_this443.routeReuseStrategy, /** @type {?} */ t.targetSnapshot, t.currentRouterState); return Object.assign({}, t, { targetRouterState: targetRouterState }); }), /* Once here, we are about to activate syncronously. The assumption is this will succeed, and user code may read from the Router service. Therefore before activation, we need to update router properties storing the current URL and the RouterState, as well as updated the browser URL. All this should happen *before* activating. */ Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["tap"])( /** * @param {?} t * @return {?} */ function (t) { _this443.currentUrlTree = t.urlAfterRedirects; _this443.rawUrlTree = _this443.urlHandlingStrategy.merge(_this443.currentUrlTree, t.rawUrl); /** @type {?} */ _this443.routerState = /** @type {?} */ t.targetRouterState; if (_this443.urlUpdateStrategy === 'deferred') { if (!t.extras.skipLocationChange) { _this443.setBrowserUrl(_this443.rawUrlTree, !!t.extras.replaceUrl, t.id, t.extras.state); } _this443.browserUrlTree = t.urlAfterRedirects; } }), activateRoutes(_this443.rootContexts, _this443.routeReuseStrategy, /** * @param {?} evt * @return {?} */ function (evt) { return _this443.triggerEvent(evt); }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["tap"])({ /** * @return {?} */ next: function next() { completed = true; }, /** * @return {?} */ complete: function complete() { completed = true; } }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["finalize"])( /** * @return {?} */ function () { /* When the navigation stream finishes either through error or success, we set the * `completed` or `errored` flag. However, there are some situations where we could * get here without either of those being set. For instance, a redirect during * NavigationStart. Therefore, this is a catch-all to make sure the NavigationCancel * event is fired when a navigation gets cancelled but not caught by other means. */ if (!completed && !errored) { // Must reset to current URL tree here to ensure history.state is set. On a fresh // page load, if a new navigation comes in before a successful navigation // completes, there will be nothing in history.state.navigationId. This can cause // sync problems with AngularJS sync code which looks for a value here in order // to determine whether or not to handle a given popstate event or to leave it // to the Angualr router. _this443.resetUrlToCurrentUrlTree(); /** @type {?} */ var navCancel = new NavigationCancel(t.id, _this443.serializeUrl(t.extractedUrl), "Navigation ID ".concat(t.id, " is not equal to the current navigation id ").concat(_this443.navigationId)); eventsSubject.next(navCancel); t.resolve(false); } // currentNavigation should always be reset to null here. If navigation was // successful, lastSuccessfulTransition will have already been set. Therefore we // can safely set currentNavigation to null here. _this443.currentNavigation = null; }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["catchError"])( /** * @param {?} e * @return {?} */ function (e) { errored = true; /* This error type is issued during Redirect, and is handled as a cancellation * rather than an error. */ if (isNavigationCancelingError(e)) { /** @type {?} */ var redirecting = isUrlTree(e.url); if (!redirecting) { // Set property only if we're not redirecting. If we landed on a page and // redirect to `/` route, the new navigation is going to see the `/` isn't // a change from the default currentUrlTree and won't navigate. This is // only applicable with initial navigation, so setting `navigated` only when // not redirecting resolves this scenario. _this443.navigated = true; _this443.resetStateAndUrl(t.currentRouterState, t.currentUrlTree, t.rawUrl); } /** @type {?} */ var navCancel = new NavigationCancel(t.id, _this443.serializeUrl(t.extractedUrl), e.message); eventsSubject.next(navCancel); t.resolve(false); if (redirecting) { _this443.navigateByUrl(e.url); } /* All other errors should reset to the router's internal URL reference to the * pre-error state. */ } else { _this443.resetStateAndUrl(t.currentRouterState, t.currentUrlTree, t.rawUrl); /** @type {?} */ var navError = new NavigationError(t.id, _this443.serializeUrl(t.extractedUrl), e); eventsSubject.next(navError); try { t.resolve(_this443.errorHandler(e)); } catch (ee) { t.reject(ee); } } return rxjs__WEBPACK_IMPORTED_MODULE_2__["EMPTY"]; })); // TODO(jasonaden): remove cast once g3 is on updated TypeScript })) ); } /** * \@internal * TODO: this should be removed once the constructor of the router made internal * @param {?} rootComponentType * @return {?} */ }, { key: "resetRootComponentType", value: function resetRootComponentType(rootComponentType) { this.rootComponentType = rootComponentType; // TODO: vsavkin router 4.0 should make the root component set to null // this will simplify the lifecycle of the router. this.routerState.root.component = this.rootComponentType; } /** * @private * @return {?} */ }, { key: "getTransition", value: function getTransition() { /** @type {?} */ var transition = this.transitions.value; // This value needs to be set. Other values such as extractedUrl are set on initial navigation // but the urlAfterRedirects may not get set if we aren't processing the new URL *and* not // processing the previous URL. transition.urlAfterRedirects = this.browserUrlTree; return transition; } /** * @private * @param {?} t * @return {?} */ }, { key: "setTransition", value: function setTransition(t) { this.transitions.next(Object.assign({}, this.getTransition(), t)); } /** * Sets up the location change listener and performs the initial navigation. * @return {?} */ }, { key: "initialNavigation", value: function initialNavigation() { this.setUpLocationChangeListener(); if (this.navigationId === 0) { this.navigateByUrl(this.location.path(true), { replaceUrl: true }); } } /** * Sets up the location change listener. * @return {?} */ }, { key: "setUpLocationChangeListener", value: function setUpLocationChangeListener() { var _this444 = this; // Don't need to use Zone.wrap any more, because zone.js // already patch onPopState, so location change callback will // run into ngZone if (!this.locationSubscription) { this.locationSubscription = /** @type {?} */ this.location.subscribe( /** * @param {?} change * @return {?} */ function (change) { /** @type {?} */ var rawUrlTree = _this444.parseUrl(change['url']); /** @type {?} */ var source = change['type'] === 'popstate' ? 'popstate' : 'hashchange'; // Navigations coming from Angular router have a navigationId state property. When this // exists, restore the state. /** @type {?} */ var state = change.state && change.state.navigationId ? change.state : null; setTimeout( /** * @return {?} */ function () { _this444.scheduleNavigation(rawUrlTree, source, state, { replaceUrl: true }); }, 0); }); } } /** * The current URL. * @return {?} */ }, { key: "getCurrentNavigation", /** * The current Navigation object if one exists * @return {?} */ value: function getCurrentNavigation() { return this.currentNavigation; } /** * \@internal * @param {?} event * @return {?} */ }, { key: "triggerEvent", value: function triggerEvent(event) { /** @type {?} */ this.events.next(event); } /** * Resets the configuration used for navigation and generating links. * * \@usageNotes * * ``` * router.resetConfig([ * { path: 'team/:id', component: TeamCmp, children: [ * { path: 'simple', component: SimpleCmp }, * { path: 'user/:name', component: UserCmp } * ]} * ]); * ``` * @param {?} config The route array for the new configuration. * * @return {?} */ }, { key: "resetConfig", value: function resetConfig(config) { validateConfig(config); this.config = config.map(standardizeConfig); this.navigated = false; this.lastSuccessfulId = -1; } /** * \@docsNotRequired * @return {?} */ }, { key: "ngOnDestroy", value: function ngOnDestroy() { this.dispose(); } /** * Disposes of the router. * @return {?} */ }, { key: "dispose", value: function dispose() { if (this.locationSubscription) { this.locationSubscription.unsubscribe(); this.locationSubscription = /** @type {?} */ null; } } /** * Applies an array of commands to the current URL tree and creates a new URL tree. * * When given an activated route, applies the given commands starting from the route. * Otherwise, applies the given command starting from the root. * * \@usageNotes * * ``` * // create /team/33/user/11 * router.createUrlTree(['/team', 33, 'user', 11]); * * // create /team/33;expand=true/user/11 * router.createUrlTree(['/team', 33, {expand: true}, 'user', 11]); * * // you can collapse static segments like this (this works only with the first passed-in value): * router.createUrlTree(['/team/33/user', userId]); * * // If the first segment can contain slashes, and you do not want the router to split it, * // you can do the following: * router.createUrlTree([{segmentPath: '/one/two'}]); * * // create /team/33/(user/11//right:chat) * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: 'chat'}}]); * * // remove the right secondary node * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: null}}]); * * // assuming the current url is `/team/33/user/11` and the route points to `user/11` * * // navigate to /team/33/user/11/details * router.createUrlTree(['details'], {relativeTo: route}); * * // navigate to /team/33/user/22 * router.createUrlTree(['../22'], {relativeTo: route}); * * // navigate to /team/44/user/22 * router.createUrlTree(['../../team/44/user/22'], {relativeTo: route}); * ``` * @param {?} commands An array of commands to apply. * @param {?=} navigationExtras Options that control the navigation strategy. * @return {?} The new URL tree. * */ }, { key: "createUrlTree", value: function createUrlTree(commands) { var navigationExtras = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var relativeTo = navigationExtras.relativeTo, queryParams = navigationExtras.queryParams, fragment = navigationExtras.fragment, preserveQueryParams = navigationExtras.preserveQueryParams, queryParamsHandling = navigationExtras.queryParamsHandling, preserveFragment = navigationExtras.preserveFragment; if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["isDevMode"])() && preserveQueryParams && /** @type {?} */ console && /** @type {?} */ console.warn) { console.warn('preserveQueryParams is deprecated, use queryParamsHandling instead.'); } /** @type {?} */ var a = relativeTo || this.routerState.root; /** @type {?} */ var f = preserveFragment ? this.currentUrlTree.fragment : fragment; /** @type {?} */ var q = null; if (queryParamsHandling) { switch (queryParamsHandling) { case 'merge': q = Object.assign({}, this.currentUrlTree.queryParams, queryParams); break; case 'preserve': q = this.currentUrlTree.queryParams; break; default: q = queryParams || null; } } else { q = preserveQueryParams ? this.currentUrlTree.queryParams : queryParams || null; } if (q !== null) { q = this.removeEmptyProps(q); } return _createUrlTree(a, this.currentUrlTree, commands, /** @type {?} */ q, /** @type {?} */ f); } /** * Navigate based on the provided URL, which must be absolute. * * \@usageNotes * * ``` * router.navigateByUrl("/team/33/user/11"); * * // Navigate without updating the URL * router.navigateByUrl("/team/33/user/11", { skipLocationChange: true }); * ``` * * @param {?} url An absolute URL. The function does not apply any delta to the current URL. * @param {?=} extras An object containing properties that modify the navigation strategy. * The function ignores any properties in the `NavigationExtras` that would change the * provided URL. * * @return {?} A Promise that resolves to 'true' when navigation succeeds, * to 'false' when navigation fails, or is rejected on error. * */ }, { key: "navigateByUrl", value: function navigateByUrl(url) { var extras = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { skipLocationChange: false }; if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["isDevMode"])() && this.isNgZoneEnabled && !_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"].isInAngularZone()) { this.console.warn("Navigation triggered outside Angular zone, did you forget to call 'ngZone.run()'?"); } /** @type {?} */ var urlTree = isUrlTree(url) ? url : this.parseUrl(url); /** @type {?} */ var mergedTree = this.urlHandlingStrategy.merge(urlTree, this.rawUrlTree); return this.scheduleNavigation(mergedTree, 'imperative', null, extras); } /** * Navigate based on the provided array of commands and a starting point. * If no starting route is provided, the navigation is absolute. * * Returns a promise that: * - resolves to 'true' when navigation succeeds, * - resolves to 'false' when navigation fails, * - is rejected when an error happens. * * \@usageNotes * * ``` * router.navigate(['team', 33, 'user', 11], {relativeTo: route}); * * // Navigate without updating the URL * router.navigate(['team', 33, 'user', 11], {relativeTo: route, skipLocationChange: true}); * ``` * * The first parameter of `navigate()` is a delta to be applied to the current URL * or the one provided in the `relativeTo` property of the second parameter (the * `NavigationExtras`). * * In order to affect this browser's `history.state` entry, the `state` * parameter can be passed. This must be an object because the router * will add the `navigationId` property to this object before creating * the new history item. * @param {?} commands * @param {?=} extras * @return {?} */ }, { key: "navigate", value: function navigate(commands) { var extras = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { skipLocationChange: false }; validateCommands(commands); return this.navigateByUrl(this.createUrlTree(commands, extras), extras); } /** * Serializes a `UrlTree` into a string * @param {?} url * @return {?} */ }, { key: "serializeUrl", value: function serializeUrl(url) { return this.urlSerializer.serialize(url); } /** * Parses a string into a `UrlTree` * @param {?} url * @return {?} */ }, { key: "parseUrl", value: function parseUrl(url) { /** @type {?} */ var urlTree; try { urlTree = this.urlSerializer.parse(url); } catch (e) { urlTree = this.malformedUriErrorHandler(e, this.urlSerializer, url); } return urlTree; } /** * Returns whether the url is activated * @param {?} url * @param {?} exact * @return {?} */ }, { key: "isActive", value: function isActive(url, exact) { if (isUrlTree(url)) { return containsTree(this.currentUrlTree, url, exact); } /** @type {?} */ var urlTree = this.parseUrl(url); return containsTree(this.currentUrlTree, urlTree, exact); } /** * @private * @param {?} params * @return {?} */ }, { key: "removeEmptyProps", value: function removeEmptyProps(params) { return Object.keys(params).reduce( /** * @param {?} result * @param {?} key * @return {?} */ function (result, key) { /** @type {?} */ var value = params[key]; if (value !== null && value !== undefined) { result[key] = value; } return result; }, {}); } /** * @private * @return {?} */ }, { key: "processNavigations", value: function processNavigations() { var _this445 = this; this.navigations.subscribe( /** * @param {?} t * @return {?} */ function (t) { _this445.navigated = true; _this445.lastSuccessfulId = t.id; /** @type {?} */ _this445.events.next(new NavigationEnd(t.id, _this445.serializeUrl(t.extractedUrl), _this445.serializeUrl(_this445.currentUrlTree))); _this445.lastSuccessfulNavigation = _this445.currentNavigation; _this445.currentNavigation = null; t.resolve(true); }, /** * @param {?} e * @return {?} */ function (e) { _this445.console.warn("Unhandled Navigation Error: "); }); } /** * @private * @param {?} rawUrl * @param {?} source * @param {?} restoredState * @param {?} extras * @return {?} */ }, { key: "scheduleNavigation", value: function scheduleNavigation(rawUrl, source, restoredState, extras) { /** @type {?} */ var lastNavigation = this.getTransition(); // If the user triggers a navigation imperatively (e.g., by using navigateByUrl), // and that navigation results in 'replaceState' that leads to the same URL, // we should skip those. if (lastNavigation && source !== 'imperative' && lastNavigation.source === 'imperative' && lastNavigation.rawUrl.toString() === rawUrl.toString()) { return Promise.resolve(true); // return value is not used } // Because of a bug in IE and Edge, the location class fires two events (popstate and // hashchange) every single time. The second one should be ignored. Otherwise, the URL will // flicker. Handles the case when a popstate was emitted first. if (lastNavigation && source == 'hashchange' && lastNavigation.source === 'popstate' && lastNavigation.rawUrl.toString() === rawUrl.toString()) { return Promise.resolve(true); // return value is not used } // Because of a bug in IE and Edge, the location class fires two events (popstate and // hashchange) every single time. The second one should be ignored. Otherwise, the URL will // flicker. Handles the case when a hashchange was emitted first. if (lastNavigation && source == 'popstate' && lastNavigation.source === 'hashchange' && lastNavigation.rawUrl.toString() === rawUrl.toString()) { return Promise.resolve(true); // return value is not used } /** @type {?} */ var resolve = null; /** @type {?} */ var reject = null; /** @type {?} */ var promise = new Promise( /** * @param {?} res * @param {?} rej * @return {?} */ function (res, rej) { resolve = res; reject = rej; }); /** @type {?} */ var id = ++this.navigationId; this.setTransition({ id: id, source: source, restoredState: restoredState, currentUrlTree: this.currentUrlTree, currentRawUrl: this.rawUrlTree, rawUrl: rawUrl, extras: extras, resolve: resolve, reject: reject, promise: promise, currentSnapshot: this.routerState.snapshot, currentRouterState: this.routerState }); // Make sure that the error is propagated even though `processNavigations` catch // handler does not rethrow return promise["catch"]( /** * @param {?} e * @return {?} */ function (e) { return Promise.reject(e); }); } /** * @private * @param {?} url * @param {?} replaceUrl * @param {?} id * @param {?=} state * @return {?} */ }, { key: "setBrowserUrl", value: function setBrowserUrl(url, replaceUrl, id, state) { /** @type {?} */ var path = this.urlSerializer.serialize(url); state = state || {}; if (this.location.isCurrentPathEqualTo(path) || replaceUrl) { // TODO(jasonaden): Remove first `navigationId` and rely on `ng` namespace. this.location.replaceState(path, '', Object.assign({}, state, { navigationId: id })); } else { this.location.go(path, '', Object.assign({}, state, { navigationId: id })); } } /** * @private * @param {?} storedState * @param {?} storedUrl * @param {?} rawUrl * @return {?} */ }, { key: "resetStateAndUrl", value: function resetStateAndUrl(storedState, storedUrl, rawUrl) { /** @type {?} */ this.routerState = storedState; this.currentUrlTree = storedUrl; this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, rawUrl); this.resetUrlToCurrentUrlTree(); } /** * @private * @return {?} */ }, { key: "resetUrlToCurrentUrlTree", value: function resetUrlToCurrentUrlTree() { this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', { navigationId: this.lastSuccessfulId }); } }, { key: "url", get: function get() { return this.serializeUrl(this.currentUrlTree); } }]); return Router; }(); if (false) {} /** * @param {?} commands * @return {?} */ function validateCommands(commands) { for (var i = 0; i < commands.length; i++) { /** @type {?} */ var cmd = commands[i]; if (cmd == null) { throw new Error("The requested path contains ".concat(cmd, " segment at index ").concat(i)); } } } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@description * * Lets you link to specific routes in your app. * * Consider the following route configuration: * `[{ path: 'user/:name', component: UserCmp }]`. * When linking to this `user/:name` route, you use the `RouterLink` directive. * * If the link is static, you can use the directive as follows: * `<a routerLink="/user/bob">link to user component</a>` * * If you use dynamic values to generate the link, you can pass an array of path * segments, followed by the params for each segment. * * For instance `['/team', teamId, 'user', userName, {details: true}]` * means that we want to generate a link to `/team/11/user/bob;details=true`. * * Multiple static segments can be merged into one * (e.g., `['/team/11/user', userName, {details: true}]`). * * The first segment name can be prepended with `/`, `./`, or `../`: * * If the first segment begins with `/`, the router will look up the route from the root of the * app. * * If the first segment begins with `./`, or doesn't begin with a slash, the router will * instead look in the children of the current activated route. * * And if the first segment begins with `../`, the router will go up one level. * * You can set query params and fragment as follows: * * ``` * <a [routerLink]="['/user/bob']" [queryParams]="{debug: true}" fragment="education"> * link to user component * </a> * ``` * RouterLink will use these to generate this link: `/user/bob#education?debug=true`. * * (Deprecated in v4.0.0 use `queryParamsHandling` instead) You can also tell the * directive to preserve the current query params and fragment: * * ``` * <a [routerLink]="['/user/bob']" preserveQueryParams preserveFragment> * link to user component * </a> * ``` * * You can tell the directive how to handle queryParams. Available options are: * - `'merge'`: merge the queryParams into the current queryParams * - `'preserve'`: preserve the current queryParams * - default/`''`: use the queryParams only * * Same options for {\@link NavigationExtras#queryParamsHandling * NavigationExtras#queryParamsHandling}. * * ``` * <a [routerLink]="['/user/bob']" [queryParams]="{debug: true}" queryParamsHandling="merge"> * link to user component * </a> * ``` * * You can provide a `state` value to be persisted to the browser's History.state * property (See https://developer.mozilla.org/en-US/docs/Web/API/History#Properties). It's * used as follows: * * ``` * <a [routerLink]="['/user/bob']" [state]="{tracingId: 123}"> * link to user component * </a> * ``` * * And later the value can be read from the router through `router.getCurrentNavigation`. * For example, to capture the `tracingId` above during the `NavigationStart` event: * * ``` * // Get NavigationStart events * router.events.pipe(filter(e => e instanceof NavigationStart)).subscribe(e => { * const navigation = router.getCurrentNavigation(); * tracingService.trace({id: navigation.extras.state.tracingId}); * }); * ``` * * The router link directive always treats the provided input as a delta to the current url. * * For instance, if the current url is `/user/(box//aux:team)`. * * Then the following link `<a [routerLink]="['/user/jim']">Jim</a>` will generate the link * `/user/(jim//aux:team)`. * * See {\@link Router#createUrlTree createUrlTree} for more information. * * \@ngModule RouterModule * * \@publicApi */ var RouterLink = /*#__PURE__*/function () { /** * @param {?} router * @param {?} route * @param {?} tabIndex * @param {?} renderer * @param {?} el */ function RouterLink(router, route, tabIndex, renderer, el) { _classCallCheck(this, RouterLink); this.router = router; this.route = route; this.commands = []; if (tabIndex == null) { renderer.setAttribute(el.nativeElement, 'tabindex', '0'); } } /** * @param {?} commands * @return {?} */ _createClass2(RouterLink, [{ key: "onClick", /** * @return {?} */ value: function onClick() { /** @type {?} */ var extras = { skipLocationChange: attrBoolValue(this.skipLocationChange), replaceUrl: attrBoolValue(this.replaceUrl) }; this.router.navigateByUrl(this.urlTree, extras); return true; } /** * @return {?} */ }, { key: "routerLink", set: function set(commands) { if (commands != null) { this.commands = Array.isArray(commands) ? commands : [commands]; } else { this.commands = []; } } /** * @deprecated 4.0.0 use `queryParamsHandling` instead. * @param {?} value * @return {?} */ }, { key: "preserveQueryParams", set: function set(value) { if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["isDevMode"])() && /** @type {?} */ console && /** @type {?} */ console.warn) { console.warn('preserveQueryParams is deprecated!, use queryParamsHandling instead.'); } this.preserve = value; } }, { key: "urlTree", get: function get() { return this.router.createUrlTree(this.commands, { relativeTo: this.route, queryParams: this.queryParams, fragment: this.fragment, preserveQueryParams: attrBoolValue(this.preserve), queryParamsHandling: this.queryParamsHandling, preserveFragment: attrBoolValue(this.preserveFragment) }); } }]); return RouterLink; }(); RouterLink.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"], args: [{ selector: ':not(a):not(area)[routerLink]' }] }]; /** @nocollapse */ RouterLink.ctorParameters = function () { return [{ type: Router }, { type: ActivatedRoute }, { type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Attribute"], args: ['tabindex'] }] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Renderer2"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] }]; }; RouterLink.propDecorators = { queryParams: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], fragment: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], queryParamsHandling: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], preserveFragment: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], skipLocationChange: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], replaceUrl: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], state: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], routerLink: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], preserveQueryParams: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], onClick: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["HostListener"], args: ['click'] }] }; if (false) {} /** * \@description * * Lets you link to specific routes in your app. * * See `RouterLink` for more information. * * \@ngModule RouterModule * * \@publicApi */ var RouterLinkWithHref = /*#__PURE__*/function () { /** * @param {?} router * @param {?} route * @param {?} locationStrategy */ function RouterLinkWithHref(router, route, locationStrategy) { var _this446 = this; _classCallCheck(this, RouterLinkWithHref); this.router = router; this.route = route; this.locationStrategy = locationStrategy; this.commands = []; this.subscription = router.events.subscribe( /** * @param {?} s * @return {?} */ function (s) { if (s instanceof NavigationEnd) { _this446.updateTargetUrlAndHref(); } }); } /** * @param {?} commands * @return {?} */ _createClass2(RouterLinkWithHref, [{ key: "ngOnChanges", /** * @param {?} changes * @return {?} */ value: function ngOnChanges(changes) { this.updateTargetUrlAndHref(); } /** * @return {?} */ }, { key: "ngOnDestroy", value: function ngOnDestroy() { this.subscription.unsubscribe(); } /** * @param {?} button * @param {?} ctrlKey * @param {?} metaKey * @param {?} shiftKey * @return {?} */ }, { key: "onClick", value: function onClick(button, ctrlKey, metaKey, shiftKey) { if (button !== 0 || ctrlKey || metaKey || shiftKey) { return true; } if (typeof this.target === 'string' && this.target != '_self') { return true; } /** @type {?} */ var extras = { skipLocationChange: attrBoolValue(this.skipLocationChange), replaceUrl: attrBoolValue(this.replaceUrl), state: this.state }; this.router.navigateByUrl(this.urlTree, extras); return false; } /** * @private * @return {?} */ }, { key: "updateTargetUrlAndHref", value: function updateTargetUrlAndHref() { this.href = this.locationStrategy.prepareExternalUrl(this.router.serializeUrl(this.urlTree)); } /** * @return {?} */ }, { key: "routerLink", set: function set(commands) { if (commands != null) { this.commands = Array.isArray(commands) ? commands : [commands]; } else { this.commands = []; } } /** * @param {?} value * @return {?} */ }, { key: "preserveQueryParams", set: function set(value) { if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["isDevMode"])() && /** @type {?} */ console && /** @type {?} */ console.warn) { console.warn('preserveQueryParams is deprecated, use queryParamsHandling instead.'); } this.preserve = value; } }, { key: "urlTree", get: function get() { return this.router.createUrlTree(this.commands, { relativeTo: this.route, queryParams: this.queryParams, fragment: this.fragment, preserveQueryParams: attrBoolValue(this.preserve), queryParamsHandling: this.queryParamsHandling, preserveFragment: attrBoolValue(this.preserveFragment) }); } }]); return RouterLinkWithHref; }(); RouterLinkWithHref.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"], args: [{ selector: 'a[routerLink],area[routerLink]' }] }]; /** @nocollapse */ RouterLinkWithHref.ctorParameters = function () { return [{ type: Router }, { type: ActivatedRoute }, { type: _angular_common__WEBPACK_IMPORTED_MODULE_0__["LocationStrategy"] }]; }; RouterLinkWithHref.propDecorators = { target: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["HostBinding"], args: ['attr.target'] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], queryParams: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], fragment: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], queryParamsHandling: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], preserveFragment: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], skipLocationChange: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], replaceUrl: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], state: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], href: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["HostBinding"] }], routerLink: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], preserveQueryParams: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], onClick: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["HostListener"], args: ['click', ['$event.button', '$event.ctrlKey', '$event.metaKey', '$event.shiftKey']] }] }; if (false) {} /** * @param {?} s * @return {?} */ function attrBoolValue(s) { return s === '' || !!s; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * * \@description * * Lets you add a CSS class to an element when the link's route becomes active. * * This directive lets you add a CSS class to an element when the link's route * becomes active. * * Consider the following example: * * ``` * <a routerLink="/user/bob" routerLinkActive="active-link">Bob</a> * ``` * * When the url is either '/user' or '/user/bob', the active-link class will * be added to the `a` tag. If the url changes, the class will be removed. * * You can set more than one class, as follows: * * ``` * <a routerLink="/user/bob" routerLinkActive="class1 class2">Bob</a> * <a routerLink="/user/bob" [routerLinkActive]="['class1', 'class2']">Bob</a> * ``` * * You can configure RouterLinkActive by passing `exact: true`. This will add the classes * only when the url matches the link exactly. * * ``` * <a routerLink="/user/bob" routerLinkActive="active-link" [routerLinkActiveOptions]="{exact: * true}">Bob</a> * ``` * * You can assign the RouterLinkActive instance to a template variable and directly check * the `isActive` status. * ``` * <a routerLink="/user/bob" routerLinkActive #rla="routerLinkActive"> * Bob {{ rla.isActive ? '(already open)' : ''}} * </a> * ``` * * Finally, you can apply the RouterLinkActive directive to an ancestor of a RouterLink. * * ``` * <div routerLinkActive="active-link" [routerLinkActiveOptions]="{exact: true}"> * <a routerLink="/user/jim">Jim</a> * <a routerLink="/user/bob">Bob</a> * </div> * ``` * * This will set the active-link class on the div tag if the url is either '/user/jim' or * '/user/bob'. * * \@ngModule RouterModule * * \@publicApi */ var RouterLinkActive = /*#__PURE__*/function () { /** * @param {?} router * @param {?} element * @param {?} renderer * @param {?=} link * @param {?=} linkWithHref */ function RouterLinkActive(router, element, renderer, link, linkWithHref) { var _this447 = this; _classCallCheck(this, RouterLinkActive); this.router = router; this.element = element; this.renderer = renderer; this.link = link; this.linkWithHref = linkWithHref; this.classes = []; this.isActive = false; this.routerLinkActiveOptions = { exact: false }; this.subscription = router.events.subscribe( /** * @param {?} s * @return {?} */ function (s) { if (s instanceof NavigationEnd) { _this447.update(); } }); } /** * @return {?} */ _createClass2(RouterLinkActive, [{ key: "ngAfterContentInit", value: function ngAfterContentInit() { var _this448 = this; this.links.changes.subscribe( /** * @param {?} _ * @return {?} */ function (_) { return _this448.update(); }); this.linksWithHrefs.changes.subscribe( /** * @param {?} _ * @return {?} */ function (_) { return _this448.update(); }); this.update(); } /** * @param {?} data * @return {?} */ }, { key: "ngOnChanges", /** * @param {?} changes * @return {?} */ value: function ngOnChanges(changes) { this.update(); } /** * @return {?} */ }, { key: "ngOnDestroy", value: function ngOnDestroy() { this.subscription.unsubscribe(); } /** * @private * @return {?} */ }, { key: "update", value: function update() { var _this449 = this; if (!this.links || !this.linksWithHrefs || !this.router.navigated) return; Promise.resolve().then( /** * @return {?} */ function () { /** @type {?} */ var hasActiveLinks = _this449.hasActiveLinks(); if (_this449.isActive !== hasActiveLinks) { /** @type {?} */ _this449.isActive = hasActiveLinks; _this449.classes.forEach( /** * @param {?} c * @return {?} */ function (c) { if (hasActiveLinks) { _this449.renderer.addClass(_this449.element.nativeElement, c); } else { _this449.renderer.removeClass(_this449.element.nativeElement, c); } }); } }); } /** * @private * @param {?} router * @return {?} */ }, { key: "isLinkActive", value: function isLinkActive(router) { var _this450 = this; return ( /** * @param {?} link * @return {?} */ function (link) { return router.isActive(link.urlTree, _this450.routerLinkActiveOptions.exact); } ); } /** * @private * @return {?} */ }, { key: "hasActiveLinks", value: function hasActiveLinks() { /** @type {?} */ var isActiveCheckFn = this.isLinkActive(this.router); return this.link && isActiveCheckFn(this.link) || this.linkWithHref && isActiveCheckFn(this.linkWithHref) || this.links.some(isActiveCheckFn) || this.linksWithHrefs.some(isActiveCheckFn); } }, { key: "routerLinkActive", set: function set(data) { /** @type {?} */ var classes = Array.isArray(data) ? data : data.split(' '); this.classes = classes.filter( /** * @param {?} c * @return {?} */ function (c) { return !!c; }); } }]); return RouterLinkActive; }(); RouterLinkActive.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"], args: [{ selector: '[routerLinkActive]', exportAs: 'routerLinkActive' }] }]; /** @nocollapse */ RouterLinkActive.ctorParameters = function () { return [{ type: Router }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Renderer2"] }, { type: RouterLink, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"] }] }, { type: RouterLinkWithHref, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"] }] }]; }; RouterLinkActive.propDecorators = { links: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ContentChildren"], args: [RouterLink, { descendants: true }] }], linksWithHrefs: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ContentChildren"], args: [RouterLinkWithHref, { descendants: true }] }], routerLinkActiveOptions: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }], routerLinkActive: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"] }] }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @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 */ /** * Store contextual information about a `RouterOutlet` * * \@publicApi */ var OutletContext = function OutletContext() { _classCallCheck(this, OutletContext); this.outlet = null; this.route = null; this.resolver = null; this.children = new ChildrenOutletContexts(); this.attachRef = null; }; if (false) {} /** * Store contextual information about the children (= nested) `RouterOutlet` * * \@publicApi */ var ChildrenOutletContexts = /*#__PURE__*/function () { function ChildrenOutletContexts() { _classCallCheck(this, ChildrenOutletContexts); // contexts for child outlets, by name. this.contexts = new Map(); } /** * Called when a `RouterOutlet` directive is instantiated * @param {?} childName * @param {?} outlet * @return {?} */ _createClass2(ChildrenOutletContexts, [{ key: "onChildOutletCreated", value: function onChildOutletCreated(childName, outlet) { /** @type {?} */ var context = this.getOrCreateContext(childName); context.outlet = outlet; this.contexts.set(childName, context); } /** * Called when a `RouterOutlet` directive is destroyed. * We need to keep the context as the outlet could be destroyed inside a NgIf and might be * re-created later. * @param {?} childName * @return {?} */ }, { key: "onChildOutletDestroyed", value: function onChildOutletDestroyed(childName) { /** @type {?} */ var context = this.getContext(childName); if (context) { context.outlet = null; } } /** * Called when the corresponding route is deactivated during navigation. * Because the component get destroyed, all children outlet are destroyed. * @return {?} */ }, { key: "onOutletDeactivated", value: function onOutletDeactivated() { /** @type {?} */ var contexts = this.contexts; this.contexts = new Map(); return contexts; } /** * @param {?} contexts * @return {?} */ }, { key: "onOutletReAttached", value: function onOutletReAttached(contexts) { this.contexts = contexts; } /** * @param {?} childName * @return {?} */ }, { key: "getOrCreateContext", value: function getOrCreateContext(childName) { /** @type {?} */ var context = this.getContext(childName); if (!context) { context = new OutletContext(); this.contexts.set(childName, context); } return context; } /** * @param {?} childName * @return {?} */ }, { key: "getContext", value: function getContext(childName) { return this.contexts.get(childName) || null; } }]); return ChildrenOutletContexts; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@description * * Acts as a placeholder that Angular dynamically fills based on the current router state. * * Each outlet can have a unique name, determined by the optional `name` attribute. * The name cannot be set or changed dynamically. If not set, default value is "primary". * * ``` * <router-outlet></router-outlet> * <router-outlet name='left'></router-outlet> * <router-outlet name='right'></router-outlet> * ``` * * A router outlet emits an activate event when a new component is instantiated, * and a deactivate event when a component is destroyed. * * ``` * <router-outlet * (activate)='onActivate($event)' * (deactivate)='onDeactivate($event)'></router-outlet> * ``` * \@ngModule RouterModule * * \@publicApi */ var RouterOutlet = /*#__PURE__*/function () { /** * @param {?} parentContexts * @param {?} location * @param {?} resolver * @param {?} name * @param {?} changeDetector */ function RouterOutlet(parentContexts, location, resolver, name, changeDetector) { _classCallCheck(this, RouterOutlet); this.parentContexts = parentContexts; this.location = location; this.resolver = resolver; this.changeDetector = changeDetector; this.activated = null; this._activatedRoute = null; this.activateEvents = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["EventEmitter"](); this.deactivateEvents = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["EventEmitter"](); this.name = name || PRIMARY_OUTLET; parentContexts.onChildOutletCreated(this.name, this); } /** * @return {?} */ _createClass2(RouterOutlet, [{ key: "ngOnDestroy", value: function ngOnDestroy() { this.parentContexts.onChildOutletDestroyed(this.name); } /** * @return {?} */ }, { key: "ngOnInit", value: function ngOnInit() { if (!this.activated) { // If the outlet was not instantiated at the time the route got activated we need to populate // the outlet when it is initialized (ie inside a NgIf) /** @type {?} */ var context = this.parentContexts.getContext(this.name); if (context && context.route) { if (context.attachRef) { // `attachRef` is populated when there is an existing component to mount this.attach(context.attachRef, context.route); } else { // otherwise the component defined in the configuration is created this.activateWith(context.route, context.resolver || null); } } } } /** * @return {?} */ }, { key: "detach", /** * Called when the `RouteReuseStrategy` instructs to detach the subtree * @return {?} */ value: function detach() { if (!this.activated) throw new Error('Outlet is not activated'); this.location.detach(); /** @type {?} */ var cmp = this.activated; this.activated = null; this._activatedRoute = null; return cmp; } /** * Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree * @param {?} ref * @param {?} activatedRoute * @return {?} */ }, { key: "attach", value: function attach(ref, activatedRoute) { this.activated = ref; this._activatedRoute = activatedRoute; this.location.insert(ref.hostView); } /** * @return {?} */ }, { key: "deactivate", value: function deactivate() { if (this.activated) { /** @type {?} */ var c = this.component; this.activated.destroy(); this.activated = null; this._activatedRoute = null; this.deactivateEvents.emit(c); } } /** * @param {?} activatedRoute * @param {?} resolver * @return {?} */ }, { key: "activateWith", value: function activateWith(activatedRoute, resolver) { if (this.isActivated) { throw new Error('Cannot activate an already activated outlet'); } this._activatedRoute = activatedRoute; /** @type {?} */ var snapshot = activatedRoute._futureSnapshot; /** @type {?} */ var component = /** @type {?} */ /** @type {?} */ snapshot.routeConfig.component; resolver = resolver || this.resolver; /** @type {?} */ var factory = resolver.resolveComponentFactory(component); /** @type {?} */ var childContexts = this.parentContexts.getOrCreateContext(this.name).children; /** @type {?} */ var injector = new OutletInjector(activatedRoute, childContexts, this.location.injector); this.activated = this.location.createComponent(factory, this.location.length, injector); // Calling `markForCheck` to make sure we will run the change detection when the // `RouterOutlet` is inside a `ChangeDetectionStrategy.OnPush` component. this.changeDetector.markForCheck(); this.activateEvents.emit(this.activated.instance); } }, { key: "isActivated", get: function get() { return !!this.activated; } /** * @return {?} */ }, { key: "component", get: function get() { if (!this.activated) throw new Error('Outlet is not activated'); return this.activated.instance; } /** * @return {?} */ }, { key: "activatedRoute", get: function get() { if (!this.activated) throw new Error('Outlet is not activated'); return ( /** @type {?} */ this._activatedRoute ); } /** * @return {?} */ }, { key: "activatedRouteData", get: function get() { if (this._activatedRoute) { return this._activatedRoute.snapshot.data; } return {}; } }]); return RouterOutlet; }(); RouterOutlet.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"], args: [{ selector: 'router-outlet', exportAs: 'outlet' }] }]; /** @nocollapse */ RouterOutlet.ctorParameters = function () { return [{ type: ChildrenOutletContexts }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewContainerRef"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ComponentFactoryResolver"] }, { type: String, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Attribute"], args: ['name'] }] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectorRef"] }]; }; RouterOutlet.propDecorators = { activateEvents: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Output"], args: ['activate'] }], deactivateEvents: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Output"], args: ['deactivate'] }] }; if (false) {} var OutletInjector = /*#__PURE__*/function () { /** * @param {?} route * @param {?} childContexts * @param {?} parent */ function OutletInjector(route, childContexts, parent) { _classCallCheck(this, OutletInjector); this.route = route; this.childContexts = childContexts; this.parent = parent; } /** * @param {?} token * @param {?=} notFoundValue * @return {?} */ _createClass2(OutletInjector, [{ key: "get", value: function get(token, notFoundValue) { if (token === ActivatedRoute) { return this.route; } if (token === ChildrenOutletContexts) { return this.childContexts; } return this.parent.get(token, notFoundValue); } }]); return OutletInjector; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@description * * Provides a preloading strategy. * * \@publicApi * @abstract */ var PreloadingStrategy = function PreloadingStrategy() { _classCallCheck(this, PreloadingStrategy); }; if (false) {} /** * \@description * * Provides a preloading strategy that preloads all modules as quickly as possible. * * ``` * RouteModule.forRoot(ROUTES, {preloadingStrategy: PreloadAllModules}) * ``` * * \@publicApi */ var PreloadAllModules = /*#__PURE__*/function () { function PreloadAllModules() { _classCallCheck(this, PreloadAllModules); } _createClass2(PreloadAllModules, [{ key: "preload", /** * @param {?} route * @param {?} fn * @return {?} */ value: function preload(route, fn) { return fn().pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["catchError"])( /** * @return {?} */ function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(null); })); } }]); return PreloadAllModules; }(); /** * \@description * * Provides a preloading strategy that does not preload any modules. * * This strategy is enabled by default. * * \@publicApi */ var NoPreloading = /*#__PURE__*/function () { function NoPreloading() { _classCallCheck(this, NoPreloading); } _createClass2(NoPreloading, [{ key: "preload", /** * @param {?} route * @param {?} fn * @return {?} */ value: function preload(route, fn) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(null); } }]); return NoPreloading; }(); /** * The preloader optimistically loads all router configurations to * make navigations into lazily-loaded sections of the application faster. * * The preloader runs in the background. When the router bootstraps, the preloader * starts listening to all navigation events. After every such event, the preloader * will check if any configurations can be loaded lazily. * * If a route is protected by `canLoad` guards, the preloaded will not load it. * * \@publicApi */ var RouterPreloader = /*#__PURE__*/function () { /** * @param {?} router * @param {?} moduleLoader * @param {?} compiler * @param {?} injector * @param {?} preloadingStrategy */ function RouterPreloader(router, moduleLoader, compiler, injector, preloadingStrategy) { _classCallCheck(this, RouterPreloader); this.router = router; this.injector = injector; this.preloadingStrategy = preloadingStrategy; /** @type {?} */ var onStartLoad = /** * @param {?} r * @return {?} */ function onStartLoad(r) { return router.triggerEvent(new RouteConfigLoadStart(r)); }; /** @type {?} */ var onEndLoad = /** * @param {?} r * @return {?} */ function onEndLoad(r) { return router.triggerEvent(new RouteConfigLoadEnd(r)); }; this.loader = new RouterConfigLoader(moduleLoader, compiler, onStartLoad, onEndLoad); } /** * @return {?} */ _createClass2(RouterPreloader, [{ key: "setUpPreloading", value: function setUpPreloading() { var _this451 = this; this.subscription = this.router.events.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["filter"])( /** * @param {?} e * @return {?} */ function (e) { return e instanceof NavigationEnd; }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["concatMap"])( /** * @return {?} */ function () { return _this451.preload(); })).subscribe( /** * @return {?} */ function () {}); } /** * @return {?} */ }, { key: "preload", value: function preload() { /** @type {?} */ var ngModule = this.injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleRef"]); return this.processRoutes(ngModule, this.router.config); } // TODO(jasonaden): This class relies on code external to the class to call setUpPreloading. If // this hasn't been done, ngOnDestroy will fail as this.subscription will be undefined. This // should be refactored. /** * @return {?} */ }, { key: "ngOnDestroy", value: function ngOnDestroy() { this.subscription.unsubscribe(); } /** * @private * @param {?} ngModule * @param {?} routes * @return {?} */ }, { key: "processRoutes", value: function processRoutes(ngModule, routes) { /** @type {?} */ var res = []; var _iterator55 = _createForOfIteratorHelper(routes), _step55; try { for (_iterator55.s(); !(_step55 = _iterator55.n()).done;) { var route = _step55.value; // we already have the config loaded, just recurse if (route.loadChildren && !route.canLoad && route._loadedConfig) { /** @type {?} */ var childConfig = route._loadedConfig; res.push(this.processRoutes(childConfig.module, childConfig.routes)); // no config loaded, fetch the config } else if (route.loadChildren && !route.canLoad) { res.push(this.preloadConfig(ngModule, route)); // recurse into children } else if (route.children) { res.push(this.processRoutes(ngModule, route.children)); } } } catch (err) { _iterator55.e(err); } finally { _iterator55.f(); } return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(res).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeAll"])(), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])( /** * @param {?} _ * @return {?} */ function (_) { return void 0; })); } /** * @private * @param {?} ngModule * @param {?} route * @return {?} */ }, { key: "preloadConfig", value: function preloadConfig(ngModule, route) { var _this452 = this; return this.preloadingStrategy.preload(route, /** * @return {?} */ function () { /** @type {?} */ var loaded$ = _this452.loader.load(ngModule.injector, route); return loaded$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])( /** * @param {?} config * @return {?} */ function (config) { route._loadedConfig = config; return _this452.processRoutes(config.module, config.routes); })); }); } }]); return RouterPreloader; }(); RouterPreloader.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"] }]; /** @nocollapse */ RouterPreloader.ctorParameters = function () { return [{ type: Router }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleFactoryLoader"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Compiler"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injector"] }, { type: PreloadingStrategy }]; }; if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ var RouterScroller = /*#__PURE__*/function () { /** * @param {?} router * @param {?} viewportScroller * @param {?=} options */ function RouterScroller(router, viewportScroller) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; _classCallCheck(this, RouterScroller); this.router = router; this.viewportScroller = viewportScroller; this.options = options; this.lastId = 0; this.lastSource = 'imperative'; this.restoredId = 0; this.store = {}; // Default both options to 'disabled' options.scrollPositionRestoration = options.scrollPositionRestoration || 'disabled'; options.anchorScrolling = options.anchorScrolling || 'disabled'; } /** * @return {?} */ _createClass2(RouterScroller, [{ key: "init", value: function init() { // we want to disable the automatic scrolling because having two places // responsible for scrolling results race conditions, especially given // that browser don't implement this behavior consistently if (this.options.scrollPositionRestoration !== 'disabled') { this.viewportScroller.setHistoryScrollRestoration('manual'); } this.routerEventsSubscription = this.createScrollEvents(); this.scrollEventsSubscription = this.consumeScrollEvents(); } /** * @private * @return {?} */ }, { key: "createScrollEvents", value: function createScrollEvents() { var _this453 = this; return this.router.events.subscribe( /** * @param {?} e * @return {?} */ function (e) { if (e instanceof NavigationStart) { // store the scroll position of the current stable navigations. _this453.store[_this453.lastId] = _this453.viewportScroller.getScrollPosition(); _this453.lastSource = e.navigationTrigger; _this453.restoredId = e.restoredState ? e.restoredState.navigationId : 0; } else if (e instanceof NavigationEnd) { _this453.lastId = e.id; _this453.scheduleScrollEvent(e, _this453.router.parseUrl(e.urlAfterRedirects).fragment); } }); } /** * @private * @return {?} */ }, { key: "consumeScrollEvents", value: function consumeScrollEvents() { var _this454 = this; return this.router.events.subscribe( /** * @param {?} e * @return {?} */ function (e) { if (!(e instanceof Scroll)) return; // a popstate event. The pop state event will always ignore anchor scrolling. if (e.position) { if (_this454.options.scrollPositionRestoration === 'top') { _this454.viewportScroller.scrollToPosition([0, 0]); } else if (_this454.options.scrollPositionRestoration === 'enabled') { _this454.viewportScroller.scrollToPosition(e.position); } // imperative navigation "forward" } else { if (e.anchor && _this454.options.anchorScrolling === 'enabled') { _this454.viewportScroller.scrollToAnchor(e.anchor); } else if (_this454.options.scrollPositionRestoration !== 'disabled') { _this454.viewportScroller.scrollToPosition([0, 0]); } } }); } /** * @private * @param {?} routerEvent * @param {?} anchor * @return {?} */ }, { key: "scheduleScrollEvent", value: function scheduleScrollEvent(routerEvent, anchor) { this.router.triggerEvent(new Scroll(routerEvent, this.lastSource === 'popstate' ? this.store[this.restoredId] : null, anchor)); } /** * @return {?} */ }, { key: "ngOnDestroy", value: function ngOnDestroy() { if (this.routerEventsSubscription) { this.routerEventsSubscription.unsubscribe(); } if (this.scrollEventsSubscription) { this.scrollEventsSubscription.unsubscribe(); } } }]); return RouterScroller; }(); if (false) {} /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * The directives defined in the `RouterModule`. * @type {?} */ var ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, ɵEmptyOutletComponent]; /** * A [DI token](guide/glossary/#di-token) for the router service. * * \@publicApi * @type {?} */ var ROUTER_CONFIGURATION = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('ROUTER_CONFIGURATION'); /** * \@docsNotRequired * @type {?} */ var ROUTER_FORROOT_GUARD = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('ROUTER_FORROOT_GUARD'); var ɵ0 = { enableTracing: false }; /** @type {?} */ var ROUTER_PROVIDERS = [_angular_common__WEBPACK_IMPORTED_MODULE_0__["Location"], { provide: UrlSerializer, useClass: DefaultUrlSerializer }, { provide: Router, useFactory: setupRouter, deps: [_angular_core__WEBPACK_IMPORTED_MODULE_1__["ApplicationRef"], UrlSerializer, ChildrenOutletContexts, _angular_common__WEBPACK_IMPORTED_MODULE_0__["Location"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injector"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleFactoryLoader"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["Compiler"], ROUTES, ROUTER_CONFIGURATION, [UrlHandlingStrategy, new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"]()], [RouteReuseStrategy, new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"]()]] }, ChildrenOutletContexts, { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] }, { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleFactoryLoader"], useClass: _angular_core__WEBPACK_IMPORTED_MODULE_1__["SystemJsNgModuleLoader"] }, RouterPreloader, NoPreloading, PreloadAllModules, { provide: ROUTER_CONFIGURATION, useValue: ɵ0 }]; /** * @return {?} */ function routerNgProbeToken() { return new _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgProbeToken"]('Router', Router); } /** * \@usageNotes * * RouterModule can be imported multiple times: once per lazily-loaded bundle. * Since the router deals with a global shared resource--location, we cannot have * more than one router service active. * * That is why there are two ways to create the module: `RouterModule.forRoot` and * `RouterModule.forChild`. * * * `forRoot` creates a module that contains all the directives, the given routes, and the router * service itself. * * `forChild` creates a module that contains all the directives and the given routes, but does not * include the router service. * * When registered at the root, the module should be used as follows * * ``` * \@NgModule({ * imports: [RouterModule.forRoot(ROUTES)] * }) * class MyNgModule {} * ``` * * For submodules and lazy loaded submodules the module should be used as follows: * * ``` * \@NgModule({ * imports: [RouterModule.forChild(ROUTES)] * }) * class MyNgModule {} * ``` * * \@description * * Adds router directives and providers. * * Managing state transitions is one of the hardest parts of building applications. This is * especially true on the web, where you also need to ensure that the state is reflected in the URL. * In addition, we often want to split applications into multiple bundles and load them on demand. * Doing this transparently is not trivial. * * The Angular router service solves these problems. Using the router, you can declaratively specify * application states, manage state transitions while taking care of the URL, and load bundles on * demand. * * @see [Routing and Navigation](guide/router.html) for an * overview of how the router service should be used. * * \@publicApi */ var RouterModule = /*#__PURE__*/function () { // Note: We are injecting the Router so it gets created eagerly... /** * @param {?} guard * @param {?} router */ function RouterModule(guard, router) { _classCallCheck(this, RouterModule); } /** * Creates and configures a module with all the router providers and directives. * Optionally sets up an application listener to perform an initial navigation. * * @param {?} routes An array of `Route` objects that define the navigation paths for the application. * @param {?=} config An `ExtraOptions` configuration object that controls how navigation is performed. * @return {?} The new router module. */ _createClass2(RouterModule, null, [{ key: "forRoot", value: function forRoot(routes, config) { return { ngModule: RouterModule, providers: [ROUTER_PROVIDERS, provideRoutes(routes), { provide: ROUTER_FORROOT_GUARD, useFactory: provideForRootGuard, deps: [[Router, new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"](), new _angular_core__WEBPACK_IMPORTED_MODULE_1__["SkipSelf"]()]] }, { provide: ROUTER_CONFIGURATION, useValue: config ? config : {} }, { provide: _angular_common__WEBPACK_IMPORTED_MODULE_0__["LocationStrategy"], useFactory: provideLocationStrategy, deps: [_angular_common__WEBPACK_IMPORTED_MODULE_0__["PlatformLocation"], [new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"](_angular_common__WEBPACK_IMPORTED_MODULE_0__["APP_BASE_HREF"]), new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"]()], ROUTER_CONFIGURATION] }, { provide: RouterScroller, useFactory: createRouterScroller, deps: [Router, _angular_common__WEBPACK_IMPORTED_MODULE_0__["ViewportScroller"], ROUTER_CONFIGURATION] }, { provide: PreloadingStrategy, useExisting: config && config.preloadingStrategy ? config.preloadingStrategy : NoPreloading }, { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgProbeToken"], multi: true, useFactory: routerNgProbeToken }, provideRouterInitializer()] }; } /** * Creates a module with all the router directives and a provider registering routes. * @param {?} routes * @return {?} */ }, { key: "forChild", value: function forChild(routes) { return { ngModule: RouterModule, providers: [provideRoutes(routes)] }; } }]); return RouterModule; }(); RouterModule.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"], args: [{ declarations: ROUTER_DIRECTIVES, exports: ROUTER_DIRECTIVES, entryComponents: [ɵEmptyOutletComponent] }] }]; /** @nocollapse */ RouterModule.ctorParameters = function () { return [{ type: undefined, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"] }, { type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"], args: [ROUTER_FORROOT_GUARD] }] }, { type: Router, decorators: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"] }] }]; }; /** * @param {?} router * @param {?} viewportScroller * @param {?} config * @return {?} */ function createRouterScroller(router, viewportScroller, config) { if (config.scrollOffset) { viewportScroller.setOffset(config.scrollOffset); } return new RouterScroller(router, viewportScroller, config); } /** * @param {?} platformLocationStrategy * @param {?} baseHref * @param {?=} options * @return {?} */ function provideLocationStrategy(platformLocationStrategy, baseHref) { var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; return options.useHash ? new _angular_common__WEBPACK_IMPORTED_MODULE_0__["HashLocationStrategy"](platformLocationStrategy, baseHref) : new _angular_common__WEBPACK_IMPORTED_MODULE_0__["PathLocationStrategy"](platformLocationStrategy, baseHref); } /** * @param {?} router * @return {?} */ function provideForRootGuard(router) { if (router) { throw new Error("RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead."); } return 'guarded'; } /** * Registers a [DI provider](guide/glossary#provider) for a set of routes. * \@usageNotes * * ``` * \@NgModule({ * imports: [RouterModule.forChild(ROUTES)], * providers: [provideRoutes(EXTRA_ROUTES)] * }) * class MyNgModule {} * ``` * * \@publicApi * @param {?} routes The route configuration to provide. * * @return {?} */ function provideRoutes(routes) { return [{ provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ANALYZE_FOR_ENTRY_COMPONENTS"], multi: true, useValue: routes }, { provide: ROUTES, multi: true, useValue: routes }]; } /** * A set of configuration options for a router module, provided in the * `forRoot()` method. * * \@publicApi * @record */ function ExtraOptions() {} if (false) {} /** * @param {?} ref * @param {?} urlSerializer * @param {?} contexts * @param {?} location * @param {?} injector * @param {?} loader * @param {?} compiler * @param {?} config * @param {?=} opts * @param {?=} urlHandlingStrategy * @param {?=} routeReuseStrategy * @return {?} */ function setupRouter(ref, urlSerializer, contexts, location, injector, loader, compiler, config) { var opts = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : {}; var urlHandlingStrategy = arguments.length > 9 ? arguments[9] : undefined; var routeReuseStrategy = arguments.length > 10 ? arguments[10] : undefined; /** @type {?} */ var router = new Router(null, urlSerializer, contexts, location, injector, loader, compiler, flatten(config)); if (urlHandlingStrategy) { router.urlHandlingStrategy = urlHandlingStrategy; } if (routeReuseStrategy) { router.routeReuseStrategy = routeReuseStrategy; } if (opts.errorHandler) { router.errorHandler = opts.errorHandler; } if (opts.malformedUriErrorHandler) { router.malformedUriErrorHandler = opts.malformedUriErrorHandler; } if (opts.enableTracing) { /** @type {?} */ var dom = Object(_angular_platform_browser__WEBPACK_IMPORTED_MODULE_4__["ɵgetDOM"])(); router.events.subscribe( /** * @param {?} e * @return {?} */ function (e) { dom.logGroup("Router Event: ".concat( /** @type {?} */ e.constructor.name)); dom.log(e.toString()); dom.log(e); dom.logGroupEnd(); }); } if (opts.onSameUrlNavigation) { router.onSameUrlNavigation = opts.onSameUrlNavigation; } if (opts.paramsInheritanceStrategy) { router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy; } if (opts.urlUpdateStrategy) { router.urlUpdateStrategy = opts.urlUpdateStrategy; } if (opts.relativeLinkResolution) { router.relativeLinkResolution = opts.relativeLinkResolution; } return router; } /** * @param {?} router * @return {?} */ function rootRoute(router) { return router.routerState.root; } /** * Router initialization requires two steps: * * First, we start the navigation in a `APP_INITIALIZER` to block the bootstrap if * a resolver or a guard executes asynchronously. * * Next, we actually run activation in a `BOOTSTRAP_LISTENER`, using the * `afterPreactivation` hook provided by the router. * The router navigation starts, reaches the point when preactivation is done, and then * pauses. It waits for the hook to be resolved. We then resolve it only in a bootstrap listener. */ var RouterInitializer = /*#__PURE__*/function () { /** * @param {?} injector */ function RouterInitializer(injector) { _classCallCheck(this, RouterInitializer); this.injector = injector; this.initNavigation = false; this.resultOfPreactivationDone = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"](); } /** * @return {?} */ _createClass2(RouterInitializer, [{ key: "appInitializer", value: function appInitializer() { var _this455 = this; /** @type {?} */ var p = this.injector.get(_angular_common__WEBPACK_IMPORTED_MODULE_0__["LOCATION_INITIALIZED"], Promise.resolve(null)); return p.then( /** * @return {?} */ function () { /** @type {?} */ var resolve = /** @type {?} */ null; /** @type {?} */ var res = new Promise( /** * @param {?} r * @return {?} */ function (r) { return resolve = r; }); /** @type {?} */ var router = _this455.injector.get(Router); /** @type {?} */ var opts = _this455.injector.get(ROUTER_CONFIGURATION); if (_this455.isLegacyDisabled(opts) || _this455.isLegacyEnabled(opts)) { resolve(true); } else if (opts.initialNavigation === 'disabled') { router.setUpLocationChangeListener(); resolve(true); } else if (opts.initialNavigation === 'enabled') { router.hooks.afterPreactivation = /** * @return {?} */ function () { // only the initial navigation should be delayed if (!_this455.initNavigation) { _this455.initNavigation = true; resolve(true); return _this455.resultOfPreactivationDone; // subsequent navigations should not be delayed } else { return ( /** @type {?} */ Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(null) ); } }; router.initialNavigation(); } else { throw new Error("Invalid initialNavigation options: '".concat(opts.initialNavigation, "'")); } return res; }); } /** * @param {?} bootstrappedComponentRef * @return {?} */ }, { key: "bootstrapListener", value: function bootstrapListener(bootstrappedComponentRef) { /** @type {?} */ var opts = this.injector.get(ROUTER_CONFIGURATION); /** @type {?} */ var preloader = this.injector.get(RouterPreloader); /** @type {?} */ var routerScroller = this.injector.get(RouterScroller); /** @type {?} */ var router = this.injector.get(Router); /** @type {?} */ var ref = this.injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ApplicationRef"]); if (bootstrappedComponentRef !== ref.components[0]) { return; } if (this.isLegacyEnabled(opts)) { router.initialNavigation(); } else if (this.isLegacyDisabled(opts)) { router.setUpLocationChangeListener(); } preloader.setUpPreloading(); routerScroller.init(); router.resetRootComponentType(ref.componentTypes[0]); this.resultOfPreactivationDone.next( /** @type {?} */ null); this.resultOfPreactivationDone.complete(); } /** * @private * @param {?} opts * @return {?} */ }, { key: "isLegacyEnabled", value: function isLegacyEnabled(opts) { return opts.initialNavigation === 'legacy_enabled' || opts.initialNavigation === true || opts.initialNavigation === undefined; } /** * @private * @param {?} opts * @return {?} */ }, { key: "isLegacyDisabled", value: function isLegacyDisabled(opts) { return opts.initialNavigation === 'legacy_disabled' || opts.initialNavigation === false; } }]); return RouterInitializer; }(); RouterInitializer.decorators = [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"] }]; /** @nocollapse */ RouterInitializer.ctorParameters = function () { return [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injector"] }]; }; if (false) {} /** * @param {?} r * @return {?} */ function getAppInitializer(r) { return r.appInitializer.bind(r); } /** * @param {?} r * @return {?} */ function getBootstrapListener(r) { return r.bootstrapListener.bind(r); } /** * A [DI token](guide/glossary/#di-token) for the router initializer that * is called after the app is bootstrapped. * * \@publicApi * @type {?} */ var ROUTER_INITIALIZER = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('Router Initializer'); /** * @return {?} */ function provideRouterInitializer() { return [RouterInitializer, { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["APP_INITIALIZER"], multi: true, useFactory: getAppInitializer, deps: [RouterInitializer] }, { provide: ROUTER_INITIALIZER, useFactory: getBootstrapListener, deps: [RouterInitializer] }, { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["APP_BOOTSTRAP_LISTENER"], multi: true, useExisting: ROUTER_INITIALIZER }]; } /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * \@publicApi * @type {?} */ var VERSION = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Version"]('8.2.12'); /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * @fileoverview added by tsickle * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc */ /** * Generated bundle index. Do not edit. */ //# sourceMappingURL=router.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/index.js": /*!*********************************************!*\ !*** ./node_modules/rxjs/_esm2015/index.js ***! \*********************************************/ /*! exports provided: Observable, ConnectableObservable, GroupedObservable, observable, Subject, BehaviorSubject, ReplaySubject, AsyncSubject, asap, asapScheduler, async, asyncScheduler, queue, queueScheduler, animationFrame, animationFrameScheduler, VirtualTimeScheduler, VirtualAction, Scheduler, Subscription, Subscriber, Notification, NotificationKind, pipe, noop, identity, isObservable, ArgumentOutOfRangeError, EmptyError, ObjectUnsubscribedError, UnsubscriptionError, TimeoutError, bindCallback, bindNodeCallback, combineLatest, concat, defer, empty, forkJoin, from, fromEvent, fromEventPattern, generate, iif, interval, merge, never, of, onErrorResumeNext, pairs, partition, race, range, throwError, timer, using, zip, scheduled, EMPTY, NEVER, config */ /***/ function node_modulesRxjs_esm2015IndexJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _internal_Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./internal/Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Observable", function () { return _internal_Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]; }); /* harmony import */ var _internal_observable_ConnectableObservable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./internal/observable/ConnectableObservable */ "./node_modules/rxjs/_esm2015/internal/observable/ConnectableObservable.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ConnectableObservable", function () { return _internal_observable_ConnectableObservable__WEBPACK_IMPORTED_MODULE_1__["ConnectableObservable"]; }); /* harmony import */ var _internal_operators_groupBy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./internal/operators/groupBy */ "./node_modules/rxjs/_esm2015/internal/operators/groupBy.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GroupedObservable", function () { return _internal_operators_groupBy__WEBPACK_IMPORTED_MODULE_2__["GroupedObservable"]; }); /* harmony import */ var _internal_symbol_observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./internal/symbol/observable */ "./node_modules/rxjs/_esm2015/internal/symbol/observable.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "observable", function () { return _internal_symbol_observable__WEBPACK_IMPORTED_MODULE_3__["observable"]; }); /* harmony import */ var _internal_Subject__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ./internal/Subject */ "./node_modules/rxjs/_esm2015/internal/Subject.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Subject", function () { return _internal_Subject__WEBPACK_IMPORTED_MODULE_4__["Subject"]; }); /* harmony import */ var _internal_BehaviorSubject__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__( /*! ./internal/BehaviorSubject */ "./node_modules/rxjs/_esm2015/internal/BehaviorSubject.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BehaviorSubject", function () { return _internal_BehaviorSubject__WEBPACK_IMPORTED_MODULE_5__["BehaviorSubject"]; }); /* harmony import */ var _internal_ReplaySubject__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__( /*! ./internal/ReplaySubject */ "./node_modules/rxjs/_esm2015/internal/ReplaySubject.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ReplaySubject", function () { return _internal_ReplaySubject__WEBPACK_IMPORTED_MODULE_6__["ReplaySubject"]; }); /* harmony import */ var _internal_AsyncSubject__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__( /*! ./internal/AsyncSubject */ "./node_modules/rxjs/_esm2015/internal/AsyncSubject.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AsyncSubject", function () { return _internal_AsyncSubject__WEBPACK_IMPORTED_MODULE_7__["AsyncSubject"]; }); /* harmony import */ var _internal_scheduler_asap__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__( /*! ./internal/scheduler/asap */ "./node_modules/rxjs/_esm2015/internal/scheduler/asap.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "asap", function () { return _internal_scheduler_asap__WEBPACK_IMPORTED_MODULE_8__["asap"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "asapScheduler", function () { return _internal_scheduler_asap__WEBPACK_IMPORTED_MODULE_8__["asapScheduler"]; }); /* harmony import */ var _internal_scheduler_async__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__( /*! ./internal/scheduler/async */ "./node_modules/rxjs/_esm2015/internal/scheduler/async.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "async", function () { return _internal_scheduler_async__WEBPACK_IMPORTED_MODULE_9__["async"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "asyncScheduler", function () { return _internal_scheduler_async__WEBPACK_IMPORTED_MODULE_9__["asyncScheduler"]; }); /* harmony import */ var _internal_scheduler_queue__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__( /*! ./internal/scheduler/queue */ "./node_modules/rxjs/_esm2015/internal/scheduler/queue.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "queue", function () { return _internal_scheduler_queue__WEBPACK_IMPORTED_MODULE_10__["queue"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "queueScheduler", function () { return _internal_scheduler_queue__WEBPACK_IMPORTED_MODULE_10__["queueScheduler"]; }); /* harmony import */ var _internal_scheduler_animationFrame__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__( /*! ./internal/scheduler/animationFrame */ "./node_modules/rxjs/_esm2015/internal/scheduler/animationFrame.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "animationFrame", function () { return _internal_scheduler_animationFrame__WEBPACK_IMPORTED_MODULE_11__["animationFrame"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "animationFrameScheduler", function () { return _internal_scheduler_animationFrame__WEBPACK_IMPORTED_MODULE_11__["animationFrameScheduler"]; }); /* harmony import */ var _internal_scheduler_VirtualTimeScheduler__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__( /*! ./internal/scheduler/VirtualTimeScheduler */ "./node_modules/rxjs/_esm2015/internal/scheduler/VirtualTimeScheduler.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VirtualTimeScheduler", function () { return _internal_scheduler_VirtualTimeScheduler__WEBPACK_IMPORTED_MODULE_12__["VirtualTimeScheduler"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VirtualAction", function () { return _internal_scheduler_VirtualTimeScheduler__WEBPACK_IMPORTED_MODULE_12__["VirtualAction"]; }); /* harmony import */ var _internal_Scheduler__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__( /*! ./internal/Scheduler */ "./node_modules/rxjs/_esm2015/internal/Scheduler.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Scheduler", function () { return _internal_Scheduler__WEBPACK_IMPORTED_MODULE_13__["Scheduler"]; }); /* harmony import */ var _internal_Subscription__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__( /*! ./internal/Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Subscription", function () { return _internal_Subscription__WEBPACK_IMPORTED_MODULE_14__["Subscription"]; }); /* harmony import */ var _internal_Subscriber__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__( /*! ./internal/Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Subscriber", function () { return _internal_Subscriber__WEBPACK_IMPORTED_MODULE_15__["Subscriber"]; }); /* harmony import */ var _internal_Notification__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__( /*! ./internal/Notification */ "./node_modules/rxjs/_esm2015/internal/Notification.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Notification", function () { return _internal_Notification__WEBPACK_IMPORTED_MODULE_16__["Notification"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NotificationKind", function () { return _internal_Notification__WEBPACK_IMPORTED_MODULE_16__["NotificationKind"]; }); /* harmony import */ var _internal_util_pipe__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__( /*! ./internal/util/pipe */ "./node_modules/rxjs/_esm2015/internal/util/pipe.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pipe", function () { return _internal_util_pipe__WEBPACK_IMPORTED_MODULE_17__["pipe"]; }); /* harmony import */ var _internal_util_noop__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__( /*! ./internal/util/noop */ "./node_modules/rxjs/_esm2015/internal/util/noop.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "noop", function () { return _internal_util_noop__WEBPACK_IMPORTED_MODULE_18__["noop"]; }); /* harmony import */ var _internal_util_identity__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__( /*! ./internal/util/identity */ "./node_modules/rxjs/_esm2015/internal/util/identity.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "identity", function () { return _internal_util_identity__WEBPACK_IMPORTED_MODULE_19__["identity"]; }); /* harmony import */ var _internal_util_isObservable__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__( /*! ./internal/util/isObservable */ "./node_modules/rxjs/_esm2015/internal/util/isObservable.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isObservable", function () { return _internal_util_isObservable__WEBPACK_IMPORTED_MODULE_20__["isObservable"]; }); /* harmony import */ var _internal_util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__( /*! ./internal/util/ArgumentOutOfRangeError */ "./node_modules/rxjs/_esm2015/internal/util/ArgumentOutOfRangeError.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArgumentOutOfRangeError", function () { return _internal_util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_21__["ArgumentOutOfRangeError"]; }); /* harmony import */ var _internal_util_EmptyError__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__( /*! ./internal/util/EmptyError */ "./node_modules/rxjs/_esm2015/internal/util/EmptyError.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EmptyError", function () { return _internal_util_EmptyError__WEBPACK_IMPORTED_MODULE_22__["EmptyError"]; }); /* harmony import */ var _internal_util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__( /*! ./internal/util/ObjectUnsubscribedError */ "./node_modules/rxjs/_esm2015/internal/util/ObjectUnsubscribedError.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ObjectUnsubscribedError", function () { return _internal_util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_23__["ObjectUnsubscribedError"]; }); /* harmony import */ var _internal_util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__( /*! ./internal/util/UnsubscriptionError */ "./node_modules/rxjs/_esm2015/internal/util/UnsubscriptionError.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UnsubscriptionError", function () { return _internal_util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_24__["UnsubscriptionError"]; }); /* harmony import */ var _internal_util_TimeoutError__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__( /*! ./internal/util/TimeoutError */ "./node_modules/rxjs/_esm2015/internal/util/TimeoutError.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TimeoutError", function () { return _internal_util_TimeoutError__WEBPACK_IMPORTED_MODULE_25__["TimeoutError"]; }); /* harmony import */ var _internal_observable_bindCallback__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__( /*! ./internal/observable/bindCallback */ "./node_modules/rxjs/_esm2015/internal/observable/bindCallback.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bindCallback", function () { return _internal_observable_bindCallback__WEBPACK_IMPORTED_MODULE_26__["bindCallback"]; }); /* harmony import */ var _internal_observable_bindNodeCallback__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__( /*! ./internal/observable/bindNodeCallback */ "./node_modules/rxjs/_esm2015/internal/observable/bindNodeCallback.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bindNodeCallback", function () { return _internal_observable_bindNodeCallback__WEBPACK_IMPORTED_MODULE_27__["bindNodeCallback"]; }); /* harmony import */ var _internal_observable_combineLatest__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__( /*! ./internal/observable/combineLatest */ "./node_modules/rxjs/_esm2015/internal/observable/combineLatest.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "combineLatest", function () { return _internal_observable_combineLatest__WEBPACK_IMPORTED_MODULE_28__["combineLatest"]; }); /* harmony import */ var _internal_observable_concat__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__( /*! ./internal/observable/concat */ "./node_modules/rxjs/_esm2015/internal/observable/concat.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concat", function () { return _internal_observable_concat__WEBPACK_IMPORTED_MODULE_29__["concat"]; }); /* harmony import */ var _internal_observable_defer__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__( /*! ./internal/observable/defer */ "./node_modules/rxjs/_esm2015/internal/observable/defer.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defer", function () { return _internal_observable_defer__WEBPACK_IMPORTED_MODULE_30__["defer"]; }); /* harmony import */ var _internal_observable_empty__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__( /*! ./internal/observable/empty */ "./node_modules/rxjs/_esm2015/internal/observable/empty.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "empty", function () { return _internal_observable_empty__WEBPACK_IMPORTED_MODULE_31__["empty"]; }); /* harmony import */ var _internal_observable_forkJoin__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__( /*! ./internal/observable/forkJoin */ "./node_modules/rxjs/_esm2015/internal/observable/forkJoin.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "forkJoin", function () { return _internal_observable_forkJoin__WEBPACK_IMPORTED_MODULE_32__["forkJoin"]; }); /* harmony import */ var _internal_observable_from__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__( /*! ./internal/observable/from */ "./node_modules/rxjs/_esm2015/internal/observable/from.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "from", function () { return _internal_observable_from__WEBPACK_IMPORTED_MODULE_33__["from"]; }); /* harmony import */ var _internal_observable_fromEvent__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__( /*! ./internal/observable/fromEvent */ "./node_modules/rxjs/_esm2015/internal/observable/fromEvent.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fromEvent", function () { return _internal_observable_fromEvent__WEBPACK_IMPORTED_MODULE_34__["fromEvent"]; }); /* harmony import */ var _internal_observable_fromEventPattern__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__( /*! ./internal/observable/fromEventPattern */ "./node_modules/rxjs/_esm2015/internal/observable/fromEventPattern.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fromEventPattern", function () { return _internal_observable_fromEventPattern__WEBPACK_IMPORTED_MODULE_35__["fromEventPattern"]; }); /* harmony import */ var _internal_observable_generate__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__( /*! ./internal/observable/generate */ "./node_modules/rxjs/_esm2015/internal/observable/generate.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "generate", function () { return _internal_observable_generate__WEBPACK_IMPORTED_MODULE_36__["generate"]; }); /* harmony import */ var _internal_observable_iif__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__( /*! ./internal/observable/iif */ "./node_modules/rxjs/_esm2015/internal/observable/iif.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "iif", function () { return _internal_observable_iif__WEBPACK_IMPORTED_MODULE_37__["iif"]; }); /* harmony import */ var _internal_observable_interval__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__( /*! ./internal/observable/interval */ "./node_modules/rxjs/_esm2015/internal/observable/interval.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interval", function () { return _internal_observable_interval__WEBPACK_IMPORTED_MODULE_38__["interval"]; }); /* harmony import */ var _internal_observable_merge__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__( /*! ./internal/observable/merge */ "./node_modules/rxjs/_esm2015/internal/observable/merge.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "merge", function () { return _internal_observable_merge__WEBPACK_IMPORTED_MODULE_39__["merge"]; }); /* harmony import */ var _internal_observable_never__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__( /*! ./internal/observable/never */ "./node_modules/rxjs/_esm2015/internal/observable/never.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "never", function () { return _internal_observable_never__WEBPACK_IMPORTED_MODULE_40__["never"]; }); /* harmony import */ var _internal_observable_of__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__( /*! ./internal/observable/of */ "./node_modules/rxjs/_esm2015/internal/observable/of.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "of", function () { return _internal_observable_of__WEBPACK_IMPORTED_MODULE_41__["of"]; }); /* harmony import */ var _internal_observable_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__( /*! ./internal/observable/onErrorResumeNext */ "./node_modules/rxjs/_esm2015/internal/observable/onErrorResumeNext.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "onErrorResumeNext", function () { return _internal_observable_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_42__["onErrorResumeNext"]; }); /* harmony import */ var _internal_observable_pairs__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__( /*! ./internal/observable/pairs */ "./node_modules/rxjs/_esm2015/internal/observable/pairs.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pairs", function () { return _internal_observable_pairs__WEBPACK_IMPORTED_MODULE_43__["pairs"]; }); /* harmony import */ var _internal_observable_partition__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__( /*! ./internal/observable/partition */ "./node_modules/rxjs/_esm2015/internal/observable/partition.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "partition", function () { return _internal_observable_partition__WEBPACK_IMPORTED_MODULE_44__["partition"]; }); /* harmony import */ var _internal_observable_race__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__( /*! ./internal/observable/race */ "./node_modules/rxjs/_esm2015/internal/observable/race.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "race", function () { return _internal_observable_race__WEBPACK_IMPORTED_MODULE_45__["race"]; }); /* harmony import */ var _internal_observable_range__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__( /*! ./internal/observable/range */ "./node_modules/rxjs/_esm2015/internal/observable/range.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "range", function () { return _internal_observable_range__WEBPACK_IMPORTED_MODULE_46__["range"]; }); /* harmony import */ var _internal_observable_throwError__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__( /*! ./internal/observable/throwError */ "./node_modules/rxjs/_esm2015/internal/observable/throwError.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throwError", function () { return _internal_observable_throwError__WEBPACK_IMPORTED_MODULE_47__["throwError"]; }); /* harmony import */ var _internal_observable_timer__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__( /*! ./internal/observable/timer */ "./node_modules/rxjs/_esm2015/internal/observable/timer.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timer", function () { return _internal_observable_timer__WEBPACK_IMPORTED_MODULE_48__["timer"]; }); /* harmony import */ var _internal_observable_using__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__( /*! ./internal/observable/using */ "./node_modules/rxjs/_esm2015/internal/observable/using.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "using", function () { return _internal_observable_using__WEBPACK_IMPORTED_MODULE_49__["using"]; }); /* harmony import */ var _internal_observable_zip__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__( /*! ./internal/observable/zip */ "./node_modules/rxjs/_esm2015/internal/observable/zip.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "zip", function () { return _internal_observable_zip__WEBPACK_IMPORTED_MODULE_50__["zip"]; }); /* harmony import */ var _internal_scheduled_scheduled__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__( /*! ./internal/scheduled/scheduled */ "./node_modules/rxjs/_esm2015/internal/scheduled/scheduled.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "scheduled", function () { return _internal_scheduled_scheduled__WEBPACK_IMPORTED_MODULE_51__["scheduled"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EMPTY", function () { return _internal_observable_empty__WEBPACK_IMPORTED_MODULE_31__["EMPTY"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NEVER", function () { return _internal_observable_never__WEBPACK_IMPORTED_MODULE_40__["NEVER"]; }); /* harmony import */ var _internal_config__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__( /*! ./internal/config */ "./node_modules/rxjs/_esm2015/internal/config.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "config", function () { return _internal_config__WEBPACK_IMPORTED_MODULE_52__["config"]; }); //# sourceMappingURL=index.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/AsyncSubject.js": /*!*************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/AsyncSubject.js ***! \*************************************************************/ /*! exports provided: AsyncSubject */ /***/ function node_modulesRxjs_esm2015InternalAsyncSubjectJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsyncSubject", function () { return AsyncSubject; }); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./Subject */ "./node_modules/rxjs/_esm2015/internal/Subject.js"); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); var AsyncSubject = /*#__PURE__*/function (_Subject__WEBPACK_IMP) { _inherits(AsyncSubject, _Subject__WEBPACK_IMP); var _super171 = _createSuper(AsyncSubject); function AsyncSubject() { var _this456; _classCallCheck(this, AsyncSubject); _this456 = _super171.apply(this, arguments); _this456.value = null; _this456.hasNext = false; _this456.hasCompleted = false; return _this456; } _createClass2(AsyncSubject, [{ key: "_subscribe", value: function _subscribe(subscriber) { if (this.hasError) { subscriber.error(this.thrownError); return _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"].EMPTY; } else if (this.hasCompleted && this.hasNext) { subscriber.next(this.value); subscriber.complete(); return _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"].EMPTY; } return _get(_getPrototypeOf(AsyncSubject.prototype), "_subscribe", this).call(this, subscriber); } }, { key: "next", value: function next(value) { if (!this.hasCompleted) { this.value = value; this.hasNext = true; } } }, { key: "error", value: function error(_error3) { if (!this.hasCompleted) { _get(_getPrototypeOf(AsyncSubject.prototype), "error", this).call(this, _error3); } } }, { key: "complete", value: function complete() { this.hasCompleted = true; if (this.hasNext) { _get(_getPrototypeOf(AsyncSubject.prototype), "next", this).call(this, this.value); } _get(_getPrototypeOf(AsyncSubject.prototype), "complete", this).call(this); } }]); return AsyncSubject; }(_Subject__WEBPACK_IMPORTED_MODULE_0__["Subject"]); //# sourceMappingURL=AsyncSubject.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/BehaviorSubject.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/BehaviorSubject.js ***! \****************************************************************/ /*! exports provided: BehaviorSubject */ /***/ function node_modulesRxjs_esm2015InternalBehaviorSubjectJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BehaviorSubject", function () { return BehaviorSubject; }); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./Subject */ "./node_modules/rxjs/_esm2015/internal/Subject.js"); /* harmony import */ var _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./util/ObjectUnsubscribedError */ "./node_modules/rxjs/_esm2015/internal/util/ObjectUnsubscribedError.js"); var BehaviorSubject = /*#__PURE__*/function (_Subject__WEBPACK_IMP2) { _inherits(BehaviorSubject, _Subject__WEBPACK_IMP2); var _super172 = _createSuper(BehaviorSubject); function BehaviorSubject(_value) { var _this457; _classCallCheck(this, BehaviorSubject); _this457 = _super172.call(this); _this457._value = _value; return _this457; } _createClass2(BehaviorSubject, [{ key: "_subscribe", value: function _subscribe(subscriber) { var subscription = _get(_getPrototypeOf(BehaviorSubject.prototype), "_subscribe", this).call(this, subscriber); if (subscription && !subscription.closed) { subscriber.next(this._value); } return subscription; } }, { key: "getValue", value: function getValue() { if (this.hasError) { throw this.thrownError; } else if (this.closed) { throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_1__["ObjectUnsubscribedError"](); } else { return this._value; } } }, { key: "next", value: function next(value) { _get(_getPrototypeOf(BehaviorSubject.prototype), "next", this).call(this, this._value = value); } }, { key: "value", get: function get() { return this.getValue(); } }]); return BehaviorSubject; }(_Subject__WEBPACK_IMPORTED_MODULE_0__["Subject"]); //# sourceMappingURL=BehaviorSubject.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/InnerSubscriber.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/InnerSubscriber.js ***! \****************************************************************/ /*! exports provided: InnerSubscriber */ /***/ function node_modulesRxjs_esm2015InternalInnerSubscriberJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InnerSubscriber", function () { return InnerSubscriber; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); var InnerSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_) { _inherits(InnerSubscriber, _Subscriber__WEBPACK_); var _super173 = _createSuper(InnerSubscriber); function InnerSubscriber(parent, outerValue, outerIndex) { var _this458; _classCallCheck(this, InnerSubscriber); _this458 = _super173.call(this); _this458.parent = parent; _this458.outerValue = outerValue; _this458.outerIndex = outerIndex; _this458.index = 0; return _this458; } _createClass2(InnerSubscriber, [{ key: "_next", value: function _next(value) { this.parent.notifyNext(this.outerValue, value, this.outerIndex, this.index++, this); } }, { key: "_error", value: function _error(error) { this.parent.notifyError(error, this); this.unsubscribe(); } }, { key: "_complete", value: function _complete() { this.parent.notifyComplete(this); this.unsubscribe(); } }]); return InnerSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=InnerSubscriber.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/Notification.js": /*!*************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/Notification.js ***! \*************************************************************/ /*! exports provided: NotificationKind, Notification */ /***/ function node_modulesRxjs_esm2015InternalNotificationJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NotificationKind", function () { return NotificationKind; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Notification", function () { return Notification; }); /* harmony import */ var _observable_empty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./observable/empty */ "./node_modules/rxjs/_esm2015/internal/observable/empty.js"); /* harmony import */ var _observable_of__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./observable/of */ "./node_modules/rxjs/_esm2015/internal/observable/of.js"); /* harmony import */ var _observable_throwError__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./observable/throwError */ "./node_modules/rxjs/_esm2015/internal/observable/throwError.js"); var NotificationKind; (function (NotificationKind) { NotificationKind["NEXT"] = "N"; NotificationKind["ERROR"] = "E"; NotificationKind["COMPLETE"] = "C"; })(NotificationKind || (NotificationKind = {})); var Notification = /*#__PURE__*/function () { function Notification(kind, value, error) { _classCallCheck(this, Notification); this.kind = kind; this.value = value; this.error = error; this.hasValue = kind === 'N'; } _createClass2(Notification, [{ key: "observe", value: function observe(observer) { switch (this.kind) { case 'N': return observer.next && observer.next(this.value); case 'E': return observer.error && observer.error(this.error); case 'C': return observer.complete && observer.complete(); } } }, { key: "do", value: function _do(next, error, complete) { var kind = this.kind; switch (kind) { case 'N': return next && next(this.value); case 'E': return error && error(this.error); case 'C': return complete && complete(); } } }, { key: "accept", value: function accept(nextOrObserver, error, complete) { if (nextOrObserver && typeof nextOrObserver.next === 'function') { return this.observe(nextOrObserver); } else { return this["do"](nextOrObserver, error, complete); } } }, { key: "toObservable", value: function toObservable() { var kind = this.kind; switch (kind) { case 'N': return Object(_observable_of__WEBPACK_IMPORTED_MODULE_1__["of"])(this.value); case 'E': return Object(_observable_throwError__WEBPACK_IMPORTED_MODULE_2__["throwError"])(this.error); case 'C': return Object(_observable_empty__WEBPACK_IMPORTED_MODULE_0__["empty"])(); } throw new Error('unexpected notification kind value'); } }], [{ key: "createNext", value: function createNext(value) { if (typeof value !== 'undefined') { return new Notification('N', value); } return Notification.undefinedValueNotification; } }, { key: "createError", value: function createError(err) { return new Notification('E', undefined, err); } }, { key: "createComplete", value: function createComplete() { return Notification.completeNotification; } }]); return Notification; }(); Notification.completeNotification = new Notification('C'); Notification.undefinedValueNotification = new Notification('N', undefined); //# sourceMappingURL=Notification.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/Observable.js": /*!***********************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/Observable.js ***! \***********************************************************/ /*! exports provided: Observable */ /***/ function node_modulesRxjs_esm2015InternalObservableJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Observable", function () { return Observable; }); /* harmony import */ var _util_canReportError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./util/canReportError */ "./node_modules/rxjs/_esm2015/internal/util/canReportError.js"); /* harmony import */ var _util_toSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./util/toSubscriber */ "./node_modules/rxjs/_esm2015/internal/util/toSubscriber.js"); /* harmony import */ var _symbol_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./symbol/observable */ "./node_modules/rxjs/_esm2015/internal/symbol/observable.js"); /* harmony import */ var _util_pipe__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./util/pipe */ "./node_modules/rxjs/_esm2015/internal/util/pipe.js"); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ./config */ "./node_modules/rxjs/_esm2015/internal/config.js"); var Observable = /*#__PURE__*/function () { function Observable(subscribe) { _classCallCheck(this, Observable); this._isScalar = false; if (subscribe) { this._subscribe = subscribe; } } _createClass2(Observable, [{ key: "lift", value: function lift(operator) { var observable = new Observable(); observable.source = this; observable.operator = operator; return observable; } }, { key: "subscribe", value: function subscribe(observerOrNext, error, complete) { var operator = this.operator; var sink = Object(_util_toSubscriber__WEBPACK_IMPORTED_MODULE_1__["toSubscriber"])(observerOrNext, error, complete); if (operator) { sink.add(operator.call(sink, this.source)); } else { sink.add(this.source || _config__WEBPACK_IMPORTED_MODULE_4__["config"].useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable ? this._subscribe(sink) : this._trySubscribe(sink)); } if (_config__WEBPACK_IMPORTED_MODULE_4__["config"].useDeprecatedSynchronousErrorHandling) { if (sink.syncErrorThrowable) { sink.syncErrorThrowable = false; if (sink.syncErrorThrown) { throw sink.syncErrorValue; } } } return sink; } }, { key: "_trySubscribe", value: function _trySubscribe(sink) { try { return this._subscribe(sink); } catch (err) { if (_config__WEBPACK_IMPORTED_MODULE_4__["config"].useDeprecatedSynchronousErrorHandling) { sink.syncErrorThrown = true; sink.syncErrorValue = err; } if (Object(_util_canReportError__WEBPACK_IMPORTED_MODULE_0__["canReportError"])(sink)) { sink.error(err); } else { console.warn(err); } } } }, { key: "forEach", value: function forEach(next, promiseCtor) { var _this459 = this; promiseCtor = getPromiseCtor(promiseCtor); return new promiseCtor(function (resolve, reject) { var subscription; subscription = _this459.subscribe(function (value) { try { next(value); } catch (err) { reject(err); if (subscription) { subscription.unsubscribe(); } } }, reject, resolve); }); } }, { key: "_subscribe", value: function _subscribe(subscriber) { var source = this.source; return source && source.subscribe(subscriber); } }, { key: _symbol_observable__WEBPACK_IMPORTED_MODULE_2__["observable"], value: function value() { return this; } }, { key: "pipe", value: function pipe() { for (var _len21 = arguments.length, operations = new Array(_len21), _key22 = 0; _key22 < _len21; _key22++) { operations[_key22] = arguments[_key22]; } if (operations.length === 0) { return this; } return Object(_util_pipe__WEBPACK_IMPORTED_MODULE_3__["pipeFromArray"])(operations)(this); } }, { key: "toPromise", value: function toPromise(promiseCtor) { var _this460 = this; promiseCtor = getPromiseCtor(promiseCtor); return new promiseCtor(function (resolve, reject) { var value; _this460.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); }); }); } }]); return Observable; }(); Observable.create = function (subscribe) { return new Observable(subscribe); }; function getPromiseCtor(promiseCtor) { if (!promiseCtor) { promiseCtor = _config__WEBPACK_IMPORTED_MODULE_4__["config"].Promise || Promise; } if (!promiseCtor) { throw new Error('no Promise impl found'); } return promiseCtor; } //# sourceMappingURL=Observable.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/Observer.js": /*!*********************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/Observer.js ***! \*********************************************************/ /*! exports provided: empty */ /***/ function node_modulesRxjs_esm2015InternalObserverJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "empty", function () { return empty; }); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./config */ "./node_modules/rxjs/_esm2015/internal/config.js"); /* harmony import */ var _util_hostReportError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./util/hostReportError */ "./node_modules/rxjs/_esm2015/internal/util/hostReportError.js"); var empty = { closed: true, next: function next(value) {}, error: function error(err) { if (_config__WEBPACK_IMPORTED_MODULE_0__["config"].useDeprecatedSynchronousErrorHandling) { throw err; } else { Object(_util_hostReportError__WEBPACK_IMPORTED_MODULE_1__["hostReportError"])(err); } }, complete: function complete() {} }; //# sourceMappingURL=Observer.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/OuterSubscriber.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/OuterSubscriber.js ***! \****************************************************************/ /*! exports provided: OuterSubscriber */ /***/ function node_modulesRxjs_esm2015InternalOuterSubscriberJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OuterSubscriber", function () { return OuterSubscriber; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); var OuterSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_2) { _inherits(OuterSubscriber, _Subscriber__WEBPACK_2); var _super174 = _createSuper(OuterSubscriber); function OuterSubscriber() { _classCallCheck(this, OuterSubscriber); return _super174.apply(this, arguments); } _createClass2(OuterSubscriber, [{ key: "notifyNext", value: function notifyNext(outerValue, innerValue, outerIndex, innerIndex, innerSub) { this.destination.next(innerValue); } }, { key: "notifyError", value: function notifyError(error, innerSub) { this.destination.error(error); } }, { key: "notifyComplete", value: function notifyComplete(innerSub) { this.destination.complete(); } }]); return OuterSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=OuterSubscriber.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/ReplaySubject.js": /*!**************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/ReplaySubject.js ***! \**************************************************************/ /*! exports provided: ReplaySubject */ /***/ function node_modulesRxjs_esm2015InternalReplaySubjectJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReplaySubject", function () { return ReplaySubject; }); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./Subject */ "./node_modules/rxjs/_esm2015/internal/Subject.js"); /* harmony import */ var _scheduler_queue__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./scheduler/queue */ "./node_modules/rxjs/_esm2015/internal/scheduler/queue.js"); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); /* harmony import */ var _operators_observeOn__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./operators/observeOn */ "./node_modules/rxjs/_esm2015/internal/operators/observeOn.js"); /* harmony import */ var _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ./util/ObjectUnsubscribedError */ "./node_modules/rxjs/_esm2015/internal/util/ObjectUnsubscribedError.js"); /* harmony import */ var _SubjectSubscription__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__( /*! ./SubjectSubscription */ "./node_modules/rxjs/_esm2015/internal/SubjectSubscription.js"); var ReplaySubject = /*#__PURE__*/function (_Subject__WEBPACK_IMP3) { _inherits(ReplaySubject, _Subject__WEBPACK_IMP3); var _super175 = _createSuper(ReplaySubject); function ReplaySubject() { var _this461; var bufferSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Number.POSITIVE_INFINITY; var windowTime = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.POSITIVE_INFINITY; var scheduler = arguments.length > 2 ? arguments[2] : undefined; _classCallCheck(this, ReplaySubject); _this461 = _super175.call(this); _this461.scheduler = scheduler; _this461._events = []; _this461._infiniteTimeWindow = false; _this461._bufferSize = bufferSize < 1 ? 1 : bufferSize; _this461._windowTime = windowTime < 1 ? 1 : windowTime; if (windowTime === Number.POSITIVE_INFINITY) { _this461._infiniteTimeWindow = true; _this461.next = _this461.nextInfiniteTimeWindow; } else { _this461.next = _this461.nextTimeWindow; } return _this461; } _createClass2(ReplaySubject, [{ key: "nextInfiniteTimeWindow", value: function nextInfiniteTimeWindow(value) { if (!this.isStopped) { var _events = this._events; _events.push(value); if (_events.length > this._bufferSize) { _events.shift(); } } _get(_getPrototypeOf(ReplaySubject.prototype), "next", this).call(this, value); } }, { key: "nextTimeWindow", value: function nextTimeWindow(value) { if (!this.isStopped) { this._events.push(new ReplayEvent(this._getNow(), value)); this._trimBufferThenGetEvents(); } _get(_getPrototypeOf(ReplaySubject.prototype), "next", this).call(this, value); } }, { key: "_subscribe", value: function _subscribe(subscriber) { var _infiniteTimeWindow = this._infiniteTimeWindow; var _events = _infiniteTimeWindow ? this._events : this._trimBufferThenGetEvents(); var scheduler = this.scheduler; var len = _events.length; var subscription; if (this.closed) { throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_4__["ObjectUnsubscribedError"](); } else if (this.isStopped || this.hasError) { subscription = _Subscription__WEBPACK_IMPORTED_MODULE_2__["Subscription"].EMPTY; } else { this.observers.push(subscriber); subscription = new _SubjectSubscription__WEBPACK_IMPORTED_MODULE_5__["SubjectSubscription"](this, subscriber); } if (scheduler) { subscriber.add(subscriber = new _operators_observeOn__WEBPACK_IMPORTED_MODULE_3__["ObserveOnSubscriber"](subscriber, scheduler)); } if (_infiniteTimeWindow) { for (var i = 0; i < len && !subscriber.closed; i++) { subscriber.next(_events[i]); } } else { for (var _i34 = 0; _i34 < len && !subscriber.closed; _i34++) { subscriber.next(_events[_i34].value); } } if (this.hasError) { subscriber.error(this.thrownError); } else if (this.isStopped) { subscriber.complete(); } return subscription; } }, { key: "_getNow", value: function _getNow() { return (this.scheduler || _scheduler_queue__WEBPACK_IMPORTED_MODULE_1__["queue"]).now(); } }, { key: "_trimBufferThenGetEvents", value: function _trimBufferThenGetEvents() { var now = this._getNow(); var _bufferSize = this._bufferSize; var _windowTime = this._windowTime; var _events = this._events; var eventsCount = _events.length; var spliceCount = 0; while (spliceCount < eventsCount) { if (now - _events[spliceCount].time < _windowTime) { break; } spliceCount++; } if (eventsCount > _bufferSize) { spliceCount = Math.max(spliceCount, eventsCount - _bufferSize); } if (spliceCount > 0) { _events.splice(0, spliceCount); } return _events; } }]); return ReplaySubject; }(_Subject__WEBPACK_IMPORTED_MODULE_0__["Subject"]); var ReplayEvent = function ReplayEvent(time, value) { _classCallCheck(this, ReplayEvent); this.time = time; this.value = value; }; //# sourceMappingURL=ReplaySubject.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/Scheduler.js": /*!**********************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/Scheduler.js ***! \**********************************************************/ /*! exports provided: Scheduler */ /***/ function node_modulesRxjs_esm2015InternalSchedulerJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Scheduler", function () { return Scheduler; }); var Scheduler = /*#__PURE__*/function () { function Scheduler(SchedulerAction) { var now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Scheduler.now; _classCallCheck(this, Scheduler); this.SchedulerAction = SchedulerAction; this.now = now; } _createClass2(Scheduler, [{ key: "schedule", value: function schedule(work) { var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var state = arguments.length > 2 ? arguments[2] : undefined; return new this.SchedulerAction(this, work).schedule(state, delay); } }]); return Scheduler; }(); Scheduler.now = function () { return Date.now(); }; //# sourceMappingURL=Scheduler.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/Subject.js": /*!********************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/Subject.js ***! \********************************************************/ /*! exports provided: SubjectSubscriber, Subject, AnonymousSubject */ /***/ function node_modulesRxjs_esm2015InternalSubjectJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SubjectSubscriber", function () { return SubjectSubscriber; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Subject", function () { return Subject; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnonymousSubject", function () { return AnonymousSubject; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); /* harmony import */ var _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./util/ObjectUnsubscribedError */ "./node_modules/rxjs/_esm2015/internal/util/ObjectUnsubscribedError.js"); /* harmony import */ var _SubjectSubscription__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ./SubjectSubscription */ "./node_modules/rxjs/_esm2015/internal/SubjectSubscription.js"); /* harmony import */ var _internal_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__( /*! ../internal/symbol/rxSubscriber */ "./node_modules/rxjs/_esm2015/internal/symbol/rxSubscriber.js"); var SubjectSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_3) { _inherits(SubjectSubscriber, _Subscriber__WEBPACK_3); var _super176 = _createSuper(SubjectSubscriber); function SubjectSubscriber(destination) { var _this462; _classCallCheck(this, SubjectSubscriber); _this462 = _super176.call(this, destination); _this462.destination = destination; return _this462; } return SubjectSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]); var Subject = /*#__PURE__*/function (_Observable__WEBPACK_) { _inherits(Subject, _Observable__WEBPACK_); var _super177 = _createSuper(Subject); function Subject() { var _this463; _classCallCheck(this, Subject); _this463 = _super177.call(this); _this463.observers = []; _this463.closed = false; _this463.isStopped = false; _this463.hasError = false; _this463.thrownError = null; return _this463; } _createClass2(Subject, [{ key: _internal_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_5__["rxSubscriber"], value: function value() { return new SubjectSubscriber(this); } }, { key: "lift", value: function lift(operator) { var subject = new AnonymousSubject(this, this); subject.operator = operator; return subject; } }, { key: "next", value: function next(value) { if (this.closed) { throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_3__["ObjectUnsubscribedError"](); } if (!this.isStopped) { var observers = this.observers; var _len22 = observers.length; var copy = observers.slice(); for (var i = 0; i < _len22; i++) { copy[i].next(value); } } } }, { key: "error", value: function error(err) { if (this.closed) { throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_3__["ObjectUnsubscribedError"](); } this.hasError = true; this.thrownError = err; this.isStopped = true; var observers = this.observers; var len = observers.length; var copy = observers.slice(); for (var i = 0; i < len; i++) { copy[i].error(err); } this.observers.length = 0; } }, { key: "complete", value: function complete() { if (this.closed) { throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_3__["ObjectUnsubscribedError"](); } this.isStopped = true; var observers = this.observers; var len = observers.length; var copy = observers.slice(); for (var i = 0; i < len; i++) { copy[i].complete(); } this.observers.length = 0; } }, { key: "unsubscribe", value: function unsubscribe() { this.isStopped = true; this.closed = true; this.observers = null; } }, { key: "_trySubscribe", value: function _trySubscribe(subscriber) { if (this.closed) { throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_3__["ObjectUnsubscribedError"](); } else { return _get(_getPrototypeOf(Subject.prototype), "_trySubscribe", this).call(this, subscriber); } } }, { key: "_subscribe", value: function _subscribe(subscriber) { if (this.closed) { throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_3__["ObjectUnsubscribedError"](); } else if (this.hasError) { subscriber.error(this.thrownError); return _Subscription__WEBPACK_IMPORTED_MODULE_2__["Subscription"].EMPTY; } else if (this.isStopped) { subscriber.complete(); return _Subscription__WEBPACK_IMPORTED_MODULE_2__["Subscription"].EMPTY; } else { this.observers.push(subscriber); return new _SubjectSubscription__WEBPACK_IMPORTED_MODULE_4__["SubjectSubscription"](this, subscriber); } } }, { key: "asObservable", value: function asObservable() { var observable = new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](); observable.source = this; return observable; } }]); return Subject; }(_Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]); Subject.create = function (destination, source) { return new AnonymousSubject(destination, source); }; var AnonymousSubject = /*#__PURE__*/function (_Subject) { _inherits(AnonymousSubject, _Subject); var _super178 = _createSuper(AnonymousSubject); function AnonymousSubject(destination, source) { var _this464; _classCallCheck(this, AnonymousSubject); _this464 = _super178.call(this); _this464.destination = destination; _this464.source = source; return _this464; } _createClass2(AnonymousSubject, [{ key: "next", value: function next(value) { var destination = this.destination; if (destination && destination.next) { destination.next(value); } } }, { key: "error", value: function error(err) { var destination = this.destination; if (destination && destination.error) { this.destination.error(err); } } }, { key: "complete", value: function complete() { var destination = this.destination; if (destination && destination.complete) { this.destination.complete(); } } }, { key: "_subscribe", value: function _subscribe(subscriber) { var source = this.source; if (source) { return this.source.subscribe(subscriber); } else { return _Subscription__WEBPACK_IMPORTED_MODULE_2__["Subscription"].EMPTY; } } }]); return AnonymousSubject; }(Subject); //# sourceMappingURL=Subject.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/SubjectSubscription.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/SubjectSubscription.js ***! \********************************************************************/ /*! exports provided: SubjectSubscription */ /***/ function node_modulesRxjs_esm2015InternalSubjectSubscriptionJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SubjectSubscription", function () { return SubjectSubscription; }); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); var SubjectSubscription = /*#__PURE__*/function (_Subscription__WEBPAC) { _inherits(SubjectSubscription, _Subscription__WEBPAC); var _super179 = _createSuper(SubjectSubscription); function SubjectSubscription(subject, subscriber) { var _this465; _classCallCheck(this, SubjectSubscription); _this465 = _super179.call(this); _this465.subject = subject; _this465.subscriber = subscriber; _this465.closed = false; return _this465; } _createClass2(SubjectSubscription, [{ key: "unsubscribe", value: function unsubscribe() { if (this.closed) { return; } this.closed = true; var subject = this.subject; var observers = subject.observers; this.subject = null; if (!observers || observers.length === 0 || subject.isStopped || subject.closed) { return; } var subscriberIndex = observers.indexOf(this.subscriber); if (subscriberIndex !== -1) { observers.splice(subscriberIndex, 1); } } }]); return SubjectSubscription; }(_Subscription__WEBPACK_IMPORTED_MODULE_0__["Subscription"]); //# sourceMappingURL=SubjectSubscription.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/Subscriber.js": /*!***********************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/Subscriber.js ***! \***********************************************************/ /*! exports provided: Subscriber, SafeSubscriber */ /***/ function node_modulesRxjs_esm2015InternalSubscriberJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Subscriber", function () { return Subscriber; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SafeSubscriber", function () { return SafeSubscriber; }); /* harmony import */ var _util_isFunction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./util/isFunction */ "./node_modules/rxjs/_esm2015/internal/util/isFunction.js"); /* harmony import */ var _Observer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./Observer */ "./node_modules/rxjs/_esm2015/internal/Observer.js"); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); /* harmony import */ var _internal_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../internal/symbol/rxSubscriber */ "./node_modules/rxjs/_esm2015/internal/symbol/rxSubscriber.js"); /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ./config */ "./node_modules/rxjs/_esm2015/internal/config.js"); /* harmony import */ var _util_hostReportError__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__( /*! ./util/hostReportError */ "./node_modules/rxjs/_esm2015/internal/util/hostReportError.js"); var Subscriber = /*#__PURE__*/function (_Subscription__WEBPAC2) { _inherits(Subscriber, _Subscription__WEBPAC2); var _super180 = _createSuper(Subscriber); function Subscriber(destinationOrNext, error, complete) { var _this466; _classCallCheck(this, Subscriber); _this466 = _super180.call(this); _this466.syncErrorValue = null; _this466.syncErrorThrown = false; _this466.syncErrorThrowable = false; _this466.isStopped = false; switch (arguments.length) { case 0: _this466.destination = _Observer__WEBPACK_IMPORTED_MODULE_1__["empty"]; break; case 1: if (!destinationOrNext) { _this466.destination = _Observer__WEBPACK_IMPORTED_MODULE_1__["empty"]; break; } if (typeof destinationOrNext === 'object') { if (destinationOrNext instanceof Subscriber) { _this466.syncErrorThrowable = destinationOrNext.syncErrorThrowable; _this466.destination = destinationOrNext; destinationOrNext.add(_assertThisInitialized(_this466)); } else { _this466.syncErrorThrowable = true; _this466.destination = new SafeSubscriber(_assertThisInitialized(_this466), destinationOrNext); } break; } default: _this466.syncErrorThrowable = true; _this466.destination = new SafeSubscriber(_assertThisInitialized(_this466), destinationOrNext, error, complete); break; } return _this466; } _createClass2(Subscriber, [{ key: _internal_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_3__["rxSubscriber"], value: function value() { return this; } }, { key: "next", value: function next(value) { if (!this.isStopped) { this._next(value); } } }, { key: "error", value: function error(err) { if (!this.isStopped) { this.isStopped = true; this._error(err); } } }, { key: "complete", value: function complete() { if (!this.isStopped) { this.isStopped = true; this._complete(); } } }, { key: "unsubscribe", value: function unsubscribe() { if (this.closed) { return; } this.isStopped = true; _get(_getPrototypeOf(Subscriber.prototype), "unsubscribe", this).call(this); } }, { key: "_next", value: function _next(value) { this.destination.next(value); } }, { key: "_error", value: function _error(err) { this.destination.error(err); this.unsubscribe(); } }, { key: "_complete", value: function _complete() { this.destination.complete(); this.unsubscribe(); } }, { key: "_unsubscribeAndRecycle", value: function _unsubscribeAndRecycle() { var _parentOrParents = this._parentOrParents; this._parentOrParents = null; this.unsubscribe(); this.closed = false; this.isStopped = false; this._parentOrParents = _parentOrParents; return this; } }], [{ key: "create", value: function create(next, error, complete) { var subscriber = new Subscriber(next, error, complete); subscriber.syncErrorThrowable = false; return subscriber; } }]); return Subscriber; }(_Subscription__WEBPACK_IMPORTED_MODULE_2__["Subscription"]); var SafeSubscriber = /*#__PURE__*/function (_Subscriber) { _inherits(SafeSubscriber, _Subscriber); var _super181 = _createSuper(SafeSubscriber); function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) { var _this467; _classCallCheck(this, SafeSubscriber); _this467 = _super181.call(this); _this467._parentSubscriber = _parentSubscriber; var next; var context = _assertThisInitialized(_this467); if (Object(_util_isFunction__WEBPACK_IMPORTED_MODULE_0__["isFunction"])(observerOrNext)) { next = observerOrNext; } else if (observerOrNext) { next = observerOrNext.next; error = observerOrNext.error; complete = observerOrNext.complete; if (observerOrNext !== _Observer__WEBPACK_IMPORTED_MODULE_1__["empty"]) { context = Object.create(observerOrNext); if (Object(_util_isFunction__WEBPACK_IMPORTED_MODULE_0__["isFunction"])(context.unsubscribe)) { _this467.add(context.unsubscribe.bind(context)); } context.unsubscribe = _this467.unsubscribe.bind(_assertThisInitialized(_this467)); } } _this467._context = context; _this467._next = next; _this467._error = error; _this467._complete = complete; return _this467; } _createClass2(SafeSubscriber, [{ key: "next", value: function next(value) { if (!this.isStopped && this._next) { var _parentSubscriber = this._parentSubscriber; if (!_config__WEBPACK_IMPORTED_MODULE_4__["config"].useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(this._next, value); } else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) { this.unsubscribe(); } } } }, { key: "error", value: function error(err) { if (!this.isStopped) { var _parentSubscriber = this._parentSubscriber; var useDeprecatedSynchronousErrorHandling = _config__WEBPACK_IMPORTED_MODULE_4__["config"].useDeprecatedSynchronousErrorHandling; if (this._error) { if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(this._error, err); this.unsubscribe(); } else { this.__tryOrSetError(_parentSubscriber, this._error, err); this.unsubscribe(); } } else if (!_parentSubscriber.syncErrorThrowable) { this.unsubscribe(); if (useDeprecatedSynchronousErrorHandling) { throw err; } Object(_util_hostReportError__WEBPACK_IMPORTED_MODULE_5__["hostReportError"])(err); } else { if (useDeprecatedSynchronousErrorHandling) { _parentSubscriber.syncErrorValue = err; _parentSubscriber.syncErrorThrown = true; } else { Object(_util_hostReportError__WEBPACK_IMPORTED_MODULE_5__["hostReportError"])(err); } this.unsubscribe(); } } } }, { key: "complete", value: function complete() { var _this468 = this; if (!this.isStopped) { var _parentSubscriber = this._parentSubscriber; if (this._complete) { var wrappedComplete = function wrappedComplete() { return _this468._complete.call(_this468._context); }; if (!_config__WEBPACK_IMPORTED_MODULE_4__["config"].useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) { this.__tryOrUnsub(wrappedComplete); this.unsubscribe(); } else { this.__tryOrSetError(_parentSubscriber, wrappedComplete); this.unsubscribe(); } } else { this.unsubscribe(); } } } }, { key: "__tryOrUnsub", value: function __tryOrUnsub(fn, value) { try { fn.call(this._context, value); } catch (err) { this.unsubscribe(); if (_config__WEBPACK_IMPORTED_MODULE_4__["config"].useDeprecatedSynchronousErrorHandling) { throw err; } else { Object(_util_hostReportError__WEBPACK_IMPORTED_MODULE_5__["hostReportError"])(err); } } } }, { key: "__tryOrSetError", value: function __tryOrSetError(parent, fn, value) { if (!_config__WEBPACK_IMPORTED_MODULE_4__["config"].useDeprecatedSynchronousErrorHandling) { throw new Error('bad call'); } try { fn.call(this._context, value); } catch (err) { if (_config__WEBPACK_IMPORTED_MODULE_4__["config"].useDeprecatedSynchronousErrorHandling) { parent.syncErrorValue = err; parent.syncErrorThrown = true; return true; } else { Object(_util_hostReportError__WEBPACK_IMPORTED_MODULE_5__["hostReportError"])(err); return true; } } return false; } }, { key: "_unsubscribe", value: function _unsubscribe() { var _parentSubscriber = this._parentSubscriber; this._context = null; this._parentSubscriber = null; _parentSubscriber.unsubscribe(); } }]); return SafeSubscriber; }(Subscriber); //# sourceMappingURL=Subscriber.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/Subscription.js": /*!*************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/Subscription.js ***! \*************************************************************/ /*! exports provided: Subscription */ /***/ function node_modulesRxjs_esm2015InternalSubscriptionJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Subscription", function () { return Subscription; }); /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./util/isArray */ "./node_modules/rxjs/_esm2015/internal/util/isArray.js"); /* harmony import */ var _util_isObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./util/isObject */ "./node_modules/rxjs/_esm2015/internal/util/isObject.js"); /* harmony import */ var _util_isFunction__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./util/isFunction */ "./node_modules/rxjs/_esm2015/internal/util/isFunction.js"); /* harmony import */ var _util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./util/UnsubscriptionError */ "./node_modules/rxjs/_esm2015/internal/util/UnsubscriptionError.js"); var Subscription = /*#__PURE__*/function () { function Subscription(unsubscribe) { _classCallCheck(this, Subscription); this.closed = false; this._parentOrParents = null; this._subscriptions = null; if (unsubscribe) { this._ctorUnsubscribe = true; this._unsubscribe = unsubscribe; } } _createClass2(Subscription, [{ key: "unsubscribe", value: function unsubscribe() { var errors; if (this.closed) { return; } var _parentOrParents = this._parentOrParents, _ctorUnsubscribe = this._ctorUnsubscribe, _unsubscribe = this._unsubscribe, _subscriptions = this._subscriptions; this.closed = true; this._parentOrParents = null; this._subscriptions = null; if (_parentOrParents instanceof Subscription) { _parentOrParents.remove(this); } else if (_parentOrParents !== null) { for (var index = 0; index < _parentOrParents.length; ++index) { var parent = _parentOrParents[index]; parent.remove(this); } } if (Object(_util_isFunction__WEBPACK_IMPORTED_MODULE_2__["isFunction"])(_unsubscribe)) { if (_ctorUnsubscribe) { this._unsubscribe = undefined; } try { _unsubscribe.call(this); } catch (e) { errors = e instanceof _util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_3__["UnsubscriptionError"] ? flattenUnsubscriptionErrors(e.errors) : [e]; } } if (Object(_util_isArray__WEBPACK_IMPORTED_MODULE_0__["isArray"])(_subscriptions)) { var _index2 = -1; var _len23 = _subscriptions.length; while (++_index2 < _len23) { var sub = _subscriptions[_index2]; if (Object(_util_isObject__WEBPACK_IMPORTED_MODULE_1__["isObject"])(sub)) { try { sub.unsubscribe(); } catch (e) { errors = errors || []; if (e instanceof _util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_3__["UnsubscriptionError"]) { errors = errors.concat(flattenUnsubscriptionErrors(e.errors)); } else { errors.push(e); } } } } } if (errors) { throw new _util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_3__["UnsubscriptionError"](errors); } } }, { key: "add", value: function add(teardown) { var subscription = teardown; if (!teardown) { return Subscription.EMPTY; } switch (typeof teardown) { case 'function': subscription = new Subscription(teardown); case 'object': if (subscription === this || subscription.closed || typeof subscription.unsubscribe !== 'function') { return subscription; } else if (this.closed) { subscription.unsubscribe(); return subscription; } else if (!(subscription instanceof Subscription)) { var tmp = subscription; subscription = new Subscription(); subscription._subscriptions = [tmp]; } break; default: { throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.'); } } var _subscription = subscription, _parentOrParents = _subscription._parentOrParents; if (_parentOrParents === null) { subscription._parentOrParents = this; } else if (_parentOrParents instanceof Subscription) { if (_parentOrParents === this) { return subscription; } subscription._parentOrParents = [_parentOrParents, this]; } else if (_parentOrParents.indexOf(this) === -1) { _parentOrParents.push(this); } else { return subscription; } var subscriptions = this._subscriptions; if (subscriptions === null) { this._subscriptions = [subscription]; } else { subscriptions.push(subscription); } return subscription; } }, { key: "remove", value: function remove(subscription) { var subscriptions = this._subscriptions; if (subscriptions) { var subscriptionIndex = subscriptions.indexOf(subscription); if (subscriptionIndex !== -1) { subscriptions.splice(subscriptionIndex, 1); } } } }]); return Subscription; }(); Subscription.EMPTY = function (empty) { empty.closed = true; return empty; }(new Subscription()); function flattenUnsubscriptionErrors(errors) { return errors.reduce(function (errs, err) { return errs.concat(err instanceof _util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_3__["UnsubscriptionError"] ? err.errors : err); }, []); } //# sourceMappingURL=Subscription.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/config.js": /*!*******************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/config.js ***! \*******************************************************/ /*! exports provided: config */ /***/ function node_modulesRxjs_esm2015InternalConfigJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "config", function () { return config; }); var _enable_super_gross_mode_that_will_cause_bad_things = false; var config = { Promise: undefined, set useDeprecatedSynchronousErrorHandling(value) { if (value) { var error = new Error(); console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack); } else if (_enable_super_gross_mode_that_will_cause_bad_things) { console.log('RxJS: Back to a better error behavior. Thank you. <3'); } _enable_super_gross_mode_that_will_cause_bad_things = value; }, get useDeprecatedSynchronousErrorHandling() { return _enable_super_gross_mode_that_will_cause_bad_things; } }; //# sourceMappingURL=config.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js": /*!***************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/innerSubscribe.js ***! \***************************************************************/ /*! exports provided: SimpleInnerSubscriber, ComplexInnerSubscriber, SimpleOuterSubscriber, ComplexOuterSubscriber, innerSubscribe */ /***/ function node_modulesRxjs_esm2015InternalInnerSubscribeJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SimpleInnerSubscriber", function () { return SimpleInnerSubscriber; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComplexInnerSubscriber", function () { return ComplexInnerSubscriber; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SimpleOuterSubscriber", function () { return SimpleOuterSubscriber; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComplexOuterSubscriber", function () { return ComplexOuterSubscriber; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "innerSubscribe", function () { return innerSubscribe; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _util_subscribeTo__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./util/subscribeTo */ "./node_modules/rxjs/_esm2015/internal/util/subscribeTo.js"); var SimpleInnerSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_4) { _inherits(SimpleInnerSubscriber, _Subscriber__WEBPACK_4); var _super182 = _createSuper(SimpleInnerSubscriber); function SimpleInnerSubscriber(parent) { var _this469; _classCallCheck(this, SimpleInnerSubscriber); _this469 = _super182.call(this); _this469.parent = parent; return _this469; } _createClass2(SimpleInnerSubscriber, [{ key: "_next", value: function _next(value) { this.parent.notifyNext(value); } }, { key: "_error", value: function _error(error) { this.parent.notifyError(error); this.unsubscribe(); } }, { key: "_complete", value: function _complete() { this.parent.notifyComplete(); this.unsubscribe(); } }]); return SimpleInnerSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); var ComplexInnerSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_5) { _inherits(ComplexInnerSubscriber, _Subscriber__WEBPACK_5); var _super183 = _createSuper(ComplexInnerSubscriber); function ComplexInnerSubscriber(parent, outerValue, outerIndex) { var _this470; _classCallCheck(this, ComplexInnerSubscriber); _this470 = _super183.call(this); _this470.parent = parent; _this470.outerValue = outerValue; _this470.outerIndex = outerIndex; return _this470; } _createClass2(ComplexInnerSubscriber, [{ key: "_next", value: function _next(value) { this.parent.notifyNext(this.outerValue, value, this.outerIndex, this); } }, { key: "_error", value: function _error(error) { this.parent.notifyError(error); this.unsubscribe(); } }, { key: "_complete", value: function _complete() { this.parent.notifyComplete(this); this.unsubscribe(); } }]); return ComplexInnerSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); var SimpleOuterSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_6) { _inherits(SimpleOuterSubscriber, _Subscriber__WEBPACK_6); var _super184 = _createSuper(SimpleOuterSubscriber); function SimpleOuterSubscriber() { _classCallCheck(this, SimpleOuterSubscriber); return _super184.apply(this, arguments); } _createClass2(SimpleOuterSubscriber, [{ key: "notifyNext", value: function notifyNext(innerValue) { this.destination.next(innerValue); } }, { key: "notifyError", value: function notifyError(err) { this.destination.error(err); } }, { key: "notifyComplete", value: function notifyComplete() { this.destination.complete(); } }]); return SimpleOuterSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); var ComplexOuterSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_7) { _inherits(ComplexOuterSubscriber, _Subscriber__WEBPACK_7); var _super185 = _createSuper(ComplexOuterSubscriber); function ComplexOuterSubscriber() { _classCallCheck(this, ComplexOuterSubscriber); return _super185.apply(this, arguments); } _createClass2(ComplexOuterSubscriber, [{ key: "notifyNext", value: function notifyNext(_outerValue, innerValue, _outerIndex, _innerSub) { this.destination.next(innerValue); } }, { key: "notifyError", value: function notifyError(error) { this.destination.error(error); } }, { key: "notifyComplete", value: function notifyComplete(_innerSub) { this.destination.complete(); } }]); return ComplexOuterSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); function innerSubscribe(result, innerSubscriber) { if (innerSubscriber.closed) { return undefined; } if (result instanceof _Observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]) { return result.subscribe(innerSubscriber); } return Object(_util_subscribeTo__WEBPACK_IMPORTED_MODULE_2__["subscribeTo"])(result)(innerSubscriber); } //# sourceMappingURL=innerSubscribe.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/ConnectableObservable.js": /*!*********************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/ConnectableObservable.js ***! \*********************************************************************************/ /*! exports provided: ConnectableObservable, connectableObservableDescriptor */ /***/ function node_modulesRxjs_esm2015InternalObservableConnectableObservableJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConnectableObservable", function () { return ConnectableObservable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "connectableObservableDescriptor", function () { return connectableObservableDescriptor; }); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subject */ "./node_modules/rxjs/_esm2015/internal/Subject.js"); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); /* harmony import */ var _operators_refCount__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ../operators/refCount */ "./node_modules/rxjs/_esm2015/internal/operators/refCount.js"); var ConnectableObservable = /*#__PURE__*/function (_Observable__WEBPACK_2) { _inherits(ConnectableObservable, _Observable__WEBPACK_2); var _super186 = _createSuper(ConnectableObservable); function ConnectableObservable(source, subjectFactory) { var _this471; _classCallCheck(this, ConnectableObservable); _this471 = _super186.call(this); _this471.source = source; _this471.subjectFactory = subjectFactory; _this471._refCount = 0; _this471._isComplete = false; return _this471; } _createClass2(ConnectableObservable, [{ key: "_subscribe", value: function _subscribe(subscriber) { return this.getSubject().subscribe(subscriber); } }, { key: "getSubject", value: function getSubject() { var subject = this._subject; if (!subject || subject.isStopped) { this._subject = this.subjectFactory(); } return this._subject; } }, { key: "connect", value: function connect() { var connection = this._connection; if (!connection) { this._isComplete = false; connection = this._connection = new _Subscription__WEBPACK_IMPORTED_MODULE_3__["Subscription"](); connection.add(this.source.subscribe(new ConnectableSubscriber(this.getSubject(), this))); if (connection.closed) { this._connection = null; connection = _Subscription__WEBPACK_IMPORTED_MODULE_3__["Subscription"].EMPTY; } } return connection; } }, { key: "refCount", value: function refCount() { return Object(_operators_refCount__WEBPACK_IMPORTED_MODULE_4__["refCount"])()(this); } }]); return ConnectableObservable; }(_Observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]); var connectableObservableDescriptor = function () { var connectableProto = ConnectableObservable.prototype; return { operator: { value: null }, _refCount: { value: 0, writable: true }, _subject: { value: null, writable: true }, _connection: { value: null, writable: true }, _subscribe: { value: connectableProto._subscribe }, _isComplete: { value: connectableProto._isComplete, writable: true }, getSubject: { value: connectableProto.getSubject }, connect: { value: connectableProto.connect }, refCount: { value: connectableProto.refCount } }; }(); var ConnectableSubscriber = /*#__PURE__*/function (_Subject__WEBPACK_IMP4) { _inherits(ConnectableSubscriber, _Subject__WEBPACK_IMP4); var _super187 = _createSuper(ConnectableSubscriber); function ConnectableSubscriber(destination, connectable) { var _this472; _classCallCheck(this, ConnectableSubscriber); _this472 = _super187.call(this, destination); _this472.connectable = connectable; return _this472; } _createClass2(ConnectableSubscriber, [{ key: "_error", value: function _error(err) { this._unsubscribe(); _get(_getPrototypeOf(ConnectableSubscriber.prototype), "_error", this).call(this, err); } }, { key: "_complete", value: function _complete() { this.connectable._isComplete = true; this._unsubscribe(); _get(_getPrototypeOf(ConnectableSubscriber.prototype), "_complete", this).call(this); } }, { key: "_unsubscribe", value: function _unsubscribe() { var connectable = this.connectable; if (connectable) { this.connectable = null; var connection = connectable._connection; connectable._refCount = 0; connectable._subject = null; connectable._connection = null; if (connection) { connection.unsubscribe(); } } } }]); return ConnectableSubscriber; }(_Subject__WEBPACK_IMPORTED_MODULE_0__["SubjectSubscriber"]); var RefCountOperator = /*#__PURE__*/function () { function RefCountOperator(connectable) { _classCallCheck(this, RefCountOperator); this.connectable = connectable; } _createClass2(RefCountOperator, [{ key: "call", value: function call(subscriber, source) { var connectable = this.connectable; connectable._refCount++; var refCounter = new RefCountSubscriber(subscriber, connectable); var subscription = source.subscribe(refCounter); if (!refCounter.closed) { refCounter.connection = connectable.connect(); } return subscription; } }]); return RefCountOperator; }(); var RefCountSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_8) { _inherits(RefCountSubscriber, _Subscriber__WEBPACK_8); var _super188 = _createSuper(RefCountSubscriber); function RefCountSubscriber(destination, connectable) { var _this473; _classCallCheck(this, RefCountSubscriber); _this473 = _super188.call(this, destination); _this473.connectable = connectable; return _this473; } _createClass2(RefCountSubscriber, [{ key: "_unsubscribe", value: function _unsubscribe() { var connectable = this.connectable; if (!connectable) { this.connection = null; return; } this.connectable = null; var refCount = connectable._refCount; if (refCount <= 0) { this.connection = null; return; } connectable._refCount = refCount - 1; if (refCount > 1) { this.connection = null; return; } var connection = this.connection; var sharedConnection = connectable._connection; this.connection = null; if (sharedConnection && (!connection || sharedConnection === connection)) { sharedConnection.unsubscribe(); } } }]); return RefCountSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_2__["Subscriber"]); //# sourceMappingURL=ConnectableObservable.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/SubscribeOnObservable.js": /*!*********************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/SubscribeOnObservable.js ***! \*********************************************************************************/ /*! exports provided: SubscribeOnObservable */ /***/ function node_modulesRxjs_esm2015InternalObservableSubscribeOnObservableJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SubscribeOnObservable", function () { return SubscribeOnObservable; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _scheduler_asap__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../scheduler/asap */ "./node_modules/rxjs/_esm2015/internal/scheduler/asap.js"); /* harmony import */ var _util_isNumeric__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../util/isNumeric */ "./node_modules/rxjs/_esm2015/internal/util/isNumeric.js"); var SubscribeOnObservable = /*#__PURE__*/function (_Observable__WEBPACK_3) { _inherits(SubscribeOnObservable, _Observable__WEBPACK_3); var _super189 = _createSuper(SubscribeOnObservable); function SubscribeOnObservable(source) { var _this474; var delayTime = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var scheduler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _scheduler_asap__WEBPACK_IMPORTED_MODULE_1__["asap"]; _classCallCheck(this, SubscribeOnObservable); _this474 = _super189.call(this); _this474.source = source; _this474.delayTime = delayTime; _this474.scheduler = scheduler; if (!Object(_util_isNumeric__WEBPACK_IMPORTED_MODULE_2__["isNumeric"])(delayTime) || delayTime < 0) { _this474.delayTime = 0; } if (!scheduler || typeof scheduler.schedule !== 'function') { _this474.scheduler = _scheduler_asap__WEBPACK_IMPORTED_MODULE_1__["asap"]; } return _this474; } _createClass2(SubscribeOnObservable, [{ key: "_subscribe", value: function _subscribe(subscriber) { var delay = this.delayTime; var source = this.source; var scheduler = this.scheduler; return scheduler.schedule(SubscribeOnObservable.dispatch, delay, { source: source, subscriber: subscriber }); } }], [{ key: "create", value: function create(source) { var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var scheduler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _scheduler_asap__WEBPACK_IMPORTED_MODULE_1__["asap"]; return new SubscribeOnObservable(source, delay, scheduler); } }, { key: "dispatch", value: function dispatch(arg) { var source = arg.source, subscriber = arg.subscriber; return this.add(source.subscribe(subscriber)); } }]); return SubscribeOnObservable; }(_Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]); //# sourceMappingURL=SubscribeOnObservable.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/bindCallback.js": /*!************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/bindCallback.js ***! \************************************************************************/ /*! exports provided: bindCallback */ /***/ function node_modulesRxjs_esm2015InternalObservableBindCallbackJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bindCallback", function () { return bindCallback; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _AsyncSubject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../AsyncSubject */ "./node_modules/rxjs/_esm2015/internal/AsyncSubject.js"); /* harmony import */ var _operators_map__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../operators/map */ "./node_modules/rxjs/_esm2015/internal/operators/map.js"); /* harmony import */ var _util_canReportError__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../util/canReportError */ "./node_modules/rxjs/_esm2015/internal/util/canReportError.js"); /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ../util/isArray */ "./node_modules/rxjs/_esm2015/internal/util/isArray.js"); /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__( /*! ../util/isScheduler */ "./node_modules/rxjs/_esm2015/internal/util/isScheduler.js"); function bindCallback(callbackFunc, resultSelector, scheduler) { if (resultSelector) { if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_5__["isScheduler"])(resultSelector)) { scheduler = resultSelector; } else { return function () { return bindCallback(callbackFunc, scheduler).apply(void 0, arguments).pipe(Object(_operators_map__WEBPACK_IMPORTED_MODULE_2__["map"])(function (args) { return Object(_util_isArray__WEBPACK_IMPORTED_MODULE_4__["isArray"])(args) ? resultSelector.apply(void 0, _toConsumableArray(args)) : resultSelector(args); })); }; } } return function () { for (var _len24 = arguments.length, args = new Array(_len24), _key23 = 0; _key23 < _len24; _key23++) { args[_key23] = arguments[_key23]; } var context = this; var subject; var params = { context: context, subject: subject, callbackFunc: callbackFunc, scheduler: scheduler }; return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { if (!scheduler) { if (!subject) { subject = new _AsyncSubject__WEBPACK_IMPORTED_MODULE_1__["AsyncSubject"](); var handler = function handler() { for (var _len25 = arguments.length, innerArgs = new Array(_len25), _key24 = 0; _key24 < _len25; _key24++) { innerArgs[_key24] = arguments[_key24]; } subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs); subject.complete(); }; try { callbackFunc.apply(context, [].concat(args, [handler])); } catch (err) { if (Object(_util_canReportError__WEBPACK_IMPORTED_MODULE_3__["canReportError"])(subject)) { subject.error(err); } else { console.warn(err); } } } return subject.subscribe(subscriber); } else { var state = { args: args, subscriber: subscriber, params: params }; return scheduler.schedule(dispatch, 0, state); } }); }; } function dispatch(state) { var _this475 = this; var self = this; var args = state.args, subscriber = state.subscriber, params = state.params; var callbackFunc = params.callbackFunc, context = params.context, scheduler = params.scheduler; var subject = params.subject; if (!subject) { subject = params.subject = new _AsyncSubject__WEBPACK_IMPORTED_MODULE_1__["AsyncSubject"](); var handler = function handler() { for (var _len26 = arguments.length, innerArgs = new Array(_len26), _key25 = 0; _key25 < _len26; _key25++) { innerArgs[_key25] = arguments[_key25]; } var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs; _this475.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject })); }; try { callbackFunc.apply(context, [].concat(_toConsumableArray(args), [handler])); } catch (err) { subject.error(err); } } this.add(subject.subscribe(subscriber)); } function dispatchNext(state) { var value = state.value, subject = state.subject; subject.next(value); subject.complete(); } function dispatchError(state) { var err = state.err, subject = state.subject; subject.error(err); } //# sourceMappingURL=bindCallback.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/bindNodeCallback.js": /*!****************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/bindNodeCallback.js ***! \****************************************************************************/ /*! exports provided: bindNodeCallback */ /***/ function node_modulesRxjs_esm2015InternalObservableBindNodeCallbackJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bindNodeCallback", function () { return bindNodeCallback; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _AsyncSubject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../AsyncSubject */ "./node_modules/rxjs/_esm2015/internal/AsyncSubject.js"); /* harmony import */ var _operators_map__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../operators/map */ "./node_modules/rxjs/_esm2015/internal/operators/map.js"); /* harmony import */ var _util_canReportError__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../util/canReportError */ "./node_modules/rxjs/_esm2015/internal/util/canReportError.js"); /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ../util/isScheduler */ "./node_modules/rxjs/_esm2015/internal/util/isScheduler.js"); /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__( /*! ../util/isArray */ "./node_modules/rxjs/_esm2015/internal/util/isArray.js"); function bindNodeCallback(callbackFunc, resultSelector, scheduler) { if (resultSelector) { if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_4__["isScheduler"])(resultSelector)) { scheduler = resultSelector; } else { return function () { return bindNodeCallback(callbackFunc, scheduler).apply(void 0, arguments).pipe(Object(_operators_map__WEBPACK_IMPORTED_MODULE_2__["map"])(function (args) { return Object(_util_isArray__WEBPACK_IMPORTED_MODULE_5__["isArray"])(args) ? resultSelector.apply(void 0, _toConsumableArray(args)) : resultSelector(args); })); }; } } return function () { for (var _len27 = arguments.length, args = new Array(_len27), _key26 = 0; _key26 < _len27; _key26++) { args[_key26] = arguments[_key26]; } var params = { subject: undefined, args: args, callbackFunc: callbackFunc, scheduler: scheduler, context: this }; return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { var context = params.context; var subject = params.subject; if (!scheduler) { if (!subject) { subject = params.subject = new _AsyncSubject__WEBPACK_IMPORTED_MODULE_1__["AsyncSubject"](); var handler = function handler() { for (var _len28 = arguments.length, innerArgs = new Array(_len28), _key27 = 0; _key27 < _len28; _key27++) { innerArgs[_key27] = arguments[_key27]; } var err = innerArgs.shift(); if (err) { subject.error(err); return; } subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs); subject.complete(); }; try { callbackFunc.apply(context, [].concat(args, [handler])); } catch (err) { if (Object(_util_canReportError__WEBPACK_IMPORTED_MODULE_3__["canReportError"])(subject)) { subject.error(err); } else { console.warn(err); } } } return subject.subscribe(subscriber); } else { return scheduler.schedule(dispatch, 0, { params: params, subscriber: subscriber, context: context }); } }); }; } function dispatch(state) { var _this476 = this; var params = state.params, subscriber = state.subscriber, context = state.context; var callbackFunc = params.callbackFunc, args = params.args, scheduler = params.scheduler; var subject = params.subject; if (!subject) { subject = params.subject = new _AsyncSubject__WEBPACK_IMPORTED_MODULE_1__["AsyncSubject"](); var handler = function handler() { for (var _len29 = arguments.length, innerArgs = new Array(_len29), _key28 = 0; _key28 < _len29; _key28++) { innerArgs[_key28] = arguments[_key28]; } var err = innerArgs.shift(); if (err) { _this476.add(scheduler.schedule(dispatchError, 0, { err: err, subject: subject })); } else { var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs; _this476.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject })); } }; try { callbackFunc.apply(context, [].concat(_toConsumableArray(args), [handler])); } catch (err) { this.add(scheduler.schedule(dispatchError, 0, { err: err, subject: subject })); } } this.add(subject.subscribe(subscriber)); } function dispatchNext(arg) { var value = arg.value, subject = arg.subject; subject.next(value); subject.complete(); } function dispatchError(arg) { var err = arg.err, subject = arg.subject; subject.error(err); } //# sourceMappingURL=bindNodeCallback.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/combineLatest.js": /*!*************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/combineLatest.js ***! \*************************************************************************/ /*! exports provided: combineLatest, CombineLatestOperator, CombineLatestSubscriber */ /***/ function node_modulesRxjs_esm2015InternalObservableCombineLatestJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "combineLatest", function () { return combineLatest; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CombineLatestOperator", function () { return CombineLatestOperator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CombineLatestSubscriber", function () { return CombineLatestSubscriber; }); /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../util/isScheduler */ "./node_modules/rxjs/_esm2015/internal/util/isScheduler.js"); /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/isArray */ "./node_modules/rxjs/_esm2015/internal/util/isArray.js"); /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../OuterSubscriber */ "./node_modules/rxjs/_esm2015/internal/OuterSubscriber.js"); /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm2015/internal/util/subscribeToResult.js"); /* harmony import */ var _fromArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ./fromArray */ "./node_modules/rxjs/_esm2015/internal/observable/fromArray.js"); var NONE = {}; function combineLatest() { for (var _len30 = arguments.length, observables = new Array(_len30), _key29 = 0; _key29 < _len30; _key29++) { observables[_key29] = arguments[_key29]; } var resultSelector = undefined; var scheduler = undefined; if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_0__["isScheduler"])(observables[observables.length - 1])) { scheduler = observables.pop(); } if (typeof observables[observables.length - 1] === 'function') { resultSelector = observables.pop(); } if (observables.length === 1 && Object(_util_isArray__WEBPACK_IMPORTED_MODULE_1__["isArray"])(observables[0])) { observables = observables[0]; } return Object(_fromArray__WEBPACK_IMPORTED_MODULE_4__["fromArray"])(observables, scheduler).lift(new CombineLatestOperator(resultSelector)); } var CombineLatestOperator = /*#__PURE__*/function () { function CombineLatestOperator(resultSelector) { _classCallCheck(this, CombineLatestOperator); this.resultSelector = resultSelector; } _createClass2(CombineLatestOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new CombineLatestSubscriber(subscriber, this.resultSelector)); } }]); return CombineLatestOperator; }(); var CombineLatestSubscriber = /*#__PURE__*/function (_OuterSubscriber__WEB) { _inherits(CombineLatestSubscriber, _OuterSubscriber__WEB); var _super190 = _createSuper(CombineLatestSubscriber); function CombineLatestSubscriber(destination, resultSelector) { var _this477; _classCallCheck(this, CombineLatestSubscriber); _this477 = _super190.call(this, destination); _this477.resultSelector = resultSelector; _this477.active = 0; _this477.values = []; _this477.observables = []; return _this477; } _createClass2(CombineLatestSubscriber, [{ key: "_next", value: function _next(observable) { this.values.push(NONE); this.observables.push(observable); } }, { key: "_complete", value: function _complete() { var observables = this.observables; var len = observables.length; if (len === 0) { this.destination.complete(); } else { this.active = len; this.toRespond = len; for (var i = 0; i < len; i++) { var observable = observables[i]; this.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_3__["subscribeToResult"])(this, observable, undefined, i)); } } } }, { key: "notifyComplete", value: function notifyComplete(unused) { if ((this.active -= 1) === 0) { this.destination.complete(); } } }, { key: "notifyNext", value: function notifyNext(_outerValue, innerValue, outerIndex) { var values = this.values; var oldVal = values[outerIndex]; var toRespond = !this.toRespond ? 0 : oldVal === NONE ? --this.toRespond : this.toRespond; values[outerIndex] = innerValue; if (toRespond === 0) { if (this.resultSelector) { this._tryResultSelector(values); } else { this.destination.next(values.slice()); } } } }, { key: "_tryResultSelector", value: function _tryResultSelector(values) { var result; try { result = this.resultSelector.apply(this, values); } catch (err) { this.destination.error(err); return; } this.destination.next(result); } }]); return CombineLatestSubscriber; }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_2__["OuterSubscriber"]); //# sourceMappingURL=combineLatest.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/concat.js": /*!******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/concat.js ***! \******************************************************************/ /*! exports provided: concat */ /***/ function node_modulesRxjs_esm2015InternalObservableConcatJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concat", function () { return concat; }); /* harmony import */ var _of__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./of */ "./node_modules/rxjs/_esm2015/internal/observable/of.js"); /* harmony import */ var _operators_concatAll__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../operators/concatAll */ "./node_modules/rxjs/_esm2015/internal/operators/concatAll.js"); function concat() { return Object(_operators_concatAll__WEBPACK_IMPORTED_MODULE_1__["concatAll"])()(Object(_of__WEBPACK_IMPORTED_MODULE_0__["of"]).apply(void 0, arguments)); } //# sourceMappingURL=concat.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/defer.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/defer.js ***! \*****************************************************************/ /*! exports provided: defer */ /***/ function node_modulesRxjs_esm2015InternalObservableDeferJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defer", function () { return defer; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _from__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./from */ "./node_modules/rxjs/_esm2015/internal/observable/from.js"); /* harmony import */ var _empty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./empty */ "./node_modules/rxjs/_esm2015/internal/observable/empty.js"); function defer(observableFactory) { return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { var input; try { input = observableFactory(); } catch (err) { subscriber.error(err); return undefined; } var source = input ? Object(_from__WEBPACK_IMPORTED_MODULE_1__["from"])(input) : Object(_empty__WEBPACK_IMPORTED_MODULE_2__["empty"])(); return source.subscribe(subscriber); }); } //# sourceMappingURL=defer.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/empty.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/empty.js ***! \*****************************************************************/ /*! exports provided: EMPTY, empty */ /***/ function node_modulesRxjs_esm2015InternalObservableEmptyJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EMPTY", function () { return EMPTY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "empty", function () { return empty; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); var EMPTY = new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { return subscriber.complete(); }); function empty(scheduler) { return scheduler ? emptyScheduled(scheduler) : EMPTY; } function emptyScheduled(scheduler) { return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { return scheduler.schedule(function () { return subscriber.complete(); }); }); } //# sourceMappingURL=empty.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/forkJoin.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/forkJoin.js ***! \********************************************************************/ /*! exports provided: forkJoin */ /***/ function node_modulesRxjs_esm2015InternalObservableForkJoinJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forkJoin", function () { return forkJoin; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/isArray */ "./node_modules/rxjs/_esm2015/internal/util/isArray.js"); /* harmony import */ var _operators_map__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../operators/map */ "./node_modules/rxjs/_esm2015/internal/operators/map.js"); /* harmony import */ var _util_isObject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../util/isObject */ "./node_modules/rxjs/_esm2015/internal/util/isObject.js"); /* harmony import */ var _from__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ./from */ "./node_modules/rxjs/_esm2015/internal/observable/from.js"); function forkJoin() { for (var _len31 = arguments.length, sources = new Array(_len31), _key30 = 0; _key30 < _len31; _key30++) { sources[_key30] = arguments[_key30]; } if (sources.length === 1) { var first = sources[0]; if (Object(_util_isArray__WEBPACK_IMPORTED_MODULE_1__["isArray"])(first)) { return forkJoinInternal(first, null); } if (Object(_util_isObject__WEBPACK_IMPORTED_MODULE_3__["isObject"])(first) && Object.getPrototypeOf(first) === Object.prototype) { var keys = Object.keys(first); return forkJoinInternal(keys.map(function (key) { return first[key]; }), keys); } } if (typeof sources[sources.length - 1] === 'function') { var resultSelector = sources.pop(); sources = sources.length === 1 && Object(_util_isArray__WEBPACK_IMPORTED_MODULE_1__["isArray"])(sources[0]) ? sources[0] : sources; return forkJoinInternal(sources, null).pipe(Object(_operators_map__WEBPACK_IMPORTED_MODULE_2__["map"])(function (args) { return resultSelector.apply(void 0, _toConsumableArray(args)); })); } return forkJoinInternal(sources, null); } function forkJoinInternal(sources, keys) { return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { var len = sources.length; if (len === 0) { subscriber.complete(); return; } var values = new Array(len); var completed = 0; var emitted = 0; var _loop7 = function _loop7(i) { var source = Object(_from__WEBPACK_IMPORTED_MODULE_4__["from"])(sources[i]); var hasValue = false; subscriber.add(source.subscribe({ next: function next(value) { if (!hasValue) { hasValue = true; emitted++; } values[i] = value; }, error: function error(err) { return subscriber.error(err); }, complete: function complete() { completed++; if (completed === len || !hasValue) { if (emitted === len) { subscriber.next(keys ? keys.reduce(function (result, key, i) { return result[key] = values[i], result; }, {}) : values); } subscriber.complete(); } } })); }; for (var i = 0; i < len; i++) { _loop7(i); } }); } //# sourceMappingURL=forkJoin.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/from.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/from.js ***! \****************************************************************/ /*! exports provided: from */ /***/ function node_modulesRxjs_esm2015InternalObservableFromJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "from", function () { return from; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _util_subscribeTo__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/subscribeTo */ "./node_modules/rxjs/_esm2015/internal/util/subscribeTo.js"); /* harmony import */ var _scheduled_scheduled__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../scheduled/scheduled */ "./node_modules/rxjs/_esm2015/internal/scheduled/scheduled.js"); function from(input, scheduler) { if (!scheduler) { if (input instanceof _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]) { return input; } return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](Object(_util_subscribeTo__WEBPACK_IMPORTED_MODULE_1__["subscribeTo"])(input)); } else { return Object(_scheduled_scheduled__WEBPACK_IMPORTED_MODULE_2__["scheduled"])(input, scheduler); } } //# sourceMappingURL=from.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/fromArray.js": /*!*********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/fromArray.js ***! \*********************************************************************/ /*! exports provided: fromArray */ /***/ function node_modulesRxjs_esm2015InternalObservableFromArrayJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromArray", function () { return fromArray; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _util_subscribeToArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/subscribeToArray */ "./node_modules/rxjs/_esm2015/internal/util/subscribeToArray.js"); /* harmony import */ var _scheduled_scheduleArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../scheduled/scheduleArray */ "./node_modules/rxjs/_esm2015/internal/scheduled/scheduleArray.js"); function fromArray(input, scheduler) { if (!scheduler) { return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](Object(_util_subscribeToArray__WEBPACK_IMPORTED_MODULE_1__["subscribeToArray"])(input)); } else { return Object(_scheduled_scheduleArray__WEBPACK_IMPORTED_MODULE_2__["scheduleArray"])(input, scheduler); } } //# sourceMappingURL=fromArray.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/fromEvent.js": /*!*********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/fromEvent.js ***! \*********************************************************************/ /*! exports provided: fromEvent */ /***/ function node_modulesRxjs_esm2015InternalObservableFromEventJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromEvent", function () { return fromEvent; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/isArray */ "./node_modules/rxjs/_esm2015/internal/util/isArray.js"); /* harmony import */ var _util_isFunction__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../util/isFunction */ "./node_modules/rxjs/_esm2015/internal/util/isFunction.js"); /* harmony import */ var _operators_map__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../operators/map */ "./node_modules/rxjs/_esm2015/internal/operators/map.js"); var toString = function () { return Object.prototype.toString; }(); function fromEvent(target, eventName, options, resultSelector) { if (Object(_util_isFunction__WEBPACK_IMPORTED_MODULE_2__["isFunction"])(options)) { resultSelector = options; options = undefined; } if (resultSelector) { return fromEvent(target, eventName, options).pipe(Object(_operators_map__WEBPACK_IMPORTED_MODULE_3__["map"])(function (args) { return Object(_util_isArray__WEBPACK_IMPORTED_MODULE_1__["isArray"])(args) ? resultSelector.apply(void 0, _toConsumableArray(args)) : resultSelector(args); })); } return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { function handler(e) { if (arguments.length > 1) { subscriber.next(Array.prototype.slice.call(arguments)); } else { subscriber.next(e); } } setupSubscription(target, eventName, handler, subscriber, options); }); } function setupSubscription(sourceObj, eventName, handler, subscriber, options) { var unsubscribe; if (isEventTarget(sourceObj)) { var source = sourceObj; sourceObj.addEventListener(eventName, handler, options); unsubscribe = function unsubscribe() { return source.removeEventListener(eventName, handler, options); }; } else if (isJQueryStyleEventEmitter(sourceObj)) { var _source = sourceObj; sourceObj.on(eventName, handler); unsubscribe = function unsubscribe() { return _source.off(eventName, handler); }; } else if (isNodeStyleEventEmitter(sourceObj)) { var _source2 = sourceObj; sourceObj.addListener(eventName, handler); unsubscribe = function unsubscribe() { return _source2.removeListener(eventName, handler); }; } else if (sourceObj && sourceObj.length) { for (var i = 0, _len32 = sourceObj.length; i < _len32; i++) { setupSubscription(sourceObj[i], eventName, handler, subscriber, options); } } else { throw new TypeError('Invalid event target'); } subscriber.add(unsubscribe); } function isNodeStyleEventEmitter(sourceObj) { return sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function'; } function isJQueryStyleEventEmitter(sourceObj) { return sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function'; } function isEventTarget(sourceObj) { return sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function'; } //# sourceMappingURL=fromEvent.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/fromEventPattern.js": /*!****************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/fromEventPattern.js ***! \****************************************************************************/ /*! exports provided: fromEventPattern */ /***/ function node_modulesRxjs_esm2015InternalObservableFromEventPatternJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromEventPattern", function () { return fromEventPattern; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/isArray */ "./node_modules/rxjs/_esm2015/internal/util/isArray.js"); /* harmony import */ var _util_isFunction__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../util/isFunction */ "./node_modules/rxjs/_esm2015/internal/util/isFunction.js"); /* harmony import */ var _operators_map__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../operators/map */ "./node_modules/rxjs/_esm2015/internal/operators/map.js"); function fromEventPattern(addHandler, removeHandler, resultSelector) { if (resultSelector) { return fromEventPattern(addHandler, removeHandler).pipe(Object(_operators_map__WEBPACK_IMPORTED_MODULE_3__["map"])(function (args) { return Object(_util_isArray__WEBPACK_IMPORTED_MODULE_1__["isArray"])(args) ? resultSelector.apply(void 0, _toConsumableArray(args)) : resultSelector(args); })); } return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { var handler = function handler() { for (var _len33 = arguments.length, e = new Array(_len33), _key31 = 0; _key31 < _len33; _key31++) { e[_key31] = arguments[_key31]; } return subscriber.next(e.length === 1 ? e[0] : e); }; var retValue; try { retValue = addHandler(handler); } catch (err) { subscriber.error(err); return undefined; } if (!Object(_util_isFunction__WEBPACK_IMPORTED_MODULE_2__["isFunction"])(removeHandler)) { return undefined; } return function () { return removeHandler(handler, retValue); }; }); } //# sourceMappingURL=fromEventPattern.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/generate.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/generate.js ***! \********************************************************************/ /*! exports provided: generate */ /***/ function node_modulesRxjs_esm2015InternalObservableGenerateJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generate", function () { return generate; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/identity */ "./node_modules/rxjs/_esm2015/internal/util/identity.js"); /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../util/isScheduler */ "./node_modules/rxjs/_esm2015/internal/util/isScheduler.js"); function generate(initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler) { var resultSelector; var initialState; if (arguments.length == 1) { var options = initialStateOrOptions; initialState = options.initialState; condition = options.condition; iterate = options.iterate; resultSelector = options.resultSelector || _util_identity__WEBPACK_IMPORTED_MODULE_1__["identity"]; scheduler = options.scheduler; } else if (resultSelectorOrObservable === undefined || Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_2__["isScheduler"])(resultSelectorOrObservable)) { initialState = initialStateOrOptions; resultSelector = _util_identity__WEBPACK_IMPORTED_MODULE_1__["identity"]; scheduler = resultSelectorOrObservable; } else { initialState = initialStateOrOptions; resultSelector = resultSelectorOrObservable; } return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { var state = initialState; if (scheduler) { return scheduler.schedule(dispatch, 0, { subscriber: subscriber, iterate: iterate, condition: condition, resultSelector: resultSelector, state: state }); } do { if (condition) { var conditionResult = void 0; try { conditionResult = condition(state); } catch (err) { subscriber.error(err); return undefined; } if (!conditionResult) { subscriber.complete(); break; } } var value = void 0; try { value = resultSelector(state); } catch (err) { subscriber.error(err); return undefined; } subscriber.next(value); if (subscriber.closed) { break; } try { state = iterate(state); } catch (err) { subscriber.error(err); return undefined; } } while (true); return undefined; }); } function dispatch(state) { var subscriber = state.subscriber, condition = state.condition; if (subscriber.closed) { return undefined; } if (state.needIterate) { try { state.state = state.iterate(state.state); } catch (err) { subscriber.error(err); return undefined; } } else { state.needIterate = true; } if (condition) { var conditionResult; try { conditionResult = condition(state.state); } catch (err) { subscriber.error(err); return undefined; } if (!conditionResult) { subscriber.complete(); return undefined; } if (subscriber.closed) { return undefined; } } var value; try { value = state.resultSelector(state.state); } catch (err) { subscriber.error(err); return undefined; } if (subscriber.closed) { return undefined; } subscriber.next(value); if (subscriber.closed) { return undefined; } return this.schedule(state); } //# sourceMappingURL=generate.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/iif.js": /*!***************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/iif.js ***! \***************************************************************/ /*! exports provided: iif */ /***/ function node_modulesRxjs_esm2015InternalObservableIifJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "iif", function () { return iif; }); /* harmony import */ var _defer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./defer */ "./node_modules/rxjs/_esm2015/internal/observable/defer.js"); /* harmony import */ var _empty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./empty */ "./node_modules/rxjs/_esm2015/internal/observable/empty.js"); function iif(condition) { var trueResult = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _empty__WEBPACK_IMPORTED_MODULE_1__["EMPTY"]; var falseResult = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _empty__WEBPACK_IMPORTED_MODULE_1__["EMPTY"]; return Object(_defer__WEBPACK_IMPORTED_MODULE_0__["defer"])(function () { return condition() ? trueResult : falseResult; }); } //# sourceMappingURL=iif.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/interval.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/interval.js ***! \********************************************************************/ /*! exports provided: interval */ /***/ function node_modulesRxjs_esm2015InternalObservableIntervalJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "interval", function () { return interval; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../scheduler/async */ "./node_modules/rxjs/_esm2015/internal/scheduler/async.js"); /* harmony import */ var _util_isNumeric__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../util/isNumeric */ "./node_modules/rxjs/_esm2015/internal/util/isNumeric.js"); function interval() { var period = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var scheduler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _scheduler_async__WEBPACK_IMPORTED_MODULE_1__["async"]; if (!Object(_util_isNumeric__WEBPACK_IMPORTED_MODULE_2__["isNumeric"])(period) || period < 0) { period = 0; } if (!scheduler || typeof scheduler.schedule !== 'function') { scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_1__["async"]; } return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { subscriber.add(scheduler.schedule(dispatch, period, { subscriber: subscriber, counter: 0, period: period })); return subscriber; }); } function dispatch(state) { var subscriber = state.subscriber, counter = state.counter, period = state.period; subscriber.next(counter); this.schedule({ subscriber: subscriber, counter: counter + 1, period: period }, period); } //# sourceMappingURL=interval.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/merge.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/merge.js ***! \*****************************************************************/ /*! exports provided: merge */ /***/ function node_modulesRxjs_esm2015InternalObservableMergeJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "merge", function () { return merge; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/isScheduler */ "./node_modules/rxjs/_esm2015/internal/util/isScheduler.js"); /* harmony import */ var _operators_mergeAll__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../operators/mergeAll */ "./node_modules/rxjs/_esm2015/internal/operators/mergeAll.js"); /* harmony import */ var _fromArray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./fromArray */ "./node_modules/rxjs/_esm2015/internal/observable/fromArray.js"); function merge() { var concurrent = Number.POSITIVE_INFINITY; var scheduler = null; for (var _len34 = arguments.length, observables = new Array(_len34), _key32 = 0; _key32 < _len34; _key32++) { observables[_key32] = arguments[_key32]; } var last = observables[observables.length - 1]; if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_1__["isScheduler"])(last)) { scheduler = observables.pop(); if (observables.length > 1 && typeof observables[observables.length - 1] === 'number') { concurrent = observables.pop(); } } else if (typeof last === 'number') { concurrent = observables.pop(); } if (scheduler === null && observables.length === 1 && observables[0] instanceof _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]) { return observables[0]; } return Object(_operators_mergeAll__WEBPACK_IMPORTED_MODULE_2__["mergeAll"])(concurrent)(Object(_fromArray__WEBPACK_IMPORTED_MODULE_3__["fromArray"])(observables, scheduler)); } //# sourceMappingURL=merge.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/never.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/never.js ***! \*****************************************************************/ /*! exports provided: NEVER, never */ /***/ function node_modulesRxjs_esm2015InternalObservableNeverJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NEVER", function () { return NEVER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "never", function () { return never; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _util_noop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/noop */ "./node_modules/rxjs/_esm2015/internal/util/noop.js"); var NEVER = new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](_util_noop__WEBPACK_IMPORTED_MODULE_1__["noop"]); function never() { return NEVER; } //# sourceMappingURL=never.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/of.js": /*!**************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/of.js ***! \**************************************************************/ /*! exports provided: of */ /***/ function node_modulesRxjs_esm2015InternalObservableOfJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "of", function () { return of; }); /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../util/isScheduler */ "./node_modules/rxjs/_esm2015/internal/util/isScheduler.js"); /* harmony import */ var _fromArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./fromArray */ "./node_modules/rxjs/_esm2015/internal/observable/fromArray.js"); /* harmony import */ var _scheduled_scheduleArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../scheduled/scheduleArray */ "./node_modules/rxjs/_esm2015/internal/scheduled/scheduleArray.js"); function of() { for (var _len35 = arguments.length, args = new Array(_len35), _key33 = 0; _key33 < _len35; _key33++) { args[_key33] = arguments[_key33]; } var scheduler = args[args.length - 1]; if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_0__["isScheduler"])(scheduler)) { args.pop(); return Object(_scheduled_scheduleArray__WEBPACK_IMPORTED_MODULE_2__["scheduleArray"])(args, scheduler); } else { return Object(_fromArray__WEBPACK_IMPORTED_MODULE_1__["fromArray"])(args); } } //# sourceMappingURL=of.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/onErrorResumeNext.js": /*!*****************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/onErrorResumeNext.js ***! \*****************************************************************************/ /*! exports provided: onErrorResumeNext */ /***/ function node_modulesRxjs_esm2015InternalObservableOnErrorResumeNextJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onErrorResumeNext", function () { return onErrorResumeNext; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _from__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./from */ "./node_modules/rxjs/_esm2015/internal/observable/from.js"); /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../util/isArray */ "./node_modules/rxjs/_esm2015/internal/util/isArray.js"); /* harmony import */ var _empty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./empty */ "./node_modules/rxjs/_esm2015/internal/observable/empty.js"); function onErrorResumeNext() { for (var _len36 = arguments.length, sources = new Array(_len36), _key34 = 0; _key34 < _len36; _key34++) { sources[_key34] = arguments[_key34]; } if (sources.length === 0) { return _empty__WEBPACK_IMPORTED_MODULE_3__["EMPTY"]; } var first = sources[0], remainder = sources.slice(1); if (sources.length === 1 && Object(_util_isArray__WEBPACK_IMPORTED_MODULE_2__["isArray"])(first)) { return onErrorResumeNext.apply(void 0, _toConsumableArray(first)); } return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { var subNext = function subNext() { return subscriber.add(onErrorResumeNext.apply(void 0, _toConsumableArray(remainder)).subscribe(subscriber)); }; return Object(_from__WEBPACK_IMPORTED_MODULE_1__["from"])(first).subscribe({ next: function next(value) { subscriber.next(value); }, error: subNext, complete: subNext }); }); } //# sourceMappingURL=onErrorResumeNext.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/pairs.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/pairs.js ***! \*****************************************************************/ /*! exports provided: pairs, dispatch */ /***/ function node_modulesRxjs_esm2015InternalObservablePairsJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pairs", function () { return pairs; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dispatch", function () { return dispatch; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); function pairs(obj, scheduler) { if (!scheduler) { return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { var keys = Object.keys(obj); for (var i = 0; i < keys.length && !subscriber.closed; i++) { var key = keys[i]; if (obj.hasOwnProperty(key)) { subscriber.next([key, obj[key]]); } } subscriber.complete(); }); } else { return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { var keys = Object.keys(obj); var subscription = new _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"](); subscription.add(scheduler.schedule(dispatch, 0, { keys: keys, index: 0, subscriber: subscriber, subscription: subscription, obj: obj })); return subscription; }); } } function dispatch(state) { var keys = state.keys, index = state.index, subscriber = state.subscriber, subscription = state.subscription, obj = state.obj; if (!subscriber.closed) { if (index < keys.length) { var key = keys[index]; subscriber.next([key, obj[key]]); subscription.add(this.schedule({ keys: keys, index: index + 1, subscriber: subscriber, subscription: subscription, obj: obj })); } else { subscriber.complete(); } } } //# sourceMappingURL=pairs.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/partition.js": /*!*********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/partition.js ***! \*********************************************************************/ /*! exports provided: partition */ /***/ function node_modulesRxjs_esm2015InternalObservablePartitionJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function () { return partition; }); /* harmony import */ var _util_not__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../util/not */ "./node_modules/rxjs/_esm2015/internal/util/not.js"); /* harmony import */ var _util_subscribeTo__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/subscribeTo */ "./node_modules/rxjs/_esm2015/internal/util/subscribeTo.js"); /* harmony import */ var _operators_filter__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../operators/filter */ "./node_modules/rxjs/_esm2015/internal/operators/filter.js"); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); function partition(source, predicate, thisArg) { return [Object(_operators_filter__WEBPACK_IMPORTED_MODULE_2__["filter"])(predicate, thisArg)(new _Observable__WEBPACK_IMPORTED_MODULE_3__["Observable"](Object(_util_subscribeTo__WEBPACK_IMPORTED_MODULE_1__["subscribeTo"])(source))), Object(_operators_filter__WEBPACK_IMPORTED_MODULE_2__["filter"])(Object(_util_not__WEBPACK_IMPORTED_MODULE_0__["not"])(predicate, thisArg))(new _Observable__WEBPACK_IMPORTED_MODULE_3__["Observable"](Object(_util_subscribeTo__WEBPACK_IMPORTED_MODULE_1__["subscribeTo"])(source)))]; } //# sourceMappingURL=partition.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/race.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/race.js ***! \****************************************************************/ /*! exports provided: race, RaceOperator, RaceSubscriber */ /***/ function node_modulesRxjs_esm2015InternalObservableRaceJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "race", function () { return race; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RaceOperator", function () { return RaceOperator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RaceSubscriber", function () { return RaceSubscriber; }); /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../util/isArray */ "./node_modules/rxjs/_esm2015/internal/util/isArray.js"); /* harmony import */ var _fromArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./fromArray */ "./node_modules/rxjs/_esm2015/internal/observable/fromArray.js"); /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../OuterSubscriber */ "./node_modules/rxjs/_esm2015/internal/OuterSubscriber.js"); /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm2015/internal/util/subscribeToResult.js"); function race() { for (var _len37 = arguments.length, observables = new Array(_len37), _key35 = 0; _key35 < _len37; _key35++) { observables[_key35] = arguments[_key35]; } if (observables.length === 1) { if (Object(_util_isArray__WEBPACK_IMPORTED_MODULE_0__["isArray"])(observables[0])) { observables = observables[0]; } else { return observables[0]; } } return Object(_fromArray__WEBPACK_IMPORTED_MODULE_1__["fromArray"])(observables, undefined).lift(new RaceOperator()); } var RaceOperator = /*#__PURE__*/function () { function RaceOperator() { _classCallCheck(this, RaceOperator); } _createClass2(RaceOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new RaceSubscriber(subscriber)); } }]); return RaceOperator; }(); var RaceSubscriber = /*#__PURE__*/function (_OuterSubscriber__WEB2) { _inherits(RaceSubscriber, _OuterSubscriber__WEB2); var _super191 = _createSuper(RaceSubscriber); function RaceSubscriber(destination) { var _this478; _classCallCheck(this, RaceSubscriber); _this478 = _super191.call(this, destination); _this478.hasFirst = false; _this478.observables = []; _this478.subscriptions = []; return _this478; } _createClass2(RaceSubscriber, [{ key: "_next", value: function _next(observable) { this.observables.push(observable); } }, { key: "_complete", value: function _complete() { var observables = this.observables; var len = observables.length; if (len === 0) { this.destination.complete(); } else { for (var i = 0; i < len && !this.hasFirst; i++) { var observable = observables[i]; var subscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_3__["subscribeToResult"])(this, observable, undefined, i); if (this.subscriptions) { this.subscriptions.push(subscription); } this.add(subscription); } this.observables = null; } } }, { key: "notifyNext", value: function notifyNext(_outerValue, innerValue, outerIndex) { if (!this.hasFirst) { this.hasFirst = true; for (var i = 0; i < this.subscriptions.length; i++) { if (i !== outerIndex) { var subscription = this.subscriptions[i]; subscription.unsubscribe(); this.remove(subscription); } } this.subscriptions = null; } this.destination.next(innerValue); } }]); return RaceSubscriber; }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_2__["OuterSubscriber"]); //# sourceMappingURL=race.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/range.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/range.js ***! \*****************************************************************/ /*! exports provided: range, dispatch */ /***/ function node_modulesRxjs_esm2015InternalObservableRangeJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "range", function () { return range; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dispatch", function () { return dispatch; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); function range() { var start = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var count = arguments.length > 1 ? arguments[1] : undefined; var scheduler = arguments.length > 2 ? arguments[2] : undefined; return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { if (count === undefined) { count = start; start = 0; } var index = 0; var current = start; if (scheduler) { return scheduler.schedule(dispatch, 0, { index: index, count: count, start: start, subscriber: subscriber }); } else { do { if (index++ >= count) { subscriber.complete(); break; } subscriber.next(current++); if (subscriber.closed) { break; } } while (true); } return undefined; }); } function dispatch(state) { var start = state.start, index = state.index, count = state.count, subscriber = state.subscriber; if (index >= count) { subscriber.complete(); return; } subscriber.next(start); if (subscriber.closed) { return; } state.index = index + 1; state.start = start + 1; this.schedule(state); } //# sourceMappingURL=range.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/throwError.js": /*!**********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/throwError.js ***! \**********************************************************************/ /*! exports provided: throwError */ /***/ function node_modulesRxjs_esm2015InternalObservableThrowErrorJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "throwError", function () { return throwError; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); function throwError(error, scheduler) { if (!scheduler) { return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { return subscriber.error(error); }); } else { return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { return scheduler.schedule(dispatch, 0, { error: error, subscriber: subscriber }); }); } } function dispatch(_ref69) { var error = _ref69.error, subscriber = _ref69.subscriber; subscriber.error(error); } //# sourceMappingURL=throwError.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/timer.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/timer.js ***! \*****************************************************************/ /*! exports provided: timer */ /***/ function node_modulesRxjs_esm2015InternalObservableTimerJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timer", function () { return timer; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../scheduler/async */ "./node_modules/rxjs/_esm2015/internal/scheduler/async.js"); /* harmony import */ var _util_isNumeric__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../util/isNumeric */ "./node_modules/rxjs/_esm2015/internal/util/isNumeric.js"); /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../util/isScheduler */ "./node_modules/rxjs/_esm2015/internal/util/isScheduler.js"); function timer() { var dueTime = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var periodOrScheduler = arguments.length > 1 ? arguments[1] : undefined; var scheduler = arguments.length > 2 ? arguments[2] : undefined; var period = -1; if (Object(_util_isNumeric__WEBPACK_IMPORTED_MODULE_2__["isNumeric"])(periodOrScheduler)) { period = Number(periodOrScheduler) < 1 && 1 || Number(periodOrScheduler); } else if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_3__["isScheduler"])(periodOrScheduler)) { scheduler = periodOrScheduler; } if (!Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_3__["isScheduler"])(scheduler)) { scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_1__["async"]; } return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { var due = Object(_util_isNumeric__WEBPACK_IMPORTED_MODULE_2__["isNumeric"])(dueTime) ? dueTime : +dueTime - scheduler.now(); return scheduler.schedule(dispatch, due, { index: 0, period: period, subscriber: subscriber }); }); } function dispatch(state) { var index = state.index, period = state.period, subscriber = state.subscriber; subscriber.next(index); if (subscriber.closed) { return; } else if (period === -1) { return subscriber.complete(); } state.index = index + 1; this.schedule(state, period); } //# sourceMappingURL=timer.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/using.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/using.js ***! \*****************************************************************/ /*! exports provided: using */ /***/ function node_modulesRxjs_esm2015InternalObservableUsingJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "using", function () { return using; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _from__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./from */ "./node_modules/rxjs/_esm2015/internal/observable/from.js"); /* harmony import */ var _empty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./empty */ "./node_modules/rxjs/_esm2015/internal/observable/empty.js"); function using(resourceFactory, observableFactory) { return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { var resource; try { resource = resourceFactory(); } catch (err) { subscriber.error(err); return undefined; } var result; try { result = observableFactory(resource); } catch (err) { subscriber.error(err); return undefined; } var source = result ? Object(_from__WEBPACK_IMPORTED_MODULE_1__["from"])(result) : _empty__WEBPACK_IMPORTED_MODULE_2__["EMPTY"]; var subscription = source.subscribe(subscriber); return function () { subscription.unsubscribe(); if (resource) { resource.unsubscribe(); } }; }); } //# sourceMappingURL=using.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/observable/zip.js": /*!***************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/observable/zip.js ***! \***************************************************************/ /*! exports provided: zip, ZipOperator, ZipSubscriber */ /***/ function node_modulesRxjs_esm2015InternalObservableZipJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function () { return zip; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ZipOperator", function () { return ZipOperator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ZipSubscriber", function () { return ZipSubscriber; }); /* harmony import */ var _fromArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./fromArray */ "./node_modules/rxjs/_esm2015/internal/observable/fromArray.js"); /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/isArray */ "./node_modules/rxjs/_esm2015/internal/util/isArray.js"); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _internal_symbol_iterator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../../internal/symbol/iterator */ "./node_modules/rxjs/_esm2015/internal/symbol/iterator.js"); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function zip() { for (var _len38 = arguments.length, observables = new Array(_len38), _key36 = 0; _key36 < _len38; _key36++) { observables[_key36] = arguments[_key36]; } var resultSelector = observables[observables.length - 1]; if (typeof resultSelector === 'function') { observables.pop(); } return Object(_fromArray__WEBPACK_IMPORTED_MODULE_0__["fromArray"])(observables, undefined).lift(new ZipOperator(resultSelector)); } var ZipOperator = /*#__PURE__*/function () { function ZipOperator(resultSelector) { _classCallCheck(this, ZipOperator); this.resultSelector = resultSelector; } _createClass2(ZipOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new ZipSubscriber(subscriber, this.resultSelector)); } }]); return ZipOperator; }(); var ZipSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_9) { _inherits(ZipSubscriber, _Subscriber__WEBPACK_9); var _super192 = _createSuper(ZipSubscriber); function ZipSubscriber(destination, resultSelector) { var _this479; var values = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Object.create(null); _classCallCheck(this, ZipSubscriber); _this479 = _super192.call(this, destination); _this479.resultSelector = resultSelector; _this479.iterators = []; _this479.active = 0; _this479.resultSelector = typeof resultSelector === 'function' ? resultSelector : undefined; return _this479; } _createClass2(ZipSubscriber, [{ key: "_next", value: function _next(value) { var iterators = this.iterators; if (Object(_util_isArray__WEBPACK_IMPORTED_MODULE_1__["isArray"])(value)) { iterators.push(new StaticArrayIterator(value)); } else if (typeof value[_internal_symbol_iterator__WEBPACK_IMPORTED_MODULE_3__["iterator"]] === 'function') { iterators.push(new StaticIterator(value[_internal_symbol_iterator__WEBPACK_IMPORTED_MODULE_3__["iterator"]]())); } else { iterators.push(new ZipBufferIterator(this.destination, this, value)); } } }, { key: "_complete", value: function _complete() { var iterators = this.iterators; var len = iterators.length; this.unsubscribe(); if (len === 0) { this.destination.complete(); return; } this.active = len; for (var i = 0; i < len; i++) { var iterator = iterators[i]; if (iterator.stillUnsubscribed) { var destination = this.destination; destination.add(iterator.subscribe()); } else { this.active--; } } } }, { key: "notifyInactive", value: function notifyInactive() { this.active--; if (this.active === 0) { this.destination.complete(); } } }, { key: "checkIterators", value: function checkIterators() { var iterators = this.iterators; var len = iterators.length; var destination = this.destination; for (var i = 0; i < len; i++) { var iterator = iterators[i]; if (typeof iterator.hasValue === 'function' && !iterator.hasValue()) { return; } } var shouldComplete = false; var args = []; for (var _i35 = 0; _i35 < len; _i35++) { var _iterator56 = iterators[_i35]; var result = _iterator56.next(); if (_iterator56.hasCompleted()) { shouldComplete = true; } if (result.done) { destination.complete(); return; } args.push(result.value); } if (this.resultSelector) { this._tryresultSelector(args); } else { destination.next(args); } if (shouldComplete) { destination.complete(); } } }, { key: "_tryresultSelector", value: function _tryresultSelector(args) { var result; try { result = this.resultSelector.apply(this, args); } catch (err) { this.destination.error(err); return; } this.destination.next(result); } }]); return ZipSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_2__["Subscriber"]); var StaticIterator = /*#__PURE__*/function () { function StaticIterator(iterator) { _classCallCheck(this, StaticIterator); this.iterator = iterator; this.nextResult = iterator.next(); } _createClass2(StaticIterator, [{ key: "hasValue", value: function hasValue() { return true; } }, { key: "next", value: function next() { var result = this.nextResult; this.nextResult = this.iterator.next(); return result; } }, { key: "hasCompleted", value: function hasCompleted() { var nextResult = this.nextResult; return Boolean(nextResult && nextResult.done); } }]); return StaticIterator; }(); var StaticArrayIterator = /*#__PURE__*/function () { function StaticArrayIterator(array) { _classCallCheck(this, StaticArrayIterator); this.array = array; this.index = 0; this.length = 0; this.length = array.length; } _createClass2(StaticArrayIterator, [{ key: _internal_symbol_iterator__WEBPACK_IMPORTED_MODULE_3__["iterator"], value: function value() { return this; } }, { key: "next", value: function next(value) { var i = this.index++; var array = this.array; return i < this.length ? { value: array[i], done: false } : { value: null, done: true }; } }, { key: "hasValue", value: function hasValue() { return this.array.length > this.index; } }, { key: "hasCompleted", value: function hasCompleted() { return this.array.length === this.index; } }]); return StaticArrayIterator; }(); var ZipBufferIterator = /*#__PURE__*/function (_innerSubscribe__WEBP) { _inherits(ZipBufferIterator, _innerSubscribe__WEBP); var _super193 = _createSuper(ZipBufferIterator); function ZipBufferIterator(destination, parent, observable) { var _this480; _classCallCheck(this, ZipBufferIterator); _this480 = _super193.call(this, destination); _this480.parent = parent; _this480.observable = observable; _this480.stillUnsubscribed = true; _this480.buffer = []; _this480.isComplete = false; return _this480; } _createClass2(ZipBufferIterator, [{ key: _internal_symbol_iterator__WEBPACK_IMPORTED_MODULE_3__["iterator"], value: function value() { return this; } }, { key: "next", value: function next() { var buffer = this.buffer; if (buffer.length === 0 && this.isComplete) { return { value: null, done: true }; } else { return { value: buffer.shift(), done: false }; } } }, { key: "hasValue", value: function hasValue() { return this.buffer.length > 0; } }, { key: "hasCompleted", value: function hasCompleted() { return this.buffer.length === 0 && this.isComplete; } }, { key: "notifyComplete", value: function notifyComplete() { if (this.buffer.length > 0) { this.isComplete = true; this.parent.notifyInactive(); } else { this.destination.complete(); } } }, { key: "notifyNext", value: function notifyNext(innerValue) { this.buffer.push(innerValue); this.parent.checkIterators(); } }, { key: "subscribe", value: function subscribe() { return Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_4__["innerSubscribe"])(this.observable, new _innerSubscribe__WEBPACK_IMPORTED_MODULE_4__["SimpleInnerSubscriber"](this)); } }]); return ZipBufferIterator; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_4__["SimpleOuterSubscriber"]); //# sourceMappingURL=zip.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/audit.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/audit.js ***! \****************************************************************/ /*! exports provided: audit */ /***/ function node_modulesRxjs_esm2015InternalOperatorsAuditJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "audit", function () { return audit; }); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function audit(durationSelector) { return function auditOperatorFunction(source) { return source.lift(new AuditOperator(durationSelector)); }; } var AuditOperator = /*#__PURE__*/function () { function AuditOperator(durationSelector) { _classCallCheck(this, AuditOperator); this.durationSelector = durationSelector; } _createClass2(AuditOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new AuditSubscriber(subscriber, this.durationSelector)); } }]); return AuditOperator; }(); var AuditSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP2) { _inherits(AuditSubscriber, _innerSubscribe__WEBP2); var _super194 = _createSuper(AuditSubscriber); function AuditSubscriber(destination, durationSelector) { var _this481; _classCallCheck(this, AuditSubscriber); _this481 = _super194.call(this, destination); _this481.durationSelector = durationSelector; _this481.hasValue = false; return _this481; } _createClass2(AuditSubscriber, [{ key: "_next", value: function _next(value) { this.value = value; this.hasValue = true; if (!this.throttled) { var duration; try { var durationSelector = this.durationSelector; duration = durationSelector(value); } catch (err) { return this.destination.error(err); } var innerSubscription = Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["innerSubscribe"])(duration, new _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleInnerSubscriber"](this)); if (!innerSubscription || innerSubscription.closed) { this.clearThrottle(); } else { this.add(this.throttled = innerSubscription); } } } }, { key: "clearThrottle", value: function clearThrottle() { var value = this.value, hasValue = this.hasValue, throttled = this.throttled; if (throttled) { this.remove(throttled); this.throttled = undefined; throttled.unsubscribe(); } if (hasValue) { this.value = undefined; this.hasValue = false; this.destination.next(value); } } }, { key: "notifyNext", value: function notifyNext() { this.clearThrottle(); } }, { key: "notifyComplete", value: function notifyComplete() { this.clearThrottle(); } }]); return AuditSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleOuterSubscriber"]); //# sourceMappingURL=audit.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/auditTime.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/auditTime.js ***! \********************************************************************/ /*! exports provided: auditTime */ /***/ function node_modulesRxjs_esm2015InternalOperatorsAuditTimeJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "auditTime", function () { return auditTime; }); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../scheduler/async */ "./node_modules/rxjs/_esm2015/internal/scheduler/async.js"); /* harmony import */ var _audit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./audit */ "./node_modules/rxjs/_esm2015/internal/operators/audit.js"); /* harmony import */ var _observable_timer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../observable/timer */ "./node_modules/rxjs/_esm2015/internal/observable/timer.js"); function auditTime(duration) { var scheduler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _scheduler_async__WEBPACK_IMPORTED_MODULE_0__["async"]; return Object(_audit__WEBPACK_IMPORTED_MODULE_1__["audit"])(function () { return Object(_observable_timer__WEBPACK_IMPORTED_MODULE_2__["timer"])(duration, scheduler); }); } //# sourceMappingURL=auditTime.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/buffer.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/buffer.js ***! \*****************************************************************/ /*! exports provided: buffer */ /***/ function node_modulesRxjs_esm2015InternalOperatorsBufferJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buffer", function () { return buffer; }); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function buffer(closingNotifier) { return function bufferOperatorFunction(source) { return source.lift(new BufferOperator(closingNotifier)); }; } var BufferOperator = /*#__PURE__*/function () { function BufferOperator(closingNotifier) { _classCallCheck(this, BufferOperator); this.closingNotifier = closingNotifier; } _createClass2(BufferOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new BufferSubscriber(subscriber, this.closingNotifier)); } }]); return BufferOperator; }(); var BufferSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP3) { _inherits(BufferSubscriber, _innerSubscribe__WEBP3); var _super195 = _createSuper(BufferSubscriber); function BufferSubscriber(destination, closingNotifier) { var _this482; _classCallCheck(this, BufferSubscriber); _this482 = _super195.call(this, destination); _this482.buffer = []; _this482.add(Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["innerSubscribe"])(closingNotifier, new _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleInnerSubscriber"](_assertThisInitialized(_this482)))); return _this482; } _createClass2(BufferSubscriber, [{ key: "_next", value: function _next(value) { this.buffer.push(value); } }, { key: "notifyNext", value: function notifyNext() { var buffer = this.buffer; this.buffer = []; this.destination.next(buffer); } }]); return BufferSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleOuterSubscriber"]); //# sourceMappingURL=buffer.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/bufferCount.js": /*!**********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/bufferCount.js ***! \**********************************************************************/ /*! exports provided: bufferCount */ /***/ function node_modulesRxjs_esm2015InternalOperatorsBufferCountJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bufferCount", function () { return bufferCount; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function bufferCount(bufferSize) { var startBufferEvery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; return function bufferCountOperatorFunction(source) { return source.lift(new BufferCountOperator(bufferSize, startBufferEvery)); }; } var BufferCountOperator = /*#__PURE__*/function () { function BufferCountOperator(bufferSize, startBufferEvery) { _classCallCheck(this, BufferCountOperator); this.bufferSize = bufferSize; this.startBufferEvery = startBufferEvery; if (!startBufferEvery || bufferSize === startBufferEvery) { this.subscriberClass = BufferCountSubscriber; } else { this.subscriberClass = BufferSkipCountSubscriber; } } _createClass2(BufferCountOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new this.subscriberClass(subscriber, this.bufferSize, this.startBufferEvery)); } }]); return BufferCountOperator; }(); var BufferCountSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_10) { _inherits(BufferCountSubscriber, _Subscriber__WEBPACK_10); var _super196 = _createSuper(BufferCountSubscriber); function BufferCountSubscriber(destination, bufferSize) { var _this483; _classCallCheck(this, BufferCountSubscriber); _this483 = _super196.call(this, destination); _this483.bufferSize = bufferSize; _this483.buffer = []; return _this483; } _createClass2(BufferCountSubscriber, [{ key: "_next", value: function _next(value) { var buffer = this.buffer; buffer.push(value); if (buffer.length == this.bufferSize) { this.destination.next(buffer); this.buffer = []; } } }, { key: "_complete", value: function _complete() { var buffer = this.buffer; if (buffer.length > 0) { this.destination.next(buffer); } _get(_getPrototypeOf(BufferCountSubscriber.prototype), "_complete", this).call(this); } }]); return BufferCountSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); var BufferSkipCountSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_11) { _inherits(BufferSkipCountSubscriber, _Subscriber__WEBPACK_11); var _super197 = _createSuper(BufferSkipCountSubscriber); function BufferSkipCountSubscriber(destination, bufferSize, startBufferEvery) { var _this484; _classCallCheck(this, BufferSkipCountSubscriber); _this484 = _super197.call(this, destination); _this484.bufferSize = bufferSize; _this484.startBufferEvery = startBufferEvery; _this484.buffers = []; _this484.count = 0; return _this484; } _createClass2(BufferSkipCountSubscriber, [{ key: "_next", value: function _next(value) { var bufferSize = this.bufferSize, startBufferEvery = this.startBufferEvery, buffers = this.buffers, count = this.count; this.count++; if (count % startBufferEvery === 0) { buffers.push([]); } for (var i = buffers.length; i--;) { var buffer = buffers[i]; buffer.push(value); if (buffer.length === bufferSize) { buffers.splice(i, 1); this.destination.next(buffer); } } } }, { key: "_complete", value: function _complete() { var buffers = this.buffers, destination = this.destination; while (buffers.length > 0) { var buffer = buffers.shift(); if (buffer.length > 0) { destination.next(buffer); } } _get(_getPrototypeOf(BufferSkipCountSubscriber.prototype), "_complete", this).call(this); } }]); return BufferSkipCountSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=bufferCount.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/bufferTime.js": /*!*********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/bufferTime.js ***! \*********************************************************************/ /*! exports provided: bufferTime */ /***/ function node_modulesRxjs_esm2015InternalOperatorsBufferTimeJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bufferTime", function () { return bufferTime; }); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../scheduler/async */ "./node_modules/rxjs/_esm2015/internal/scheduler/async.js"); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../util/isScheduler */ "./node_modules/rxjs/_esm2015/internal/util/isScheduler.js"); function bufferTime(bufferTimeSpan) { var length = arguments.length; var scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_0__["async"]; if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_2__["isScheduler"])(arguments[arguments.length - 1])) { scheduler = arguments[arguments.length - 1]; length--; } var bufferCreationInterval = null; if (length >= 2) { bufferCreationInterval = arguments[1]; } var maxBufferSize = Number.POSITIVE_INFINITY; if (length >= 3) { maxBufferSize = arguments[2]; } return function bufferTimeOperatorFunction(source) { return source.lift(new BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler)); }; } var BufferTimeOperator = /*#__PURE__*/function () { function BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { _classCallCheck(this, BufferTimeOperator); this.bufferTimeSpan = bufferTimeSpan; this.bufferCreationInterval = bufferCreationInterval; this.maxBufferSize = maxBufferSize; this.scheduler = scheduler; } _createClass2(BufferTimeOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new BufferTimeSubscriber(subscriber, this.bufferTimeSpan, this.bufferCreationInterval, this.maxBufferSize, this.scheduler)); } }]); return BufferTimeOperator; }(); var Context = function Context() { _classCallCheck(this, Context); this.buffer = []; }; var BufferTimeSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_12) { _inherits(BufferTimeSubscriber, _Subscriber__WEBPACK_12); var _super198 = _createSuper(BufferTimeSubscriber); function BufferTimeSubscriber(destination, bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) { var _this485; _classCallCheck(this, BufferTimeSubscriber); _this485 = _super198.call(this, destination); _this485.bufferTimeSpan = bufferTimeSpan; _this485.bufferCreationInterval = bufferCreationInterval; _this485.maxBufferSize = maxBufferSize; _this485.scheduler = scheduler; _this485.contexts = []; var context = _this485.openContext(); _this485.timespanOnly = bufferCreationInterval == null || bufferCreationInterval < 0; if (_this485.timespanOnly) { var timeSpanOnlyState = { subscriber: _assertThisInitialized(_this485), context: context, bufferTimeSpan: bufferTimeSpan }; _this485.add(context.closeAction = scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); } else { var closeState = { subscriber: _assertThisInitialized(_this485), context: context }; var creationState = { bufferTimeSpan: bufferTimeSpan, bufferCreationInterval: bufferCreationInterval, subscriber: _assertThisInitialized(_this485), scheduler: scheduler }; _this485.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, closeState)); _this485.add(scheduler.schedule(dispatchBufferCreation, bufferCreationInterval, creationState)); } return _this485; } _createClass2(BufferTimeSubscriber, [{ key: "_next", value: function _next(value) { var contexts = this.contexts; var len = contexts.length; var filledBufferContext; for (var i = 0; i < len; i++) { var context = contexts[i]; var buffer = context.buffer; buffer.push(value); if (buffer.length == this.maxBufferSize) { filledBufferContext = context; } } if (filledBufferContext) { this.onBufferFull(filledBufferContext); } } }, { key: "_error", value: function _error(err) { this.contexts.length = 0; _get(_getPrototypeOf(BufferTimeSubscriber.prototype), "_error", this).call(this, err); } }, { key: "_complete", value: function _complete() { var contexts = this.contexts, destination = this.destination; while (contexts.length > 0) { var context = contexts.shift(); destination.next(context.buffer); } _get(_getPrototypeOf(BufferTimeSubscriber.prototype), "_complete", this).call(this); } }, { key: "_unsubscribe", value: function _unsubscribe() { this.contexts = null; } }, { key: "onBufferFull", value: function onBufferFull(context) { this.closeContext(context); var closeAction = context.closeAction; closeAction.unsubscribe(); this.remove(closeAction); if (!this.closed && this.timespanOnly) { context = this.openContext(); var bufferTimeSpan = this.bufferTimeSpan; var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan }; this.add(context.closeAction = this.scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState)); } } }, { key: "openContext", value: function openContext() { var context = new Context(); this.contexts.push(context); return context; } }, { key: "closeContext", value: function closeContext(context) { this.destination.next(context.buffer); var contexts = this.contexts; var spliceIndex = contexts ? contexts.indexOf(context) : -1; if (spliceIndex >= 0) { contexts.splice(contexts.indexOf(context), 1); } } }]); return BufferTimeSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]); function dispatchBufferTimeSpanOnly(state) { var subscriber = state.subscriber; var prevContext = state.context; if (prevContext) { subscriber.closeContext(prevContext); } if (!subscriber.closed) { state.context = subscriber.openContext(); state.context.closeAction = this.schedule(state, state.bufferTimeSpan); } } function dispatchBufferCreation(state) { var bufferCreationInterval = state.bufferCreationInterval, bufferTimeSpan = state.bufferTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler; var context = subscriber.openContext(); var action = this; if (!subscriber.closed) { subscriber.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, { subscriber: subscriber, context: context })); action.schedule(state, bufferCreationInterval); } } function dispatchBufferClose(arg) { var subscriber = arg.subscriber, context = arg.context; subscriber.closeContext(context); } //# sourceMappingURL=bufferTime.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/bufferToggle.js": /*!***********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/bufferToggle.js ***! \***********************************************************************/ /*! exports provided: bufferToggle */ /***/ function node_modulesRxjs_esm2015InternalOperatorsBufferToggleJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bufferToggle", function () { return bufferToggle; }); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm2015/internal/util/subscribeToResult.js"); /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../OuterSubscriber */ "./node_modules/rxjs/_esm2015/internal/OuterSubscriber.js"); function bufferToggle(openings, closingSelector) { return function bufferToggleOperatorFunction(source) { return source.lift(new BufferToggleOperator(openings, closingSelector)); }; } var BufferToggleOperator = /*#__PURE__*/function () { function BufferToggleOperator(openings, closingSelector) { _classCallCheck(this, BufferToggleOperator); this.openings = openings; this.closingSelector = closingSelector; } _createClass2(BufferToggleOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new BufferToggleSubscriber(subscriber, this.openings, this.closingSelector)); } }]); return BufferToggleOperator; }(); var BufferToggleSubscriber = /*#__PURE__*/function (_OuterSubscriber__WEB3) { _inherits(BufferToggleSubscriber, _OuterSubscriber__WEB3); var _super199 = _createSuper(BufferToggleSubscriber); function BufferToggleSubscriber(destination, openings, closingSelector) { var _this486; _classCallCheck(this, BufferToggleSubscriber); _this486 = _super199.call(this, destination); _this486.closingSelector = closingSelector; _this486.contexts = []; _this486.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_1__["subscribeToResult"])(_assertThisInitialized(_this486), openings)); return _this486; } _createClass2(BufferToggleSubscriber, [{ key: "_next", value: function _next(value) { var contexts = this.contexts; var len = contexts.length; for (var i = 0; i < len; i++) { contexts[i].buffer.push(value); } } }, { key: "_error", value: function _error(err) { var contexts = this.contexts; while (contexts.length > 0) { var context = contexts.shift(); context.subscription.unsubscribe(); context.buffer = null; context.subscription = null; } this.contexts = null; _get(_getPrototypeOf(BufferToggleSubscriber.prototype), "_error", this).call(this, err); } }, { key: "_complete", value: function _complete() { var contexts = this.contexts; while (contexts.length > 0) { var context = contexts.shift(); this.destination.next(context.buffer); context.subscription.unsubscribe(); context.buffer = null; context.subscription = null; } this.contexts = null; _get(_getPrototypeOf(BufferToggleSubscriber.prototype), "_complete", this).call(this); } }, { key: "notifyNext", value: function notifyNext(outerValue, innerValue) { outerValue ? this.closeBuffer(outerValue) : this.openBuffer(innerValue); } }, { key: "notifyComplete", value: function notifyComplete(innerSub) { this.closeBuffer(innerSub.context); } }, { key: "openBuffer", value: function openBuffer(value) { try { var closingSelector = this.closingSelector; var closingNotifier = closingSelector.call(this, value); if (closingNotifier) { this.trySubscribe(closingNotifier); } } catch (err) { this._error(err); } } }, { key: "closeBuffer", value: function closeBuffer(context) { var contexts = this.contexts; if (contexts && context) { var buffer = context.buffer, subscription = context.subscription; this.destination.next(buffer); contexts.splice(contexts.indexOf(context), 1); this.remove(subscription); subscription.unsubscribe(); } } }, { key: "trySubscribe", value: function trySubscribe(closingNotifier) { var contexts = this.contexts; var buffer = []; var subscription = new _Subscription__WEBPACK_IMPORTED_MODULE_0__["Subscription"](); var context = { buffer: buffer, subscription: subscription }; contexts.push(context); var innerSubscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_1__["subscribeToResult"])(this, closingNotifier, context); if (!innerSubscription || innerSubscription.closed) { this.closeBuffer(context); } else { innerSubscription.context = context; this.add(innerSubscription); subscription.add(innerSubscription); } } }]); return BufferToggleSubscriber; }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_2__["OuterSubscriber"]); //# sourceMappingURL=bufferToggle.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/bufferWhen.js": /*!*********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/bufferWhen.js ***! \*********************************************************************/ /*! exports provided: bufferWhen */ /***/ function node_modulesRxjs_esm2015InternalOperatorsBufferWhenJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bufferWhen", function () { return bufferWhen; }); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function bufferWhen(closingSelector) { return function (source) { return source.lift(new BufferWhenOperator(closingSelector)); }; } var BufferWhenOperator = /*#__PURE__*/function () { function BufferWhenOperator(closingSelector) { _classCallCheck(this, BufferWhenOperator); this.closingSelector = closingSelector; } _createClass2(BufferWhenOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new BufferWhenSubscriber(subscriber, this.closingSelector)); } }]); return BufferWhenOperator; }(); var BufferWhenSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP4) { _inherits(BufferWhenSubscriber, _innerSubscribe__WEBP4); var _super200 = _createSuper(BufferWhenSubscriber); function BufferWhenSubscriber(destination, closingSelector) { var _this487; _classCallCheck(this, BufferWhenSubscriber); _this487 = _super200.call(this, destination); _this487.closingSelector = closingSelector; _this487.subscribing = false; _this487.openBuffer(); return _this487; } _createClass2(BufferWhenSubscriber, [{ key: "_next", value: function _next(value) { this.buffer.push(value); } }, { key: "_complete", value: function _complete() { var buffer = this.buffer; if (buffer) { this.destination.next(buffer); } _get(_getPrototypeOf(BufferWhenSubscriber.prototype), "_complete", this).call(this); } }, { key: "_unsubscribe", value: function _unsubscribe() { this.buffer = undefined; this.subscribing = false; } }, { key: "notifyNext", value: function notifyNext() { this.openBuffer(); } }, { key: "notifyComplete", value: function notifyComplete() { if (this.subscribing) { this.complete(); } else { this.openBuffer(); } } }, { key: "openBuffer", value: function openBuffer() { var closingSubscription = this.closingSubscription; if (closingSubscription) { this.remove(closingSubscription); closingSubscription.unsubscribe(); } var buffer = this.buffer; if (this.buffer) { this.destination.next(buffer); } this.buffer = []; var closingNotifier; try { var closingSelector = this.closingSelector; closingNotifier = closingSelector(); } catch (err) { return this.error(err); } closingSubscription = new _Subscription__WEBPACK_IMPORTED_MODULE_0__["Subscription"](); this.closingSubscription = closingSubscription; this.add(closingSubscription); this.subscribing = true; closingSubscription.add(Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_1__["innerSubscribe"])(closingNotifier, new _innerSubscribe__WEBPACK_IMPORTED_MODULE_1__["SimpleInnerSubscriber"](this))); this.subscribing = false; } }]); return BufferWhenSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_1__["SimpleOuterSubscriber"]); //# sourceMappingURL=bufferWhen.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/catchError.js": /*!*********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/catchError.js ***! \*********************************************************************/ /*! exports provided: catchError */ /***/ function node_modulesRxjs_esm2015InternalOperatorsCatchErrorJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "catchError", function () { return catchError; }); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function catchError(selector) { return function catchErrorOperatorFunction(source) { var operator = new CatchOperator(selector); var caught = source.lift(operator); return operator.caught = caught; }; } var CatchOperator = /*#__PURE__*/function () { function CatchOperator(selector) { _classCallCheck(this, CatchOperator); this.selector = selector; } _createClass2(CatchOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new CatchSubscriber(subscriber, this.selector, this.caught)); } }]); return CatchOperator; }(); var CatchSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP5) { _inherits(CatchSubscriber, _innerSubscribe__WEBP5); var _super201 = _createSuper(CatchSubscriber); function CatchSubscriber(destination, selector, caught) { var _this488; _classCallCheck(this, CatchSubscriber); _this488 = _super201.call(this, destination); _this488.selector = selector; _this488.caught = caught; return _this488; } _createClass2(CatchSubscriber, [{ key: "error", value: function error(err) { if (!this.isStopped) { var result; try { result = this.selector(err, this.caught); } catch (err2) { _get(_getPrototypeOf(CatchSubscriber.prototype), "error", this).call(this, err2); return; } this._unsubscribeAndRecycle(); var innerSubscriber = new _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleInnerSubscriber"](this); this.add(innerSubscriber); var innerSubscription = Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["innerSubscribe"])(result, innerSubscriber); if (innerSubscription !== innerSubscriber) { this.add(innerSubscription); } } } }]); return CatchSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleOuterSubscriber"]); //# sourceMappingURL=catchError.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/combineAll.js": /*!*********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/combineAll.js ***! \*********************************************************************/ /*! exports provided: combineAll */ /***/ function node_modulesRxjs_esm2015InternalOperatorsCombineAllJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "combineAll", function () { return combineAll; }); /* harmony import */ var _observable_combineLatest__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../observable/combineLatest */ "./node_modules/rxjs/_esm2015/internal/observable/combineLatest.js"); function combineAll(project) { return function (source) { return source.lift(new _observable_combineLatest__WEBPACK_IMPORTED_MODULE_0__["CombineLatestOperator"](project)); }; } //# sourceMappingURL=combineAll.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/combineLatest.js": /*!************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/combineLatest.js ***! \************************************************************************/ /*! exports provided: combineLatest */ /***/ function node_modulesRxjs_esm2015InternalOperatorsCombineLatestJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "combineLatest", function () { return combineLatest; }); /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../util/isArray */ "./node_modules/rxjs/_esm2015/internal/util/isArray.js"); /* harmony import */ var _observable_combineLatest__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../observable/combineLatest */ "./node_modules/rxjs/_esm2015/internal/observable/combineLatest.js"); /* harmony import */ var _observable_from__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../observable/from */ "./node_modules/rxjs/_esm2015/internal/observable/from.js"); var none = {}; function combineLatest() { for (var _len39 = arguments.length, observables = new Array(_len39), _key37 = 0; _key37 < _len39; _key37++) { observables[_key37] = arguments[_key37]; } var project = null; if (typeof observables[observables.length - 1] === 'function') { project = observables.pop(); } if (observables.length === 1 && Object(_util_isArray__WEBPACK_IMPORTED_MODULE_0__["isArray"])(observables[0])) { observables = observables[0].slice(); } return function (source) { return source.lift.call(Object(_observable_from__WEBPACK_IMPORTED_MODULE_2__["from"])([source].concat(_toConsumableArray(observables))), new _observable_combineLatest__WEBPACK_IMPORTED_MODULE_1__["CombineLatestOperator"](project)); }; } //# sourceMappingURL=combineLatest.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/concat.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/concat.js ***! \*****************************************************************/ /*! exports provided: concat */ /***/ function node_modulesRxjs_esm2015InternalOperatorsConcatJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concat", function () { return concat; }); /* harmony import */ var _observable_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../observable/concat */ "./node_modules/rxjs/_esm2015/internal/observable/concat.js"); function concat() { for (var _len40 = arguments.length, observables = new Array(_len40), _key38 = 0; _key38 < _len40; _key38++) { observables[_key38] = arguments[_key38]; } return function (source) { return source.lift.call(Object(_observable_concat__WEBPACK_IMPORTED_MODULE_0__["concat"]).apply(void 0, [source].concat(observables))); }; } //# sourceMappingURL=concat.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/concatAll.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/concatAll.js ***! \********************************************************************/ /*! exports provided: concatAll */ /***/ function node_modulesRxjs_esm2015InternalOperatorsConcatAllJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concatAll", function () { return concatAll; }); /* harmony import */ var _mergeAll__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./mergeAll */ "./node_modules/rxjs/_esm2015/internal/operators/mergeAll.js"); function concatAll() { return Object(_mergeAll__WEBPACK_IMPORTED_MODULE_0__["mergeAll"])(1); } //# sourceMappingURL=concatAll.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/concatMap.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/concatMap.js ***! \********************************************************************/ /*! exports provided: concatMap */ /***/ function node_modulesRxjs_esm2015InternalOperatorsConcatMapJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concatMap", function () { return concatMap; }); /* harmony import */ var _mergeMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./mergeMap */ "./node_modules/rxjs/_esm2015/internal/operators/mergeMap.js"); function concatMap(project, resultSelector) { return Object(_mergeMap__WEBPACK_IMPORTED_MODULE_0__["mergeMap"])(project, resultSelector, 1); } //# sourceMappingURL=concatMap.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/concatMapTo.js": /*!**********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/concatMapTo.js ***! \**********************************************************************/ /*! exports provided: concatMapTo */ /***/ function node_modulesRxjs_esm2015InternalOperatorsConcatMapToJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concatMapTo", function () { return concatMapTo; }); /* harmony import */ var _concatMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./concatMap */ "./node_modules/rxjs/_esm2015/internal/operators/concatMap.js"); function concatMapTo(innerObservable, resultSelector) { return Object(_concatMap__WEBPACK_IMPORTED_MODULE_0__["concatMap"])(function () { return innerObservable; }, resultSelector); } //# sourceMappingURL=concatMapTo.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/count.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/count.js ***! \****************************************************************/ /*! exports provided: count */ /***/ function node_modulesRxjs_esm2015InternalOperatorsCountJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "count", function () { return count; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function count(predicate) { return function (source) { return source.lift(new CountOperator(predicate, source)); }; } var CountOperator = /*#__PURE__*/function () { function CountOperator(predicate, source) { _classCallCheck(this, CountOperator); this.predicate = predicate; this.source = source; } _createClass2(CountOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new CountSubscriber(subscriber, this.predicate, this.source)); } }]); return CountOperator; }(); var CountSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_13) { _inherits(CountSubscriber, _Subscriber__WEBPACK_13); var _super202 = _createSuper(CountSubscriber); function CountSubscriber(destination, predicate, source) { var _this489; _classCallCheck(this, CountSubscriber); _this489 = _super202.call(this, destination); _this489.predicate = predicate; _this489.source = source; _this489.count = 0; _this489.index = 0; return _this489; } _createClass2(CountSubscriber, [{ key: "_next", value: function _next(value) { if (this.predicate) { this._tryPredicate(value); } else { this.count++; } } }, { key: "_tryPredicate", value: function _tryPredicate(value) { var result; try { result = this.predicate(value, this.index++, this.source); } catch (err) { this.destination.error(err); return; } if (result) { this.count++; } } }, { key: "_complete", value: function _complete() { this.destination.next(this.count); this.destination.complete(); } }]); return CountSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=count.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/debounce.js": /*!*******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/debounce.js ***! \*******************************************************************/ /*! exports provided: debounce */ /***/ function node_modulesRxjs_esm2015InternalOperatorsDebounceJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function () { return debounce; }); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function debounce(durationSelector) { return function (source) { return source.lift(new DebounceOperator(durationSelector)); }; } var DebounceOperator = /*#__PURE__*/function () { function DebounceOperator(durationSelector) { _classCallCheck(this, DebounceOperator); this.durationSelector = durationSelector; } _createClass2(DebounceOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new DebounceSubscriber(subscriber, this.durationSelector)); } }]); return DebounceOperator; }(); var DebounceSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP6) { _inherits(DebounceSubscriber, _innerSubscribe__WEBP6); var _super203 = _createSuper(DebounceSubscriber); function DebounceSubscriber(destination, durationSelector) { var _this490; _classCallCheck(this, DebounceSubscriber); _this490 = _super203.call(this, destination); _this490.durationSelector = durationSelector; _this490.hasValue = false; return _this490; } _createClass2(DebounceSubscriber, [{ key: "_next", value: function _next(value) { try { var result = this.durationSelector.call(this, value); if (result) { this._tryNext(value, result); } } catch (err) { this.destination.error(err); } } }, { key: "_complete", value: function _complete() { this.emitValue(); this.destination.complete(); } }, { key: "_tryNext", value: function _tryNext(value, duration) { var subscription = this.durationSubscription; this.value = value; this.hasValue = true; if (subscription) { subscription.unsubscribe(); this.remove(subscription); } subscription = Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["innerSubscribe"])(duration, new _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleInnerSubscriber"](this)); if (subscription && !subscription.closed) { this.add(this.durationSubscription = subscription); } } }, { key: "notifyNext", value: function notifyNext() { this.emitValue(); } }, { key: "notifyComplete", value: function notifyComplete() { this.emitValue(); } }, { key: "emitValue", value: function emitValue() { if (this.hasValue) { var value = this.value; var subscription = this.durationSubscription; if (subscription) { this.durationSubscription = undefined; subscription.unsubscribe(); this.remove(subscription); } this.value = undefined; this.hasValue = false; _get(_getPrototypeOf(DebounceSubscriber.prototype), "_next", this).call(this, value); } } }]); return DebounceSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleOuterSubscriber"]); //# sourceMappingURL=debounce.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/debounceTime.js": /*!***********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/debounceTime.js ***! \***********************************************************************/ /*! exports provided: debounceTime */ /***/ function node_modulesRxjs_esm2015InternalOperatorsDebounceTimeJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "debounceTime", function () { return debounceTime; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../scheduler/async */ "./node_modules/rxjs/_esm2015/internal/scheduler/async.js"); function debounceTime(dueTime) { var scheduler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _scheduler_async__WEBPACK_IMPORTED_MODULE_1__["async"]; return function (source) { return source.lift(new DebounceTimeOperator(dueTime, scheduler)); }; } var DebounceTimeOperator = /*#__PURE__*/function () { function DebounceTimeOperator(dueTime, scheduler) { _classCallCheck(this, DebounceTimeOperator); this.dueTime = dueTime; this.scheduler = scheduler; } _createClass2(DebounceTimeOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler)); } }]); return DebounceTimeOperator; }(); var DebounceTimeSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_14) { _inherits(DebounceTimeSubscriber, _Subscriber__WEBPACK_14); var _super204 = _createSuper(DebounceTimeSubscriber); function DebounceTimeSubscriber(destination, dueTime, scheduler) { var _this491; _classCallCheck(this, DebounceTimeSubscriber); _this491 = _super204.call(this, destination); _this491.dueTime = dueTime; _this491.scheduler = scheduler; _this491.debouncedSubscription = null; _this491.lastValue = null; _this491.hasValue = false; return _this491; } _createClass2(DebounceTimeSubscriber, [{ key: "_next", value: function _next(value) { this.clearDebounce(); this.lastValue = value; this.hasValue = true; this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this)); } }, { key: "_complete", value: function _complete() { this.debouncedNext(); this.destination.complete(); } }, { key: "debouncedNext", value: function debouncedNext() { this.clearDebounce(); if (this.hasValue) { var lastValue = this.lastValue; this.lastValue = null; this.hasValue = false; this.destination.next(lastValue); } } }, { key: "clearDebounce", value: function clearDebounce() { var debouncedSubscription = this.debouncedSubscription; if (debouncedSubscription !== null) { this.remove(debouncedSubscription); debouncedSubscription.unsubscribe(); this.debouncedSubscription = null; } } }]); return DebounceTimeSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); function dispatchNext(subscriber) { subscriber.debouncedNext(); } //# sourceMappingURL=debounceTime.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/defaultIfEmpty.js": /*!*************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/defaultIfEmpty.js ***! \*************************************************************************/ /*! exports provided: defaultIfEmpty */ /***/ function node_modulesRxjs_esm2015InternalOperatorsDefaultIfEmptyJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultIfEmpty", function () { return defaultIfEmpty; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function defaultIfEmpty() { var defaultValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; return function (source) { return source.lift(new DefaultIfEmptyOperator(defaultValue)); }; } var DefaultIfEmptyOperator = /*#__PURE__*/function () { function DefaultIfEmptyOperator(defaultValue) { _classCallCheck(this, DefaultIfEmptyOperator); this.defaultValue = defaultValue; } _createClass2(DefaultIfEmptyOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue)); } }]); return DefaultIfEmptyOperator; }(); var DefaultIfEmptySubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_15) { _inherits(DefaultIfEmptySubscriber, _Subscriber__WEBPACK_15); var _super205 = _createSuper(DefaultIfEmptySubscriber); function DefaultIfEmptySubscriber(destination, defaultValue) { var _this492; _classCallCheck(this, DefaultIfEmptySubscriber); _this492 = _super205.call(this, destination); _this492.defaultValue = defaultValue; _this492.isEmpty = true; return _this492; } _createClass2(DefaultIfEmptySubscriber, [{ key: "_next", value: function _next(value) { this.isEmpty = false; this.destination.next(value); } }, { key: "_complete", value: function _complete() { if (this.isEmpty) { this.destination.next(this.defaultValue); } this.destination.complete(); } }]); return DefaultIfEmptySubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=defaultIfEmpty.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/delay.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/delay.js ***! \****************************************************************/ /*! exports provided: delay */ /***/ function node_modulesRxjs_esm2015InternalOperatorsDelayJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function () { return delay; }); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../scheduler/async */ "./node_modules/rxjs/_esm2015/internal/scheduler/async.js"); /* harmony import */ var _util_isDate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/isDate */ "./node_modules/rxjs/_esm2015/internal/util/isDate.js"); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _Notification__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../Notification */ "./node_modules/rxjs/_esm2015/internal/Notification.js"); function delay(delay) { var scheduler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _scheduler_async__WEBPACK_IMPORTED_MODULE_0__["async"]; var absoluteDelay = Object(_util_isDate__WEBPACK_IMPORTED_MODULE_1__["isDate"])(delay); var delayFor = absoluteDelay ? +delay - scheduler.now() : Math.abs(delay); return function (source) { return source.lift(new DelayOperator(delayFor, scheduler)); }; } var DelayOperator = /*#__PURE__*/function () { function DelayOperator(delay, scheduler) { _classCallCheck(this, DelayOperator); this.delay = delay; this.scheduler = scheduler; } _createClass2(DelayOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new DelaySubscriber(subscriber, this.delay, this.scheduler)); } }]); return DelayOperator; }(); var DelaySubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_16) { _inherits(DelaySubscriber, _Subscriber__WEBPACK_16); var _super206 = _createSuper(DelaySubscriber); function DelaySubscriber(destination, delay, scheduler) { var _this493; _classCallCheck(this, DelaySubscriber); _this493 = _super206.call(this, destination); _this493.delay = delay; _this493.scheduler = scheduler; _this493.queue = []; _this493.active = false; _this493.errored = false; return _this493; } _createClass2(DelaySubscriber, [{ key: "_schedule", value: function _schedule(scheduler) { this.active = true; var destination = this.destination; destination.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, { source: this, destination: this.destination, scheduler: scheduler })); } }, { key: "scheduleNotification", value: function scheduleNotification(notification) { if (this.errored === true) { return; } var scheduler = this.scheduler; var message = new DelayMessage(scheduler.now() + this.delay, notification); this.queue.push(message); if (this.active === false) { this._schedule(scheduler); } } }, { key: "_next", value: function _next(value) { this.scheduleNotification(_Notification__WEBPACK_IMPORTED_MODULE_3__["Notification"].createNext(value)); } }, { key: "_error", value: function _error(err) { this.errored = true; this.queue = []; this.destination.error(err); this.unsubscribe(); } }, { key: "_complete", value: function _complete() { this.scheduleNotification(_Notification__WEBPACK_IMPORTED_MODULE_3__["Notification"].createComplete()); this.unsubscribe(); } }], [{ key: "dispatch", value: function dispatch(state) { var source = state.source; var queue = source.queue; var scheduler = state.scheduler; var destination = state.destination; while (queue.length > 0 && queue[0].time - scheduler.now() <= 0) { queue.shift().notification.observe(destination); } if (queue.length > 0) { var _delay = Math.max(0, queue[0].time - scheduler.now()); this.schedule(state, _delay); } else { this.unsubscribe(); source.active = false; } } }]); return DelaySubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_2__["Subscriber"]); var DelayMessage = function DelayMessage(time, notification) { _classCallCheck(this, DelayMessage); this.time = time; this.notification = notification; }; //# sourceMappingURL=delay.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/delayWhen.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/delayWhen.js ***! \********************************************************************/ /*! exports provided: delayWhen */ /***/ function node_modulesRxjs_esm2015InternalOperatorsDelayWhenJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "delayWhen", function () { return delayWhen; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../OuterSubscriber */ "./node_modules/rxjs/_esm2015/internal/OuterSubscriber.js"); /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm2015/internal/util/subscribeToResult.js"); function delayWhen(delayDurationSelector, subscriptionDelay) { if (subscriptionDelay) { return function (source) { return new SubscriptionDelayObservable(source, subscriptionDelay).lift(new DelayWhenOperator(delayDurationSelector)); }; } return function (source) { return source.lift(new DelayWhenOperator(delayDurationSelector)); }; } var DelayWhenOperator = /*#__PURE__*/function () { function DelayWhenOperator(delayDurationSelector) { _classCallCheck(this, DelayWhenOperator); this.delayDurationSelector = delayDurationSelector; } _createClass2(DelayWhenOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new DelayWhenSubscriber(subscriber, this.delayDurationSelector)); } }]); return DelayWhenOperator; }(); var DelayWhenSubscriber = /*#__PURE__*/function (_OuterSubscriber__WEB4) { _inherits(DelayWhenSubscriber, _OuterSubscriber__WEB4); var _super207 = _createSuper(DelayWhenSubscriber); function DelayWhenSubscriber(destination, delayDurationSelector) { var _this494; _classCallCheck(this, DelayWhenSubscriber); _this494 = _super207.call(this, destination); _this494.delayDurationSelector = delayDurationSelector; _this494.completed = false; _this494.delayNotifierSubscriptions = []; _this494.index = 0; return _this494; } _createClass2(DelayWhenSubscriber, [{ key: "notifyNext", value: function notifyNext(outerValue, _innerValue, _outerIndex, _innerIndex, innerSub) { this.destination.next(outerValue); this.removeSubscription(innerSub); this.tryComplete(); } }, { key: "notifyError", value: function notifyError(error, innerSub) { this._error(error); } }, { key: "notifyComplete", value: function notifyComplete(innerSub) { var value = this.removeSubscription(innerSub); if (value) { this.destination.next(value); } this.tryComplete(); } }, { key: "_next", value: function _next(value) { var index = this.index++; try { var delayNotifier = this.delayDurationSelector(value, index); if (delayNotifier) { this.tryDelay(delayNotifier, value); } } catch (err) { this.destination.error(err); } } }, { key: "_complete", value: function _complete() { this.completed = true; this.tryComplete(); this.unsubscribe(); } }, { key: "removeSubscription", value: function removeSubscription(subscription) { subscription.unsubscribe(); var subscriptionIdx = this.delayNotifierSubscriptions.indexOf(subscription); if (subscriptionIdx !== -1) { this.delayNotifierSubscriptions.splice(subscriptionIdx, 1); } return subscription.outerValue; } }, { key: "tryDelay", value: function tryDelay(delayNotifier, value) { var notifierSubscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_3__["subscribeToResult"])(this, delayNotifier, value); if (notifierSubscription && !notifierSubscription.closed) { var destination = this.destination; destination.add(notifierSubscription); this.delayNotifierSubscriptions.push(notifierSubscription); } } }, { key: "tryComplete", value: function tryComplete() { if (this.completed && this.delayNotifierSubscriptions.length === 0) { this.destination.complete(); } } }]); return DelayWhenSubscriber; }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_2__["OuterSubscriber"]); var SubscriptionDelayObservable = /*#__PURE__*/function (_Observable__WEBPACK_4) { _inherits(SubscriptionDelayObservable, _Observable__WEBPACK_4); var _super208 = _createSuper(SubscriptionDelayObservable); function SubscriptionDelayObservable(source, subscriptionDelay) { var _this495; _classCallCheck(this, SubscriptionDelayObservable); _this495 = _super208.call(this); _this495.source = source; _this495.subscriptionDelay = subscriptionDelay; return _this495; } _createClass2(SubscriptionDelayObservable, [{ key: "_subscribe", value: function _subscribe(subscriber) { this.subscriptionDelay.subscribe(new SubscriptionDelaySubscriber(subscriber, this.source)); } }]); return SubscriptionDelayObservable; }(_Observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]); var SubscriptionDelaySubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_17) { _inherits(SubscriptionDelaySubscriber, _Subscriber__WEBPACK_17); var _super209 = _createSuper(SubscriptionDelaySubscriber); function SubscriptionDelaySubscriber(parent, source) { var _this496; _classCallCheck(this, SubscriptionDelaySubscriber); _this496 = _super209.call(this); _this496.parent = parent; _this496.source = source; _this496.sourceSubscribed = false; return _this496; } _createClass2(SubscriptionDelaySubscriber, [{ key: "_next", value: function _next(unused) { this.subscribeToSource(); } }, { key: "_error", value: function _error(err) { this.unsubscribe(); this.parent.error(err); } }, { key: "_complete", value: function _complete() { this.unsubscribe(); this.subscribeToSource(); } }, { key: "subscribeToSource", value: function subscribeToSource() { if (!this.sourceSubscribed) { this.sourceSubscribed = true; this.unsubscribe(); this.source.subscribe(this.parent); } } }]); return SubscriptionDelaySubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=delayWhen.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/dematerialize.js": /*!************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/dematerialize.js ***! \************************************************************************/ /*! exports provided: dematerialize */ /***/ function node_modulesRxjs_esm2015InternalOperatorsDematerializeJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dematerialize", function () { return dematerialize; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function dematerialize() { return function dematerializeOperatorFunction(source) { return source.lift(new DeMaterializeOperator()); }; } var DeMaterializeOperator = /*#__PURE__*/function () { function DeMaterializeOperator() { _classCallCheck(this, DeMaterializeOperator); } _createClass2(DeMaterializeOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new DeMaterializeSubscriber(subscriber)); } }]); return DeMaterializeOperator; }(); var DeMaterializeSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_18) { _inherits(DeMaterializeSubscriber, _Subscriber__WEBPACK_18); var _super210 = _createSuper(DeMaterializeSubscriber); function DeMaterializeSubscriber(destination) { _classCallCheck(this, DeMaterializeSubscriber); return _super210.call(this, destination); } _createClass2(DeMaterializeSubscriber, [{ key: "_next", value: function _next(value) { value.observe(this.destination); } }]); return DeMaterializeSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=dematerialize.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/distinct.js": /*!*******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/distinct.js ***! \*******************************************************************/ /*! exports provided: distinct, DistinctSubscriber */ /***/ function node_modulesRxjs_esm2015InternalOperatorsDistinctJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "distinct", function () { return distinct; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DistinctSubscriber", function () { return DistinctSubscriber; }); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function distinct(keySelector, flushes) { return function (source) { return source.lift(new DistinctOperator(keySelector, flushes)); }; } var DistinctOperator = /*#__PURE__*/function () { function DistinctOperator(keySelector, flushes) { _classCallCheck(this, DistinctOperator); this.keySelector = keySelector; this.flushes = flushes; } _createClass2(DistinctOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new DistinctSubscriber(subscriber, this.keySelector, this.flushes)); } }]); return DistinctOperator; }(); var DistinctSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP7) { _inherits(DistinctSubscriber, _innerSubscribe__WEBP7); var _super211 = _createSuper(DistinctSubscriber); function DistinctSubscriber(destination, keySelector, flushes) { var _this497; _classCallCheck(this, DistinctSubscriber); _this497 = _super211.call(this, destination); _this497.keySelector = keySelector; _this497.values = new Set(); if (flushes) { _this497.add(Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["innerSubscribe"])(flushes, new _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleInnerSubscriber"](_assertThisInitialized(_this497)))); } return _this497; } _createClass2(DistinctSubscriber, [{ key: "notifyNext", value: function notifyNext() { this.values.clear(); } }, { key: "notifyError", value: function notifyError(error) { this._error(error); } }, { key: "_next", value: function _next(value) { if (this.keySelector) { this._useKeySelector(value); } else { this._finalizeNext(value, value); } } }, { key: "_useKeySelector", value: function _useKeySelector(value) { var key; var destination = this.destination; try { key = this.keySelector(value); } catch (err) { destination.error(err); return; } this._finalizeNext(key, value); } }, { key: "_finalizeNext", value: function _finalizeNext(key, value) { var values = this.values; if (!values.has(key)) { values.add(key); this.destination.next(value); } } }]); return DistinctSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleOuterSubscriber"]); //# sourceMappingURL=distinct.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/distinctUntilChanged.js": /*!*******************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/distinctUntilChanged.js ***! \*******************************************************************************/ /*! exports provided: distinctUntilChanged */ /***/ function node_modulesRxjs_esm2015InternalOperatorsDistinctUntilChangedJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "distinctUntilChanged", function () { return distinctUntilChanged; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function distinctUntilChanged(compare, keySelector) { return function (source) { return source.lift(new DistinctUntilChangedOperator(compare, keySelector)); }; } var DistinctUntilChangedOperator = /*#__PURE__*/function () { function DistinctUntilChangedOperator(compare, keySelector) { _classCallCheck(this, DistinctUntilChangedOperator); this.compare = compare; this.keySelector = keySelector; } _createClass2(DistinctUntilChangedOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new DistinctUntilChangedSubscriber(subscriber, this.compare, this.keySelector)); } }]); return DistinctUntilChangedOperator; }(); var DistinctUntilChangedSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_19) { _inherits(DistinctUntilChangedSubscriber, _Subscriber__WEBPACK_19); var _super212 = _createSuper(DistinctUntilChangedSubscriber); function DistinctUntilChangedSubscriber(destination, compare, keySelector) { var _this498; _classCallCheck(this, DistinctUntilChangedSubscriber); _this498 = _super212.call(this, destination); _this498.keySelector = keySelector; _this498.hasKey = false; if (typeof compare === 'function') { _this498.compare = compare; } return _this498; } _createClass2(DistinctUntilChangedSubscriber, [{ key: "compare", value: function compare(x, y) { return x === y; } }, { key: "_next", value: function _next(value) { var key; try { var keySelector = this.keySelector; key = keySelector ? keySelector(value) : value; } catch (err) { return this.destination.error(err); } var result = false; if (this.hasKey) { try { var compare = this.compare; result = compare(this.key, key); } catch (err) { return this.destination.error(err); } } else { this.hasKey = true; } if (!result) { this.key = key; this.destination.next(value); } } }]); return DistinctUntilChangedSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=distinctUntilChanged.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/distinctUntilKeyChanged.js": /*!**********************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/distinctUntilKeyChanged.js ***! \**********************************************************************************/ /*! exports provided: distinctUntilKeyChanged */ /***/ function node_modulesRxjs_esm2015InternalOperatorsDistinctUntilKeyChangedJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "distinctUntilKeyChanged", function () { return distinctUntilKeyChanged; }); /* harmony import */ var _distinctUntilChanged__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./distinctUntilChanged */ "./node_modules/rxjs/_esm2015/internal/operators/distinctUntilChanged.js"); function distinctUntilKeyChanged(key, compare) { return Object(_distinctUntilChanged__WEBPACK_IMPORTED_MODULE_0__["distinctUntilChanged"])(function (x, y) { return compare ? compare(x[key], y[key]) : x[key] === y[key]; }); } //# sourceMappingURL=distinctUntilKeyChanged.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/elementAt.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/elementAt.js ***! \********************************************************************/ /*! exports provided: elementAt */ /***/ function node_modulesRxjs_esm2015InternalOperatorsElementAtJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "elementAt", function () { return elementAt; }); /* harmony import */ var _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../util/ArgumentOutOfRangeError */ "./node_modules/rxjs/_esm2015/internal/util/ArgumentOutOfRangeError.js"); /* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./filter */ "./node_modules/rxjs/_esm2015/internal/operators/filter.js"); /* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./throwIfEmpty */ "./node_modules/rxjs/_esm2015/internal/operators/throwIfEmpty.js"); /* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./defaultIfEmpty */ "./node_modules/rxjs/_esm2015/internal/operators/defaultIfEmpty.js"); /* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ./take */ "./node_modules/rxjs/_esm2015/internal/operators/take.js"); function elementAt(index, defaultValue) { if (index < 0) { throw new _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_0__["ArgumentOutOfRangeError"](); } var hasDefaultValue = arguments.length >= 2; return function (source) { return source.pipe(Object(_filter__WEBPACK_IMPORTED_MODULE_1__["filter"])(function (v, i) { return i === index; }), Object(_take__WEBPACK_IMPORTED_MODULE_4__["take"])(1), hasDefaultValue ? Object(_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__["defaultIfEmpty"])(defaultValue) : Object(_throwIfEmpty__WEBPACK_IMPORTED_MODULE_2__["throwIfEmpty"])(function () { return new _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_0__["ArgumentOutOfRangeError"](); })); }; } //# sourceMappingURL=elementAt.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/endWith.js": /*!******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/endWith.js ***! \******************************************************************/ /*! exports provided: endWith */ /***/ function node_modulesRxjs_esm2015InternalOperatorsEndWithJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "endWith", function () { return endWith; }); /* harmony import */ var _observable_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../observable/concat */ "./node_modules/rxjs/_esm2015/internal/observable/concat.js"); /* harmony import */ var _observable_of__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../observable/of */ "./node_modules/rxjs/_esm2015/internal/observable/of.js"); function endWith() { for (var _len41 = arguments.length, array = new Array(_len41), _key39 = 0; _key39 < _len41; _key39++) { array[_key39] = arguments[_key39]; } return function (source) { return Object(_observable_concat__WEBPACK_IMPORTED_MODULE_0__["concat"])(source, Object(_observable_of__WEBPACK_IMPORTED_MODULE_1__["of"]).apply(void 0, array)); }; } //# sourceMappingURL=endWith.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/every.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/every.js ***! \****************************************************************/ /*! exports provided: every */ /***/ function node_modulesRxjs_esm2015InternalOperatorsEveryJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "every", function () { return every; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function every(predicate, thisArg) { return function (source) { return source.lift(new EveryOperator(predicate, thisArg, source)); }; } var EveryOperator = /*#__PURE__*/function () { function EveryOperator(predicate, thisArg, source) { _classCallCheck(this, EveryOperator); this.predicate = predicate; this.thisArg = thisArg; this.source = source; } _createClass2(EveryOperator, [{ key: "call", value: function call(observer, source) { return source.subscribe(new EverySubscriber(observer, this.predicate, this.thisArg, this.source)); } }]); return EveryOperator; }(); var EverySubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_20) { _inherits(EverySubscriber, _Subscriber__WEBPACK_20); var _super213 = _createSuper(EverySubscriber); function EverySubscriber(destination, predicate, thisArg, source) { var _this499; _classCallCheck(this, EverySubscriber); _this499 = _super213.call(this, destination); _this499.predicate = predicate; _this499.thisArg = thisArg; _this499.source = source; _this499.index = 0; _this499.thisArg = thisArg || _assertThisInitialized(_this499); return _this499; } _createClass2(EverySubscriber, [{ key: "notifyComplete", value: function notifyComplete(everyValueMatch) { this.destination.next(everyValueMatch); this.destination.complete(); } }, { key: "_next", value: function _next(value) { var result = false; try { result = this.predicate.call(this.thisArg, value, this.index++, this.source); } catch (err) { this.destination.error(err); return; } if (!result) { this.notifyComplete(false); } } }, { key: "_complete", value: function _complete() { this.notifyComplete(true); } }]); return EverySubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=every.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/exhaust.js": /*!******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/exhaust.js ***! \******************************************************************/ /*! exports provided: exhaust */ /***/ function node_modulesRxjs_esm2015InternalOperatorsExhaustJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exhaust", function () { return exhaust; }); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function exhaust() { return function (source) { return source.lift(new SwitchFirstOperator()); }; } var SwitchFirstOperator = /*#__PURE__*/function () { function SwitchFirstOperator() { _classCallCheck(this, SwitchFirstOperator); } _createClass2(SwitchFirstOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new SwitchFirstSubscriber(subscriber)); } }]); return SwitchFirstOperator; }(); var SwitchFirstSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP8) { _inherits(SwitchFirstSubscriber, _innerSubscribe__WEBP8); var _super214 = _createSuper(SwitchFirstSubscriber); function SwitchFirstSubscriber(destination) { var _this500; _classCallCheck(this, SwitchFirstSubscriber); _this500 = _super214.call(this, destination); _this500.hasCompleted = false; _this500.hasSubscription = false; return _this500; } _createClass2(SwitchFirstSubscriber, [{ key: "_next", value: function _next(value) { if (!this.hasSubscription) { this.hasSubscription = true; this.add(Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["innerSubscribe"])(value, new _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleInnerSubscriber"](this))); } } }, { key: "_complete", value: function _complete() { this.hasCompleted = true; if (!this.hasSubscription) { this.destination.complete(); } } }, { key: "notifyComplete", value: function notifyComplete() { this.hasSubscription = false; if (this.hasCompleted) { this.destination.complete(); } } }]); return SwitchFirstSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleOuterSubscriber"]); //# sourceMappingURL=exhaust.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/exhaustMap.js": /*!*********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/exhaustMap.js ***! \*********************************************************************/ /*! exports provided: exhaustMap */ /***/ function node_modulesRxjs_esm2015InternalOperatorsExhaustMapJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exhaustMap", function () { return exhaustMap; }); /* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./map */ "./node_modules/rxjs/_esm2015/internal/operators/map.js"); /* harmony import */ var _observable_from__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../observable/from */ "./node_modules/rxjs/_esm2015/internal/observable/from.js"); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function exhaustMap(project, resultSelector) { if (resultSelector) { return function (source) { return source.pipe(exhaustMap(function (a, i) { return Object(_observable_from__WEBPACK_IMPORTED_MODULE_1__["from"])(project(a, i)).pipe(Object(_map__WEBPACK_IMPORTED_MODULE_0__["map"])(function (b, ii) { return resultSelector(a, b, i, ii); })); })); }; } return function (source) { return source.lift(new ExhaustMapOperator(project)); }; } var ExhaustMapOperator = /*#__PURE__*/function () { function ExhaustMapOperator(project) { _classCallCheck(this, ExhaustMapOperator); this.project = project; } _createClass2(ExhaustMapOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new ExhaustMapSubscriber(subscriber, this.project)); } }]); return ExhaustMapOperator; }(); var ExhaustMapSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP9) { _inherits(ExhaustMapSubscriber, _innerSubscribe__WEBP9); var _super215 = _createSuper(ExhaustMapSubscriber); function ExhaustMapSubscriber(destination, project) { var _this501; _classCallCheck(this, ExhaustMapSubscriber); _this501 = _super215.call(this, destination); _this501.project = project; _this501.hasSubscription = false; _this501.hasCompleted = false; _this501.index = 0; return _this501; } _createClass2(ExhaustMapSubscriber, [{ key: "_next", value: function _next(value) { if (!this.hasSubscription) { this.tryNext(value); } } }, { key: "tryNext", value: function tryNext(value) { var result; var index = this.index++; try { result = this.project(value, index); } catch (err) { this.destination.error(err); return; } this.hasSubscription = true; this._innerSub(result); } }, { key: "_innerSub", value: function _innerSub(result) { var innerSubscriber = new _innerSubscribe__WEBPACK_IMPORTED_MODULE_2__["SimpleInnerSubscriber"](this); var destination = this.destination; destination.add(innerSubscriber); var innerSubscription = Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_2__["innerSubscribe"])(result, innerSubscriber); if (innerSubscription !== innerSubscriber) { destination.add(innerSubscription); } } }, { key: "_complete", value: function _complete() { this.hasCompleted = true; if (!this.hasSubscription) { this.destination.complete(); } this.unsubscribe(); } }, { key: "notifyNext", value: function notifyNext(innerValue) { this.destination.next(innerValue); } }, { key: "notifyError", value: function notifyError(err) { this.destination.error(err); } }, { key: "notifyComplete", value: function notifyComplete() { this.hasSubscription = false; if (this.hasCompleted) { this.destination.complete(); } } }]); return ExhaustMapSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_2__["SimpleOuterSubscriber"]); //# sourceMappingURL=exhaustMap.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/expand.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/expand.js ***! \*****************************************************************/ /*! exports provided: expand, ExpandOperator, ExpandSubscriber */ /***/ function node_modulesRxjs_esm2015InternalOperatorsExpandJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "expand", function () { return expand; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpandOperator", function () { return ExpandOperator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpandSubscriber", function () { return ExpandSubscriber; }); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function expand(project) { var concurrent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.POSITIVE_INFINITY; var scheduler = arguments.length > 2 ? arguments[2] : undefined; concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent; return function (source) { return source.lift(new ExpandOperator(project, concurrent, scheduler)); }; } var ExpandOperator = /*#__PURE__*/function () { function ExpandOperator(project, concurrent, scheduler) { _classCallCheck(this, ExpandOperator); this.project = project; this.concurrent = concurrent; this.scheduler = scheduler; } _createClass2(ExpandOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new ExpandSubscriber(subscriber, this.project, this.concurrent, this.scheduler)); } }]); return ExpandOperator; }(); var ExpandSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP10) { _inherits(ExpandSubscriber, _innerSubscribe__WEBP10); var _super216 = _createSuper(ExpandSubscriber); function ExpandSubscriber(destination, project, concurrent, scheduler) { var _this502; _classCallCheck(this, ExpandSubscriber); _this502 = _super216.call(this, destination); _this502.project = project; _this502.concurrent = concurrent; _this502.scheduler = scheduler; _this502.index = 0; _this502.active = 0; _this502.hasCompleted = false; if (concurrent < Number.POSITIVE_INFINITY) { _this502.buffer = []; } return _this502; } _createClass2(ExpandSubscriber, [{ key: "_next", value: function _next(value) { var destination = this.destination; if (destination.closed) { this._complete(); return; } var index = this.index++; if (this.active < this.concurrent) { destination.next(value); try { var project = this.project; var result = project(value, index); if (!this.scheduler) { this.subscribeToProjection(result, value, index); } else { var state = { subscriber: this, result: result, value: value, index: index }; var _destination = this.destination; _destination.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state)); } } catch (e) { destination.error(e); } } else { this.buffer.push(value); } } }, { key: "subscribeToProjection", value: function subscribeToProjection(result, value, index) { this.active++; var destination = this.destination; destination.add(Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["innerSubscribe"])(result, new _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleInnerSubscriber"](this))); } }, { key: "_complete", value: function _complete() { this.hasCompleted = true; if (this.hasCompleted && this.active === 0) { this.destination.complete(); } this.unsubscribe(); } }, { key: "notifyNext", value: function notifyNext(innerValue) { this._next(innerValue); } }, { key: "notifyComplete", value: function notifyComplete() { var buffer = this.buffer; this.active--; if (buffer && buffer.length > 0) { this._next(buffer.shift()); } if (this.hasCompleted && this.active === 0) { this.destination.complete(); } } }], [{ key: "dispatch", value: function dispatch(arg) { var subscriber = arg.subscriber, result = arg.result, value = arg.value, index = arg.index; subscriber.subscribeToProjection(result, value, index); } }]); return ExpandSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleOuterSubscriber"]); //# sourceMappingURL=expand.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/filter.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/filter.js ***! \*****************************************************************/ /*! exports provided: filter */ /***/ function node_modulesRxjs_esm2015InternalOperatorsFilterJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function () { return filter; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function filter(predicate, thisArg) { return function filterOperatorFunction(source) { return source.lift(new FilterOperator(predicate, thisArg)); }; } var FilterOperator = /*#__PURE__*/function () { function FilterOperator(predicate, thisArg) { _classCallCheck(this, FilterOperator); this.predicate = predicate; this.thisArg = thisArg; } _createClass2(FilterOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new FilterSubscriber(subscriber, this.predicate, this.thisArg)); } }]); return FilterOperator; }(); var FilterSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_21) { _inherits(FilterSubscriber, _Subscriber__WEBPACK_21); var _super217 = _createSuper(FilterSubscriber); function FilterSubscriber(destination, predicate, thisArg) { var _this503; _classCallCheck(this, FilterSubscriber); _this503 = _super217.call(this, destination); _this503.predicate = predicate; _this503.thisArg = thisArg; _this503.count = 0; return _this503; } _createClass2(FilterSubscriber, [{ key: "_next", value: function _next(value) { var result; try { result = this.predicate.call(this.thisArg, value, this.count++); } catch (err) { this.destination.error(err); return; } if (result) { this.destination.next(value); } } }]); return FilterSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=filter.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/finalize.js": /*!*******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/finalize.js ***! \*******************************************************************/ /*! exports provided: finalize */ /***/ function node_modulesRxjs_esm2015InternalOperatorsFinalizeJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "finalize", function () { return finalize; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); function finalize(callback) { return function (source) { return source.lift(new FinallyOperator(callback)); }; } var FinallyOperator = /*#__PURE__*/function () { function FinallyOperator(callback) { _classCallCheck(this, FinallyOperator); this.callback = callback; } _createClass2(FinallyOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new FinallySubscriber(subscriber, this.callback)); } }]); return FinallyOperator; }(); var FinallySubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_22) { _inherits(FinallySubscriber, _Subscriber__WEBPACK_22); var _super218 = _createSuper(FinallySubscriber); function FinallySubscriber(destination, callback) { var _this504; _classCallCheck(this, FinallySubscriber); _this504 = _super218.call(this, destination); _this504.add(new _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"](callback)); return _this504; } return FinallySubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=finalize.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/find.js": /*!***************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/find.js ***! \***************************************************************/ /*! exports provided: find, FindValueOperator, FindValueSubscriber */ /***/ function node_modulesRxjs_esm2015InternalOperatorsFindJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "find", function () { return find; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FindValueOperator", function () { return FindValueOperator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FindValueSubscriber", function () { return FindValueSubscriber; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function find(predicate, thisArg) { if (typeof predicate !== 'function') { throw new TypeError('predicate is not a function'); } return function (source) { return source.lift(new FindValueOperator(predicate, source, false, thisArg)); }; } var FindValueOperator = /*#__PURE__*/function () { function FindValueOperator(predicate, source, yieldIndex, thisArg) { _classCallCheck(this, FindValueOperator); this.predicate = predicate; this.source = source; this.yieldIndex = yieldIndex; this.thisArg = thisArg; } _createClass2(FindValueOperator, [{ key: "call", value: function call(observer, source) { return source.subscribe(new FindValueSubscriber(observer, this.predicate, this.source, this.yieldIndex, this.thisArg)); } }]); return FindValueOperator; }(); var FindValueSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_23) { _inherits(FindValueSubscriber, _Subscriber__WEBPACK_23); var _super219 = _createSuper(FindValueSubscriber); function FindValueSubscriber(destination, predicate, source, yieldIndex, thisArg) { var _this505; _classCallCheck(this, FindValueSubscriber); _this505 = _super219.call(this, destination); _this505.predicate = predicate; _this505.source = source; _this505.yieldIndex = yieldIndex; _this505.thisArg = thisArg; _this505.index = 0; return _this505; } _createClass2(FindValueSubscriber, [{ key: "notifyComplete", value: function notifyComplete(value) { var destination = this.destination; destination.next(value); destination.complete(); this.unsubscribe(); } }, { key: "_next", value: function _next(value) { var predicate = this.predicate, thisArg = this.thisArg; var index = this.index++; try { var result = predicate.call(thisArg || this, value, index, this.source); if (result) { this.notifyComplete(this.yieldIndex ? index : value); } } catch (err) { this.destination.error(err); } } }, { key: "_complete", value: function _complete() { this.notifyComplete(this.yieldIndex ? -1 : undefined); } }]); return FindValueSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=find.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/findIndex.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/findIndex.js ***! \********************************************************************/ /*! exports provided: findIndex */ /***/ function node_modulesRxjs_esm2015InternalOperatorsFindIndexJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function () { return findIndex; }); /* harmony import */ var _operators_find__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../operators/find */ "./node_modules/rxjs/_esm2015/internal/operators/find.js"); function findIndex(predicate, thisArg) { return function (source) { return source.lift(new _operators_find__WEBPACK_IMPORTED_MODULE_0__["FindValueOperator"](predicate, source, true, thisArg)); }; } //# sourceMappingURL=findIndex.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/first.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/first.js ***! \****************************************************************/ /*! exports provided: first */ /***/ function node_modulesRxjs_esm2015InternalOperatorsFirstJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "first", function () { return first; }); /* harmony import */ var _util_EmptyError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../util/EmptyError */ "./node_modules/rxjs/_esm2015/internal/util/EmptyError.js"); /* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./filter */ "./node_modules/rxjs/_esm2015/internal/operators/filter.js"); /* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./take */ "./node_modules/rxjs/_esm2015/internal/operators/take.js"); /* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./defaultIfEmpty */ "./node_modules/rxjs/_esm2015/internal/operators/defaultIfEmpty.js"); /* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ./throwIfEmpty */ "./node_modules/rxjs/_esm2015/internal/operators/throwIfEmpty.js"); /* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__( /*! ../util/identity */ "./node_modules/rxjs/_esm2015/internal/util/identity.js"); function first(predicate, defaultValue) { var hasDefaultValue = arguments.length >= 2; return function (source) { return source.pipe(predicate ? Object(_filter__WEBPACK_IMPORTED_MODULE_1__["filter"])(function (v, i) { return predicate(v, i, source); }) : _util_identity__WEBPACK_IMPORTED_MODULE_5__["identity"], Object(_take__WEBPACK_IMPORTED_MODULE_2__["take"])(1), hasDefaultValue ? Object(_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__["defaultIfEmpty"])(defaultValue) : Object(_throwIfEmpty__WEBPACK_IMPORTED_MODULE_4__["throwIfEmpty"])(function () { return new _util_EmptyError__WEBPACK_IMPORTED_MODULE_0__["EmptyError"](); })); }; } //# sourceMappingURL=first.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/groupBy.js": /*!******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/groupBy.js ***! \******************************************************************/ /*! exports provided: groupBy, GroupedObservable */ /***/ function node_modulesRxjs_esm2015InternalOperatorsGroupByJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function () { return groupBy; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GroupedObservable", function () { return GroupedObservable; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../Subject */ "./node_modules/rxjs/_esm2015/internal/Subject.js"); function groupBy(keySelector, elementSelector, durationSelector, subjectSelector) { return function (source) { return source.lift(new GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector)); }; } var GroupByOperator = /*#__PURE__*/function () { function GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector) { _classCallCheck(this, GroupByOperator); this.keySelector = keySelector; this.elementSelector = elementSelector; this.durationSelector = durationSelector; this.subjectSelector = subjectSelector; } _createClass2(GroupByOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new GroupBySubscriber(subscriber, this.keySelector, this.elementSelector, this.durationSelector, this.subjectSelector)); } }]); return GroupByOperator; }(); var GroupBySubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_24) { _inherits(GroupBySubscriber, _Subscriber__WEBPACK_24); var _super220 = _createSuper(GroupBySubscriber); function GroupBySubscriber(destination, keySelector, elementSelector, durationSelector, subjectSelector) { var _this506; _classCallCheck(this, GroupBySubscriber); _this506 = _super220.call(this, destination); _this506.keySelector = keySelector; _this506.elementSelector = elementSelector; _this506.durationSelector = durationSelector; _this506.subjectSelector = subjectSelector; _this506.groups = null; _this506.attemptedToUnsubscribe = false; _this506.count = 0; return _this506; } _createClass2(GroupBySubscriber, [{ key: "_next", value: function _next(value) { var key; try { key = this.keySelector(value); } catch (err) { this.error(err); return; } this._group(value, key); } }, { key: "_group", value: function _group(value, key) { var groups = this.groups; if (!groups) { groups = this.groups = new Map(); } var group = groups.get(key); var element; if (this.elementSelector) { try { element = this.elementSelector(value); } catch (err) { this.error(err); } } else { element = value; } if (!group) { group = this.subjectSelector ? this.subjectSelector() : new _Subject__WEBPACK_IMPORTED_MODULE_3__["Subject"](); groups.set(key, group); var groupedObservable = new GroupedObservable(key, group, this); this.destination.next(groupedObservable); if (this.durationSelector) { var duration; try { duration = this.durationSelector(new GroupedObservable(key, group)); } catch (err) { this.error(err); return; } this.add(duration.subscribe(new GroupDurationSubscriber(key, group, this))); } } if (!group.closed) { group.next(element); } } }, { key: "_error", value: function _error(err) { var groups = this.groups; if (groups) { groups.forEach(function (group, key) { group.error(err); }); groups.clear(); } this.destination.error(err); } }, { key: "_complete", value: function _complete() { var groups = this.groups; if (groups) { groups.forEach(function (group, key) { group.complete(); }); groups.clear(); } this.destination.complete(); } }, { key: "removeGroup", value: function removeGroup(key) { this.groups["delete"](key); } }, { key: "unsubscribe", value: function unsubscribe() { if (!this.closed) { this.attemptedToUnsubscribe = true; if (this.count === 0) { _get(_getPrototypeOf(GroupBySubscriber.prototype), "unsubscribe", this).call(this); } } } }]); return GroupBySubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); var GroupDurationSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_25) { _inherits(GroupDurationSubscriber, _Subscriber__WEBPACK_25); var _super221 = _createSuper(GroupDurationSubscriber); function GroupDurationSubscriber(key, group, parent) { var _this507; _classCallCheck(this, GroupDurationSubscriber); _this507 = _super221.call(this, group); _this507.key = key; _this507.group = group; _this507.parent = parent; return _this507; } _createClass2(GroupDurationSubscriber, [{ key: "_next", value: function _next(value) { this.complete(); } }, { key: "_unsubscribe", value: function _unsubscribe() { var parent = this.parent, key = this.key; this.key = this.parent = null; if (parent) { parent.removeGroup(key); } } }]); return GroupDurationSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); var GroupedObservable = /*#__PURE__*/function (_Observable__WEBPACK_5) { _inherits(GroupedObservable, _Observable__WEBPACK_5); var _super222 = _createSuper(GroupedObservable); function GroupedObservable(key, groupSubject, refCountSubscription) { var _this508; _classCallCheck(this, GroupedObservable); _this508 = _super222.call(this); _this508.key = key; _this508.groupSubject = groupSubject; _this508.refCountSubscription = refCountSubscription; return _this508; } _createClass2(GroupedObservable, [{ key: "_subscribe", value: function _subscribe(subscriber) { var subscription = new _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"](); var refCountSubscription = this.refCountSubscription, groupSubject = this.groupSubject; if (refCountSubscription && !refCountSubscription.closed) { subscription.add(new InnerRefCountSubscription(refCountSubscription)); } subscription.add(groupSubject.subscribe(subscriber)); return subscription; } }]); return GroupedObservable; }(_Observable__WEBPACK_IMPORTED_MODULE_2__["Observable"]); var InnerRefCountSubscription = /*#__PURE__*/function (_Subscription__WEBPAC3) { _inherits(InnerRefCountSubscription, _Subscription__WEBPAC3); var _super223 = _createSuper(InnerRefCountSubscription); function InnerRefCountSubscription(parent) { var _this509; _classCallCheck(this, InnerRefCountSubscription); _this509 = _super223.call(this); _this509.parent = parent; parent.count++; return _this509; } _createClass2(InnerRefCountSubscription, [{ key: "unsubscribe", value: function unsubscribe() { var parent = this.parent; if (!parent.closed && !this.closed) { _get(_getPrototypeOf(InnerRefCountSubscription.prototype), "unsubscribe", this).call(this); parent.count -= 1; if (parent.count === 0 && parent.attemptedToUnsubscribe) { parent.unsubscribe(); } } } }]); return InnerRefCountSubscription; }(_Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"]); //# sourceMappingURL=groupBy.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/ignoreElements.js": /*!*************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/ignoreElements.js ***! \*************************************************************************/ /*! exports provided: ignoreElements */ /***/ function node_modulesRxjs_esm2015InternalOperatorsIgnoreElementsJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ignoreElements", function () { return ignoreElements; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function ignoreElements() { return function ignoreElementsOperatorFunction(source) { return source.lift(new IgnoreElementsOperator()); }; } var IgnoreElementsOperator = /*#__PURE__*/function () { function IgnoreElementsOperator() { _classCallCheck(this, IgnoreElementsOperator); } _createClass2(IgnoreElementsOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new IgnoreElementsSubscriber(subscriber)); } }]); return IgnoreElementsOperator; }(); var IgnoreElementsSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_26) { _inherits(IgnoreElementsSubscriber, _Subscriber__WEBPACK_26); var _super224 = _createSuper(IgnoreElementsSubscriber); function IgnoreElementsSubscriber() { _classCallCheck(this, IgnoreElementsSubscriber); return _super224.apply(this, arguments); } _createClass2(IgnoreElementsSubscriber, [{ key: "_next", value: function _next(unused) {} }]); return IgnoreElementsSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=ignoreElements.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/isEmpty.js": /*!******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/isEmpty.js ***! \******************************************************************/ /*! exports provided: isEmpty */ /***/ function node_modulesRxjs_esm2015InternalOperatorsIsEmptyJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function () { return isEmpty; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function isEmpty() { return function (source) { return source.lift(new IsEmptyOperator()); }; } var IsEmptyOperator = /*#__PURE__*/function () { function IsEmptyOperator() { _classCallCheck(this, IsEmptyOperator); } _createClass2(IsEmptyOperator, [{ key: "call", value: function call(observer, source) { return source.subscribe(new IsEmptySubscriber(observer)); } }]); return IsEmptyOperator; }(); var IsEmptySubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_27) { _inherits(IsEmptySubscriber, _Subscriber__WEBPACK_27); var _super225 = _createSuper(IsEmptySubscriber); function IsEmptySubscriber(destination) { _classCallCheck(this, IsEmptySubscriber); return _super225.call(this, destination); } _createClass2(IsEmptySubscriber, [{ key: "notifyComplete", value: function notifyComplete(isEmpty) { var destination = this.destination; destination.next(isEmpty); destination.complete(); } }, { key: "_next", value: function _next(value) { this.notifyComplete(false); } }, { key: "_complete", value: function _complete() { this.notifyComplete(true); } }]); return IsEmptySubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=isEmpty.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/last.js": /*!***************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/last.js ***! \***************************************************************/ /*! exports provided: last */ /***/ function node_modulesRxjs_esm2015InternalOperatorsLastJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "last", function () { return last; }); /* harmony import */ var _util_EmptyError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../util/EmptyError */ "./node_modules/rxjs/_esm2015/internal/util/EmptyError.js"); /* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./filter */ "./node_modules/rxjs/_esm2015/internal/operators/filter.js"); /* harmony import */ var _takeLast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./takeLast */ "./node_modules/rxjs/_esm2015/internal/operators/takeLast.js"); /* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./throwIfEmpty */ "./node_modules/rxjs/_esm2015/internal/operators/throwIfEmpty.js"); /* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ./defaultIfEmpty */ "./node_modules/rxjs/_esm2015/internal/operators/defaultIfEmpty.js"); /* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__( /*! ../util/identity */ "./node_modules/rxjs/_esm2015/internal/util/identity.js"); function last(predicate, defaultValue) { var hasDefaultValue = arguments.length >= 2; return function (source) { return source.pipe(predicate ? Object(_filter__WEBPACK_IMPORTED_MODULE_1__["filter"])(function (v, i) { return predicate(v, i, source); }) : _util_identity__WEBPACK_IMPORTED_MODULE_5__["identity"], Object(_takeLast__WEBPACK_IMPORTED_MODULE_2__["takeLast"])(1), hasDefaultValue ? Object(_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_4__["defaultIfEmpty"])(defaultValue) : Object(_throwIfEmpty__WEBPACK_IMPORTED_MODULE_3__["throwIfEmpty"])(function () { return new _util_EmptyError__WEBPACK_IMPORTED_MODULE_0__["EmptyError"](); })); }; } //# sourceMappingURL=last.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/map.js": /*!**************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/map.js ***! \**************************************************************/ /*! exports provided: map, MapOperator */ /***/ function node_modulesRxjs_esm2015InternalOperatorsMapJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "map", function () { return map; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MapOperator", function () { return MapOperator; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function map(project, thisArg) { return function mapOperation(source) { if (typeof project !== 'function') { throw new TypeError('argument is not a function. Are you looking for `mapTo()`?'); } return source.lift(new MapOperator(project, thisArg)); }; } var MapOperator = /*#__PURE__*/function () { function MapOperator(project, thisArg) { _classCallCheck(this, MapOperator); this.project = project; this.thisArg = thisArg; } _createClass2(MapOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg)); } }]); return MapOperator; }(); var MapSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_28) { _inherits(MapSubscriber, _Subscriber__WEBPACK_28); var _super226 = _createSuper(MapSubscriber); function MapSubscriber(destination, project, thisArg) { var _this510; _classCallCheck(this, MapSubscriber); _this510 = _super226.call(this, destination); _this510.project = project; _this510.count = 0; _this510.thisArg = thisArg || _assertThisInitialized(_this510); return _this510; } _createClass2(MapSubscriber, [{ key: "_next", value: function _next(value) { var result; try { result = this.project.call(this.thisArg, value, this.count++); } catch (err) { this.destination.error(err); return; } this.destination.next(result); } }]); return MapSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=map.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/mapTo.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/mapTo.js ***! \****************************************************************/ /*! exports provided: mapTo */ /***/ function node_modulesRxjs_esm2015InternalOperatorsMapToJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapTo", function () { return mapTo; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function mapTo(value) { return function (source) { return source.lift(new MapToOperator(value)); }; } var MapToOperator = /*#__PURE__*/function () { function MapToOperator(value) { _classCallCheck(this, MapToOperator); this.value = value; } _createClass2(MapToOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new MapToSubscriber(subscriber, this.value)); } }]); return MapToOperator; }(); var MapToSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_29) { _inherits(MapToSubscriber, _Subscriber__WEBPACK_29); var _super227 = _createSuper(MapToSubscriber); function MapToSubscriber(destination, value) { var _this511; _classCallCheck(this, MapToSubscriber); _this511 = _super227.call(this, destination); _this511.value = value; return _this511; } _createClass2(MapToSubscriber, [{ key: "_next", value: function _next(x) { this.destination.next(this.value); } }]); return MapToSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=mapTo.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/materialize.js": /*!**********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/materialize.js ***! \**********************************************************************/ /*! exports provided: materialize */ /***/ function node_modulesRxjs_esm2015InternalOperatorsMaterializeJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "materialize", function () { return materialize; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _Notification__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../Notification */ "./node_modules/rxjs/_esm2015/internal/Notification.js"); function materialize() { return function materializeOperatorFunction(source) { return source.lift(new MaterializeOperator()); }; } var MaterializeOperator = /*#__PURE__*/function () { function MaterializeOperator() { _classCallCheck(this, MaterializeOperator); } _createClass2(MaterializeOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new MaterializeSubscriber(subscriber)); } }]); return MaterializeOperator; }(); var MaterializeSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_30) { _inherits(MaterializeSubscriber, _Subscriber__WEBPACK_30); var _super228 = _createSuper(MaterializeSubscriber); function MaterializeSubscriber(destination) { _classCallCheck(this, MaterializeSubscriber); return _super228.call(this, destination); } _createClass2(MaterializeSubscriber, [{ key: "_next", value: function _next(value) { this.destination.next(_Notification__WEBPACK_IMPORTED_MODULE_1__["Notification"].createNext(value)); } }, { key: "_error", value: function _error(err) { var destination = this.destination; destination.next(_Notification__WEBPACK_IMPORTED_MODULE_1__["Notification"].createError(err)); destination.complete(); } }, { key: "_complete", value: function _complete() { var destination = this.destination; destination.next(_Notification__WEBPACK_IMPORTED_MODULE_1__["Notification"].createComplete()); destination.complete(); } }]); return MaterializeSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=materialize.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/max.js": /*!**************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/max.js ***! \**************************************************************/ /*! exports provided: max */ /***/ function node_modulesRxjs_esm2015InternalOperatorsMaxJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "max", function () { return max; }); /* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./reduce */ "./node_modules/rxjs/_esm2015/internal/operators/reduce.js"); function max(comparer) { var max = typeof comparer === 'function' ? function (x, y) { return comparer(x, y) > 0 ? x : y; } : function (x, y) { return x > y ? x : y; }; return Object(_reduce__WEBPACK_IMPORTED_MODULE_0__["reduce"])(max); } //# sourceMappingURL=max.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/merge.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/merge.js ***! \****************************************************************/ /*! exports provided: merge */ /***/ function node_modulesRxjs_esm2015InternalOperatorsMergeJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "merge", function () { return merge; }); /* harmony import */ var _observable_merge__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../observable/merge */ "./node_modules/rxjs/_esm2015/internal/observable/merge.js"); function merge() { for (var _len42 = arguments.length, observables = new Array(_len42), _key40 = 0; _key40 < _len42; _key40++) { observables[_key40] = arguments[_key40]; } return function (source) { return source.lift.call(Object(_observable_merge__WEBPACK_IMPORTED_MODULE_0__["merge"]).apply(void 0, [source].concat(observables))); }; } //# sourceMappingURL=merge.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/mergeAll.js": /*!*******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/mergeAll.js ***! \*******************************************************************/ /*! exports provided: mergeAll */ /***/ function node_modulesRxjs_esm2015InternalOperatorsMergeAllJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeAll", function () { return mergeAll; }); /* harmony import */ var _mergeMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./mergeMap */ "./node_modules/rxjs/_esm2015/internal/operators/mergeMap.js"); /* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/identity */ "./node_modules/rxjs/_esm2015/internal/util/identity.js"); function mergeAll() { var concurrent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : Number.POSITIVE_INFINITY; return Object(_mergeMap__WEBPACK_IMPORTED_MODULE_0__["mergeMap"])(_util_identity__WEBPACK_IMPORTED_MODULE_1__["identity"], concurrent); } //# sourceMappingURL=mergeAll.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/mergeMap.js": /*!*******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/mergeMap.js ***! \*******************************************************************/ /*! exports provided: mergeMap, MergeMapOperator, MergeMapSubscriber, flatMap */ /***/ function node_modulesRxjs_esm2015InternalOperatorsMergeMapJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeMap", function () { return mergeMap; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MergeMapOperator", function () { return MergeMapOperator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MergeMapSubscriber", function () { return MergeMapSubscriber; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "flatMap", function () { return flatMap; }); /* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./map */ "./node_modules/rxjs/_esm2015/internal/operators/map.js"); /* harmony import */ var _observable_from__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../observable/from */ "./node_modules/rxjs/_esm2015/internal/observable/from.js"); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function mergeMap(project, resultSelector) { var concurrent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Number.POSITIVE_INFINITY; if (typeof resultSelector === 'function') { return function (source) { return source.pipe(mergeMap(function (a, i) { return Object(_observable_from__WEBPACK_IMPORTED_MODULE_1__["from"])(project(a, i)).pipe(Object(_map__WEBPACK_IMPORTED_MODULE_0__["map"])(function (b, ii) { return resultSelector(a, b, i, ii); })); }, concurrent)); }; } else if (typeof resultSelector === 'number') { concurrent = resultSelector; } return function (source) { return source.lift(new MergeMapOperator(project, concurrent)); }; } var MergeMapOperator = /*#__PURE__*/function () { function MergeMapOperator(project) { var concurrent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.POSITIVE_INFINITY; _classCallCheck(this, MergeMapOperator); this.project = project; this.concurrent = concurrent; } _createClass2(MergeMapOperator, [{ key: "call", value: function call(observer, source) { return source.subscribe(new MergeMapSubscriber(observer, this.project, this.concurrent)); } }]); return MergeMapOperator; }(); var MergeMapSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP11) { _inherits(MergeMapSubscriber, _innerSubscribe__WEBP11); var _super229 = _createSuper(MergeMapSubscriber); function MergeMapSubscriber(destination, project) { var _this512; var concurrent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Number.POSITIVE_INFINITY; _classCallCheck(this, MergeMapSubscriber); _this512 = _super229.call(this, destination); _this512.project = project; _this512.concurrent = concurrent; _this512.hasCompleted = false; _this512.buffer = []; _this512.active = 0; _this512.index = 0; return _this512; } _createClass2(MergeMapSubscriber, [{ key: "_next", value: function _next(value) { if (this.active < this.concurrent) { this._tryNext(value); } else { this.buffer.push(value); } } }, { key: "_tryNext", value: function _tryNext(value) { var result; var index = this.index++; try { result = this.project(value, index); } catch (err) { this.destination.error(err); return; } this.active++; this._innerSub(result); } }, { key: "_innerSub", value: function _innerSub(ish) { var innerSubscriber = new _innerSubscribe__WEBPACK_IMPORTED_MODULE_2__["SimpleInnerSubscriber"](this); var destination = this.destination; destination.add(innerSubscriber); var innerSubscription = Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_2__["innerSubscribe"])(ish, innerSubscriber); if (innerSubscription !== innerSubscriber) { destination.add(innerSubscription); } } }, { key: "_complete", value: function _complete() { this.hasCompleted = true; if (this.active === 0 && this.buffer.length === 0) { this.destination.complete(); } this.unsubscribe(); } }, { key: "notifyNext", value: function notifyNext(innerValue) { this.destination.next(innerValue); } }, { key: "notifyComplete", value: function notifyComplete() { var buffer = this.buffer; this.active--; if (buffer.length > 0) { this._next(buffer.shift()); } else if (this.active === 0 && this.hasCompleted) { this.destination.complete(); } } }]); return MergeMapSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_2__["SimpleOuterSubscriber"]); var flatMap = mergeMap; //# sourceMappingURL=mergeMap.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/mergeMapTo.js": /*!*********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/mergeMapTo.js ***! \*********************************************************************/ /*! exports provided: mergeMapTo */ /***/ function node_modulesRxjs_esm2015InternalOperatorsMergeMapToJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeMapTo", function () { return mergeMapTo; }); /* harmony import */ var _mergeMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./mergeMap */ "./node_modules/rxjs/_esm2015/internal/operators/mergeMap.js"); function mergeMapTo(innerObservable, resultSelector) { var concurrent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Number.POSITIVE_INFINITY; if (typeof resultSelector === 'function') { return Object(_mergeMap__WEBPACK_IMPORTED_MODULE_0__["mergeMap"])(function () { return innerObservable; }, resultSelector, concurrent); } if (typeof resultSelector === 'number') { concurrent = resultSelector; } return Object(_mergeMap__WEBPACK_IMPORTED_MODULE_0__["mergeMap"])(function () { return innerObservable; }, concurrent); } //# sourceMappingURL=mergeMapTo.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/mergeScan.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/mergeScan.js ***! \********************************************************************/ /*! exports provided: mergeScan, MergeScanOperator, MergeScanSubscriber */ /***/ function node_modulesRxjs_esm2015InternalOperatorsMergeScanJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeScan", function () { return mergeScan; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MergeScanOperator", function () { return MergeScanOperator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MergeScanSubscriber", function () { return MergeScanSubscriber; }); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function mergeScan(accumulator, seed) { var concurrent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Number.POSITIVE_INFINITY; return function (source) { return source.lift(new MergeScanOperator(accumulator, seed, concurrent)); }; } var MergeScanOperator = /*#__PURE__*/function () { function MergeScanOperator(accumulator, seed, concurrent) { _classCallCheck(this, MergeScanOperator); this.accumulator = accumulator; this.seed = seed; this.concurrent = concurrent; } _createClass2(MergeScanOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new MergeScanSubscriber(subscriber, this.accumulator, this.seed, this.concurrent)); } }]); return MergeScanOperator; }(); var MergeScanSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP12) { _inherits(MergeScanSubscriber, _innerSubscribe__WEBP12); var _super230 = _createSuper(MergeScanSubscriber); function MergeScanSubscriber(destination, accumulator, acc, concurrent) { var _this513; _classCallCheck(this, MergeScanSubscriber); _this513 = _super230.call(this, destination); _this513.accumulator = accumulator; _this513.acc = acc; _this513.concurrent = concurrent; _this513.hasValue = false; _this513.hasCompleted = false; _this513.buffer = []; _this513.active = 0; _this513.index = 0; return _this513; } _createClass2(MergeScanSubscriber, [{ key: "_next", value: function _next(value) { if (this.active < this.concurrent) { var index = this.index++; var destination = this.destination; var ish; try { var accumulator = this.accumulator; ish = accumulator(this.acc, value, index); } catch (e) { return destination.error(e); } this.active++; this._innerSub(ish); } else { this.buffer.push(value); } } }, { key: "_innerSub", value: function _innerSub(ish) { var innerSubscriber = new _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleInnerSubscriber"](this); var destination = this.destination; destination.add(innerSubscriber); var innerSubscription = Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["innerSubscribe"])(ish, innerSubscriber); if (innerSubscription !== innerSubscriber) { destination.add(innerSubscription); } } }, { key: "_complete", value: function _complete() { this.hasCompleted = true; if (this.active === 0 && this.buffer.length === 0) { if (this.hasValue === false) { this.destination.next(this.acc); } this.destination.complete(); } this.unsubscribe(); } }, { key: "notifyNext", value: function notifyNext(innerValue) { var destination = this.destination; this.acc = innerValue; this.hasValue = true; destination.next(innerValue); } }, { key: "notifyComplete", value: function notifyComplete() { var buffer = this.buffer; this.active--; if (buffer.length > 0) { this._next(buffer.shift()); } else if (this.active === 0 && this.hasCompleted) { if (this.hasValue === false) { this.destination.next(this.acc); } this.destination.complete(); } } }]); return MergeScanSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleOuterSubscriber"]); //# sourceMappingURL=mergeScan.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/min.js": /*!**************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/min.js ***! \**************************************************************/ /*! exports provided: min */ /***/ function node_modulesRxjs_esm2015InternalOperatorsMinJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "min", function () { return min; }); /* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./reduce */ "./node_modules/rxjs/_esm2015/internal/operators/reduce.js"); function min(comparer) { var min = typeof comparer === 'function' ? function (x, y) { return comparer(x, y) < 0 ? x : y; } : function (x, y) { return x < y ? x : y; }; return Object(_reduce__WEBPACK_IMPORTED_MODULE_0__["reduce"])(min); } //# sourceMappingURL=min.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/multicast.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/multicast.js ***! \********************************************************************/ /*! exports provided: multicast, MulticastOperator */ /***/ function node_modulesRxjs_esm2015InternalOperatorsMulticastJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multicast", function () { return multicast; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MulticastOperator", function () { return MulticastOperator; }); /* harmony import */ var _observable_ConnectableObservable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../observable/ConnectableObservable */ "./node_modules/rxjs/_esm2015/internal/observable/ConnectableObservable.js"); function multicast(subjectOrSubjectFactory, selector) { return function multicastOperatorFunction(source) { var subjectFactory; if (typeof subjectOrSubjectFactory === 'function') { subjectFactory = subjectOrSubjectFactory; } else { subjectFactory = function subjectFactory() { return subjectOrSubjectFactory; }; } if (typeof selector === 'function') { return source.lift(new MulticastOperator(subjectFactory, selector)); } var connectable = Object.create(source, _observable_ConnectableObservable__WEBPACK_IMPORTED_MODULE_0__["connectableObservableDescriptor"]); connectable.source = source; connectable.subjectFactory = subjectFactory; return connectable; }; } var MulticastOperator = /*#__PURE__*/function () { function MulticastOperator(subjectFactory, selector) { _classCallCheck(this, MulticastOperator); this.subjectFactory = subjectFactory; this.selector = selector; } _createClass2(MulticastOperator, [{ key: "call", value: function call(subscriber, source) { var selector = this.selector; var subject = this.subjectFactory(); var subscription = selector(subject).subscribe(subscriber); subscription.add(source.subscribe(subject)); return subscription; } }]); return MulticastOperator; }(); //# sourceMappingURL=multicast.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/observeOn.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/observeOn.js ***! \********************************************************************/ /*! exports provided: observeOn, ObserveOnOperator, ObserveOnSubscriber, ObserveOnMessage */ /***/ function node_modulesRxjs_esm2015InternalOperatorsObserveOnJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "observeOn", function () { return observeOn; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObserveOnOperator", function () { return ObserveOnOperator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObserveOnSubscriber", function () { return ObserveOnSubscriber; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObserveOnMessage", function () { return ObserveOnMessage; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _Notification__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../Notification */ "./node_modules/rxjs/_esm2015/internal/Notification.js"); function observeOn(scheduler) { var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; return function observeOnOperatorFunction(source) { return source.lift(new ObserveOnOperator(scheduler, delay)); }; } var ObserveOnOperator = /*#__PURE__*/function () { function ObserveOnOperator(scheduler) { var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; _classCallCheck(this, ObserveOnOperator); this.scheduler = scheduler; this.delay = delay; } _createClass2(ObserveOnOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new ObserveOnSubscriber(subscriber, this.scheduler, this.delay)); } }]); return ObserveOnOperator; }(); var ObserveOnSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_31) { _inherits(ObserveOnSubscriber, _Subscriber__WEBPACK_31); var _super231 = _createSuper(ObserveOnSubscriber); function ObserveOnSubscriber(destination, scheduler) { var _this514; var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; _classCallCheck(this, ObserveOnSubscriber); _this514 = _super231.call(this, destination); _this514.scheduler = scheduler; _this514.delay = delay; return _this514; } _createClass2(ObserveOnSubscriber, [{ key: "scheduleMessage", value: function scheduleMessage(notification) { var destination = this.destination; destination.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination))); } }, { key: "_next", value: function _next(value) { this.scheduleMessage(_Notification__WEBPACK_IMPORTED_MODULE_1__["Notification"].createNext(value)); } }, { key: "_error", value: function _error(err) { this.scheduleMessage(_Notification__WEBPACK_IMPORTED_MODULE_1__["Notification"].createError(err)); this.unsubscribe(); } }, { key: "_complete", value: function _complete() { this.scheduleMessage(_Notification__WEBPACK_IMPORTED_MODULE_1__["Notification"].createComplete()); this.unsubscribe(); } }], [{ key: "dispatch", value: function dispatch(arg) { var notification = arg.notification, destination = arg.destination; notification.observe(destination); this.unsubscribe(); } }]); return ObserveOnSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); var ObserveOnMessage = function ObserveOnMessage(notification, destination) { _classCallCheck(this, ObserveOnMessage); this.notification = notification; this.destination = destination; }; //# sourceMappingURL=observeOn.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/onErrorResumeNext.js": /*!****************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/onErrorResumeNext.js ***! \****************************************************************************/ /*! exports provided: onErrorResumeNext, onErrorResumeNextStatic */ /***/ function node_modulesRxjs_esm2015InternalOperatorsOnErrorResumeNextJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onErrorResumeNext", function () { return onErrorResumeNext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onErrorResumeNextStatic", function () { return onErrorResumeNextStatic; }); /* harmony import */ var _observable_from__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../observable/from */ "./node_modules/rxjs/_esm2015/internal/observable/from.js"); /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/isArray */ "./node_modules/rxjs/_esm2015/internal/util/isArray.js"); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function onErrorResumeNext() { for (var _len43 = arguments.length, nextSources = new Array(_len43), _key41 = 0; _key41 < _len43; _key41++) { nextSources[_key41] = arguments[_key41]; } if (nextSources.length === 1 && Object(_util_isArray__WEBPACK_IMPORTED_MODULE_1__["isArray"])(nextSources[0])) { nextSources = nextSources[0]; } return function (source) { return source.lift(new OnErrorResumeNextOperator(nextSources)); }; } function onErrorResumeNextStatic() { for (var _len44 = arguments.length, nextSources = new Array(_len44), _key42 = 0; _key42 < _len44; _key42++) { nextSources[_key42] = arguments[_key42]; } var source = undefined; if (nextSources.length === 1 && Object(_util_isArray__WEBPACK_IMPORTED_MODULE_1__["isArray"])(nextSources[0])) { nextSources = nextSources[0]; } source = nextSources.shift(); return Object(_observable_from__WEBPACK_IMPORTED_MODULE_0__["from"])(source).lift(new OnErrorResumeNextOperator(nextSources)); } var OnErrorResumeNextOperator = /*#__PURE__*/function () { function OnErrorResumeNextOperator(nextSources) { _classCallCheck(this, OnErrorResumeNextOperator); this.nextSources = nextSources; } _createClass2(OnErrorResumeNextOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new OnErrorResumeNextSubscriber(subscriber, this.nextSources)); } }]); return OnErrorResumeNextOperator; }(); var OnErrorResumeNextSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP13) { _inherits(OnErrorResumeNextSubscriber, _innerSubscribe__WEBP13); var _super232 = _createSuper(OnErrorResumeNextSubscriber); function OnErrorResumeNextSubscriber(destination, nextSources) { var _this515; _classCallCheck(this, OnErrorResumeNextSubscriber); _this515 = _super232.call(this, destination); _this515.destination = destination; _this515.nextSources = nextSources; return _this515; } _createClass2(OnErrorResumeNextSubscriber, [{ key: "notifyError", value: function notifyError() { this.subscribeToNextSource(); } }, { key: "notifyComplete", value: function notifyComplete() { this.subscribeToNextSource(); } }, { key: "_error", value: function _error(err) { this.subscribeToNextSource(); this.unsubscribe(); } }, { key: "_complete", value: function _complete() { this.subscribeToNextSource(); this.unsubscribe(); } }, { key: "subscribeToNextSource", value: function subscribeToNextSource() { var next = this.nextSources.shift(); if (!!next) { var innerSubscriber = new _innerSubscribe__WEBPACK_IMPORTED_MODULE_2__["SimpleInnerSubscriber"](this); var destination = this.destination; destination.add(innerSubscriber); var innerSubscription = Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_2__["innerSubscribe"])(next, innerSubscriber); if (innerSubscription !== innerSubscriber) { destination.add(innerSubscription); } } else { this.destination.complete(); } } }]); return OnErrorResumeNextSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_2__["SimpleOuterSubscriber"]); //# sourceMappingURL=onErrorResumeNext.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/pairwise.js": /*!*******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/pairwise.js ***! \*******************************************************************/ /*! exports provided: pairwise */ /***/ function node_modulesRxjs_esm2015InternalOperatorsPairwiseJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pairwise", function () { return pairwise; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function pairwise() { return function (source) { return source.lift(new PairwiseOperator()); }; } var PairwiseOperator = /*#__PURE__*/function () { function PairwiseOperator() { _classCallCheck(this, PairwiseOperator); } _createClass2(PairwiseOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new PairwiseSubscriber(subscriber)); } }]); return PairwiseOperator; }(); var PairwiseSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_32) { _inherits(PairwiseSubscriber, _Subscriber__WEBPACK_32); var _super233 = _createSuper(PairwiseSubscriber); function PairwiseSubscriber(destination) { var _this516; _classCallCheck(this, PairwiseSubscriber); _this516 = _super233.call(this, destination); _this516.hasPrev = false; return _this516; } _createClass2(PairwiseSubscriber, [{ key: "_next", value: function _next(value) { var pair; if (this.hasPrev) { pair = [this.prev, value]; } else { this.hasPrev = true; } this.prev = value; if (pair) { this.destination.next(pair); } } }]); return PairwiseSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=pairwise.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/partition.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/partition.js ***! \********************************************************************/ /*! exports provided: partition */ /***/ function node_modulesRxjs_esm2015InternalOperatorsPartitionJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function () { return partition; }); /* harmony import */ var _util_not__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../util/not */ "./node_modules/rxjs/_esm2015/internal/util/not.js"); /* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./filter */ "./node_modules/rxjs/_esm2015/internal/operators/filter.js"); function partition(predicate, thisArg) { return function (source) { return [Object(_filter__WEBPACK_IMPORTED_MODULE_1__["filter"])(predicate, thisArg)(source), Object(_filter__WEBPACK_IMPORTED_MODULE_1__["filter"])(Object(_util_not__WEBPACK_IMPORTED_MODULE_0__["not"])(predicate, thisArg))(source)]; }; } //# sourceMappingURL=partition.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/pluck.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/pluck.js ***! \****************************************************************/ /*! exports provided: pluck */ /***/ function node_modulesRxjs_esm2015InternalOperatorsPluckJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pluck", function () { return pluck; }); /* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./map */ "./node_modules/rxjs/_esm2015/internal/operators/map.js"); function pluck() { for (var _len45 = arguments.length, properties = new Array(_len45), _key43 = 0; _key43 < _len45; _key43++) { properties[_key43] = arguments[_key43]; } var length = properties.length; if (length === 0) { throw new Error('list of properties cannot be empty.'); } return function (source) { return Object(_map__WEBPACK_IMPORTED_MODULE_0__["map"])(plucker(properties, length))(source); }; } function plucker(props, length) { var mapper = function mapper(x) { var currentProp = x; for (var i = 0; i < length; i++) { var p = currentProp != null ? currentProp[props[i]] : undefined; if (p !== void 0) { currentProp = p; } else { return undefined; } } return currentProp; }; return mapper; } //# sourceMappingURL=pluck.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/publish.js": /*!******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/publish.js ***! \******************************************************************/ /*! exports provided: publish */ /***/ function node_modulesRxjs_esm2015InternalOperatorsPublishJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publish", function () { return publish; }); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subject */ "./node_modules/rxjs/_esm2015/internal/Subject.js"); /* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./multicast */ "./node_modules/rxjs/_esm2015/internal/operators/multicast.js"); function publish(selector) { return selector ? Object(_multicast__WEBPACK_IMPORTED_MODULE_1__["multicast"])(function () { return new _Subject__WEBPACK_IMPORTED_MODULE_0__["Subject"](); }, selector) : Object(_multicast__WEBPACK_IMPORTED_MODULE_1__["multicast"])(new _Subject__WEBPACK_IMPORTED_MODULE_0__["Subject"]()); } //# sourceMappingURL=publish.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/publishBehavior.js": /*!**************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/publishBehavior.js ***! \**************************************************************************/ /*! exports provided: publishBehavior */ /***/ function node_modulesRxjs_esm2015InternalOperatorsPublishBehaviorJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publishBehavior", function () { return publishBehavior; }); /* harmony import */ var _BehaviorSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../BehaviorSubject */ "./node_modules/rxjs/_esm2015/internal/BehaviorSubject.js"); /* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./multicast */ "./node_modules/rxjs/_esm2015/internal/operators/multicast.js"); function publishBehavior(value) { return function (source) { return Object(_multicast__WEBPACK_IMPORTED_MODULE_1__["multicast"])(new _BehaviorSubject__WEBPACK_IMPORTED_MODULE_0__["BehaviorSubject"](value))(source); }; } //# sourceMappingURL=publishBehavior.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/publishLast.js": /*!**********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/publishLast.js ***! \**********************************************************************/ /*! exports provided: publishLast */ /***/ function node_modulesRxjs_esm2015InternalOperatorsPublishLastJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publishLast", function () { return publishLast; }); /* harmony import */ var _AsyncSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../AsyncSubject */ "./node_modules/rxjs/_esm2015/internal/AsyncSubject.js"); /* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./multicast */ "./node_modules/rxjs/_esm2015/internal/operators/multicast.js"); function publishLast() { return function (source) { return Object(_multicast__WEBPACK_IMPORTED_MODULE_1__["multicast"])(new _AsyncSubject__WEBPACK_IMPORTED_MODULE_0__["AsyncSubject"]())(source); }; } //# sourceMappingURL=publishLast.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/publishReplay.js": /*!************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/publishReplay.js ***! \************************************************************************/ /*! exports provided: publishReplay */ /***/ function node_modulesRxjs_esm2015InternalOperatorsPublishReplayJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publishReplay", function () { return publishReplay; }); /* harmony import */ var _ReplaySubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../ReplaySubject */ "./node_modules/rxjs/_esm2015/internal/ReplaySubject.js"); /* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./multicast */ "./node_modules/rxjs/_esm2015/internal/operators/multicast.js"); function publishReplay(bufferSize, windowTime, selectorOrScheduler, scheduler) { if (selectorOrScheduler && typeof selectorOrScheduler !== 'function') { scheduler = selectorOrScheduler; } var selector = typeof selectorOrScheduler === 'function' ? selectorOrScheduler : undefined; var subject = new _ReplaySubject__WEBPACK_IMPORTED_MODULE_0__["ReplaySubject"](bufferSize, windowTime, scheduler); return function (source) { return Object(_multicast__WEBPACK_IMPORTED_MODULE_1__["multicast"])(function () { return subject; }, selector)(source); }; } //# sourceMappingURL=publishReplay.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/race.js": /*!***************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/race.js ***! \***************************************************************/ /*! exports provided: race */ /***/ function node_modulesRxjs_esm2015InternalOperatorsRaceJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "race", function () { return race; }); /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../util/isArray */ "./node_modules/rxjs/_esm2015/internal/util/isArray.js"); /* harmony import */ var _observable_race__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../observable/race */ "./node_modules/rxjs/_esm2015/internal/observable/race.js"); function race() { for (var _len46 = arguments.length, observables = new Array(_len46), _key44 = 0; _key44 < _len46; _key44++) { observables[_key44] = arguments[_key44]; } return function raceOperatorFunction(source) { if (observables.length === 1 && Object(_util_isArray__WEBPACK_IMPORTED_MODULE_0__["isArray"])(observables[0])) { observables = observables[0]; } return source.lift.call(Object(_observable_race__WEBPACK_IMPORTED_MODULE_1__["race"]).apply(void 0, [source].concat(_toConsumableArray(observables)))); }; } //# sourceMappingURL=race.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/reduce.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/reduce.js ***! \*****************************************************************/ /*! exports provided: reduce */ /***/ function node_modulesRxjs_esm2015InternalOperatorsReduceJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function () { return reduce; }); /* harmony import */ var _scan__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./scan */ "./node_modules/rxjs/_esm2015/internal/operators/scan.js"); /* harmony import */ var _takeLast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./takeLast */ "./node_modules/rxjs/_esm2015/internal/operators/takeLast.js"); /* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./defaultIfEmpty */ "./node_modules/rxjs/_esm2015/internal/operators/defaultIfEmpty.js"); /* harmony import */ var _util_pipe__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../util/pipe */ "./node_modules/rxjs/_esm2015/internal/util/pipe.js"); function reduce(accumulator, seed) { if (arguments.length >= 2) { return function reduceOperatorFunctionWithSeed(source) { return Object(_util_pipe__WEBPACK_IMPORTED_MODULE_3__["pipe"])(Object(_scan__WEBPACK_IMPORTED_MODULE_0__["scan"])(accumulator, seed), Object(_takeLast__WEBPACK_IMPORTED_MODULE_1__["takeLast"])(1), Object(_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_2__["defaultIfEmpty"])(seed))(source); }; } return function reduceOperatorFunction(source) { return Object(_util_pipe__WEBPACK_IMPORTED_MODULE_3__["pipe"])(Object(_scan__WEBPACK_IMPORTED_MODULE_0__["scan"])(function (acc, value, index) { return accumulator(acc, value, index + 1); }), Object(_takeLast__WEBPACK_IMPORTED_MODULE_1__["takeLast"])(1))(source); }; } //# sourceMappingURL=reduce.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/refCount.js": /*!*******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/refCount.js ***! \*******************************************************************/ /*! exports provided: refCount */ /***/ function node_modulesRxjs_esm2015InternalOperatorsRefCountJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "refCount", function () { return refCount; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function refCount() { return function refCountOperatorFunction(source) { return source.lift(new RefCountOperator(source)); }; } var RefCountOperator = /*#__PURE__*/function () { function RefCountOperator(connectable) { _classCallCheck(this, RefCountOperator); this.connectable = connectable; } _createClass2(RefCountOperator, [{ key: "call", value: function call(subscriber, source) { var connectable = this.connectable; connectable._refCount++; var refCounter = new RefCountSubscriber(subscriber, connectable); var subscription = source.subscribe(refCounter); if (!refCounter.closed) { refCounter.connection = connectable.connect(); } return subscription; } }]); return RefCountOperator; }(); var RefCountSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_33) { _inherits(RefCountSubscriber, _Subscriber__WEBPACK_33); var _super234 = _createSuper(RefCountSubscriber); function RefCountSubscriber(destination, connectable) { var _this517; _classCallCheck(this, RefCountSubscriber); _this517 = _super234.call(this, destination); _this517.connectable = connectable; return _this517; } _createClass2(RefCountSubscriber, [{ key: "_unsubscribe", value: function _unsubscribe() { var connectable = this.connectable; if (!connectable) { this.connection = null; return; } this.connectable = null; var refCount = connectable._refCount; if (refCount <= 0) { this.connection = null; return; } connectable._refCount = refCount - 1; if (refCount > 1) { this.connection = null; return; } var connection = this.connection; var sharedConnection = connectable._connection; this.connection = null; if (sharedConnection && (!connection || sharedConnection === connection)) { sharedConnection.unsubscribe(); } } }]); return RefCountSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=refCount.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/repeat.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/repeat.js ***! \*****************************************************************/ /*! exports provided: repeat */ /***/ function node_modulesRxjs_esm2015InternalOperatorsRepeatJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "repeat", function () { return repeat; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _observable_empty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../observable/empty */ "./node_modules/rxjs/_esm2015/internal/observable/empty.js"); function repeat() { var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1; return function (source) { if (count === 0) { return Object(_observable_empty__WEBPACK_IMPORTED_MODULE_1__["empty"])(); } else if (count < 0) { return source.lift(new RepeatOperator(-1, source)); } else { return source.lift(new RepeatOperator(count - 1, source)); } }; } var RepeatOperator = /*#__PURE__*/function () { function RepeatOperator(count, source) { _classCallCheck(this, RepeatOperator); this.count = count; this.source = source; } _createClass2(RepeatOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new RepeatSubscriber(subscriber, this.count, this.source)); } }]); return RepeatOperator; }(); var RepeatSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_34) { _inherits(RepeatSubscriber, _Subscriber__WEBPACK_34); var _super235 = _createSuper(RepeatSubscriber); function RepeatSubscriber(destination, count, source) { var _this518; _classCallCheck(this, RepeatSubscriber); _this518 = _super235.call(this, destination); _this518.count = count; _this518.source = source; return _this518; } _createClass2(RepeatSubscriber, [{ key: "complete", value: function complete() { if (!this.isStopped) { var source = this.source, count = this.count; if (count === 0) { return _get(_getPrototypeOf(RepeatSubscriber.prototype), "complete", this).call(this); } else if (count > -1) { this.count = count - 1; } source.subscribe(this._unsubscribeAndRecycle()); } } }]); return RepeatSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=repeat.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/repeatWhen.js": /*!*********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/repeatWhen.js ***! \*********************************************************************/ /*! exports provided: repeatWhen */ /***/ function node_modulesRxjs_esm2015InternalOperatorsRepeatWhenJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "repeatWhen", function () { return repeatWhen; }); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subject */ "./node_modules/rxjs/_esm2015/internal/Subject.js"); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function repeatWhen(notifier) { return function (source) { return source.lift(new RepeatWhenOperator(notifier)); }; } var RepeatWhenOperator = /*#__PURE__*/function () { function RepeatWhenOperator(notifier) { _classCallCheck(this, RepeatWhenOperator); this.notifier = notifier; } _createClass2(RepeatWhenOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new RepeatWhenSubscriber(subscriber, this.notifier, source)); } }]); return RepeatWhenOperator; }(); var RepeatWhenSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP14) { _inherits(RepeatWhenSubscriber, _innerSubscribe__WEBP14); var _super236 = _createSuper(RepeatWhenSubscriber); function RepeatWhenSubscriber(destination, notifier, source) { var _this519; _classCallCheck(this, RepeatWhenSubscriber); _this519 = _super236.call(this, destination); _this519.notifier = notifier; _this519.source = source; _this519.sourceIsBeingSubscribedTo = true; return _this519; } _createClass2(RepeatWhenSubscriber, [{ key: "notifyNext", value: function notifyNext() { this.sourceIsBeingSubscribedTo = true; this.source.subscribe(this); } }, { key: "notifyComplete", value: function notifyComplete() { if (this.sourceIsBeingSubscribedTo === false) { return _get(_getPrototypeOf(RepeatWhenSubscriber.prototype), "complete", this).call(this); } } }, { key: "complete", value: function complete() { this.sourceIsBeingSubscribedTo = false; if (!this.isStopped) { if (!this.retries) { this.subscribeToRetries(); } if (!this.retriesSubscription || this.retriesSubscription.closed) { return _get(_getPrototypeOf(RepeatWhenSubscriber.prototype), "complete", this).call(this); } this._unsubscribeAndRecycle(); this.notifications.next(undefined); } } }, { key: "_unsubscribe", value: function _unsubscribe() { var notifications = this.notifications, retriesSubscription = this.retriesSubscription; if (notifications) { notifications.unsubscribe(); this.notifications = undefined; } if (retriesSubscription) { retriesSubscription.unsubscribe(); this.retriesSubscription = undefined; } this.retries = undefined; } }, { key: "_unsubscribeAndRecycle", value: function _unsubscribeAndRecycle() { var _unsubscribe = this._unsubscribe; this._unsubscribe = null; _get(_getPrototypeOf(RepeatWhenSubscriber.prototype), "_unsubscribeAndRecycle", this).call(this); this._unsubscribe = _unsubscribe; return this; } }, { key: "subscribeToRetries", value: function subscribeToRetries() { this.notifications = new _Subject__WEBPACK_IMPORTED_MODULE_0__["Subject"](); var retries; try { var notifier = this.notifier; retries = notifier(this.notifications); } catch (e) { return _get(_getPrototypeOf(RepeatWhenSubscriber.prototype), "complete", this).call(this); } this.retries = retries; this.retriesSubscription = Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_1__["innerSubscribe"])(retries, new _innerSubscribe__WEBPACK_IMPORTED_MODULE_1__["SimpleInnerSubscriber"](this)); } }]); return RepeatWhenSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_1__["SimpleOuterSubscriber"]); //# sourceMappingURL=repeatWhen.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/retry.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/retry.js ***! \****************************************************************/ /*! exports provided: retry */ /***/ function node_modulesRxjs_esm2015InternalOperatorsRetryJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "retry", function () { return retry; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function retry() { var count = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1; return function (source) { return source.lift(new RetryOperator(count, source)); }; } var RetryOperator = /*#__PURE__*/function () { function RetryOperator(count, source) { _classCallCheck(this, RetryOperator); this.count = count; this.source = source; } _createClass2(RetryOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new RetrySubscriber(subscriber, this.count, this.source)); } }]); return RetryOperator; }(); var RetrySubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_35) { _inherits(RetrySubscriber, _Subscriber__WEBPACK_35); var _super237 = _createSuper(RetrySubscriber); function RetrySubscriber(destination, count, source) { var _this520; _classCallCheck(this, RetrySubscriber); _this520 = _super237.call(this, destination); _this520.count = count; _this520.source = source; return _this520; } _createClass2(RetrySubscriber, [{ key: "error", value: function error(err) { if (!this.isStopped) { var source = this.source, count = this.count; if (count === 0) { return _get(_getPrototypeOf(RetrySubscriber.prototype), "error", this).call(this, err); } else if (count > -1) { this.count = count - 1; } source.subscribe(this._unsubscribeAndRecycle()); } } }]); return RetrySubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=retry.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/retryWhen.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/retryWhen.js ***! \********************************************************************/ /*! exports provided: retryWhen */ /***/ function node_modulesRxjs_esm2015InternalOperatorsRetryWhenJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "retryWhen", function () { return retryWhen; }); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subject */ "./node_modules/rxjs/_esm2015/internal/Subject.js"); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function retryWhen(notifier) { return function (source) { return source.lift(new RetryWhenOperator(notifier, source)); }; } var RetryWhenOperator = /*#__PURE__*/function () { function RetryWhenOperator(notifier, source) { _classCallCheck(this, RetryWhenOperator); this.notifier = notifier; this.source = source; } _createClass2(RetryWhenOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new RetryWhenSubscriber(subscriber, this.notifier, this.source)); } }]); return RetryWhenOperator; }(); var RetryWhenSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP15) { _inherits(RetryWhenSubscriber, _innerSubscribe__WEBP15); var _super238 = _createSuper(RetryWhenSubscriber); function RetryWhenSubscriber(destination, notifier, source) { var _this521; _classCallCheck(this, RetryWhenSubscriber); _this521 = _super238.call(this, destination); _this521.notifier = notifier; _this521.source = source; return _this521; } _createClass2(RetryWhenSubscriber, [{ key: "error", value: function error(err) { if (!this.isStopped) { var errors = this.errors; var retries = this.retries; var retriesSubscription = this.retriesSubscription; if (!retries) { errors = new _Subject__WEBPACK_IMPORTED_MODULE_0__["Subject"](); try { var notifier = this.notifier; retries = notifier(errors); } catch (e) { return _get(_getPrototypeOf(RetryWhenSubscriber.prototype), "error", this).call(this, e); } retriesSubscription = Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_1__["innerSubscribe"])(retries, new _innerSubscribe__WEBPACK_IMPORTED_MODULE_1__["SimpleInnerSubscriber"](this)); } else { this.errors = undefined; this.retriesSubscription = undefined; } this._unsubscribeAndRecycle(); this.errors = errors; this.retries = retries; this.retriesSubscription = retriesSubscription; errors.next(err); } } }, { key: "_unsubscribe", value: function _unsubscribe() { var errors = this.errors, retriesSubscription = this.retriesSubscription; if (errors) { errors.unsubscribe(); this.errors = undefined; } if (retriesSubscription) { retriesSubscription.unsubscribe(); this.retriesSubscription = undefined; } this.retries = undefined; } }, { key: "notifyNext", value: function notifyNext() { var _unsubscribe = this._unsubscribe; this._unsubscribe = null; this._unsubscribeAndRecycle(); this._unsubscribe = _unsubscribe; this.source.subscribe(this); } }]); return RetryWhenSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_1__["SimpleOuterSubscriber"]); //# sourceMappingURL=retryWhen.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/sample.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/sample.js ***! \*****************************************************************/ /*! exports provided: sample */ /***/ function node_modulesRxjs_esm2015InternalOperatorsSampleJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sample", function () { return sample; }); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function sample(notifier) { return function (source) { return source.lift(new SampleOperator(notifier)); }; } var SampleOperator = /*#__PURE__*/function () { function SampleOperator(notifier) { _classCallCheck(this, SampleOperator); this.notifier = notifier; } _createClass2(SampleOperator, [{ key: "call", value: function call(subscriber, source) { var sampleSubscriber = new SampleSubscriber(subscriber); var subscription = source.subscribe(sampleSubscriber); subscription.add(Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["innerSubscribe"])(this.notifier, new _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleInnerSubscriber"](sampleSubscriber))); return subscription; } }]); return SampleOperator; }(); var SampleSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP16) { _inherits(SampleSubscriber, _innerSubscribe__WEBP16); var _super239 = _createSuper(SampleSubscriber); function SampleSubscriber() { var _this522; _classCallCheck(this, SampleSubscriber); _this522 = _super239.apply(this, arguments); _this522.hasValue = false; return _this522; } _createClass2(SampleSubscriber, [{ key: "_next", value: function _next(value) { this.value = value; this.hasValue = true; } }, { key: "notifyNext", value: function notifyNext() { this.emitValue(); } }, { key: "notifyComplete", value: function notifyComplete() { this.emitValue(); } }, { key: "emitValue", value: function emitValue() { if (this.hasValue) { this.hasValue = false; this.destination.next(this.value); } } }]); return SampleSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleOuterSubscriber"]); //# sourceMappingURL=sample.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/sampleTime.js": /*!*********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/sampleTime.js ***! \*********************************************************************/ /*! exports provided: sampleTime */ /***/ function node_modulesRxjs_esm2015InternalOperatorsSampleTimeJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sampleTime", function () { return sampleTime; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../scheduler/async */ "./node_modules/rxjs/_esm2015/internal/scheduler/async.js"); function sampleTime(period) { var scheduler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _scheduler_async__WEBPACK_IMPORTED_MODULE_1__["async"]; return function (source) { return source.lift(new SampleTimeOperator(period, scheduler)); }; } var SampleTimeOperator = /*#__PURE__*/function () { function SampleTimeOperator(period, scheduler) { _classCallCheck(this, SampleTimeOperator); this.period = period; this.scheduler = scheduler; } _createClass2(SampleTimeOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new SampleTimeSubscriber(subscriber, this.period, this.scheduler)); } }]); return SampleTimeOperator; }(); var SampleTimeSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_36) { _inherits(SampleTimeSubscriber, _Subscriber__WEBPACK_36); var _super240 = _createSuper(SampleTimeSubscriber); function SampleTimeSubscriber(destination, period, scheduler) { var _this523; _classCallCheck(this, SampleTimeSubscriber); _this523 = _super240.call(this, destination); _this523.period = period; _this523.scheduler = scheduler; _this523.hasValue = false; _this523.add(scheduler.schedule(dispatchNotification, period, { subscriber: _assertThisInitialized(_this523), period: period })); return _this523; } _createClass2(SampleTimeSubscriber, [{ key: "_next", value: function _next(value) { this.lastValue = value; this.hasValue = true; } }, { key: "notifyNext", value: function notifyNext() { if (this.hasValue) { this.hasValue = false; this.destination.next(this.lastValue); } } }]); return SampleTimeSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); function dispatchNotification(state) { var subscriber = state.subscriber, period = state.period; subscriber.notifyNext(); this.schedule(state, period); } //# sourceMappingURL=sampleTime.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/scan.js": /*!***************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/scan.js ***! \***************************************************************/ /*! exports provided: scan */ /***/ function node_modulesRxjs_esm2015InternalOperatorsScanJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scan", function () { return scan; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function scan(accumulator, seed) { var hasSeed = false; if (arguments.length >= 2) { hasSeed = true; } return function scanOperatorFunction(source) { return source.lift(new ScanOperator(accumulator, seed, hasSeed)); }; } var ScanOperator = /*#__PURE__*/function () { function ScanOperator(accumulator, seed) { var hasSeed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; _classCallCheck(this, ScanOperator); this.accumulator = accumulator; this.seed = seed; this.hasSeed = hasSeed; } _createClass2(ScanOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new ScanSubscriber(subscriber, this.accumulator, this.seed, this.hasSeed)); } }]); return ScanOperator; }(); var ScanSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_37) { _inherits(ScanSubscriber, _Subscriber__WEBPACK_37); var _super241 = _createSuper(ScanSubscriber); function ScanSubscriber(destination, accumulator, _seed, hasSeed) { var _this524; _classCallCheck(this, ScanSubscriber); _this524 = _super241.call(this, destination); _this524.accumulator = accumulator; _this524._seed = _seed; _this524.hasSeed = hasSeed; _this524.index = 0; return _this524; } _createClass2(ScanSubscriber, [{ key: "_next", value: function _next(value) { if (!this.hasSeed) { this.seed = value; this.destination.next(value); } else { return this._tryNext(value); } } }, { key: "_tryNext", value: function _tryNext(value) { var index = this.index++; var result; try { result = this.accumulator(this.seed, value, index); } catch (err) { this.destination.error(err); } this.seed = result; this.destination.next(result); } }, { key: "seed", get: function get() { return this._seed; }, set: function set(value) { this.hasSeed = true; this._seed = value; } }]); return ScanSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=scan.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/sequenceEqual.js": /*!************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/sequenceEqual.js ***! \************************************************************************/ /*! exports provided: sequenceEqual, SequenceEqualOperator, SequenceEqualSubscriber */ /***/ function node_modulesRxjs_esm2015InternalOperatorsSequenceEqualJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sequenceEqual", function () { return sequenceEqual; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SequenceEqualOperator", function () { return SequenceEqualOperator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SequenceEqualSubscriber", function () { return SequenceEqualSubscriber; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function sequenceEqual(compareTo, comparator) { return function (source) { return source.lift(new SequenceEqualOperator(compareTo, comparator)); }; } var SequenceEqualOperator = /*#__PURE__*/function () { function SequenceEqualOperator(compareTo, comparator) { _classCallCheck(this, SequenceEqualOperator); this.compareTo = compareTo; this.comparator = comparator; } _createClass2(SequenceEqualOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new SequenceEqualSubscriber(subscriber, this.compareTo, this.comparator)); } }]); return SequenceEqualOperator; }(); var SequenceEqualSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_38) { _inherits(SequenceEqualSubscriber, _Subscriber__WEBPACK_38); var _super242 = _createSuper(SequenceEqualSubscriber); function SequenceEqualSubscriber(destination, compareTo, comparator) { var _this525; _classCallCheck(this, SequenceEqualSubscriber); _this525 = _super242.call(this, destination); _this525.compareTo = compareTo; _this525.comparator = comparator; _this525._a = []; _this525._b = []; _this525._oneComplete = false; _this525.destination.add(compareTo.subscribe(new SequenceEqualCompareToSubscriber(destination, _assertThisInitialized(_this525)))); return _this525; } _createClass2(SequenceEqualSubscriber, [{ key: "_next", value: function _next(value) { if (this._oneComplete && this._b.length === 0) { this.emit(false); } else { this._a.push(value); this.checkValues(); } } }, { key: "_complete", value: function _complete() { if (this._oneComplete) { this.emit(this._a.length === 0 && this._b.length === 0); } else { this._oneComplete = true; } this.unsubscribe(); } }, { key: "checkValues", value: function checkValues() { var _a = this._a, _b = this._b, comparator = this.comparator; while (_a.length > 0 && _b.length > 0) { var a = _a.shift(); var b = _b.shift(); var areEqual = false; try { areEqual = comparator ? comparator(a, b) : a === b; } catch (e) { this.destination.error(e); } if (!areEqual) { this.emit(false); } } } }, { key: "emit", value: function emit(value) { var destination = this.destination; destination.next(value); destination.complete(); } }, { key: "nextB", value: function nextB(value) { if (this._oneComplete && this._a.length === 0) { this.emit(false); } else { this._b.push(value); this.checkValues(); } } }, { key: "completeB", value: function completeB() { if (this._oneComplete) { this.emit(this._a.length === 0 && this._b.length === 0); } else { this._oneComplete = true; } } }]); return SequenceEqualSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); var SequenceEqualCompareToSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_39) { _inherits(SequenceEqualCompareToSubscriber, _Subscriber__WEBPACK_39); var _super243 = _createSuper(SequenceEqualCompareToSubscriber); function SequenceEqualCompareToSubscriber(destination, parent) { var _this526; _classCallCheck(this, SequenceEqualCompareToSubscriber); _this526 = _super243.call(this, destination); _this526.parent = parent; return _this526; } _createClass2(SequenceEqualCompareToSubscriber, [{ key: "_next", value: function _next(value) { this.parent.nextB(value); } }, { key: "_error", value: function _error(err) { this.parent.error(err); this.unsubscribe(); } }, { key: "_complete", value: function _complete() { this.parent.completeB(); this.unsubscribe(); } }]); return SequenceEqualCompareToSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=sequenceEqual.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/share.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/share.js ***! \****************************************************************/ /*! exports provided: share */ /***/ function node_modulesRxjs_esm2015InternalOperatorsShareJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "share", function () { return share; }); /* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./multicast */ "./node_modules/rxjs/_esm2015/internal/operators/multicast.js"); /* harmony import */ var _refCount__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./refCount */ "./node_modules/rxjs/_esm2015/internal/operators/refCount.js"); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../Subject */ "./node_modules/rxjs/_esm2015/internal/Subject.js"); function shareSubjectFactory() { return new _Subject__WEBPACK_IMPORTED_MODULE_2__["Subject"](); } function share() { return function (source) { return Object(_refCount__WEBPACK_IMPORTED_MODULE_1__["refCount"])()(Object(_multicast__WEBPACK_IMPORTED_MODULE_0__["multicast"])(shareSubjectFactory)(source)); }; } //# sourceMappingURL=share.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/shareReplay.js": /*!**********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/shareReplay.js ***! \**********************************************************************/ /*! exports provided: shareReplay */ /***/ function node_modulesRxjs_esm2015InternalOperatorsShareReplayJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shareReplay", function () { return shareReplay; }); /* harmony import */ var _ReplaySubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../ReplaySubject */ "./node_modules/rxjs/_esm2015/internal/ReplaySubject.js"); function shareReplay(configOrBufferSize, windowTime, scheduler) { var config; if (configOrBufferSize && typeof configOrBufferSize === 'object') { config = configOrBufferSize; } else { config = { bufferSize: configOrBufferSize, windowTime: windowTime, refCount: false, scheduler: scheduler }; } return function (source) { return source.lift(shareReplayOperator(config)); }; } function shareReplayOperator(_ref70) { var _ref70$bufferSize = _ref70.bufferSize, bufferSize = _ref70$bufferSize === void 0 ? Number.POSITIVE_INFINITY : _ref70$bufferSize, _ref70$windowTime = _ref70.windowTime, windowTime = _ref70$windowTime === void 0 ? Number.POSITIVE_INFINITY : _ref70$windowTime, useRefCount = _ref70.refCount, scheduler = _ref70.scheduler; var subject; var refCount = 0; var subscription; var hasError = false; var isComplete = false; return function shareReplayOperation(source) { refCount++; var innerSub; if (!subject || hasError) { hasError = false; subject = new _ReplaySubject__WEBPACK_IMPORTED_MODULE_0__["ReplaySubject"](bufferSize, windowTime, scheduler); innerSub = subject.subscribe(this); subscription = source.subscribe({ next: function next(value) { subject.next(value); }, error: function error(err) { hasError = true; subject.error(err); }, complete: function complete() { isComplete = true; subscription = undefined; subject.complete(); } }); } else { innerSub = subject.subscribe(this); } this.add(function () { refCount--; innerSub.unsubscribe(); if (subscription && !isComplete && useRefCount && refCount === 0) { subscription.unsubscribe(); subscription = undefined; subject = undefined; } }); }; } //# sourceMappingURL=shareReplay.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/single.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/single.js ***! \*****************************************************************/ /*! exports provided: single */ /***/ function node_modulesRxjs_esm2015InternalOperatorsSingleJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "single", function () { return single; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _util_EmptyError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/EmptyError */ "./node_modules/rxjs/_esm2015/internal/util/EmptyError.js"); function single(predicate) { return function (source) { return source.lift(new SingleOperator(predicate, source)); }; } var SingleOperator = /*#__PURE__*/function () { function SingleOperator(predicate, source) { _classCallCheck(this, SingleOperator); this.predicate = predicate; this.source = source; } _createClass2(SingleOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new SingleSubscriber(subscriber, this.predicate, this.source)); } }]); return SingleOperator; }(); var SingleSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_40) { _inherits(SingleSubscriber, _Subscriber__WEBPACK_40); var _super244 = _createSuper(SingleSubscriber); function SingleSubscriber(destination, predicate, source) { var _this527; _classCallCheck(this, SingleSubscriber); _this527 = _super244.call(this, destination); _this527.predicate = predicate; _this527.source = source; _this527.seenValue = false; _this527.index = 0; return _this527; } _createClass2(SingleSubscriber, [{ key: "applySingleValue", value: function applySingleValue(value) { if (this.seenValue) { this.destination.error('Sequence contains more than one element'); } else { this.seenValue = true; this.singleValue = value; } } }, { key: "_next", value: function _next(value) { var index = this.index++; if (this.predicate) { this.tryNext(value, index); } else { this.applySingleValue(value); } } }, { key: "tryNext", value: function tryNext(value, index) { try { if (this.predicate(value, index, this.source)) { this.applySingleValue(value); } } catch (err) { this.destination.error(err); } } }, { key: "_complete", value: function _complete() { var destination = this.destination; if (this.index > 0) { destination.next(this.seenValue ? this.singleValue : undefined); destination.complete(); } else { destination.error(new _util_EmptyError__WEBPACK_IMPORTED_MODULE_1__["EmptyError"]()); } } }]); return SingleSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=single.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/skip.js": /*!***************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/skip.js ***! \***************************************************************/ /*! exports provided: skip */ /***/ function node_modulesRxjs_esm2015InternalOperatorsSkipJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "skip", function () { return skip; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function skip(count) { return function (source) { return source.lift(new SkipOperator(count)); }; } var SkipOperator = /*#__PURE__*/function () { function SkipOperator(total) { _classCallCheck(this, SkipOperator); this.total = total; } _createClass2(SkipOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new SkipSubscriber(subscriber, this.total)); } }]); return SkipOperator; }(); var SkipSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_41) { _inherits(SkipSubscriber, _Subscriber__WEBPACK_41); var _super245 = _createSuper(SkipSubscriber); function SkipSubscriber(destination, total) { var _this528; _classCallCheck(this, SkipSubscriber); _this528 = _super245.call(this, destination); _this528.total = total; _this528.count = 0; return _this528; } _createClass2(SkipSubscriber, [{ key: "_next", value: function _next(x) { if (++this.count > this.total) { this.destination.next(x); } } }]); return SkipSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=skip.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/skipLast.js": /*!*******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/skipLast.js ***! \*******************************************************************/ /*! exports provided: skipLast */ /***/ function node_modulesRxjs_esm2015InternalOperatorsSkipLastJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "skipLast", function () { return skipLast; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/ArgumentOutOfRangeError */ "./node_modules/rxjs/_esm2015/internal/util/ArgumentOutOfRangeError.js"); function skipLast(count) { return function (source) { return source.lift(new SkipLastOperator(count)); }; } var SkipLastOperator = /*#__PURE__*/function () { function SkipLastOperator(_skipCount) { _classCallCheck(this, SkipLastOperator); this._skipCount = _skipCount; if (this._skipCount < 0) { throw new _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_1__["ArgumentOutOfRangeError"](); } } _createClass2(SkipLastOperator, [{ key: "call", value: function call(subscriber, source) { if (this._skipCount === 0) { return source.subscribe(new _Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"](subscriber)); } else { return source.subscribe(new SkipLastSubscriber(subscriber, this._skipCount)); } } }]); return SkipLastOperator; }(); var SkipLastSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_42) { _inherits(SkipLastSubscriber, _Subscriber__WEBPACK_42); var _super246 = _createSuper(SkipLastSubscriber); function SkipLastSubscriber(destination, _skipCount) { var _this529; _classCallCheck(this, SkipLastSubscriber); _this529 = _super246.call(this, destination); _this529._skipCount = _skipCount; _this529._count = 0; _this529._ring = new Array(_skipCount); return _this529; } _createClass2(SkipLastSubscriber, [{ key: "_next", value: function _next(value) { var skipCount = this._skipCount; var count = this._count++; if (count < skipCount) { this._ring[count] = value; } else { var currentIndex = count % skipCount; var ring = this._ring; var oldValue = ring[currentIndex]; ring[currentIndex] = value; this.destination.next(oldValue); } } }]); return SkipLastSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=skipLast.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/skipUntil.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/skipUntil.js ***! \********************************************************************/ /*! exports provided: skipUntil */ /***/ function node_modulesRxjs_esm2015InternalOperatorsSkipUntilJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "skipUntil", function () { return skipUntil; }); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function skipUntil(notifier) { return function (source) { return source.lift(new SkipUntilOperator(notifier)); }; } var SkipUntilOperator = /*#__PURE__*/function () { function SkipUntilOperator(notifier) { _classCallCheck(this, SkipUntilOperator); this.notifier = notifier; } _createClass2(SkipUntilOperator, [{ key: "call", value: function call(destination, source) { return source.subscribe(new SkipUntilSubscriber(destination, this.notifier)); } }]); return SkipUntilOperator; }(); var SkipUntilSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP17) { _inherits(SkipUntilSubscriber, _innerSubscribe__WEBP17); var _super247 = _createSuper(SkipUntilSubscriber); function SkipUntilSubscriber(destination, notifier) { var _this530; _classCallCheck(this, SkipUntilSubscriber); _this530 = _super247.call(this, destination); _this530.hasValue = false; var innerSubscriber = new _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleInnerSubscriber"](_assertThisInitialized(_this530)); _this530.add(innerSubscriber); _this530.innerSubscription = innerSubscriber; var innerSubscription = Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["innerSubscribe"])(notifier, innerSubscriber); if (innerSubscription !== innerSubscriber) { _this530.add(innerSubscription); _this530.innerSubscription = innerSubscription; } return _this530; } _createClass2(SkipUntilSubscriber, [{ key: "_next", value: function _next(value) { if (this.hasValue) { _get(_getPrototypeOf(SkipUntilSubscriber.prototype), "_next", this).call(this, value); } } }, { key: "notifyNext", value: function notifyNext() { this.hasValue = true; if (this.innerSubscription) { this.innerSubscription.unsubscribe(); } } }, { key: "notifyComplete", value: function notifyComplete() {} }]); return SkipUntilSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleOuterSubscriber"]); //# sourceMappingURL=skipUntil.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/skipWhile.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/skipWhile.js ***! \********************************************************************/ /*! exports provided: skipWhile */ /***/ function node_modulesRxjs_esm2015InternalOperatorsSkipWhileJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "skipWhile", function () { return skipWhile; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function skipWhile(predicate) { return function (source) { return source.lift(new SkipWhileOperator(predicate)); }; } var SkipWhileOperator = /*#__PURE__*/function () { function SkipWhileOperator(predicate) { _classCallCheck(this, SkipWhileOperator); this.predicate = predicate; } _createClass2(SkipWhileOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new SkipWhileSubscriber(subscriber, this.predicate)); } }]); return SkipWhileOperator; }(); var SkipWhileSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_43) { _inherits(SkipWhileSubscriber, _Subscriber__WEBPACK_43); var _super248 = _createSuper(SkipWhileSubscriber); function SkipWhileSubscriber(destination, predicate) { var _this531; _classCallCheck(this, SkipWhileSubscriber); _this531 = _super248.call(this, destination); _this531.predicate = predicate; _this531.skipping = true; _this531.index = 0; return _this531; } _createClass2(SkipWhileSubscriber, [{ key: "_next", value: function _next(value) { var destination = this.destination; if (this.skipping) { this.tryCallPredicate(value); } if (!this.skipping) { destination.next(value); } } }, { key: "tryCallPredicate", value: function tryCallPredicate(value) { try { var result = this.predicate(value, this.index++); this.skipping = Boolean(result); } catch (err) { this.destination.error(err); } } }]); return SkipWhileSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=skipWhile.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/startWith.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/startWith.js ***! \********************************************************************/ /*! exports provided: startWith */ /***/ function node_modulesRxjs_esm2015InternalOperatorsStartWithJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "startWith", function () { return startWith; }); /* harmony import */ var _observable_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../observable/concat */ "./node_modules/rxjs/_esm2015/internal/observable/concat.js"); /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/isScheduler */ "./node_modules/rxjs/_esm2015/internal/util/isScheduler.js"); function startWith() { for (var _len47 = arguments.length, array = new Array(_len47), _key45 = 0; _key45 < _len47; _key45++) { array[_key45] = arguments[_key45]; } var scheduler = array[array.length - 1]; if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_1__["isScheduler"])(scheduler)) { array.pop(); return function (source) { return Object(_observable_concat__WEBPACK_IMPORTED_MODULE_0__["concat"])(array, source, scheduler); }; } else { return function (source) { return Object(_observable_concat__WEBPACK_IMPORTED_MODULE_0__["concat"])(array, source); }; } } //# sourceMappingURL=startWith.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/subscribeOn.js": /*!**********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/subscribeOn.js ***! \**********************************************************************/ /*! exports provided: subscribeOn */ /***/ function node_modulesRxjs_esm2015InternalOperatorsSubscribeOnJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeOn", function () { return subscribeOn; }); /* harmony import */ var _observable_SubscribeOnObservable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../observable/SubscribeOnObservable */ "./node_modules/rxjs/_esm2015/internal/observable/SubscribeOnObservable.js"); function subscribeOn(scheduler) { var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; return function subscribeOnOperatorFunction(source) { return source.lift(new SubscribeOnOperator(scheduler, delay)); }; } var SubscribeOnOperator = /*#__PURE__*/function () { function SubscribeOnOperator(scheduler, delay) { _classCallCheck(this, SubscribeOnOperator); this.scheduler = scheduler; this.delay = delay; } _createClass2(SubscribeOnOperator, [{ key: "call", value: function call(subscriber, source) { return new _observable_SubscribeOnObservable__WEBPACK_IMPORTED_MODULE_0__["SubscribeOnObservable"](source, this.delay, this.scheduler).subscribe(subscriber); } }]); return SubscribeOnOperator; }(); //# sourceMappingURL=subscribeOn.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/switchAll.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/switchAll.js ***! \********************************************************************/ /*! exports provided: switchAll */ /***/ function node_modulesRxjs_esm2015InternalOperatorsSwitchAllJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "switchAll", function () { return switchAll; }); /* harmony import */ var _switchMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./switchMap */ "./node_modules/rxjs/_esm2015/internal/operators/switchMap.js"); /* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/identity */ "./node_modules/rxjs/_esm2015/internal/util/identity.js"); function switchAll() { return Object(_switchMap__WEBPACK_IMPORTED_MODULE_0__["switchMap"])(_util_identity__WEBPACK_IMPORTED_MODULE_1__["identity"]); } //# sourceMappingURL=switchAll.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/switchMap.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/switchMap.js ***! \********************************************************************/ /*! exports provided: switchMap */ /***/ function node_modulesRxjs_esm2015InternalOperatorsSwitchMapJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "switchMap", function () { return switchMap; }); /* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./map */ "./node_modules/rxjs/_esm2015/internal/operators/map.js"); /* harmony import */ var _observable_from__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../observable/from */ "./node_modules/rxjs/_esm2015/internal/observable/from.js"); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function switchMap(project, resultSelector) { if (typeof resultSelector === 'function') { return function (source) { return source.pipe(switchMap(function (a, i) { return Object(_observable_from__WEBPACK_IMPORTED_MODULE_1__["from"])(project(a, i)).pipe(Object(_map__WEBPACK_IMPORTED_MODULE_0__["map"])(function (b, ii) { return resultSelector(a, b, i, ii); })); })); }; } return function (source) { return source.lift(new SwitchMapOperator(project)); }; } var SwitchMapOperator = /*#__PURE__*/function () { function SwitchMapOperator(project) { _classCallCheck(this, SwitchMapOperator); this.project = project; } _createClass2(SwitchMapOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new SwitchMapSubscriber(subscriber, this.project)); } }]); return SwitchMapOperator; }(); var SwitchMapSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP18) { _inherits(SwitchMapSubscriber, _innerSubscribe__WEBP18); var _super249 = _createSuper(SwitchMapSubscriber); function SwitchMapSubscriber(destination, project) { var _this532; _classCallCheck(this, SwitchMapSubscriber); _this532 = _super249.call(this, destination); _this532.project = project; _this532.index = 0; return _this532; } _createClass2(SwitchMapSubscriber, [{ key: "_next", value: function _next(value) { var result; var index = this.index++; try { result = this.project(value, index); } catch (error) { this.destination.error(error); return; } this._innerSub(result); } }, { key: "_innerSub", value: function _innerSub(result) { var innerSubscription = this.innerSubscription; if (innerSubscription) { innerSubscription.unsubscribe(); } var innerSubscriber = new _innerSubscribe__WEBPACK_IMPORTED_MODULE_2__["SimpleInnerSubscriber"](this); var destination = this.destination; destination.add(innerSubscriber); this.innerSubscription = Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_2__["innerSubscribe"])(result, innerSubscriber); if (this.innerSubscription !== innerSubscriber) { destination.add(this.innerSubscription); } } }, { key: "_complete", value: function _complete() { var innerSubscription = this.innerSubscription; if (!innerSubscription || innerSubscription.closed) { _get(_getPrototypeOf(SwitchMapSubscriber.prototype), "_complete", this).call(this); } this.unsubscribe(); } }, { key: "_unsubscribe", value: function _unsubscribe() { this.innerSubscription = undefined; } }, { key: "notifyComplete", value: function notifyComplete() { this.innerSubscription = undefined; if (this.isStopped) { _get(_getPrototypeOf(SwitchMapSubscriber.prototype), "_complete", this).call(this); } } }, { key: "notifyNext", value: function notifyNext(innerValue) { this.destination.next(innerValue); } }]); return SwitchMapSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_2__["SimpleOuterSubscriber"]); //# sourceMappingURL=switchMap.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/switchMapTo.js": /*!**********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/switchMapTo.js ***! \**********************************************************************/ /*! exports provided: switchMapTo */ /***/ function node_modulesRxjs_esm2015InternalOperatorsSwitchMapToJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "switchMapTo", function () { return switchMapTo; }); /* harmony import */ var _switchMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./switchMap */ "./node_modules/rxjs/_esm2015/internal/operators/switchMap.js"); function switchMapTo(innerObservable, resultSelector) { return resultSelector ? Object(_switchMap__WEBPACK_IMPORTED_MODULE_0__["switchMap"])(function () { return innerObservable; }, resultSelector) : Object(_switchMap__WEBPACK_IMPORTED_MODULE_0__["switchMap"])(function () { return innerObservable; }); } //# sourceMappingURL=switchMapTo.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/take.js": /*!***************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/take.js ***! \***************************************************************/ /*! exports provided: take */ /***/ function node_modulesRxjs_esm2015InternalOperatorsTakeJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "take", function () { return take; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/ArgumentOutOfRangeError */ "./node_modules/rxjs/_esm2015/internal/util/ArgumentOutOfRangeError.js"); /* harmony import */ var _observable_empty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../observable/empty */ "./node_modules/rxjs/_esm2015/internal/observable/empty.js"); function take(count) { return function (source) { if (count === 0) { return Object(_observable_empty__WEBPACK_IMPORTED_MODULE_2__["empty"])(); } else { return source.lift(new TakeOperator(count)); } }; } var TakeOperator = /*#__PURE__*/function () { function TakeOperator(total) { _classCallCheck(this, TakeOperator); this.total = total; if (this.total < 0) { throw new _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_1__["ArgumentOutOfRangeError"](); } } _createClass2(TakeOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new TakeSubscriber(subscriber, this.total)); } }]); return TakeOperator; }(); var TakeSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_44) { _inherits(TakeSubscriber, _Subscriber__WEBPACK_44); var _super250 = _createSuper(TakeSubscriber); function TakeSubscriber(destination, total) { var _this533; _classCallCheck(this, TakeSubscriber); _this533 = _super250.call(this, destination); _this533.total = total; _this533.count = 0; return _this533; } _createClass2(TakeSubscriber, [{ key: "_next", value: function _next(value) { var total = this.total; var count = ++this.count; if (count <= total) { this.destination.next(value); if (count === total) { this.destination.complete(); this.unsubscribe(); } } } }]); return TakeSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=take.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/takeLast.js": /*!*******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/takeLast.js ***! \*******************************************************************/ /*! exports provided: takeLast */ /***/ function node_modulesRxjs_esm2015InternalOperatorsTakeLastJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "takeLast", function () { return takeLast; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/ArgumentOutOfRangeError */ "./node_modules/rxjs/_esm2015/internal/util/ArgumentOutOfRangeError.js"); /* harmony import */ var _observable_empty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../observable/empty */ "./node_modules/rxjs/_esm2015/internal/observable/empty.js"); function takeLast(count) { return function takeLastOperatorFunction(source) { if (count === 0) { return Object(_observable_empty__WEBPACK_IMPORTED_MODULE_2__["empty"])(); } else { return source.lift(new TakeLastOperator(count)); } }; } var TakeLastOperator = /*#__PURE__*/function () { function TakeLastOperator(total) { _classCallCheck(this, TakeLastOperator); this.total = total; if (this.total < 0) { throw new _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_1__["ArgumentOutOfRangeError"](); } } _createClass2(TakeLastOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new TakeLastSubscriber(subscriber, this.total)); } }]); return TakeLastOperator; }(); var TakeLastSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_45) { _inherits(TakeLastSubscriber, _Subscriber__WEBPACK_45); var _super251 = _createSuper(TakeLastSubscriber); function TakeLastSubscriber(destination, total) { var _this534; _classCallCheck(this, TakeLastSubscriber); _this534 = _super251.call(this, destination); _this534.total = total; _this534.ring = new Array(); _this534.count = 0; return _this534; } _createClass2(TakeLastSubscriber, [{ key: "_next", value: function _next(value) { var ring = this.ring; var total = this.total; var count = this.count++; if (ring.length < total) { ring.push(value); } else { var index = count % total; ring[index] = value; } } }, { key: "_complete", value: function _complete() { var destination = this.destination; var count = this.count; if (count > 0) { var total = this.count >= this.total ? this.total : this.count; var ring = this.ring; for (var i = 0; i < total; i++) { var idx = count++ % total; destination.next(ring[idx]); } } destination.complete(); } }]); return TakeLastSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=takeLast.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/takeUntil.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/takeUntil.js ***! \********************************************************************/ /*! exports provided: takeUntil */ /***/ function node_modulesRxjs_esm2015InternalOperatorsTakeUntilJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "takeUntil", function () { return takeUntil; }); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function takeUntil(notifier) { return function (source) { return source.lift(new TakeUntilOperator(notifier)); }; } var TakeUntilOperator = /*#__PURE__*/function () { function TakeUntilOperator(notifier) { _classCallCheck(this, TakeUntilOperator); this.notifier = notifier; } _createClass2(TakeUntilOperator, [{ key: "call", value: function call(subscriber, source) { var takeUntilSubscriber = new TakeUntilSubscriber(subscriber); var notifierSubscription = Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["innerSubscribe"])(this.notifier, new _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleInnerSubscriber"](takeUntilSubscriber)); if (notifierSubscription && !takeUntilSubscriber.seenValue) { takeUntilSubscriber.add(notifierSubscription); return source.subscribe(takeUntilSubscriber); } return takeUntilSubscriber; } }]); return TakeUntilOperator; }(); var TakeUntilSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP19) { _inherits(TakeUntilSubscriber, _innerSubscribe__WEBP19); var _super252 = _createSuper(TakeUntilSubscriber); function TakeUntilSubscriber(destination) { var _this535; _classCallCheck(this, TakeUntilSubscriber); _this535 = _super252.call(this, destination); _this535.seenValue = false; return _this535; } _createClass2(TakeUntilSubscriber, [{ key: "notifyNext", value: function notifyNext() { this.seenValue = true; this.complete(); } }, { key: "notifyComplete", value: function notifyComplete() {} }]); return TakeUntilSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleOuterSubscriber"]); //# sourceMappingURL=takeUntil.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/takeWhile.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/takeWhile.js ***! \********************************************************************/ /*! exports provided: takeWhile */ /***/ function node_modulesRxjs_esm2015InternalOperatorsTakeWhileJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "takeWhile", function () { return takeWhile; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function takeWhile(predicate) { var inclusive = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; return function (source) { return source.lift(new TakeWhileOperator(predicate, inclusive)); }; } var TakeWhileOperator = /*#__PURE__*/function () { function TakeWhileOperator(predicate, inclusive) { _classCallCheck(this, TakeWhileOperator); this.predicate = predicate; this.inclusive = inclusive; } _createClass2(TakeWhileOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new TakeWhileSubscriber(subscriber, this.predicate, this.inclusive)); } }]); return TakeWhileOperator; }(); var TakeWhileSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_46) { _inherits(TakeWhileSubscriber, _Subscriber__WEBPACK_46); var _super253 = _createSuper(TakeWhileSubscriber); function TakeWhileSubscriber(destination, predicate, inclusive) { var _this536; _classCallCheck(this, TakeWhileSubscriber); _this536 = _super253.call(this, destination); _this536.predicate = predicate; _this536.inclusive = inclusive; _this536.index = 0; return _this536; } _createClass2(TakeWhileSubscriber, [{ key: "_next", value: function _next(value) { var destination = this.destination; var result; try { result = this.predicate(value, this.index++); } catch (err) { destination.error(err); return; } this.nextOrComplete(value, result); } }, { key: "nextOrComplete", value: function nextOrComplete(value, predicateResult) { var destination = this.destination; if (Boolean(predicateResult)) { destination.next(value); } else { if (this.inclusive) { destination.next(value); } destination.complete(); } } }]); return TakeWhileSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=takeWhile.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/tap.js": /*!**************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/tap.js ***! \**************************************************************/ /*! exports provided: tap */ /***/ function node_modulesRxjs_esm2015InternalOperatorsTapJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tap", function () { return tap; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _util_noop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/noop */ "./node_modules/rxjs/_esm2015/internal/util/noop.js"); /* harmony import */ var _util_isFunction__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../util/isFunction */ "./node_modules/rxjs/_esm2015/internal/util/isFunction.js"); function tap(nextOrObserver, error, complete) { return function tapOperatorFunction(source) { return source.lift(new DoOperator(nextOrObserver, error, complete)); }; } var DoOperator = /*#__PURE__*/function () { function DoOperator(nextOrObserver, error, complete) { _classCallCheck(this, DoOperator); this.nextOrObserver = nextOrObserver; this.error = error; this.complete = complete; } _createClass2(DoOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new TapSubscriber(subscriber, this.nextOrObserver, this.error, this.complete)); } }]); return DoOperator; }(); var TapSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_47) { _inherits(TapSubscriber, _Subscriber__WEBPACK_47); var _super254 = _createSuper(TapSubscriber); function TapSubscriber(destination, observerOrNext, error, complete) { var _this537; _classCallCheck(this, TapSubscriber); _this537 = _super254.call(this, destination); _this537._tapNext = _util_noop__WEBPACK_IMPORTED_MODULE_1__["noop"]; _this537._tapError = _util_noop__WEBPACK_IMPORTED_MODULE_1__["noop"]; _this537._tapComplete = _util_noop__WEBPACK_IMPORTED_MODULE_1__["noop"]; _this537._tapError = error || _util_noop__WEBPACK_IMPORTED_MODULE_1__["noop"]; _this537._tapComplete = complete || _util_noop__WEBPACK_IMPORTED_MODULE_1__["noop"]; if (Object(_util_isFunction__WEBPACK_IMPORTED_MODULE_2__["isFunction"])(observerOrNext)) { _this537._context = _assertThisInitialized(_this537); _this537._tapNext = observerOrNext; } else if (observerOrNext) { _this537._context = observerOrNext; _this537._tapNext = observerOrNext.next || _util_noop__WEBPACK_IMPORTED_MODULE_1__["noop"]; _this537._tapError = observerOrNext.error || _util_noop__WEBPACK_IMPORTED_MODULE_1__["noop"]; _this537._tapComplete = observerOrNext.complete || _util_noop__WEBPACK_IMPORTED_MODULE_1__["noop"]; } return _this537; } _createClass2(TapSubscriber, [{ key: "_next", value: function _next(value) { try { this._tapNext.call(this._context, value); } catch (err) { this.destination.error(err); return; } this.destination.next(value); } }, { key: "_error", value: function _error(err) { try { this._tapError.call(this._context, err); } catch (err) { this.destination.error(err); return; } this.destination.error(err); } }, { key: "_complete", value: function _complete() { try { this._tapComplete.call(this._context); } catch (err) { this.destination.error(err); return; } return this.destination.complete(); } }]); return TapSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=tap.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/throttle.js": /*!*******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/throttle.js ***! \*******************************************************************/ /*! exports provided: defaultThrottleConfig, throttle */ /***/ function node_modulesRxjs_esm2015InternalOperatorsThrottleJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultThrottleConfig", function () { return defaultThrottleConfig; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "throttle", function () { return throttle; }); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); var defaultThrottleConfig = { leading: true, trailing: false }; function throttle(durationSelector) { var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultThrottleConfig; return function (source) { return source.lift(new ThrottleOperator(durationSelector, !!config.leading, !!config.trailing)); }; } var ThrottleOperator = /*#__PURE__*/function () { function ThrottleOperator(durationSelector, leading, trailing) { _classCallCheck(this, ThrottleOperator); this.durationSelector = durationSelector; this.leading = leading; this.trailing = trailing; } _createClass2(ThrottleOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new ThrottleSubscriber(subscriber, this.durationSelector, this.leading, this.trailing)); } }]); return ThrottleOperator; }(); var ThrottleSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP20) { _inherits(ThrottleSubscriber, _innerSubscribe__WEBP20); var _super255 = _createSuper(ThrottleSubscriber); function ThrottleSubscriber(destination, durationSelector, _leading, _trailing) { var _this538; _classCallCheck(this, ThrottleSubscriber); _this538 = _super255.call(this, destination); _this538.destination = destination; _this538.durationSelector = durationSelector; _this538._leading = _leading; _this538._trailing = _trailing; _this538._hasValue = false; return _this538; } _createClass2(ThrottleSubscriber, [{ key: "_next", value: function _next(value) { this._hasValue = true; this._sendValue = value; if (!this._throttled) { if (this._leading) { this.send(); } else { this.throttle(value); } } } }, { key: "send", value: function send() { var _hasValue = this._hasValue, _sendValue = this._sendValue; if (_hasValue) { this.destination.next(_sendValue); this.throttle(_sendValue); } this._hasValue = false; this._sendValue = undefined; } }, { key: "throttle", value: function throttle(value) { var duration = this.tryDurationSelector(value); if (!!duration) { this.add(this._throttled = Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["innerSubscribe"])(duration, new _innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleInnerSubscriber"](this))); } } }, { key: "tryDurationSelector", value: function tryDurationSelector(value) { try { return this.durationSelector(value); } catch (err) { this.destination.error(err); return null; } } }, { key: "throttlingDone", value: function throttlingDone() { var _throttled = this._throttled, _trailing = this._trailing; if (_throttled) { _throttled.unsubscribe(); } this._throttled = undefined; if (_trailing) { this.send(); } } }, { key: "notifyNext", value: function notifyNext() { this.throttlingDone(); } }, { key: "notifyComplete", value: function notifyComplete() { this.throttlingDone(); } }]); return ThrottleSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_0__["SimpleOuterSubscriber"]); //# sourceMappingURL=throttle.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/throttleTime.js": /*!***********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/throttleTime.js ***! \***********************************************************************/ /*! exports provided: throttleTime */ /***/ function node_modulesRxjs_esm2015InternalOperatorsThrottleTimeJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "throttleTime", function () { return throttleTime; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../scheduler/async */ "./node_modules/rxjs/_esm2015/internal/scheduler/async.js"); /* harmony import */ var _throttle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./throttle */ "./node_modules/rxjs/_esm2015/internal/operators/throttle.js"); function throttleTime(duration) { var scheduler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _scheduler_async__WEBPACK_IMPORTED_MODULE_1__["async"]; var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _throttle__WEBPACK_IMPORTED_MODULE_2__["defaultThrottleConfig"]; return function (source) { return source.lift(new ThrottleTimeOperator(duration, scheduler, config.leading, config.trailing)); }; } var ThrottleTimeOperator = /*#__PURE__*/function () { function ThrottleTimeOperator(duration, scheduler, leading, trailing) { _classCallCheck(this, ThrottleTimeOperator); this.duration = duration; this.scheduler = scheduler; this.leading = leading; this.trailing = trailing; } _createClass2(ThrottleTimeOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new ThrottleTimeSubscriber(subscriber, this.duration, this.scheduler, this.leading, this.trailing)); } }]); return ThrottleTimeOperator; }(); var ThrottleTimeSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_48) { _inherits(ThrottleTimeSubscriber, _Subscriber__WEBPACK_48); var _super256 = _createSuper(ThrottleTimeSubscriber); function ThrottleTimeSubscriber(destination, duration, scheduler, leading, trailing) { var _this539; _classCallCheck(this, ThrottleTimeSubscriber); _this539 = _super256.call(this, destination); _this539.duration = duration; _this539.scheduler = scheduler; _this539.leading = leading; _this539.trailing = trailing; _this539._hasTrailingValue = false; _this539._trailingValue = null; return _this539; } _createClass2(ThrottleTimeSubscriber, [{ key: "_next", value: function _next(value) { if (this.throttled) { if (this.trailing) { this._trailingValue = value; this._hasTrailingValue = true; } } else { this.add(this.throttled = this.scheduler.schedule(dispatchNext, this.duration, { subscriber: this })); if (this.leading) { this.destination.next(value); } else if (this.trailing) { this._trailingValue = value; this._hasTrailingValue = true; } } } }, { key: "_complete", value: function _complete() { if (this._hasTrailingValue) { this.destination.next(this._trailingValue); this.destination.complete(); } else { this.destination.complete(); } } }, { key: "clearThrottle", value: function clearThrottle() { var throttled = this.throttled; if (throttled) { if (this.trailing && this._hasTrailingValue) { this.destination.next(this._trailingValue); this._trailingValue = null; this._hasTrailingValue = false; } throttled.unsubscribe(); this.remove(throttled); this.throttled = null; } } }]); return ThrottleTimeSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); function dispatchNext(arg) { var subscriber = arg.subscriber; subscriber.clearThrottle(); } //# sourceMappingURL=throttleTime.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/throwIfEmpty.js": /*!***********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/throwIfEmpty.js ***! \***********************************************************************/ /*! exports provided: throwIfEmpty */ /***/ function node_modulesRxjs_esm2015InternalOperatorsThrowIfEmptyJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "throwIfEmpty", function () { return throwIfEmpty; }); /* harmony import */ var _util_EmptyError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../util/EmptyError */ "./node_modules/rxjs/_esm2015/internal/util/EmptyError.js"); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function throwIfEmpty() { var errorFactory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultErrorFactory; return function (source) { return source.lift(new ThrowIfEmptyOperator(errorFactory)); }; } var ThrowIfEmptyOperator = /*#__PURE__*/function () { function ThrowIfEmptyOperator(errorFactory) { _classCallCheck(this, ThrowIfEmptyOperator); this.errorFactory = errorFactory; } _createClass2(ThrowIfEmptyOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new ThrowIfEmptySubscriber(subscriber, this.errorFactory)); } }]); return ThrowIfEmptyOperator; }(); var ThrowIfEmptySubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_49) { _inherits(ThrowIfEmptySubscriber, _Subscriber__WEBPACK_49); var _super257 = _createSuper(ThrowIfEmptySubscriber); function ThrowIfEmptySubscriber(destination, errorFactory) { var _this540; _classCallCheck(this, ThrowIfEmptySubscriber); _this540 = _super257.call(this, destination); _this540.errorFactory = errorFactory; _this540.hasValue = false; return _this540; } _createClass2(ThrowIfEmptySubscriber, [{ key: "_next", value: function _next(value) { this.hasValue = true; this.destination.next(value); } }, { key: "_complete", value: function _complete() { if (!this.hasValue) { var _err; try { _err = this.errorFactory(); } catch (e) { _err = e; } this.destination.error(_err); } else { return this.destination.complete(); } } }]); return ThrowIfEmptySubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]); function defaultErrorFactory() { return new _util_EmptyError__WEBPACK_IMPORTED_MODULE_0__["EmptyError"](); } //# sourceMappingURL=throwIfEmpty.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/timeInterval.js": /*!***********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/timeInterval.js ***! \***********************************************************************/ /*! exports provided: timeInterval, TimeInterval */ /***/ function node_modulesRxjs_esm2015InternalOperatorsTimeIntervalJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timeInterval", function () { return timeInterval; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TimeInterval", function () { return TimeInterval; }); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../scheduler/async */ "./node_modules/rxjs/_esm2015/internal/scheduler/async.js"); /* harmony import */ var _scan__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./scan */ "./node_modules/rxjs/_esm2015/internal/operators/scan.js"); /* harmony import */ var _observable_defer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../observable/defer */ "./node_modules/rxjs/_esm2015/internal/observable/defer.js"); /* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./map */ "./node_modules/rxjs/_esm2015/internal/operators/map.js"); function timeInterval() { var scheduler = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _scheduler_async__WEBPACK_IMPORTED_MODULE_0__["async"]; return function (source) { return Object(_observable_defer__WEBPACK_IMPORTED_MODULE_2__["defer"])(function () { return source.pipe(Object(_scan__WEBPACK_IMPORTED_MODULE_1__["scan"])(function (_ref71, value) { var current = _ref71.current; return { value: value, current: scheduler.now(), last: current }; }, { current: scheduler.now(), value: undefined, last: undefined }), Object(_map__WEBPACK_IMPORTED_MODULE_3__["map"])(function (_ref72) { var current = _ref72.current, last = _ref72.last, value = _ref72.value; return new TimeInterval(value, current - last); })); }); }; } var TimeInterval = function TimeInterval(value, interval) { _classCallCheck(this, TimeInterval); this.value = value; this.interval = interval; }; //# sourceMappingURL=timeInterval.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/timeout.js": /*!******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/timeout.js ***! \******************************************************************/ /*! exports provided: timeout */ /***/ function node_modulesRxjs_esm2015InternalOperatorsTimeoutJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timeout", function () { return timeout; }); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../scheduler/async */ "./node_modules/rxjs/_esm2015/internal/scheduler/async.js"); /* harmony import */ var _util_TimeoutError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/TimeoutError */ "./node_modules/rxjs/_esm2015/internal/util/TimeoutError.js"); /* harmony import */ var _timeoutWith__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./timeoutWith */ "./node_modules/rxjs/_esm2015/internal/operators/timeoutWith.js"); /* harmony import */ var _observable_throwError__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../observable/throwError */ "./node_modules/rxjs/_esm2015/internal/observable/throwError.js"); function timeout(due) { var scheduler = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _scheduler_async__WEBPACK_IMPORTED_MODULE_0__["async"]; return Object(_timeoutWith__WEBPACK_IMPORTED_MODULE_2__["timeoutWith"])(due, Object(_observable_throwError__WEBPACK_IMPORTED_MODULE_3__["throwError"])(new _util_TimeoutError__WEBPACK_IMPORTED_MODULE_1__["TimeoutError"]()), scheduler); } //# sourceMappingURL=timeout.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/timeoutWith.js": /*!**********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/timeoutWith.js ***! \**********************************************************************/ /*! exports provided: timeoutWith */ /***/ function node_modulesRxjs_esm2015InternalOperatorsTimeoutWithJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timeoutWith", function () { return timeoutWith; }); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../scheduler/async */ "./node_modules/rxjs/_esm2015/internal/scheduler/async.js"); /* harmony import */ var _util_isDate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/isDate */ "./node_modules/rxjs/_esm2015/internal/util/isDate.js"); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function timeoutWith(due, withObservable) { var scheduler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _scheduler_async__WEBPACK_IMPORTED_MODULE_0__["async"]; return function (source) { var absoluteTimeout = Object(_util_isDate__WEBPACK_IMPORTED_MODULE_1__["isDate"])(due); var waitFor = absoluteTimeout ? +due - scheduler.now() : Math.abs(due); return source.lift(new TimeoutWithOperator(waitFor, absoluteTimeout, withObservable, scheduler)); }; } var TimeoutWithOperator = /*#__PURE__*/function () { function TimeoutWithOperator(waitFor, absoluteTimeout, withObservable, scheduler) { _classCallCheck(this, TimeoutWithOperator); this.waitFor = waitFor; this.absoluteTimeout = absoluteTimeout; this.withObservable = withObservable; this.scheduler = scheduler; } _createClass2(TimeoutWithOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new TimeoutWithSubscriber(subscriber, this.absoluteTimeout, this.waitFor, this.withObservable, this.scheduler)); } }]); return TimeoutWithOperator; }(); var TimeoutWithSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP21) { _inherits(TimeoutWithSubscriber, _innerSubscribe__WEBP21); var _super258 = _createSuper(TimeoutWithSubscriber); function TimeoutWithSubscriber(destination, absoluteTimeout, waitFor, withObservable, scheduler) { var _this541; _classCallCheck(this, TimeoutWithSubscriber); _this541 = _super258.call(this, destination); _this541.absoluteTimeout = absoluteTimeout; _this541.waitFor = waitFor; _this541.withObservable = withObservable; _this541.scheduler = scheduler; _this541.scheduleTimeout(); return _this541; } _createClass2(TimeoutWithSubscriber, [{ key: "scheduleTimeout", value: function scheduleTimeout() { var action = this.action; if (action) { this.action = action.schedule(this, this.waitFor); } else { this.add(this.action = this.scheduler.schedule(TimeoutWithSubscriber.dispatchTimeout, this.waitFor, this)); } } }, { key: "_next", value: function _next(value) { if (!this.absoluteTimeout) { this.scheduleTimeout(); } _get(_getPrototypeOf(TimeoutWithSubscriber.prototype), "_next", this).call(this, value); } }, { key: "_unsubscribe", value: function _unsubscribe() { this.action = undefined; this.scheduler = null; this.withObservable = null; } }], [{ key: "dispatchTimeout", value: function dispatchTimeout(subscriber) { var withObservable = subscriber.withObservable; subscriber._unsubscribeAndRecycle(); subscriber.add(Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_2__["innerSubscribe"])(withObservable, new _innerSubscribe__WEBPACK_IMPORTED_MODULE_2__["SimpleInnerSubscriber"](subscriber))); } }]); return TimeoutWithSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_2__["SimpleOuterSubscriber"]); //# sourceMappingURL=timeoutWith.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/timestamp.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/timestamp.js ***! \********************************************************************/ /*! exports provided: timestamp, Timestamp */ /***/ function node_modulesRxjs_esm2015InternalOperatorsTimestampJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timestamp", function () { return timestamp; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Timestamp", function () { return Timestamp; }); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../scheduler/async */ "./node_modules/rxjs/_esm2015/internal/scheduler/async.js"); /* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./map */ "./node_modules/rxjs/_esm2015/internal/operators/map.js"); function timestamp() { var scheduler = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _scheduler_async__WEBPACK_IMPORTED_MODULE_0__["async"]; return Object(_map__WEBPACK_IMPORTED_MODULE_1__["map"])(function (value) { return new Timestamp(value, scheduler.now()); }); } var Timestamp = function Timestamp(value, timestamp) { _classCallCheck(this, Timestamp); this.value = value; this.timestamp = timestamp; }; //# sourceMappingURL=timestamp.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/toArray.js": /*!******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/toArray.js ***! \******************************************************************/ /*! exports provided: toArray */ /***/ function node_modulesRxjs_esm2015InternalOperatorsToArrayJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function () { return toArray; }); /* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./reduce */ "./node_modules/rxjs/_esm2015/internal/operators/reduce.js"); function toArrayReducer(arr, item, index) { if (index === 0) { return [item]; } arr.push(item); return arr; } function toArray() { return Object(_reduce__WEBPACK_IMPORTED_MODULE_0__["reduce"])(toArrayReducer, []); } //# sourceMappingURL=toArray.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/window.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/window.js ***! \*****************************************************************/ /*! exports provided: window */ /***/ function node_modulesRxjs_esm2015InternalOperatorsWindowJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "window", function () { return window; }); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subject */ "./node_modules/rxjs/_esm2015/internal/Subject.js"); /* harmony import */ var _innerSubscribe__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../innerSubscribe */ "./node_modules/rxjs/_esm2015/internal/innerSubscribe.js"); function window(windowBoundaries) { return function windowOperatorFunction(source) { return source.lift(new WindowOperator(windowBoundaries)); }; } var WindowOperator = /*#__PURE__*/function () { function WindowOperator(windowBoundaries) { _classCallCheck(this, WindowOperator); this.windowBoundaries = windowBoundaries; } _createClass2(WindowOperator, [{ key: "call", value: function call(subscriber, source) { var windowSubscriber = new WindowSubscriber(subscriber); var sourceSubscription = source.subscribe(windowSubscriber); if (!sourceSubscription.closed) { windowSubscriber.add(Object(_innerSubscribe__WEBPACK_IMPORTED_MODULE_1__["innerSubscribe"])(this.windowBoundaries, new _innerSubscribe__WEBPACK_IMPORTED_MODULE_1__["SimpleInnerSubscriber"](windowSubscriber))); } return sourceSubscription; } }]); return WindowOperator; }(); var WindowSubscriber = /*#__PURE__*/function (_innerSubscribe__WEBP22) { _inherits(WindowSubscriber, _innerSubscribe__WEBP22); var _super259 = _createSuper(WindowSubscriber); function WindowSubscriber(destination) { var _this542; _classCallCheck(this, WindowSubscriber); _this542 = _super259.call(this, destination); _this542.window = new _Subject__WEBPACK_IMPORTED_MODULE_0__["Subject"](); destination.next(_this542.window); return _this542; } _createClass2(WindowSubscriber, [{ key: "notifyNext", value: function notifyNext() { this.openWindow(); } }, { key: "notifyError", value: function notifyError(error) { this._error(error); } }, { key: "notifyComplete", value: function notifyComplete() { this._complete(); } }, { key: "_next", value: function _next(value) { this.window.next(value); } }, { key: "_error", value: function _error(err) { this.window.error(err); this.destination.error(err); } }, { key: "_complete", value: function _complete() { this.window.complete(); this.destination.complete(); } }, { key: "_unsubscribe", value: function _unsubscribe() { this.window = null; } }, { key: "openWindow", value: function openWindow() { var prevWindow = this.window; if (prevWindow) { prevWindow.complete(); } var destination = this.destination; var newWindow = this.window = new _Subject__WEBPACK_IMPORTED_MODULE_0__["Subject"](); destination.next(newWindow); } }]); return WindowSubscriber; }(_innerSubscribe__WEBPACK_IMPORTED_MODULE_1__["SimpleOuterSubscriber"]); //# sourceMappingURL=window.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/windowCount.js": /*!**********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/windowCount.js ***! \**********************************************************************/ /*! exports provided: windowCount */ /***/ function node_modulesRxjs_esm2015InternalOperatorsWindowCountJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "windowCount", function () { return windowCount; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../Subject */ "./node_modules/rxjs/_esm2015/internal/Subject.js"); function windowCount(windowSize) { var startWindowEvery = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; return function windowCountOperatorFunction(source) { return source.lift(new WindowCountOperator(windowSize, startWindowEvery)); }; } var WindowCountOperator = /*#__PURE__*/function () { function WindowCountOperator(windowSize, startWindowEvery) { _classCallCheck(this, WindowCountOperator); this.windowSize = windowSize; this.startWindowEvery = startWindowEvery; } _createClass2(WindowCountOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new WindowCountSubscriber(subscriber, this.windowSize, this.startWindowEvery)); } }]); return WindowCountOperator; }(); var WindowCountSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_50) { _inherits(WindowCountSubscriber, _Subscriber__WEBPACK_50); var _super260 = _createSuper(WindowCountSubscriber); function WindowCountSubscriber(destination, windowSize, startWindowEvery) { var _this543; _classCallCheck(this, WindowCountSubscriber); _this543 = _super260.call(this, destination); _this543.destination = destination; _this543.windowSize = windowSize; _this543.startWindowEvery = startWindowEvery; _this543.windows = [new _Subject__WEBPACK_IMPORTED_MODULE_1__["Subject"]()]; _this543.count = 0; destination.next(_this543.windows[0]); return _this543; } _createClass2(WindowCountSubscriber, [{ key: "_next", value: function _next(value) { var startWindowEvery = this.startWindowEvery > 0 ? this.startWindowEvery : this.windowSize; var destination = this.destination; var windowSize = this.windowSize; var windows = this.windows; var len = windows.length; for (var i = 0; i < len && !this.closed; i++) { windows[i].next(value); } var c = this.count - windowSize + 1; if (c >= 0 && c % startWindowEvery === 0 && !this.closed) { windows.shift().complete(); } if (++this.count % startWindowEvery === 0 && !this.closed) { var _window = new _Subject__WEBPACK_IMPORTED_MODULE_1__["Subject"](); windows.push(_window); destination.next(_window); } } }, { key: "_error", value: function _error(err) { var windows = this.windows; if (windows) { while (windows.length > 0 && !this.closed) { windows.shift().error(err); } } this.destination.error(err); } }, { key: "_complete", value: function _complete() { var windows = this.windows; if (windows) { while (windows.length > 0 && !this.closed) { windows.shift().complete(); } } this.destination.complete(); } }, { key: "_unsubscribe", value: function _unsubscribe() { this.count = 0; this.windows = null; } }]); return WindowCountSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]); //# sourceMappingURL=windowCount.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/windowTime.js": /*!*********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/windowTime.js ***! \*********************************************************************/ /*! exports provided: windowTime */ /***/ function node_modulesRxjs_esm2015InternalOperatorsWindowTimeJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "windowTime", function () { return windowTime; }); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subject */ "./node_modules/rxjs/_esm2015/internal/Subject.js"); /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../scheduler/async */ "./node_modules/rxjs/_esm2015/internal/scheduler/async.js"); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _util_isNumeric__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../util/isNumeric */ "./node_modules/rxjs/_esm2015/internal/util/isNumeric.js"); /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ../util/isScheduler */ "./node_modules/rxjs/_esm2015/internal/util/isScheduler.js"); function windowTime(windowTimeSpan) { var scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_1__["async"]; var windowCreationInterval = null; var maxWindowSize = Number.POSITIVE_INFINITY; if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_4__["isScheduler"])(arguments[3])) { scheduler = arguments[3]; } if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_4__["isScheduler"])(arguments[2])) { scheduler = arguments[2]; } else if (Object(_util_isNumeric__WEBPACK_IMPORTED_MODULE_3__["isNumeric"])(arguments[2])) { maxWindowSize = Number(arguments[2]); } if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_4__["isScheduler"])(arguments[1])) { scheduler = arguments[1]; } else if (Object(_util_isNumeric__WEBPACK_IMPORTED_MODULE_3__["isNumeric"])(arguments[1])) { windowCreationInterval = Number(arguments[1]); } return function windowTimeOperatorFunction(source) { return source.lift(new WindowTimeOperator(windowTimeSpan, windowCreationInterval, maxWindowSize, scheduler)); }; } var WindowTimeOperator = /*#__PURE__*/function () { function WindowTimeOperator(windowTimeSpan, windowCreationInterval, maxWindowSize, scheduler) { _classCallCheck(this, WindowTimeOperator); this.windowTimeSpan = windowTimeSpan; this.windowCreationInterval = windowCreationInterval; this.maxWindowSize = maxWindowSize; this.scheduler = scheduler; } _createClass2(WindowTimeOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new WindowTimeSubscriber(subscriber, this.windowTimeSpan, this.windowCreationInterval, this.maxWindowSize, this.scheduler)); } }]); return WindowTimeOperator; }(); var CountedSubject = /*#__PURE__*/function (_Subject__WEBPACK_IMP5) { _inherits(CountedSubject, _Subject__WEBPACK_IMP5); var _super261 = _createSuper(CountedSubject); function CountedSubject() { var _this544; _classCallCheck(this, CountedSubject); _this544 = _super261.apply(this, arguments); _this544._numberOfNextedValues = 0; return _this544; } _createClass2(CountedSubject, [{ key: "next", value: function next(value) { this._numberOfNextedValues++; _get(_getPrototypeOf(CountedSubject.prototype), "next", this).call(this, value); } }, { key: "numberOfNextedValues", get: function get() { return this._numberOfNextedValues; } }]); return CountedSubject; }(_Subject__WEBPACK_IMPORTED_MODULE_0__["Subject"]); var WindowTimeSubscriber = /*#__PURE__*/function (_Subscriber__WEBPACK_51) { _inherits(WindowTimeSubscriber, _Subscriber__WEBPACK_51); var _super262 = _createSuper(WindowTimeSubscriber); function WindowTimeSubscriber(destination, windowTimeSpan, windowCreationInterval, maxWindowSize, scheduler) { var _this545; _classCallCheck(this, WindowTimeSubscriber); _this545 = _super262.call(this, destination); _this545.destination = destination; _this545.windowTimeSpan = windowTimeSpan; _this545.windowCreationInterval = windowCreationInterval; _this545.maxWindowSize = maxWindowSize; _this545.scheduler = scheduler; _this545.windows = []; var window = _this545.openWindow(); if (windowCreationInterval !== null && windowCreationInterval >= 0) { var closeState = { subscriber: _assertThisInitialized(_this545), window: window, context: null }; var creationState = { windowTimeSpan: windowTimeSpan, windowCreationInterval: windowCreationInterval, subscriber: _assertThisInitialized(_this545), scheduler: scheduler }; _this545.add(scheduler.schedule(dispatchWindowClose, windowTimeSpan, closeState)); _this545.add(scheduler.schedule(dispatchWindowCreation, windowCreationInterval, creationState)); } else { var timeSpanOnlyState = { subscriber: _assertThisInitialized(_this545), window: window, windowTimeSpan: windowTimeSpan }; _this545.add(scheduler.schedule(dispatchWindowTimeSpanOnly, windowTimeSpan, timeSpanOnlyState)); } return _this545; } _createClass2(WindowTimeSubscriber, [{ key: "_next", value: function _next(value) { var windows = this.windows; var len = windows.length; for (var i = 0; i < len; i++) { var _window2 = windows[i]; if (!_window2.closed) { _window2.next(value); if (_window2.numberOfNextedValues >= this.maxWindowSize) { this.closeWindow(_window2); } } } } }, { key: "_error", value: function _error(err) { var windows = this.windows; while (windows.length > 0) { windows.shift().error(err); } this.destination.error(err); } }, { key: "_complete", value: function _complete() { var windows = this.windows; while (windows.length > 0) { var _window3 = windows.shift(); if (!_window3.closed) { _window3.complete(); } } this.destination.complete(); } }, { key: "openWindow", value: function openWindow() { var window = new CountedSubject(); this.windows.push(window); var destination = this.destination; destination.next(window); return window; } }, { key: "closeWindow", value: function closeWindow(window) { window.complete(); var windows = this.windows; windows.splice(windows.indexOf(window), 1); } }]); return WindowTimeSubscriber; }(_Subscriber__WEBPACK_IMPORTED_MODULE_2__["Subscriber"]); function dispatchWindowTimeSpanOnly(state) { var subscriber = state.subscriber, windowTimeSpan = state.windowTimeSpan, window = state.window; if (window) { subscriber.closeWindow(window); } state.window = subscriber.openWindow(); this.schedule(state, windowTimeSpan); } function dispatchWindowCreation(state) { var windowTimeSpan = state.windowTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler, windowCreationInterval = state.windowCreationInterval; var window = subscriber.openWindow(); var action = this; var context = { action: action, subscription: null }; var timeSpanState = { subscriber: subscriber, window: window, context: context }; context.subscription = scheduler.schedule(dispatchWindowClose, windowTimeSpan, timeSpanState); action.add(context.subscription); action.schedule(state, windowCreationInterval); } function dispatchWindowClose(state) { var subscriber = state.subscriber, window = state.window, context = state.context; if (context && context.action && context.subscription) { context.action.remove(context.subscription); } subscriber.closeWindow(window); } //# sourceMappingURL=windowTime.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/windowToggle.js": /*!***********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/windowToggle.js ***! \***********************************************************************/ /*! exports provided: windowToggle */ /***/ function node_modulesRxjs_esm2015InternalOperatorsWindowToggleJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "windowToggle", function () { return windowToggle; }); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subject */ "./node_modules/rxjs/_esm2015/internal/Subject.js"); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../OuterSubscriber */ "./node_modules/rxjs/_esm2015/internal/OuterSubscriber.js"); /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm2015/internal/util/subscribeToResult.js"); function windowToggle(openings, closingSelector) { return function (source) { return source.lift(new WindowToggleOperator(openings, closingSelector)); }; } var WindowToggleOperator = /*#__PURE__*/function () { function WindowToggleOperator(openings, closingSelector) { _classCallCheck(this, WindowToggleOperator); this.openings = openings; this.closingSelector = closingSelector; } _createClass2(WindowToggleOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new WindowToggleSubscriber(subscriber, this.openings, this.closingSelector)); } }]); return WindowToggleOperator; }(); var WindowToggleSubscriber = /*#__PURE__*/function (_OuterSubscriber__WEB5) { _inherits(WindowToggleSubscriber, _OuterSubscriber__WEB5); var _super263 = _createSuper(WindowToggleSubscriber); function WindowToggleSubscriber(destination, openings, closingSelector) { var _this546; _classCallCheck(this, WindowToggleSubscriber); _this546 = _super263.call(this, destination); _this546.openings = openings; _this546.closingSelector = closingSelector; _this546.contexts = []; _this546.add(_this546.openSubscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_3__["subscribeToResult"])(_assertThisInitialized(_this546), openings, openings)); return _this546; } _createClass2(WindowToggleSubscriber, [{ key: "_next", value: function _next(value) { var contexts = this.contexts; if (contexts) { var _len48 = contexts.length; for (var i = 0; i < _len48; i++) { contexts[i].window.next(value); } } } }, { key: "_error", value: function _error(err) { var contexts = this.contexts; this.contexts = null; if (contexts) { var _len49 = contexts.length; var index = -1; while (++index < _len49) { var context = contexts[index]; context.window.error(err); context.subscription.unsubscribe(); } } _get(_getPrototypeOf(WindowToggleSubscriber.prototype), "_error", this).call(this, err); } }, { key: "_complete", value: function _complete() { var contexts = this.contexts; this.contexts = null; if (contexts) { var _len50 = contexts.length; var index = -1; while (++index < _len50) { var context = contexts[index]; context.window.complete(); context.subscription.unsubscribe(); } } _get(_getPrototypeOf(WindowToggleSubscriber.prototype), "_complete", this).call(this); } }, { key: "_unsubscribe", value: function _unsubscribe() { var contexts = this.contexts; this.contexts = null; if (contexts) { var _len51 = contexts.length; var index = -1; while (++index < _len51) { var context = contexts[index]; context.window.unsubscribe(); context.subscription.unsubscribe(); } } } }, { key: "notifyNext", value: function notifyNext(outerValue, innerValue, outerIndex, innerIndex, innerSub) { if (outerValue === this.openings) { var closingNotifier; try { var closingSelector = this.closingSelector; closingNotifier = closingSelector(innerValue); } catch (e) { return this.error(e); } var _window4 = new _Subject__WEBPACK_IMPORTED_MODULE_0__["Subject"](); var subscription = new _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"](); var context = { window: _window4, subscription: subscription }; this.contexts.push(context); var innerSubscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_3__["subscribeToResult"])(this, closingNotifier, context); if (innerSubscription.closed) { this.closeWindow(this.contexts.length - 1); } else { innerSubscription.context = context; subscription.add(innerSubscription); } this.destination.next(_window4); } else { this.closeWindow(this.contexts.indexOf(outerValue)); } } }, { key: "notifyError", value: function notifyError(err) { this.error(err); } }, { key: "notifyComplete", value: function notifyComplete(inner) { if (inner !== this.openSubscription) { this.closeWindow(this.contexts.indexOf(inner.context)); } } }, { key: "closeWindow", value: function closeWindow(index) { if (index === -1) { return; } var contexts = this.contexts; var context = contexts[index]; var window = context.window, subscription = context.subscription; contexts.splice(index, 1); window.complete(); subscription.unsubscribe(); } }]); return WindowToggleSubscriber; }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_2__["OuterSubscriber"]); //# sourceMappingURL=windowToggle.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/windowWhen.js": /*!*********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/windowWhen.js ***! \*********************************************************************/ /*! exports provided: windowWhen */ /***/ function node_modulesRxjs_esm2015InternalOperatorsWindowWhenJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "windowWhen", function () { return windowWhen; }); /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subject */ "./node_modules/rxjs/_esm2015/internal/Subject.js"); /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../OuterSubscriber */ "./node_modules/rxjs/_esm2015/internal/OuterSubscriber.js"); /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm2015/internal/util/subscribeToResult.js"); function windowWhen(closingSelector) { return function windowWhenOperatorFunction(source) { return source.lift(new WindowOperator(closingSelector)); }; } var WindowOperator = /*#__PURE__*/function () { function WindowOperator(closingSelector) { _classCallCheck(this, WindowOperator); this.closingSelector = closingSelector; } _createClass2(WindowOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new WindowSubscriber(subscriber, this.closingSelector)); } }]); return WindowOperator; }(); var WindowSubscriber = /*#__PURE__*/function (_OuterSubscriber__WEB6) { _inherits(WindowSubscriber, _OuterSubscriber__WEB6); var _super264 = _createSuper(WindowSubscriber); function WindowSubscriber(destination, closingSelector) { var _this547; _classCallCheck(this, WindowSubscriber); _this547 = _super264.call(this, destination); _this547.destination = destination; _this547.closingSelector = closingSelector; _this547.openWindow(); return _this547; } _createClass2(WindowSubscriber, [{ key: "notifyNext", value: function notifyNext(_outerValue, _innerValue, _outerIndex, _innerIndex, innerSub) { this.openWindow(innerSub); } }, { key: "notifyError", value: function notifyError(error) { this._error(error); } }, { key: "notifyComplete", value: function notifyComplete(innerSub) { this.openWindow(innerSub); } }, { key: "_next", value: function _next(value) { this.window.next(value); } }, { key: "_error", value: function _error(err) { this.window.error(err); this.destination.error(err); this.unsubscribeClosingNotification(); } }, { key: "_complete", value: function _complete() { this.window.complete(); this.destination.complete(); this.unsubscribeClosingNotification(); } }, { key: "unsubscribeClosingNotification", value: function unsubscribeClosingNotification() { if (this.closingNotification) { this.closingNotification.unsubscribe(); } } }, { key: "openWindow", value: function openWindow() { var innerSub = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; if (innerSub) { this.remove(innerSub); innerSub.unsubscribe(); } var prevWindow = this.window; if (prevWindow) { prevWindow.complete(); } var window = this.window = new _Subject__WEBPACK_IMPORTED_MODULE_0__["Subject"](); this.destination.next(window); var closingNotifier; try { var closingSelector = this.closingSelector; closingNotifier = closingSelector(); } catch (e) { this.destination.error(e); this.window.error(e); return; } this.add(this.closingNotification = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__["subscribeToResult"])(this, closingNotifier)); } }]); return WindowSubscriber; }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__["OuterSubscriber"]); //# sourceMappingURL=windowWhen.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/withLatestFrom.js": /*!*************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/withLatestFrom.js ***! \*************************************************************************/ /*! exports provided: withLatestFrom */ /***/ function node_modulesRxjs_esm2015InternalOperatorsWithLatestFromJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "withLatestFrom", function () { return withLatestFrom; }); /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../OuterSubscriber */ "./node_modules/rxjs/_esm2015/internal/OuterSubscriber.js"); /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm2015/internal/util/subscribeToResult.js"); function withLatestFrom() { for (var _len52 = arguments.length, args = new Array(_len52), _key46 = 0; _key46 < _len52; _key46++) { args[_key46] = arguments[_key46]; } return function (source) { var project; if (typeof args[args.length - 1] === 'function') { project = args.pop(); } var observables = args; return source.lift(new WithLatestFromOperator(observables, project)); }; } var WithLatestFromOperator = /*#__PURE__*/function () { function WithLatestFromOperator(observables, project) { _classCallCheck(this, WithLatestFromOperator); this.observables = observables; this.project = project; } _createClass2(WithLatestFromOperator, [{ key: "call", value: function call(subscriber, source) { return source.subscribe(new WithLatestFromSubscriber(subscriber, this.observables, this.project)); } }]); return WithLatestFromOperator; }(); var WithLatestFromSubscriber = /*#__PURE__*/function (_OuterSubscriber__WEB7) { _inherits(WithLatestFromSubscriber, _OuterSubscriber__WEB7); var _super265 = _createSuper(WithLatestFromSubscriber); function WithLatestFromSubscriber(destination, observables, project) { var _this548; _classCallCheck(this, WithLatestFromSubscriber); _this548 = _super265.call(this, destination); _this548.observables = observables; _this548.project = project; _this548.toRespond = []; var len = observables.length; _this548.values = new Array(len); for (var i = 0; i < len; i++) { _this548.toRespond.push(i); } for (var _i36 = 0; _i36 < len; _i36++) { var observable = observables[_i36]; _this548.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_1__["subscribeToResult"])(_assertThisInitialized(_this548), observable, undefined, _i36)); } return _this548; } _createClass2(WithLatestFromSubscriber, [{ key: "notifyNext", value: function notifyNext(_outerValue, innerValue, outerIndex) { this.values[outerIndex] = innerValue; var toRespond = this.toRespond; if (toRespond.length > 0) { var found = toRespond.indexOf(outerIndex); if (found !== -1) { toRespond.splice(found, 1); } } } }, { key: "notifyComplete", value: function notifyComplete() {} }, { key: "_next", value: function _next(value) { if (this.toRespond.length === 0) { var args = [value].concat(_toConsumableArray(this.values)); if (this.project) { this._tryProject(args); } else { this.destination.next(args); } } } }, { key: "_tryProject", value: function _tryProject(args) { var result; try { result = this.project.apply(this, args); } catch (err) { this.destination.error(err); return; } this.destination.next(result); } }]); return WithLatestFromSubscriber; }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_0__["OuterSubscriber"]); //# sourceMappingURL=withLatestFrom.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/zip.js": /*!**************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/zip.js ***! \**************************************************************/ /*! exports provided: zip */ /***/ function node_modulesRxjs_esm2015InternalOperatorsZipJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function () { return zip; }); /* harmony import */ var _observable_zip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../observable/zip */ "./node_modules/rxjs/_esm2015/internal/observable/zip.js"); function zip() { for (var _len53 = arguments.length, observables = new Array(_len53), _key47 = 0; _key47 < _len53; _key47++) { observables[_key47] = arguments[_key47]; } return function zipOperatorFunction(source) { return source.lift.call(Object(_observable_zip__WEBPACK_IMPORTED_MODULE_0__["zip"]).apply(void 0, [source].concat(observables))); }; } //# sourceMappingURL=zip.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/operators/zipAll.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/operators/zipAll.js ***! \*****************************************************************/ /*! exports provided: zipAll */ /***/ function node_modulesRxjs_esm2015InternalOperatorsZipAllJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zipAll", function () { return zipAll; }); /* harmony import */ var _observable_zip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../observable/zip */ "./node_modules/rxjs/_esm2015/internal/observable/zip.js"); function zipAll(project) { return function (source) { return source.lift(new _observable_zip__WEBPACK_IMPORTED_MODULE_0__["ZipOperator"](project)); }; } //# sourceMappingURL=zipAll.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduled/scheduleArray.js": /*!************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduled/scheduleArray.js ***! \************************************************************************/ /*! exports provided: scheduleArray */ /***/ function node_modulesRxjs_esm2015InternalScheduledScheduleArrayJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scheduleArray", function () { return scheduleArray; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); function scheduleArray(input, scheduler) { return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { var sub = new _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"](); var i = 0; sub.add(scheduler.schedule(function () { if (i === input.length) { subscriber.complete(); return; } subscriber.next(input[i++]); if (!subscriber.closed) { sub.add(this.schedule()); } })); return sub; }); } //# sourceMappingURL=scheduleArray.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduled/scheduleIterable.js": /*!***************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduled/scheduleIterable.js ***! \***************************************************************************/ /*! exports provided: scheduleIterable */ /***/ function node_modulesRxjs_esm2015InternalScheduledScheduleIterableJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scheduleIterable", function () { return scheduleIterable; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); /* harmony import */ var _symbol_iterator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../symbol/iterator */ "./node_modules/rxjs/_esm2015/internal/symbol/iterator.js"); function scheduleIterable(input, scheduler) { if (!input) { throw new Error('Iterable cannot be null'); } return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { var sub = new _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"](); var iterator; sub.add(function () { if (iterator && typeof iterator["return"] === 'function') { iterator["return"](); } }); sub.add(scheduler.schedule(function () { iterator = input[_symbol_iterator__WEBPACK_IMPORTED_MODULE_2__["iterator"]](); sub.add(scheduler.schedule(function () { if (subscriber.closed) { return; } var value; var done; try { var result = iterator.next(); value = result.value; done = result.done; } catch (err) { subscriber.error(err); return; } if (done) { subscriber.complete(); } else { subscriber.next(value); this.schedule(); } })); })); return sub; }); } //# sourceMappingURL=scheduleIterable.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduled/scheduleObservable.js": /*!*****************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduled/scheduleObservable.js ***! \*****************************************************************************/ /*! exports provided: scheduleObservable */ /***/ function node_modulesRxjs_esm2015InternalScheduledScheduleObservableJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scheduleObservable", function () { return scheduleObservable; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); /* harmony import */ var _symbol_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../symbol/observable */ "./node_modules/rxjs/_esm2015/internal/symbol/observable.js"); function scheduleObservable(input, scheduler) { return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { var sub = new _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"](); sub.add(scheduler.schedule(function () { var observable = input[_symbol_observable__WEBPACK_IMPORTED_MODULE_2__["observable"]](); sub.add(observable.subscribe({ next: function next(value) { sub.add(scheduler.schedule(function () { return subscriber.next(value); })); }, error: function error(err) { sub.add(scheduler.schedule(function () { return subscriber.error(err); })); }, complete: function complete() { sub.add(scheduler.schedule(function () { return subscriber.complete(); })); } })); })); return sub; }); } //# sourceMappingURL=scheduleObservable.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduled/schedulePromise.js": /*!**************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduled/schedulePromise.js ***! \**************************************************************************/ /*! exports provided: schedulePromise */ /***/ function node_modulesRxjs_esm2015InternalScheduledSchedulePromiseJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "schedulePromise", function () { return schedulePromise; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); function schedulePromise(input, scheduler) { return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { var sub = new _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"](); sub.add(scheduler.schedule(function () { return input.then(function (value) { sub.add(scheduler.schedule(function () { subscriber.next(value); sub.add(scheduler.schedule(function () { return subscriber.complete(); })); })); }, function (err) { sub.add(scheduler.schedule(function () { return subscriber.error(err); })); }); })); return sub; }); } //# sourceMappingURL=schedulePromise.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduled/scheduled.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduled/scheduled.js ***! \********************************************************************/ /*! exports provided: scheduled */ /***/ function node_modulesRxjs_esm2015InternalScheduledScheduledJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scheduled", function () { return scheduled; }); /* harmony import */ var _scheduleObservable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./scheduleObservable */ "./node_modules/rxjs/_esm2015/internal/scheduled/scheduleObservable.js"); /* harmony import */ var _schedulePromise__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./schedulePromise */ "./node_modules/rxjs/_esm2015/internal/scheduled/schedulePromise.js"); /* harmony import */ var _scheduleArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./scheduleArray */ "./node_modules/rxjs/_esm2015/internal/scheduled/scheduleArray.js"); /* harmony import */ var _scheduleIterable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./scheduleIterable */ "./node_modules/rxjs/_esm2015/internal/scheduled/scheduleIterable.js"); /* harmony import */ var _util_isInteropObservable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ../util/isInteropObservable */ "./node_modules/rxjs/_esm2015/internal/util/isInteropObservable.js"); /* harmony import */ var _util_isPromise__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__( /*! ../util/isPromise */ "./node_modules/rxjs/_esm2015/internal/util/isPromise.js"); /* harmony import */ var _util_isArrayLike__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__( /*! ../util/isArrayLike */ "./node_modules/rxjs/_esm2015/internal/util/isArrayLike.js"); /* harmony import */ var _util_isIterable__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__( /*! ../util/isIterable */ "./node_modules/rxjs/_esm2015/internal/util/isIterable.js"); function scheduled(input, scheduler) { if (input != null) { if (Object(_util_isInteropObservable__WEBPACK_IMPORTED_MODULE_4__["isInteropObservable"])(input)) { return Object(_scheduleObservable__WEBPACK_IMPORTED_MODULE_0__["scheduleObservable"])(input, scheduler); } else if (Object(_util_isPromise__WEBPACK_IMPORTED_MODULE_5__["isPromise"])(input)) { return Object(_schedulePromise__WEBPACK_IMPORTED_MODULE_1__["schedulePromise"])(input, scheduler); } else if (Object(_util_isArrayLike__WEBPACK_IMPORTED_MODULE_6__["isArrayLike"])(input)) { return Object(_scheduleArray__WEBPACK_IMPORTED_MODULE_2__["scheduleArray"])(input, scheduler); } else if (Object(_util_isIterable__WEBPACK_IMPORTED_MODULE_7__["isIterable"])(input) || typeof input === 'string') { return Object(_scheduleIterable__WEBPACK_IMPORTED_MODULE_3__["scheduleIterable"])(input, scheduler); } } throw new TypeError((input !== null && typeof input || input) + ' is not observable'); } //# sourceMappingURL=scheduled.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduler/Action.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduler/Action.js ***! \*****************************************************************/ /*! exports provided: Action */ /***/ function node_modulesRxjs_esm2015InternalSchedulerActionJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Action", function () { return Action; }); /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscription */ "./node_modules/rxjs/_esm2015/internal/Subscription.js"); var Action = /*#__PURE__*/function (_Subscription__WEBPAC4) { _inherits(Action, _Subscription__WEBPAC4); var _super266 = _createSuper(Action); function Action(scheduler, work) { _classCallCheck(this, Action); return _super266.call(this); } _createClass2(Action, [{ key: "schedule", value: function schedule(state) { var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; return this; } }]); return Action; }(_Subscription__WEBPACK_IMPORTED_MODULE_0__["Subscription"]); //# sourceMappingURL=Action.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduler/AnimationFrameAction.js": /*!*******************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduler/AnimationFrameAction.js ***! \*******************************************************************************/ /*! exports provided: AnimationFrameAction */ /***/ function node_modulesRxjs_esm2015InternalSchedulerAnimationFrameActionJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationFrameAction", function () { return AnimationFrameAction; }); /* harmony import */ var _AsyncAction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./AsyncAction */ "./node_modules/rxjs/_esm2015/internal/scheduler/AsyncAction.js"); var AnimationFrameAction = /*#__PURE__*/function (_AsyncAction__WEBPACK) { _inherits(AnimationFrameAction, _AsyncAction__WEBPACK); var _super267 = _createSuper(AnimationFrameAction); function AnimationFrameAction(scheduler, work) { var _this549; _classCallCheck(this, AnimationFrameAction); _this549 = _super267.call(this, scheduler, work); _this549.scheduler = scheduler; _this549.work = work; return _this549; } _createClass2(AnimationFrameAction, [{ key: "requestAsyncId", value: function requestAsyncId(scheduler, id) { var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; if (delay !== null && delay > 0) { return _get(_getPrototypeOf(AnimationFrameAction.prototype), "requestAsyncId", this).call(this, scheduler, id, delay); } scheduler.actions.push(this); return scheduler.scheduled || (scheduler.scheduled = requestAnimationFrame(function () { return scheduler.flush(null); })); } }, { key: "recycleAsyncId", value: function recycleAsyncId(scheduler, id) { var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; if (delay !== null && delay > 0 || delay === null && this.delay > 0) { return _get(_getPrototypeOf(AnimationFrameAction.prototype), "recycleAsyncId", this).call(this, scheduler, id, delay); } if (scheduler.actions.length === 0) { cancelAnimationFrame(id); scheduler.scheduled = undefined; } return undefined; } }]); return AnimationFrameAction; }(_AsyncAction__WEBPACK_IMPORTED_MODULE_0__["AsyncAction"]); //# sourceMappingURL=AnimationFrameAction.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduler/AnimationFrameScheduler.js": /*!**********************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduler/AnimationFrameScheduler.js ***! \**********************************************************************************/ /*! exports provided: AnimationFrameScheduler */ /***/ function node_modulesRxjs_esm2015InternalSchedulerAnimationFrameSchedulerJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationFrameScheduler", function () { return AnimationFrameScheduler; }); /* harmony import */ var _AsyncScheduler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./AsyncScheduler */ "./node_modules/rxjs/_esm2015/internal/scheduler/AsyncScheduler.js"); var AnimationFrameScheduler = /*#__PURE__*/function (_AsyncScheduler__WEBP) { _inherits(AnimationFrameScheduler, _AsyncScheduler__WEBP); var _super268 = _createSuper(AnimationFrameScheduler); function AnimationFrameScheduler() { _classCallCheck(this, AnimationFrameScheduler); return _super268.apply(this, arguments); } _createClass2(AnimationFrameScheduler, [{ key: "flush", value: function flush(action) { this.active = true; this.scheduled = undefined; var actions = this.actions; var error; var index = -1; var count = actions.length; action = action || actions.shift(); do { if (error = action.execute(action.state, action.delay)) { break; } } while (++index < count && (action = actions.shift())); this.active = false; if (error) { while (++index < count && (action = actions.shift())) { action.unsubscribe(); } throw error; } } }]); return AnimationFrameScheduler; }(_AsyncScheduler__WEBPACK_IMPORTED_MODULE_0__["AsyncScheduler"]); //# sourceMappingURL=AnimationFrameScheduler.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduler/AsapAction.js": /*!*********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduler/AsapAction.js ***! \*********************************************************************/ /*! exports provided: AsapAction */ /***/ function node_modulesRxjs_esm2015InternalSchedulerAsapActionJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsapAction", function () { return AsapAction; }); /* harmony import */ var _util_Immediate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../util/Immediate */ "./node_modules/rxjs/_esm2015/internal/util/Immediate.js"); /* harmony import */ var _AsyncAction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./AsyncAction */ "./node_modules/rxjs/_esm2015/internal/scheduler/AsyncAction.js"); var AsapAction = /*#__PURE__*/function (_AsyncAction__WEBPACK2) { _inherits(AsapAction, _AsyncAction__WEBPACK2); var _super269 = _createSuper(AsapAction); function AsapAction(scheduler, work) { var _this550; _classCallCheck(this, AsapAction); _this550 = _super269.call(this, scheduler, work); _this550.scheduler = scheduler; _this550.work = work; return _this550; } _createClass2(AsapAction, [{ key: "requestAsyncId", value: function requestAsyncId(scheduler, id) { var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; if (delay !== null && delay > 0) { return _get(_getPrototypeOf(AsapAction.prototype), "requestAsyncId", this).call(this, scheduler, id, delay); } scheduler.actions.push(this); return scheduler.scheduled || (scheduler.scheduled = _util_Immediate__WEBPACK_IMPORTED_MODULE_0__["Immediate"].setImmediate(scheduler.flush.bind(scheduler, null))); } }, { key: "recycleAsyncId", value: function recycleAsyncId(scheduler, id) { var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; if (delay !== null && delay > 0 || delay === null && this.delay > 0) { return _get(_getPrototypeOf(AsapAction.prototype), "recycleAsyncId", this).call(this, scheduler, id, delay); } if (scheduler.actions.length === 0) { _util_Immediate__WEBPACK_IMPORTED_MODULE_0__["Immediate"].clearImmediate(id); scheduler.scheduled = undefined; } return undefined; } }]); return AsapAction; }(_AsyncAction__WEBPACK_IMPORTED_MODULE_1__["AsyncAction"]); //# sourceMappingURL=AsapAction.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduler/AsapScheduler.js": /*!************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduler/AsapScheduler.js ***! \************************************************************************/ /*! exports provided: AsapScheduler */ /***/ function node_modulesRxjs_esm2015InternalSchedulerAsapSchedulerJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsapScheduler", function () { return AsapScheduler; }); /* harmony import */ var _AsyncScheduler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./AsyncScheduler */ "./node_modules/rxjs/_esm2015/internal/scheduler/AsyncScheduler.js"); var AsapScheduler = /*#__PURE__*/function (_AsyncScheduler__WEBP2) { _inherits(AsapScheduler, _AsyncScheduler__WEBP2); var _super270 = _createSuper(AsapScheduler); function AsapScheduler() { _classCallCheck(this, AsapScheduler); return _super270.apply(this, arguments); } _createClass2(AsapScheduler, [{ key: "flush", value: function flush(action) { this.active = true; this.scheduled = undefined; var actions = this.actions; var error; var index = -1; var count = actions.length; action = action || actions.shift(); do { if (error = action.execute(action.state, action.delay)) { break; } } while (++index < count && (action = actions.shift())); this.active = false; if (error) { while (++index < count && (action = actions.shift())) { action.unsubscribe(); } throw error; } } }]); return AsapScheduler; }(_AsyncScheduler__WEBPACK_IMPORTED_MODULE_0__["AsyncScheduler"]); //# sourceMappingURL=AsapScheduler.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduler/AsyncAction.js": /*!**********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduler/AsyncAction.js ***! \**********************************************************************/ /*! exports provided: AsyncAction */ /***/ function node_modulesRxjs_esm2015InternalSchedulerAsyncActionJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsyncAction", function () { return AsyncAction; }); /* harmony import */ var _Action__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./Action */ "./node_modules/rxjs/_esm2015/internal/scheduler/Action.js"); var AsyncAction = /*#__PURE__*/function (_Action__WEBPACK_IMPO) { _inherits(AsyncAction, _Action__WEBPACK_IMPO); var _super271 = _createSuper(AsyncAction); function AsyncAction(scheduler, work) { var _this551; _classCallCheck(this, AsyncAction); _this551 = _super271.call(this, scheduler, work); _this551.scheduler = scheduler; _this551.work = work; _this551.pending = false; return _this551; } _createClass2(AsyncAction, [{ key: "schedule", value: function schedule(state) { var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; if (this.closed) { return this; } this.state = state; var id = this.id; var scheduler = this.scheduler; if (id != null) { this.id = this.recycleAsyncId(scheduler, id, delay); } this.pending = true; this.delay = delay; this.id = this.id || this.requestAsyncId(scheduler, this.id, delay); return this; } }, { key: "requestAsyncId", value: function requestAsyncId(scheduler, id) { var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; return setInterval(scheduler.flush.bind(scheduler, this), delay); } }, { key: "recycleAsyncId", value: function recycleAsyncId(scheduler, id) { var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; if (delay !== null && this.delay === delay && this.pending === false) { return id; } clearInterval(id); return undefined; } }, { key: "execute", value: function execute(state, delay) { if (this.closed) { return new Error('executing a cancelled action'); } this.pending = false; var error = this._execute(state, delay); if (error) { return error; } else if (this.pending === false && this.id != null) { this.id = this.recycleAsyncId(this.scheduler, this.id, null); } } }, { key: "_execute", value: function _execute(state, delay) { var errored = false; var errorValue = undefined; try { this.work(state); } catch (e) { errored = true; errorValue = !!e && e || new Error(e); } if (errored) { this.unsubscribe(); return errorValue; } } }, { key: "_unsubscribe", value: function _unsubscribe() { var id = this.id; var scheduler = this.scheduler; var actions = scheduler.actions; var index = actions.indexOf(this); this.work = null; this.state = null; this.pending = false; this.scheduler = null; if (index !== -1) { actions.splice(index, 1); } if (id != null) { this.id = this.recycleAsyncId(scheduler, id, null); } this.delay = null; } }]); return AsyncAction; }(_Action__WEBPACK_IMPORTED_MODULE_0__["Action"]); //# sourceMappingURL=AsyncAction.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduler/AsyncScheduler.js": /*!*************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduler/AsyncScheduler.js ***! \*************************************************************************/ /*! exports provided: AsyncScheduler */ /***/ function node_modulesRxjs_esm2015InternalSchedulerAsyncSchedulerJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsyncScheduler", function () { return AsyncScheduler; }); /* harmony import */ var _Scheduler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Scheduler */ "./node_modules/rxjs/_esm2015/internal/Scheduler.js"); var AsyncScheduler = /*#__PURE__*/function (_Scheduler__WEBPACK_I) { _inherits(AsyncScheduler, _Scheduler__WEBPACK_I); var _super272 = _createSuper(AsyncScheduler); function AsyncScheduler(SchedulerAction) { var _this552; var now = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _Scheduler__WEBPACK_IMPORTED_MODULE_0__["Scheduler"].now; _classCallCheck(this, AsyncScheduler); _this552 = _super272.call(this, SchedulerAction, function () { if (AsyncScheduler.delegate && AsyncScheduler.delegate !== _assertThisInitialized(_this552)) { return AsyncScheduler.delegate.now(); } else { return now(); } }); _this552.actions = []; _this552.active = false; _this552.scheduled = undefined; return _this552; } _createClass2(AsyncScheduler, [{ key: "schedule", value: function schedule(work) { var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var state = arguments.length > 2 ? arguments[2] : undefined; if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) { return AsyncScheduler.delegate.schedule(work, delay, state); } else { return _get(_getPrototypeOf(AsyncScheduler.prototype), "schedule", this).call(this, work, delay, state); } } }, { key: "flush", value: function flush(action) { var actions = this.actions; if (this.active) { actions.push(action); return; } var error; this.active = true; do { if (error = action.execute(action.state, action.delay)) { break; } } while (action = actions.shift()); this.active = false; if (error) { while (action = actions.shift()) { action.unsubscribe(); } throw error; } } }]); return AsyncScheduler; }(_Scheduler__WEBPACK_IMPORTED_MODULE_0__["Scheduler"]); //# sourceMappingURL=AsyncScheduler.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduler/QueueAction.js": /*!**********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduler/QueueAction.js ***! \**********************************************************************/ /*! exports provided: QueueAction */ /***/ function node_modulesRxjs_esm2015InternalSchedulerQueueActionJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QueueAction", function () { return QueueAction; }); /* harmony import */ var _AsyncAction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./AsyncAction */ "./node_modules/rxjs/_esm2015/internal/scheduler/AsyncAction.js"); var QueueAction = /*#__PURE__*/function (_AsyncAction__WEBPACK3) { _inherits(QueueAction, _AsyncAction__WEBPACK3); var _super273 = _createSuper(QueueAction); function QueueAction(scheduler, work) { var _this553; _classCallCheck(this, QueueAction); _this553 = _super273.call(this, scheduler, work); _this553.scheduler = scheduler; _this553.work = work; return _this553; } _createClass2(QueueAction, [{ key: "schedule", value: function schedule(state) { var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; if (delay > 0) { return _get(_getPrototypeOf(QueueAction.prototype), "schedule", this).call(this, state, delay); } this.delay = delay; this.state = state; this.scheduler.flush(this); return this; } }, { key: "execute", value: function execute(state, delay) { return delay > 0 || this.closed ? _get(_getPrototypeOf(QueueAction.prototype), "execute", this).call(this, state, delay) : this._execute(state, delay); } }, { key: "requestAsyncId", value: function requestAsyncId(scheduler, id) { var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; if (delay !== null && delay > 0 || delay === null && this.delay > 0) { return _get(_getPrototypeOf(QueueAction.prototype), "requestAsyncId", this).call(this, scheduler, id, delay); } return scheduler.flush(this); } }]); return QueueAction; }(_AsyncAction__WEBPACK_IMPORTED_MODULE_0__["AsyncAction"]); //# sourceMappingURL=QueueAction.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduler/QueueScheduler.js": /*!*************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduler/QueueScheduler.js ***! \*************************************************************************/ /*! exports provided: QueueScheduler */ /***/ function node_modulesRxjs_esm2015InternalSchedulerQueueSchedulerJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QueueScheduler", function () { return QueueScheduler; }); /* harmony import */ var _AsyncScheduler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./AsyncScheduler */ "./node_modules/rxjs/_esm2015/internal/scheduler/AsyncScheduler.js"); var QueueScheduler = /*#__PURE__*/function (_AsyncScheduler__WEBP3) { _inherits(QueueScheduler, _AsyncScheduler__WEBP3); var _super274 = _createSuper(QueueScheduler); function QueueScheduler() { _classCallCheck(this, QueueScheduler); return _super274.apply(this, arguments); } return QueueScheduler; }(_AsyncScheduler__WEBPACK_IMPORTED_MODULE_0__["AsyncScheduler"]); //# sourceMappingURL=QueueScheduler.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduler/VirtualTimeScheduler.js": /*!*******************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduler/VirtualTimeScheduler.js ***! \*******************************************************************************/ /*! exports provided: VirtualTimeScheduler, VirtualAction */ /***/ function node_modulesRxjs_esm2015InternalSchedulerVirtualTimeSchedulerJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VirtualTimeScheduler", function () { return VirtualTimeScheduler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VirtualAction", function () { return VirtualAction; }); /* harmony import */ var _AsyncAction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./AsyncAction */ "./node_modules/rxjs/_esm2015/internal/scheduler/AsyncAction.js"); /* harmony import */ var _AsyncScheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./AsyncScheduler */ "./node_modules/rxjs/_esm2015/internal/scheduler/AsyncScheduler.js"); var VirtualTimeScheduler = /*#__PURE__*/function (_AsyncScheduler__WEBP4) { _inherits(VirtualTimeScheduler, _AsyncScheduler__WEBP4); var _super275 = _createSuper(VirtualTimeScheduler); function VirtualTimeScheduler() { var _this554; var SchedulerAction = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : VirtualAction; var maxFrames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.POSITIVE_INFINITY; _classCallCheck(this, VirtualTimeScheduler); _this554 = _super275.call(this, SchedulerAction, function () { return _this554.frame; }); _this554.maxFrames = maxFrames; _this554.frame = 0; _this554.index = -1; return _this554; } _createClass2(VirtualTimeScheduler, [{ key: "flush", value: function flush() { var actions = this.actions, maxFrames = this.maxFrames; var error, action; while ((action = actions[0]) && action.delay <= maxFrames) { actions.shift(); this.frame = action.delay; if (error = action.execute(action.state, action.delay)) { break; } } if (error) { while (action = actions.shift()) { action.unsubscribe(); } throw error; } } }]); return VirtualTimeScheduler; }(_AsyncScheduler__WEBPACK_IMPORTED_MODULE_1__["AsyncScheduler"]); VirtualTimeScheduler.frameTimeFactor = 10; var VirtualAction = /*#__PURE__*/function (_AsyncAction__WEBPACK4) { _inherits(VirtualAction, _AsyncAction__WEBPACK4); var _super276 = _createSuper(VirtualAction); function VirtualAction(scheduler, work) { var _this555; var index = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : scheduler.index += 1; _classCallCheck(this, VirtualAction); _this555 = _super276.call(this, scheduler, work); _this555.scheduler = scheduler; _this555.work = work; _this555.index = index; _this555.active = true; _this555.index = scheduler.index = index; return _this555; } _createClass2(VirtualAction, [{ key: "schedule", value: function schedule(state) { var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; if (!this.id) { return _get(_getPrototypeOf(VirtualAction.prototype), "schedule", this).call(this, state, delay); } this.active = false; var action = new VirtualAction(this.scheduler, this.work); this.add(action); return action.schedule(state, delay); } }, { key: "requestAsyncId", value: function requestAsyncId(scheduler, id) { var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; this.delay = scheduler.frame + delay; var actions = scheduler.actions; actions.push(this); actions.sort(VirtualAction.sortActions); return true; } }, { key: "recycleAsyncId", value: function recycleAsyncId(scheduler, id) { var delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; return undefined; } }, { key: "_execute", value: function _execute(state, delay) { if (this.active === true) { return _get(_getPrototypeOf(VirtualAction.prototype), "_execute", this).call(this, state, delay); } } }], [{ key: "sortActions", value: function sortActions(a, b) { if (a.delay === b.delay) { if (a.index === b.index) { return 0; } else if (a.index > b.index) { return 1; } else { return -1; } } else if (a.delay > b.delay) { return 1; } else { return -1; } } }]); return VirtualAction; }(_AsyncAction__WEBPACK_IMPORTED_MODULE_0__["AsyncAction"]); //# sourceMappingURL=VirtualTimeScheduler.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduler/animationFrame.js": /*!*************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduler/animationFrame.js ***! \*************************************************************************/ /*! exports provided: animationFrameScheduler, animationFrame */ /***/ function node_modulesRxjs_esm2015InternalSchedulerAnimationFrameJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "animationFrameScheduler", function () { return animationFrameScheduler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "animationFrame", function () { return animationFrame; }); /* harmony import */ var _AnimationFrameAction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./AnimationFrameAction */ "./node_modules/rxjs/_esm2015/internal/scheduler/AnimationFrameAction.js"); /* harmony import */ var _AnimationFrameScheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./AnimationFrameScheduler */ "./node_modules/rxjs/_esm2015/internal/scheduler/AnimationFrameScheduler.js"); var animationFrameScheduler = new _AnimationFrameScheduler__WEBPACK_IMPORTED_MODULE_1__["AnimationFrameScheduler"](_AnimationFrameAction__WEBPACK_IMPORTED_MODULE_0__["AnimationFrameAction"]); var animationFrame = animationFrameScheduler; //# sourceMappingURL=animationFrame.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduler/asap.js": /*!***************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduler/asap.js ***! \***************************************************************/ /*! exports provided: asapScheduler, asap */ /***/ function node_modulesRxjs_esm2015InternalSchedulerAsapJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asapScheduler", function () { return asapScheduler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asap", function () { return asap; }); /* harmony import */ var _AsapAction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./AsapAction */ "./node_modules/rxjs/_esm2015/internal/scheduler/AsapAction.js"); /* harmony import */ var _AsapScheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./AsapScheduler */ "./node_modules/rxjs/_esm2015/internal/scheduler/AsapScheduler.js"); var asapScheduler = new _AsapScheduler__WEBPACK_IMPORTED_MODULE_1__["AsapScheduler"](_AsapAction__WEBPACK_IMPORTED_MODULE_0__["AsapAction"]); var asap = asapScheduler; //# sourceMappingURL=asap.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduler/async.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduler/async.js ***! \****************************************************************/ /*! exports provided: asyncScheduler, async */ /***/ function node_modulesRxjs_esm2015InternalSchedulerAsyncJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asyncScheduler", function () { return asyncScheduler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "async", function () { return async; }); /* harmony import */ var _AsyncAction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./AsyncAction */ "./node_modules/rxjs/_esm2015/internal/scheduler/AsyncAction.js"); /* harmony import */ var _AsyncScheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./AsyncScheduler */ "./node_modules/rxjs/_esm2015/internal/scheduler/AsyncScheduler.js"); var asyncScheduler = new _AsyncScheduler__WEBPACK_IMPORTED_MODULE_1__["AsyncScheduler"](_AsyncAction__WEBPACK_IMPORTED_MODULE_0__["AsyncAction"]); var async = asyncScheduler; //# sourceMappingURL=async.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/scheduler/queue.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/scheduler/queue.js ***! \****************************************************************/ /*! exports provided: queueScheduler, queue */ /***/ function node_modulesRxjs_esm2015InternalSchedulerQueueJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "queueScheduler", function () { return queueScheduler; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "queue", function () { return queue; }); /* harmony import */ var _QueueAction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./QueueAction */ "./node_modules/rxjs/_esm2015/internal/scheduler/QueueAction.js"); /* harmony import */ var _QueueScheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./QueueScheduler */ "./node_modules/rxjs/_esm2015/internal/scheduler/QueueScheduler.js"); var queueScheduler = new _QueueScheduler__WEBPACK_IMPORTED_MODULE_1__["QueueScheduler"](_QueueAction__WEBPACK_IMPORTED_MODULE_0__["QueueAction"]); var queue = queueScheduler; //# sourceMappingURL=queue.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/symbol/iterator.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/symbol/iterator.js ***! \****************************************************************/ /*! exports provided: getSymbolIterator, iterator, $$iterator */ /***/ function node_modulesRxjs_esm2015InternalSymbolIteratorJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSymbolIterator", function () { return getSymbolIterator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "iterator", function () { return iterator; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "$$iterator", function () { return $$iterator; }); function getSymbolIterator() { if (typeof Symbol !== 'function' || !Symbol.iterator) { return '@@iterator'; } return Symbol.iterator; } var iterator = getSymbolIterator(); var $$iterator = iterator; //# sourceMappingURL=iterator.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/symbol/observable.js": /*!******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/symbol/observable.js ***! \******************************************************************/ /*! exports provided: observable */ /***/ function node_modulesRxjs_esm2015InternalSymbolObservableJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "observable", function () { return observable; }); var observable = function () { return typeof Symbol === 'function' && Symbol.observable || '@@observable'; }(); //# sourceMappingURL=observable.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/symbol/rxSubscriber.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/symbol/rxSubscriber.js ***! \********************************************************************/ /*! exports provided: rxSubscriber, $$rxSubscriber */ /***/ function node_modulesRxjs_esm2015InternalSymbolRxSubscriberJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rxSubscriber", function () { return rxSubscriber; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "$$rxSubscriber", function () { return $$rxSubscriber; }); var rxSubscriber = function () { return typeof Symbol === 'function' ? Symbol('rxSubscriber') : '@@rxSubscriber_' + Math.random(); }(); var $$rxSubscriber = rxSubscriber; //# sourceMappingURL=rxSubscriber.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/ArgumentOutOfRangeError.js": /*!*****************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/ArgumentOutOfRangeError.js ***! \*****************************************************************************/ /*! exports provided: ArgumentOutOfRangeError */ /***/ function node_modulesRxjs_esm2015InternalUtilArgumentOutOfRangeErrorJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArgumentOutOfRangeError", function () { return ArgumentOutOfRangeError; }); var ArgumentOutOfRangeErrorImpl = function () { function ArgumentOutOfRangeErrorImpl() { Error.call(this); this.message = 'argument out of range'; this.name = 'ArgumentOutOfRangeError'; return this; } ArgumentOutOfRangeErrorImpl.prototype = Object.create(Error.prototype); return ArgumentOutOfRangeErrorImpl; }(); var ArgumentOutOfRangeError = ArgumentOutOfRangeErrorImpl; //# sourceMappingURL=ArgumentOutOfRangeError.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/EmptyError.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/EmptyError.js ***! \****************************************************************/ /*! exports provided: EmptyError */ /***/ function node_modulesRxjs_esm2015InternalUtilEmptyErrorJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmptyError", function () { return EmptyError; }); var EmptyErrorImpl = function () { function EmptyErrorImpl() { Error.call(this); this.message = 'no elements in sequence'; this.name = 'EmptyError'; return this; } EmptyErrorImpl.prototype = Object.create(Error.prototype); return EmptyErrorImpl; }(); var EmptyError = EmptyErrorImpl; //# sourceMappingURL=EmptyError.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/Immediate.js": /*!***************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/Immediate.js ***! \***************************************************************/ /*! exports provided: Immediate, TestTools */ /***/ function node_modulesRxjs_esm2015InternalUtilImmediateJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Immediate", function () { return Immediate; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TestTools", function () { return TestTools; }); var nextHandle = 1; var RESOLVED = function () { return Promise.resolve(); }(); var activeHandles = {}; function findAndClearHandle(handle) { if (handle in activeHandles) { delete activeHandles[handle]; return true; } return false; } var Immediate = { setImmediate: function setImmediate(cb) { var handle = nextHandle++; activeHandles[handle] = true; RESOLVED.then(function () { return findAndClearHandle(handle) && cb(); }); return handle; }, clearImmediate: function clearImmediate(handle) { findAndClearHandle(handle); } }; var TestTools = { pending: function pending() { return Object.keys(activeHandles).length; } }; //# sourceMappingURL=Immediate.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/ObjectUnsubscribedError.js": /*!*****************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/ObjectUnsubscribedError.js ***! \*****************************************************************************/ /*! exports provided: ObjectUnsubscribedError */ /***/ function node_modulesRxjs_esm2015InternalUtilObjectUnsubscribedErrorJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObjectUnsubscribedError", function () { return ObjectUnsubscribedError; }); var ObjectUnsubscribedErrorImpl = function () { function ObjectUnsubscribedErrorImpl() { Error.call(this); this.message = 'object unsubscribed'; this.name = 'ObjectUnsubscribedError'; return this; } ObjectUnsubscribedErrorImpl.prototype = Object.create(Error.prototype); return ObjectUnsubscribedErrorImpl; }(); var ObjectUnsubscribedError = ObjectUnsubscribedErrorImpl; //# sourceMappingURL=ObjectUnsubscribedError.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/TimeoutError.js": /*!******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/TimeoutError.js ***! \******************************************************************/ /*! exports provided: TimeoutError */ /***/ function node_modulesRxjs_esm2015InternalUtilTimeoutErrorJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TimeoutError", function () { return TimeoutError; }); var TimeoutErrorImpl = function () { function TimeoutErrorImpl() { Error.call(this); this.message = 'Timeout has occurred'; this.name = 'TimeoutError'; return this; } TimeoutErrorImpl.prototype = Object.create(Error.prototype); return TimeoutErrorImpl; }(); var TimeoutError = TimeoutErrorImpl; //# sourceMappingURL=TimeoutError.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/UnsubscriptionError.js": /*!*************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/UnsubscriptionError.js ***! \*************************************************************************/ /*! exports provided: UnsubscriptionError */ /***/ function node_modulesRxjs_esm2015InternalUtilUnsubscriptionErrorJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UnsubscriptionError", function () { return UnsubscriptionError; }); var UnsubscriptionErrorImpl = function () { function UnsubscriptionErrorImpl(errors) { Error.call(this); this.message = errors ? "".concat(errors.length, " errors occurred during unsubscription:\n").concat(errors.map(function (err, i) { return "".concat(i + 1, ") ").concat(err.toString()); }).join('\n ')) : ''; this.name = 'UnsubscriptionError'; this.errors = errors; return this; } UnsubscriptionErrorImpl.prototype = Object.create(Error.prototype); return UnsubscriptionErrorImpl; }(); var UnsubscriptionError = UnsubscriptionErrorImpl; //# sourceMappingURL=UnsubscriptionError.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/canReportError.js": /*!********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/canReportError.js ***! \********************************************************************/ /*! exports provided: canReportError */ /***/ function node_modulesRxjs_esm2015InternalUtilCanReportErrorJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "canReportError", function () { return canReportError; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); function canReportError(observer) { while (observer) { var _observer = observer, closed = _observer.closed, destination = _observer.destination, isStopped = _observer.isStopped; if (closed || isStopped) { return false; } else if (destination && destination instanceof _Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]) { observer = destination; } else { observer = null; } } return true; } //# sourceMappingURL=canReportError.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/hostReportError.js": /*!*********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/hostReportError.js ***! \*********************************************************************/ /*! exports provided: hostReportError */ /***/ function node_modulesRxjs_esm2015InternalUtilHostReportErrorJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hostReportError", function () { return hostReportError; }); function hostReportError(err) { setTimeout(function () { throw err; }, 0); } //# sourceMappingURL=hostReportError.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/identity.js": /*!**************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/identity.js ***! \**************************************************************/ /*! exports provided: identity */ /***/ function node_modulesRxjs_esm2015InternalUtilIdentityJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function () { return identity; }); function identity(x) { return x; } //# sourceMappingURL=identity.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/isArray.js": /*!*************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/isArray.js ***! \*************************************************************/ /*! exports provided: isArray */ /***/ function node_modulesRxjs_esm2015InternalUtilIsArrayJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function () { return isArray; }); var isArray = function () { return Array.isArray || function (x) { return x && typeof x.length === 'number'; }; }(); //# sourceMappingURL=isArray.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/isArrayLike.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/isArrayLike.js ***! \*****************************************************************/ /*! exports provided: isArrayLike */ /***/ function node_modulesRxjs_esm2015InternalUtilIsArrayLikeJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayLike", function () { return isArrayLike; }); var isArrayLike = function isArrayLike(x) { return x && typeof x.length === 'number' && typeof x !== 'function'; }; //# sourceMappingURL=isArrayLike.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/isDate.js": /*!************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/isDate.js ***! \************************************************************/ /*! exports provided: isDate */ /***/ function node_modulesRxjs_esm2015InternalUtilIsDateJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isDate", function () { return isDate; }); function isDate(value) { return value instanceof Date && !isNaN(+value); } //# sourceMappingURL=isDate.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/isFunction.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/isFunction.js ***! \****************************************************************/ /*! exports provided: isFunction */ /***/ function node_modulesRxjs_esm2015InternalUtilIsFunctionJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function () { return isFunction; }); function isFunction(x) { return typeof x === 'function'; } //# sourceMappingURL=isFunction.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/isInteropObservable.js": /*!*************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/isInteropObservable.js ***! \*************************************************************************/ /*! exports provided: isInteropObservable */ /***/ function node_modulesRxjs_esm2015InternalUtilIsInteropObservableJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isInteropObservable", function () { return isInteropObservable; }); /* harmony import */ var _symbol_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../symbol/observable */ "./node_modules/rxjs/_esm2015/internal/symbol/observable.js"); function isInteropObservable(input) { return input && typeof input[_symbol_observable__WEBPACK_IMPORTED_MODULE_0__["observable"]] === 'function'; } //# sourceMappingURL=isInteropObservable.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/isIterable.js": /*!****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/isIterable.js ***! \****************************************************************/ /*! exports provided: isIterable */ /***/ function node_modulesRxjs_esm2015InternalUtilIsIterableJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isIterable", function () { return isIterable; }); /* harmony import */ var _symbol_iterator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../symbol/iterator */ "./node_modules/rxjs/_esm2015/internal/symbol/iterator.js"); function isIterable(input) { return input && typeof input[_symbol_iterator__WEBPACK_IMPORTED_MODULE_0__["iterator"]] === 'function'; } //# sourceMappingURL=isIterable.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/isNumeric.js": /*!***************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/isNumeric.js ***! \***************************************************************/ /*! exports provided: isNumeric */ /***/ function node_modulesRxjs_esm2015InternalUtilIsNumericJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNumeric", function () { return isNumeric; }); /* harmony import */ var _isArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./isArray */ "./node_modules/rxjs/_esm2015/internal/util/isArray.js"); function isNumeric(val) { return !Object(_isArray__WEBPACK_IMPORTED_MODULE_0__["isArray"])(val) && val - parseFloat(val) + 1 >= 0; } //# sourceMappingURL=isNumeric.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/isObject.js": /*!**************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/isObject.js ***! \**************************************************************/ /*! exports provided: isObject */ /***/ function node_modulesRxjs_esm2015InternalUtilIsObjectJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function () { return isObject; }); function isObject(x) { return x !== null && typeof x === 'object'; } //# sourceMappingURL=isObject.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/isObservable.js": /*!******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/isObservable.js ***! \******************************************************************/ /*! exports provided: isObservable */ /***/ function node_modulesRxjs_esm2015InternalUtilIsObservableJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservable", function () { return isObservable; }); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); function isObservable(obj) { return !!obj && (obj instanceof _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"] || typeof obj.lift === 'function' && typeof obj.subscribe === 'function'); } //# sourceMappingURL=isObservable.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/isPromise.js": /*!***************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/isPromise.js ***! \***************************************************************/ /*! exports provided: isPromise */ /***/ function node_modulesRxjs_esm2015InternalUtilIsPromiseJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPromise", function () { return isPromise; }); function isPromise(value) { return !!value && typeof value.subscribe !== 'function' && typeof value.then === 'function'; } //# sourceMappingURL=isPromise.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/isScheduler.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/isScheduler.js ***! \*****************************************************************/ /*! exports provided: isScheduler */ /***/ function node_modulesRxjs_esm2015InternalUtilIsSchedulerJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isScheduler", function () { return isScheduler; }); function isScheduler(value) { return value && typeof value.schedule === 'function'; } //# sourceMappingURL=isScheduler.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/noop.js": /*!**********************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/noop.js ***! \**********************************************************/ /*! exports provided: noop */ /***/ function node_modulesRxjs_esm2015InternalUtilNoopJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "noop", function () { return noop; }); function noop() {} //# sourceMappingURL=noop.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/not.js": /*!*********************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/not.js ***! \*********************************************************/ /*! exports provided: not */ /***/ function node_modulesRxjs_esm2015InternalUtilNotJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "not", function () { return not; }); function not(pred, thisArg) { function notPred() { return !notPred.pred.apply(notPred.thisArg, arguments); } notPred.pred = pred; notPred.thisArg = thisArg; return notPred; } //# sourceMappingURL=not.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/pipe.js": /*!**********************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/pipe.js ***! \**********************************************************/ /*! exports provided: pipe, pipeFromArray */ /***/ function node_modulesRxjs_esm2015InternalUtilPipeJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pipe", function () { return pipe; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pipeFromArray", function () { return pipeFromArray; }); /* harmony import */ var _identity__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./identity */ "./node_modules/rxjs/_esm2015/internal/util/identity.js"); function pipe() { for (var _len54 = arguments.length, fns = new Array(_len54), _key48 = 0; _key48 < _len54; _key48++) { fns[_key48] = arguments[_key48]; } return pipeFromArray(fns); } function pipeFromArray(fns) { if (fns.length === 0) { return _identity__WEBPACK_IMPORTED_MODULE_0__["identity"]; } if (fns.length === 1) { return fns[0]; } return function piped(input) { return fns.reduce(function (prev, fn) { return fn(prev); }, input); }; } //# sourceMappingURL=pipe.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/subscribeTo.js": /*!*****************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/subscribeTo.js ***! \*****************************************************************/ /*! exports provided: subscribeTo */ /***/ function node_modulesRxjs_esm2015InternalUtilSubscribeToJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeTo", function () { return subscribeTo; }); /* harmony import */ var _subscribeToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./subscribeToArray */ "./node_modules/rxjs/_esm2015/internal/util/subscribeToArray.js"); /* harmony import */ var _subscribeToPromise__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./subscribeToPromise */ "./node_modules/rxjs/_esm2015/internal/util/subscribeToPromise.js"); /* harmony import */ var _subscribeToIterable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ./subscribeToIterable */ "./node_modules/rxjs/_esm2015/internal/util/subscribeToIterable.js"); /* harmony import */ var _subscribeToObservable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ./subscribeToObservable */ "./node_modules/rxjs/_esm2015/internal/util/subscribeToObservable.js"); /* harmony import */ var _isArrayLike__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ./isArrayLike */ "./node_modules/rxjs/_esm2015/internal/util/isArrayLike.js"); /* harmony import */ var _isPromise__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__( /*! ./isPromise */ "./node_modules/rxjs/_esm2015/internal/util/isPromise.js"); /* harmony import */ var _isObject__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__( /*! ./isObject */ "./node_modules/rxjs/_esm2015/internal/util/isObject.js"); /* harmony import */ var _symbol_iterator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__( /*! ../symbol/iterator */ "./node_modules/rxjs/_esm2015/internal/symbol/iterator.js"); /* harmony import */ var _symbol_observable__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__( /*! ../symbol/observable */ "./node_modules/rxjs/_esm2015/internal/symbol/observable.js"); var subscribeTo = function subscribeTo(result) { if (!!result && typeof result[_symbol_observable__WEBPACK_IMPORTED_MODULE_8__["observable"]] === 'function') { return Object(_subscribeToObservable__WEBPACK_IMPORTED_MODULE_3__["subscribeToObservable"])(result); } else if (Object(_isArrayLike__WEBPACK_IMPORTED_MODULE_4__["isArrayLike"])(result)) { return Object(_subscribeToArray__WEBPACK_IMPORTED_MODULE_0__["subscribeToArray"])(result); } else if (Object(_isPromise__WEBPACK_IMPORTED_MODULE_5__["isPromise"])(result)) { return Object(_subscribeToPromise__WEBPACK_IMPORTED_MODULE_1__["subscribeToPromise"])(result); } else if (!!result && typeof result[_symbol_iterator__WEBPACK_IMPORTED_MODULE_7__["iterator"]] === 'function') { return Object(_subscribeToIterable__WEBPACK_IMPORTED_MODULE_2__["subscribeToIterable"])(result); } else { var value = Object(_isObject__WEBPACK_IMPORTED_MODULE_6__["isObject"])(result) ? 'an invalid object' : "'".concat(result, "'"); var msg = "You provided ".concat(value, " where a stream was expected.") + ' You can provide an Observable, Promise, Array, or Iterable.'; throw new TypeError(msg); } }; //# sourceMappingURL=subscribeTo.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/subscribeToArray.js": /*!**********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/subscribeToArray.js ***! \**********************************************************************/ /*! exports provided: subscribeToArray */ /***/ function node_modulesRxjs_esm2015InternalUtilSubscribeToArrayJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeToArray", function () { return subscribeToArray; }); var subscribeToArray = function subscribeToArray(array) { return function (subscriber) { for (var i = 0, _len55 = array.length; i < _len55 && !subscriber.closed; i++) { subscriber.next(array[i]); } subscriber.complete(); }; }; //# sourceMappingURL=subscribeToArray.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/subscribeToIterable.js": /*!*************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/subscribeToIterable.js ***! \*************************************************************************/ /*! exports provided: subscribeToIterable */ /***/ function node_modulesRxjs_esm2015InternalUtilSubscribeToIterableJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeToIterable", function () { return subscribeToIterable; }); /* harmony import */ var _symbol_iterator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../symbol/iterator */ "./node_modules/rxjs/_esm2015/internal/symbol/iterator.js"); var subscribeToIterable = function subscribeToIterable(iterable) { return function (subscriber) { var iterator = iterable[_symbol_iterator__WEBPACK_IMPORTED_MODULE_0__["iterator"]](); do { var item = void 0; try { item = iterator.next(); } catch (err) { subscriber.error(err); return subscriber; } if (item.done) { subscriber.complete(); break; } subscriber.next(item.value); if (subscriber.closed) { break; } } while (true); if (typeof iterator["return"] === 'function') { subscriber.add(function () { if (iterator["return"]) { iterator["return"](); } }); } return subscriber; }; }; //# sourceMappingURL=subscribeToIterable.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/subscribeToObservable.js": /*!***************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/subscribeToObservable.js ***! \***************************************************************************/ /*! exports provided: subscribeToObservable */ /***/ function node_modulesRxjs_esm2015InternalUtilSubscribeToObservableJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeToObservable", function () { return subscribeToObservable; }); /* harmony import */ var _symbol_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../symbol/observable */ "./node_modules/rxjs/_esm2015/internal/symbol/observable.js"); var subscribeToObservable = function subscribeToObservable(obj) { return function (subscriber) { var obs = obj[_symbol_observable__WEBPACK_IMPORTED_MODULE_0__["observable"]](); if (typeof obs.subscribe !== 'function') { throw new TypeError('Provided object does not correctly implement Symbol.observable'); } else { return obs.subscribe(subscriber); } }; }; //# sourceMappingURL=subscribeToObservable.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/subscribeToPromise.js": /*!************************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/subscribeToPromise.js ***! \************************************************************************/ /*! exports provided: subscribeToPromise */ /***/ function node_modulesRxjs_esm2015InternalUtilSubscribeToPromiseJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeToPromise", function () { return subscribeToPromise; }); /* harmony import */ var _hostReportError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ./hostReportError */ "./node_modules/rxjs/_esm2015/internal/util/hostReportError.js"); var subscribeToPromise = function subscribeToPromise(promise) { return function (subscriber) { promise.then(function (value) { if (!subscriber.closed) { subscriber.next(value); subscriber.complete(); } }, function (err) { return subscriber.error(err); }).then(null, _hostReportError__WEBPACK_IMPORTED_MODULE_0__["hostReportError"]); return subscriber; }; }; //# sourceMappingURL=subscribeToPromise.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/subscribeToResult.js": /*!***********************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/subscribeToResult.js ***! \***********************************************************************/ /*! exports provided: subscribeToResult */ /***/ function node_modulesRxjs_esm2015InternalUtilSubscribeToResultJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeToResult", function () { return subscribeToResult; }); /* harmony import */ var _InnerSubscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../InnerSubscriber */ "./node_modules/rxjs/_esm2015/internal/InnerSubscriber.js"); /* harmony import */ var _subscribeTo__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ./subscribeTo */ "./node_modules/rxjs/_esm2015/internal/util/subscribeTo.js"); /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../Observable */ "./node_modules/rxjs/_esm2015/internal/Observable.js"); function subscribeToResult(outerSubscriber, result, outerValue, outerIndex) { var innerSubscriber = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : new _InnerSubscriber__WEBPACK_IMPORTED_MODULE_0__["InnerSubscriber"](outerSubscriber, outerValue, outerIndex); if (innerSubscriber.closed) { return undefined; } if (result instanceof _Observable__WEBPACK_IMPORTED_MODULE_2__["Observable"]) { return result.subscribe(innerSubscriber); } return Object(_subscribeTo__WEBPACK_IMPORTED_MODULE_1__["subscribeTo"])(result)(innerSubscriber); } //# sourceMappingURL=subscribeToResult.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/internal/util/toSubscriber.js": /*!******************************************************************!*\ !*** ./node_modules/rxjs/_esm2015/internal/util/toSubscriber.js ***! \******************************************************************/ /*! exports provided: toSubscriber */ /***/ function node_modulesRxjs_esm2015InternalUtilToSubscriberJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toSubscriber", function () { return toSubscriber; }); /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../Subscriber */ "./node_modules/rxjs/_esm2015/internal/Subscriber.js"); /* harmony import */ var _symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../symbol/rxSubscriber */ "./node_modules/rxjs/_esm2015/internal/symbol/rxSubscriber.js"); /* harmony import */ var _Observer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../Observer */ "./node_modules/rxjs/_esm2015/internal/Observer.js"); function toSubscriber(nextOrObserver, error, complete) { if (nextOrObserver) { if (nextOrObserver instanceof _Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]) { return nextOrObserver; } if (nextOrObserver[_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_1__["rxSubscriber"]]) { return nextOrObserver[_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_1__["rxSubscriber"]](); } } if (!nextOrObserver && !error && !complete) { return new _Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"](_Observer__WEBPACK_IMPORTED_MODULE_2__["empty"]); } return new _Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"](nextOrObserver, error, complete); } //# sourceMappingURL=toSubscriber.js.map /***/ }, /***/ "./node_modules/rxjs/_esm2015/operators/index.js": /*!*******************************************************!*\ !*** ./node_modules/rxjs/_esm2015/operators/index.js ***! \*******************************************************/ /*! exports provided: audit, auditTime, buffer, bufferCount, bufferTime, bufferToggle, bufferWhen, catchError, combineAll, combineLatest, concat, concatAll, concatMap, concatMapTo, count, debounce, debounceTime, defaultIfEmpty, delay, delayWhen, dematerialize, distinct, distinctUntilChanged, distinctUntilKeyChanged, elementAt, endWith, every, exhaust, exhaustMap, expand, filter, finalize, find, findIndex, first, groupBy, ignoreElements, isEmpty, last, map, mapTo, materialize, max, merge, mergeAll, mergeMap, flatMap, mergeMapTo, mergeScan, min, multicast, observeOn, onErrorResumeNext, pairwise, partition, pluck, publish, publishBehavior, publishLast, publishReplay, race, reduce, repeat, repeatWhen, retry, retryWhen, refCount, sample, sampleTime, scan, sequenceEqual, share, shareReplay, single, skip, skipLast, skipUntil, skipWhile, startWith, subscribeOn, switchAll, switchMap, switchMapTo, take, takeLast, takeUntil, takeWhile, tap, throttle, throttleTime, throwIfEmpty, timeInterval, timeout, timeoutWith, timestamp, toArray, window, windowCount, windowTime, windowToggle, windowWhen, withLatestFrom, zip, zipAll */ /***/ function node_modulesRxjs_esm2015OperatorsIndexJs(module, __webpack_exports__, __webpack_require__) { "use strict"; __webpack_require__.r(__webpack_exports__); /* harmony import */ var _internal_operators_audit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( /*! ../internal/operators/audit */ "./node_modules/rxjs/_esm2015/internal/operators/audit.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "audit", function () { return _internal_operators_audit__WEBPACK_IMPORTED_MODULE_0__["audit"]; }); /* harmony import */ var _internal_operators_auditTime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( /*! ../internal/operators/auditTime */ "./node_modules/rxjs/_esm2015/internal/operators/auditTime.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "auditTime", function () { return _internal_operators_auditTime__WEBPACK_IMPORTED_MODULE_1__["auditTime"]; }); /* harmony import */ var _internal_operators_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__( /*! ../internal/operators/buffer */ "./node_modules/rxjs/_esm2015/internal/operators/buffer.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buffer", function () { return _internal_operators_buffer__WEBPACK_IMPORTED_MODULE_2__["buffer"]; }); /* harmony import */ var _internal_operators_bufferCount__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__( /*! ../internal/operators/bufferCount */ "./node_modules/rxjs/_esm2015/internal/operators/bufferCount.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferCount", function () { return _internal_operators_bufferCount__WEBPACK_IMPORTED_MODULE_3__["bufferCount"]; }); /* harmony import */ var _internal_operators_bufferTime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__( /*! ../internal/operators/bufferTime */ "./node_modules/rxjs/_esm2015/internal/operators/bufferTime.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferTime", function () { return _internal_operators_bufferTime__WEBPACK_IMPORTED_MODULE_4__["bufferTime"]; }); /* harmony import */ var _internal_operators_bufferToggle__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__( /*! ../internal/operators/bufferToggle */ "./node_modules/rxjs/_esm2015/internal/operators/bufferToggle.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferToggle", function () { return _internal_operators_bufferToggle__WEBPACK_IMPORTED_MODULE_5__["bufferToggle"]; }); /* harmony import */ var _internal_operators_bufferWhen__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__( /*! ../internal/operators/bufferWhen */ "./node_modules/rxjs/_esm2015/internal/operators/bufferWhen.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferWhen", function () { return _internal_operators_bufferWhen__WEBPACK_IMPORTED_MODULE_6__["bufferWhen"]; }); /* harmony import */ var _internal_operators_catchError__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__( /*! ../internal/operators/catchError */ "./node_modules/rxjs/_esm2015/internal/operators/catchError.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "catchError", function () { return _internal_operators_catchError__WEBPACK_IMPORTED_MODULE_7__["catchError"]; }); /* harmony import */ var _internal_operators_combineAll__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__( /*! ../internal/operators/combineAll */ "./node_modules/rxjs/_esm2015/internal/operators/combineAll.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "combineAll", function () { return _internal_operators_combineAll__WEBPACK_IMPORTED_MODULE_8__["combineAll"]; }); /* harmony import */ var _internal_operators_combineLatest__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__( /*! ../internal/operators/combineLatest */ "./node_modules/rxjs/_esm2015/internal/operators/combineLatest.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "combineLatest", function () { return _internal_operators_combineLatest__WEBPACK_IMPORTED_MODULE_9__["combineLatest"]; }); /* harmony import */ var _internal_operators_concat__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__( /*! ../internal/operators/concat */ "./node_modules/rxjs/_esm2015/internal/operators/concat.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concat", function () { return _internal_operators_concat__WEBPACK_IMPORTED_MODULE_10__["concat"]; }); /* harmony import */ var _internal_operators_concatAll__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__( /*! ../internal/operators/concatAll */ "./node_modules/rxjs/_esm2015/internal/operators/concatAll.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatAll", function () { return _internal_operators_concatAll__WEBPACK_IMPORTED_MODULE_11__["concatAll"]; }); /* harmony import */ var _internal_operators_concatMap__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__( /*! ../internal/operators/concatMap */ "./node_modules/rxjs/_esm2015/internal/operators/concatMap.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatMap", function () { return _internal_operators_concatMap__WEBPACK_IMPORTED_MODULE_12__["concatMap"]; }); /* harmony import */ var _internal_operators_concatMapTo__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__( /*! ../internal/operators/concatMapTo */ "./node_modules/rxjs/_esm2015/internal/operators/concatMapTo.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatMapTo", function () { return _internal_operators_concatMapTo__WEBPACK_IMPORTED_MODULE_13__["concatMapTo"]; }); /* harmony import */ var _internal_operators_count__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__( /*! ../internal/operators/count */ "./node_modules/rxjs/_esm2015/internal/operators/count.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "count", function () { return _internal_operators_count__WEBPACK_IMPORTED_MODULE_14__["count"]; }); /* harmony import */ var _internal_operators_debounce__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__( /*! ../internal/operators/debounce */ "./node_modules/rxjs/_esm2015/internal/operators/debounce.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "debounce", function () { return _internal_operators_debounce__WEBPACK_IMPORTED_MODULE_15__["debounce"]; }); /* harmony import */ var _internal_operators_debounceTime__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__( /*! ../internal/operators/debounceTime */ "./node_modules/rxjs/_esm2015/internal/operators/debounceTime.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "debounceTime", function () { return _internal_operators_debounceTime__WEBPACK_IMPORTED_MODULE_16__["debounceTime"]; }); /* harmony import */ var _internal_operators_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__( /*! ../internal/operators/defaultIfEmpty */ "./node_modules/rxjs/_esm2015/internal/operators/defaultIfEmpty.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defaultIfEmpty", function () { return _internal_operators_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_17__["defaultIfEmpty"]; }); /* harmony import */ var _internal_operators_delay__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__( /*! ../internal/operators/delay */ "./node_modules/rxjs/_esm2015/internal/operators/delay.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "delay", function () { return _internal_operators_delay__WEBPACK_IMPORTED_MODULE_18__["delay"]; }); /* harmony import */ var _internal_operators_delayWhen__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__( /*! ../internal/operators/delayWhen */ "./node_modules/rxjs/_esm2015/internal/operators/delayWhen.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "delayWhen", function () { return _internal_operators_delayWhen__WEBPACK_IMPORTED_MODULE_19__["delayWhen"]; }); /* harmony import */ var _internal_operators_dematerialize__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__( /*! ../internal/operators/dematerialize */ "./node_modules/rxjs/_esm2015/internal/operators/dematerialize.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "dematerialize", function () { return _internal_operators_dematerialize__WEBPACK_IMPORTED_MODULE_20__["dematerialize"]; }); /* harmony import */ var _internal_operators_distinct__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__( /*! ../internal/operators/distinct */ "./node_modules/rxjs/_esm2015/internal/operators/distinct.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "distinct", function () { return _internal_operators_distinct__WEBPACK_IMPORTED_MODULE_21__["distinct"]; }); /* harmony import */ var _internal_operators_distinctUntilChanged__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__( /*! ../internal/operators/distinctUntilChanged */ "./node_modules/rxjs/_esm2015/internal/operators/distinctUntilChanged.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "distinctUntilChanged", function () { return _internal_operators_distinctUntilChanged__WEBPACK_IMPORTED_MODULE_22__["distinctUntilChanged"]; }); /* harmony import */ var _internal_operators_distinctUntilKeyChanged__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__( /*! ../internal/operators/distinctUntilKeyChanged */ "./node_modules/rxjs/_esm2015/internal/operators/distinctUntilKeyChanged.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "distinctUntilKeyChanged", function () { return _internal_operators_distinctUntilKeyChanged__WEBPACK_IMPORTED_MODULE_23__["distinctUntilKeyChanged"]; }); /* harmony import */ var _internal_operators_elementAt__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__( /*! ../internal/operators/elementAt */ "./node_modules/rxjs/_esm2015/internal/operators/elementAt.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "elementAt", function () { return _internal_operators_elementAt__WEBPACK_IMPORTED_MODULE_24__["elementAt"]; }); /* harmony import */ var _internal_operators_endWith__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__( /*! ../internal/operators/endWith */ "./node_modules/rxjs/_esm2015/internal/operators/endWith.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endWith", function () { return _internal_operators_endWith__WEBPACK_IMPORTED_MODULE_25__["endWith"]; }); /* harmony import */ var _internal_operators_every__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__( /*! ../internal/operators/every */ "./node_modules/rxjs/_esm2015/internal/operators/every.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "every", function () { return _internal_operators_every__WEBPACK_IMPORTED_MODULE_26__["every"]; }); /* harmony import */ var _internal_operators_exhaust__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__( /*! ../internal/operators/exhaust */ "./node_modules/rxjs/_esm2015/internal/operators/exhaust.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "exhaust", function () { return _internal_operators_exhaust__WEBPACK_IMPORTED_MODULE_27__["exhaust"]; }); /* harmony import */ var _internal_operators_exhaustMap__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__( /*! ../internal/operators/exhaustMap */ "./node_modules/rxjs/_esm2015/internal/operators/exhaustMap.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "exhaustMap", function () { return _internal_operators_exhaustMap__WEBPACK_IMPORTED_MODULE_28__["exhaustMap"]; }); /* harmony import */ var _internal_operators_expand__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__( /*! ../internal/operators/expand */ "./node_modules/rxjs/_esm2015/internal/operators/expand.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "expand", function () { return _internal_operators_expand__WEBPACK_IMPORTED_MODULE_29__["expand"]; }); /* harmony import */ var _internal_operators_filter__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__( /*! ../internal/operators/filter */ "./node_modules/rxjs/_esm2015/internal/operators/filter.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "filter", function () { return _internal_operators_filter__WEBPACK_IMPORTED_MODULE_30__["filter"]; }); /* harmony import */ var _internal_operators_finalize__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__( /*! ../internal/operators/finalize */ "./node_modules/rxjs/_esm2015/internal/operators/finalize.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "finalize", function () { return _internal_operators_finalize__WEBPACK_IMPORTED_MODULE_31__["finalize"]; }); /* harmony import */ var _internal_operators_find__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__( /*! ../internal/operators/find */ "./node_modules/rxjs/_esm2015/internal/operators/find.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "find", function () { return _internal_operators_find__WEBPACK_IMPORTED_MODULE_32__["find"]; }); /* harmony import */ var _internal_operators_findIndex__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__( /*! ../internal/operators/findIndex */ "./node_modules/rxjs/_esm2015/internal/operators/findIndex.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "findIndex", function () { return _internal_operators_findIndex__WEBPACK_IMPORTED_MODULE_33__["findIndex"]; }); /* harmony import */ var _internal_operators_first__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__( /*! ../internal/operators/first */ "./node_modules/rxjs/_esm2015/internal/operators/first.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "first", function () { return _internal_operators_first__WEBPACK_IMPORTED_MODULE_34__["first"]; }); /* harmony import */ var _internal_operators_groupBy__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__( /*! ../internal/operators/groupBy */ "./node_modules/rxjs/_esm2015/internal/operators/groupBy.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "groupBy", function () { return _internal_operators_groupBy__WEBPACK_IMPORTED_MODULE_35__["groupBy"]; }); /* harmony import */ var _internal_operators_ignoreElements__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__( /*! ../internal/operators/ignoreElements */ "./node_modules/rxjs/_esm2015/internal/operators/ignoreElements.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ignoreElements", function () { return _internal_operators_ignoreElements__WEBPACK_IMPORTED_MODULE_36__["ignoreElements"]; }); /* harmony import */ var _internal_operators_isEmpty__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__( /*! ../internal/operators/isEmpty */ "./node_modules/rxjs/_esm2015/internal/operators/isEmpty.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function () { return _internal_operators_isEmpty__WEBPACK_IMPORTED_MODULE_37__["isEmpty"]; }); /* harmony import */ var _internal_operators_last__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__( /*! ../internal/operators/last */ "./node_modules/rxjs/_esm2015/internal/operators/last.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "last", function () { return _internal_operators_last__WEBPACK_IMPORTED_MODULE_38__["last"]; }); /* harmony import */ var _internal_operators_map__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__( /*! ../internal/operators/map */ "./node_modules/rxjs/_esm2015/internal/operators/map.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "map", function () { return _internal_operators_map__WEBPACK_IMPORTED_MODULE_39__["map"]; }); /* harmony import */ var _internal_operators_mapTo__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__( /*! ../internal/operators/mapTo */ "./node_modules/rxjs/_esm2015/internal/operators/mapTo.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mapTo", function () { return _internal_operators_mapTo__WEBPACK_IMPORTED_MODULE_40__["mapTo"]; }); /* harmony import */ var _internal_operators_materialize__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__( /*! ../internal/operators/materialize */ "./node_modules/rxjs/_esm2015/internal/operators/materialize.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "materialize", function () { return _internal_operators_materialize__WEBPACK_IMPORTED_MODULE_41__["materialize"]; }); /* harmony import */ var _internal_operators_max__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__( /*! ../internal/operators/max */ "./node_modules/rxjs/_esm2015/internal/operators/max.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "max", function () { return _internal_operators_max__WEBPACK_IMPORTED_MODULE_42__["max"]; }); /* harmony import */ var _internal_operators_merge__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__( /*! ../internal/operators/merge */ "./node_modules/rxjs/_esm2015/internal/operators/merge.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "merge", function () { return _internal_operators_merge__WEBPACK_IMPORTED_MODULE_43__["merge"]; }); /* harmony import */ var _internal_operators_mergeAll__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__( /*! ../internal/operators/mergeAll */ "./node_modules/rxjs/_esm2015/internal/operators/mergeAll.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeAll", function () { return _internal_operators_mergeAll__WEBPACK_IMPORTED_MODULE_44__["mergeAll"]; }); /* harmony import */ var _internal_operators_mergeMap__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__( /*! ../internal/operators/mergeMap */ "./node_modules/rxjs/_esm2015/internal/operators/mergeMap.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeMap", function () { return _internal_operators_mergeMap__WEBPACK_IMPORTED_MODULE_45__["mergeMap"]; }); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "flatMap", function () { return _internal_operators_mergeMap__WEBPACK_IMPORTED_MODULE_45__["flatMap"]; }); /* harmony import */ var _internal_operators_mergeMapTo__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__( /*! ../internal/operators/mergeMapTo */ "./node_modules/rxjs/_esm2015/internal/operators/mergeMapTo.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeMapTo", function () { return _internal_operators_mergeMapTo__WEBPACK_IMPORTED_MODULE_46__["mergeMapTo"]; }); /* harmony import */ var _internal_operators_mergeScan__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__( /*! ../internal/operators/mergeScan */ "./node_modules/rxjs/_esm2015/internal/operators/mergeScan.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeScan", function () { return _internal_operators_mergeScan__WEBPACK_IMPORTED_MODULE_47__["mergeScan"]; }); /* harmony import */ var _internal_operators_min__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__( /*! ../internal/operators/min */ "./node_modules/rxjs/_esm2015/internal/operators/min.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "min", function () { return _internal_operators_min__WEBPACK_IMPORTED_MODULE_48__["min"]; }); /* harmony import */ var _internal_operators_multicast__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__( /*! ../internal/operators/multicast */ "./node_modules/rxjs/_esm2015/internal/operators/multicast.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "multicast", function () { return _internal_operators_multicast__WEBPACK_IMPORTED_MODULE_49__["multicast"]; }); /* harmony import */ var _internal_operators_observeOn__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__( /*! ../internal/operators/observeOn */ "./node_modules/rxjs/_esm2015/internal/operators/observeOn.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "observeOn", function () { return _internal_operators_observeOn__WEBPACK_IMPORTED_MODULE_50__["observeOn"]; }); /* harmony import */ var _internal_operators_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__( /*! ../internal/operators/onErrorResumeNext */ "./node_modules/rxjs/_esm2015/internal/operators/onErrorResumeNext.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "onErrorResumeNext", function () { return _internal_operators_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_51__["onErrorResumeNext"]; }); /* harmony import */ var _internal_operators_pairwise__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__( /*! ../internal/operators/pairwise */ "./node_modules/rxjs/_esm2015/internal/operators/pairwise.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pairwise", function () { return _internal_operators_pairwise__WEBPACK_IMPORTED_MODULE_52__["pairwise"]; }); /* harmony import */ var _internal_operators_partition__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__( /*! ../internal/operators/partition */ "./node_modules/rxjs/_esm2015/internal/operators/partition.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "partition", function () { return _internal_operators_partition__WEBPACK_IMPORTED_MODULE_53__["partition"]; }); /* harmony import */ var _internal_operators_pluck__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__( /*! ../internal/operators/pluck */ "./node_modules/rxjs/_esm2015/internal/operators/pluck.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pluck", function () { return _internal_operators_pluck__WEBPACK_IMPORTED_MODULE_54__["pluck"]; }); /* harmony import */ var _internal_operators_publish__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__( /*! ../internal/operators/publish */ "./node_modules/rxjs/_esm2015/internal/operators/publish.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publish", function () { return _internal_operators_publish__WEBPACK_IMPORTED_MODULE_55__["publish"]; }); /* harmony import */ var _internal_operators_publishBehavior__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__( /*! ../internal/operators/publishBehavior */ "./node_modules/rxjs/_esm2015/internal/operators/publishBehavior.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishBehavior", function () { return _internal_operators_publishBehavior__WEBPACK_IMPORTED_MODULE_56__["publishBehavior"]; }); /* harmony import */ var _internal_operators_publishLast__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__( /*! ../internal/operators/publishLast */ "./node_modules/rxjs/_esm2015/internal/operators/publishLast.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishLast", function () { return _internal_operators_publishLast__WEBPACK_IMPORTED_MODULE_57__["publishLast"]; }); /* harmony import */ var _internal_operators_publishReplay__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__( /*! ../internal/operators/publishReplay */ "./node_modules/rxjs/_esm2015/internal/operators/publishReplay.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishReplay", function () { return _internal_operators_publishReplay__WEBPACK_IMPORTED_MODULE_58__["publishReplay"]; }); /* harmony import */ var _internal_operators_race__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__( /*! ../internal/operators/race */ "./node_modules/rxjs/_esm2015/internal/operators/race.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "race", function () { return _internal_operators_race__WEBPACK_IMPORTED_MODULE_59__["race"]; }); /* harmony import */ var _internal_operators_reduce__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__( /*! ../internal/operators/reduce */ "./node_modules/rxjs/_esm2015/internal/operators/reduce.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "reduce", function () { return _internal_operators_reduce__WEBPACK_IMPORTED_MODULE_60__["reduce"]; }); /* harmony import */ var _internal_operators_repeat__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__( /*! ../internal/operators/repeat */ "./node_modules/rxjs/_esm2015/internal/operators/repeat.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "repeat", function () { return _internal_operators_repeat__WEBPACK_IMPORTED_MODULE_61__["repeat"]; }); /* harmony import */ var _internal_operators_repeatWhen__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__( /*! ../internal/operators/repeatWhen */ "./node_modules/rxjs/_esm2015/internal/operators/repeatWhen.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "repeatWhen", function () { return _internal_operators_repeatWhen__WEBPACK_IMPORTED_MODULE_62__["repeatWhen"]; }); /* harmony import */ var _internal_operators_retry__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__( /*! ../internal/operators/retry */ "./node_modules/rxjs/_esm2015/internal/operators/retry.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "retry", function () { return _internal_operators_retry__WEBPACK_IMPORTED_MODULE_63__["retry"]; }); /* harmony import */ var _internal_operators_retryWhen__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__( /*! ../internal/operators/retryWhen */ "./node_modules/rxjs/_esm2015/internal/operators/retryWhen.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "retryWhen", function () { return _internal_operators_retryWhen__WEBPACK_IMPORTED_MODULE_64__["retryWhen"]; }); /* harmony import */ var _internal_operators_refCount__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__( /*! ../internal/operators/refCount */ "./node_modules/rxjs/_esm2015/internal/operators/refCount.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "refCount", function () { return _internal_operators_refCount__WEBPACK_IMPORTED_MODULE_65__["refCount"]; }); /* harmony import */ var _internal_operators_sample__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__( /*! ../internal/operators/sample */ "./node_modules/rxjs/_esm2015/internal/operators/sample.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sample", function () { return _internal_operators_sample__WEBPACK_IMPORTED_MODULE_66__["sample"]; }); /* harmony import */ var _internal_operators_sampleTime__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__( /*! ../internal/operators/sampleTime */ "./node_modules/rxjs/_esm2015/internal/operators/sampleTime.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sampleTime", function () { return _internal_operators_sampleTime__WEBPACK_IMPORTED_MODULE_67__["sampleTime"]; }); /* harmony import */ var _internal_operators_scan__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__( /*! ../internal/operators/scan */ "./node_modules/rxjs/_esm2015/internal/operators/scan.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "scan", function () { return _internal_operators_scan__WEBPACK_IMPORTED_MODULE_68__["scan"]; }); /* harmony import */ var _internal_operators_sequenceEqual__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__( /*! ../internal/operators/sequenceEqual */ "./node_modules/rxjs/_esm2015/internal/operators/sequenceEqual.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sequenceEqual", function () { return _internal_operators_sequenceEqual__WEBPACK_IMPORTED_MODULE_69__["sequenceEqual"]; }); /* harmony import */ var _internal_operators_share__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__( /*! ../internal/operators/share */ "./node_modules/rxjs/_esm2015/internal/operators/share.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "share", function () { return _internal_operators_share__WEBPACK_IMPORTED_MODULE_70__["share"]; }); /* harmony import */ var _internal_operators_shareReplay__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__( /*! ../internal/operators/shareReplay */ "./node_modules/rxjs/_esm2015/internal/operators/shareReplay.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "shareReplay", function () { return _internal_operators_shareReplay__WEBPACK_IMPORTED_MODULE_71__["shareReplay"]; }); /* harmony import */ var _internal_operators_single__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__( /*! ../internal/operators/single */ "./node_modules/rxjs/_esm2015/internal/operators/single.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "single", function () { return _internal_operators_single__WEBPACK_IMPORTED_MODULE_72__["single"]; }); /* harmony import */ var _internal_operators_skip__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__( /*! ../internal/operators/skip */ "./node_modules/rxjs/_esm2015/internal/operators/skip.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skip", function () { return _internal_operators_skip__WEBPACK_IMPORTED_MODULE_73__["skip"]; }); /* harmony import */ var _internal_operators_skipLast__WEBPACK_IMPORTED_MODULE_74__ = __webpack_require__( /*! ../internal/operators/skipLast */ "./node_modules/rxjs/_esm2015/internal/operators/skipLast.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skipLast", function () { return _internal_operators_skipLast__WEBPACK_IMPORTED_MODULE_74__["skipLast"]; }); /* harmony import */ var _internal_operators_skipUntil__WEBPACK_IMPORTED_MODULE_75__ = __webpack_require__( /*! ../internal/operators/skipUntil */ "./node_modules/rxjs/_esm2015/internal/operators/skipUntil.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skipUntil", function () { return _internal_operators_skipUntil__WEBPACK_IMPORTED_MODULE_75__["skipUntil"]; }); /* harmony import */ var _internal_operators_skipWhile__WEBPACK_IMPORTED_MODULE_76__ = __webpack_require__( /*! ../internal/operators/skipWhile */ "./node_modules/rxjs/_esm2015/internal/operators/skipWhile.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skipWhile", function () { return _internal_operators_skipWhile__WEBPACK_IMPORTED_MODULE_76__["skipWhile"]; }); /* harmony import */ var _internal_operators_startWith__WEBPACK_IMPORTED_MODULE_77__ = __webpack_require__( /*! ../internal/operators/startWith */ "./node_modules/rxjs/_esm2015/internal/operators/startWith.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startWith", function () { return _internal_operators_startWith__WEBPACK_IMPORTED_MODULE_77__["startWith"]; }); /* harmony import */ var _internal_operators_subscribeOn__WEBPACK_IMPORTED_MODULE_78__ = __webpack_require__( /*! ../internal/operators/subscribeOn */ "./node_modules/rxjs/_esm2015/internal/operators/subscribeOn.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "subscribeOn", function () { return _internal_operators_subscribeOn__WEBPACK_IMPORTED_MODULE_78__["subscribeOn"]; }); /* harmony import */ var _internal_operators_switchAll__WEBPACK_IMPORTED_MODULE_79__ = __webpack_require__( /*! ../internal/operators/switchAll */ "./node_modules/rxjs/_esm2015/internal/operators/switchAll.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "switchAll", function () { return _internal_operators_switchAll__WEBPACK_IMPORTED_MODULE_79__["switchAll"]; }); /* harmony import */ var _internal_operators_switchMap__WEBPACK_IMPORTED_MODULE_80__ = __webpack_require__( /*! ../internal/operators/switchMap */ "./node_modules/rxjs/_esm2015/internal/operators/switchMap.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "switchMap", function () { return _internal_operators_switchMap__WEBPACK_IMPORTED_MODULE_80__["switchMap"]; }); /* harmony import */ var _internal_operators_switchMapTo__WEBPACK_IMPORTED_MODULE_81__ = __webpack_require__( /*! ../internal/operators/switchMapTo */ "./node_modules/rxjs/_esm2015/internal/operators/switchMapTo.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "switchMapTo", function () { return _internal_operators_switchMapTo__WEBPACK_IMPORTED_MODULE_81__["switchMapTo"]; }); /* harmony import */ var _internal_operators_take__WEBPACK_IMPORTED_MODULE_82__ = __webpack_require__( /*! ../internal/operators/take */ "./node_modules/rxjs/_esm2015/internal/operators/take.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "take", function () { return _internal_operators_take__WEBPACK_IMPORTED_MODULE_82__["take"]; }); /* harmony import */ var _internal_operators_takeLast__WEBPACK_IMPORTED_MODULE_83__ = __webpack_require__( /*! ../internal/operators/takeLast */ "./node_modules/rxjs/_esm2015/internal/operators/takeLast.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "takeLast", function () { return _internal_operators_takeLast__WEBPACK_IMPORTED_MODULE_83__["takeLast"]; }); /* harmony import */ var _internal_operators_takeUntil__WEBPACK_IMPORTED_MODULE_84__ = __webpack_require__( /*! ../internal/operators/takeUntil */ "./node_modules/rxjs/_esm2015/internal/operators/takeUntil.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "takeUntil", function () { return _internal_operators_takeUntil__WEBPACK_IMPORTED_MODULE_84__["takeUntil"]; }); /* harmony import */ var _internal_operators_takeWhile__WEBPACK_IMPORTED_MODULE_85__ = __webpack_require__( /*! ../internal/operators/takeWhile */ "./node_modules/rxjs/_esm2015/internal/operators/takeWhile.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "takeWhile", function () { return _internal_operators_takeWhile__WEBPACK_IMPORTED_MODULE_85__["takeWhile"]; }); /* harmony import */ var _internal_operators_tap__WEBPACK_IMPORTED_MODULE_86__ = __webpack_require__( /*! ../internal/operators/tap */ "./node_modules/rxjs/_esm2015/internal/operators/tap.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "tap", function () { return _internal_operators_tap__WEBPACK_IMPORTED_MODULE_86__["tap"]; }); /* harmony import */ var _internal_operators_throttle__WEBPACK_IMPORTED_MODULE_87__ = __webpack_require__( /*! ../internal/operators/throttle */ "./node_modules/rxjs/_esm2015/internal/operators/throttle.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throttle", function () { return _internal_operators_throttle__WEBPACK_IMPORTED_MODULE_87__["throttle"]; }); /* harmony import */ var _internal_operators_throttleTime__WEBPACK_IMPORTED_MODULE_88__ = __webpack_require__( /*! ../internal/operators/throttleTime */ "./node_modules/rxjs/_esm2015/internal/operators/throttleTime.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throttleTime", function () { return _internal_operators_throttleTime__WEBPACK_IMPORTED_MODULE_88__["throttleTime"]; }); /* harmony import */ var _internal_operators_throwIfEmpty__WEBPACK_IMPORTED_MODULE_89__ = __webpack_require__( /*! ../internal/operators/throwIfEmpty */ "./node_modules/rxjs/_esm2015/internal/operators/throwIfEmpty.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throwIfEmpty", function () { return _internal_operators_throwIfEmpty__WEBPACK_IMPORTED_MODULE_89__["throwIfEmpty"]; }); /* harmony import */ var _internal_operators_timeInterval__WEBPACK_IMPORTED_MODULE_90__ = __webpack_require__( /*! ../internal/operators/timeInterval */ "./node_modules/rxjs/_esm2015/internal/operators/timeInterval.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timeInterval", function () { return _internal_operators_timeInterval__WEBPACK_IMPORTED_MODULE_90__["timeInterval"]; }); /* harmony import */ var _internal_operators_timeout__WEBPACK_IMPORTED_MODULE_91__ = __webpack_require__( /*! ../internal/operators/timeout */ "./node_modules/rxjs/_esm2015/internal/operators/timeout.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timeout", function () { return _internal_operators_timeout__WEBPACK_IMPORTED_MODULE_91__["timeout"]; }); /* harmony import */ var _internal_operators_timeoutWith__WEBPACK_IMPORTED_MODULE_92__ = __webpack_require__( /*! ../internal/operators/timeoutWith */ "./node_modules/rxjs/_esm2015/internal/operators/timeoutWith.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timeoutWith", function () { return _internal_operators_timeoutWith__WEBPACK_IMPORTED_MODULE_92__["timeoutWith"]; }); /* harmony import */ var _internal_operators_timestamp__WEBPACK_IMPORTED_MODULE_93__ = __webpack_require__( /*! ../internal/operators/timestamp */ "./node_modules/rxjs/_esm2015/internal/operators/timestamp.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timestamp", function () { return _internal_operators_timestamp__WEBPACK_IMPORTED_MODULE_93__["timestamp"]; }); /* harmony import */ var _internal_operators_toArray__WEBPACK_IMPORTED_MODULE_94__ = __webpack_require__( /*! ../internal/operators/toArray */ "./node_modules/rxjs/_esm2015/internal/operators/toArray.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toArray", function () { return _internal_operators_toArray__WEBPACK_IMPORTED_MODULE_94__["toArray"]; }); /* harmony import */ var _internal_operators_window__WEBPACK_IMPORTED_MODULE_95__ = __webpack_require__( /*! ../internal/operators/window */ "./node_modules/rxjs/_esm2015/internal/operators/window.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "window", function () { return _internal_operators_window__WEBPACK_IMPORTED_MODULE_95__["window"]; }); /* harmony import */ var _internal_operators_windowCount__WEBPACK_IMPORTED_MODULE_96__ = __webpack_require__( /*! ../internal/operators/windowCount */ "./node_modules/rxjs/_esm2015/internal/operators/windowCount.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowCount", function () { return _internal_operators_windowCount__WEBPACK_IMPORTED_MODULE_96__["windowCount"]; }); /* harmony import */ var _internal_operators_windowTime__WEBPACK_IMPORTED_MODULE_97__ = __webpack_require__( /*! ../internal/operators/windowTime */ "./node_modules/rxjs/_esm2015/internal/operators/windowTime.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowTime", function () { return _internal_operators_windowTime__WEBPACK_IMPORTED_MODULE_97__["windowTime"]; }); /* harmony import */ var _internal_operators_windowToggle__WEBPACK_IMPORTED_MODULE_98__ = __webpack_require__( /*! ../internal/operators/windowToggle */ "./node_modules/rxjs/_esm2015/internal/operators/windowToggle.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowToggle", function () { return _internal_operators_windowToggle__WEBPACK_IMPORTED_MODULE_98__["windowToggle"]; }); /* harmony import */ var _internal_operators_windowWhen__WEBPACK_IMPORTED_MODULE_99__ = __webpack_require__( /*! ../internal/operators/windowWhen */ "./node_modules/rxjs/_esm2015/internal/operators/windowWhen.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowWhen", function () { return _internal_operators_windowWhen__WEBPACK_IMPORTED_MODULE_99__["windowWhen"]; }); /* harmony import */ var _internal_operators_withLatestFrom__WEBPACK_IMPORTED_MODULE_100__ = __webpack_require__( /*! ../internal/operators/withLatestFrom */ "./node_modules/rxjs/_esm2015/internal/operators/withLatestFrom.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "withLatestFrom", function () { return _internal_operators_withLatestFrom__WEBPACK_IMPORTED_MODULE_100__["withLatestFrom"]; }); /* harmony import */ var _internal_operators_zip__WEBPACK_IMPORTED_MODULE_101__ = __webpack_require__( /*! ../internal/operators/zip */ "./node_modules/rxjs/_esm2015/internal/operators/zip.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "zip", function () { return _internal_operators_zip__WEBPACK_IMPORTED_MODULE_101__["zip"]; }); /* harmony import */ var _internal_operators_zipAll__WEBPACK_IMPORTED_MODULE_102__ = __webpack_require__( /*! ../internal/operators/zipAll */ "./node_modules/rxjs/_esm2015/internal/operators/zipAll.js"); /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "zipAll", function () { return _internal_operators_zipAll__WEBPACK_IMPORTED_MODULE_102__["zipAll"]; }); //# sourceMappingURL=index.js.map /***/ } }]); //# sourceMappingURL=vendor-es5.js.map