UNPKG

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