UNPKG

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