UNPKG

248 kBJavaScriptView Raw
1/**
2 * @license Angular v9.0.3
3 * (c) 2010-2020 Google LLC. https://angular.io/
4 * License: MIT
5 */
6
7(function (global, factory) {
8 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) :
9 typeof define === 'function' && define.amd ? define('@angular/common', ['exports', '@angular/core'], factory) :
10 (global = global || self, factory((global.ng = global.ng || {}, global.ng.common = {}), global.ng.core));
11}(this, (function (exports, i0) { 'use strict';
12
13 /**
14 * @license
15 * Copyright Google Inc. All Rights Reserved.
16 *
17 * Use of this source code is governed by an MIT-style license that can be
18 * found in the LICENSE file at https://angular.io/license
19 */
20 var _DOM = null;
21 function getDOM() {
22 return _DOM;
23 }
24 function setDOM(adapter) {
25 _DOM = adapter;
26 }
27 function setRootDomAdapter(adapter) {
28 if (!_DOM) {
29 _DOM = adapter;
30 }
31 }
32 /* tslint:disable:requireParameterType */
33 /**
34 * Provides DOM operations in an environment-agnostic way.
35 *
36 * @security Tread carefully! Interacting with the DOM directly is dangerous and
37 * can introduce XSS risks.
38 */
39 var DomAdapter = /** @class */ (function () {
40 function DomAdapter() {
41 }
42 return DomAdapter;
43 }());
44
45 /*! *****************************************************************************
46 Copyright (c) Microsoft Corporation. All rights reserved.
47 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
48 this file except in compliance with the License. You may obtain a copy of the
49 License at http://www.apache.org/licenses/LICENSE-2.0
50
51 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
52 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
53 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
54 MERCHANTABLITY OR NON-INFRINGEMENT.
55
56 See the Apache Version 2.0 License for specific language governing permissions
57 and limitations under the License.
58 ***************************************************************************** */
59 /* global Reflect, Promise */
60
61 var extendStatics = function(d, b) {
62 extendStatics = Object.setPrototypeOf ||
63 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
64 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
65 return extendStatics(d, b);
66 };
67
68 function __extends(d, b) {
69 extendStatics(d, b);
70 function __() { this.constructor = d; }
71 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
72 }
73
74 var __assign = function() {
75 __assign = Object.assign || function __assign(t) {
76 for (var s, i = 1, n = arguments.length; i < n; i++) {
77 s = arguments[i];
78 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
79 }
80 return t;
81 };
82 return __assign.apply(this, arguments);
83 };
84
85 function __rest(s, e) {
86 var t = {};
87 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
88 t[p] = s[p];
89 if (s != null && typeof Object.getOwnPropertySymbols === "function")
90 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
91 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
92 t[p[i]] = s[p[i]];
93 }
94 return t;
95 }
96
97 function __decorate(decorators, target, key, desc) {
98 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
99 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
100 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
101 return c > 3 && r && Object.defineProperty(target, key, r), r;
102 }
103
104 function __param(paramIndex, decorator) {
105 return function (target, key) { decorator(target, key, paramIndex); }
106 }
107
108 function __metadata(metadataKey, metadataValue) {
109 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
110 }
111
112 function __awaiter(thisArg, _arguments, P, generator) {
113 return new (P || (P = Promise))(function (resolve, reject) {
114 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
115 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
116 function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
117 step((generator = generator.apply(thisArg, _arguments || [])).next());
118 });
119 }
120
121 function __generator(thisArg, body) {
122 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
123 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
124 function verb(n) { return function (v) { return step([n, v]); }; }
125 function step(op) {
126 if (f) throw new TypeError("Generator is already executing.");
127 while (_) try {
128 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
129 if (y = 0, t) op = [op[0] & 2, t.value];
130 switch (op[0]) {
131 case 0: case 1: t = op; break;
132 case 4: _.label++; return { value: op[1], done: false };
133 case 5: _.label++; y = op[1]; op = [0]; continue;
134 case 7: op = _.ops.pop(); _.trys.pop(); continue;
135 default:
136 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
137 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
138 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
139 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
140 if (t[2]) _.ops.pop();
141 _.trys.pop(); continue;
142 }
143 op = body.call(thisArg, _);
144 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
145 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
146 }
147 }
148
149 function __exportStar(m, exports) {
150 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
151 }
152
153 function __values(o) {
154 var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
155 if (m) return m.call(o);
156 return {
157 next: function () {
158 if (o && i >= o.length) o = void 0;
159 return { value: o && o[i++], done: !o };
160 }
161 };
162 }
163
164 function __read(o, n) {
165 var m = typeof Symbol === "function" && o[Symbol.iterator];
166 if (!m) return o;
167 var i = m.call(o), r, ar = [], e;
168 try {
169 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
170 }
171 catch (error) { e = { error: error }; }
172 finally {
173 try {
174 if (r && !r.done && (m = i["return"])) m.call(i);
175 }
176 finally { if (e) throw e.error; }
177 }
178 return ar;
179 }
180
181 function __spread() {
182 for (var ar = [], i = 0; i < arguments.length; i++)
183 ar = ar.concat(__read(arguments[i]));
184 return ar;
185 }
186
187 function __spreadArrays() {
188 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
189 for (var r = Array(s), k = 0, i = 0; i < il; i++)
190 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
191 r[k] = a[j];
192 return r;
193 };
194
195 function __await(v) {
196 return this instanceof __await ? (this.v = v, this) : new __await(v);
197 }
198
199 function __asyncGenerator(thisArg, _arguments, generator) {
200 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
201 var g = generator.apply(thisArg, _arguments || []), i, q = [];
202 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
203 function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
204 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
205 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
206 function fulfill(value) { resume("next", value); }
207 function reject(value) { resume("throw", value); }
208 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
209 }
210
211 function __asyncDelegator(o) {
212 var i, p;
213 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
214 function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
215 }
216
217 function __asyncValues(o) {
218 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
219 var m = o[Symbol.asyncIterator], i;
220 return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
221 function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
222 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
223 }
224
225 function __makeTemplateObject(cooked, raw) {
226 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
227 return cooked;
228 };
229
230 function __importStar(mod) {
231 if (mod && mod.__esModule) return mod;
232 var result = {};
233 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
234 result.default = mod;
235 return result;
236 }
237
238 function __importDefault(mod) {
239 return (mod && mod.__esModule) ? mod : { default: mod };
240 }
241
242 /**
243 * @license
244 * Copyright Google Inc. All Rights Reserved.
245 *
246 * Use of this source code is governed by an MIT-style license that can be
247 * found in the LICENSE file at https://angular.io/license
248 */
249 /**
250 * A DI Token representing the main rendering context. In a browser this is the DOM Document.
251 *
252 * Note: Document might not be available in the Application Context when Application and Rendering
253 * Contexts are not the same (e.g. when running the application in a Web Worker).
254 *
255 * @publicApi
256 */
257 var DOCUMENT = new i0.InjectionToken('DocumentToken');
258
259 /**
260 * This class should not be used directly by an application developer. Instead, use
261 * {@link Location}.
262 *
263 * `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform
264 * agnostic.
265 * This means that we can have different implementation of `PlatformLocation` for the different
266 * platforms that angular supports. For example, `@angular/platform-browser` provides an
267 * implementation specific to the browser environment, while `@angular/platform-webworker` provides
268 * one suitable for use with web workers.
269 *
270 * The `PlatformLocation` class is used directly by all implementations of {@link LocationStrategy}
271 * when they need to interact with the DOM apis like pushState, popState, etc...
272 *
273 * {@link LocationStrategy} in turn is used by the {@link Location} service which is used directly
274 * by the {@link Router} in order to navigate between routes. Since all interactions between {@link
275 * Router} /
276 * {@link Location} / {@link LocationStrategy} and DOM apis flow through the `PlatformLocation`
277 * class they are all platform independent.
278 *
279 * @publicApi
280 */
281 var PlatformLocation = /** @class */ (function () {
282 function PlatformLocation() {
283 }
284 PlatformLocation.ɵprov = i0.ɵɵdefineInjectable({ factory: useBrowserPlatformLocation, token: PlatformLocation, providedIn: "platform" });
285 PlatformLocation = __decorate([
286 i0.Injectable({
287 providedIn: 'platform',
288 // See #23917
289 useFactory: useBrowserPlatformLocation
290 })
291 ], PlatformLocation);
292 return PlatformLocation;
293 }());
294 function useBrowserPlatformLocation() {
295 return i0.ɵɵinject(BrowserPlatformLocation);
296 }
297 /**
298 * @description
299 * Indicates when a location is initialized.
300 *
301 * @publicApi
302 */
303 var LOCATION_INITIALIZED = new i0.InjectionToken('Location Initialized');
304 /**
305 * `PlatformLocation` encapsulates all of the direct calls to platform APIs.
306 * This class should not be used directly by an application developer. Instead, use
307 * {@link Location}.
308 */
309 var BrowserPlatformLocation = /** @class */ (function (_super) {
310 __extends(BrowserPlatformLocation, _super);
311 function BrowserPlatformLocation(_doc) {
312 var _this = _super.call(this) || this;
313 _this._doc = _doc;
314 _this._init();
315 return _this;
316 }
317 // This is moved to its own method so that `MockPlatformLocationStrategy` can overwrite it
318 /** @internal */
319 BrowserPlatformLocation.prototype._init = function () {
320 this.location = getDOM().getLocation();
321 this._history = getDOM().getHistory();
322 };
323 BrowserPlatformLocation.prototype.getBaseHrefFromDOM = function () { return getDOM().getBaseHref(this._doc); };
324 BrowserPlatformLocation.prototype.onPopState = function (fn) {
325 getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('popstate', fn, false);
326 };
327 BrowserPlatformLocation.prototype.onHashChange = function (fn) {
328 getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('hashchange', fn, false);
329 };
330 Object.defineProperty(BrowserPlatformLocation.prototype, "href", {
331 get: function () { return this.location.href; },
332 enumerable: true,
333 configurable: true
334 });
335 Object.defineProperty(BrowserPlatformLocation.prototype, "protocol", {
336 get: function () { return this.location.protocol; },
337 enumerable: true,
338 configurable: true
339 });
340 Object.defineProperty(BrowserPlatformLocation.prototype, "hostname", {
341 get: function () { return this.location.hostname; },
342 enumerable: true,
343 configurable: true
344 });
345 Object.defineProperty(BrowserPlatformLocation.prototype, "port", {
346 get: function () { return this.location.port; },
347 enumerable: true,
348 configurable: true
349 });
350 Object.defineProperty(BrowserPlatformLocation.prototype, "pathname", {
351 get: function () { return this.location.pathname; },
352 set: function (newPath) { this.location.pathname = newPath; },
353 enumerable: true,
354 configurable: true
355 });
356 Object.defineProperty(BrowserPlatformLocation.prototype, "search", {
357 get: function () { return this.location.search; },
358 enumerable: true,
359 configurable: true
360 });
361 Object.defineProperty(BrowserPlatformLocation.prototype, "hash", {
362 get: function () { return this.location.hash; },
363 enumerable: true,
364 configurable: true
365 });
366 BrowserPlatformLocation.prototype.pushState = function (state, title, url) {
367 if (supportsState()) {
368 this._history.pushState(state, title, url);
369 }
370 else {
371 this.location.hash = url;
372 }
373 };
374 BrowserPlatformLocation.prototype.replaceState = function (state, title, url) {
375 if (supportsState()) {
376 this._history.replaceState(state, title, url);
377 }
378 else {
379 this.location.hash = url;
380 }
381 };
382 BrowserPlatformLocation.prototype.forward = function () { this._history.forward(); };
383 BrowserPlatformLocation.prototype.back = function () { this._history.back(); };
384 BrowserPlatformLocation.prototype.getState = function () { return this._history.state; };
385 BrowserPlatformLocation.ɵprov = i0.ɵɵdefineInjectable({ factory: createBrowserPlatformLocation, token: BrowserPlatformLocation, providedIn: "platform" });
386 BrowserPlatformLocation = __decorate([
387 i0.Injectable({
388 providedIn: 'platform',
389 // See #23917
390 useFactory: createBrowserPlatformLocation,
391 }),
392 __param(0, i0.Inject(DOCUMENT)),
393 __metadata("design:paramtypes", [Object])
394 ], BrowserPlatformLocation);
395 return BrowserPlatformLocation;
396 }(PlatformLocation));
397 function supportsState() {
398 return !!window.history.pushState;
399 }
400 function createBrowserPlatformLocation() {
401 return new BrowserPlatformLocation(i0.ɵɵinject(DOCUMENT));
402 }
403
404 /**
405 * @license
406 * Copyright Google Inc. All Rights Reserved.
407 *
408 * Use of this source code is governed by an MIT-style license that can be
409 * found in the LICENSE file at https://angular.io/license
410 */
411
412 /**
413 * @license
414 * Copyright Google Inc. All Rights Reserved.
415 *
416 * Use of this source code is governed by an MIT-style license that can be
417 * found in the LICENSE file at https://angular.io/license
418 */
419 /**
420 * Joins two parts of a URL with a slash if needed.
421 *
422 * @param start URL string
423 * @param end URL string
424 *
425 *
426 * @returns The joined URL string.
427 */
428 function joinWithSlash(start, end) {
429 if (start.length == 0) {
430 return end;
431 }
432 if (end.length == 0) {
433 return start;
434 }
435 var slashes = 0;
436 if (start.endsWith('/')) {
437 slashes++;
438 }
439 if (end.startsWith('/')) {
440 slashes++;
441 }
442 if (slashes == 2) {
443 return start + end.substring(1);
444 }
445 if (slashes == 1) {
446 return start + end;
447 }
448 return start + '/' + end;
449 }
450 /**
451 * Removes a trailing slash from a URL string if needed.
452 * Looks for the first occurrence of either `#`, `?`, or the end of the
453 * line as `/` characters and removes the trailing slash if one exists.
454 *
455 * @param url URL string.
456 *
457 * @returns The URL string, modified if needed.
458 */
459 function stripTrailingSlash(url) {
460 var match = url.match(/#|\?|$/);
461 var pathEndIdx = match && match.index || url.length;
462 var droppedSlashIdx = pathEndIdx - (url[pathEndIdx - 1] === '/' ? 1 : 0);
463 return url.slice(0, droppedSlashIdx) + url.slice(pathEndIdx);
464 }
465 /**
466 * Normalizes URL parameters by prepending with `?` if needed.
467 *
468 * @param params String of URL parameters.
469 *
470 * @returns The normalized URL parameters string.
471 */
472 function normalizeQueryParams(params) {
473 return params && params[0] !== '?' ? '?' + params : params;
474 }
475
476 /**
477 * Enables the `Location` service to read route state from the browser's URL.
478 * Angular provides two strategies:
479 * `HashLocationStrategy` and `PathLocationStrategy`.
480 *
481 * Applications should use the `Router` or `Location` services to
482 * interact with application route state.
483 *
484 * For instance, `HashLocationStrategy` produces URLs like
485 * <code class="no-auto-link">http://example.com#/foo</code>,
486 * and `PathLocationStrategy` produces
487 * <code class="no-auto-link">http://example.com/foo</code> as an equivalent URL.
488 *
489 * See these two classes for more.
490 *
491 * @publicApi
492 */
493 var LocationStrategy = /** @class */ (function () {
494 function LocationStrategy() {
495 }
496 LocationStrategy.ɵprov = i0.ɵɵdefineInjectable({ factory: provideLocationStrategy, token: LocationStrategy, providedIn: "root" });
497 LocationStrategy = __decorate([
498 i0.Injectable({ providedIn: 'root', useFactory: provideLocationStrategy })
499 ], LocationStrategy);
500 return LocationStrategy;
501 }());
502 function provideLocationStrategy(platformLocation) {
503 // See #23917
504 var location = i0.ɵɵinject(DOCUMENT).location;
505 return new PathLocationStrategy(i0.ɵɵinject(PlatformLocation), location && location.origin || '');
506 }
507 /**
508 * A predefined [DI token](guide/glossary#di-token) for the base href
509 * to be used with the `PathLocationStrategy`.
510 * The base href is the URL prefix that should be preserved when generating
511 * and recognizing URLs.
512 *
513 * @usageNotes
514 *
515 * The following example shows how to use this token to configure the root app injector
516 * with a base href value, so that the DI framework can supply the dependency anywhere in the app.
517 *
518 * ```typescript
519 * import {Component, NgModule} from '@angular/core';
520 * import {APP_BASE_HREF} from '@angular/common';
521 *
522 * @NgModule({
523 * providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]
524 * })
525 * class AppModule {}
526 * ```
527 *
528 * @publicApi
529 */
530 var APP_BASE_HREF = new i0.InjectionToken('appBaseHref');
531 /**
532 * @description
533 * A {@link LocationStrategy} used to configure the {@link Location} service to
534 * represent its state in the
535 * [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the
536 * browser's URL.
537 *
538 * If you're using `PathLocationStrategy`, you must provide a {@link APP_BASE_HREF}
539 * or add a base element to the document. This URL prefix that will be preserved
540 * when generating and recognizing URLs.
541 *
542 * For instance, if you provide an `APP_BASE_HREF` of `'/my/app'` and call
543 * `location.go('/foo')`, the browser's URL will become
544 * `example.com/my/app/foo`.
545 *
546 * Similarly, if you add `<base href='/my/app'/>` to the document and call
547 * `location.go('/foo')`, the browser's URL will become
548 * `example.com/my/app/foo`.
549 *
550 * @usageNotes
551 *
552 * ### Example
553 *
554 * {@example common/location/ts/path_location_component.ts region='LocationComponent'}
555 *
556 * @publicApi
557 */
558 var PathLocationStrategy = /** @class */ (function (_super) {
559 __extends(PathLocationStrategy, _super);
560 function PathLocationStrategy(_platformLocation, href) {
561 var _this = _super.call(this) || this;
562 _this._platformLocation = _platformLocation;
563 if (href == null) {
564 href = _this._platformLocation.getBaseHrefFromDOM();
565 }
566 if (href == null) {
567 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.");
568 }
569 _this._baseHref = href;
570 return _this;
571 }
572 PathLocationStrategy.prototype.onPopState = function (fn) {
573 this._platformLocation.onPopState(fn);
574 this._platformLocation.onHashChange(fn);
575 };
576 PathLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; };
577 PathLocationStrategy.prototype.prepareExternalUrl = function (internal) { return joinWithSlash(this._baseHref, internal); };
578 PathLocationStrategy.prototype.path = function (includeHash) {
579 if (includeHash === void 0) { includeHash = false; }
580 var pathname = this._platformLocation.pathname + normalizeQueryParams(this._platformLocation.search);
581 var hash = this._platformLocation.hash;
582 return hash && includeHash ? "" + pathname + hash : pathname;
583 };
584 PathLocationStrategy.prototype.pushState = function (state, title, url, queryParams) {
585 var externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));
586 this._platformLocation.pushState(state, title, externalUrl);
587 };
588 PathLocationStrategy.prototype.replaceState = function (state, title, url, queryParams) {
589 var externalUrl = this.prepareExternalUrl(url + normalizeQueryParams(queryParams));
590 this._platformLocation.replaceState(state, title, externalUrl);
591 };
592 PathLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); };
593 PathLocationStrategy.prototype.back = function () { this._platformLocation.back(); };
594 PathLocationStrategy = __decorate([
595 i0.Injectable(),
596 __param(1, i0.Optional()), __param(1, i0.Inject(APP_BASE_HREF)),
597 __metadata("design:paramtypes", [PlatformLocation, String])
598 ], PathLocationStrategy);
599 return PathLocationStrategy;
600 }(LocationStrategy));
601
602 /**
603 * @license
604 * Copyright Google Inc. All Rights Reserved.
605 *
606 * Use of this source code is governed by an MIT-style license that can be
607 * found in the LICENSE file at https://angular.io/license
608 */
609 /**
610 * @description
611 * A {@link LocationStrategy} used to configure the {@link Location} service to
612 * represent its state in the
613 * [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax)
614 * of the browser's URL.
615 *
616 * For instance, if you call `location.go('/foo')`, the browser's URL will become
617 * `example.com#/foo`.
618 *
619 * @usageNotes
620 *
621 * ### Example
622 *
623 * {@example common/location/ts/hash_location_component.ts region='LocationComponent'}
624 *
625 * @publicApi
626 */
627 var HashLocationStrategy = /** @class */ (function (_super) {
628 __extends(HashLocationStrategy, _super);
629 function HashLocationStrategy(_platformLocation, _baseHref) {
630 var _this = _super.call(this) || this;
631 _this._platformLocation = _platformLocation;
632 _this._baseHref = '';
633 if (_baseHref != null) {
634 _this._baseHref = _baseHref;
635 }
636 return _this;
637 }
638 HashLocationStrategy.prototype.onPopState = function (fn) {
639 this._platformLocation.onPopState(fn);
640 this._platformLocation.onHashChange(fn);
641 };
642 HashLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; };
643 HashLocationStrategy.prototype.path = function (includeHash) {
644 if (includeHash === void 0) { includeHash = false; }
645 // the hash value is always prefixed with a `#`
646 // and if it is empty then it will stay empty
647 var path = this._platformLocation.hash;
648 if (path == null)
649 path = '#';
650 return path.length > 0 ? path.substring(1) : path;
651 };
652 HashLocationStrategy.prototype.prepareExternalUrl = function (internal) {
653 var url = joinWithSlash(this._baseHref, internal);
654 return url.length > 0 ? ('#' + url) : url;
655 };
656 HashLocationStrategy.prototype.pushState = function (state, title, path, queryParams) {
657 var url = this.prepareExternalUrl(path + normalizeQueryParams(queryParams));
658 if (url.length == 0) {
659 url = this._platformLocation.pathname;
660 }
661 this._platformLocation.pushState(state, title, url);
662 };
663 HashLocationStrategy.prototype.replaceState = function (state, title, path, queryParams) {
664 var url = this.prepareExternalUrl(path + normalizeQueryParams(queryParams));
665 if (url.length == 0) {
666 url = this._platformLocation.pathname;
667 }
668 this._platformLocation.replaceState(state, title, url);
669 };
670 HashLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); };
671 HashLocationStrategy.prototype.back = function () { this._platformLocation.back(); };
672 HashLocationStrategy = __decorate([
673 i0.Injectable(),
674 __param(1, i0.Optional()), __param(1, i0.Inject(APP_BASE_HREF)),
675 __metadata("design:paramtypes", [PlatformLocation, String])
676 ], HashLocationStrategy);
677 return HashLocationStrategy;
678 }(LocationStrategy));
679
680 /**
681 * @description
682 *
683 * A service that applications can use to interact with a browser's URL.
684 *
685 * Depending on the `LocationStrategy` used, `Location` persists
686 * to the URL's path or the URL's hash segment.
687 *
688 * @usageNotes
689 *
690 * It's better to use the `Router#navigate` service to trigger route changes. Use
691 * `Location` only if you need to interact with or create normalized URLs outside of
692 * routing.
693 *
694 * `Location` is responsible for normalizing the URL against the application's base href.
695 * A normalized URL is absolute from the URL host, includes the application's base href, and has no
696 * trailing slash:
697 * - `/my/app/user/123` is normalized
698 * - `my/app/user/123` **is not** normalized
699 * - `/my/app/user/123/` **is not** normalized
700 *
701 * ### Example
702 *
703 * <code-example path='common/location/ts/path_location_component.ts'
704 * region='LocationComponent'></code-example>
705 *
706 * @publicApi
707 */
708 var Location = /** @class */ (function () {
709 function Location(platformStrategy, platformLocation) {
710 var _this = this;
711 /** @internal */
712 this._subject = new i0.EventEmitter();
713 /** @internal */
714 this._urlChangeListeners = [];
715 this._platformStrategy = platformStrategy;
716 var browserBaseHref = this._platformStrategy.getBaseHref();
717 this._platformLocation = platformLocation;
718 this._baseHref = stripTrailingSlash(_stripIndexHtml(browserBaseHref));
719 this._platformStrategy.onPopState(function (ev) {
720 _this._subject.emit({
721 'url': _this.path(true),
722 'pop': true,
723 'state': ev.state,
724 'type': ev.type,
725 });
726 });
727 }
728 Location_1 = Location;
729 /**
730 * Normalizes the URL path for this location.
731 *
732 * @param includeHash True to include an anchor fragment in the path.
733 *
734 * @returns The normalized URL path.
735 */
736 // TODO: vsavkin. Remove the boolean flag and always include hash once the deprecated router is
737 // removed.
738 Location.prototype.path = function (includeHash) {
739 if (includeHash === void 0) { includeHash = false; }
740 return this.normalize(this._platformStrategy.path(includeHash));
741 };
742 /**
743 * Reports the current state of the location history.
744 * @returns The current value of the `history.state` object.
745 */
746 Location.prototype.getState = function () { return this._platformLocation.getState(); };
747 /**
748 * Normalizes the given path and compares to the current normalized path.
749 *
750 * @param path The given URL path.
751 * @param query Query parameters.
752 *
753 * @returns True if the given URL path is equal to the current normalized path, false
754 * otherwise.
755 */
756 Location.prototype.isCurrentPathEqualTo = function (path, query) {
757 if (query === void 0) { query = ''; }
758 return this.path() == this.normalize(path + normalizeQueryParams(query));
759 };
760 /**
761 * Normalizes a URL path by stripping any trailing slashes.
762 *
763 * @param url String representing a URL.
764 *
765 * @returns The normalized URL string.
766 */
767 Location.prototype.normalize = function (url) {
768 return Location_1.stripTrailingSlash(_stripBaseHref(this._baseHref, _stripIndexHtml(url)));
769 };
770 /**
771 * Normalizes an external URL path.
772 * If the given URL doesn't begin with a leading slash (`'/'`), adds one
773 * before normalizing. Adds a hash if `HashLocationStrategy` is
774 * in use, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
775 *
776 * @param url String representing a URL.
777 *
778 * @returns A normalized platform-specific URL.
779 */
780 Location.prototype.prepareExternalUrl = function (url) {
781 if (url && url[0] !== '/') {
782 url = '/' + url;
783 }
784 return this._platformStrategy.prepareExternalUrl(url);
785 };
786 // TODO: rename this method to pushState
787 /**
788 * Changes the browser's URL to a normalized version of a given URL, and pushes a
789 * new item onto the platform's history.
790 *
791 * @param path URL path to normalize.
792 * @param query Query parameters.
793 * @param state Location history state.
794 *
795 */
796 Location.prototype.go = function (path, query, state) {
797 if (query === void 0) { query = ''; }
798 if (state === void 0) { state = null; }
799 this._platformStrategy.pushState(state, '', path, query);
800 this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);
801 };
802 /**
803 * Changes the browser's URL to a normalized version of the given URL, and replaces
804 * the top item on the platform's history stack.
805 *
806 * @param path URL path to normalize.
807 * @param query Query parameters.
808 * @param state Location history state.
809 */
810 Location.prototype.replaceState = function (path, query, state) {
811 if (query === void 0) { query = ''; }
812 if (state === void 0) { state = null; }
813 this._platformStrategy.replaceState(state, '', path, query);
814 this._notifyUrlChangeListeners(this.prepareExternalUrl(path + normalizeQueryParams(query)), state);
815 };
816 /**
817 * Navigates forward in the platform's history.
818 */
819 Location.prototype.forward = function () { this._platformStrategy.forward(); };
820 /**
821 * Navigates back in the platform's history.
822 */
823 Location.prototype.back = function () { this._platformStrategy.back(); };
824 /**
825 * Registers a URL change listener. Use to catch updates performed by the Angular
826 * framework that are not detectible through "popstate" or "hashchange" events.
827 *
828 * @param fn The change handler function, which take a URL and a location history state.
829 */
830 Location.prototype.onUrlChange = function (fn) {
831 var _this = this;
832 this._urlChangeListeners.push(fn);
833 this.subscribe(function (v) { _this._notifyUrlChangeListeners(v.url, v.state); });
834 };
835 /** @internal */
836 Location.prototype._notifyUrlChangeListeners = function (url, state) {
837 if (url === void 0) { url = ''; }
838 this._urlChangeListeners.forEach(function (fn) { return fn(url, state); });
839 };
840 /**
841 * Subscribes to the platform's `popState` events.
842 *
843 * @param value Event that is triggered when the state history changes.
844 * @param exception The exception to throw.
845 *
846 * @returns Subscribed events.
847 */
848 Location.prototype.subscribe = function (onNext, onThrow, onReturn) {
849 return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn });
850 };
851 var Location_1;
852 /**
853 * Normalizes URL parameters by prepending with `?` if needed.
854 *
855 * @param params String of URL parameters.
856 *
857 * @returns The normalized URL parameters string.
858 */
859 Location.normalizeQueryParams = normalizeQueryParams;
860 /**
861 * Joins two parts of a URL with a slash if needed.
862 *
863 * @param start URL string
864 * @param end URL string
865 *
866 *
867 * @returns The joined URL string.
868 */
869 Location.joinWithSlash = joinWithSlash;
870 /**
871 * Removes a trailing slash from a URL string if needed.
872 * Looks for the first occurrence of either `#`, `?`, or the end of the
873 * line as `/` characters and removes the trailing slash if one exists.
874 *
875 * @param url URL string.
876 *
877 * @returns The URL string, modified if needed.
878 */
879 Location.stripTrailingSlash = stripTrailingSlash;
880 Location.ɵprov = i0.ɵɵdefineInjectable({ factory: createLocation, token: Location, providedIn: "root" });
881 Location = Location_1 = __decorate([
882 i0.Injectable({
883 providedIn: 'root',
884 // See #23917
885 useFactory: createLocation,
886 }),
887 __metadata("design:paramtypes", [LocationStrategy, PlatformLocation])
888 ], Location);
889 return Location;
890 }());
891 function createLocation() {
892 return new Location(i0.ɵɵinject(LocationStrategy), i0.ɵɵinject(PlatformLocation));
893 }
894 function _stripBaseHref(baseHref, url) {
895 return baseHref && url.startsWith(baseHref) ? url.substring(baseHref.length) : url;
896 }
897 function _stripIndexHtml(url) {
898 return url.replace(/\/index.html$/, '');
899 }
900
901 /**
902 * @license
903 * Copyright Google Inc. All Rights Reserved.
904 *
905 * Use of this source code is governed by an MIT-style license that can be
906 * found in the LICENSE file at https://angular.io/license
907 */
908
909 /**
910 * @license
911 * Copyright Google Inc. All Rights Reserved.
912 *
913 * Use of this source code is governed by an MIT-style license that can be
914 * found in the LICENSE file at https://angular.io/license
915 */
916 /** @internal */
917 var CURRENCIES_EN = {
918 'ADP': [undefined, undefined, 0],
919 'AFN': [undefined, undefined, 0],
920 'ALL': [undefined, undefined, 0],
921 'AMD': [undefined, undefined, 2],
922 'AOA': [undefined, 'Kz'],
923 'ARS': [undefined, '$'],
924 'AUD': ['A$', '$'],
925 'BAM': [undefined, 'KM'],
926 'BBD': [undefined, '$'],
927 'BDT': [undefined, '৳'],
928 'BHD': [undefined, undefined, 3],
929 'BIF': [undefined, undefined, 0],
930 'BMD': [undefined, '$'],
931 'BND': [undefined, '$'],
932 'BOB': [undefined, 'Bs'],
933 'BRL': ['R$'],
934 'BSD': [undefined, '$'],
935 'BWP': [undefined, 'P'],
936 'BYN': [undefined, 'р.', 2],
937 'BYR': [undefined, undefined, 0],
938 'BZD': [undefined, '$'],
939 'CAD': ['CA$', '$', 2],
940 'CHF': [undefined, undefined, 2],
941 'CLF': [undefined, undefined, 4],
942 'CLP': [undefined, '$', 0],
943 'CNY': ['CN¥', '¥'],
944 'COP': [undefined, '$', 2],
945 'CRC': [undefined, '₡', 2],
946 'CUC': [undefined, '$'],
947 'CUP': [undefined, '$'],
948 'CZK': [undefined, 'Kč', 2],
949 'DJF': [undefined, undefined, 0],
950 'DKK': [undefined, 'kr', 2],
951 'DOP': [undefined, '$'],
952 'EGP': [undefined, 'E£'],
953 'ESP': [undefined, '₧', 0],
954 'EUR': ['€'],
955 'FJD': [undefined, '$'],
956 'FKP': [undefined, '£'],
957 'GBP': ['£'],
958 'GEL': [undefined, '₾'],
959 'GIP': [undefined, '£'],
960 'GNF': [undefined, 'FG', 0],
961 'GTQ': [undefined, 'Q'],
962 'GYD': [undefined, '$', 2],
963 'HKD': ['HK$', '$'],
964 'HNL': [undefined, 'L'],
965 'HRK': [undefined, 'kn'],
966 'HUF': [undefined, 'Ft', 2],
967 'IDR': [undefined, 'Rp', 2],
968 'ILS': ['₪'],
969 'INR': ['₹'],
970 'IQD': [undefined, undefined, 0],
971 'IRR': [undefined, undefined, 0],
972 'ISK': [undefined, 'kr', 0],
973 'ITL': [undefined, undefined, 0],
974 'JMD': [undefined, '$'],
975 'JOD': [undefined, undefined, 3],
976 'JPY': ['¥', undefined, 0],
977 'KHR': [undefined, '៛'],
978 'KMF': [undefined, 'CF', 0],
979 'KPW': [undefined, '₩', 0],
980 'KRW': ['₩', undefined, 0],
981 'KWD': [undefined, undefined, 3],
982 'KYD': [undefined, '$'],
983 'KZT': [undefined, '₸'],
984 'LAK': [undefined, '₭', 0],
985 'LBP': [undefined, 'L£', 0],
986 'LKR': [undefined, 'Rs'],
987 'LRD': [undefined, '$'],
988 'LTL': [undefined, 'Lt'],
989 'LUF': [undefined, undefined, 0],
990 'LVL': [undefined, 'Ls'],
991 'LYD': [undefined, undefined, 3],
992 'MGA': [undefined, 'Ar', 0],
993 'MGF': [undefined, undefined, 0],
994 'MMK': [undefined, 'K', 0],
995 'MNT': [undefined, '₮', 2],
996 'MRO': [undefined, undefined, 0],
997 'MUR': [undefined, 'Rs', 2],
998 'MXN': ['MX$', '$'],
999 'MYR': [undefined, 'RM'],
1000 'NAD': [undefined, '$'],
1001 'NGN': [undefined, '₦'],
1002 'NIO': [undefined, 'C$'],
1003 'NOK': [undefined, 'kr', 2],
1004 'NPR': [undefined, 'Rs'],
1005 'NZD': ['NZ$', '$'],
1006 'OMR': [undefined, undefined, 3],
1007 'PHP': [undefined, '₱'],
1008 'PKR': [undefined, 'Rs', 2],
1009 'PLN': [undefined, 'zł'],
1010 'PYG': [undefined, '₲', 0],
1011 'RON': [undefined, 'lei'],
1012 'RSD': [undefined, undefined, 0],
1013 'RUB': [undefined, '₽'],
1014 'RUR': [undefined, 'р.'],
1015 'RWF': [undefined, 'RF', 0],
1016 'SBD': [undefined, '$'],
1017 'SEK': [undefined, 'kr', 2],
1018 'SGD': [undefined, '$'],
1019 'SHP': [undefined, '£'],
1020 'SLL': [undefined, undefined, 0],
1021 'SOS': [undefined, undefined, 0],
1022 'SRD': [undefined, '$'],
1023 'SSP': [undefined, '£'],
1024 'STD': [undefined, undefined, 0],
1025 'STN': [undefined, 'Db'],
1026 'SYP': [undefined, '£', 0],
1027 'THB': [undefined, '฿'],
1028 'TMM': [undefined, undefined, 0],
1029 'TND': [undefined, undefined, 3],
1030 'TOP': [undefined, 'T$'],
1031 'TRL': [undefined, undefined, 0],
1032 'TRY': [undefined, '₺'],
1033 'TTD': [undefined, '$'],
1034 'TWD': ['NT$', '$', 2],
1035 'TZS': [undefined, undefined, 2],
1036 'UAH': [undefined, '₴'],
1037 'UGX': [undefined, undefined, 0],
1038 'USD': ['$'],
1039 'UYI': [undefined, undefined, 0],
1040 'UYU': [undefined, '$'],
1041 'UYW': [undefined, undefined, 4],
1042 'UZS': [undefined, undefined, 2],
1043 'VEF': [undefined, 'Bs', 2],
1044 'VND': ['₫', undefined, 0],
1045 'VUV': [undefined, undefined, 0],
1046 'XAF': ['FCFA', undefined, 0],
1047 'XCD': ['EC$', '$'],
1048 'XOF': ['CFA', undefined, 0],
1049 'XPF': ['CFPF', undefined, 0],
1050 'XXX': ['¤'],
1051 'YER': [undefined, undefined, 0],
1052 'ZAR': [undefined, 'R'],
1053 'ZMK': [undefined, undefined, 0],
1054 'ZMW': [undefined, 'ZK'],
1055 'ZWD': [undefined, undefined, 0]
1056 };
1057
1058 /**
1059 * @license
1060 * Copyright Google Inc. All Rights Reserved.
1061 *
1062 * Use of this source code is governed by an MIT-style license that can be
1063 * found in the LICENSE file at https://angular.io/license
1064 */
1065 (function (NumberFormatStyle) {
1066 NumberFormatStyle[NumberFormatStyle["Decimal"] = 0] = "Decimal";
1067 NumberFormatStyle[NumberFormatStyle["Percent"] = 1] = "Percent";
1068 NumberFormatStyle[NumberFormatStyle["Currency"] = 2] = "Currency";
1069 NumberFormatStyle[NumberFormatStyle["Scientific"] = 3] = "Scientific";
1070 })(exports.NumberFormatStyle || (exports.NumberFormatStyle = {}));
1071 (function (Plural) {
1072 Plural[Plural["Zero"] = 0] = "Zero";
1073 Plural[Plural["One"] = 1] = "One";
1074 Plural[Plural["Two"] = 2] = "Two";
1075 Plural[Plural["Few"] = 3] = "Few";
1076 Plural[Plural["Many"] = 4] = "Many";
1077 Plural[Plural["Other"] = 5] = "Other";
1078 })(exports.Plural || (exports.Plural = {}));
1079 (function (FormStyle) {
1080 FormStyle[FormStyle["Format"] = 0] = "Format";
1081 FormStyle[FormStyle["Standalone"] = 1] = "Standalone";
1082 })(exports.FormStyle || (exports.FormStyle = {}));
1083 (function (TranslationWidth) {
1084 /** 1 character for `en-US`. For example: 'S' */
1085 TranslationWidth[TranslationWidth["Narrow"] = 0] = "Narrow";
1086 /** 3 characters for `en-US`. For example: 'Sun' */
1087 TranslationWidth[TranslationWidth["Abbreviated"] = 1] = "Abbreviated";
1088 /** Full length for `en-US`. For example: "Sunday" */
1089 TranslationWidth[TranslationWidth["Wide"] = 2] = "Wide";
1090 /** 2 characters for `en-US`, For example: "Su" */
1091 TranslationWidth[TranslationWidth["Short"] = 3] = "Short";
1092 })(exports.TranslationWidth || (exports.TranslationWidth = {}));
1093 (function (FormatWidth) {
1094 /**
1095 * For `en-US`, 'M/d/yy, h:mm a'`
1096 * (Example: `6/15/15, 9:03 AM`)
1097 */
1098 FormatWidth[FormatWidth["Short"] = 0] = "Short";
1099 /**
1100 * For `en-US`, `'MMM d, y, h:mm:ss a'`
1101 * (Example: `Jun 15, 2015, 9:03:01 AM`)
1102 */
1103 FormatWidth[FormatWidth["Medium"] = 1] = "Medium";
1104 /**
1105 * For `en-US`, `'MMMM d, y, h:mm:ss a z'`
1106 * (Example: `June 15, 2015 at 9:03:01 AM GMT+1`)
1107 */
1108 FormatWidth[FormatWidth["Long"] = 2] = "Long";
1109 /**
1110 * For `en-US`, `'EEEE, MMMM d, y, h:mm:ss a zzzz'`
1111 * (Example: `Monday, June 15, 2015 at 9:03:01 AM GMT+01:00`)
1112 */
1113 FormatWidth[FormatWidth["Full"] = 3] = "Full";
1114 })(exports.FormatWidth || (exports.FormatWidth = {}));
1115 (function (NumberSymbol) {
1116 /**
1117 * Decimal separator.
1118 * For `en-US`, the dot character.
1119 * Example : 2,345`.`67
1120 */
1121 NumberSymbol[NumberSymbol["Decimal"] = 0] = "Decimal";
1122 /**
1123 * Grouping separator, typically for thousands.
1124 * For `en-US`, the comma character.
1125 * Example: 2`,`345.67
1126 */
1127 NumberSymbol[NumberSymbol["Group"] = 1] = "Group";
1128 /**
1129 * List-item separator.
1130 * Example: "one, two, and three"
1131 */
1132 NumberSymbol[NumberSymbol["List"] = 2] = "List";
1133 /**
1134 * Sign for percentage (out of 100).
1135 * Example: 23.4%
1136 */
1137 NumberSymbol[NumberSymbol["PercentSign"] = 3] = "PercentSign";
1138 /**
1139 * Sign for positive numbers.
1140 * Example: +23
1141 */
1142 NumberSymbol[NumberSymbol["PlusSign"] = 4] = "PlusSign";
1143 /**
1144 * Sign for negative numbers.
1145 * Example: -23
1146 */
1147 NumberSymbol[NumberSymbol["MinusSign"] = 5] = "MinusSign";
1148 /**
1149 * Computer notation for exponential value (n times a power of 10).
1150 * Example: 1.2E3
1151 */
1152 NumberSymbol[NumberSymbol["Exponential"] = 6] = "Exponential";
1153 /**
1154 * Human-readable format of exponential.
1155 * Example: 1.2x103
1156 */
1157 NumberSymbol[NumberSymbol["SuperscriptingExponent"] = 7] = "SuperscriptingExponent";
1158 /**
1159 * Sign for permille (out of 1000).
1160 * Example: 23.4‰
1161 */
1162 NumberSymbol[NumberSymbol["PerMille"] = 8] = "PerMille";
1163 /**
1164 * Infinity, can be used with plus and minus.
1165 * Example: ∞, +∞, -∞
1166 */
1167 NumberSymbol[NumberSymbol["Infinity"] = 9] = "Infinity";
1168 /**
1169 * Not a number.
1170 * Example: NaN
1171 */
1172 NumberSymbol[NumberSymbol["NaN"] = 10] = "NaN";
1173 /**
1174 * Symbol used between time units.
1175 * Example: 10:52
1176 */
1177 NumberSymbol[NumberSymbol["TimeSeparator"] = 11] = "TimeSeparator";
1178 /**
1179 * Decimal separator for currency values (fallback to `Decimal`).
1180 * Example: $2,345.67
1181 */
1182 NumberSymbol[NumberSymbol["CurrencyDecimal"] = 12] = "CurrencyDecimal";
1183 /**
1184 * Group separator for currency values (fallback to `Group`).
1185 * Example: $2,345.67
1186 */
1187 NumberSymbol[NumberSymbol["CurrencyGroup"] = 13] = "CurrencyGroup";
1188 })(exports.NumberSymbol || (exports.NumberSymbol = {}));
1189 (function (WeekDay) {
1190 WeekDay[WeekDay["Sunday"] = 0] = "Sunday";
1191 WeekDay[WeekDay["Monday"] = 1] = "Monday";
1192 WeekDay[WeekDay["Tuesday"] = 2] = "Tuesday";
1193 WeekDay[WeekDay["Wednesday"] = 3] = "Wednesday";
1194 WeekDay[WeekDay["Thursday"] = 4] = "Thursday";
1195 WeekDay[WeekDay["Friday"] = 5] = "Friday";
1196 WeekDay[WeekDay["Saturday"] = 6] = "Saturday";
1197 })(exports.WeekDay || (exports.WeekDay = {}));
1198 /**
1199 * Retrieves the locale ID from the currently loaded locale.
1200 * The loaded locale could be, for example, a global one rather than a regional one.
1201 * @param locale A locale code, such as `fr-FR`.
1202 * @returns The locale code. For example, `fr`.
1203 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1204 *
1205 * @publicApi
1206 */
1207 function getLocaleId(locale) {
1208 return i0.ɵfindLocaleData(locale)[i0.ɵLocaleDataIndex.LocaleId];
1209 }
1210 /**
1211 * Retrieves day period strings for the given locale.
1212 *
1213 * @param locale A locale code for the locale format rules to use.
1214 * @param formStyle The required grammatical form.
1215 * @param width The required character width.
1216 * @returns An array of localized period strings. For example, `[AM, PM]` for `en-US`.
1217 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1218 *
1219 * @publicApi
1220 */
1221 function getLocaleDayPeriods(locale, formStyle, width) {
1222 var data = i0.ɵfindLocaleData(locale);
1223 var amPmData = [data[i0.ɵLocaleDataIndex.DayPeriodsFormat], data[i0.ɵLocaleDataIndex.DayPeriodsStandalone]];
1224 var amPm = getLastDefinedValue(amPmData, formStyle);
1225 return getLastDefinedValue(amPm, width);
1226 }
1227 /**
1228 * Retrieves days of the week for the given locale, using the Gregorian calendar.
1229 *
1230 * @param locale A locale code for the locale format rules to use.
1231 * @param formStyle The required grammatical form.
1232 * @param width The required character width.
1233 * @returns An array of localized name strings.
1234 * For example,`[Sunday, Monday, ... Saturday]` for `en-US`.
1235 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1236 *
1237 * @publicApi
1238 */
1239 function getLocaleDayNames(locale, formStyle, width) {
1240 var data = i0.ɵfindLocaleData(locale);
1241 var daysData = [data[i0.ɵLocaleDataIndex.DaysFormat], data[i0.ɵLocaleDataIndex.DaysStandalone]];
1242 var days = getLastDefinedValue(daysData, formStyle);
1243 return getLastDefinedValue(days, width);
1244 }
1245 /**
1246 * Retrieves months of the year for the given locale, using the Gregorian calendar.
1247 *
1248 * @param locale A locale code for the locale format rules to use.
1249 * @param formStyle The required grammatical form.
1250 * @param width The required character width.
1251 * @returns An array of localized name strings.
1252 * For example, `[January, February, ...]` for `en-US`.
1253 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1254 *
1255 * @publicApi
1256 */
1257 function getLocaleMonthNames(locale, formStyle, width) {
1258 var data = i0.ɵfindLocaleData(locale);
1259 var monthsData = [data[i0.ɵLocaleDataIndex.MonthsFormat], data[i0.ɵLocaleDataIndex.MonthsStandalone]];
1260 var months = getLastDefinedValue(monthsData, formStyle);
1261 return getLastDefinedValue(months, width);
1262 }
1263 /**
1264 * Retrieves Gregorian-calendar eras for the given locale.
1265 * @param locale A locale code for the locale format rules to use.
1266 * @param formStyle The required grammatical form.
1267 * @param width The required character width.
1268
1269 * @returns An array of localized era strings.
1270 * For example, `[AD, BC]` for `en-US`.
1271 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1272 *
1273 * @publicApi
1274 */
1275 function getLocaleEraNames(locale, width) {
1276 var data = i0.ɵfindLocaleData(locale);
1277 var erasData = data[i0.ɵLocaleDataIndex.Eras];
1278 return getLastDefinedValue(erasData, width);
1279 }
1280 /**
1281 * Retrieves the first day of the week for the given locale.
1282 *
1283 * @param locale A locale code for the locale format rules to use.
1284 * @returns A day index number, using the 0-based week-day index for `en-US`
1285 * (Sunday = 0, Monday = 1, ...).
1286 * For example, for `fr-FR`, returns 1 to indicate that the first day is Monday.
1287 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1288 *
1289 * @publicApi
1290 */
1291 function getLocaleFirstDayOfWeek(locale) {
1292 var data = i0.ɵfindLocaleData(locale);
1293 return data[i0.ɵLocaleDataIndex.FirstDayOfWeek];
1294 }
1295 /**
1296 * Range of week days that are considered the week-end for the given locale.
1297 *
1298 * @param locale A locale code for the locale format rules to use.
1299 * @returns The range of day values, `[startDay, endDay]`.
1300 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1301 *
1302 * @publicApi
1303 */
1304 function getLocaleWeekEndRange(locale) {
1305 var data = i0.ɵfindLocaleData(locale);
1306 return data[i0.ɵLocaleDataIndex.WeekendRange];
1307 }
1308 /**
1309 * Retrieves a localized date-value formating string.
1310 *
1311 * @param locale A locale code for the locale format rules to use.
1312 * @param width The format type.
1313 * @returns The localized formating string.
1314 * @see `FormatWidth`
1315 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1316 *
1317 * @publicApi
1318 */
1319 function getLocaleDateFormat(locale, width) {
1320 var data = i0.ɵfindLocaleData(locale);
1321 return getLastDefinedValue(data[i0.ɵLocaleDataIndex.DateFormat], width);
1322 }
1323 /**
1324 * Retrieves a localized time-value formatting string.
1325 *
1326 * @param locale A locale code for the locale format rules to use.
1327 * @param width The format type.
1328 * @returns The localized formatting string.
1329 * @see `FormatWidth`
1330 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1331
1332 * @publicApi
1333 */
1334 function getLocaleTimeFormat(locale, width) {
1335 var data = i0.ɵfindLocaleData(locale);
1336 return getLastDefinedValue(data[i0.ɵLocaleDataIndex.TimeFormat], width);
1337 }
1338 /**
1339 * Retrieves a localized date-time formatting string.
1340 *
1341 * @param locale A locale code for the locale format rules to use.
1342 * @param width The format type.
1343 * @returns The localized formatting string.
1344 * @see `FormatWidth`
1345 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1346 *
1347 * @publicApi
1348 */
1349 function getLocaleDateTimeFormat(locale, width) {
1350 var data = i0.ɵfindLocaleData(locale);
1351 var dateTimeFormatData = data[i0.ɵLocaleDataIndex.DateTimeFormat];
1352 return getLastDefinedValue(dateTimeFormatData, width);
1353 }
1354 /**
1355 * Retrieves a localized number symbol that can be used to replace placeholders in number formats.
1356 * @param locale The locale code.
1357 * @param symbol The symbol to localize.
1358 * @returns The character for the localized symbol.
1359 * @see `NumberSymbol`
1360 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1361 *
1362 * @publicApi
1363 */
1364 function getLocaleNumberSymbol(locale, symbol) {
1365 var data = i0.ɵfindLocaleData(locale);
1366 var res = data[i0.ɵLocaleDataIndex.NumberSymbols][symbol];
1367 if (typeof res === 'undefined') {
1368 if (symbol === exports.NumberSymbol.CurrencyDecimal) {
1369 return data[i0.ɵLocaleDataIndex.NumberSymbols][exports.NumberSymbol.Decimal];
1370 }
1371 else if (symbol === exports.NumberSymbol.CurrencyGroup) {
1372 return data[i0.ɵLocaleDataIndex.NumberSymbols][exports.NumberSymbol.Group];
1373 }
1374 }
1375 return res;
1376 }
1377 /**
1378 * Retrieves a number format for a given locale.
1379 *
1380 * Numbers are formatted using patterns, like `#,###.00`. For example, the pattern `#,###.00`
1381 * when used to format the number 12345.678 could result in "12'345,678". That would happen if the
1382 * grouping separator for your language is an apostrophe, and the decimal separator is a comma.
1383 *
1384 * <b>Important:</b> The characters `.` `,` `0` `#` (and others below) are special placeholders
1385 * that stand for the decimal separator, and so on, and are NOT real characters.
1386 * You must NOT "translate" the placeholders. For example, don't change `.` to `,` even though in
1387 * your language the decimal point is written with a comma. The symbols should be replaced by the
1388 * local equivalents, using the appropriate `NumberSymbol` for your language.
1389 *
1390 * Here are the special characters used in number patterns:
1391 *
1392 * | Symbol | Meaning |
1393 * |--------|---------|
1394 * | . | Replaced automatically by the character used for the decimal point. |
1395 * | , | Replaced by the "grouping" (thousands) separator. |
1396 * | 0 | Replaced by a digit (or zero if there aren't enough digits). |
1397 * | # | Replaced by a digit (or nothing if there aren't enough). |
1398 * | ¤ | Replaced by a currency symbol, such as $ or USD. |
1399 * | % | Marks a percent format. The % symbol may change position, but must be retained. |
1400 * | E | Marks a scientific format. The E symbol may change position, but must be retained. |
1401 * | ' | Special characters used as literal characters are quoted with ASCII single quotes. |
1402 *
1403 * @param locale A locale code for the locale format rules to use.
1404 * @param type The type of numeric value to be formatted (such as `Decimal` or `Currency`.)
1405 * @returns The localized format string.
1406 * @see `NumberFormatStyle`
1407 * @see [CLDR website](http://cldr.unicode.org/translation/number-patterns)
1408 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1409 *
1410 * @publicApi
1411 */
1412 function getLocaleNumberFormat(locale, type) {
1413 var data = i0.ɵfindLocaleData(locale);
1414 return data[i0.ɵLocaleDataIndex.NumberFormats][type];
1415 }
1416 /**
1417 * Retrieves the symbol used to represent the currency for the main country
1418 * corresponding to a given locale. For example, '$' for `en-US`.
1419 *
1420 * @param locale A locale code for the locale format rules to use.
1421 * @returns The localized symbol character,
1422 * or `null` if the main country cannot be determined.
1423 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1424 *
1425 * @publicApi
1426 */
1427 function getLocaleCurrencySymbol(locale) {
1428 var data = i0.ɵfindLocaleData(locale);
1429 return data[i0.ɵLocaleDataIndex.CurrencySymbol] || null;
1430 }
1431 /**
1432 * Retrieves the name of the currency for the main country corresponding
1433 * to a given locale. For example, 'US Dollar' for `en-US`.
1434 * @param locale A locale code for the locale format rules to use.
1435 * @returns The currency name,
1436 * or `null` if the main country cannot be determined.
1437 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1438 *
1439 * @publicApi
1440 */
1441 function getLocaleCurrencyName(locale) {
1442 var data = i0.ɵfindLocaleData(locale);
1443 return data[i0.ɵLocaleDataIndex.CurrencyName] || null;
1444 }
1445 /**
1446 * Retrieves the default currency code for the given locale.
1447 *
1448 * The default is defined as the first currency which is still in use.
1449 *
1450 * @param locale The code of the locale whose currency code we want.
1451 * @returns The code of the default currency for the given locale.
1452 *
1453 * @publicApi
1454 */
1455 function getLocaleCurrencyCode(locale) {
1456 return i0.ɵgetLocaleCurrencyCode(locale);
1457 }
1458 /**
1459 * Retrieves the currency values for a given locale.
1460 * @param locale A locale code for the locale format rules to use.
1461 * @returns The currency values.
1462 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1463 */
1464 function getLocaleCurrencies(locale) {
1465 var data = i0.ɵfindLocaleData(locale);
1466 return data[i0.ɵLocaleDataIndex.Currencies];
1467 }
1468 /**
1469 * @alias core/ɵgetLocalePluralCase
1470 * @publicApi
1471 */
1472 var getLocalePluralCase = i0.ɵgetLocalePluralCase;
1473 function checkFullData(data) {
1474 if (!data[i0.ɵLocaleDataIndex.ExtraData]) {
1475 throw new Error("Missing extra locale data for the locale \"" + data[i0.ɵLocaleDataIndex.LocaleId] + "\". Use \"registerLocaleData\" to load new data. See the \"I18n guide\" on angular.io to know more.");
1476 }
1477 }
1478 /**
1479 * Retrieves locale-specific rules used to determine which day period to use
1480 * when more than one period is defined for a locale.
1481 *
1482 * There is a rule for each defined day period. The
1483 * first rule is applied to the first day period and so on.
1484 * Fall back to AM/PM when no rules are available.
1485 *
1486 * A rule can specify a period as time range, or as a single time value.
1487 *
1488 * This functionality is only available when you have loaded the full locale data.
1489 * See the ["I18n guide"](guide/i18n#i18n-pipes).
1490 *
1491 * @param locale A locale code for the locale format rules to use.
1492 * @returns The rules for the locale, a single time value or array of *from-time, to-time*,
1493 * or null if no periods are available.
1494 *
1495 * @see `getLocaleExtraDayPeriods()`
1496 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1497 *
1498 * @publicApi
1499 */
1500 function getLocaleExtraDayPeriodRules(locale) {
1501 var data = i0.ɵfindLocaleData(locale);
1502 checkFullData(data);
1503 var rules = data[i0.ɵLocaleDataIndex.ExtraData][2 /* ExtraDayPeriodsRules */] || [];
1504 return rules.map(function (rule) {
1505 if (typeof rule === 'string') {
1506 return extractTime(rule);
1507 }
1508 return [extractTime(rule[0]), extractTime(rule[1])];
1509 });
1510 }
1511 /**
1512 * Retrieves locale-specific day periods, which indicate roughly how a day is broken up
1513 * in different languages.
1514 * For example, for `en-US`, periods are morning, noon, afternoon, evening, and midnight.
1515 *
1516 * This functionality is only available when you have loaded the full locale data.
1517 * See the ["I18n guide"](guide/i18n#i18n-pipes).
1518 *
1519 * @param locale A locale code for the locale format rules to use.
1520 * @param formStyle The required grammatical form.
1521 * @param width The required character width.
1522 * @returns The translated day-period strings.
1523 * @see `getLocaleExtraDayPeriodRules()`
1524 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1525 *
1526 * @publicApi
1527 */
1528 function getLocaleExtraDayPeriods(locale, formStyle, width) {
1529 var data = i0.ɵfindLocaleData(locale);
1530 checkFullData(data);
1531 var dayPeriodsData = [
1532 data[i0.ɵLocaleDataIndex.ExtraData][0 /* ExtraDayPeriodFormats */],
1533 data[i0.ɵLocaleDataIndex.ExtraData][1 /* ExtraDayPeriodStandalone */]
1534 ];
1535 var dayPeriods = getLastDefinedValue(dayPeriodsData, formStyle) || [];
1536 return getLastDefinedValue(dayPeriods, width) || [];
1537 }
1538 /**
1539 * Retrieves the first value that is defined in an array, going backwards from an index position.
1540 *
1541 * To avoid repeating the same data (as when the "format" and "standalone" forms are the same)
1542 * add the first value to the locale data arrays, and add other values only if they are different.
1543 *
1544 * @param data The data array to retrieve from.
1545 * @param index A 0-based index into the array to start from.
1546 * @returns The value immediately before the given index position.
1547 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1548 *
1549 * @publicApi
1550 */
1551 function getLastDefinedValue(data, index) {
1552 for (var i = index; i > -1; i--) {
1553 if (typeof data[i] !== 'undefined') {
1554 return data[i];
1555 }
1556 }
1557 throw new Error('Locale data API: locale data undefined');
1558 }
1559 /**
1560 * Extracts the hours and minutes from a string like "15:45"
1561 */
1562 function extractTime(time) {
1563 var _a = __read(time.split(':'), 2), h = _a[0], m = _a[1];
1564 return { hours: +h, minutes: +m };
1565 }
1566 /**
1567 * Retrieves the currency symbol for a given currency code.
1568 *
1569 * For example, for the default `en-US` locale, the code `USD` can
1570 * be represented by the narrow symbol `$` or the wide symbol `US$`.
1571 *
1572 * @param code The currency code.
1573 * @param format The format, `wide` or `narrow`.
1574 * @param locale A locale code for the locale format rules to use.
1575 *
1576 * @returns The symbol, or the currency code if no symbol is available.
1577 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1578 *
1579 * @publicApi
1580 */
1581 function getCurrencySymbol(code, format, locale) {
1582 if (locale === void 0) { locale = 'en'; }
1583 var currency = getLocaleCurrencies(locale)[code] || CURRENCIES_EN[code] || [];
1584 var symbolNarrow = currency[1 /* SymbolNarrow */];
1585 if (format === 'narrow' && typeof symbolNarrow === 'string') {
1586 return symbolNarrow;
1587 }
1588 return currency[0 /* Symbol */] || code;
1589 }
1590 // Most currencies have cents, that's why the default is 2
1591 var DEFAULT_NB_OF_CURRENCY_DIGITS = 2;
1592 /**
1593 * Reports the number of decimal digits for a given currency.
1594 * The value depends upon the presence of cents in that particular currency.
1595 *
1596 * @param code The currency code.
1597 * @returns The number of decimal digits, typically 0 or 2.
1598 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1599 *
1600 * @publicApi
1601 */
1602 function getNumberOfCurrencyDigits(code) {
1603 var digits;
1604 var currency = CURRENCIES_EN[code];
1605 if (currency) {
1606 digits = currency[2 /* NbOfDigits */];
1607 }
1608 return typeof digits === 'number' ? digits : DEFAULT_NB_OF_CURRENCY_DIGITS;
1609 }
1610
1611 /**
1612 * @license
1613 * Copyright Google Inc. All Rights Reserved.
1614 *
1615 * Use of this source code is governed by an MIT-style license that can be
1616 * found in the LICENSE file at https://angular.io/license
1617 */
1618 var ISO8601_DATE_REGEX = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
1619 // 1 2 3 4 5 6 7 8 9 10 11
1620 var NAMED_FORMATS = {};
1621 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]*)/;
1622 var ZoneWidth;
1623 (function (ZoneWidth) {
1624 ZoneWidth[ZoneWidth["Short"] = 0] = "Short";
1625 ZoneWidth[ZoneWidth["ShortGMT"] = 1] = "ShortGMT";
1626 ZoneWidth[ZoneWidth["Long"] = 2] = "Long";
1627 ZoneWidth[ZoneWidth["Extended"] = 3] = "Extended";
1628 })(ZoneWidth || (ZoneWidth = {}));
1629 var DateType;
1630 (function (DateType) {
1631 DateType[DateType["FullYear"] = 0] = "FullYear";
1632 DateType[DateType["Month"] = 1] = "Month";
1633 DateType[DateType["Date"] = 2] = "Date";
1634 DateType[DateType["Hours"] = 3] = "Hours";
1635 DateType[DateType["Minutes"] = 4] = "Minutes";
1636 DateType[DateType["Seconds"] = 5] = "Seconds";
1637 DateType[DateType["FractionalSeconds"] = 6] = "FractionalSeconds";
1638 DateType[DateType["Day"] = 7] = "Day";
1639 })(DateType || (DateType = {}));
1640 var TranslationType;
1641 (function (TranslationType) {
1642 TranslationType[TranslationType["DayPeriods"] = 0] = "DayPeriods";
1643 TranslationType[TranslationType["Days"] = 1] = "Days";
1644 TranslationType[TranslationType["Months"] = 2] = "Months";
1645 TranslationType[TranslationType["Eras"] = 3] = "Eras";
1646 })(TranslationType || (TranslationType = {}));
1647 /**
1648 * @ngModule CommonModule
1649 * @description
1650 *
1651 * Formats a date according to locale rules.
1652 *
1653 * @param value The date to format, as a Date, or a number (milliseconds since UTC epoch)
1654 * or an [ISO date-time string](https://www.w3.org/TR/NOTE-datetime).
1655 * @param format The date-time components to include. See `DatePipe` for details.
1656 * @param locale A locale code for the locale format rules to use.
1657 * @param timezone The time zone. A time zone offset from GMT (such as `'+0430'`),
1658 * or a standard UTC/GMT or continental US time zone abbreviation.
1659 * If not specified, uses host system settings.
1660 *
1661 * @returns The formatted date string.
1662 *
1663 * @see `DatePipe`
1664 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
1665 *
1666 * @publicApi
1667 */
1668 function formatDate(value, format, locale, timezone) {
1669 var date = toDate(value);
1670 var namedFormat = getNamedFormat(locale, format);
1671 format = namedFormat || format;
1672 var parts = [];
1673 var match;
1674 while (format) {
1675 match = DATE_FORMATS_SPLIT.exec(format);
1676 if (match) {
1677 parts = parts.concat(match.slice(1));
1678 var part = parts.pop();
1679 if (!part) {
1680 break;
1681 }
1682 format = part;
1683 }
1684 else {
1685 parts.push(format);
1686 break;
1687 }
1688 }
1689 var dateTimezoneOffset = date.getTimezoneOffset();
1690 if (timezone) {
1691 dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
1692 date = convertTimezoneToLocal(date, timezone, true);
1693 }
1694 var text = '';
1695 parts.forEach(function (value) {
1696 var dateFormatter = getDateFormatter(value);
1697 text += dateFormatter ?
1698 dateFormatter(date, locale, dateTimezoneOffset) :
1699 value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
1700 });
1701 return text;
1702 }
1703 function getNamedFormat(locale, format) {
1704 var localeId = getLocaleId(locale);
1705 NAMED_FORMATS[localeId] = NAMED_FORMATS[localeId] || {};
1706 if (NAMED_FORMATS[localeId][format]) {
1707 return NAMED_FORMATS[localeId][format];
1708 }
1709 var formatValue = '';
1710 switch (format) {
1711 case 'shortDate':
1712 formatValue = getLocaleDateFormat(locale, exports.FormatWidth.Short);
1713 break;
1714 case 'mediumDate':
1715 formatValue = getLocaleDateFormat(locale, exports.FormatWidth.Medium);
1716 break;
1717 case 'longDate':
1718 formatValue = getLocaleDateFormat(locale, exports.FormatWidth.Long);
1719 break;
1720 case 'fullDate':
1721 formatValue = getLocaleDateFormat(locale, exports.FormatWidth.Full);
1722 break;
1723 case 'shortTime':
1724 formatValue = getLocaleTimeFormat(locale, exports.FormatWidth.Short);
1725 break;
1726 case 'mediumTime':
1727 formatValue = getLocaleTimeFormat(locale, exports.FormatWidth.Medium);
1728 break;
1729 case 'longTime':
1730 formatValue = getLocaleTimeFormat(locale, exports.FormatWidth.Long);
1731 break;
1732 case 'fullTime':
1733 formatValue = getLocaleTimeFormat(locale, exports.FormatWidth.Full);
1734 break;
1735 case 'short':
1736 var shortTime = getNamedFormat(locale, 'shortTime');
1737 var shortDate = getNamedFormat(locale, 'shortDate');
1738 formatValue = formatDateTime(getLocaleDateTimeFormat(locale, exports.FormatWidth.Short), [shortTime, shortDate]);
1739 break;
1740 case 'medium':
1741 var mediumTime = getNamedFormat(locale, 'mediumTime');
1742 var mediumDate = getNamedFormat(locale, 'mediumDate');
1743 formatValue = formatDateTime(getLocaleDateTimeFormat(locale, exports.FormatWidth.Medium), [mediumTime, mediumDate]);
1744 break;
1745 case 'long':
1746 var longTime = getNamedFormat(locale, 'longTime');
1747 var longDate = getNamedFormat(locale, 'longDate');
1748 formatValue =
1749 formatDateTime(getLocaleDateTimeFormat(locale, exports.FormatWidth.Long), [longTime, longDate]);
1750 break;
1751 case 'full':
1752 var fullTime = getNamedFormat(locale, 'fullTime');
1753 var fullDate = getNamedFormat(locale, 'fullDate');
1754 formatValue =
1755 formatDateTime(getLocaleDateTimeFormat(locale, exports.FormatWidth.Full), [fullTime, fullDate]);
1756 break;
1757 }
1758 if (formatValue) {
1759 NAMED_FORMATS[localeId][format] = formatValue;
1760 }
1761 return formatValue;
1762 }
1763 function formatDateTime(str, opt_values) {
1764 if (opt_values) {
1765 str = str.replace(/\{([^}]+)}/g, function (match, key) {
1766 return (opt_values != null && key in opt_values) ? opt_values[key] : match;
1767 });
1768 }
1769 return str;
1770 }
1771 function padNumber(num, digits, minusSign, trim, negWrap) {
1772 if (minusSign === void 0) { minusSign = '-'; }
1773 var neg = '';
1774 if (num < 0 || (negWrap && num <= 0)) {
1775 if (negWrap) {
1776 num = -num + 1;
1777 }
1778 else {
1779 num = -num;
1780 neg = minusSign;
1781 }
1782 }
1783 var strNum = String(num);
1784 while (strNum.length < digits) {
1785 strNum = '0' + strNum;
1786 }
1787 if (trim) {
1788 strNum = strNum.substr(strNum.length - digits);
1789 }
1790 return neg + strNum;
1791 }
1792 function formatFractionalSeconds(milliseconds, digits) {
1793 var strMs = padNumber(milliseconds, 3);
1794 return strMs.substr(0, digits);
1795 }
1796 /**
1797 * Returns a date formatter that transforms a date into its locale digit representation
1798 */
1799 function dateGetter(name, size, offset, trim, negWrap) {
1800 if (offset === void 0) { offset = 0; }
1801 if (trim === void 0) { trim = false; }
1802 if (negWrap === void 0) { negWrap = false; }
1803 return function (date, locale) {
1804 var part = getDatePart(name, date);
1805 if (offset > 0 || part > -offset) {
1806 part += offset;
1807 }
1808 if (name === DateType.Hours) {
1809 if (part === 0 && offset === -12) {
1810 part = 12;
1811 }
1812 }
1813 else if (name === DateType.FractionalSeconds) {
1814 return formatFractionalSeconds(part, size);
1815 }
1816 var localeMinus = getLocaleNumberSymbol(locale, exports.NumberSymbol.MinusSign);
1817 return padNumber(part, size, localeMinus, trim, negWrap);
1818 };
1819 }
1820 function getDatePart(part, date) {
1821 switch (part) {
1822 case DateType.FullYear:
1823 return date.getFullYear();
1824 case DateType.Month:
1825 return date.getMonth();
1826 case DateType.Date:
1827 return date.getDate();
1828 case DateType.Hours:
1829 return date.getHours();
1830 case DateType.Minutes:
1831 return date.getMinutes();
1832 case DateType.Seconds:
1833 return date.getSeconds();
1834 case DateType.FractionalSeconds:
1835 return date.getMilliseconds();
1836 case DateType.Day:
1837 return date.getDay();
1838 default:
1839 throw new Error("Unknown DateType value \"" + part + "\".");
1840 }
1841 }
1842 /**
1843 * Returns a date formatter that transforms a date into its locale string representation
1844 */
1845 function dateStrGetter(name, width, form, extended) {
1846 if (form === void 0) { form = exports.FormStyle.Format; }
1847 if (extended === void 0) { extended = false; }
1848 return function (date, locale) {
1849 return getDateTranslation(date, locale, name, width, form, extended);
1850 };
1851 }
1852 /**
1853 * Returns the locale translation of a date for a given form, type and width
1854 */
1855 function getDateTranslation(date, locale, name, width, form, extended) {
1856 switch (name) {
1857 case TranslationType.Months:
1858 return getLocaleMonthNames(locale, form, width)[date.getMonth()];
1859 case TranslationType.Days:
1860 return getLocaleDayNames(locale, form, width)[date.getDay()];
1861 case TranslationType.DayPeriods:
1862 var currentHours_1 = date.getHours();
1863 var currentMinutes_1 = date.getMinutes();
1864 if (extended) {
1865 var rules = getLocaleExtraDayPeriodRules(locale);
1866 var dayPeriods_1 = getLocaleExtraDayPeriods(locale, form, width);
1867 var result_1;
1868 rules.forEach(function (rule, index) {
1869 if (Array.isArray(rule)) {
1870 // morning, afternoon, evening, night
1871 var _a = rule[0], hoursFrom = _a.hours, minutesFrom = _a.minutes;
1872 var _b = rule[1], hoursTo = _b.hours, minutesTo = _b.minutes;
1873 if (currentHours_1 >= hoursFrom && currentMinutes_1 >= minutesFrom &&
1874 (currentHours_1 < hoursTo ||
1875 (currentHours_1 === hoursTo && currentMinutes_1 < minutesTo))) {
1876 result_1 = dayPeriods_1[index];
1877 }
1878 }
1879 else { // noon or midnight
1880 var hours = rule.hours, minutes = rule.minutes;
1881 if (hours === currentHours_1 && minutes === currentMinutes_1) {
1882 result_1 = dayPeriods_1[index];
1883 }
1884 }
1885 });
1886 if (result_1) {
1887 return result_1;
1888 }
1889 }
1890 // if no rules for the day periods, we use am/pm by default
1891 return getLocaleDayPeriods(locale, form, width)[currentHours_1 < 12 ? 0 : 1];
1892 case TranslationType.Eras:
1893 return getLocaleEraNames(locale, width)[date.getFullYear() <= 0 ? 0 : 1];
1894 default:
1895 // This default case is not needed by TypeScript compiler, as the switch is exhaustive.
1896 // However Closure Compiler does not understand that and reports an error in typed mode.
1897 // The `throw new Error` below works around the problem, and the unexpected: never variable
1898 // makes sure tsc still checks this code is unreachable.
1899 var unexpected = name;
1900 throw new Error("unexpected translation type " + unexpected);
1901 }
1902 }
1903 /**
1904 * Returns a date formatter that transforms a date and an offset into a timezone with ISO8601 or
1905 * GMT format depending on the width (eg: short = +0430, short:GMT = GMT+4, long = GMT+04:30,
1906 * extended = +04:30)
1907 */
1908 function timeZoneGetter(width) {
1909 return function (date, locale, offset) {
1910 var zone = -1 * offset;
1911 var minusSign = getLocaleNumberSymbol(locale, exports.NumberSymbol.MinusSign);
1912 var hours = zone > 0 ? Math.floor(zone / 60) : Math.ceil(zone / 60);
1913 switch (width) {
1914 case ZoneWidth.Short:
1915 return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) +
1916 padNumber(Math.abs(zone % 60), 2, minusSign);
1917 case ZoneWidth.ShortGMT:
1918 return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 1, minusSign);
1919 case ZoneWidth.Long:
1920 return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' +
1921 padNumber(Math.abs(zone % 60), 2, minusSign);
1922 case ZoneWidth.Extended:
1923 if (offset === 0) {
1924 return 'Z';
1925 }
1926 else {
1927 return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' +
1928 padNumber(Math.abs(zone % 60), 2, minusSign);
1929 }
1930 default:
1931 throw new Error("Unknown zone width \"" + width + "\"");
1932 }
1933 };
1934 }
1935 var JANUARY = 0;
1936 var THURSDAY = 4;
1937 function getFirstThursdayOfYear(year) {
1938 var firstDayOfYear = (new Date(year, JANUARY, 1)).getDay();
1939 return new Date(year, 0, 1 + ((firstDayOfYear <= THURSDAY) ? THURSDAY : THURSDAY + 7) - firstDayOfYear);
1940 }
1941 function getThursdayThisWeek(datetime) {
1942 return new Date(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + (THURSDAY - datetime.getDay()));
1943 }
1944 function weekGetter(size, monthBased) {
1945 if (monthBased === void 0) { monthBased = false; }
1946 return function (date, locale) {
1947 var result;
1948 if (monthBased) {
1949 var nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1;
1950 var today = date.getDate();
1951 result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7);
1952 }
1953 else {
1954 var firstThurs = getFirstThursdayOfYear(date.getFullYear());
1955 var thisThurs = getThursdayThisWeek(date);
1956 var diff = thisThurs.getTime() - firstThurs.getTime();
1957 result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week
1958 }
1959 return padNumber(result, size, getLocaleNumberSymbol(locale, exports.NumberSymbol.MinusSign));
1960 };
1961 }
1962 var DATE_FORMATS = {};
1963 // Based on CLDR formats:
1964 // See complete list: http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
1965 // See also explanations: http://cldr.unicode.org/translation/date-time
1966 // TODO(ocombe): support all missing cldr formats: Y, U, Q, D, F, e, c, j, J, C, A, v, V, X, x
1967 function getDateFormatter(format) {
1968 if (DATE_FORMATS[format]) {
1969 return DATE_FORMATS[format];
1970 }
1971 var formatter;
1972 switch (format) {
1973 // Era name (AD/BC)
1974 case 'G':
1975 case 'GG':
1976 case 'GGG':
1977 formatter = dateStrGetter(TranslationType.Eras, exports.TranslationWidth.Abbreviated);
1978 break;
1979 case 'GGGG':
1980 formatter = dateStrGetter(TranslationType.Eras, exports.TranslationWidth.Wide);
1981 break;
1982 case 'GGGGG':
1983 formatter = dateStrGetter(TranslationType.Eras, exports.TranslationWidth.Narrow);
1984 break;
1985 // 1 digit representation of the year, e.g. (AD 1 => 1, AD 199 => 199)
1986 case 'y':
1987 formatter = dateGetter(DateType.FullYear, 1, 0, false, true);
1988 break;
1989 // 2 digit representation of the year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
1990 case 'yy':
1991 formatter = dateGetter(DateType.FullYear, 2, 0, true, true);
1992 break;
1993 // 3 digit representation of the year, padded (000-999). (e.g. AD 2001 => 01, AD 2010 => 10)
1994 case 'yyy':
1995 formatter = dateGetter(DateType.FullYear, 3, 0, false, true);
1996 break;
1997 // 4 digit representation of the year (e.g. AD 1 => 0001, AD 2010 => 2010)
1998 case 'yyyy':
1999 formatter = dateGetter(DateType.FullYear, 4, 0, false, true);
2000 break;
2001 // Month of the year (1-12), numeric
2002 case 'M':
2003 case 'L':
2004 formatter = dateGetter(DateType.Month, 1, 1);
2005 break;
2006 case 'MM':
2007 case 'LL':
2008 formatter = dateGetter(DateType.Month, 2, 1);
2009 break;
2010 // Month of the year (January, ...), string, format
2011 case 'MMM':
2012 formatter = dateStrGetter(TranslationType.Months, exports.TranslationWidth.Abbreviated);
2013 break;
2014 case 'MMMM':
2015 formatter = dateStrGetter(TranslationType.Months, exports.TranslationWidth.Wide);
2016 break;
2017 case 'MMMMM':
2018 formatter = dateStrGetter(TranslationType.Months, exports.TranslationWidth.Narrow);
2019 break;
2020 // Month of the year (January, ...), string, standalone
2021 case 'LLL':
2022 formatter =
2023 dateStrGetter(TranslationType.Months, exports.TranslationWidth.Abbreviated, exports.FormStyle.Standalone);
2024 break;
2025 case 'LLLL':
2026 formatter =
2027 dateStrGetter(TranslationType.Months, exports.TranslationWidth.Wide, exports.FormStyle.Standalone);
2028 break;
2029 case 'LLLLL':
2030 formatter =
2031 dateStrGetter(TranslationType.Months, exports.TranslationWidth.Narrow, exports.FormStyle.Standalone);
2032 break;
2033 // Week of the year (1, ... 52)
2034 case 'w':
2035 formatter = weekGetter(1);
2036 break;
2037 case 'ww':
2038 formatter = weekGetter(2);
2039 break;
2040 // Week of the month (1, ...)
2041 case 'W':
2042 formatter = weekGetter(1, true);
2043 break;
2044 // Day of the month (1-31)
2045 case 'd':
2046 formatter = dateGetter(DateType.Date, 1);
2047 break;
2048 case 'dd':
2049 formatter = dateGetter(DateType.Date, 2);
2050 break;
2051 // Day of the Week
2052 case 'E':
2053 case 'EE':
2054 case 'EEE':
2055 formatter = dateStrGetter(TranslationType.Days, exports.TranslationWidth.Abbreviated);
2056 break;
2057 case 'EEEE':
2058 formatter = dateStrGetter(TranslationType.Days, exports.TranslationWidth.Wide);
2059 break;
2060 case 'EEEEE':
2061 formatter = dateStrGetter(TranslationType.Days, exports.TranslationWidth.Narrow);
2062 break;
2063 case 'EEEEEE':
2064 formatter = dateStrGetter(TranslationType.Days, exports.TranslationWidth.Short);
2065 break;
2066 // Generic period of the day (am-pm)
2067 case 'a':
2068 case 'aa':
2069 case 'aaa':
2070 formatter = dateStrGetter(TranslationType.DayPeriods, exports.TranslationWidth.Abbreviated);
2071 break;
2072 case 'aaaa':
2073 formatter = dateStrGetter(TranslationType.DayPeriods, exports.TranslationWidth.Wide);
2074 break;
2075 case 'aaaaa':
2076 formatter = dateStrGetter(TranslationType.DayPeriods, exports.TranslationWidth.Narrow);
2077 break;
2078 // Extended period of the day (midnight, at night, ...), standalone
2079 case 'b':
2080 case 'bb':
2081 case 'bbb':
2082 formatter = dateStrGetter(TranslationType.DayPeriods, exports.TranslationWidth.Abbreviated, exports.FormStyle.Standalone, true);
2083 break;
2084 case 'bbbb':
2085 formatter = dateStrGetter(TranslationType.DayPeriods, exports.TranslationWidth.Wide, exports.FormStyle.Standalone, true);
2086 break;
2087 case 'bbbbb':
2088 formatter = dateStrGetter(TranslationType.DayPeriods, exports.TranslationWidth.Narrow, exports.FormStyle.Standalone, true);
2089 break;
2090 // Extended period of the day (midnight, night, ...), standalone
2091 case 'B':
2092 case 'BB':
2093 case 'BBB':
2094 formatter = dateStrGetter(TranslationType.DayPeriods, exports.TranslationWidth.Abbreviated, exports.FormStyle.Format, true);
2095 break;
2096 case 'BBBB':
2097 formatter =
2098 dateStrGetter(TranslationType.DayPeriods, exports.TranslationWidth.Wide, exports.FormStyle.Format, true);
2099 break;
2100 case 'BBBBB':
2101 formatter = dateStrGetter(TranslationType.DayPeriods, exports.TranslationWidth.Narrow, exports.FormStyle.Format, true);
2102 break;
2103 // Hour in AM/PM, (1-12)
2104 case 'h':
2105 formatter = dateGetter(DateType.Hours, 1, -12);
2106 break;
2107 case 'hh':
2108 formatter = dateGetter(DateType.Hours, 2, -12);
2109 break;
2110 // Hour of the day (0-23)
2111 case 'H':
2112 formatter = dateGetter(DateType.Hours, 1);
2113 break;
2114 // Hour in day, padded (00-23)
2115 case 'HH':
2116 formatter = dateGetter(DateType.Hours, 2);
2117 break;
2118 // Minute of the hour (0-59)
2119 case 'm':
2120 formatter = dateGetter(DateType.Minutes, 1);
2121 break;
2122 case 'mm':
2123 formatter = dateGetter(DateType.Minutes, 2);
2124 break;
2125 // Second of the minute (0-59)
2126 case 's':
2127 formatter = dateGetter(DateType.Seconds, 1);
2128 break;
2129 case 'ss':
2130 formatter = dateGetter(DateType.Seconds, 2);
2131 break;
2132 // Fractional second
2133 case 'S':
2134 formatter = dateGetter(DateType.FractionalSeconds, 1);
2135 break;
2136 case 'SS':
2137 formatter = dateGetter(DateType.FractionalSeconds, 2);
2138 break;
2139 case 'SSS':
2140 formatter = dateGetter(DateType.FractionalSeconds, 3);
2141 break;
2142 // Timezone ISO8601 short format (-0430)
2143 case 'Z':
2144 case 'ZZ':
2145 case 'ZZZ':
2146 formatter = timeZoneGetter(ZoneWidth.Short);
2147 break;
2148 // Timezone ISO8601 extended format (-04:30)
2149 case 'ZZZZZ':
2150 formatter = timeZoneGetter(ZoneWidth.Extended);
2151 break;
2152 // Timezone GMT short format (GMT+4)
2153 case 'O':
2154 case 'OO':
2155 case 'OOO':
2156 // Should be location, but fallback to format O instead because we don't have the data yet
2157 case 'z':
2158 case 'zz':
2159 case 'zzz':
2160 formatter = timeZoneGetter(ZoneWidth.ShortGMT);
2161 break;
2162 // Timezone GMT long format (GMT+0430)
2163 case 'OOOO':
2164 case 'ZZZZ':
2165 // Should be location, but fallback to format O instead because we don't have the data yet
2166 case 'zzzz':
2167 formatter = timeZoneGetter(ZoneWidth.Long);
2168 break;
2169 default:
2170 return null;
2171 }
2172 DATE_FORMATS[format] = formatter;
2173 return formatter;
2174 }
2175 function timezoneToOffset(timezone, fallback) {
2176 // Support: IE 9-11 only, Edge 13-15+
2177 // IE/Edge do not "understand" colon (`:`) in timezone
2178 timezone = timezone.replace(/:/g, '');
2179 var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
2180 return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
2181 }
2182 function addDateMinutes(date, minutes) {
2183 date = new Date(date.getTime());
2184 date.setMinutes(date.getMinutes() + minutes);
2185 return date;
2186 }
2187 function convertTimezoneToLocal(date, timezone, reverse) {
2188 var reverseValue = reverse ? -1 : 1;
2189 var dateTimezoneOffset = date.getTimezoneOffset();
2190 var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
2191 return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset));
2192 }
2193 /**
2194 * Converts a value to date.
2195 *
2196 * Supported input formats:
2197 * - `Date`
2198 * - number: timestamp
2199 * - string: numeric (e.g. "1234"), ISO and date strings in a format supported by
2200 * [Date.parse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).
2201 * Note: ISO strings without time return a date without timeoffset.
2202 *
2203 * Throws if unable to convert to a date.
2204 */
2205 function toDate(value) {
2206 if (isDate(value)) {
2207 return value;
2208 }
2209 if (typeof value === 'number' && !isNaN(value)) {
2210 return new Date(value);
2211 }
2212 if (typeof value === 'string') {
2213 value = value.trim();
2214 var parsedNb = parseFloat(value);
2215 // any string that only contains numbers, like "1234" but not like "1234hello"
2216 if (!isNaN(value - parsedNb)) {
2217 return new Date(parsedNb);
2218 }
2219 if (/^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) {
2220 /* For ISO Strings without time the day, month and year must be extracted from the ISO String
2221 before Date creation to avoid time offset and errors in the new Date.
2222 If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new
2223 date, some browsers (e.g. IE 9) will throw an invalid Date error.
2224 If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the timeoffset
2225 is applied.
2226 Note: ISO months are 0 for January, 1 for February, ... */
2227 var _a = __read(value.split('-').map(function (val) { return +val; }), 3), y = _a[0], m = _a[1], d = _a[2];
2228 return new Date(y, m - 1, d);
2229 }
2230 var match = void 0;
2231 if (match = value.match(ISO8601_DATE_REGEX)) {
2232 return isoStringToDate(match);
2233 }
2234 }
2235 var date = new Date(value);
2236 if (!isDate(date)) {
2237 throw new Error("Unable to convert \"" + value + "\" into a date");
2238 }
2239 return date;
2240 }
2241 /**
2242 * Converts a date in ISO8601 to a Date.
2243 * Used instead of `Date.parse` because of browser discrepancies.
2244 */
2245 function isoStringToDate(match) {
2246 var date = new Date(0);
2247 var tzHour = 0;
2248 var tzMin = 0;
2249 // match[8] means that the string contains "Z" (UTC) or a timezone like "+01:00" or "+0100"
2250 var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;
2251 var timeSetter = match[8] ? date.setUTCHours : date.setHours;
2252 // if there is a timezone defined like "+01:00" or "+0100"
2253 if (match[9]) {
2254 tzHour = Number(match[9] + match[10]);
2255 tzMin = Number(match[9] + match[11]);
2256 }
2257 dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));
2258 var h = Number(match[4] || 0) - tzHour;
2259 var m = Number(match[5] || 0) - tzMin;
2260 var s = Number(match[6] || 0);
2261 var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);
2262 timeSetter.call(date, h, m, s, ms);
2263 return date;
2264 }
2265 function isDate(value) {
2266 return value instanceof Date && !isNaN(value.valueOf());
2267 }
2268
2269 /**
2270 * @license
2271 * Copyright Google Inc. All Rights Reserved.
2272 *
2273 * Use of this source code is governed by an MIT-style license that can be
2274 * found in the LICENSE file at https://angular.io/license
2275 */
2276 var NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/;
2277 var MAX_DIGITS = 22;
2278 var DECIMAL_SEP = '.';
2279 var ZERO_CHAR = '0';
2280 var PATTERN_SEP = ';';
2281 var GROUP_SEP = ',';
2282 var DIGIT_CHAR = '#';
2283 var CURRENCY_CHAR = '¤';
2284 var PERCENT_CHAR = '%';
2285 /**
2286 * Transforms a number to a locale string based on a style and a format.
2287 */
2288 function formatNumberToLocaleString(value, pattern, locale, groupSymbol, decimalSymbol, digitsInfo, isPercent) {
2289 if (isPercent === void 0) { isPercent = false; }
2290 var formattedText = '';
2291 var isZero = false;
2292 if (!isFinite(value)) {
2293 formattedText = getLocaleNumberSymbol(locale, exports.NumberSymbol.Infinity);
2294 }
2295 else {
2296 var parsedNumber = parseNumber(value);
2297 if (isPercent) {
2298 parsedNumber = toPercent(parsedNumber);
2299 }
2300 var minInt = pattern.minInt;
2301 var minFraction = pattern.minFrac;
2302 var maxFraction = pattern.maxFrac;
2303 if (digitsInfo) {
2304 var parts = digitsInfo.match(NUMBER_FORMAT_REGEXP);
2305 if (parts === null) {
2306 throw new Error(digitsInfo + " is not a valid digit info");
2307 }
2308 var minIntPart = parts[1];
2309 var minFractionPart = parts[3];
2310 var maxFractionPart = parts[5];
2311 if (minIntPart != null) {
2312 minInt = parseIntAutoRadix(minIntPart);
2313 }
2314 if (minFractionPart != null) {
2315 minFraction = parseIntAutoRadix(minFractionPart);
2316 }
2317 if (maxFractionPart != null) {
2318 maxFraction = parseIntAutoRadix(maxFractionPart);
2319 }
2320 else if (minFractionPart != null && minFraction > maxFraction) {
2321 maxFraction = minFraction;
2322 }
2323 }
2324 roundNumber(parsedNumber, minFraction, maxFraction);
2325 var digits = parsedNumber.digits;
2326 var integerLen = parsedNumber.integerLen;
2327 var exponent = parsedNumber.exponent;
2328 var decimals = [];
2329 isZero = digits.every(function (d) { return !d; });
2330 // pad zeros for small numbers
2331 for (; integerLen < minInt; integerLen++) {
2332 digits.unshift(0);
2333 }
2334 // pad zeros for small numbers
2335 for (; integerLen < 0; integerLen++) {
2336 digits.unshift(0);
2337 }
2338 // extract decimals digits
2339 if (integerLen > 0) {
2340 decimals = digits.splice(integerLen, digits.length);
2341 }
2342 else {
2343 decimals = digits;
2344 digits = [0];
2345 }
2346 // format the integer digits with grouping separators
2347 var groups = [];
2348 if (digits.length >= pattern.lgSize) {
2349 groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(''));
2350 }
2351 while (digits.length > pattern.gSize) {
2352 groups.unshift(digits.splice(-pattern.gSize, digits.length).join(''));
2353 }
2354 if (digits.length) {
2355 groups.unshift(digits.join(''));
2356 }
2357 formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol));
2358 // append the decimal digits
2359 if (decimals.length) {
2360 formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join('');
2361 }
2362 if (exponent) {
2363 formattedText += getLocaleNumberSymbol(locale, exports.NumberSymbol.Exponential) + '+' + exponent;
2364 }
2365 }
2366 if (value < 0 && !isZero) {
2367 formattedText = pattern.negPre + formattedText + pattern.negSuf;
2368 }
2369 else {
2370 formattedText = pattern.posPre + formattedText + pattern.posSuf;
2371 }
2372 return formattedText;
2373 }
2374 /**
2375 * @ngModule CommonModule
2376 * @description
2377 *
2378 * Formats a number as currency using locale rules.
2379 *
2380 * @param value The number to format.
2381 * @param locale A locale code for the locale format rules to use.
2382 * @param currency A string containing the currency symbol or its name,
2383 * such as "$" or "Canadian Dollar". Used in output string, but does not affect the operation
2384 * of the function.
2385 * @param currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)
2386 * currency code, such as `USD` for the US dollar and `EUR` for the euro.
2387 * Used to determine the number of digits in the decimal part.
2388 * @param digitInfo Decimal representation options, specified by a string in the following format:
2389 * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details.
2390 *
2391 * @returns The formatted currency value.
2392 *
2393 * @see `formatNumber()`
2394 * @see `DecimalPipe`
2395 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
2396 *
2397 * @publicApi
2398 */
2399 function formatCurrency(value, locale, currency, currencyCode, digitsInfo) {
2400 var format = getLocaleNumberFormat(locale, exports.NumberFormatStyle.Currency);
2401 var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, exports.NumberSymbol.MinusSign));
2402 pattern.minFrac = getNumberOfCurrencyDigits(currencyCode);
2403 pattern.maxFrac = pattern.minFrac;
2404 var res = formatNumberToLocaleString(value, pattern, locale, exports.NumberSymbol.CurrencyGroup, exports.NumberSymbol.CurrencyDecimal, digitsInfo);
2405 return res
2406 .replace(CURRENCY_CHAR, currency)
2407 // if we have 2 time the currency character, the second one is ignored
2408 .replace(CURRENCY_CHAR, '')
2409 // If there is a spacing between currency character and the value and
2410 // the currency character is supressed by passing an empty string, the
2411 // spacing character would remain as part of the string. Then we
2412 // should remove it.
2413 .trim();
2414 }
2415 /**
2416 * @ngModule CommonModule
2417 * @description
2418 *
2419 * Formats a number as a percentage according to locale rules.
2420 *
2421 * @param value The number to format.
2422 * @param locale A locale code for the locale format rules to use.
2423 * @param digitInfo Decimal representation options, specified by a string in the following format:
2424 * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details.
2425 *
2426 * @returns The formatted percentage value.
2427 *
2428 * @see `formatNumber()`
2429 * @see `DecimalPipe`
2430 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
2431 * @publicApi
2432 *
2433 */
2434 function formatPercent(value, locale, digitsInfo) {
2435 var format = getLocaleNumberFormat(locale, exports.NumberFormatStyle.Percent);
2436 var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, exports.NumberSymbol.MinusSign));
2437 var res = formatNumberToLocaleString(value, pattern, locale, exports.NumberSymbol.Group, exports.NumberSymbol.Decimal, digitsInfo, true);
2438 return res.replace(new RegExp(PERCENT_CHAR, 'g'), getLocaleNumberSymbol(locale, exports.NumberSymbol.PercentSign));
2439 }
2440 /**
2441 * @ngModule CommonModule
2442 * @description
2443 *
2444 * Formats a number as text, with group sizing, separator, and other
2445 * parameters based on the locale.
2446 *
2447 * @param value The number to format.
2448 * @param locale A locale code for the locale format rules to use.
2449 * @param digitInfo Decimal representation options, specified by a string in the following format:
2450 * `{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}`. See `DecimalPipe` for more details.
2451 *
2452 * @returns The formatted text string.
2453 * @see [Internationalization (i18n) Guide](https://angular.io/guide/i18n)
2454 *
2455 * @publicApi
2456 */
2457 function formatNumber(value, locale, digitsInfo) {
2458 var format = getLocaleNumberFormat(locale, exports.NumberFormatStyle.Decimal);
2459 var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, exports.NumberSymbol.MinusSign));
2460 return formatNumberToLocaleString(value, pattern, locale, exports.NumberSymbol.Group, exports.NumberSymbol.Decimal, digitsInfo);
2461 }
2462 function parseNumberFormat(format, minusSign) {
2463 if (minusSign === void 0) { minusSign = '-'; }
2464 var p = {
2465 minInt: 1,
2466 minFrac: 0,
2467 maxFrac: 0,
2468 posPre: '',
2469 posSuf: '',
2470 negPre: '',
2471 negSuf: '',
2472 gSize: 0,
2473 lgSize: 0
2474 };
2475 var patternParts = format.split(PATTERN_SEP);
2476 var positive = patternParts[0];
2477 var negative = patternParts[1];
2478 var positiveParts = positive.indexOf(DECIMAL_SEP) !== -1 ?
2479 positive.split(DECIMAL_SEP) :
2480 [
2481 positive.substring(0, positive.lastIndexOf(ZERO_CHAR) + 1),
2482 positive.substring(positive.lastIndexOf(ZERO_CHAR) + 1)
2483 ], integer = positiveParts[0], fraction = positiveParts[1] || '';
2484 p.posPre = integer.substr(0, integer.indexOf(DIGIT_CHAR));
2485 for (var i = 0; i < fraction.length; i++) {
2486 var ch = fraction.charAt(i);
2487 if (ch === ZERO_CHAR) {
2488 p.minFrac = p.maxFrac = i + 1;
2489 }
2490 else if (ch === DIGIT_CHAR) {
2491 p.maxFrac = i + 1;
2492 }
2493 else {
2494 p.posSuf += ch;
2495 }
2496 }
2497 var groups = integer.split(GROUP_SEP);
2498 p.gSize = groups[1] ? groups[1].length : 0;
2499 p.lgSize = (groups[2] || groups[1]) ? (groups[2] || groups[1]).length : 0;
2500 if (negative) {
2501 var trunkLen = positive.length - p.posPre.length - p.posSuf.length, pos = negative.indexOf(DIGIT_CHAR);
2502 p.negPre = negative.substr(0, pos).replace(/'/g, '');
2503 p.negSuf = negative.substr(pos + trunkLen).replace(/'/g, '');
2504 }
2505 else {
2506 p.negPre = minusSign + p.posPre;
2507 p.negSuf = p.posSuf;
2508 }
2509 return p;
2510 }
2511 // Transforms a parsed number into a percentage by multiplying it by 100
2512 function toPercent(parsedNumber) {
2513 // if the number is 0, don't do anything
2514 if (parsedNumber.digits[0] === 0) {
2515 return parsedNumber;
2516 }
2517 // Getting the current number of decimals
2518 var fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;
2519 if (parsedNumber.exponent) {
2520 parsedNumber.exponent += 2;
2521 }
2522 else {
2523 if (fractionLen === 0) {
2524 parsedNumber.digits.push(0, 0);
2525 }
2526 else if (fractionLen === 1) {
2527 parsedNumber.digits.push(0);
2528 }
2529 parsedNumber.integerLen += 2;
2530 }
2531 return parsedNumber;
2532 }
2533 /**
2534 * Parses a number.
2535 * Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/
2536 */
2537 function parseNumber(num) {
2538 var numStr = Math.abs(num) + '';
2539 var exponent = 0, digits, integerLen;
2540 var i, j, zeros;
2541 // Decimal point?
2542 if ((integerLen = numStr.indexOf(DECIMAL_SEP)) > -1) {
2543 numStr = numStr.replace(DECIMAL_SEP, '');
2544 }
2545 // Exponential form?
2546 if ((i = numStr.search(/e/i)) > 0) {
2547 // Work out the exponent.
2548 if (integerLen < 0)
2549 integerLen = i;
2550 integerLen += +numStr.slice(i + 1);
2551 numStr = numStr.substring(0, i);
2552 }
2553 else if (integerLen < 0) {
2554 // There was no decimal point or exponent so it is an integer.
2555 integerLen = numStr.length;
2556 }
2557 // Count the number of leading zeros.
2558 for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) { /* empty */
2559 }
2560 if (i === (zeros = numStr.length)) {
2561 // The digits are all zero.
2562 digits = [0];
2563 integerLen = 1;
2564 }
2565 else {
2566 // Count the number of trailing zeros
2567 zeros--;
2568 while (numStr.charAt(zeros) === ZERO_CHAR)
2569 zeros--;
2570 // Trailing zeros are insignificant so ignore them
2571 integerLen -= i;
2572 digits = [];
2573 // Convert string to array of digits without leading/trailing zeros.
2574 for (j = 0; i <= zeros; i++, j++) {
2575 digits[j] = Number(numStr.charAt(i));
2576 }
2577 }
2578 // If the number overflows the maximum allowed digits then use an exponent.
2579 if (integerLen > MAX_DIGITS) {
2580 digits = digits.splice(0, MAX_DIGITS - 1);
2581 exponent = integerLen - 1;
2582 integerLen = 1;
2583 }
2584 return { digits: digits, exponent: exponent, integerLen: integerLen };
2585 }
2586 /**
2587 * Round the parsed number to the specified number of decimal places
2588 * This function changes the parsedNumber in-place
2589 */
2590 function roundNumber(parsedNumber, minFrac, maxFrac) {
2591 if (minFrac > maxFrac) {
2592 throw new Error("The minimum number of digits after fraction (" + minFrac + ") is higher than the maximum (" + maxFrac + ").");
2593 }
2594 var digits = parsedNumber.digits;
2595 var fractionLen = digits.length - parsedNumber.integerLen;
2596 var fractionSize = Math.min(Math.max(minFrac, fractionLen), maxFrac);
2597 // The index of the digit to where rounding is to occur
2598 var roundAt = fractionSize + parsedNumber.integerLen;
2599 var digit = digits[roundAt];
2600 if (roundAt > 0) {
2601 // Drop fractional digits beyond `roundAt`
2602 digits.splice(Math.max(parsedNumber.integerLen, roundAt));
2603 // Set non-fractional digits beyond `roundAt` to 0
2604 for (var j = roundAt; j < digits.length; j++) {
2605 digits[j] = 0;
2606 }
2607 }
2608 else {
2609 // We rounded to zero so reset the parsedNumber
2610 fractionLen = Math.max(0, fractionLen);
2611 parsedNumber.integerLen = 1;
2612 digits.length = Math.max(1, roundAt = fractionSize + 1);
2613 digits[0] = 0;
2614 for (var i = 1; i < roundAt; i++)
2615 digits[i] = 0;
2616 }
2617 if (digit >= 5) {
2618 if (roundAt - 1 < 0) {
2619 for (var k = 0; k > roundAt; k--) {
2620 digits.unshift(0);
2621 parsedNumber.integerLen++;
2622 }
2623 digits.unshift(1);
2624 parsedNumber.integerLen++;
2625 }
2626 else {
2627 digits[roundAt - 1]++;
2628 }
2629 }
2630 // Pad out with zeros to get the required fraction length
2631 for (; fractionLen < Math.max(0, fractionSize); fractionLen++)
2632 digits.push(0);
2633 var dropTrailingZeros = fractionSize !== 0;
2634 // Minimal length = nb of decimals required + current nb of integers
2635 // Any number besides that is optional and can be removed if it's a trailing 0
2636 var minLen = minFrac + parsedNumber.integerLen;
2637 // Do any carrying, e.g. a digit was rounded up to 10
2638 var carry = digits.reduceRight(function (carry, d, i, digits) {
2639 d = d + carry;
2640 digits[i] = d < 10 ? d : d - 10; // d % 10
2641 if (dropTrailingZeros) {
2642 // Do not keep meaningless fractional trailing zeros (e.g. 15.52000 --> 15.52)
2643 if (digits[i] === 0 && i >= minLen) {
2644 digits.pop();
2645 }
2646 else {
2647 dropTrailingZeros = false;
2648 }
2649 }
2650 return d >= 10 ? 1 : 0; // Math.floor(d / 10);
2651 }, 0);
2652 if (carry) {
2653 digits.unshift(carry);
2654 parsedNumber.integerLen++;
2655 }
2656 }
2657 function parseIntAutoRadix(text) {
2658 var result = parseInt(text);
2659 if (isNaN(result)) {
2660 throw new Error('Invalid integer literal when parsing ' + text);
2661 }
2662 return result;
2663 }
2664
2665 /**
2666 * @license
2667 * Copyright Google Inc. All Rights Reserved.
2668 *
2669 * Use of this source code is governed by an MIT-style license that can be
2670 * found in the LICENSE file at https://angular.io/license
2671 */
2672 /**
2673 * @publicApi
2674 */
2675 var NgLocalization = /** @class */ (function () {
2676 function NgLocalization() {
2677 }
2678 return NgLocalization;
2679 }());
2680 /**
2681 * Returns the plural category for a given value.
2682 * - "=value" when the case exists,
2683 * - the plural category otherwise
2684 */
2685 function getPluralCategory(value, cases, ngLocalization, locale) {
2686 var key = "=" + value;
2687 if (cases.indexOf(key) > -1) {
2688 return key;
2689 }
2690 key = ngLocalization.getPluralCategory(value, locale);
2691 if (cases.indexOf(key) > -1) {
2692 return key;
2693 }
2694 if (cases.indexOf('other') > -1) {
2695 return 'other';
2696 }
2697 throw new Error("No plural message found for value \"" + value + "\"");
2698 }
2699 /**
2700 * Returns the plural case based on the locale
2701 *
2702 * @publicApi
2703 */
2704 var NgLocaleLocalization = /** @class */ (function (_super) {
2705 __extends(NgLocaleLocalization, _super);
2706 function NgLocaleLocalization(locale) {
2707 var _this = _super.call(this) || this;
2708 _this.locale = locale;
2709 return _this;
2710 }
2711 NgLocaleLocalization.prototype.getPluralCategory = function (value, locale) {
2712 var plural = getLocalePluralCase(locale || this.locale)(value);
2713 switch (plural) {
2714 case exports.Plural.Zero:
2715 return 'zero';
2716 case exports.Plural.One:
2717 return 'one';
2718 case exports.Plural.Two:
2719 return 'two';
2720 case exports.Plural.Few:
2721 return 'few';
2722 case exports.Plural.Many:
2723 return 'many';
2724 default:
2725 return 'other';
2726 }
2727 };
2728 NgLocaleLocalization = __decorate([
2729 i0.Injectable(),
2730 __param(0, i0.Inject(i0.LOCALE_ID)),
2731 __metadata("design:paramtypes", [String])
2732 ], NgLocaleLocalization);
2733 return NgLocaleLocalization;
2734 }(NgLocalization));
2735
2736 /**
2737 * @license
2738 * Copyright Google Inc. All Rights Reserved.
2739 *
2740 * Use of this source code is governed by an MIT-style license that can be
2741 * found in the LICENSE file at https://angular.io/license
2742 */
2743 /**
2744 * Register global data to be used internally by Angular. See the
2745 * ["I18n guide"](guide/i18n#i18n-pipes) to know how to import additional locale data.
2746 *
2747 * The signature registerLocaleData(data: any, extraData?: any) is deprecated since v5.1
2748 *
2749 * @publicApi
2750 */
2751 function registerLocaleData(data, localeId, extraData) {
2752 return i0.ɵregisterLocaleData(data, localeId, extraData);
2753 }
2754
2755 /**
2756 * @license
2757 * Copyright Google Inc. All Rights Reserved.
2758 *
2759 * Use of this source code is governed by an MIT-style license that can be
2760 * found in the LICENSE file at https://angular.io/license
2761 */
2762 function parseCookieValue(cookieStr, name) {
2763 var e_1, _a;
2764 name = encodeURIComponent(name);
2765 try {
2766 for (var _b = __values(cookieStr.split(';')), _c = _b.next(); !_c.done; _c = _b.next()) {
2767 var cookie = _c.value;
2768 var eqIndex = cookie.indexOf('=');
2769 var _d = __read(eqIndex == -1 ? [cookie, ''] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)], 2), cookieName = _d[0], cookieValue = _d[1];
2770 if (cookieName.trim() === name) {
2771 return decodeURIComponent(cookieValue);
2772 }
2773 }
2774 }
2775 catch (e_1_1) { e_1 = { error: e_1_1 }; }
2776 finally {
2777 try {
2778 if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2779 }
2780 finally { if (e_1) throw e_1.error; }
2781 }
2782 return null;
2783 }
2784
2785 /**
2786 * @ngModule CommonModule
2787 *
2788 * @usageNotes
2789 * ```
2790 * <some-element [ngClass]="'first second'">...</some-element>
2791 *
2792 * <some-element [ngClass]="['first', 'second']">...</some-element>
2793 *
2794 * <some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...</some-element>
2795 *
2796 * <some-element [ngClass]="stringExp|arrayExp|objExp">...</some-element>
2797 *
2798 * <some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element>
2799 * ```
2800 *
2801 * @description
2802 *
2803 * Adds and removes CSS classes on an HTML element.
2804 *
2805 * The CSS classes are updated as follows, depending on the type of the expression evaluation:
2806 * - `string` - the CSS classes listed in the string (space delimited) are added,
2807 * - `Array` - the CSS classes declared as Array elements are added,
2808 * - `Object` - keys are CSS classes that get added when the expression given in the value
2809 * evaluates to a truthy value, otherwise they are removed.
2810 *
2811 * @publicApi
2812 */
2813 var NgClass = /** @class */ (function () {
2814 function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) {
2815 this._iterableDiffers = _iterableDiffers;
2816 this._keyValueDiffers = _keyValueDiffers;
2817 this._ngEl = _ngEl;
2818 this._renderer = _renderer;
2819 this._iterableDiffer = null;
2820 this._keyValueDiffer = null;
2821 this._initialClasses = [];
2822 this._rawClass = null;
2823 }
2824 Object.defineProperty(NgClass.prototype, "klass", {
2825 set: function (value) {
2826 this._removeClasses(this._initialClasses);
2827 this._initialClasses = typeof value === 'string' ? value.split(/\s+/) : [];
2828 this._applyClasses(this._initialClasses);
2829 this._applyClasses(this._rawClass);
2830 },
2831 enumerable: true,
2832 configurable: true
2833 });
2834 Object.defineProperty(NgClass.prototype, "ngClass", {
2835 set: function (value) {
2836 this._removeClasses(this._rawClass);
2837 this._applyClasses(this._initialClasses);
2838 this._iterableDiffer = null;
2839 this._keyValueDiffer = null;
2840 this._rawClass = typeof value === 'string' ? value.split(/\s+/) : value;
2841 if (this._rawClass) {
2842 if (i0.ɵisListLikeIterable(this._rawClass)) {
2843 this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create();
2844 }
2845 else {
2846 this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create();
2847 }
2848 }
2849 },
2850 enumerable: true,
2851 configurable: true
2852 });
2853 NgClass.prototype.ngDoCheck = function () {
2854 if (this._iterableDiffer) {
2855 var iterableChanges = this._iterableDiffer.diff(this._rawClass);
2856 if (iterableChanges) {
2857 this._applyIterableChanges(iterableChanges);
2858 }
2859 }
2860 else if (this._keyValueDiffer) {
2861 var keyValueChanges = this._keyValueDiffer.diff(this._rawClass);
2862 if (keyValueChanges) {
2863 this._applyKeyValueChanges(keyValueChanges);
2864 }
2865 }
2866 };
2867 NgClass.prototype._applyKeyValueChanges = function (changes) {
2868 var _this = this;
2869 changes.forEachAddedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
2870 changes.forEachChangedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
2871 changes.forEachRemovedItem(function (record) {
2872 if (record.previousValue) {
2873 _this._toggleClass(record.key, false);
2874 }
2875 });
2876 };
2877 NgClass.prototype._applyIterableChanges = function (changes) {
2878 var _this = this;
2879 changes.forEachAddedItem(function (record) {
2880 if (typeof record.item === 'string') {
2881 _this._toggleClass(record.item, true);
2882 }
2883 else {
2884 throw new Error("NgClass can only toggle CSS classes expressed as strings, got " + i0.ɵstringify(record.item));
2885 }
2886 });
2887 changes.forEachRemovedItem(function (record) { return _this._toggleClass(record.item, false); });
2888 };
2889 /**
2890 * Applies a collection of CSS classes to the DOM element.
2891 *
2892 * For argument of type Set and Array CSS class names contained in those collections are always
2893 * added.
2894 * For argument of type Map CSS class name in the map's key is toggled based on the value (added
2895 * for truthy and removed for falsy).
2896 */
2897 NgClass.prototype._applyClasses = function (rawClassVal) {
2898 var _this = this;
2899 if (rawClassVal) {
2900 if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) {
2901 rawClassVal.forEach(function (klass) { return _this._toggleClass(klass, true); });
2902 }
2903 else {
2904 Object.keys(rawClassVal).forEach(function (klass) { return _this._toggleClass(klass, !!rawClassVal[klass]); });
2905 }
2906 }
2907 };
2908 /**
2909 * Removes a collection of CSS classes from the DOM element. This is mostly useful for cleanup
2910 * purposes.
2911 */
2912 NgClass.prototype._removeClasses = function (rawClassVal) {
2913 var _this = this;
2914 if (rawClassVal) {
2915 if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) {
2916 rawClassVal.forEach(function (klass) { return _this._toggleClass(klass, false); });
2917 }
2918 else {
2919 Object.keys(rawClassVal).forEach(function (klass) { return _this._toggleClass(klass, false); });
2920 }
2921 }
2922 };
2923 NgClass.prototype._toggleClass = function (klass, enabled) {
2924 var _this = this;
2925 klass = klass.trim();
2926 if (klass) {
2927 klass.split(/\s+/g).forEach(function (klass) {
2928 if (enabled) {
2929 _this._renderer.addClass(_this._ngEl.nativeElement, klass);
2930 }
2931 else {
2932 _this._renderer.removeClass(_this._ngEl.nativeElement, klass);
2933 }
2934 });
2935 }
2936 };
2937 __decorate([
2938 i0.Input('class'),
2939 __metadata("design:type", String),
2940 __metadata("design:paramtypes", [String])
2941 ], NgClass.prototype, "klass", null);
2942 __decorate([
2943 i0.Input('ngClass'),
2944 __metadata("design:type", Object),
2945 __metadata("design:paramtypes", [Object])
2946 ], NgClass.prototype, "ngClass", null);
2947 NgClass = __decorate([
2948 i0.Directive({ selector: '[ngClass]' }),
2949 __metadata("design:paramtypes", [i0.IterableDiffers, i0.KeyValueDiffers,
2950 i0.ElementRef, i0.Renderer2])
2951 ], NgClass);
2952 return NgClass;
2953 }());
2954
2955 /**
2956 * @license
2957 * Copyright Google Inc. All Rights Reserved.
2958 *
2959 * Use of this source code is governed by an MIT-style license that can be
2960 * found in the LICENSE file at https://angular.io/license
2961 */
2962 /**
2963 * Instantiates a single {@link Component} type and inserts its Host View into current View.
2964 * `NgComponentOutlet` provides a declarative approach for dynamic component creation.
2965 *
2966 * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and
2967 * any existing component will get destroyed.
2968 *
2969 * @usageNotes
2970 *
2971 * ### Fine tune control
2972 *
2973 * You can control the component creation process by using the following optional attributes:
2974 *
2975 * * `ngComponentOutletInjector`: Optional custom {@link Injector} that will be used as parent for
2976 * the Component. Defaults to the injector of the current view container.
2977 *
2978 * * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content
2979 * section of the component, if exists.
2980 *
2981 * * `ngComponentOutletNgModuleFactory`: Optional module factory to allow dynamically loading other
2982 * module, then load a component from that module.
2983 *
2984 * ### Syntax
2985 *
2986 * Simple
2987 * ```
2988 * <ng-container *ngComponentOutlet="componentTypeExpression"></ng-container>
2989 * ```
2990 *
2991 * Customized injector/content
2992 * ```
2993 * <ng-container *ngComponentOutlet="componentTypeExpression;
2994 * injector: injectorExpression;
2995 * content: contentNodesExpression;">
2996 * </ng-container>
2997 * ```
2998 *
2999 * Customized ngModuleFactory
3000 * ```
3001 * <ng-container *ngComponentOutlet="componentTypeExpression;
3002 * ngModuleFactory: moduleFactory;">
3003 * </ng-container>
3004 * ```
3005 *
3006 * ### A simple example
3007 *
3008 * {@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'}
3009 *
3010 * A more complete example with additional options:
3011 *
3012 * {@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'}
3013 *
3014 * @publicApi
3015 * @ngModule CommonModule
3016 */
3017 var NgComponentOutlet = /** @class */ (function () {
3018 function NgComponentOutlet(_viewContainerRef) {
3019 this._viewContainerRef = _viewContainerRef;
3020 this._componentRef = null;
3021 this._moduleRef = null;
3022 }
3023 NgComponentOutlet.prototype.ngOnChanges = function (changes) {
3024 this._viewContainerRef.clear();
3025 this._componentRef = null;
3026 if (this.ngComponentOutlet) {
3027 var elInjector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector;
3028 if (changes['ngComponentOutletNgModuleFactory']) {
3029 if (this._moduleRef)
3030 this._moduleRef.destroy();
3031 if (this.ngComponentOutletNgModuleFactory) {
3032 var parentModule = elInjector.get(i0.NgModuleRef);
3033 this._moduleRef = this.ngComponentOutletNgModuleFactory.create(parentModule.injector);
3034 }
3035 else {
3036 this._moduleRef = null;
3037 }
3038 }
3039 var componentFactoryResolver = this._moduleRef ? this._moduleRef.componentFactoryResolver :
3040 elInjector.get(i0.ComponentFactoryResolver);
3041 var componentFactory = componentFactoryResolver.resolveComponentFactory(this.ngComponentOutlet);
3042 this._componentRef = this._viewContainerRef.createComponent(componentFactory, this._viewContainerRef.length, elInjector, this.ngComponentOutletContent);
3043 }
3044 };
3045 NgComponentOutlet.prototype.ngOnDestroy = function () {
3046 if (this._moduleRef)
3047 this._moduleRef.destroy();
3048 };
3049 __decorate([
3050 i0.Input(),
3051 __metadata("design:type", i0.Type)
3052 ], NgComponentOutlet.prototype, "ngComponentOutlet", void 0);
3053 __decorate([
3054 i0.Input(),
3055 __metadata("design:type", i0.Injector)
3056 ], NgComponentOutlet.prototype, "ngComponentOutletInjector", void 0);
3057 __decorate([
3058 i0.Input(),
3059 __metadata("design:type", Array)
3060 ], NgComponentOutlet.prototype, "ngComponentOutletContent", void 0);
3061 __decorate([
3062 i0.Input(),
3063 __metadata("design:type", i0.NgModuleFactory)
3064 ], NgComponentOutlet.prototype, "ngComponentOutletNgModuleFactory", void 0);
3065 NgComponentOutlet = __decorate([
3066 i0.Directive({ selector: '[ngComponentOutlet]' }),
3067 __metadata("design:paramtypes", [i0.ViewContainerRef])
3068 ], NgComponentOutlet);
3069 return NgComponentOutlet;
3070 }());
3071
3072 /**
3073 * @license
3074 * Copyright Google Inc. All Rights Reserved.
3075 *
3076 * Use of this source code is governed by an MIT-style license that can be
3077 * found in the LICENSE file at https://angular.io/license
3078 */
3079 /**
3080 * @publicApi
3081 */
3082 var NgForOfContext = /** @class */ (function () {
3083 function NgForOfContext($implicit, ngForOf, index, count) {
3084 this.$implicit = $implicit;
3085 this.ngForOf = ngForOf;
3086 this.index = index;
3087 this.count = count;
3088 }
3089 Object.defineProperty(NgForOfContext.prototype, "first", {
3090 get: function () { return this.index === 0; },
3091 enumerable: true,
3092 configurable: true
3093 });
3094 Object.defineProperty(NgForOfContext.prototype, "last", {
3095 get: function () { return this.index === this.count - 1; },
3096 enumerable: true,
3097 configurable: true
3098 });
3099 Object.defineProperty(NgForOfContext.prototype, "even", {
3100 get: function () { return this.index % 2 === 0; },
3101 enumerable: true,
3102 configurable: true
3103 });
3104 Object.defineProperty(NgForOfContext.prototype, "odd", {
3105 get: function () { return !this.even; },
3106 enumerable: true,
3107 configurable: true
3108 });
3109 return NgForOfContext;
3110 }());
3111 /**
3112 * A [structural directive](guide/structural-directives) that renders
3113 * a template for each item in a collection.
3114 * The directive is placed on an element, which becomes the parent
3115 * of the cloned templates.
3116 *
3117 * The `ngForOf` directive is generally used in the
3118 * [shorthand form](guide/structural-directives#the-asterisk--prefix) `*ngFor`.
3119 * In this form, the template to be rendered for each iteration is the content
3120 * of an anchor element containing the directive.
3121 *
3122 * The following example shows the shorthand syntax with some options,
3123 * contained in an `<li>` element.
3124 *
3125 * ```
3126 * <li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li>
3127 * ```
3128 *
3129 * The shorthand form expands into a long form that uses the `ngForOf` selector
3130 * on an `<ng-template>` element.
3131 * The content of the `<ng-template>` element is the `<li>` element that held the
3132 * short-form directive.
3133 *
3134 * Here is the expanded version of the short-form example.
3135 *
3136 * ```
3137 * <ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn">
3138 * <li>...</li>
3139 * </ng-template>
3140 * ```
3141 *
3142 * Angular automatically expands the shorthand syntax as it compiles the template.
3143 * The context for each embedded view is logically merged to the current component
3144 * context according to its lexical position.
3145 *
3146 * When using the shorthand syntax, Angular allows only [one structural directive
3147 * on an element](guide/structural-directives#one-structural-directive-per-host-element).
3148 * If you want to iterate conditionally, for example,
3149 * put the `*ngIf` on a container element that wraps the `*ngFor` element.
3150 * For futher discussion, see
3151 * [Structural Directives](guide/structural-directives#one-per-element).
3152 *
3153 * @usageNotes
3154 *
3155 * ### Local variables
3156 *
3157 * `NgForOf` provides exported values that can be aliased to local variables.
3158 * For example:
3159 *
3160 * ```
3161 * <li *ngFor="let user of users; index as i; first as isFirst">
3162 * {{i}}/{{users.length}}. {{user}} <span *ngIf="isFirst">default</span>
3163 * </li>
3164 * ```
3165 *
3166 * The following exported values can be aliased to local variables:
3167 *
3168 * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`).
3169 * - `ngForOf: NgIterable<T>`: The value of the iterable expression. Useful when the expression is
3170 * more complex then a property access, for example when using the async pipe (`userStreams |
3171 * async`).
3172 * - `index: number`: The index of the current item in the iterable.
3173 * - `first: boolean`: True when the item is the first item in the iterable.
3174 * - `last: boolean`: True when the item is the last item in the iterable.
3175 * - `even: boolean`: True when the item has an even index in the iterable.
3176 * - `odd: boolean`: True when the item has an odd index in the iterable.
3177 *
3178 * ### Change propagation
3179 *
3180 * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM:
3181 *
3182 * * When an item is added, a new instance of the template is added to the DOM.
3183 * * When an item is removed, its template instance is removed from the DOM.
3184 * * When items are reordered, their respective templates are reordered in the DOM.
3185 *
3186 * Angular uses object identity to track insertions and deletions within the iterator and reproduce
3187 * those changes in the DOM. This has important implications for animations and any stateful
3188 * controls that are present, such as `<input>` elements that accept user input. Inserted rows can
3189 * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state
3190 * such as user input.
3191 * For more on animations, see [Transitions and Triggers](guide/transition-and-triggers).
3192 *
3193 * The identities of elements in the iterator can change while the data does not.
3194 * This can happen, for example, if the iterator is produced from an RPC to the server, and that
3195 * RPC is re-run. Even if the data hasn't changed, the second response produces objects with
3196 * different identities, and Angular must tear down the entire DOM and rebuild it (as if all old
3197 * elements were deleted and all new elements inserted).
3198 *
3199 * To avoid this expensive operation, you can customize the default tracking algorithm.
3200 * by supplying the `trackBy` option to `NgForOf`.
3201 * `trackBy` takes a function that has two arguments: `index` and `item`.
3202 * If `trackBy` is given, Angular tracks changes by the return value of the function.
3203 *
3204 * @see [Structural Directives](guide/structural-directives)
3205 * @ngModule CommonModule
3206 * @publicApi
3207 */
3208 var NgForOf = /** @class */ (function () {
3209 function NgForOf(_viewContainer, _template, _differs) {
3210 this._viewContainer = _viewContainer;
3211 this._template = _template;
3212 this._differs = _differs;
3213 this._ngForOf = null;
3214 this._ngForOfDirty = true;
3215 this._differ = null;
3216 }
3217 Object.defineProperty(NgForOf.prototype, "ngForOf", {
3218 /**
3219 * The value of the iterable expression, which can be used as a
3220 * [template input variable](guide/structural-directives#template-input-variable).
3221 */
3222 set: function (ngForOf) {
3223 this._ngForOf = ngForOf;
3224 this._ngForOfDirty = true;
3225 },
3226 enumerable: true,
3227 configurable: true
3228 });
3229 Object.defineProperty(NgForOf.prototype, "ngForTrackBy", {
3230 get: function () { return this._trackByFn; },
3231 /**
3232 * A function that defines how to track changes for items in the iterable.
3233 *
3234 * When items are added, moved, or removed in the iterable,
3235 * the directive must re-render the appropriate DOM nodes.
3236 * To minimize churn in the DOM, only nodes that have changed
3237 * are re-rendered.
3238 *
3239 * By default, the change detector assumes that
3240 * the object instance identifies the node in the iterable.
3241 * When this function is supplied, the directive uses
3242 * the result of calling this function to identify the item node,
3243 * rather than the identity of the object itself.
3244 *
3245 * The function receives two inputs,
3246 * the iteration index and the node object ID.
3247 */
3248 set: function (fn) {
3249 if (i0.isDevMode() && fn != null && typeof fn !== 'function') {
3250 // TODO(vicb): use a log service once there is a public one available
3251 if (console && console.warn) {
3252 console.warn("trackBy must be a function, but received " + JSON.stringify(fn) + ". " +
3253 "See https://angular.io/api/common/NgForOf#change-propagation for more information.");
3254 }
3255 }
3256 this._trackByFn = fn;
3257 },
3258 enumerable: true,
3259 configurable: true
3260 });
3261 Object.defineProperty(NgForOf.prototype, "ngForTemplate", {
3262 /**
3263 * A reference to the template that is stamped out for each item in the iterable.
3264 * @see [template reference variable](guide/template-syntax#template-reference-variables--var-)
3265 */
3266 set: function (value) {
3267 // TODO(TS2.1): make TemplateRef<Partial<NgForRowOf<T>>> once we move to TS v2.1
3268 // The current type is too restrictive; a template that just uses index, for example,
3269 // should be acceptable.
3270 if (value) {
3271 this._template = value;
3272 }
3273 },
3274 enumerable: true,
3275 configurable: true
3276 });
3277 /**
3278 * Applies the changes when needed.
3279 */
3280 NgForOf.prototype.ngDoCheck = function () {
3281 if (this._ngForOfDirty) {
3282 this._ngForOfDirty = false;
3283 // React on ngForOf changes only once all inputs have been initialized
3284 var value = this._ngForOf;
3285 if (!this._differ && value) {
3286 try {
3287 this._differ = this._differs.find(value).create(this.ngForTrackBy);
3288 }
3289 catch (_a) {
3290 throw new Error("Cannot find a differ supporting object '" + value + "' of type '" + getTypeName(value) + "'. NgFor only supports binding to Iterables such as Arrays.");
3291 }
3292 }
3293 }
3294 if (this._differ) {
3295 var changes = this._differ.diff(this._ngForOf);
3296 if (changes)
3297 this._applyChanges(changes);
3298 }
3299 };
3300 NgForOf.prototype._applyChanges = function (changes) {
3301 var _this = this;
3302 var insertTuples = [];
3303 changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) {
3304 if (item.previousIndex == null) {
3305 // NgForOf is never "null" or "undefined" here because the differ detected
3306 // that a new item needs to be inserted from the iterable. This implies that
3307 // there is an iterable value for "_ngForOf".
3308 var view = _this._viewContainer.createEmbeddedView(_this._template, new NgForOfContext(null, _this._ngForOf, -1, -1), currentIndex === null ? undefined : currentIndex);
3309 var tuple = new RecordViewTuple(item, view);
3310 insertTuples.push(tuple);
3311 }
3312 else if (currentIndex == null) {
3313 _this._viewContainer.remove(adjustedPreviousIndex === null ? undefined : adjustedPreviousIndex);
3314 }
3315 else if (adjustedPreviousIndex !== null) {
3316 var view = _this._viewContainer.get(adjustedPreviousIndex);
3317 _this._viewContainer.move(view, currentIndex);
3318 var tuple = new RecordViewTuple(item, view);
3319 insertTuples.push(tuple);
3320 }
3321 });
3322 for (var i = 0; i < insertTuples.length; i++) {
3323 this._perViewChange(insertTuples[i].view, insertTuples[i].record);
3324 }
3325 for (var i = 0, ilen = this._viewContainer.length; i < ilen; i++) {
3326 var viewRef = this._viewContainer.get(i);
3327 viewRef.context.index = i;
3328 viewRef.context.count = ilen;
3329 viewRef.context.ngForOf = this._ngForOf;
3330 }
3331 changes.forEachIdentityChange(function (record) {
3332 var viewRef = _this._viewContainer.get(record.currentIndex);
3333 viewRef.context.$implicit = record.item;
3334 });
3335 };
3336 NgForOf.prototype._perViewChange = function (view, record) {
3337 view.context.$implicit = record.item;
3338 };
3339 /**
3340 * Asserts the correct type of the context for the template that `NgForOf` will render.
3341 *
3342 * The presence of this method is a signal to the Ivy template type-check compiler that the
3343 * `NgForOf` structural directive renders its template with a specific context type.
3344 */
3345 NgForOf.ngTemplateContextGuard = function (dir, ctx) {
3346 return true;
3347 };
3348 __decorate([
3349 i0.Input(),
3350 __metadata("design:type", Object),
3351 __metadata("design:paramtypes", [Object])
3352 ], NgForOf.prototype, "ngForOf", null);
3353 __decorate([
3354 i0.Input(),
3355 __metadata("design:type", Function),
3356 __metadata("design:paramtypes", [Function])
3357 ], NgForOf.prototype, "ngForTrackBy", null);
3358 __decorate([
3359 i0.Input(),
3360 __metadata("design:type", i0.TemplateRef),
3361 __metadata("design:paramtypes", [i0.TemplateRef])
3362 ], NgForOf.prototype, "ngForTemplate", null);
3363 NgForOf = __decorate([
3364 i0.Directive({ selector: '[ngFor][ngForOf]' }),
3365 __metadata("design:paramtypes", [i0.ViewContainerRef,
3366 i0.TemplateRef, i0.IterableDiffers])
3367 ], NgForOf);
3368 return NgForOf;
3369 }());
3370 var RecordViewTuple = /** @class */ (function () {
3371 function RecordViewTuple(record, view) {
3372 this.record = record;
3373 this.view = view;
3374 }
3375 return RecordViewTuple;
3376 }());
3377 function getTypeName(type) {
3378 return type['name'] || typeof type;
3379 }
3380
3381 /**
3382 * @license
3383 * Copyright Google Inc. All Rights Reserved.
3384 *
3385 * Use of this source code is governed by an MIT-style license that can be
3386 * found in the LICENSE file at https://angular.io/license
3387 */
3388 /**
3389 * A structural directive that conditionally includes a template based on the value of
3390 * an expression coerced to Boolean.
3391 * When the expression evaluates to true, Angular renders the template
3392 * provided in a `then` clause, and when false or null,
3393 * Angular renders the template provided in an optional `else` clause. The default
3394 * template for the `else` clause is blank.
3395 *
3396 * A [shorthand form](guide/structural-directives#the-asterisk--prefix) of the directive,
3397 * `*ngIf="condition"`, is generally used, provided
3398 * as an attribute of the anchor element for the inserted template.
3399 * Angular expands this into a more explicit version, in which the anchor element
3400 * is contained in an `<ng-template>` element.
3401 *
3402 * Simple form with shorthand syntax:
3403 *
3404 * ```
3405 * <div *ngIf="condition">Content to render when condition is true.</div>
3406 * ```
3407 *
3408 * Simple form with expanded syntax:
3409 *
3410 * ```
3411 * <ng-template [ngIf]="condition"><div>Content to render when condition is
3412 * true.</div></ng-template>
3413 * ```
3414 *
3415 * Form with an "else" block:
3416 *
3417 * ```
3418 * <div *ngIf="condition; else elseBlock">Content to render when condition is true.</div>
3419 * <ng-template #elseBlock>Content to render when condition is false.</ng-template>
3420 * ```
3421 *
3422 * Shorthand form with "then" and "else" blocks:
3423 *
3424 * ```
3425 * <div *ngIf="condition; then thenBlock else elseBlock"></div>
3426 * <ng-template #thenBlock>Content to render when condition is true.</ng-template>
3427 * <ng-template #elseBlock>Content to render when condition is false.</ng-template>
3428 * ```
3429 *
3430 * Form with storing the value locally:
3431 *
3432 * ```
3433 * <div *ngIf="condition as value; else elseBlock">{{value}}</div>
3434 * <ng-template #elseBlock>Content to render when value is null.</ng-template>
3435 * ```
3436 *
3437 * @usageNotes
3438 *
3439 * The `*ngIf` directive is most commonly used to conditionally show an inline template,
3440 * as seen in the following example.
3441 * The default `else` template is blank.
3442 *
3443 * {@example common/ngIf/ts/module.ts region='NgIfSimple'}
3444 *
3445 * ### Showing an alternative template using `else`
3446 *
3447 * To display a template when `expression` evaluates to false, use an `else` template
3448 * binding as shown in the following example.
3449 * The `else` binding points to an `<ng-template>` element labeled `#elseBlock`.
3450 * The template can be defined anywhere in the component view, but is typically placed right after
3451 * `ngIf` for readability.
3452 *
3453 * {@example common/ngIf/ts/module.ts region='NgIfElse'}
3454 *
3455 * ### Using an external `then` template
3456 *
3457 * In the previous example, the then-clause template is specified inline, as the content of the
3458 * tag that contains the `ngIf` directive. You can also specify a template that is defined
3459 * externally, by referencing a labeled `<ng-template>` element. When you do this, you can
3460 * change which template to use at runtime, as shown in the following example.
3461 *
3462 * {@example common/ngIf/ts/module.ts region='NgIfThenElse'}
3463 *
3464 * ### Storing a conditional result in a variable
3465 *
3466 * You might want to show a set of properties from the same object. If you are waiting
3467 * for asynchronous data, the object can be undefined.
3468 * In this case, you can use `ngIf` and store the result of the condition in a local
3469 * variable as shown in the the following example.
3470 *
3471 * {@example common/ngIf/ts/module.ts region='NgIfAs'}
3472 *
3473 * This code uses only one `AsyncPipe`, so only one subscription is created.
3474 * The conditional statement stores the result of `userStream|async` in the local variable `user`.
3475 * You can then bind the local `user` repeatedly.
3476 *
3477 * The conditional displays the data only if `userStream` returns a value,
3478 * so you don't need to use the
3479 * [safe-navigation-operator](guide/template-syntax#safe-navigation-operator) (`?.`)
3480 * to guard against null values when accessing properties.
3481 * You can display an alternative template while waiting for the data.
3482 *
3483 * ### Shorthand syntax
3484 *
3485 * The shorthand syntax `*ngIf` expands into two separate template specifications
3486 * for the "then" and "else" clauses. For example, consider the following shorthand statement,
3487 * that is meant to show a loading page while waiting for data to be loaded.
3488 *
3489 * ```
3490 * <div class="hero-list" *ngIf="heroes else loading">
3491 * ...
3492 * </div>
3493 *
3494 * <ng-template #loading>
3495 * <div>Loading...</div>
3496 * </ng-template>
3497 * ```
3498 *
3499 * You can see that the "else" clause references the `<ng-template>`
3500 * with the `#loading` label, and the template for the "then" clause
3501 * is provided as the content of the anchor element.
3502 *
3503 * However, when Angular expands the shorthand syntax, it creates
3504 * another `<ng-template>` tag, with `ngIf` and `ngIfElse` directives.
3505 * The anchor element containing the template for the "then" clause becomes
3506 * the content of this unlabeled `<ng-template>` tag.
3507 *
3508 * ```
3509 * <ng-template [ngIf]="heroes" [ngIfElse]="loading">
3510 * <div class="hero-list">
3511 * ...
3512 * </div>
3513 * </ng-template>
3514 *
3515 * <ng-template #loading>
3516 * <div>Loading...</div>
3517 * </ng-template>
3518 * ```
3519 *
3520 * The presence of the implicit template object has implications for the nesting of
3521 * structural directives. For more on this subject, see
3522 * [Structural Directives](https://angular.io/guide/structural-directives#one-per-element).
3523 *
3524 * @ngModule CommonModule
3525 * @publicApi
3526 */
3527 var NgIf = /** @class */ (function () {
3528 function NgIf(_viewContainer, templateRef) {
3529 this._viewContainer = _viewContainer;
3530 this._context = new NgIfContext();
3531 this._thenTemplateRef = null;
3532 this._elseTemplateRef = null;
3533 this._thenViewRef = null;
3534 this._elseViewRef = null;
3535 this._thenTemplateRef = templateRef;
3536 }
3537 Object.defineProperty(NgIf.prototype, "ngIf", {
3538 /**
3539 * The Boolean expression to evaluate as the condition for showing a template.
3540 */
3541 set: function (condition) {
3542 this._context.$implicit = this._context.ngIf = condition;
3543 this._updateView();
3544 },
3545 enumerable: true,
3546 configurable: true
3547 });
3548 Object.defineProperty(NgIf.prototype, "ngIfThen", {
3549 /**
3550 * A template to show if the condition expression evaluates to true.
3551 */
3552 set: function (templateRef) {
3553 assertTemplate('ngIfThen', templateRef);
3554 this._thenTemplateRef = templateRef;
3555 this._thenViewRef = null; // clear previous view if any.
3556 this._updateView();
3557 },
3558 enumerable: true,
3559 configurable: true
3560 });
3561 Object.defineProperty(NgIf.prototype, "ngIfElse", {
3562 /**
3563 * A template to show if the condition expression evaluates to false.
3564 */
3565 set: function (templateRef) {
3566 assertTemplate('ngIfElse', templateRef);
3567 this._elseTemplateRef = templateRef;
3568 this._elseViewRef = null; // clear previous view if any.
3569 this._updateView();
3570 },
3571 enumerable: true,
3572 configurable: true
3573 });
3574 NgIf.prototype._updateView = function () {
3575 if (this._context.$implicit) {
3576 if (!this._thenViewRef) {
3577 this._viewContainer.clear();
3578 this._elseViewRef = null;
3579 if (this._thenTemplateRef) {
3580 this._thenViewRef =
3581 this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context);
3582 }
3583 }
3584 }
3585 else {
3586 if (!this._elseViewRef) {
3587 this._viewContainer.clear();
3588 this._thenViewRef = null;
3589 if (this._elseTemplateRef) {
3590 this._elseViewRef =
3591 this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context);
3592 }
3593 }
3594 }
3595 };
3596 /**
3597 * Asserts the correct type of the context for the template that `NgIf` will render.
3598 *
3599 * The presence of this method is a signal to the Ivy template type-check compiler that the
3600 * `NgIf` structural directive renders its template with a specific context type.
3601 */
3602 NgIf.ngTemplateContextGuard = function (dir, ctx) { return true; };
3603 __decorate([
3604 i0.Input(),
3605 __metadata("design:type", Object),
3606 __metadata("design:paramtypes", [Object])
3607 ], NgIf.prototype, "ngIf", null);
3608 __decorate([
3609 i0.Input(),
3610 __metadata("design:type", Object),
3611 __metadata("design:paramtypes", [Object])
3612 ], NgIf.prototype, "ngIfThen", null);
3613 __decorate([
3614 i0.Input(),
3615 __metadata("design:type", Object),
3616 __metadata("design:paramtypes", [Object])
3617 ], NgIf.prototype, "ngIfElse", null);
3618 NgIf = __decorate([
3619 i0.Directive({ selector: '[ngIf]' }),
3620 __metadata("design:paramtypes", [i0.ViewContainerRef, i0.TemplateRef])
3621 ], NgIf);
3622 return NgIf;
3623 }());
3624 /**
3625 * @publicApi
3626 */
3627 var NgIfContext = /** @class */ (function () {
3628 function NgIfContext() {
3629 this.$implicit = null;
3630 this.ngIf = null;
3631 }
3632 return NgIfContext;
3633 }());
3634 function assertTemplate(property, templateRef) {
3635 var isTemplateRefOrNull = !!(!templateRef || templateRef.createEmbeddedView);
3636 if (!isTemplateRefOrNull) {
3637 throw new Error(property + " must be a TemplateRef, but received '" + i0.ɵstringify(templateRef) + "'.");
3638 }
3639 }
3640
3641 /**
3642 * @license
3643 * Copyright Google Inc. All Rights Reserved.
3644 *
3645 * Use of this source code is governed by an MIT-style license that can be
3646 * found in the LICENSE file at https://angular.io/license
3647 */
3648 var SwitchView = /** @class */ (function () {
3649 function SwitchView(_viewContainerRef, _templateRef) {
3650 this._viewContainerRef = _viewContainerRef;
3651 this._templateRef = _templateRef;
3652 this._created = false;
3653 }
3654 SwitchView.prototype.create = function () {
3655 this._created = true;
3656 this._viewContainerRef.createEmbeddedView(this._templateRef);
3657 };
3658 SwitchView.prototype.destroy = function () {
3659 this._created = false;
3660 this._viewContainerRef.clear();
3661 };
3662 SwitchView.prototype.enforceState = function (created) {
3663 if (created && !this._created) {
3664 this.create();
3665 }
3666 else if (!created && this._created) {
3667 this.destroy();
3668 }
3669 };
3670 return SwitchView;
3671 }());
3672 /**
3673 * @ngModule CommonModule
3674 *
3675 * @description A structural directive that adds or removes templates (displaying or hiding views)
3676 * when the next match expression matches the switch expression.
3677 *
3678 * The `[ngSwitch]` directive on a container specifies an expression to match against.
3679 * The expressions to match are provided by `ngSwitchCase` directives on views within the container.
3680 * - Every view that matches is rendered.
3681 * - If there are no matches, a view with the `ngSwitchDefault` directive is rendered.
3682 * - Elements within the `[NgSwitch]` statement but outside of any `NgSwitchCase`
3683 * or `ngSwitchDefault` directive are preserved at the location.
3684 *
3685 * @usageNotes
3686 * Define a container element for the directive, and specify the switch expression
3687 * to match against as an attribute:
3688 *
3689 * ```
3690 * <container-element [ngSwitch]="switch_expression">
3691 * ```
3692 *
3693 * Within the container, `*ngSwitchCase` statements specify the match expressions
3694 * as attributes. Include `*ngSwitchDefault` as the final case.
3695 *
3696 * ```
3697 * <container-element [ngSwitch]="switch_expression">
3698 * <some-element *ngSwitchCase="match_expression_1">...</some-element>
3699 * ...
3700 * <some-element *ngSwitchDefault>...</some-element>
3701 * </container-element>
3702 * ```
3703 *
3704 * ### Usage Examples
3705 *
3706 * The following example shows how to use more than one case to display the same view:
3707 *
3708 * ```
3709 * <container-element [ngSwitch]="switch_expression">
3710 * <!-- the same view can be shown in more than one case -->
3711 * <some-element *ngSwitchCase="match_expression_1">...</some-element>
3712 * <some-element *ngSwitchCase="match_expression_2">...</some-element>
3713 * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
3714 * <!--default case when there are no matches -->
3715 * <some-element *ngSwitchDefault>...</some-element>
3716 * </container-element>
3717 * ```
3718 *
3719 * The following example shows how cases can be nested:
3720 * ```
3721 * <container-element [ngSwitch]="switch_expression">
3722 * <some-element *ngSwitchCase="match_expression_1">...</some-element>
3723 * <some-element *ngSwitchCase="match_expression_2">...</some-element>
3724 * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
3725 * <ng-container *ngSwitchCase="match_expression_3">
3726 * <!-- use a ng-container to group multiple root nodes -->
3727 * <inner-element></inner-element>
3728 * <inner-other-element></inner-other-element>
3729 * </ng-container>
3730 * <some-element *ngSwitchDefault>...</some-element>
3731 * </container-element>
3732 * ```
3733 *
3734 * @publicApi
3735 * @see `NgSwitchCase`
3736 * @see `NgSwitchDefault`
3737 * @see [Structural Directives](guide/structural-directives)
3738 *
3739 */
3740 var NgSwitch = /** @class */ (function () {
3741 function NgSwitch() {
3742 this._defaultUsed = false;
3743 this._caseCount = 0;
3744 this._lastCaseCheckIndex = 0;
3745 this._lastCasesMatched = false;
3746 }
3747 Object.defineProperty(NgSwitch.prototype, "ngSwitch", {
3748 set: function (newValue) {
3749 this._ngSwitch = newValue;
3750 if (this._caseCount === 0) {
3751 this._updateDefaultCases(true);
3752 }
3753 },
3754 enumerable: true,
3755 configurable: true
3756 });
3757 /** @internal */
3758 NgSwitch.prototype._addCase = function () { return this._caseCount++; };
3759 /** @internal */
3760 NgSwitch.prototype._addDefault = function (view) {
3761 if (!this._defaultViews) {
3762 this._defaultViews = [];
3763 }
3764 this._defaultViews.push(view);
3765 };
3766 /** @internal */
3767 NgSwitch.prototype._matchCase = function (value) {
3768 var matched = value == this._ngSwitch;
3769 this._lastCasesMatched = this._lastCasesMatched || matched;
3770 this._lastCaseCheckIndex++;
3771 if (this._lastCaseCheckIndex === this._caseCount) {
3772 this._updateDefaultCases(!this._lastCasesMatched);
3773 this._lastCaseCheckIndex = 0;
3774 this._lastCasesMatched = false;
3775 }
3776 return matched;
3777 };
3778 NgSwitch.prototype._updateDefaultCases = function (useDefault) {
3779 if (this._defaultViews && useDefault !== this._defaultUsed) {
3780 this._defaultUsed = useDefault;
3781 for (var i = 0; i < this._defaultViews.length; i++) {
3782 var defaultView = this._defaultViews[i];
3783 defaultView.enforceState(useDefault);
3784 }
3785 }
3786 };
3787 __decorate([
3788 i0.Input(),
3789 __metadata("design:type", Object),
3790 __metadata("design:paramtypes", [Object])
3791 ], NgSwitch.prototype, "ngSwitch", null);
3792 NgSwitch = __decorate([
3793 i0.Directive({ selector: '[ngSwitch]' })
3794 ], NgSwitch);
3795 return NgSwitch;
3796 }());
3797 /**
3798 * @ngModule CommonModule
3799 *
3800 * @description
3801 * Provides a switch case expression to match against an enclosing `ngSwitch` expression.
3802 * When the expressions match, the given `NgSwitchCase` template is rendered.
3803 * If multiple match expressions match the switch expression value, all of them are displayed.
3804 *
3805 * @usageNotes
3806 *
3807 * Within a switch container, `*ngSwitchCase` statements specify the match expressions
3808 * as attributes. Include `*ngSwitchDefault` as the final case.
3809 *
3810 * ```
3811 * <container-element [ngSwitch]="switch_expression">
3812 * <some-element *ngSwitchCase="match_expression_1">...</some-element>
3813 * ...
3814 * <some-element *ngSwitchDefault>...</some-element>
3815 * </container-element>
3816 * ```
3817 *
3818 * Each switch-case statement contains an in-line HTML template or template reference
3819 * that defines the subtree to be selected if the value of the match expression
3820 * matches the value of the switch expression.
3821 *
3822 * Unlike JavaScript, which uses strict equality, Angular uses loose equality.
3823 * This means that the empty string, `""` matches 0.
3824 *
3825 * @publicApi
3826 * @see `NgSwitch`
3827 * @see `NgSwitchDefault`
3828 *
3829 */
3830 var NgSwitchCase = /** @class */ (function () {
3831 function NgSwitchCase(viewContainer, templateRef, ngSwitch) {
3832 this.ngSwitch = ngSwitch;
3833 ngSwitch._addCase();
3834 this._view = new SwitchView(viewContainer, templateRef);
3835 }
3836 /**
3837 * Performs case matching. For internal use only.
3838 */
3839 NgSwitchCase.prototype.ngDoCheck = function () { this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase)); };
3840 __decorate([
3841 i0.Input(),
3842 __metadata("design:type", Object)
3843 ], NgSwitchCase.prototype, "ngSwitchCase", void 0);
3844 NgSwitchCase = __decorate([
3845 i0.Directive({ selector: '[ngSwitchCase]' }),
3846 __param(2, i0.Host()),
3847 __metadata("design:paramtypes", [i0.ViewContainerRef, i0.TemplateRef,
3848 NgSwitch])
3849 ], NgSwitchCase);
3850 return NgSwitchCase;
3851 }());
3852 /**
3853 * @ngModule CommonModule
3854 *
3855 * @description
3856 *
3857 * Creates a view that is rendered when no `NgSwitchCase` expressions
3858 * match the `NgSwitch` expression.
3859 * This statement should be the final case in an `NgSwitch`.
3860 *
3861 * @publicApi
3862 * @see `NgSwitch`
3863 * @see `NgSwitchCase`
3864 *
3865 */
3866 var NgSwitchDefault = /** @class */ (function () {
3867 function NgSwitchDefault(viewContainer, templateRef, ngSwitch) {
3868 ngSwitch._addDefault(new SwitchView(viewContainer, templateRef));
3869 }
3870 NgSwitchDefault = __decorate([
3871 i0.Directive({ selector: '[ngSwitchDefault]' }),
3872 __param(2, i0.Host()),
3873 __metadata("design:paramtypes", [i0.ViewContainerRef, i0.TemplateRef,
3874 NgSwitch])
3875 ], NgSwitchDefault);
3876 return NgSwitchDefault;
3877 }());
3878
3879 /**
3880 * @license
3881 * Copyright Google Inc. All Rights Reserved.
3882 *
3883 * Use of this source code is governed by an MIT-style license that can be
3884 * found in the LICENSE file at https://angular.io/license
3885 */
3886 /**
3887 * @ngModule CommonModule
3888 *
3889 * @usageNotes
3890 * ```
3891 * <some-element [ngPlural]="value">
3892 * <ng-template ngPluralCase="=0">there is nothing</ng-template>
3893 * <ng-template ngPluralCase="=1">there is one</ng-template>
3894 * <ng-template ngPluralCase="few">there are a few</ng-template>
3895 * </some-element>
3896 * ```
3897 *
3898 * @description
3899 *
3900 * Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization.
3901 *
3902 * Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees
3903 * that match the switch expression's pluralization category.
3904 *
3905 * To use this directive you must provide a container element that sets the `[ngPlural]` attribute
3906 * to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their
3907 * expression:
3908 * - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value
3909 * matches the switch expression exactly,
3910 * - otherwise, the view will be treated as a "category match", and will only display if exact
3911 * value matches aren't found and the value maps to its category for the defined locale.
3912 *
3913 * See http://cldr.unicode.org/index/cldr-spec/plural-rules
3914 *
3915 * @publicApi
3916 */
3917 var NgPlural = /** @class */ (function () {
3918 function NgPlural(_localization) {
3919 this._localization = _localization;
3920 this._caseViews = {};
3921 }
3922 Object.defineProperty(NgPlural.prototype, "ngPlural", {
3923 set: function (value) {
3924 this._switchValue = value;
3925 this._updateView();
3926 },
3927 enumerable: true,
3928 configurable: true
3929 });
3930 NgPlural.prototype.addCase = function (value, switchView) { this._caseViews[value] = switchView; };
3931 NgPlural.prototype._updateView = function () {
3932 this._clearViews();
3933 var cases = Object.keys(this._caseViews);
3934 var key = getPluralCategory(this._switchValue, cases, this._localization);
3935 this._activateView(this._caseViews[key]);
3936 };
3937 NgPlural.prototype._clearViews = function () {
3938 if (this._activeView)
3939 this._activeView.destroy();
3940 };
3941 NgPlural.prototype._activateView = function (view) {
3942 if (view) {
3943 this._activeView = view;
3944 this._activeView.create();
3945 }
3946 };
3947 __decorate([
3948 i0.Input(),
3949 __metadata("design:type", Number),
3950 __metadata("design:paramtypes", [Number])
3951 ], NgPlural.prototype, "ngPlural", null);
3952 NgPlural = __decorate([
3953 i0.Directive({ selector: '[ngPlural]' }),
3954 __metadata("design:paramtypes", [NgLocalization])
3955 ], NgPlural);
3956 return NgPlural;
3957 }());
3958 /**
3959 * @ngModule CommonModule
3960 *
3961 * @description
3962 *
3963 * Creates a view that will be added/removed from the parent {@link NgPlural} when the
3964 * given expression matches the plural expression according to CLDR rules.
3965 *
3966 * @usageNotes
3967 * ```
3968 * <some-element [ngPlural]="value">
3969 * <ng-template ngPluralCase="=0">...</ng-template>
3970 * <ng-template ngPluralCase="other">...</ng-template>
3971 * </some-element>
3972 *```
3973 *
3974 * See {@link NgPlural} for more details and example.
3975 *
3976 * @publicApi
3977 */
3978 var NgPluralCase = /** @class */ (function () {
3979 function NgPluralCase(value, template, viewContainer, ngPlural) {
3980 this.value = value;
3981 var isANumber = !isNaN(Number(value));
3982 ngPlural.addCase(isANumber ? "=" + value : value, new SwitchView(viewContainer, template));
3983 }
3984 NgPluralCase = __decorate([
3985 i0.Directive({ selector: '[ngPluralCase]' }),
3986 __param(0, i0.Attribute('ngPluralCase')),
3987 __param(3, i0.Host()),
3988 __metadata("design:paramtypes", [String, i0.TemplateRef,
3989 i0.ViewContainerRef, NgPlural])
3990 ], NgPluralCase);
3991 return NgPluralCase;
3992 }());
3993
3994 /**
3995 * @ngModule CommonModule
3996 *
3997 * @usageNotes
3998 *
3999 * Set the font of the containing element to the result of an expression.
4000 *
4001 * ```
4002 * <some-element [ngStyle]="{'font-style': styleExp}">...</some-element>
4003 * ```
4004 *
4005 * Set the width of the containing element to a pixel value returned by an expression.
4006 *
4007 * ```
4008 * <some-element [ngStyle]="{'max-width.px': widthExp}">...</some-element>
4009 * ```
4010 *
4011 * Set a collection of style values using an expression that returns key-value pairs.
4012 *
4013 * ```
4014 * <some-element [ngStyle]="objExp">...</some-element>
4015 * ```
4016 *
4017 * @description
4018 *
4019 * An attribute directive that updates styles for the containing HTML element.
4020 * Sets one or more style properties, specified as colon-separated key-value pairs.
4021 * The key is a style name, with an optional `.<unit>` suffix
4022 * (such as 'top.px', 'font-style.em').
4023 * The value is an expression to be evaluated.
4024 * The resulting non-null value, expressed in the given unit,
4025 * is assigned to the given style property.
4026 * If the result of evaluation is null, the corresponding style is removed.
4027 *
4028 * @publicApi
4029 */
4030 var NgStyle = /** @class */ (function () {
4031 function NgStyle(_ngEl, _differs, _renderer) {
4032 this._ngEl = _ngEl;
4033 this._differs = _differs;
4034 this._renderer = _renderer;
4035 this._ngStyle = null;
4036 this._differ = null;
4037 }
4038 Object.defineProperty(NgStyle.prototype, "ngStyle", {
4039 set: function (values) {
4040 this._ngStyle = values;
4041 if (!this._differ && values) {
4042 this._differ = this._differs.find(values).create();
4043 }
4044 },
4045 enumerable: true,
4046 configurable: true
4047 });
4048 NgStyle.prototype.ngDoCheck = function () {
4049 if (this._differ) {
4050 var changes = this._differ.diff(this._ngStyle);
4051 if (changes) {
4052 this._applyChanges(changes);
4053 }
4054 }
4055 };
4056 NgStyle.prototype._setStyle = function (nameAndUnit, value) {
4057 var _a = __read(nameAndUnit.split('.'), 2), name = _a[0], unit = _a[1];
4058 value = value != null && unit ? "" + value + unit : value;
4059 if (value != null) {
4060 this._renderer.setStyle(this._ngEl.nativeElement, name, value);
4061 }
4062 else {
4063 this._renderer.removeStyle(this._ngEl.nativeElement, name);
4064 }
4065 };
4066 NgStyle.prototype._applyChanges = function (changes) {
4067 var _this = this;
4068 changes.forEachRemovedItem(function (record) { return _this._setStyle(record.key, null); });
4069 changes.forEachAddedItem(function (record) { return _this._setStyle(record.key, record.currentValue); });
4070 changes.forEachChangedItem(function (record) { return _this._setStyle(record.key, record.currentValue); });
4071 };
4072 __decorate([
4073 i0.Input('ngStyle'),
4074 __metadata("design:type", Object),
4075 __metadata("design:paramtypes", [Object])
4076 ], NgStyle.prototype, "ngStyle", null);
4077 NgStyle = __decorate([
4078 i0.Directive({ selector: '[ngStyle]' }),
4079 __metadata("design:paramtypes", [i0.ElementRef, i0.KeyValueDiffers, i0.Renderer2])
4080 ], NgStyle);
4081 return NgStyle;
4082 }());
4083
4084 /**
4085 * @license
4086 * Copyright Google Inc. All Rights Reserved.
4087 *
4088 * Use of this source code is governed by an MIT-style license that can be
4089 * found in the LICENSE file at https://angular.io/license
4090 */
4091 /**
4092 * @ngModule CommonModule
4093 *
4094 * @description
4095 *
4096 * Inserts an embedded view from a prepared `TemplateRef`.
4097 *
4098 * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`.
4099 * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding
4100 * by the local template `let` declarations.
4101 *
4102 * @usageNotes
4103 * ```
4104 * <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container>
4105 * ```
4106 *
4107 * Using the key `$implicit` in the context object will set its value as default.
4108 *
4109 * ### Example
4110 *
4111 * {@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'}
4112 *
4113 * @publicApi
4114 */
4115 var NgTemplateOutlet = /** @class */ (function () {
4116 function NgTemplateOutlet(_viewContainerRef) {
4117 this._viewContainerRef = _viewContainerRef;
4118 this._viewRef = null;
4119 /**
4120 * A context object to attach to the {@link EmbeddedViewRef}. This should be an
4121 * object, the object's keys will be available for binding by the local template `let`
4122 * declarations.
4123 * Using the key `$implicit` in the context object will set its value as default.
4124 */
4125 this.ngTemplateOutletContext = null;
4126 /**
4127 * A string defining the template reference and optionally the context object for the template.
4128 */
4129 this.ngTemplateOutlet = null;
4130 }
4131 NgTemplateOutlet.prototype.ngOnChanges = function (changes) {
4132 var recreateView = this._shouldRecreateView(changes);
4133 if (recreateView) {
4134 var viewContainerRef = this._viewContainerRef;
4135 if (this._viewRef) {
4136 viewContainerRef.remove(viewContainerRef.indexOf(this._viewRef));
4137 }
4138 this._viewRef = this.ngTemplateOutlet ?
4139 viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, this.ngTemplateOutletContext) :
4140 null;
4141 }
4142 else if (this._viewRef && this.ngTemplateOutletContext) {
4143 this._updateExistingContext(this.ngTemplateOutletContext);
4144 }
4145 };
4146 /**
4147 * We need to re-create existing embedded view if:
4148 * - templateRef has changed
4149 * - context has changes
4150 *
4151 * We mark context object as changed when the corresponding object
4152 * shape changes (new properties are added or existing properties are removed).
4153 * In other words we consider context with the same properties as "the same" even
4154 * if object reference changes (see https://github.com/angular/angular/issues/13407).
4155 */
4156 NgTemplateOutlet.prototype._shouldRecreateView = function (changes) {
4157 var ctxChange = changes['ngTemplateOutletContext'];
4158 return !!changes['ngTemplateOutlet'] || (ctxChange && this._hasContextShapeChanged(ctxChange));
4159 };
4160 NgTemplateOutlet.prototype._hasContextShapeChanged = function (ctxChange) {
4161 var e_1, _a;
4162 var prevCtxKeys = Object.keys(ctxChange.previousValue || {});
4163 var currCtxKeys = Object.keys(ctxChange.currentValue || {});
4164 if (prevCtxKeys.length === currCtxKeys.length) {
4165 try {
4166 for (var currCtxKeys_1 = __values(currCtxKeys), currCtxKeys_1_1 = currCtxKeys_1.next(); !currCtxKeys_1_1.done; currCtxKeys_1_1 = currCtxKeys_1.next()) {
4167 var propName = currCtxKeys_1_1.value;
4168 if (prevCtxKeys.indexOf(propName) === -1) {
4169 return true;
4170 }
4171 }
4172 }
4173 catch (e_1_1) { e_1 = { error: e_1_1 }; }
4174 finally {
4175 try {
4176 if (currCtxKeys_1_1 && !currCtxKeys_1_1.done && (_a = currCtxKeys_1.return)) _a.call(currCtxKeys_1);
4177 }
4178 finally { if (e_1) throw e_1.error; }
4179 }
4180 return false;
4181 }
4182 return true;
4183 };
4184 NgTemplateOutlet.prototype._updateExistingContext = function (ctx) {
4185 var e_2, _a;
4186 try {
4187 for (var _b = __values(Object.keys(ctx)), _c = _b.next(); !_c.done; _c = _b.next()) {
4188 var propName = _c.value;
4189 this._viewRef.context[propName] = this.ngTemplateOutletContext[propName];
4190 }
4191 }
4192 catch (e_2_1) { e_2 = { error: e_2_1 }; }
4193 finally {
4194 try {
4195 if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
4196 }
4197 finally { if (e_2) throw e_2.error; }
4198 }
4199 };
4200 __decorate([
4201 i0.Input(),
4202 __metadata("design:type", Object)
4203 ], NgTemplateOutlet.prototype, "ngTemplateOutletContext", void 0);
4204 __decorate([
4205 i0.Input(),
4206 __metadata("design:type", Object)
4207 ], NgTemplateOutlet.prototype, "ngTemplateOutlet", void 0);
4208 NgTemplateOutlet = __decorate([
4209 i0.Directive({ selector: '[ngTemplateOutlet]' }),
4210 __metadata("design:paramtypes", [i0.ViewContainerRef])
4211 ], NgTemplateOutlet);
4212 return NgTemplateOutlet;
4213 }());
4214
4215 /**
4216 * @license
4217 * Copyright Google Inc. All Rights Reserved.
4218 *
4219 * Use of this source code is governed by an MIT-style license that can be
4220 * found in the LICENSE file at https://angular.io/license
4221 */
4222 /**
4223 * A collection of Angular directives that are likely to be used in each and every Angular
4224 * application.
4225 */
4226 var COMMON_DIRECTIVES = [
4227 NgClass,
4228 NgComponentOutlet,
4229 NgForOf,
4230 NgIf,
4231 NgTemplateOutlet,
4232 NgStyle,
4233 NgSwitch,
4234 NgSwitchCase,
4235 NgSwitchDefault,
4236 NgPlural,
4237 NgPluralCase,
4238 ];
4239
4240 /**
4241 * @license
4242 * Copyright Google Inc. All Rights Reserved.
4243 *
4244 * Use of this source code is governed by an MIT-style license that can be
4245 * found in the LICENSE file at https://angular.io/license
4246 */
4247 function invalidPipeArgumentError(type, value) {
4248 return Error("InvalidPipeArgument: '" + value + "' for pipe '" + i0.ɵstringify(type) + "'");
4249 }
4250
4251 /**
4252 * @license
4253 * Copyright Google Inc. All Rights Reserved.
4254 *
4255 * Use of this source code is governed by an MIT-style license that can be
4256 * found in the LICENSE file at https://angular.io/license
4257 */
4258 var ObservableStrategy = /** @class */ (function () {
4259 function ObservableStrategy() {
4260 }
4261 ObservableStrategy.prototype.createSubscription = function (async, updateLatestValue) {
4262 return async.subscribe({ next: updateLatestValue, error: function (e) { throw e; } });
4263 };
4264 ObservableStrategy.prototype.dispose = function (subscription) { subscription.unsubscribe(); };
4265 ObservableStrategy.prototype.onDestroy = function (subscription) { subscription.unsubscribe(); };
4266 return ObservableStrategy;
4267 }());
4268 var PromiseStrategy = /** @class */ (function () {
4269 function PromiseStrategy() {
4270 }
4271 PromiseStrategy.prototype.createSubscription = function (async, updateLatestValue) {
4272 return async.then(updateLatestValue, function (e) { throw e; });
4273 };
4274 PromiseStrategy.prototype.dispose = function (subscription) { };
4275 PromiseStrategy.prototype.onDestroy = function (subscription) { };
4276 return PromiseStrategy;
4277 }());
4278 var _promiseStrategy = new PromiseStrategy();
4279 var _observableStrategy = new ObservableStrategy();
4280 /**
4281 * @ngModule CommonModule
4282 * @description
4283 *
4284 * Unwraps a value from an asynchronous primitive.
4285 *
4286 * The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has
4287 * emitted. When a new value is emitted, the `async` pipe marks the component to be checked for
4288 * changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid
4289 * potential memory leaks.
4290 *
4291 * @usageNotes
4292 *
4293 * ### Examples
4294 *
4295 * This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the
4296 * promise.
4297 *
4298 * {@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'}
4299 *
4300 * It's also possible to use `async` with Observables. The example below binds the `time` Observable
4301 * to the view. The Observable continuously updates the view with the current time.
4302 *
4303 * {@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'}
4304 *
4305 * @publicApi
4306 */
4307 var AsyncPipe = /** @class */ (function () {
4308 function AsyncPipe(_ref) {
4309 this._ref = _ref;
4310 this._latestValue = null;
4311 this._latestReturnedValue = null;
4312 this._subscription = null;
4313 this._obj = null;
4314 this._strategy = null;
4315 }
4316 AsyncPipe_1 = AsyncPipe;
4317 AsyncPipe.prototype.ngOnDestroy = function () {
4318 if (this._subscription) {
4319 this._dispose();
4320 }
4321 };
4322 AsyncPipe.prototype.transform = function (obj) {
4323 if (!this._obj) {
4324 if (obj) {
4325 this._subscribe(obj);
4326 }
4327 this._latestReturnedValue = this._latestValue;
4328 return this._latestValue;
4329 }
4330 if (obj !== this._obj) {
4331 this._dispose();
4332 return this.transform(obj);
4333 }
4334 if (i0.ɵlooseIdentical(this._latestValue, this._latestReturnedValue)) {
4335 return this._latestReturnedValue;
4336 }
4337 this._latestReturnedValue = this._latestValue;
4338 return i0.WrappedValue.wrap(this._latestValue);
4339 };
4340 AsyncPipe.prototype._subscribe = function (obj) {
4341 var _this = this;
4342 this._obj = obj;
4343 this._strategy = this._selectStrategy(obj);
4344 this._subscription = this._strategy.createSubscription(obj, function (value) { return _this._updateLatestValue(obj, value); });
4345 };
4346 AsyncPipe.prototype._selectStrategy = function (obj) {
4347 if (i0.ɵisPromise(obj)) {
4348 return _promiseStrategy;
4349 }
4350 if (i0.ɵisObservable(obj)) {
4351 return _observableStrategy;
4352 }
4353 throw invalidPipeArgumentError(AsyncPipe_1, obj);
4354 };
4355 AsyncPipe.prototype._dispose = function () {
4356 this._strategy.dispose(this._subscription);
4357 this._latestValue = null;
4358 this._latestReturnedValue = null;
4359 this._subscription = null;
4360 this._obj = null;
4361 };
4362 AsyncPipe.prototype._updateLatestValue = function (async, value) {
4363 if (async === this._obj) {
4364 this._latestValue = value;
4365 this._ref.markForCheck();
4366 }
4367 };
4368 var AsyncPipe_1;
4369 AsyncPipe = AsyncPipe_1 = __decorate([
4370 i0.Pipe({ name: 'async', pure: false }),
4371 __metadata("design:paramtypes", [i0.ChangeDetectorRef])
4372 ], AsyncPipe);
4373 return AsyncPipe;
4374 }());
4375
4376 /**
4377 * @license
4378 * Copyright Google Inc. All Rights Reserved.
4379 *
4380 * Use of this source code is governed by an MIT-style license that can be
4381 * found in the LICENSE file at https://angular.io/license
4382 */
4383 /**
4384 * Transforms text to all lower case.
4385 *
4386 * @see `UpperCasePipe`
4387 * @see `TitleCasePipe`
4388 * @usageNotes
4389 *
4390 * The following example defines a view that allows the user to enter
4391 * text, and then uses the pipe to convert the input text to all lower case.
4392 *
4393 * <code-example path="common/pipes/ts/lowerupper_pipe.ts" region='LowerUpperPipe'></code-example>
4394 *
4395 * @ngModule CommonModule
4396 * @publicApi
4397 */
4398 var LowerCasePipe = /** @class */ (function () {
4399 function LowerCasePipe() {
4400 }
4401 LowerCasePipe_1 = LowerCasePipe;
4402 /**
4403 * @param value The string to transform to lower case.
4404 */
4405 LowerCasePipe.prototype.transform = function (value) {
4406 if (!value)
4407 return value;
4408 if (typeof value !== 'string') {
4409 throw invalidPipeArgumentError(LowerCasePipe_1, value);
4410 }
4411 return value.toLowerCase();
4412 };
4413 var LowerCasePipe_1;
4414 LowerCasePipe = LowerCasePipe_1 = __decorate([
4415 i0.Pipe({ name: 'lowercase' })
4416 ], LowerCasePipe);
4417 return LowerCasePipe;
4418 }());
4419 //
4420 // Regex below matches any Unicode word and compatible with ES5. In ES2018 the same result
4421 // can be achieved by using /\p{L}\S*/gu and also known as Unicode Property Escapes
4422 // (http://2ality.com/2017/07/regexp-unicode-property-escapes.html). Since there is no
4423 // transpilation of this functionality down to ES5 without external tool, the only solution is
4424 // to use already transpiled form. Example can be found here -
4425 // https://mothereff.in/regexpu#input=var+regex+%3D+/%5Cp%7BL%7D/u%3B&unicodePropertyEscape=1
4426 //
4427 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;
4428 /**
4429 * Transforms text to title case.
4430 * Capitalizes the first letter of each word, and transforms the
4431 * rest of the word to lower case.
4432 * Words are delimited by any whitespace character, such as a space, tab, or line-feed character.
4433 *
4434 * @see `LowerCasePipe`
4435 * @see `UpperCasePipe`
4436 *
4437 * @usageNotes
4438 * The following example shows the result of transforming various strings into title case.
4439 *
4440 * <code-example path="common/pipes/ts/titlecase_pipe.ts" region='TitleCasePipe'></code-example>
4441 *
4442 * @ngModule CommonModule
4443 * @publicApi
4444 */
4445 var TitleCasePipe = /** @class */ (function () {
4446 function TitleCasePipe() {
4447 }
4448 TitleCasePipe_1 = TitleCasePipe;
4449 /**
4450 * @param value The string to transform to title case.
4451 */
4452 TitleCasePipe.prototype.transform = function (value) {
4453 if (!value)
4454 return value;
4455 if (typeof value !== 'string') {
4456 throw invalidPipeArgumentError(TitleCasePipe_1, value);
4457 }
4458 return value.replace(unicodeWordMatch, (function (txt) { return txt[0].toUpperCase() + txt.substr(1).toLowerCase(); }));
4459 };
4460 var TitleCasePipe_1;
4461 TitleCasePipe = TitleCasePipe_1 = __decorate([
4462 i0.Pipe({ name: 'titlecase' })
4463 ], TitleCasePipe);
4464 return TitleCasePipe;
4465 }());
4466 /**
4467 * Transforms text to all upper case.
4468 * @see `LowerCasePipe`
4469 * @see `TitleCasePipe`
4470 *
4471 * @ngModule CommonModule
4472 * @publicApi
4473 */
4474 var UpperCasePipe = /** @class */ (function () {
4475 function UpperCasePipe() {
4476 }
4477 UpperCasePipe_1 = UpperCasePipe;
4478 /**
4479 * @param value The string to transform to upper case.
4480 */
4481 UpperCasePipe.prototype.transform = function (value) {
4482 if (!value)
4483 return value;
4484 if (typeof value !== 'string') {
4485 throw invalidPipeArgumentError(UpperCasePipe_1, value);
4486 }
4487 return value.toUpperCase();
4488 };
4489 var UpperCasePipe_1;
4490 UpperCasePipe = UpperCasePipe_1 = __decorate([
4491 i0.Pipe({ name: 'uppercase' })
4492 ], UpperCasePipe);
4493 return UpperCasePipe;
4494 }());
4495
4496 /**
4497 * @license
4498 * Copyright Google Inc. All Rights Reserved.
4499 *
4500 * Use of this source code is governed by an MIT-style license that can be
4501 * found in the LICENSE file at https://angular.io/license
4502 */
4503 // clang-format off
4504 /**
4505 * @ngModule CommonModule
4506 * @description
4507 *
4508 * Formats a date value according to locale rules.
4509 *
4510 * Only the `en-US` locale data comes with Angular. To localize dates
4511 * in another language, you must import the corresponding locale data.
4512 * See the [I18n guide](guide/i18n#i18n-pipes) for more information.
4513 *
4514 * @see `formatDate()`
4515 *
4516 *
4517 * @usageNotes
4518 *
4519 * The result of this pipe is not reevaluated when the input is mutated. To avoid the need to
4520 * reformat the date on every change-detection cycle, treat the date as an immutable object
4521 * and change the reference when the pipe needs to run again.
4522 *
4523 * ### Pre-defined format options
4524 *
4525 * Examples are given in `en-US` locale.
4526 *
4527 * - `'short'`: equivalent to `'M/d/yy, h:mm a'` (`6/15/15, 9:03 AM`).
4528 * - `'medium'`: equivalent to `'MMM d, y, h:mm:ss a'` (`Jun 15, 2015, 9:03:01 AM`).
4529 * - `'long'`: equivalent to `'MMMM d, y, h:mm:ss a z'` (`June 15, 2015 at 9:03:01 AM
4530 * GMT+1`).
4531 * - `'full'`: equivalent to `'EEEE, MMMM d, y, h:mm:ss a zzzz'` (`Monday, June 15, 2015 at
4532 * 9:03:01 AM GMT+01:00`).
4533 * - `'shortDate'`: equivalent to `'M/d/yy'` (`6/15/15`).
4534 * - `'mediumDate'`: equivalent to `'MMM d, y'` (`Jun 15, 2015`).
4535 * - `'longDate'`: equivalent to `'MMMM d, y'` (`June 15, 2015`).
4536 * - `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` (`Monday, June 15, 2015`).
4537 * - `'shortTime'`: equivalent to `'h:mm a'` (`9:03 AM`).
4538 * - `'mediumTime'`: equivalent to `'h:mm:ss a'` (`9:03:01 AM`).
4539 * - `'longTime'`: equivalent to `'h:mm:ss a z'` (`9:03:01 AM GMT+1`).
4540 * - `'fullTime'`: equivalent to `'h:mm:ss a zzzz'` (`9:03:01 AM GMT+01:00`).
4541 *
4542 * ### Custom format options
4543 *
4544 * You can construct a format string using symbols to specify the components
4545 * of a date-time value, as described in the following table.
4546 * Format details depend on the locale.
4547 * Fields marked with (*) are only available in the extra data set for the given locale.
4548 *
4549 * | Field type | Format | Description | Example Value |
4550 * |--------------------|-------------|---------------------------------------------------------------|------------------------------------------------------------|
4551 * | Era | G, GG & GGG | Abbreviated | AD |
4552 * | | GGGG | Wide | Anno Domini |
4553 * | | GGGGG | Narrow | A |
4554 * | Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
4555 * | | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
4556 * | | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
4557 * | | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
4558 * | Month | M | Numeric: 1 digit | 9, 12 |
4559 * | | MM | Numeric: 2 digits + zero padded | 09, 12 |
4560 * | | MMM | Abbreviated | Sep |
4561 * | | MMMM | Wide | September |
4562 * | | MMMMM | Narrow | S |
4563 * | Month standalone | L | Numeric: 1 digit | 9, 12 |
4564 * | | LL | Numeric: 2 digits + zero padded | 09, 12 |
4565 * | | LLL | Abbreviated | Sep |
4566 * | | LLLL | Wide | September |
4567 * | | LLLLL | Narrow | S |
4568 * | Week of year | w | Numeric: minimum digits | 1... 53 |
4569 * | | ww | Numeric: 2 digits + zero padded | 01... 53 |
4570 * | Week of month | W | Numeric: 1 digit | 1... 5 |
4571 * | Day of month | d | Numeric: minimum digits | 1 |
4572 * | | dd | Numeric: 2 digits + zero padded | 01 |
4573 * | Week day | E, EE & EEE | Abbreviated | Tue |
4574 * | | EEEE | Wide | Tuesday |
4575 * | | EEEEE | Narrow | T |
4576 * | | EEEEEE | Short | Tu |
4577 * | Period | a, aa & aaa | Abbreviated | am/pm or AM/PM |
4578 * | | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem |
4579 * | | aaaaa | Narrow | a/p |
4580 * | Period* | B, BB & BBB | Abbreviated | mid. |
4581 * | | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
4582 * | | BBBBB | Narrow | md |
4583 * | Period standalone* | b, bb & bbb | Abbreviated | mid. |
4584 * | | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
4585 * | | bbbbb | Narrow | md |
4586 * | Hour 1-12 | h | Numeric: minimum digits | 1, 12 |
4587 * | | hh | Numeric: 2 digits + zero padded | 01, 12 |
4588 * | Hour 0-23 | H | Numeric: minimum digits | 0, 23 |
4589 * | | HH | Numeric: 2 digits + zero padded | 00, 23 |
4590 * | Minute | m | Numeric: minimum digits | 8, 59 |
4591 * | | mm | Numeric: 2 digits + zero padded | 08, 59 |
4592 * | Second | s | Numeric: minimum digits | 0... 59 |
4593 * | | ss | Numeric: 2 digits + zero padded | 00... 59 |
4594 * | Fractional seconds | S | Numeric: 1 digit | 0... 9 |
4595 * | | SS | Numeric: 2 digits + zero padded | 00... 99 |
4596 * | | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 |
4597 * | Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 |
4598 * | | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 |
4599 * | | Z, ZZ & ZZZ | ISO8601 basic format | -0800 |
4600 * | | ZZZZ | Long localized GMT format | GMT-8:00 |
4601 * | | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 |
4602 * | | O, OO & OOO | Short localized GMT format | GMT-8 |
4603 * | | OOOO | Long localized GMT format | GMT-08:00 |
4604 *
4605 * Note that timezone correction is not applied to an ISO string that has no time component, such as "2016-09-19"
4606 *
4607 * ### Format examples
4608 *
4609 * These examples transform a date into various formats,
4610 * assuming that `dateObj` is a JavaScript `Date` object for
4611 * year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11,
4612 * given in the local time for the `en-US` locale.
4613 *
4614 * ```
4615 * {{ dateObj | date }} // output is 'Jun 15, 2015'
4616 * {{ dateObj | date:'medium' }} // output is 'Jun 15, 2015, 9:43:11 PM'
4617 * {{ dateObj | date:'shortTime' }} // output is '9:43 PM'
4618 * {{ dateObj | date:'mm:ss' }} // output is '43:11'
4619 * ```
4620 *
4621 * ### Usage example
4622 *
4623 * The following component uses a date pipe to display the current date in different formats.
4624 *
4625 * ```
4626 * @Component({
4627 * selector: 'date-pipe',
4628 * template: `<div>
4629 * <p>Today is {{today | date}}</p>
4630 * <p>Or if you prefer, {{today | date:'fullDate'}}</p>
4631 * <p>The time is {{today | date:'h:mm a z'}}</p>
4632 * </div>`
4633 * })
4634 * // Get the current date and time as a date-time value.
4635 * export class DatePipeComponent {
4636 * today: number = Date.now();
4637 * }
4638 * ```
4639 *
4640 * @publicApi
4641 */
4642 // clang-format on
4643 var DatePipe = /** @class */ (function () {
4644 function DatePipe(locale) {
4645 this.locale = locale;
4646 }
4647 DatePipe_1 = DatePipe;
4648 /**
4649 * @param value The date expression: a `Date` object, a number
4650 * (milliseconds since UTC epoch), or an ISO string (https://www.w3.org/TR/NOTE-datetime).
4651 * @param format The date/time components to include, using predefined options or a
4652 * custom format string.
4653 * @param timezone A timezone offset (such as `'+0430'`), or a standard
4654 * UTC/GMT or continental US timezone abbreviation.
4655 * When not supplied, uses the end-user's local system timezone.
4656 * @param locale A locale code for the locale format rules to use.
4657 * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
4658 * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app).
4659 * @returns A date string in the desired format.
4660 */
4661 DatePipe.prototype.transform = function (value, format, timezone, locale) {
4662 if (format === void 0) { format = 'mediumDate'; }
4663 if (value == null || value === '' || value !== value)
4664 return null;
4665 try {
4666 return formatDate(value, format, locale || this.locale, timezone);
4667 }
4668 catch (error) {
4669 throw invalidPipeArgumentError(DatePipe_1, error.message);
4670 }
4671 };
4672 var DatePipe_1;
4673 DatePipe = DatePipe_1 = __decorate([
4674 i0.Pipe({ name: 'date', pure: true }),
4675 __param(0, i0.Inject(i0.LOCALE_ID)),
4676 __metadata("design:paramtypes", [String])
4677 ], DatePipe);
4678 return DatePipe;
4679 }());
4680
4681 /**
4682 * @license
4683 * Copyright Google Inc. All Rights Reserved.
4684 *
4685 * Use of this source code is governed by an MIT-style license that can be
4686 * found in the LICENSE file at https://angular.io/license
4687 */
4688 var _INTERPOLATION_REGEXP = /#/g;
4689 /**
4690 * @ngModule CommonModule
4691 * @description
4692 *
4693 * Maps a value to a string that pluralizes the value according to locale rules.
4694 *
4695 * @usageNotes
4696 *
4697 * ### Example
4698 *
4699 * {@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'}
4700 *
4701 * @publicApi
4702 */
4703 var I18nPluralPipe = /** @class */ (function () {
4704 function I18nPluralPipe(_localization) {
4705 this._localization = _localization;
4706 }
4707 I18nPluralPipe_1 = I18nPluralPipe;
4708 /**
4709 * @param value the number to be formatted
4710 * @param pluralMap an object that mimics the ICU format, see
4711 * http://userguide.icu-project.org/formatparse/messages.
4712 * @param locale a `string` defining the locale to use (uses the current {@link LOCALE_ID} by
4713 * default).
4714 */
4715 I18nPluralPipe.prototype.transform = function (value, pluralMap, locale) {
4716 if (value == null)
4717 return '';
4718 if (typeof pluralMap !== 'object' || pluralMap === null) {
4719 throw invalidPipeArgumentError(I18nPluralPipe_1, pluralMap);
4720 }
4721 var key = getPluralCategory(value, Object.keys(pluralMap), this._localization, locale);
4722 return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString());
4723 };
4724 var I18nPluralPipe_1;
4725 I18nPluralPipe = I18nPluralPipe_1 = __decorate([
4726 i0.Pipe({ name: 'i18nPlural', pure: true }),
4727 __metadata("design:paramtypes", [NgLocalization])
4728 ], I18nPluralPipe);
4729 return I18nPluralPipe;
4730 }());
4731
4732 /**
4733 * @license
4734 * Copyright Google Inc. All Rights Reserved.
4735 *
4736 * Use of this source code is governed by an MIT-style license that can be
4737 * found in the LICENSE file at https://angular.io/license
4738 */
4739 /**
4740 * @ngModule CommonModule
4741 * @description
4742 *
4743 * Generic selector that displays the string that matches the current value.
4744 *
4745 * If none of the keys of the `mapping` match the `value`, then the content
4746 * of the `other` key is returned when present, otherwise an empty string is returned.
4747 *
4748 * @usageNotes
4749 *
4750 * ### Example
4751 *
4752 * {@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'}
4753 *
4754 * @publicApi
4755 */
4756 var I18nSelectPipe = /** @class */ (function () {
4757 function I18nSelectPipe() {
4758 }
4759 I18nSelectPipe_1 = I18nSelectPipe;
4760 /**
4761 * @param value a string to be internationalized.
4762 * @param mapping an object that indicates the text that should be displayed
4763 * for different values of the provided `value`.
4764 */
4765 I18nSelectPipe.prototype.transform = function (value, mapping) {
4766 if (value == null)
4767 return '';
4768 if (typeof mapping !== 'object' || typeof value !== 'string') {
4769 throw invalidPipeArgumentError(I18nSelectPipe_1, mapping);
4770 }
4771 if (mapping.hasOwnProperty(value)) {
4772 return mapping[value];
4773 }
4774 if (mapping.hasOwnProperty('other')) {
4775 return mapping['other'];
4776 }
4777 return '';
4778 };
4779 var I18nSelectPipe_1;
4780 I18nSelectPipe = I18nSelectPipe_1 = __decorate([
4781 i0.Pipe({ name: 'i18nSelect', pure: true })
4782 ], I18nSelectPipe);
4783 return I18nSelectPipe;
4784 }());
4785
4786 /**
4787 * @license
4788 * Copyright Google Inc. All Rights Reserved.
4789 *
4790 * Use of this source code is governed by an MIT-style license that can be
4791 * found in the LICENSE file at https://angular.io/license
4792 */
4793 /**
4794 * @ngModule CommonModule
4795 * @description
4796 *
4797 * Converts a value into its JSON-format representation. Useful for debugging.
4798 *
4799 * @usageNotes
4800 *
4801 * The following component uses a JSON pipe to convert an object
4802 * to JSON format, and displays the string in both formats for comparison.
4803 *
4804 * {@example common/pipes/ts/json_pipe.ts region='JsonPipe'}
4805 *
4806 * @publicApi
4807 */
4808 var JsonPipe = /** @class */ (function () {
4809 function JsonPipe() {
4810 }
4811 /**
4812 * @param value A value of any type to convert into a JSON-format string.
4813 */
4814 JsonPipe.prototype.transform = function (value) { return JSON.stringify(value, null, 2); };
4815 JsonPipe = __decorate([
4816 i0.Pipe({ name: 'json', pure: false })
4817 ], JsonPipe);
4818 return JsonPipe;
4819 }());
4820
4821 /**
4822 * @license
4823 * Copyright Google Inc. All Rights Reserved.
4824 *
4825 * Use of this source code is governed by an MIT-style license that can be
4826 * found in the LICENSE file at https://angular.io/license
4827 */
4828 function makeKeyValuePair(key, value) {
4829 return { key: key, value: value };
4830 }
4831 /**
4832 * @ngModule CommonModule
4833 * @description
4834 *
4835 * Transforms Object or Map into an array of key value pairs.
4836 *
4837 * The output array will be ordered by keys.
4838 * By default the comparator will be by Unicode point value.
4839 * You can optionally pass a compareFn if your keys are complex types.
4840 *
4841 * @usageNotes
4842 * ### Examples
4843 *
4844 * This examples show how an Object or a Map can be iterated by ngFor with the use of this keyvalue
4845 * pipe.
4846 *
4847 * {@example common/pipes/ts/keyvalue_pipe.ts region='KeyValuePipe'}
4848 *
4849 * @publicApi
4850 */
4851 var KeyValuePipe = /** @class */ (function () {
4852 function KeyValuePipe(differs) {
4853 this.differs = differs;
4854 this.keyValues = [];
4855 }
4856 KeyValuePipe.prototype.transform = function (input, compareFn) {
4857 var _this = this;
4858 if (compareFn === void 0) { compareFn = defaultComparator; }
4859 if (!input || (!(input instanceof Map) && typeof input !== 'object')) {
4860 return null;
4861 }
4862 if (!this.differ) {
4863 // make a differ for whatever type we've been passed in
4864 this.differ = this.differs.find(input).create();
4865 }
4866 var differChanges = this.differ.diff(input);
4867 if (differChanges) {
4868 this.keyValues = [];
4869 differChanges.forEachItem(function (r) {
4870 _this.keyValues.push(makeKeyValuePair(r.key, r.currentValue));
4871 });
4872 this.keyValues.sort(compareFn);
4873 }
4874 return this.keyValues;
4875 };
4876 KeyValuePipe = __decorate([
4877 i0.Pipe({ name: 'keyvalue', pure: false }),
4878 __metadata("design:paramtypes", [i0.KeyValueDiffers])
4879 ], KeyValuePipe);
4880 return KeyValuePipe;
4881 }());
4882 function defaultComparator(keyValueA, keyValueB) {
4883 var a = keyValueA.key;
4884 var b = keyValueB.key;
4885 // if same exit with 0;
4886 if (a === b)
4887 return 0;
4888 // make sure that undefined are at the end of the sort.
4889 if (a === undefined)
4890 return 1;
4891 if (b === undefined)
4892 return -1;
4893 // make sure that nulls are at the end of the sort.
4894 if (a === null)
4895 return 1;
4896 if (b === null)
4897 return -1;
4898 if (typeof a == 'string' && typeof b == 'string') {
4899 return a < b ? -1 : 1;
4900 }
4901 if (typeof a == 'number' && typeof b == 'number') {
4902 return a - b;
4903 }
4904 if (typeof a == 'boolean' && typeof b == 'boolean') {
4905 return a < b ? -1 : 1;
4906 }
4907 // `a` and `b` are of different types. Compare their string values.
4908 var aString = String(a);
4909 var bString = String(b);
4910 return aString == bString ? 0 : aString < bString ? -1 : 1;
4911 }
4912
4913 /**
4914 * @license
4915 * Copyright Google Inc. All Rights Reserved.
4916 *
4917 * Use of this source code is governed by an MIT-style license that can be
4918 * found in the LICENSE file at https://angular.io/license
4919 */
4920 /**
4921 * @ngModule CommonModule
4922 * @description
4923 *
4924 * Transforms a number into a string,
4925 * formatted according to locale rules that determine group sizing and
4926 * separator, decimal-point character, and other locale-specific
4927 * configurations.
4928 *
4929 * If no parameters are specified, the function rounds off to the nearest value using this
4930 * [rounding method](https://en.wikibooks.org/wiki/Arithmetic/Rounding).
4931 * The behavior differs from that of the JavaScript ```Math.round()``` function.
4932 * In the following case for example, the pipe rounds down where
4933 * ```Math.round()``` rounds up:
4934 *
4935 * ```html
4936 * -2.5 | number:'1.0-0'
4937 * > -3
4938 * Math.round(-2.5)
4939 * > -2
4940 * ```
4941 *
4942 * @see `formatNumber()`
4943 *
4944 * @usageNotes
4945 * The following code shows how the pipe transforms numbers
4946 * into text strings, according to various format specifications,
4947 * where the caller's default locale is `en-US`.
4948 *
4949 * ### Example
4950 *
4951 * <code-example path="common/pipes/ts/number_pipe.ts" region='NumberPipe'></code-example>
4952 *
4953 * @publicApi
4954 */
4955 var DecimalPipe = /** @class */ (function () {
4956 function DecimalPipe(_locale) {
4957 this._locale = _locale;
4958 }
4959 DecimalPipe_1 = DecimalPipe;
4960 /**
4961 * @param value The number to be formatted.
4962 * @param digitsInfo Decimal representation options, specified by a string
4963 * in the following format:<br>
4964 * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>.
4965 * - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
4966 * Default is `1`.
4967 * - `minFractionDigits`: The minimum number of digits after the decimal point.
4968 * Default is `0`.
4969 * - `maxFractionDigits`: The maximum number of digits after the decimal point.
4970 * Default is `3`.
4971 * @param locale A locale code for the locale format rules to use.
4972 * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
4973 * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app).
4974 */
4975 DecimalPipe.prototype.transform = function (value, digitsInfo, locale) {
4976 if (isEmpty(value))
4977 return null;
4978 locale = locale || this._locale;
4979 try {
4980 var num = strToNumber(value);
4981 return formatNumber(num, locale, digitsInfo);
4982 }
4983 catch (error) {
4984 throw invalidPipeArgumentError(DecimalPipe_1, error.message);
4985 }
4986 };
4987 var DecimalPipe_1;
4988 DecimalPipe = DecimalPipe_1 = __decorate([
4989 i0.Pipe({ name: 'number' }),
4990 __param(0, i0.Inject(i0.LOCALE_ID)),
4991 __metadata("design:paramtypes", [String])
4992 ], DecimalPipe);
4993 return DecimalPipe;
4994 }());
4995 /**
4996 * @ngModule CommonModule
4997 * @description
4998 *
4999 * Transforms a number to a percentage
5000 * string, formatted according to locale rules that determine group sizing and
5001 * separator, decimal-point character, and other locale-specific
5002 * configurations.
5003 *
5004 * @see `formatPercent()`
5005 *
5006 * @usageNotes
5007 * The following code shows how the pipe transforms numbers
5008 * into text strings, according to various format specifications,
5009 * where the caller's default locale is `en-US`.
5010 *
5011 * <code-example path="common/pipes/ts/percent_pipe.ts" region='PercentPipe'></code-example>
5012 *
5013 * @publicApi
5014 */
5015 var PercentPipe = /** @class */ (function () {
5016 function PercentPipe(_locale) {
5017 this._locale = _locale;
5018 }
5019 PercentPipe_1 = PercentPipe;
5020 /**
5021 *
5022 * @param value The number to be formatted as a percentage.
5023 * @param digitsInfo Decimal representation options, specified by a string
5024 * in the following format:<br>
5025 * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>.
5026 * - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
5027 * Default is `1`.
5028 * - `minFractionDigits`: The minimum number of digits after the decimal point.
5029 * Default is `0`.
5030 * - `maxFractionDigits`: The maximum number of digits after the decimal point.
5031 * Default is `0`.
5032 * @param locale A locale code for the locale format rules to use.
5033 * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
5034 * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app).
5035 */
5036 PercentPipe.prototype.transform = function (value, digitsInfo, locale) {
5037 if (isEmpty(value))
5038 return null;
5039 locale = locale || this._locale;
5040 try {
5041 var num = strToNumber(value);
5042 return formatPercent(num, locale, digitsInfo);
5043 }
5044 catch (error) {
5045 throw invalidPipeArgumentError(PercentPipe_1, error.message);
5046 }
5047 };
5048 var PercentPipe_1;
5049 PercentPipe = PercentPipe_1 = __decorate([
5050 i0.Pipe({ name: 'percent' }),
5051 __param(0, i0.Inject(i0.LOCALE_ID)),
5052 __metadata("design:paramtypes", [String])
5053 ], PercentPipe);
5054 return PercentPipe;
5055 }());
5056 /**
5057 * @ngModule CommonModule
5058 * @description
5059 *
5060 * Transforms a number to a currency string, formatted according to locale rules
5061 * that determine group sizing and separator, decimal-point character,
5062 * and other locale-specific configurations.
5063 *
5064 * {@a currency-code-deprecation}
5065 * <div class="alert is-helpful">
5066 *
5067 * **Deprecation notice:**
5068 *
5069 * The default currency code is currently always `USD` but this is deprecated from v9.
5070 *
5071 * **In v11 the default currency code will be taken from the current locale identified by
5072 * the `LOCAL_ID` token. See the [i18n guide](guide/i18n#setting-up-the-locale-of-your-app) for
5073 * more information.**
5074 *
5075 * If you need the previous behavior then set it by creating a `DEFAULT_CURRENCY_CODE` provider in
5076 * your application `NgModule`:
5077 *
5078 * ```ts
5079 * {provide: DEFAULT_CURRENCY_CODE, useValue: 'USD'}
5080 * ```
5081 *
5082 * </div>
5083 *
5084 * @see `getCurrencySymbol()`
5085 * @see `formatCurrency()`
5086 *
5087 * @usageNotes
5088 * The following code shows how the pipe transforms numbers
5089 * into text strings, according to various format specifications,
5090 * where the caller's default locale is `en-US`.
5091 *
5092 * <code-example path="common/pipes/ts/currency_pipe.ts" region='CurrencyPipe'></code-example>
5093 *
5094 * @publicApi
5095 */
5096 var CurrencyPipe = /** @class */ (function () {
5097 function CurrencyPipe(_locale, _defaultCurrencyCode) {
5098 if (_defaultCurrencyCode === void 0) { _defaultCurrencyCode = 'USD'; }
5099 this._locale = _locale;
5100 this._defaultCurrencyCode = _defaultCurrencyCode;
5101 }
5102 CurrencyPipe_1 = CurrencyPipe;
5103 /**
5104 *
5105 * @param value The number to be formatted as currency.
5106 * @param currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code,
5107 * such as `USD` for the US dollar and `EUR` for the euro. The default currency code can be
5108 * configured using the `DEFAULT_CURRENCY_CODE` injection token.
5109 * @param display The format for the currency indicator. One of the following:
5110 * - `code`: Show the code (such as `USD`).
5111 * - `symbol`(default): Show the symbol (such as `$`).
5112 * - `symbol-narrow`: Use the narrow symbol for locales that have two symbols for their
5113 * currency.
5114 * For example, the Canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`. If the
5115 * locale has no narrow symbol, uses the standard symbol for the locale.
5116 * - String: Use the given string value instead of a code or a symbol.
5117 * For example, an empty string will suppress the currency & symbol.
5118 * - Boolean (marked deprecated in v5): `true` for symbol and false for `code`.
5119 *
5120 * @param digitsInfo Decimal representation options, specified by a string
5121 * in the following format:<br>
5122 * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>.
5123 * - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
5124 * Default is `1`.
5125 * - `minFractionDigits`: The minimum number of digits after the decimal point.
5126 * Default is `2`.
5127 * - `maxFractionDigits`: The maximum number of digits after the decimal point.
5128 * Default is `2`.
5129 * If not provided, the number will be formatted with the proper amount of digits,
5130 * depending on what the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) specifies.
5131 * For example, the Canadian dollar has 2 digits, whereas the Chilean peso has none.
5132 * @param locale A locale code for the locale format rules to use.
5133 * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
5134 * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app).
5135 */
5136 CurrencyPipe.prototype.transform = function (value, currencyCode, display, digitsInfo, locale) {
5137 if (display === void 0) { display = 'symbol'; }
5138 if (isEmpty(value))
5139 return null;
5140 locale = locale || this._locale;
5141 if (typeof display === 'boolean') {
5142 if (console && console.warn) {
5143 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\".");
5144 }
5145 display = display ? 'symbol' : 'code';
5146 }
5147 var currency = currencyCode || this._defaultCurrencyCode;
5148 if (display !== 'code') {
5149 if (display === 'symbol' || display === 'symbol-narrow') {
5150 currency = getCurrencySymbol(currency, display === 'symbol' ? 'wide' : 'narrow', locale);
5151 }
5152 else {
5153 currency = display;
5154 }
5155 }
5156 try {
5157 var num = strToNumber(value);
5158 return formatCurrency(num, locale, currency, currencyCode, digitsInfo);
5159 }
5160 catch (error) {
5161 throw invalidPipeArgumentError(CurrencyPipe_1, error.message);
5162 }
5163 };
5164 var CurrencyPipe_1;
5165 CurrencyPipe = CurrencyPipe_1 = __decorate([
5166 i0.Pipe({ name: 'currency' }),
5167 __param(0, i0.Inject(i0.LOCALE_ID)),
5168 __param(1, i0.Inject(i0.DEFAULT_CURRENCY_CODE)),
5169 __metadata("design:paramtypes", [String, String])
5170 ], CurrencyPipe);
5171 return CurrencyPipe;
5172 }());
5173 function isEmpty(value) {
5174 return value == null || value === '' || value !== value;
5175 }
5176 /**
5177 * Transforms a string into a number (if needed).
5178 */
5179 function strToNumber(value) {
5180 // Convert strings to numbers
5181 if (typeof value === 'string' && !isNaN(Number(value) - parseFloat(value))) {
5182 return Number(value);
5183 }
5184 if (typeof value !== 'number') {
5185 throw new Error(value + " is not a number");
5186 }
5187 return value;
5188 }
5189
5190 /**
5191 * @license
5192 * Copyright Google Inc. All Rights Reserved.
5193 *
5194 * Use of this source code is governed by an MIT-style license that can be
5195 * found in the LICENSE file at https://angular.io/license
5196 */
5197 /**
5198 * @ngModule CommonModule
5199 * @description
5200 *
5201 * Creates a new `Array` or `String` containing a subset (slice) of the elements.
5202 *
5203 * @usageNotes
5204 *
5205 * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`
5206 * and `String.prototype.slice()`.
5207 *
5208 * When operating on an `Array`, the returned `Array` is always a copy even when all
5209 * the elements are being returned.
5210 *
5211 * When operating on a blank value, the pipe returns the blank value.
5212 *
5213 * ### List Example
5214 *
5215 * This `ngFor` example:
5216 *
5217 * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'}
5218 *
5219 * produces the following:
5220 *
5221 * ```html
5222 * <li>b</li>
5223 * <li>c</li>
5224 * ```
5225 *
5226 * ### String Examples
5227 *
5228 * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'}
5229 *
5230 * @publicApi
5231 */
5232 var SlicePipe = /** @class */ (function () {
5233 function SlicePipe() {
5234 }
5235 SlicePipe_1 = SlicePipe;
5236 SlicePipe.prototype.transform = function (value, start, end) {
5237 if (value == null)
5238 return value;
5239 if (!this.supports(value)) {
5240 throw invalidPipeArgumentError(SlicePipe_1, value);
5241 }
5242 return value.slice(start, end);
5243 };
5244 SlicePipe.prototype.supports = function (obj) { return typeof obj === 'string' || Array.isArray(obj); };
5245 var SlicePipe_1;
5246 SlicePipe = SlicePipe_1 = __decorate([
5247 i0.Pipe({ name: 'slice', pure: false })
5248 ], SlicePipe);
5249 return SlicePipe;
5250 }());
5251
5252 /**
5253 * @license
5254 * Copyright Google Inc. All Rights Reserved.
5255 *
5256 * Use of this source code is governed by an MIT-style license that can be
5257 * found in the LICENSE file at https://angular.io/license
5258 */
5259 /**
5260 * A collection of Angular pipes that are likely to be used in each and every application.
5261 */
5262 var COMMON_PIPES = [
5263 AsyncPipe,
5264 UpperCasePipe,
5265 LowerCasePipe,
5266 JsonPipe,
5267 SlicePipe,
5268 DecimalPipe,
5269 PercentPipe,
5270 TitleCasePipe,
5271 CurrencyPipe,
5272 DatePipe,
5273 I18nPluralPipe,
5274 I18nSelectPipe,
5275 KeyValuePipe,
5276 ];
5277
5278 /**
5279 * @license
5280 * Copyright Google Inc. All Rights Reserved.
5281 *
5282 * Use of this source code is governed by an MIT-style license that can be
5283 * found in the LICENSE file at https://angular.io/license
5284 */
5285 // Note: This does not contain the location providers,
5286 // as they need some platform specific implementations to work.
5287 /**
5288 * Exports all the basic Angular directives and pipes,
5289 * such as `NgIf`, `NgForOf`, `DecimalPipe`, and so on.
5290 * Re-exported by `BrowserModule`, which is included automatically in the root
5291 * `AppModule` when you create a new app with the CLI `new` command.
5292 *
5293 * * The `providers` options configure the NgModule's injector to provide
5294 * localization dependencies to members.
5295 * * The `exports` options make the declared directives and pipes available for import
5296 * by other NgModules.
5297 *
5298 * @publicApi
5299 */
5300 var CommonModule = /** @class */ (function () {
5301 function CommonModule() {
5302 }
5303 CommonModule = __decorate([
5304 i0.NgModule({
5305 declarations: [COMMON_DIRECTIVES, COMMON_PIPES],
5306 exports: [COMMON_DIRECTIVES, COMMON_PIPES],
5307 providers: [
5308 { provide: NgLocalization, useClass: NgLocaleLocalization },
5309 ],
5310 })
5311 ], CommonModule);
5312 return CommonModule;
5313 }());
5314
5315 /**
5316 * @license
5317 * Copyright Google Inc. All Rights Reserved.
5318 *
5319 * Use of this source code is governed by an MIT-style license that can be
5320 * found in the LICENSE file at https://angular.io/license
5321 */
5322 var PLATFORM_BROWSER_ID = 'browser';
5323 var PLATFORM_SERVER_ID = 'server';
5324 var PLATFORM_WORKER_APP_ID = 'browserWorkerApp';
5325 var PLATFORM_WORKER_UI_ID = 'browserWorkerUi';
5326 /**
5327 * Returns whether a platform id represents a browser platform.
5328 * @publicApi
5329 */
5330 function isPlatformBrowser(platformId) {
5331 return platformId === PLATFORM_BROWSER_ID;
5332 }
5333 /**
5334 * Returns whether a platform id represents a server platform.
5335 * @publicApi
5336 */
5337 function isPlatformServer(platformId) {
5338 return platformId === PLATFORM_SERVER_ID;
5339 }
5340 /**
5341 * Returns whether a platform id represents a web worker app platform.
5342 * @publicApi
5343 */
5344 function isPlatformWorkerApp(platformId) {
5345 return platformId === PLATFORM_WORKER_APP_ID;
5346 }
5347 /**
5348 * Returns whether a platform id represents a web worker UI platform.
5349 * @publicApi
5350 */
5351 function isPlatformWorkerUi(platformId) {
5352 return platformId === PLATFORM_WORKER_UI_ID;
5353 }
5354
5355 /**
5356 * @license
5357 * Copyright Google Inc. All Rights Reserved.
5358 *
5359 * Use of this source code is governed by an MIT-style license that can be
5360 * found in the LICENSE file at https://angular.io/license
5361 */
5362 /**
5363 * @publicApi
5364 */
5365 var VERSION = new i0.Version('9.0.3');
5366
5367 /**
5368 * @license
5369 * Copyright Google Inc. All Rights Reserved.
5370 *
5371 * Use of this source code is governed by an MIT-style license that can be
5372 * found in the LICENSE file at https://angular.io/license
5373 */
5374 /**
5375 * Defines a scroll position manager. Implemented by `BrowserViewportScroller`.
5376 *
5377 * @publicApi
5378 */
5379 var ViewportScroller = /** @class */ (function () {
5380 function ViewportScroller() {
5381 }
5382 // De-sugared tree-shakable injection
5383 // See #23917
5384 /** @nocollapse */
5385 ViewportScroller.ɵprov = i0.ɵɵdefineInjectable({
5386 token: ViewportScroller,
5387 providedIn: 'root',
5388 factory: function () { return new BrowserViewportScroller(i0.ɵɵinject(DOCUMENT), window, i0.ɵɵinject(i0.ErrorHandler)); }
5389 });
5390 return ViewportScroller;
5391 }());
5392 /**
5393 * Manages the scroll position for a browser window.
5394 */
5395 var BrowserViewportScroller = /** @class */ (function () {
5396 function BrowserViewportScroller(document, window, errorHandler) {
5397 this.document = document;
5398 this.window = window;
5399 this.errorHandler = errorHandler;
5400 this.offset = function () { return [0, 0]; };
5401 }
5402 /**
5403 * Configures the top offset used when scrolling to an anchor.
5404 * @param offset A position in screen coordinates (a tuple with x and y values)
5405 * or a function that returns the top offset position.
5406 *
5407 */
5408 BrowserViewportScroller.prototype.setOffset = function (offset) {
5409 if (Array.isArray(offset)) {
5410 this.offset = function () { return offset; };
5411 }
5412 else {
5413 this.offset = offset;
5414 }
5415 };
5416 /**
5417 * Retrieves the current scroll position.
5418 * @returns The position in screen coordinates.
5419 */
5420 BrowserViewportScroller.prototype.getScrollPosition = function () {
5421 if (this.supportScrollRestoration()) {
5422 return [this.window.scrollX, this.window.scrollY];
5423 }
5424 else {
5425 return [0, 0];
5426 }
5427 };
5428 /**
5429 * Sets the scroll position.
5430 * @param position The new position in screen coordinates.
5431 */
5432 BrowserViewportScroller.prototype.scrollToPosition = function (position) {
5433 if (this.supportScrollRestoration()) {
5434 this.window.scrollTo(position[0], position[1]);
5435 }
5436 };
5437 /**
5438 * Scrolls to an anchor element.
5439 * @param anchor The ID of the anchor element.
5440 */
5441 BrowserViewportScroller.prototype.scrollToAnchor = function (anchor) {
5442 if (this.supportScrollRestoration()) {
5443 // Escape anything passed to `querySelector` as it can throw errors and stop the application
5444 // from working if invalid values are passed.
5445 if (this.window.CSS && this.window.CSS.escape) {
5446 anchor = this.window.CSS.escape(anchor);
5447 }
5448 else {
5449 anchor = anchor.replace(/(\"|\'\ |:|\.|\[|\]|,|=)/g, '\\$1');
5450 }
5451 try {
5452 var elSelectedById = this.document.querySelector("#" + anchor);
5453 if (elSelectedById) {
5454 this.scrollToElement(elSelectedById);
5455 return;
5456 }
5457 var elSelectedByName = this.document.querySelector("[name='" + anchor + "']");
5458 if (elSelectedByName) {
5459 this.scrollToElement(elSelectedByName);
5460 return;
5461 }
5462 }
5463 catch (e) {
5464 this.errorHandler.handleError(e);
5465 }
5466 }
5467 };
5468 /**
5469 * Disables automatic scroll restoration provided by the browser.
5470 */
5471 BrowserViewportScroller.prototype.setHistoryScrollRestoration = function (scrollRestoration) {
5472 if (this.supportScrollRestoration()) {
5473 var history_1 = this.window.history;
5474 if (history_1 && history_1.scrollRestoration) {
5475 history_1.scrollRestoration = scrollRestoration;
5476 }
5477 }
5478 };
5479 BrowserViewportScroller.prototype.scrollToElement = function (el) {
5480 var rect = el.getBoundingClientRect();
5481 var left = rect.left + this.window.pageXOffset;
5482 var top = rect.top + this.window.pageYOffset;
5483 var offset = this.offset();
5484 this.window.scrollTo(left - offset[0], top - offset[1]);
5485 };
5486 /**
5487 * We only support scroll restoration when we can get a hold of window.
5488 * This means that we do not support this behavior when running in a web worker.
5489 *
5490 * Lifting this restriction right now would require more changes in the dom adapter.
5491 * Since webworkers aren't widely used, we will lift it once RouterScroller is
5492 * battle-tested.
5493 */
5494 BrowserViewportScroller.prototype.supportScrollRestoration = function () {
5495 try {
5496 return !!this.window && !!this.window.scrollTo;
5497 }
5498 catch (_a) {
5499 return false;
5500 }
5501 };
5502 return BrowserViewportScroller;
5503 }());
5504 /**
5505 * Provides an empty implementation of the viewport scroller. This will
5506 * live in @angular/common as it will be used by both platform-server and platform-webworker.
5507 */
5508 var NullViewportScroller = /** @class */ (function () {
5509 function NullViewportScroller() {
5510 }
5511 /**
5512 * Empty implementation
5513 */
5514 NullViewportScroller.prototype.setOffset = function (offset) { };
5515 /**
5516 * Empty implementation
5517 */
5518 NullViewportScroller.prototype.getScrollPosition = function () { return [0, 0]; };
5519 /**
5520 * Empty implementation
5521 */
5522 NullViewportScroller.prototype.scrollToPosition = function (position) { };
5523 /**
5524 * Empty implementation
5525 */
5526 NullViewportScroller.prototype.scrollToAnchor = function (anchor) { };
5527 /**
5528 * Empty implementation
5529 */
5530 NullViewportScroller.prototype.setHistoryScrollRestoration = function (scrollRestoration) { };
5531 return NullViewportScroller;
5532 }());
5533
5534 /**
5535 * @license
5536 * Copyright Google Inc. All Rights Reserved.
5537 *
5538 * Use of this source code is governed by an MIT-style license that can be
5539 * found in the LICENSE file at https://angular.io/license
5540 */
5541
5542 /**
5543 * @license
5544 * Copyright Google Inc. All Rights Reserved.
5545 *
5546 * Use of this source code is governed by an MIT-style license that can be
5547 * found in the LICENSE file at https://angular.io/license
5548 */
5549 // This file only reexports content of the `src` folder. Keep it that way.
5550
5551 /**
5552 * @license
5553 * Copyright Google Inc. All Rights Reserved.
5554 *
5555 * Use of this source code is governed by an MIT-style license that can be
5556 * found in the LICENSE file at https://angular.io/license
5557 */
5558
5559 /**
5560 * Generated bundle index. Do not edit.
5561 */
5562
5563 exports.APP_BASE_HREF = APP_BASE_HREF;
5564 exports.AsyncPipe = AsyncPipe;
5565 exports.CommonModule = CommonModule;
5566 exports.CurrencyPipe = CurrencyPipe;
5567 exports.DOCUMENT = DOCUMENT;
5568 exports.DatePipe = DatePipe;
5569 exports.DecimalPipe = DecimalPipe;
5570 exports.HashLocationStrategy = HashLocationStrategy;
5571 exports.I18nPluralPipe = I18nPluralPipe;
5572 exports.I18nSelectPipe = I18nSelectPipe;
5573 exports.JsonPipe = JsonPipe;
5574 exports.KeyValuePipe = KeyValuePipe;
5575 exports.LOCATION_INITIALIZED = LOCATION_INITIALIZED;
5576 exports.Location = Location;
5577 exports.LocationStrategy = LocationStrategy;
5578 exports.LowerCasePipe = LowerCasePipe;
5579 exports.NgClass = NgClass;
5580 exports.NgComponentOutlet = NgComponentOutlet;
5581 exports.NgForOf = NgForOf;
5582 exports.NgForOfContext = NgForOfContext;
5583 exports.NgIf = NgIf;
5584 exports.NgIfContext = NgIfContext;
5585 exports.NgLocaleLocalization = NgLocaleLocalization;
5586 exports.NgLocalization = NgLocalization;
5587 exports.NgPlural = NgPlural;
5588 exports.NgPluralCase = NgPluralCase;
5589 exports.NgStyle = NgStyle;
5590 exports.NgSwitch = NgSwitch;
5591 exports.NgSwitchCase = NgSwitchCase;
5592 exports.NgSwitchDefault = NgSwitchDefault;
5593 exports.NgTemplateOutlet = NgTemplateOutlet;
5594 exports.PathLocationStrategy = PathLocationStrategy;
5595 exports.PercentPipe = PercentPipe;
5596 exports.PlatformLocation = PlatformLocation;
5597 exports.SlicePipe = SlicePipe;
5598 exports.TitleCasePipe = TitleCasePipe;
5599 exports.UpperCasePipe = UpperCasePipe;
5600 exports.VERSION = VERSION;
5601 exports.ViewportScroller = ViewportScroller;
5602 exports.formatCurrency = formatCurrency;
5603 exports.formatDate = formatDate;
5604 exports.formatNumber = formatNumber;
5605 exports.formatPercent = formatPercent;
5606 exports.getCurrencySymbol = getCurrencySymbol;
5607 exports.getLocaleCurrencyCode = getLocaleCurrencyCode;
5608 exports.getLocaleCurrencyName = getLocaleCurrencyName;
5609 exports.getLocaleCurrencySymbol = getLocaleCurrencySymbol;
5610 exports.getLocaleDateFormat = getLocaleDateFormat;
5611 exports.getLocaleDateTimeFormat = getLocaleDateTimeFormat;
5612 exports.getLocaleDayNames = getLocaleDayNames;
5613 exports.getLocaleDayPeriods = getLocaleDayPeriods;
5614 exports.getLocaleEraNames = getLocaleEraNames;
5615 exports.getLocaleExtraDayPeriodRules = getLocaleExtraDayPeriodRules;
5616 exports.getLocaleExtraDayPeriods = getLocaleExtraDayPeriods;
5617 exports.getLocaleFirstDayOfWeek = getLocaleFirstDayOfWeek;
5618 exports.getLocaleId = getLocaleId;
5619 exports.getLocaleMonthNames = getLocaleMonthNames;
5620 exports.getLocaleNumberFormat = getLocaleNumberFormat;
5621 exports.getLocaleNumberSymbol = getLocaleNumberSymbol;
5622 exports.getLocalePluralCase = getLocalePluralCase;
5623 exports.getLocaleTimeFormat = getLocaleTimeFormat;
5624 exports.getLocaleWeekEndRange = getLocaleWeekEndRange;
5625 exports.getNumberOfCurrencyDigits = getNumberOfCurrencyDigits;
5626 exports.isPlatformBrowser = isPlatformBrowser;
5627 exports.isPlatformServer = isPlatformServer;
5628 exports.isPlatformWorkerApp = isPlatformWorkerApp;
5629 exports.isPlatformWorkerUi = isPlatformWorkerUi;
5630 exports.registerLocaleData = registerLocaleData;
5631 exports.ɵBrowserPlatformLocation = BrowserPlatformLocation;
5632 exports.ɵDomAdapter = DomAdapter;
5633 exports.ɵNullViewportScroller = NullViewportScroller;
5634 exports.ɵPLATFORM_BROWSER_ID = PLATFORM_BROWSER_ID;
5635 exports.ɵPLATFORM_SERVER_ID = PLATFORM_SERVER_ID;
5636 exports.ɵPLATFORM_WORKER_APP_ID = PLATFORM_WORKER_APP_ID;
5637 exports.ɵPLATFORM_WORKER_UI_ID = PLATFORM_WORKER_UI_ID;
5638 exports.ɵangular_packages_common_common_a = useBrowserPlatformLocation;
5639 exports.ɵangular_packages_common_common_b = createBrowserPlatformLocation;
5640 exports.ɵangular_packages_common_common_c = createLocation;
5641 exports.ɵangular_packages_common_common_d = provideLocationStrategy;
5642 exports.ɵangular_packages_common_common_e = COMMON_DIRECTIVES;
5643 exports.ɵangular_packages_common_common_f = COMMON_PIPES;
5644 exports.ɵgetDOM = getDOM;
5645 exports.ɵparseCookieValue = parseCookieValue;
5646 exports.ɵsetRootDomAdapter = setRootDomAdapter;
5647
5648 Object.defineProperty(exports, '__esModule', { value: true });
5649
5650})));
5651//# sourceMappingURL=common.umd.js.map