UNPKG

99.8 kBJavaScriptView Raw
1/**
2 * @license Angular v9.1.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/common'), require('@angular/core')) :
9 typeof define === 'function' && define.amd ? define('@angular/platform-browser', ['exports', '@angular/common', '@angular/core'], factory) :
10 (global = global || self, factory((global.ng = global.ng || {}, global.ng.platformBrowser = {}), global.ng.common, global.ng.core));
11}(this, (function (exports, common, i0) { 'use strict';
12
13 /*! *****************************************************************************
14 Copyright (c) Microsoft Corporation. All rights reserved.
15 Licensed under the Apache License, Version 2.0 (the "License"); you may not use
16 this file except in compliance with the License. You may obtain a copy of the
17 License at http://www.apache.org/licenses/LICENSE-2.0
18
19 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
21 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
22 MERCHANTABLITY OR NON-INFRINGEMENT.
23
24 See the Apache Version 2.0 License for specific language governing permissions
25 and limitations under the License.
26 ***************************************************************************** */
27 /* global Reflect, Promise */
28
29 var extendStatics = function(d, b) {
30 extendStatics = Object.setPrototypeOf ||
31 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
32 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
33 return extendStatics(d, b);
34 };
35
36 function __extends(d, b) {
37 extendStatics(d, b);
38 function __() { this.constructor = d; }
39 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
40 }
41
42 var __assign = function() {
43 __assign = Object.assign || function __assign(t) {
44 for (var s, i = 1, n = arguments.length; i < n; i++) {
45 s = arguments[i];
46 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
47 }
48 return t;
49 };
50 return __assign.apply(this, arguments);
51 };
52
53 function __rest(s, e) {
54 var t = {};
55 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
56 t[p] = s[p];
57 if (s != null && typeof Object.getOwnPropertySymbols === "function")
58 for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
59 if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
60 t[p[i]] = s[p[i]];
61 }
62 return t;
63 }
64
65 function __decorate(decorators, target, key, desc) {
66 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
67 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
68 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;
69 return c > 3 && r && Object.defineProperty(target, key, r), r;
70 }
71
72 function __param(paramIndex, decorator) {
73 return function (target, key) { decorator(target, key, paramIndex); }
74 }
75
76 function __metadata(metadataKey, metadataValue) {
77 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
78 }
79
80 function __awaiter(thisArg, _arguments, P, generator) {
81 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
82 return new (P || (P = Promise))(function (resolve, reject) {
83 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
84 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
85 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
86 step((generator = generator.apply(thisArg, _arguments || [])).next());
87 });
88 }
89
90 function __generator(thisArg, body) {
91 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
92 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
93 function verb(n) { return function (v) { return step([n, v]); }; }
94 function step(op) {
95 if (f) throw new TypeError("Generator is already executing.");
96 while (_) try {
97 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;
98 if (y = 0, t) op = [op[0] & 2, t.value];
99 switch (op[0]) {
100 case 0: case 1: t = op; break;
101 case 4: _.label++; return { value: op[1], done: false };
102 case 5: _.label++; y = op[1]; op = [0]; continue;
103 case 7: op = _.ops.pop(); _.trys.pop(); continue;
104 default:
105 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
106 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
107 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
108 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
109 if (t[2]) _.ops.pop();
110 _.trys.pop(); continue;
111 }
112 op = body.call(thisArg, _);
113 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
114 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
115 }
116 }
117
118 function __exportStar(m, exports) {
119 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
120 }
121
122 function __values(o) {
123 var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
124 if (m) return m.call(o);
125 if (o && typeof o.length === "number") return {
126 next: function () {
127 if (o && i >= o.length) o = void 0;
128 return { value: o && o[i++], done: !o };
129 }
130 };
131 throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
132 }
133
134 function __read(o, n) {
135 var m = typeof Symbol === "function" && o[Symbol.iterator];
136 if (!m) return o;
137 var i = m.call(o), r, ar = [], e;
138 try {
139 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
140 }
141 catch (error) { e = { error: error }; }
142 finally {
143 try {
144 if (r && !r.done && (m = i["return"])) m.call(i);
145 }
146 finally { if (e) throw e.error; }
147 }
148 return ar;
149 }
150
151 function __spread() {
152 for (var ar = [], i = 0; i < arguments.length; i++)
153 ar = ar.concat(__read(arguments[i]));
154 return ar;
155 }
156
157 function __spreadArrays() {
158 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
159 for (var r = Array(s), k = 0, i = 0; i < il; i++)
160 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
161 r[k] = a[j];
162 return r;
163 };
164
165 function __await(v) {
166 return this instanceof __await ? (this.v = v, this) : new __await(v);
167 }
168
169 function __asyncGenerator(thisArg, _arguments, generator) {
170 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
171 var g = generator.apply(thisArg, _arguments || []), i, q = [];
172 return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
173 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); }); }; }
174 function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
175 function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
176 function fulfill(value) { resume("next", value); }
177 function reject(value) { resume("throw", value); }
178 function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
179 }
180
181 function __asyncDelegator(o) {
182 var i, p;
183 return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
184 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; }
185 }
186
187 function __asyncValues(o) {
188 if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
189 var m = o[Symbol.asyncIterator], i;
190 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);
191 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); }); }; }
192 function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
193 }
194
195 function __makeTemplateObject(cooked, raw) {
196 if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
197 return cooked;
198 };
199
200 function __importStar(mod) {
201 if (mod && mod.__esModule) return mod;
202 var result = {};
203 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
204 result.default = mod;
205 return result;
206 }
207
208 function __importDefault(mod) {
209 return (mod && mod.__esModule) ? mod : { default: mod };
210 }
211
212 function __classPrivateFieldGet(receiver, privateMap) {
213 if (!privateMap.has(receiver)) {
214 throw new TypeError("attempted to get private field on non-instance");
215 }
216 return privateMap.get(receiver);
217 }
218
219 function __classPrivateFieldSet(receiver, privateMap, value) {
220 if (!privateMap.has(receiver)) {
221 throw new TypeError("attempted to set private field on non-instance");
222 }
223 privateMap.set(receiver, value);
224 return value;
225 }
226
227 /**
228 * @license
229 * Copyright Google Inc. All Rights Reserved.
230 *
231 * Use of this source code is governed by an MIT-style license that can be
232 * found in the LICENSE file at https://angular.io/license
233 */
234 /**
235 * Provides DOM operations in any browser environment.
236 *
237 * @security Tread carefully! Interacting with the DOM directly is dangerous and
238 * can introduce XSS risks.
239 */
240 var GenericBrowserDomAdapter = /** @class */ (function (_super) {
241 __extends(GenericBrowserDomAdapter, _super);
242 function GenericBrowserDomAdapter() {
243 return _super.call(this) || this;
244 }
245 GenericBrowserDomAdapter.prototype.supportsDOMEvents = function () {
246 return true;
247 };
248 return GenericBrowserDomAdapter;
249 }(common.ɵDomAdapter));
250
251 /**
252 * @license
253 * Copyright Google Inc. All Rights Reserved.
254 *
255 * Use of this source code is governed by an MIT-style license that can be
256 * found in the LICENSE file at https://angular.io/license
257 */
258 var ɵ0 = function () {
259 if (i0.ɵglobal['Node']) {
260 return i0.ɵglobal['Node'].prototype.contains || function (node) {
261 return !!(this.compareDocumentPosition(node) & 16);
262 };
263 }
264 return undefined;
265 };
266 var nodeContains = (ɵ0)();
267 /**
268 * A `DomAdapter` powered by full browser DOM APIs.
269 *
270 * @security Tread carefully! Interacting with the DOM directly is dangerous and
271 * can introduce XSS risks.
272 */
273 /* tslint:disable:requireParameterType no-console */
274 var BrowserDomAdapter = /** @class */ (function (_super) {
275 __extends(BrowserDomAdapter, _super);
276 function BrowserDomAdapter() {
277 return _super !== null && _super.apply(this, arguments) || this;
278 }
279 BrowserDomAdapter.makeCurrent = function () {
280 common.ɵsetRootDomAdapter(new BrowserDomAdapter());
281 };
282 BrowserDomAdapter.prototype.getProperty = function (el, name) {
283 return el[name];
284 };
285 BrowserDomAdapter.prototype.log = function (error) {
286 if (window.console) {
287 window.console.log && window.console.log(error);
288 }
289 };
290 BrowserDomAdapter.prototype.logGroup = function (error) {
291 if (window.console) {
292 window.console.group && window.console.group(error);
293 }
294 };
295 BrowserDomAdapter.prototype.logGroupEnd = function () {
296 if (window.console) {
297 window.console.groupEnd && window.console.groupEnd();
298 }
299 };
300 BrowserDomAdapter.prototype.onAndCancel = function (el, evt, listener) {
301 el.addEventListener(evt, listener, false);
302 // Needed to follow Dart's subscription semantic, until fix of
303 // https://code.google.com/p/dart/issues/detail?id=17406
304 return function () {
305 el.removeEventListener(evt, listener, false);
306 };
307 };
308 BrowserDomAdapter.prototype.dispatchEvent = function (el, evt) {
309 el.dispatchEvent(evt);
310 };
311 BrowserDomAdapter.prototype.remove = function (node) {
312 if (node.parentNode) {
313 node.parentNode.removeChild(node);
314 }
315 return node;
316 };
317 BrowserDomAdapter.prototype.getValue = function (el) {
318 return el.value;
319 };
320 BrowserDomAdapter.prototype.createElement = function (tagName, doc) {
321 doc = doc || this.getDefaultDocument();
322 return doc.createElement(tagName);
323 };
324 BrowserDomAdapter.prototype.createHtmlDocument = function () {
325 return document.implementation.createHTMLDocument('fakeTitle');
326 };
327 BrowserDomAdapter.prototype.getDefaultDocument = function () {
328 return document;
329 };
330 BrowserDomAdapter.prototype.isElementNode = function (node) {
331 return node.nodeType === Node.ELEMENT_NODE;
332 };
333 BrowserDomAdapter.prototype.isShadowRoot = function (node) {
334 return node instanceof DocumentFragment;
335 };
336 BrowserDomAdapter.prototype.getGlobalEventTarget = function (doc, target) {
337 if (target === 'window') {
338 return window;
339 }
340 if (target === 'document') {
341 return doc;
342 }
343 if (target === 'body') {
344 return doc.body;
345 }
346 return null;
347 };
348 BrowserDomAdapter.prototype.getHistory = function () {
349 return window.history;
350 };
351 BrowserDomAdapter.prototype.getLocation = function () {
352 return window.location;
353 };
354 BrowserDomAdapter.prototype.getBaseHref = function (doc) {
355 var href = getBaseElementHref();
356 return href == null ? null : relativePath(href);
357 };
358 BrowserDomAdapter.prototype.resetBaseElement = function () {
359 baseElement = null;
360 };
361 BrowserDomAdapter.prototype.getUserAgent = function () {
362 return window.navigator.userAgent;
363 };
364 BrowserDomAdapter.prototype.performanceNow = function () {
365 // performance.now() is not available in all browsers, see
366 // http://caniuse.com/#search=performance.now
367 return window.performance && window.performance.now ? window.performance.now() :
368 new Date().getTime();
369 };
370 BrowserDomAdapter.prototype.supportsCookies = function () {
371 return true;
372 };
373 BrowserDomAdapter.prototype.getCookie = function (name) {
374 return common.ɵparseCookieValue(document.cookie, name);
375 };
376 return BrowserDomAdapter;
377 }(GenericBrowserDomAdapter));
378 var baseElement = null;
379 function getBaseElementHref() {
380 if (!baseElement) {
381 baseElement = document.querySelector('base');
382 if (!baseElement) {
383 return null;
384 }
385 }
386 return baseElement.getAttribute('href');
387 }
388 // based on urlUtils.js in AngularJS 1
389 var urlParsingNode;
390 function relativePath(url) {
391 if (!urlParsingNode) {
392 urlParsingNode = document.createElement('a');
393 }
394 urlParsingNode.setAttribute('href', url);
395 return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname :
396 '/' + urlParsingNode.pathname;
397 }
398
399 /**
400 * @license
401 * Copyright Google Inc. All Rights Reserved.
402 *
403 * Use of this source code is governed by an MIT-style license that can be
404 * found in the LICENSE file at https://angular.io/license
405 */
406 /**
407 * An id that identifies a particular application being bootstrapped, that should
408 * match across the client/server boundary.
409 */
410 var TRANSITION_ID = new i0.InjectionToken('TRANSITION_ID');
411 function appInitializerFactory(transitionId, document, injector) {
412 return function () {
413 // Wait for all application initializers to be completed before removing the styles set by
414 // the server.
415 injector.get(i0.ApplicationInitStatus).donePromise.then(function () {
416 var dom = common.ɵgetDOM();
417 var styles = Array.prototype.slice.apply(document.querySelectorAll("style[ng-transition]"));
418 styles.filter(function (el) { return el.getAttribute('ng-transition') === transitionId; })
419 .forEach(function (el) { return dom.remove(el); });
420 });
421 };
422 }
423 var SERVER_TRANSITION_PROVIDERS = [
424 {
425 provide: i0.APP_INITIALIZER,
426 useFactory: appInitializerFactory,
427 deps: [TRANSITION_ID, common.DOCUMENT, i0.Injector],
428 multi: true
429 },
430 ];
431
432 /**
433 * @license
434 * Copyright Google Inc. All Rights Reserved.
435 *
436 * Use of this source code is governed by an MIT-style license that can be
437 * found in the LICENSE file at https://angular.io/license
438 */
439 var BrowserGetTestability = /** @class */ (function () {
440 function BrowserGetTestability() {
441 }
442 BrowserGetTestability.init = function () {
443 i0.setTestabilityGetter(new BrowserGetTestability());
444 };
445 BrowserGetTestability.prototype.addToWindow = function (registry) {
446 i0.ɵglobal['getAngularTestability'] = function (elem, findInAncestors) {
447 if (findInAncestors === void 0) { findInAncestors = true; }
448 var testability = registry.findTestabilityInTree(elem, findInAncestors);
449 if (testability == null) {
450 throw new Error('Could not find testability for element.');
451 }
452 return testability;
453 };
454 i0.ɵglobal['getAllAngularTestabilities'] = function () { return registry.getAllTestabilities(); };
455 i0.ɵglobal['getAllAngularRootElements'] = function () { return registry.getAllRootElements(); };
456 var whenAllStable = function (callback /** TODO #9100 */) {
457 var testabilities = i0.ɵglobal['getAllAngularTestabilities']();
458 var count = testabilities.length;
459 var didWork = false;
460 var decrement = function (didWork_ /** TODO #9100 */) {
461 didWork = didWork || didWork_;
462 count--;
463 if (count == 0) {
464 callback(didWork);
465 }
466 };
467 testabilities.forEach(function (testability /** TODO #9100 */) {
468 testability.whenStable(decrement);
469 });
470 };
471 if (!i0.ɵglobal['frameworkStabilizers']) {
472 i0.ɵglobal['frameworkStabilizers'] = [];
473 }
474 i0.ɵglobal['frameworkStabilizers'].push(whenAllStable);
475 };
476 BrowserGetTestability.prototype.findTestabilityInTree = function (registry, elem, findInAncestors) {
477 if (elem == null) {
478 return null;
479 }
480 var t = registry.getTestability(elem);
481 if (t != null) {
482 return t;
483 }
484 else if (!findInAncestors) {
485 return null;
486 }
487 if (common.ɵgetDOM().isShadowRoot(elem)) {
488 return this.findTestabilityInTree(registry, elem.host, true);
489 }
490 return this.findTestabilityInTree(registry, elem.parentElement, true);
491 };
492 return BrowserGetTestability;
493 }());
494
495 /**
496 * @license
497 * Copyright Google Inc. All Rights Reserved.
498 *
499 * Use of this source code is governed by an MIT-style license that can be
500 * found in the LICENSE file at https://angular.io/license
501 */
502 var CAMEL_CASE_REGEXP = /([A-Z])/g;
503 var DASH_CASE_REGEXP = /-([a-z])/g;
504 function camelCaseToDashCase(input) {
505 return input.replace(CAMEL_CASE_REGEXP, function () {
506 var m = [];
507 for (var _i = 0; _i < arguments.length; _i++) {
508 m[_i] = arguments[_i];
509 }
510 return '-' + m[1].toLowerCase();
511 });
512 }
513 function dashCaseToCamelCase(input) {
514 return input.replace(DASH_CASE_REGEXP, function () {
515 var m = [];
516 for (var _i = 0; _i < arguments.length; _i++) {
517 m[_i] = arguments[_i];
518 }
519 return m[1].toUpperCase();
520 });
521 }
522 /**
523 * Exports the value under a given `name` in the global property `ng`. For example `ng.probe` if
524 * `name` is `'probe'`.
525 * @param name Name under which it will be exported. Keep in mind this will be a property of the
526 * global `ng` object.
527 * @param value The value to export.
528 */
529 function exportNgVar(name, value) {
530 if (typeof COMPILED === 'undefined' || !COMPILED) {
531 // Note: we can't export `ng` when using closure enhanced optimization as:
532 // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
533 // - we can't declare a closure extern as the namespace `ng` is already used within Google
534 // for typings for angularJS (via `goog.provide('ng....')`).
535 var ng = i0.ɵglobal['ng'] = i0.ɵglobal['ng'] || {};
536 ng[name] = value;
537 }
538 }
539
540 /**
541 * @license
542 * Copyright Google Inc. All Rights Reserved.
543 *
544 * Use of this source code is governed by an MIT-style license that can be
545 * found in the LICENSE file at https://angular.io/license
546 */
547 var ɵ0$1 = function () { return ({
548 'ApplicationRef': i0.ApplicationRef,
549 'NgZone': i0.NgZone,
550 }); };
551 var CORE_TOKENS = (ɵ0$1)();
552 var INSPECT_GLOBAL_NAME = 'probe';
553 var CORE_TOKENS_GLOBAL_NAME = 'coreTokens';
554 /**
555 * Returns a {@link DebugElement} for the given native DOM element, or
556 * null if the given native element does not have an Angular view associated
557 * with it.
558 */
559 function inspectNativeElementR2(element) {
560 return i0.ɵgetDebugNodeR2(element);
561 }
562 function _createNgProbeR2(coreTokens) {
563 exportNgVar(INSPECT_GLOBAL_NAME, inspectNativeElementR2);
564 exportNgVar(CORE_TOKENS_GLOBAL_NAME, __assign(__assign({}, CORE_TOKENS), _ngProbeTokensToMap(coreTokens || [])));
565 return function () { return inspectNativeElementR2; };
566 }
567 function _ngProbeTokensToMap(tokens) {
568 return tokens.reduce(function (prev, t) { return (prev[t.name] = t.token, prev); }, {});
569 }
570 /**
571 * In Ivy, we don't support NgProbe because we have our own set of testing utilities
572 * with more robust functionality.
573 *
574 * We shouldn't bring in NgProbe because it prevents DebugNode and friends from
575 * tree-shaking properly.
576 */
577 var ELEMENT_PROBE_PROVIDERS__POST_R3__ = [];
578 /**
579 * Providers which support debugging Angular applications (e.g. via `ng.probe`).
580 */
581 var ELEMENT_PROBE_PROVIDERS__PRE_R3__ = [
582 {
583 provide: i0.APP_INITIALIZER,
584 useFactory: _createNgProbeR2,
585 deps: [
586 [i0.NgProbeToken, new i0.Optional()],
587 ],
588 multi: true,
589 },
590 ];
591 var ELEMENT_PROBE_PROVIDERS = ELEMENT_PROBE_PROVIDERS__PRE_R3__;
592
593 /**
594 * @license
595 * Copyright Google Inc. All Rights Reserved.
596 *
597 * Use of this source code is governed by an MIT-style license that can be
598 * found in the LICENSE file at https://angular.io/license
599 */
600 /**
601 * The injection token for the event-manager plug-in service.
602 *
603 * @publicApi
604 */
605 var EVENT_MANAGER_PLUGINS = new i0.InjectionToken('EventManagerPlugins');
606 /**
607 * An injectable service that provides event management for Angular
608 * through a browser plug-in.
609 *
610 * @publicApi
611 */
612 var EventManager = /** @class */ (function () {
613 /**
614 * Initializes an instance of the event-manager service.
615 */
616 function EventManager(plugins, _zone) {
617 var _this = this;
618 this._zone = _zone;
619 this._eventNameToPlugin = new Map();
620 plugins.forEach(function (p) { return p.manager = _this; });
621 this._plugins = plugins.slice().reverse();
622 }
623 /**
624 * Registers a handler for a specific element and event.
625 *
626 * @param element The HTML element to receive event notifications.
627 * @param eventName The name of the event to listen for.
628 * @param handler A function to call when the notification occurs. Receives the
629 * event object as an argument.
630 * @returns A callback function that can be used to remove the handler.
631 */
632 EventManager.prototype.addEventListener = function (element, eventName, handler) {
633 var plugin = this._findPluginFor(eventName);
634 return plugin.addEventListener(element, eventName, handler);
635 };
636 /**
637 * Registers a global handler for an event in a target view.
638 *
639 * @param target A target for global event notifications. One of "window", "document", or "body".
640 * @param eventName The name of the event to listen for.
641 * @param handler A function to call when the notification occurs. Receives the
642 * event object as an argument.
643 * @returns A callback function that can be used to remove the handler.
644 */
645 EventManager.prototype.addGlobalEventListener = function (target, eventName, handler) {
646 var plugin = this._findPluginFor(eventName);
647 return plugin.addGlobalEventListener(target, eventName, handler);
648 };
649 /**
650 * Retrieves the compilation zone in which event listeners are registered.
651 */
652 EventManager.prototype.getZone = function () {
653 return this._zone;
654 };
655 /** @internal */
656 EventManager.prototype._findPluginFor = function (eventName) {
657 var plugin = this._eventNameToPlugin.get(eventName);
658 if (plugin) {
659 return plugin;
660 }
661 var plugins = this._plugins;
662 for (var i = 0; i < plugins.length; i++) {
663 var plugin_1 = plugins[i];
664 if (plugin_1.supports(eventName)) {
665 this._eventNameToPlugin.set(eventName, plugin_1);
666 return plugin_1;
667 }
668 }
669 throw new Error("No event manager plugin found for event " + eventName);
670 };
671 EventManager = __decorate([
672 i0.Injectable(),
673 __param(0, i0.Inject(EVENT_MANAGER_PLUGINS)),
674 __metadata("design:paramtypes", [Array, i0.NgZone])
675 ], EventManager);
676 return EventManager;
677 }());
678 var EventManagerPlugin = /** @class */ (function () {
679 function EventManagerPlugin(_doc) {
680 this._doc = _doc;
681 }
682 EventManagerPlugin.prototype.addGlobalEventListener = function (element, eventName, handler) {
683 var target = common.ɵgetDOM().getGlobalEventTarget(this._doc, element);
684 if (!target) {
685 throw new Error("Unsupported event target " + target + " for event " + eventName);
686 }
687 return this.addEventListener(target, eventName, handler);
688 };
689 return EventManagerPlugin;
690 }());
691
692 /**
693 * @license
694 * Copyright Google Inc. All Rights Reserved.
695 *
696 * Use of this source code is governed by an MIT-style license that can be
697 * found in the LICENSE file at https://angular.io/license
698 */
699 var SharedStylesHost = /** @class */ (function () {
700 function SharedStylesHost() {
701 /** @internal */
702 this._stylesSet = new Set();
703 }
704 SharedStylesHost.prototype.addStyles = function (styles) {
705 var _this = this;
706 var additions = new Set();
707 styles.forEach(function (style) {
708 if (!_this._stylesSet.has(style)) {
709 _this._stylesSet.add(style);
710 additions.add(style);
711 }
712 });
713 this.onStylesAdded(additions);
714 };
715 SharedStylesHost.prototype.onStylesAdded = function (additions) { };
716 SharedStylesHost.prototype.getAllStyles = function () {
717 return Array.from(this._stylesSet);
718 };
719 SharedStylesHost = __decorate([
720 i0.Injectable()
721 ], SharedStylesHost);
722 return SharedStylesHost;
723 }());
724 var DomSharedStylesHost = /** @class */ (function (_super) {
725 __extends(DomSharedStylesHost, _super);
726 function DomSharedStylesHost(_doc) {
727 var _this = _super.call(this) || this;
728 _this._doc = _doc;
729 _this._hostNodes = new Set();
730 _this._styleNodes = new Set();
731 _this._hostNodes.add(_doc.head);
732 return _this;
733 }
734 DomSharedStylesHost.prototype._addStylesToHost = function (styles, host) {
735 var _this = this;
736 styles.forEach(function (style) {
737 var styleEl = _this._doc.createElement('style');
738 styleEl.textContent = style;
739 _this._styleNodes.add(host.appendChild(styleEl));
740 });
741 };
742 DomSharedStylesHost.prototype.addHost = function (hostNode) {
743 this._addStylesToHost(this._stylesSet, hostNode);
744 this._hostNodes.add(hostNode);
745 };
746 DomSharedStylesHost.prototype.removeHost = function (hostNode) {
747 this._hostNodes.delete(hostNode);
748 };
749 DomSharedStylesHost.prototype.onStylesAdded = function (additions) {
750 var _this = this;
751 this._hostNodes.forEach(function (hostNode) { return _this._addStylesToHost(additions, hostNode); });
752 };
753 DomSharedStylesHost.prototype.ngOnDestroy = function () {
754 this._styleNodes.forEach(function (styleNode) { return common.ɵgetDOM().remove(styleNode); });
755 };
756 DomSharedStylesHost = __decorate([
757 i0.Injectable(),
758 __param(0, i0.Inject(common.DOCUMENT)),
759 __metadata("design:paramtypes", [Object])
760 ], DomSharedStylesHost);
761 return DomSharedStylesHost;
762 }(SharedStylesHost));
763
764 /**
765 * @license
766 * Copyright Google Inc. All Rights Reserved.
767 *
768 * Use of this source code is governed by an MIT-style license that can be
769 * found in the LICENSE file at https://angular.io/license
770 */
771 var NAMESPACE_URIS = {
772 'svg': 'http://www.w3.org/2000/svg',
773 'xhtml': 'http://www.w3.org/1999/xhtml',
774 'xlink': 'http://www.w3.org/1999/xlink',
775 'xml': 'http://www.w3.org/XML/1998/namespace',
776 'xmlns': 'http://www.w3.org/2000/xmlns/',
777 };
778 var COMPONENT_REGEX = /%COMP%/g;
779 var NG_DEV_MODE = typeof ngDevMode === 'undefined' || !!ngDevMode;
780 var COMPONENT_VARIABLE = '%COMP%';
781 var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE;
782 var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE;
783 function shimContentAttribute(componentShortId) {
784 return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
785 }
786 function shimHostAttribute(componentShortId) {
787 return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
788 }
789 function flattenStyles(compId, styles, target) {
790 for (var i = 0; i < styles.length; i++) {
791 var style = styles[i];
792 if (Array.isArray(style)) {
793 flattenStyles(compId, style, target);
794 }
795 else {
796 style = style.replace(COMPONENT_REGEX, compId);
797 target.push(style);
798 }
799 }
800 return target;
801 }
802 function decoratePreventDefault(eventHandler) {
803 // `DebugNode.triggerEventHandler` needs to know if the listener was created with
804 // decoratePreventDefault or is a listener added outside the Angular context so it can handle the
805 // two differently. In the first case, the special '__ngUnwrap__' token is passed to the unwrap
806 // the listener (see below).
807 return function (event) {
808 // Ivy uses '__ngUnwrap__' as a special token that allows us to unwrap the function
809 // so that it can be invoked programmatically by `DebugNode.triggerEventHandler`. The debug_node
810 // can inspect the listener toString contents for the existence of this special token. Because
811 // the token is a string literal, it is ensured to not be modified by compiled code.
812 if (event === '__ngUnwrap__') {
813 return eventHandler;
814 }
815 var allowDefaultBehavior = eventHandler(event);
816 if (allowDefaultBehavior === false) {
817 // TODO(tbosch): move preventDefault into event plugins...
818 event.preventDefault();
819 event.returnValue = false;
820 }
821 return undefined;
822 };
823 }
824 var DomRendererFactory2 = /** @class */ (function () {
825 function DomRendererFactory2(eventManager, sharedStylesHost, appId) {
826 this.eventManager = eventManager;
827 this.sharedStylesHost = sharedStylesHost;
828 this.appId = appId;
829 this.rendererByCompId = new Map();
830 this.defaultRenderer = new DefaultDomRenderer2(eventManager);
831 }
832 DomRendererFactory2.prototype.createRenderer = function (element, type) {
833 if (!element || !type) {
834 return this.defaultRenderer;
835 }
836 switch (type.encapsulation) {
837 case i0.ViewEncapsulation.Emulated: {
838 var renderer = this.rendererByCompId.get(type.id);
839 if (!renderer) {
840 renderer = new EmulatedEncapsulationDomRenderer2(this.eventManager, this.sharedStylesHost, type, this.appId);
841 this.rendererByCompId.set(type.id, renderer);
842 }
843 renderer.applyToHost(element);
844 return renderer;
845 }
846 case i0.ViewEncapsulation.Native:
847 case i0.ViewEncapsulation.ShadowDom:
848 return new ShadowDomRenderer(this.eventManager, this.sharedStylesHost, element, type);
849 default: {
850 if (!this.rendererByCompId.has(type.id)) {
851 var styles = flattenStyles(type.id, type.styles, []);
852 this.sharedStylesHost.addStyles(styles);
853 this.rendererByCompId.set(type.id, this.defaultRenderer);
854 }
855 return this.defaultRenderer;
856 }
857 }
858 };
859 DomRendererFactory2.prototype.begin = function () { };
860 DomRendererFactory2.prototype.end = function () { };
861 DomRendererFactory2 = __decorate([
862 i0.Injectable(),
863 __param(2, i0.Inject(i0.APP_ID)),
864 __metadata("design:paramtypes", [EventManager, DomSharedStylesHost, String])
865 ], DomRendererFactory2);
866 return DomRendererFactory2;
867 }());
868 var DefaultDomRenderer2 = /** @class */ (function () {
869 function DefaultDomRenderer2(eventManager) {
870 this.eventManager = eventManager;
871 this.data = Object.create(null);
872 }
873 DefaultDomRenderer2.prototype.destroy = function () { };
874 DefaultDomRenderer2.prototype.createElement = function (name, namespace) {
875 if (namespace) {
876 // In cases where Ivy (not ViewEngine) is giving us the actual namespace, the look up by key
877 // will result in undefined, so we just return the namespace here.
878 return document.createElementNS(NAMESPACE_URIS[namespace] || namespace, name);
879 }
880 return document.createElement(name);
881 };
882 DefaultDomRenderer2.prototype.createComment = function (value) {
883 return document.createComment(value);
884 };
885 DefaultDomRenderer2.prototype.createText = function (value) {
886 return document.createTextNode(value);
887 };
888 DefaultDomRenderer2.prototype.appendChild = function (parent, newChild) {
889 parent.appendChild(newChild);
890 };
891 DefaultDomRenderer2.prototype.insertBefore = function (parent, newChild, refChild) {
892 if (parent) {
893 parent.insertBefore(newChild, refChild);
894 }
895 };
896 DefaultDomRenderer2.prototype.removeChild = function (parent, oldChild) {
897 if (parent) {
898 parent.removeChild(oldChild);
899 }
900 };
901 DefaultDomRenderer2.prototype.selectRootElement = function (selectorOrNode, preserveContent) {
902 var el = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) :
903 selectorOrNode;
904 if (!el) {
905 throw new Error("The selector \"" + selectorOrNode + "\" did not match any elements");
906 }
907 if (!preserveContent) {
908 el.textContent = '';
909 }
910 return el;
911 };
912 DefaultDomRenderer2.prototype.parentNode = function (node) {
913 return node.parentNode;
914 };
915 DefaultDomRenderer2.prototype.nextSibling = function (node) {
916 return node.nextSibling;
917 };
918 DefaultDomRenderer2.prototype.setAttribute = function (el, name, value, namespace) {
919 if (namespace) {
920 name = namespace + ':' + name;
921 // TODO(FW-811): Ivy may cause issues here because it's passing around
922 // full URIs for namespaces, therefore this lookup will fail.
923 var namespaceUri = NAMESPACE_URIS[namespace];
924 if (namespaceUri) {
925 el.setAttributeNS(namespaceUri, name, value);
926 }
927 else {
928 el.setAttribute(name, value);
929 }
930 }
931 else {
932 el.setAttribute(name, value);
933 }
934 };
935 DefaultDomRenderer2.prototype.removeAttribute = function (el, name, namespace) {
936 if (namespace) {
937 // TODO(FW-811): Ivy may cause issues here because it's passing around
938 // full URIs for namespaces, therefore this lookup will fail.
939 var namespaceUri = NAMESPACE_URIS[namespace];
940 if (namespaceUri) {
941 el.removeAttributeNS(namespaceUri, name);
942 }
943 else {
944 // TODO(FW-811): Since ivy is passing around full URIs for namespaces
945 // this could result in properties like `http://www.w3.org/2000/svg:cx="123"`,
946 // which is wrong.
947 el.removeAttribute(namespace + ":" + name);
948 }
949 }
950 else {
951 el.removeAttribute(name);
952 }
953 };
954 DefaultDomRenderer2.prototype.addClass = function (el, name) {
955 el.classList.add(name);
956 };
957 DefaultDomRenderer2.prototype.removeClass = function (el, name) {
958 el.classList.remove(name);
959 };
960 DefaultDomRenderer2.prototype.setStyle = function (el, style, value, flags) {
961 if (flags & i0.RendererStyleFlags2.DashCase) {
962 el.style.setProperty(style, value, !!(flags & i0.RendererStyleFlags2.Important) ? 'important' : '');
963 }
964 else {
965 el.style[style] = value;
966 }
967 };
968 DefaultDomRenderer2.prototype.removeStyle = function (el, style, flags) {
969 if (flags & i0.RendererStyleFlags2.DashCase) {
970 el.style.removeProperty(style);
971 }
972 else {
973 // IE requires '' instead of null
974 // see https://github.com/angular/angular/issues/7916
975 el.style[style] = '';
976 }
977 };
978 DefaultDomRenderer2.prototype.setProperty = function (el, name, value) {
979 NG_DEV_MODE && checkNoSyntheticProp(name, 'property');
980 el[name] = value;
981 };
982 DefaultDomRenderer2.prototype.setValue = function (node, value) {
983 node.nodeValue = value;
984 };
985 DefaultDomRenderer2.prototype.listen = function (target, event, callback) {
986 NG_DEV_MODE && checkNoSyntheticProp(event, 'listener');
987 if (typeof target === 'string') {
988 return this.eventManager.addGlobalEventListener(target, event, decoratePreventDefault(callback));
989 }
990 return this.eventManager.addEventListener(target, event, decoratePreventDefault(callback));
991 };
992 return DefaultDomRenderer2;
993 }());
994 var ɵ0$2 = function () { return '@'.charCodeAt(0); };
995 var AT_CHARCODE = (ɵ0$2)();
996 function checkNoSyntheticProp(name, nameKind) {
997 if (name.charCodeAt(0) === AT_CHARCODE) {
998 throw new Error("Found the synthetic " + nameKind + " " + name + ". Please include either \"BrowserAnimationsModule\" or \"NoopAnimationsModule\" in your application.");
999 }
1000 }
1001 var EmulatedEncapsulationDomRenderer2 = /** @class */ (function (_super) {
1002 __extends(EmulatedEncapsulationDomRenderer2, _super);
1003 function EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, component, appId) {
1004 var _this = _super.call(this, eventManager) || this;
1005 _this.component = component;
1006 var styles = flattenStyles(appId + '-' + component.id, component.styles, []);
1007 sharedStylesHost.addStyles(styles);
1008 _this.contentAttr = shimContentAttribute(appId + '-' + component.id);
1009 _this.hostAttr = shimHostAttribute(appId + '-' + component.id);
1010 return _this;
1011 }
1012 EmulatedEncapsulationDomRenderer2.prototype.applyToHost = function (element) {
1013 _super.prototype.setAttribute.call(this, element, this.hostAttr, '');
1014 };
1015 EmulatedEncapsulationDomRenderer2.prototype.createElement = function (parent, name) {
1016 var el = _super.prototype.createElement.call(this, parent, name);
1017 _super.prototype.setAttribute.call(this, el, this.contentAttr, '');
1018 return el;
1019 };
1020 return EmulatedEncapsulationDomRenderer2;
1021 }(DefaultDomRenderer2));
1022 var ShadowDomRenderer = /** @class */ (function (_super) {
1023 __extends(ShadowDomRenderer, _super);
1024 function ShadowDomRenderer(eventManager, sharedStylesHost, hostEl, component) {
1025 var _this = _super.call(this, eventManager) || this;
1026 _this.sharedStylesHost = sharedStylesHost;
1027 _this.hostEl = hostEl;
1028 _this.component = component;
1029 if (component.encapsulation === i0.ViewEncapsulation.ShadowDom) {
1030 _this.shadowRoot = hostEl.attachShadow({ mode: 'open' });
1031 }
1032 else {
1033 _this.shadowRoot = hostEl.createShadowRoot();
1034 }
1035 _this.sharedStylesHost.addHost(_this.shadowRoot);
1036 var styles = flattenStyles(component.id, component.styles, []);
1037 for (var i = 0; i < styles.length; i++) {
1038 var styleEl = document.createElement('style');
1039 styleEl.textContent = styles[i];
1040 _this.shadowRoot.appendChild(styleEl);
1041 }
1042 return _this;
1043 }
1044 ShadowDomRenderer.prototype.nodeOrShadowRoot = function (node) {
1045 return node === this.hostEl ? this.shadowRoot : node;
1046 };
1047 ShadowDomRenderer.prototype.destroy = function () {
1048 this.sharedStylesHost.removeHost(this.shadowRoot);
1049 };
1050 ShadowDomRenderer.prototype.appendChild = function (parent, newChild) {
1051 return _super.prototype.appendChild.call(this, this.nodeOrShadowRoot(parent), newChild);
1052 };
1053 ShadowDomRenderer.prototype.insertBefore = function (parent, newChild, refChild) {
1054 return _super.prototype.insertBefore.call(this, this.nodeOrShadowRoot(parent), newChild, refChild);
1055 };
1056 ShadowDomRenderer.prototype.removeChild = function (parent, oldChild) {
1057 return _super.prototype.removeChild.call(this, this.nodeOrShadowRoot(parent), oldChild);
1058 };
1059 ShadowDomRenderer.prototype.parentNode = function (node) {
1060 return this.nodeOrShadowRoot(_super.prototype.parentNode.call(this, this.nodeOrShadowRoot(node)));
1061 };
1062 return ShadowDomRenderer;
1063 }(DefaultDomRenderer2));
1064
1065 /**
1066 * @license
1067 * Copyright Google Inc. All Rights Reserved.
1068 *
1069 * Use of this source code is governed by an MIT-style license that can be
1070 * found in the LICENSE file at https://angular.io/license
1071 */
1072 var DomEventsPlugin = /** @class */ (function (_super) {
1073 __extends(DomEventsPlugin, _super);
1074 function DomEventsPlugin(doc) {
1075 return _super.call(this, doc) || this;
1076 }
1077 // This plugin should come last in the list of plugins, because it accepts all
1078 // events.
1079 DomEventsPlugin.prototype.supports = function (eventName) {
1080 return true;
1081 };
1082 DomEventsPlugin.prototype.addEventListener = function (element, eventName, handler) {
1083 var _this = this;
1084 element.addEventListener(eventName, handler, false);
1085 return function () { return _this.removeEventListener(element, eventName, handler); };
1086 };
1087 DomEventsPlugin.prototype.removeEventListener = function (target, eventName, callback) {
1088 return target.removeEventListener(eventName, callback);
1089 };
1090 DomEventsPlugin = __decorate([
1091 i0.Injectable(),
1092 __param(0, i0.Inject(common.DOCUMENT)),
1093 __metadata("design:paramtypes", [Object])
1094 ], DomEventsPlugin);
1095 return DomEventsPlugin;
1096 }(EventManagerPlugin));
1097
1098 /**
1099 * @license
1100 * Copyright Google Inc. All Rights Reserved.
1101 *
1102 * Use of this source code is governed by an MIT-style license that can be
1103 * found in the LICENSE file at https://angular.io/license
1104 */
1105 /**
1106 * Supported HammerJS recognizer event names.
1107 */
1108 var EVENT_NAMES = {
1109 // pan
1110 'pan': true,
1111 'panstart': true,
1112 'panmove': true,
1113 'panend': true,
1114 'pancancel': true,
1115 'panleft': true,
1116 'panright': true,
1117 'panup': true,
1118 'pandown': true,
1119 // pinch
1120 'pinch': true,
1121 'pinchstart': true,
1122 'pinchmove': true,
1123 'pinchend': true,
1124 'pinchcancel': true,
1125 'pinchin': true,
1126 'pinchout': true,
1127 // press
1128 'press': true,
1129 'pressup': true,
1130 // rotate
1131 'rotate': true,
1132 'rotatestart': true,
1133 'rotatemove': true,
1134 'rotateend': true,
1135 'rotatecancel': true,
1136 // swipe
1137 'swipe': true,
1138 'swipeleft': true,
1139 'swiperight': true,
1140 'swipeup': true,
1141 'swipedown': true,
1142 // tap
1143 'tap': true,
1144 };
1145 /**
1146 * DI token for providing [HammerJS](http://hammerjs.github.io/) support to Angular.
1147 * @see `HammerGestureConfig`
1148 *
1149 * @ngModule HammerModule
1150 * @publicApi
1151 */
1152 var HAMMER_GESTURE_CONFIG = new i0.InjectionToken('HammerGestureConfig');
1153 /**
1154 * Injection token used to provide a {@link HammerLoader} to Angular.
1155 *
1156 * @publicApi
1157 */
1158 var HAMMER_LOADER = new i0.InjectionToken('HammerLoader');
1159 /**
1160 * An injectable [HammerJS Manager](http://hammerjs.github.io/api/#hammer.manager)
1161 * for gesture recognition. Configures specific event recognition.
1162 * @publicApi
1163 */
1164 var HammerGestureConfig = /** @class */ (function () {
1165 function HammerGestureConfig() {
1166 /**
1167 * A set of supported event names for gestures to be used in Angular.
1168 * Angular supports all built-in recognizers, as listed in
1169 * [HammerJS documentation](http://hammerjs.github.io/).
1170 */
1171 this.events = [];
1172 /**
1173 * Maps gesture event names to a set of configuration options
1174 * that specify overrides to the default values for specific properties.
1175 *
1176 * The key is a supported event name to be configured,
1177 * and the options object contains a set of properties, with override values
1178 * to be applied to the named recognizer event.
1179 * For example, to disable recognition of the rotate event, specify
1180 * `{"rotate": {"enable": false}}`.
1181 *
1182 * Properties that are not present take the HammerJS default values.
1183 * For information about which properties are supported for which events,
1184 * and their allowed and default values, see
1185 * [HammerJS documentation](http://hammerjs.github.io/).
1186 *
1187 */
1188 this.overrides = {};
1189 }
1190 /**
1191 * Creates a [HammerJS Manager](http://hammerjs.github.io/api/#hammer.manager)
1192 * and attaches it to a given HTML element.
1193 * @param element The element that will recognize gestures.
1194 * @returns A HammerJS event-manager object.
1195 */
1196 HammerGestureConfig.prototype.buildHammer = function (element) {
1197 var mc = new Hammer(element, this.options);
1198 mc.get('pinch').set({ enable: true });
1199 mc.get('rotate').set({ enable: true });
1200 for (var eventName in this.overrides) {
1201 mc.get(eventName).set(this.overrides[eventName]);
1202 }
1203 return mc;
1204 };
1205 HammerGestureConfig = __decorate([
1206 i0.Injectable()
1207 ], HammerGestureConfig);
1208 return HammerGestureConfig;
1209 }());
1210 /**
1211 * Event plugin that adds Hammer support to an application.
1212 *
1213 * @ngModule HammerModule
1214 */
1215 var HammerGesturesPlugin = /** @class */ (function (_super) {
1216 __extends(HammerGesturesPlugin, _super);
1217 function HammerGesturesPlugin(doc, _config, console, loader) {
1218 var _this = _super.call(this, doc) || this;
1219 _this._config = _config;
1220 _this.console = console;
1221 _this.loader = loader;
1222 return _this;
1223 }
1224 HammerGesturesPlugin.prototype.supports = function (eventName) {
1225 if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
1226 return false;
1227 }
1228 if (!window.Hammer && !this.loader) {
1229 this.console.warn("The \"" + eventName + "\" event cannot be bound because Hammer.JS is not " +
1230 "loaded and no custom loader has been specified.");
1231 return false;
1232 }
1233 return true;
1234 };
1235 HammerGesturesPlugin.prototype.addEventListener = function (element, eventName, handler) {
1236 var _this = this;
1237 var zone = this.manager.getZone();
1238 eventName = eventName.toLowerCase();
1239 // If Hammer is not present but a loader is specified, we defer adding the event listener
1240 // until Hammer is loaded.
1241 if (!window.Hammer && this.loader) {
1242 // This `addEventListener` method returns a function to remove the added listener.
1243 // Until Hammer is loaded, the returned function needs to *cancel* the registration rather
1244 // than remove anything.
1245 var cancelRegistration_1 = false;
1246 var deregister_1 = function () {
1247 cancelRegistration_1 = true;
1248 };
1249 this.loader()
1250 .then(function () {
1251 // If Hammer isn't actually loaded when the custom loader resolves, give up.
1252 if (!window.Hammer) {
1253 _this.console.warn("The custom HAMMER_LOADER completed, but Hammer.JS is not present.");
1254 deregister_1 = function () { };
1255 return;
1256 }
1257 if (!cancelRegistration_1) {
1258 // Now that Hammer is loaded and the listener is being loaded for real,
1259 // the deregistration function changes from canceling registration to removal.
1260 deregister_1 = _this.addEventListener(element, eventName, handler);
1261 }
1262 })
1263 .catch(function () {
1264 _this.console.warn("The \"" + eventName + "\" event cannot be bound because the custom " +
1265 "Hammer.JS loader failed.");
1266 deregister_1 = function () { };
1267 });
1268 // Return a function that *executes* `deregister` (and not `deregister` itself) so that we
1269 // can change the behavior of `deregister` once the listener is added. Using a closure in
1270 // this way allows us to avoid any additional data structures to track listener removal.
1271 return function () {
1272 deregister_1();
1273 };
1274 }
1275 return zone.runOutsideAngular(function () {
1276 // Creating the manager bind events, must be done outside of angular
1277 var mc = _this._config.buildHammer(element);
1278 var callback = function (eventObj) {
1279 zone.runGuarded(function () {
1280 handler(eventObj);
1281 });
1282 };
1283 mc.on(eventName, callback);
1284 return function () {
1285 mc.off(eventName, callback);
1286 // destroy mc to prevent memory leak
1287 if (typeof mc.destroy === 'function') {
1288 mc.destroy();
1289 }
1290 };
1291 });
1292 };
1293 HammerGesturesPlugin.prototype.isCustomEvent = function (eventName) {
1294 return this._config.events.indexOf(eventName) > -1;
1295 };
1296 HammerGesturesPlugin = __decorate([
1297 i0.Injectable(),
1298 __param(0, i0.Inject(common.DOCUMENT)),
1299 __param(1, i0.Inject(HAMMER_GESTURE_CONFIG)),
1300 __param(3, i0.Optional()), __param(3, i0.Inject(HAMMER_LOADER)),
1301 __metadata("design:paramtypes", [Object, HammerGestureConfig, i0.ɵConsole, Object])
1302 ], HammerGesturesPlugin);
1303 return HammerGesturesPlugin;
1304 }(EventManagerPlugin));
1305 /**
1306 * In Ivy, support for Hammer gestures is optional, so applications must
1307 * import the `HammerModule` at root to turn on support. This means that
1308 * Hammer-specific code can be tree-shaken away if not needed.
1309 */
1310 var HAMMER_PROVIDERS__POST_R3__ = [];
1311 /**
1312 * In View Engine, support for Hammer gestures is built-in by default.
1313 */
1314 var HAMMER_PROVIDERS__PRE_R3__ = [
1315 {
1316 provide: EVENT_MANAGER_PLUGINS,
1317 useClass: HammerGesturesPlugin,
1318 multi: true,
1319 deps: [common.DOCUMENT, HAMMER_GESTURE_CONFIG, i0.ɵConsole, [new i0.Optional(), HAMMER_LOADER]]
1320 },
1321 { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig, deps: [] },
1322 ];
1323 var HAMMER_PROVIDERS = HAMMER_PROVIDERS__PRE_R3__;
1324 /**
1325 * Adds support for HammerJS.
1326 *
1327 * Import this module at the root of your application so that Angular can work with
1328 * HammerJS to detect gesture events.
1329 *
1330 * Note that applications still need to include the HammerJS script itself. This module
1331 * simply sets up the coordination layer between HammerJS and Angular's EventManager.
1332 *
1333 * @publicApi
1334 */
1335 var HammerModule = /** @class */ (function () {
1336 function HammerModule() {
1337 }
1338 HammerModule = __decorate([
1339 i0.NgModule({ providers: HAMMER_PROVIDERS__PRE_R3__ })
1340 ], HammerModule);
1341 return HammerModule;
1342 }());
1343
1344 /**
1345 * @license
1346 * Copyright Google Inc. All Rights Reserved.
1347 *
1348 * Use of this source code is governed by an MIT-style license that can be
1349 * found in the LICENSE file at https://angular.io/license
1350 */
1351 /**
1352 * Defines supported modifiers for key events.
1353 */
1354 var MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];
1355 var DOM_KEY_LOCATION_NUMPAD = 3;
1356 // Map to convert some key or keyIdentifier values to what will be returned by getEventKey
1357 var _keyMap = {
1358 // The following values are here for cross-browser compatibility and to match the W3C standard
1359 // cf http://www.w3.org/TR/DOM-Level-3-Events-key/
1360 '\b': 'Backspace',
1361 '\t': 'Tab',
1362 '\x7F': 'Delete',
1363 '\x1B': 'Escape',
1364 'Del': 'Delete',
1365 'Esc': 'Escape',
1366 'Left': 'ArrowLeft',
1367 'Right': 'ArrowRight',
1368 'Up': 'ArrowUp',
1369 'Down': 'ArrowDown',
1370 'Menu': 'ContextMenu',
1371 'Scroll': 'ScrollLock',
1372 'Win': 'OS'
1373 };
1374 // There is a bug in Chrome for numeric keypad keys:
1375 // https://code.google.com/p/chromium/issues/detail?id=155654
1376 // 1, 2, 3 ... are reported as A, B, C ...
1377 var _chromeNumKeyPadMap = {
1378 'A': '1',
1379 'B': '2',
1380 'C': '3',
1381 'D': '4',
1382 'E': '5',
1383 'F': '6',
1384 'G': '7',
1385 'H': '8',
1386 'I': '9',
1387 'J': '*',
1388 'K': '+',
1389 'M': '-',
1390 'N': '.',
1391 'O': '/',
1392 '\x60': '0',
1393 '\x90': 'NumLock'
1394 };
1395 var ɵ0$3 = function (event) { return event.altKey; }, ɵ1 = function (event) { return event.ctrlKey; }, ɵ2 = function (event) { return event.metaKey; }, ɵ3 = function (event) { return event.shiftKey; };
1396 /**
1397 * Retrieves modifiers from key-event objects.
1398 */
1399 var MODIFIER_KEY_GETTERS = {
1400 'alt': ɵ0$3,
1401 'control': ɵ1,
1402 'meta': ɵ2,
1403 'shift': ɵ3
1404 };
1405 /**
1406 * @publicApi
1407 * A browser plug-in that provides support for handling of key events in Angular.
1408 */
1409 var KeyEventsPlugin = /** @class */ (function (_super) {
1410 __extends(KeyEventsPlugin, _super);
1411 /**
1412 * Initializes an instance of the browser plug-in.
1413 * @param doc The document in which key events will be detected.
1414 */
1415 function KeyEventsPlugin(doc) {
1416 return _super.call(this, doc) || this;
1417 }
1418 KeyEventsPlugin_1 = KeyEventsPlugin;
1419 /**
1420 * Reports whether a named key event is supported.
1421 * @param eventName The event name to query.
1422 * @return True if the named key event is supported.
1423 */
1424 KeyEventsPlugin.prototype.supports = function (eventName) {
1425 return KeyEventsPlugin_1.parseEventName(eventName) != null;
1426 };
1427 /**
1428 * Registers a handler for a specific element and key event.
1429 * @param element The HTML element to receive event notifications.
1430 * @param eventName The name of the key event to listen for.
1431 * @param handler A function to call when the notification occurs. Receives the
1432 * event object as an argument.
1433 * @returns The key event that was registered.
1434 */
1435 KeyEventsPlugin.prototype.addEventListener = function (element, eventName, handler) {
1436 var parsedEvent = KeyEventsPlugin_1.parseEventName(eventName);
1437 var outsideHandler = KeyEventsPlugin_1.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
1438 return this.manager.getZone().runOutsideAngular(function () {
1439 return common.ɵgetDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler);
1440 });
1441 };
1442 KeyEventsPlugin.parseEventName = function (eventName) {
1443 var parts = eventName.toLowerCase().split('.');
1444 var domEventName = parts.shift();
1445 if ((parts.length === 0) || !(domEventName === 'keydown' || domEventName === 'keyup')) {
1446 return null;
1447 }
1448 var key = KeyEventsPlugin_1._normalizeKey(parts.pop());
1449 var fullKey = '';
1450 MODIFIER_KEYS.forEach(function (modifierName) {
1451 var index = parts.indexOf(modifierName);
1452 if (index > -1) {
1453 parts.splice(index, 1);
1454 fullKey += modifierName + '.';
1455 }
1456 });
1457 fullKey += key;
1458 if (parts.length != 0 || key.length === 0) {
1459 // returning null instead of throwing to let another plugin process the event
1460 return null;
1461 }
1462 var result = {};
1463 result['domEventName'] = domEventName;
1464 result['fullKey'] = fullKey;
1465 return result;
1466 };
1467 KeyEventsPlugin.getEventFullKey = function (event) {
1468 var fullKey = '';
1469 var key = getEventKey(event);
1470 key = key.toLowerCase();
1471 if (key === ' ') {
1472 key = 'space'; // for readability
1473 }
1474 else if (key === '.') {
1475 key = 'dot'; // because '.' is used as a separator in event names
1476 }
1477 MODIFIER_KEYS.forEach(function (modifierName) {
1478 if (modifierName != key) {
1479 var modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
1480 if (modifierGetter(event)) {
1481 fullKey += modifierName + '.';
1482 }
1483 }
1484 });
1485 fullKey += key;
1486 return fullKey;
1487 };
1488 /**
1489 * Configures a handler callback for a key event.
1490 * @param fullKey The event name that combines all simultaneous keystrokes.
1491 * @param handler The function that responds to the key event.
1492 * @param zone The zone in which the event occurred.
1493 * @returns A callback function.
1494 */
1495 KeyEventsPlugin.eventCallback = function (fullKey, handler, zone) {
1496 return function (event /** TODO #9100 */) {
1497 if (KeyEventsPlugin_1.getEventFullKey(event) === fullKey) {
1498 zone.runGuarded(function () { return handler(event); });
1499 }
1500 };
1501 };
1502 /** @internal */
1503 KeyEventsPlugin._normalizeKey = function (keyName) {
1504 // TODO: switch to a Map if the mapping grows too much
1505 switch (keyName) {
1506 case 'esc':
1507 return 'escape';
1508 default:
1509 return keyName;
1510 }
1511 };
1512 var KeyEventsPlugin_1;
1513 KeyEventsPlugin = KeyEventsPlugin_1 = __decorate([
1514 i0.Injectable(),
1515 __param(0, i0.Inject(common.DOCUMENT)),
1516 __metadata("design:paramtypes", [Object])
1517 ], KeyEventsPlugin);
1518 return KeyEventsPlugin;
1519 }(EventManagerPlugin));
1520 function getEventKey(event) {
1521 var key = event.key;
1522 if (key == null) {
1523 key = event.keyIdentifier;
1524 // keyIdentifier is defined in the old draft of DOM Level 3 Events implemented by Chrome and
1525 // Safari cf
1526 // http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/events.html#Events-KeyboardEvents-Interfaces
1527 if (key == null) {
1528 return 'Unidentified';
1529 }
1530 if (key.startsWith('U+')) {
1531 key = String.fromCharCode(parseInt(key.substring(2), 16));
1532 if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) {
1533 // There is a bug in Chrome for numeric keypad keys:
1534 // https://code.google.com/p/chromium/issues/detail?id=155654
1535 // 1, 2, 3 ... are reported as A, B, C ...
1536 key = _chromeNumKeyPadMap[key];
1537 }
1538 }
1539 }
1540 return _keyMap[key] || key;
1541 }
1542
1543 /**
1544 * DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing
1545 * values to be safe to use in the different DOM contexts.
1546 *
1547 * For example, when binding a URL in an `<a [href]="someValue">` hyperlink, `someValue` will be
1548 * sanitized so that an attacker cannot inject e.g. a `javascript:` URL that would execute code on
1549 * the website.
1550 *
1551 * In specific situations, it might be necessary to disable sanitization, for example if the
1552 * application genuinely needs to produce a `javascript:` style link with a dynamic value in it.
1553 * Users can bypass security by constructing a value with one of the `bypassSecurityTrust...`
1554 * methods, and then binding to that value from the template.
1555 *
1556 * These situations should be very rare, and extraordinary care must be taken to avoid creating a
1557 * Cross Site Scripting (XSS) security bug!
1558 *
1559 * When using `bypassSecurityTrust...`, make sure to call the method as early as possible and as
1560 * close as possible to the source of the value, to make it easy to verify no security bug is
1561 * created by its use.
1562 *
1563 * It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that
1564 * does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous
1565 * code. The sanitizer leaves safe values intact.
1566 *
1567 * @security Calling any of the `bypassSecurityTrust...` APIs disables Angular's built-in
1568 * sanitization for the value passed in. Carefully check and audit all values and code paths going
1569 * into this call. Make sure any user data is appropriately escaped for this security context.
1570 * For more detail, see the [Security Guide](http://g.co/ng/security).
1571 *
1572 * @publicApi
1573 */
1574 var DomSanitizer = /** @class */ (function () {
1575 function DomSanitizer() {
1576 }
1577 DomSanitizer.ɵprov = i0.ɵɵdefineInjectable({ factory: function DomSanitizer_Factory() { return i0.ɵɵinject(DomSanitizerImpl); }, token: DomSanitizer, providedIn: "root" });
1578 DomSanitizer = __decorate([
1579 i0.Injectable({ providedIn: 'root', useExisting: i0.forwardRef(function () { return DomSanitizerImpl; }) })
1580 ], DomSanitizer);
1581 return DomSanitizer;
1582 }());
1583 function domSanitizerImplFactory(injector) {
1584 return new DomSanitizerImpl(injector.get(common.DOCUMENT));
1585 }
1586 var DomSanitizerImpl = /** @class */ (function (_super) {
1587 __extends(DomSanitizerImpl, _super);
1588 function DomSanitizerImpl(_doc) {
1589 var _this = _super.call(this) || this;
1590 _this._doc = _doc;
1591 return _this;
1592 }
1593 DomSanitizerImpl.prototype.sanitize = function (ctx, value) {
1594 if (value == null)
1595 return null;
1596 switch (ctx) {
1597 case i0.SecurityContext.NONE:
1598 return value;
1599 case i0.SecurityContext.HTML:
1600 if (i0.ɵallowSanitizationBypassAndThrow(value, "HTML" /* Html */)) {
1601 return i0.ɵunwrapSafeValue(value);
1602 }
1603 return i0.ɵ_sanitizeHtml(this._doc, String(value));
1604 case i0.SecurityContext.STYLE:
1605 if (i0.ɵallowSanitizationBypassAndThrow(value, "Style" /* Style */)) {
1606 return i0.ɵunwrapSafeValue(value);
1607 }
1608 return i0.ɵ_sanitizeStyle(value);
1609 case i0.SecurityContext.SCRIPT:
1610 if (i0.ɵallowSanitizationBypassAndThrow(value, "Script" /* Script */)) {
1611 return i0.ɵunwrapSafeValue(value);
1612 }
1613 throw new Error('unsafe value used in a script context');
1614 case i0.SecurityContext.URL:
1615 var type = i0.ɵgetSanitizationBypassType(value);
1616 if (i0.ɵallowSanitizationBypassAndThrow(value, "URL" /* Url */)) {
1617 return i0.ɵunwrapSafeValue(value);
1618 }
1619 return i0.ɵ_sanitizeUrl(String(value));
1620 case i0.SecurityContext.RESOURCE_URL:
1621 if (i0.ɵallowSanitizationBypassAndThrow(value, "ResourceURL" /* ResourceUrl */)) {
1622 return i0.ɵunwrapSafeValue(value);
1623 }
1624 throw new Error('unsafe value used in a resource URL context (see http://g.co/ng/security#xss)');
1625 default:
1626 throw new Error("Unexpected SecurityContext " + ctx + " (see http://g.co/ng/security#xss)");
1627 }
1628 };
1629 DomSanitizerImpl.prototype.bypassSecurityTrustHtml = function (value) {
1630 return i0.ɵbypassSanitizationTrustHtml(value);
1631 };
1632 DomSanitizerImpl.prototype.bypassSecurityTrustStyle = function (value) {
1633 return i0.ɵbypassSanitizationTrustStyle(value);
1634 };
1635 DomSanitizerImpl.prototype.bypassSecurityTrustScript = function (value) {
1636 return i0.ɵbypassSanitizationTrustScript(value);
1637 };
1638 DomSanitizerImpl.prototype.bypassSecurityTrustUrl = function (value) {
1639 return i0.ɵbypassSanitizationTrustUrl(value);
1640 };
1641 DomSanitizerImpl.prototype.bypassSecurityTrustResourceUrl = function (value) {
1642 return i0.ɵbypassSanitizationTrustResourceUrl(value);
1643 };
1644 DomSanitizerImpl.ɵprov = i0.ɵɵdefineInjectable({ factory: function DomSanitizerImpl_Factory() { return domSanitizerImplFactory(i0.ɵɵinject(i0.INJECTOR)); }, token: DomSanitizerImpl, providedIn: "root" });
1645 DomSanitizerImpl = __decorate([
1646 i0.Injectable({ providedIn: 'root', useFactory: domSanitizerImplFactory, deps: [i0.Injector] }),
1647 __param(0, i0.Inject(common.DOCUMENT)),
1648 __metadata("design:paramtypes", [Object])
1649 ], DomSanitizerImpl);
1650 return DomSanitizerImpl;
1651 }(DomSanitizer));
1652
1653 /**
1654 * @license
1655 * Copyright Google Inc. All Rights Reserved.
1656 *
1657 * Use of this source code is governed by an MIT-style license that can be
1658 * found in the LICENSE file at https://angular.io/license
1659 */
1660 function initDomAdapter() {
1661 BrowserDomAdapter.makeCurrent();
1662 BrowserGetTestability.init();
1663 }
1664 function errorHandler() {
1665 return new i0.ErrorHandler();
1666 }
1667 function _document() {
1668 // Tell ivy about the global document
1669 i0.ɵsetDocument(document);
1670 return document;
1671 }
1672 var ɵ0$4 = common.ɵPLATFORM_BROWSER_ID;
1673 var INTERNAL_BROWSER_PLATFORM_PROVIDERS = [
1674 { provide: i0.PLATFORM_ID, useValue: ɵ0$4 },
1675 { provide: i0.PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true },
1676 { provide: common.DOCUMENT, useFactory: _document, deps: [] },
1677 ];
1678 var BROWSER_SANITIZATION_PROVIDERS__PRE_R3__ = [
1679 { provide: i0.Sanitizer, useExisting: DomSanitizer },
1680 { provide: DomSanitizer, useClass: DomSanitizerImpl, deps: [common.DOCUMENT] },
1681 ];
1682 var BROWSER_SANITIZATION_PROVIDERS__POST_R3__ = [];
1683 /**
1684 * @security Replacing built-in sanitization providers exposes the application to XSS risks.
1685 * Attacker-controlled data introduced by an unsanitized provider could expose your
1686 * application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security).
1687 * @publicApi
1688 */
1689 var BROWSER_SANITIZATION_PROVIDERS = BROWSER_SANITIZATION_PROVIDERS__PRE_R3__;
1690 /**
1691 * @publicApi
1692 */
1693 var platformBrowser = i0.createPlatformFactory(i0.platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
1694 var BROWSER_MODULE_PROVIDERS = [
1695 BROWSER_SANITIZATION_PROVIDERS,
1696 { provide: i0.ɵINJECTOR_SCOPE, useValue: 'root' },
1697 { provide: i0.ErrorHandler, useFactory: errorHandler, deps: [] },
1698 {
1699 provide: EVENT_MANAGER_PLUGINS,
1700 useClass: DomEventsPlugin,
1701 multi: true,
1702 deps: [common.DOCUMENT, i0.NgZone, i0.PLATFORM_ID]
1703 },
1704 { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true, deps: [common.DOCUMENT] },
1705 HAMMER_PROVIDERS,
1706 {
1707 provide: DomRendererFactory2,
1708 useClass: DomRendererFactory2,
1709 deps: [EventManager, DomSharedStylesHost, i0.APP_ID]
1710 },
1711 { provide: i0.RendererFactory2, useExisting: DomRendererFactory2 },
1712 { provide: SharedStylesHost, useExisting: DomSharedStylesHost },
1713 { provide: DomSharedStylesHost, useClass: DomSharedStylesHost, deps: [common.DOCUMENT] },
1714 { provide: i0.Testability, useClass: i0.Testability, deps: [i0.NgZone] },
1715 { provide: EventManager, useClass: EventManager, deps: [EVENT_MANAGER_PLUGINS, i0.NgZone] },
1716 ELEMENT_PROBE_PROVIDERS,
1717 ];
1718 /**
1719 * Exports required infrastructure for all Angular apps.
1720 * Included by default in all Angular apps created with the CLI
1721 * `new` command.
1722 * Re-exports `CommonModule` and `ApplicationModule`, making their
1723 * exports and providers available to all apps.
1724 *
1725 * @publicApi
1726 */
1727 var BrowserModule = /** @class */ (function () {
1728 function BrowserModule(parentModule) {
1729 if (parentModule) {
1730 throw new Error("BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.");
1731 }
1732 }
1733 BrowserModule_1 = BrowserModule;
1734 /**
1735 * Configures a browser-based app to transition from a server-rendered app, if
1736 * one is present on the page.
1737 *
1738 * @param params An object containing an identifier for the app to transition.
1739 * The ID must match between the client and server versions of the app.
1740 * @returns The reconfigured `BrowserModule` to import into the app's root `AppModule`.
1741 */
1742 BrowserModule.withServerTransition = function (params) {
1743 return {
1744 ngModule: BrowserModule_1,
1745 providers: [
1746 { provide: i0.APP_ID, useValue: params.appId },
1747 { provide: TRANSITION_ID, useExisting: i0.APP_ID },
1748 SERVER_TRANSITION_PROVIDERS,
1749 ],
1750 };
1751 };
1752 var BrowserModule_1;
1753 BrowserModule = BrowserModule_1 = __decorate([
1754 i0.NgModule({ providers: BROWSER_MODULE_PROVIDERS, exports: [common.CommonModule, i0.ApplicationModule] }),
1755 __param(0, i0.Optional()), __param(0, i0.SkipSelf()), __param(0, i0.Inject(BrowserModule_1)),
1756 __metadata("design:paramtypes", [Object])
1757 ], BrowserModule);
1758 return BrowserModule;
1759 }());
1760
1761 /**
1762 * Factory to create Meta service.
1763 */
1764 function createMeta() {
1765 return new Meta(i0.ɵɵinject(common.DOCUMENT));
1766 }
1767 /**
1768 * A service that can be used to get and add meta tags.
1769 *
1770 * @publicApi
1771 */
1772 var Meta = /** @class */ (function () {
1773 function Meta(_doc) {
1774 this._doc = _doc;
1775 this._dom = common.ɵgetDOM();
1776 }
1777 Meta.prototype.addTag = function (tag, forceCreation) {
1778 if (forceCreation === void 0) { forceCreation = false; }
1779 if (!tag)
1780 return null;
1781 return this._getOrCreateElement(tag, forceCreation);
1782 };
1783 Meta.prototype.addTags = function (tags, forceCreation) {
1784 var _this = this;
1785 if (forceCreation === void 0) { forceCreation = false; }
1786 if (!tags)
1787 return [];
1788 return tags.reduce(function (result, tag) {
1789 if (tag) {
1790 result.push(_this._getOrCreateElement(tag, forceCreation));
1791 }
1792 return result;
1793 }, []);
1794 };
1795 Meta.prototype.getTag = function (attrSelector) {
1796 if (!attrSelector)
1797 return null;
1798 return this._doc.querySelector("meta[" + attrSelector + "]") || null;
1799 };
1800 Meta.prototype.getTags = function (attrSelector) {
1801 if (!attrSelector)
1802 return [];
1803 var list /*NodeList*/ = this._doc.querySelectorAll("meta[" + attrSelector + "]");
1804 return list ? [].slice.call(list) : [];
1805 };
1806 Meta.prototype.updateTag = function (tag, selector) {
1807 if (!tag)
1808 return null;
1809 selector = selector || this._parseSelector(tag);
1810 var meta = this.getTag(selector);
1811 if (meta) {
1812 return this._setMetaElementAttributes(tag, meta);
1813 }
1814 return this._getOrCreateElement(tag, true);
1815 };
1816 Meta.prototype.removeTag = function (attrSelector) {
1817 this.removeTagElement(this.getTag(attrSelector));
1818 };
1819 Meta.prototype.removeTagElement = function (meta) {
1820 if (meta) {
1821 this._dom.remove(meta);
1822 }
1823 };
1824 Meta.prototype._getOrCreateElement = function (meta, forceCreation) {
1825 if (forceCreation === void 0) { forceCreation = false; }
1826 if (!forceCreation) {
1827 var selector = this._parseSelector(meta);
1828 var elem = this.getTag(selector);
1829 // It's allowed to have multiple elements with the same name so it's not enough to
1830 // just check that element with the same name already present on the page. We also need to
1831 // check if element has tag attributes
1832 if (elem && this._containsAttributes(meta, elem))
1833 return elem;
1834 }
1835 var element = this._dom.createElement('meta');
1836 this._setMetaElementAttributes(meta, element);
1837 var head = this._doc.getElementsByTagName('head')[0];
1838 head.appendChild(element);
1839 return element;
1840 };
1841 Meta.prototype._setMetaElementAttributes = function (tag, el) {
1842 Object.keys(tag).forEach(function (prop) { return el.setAttribute(prop, tag[prop]); });
1843 return el;
1844 };
1845 Meta.prototype._parseSelector = function (tag) {
1846 var attr = tag.name ? 'name' : 'property';
1847 return attr + "=\"" + tag[attr] + "\"";
1848 };
1849 Meta.prototype._containsAttributes = function (tag, elem) {
1850 return Object.keys(tag).every(function (key) { return elem.getAttribute(key) === tag[key]; });
1851 };
1852 Meta.ɵprov = i0.ɵɵdefineInjectable({ factory: createMeta, token: Meta, providedIn: "root" });
1853 Meta = __decorate([
1854 i0.Injectable({ providedIn: 'root', useFactory: createMeta, deps: [] }),
1855 __param(0, i0.Inject(common.DOCUMENT)),
1856 __metadata("design:paramtypes", [Object])
1857 ], Meta);
1858 return Meta;
1859 }());
1860
1861 /**
1862 * Factory to create Title service.
1863 */
1864 function createTitle() {
1865 return new Title(i0.ɵɵinject(common.DOCUMENT));
1866 }
1867 /**
1868 * A service that can be used to get and set the title of a current HTML document.
1869 *
1870 * Since an Angular application can't be bootstrapped on the entire HTML document (`<html>` tag)
1871 * it is not possible to bind to the `text` property of the `HTMLTitleElement` elements
1872 * (representing the `<title>` tag). Instead, this service can be used to set and get the current
1873 * title value.
1874 *
1875 * @publicApi
1876 */
1877 var Title = /** @class */ (function () {
1878 function Title(_doc) {
1879 this._doc = _doc;
1880 }
1881 /**
1882 * Get the title of the current HTML document.
1883 */
1884 Title.prototype.getTitle = function () {
1885 return this._doc.title;
1886 };
1887 /**
1888 * Set the title of the current HTML document.
1889 * @param newTitle
1890 */
1891 Title.prototype.setTitle = function (newTitle) {
1892 this._doc.title = newTitle || '';
1893 };
1894 Title.ɵprov = i0.ɵɵdefineInjectable({ factory: createTitle, token: Title, providedIn: "root" });
1895 Title = __decorate([
1896 i0.Injectable({ providedIn: 'root', useFactory: createTitle, deps: [] }),
1897 __param(0, i0.Inject(common.DOCUMENT)),
1898 __metadata("design:paramtypes", [Object])
1899 ], Title);
1900 return Title;
1901 }());
1902
1903 /**
1904 * @license
1905 * Copyright Google Inc. All Rights Reserved.
1906 *
1907 * Use of this source code is governed by an MIT-style license that can be
1908 * found in the LICENSE file at https://angular.io/license
1909 */
1910 var win = typeof window !== 'undefined' && window || {};
1911
1912 /**
1913 * @license
1914 * Copyright Google Inc. All Rights Reserved.
1915 *
1916 * Use of this source code is governed by an MIT-style license that can be
1917 * found in the LICENSE file at https://angular.io/license
1918 */
1919 var ChangeDetectionPerfRecord = /** @class */ (function () {
1920 function ChangeDetectionPerfRecord(msPerTick, numTicks) {
1921 this.msPerTick = msPerTick;
1922 this.numTicks = numTicks;
1923 }
1924 return ChangeDetectionPerfRecord;
1925 }());
1926 /**
1927 * Entry point for all Angular profiling-related debug tools. This object
1928 * corresponds to the `ng.profiler` in the dev console.
1929 */
1930 var AngularProfiler = /** @class */ (function () {
1931 function AngularProfiler(ref) {
1932 this.appRef = ref.injector.get(i0.ApplicationRef);
1933 }
1934 // tslint:disable:no-console
1935 /**
1936 * Exercises change detection in a loop and then prints the average amount of
1937 * time in milliseconds how long a single round of change detection takes for
1938 * the current state of the UI. It runs a minimum of 5 rounds for a minimum
1939 * of 500 milliseconds.
1940 *
1941 * Optionally, a user may pass a `config` parameter containing a map of
1942 * options. Supported options are:
1943 *
1944 * `record` (boolean) - causes the profiler to record a CPU profile while
1945 * it exercises the change detector. Example:
1946 *
1947 * ```
1948 * ng.profiler.timeChangeDetection({record: true})
1949 * ```
1950 */
1951 AngularProfiler.prototype.timeChangeDetection = function (config) {
1952 var record = config && config['record'];
1953 var profileName = 'Change Detection';
1954 // Profiler is not available in Android browsers, nor in IE 9 without dev tools opened
1955 var isProfilerAvailable = win.console.profile != null;
1956 if (record && isProfilerAvailable) {
1957 win.console.profile(profileName);
1958 }
1959 var start = common.ɵgetDOM().performanceNow();
1960 var numTicks = 0;
1961 while (numTicks < 5 || (common.ɵgetDOM().performanceNow() - start) < 500) {
1962 this.appRef.tick();
1963 numTicks++;
1964 }
1965 var end = common.ɵgetDOM().performanceNow();
1966 if (record && isProfilerAvailable) {
1967 win.console.profileEnd(profileName);
1968 }
1969 var msPerTick = (end - start) / numTicks;
1970 win.console.log("ran " + numTicks + " change detection cycles");
1971 win.console.log(msPerTick.toFixed(2) + " ms per check");
1972 return new ChangeDetectionPerfRecord(msPerTick, numTicks);
1973 };
1974 return AngularProfiler;
1975 }());
1976
1977 /**
1978 * @license
1979 * Copyright Google Inc. All Rights Reserved.
1980 *
1981 * Use of this source code is governed by an MIT-style license that can be
1982 * found in the LICENSE file at https://angular.io/license
1983 */
1984 var PROFILER_GLOBAL_NAME = 'profiler';
1985 /**
1986 * Enabled Angular debug tools that are accessible via your browser's
1987 * developer console.
1988 *
1989 * Usage:
1990 *
1991 * 1. Open developer console (e.g. in Chrome Ctrl + Shift + j)
1992 * 1. Type `ng.` (usually the console will show auto-complete suggestion)
1993 * 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
1994 * then hit Enter.
1995 *
1996 * @publicApi
1997 */
1998 function enableDebugTools(ref) {
1999 exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
2000 return ref;
2001 }
2002 /**
2003 * Disables Angular tools.
2004 *
2005 * @publicApi
2006 */
2007 function disableDebugTools() {
2008 exportNgVar(PROFILER_GLOBAL_NAME, null);
2009 }
2010
2011 /**
2012 * @license
2013 * Copyright Google Inc. All Rights Reserved.
2014 *
2015 * Use of this source code is governed by an MIT-style license that can be
2016 * found in the LICENSE file at https://angular.io/license
2017 */
2018 function escapeHtml(text) {
2019 var escapedText = {
2020 '&': '&a;',
2021 '"': '&q;',
2022 '\'': '&s;',
2023 '<': '&l;',
2024 '>': '&g;',
2025 };
2026 return text.replace(/[&"'<>]/g, function (s) { return escapedText[s]; });
2027 }
2028 function unescapeHtml(text) {
2029 var unescapedText = {
2030 '&a;': '&',
2031 '&q;': '"',
2032 '&s;': '\'',
2033 '&l;': '<',
2034 '&g;': '>',
2035 };
2036 return text.replace(/&[^;]+;/g, function (s) { return unescapedText[s]; });
2037 }
2038 /**
2039 * Create a `StateKey<T>` that can be used to store value of type T with `TransferState`.
2040 *
2041 * Example:
2042 *
2043 * ```
2044 * const COUNTER_KEY = makeStateKey<number>('counter');
2045 * let value = 10;
2046 *
2047 * transferState.set(COUNTER_KEY, value);
2048 * ```
2049 *
2050 * @publicApi
2051 */
2052 function makeStateKey(key) {
2053 return key;
2054 }
2055 /**
2056 * A key value store that is transferred from the application on the server side to the application
2057 * on the client side.
2058 *
2059 * `TransferState` will be available as an injectable token. To use it import
2060 * `ServerTransferStateModule` on the server and `BrowserTransferStateModule` on the client.
2061 *
2062 * The values in the store are serialized/deserialized using JSON.stringify/JSON.parse. So only
2063 * boolean, number, string, null and non-class objects will be serialized and deserialzied in a
2064 * non-lossy manner.
2065 *
2066 * @publicApi
2067 */
2068 var TransferState = /** @class */ (function () {
2069 function TransferState() {
2070 this.store = {};
2071 this.onSerializeCallbacks = {};
2072 }
2073 TransferState_1 = TransferState;
2074 /** @internal */
2075 TransferState.init = function (initState) {
2076 var transferState = new TransferState_1();
2077 transferState.store = initState;
2078 return transferState;
2079 };
2080 /**
2081 * Get the value corresponding to a key. Return `defaultValue` if key is not found.
2082 */
2083 TransferState.prototype.get = function (key, defaultValue) {
2084 return this.store[key] !== undefined ? this.store[key] : defaultValue;
2085 };
2086 /**
2087 * Set the value corresponding to a key.
2088 */
2089 TransferState.prototype.set = function (key, value) {
2090 this.store[key] = value;
2091 };
2092 /**
2093 * Remove a key from the store.
2094 */
2095 TransferState.prototype.remove = function (key) {
2096 delete this.store[key];
2097 };
2098 /**
2099 * Test whether a key exists in the store.
2100 */
2101 TransferState.prototype.hasKey = function (key) {
2102 return this.store.hasOwnProperty(key);
2103 };
2104 /**
2105 * Register a callback to provide the value for a key when `toJson` is called.
2106 */
2107 TransferState.prototype.onSerialize = function (key, callback) {
2108 this.onSerializeCallbacks[key] = callback;
2109 };
2110 /**
2111 * Serialize the current state of the store to JSON.
2112 */
2113 TransferState.prototype.toJson = function () {
2114 // Call the onSerialize callbacks and put those values into the store.
2115 for (var key in this.onSerializeCallbacks) {
2116 if (this.onSerializeCallbacks.hasOwnProperty(key)) {
2117 try {
2118 this.store[key] = this.onSerializeCallbacks[key]();
2119 }
2120 catch (e) {
2121 console.warn('Exception in onSerialize callback: ', e);
2122 }
2123 }
2124 }
2125 return JSON.stringify(this.store);
2126 };
2127 var TransferState_1;
2128 TransferState = TransferState_1 = __decorate([
2129 i0.Injectable()
2130 ], TransferState);
2131 return TransferState;
2132 }());
2133 function initTransferState(doc, appId) {
2134 // Locate the script tag with the JSON data transferred from the server.
2135 // The id of the script tag is set to the Angular appId + 'state'.
2136 var script = doc.getElementById(appId + '-state');
2137 var initialState = {};
2138 if (script && script.textContent) {
2139 try {
2140 initialState = JSON.parse(unescapeHtml(script.textContent));
2141 }
2142 catch (e) {
2143 console.warn('Exception while restoring TransferState for app ' + appId, e);
2144 }
2145 }
2146 return TransferState.init(initialState);
2147 }
2148 /**
2149 * NgModule to install on the client side while using the `TransferState` to transfer state from
2150 * server to client.
2151 *
2152 * @publicApi
2153 */
2154 var BrowserTransferStateModule = /** @class */ (function () {
2155 function BrowserTransferStateModule() {
2156 }
2157 BrowserTransferStateModule = __decorate([
2158 i0.NgModule({
2159 providers: [{ provide: TransferState, useFactory: initTransferState, deps: [common.DOCUMENT, i0.APP_ID] }],
2160 })
2161 ], BrowserTransferStateModule);
2162 return BrowserTransferStateModule;
2163 }());
2164
2165 /**
2166 * @license
2167 * Copyright Google Inc. All Rights Reserved.
2168 *
2169 * Use of this source code is governed by an MIT-style license that can be
2170 * found in the LICENSE file at https://angular.io/license
2171 */
2172 /**
2173 * Predicates for use with {@link DebugElement}'s query functions.
2174 *
2175 * @publicApi
2176 */
2177 var By = /** @class */ (function () {
2178 function By() {
2179 }
2180 /**
2181 * Match all nodes.
2182 *
2183 * @usageNotes
2184 * ### Example
2185 *
2186 * {@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
2187 */
2188 By.all = function () {
2189 return function () { return true; };
2190 };
2191 /**
2192 * Match elements by the given CSS selector.
2193 *
2194 * @usageNotes
2195 * ### Example
2196 *
2197 * {@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
2198 */
2199 By.css = function (selector) {
2200 return function (debugElement) {
2201 return debugElement.nativeElement != null ?
2202 elementMatches(debugElement.nativeElement, selector) :
2203 false;
2204 };
2205 };
2206 /**
2207 * Match nodes that have the given directive present.
2208 *
2209 * @usageNotes
2210 * ### Example
2211 *
2212 * {@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
2213 */
2214 By.directive = function (type) {
2215 return function (debugNode) { return debugNode.providerTokens.indexOf(type) !== -1; };
2216 };
2217 return By;
2218 }());
2219 function elementMatches(n, selector) {
2220 if (common.ɵgetDOM().isElementNode(n)) {
2221 return n.matches && n.matches(selector) ||
2222 n.msMatchesSelector && n.msMatchesSelector(selector) ||
2223 n.webkitMatchesSelector && n.webkitMatchesSelector(selector);
2224 }
2225 return false;
2226 }
2227
2228 /**
2229 * @license
2230 * Copyright Google Inc. All Rights Reserved.
2231 *
2232 * Use of this source code is governed by an MIT-style license that can be
2233 * found in the LICENSE file at https://angular.io/license
2234 */
2235
2236 /**
2237 * @license
2238 * Copyright Google Inc. All Rights Reserved.
2239 *
2240 * Use of this source code is governed by an MIT-style license that can be
2241 * found in the LICENSE file at https://angular.io/license
2242 */
2243 /**
2244 * @publicApi
2245 */
2246 var VERSION = new i0.Version('9.1.3');
2247
2248 /**
2249 * @license
2250 * Copyright Google Inc. All Rights Reserved.
2251 *
2252 * Use of this source code is governed by an MIT-style license that can be
2253 * found in the LICENSE file at https://angular.io/license
2254 */
2255
2256 /**
2257 * @license
2258 * Copyright Google Inc. All Rights Reserved.
2259 *
2260 * Use of this source code is governed by an MIT-style license that can be
2261 * found in the LICENSE file at https://angular.io/license
2262 */
2263 // This file only reexports content of the `src` folder. Keep it that way.
2264
2265 /**
2266 * @license
2267 * Copyright Google Inc. All Rights Reserved.
2268 *
2269 * Use of this source code is governed by an MIT-style license that can be
2270 * found in the LICENSE file at https://angular.io/license
2271 */
2272
2273 /**
2274 * Generated bundle index. Do not edit.
2275 */
2276
2277 Object.defineProperty(exports, 'ɵgetDOM', {
2278 enumerable: true,
2279 get: function () {
2280 return common.ɵgetDOM;
2281 }
2282 });
2283 exports.BrowserModule = BrowserModule;
2284 exports.BrowserTransferStateModule = BrowserTransferStateModule;
2285 exports.By = By;
2286 exports.DomSanitizer = DomSanitizer;
2287 exports.EVENT_MANAGER_PLUGINS = EVENT_MANAGER_PLUGINS;
2288 exports.EventManager = EventManager;
2289 exports.HAMMER_GESTURE_CONFIG = HAMMER_GESTURE_CONFIG;
2290 exports.HAMMER_LOADER = HAMMER_LOADER;
2291 exports.HammerGestureConfig = HammerGestureConfig;
2292 exports.HammerModule = HammerModule;
2293 exports.Meta = Meta;
2294 exports.Title = Title;
2295 exports.TransferState = TransferState;
2296 exports.VERSION = VERSION;
2297 exports.disableDebugTools = disableDebugTools;
2298 exports.enableDebugTools = enableDebugTools;
2299 exports.makeStateKey = makeStateKey;
2300 exports.platformBrowser = platformBrowser;
2301 exports.ɵBROWSER_SANITIZATION_PROVIDERS = BROWSER_SANITIZATION_PROVIDERS;
2302 exports.ɵBROWSER_SANITIZATION_PROVIDERS__POST_R3__ = BROWSER_SANITIZATION_PROVIDERS__POST_R3__;
2303 exports.ɵBrowserDomAdapter = BrowserDomAdapter;
2304 exports.ɵBrowserGetTestability = BrowserGetTestability;
2305 exports.ɵDomEventsPlugin = DomEventsPlugin;
2306 exports.ɵDomRendererFactory2 = DomRendererFactory2;
2307 exports.ɵDomSanitizerImpl = DomSanitizerImpl;
2308 exports.ɵDomSharedStylesHost = DomSharedStylesHost;
2309 exports.ɵELEMENT_PROBE_PROVIDERS = ELEMENT_PROBE_PROVIDERS;
2310 exports.ɵELEMENT_PROBE_PROVIDERS__POST_R3__ = ELEMENT_PROBE_PROVIDERS__POST_R3__;
2311 exports.ɵHAMMER_PROVIDERS__POST_R3__ = HAMMER_PROVIDERS__POST_R3__;
2312 exports.ɵHammerGesturesPlugin = HammerGesturesPlugin;
2313 exports.ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS = INTERNAL_BROWSER_PLATFORM_PROVIDERS;
2314 exports.ɵKeyEventsPlugin = KeyEventsPlugin;
2315 exports.ɵNAMESPACE_URIS = NAMESPACE_URIS;
2316 exports.ɵSharedStylesHost = SharedStylesHost;
2317 exports.ɵTRANSITION_ID = TRANSITION_ID;
2318 exports.ɵangular_packages_platform_browser_platform_browser_a = errorHandler;
2319 exports.ɵangular_packages_platform_browser_platform_browser_b = _document;
2320 exports.ɵangular_packages_platform_browser_platform_browser_c = BROWSER_MODULE_PROVIDERS;
2321 exports.ɵangular_packages_platform_browser_platform_browser_d = createMeta;
2322 exports.ɵangular_packages_platform_browser_platform_browser_e = createTitle;
2323 exports.ɵangular_packages_platform_browser_platform_browser_f = initTransferState;
2324 exports.ɵangular_packages_platform_browser_platform_browser_g = EventManagerPlugin;
2325 exports.ɵangular_packages_platform_browser_platform_browser_h = HAMMER_PROVIDERS__PRE_R3__;
2326 exports.ɵangular_packages_platform_browser_platform_browser_i = HAMMER_PROVIDERS;
2327 exports.ɵangular_packages_platform_browser_platform_browser_j = domSanitizerImplFactory;
2328 exports.ɵangular_packages_platform_browser_platform_browser_k = appInitializerFactory;
2329 exports.ɵangular_packages_platform_browser_platform_browser_l = SERVER_TRANSITION_PROVIDERS;
2330 exports.ɵangular_packages_platform_browser_platform_browser_m = _createNgProbeR2;
2331 exports.ɵangular_packages_platform_browser_platform_browser_n = ELEMENT_PROBE_PROVIDERS__PRE_R3__;
2332 exports.ɵangular_packages_platform_browser_platform_browser_o = GenericBrowserDomAdapter;
2333 exports.ɵescapeHtml = escapeHtml;
2334 exports.ɵflattenStyles = flattenStyles;
2335 exports.ɵinitDomAdapter = initDomAdapter;
2336 exports.ɵshimContentAttribute = shimContentAttribute;
2337 exports.ɵshimHostAttribute = shimHostAttribute;
2338
2339 Object.defineProperty(exports, '__esModule', { value: true });
2340
2341})));
2342//# sourceMappingURL=platform-browser.umd.js.map