UNPKG

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