1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | import { ɵDomAdapter, ɵsetRootDomAdapter, ɵparseCookieValue, ɵgetDOM, DOCUMENT, ɵPLATFORM_BROWSER_ID, XhrFactory, CommonModule } from '@angular/common';
|
8 | export { ɵgetDOM } from '@angular/common';
|
9 | import * as i0 from '@angular/core';
|
10 | import { 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 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 | class GenericBrowserDomAdapter extends ɵDomAdapter {
|
26 | constructor() {
|
27 | super(...arguments);
|
28 | this.supportsDOMEvents = true;
|
29 | }
|
30 | }
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
47 | static makeCurrent() {
|
48 | ɵsetRootDomAdapter(new BrowserDomAdapter());
|
49 | }
|
50 | onAndCancel(el, evt, listener) {
|
51 | el.addEventListener(evt, listener, false);
|
52 |
|
53 |
|
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 |
|
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 | }
|
109 | let baseElement = null;
|
110 | function getBaseElementHref() {
|
111 | baseElement = baseElement || document.querySelector('base');
|
112 | return baseElement ? baseElement.getAttribute('href') : null;
|
113 | }
|
114 |
|
115 | let urlParsingNode;
|
116 | function 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 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 | const TRANSITION_ID = new InjectionToken('TRANSITION_ID');
|
135 | function appInitializerFactory(transitionId, document, injector) {
|
136 | return () => {
|
137 |
|
138 |
|
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 | }
|
148 | const 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 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 | class 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 |
|
218 |
|
219 | class BrowserXhr {
|
220 | build() {
|
221 | return new XMLHttpRequest();
|
222 | }
|
223 | }
|
224 | BrowserXhr.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserXhr, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
225 | BrowserXhr.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserXhr });
|
226 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserXhr, decorators: [{
|
227 | type: Injectable
|
228 | }] });
|
229 |
|
230 |
|
231 |
|
232 |
|
233 |
|
234 |
|
235 |
|
236 |
|
237 |
|
238 |
|
239 |
|
240 |
|
241 |
|
242 | const EVENT_MANAGER_PLUGINS = new InjectionToken('EventManagerPlugins');
|
243 |
|
244 |
|
245 |
|
246 |
|
247 |
|
248 |
|
249 | class EventManager {
|
250 | |
251 |
|
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 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 | addEventListener(element, eventName, handler) {
|
269 | const plugin = this._findPluginFor(eventName);
|
270 | return plugin.addEventListener(element, eventName, handler);
|
271 | }
|
272 | |
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 |
|
280 |
|
281 |
|
282 | addGlobalEventListener(target, eventName, handler) {
|
283 | const plugin = this._findPluginFor(eventName);
|
284 | return plugin.addGlobalEventListener(target, eventName, handler);
|
285 | }
|
286 | |
287 |
|
288 |
|
289 | getZone() {
|
290 | return this._zone;
|
291 | }
|
292 |
|
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 | }
|
309 | EventManager.ɵ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 });
|
310 | EventManager.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: EventManager });
|
311 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: EventManager, decorators: [{
|
312 | type: Injectable
|
313 | }], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
314 | type: Inject,
|
315 | args: [EVENT_MANAGER_PLUGINS]
|
316 | }] }, { type: i0.NgZone }]; } });
|
317 | class EventManagerPlugin {
|
318 | constructor(_doc) {
|
319 | this._doc = _doc;
|
320 | }
|
321 | addGlobalEventListener(element, eventName, handler) {
|
322 | const target = ɵgetDOM().getGlobalEventTarget(this._doc, element);
|
323 | if (!target) {
|
324 | throw new Error(`Unsupported event target ${target} for event ${eventName}`);
|
325 | }
|
326 | return this.addEventListener(target, eventName, handler);
|
327 | }
|
328 | }
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 | class SharedStylesHost {
|
338 | constructor() {
|
339 |
|
340 | this._stylesSet = new Set();
|
341 | }
|
342 | addStyles(styles) {
|
343 | const additions = new Set();
|
344 | styles.forEach(style => {
|
345 | if (!this._stylesSet.has(style)) {
|
346 | this._stylesSet.add(style);
|
347 | additions.add(style);
|
348 | }
|
349 | });
|
350 | this.onStylesAdded(additions);
|
351 | }
|
352 | onStylesAdded(additions) { }
|
353 | getAllStyles() {
|
354 | return Array.from(this._stylesSet);
|
355 | }
|
356 | }
|
357 | SharedStylesHost.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: SharedStylesHost, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
358 | SharedStylesHost.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: SharedStylesHost });
|
359 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: SharedStylesHost, decorators: [{
|
360 | type: Injectable
|
361 | }] });
|
362 | class DomSharedStylesHost extends SharedStylesHost {
|
363 | constructor(_doc) {
|
364 | super();
|
365 | this._doc = _doc;
|
366 |
|
367 | this._hostNodes = new Map();
|
368 | this._hostNodes.set(_doc.head, []);
|
369 | }
|
370 | _addStylesToHost(styles, host, styleNodes) {
|
371 | styles.forEach((style) => {
|
372 | const styleEl = this._doc.createElement('style');
|
373 | styleEl.textContent = style;
|
374 | styleNodes.push(host.appendChild(styleEl));
|
375 | });
|
376 | }
|
377 | addHost(hostNode) {
|
378 | const styleNodes = [];
|
379 | this._addStylesToHost(this._stylesSet, hostNode, styleNodes);
|
380 | this._hostNodes.set(hostNode, styleNodes);
|
381 | }
|
382 | removeHost(hostNode) {
|
383 | const styleNodes = this._hostNodes.get(hostNode);
|
384 | if (styleNodes) {
|
385 | styleNodes.forEach(removeStyle);
|
386 | }
|
387 | this._hostNodes.delete(hostNode);
|
388 | }
|
389 | onStylesAdded(additions) {
|
390 | this._hostNodes.forEach((styleNodes, hostNode) => {
|
391 | this._addStylesToHost(additions, hostNode, styleNodes);
|
392 | });
|
393 | }
|
394 | ngOnDestroy() {
|
395 | this._hostNodes.forEach(styleNodes => styleNodes.forEach(removeStyle));
|
396 | }
|
397 | }
|
398 | DomSharedStylesHost.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSharedStylesHost, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
399 | DomSharedStylesHost.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSharedStylesHost });
|
400 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSharedStylesHost, decorators: [{
|
401 | type: Injectable
|
402 | }], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
403 | type: Inject,
|
404 | args: [DOCUMENT]
|
405 | }] }]; } });
|
406 | function removeStyle(styleNode) {
|
407 | ɵgetDOM().remove(styleNode);
|
408 | }
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 | const NAMESPACE_URIS = {
|
418 | 'svg': 'http://www.w3.org/2000/svg',
|
419 | 'xhtml': 'http://www.w3.org/1999/xhtml',
|
420 | 'xlink': 'http://www.w3.org/1999/xlink',
|
421 | 'xml': 'http://www.w3.org/XML/1998/namespace',
|
422 | 'xmlns': 'http://www.w3.org/2000/xmlns/',
|
423 | };
|
424 | const COMPONENT_REGEX = /%COMP%/g;
|
425 | const NG_DEV_MODE = typeof ngDevMode === 'undefined' || !!ngDevMode;
|
426 | const COMPONENT_VARIABLE = '%COMP%';
|
427 | const HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
|
428 | const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;
|
429 | function shimContentAttribute(componentShortId) {
|
430 | return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
|
431 | }
|
432 | function shimHostAttribute(componentShortId) {
|
433 | return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
|
434 | }
|
435 | function flattenStyles(compId, styles, target) {
|
436 | for (let i = 0; i < styles.length; i++) {
|
437 | let style = styles[i];
|
438 | if (Array.isArray(style)) {
|
439 | flattenStyles(compId, style, target);
|
440 | }
|
441 | else {
|
442 | style = style.replace(COMPONENT_REGEX, compId);
|
443 | target.push(style);
|
444 | }
|
445 | }
|
446 | return target;
|
447 | }
|
448 | function decoratePreventDefault(eventHandler) {
|
449 |
|
450 |
|
451 |
|
452 |
|
453 | return (event) => {
|
454 |
|
455 |
|
456 |
|
457 |
|
458 | if (event === '__ngUnwrap__') {
|
459 | return eventHandler;
|
460 | }
|
461 | const allowDefaultBehavior = eventHandler(event);
|
462 | if (allowDefaultBehavior === false) {
|
463 |
|
464 | event.preventDefault();
|
465 | event.returnValue = false;
|
466 | }
|
467 | return undefined;
|
468 | };
|
469 | }
|
470 | let hasLoggedNativeEncapsulationWarning = false;
|
471 | class DomRendererFactory2 {
|
472 | constructor(eventManager, sharedStylesHost, appId) {
|
473 | this.eventManager = eventManager;
|
474 | this.sharedStylesHost = sharedStylesHost;
|
475 | this.appId = appId;
|
476 | this.rendererByCompId = new Map();
|
477 | this.defaultRenderer = new DefaultDomRenderer2(eventManager);
|
478 | }
|
479 | createRenderer(element, type) {
|
480 | if (!element || !type) {
|
481 | return this.defaultRenderer;
|
482 | }
|
483 | switch (type.encapsulation) {
|
484 | case ViewEncapsulation.Emulated: {
|
485 | let renderer = this.rendererByCompId.get(type.id);
|
486 | if (!renderer) {
|
487 | renderer = new EmulatedEncapsulationDomRenderer2(this.eventManager, this.sharedStylesHost, type, this.appId);
|
488 | this.rendererByCompId.set(type.id, renderer);
|
489 | }
|
490 | renderer.applyToHost(element);
|
491 | return renderer;
|
492 | }
|
493 |
|
494 |
|
495 | case 1:
|
496 | case ViewEncapsulation.ShadowDom:
|
497 |
|
498 | if ((typeof ngDevMode === 'undefined' || ngDevMode) &&
|
499 |
|
500 |
|
501 |
|
502 | !hasLoggedNativeEncapsulationWarning && type.encapsulation === 1) {
|
503 | hasLoggedNativeEncapsulationWarning = true;
|
504 | console.warn('ViewEncapsulation.Native is no longer supported. Falling back to ViewEncapsulation.ShadowDom. The fallback will be removed in v12.');
|
505 | }
|
506 | return new ShadowDomRenderer(this.eventManager, this.sharedStylesHost, element, type);
|
507 | default: {
|
508 | if (!this.rendererByCompId.has(type.id)) {
|
509 | const styles = flattenStyles(type.id, type.styles, []);
|
510 | this.sharedStylesHost.addStyles(styles);
|
511 | this.rendererByCompId.set(type.id, this.defaultRenderer);
|
512 | }
|
513 | return this.defaultRenderer;
|
514 | }
|
515 | }
|
516 | }
|
517 | begin() { }
|
518 | end() { }
|
519 | }
|
520 | DomRendererFactory2.ɵ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 });
|
521 | DomRendererFactory2.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomRendererFactory2 });
|
522 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomRendererFactory2, decorators: [{
|
523 | type: Injectable
|
524 | }], ctorParameters: function () { return [{ type: EventManager }, { type: DomSharedStylesHost }, { type: undefined, decorators: [{
|
525 | type: Inject,
|
526 | args: [APP_ID]
|
527 | }] }]; } });
|
528 | class DefaultDomRenderer2 {
|
529 | constructor(eventManager) {
|
530 | this.eventManager = eventManager;
|
531 | this.data = Object.create(null);
|
532 | this.destroyNode = null;
|
533 | }
|
534 | destroy() { }
|
535 | createElement(name, namespace) {
|
536 | if (namespace) {
|
537 |
|
538 |
|
539 | return document.createElementNS(NAMESPACE_URIS[namespace] || namespace, name);
|
540 | }
|
541 | return document.createElement(name);
|
542 | }
|
543 | createComment(value) {
|
544 | return document.createComment(value);
|
545 | }
|
546 | createText(value) {
|
547 | return document.createTextNode(value);
|
548 | }
|
549 | appendChild(parent, newChild) {
|
550 | parent.appendChild(newChild);
|
551 | }
|
552 | insertBefore(parent, newChild, refChild) {
|
553 | if (parent) {
|
554 | parent.insertBefore(newChild, refChild);
|
555 | }
|
556 | }
|
557 | removeChild(parent, oldChild) {
|
558 | if (parent) {
|
559 | parent.removeChild(oldChild);
|
560 | }
|
561 | }
|
562 | selectRootElement(selectorOrNode, preserveContent) {
|
563 | let el = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) :
|
564 | selectorOrNode;
|
565 | if (!el) {
|
566 | throw new Error(`The selector "${selectorOrNode}" did not match any elements`);
|
567 | }
|
568 | if (!preserveContent) {
|
569 | el.textContent = '';
|
570 | }
|
571 | return el;
|
572 | }
|
573 | parentNode(node) {
|
574 | return node.parentNode;
|
575 | }
|
576 | nextSibling(node) {
|
577 | return node.nextSibling;
|
578 | }
|
579 | setAttribute(el, name, value, namespace) {
|
580 | if (namespace) {
|
581 | name = namespace + ':' + name;
|
582 |
|
583 |
|
584 | const namespaceUri = NAMESPACE_URIS[namespace];
|
585 | if (namespaceUri) {
|
586 | el.setAttributeNS(namespaceUri, name, value);
|
587 | }
|
588 | else {
|
589 | el.setAttribute(name, value);
|
590 | }
|
591 | }
|
592 | else {
|
593 | el.setAttribute(name, value);
|
594 | }
|
595 | }
|
596 | removeAttribute(el, name, namespace) {
|
597 | if (namespace) {
|
598 |
|
599 |
|
600 | const namespaceUri = NAMESPACE_URIS[namespace];
|
601 | if (namespaceUri) {
|
602 | el.removeAttributeNS(namespaceUri, name);
|
603 | }
|
604 | else {
|
605 |
|
606 |
|
607 |
|
608 | el.removeAttribute(`${namespace}:${name}`);
|
609 | }
|
610 | }
|
611 | else {
|
612 | el.removeAttribute(name);
|
613 | }
|
614 | }
|
615 | addClass(el, name) {
|
616 | el.classList.add(name);
|
617 | }
|
618 | removeClass(el, name) {
|
619 | el.classList.remove(name);
|
620 | }
|
621 | setStyle(el, style, value, flags) {
|
622 | if (flags & (RendererStyleFlags2.DashCase | RendererStyleFlags2.Important)) {
|
623 | el.style.setProperty(style, value, flags & RendererStyleFlags2.Important ? 'important' : '');
|
624 | }
|
625 | else {
|
626 | el.style[style] = value;
|
627 | }
|
628 | }
|
629 | removeStyle(el, style, flags) {
|
630 | if (flags & RendererStyleFlags2.DashCase) {
|
631 | el.style.removeProperty(style);
|
632 | }
|
633 | else {
|
634 |
|
635 |
|
636 | el.style[style] = '';
|
637 | }
|
638 | }
|
639 | setProperty(el, name, value) {
|
640 | NG_DEV_MODE && checkNoSyntheticProp(name, 'property');
|
641 | el[name] = value;
|
642 | }
|
643 | setValue(node, value) {
|
644 | node.nodeValue = value;
|
645 | }
|
646 | listen(target, event, callback) {
|
647 | NG_DEV_MODE && checkNoSyntheticProp(event, 'listener');
|
648 | if (typeof target === 'string') {
|
649 | return this.eventManager.addGlobalEventListener(target, event, decoratePreventDefault(callback));
|
650 | }
|
651 | return this.eventManager.addEventListener(target, event, decoratePreventDefault(callback));
|
652 | }
|
653 | }
|
654 | const AT_CHARCODE = (() => '@'.charCodeAt(0))();
|
655 | function checkNoSyntheticProp(name, nameKind) {
|
656 | if (name.charCodeAt(0) === AT_CHARCODE) {
|
657 | throw new Error(`Unexpected synthetic ${nameKind} ${name} found. Please make sure that:
|
658 | - Either \`BrowserAnimationsModule\` or \`NoopAnimationsModule\` are imported in your application.
|
659 | - There is corresponding configuration for the animation named \`${name}\` defined in the \`animations\` field of the \`@Component\` decorator (see https://angular.io/api/core/Component#animations).`);
|
660 | }
|
661 | }
|
662 | class EmulatedEncapsulationDomRenderer2 extends DefaultDomRenderer2 {
|
663 | constructor(eventManager, sharedStylesHost, component, appId) {
|
664 | super(eventManager);
|
665 | this.component = component;
|
666 | const styles = flattenStyles(appId + '-' + component.id, component.styles, []);
|
667 | sharedStylesHost.addStyles(styles);
|
668 | this.contentAttr = shimContentAttribute(appId + '-' + component.id);
|
669 | this.hostAttr = shimHostAttribute(appId + '-' + component.id);
|
670 | }
|
671 | applyToHost(element) {
|
672 | super.setAttribute(element, this.hostAttr, '');
|
673 | }
|
674 | createElement(parent, name) {
|
675 | const el = super.createElement(parent, name);
|
676 | super.setAttribute(el, this.contentAttr, '');
|
677 | return el;
|
678 | }
|
679 | }
|
680 | class ShadowDomRenderer extends DefaultDomRenderer2 {
|
681 | constructor(eventManager, sharedStylesHost, hostEl, component) {
|
682 | super(eventManager);
|
683 | this.sharedStylesHost = sharedStylesHost;
|
684 | this.hostEl = hostEl;
|
685 | this.shadowRoot = hostEl.attachShadow({ mode: 'open' });
|
686 | this.sharedStylesHost.addHost(this.shadowRoot);
|
687 | const styles = flattenStyles(component.id, component.styles, []);
|
688 | for (let i = 0; i < styles.length; i++) {
|
689 | const styleEl = document.createElement('style');
|
690 | styleEl.textContent = styles[i];
|
691 | this.shadowRoot.appendChild(styleEl);
|
692 | }
|
693 | }
|
694 | nodeOrShadowRoot(node) {
|
695 | return node === this.hostEl ? this.shadowRoot : node;
|
696 | }
|
697 | destroy() {
|
698 | this.sharedStylesHost.removeHost(this.shadowRoot);
|
699 | }
|
700 | appendChild(parent, newChild) {
|
701 | return super.appendChild(this.nodeOrShadowRoot(parent), newChild);
|
702 | }
|
703 | insertBefore(parent, newChild, refChild) {
|
704 | return super.insertBefore(this.nodeOrShadowRoot(parent), newChild, refChild);
|
705 | }
|
706 | removeChild(parent, oldChild) {
|
707 | return super.removeChild(this.nodeOrShadowRoot(parent), oldChild);
|
708 | }
|
709 | parentNode(node) {
|
710 | return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(node)));
|
711 | }
|
712 | }
|
713 |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 |
|
719 |
|
720 |
|
721 | class DomEventsPlugin extends EventManagerPlugin {
|
722 | constructor(doc) {
|
723 | super(doc);
|
724 | }
|
725 |
|
726 |
|
727 | supports(eventName) {
|
728 | return true;
|
729 | }
|
730 | addEventListener(element, eventName, handler) {
|
731 | element.addEventListener(eventName, handler, false);
|
732 | return () => this.removeEventListener(element, eventName, handler);
|
733 | }
|
734 | removeEventListener(target, eventName, callback) {
|
735 | return target.removeEventListener(eventName, callback);
|
736 | }
|
737 | }
|
738 | DomEventsPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomEventsPlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
739 | DomEventsPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomEventsPlugin });
|
740 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomEventsPlugin, decorators: [{
|
741 | type: Injectable
|
742 | }], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
743 | type: Inject,
|
744 | args: [DOCUMENT]
|
745 | }] }]; } });
|
746 |
|
747 |
|
748 |
|
749 |
|
750 |
|
751 |
|
752 |
|
753 |
|
754 |
|
755 |
|
756 |
|
757 | const MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];
|
758 | const DOM_KEY_LOCATION_NUMPAD = 3;
|
759 |
|
760 | const _keyMap = {
|
761 |
|
762 |
|
763 | '\b': 'Backspace',
|
764 | '\t': 'Tab',
|
765 | '\x7F': 'Delete',
|
766 | '\x1B': 'Escape',
|
767 | 'Del': 'Delete',
|
768 | 'Esc': 'Escape',
|
769 | 'Left': 'ArrowLeft',
|
770 | 'Right': 'ArrowRight',
|
771 | 'Up': 'ArrowUp',
|
772 | 'Down': 'ArrowDown',
|
773 | 'Menu': 'ContextMenu',
|
774 | 'Scroll': 'ScrollLock',
|
775 | 'Win': 'OS'
|
776 | };
|
777 |
|
778 |
|
779 |
|
780 | const _chromeNumKeyPadMap = {
|
781 | 'A': '1',
|
782 | 'B': '2',
|
783 | 'C': '3',
|
784 | 'D': '4',
|
785 | 'E': '5',
|
786 | 'F': '6',
|
787 | 'G': '7',
|
788 | 'H': '8',
|
789 | 'I': '9',
|
790 | 'J': '*',
|
791 | 'K': '+',
|
792 | 'M': '-',
|
793 | 'N': '.',
|
794 | 'O': '/',
|
795 | '\x60': '0',
|
796 | '\x90': 'NumLock'
|
797 | };
|
798 |
|
799 |
|
800 |
|
801 | const MODIFIER_KEY_GETTERS = {
|
802 | 'alt': (event) => event.altKey,
|
803 | 'control': (event) => event.ctrlKey,
|
804 | 'meta': (event) => event.metaKey,
|
805 | 'shift': (event) => event.shiftKey
|
806 | };
|
807 |
|
808 |
|
809 |
|
810 |
|
811 | class KeyEventsPlugin extends EventManagerPlugin {
|
812 | |
813 |
|
814 |
|
815 |
|
816 | constructor(doc) {
|
817 | super(doc);
|
818 | }
|
819 | |
820 |
|
821 |
|
822 |
|
823 |
|
824 | supports(eventName) {
|
825 | return KeyEventsPlugin.parseEventName(eventName) != null;
|
826 | }
|
827 | |
828 |
|
829 |
|
830 |
|
831 |
|
832 |
|
833 |
|
834 |
|
835 | addEventListener(element, eventName, handler) {
|
836 | const parsedEvent = KeyEventsPlugin.parseEventName(eventName);
|
837 | const outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
|
838 | return this.manager.getZone().runOutsideAngular(() => {
|
839 | return ɵgetDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler);
|
840 | });
|
841 | }
|
842 | static parseEventName(eventName) {
|
843 | const parts = eventName.toLowerCase().split('.');
|
844 | const domEventName = parts.shift();
|
845 | if ((parts.length === 0) || !(domEventName === 'keydown' || domEventName === 'keyup')) {
|
846 | return null;
|
847 | }
|
848 | const key = KeyEventsPlugin._normalizeKey(parts.pop());
|
849 | let fullKey = '';
|
850 | MODIFIER_KEYS.forEach(modifierName => {
|
851 | const index = parts.indexOf(modifierName);
|
852 | if (index > -1) {
|
853 | parts.splice(index, 1);
|
854 | fullKey += modifierName + '.';
|
855 | }
|
856 | });
|
857 | fullKey += key;
|
858 | if (parts.length != 0 || key.length === 0) {
|
859 |
|
860 | return null;
|
861 | }
|
862 |
|
863 |
|
864 |
|
865 | const result = {};
|
866 | result['domEventName'] = domEventName;
|
867 | result['fullKey'] = fullKey;
|
868 | return result;
|
869 | }
|
870 | static getEventFullKey(event) {
|
871 | let fullKey = '';
|
872 | let key = getEventKey(event);
|
873 | key = key.toLowerCase();
|
874 | if (key === ' ') {
|
875 | key = 'space';
|
876 | }
|
877 | else if (key === '.') {
|
878 | key = 'dot';
|
879 | }
|
880 | MODIFIER_KEYS.forEach(modifierName => {
|
881 | if (modifierName != key) {
|
882 | const modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
|
883 | if (modifierGetter(event)) {
|
884 | fullKey += modifierName + '.';
|
885 | }
|
886 | }
|
887 | });
|
888 | fullKey += key;
|
889 | return fullKey;
|
890 | }
|
891 | |
892 |
|
893 |
|
894 |
|
895 |
|
896 |
|
897 |
|
898 | static eventCallback(fullKey, handler, zone) {
|
899 | return (event /** TODO #9100 */) => {
|
900 | if (KeyEventsPlugin.getEventFullKey(event) === fullKey) {
|
901 | zone.runGuarded(() => handler(event));
|
902 | }
|
903 | };
|
904 | }
|
905 |
|
906 | static _normalizeKey(keyName) {
|
907 |
|
908 | switch (keyName) {
|
909 | case 'esc':
|
910 | return 'escape';
|
911 | default:
|
912 | return keyName;
|
913 | }
|
914 | }
|
915 | }
|
916 | KeyEventsPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: KeyEventsPlugin, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
917 | KeyEventsPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: KeyEventsPlugin });
|
918 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: KeyEventsPlugin, decorators: [{
|
919 | type: Injectable
|
920 | }], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
921 | type: Inject,
|
922 | args: [DOCUMENT]
|
923 | }] }]; } });
|
924 | function getEventKey(event) {
|
925 | let key = event.key;
|
926 | if (key == null) {
|
927 | key = event.keyIdentifier;
|
928 |
|
929 |
|
930 |
|
931 | if (key == null) {
|
932 | return 'Unidentified';
|
933 | }
|
934 | if (key.startsWith('U+')) {
|
935 | key = String.fromCharCode(parseInt(key.substring(2), 16));
|
936 | if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) {
|
937 |
|
938 |
|
939 |
|
940 | key = _chromeNumKeyPadMap[key];
|
941 | }
|
942 | }
|
943 | }
|
944 | return _keyMap[key] || key;
|
945 | }
|
946 |
|
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 |
|
954 | function initDomAdapter() {
|
955 | BrowserDomAdapter.makeCurrent();
|
956 | BrowserGetTestability.init();
|
957 | }
|
958 | function errorHandler() {
|
959 | return new ErrorHandler();
|
960 | }
|
961 | function _document() {
|
962 |
|
963 | ɵsetDocument(document);
|
964 | return document;
|
965 | }
|
966 | const INTERNAL_BROWSER_PLATFORM_PROVIDERS = [
|
967 | { provide: PLATFORM_ID, useValue: ɵPLATFORM_BROWSER_ID },
|
968 | { provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true },
|
969 | { provide: DOCUMENT, useFactory: _document, deps: [] },
|
970 | ];
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 | const platformBrowser = createPlatformFactory(platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
|
978 | const BROWSER_MODULE_PROVIDERS = [
|
979 | { provide: ɵINJECTOR_SCOPE, useValue: 'root' },
|
980 | { provide: ErrorHandler, useFactory: errorHandler, deps: [] },
|
981 | {
|
982 | provide: EVENT_MANAGER_PLUGINS,
|
983 | useClass: DomEventsPlugin,
|
984 | multi: true,
|
985 | deps: [DOCUMENT, NgZone, PLATFORM_ID]
|
986 | },
|
987 | { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true, deps: [DOCUMENT] },
|
988 | {
|
989 | provide: DomRendererFactory2,
|
990 | useClass: DomRendererFactory2,
|
991 | deps: [EventManager, DomSharedStylesHost, APP_ID]
|
992 | },
|
993 | { provide: RendererFactory2, useExisting: DomRendererFactory2 },
|
994 | { provide: SharedStylesHost, useExisting: DomSharedStylesHost },
|
995 | { provide: DomSharedStylesHost, useClass: DomSharedStylesHost, deps: [DOCUMENT] },
|
996 | { provide: Testability, useClass: Testability, deps: [NgZone] },
|
997 | { provide: EventManager, useClass: EventManager, deps: [EVENT_MANAGER_PLUGINS, NgZone] },
|
998 | { provide: XhrFactory, useClass: BrowserXhr, deps: [] },
|
999 | ];
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 | class BrowserModule {
|
1010 | constructor(parentModule) {
|
1011 | if (parentModule) {
|
1012 | throw new Error(`BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead.`);
|
1013 | }
|
1014 | }
|
1015 | |
1016 |
|
1017 |
|
1018 |
|
1019 |
|
1020 |
|
1021 |
|
1022 |
|
1023 | static withServerTransition(params) {
|
1024 | return {
|
1025 | ngModule: BrowserModule,
|
1026 | providers: [
|
1027 | { provide: APP_ID, useValue: params.appId },
|
1028 | { provide: TRANSITION_ID, useExisting: APP_ID },
|
1029 | SERVER_TRANSITION_PROVIDERS,
|
1030 | ],
|
1031 | };
|
1032 | }
|
1033 | }
|
1034 | BrowserModule.ɵ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 });
|
1035 | BrowserModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserModule, exports: [CommonModule, ApplicationModule] });
|
1036 | BrowserModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserModule, providers: BROWSER_MODULE_PROVIDERS, imports: [CommonModule, ApplicationModule] });
|
1037 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserModule, decorators: [{
|
1038 | type: NgModule,
|
1039 | args: [{ providers: BROWSER_MODULE_PROVIDERS, exports: [CommonModule, ApplicationModule] }]
|
1040 | }], ctorParameters: function () { return [{ type: BrowserModule, decorators: [{
|
1041 | type: Optional
|
1042 | }, {
|
1043 | type: SkipSelf
|
1044 | }, {
|
1045 | type: Inject,
|
1046 | args: [BrowserModule]
|
1047 | }] }]; } });
|
1048 |
|
1049 |
|
1050 |
|
1051 |
|
1052 |
|
1053 |
|
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 | function createMeta() {
|
1060 | return new Meta(ɵɵinject(DOCUMENT));
|
1061 | }
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 |
|
1069 |
|
1070 |
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 |
|
1084 | class Meta {
|
1085 | constructor(_doc) {
|
1086 | this._doc = _doc;
|
1087 | this._dom = ɵgetDOM();
|
1088 | }
|
1089 | |
1090 |
|
1091 |
|
1092 |
|
1093 |
|
1094 |
|
1095 |
|
1096 |
|
1097 |
|
1098 |
|
1099 | addTag(tag, forceCreation = false) {
|
1100 | if (!tag)
|
1101 | return null;
|
1102 | return this._getOrCreateElement(tag, forceCreation);
|
1103 | }
|
1104 | |
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 |
|
1111 |
|
1112 | addTags(tags, forceCreation = false) {
|
1113 | if (!tags)
|
1114 | return [];
|
1115 | return tags.reduce((result, tag) => {
|
1116 | if (tag) {
|
1117 | result.push(this._getOrCreateElement(tag, forceCreation));
|
1118 | }
|
1119 | return result;
|
1120 | }, []);
|
1121 | }
|
1122 | |
1123 |
|
1124 |
|
1125 |
|
1126 |
|
1127 |
|
1128 | getTag(attrSelector) {
|
1129 | if (!attrSelector)
|
1130 | return null;
|
1131 | return this._doc.querySelector(`meta[${attrSelector}]`) || null;
|
1132 | }
|
1133 | |
1134 |
|
1135 |
|
1136 |
|
1137 |
|
1138 |
|
1139 | getTags(attrSelector) {
|
1140 | if (!attrSelector)
|
1141 | return [];
|
1142 | const list = this._doc.querySelectorAll(`meta[${attrSelector}]`);
|
1143 | return list ? [].slice.call(list) : [];
|
1144 | }
|
1145 | |
1146 |
|
1147 |
|
1148 |
|
1149 |
|
1150 |
|
1151 |
|
1152 |
|
1153 |
|
1154 | updateTag(tag, selector) {
|
1155 | if (!tag)
|
1156 | return null;
|
1157 | selector = selector || this._parseSelector(tag);
|
1158 | const meta = this.getTag(selector);
|
1159 | if (meta) {
|
1160 | return this._setMetaElementAttributes(tag, meta);
|
1161 | }
|
1162 | return this._getOrCreateElement(tag, true);
|
1163 | }
|
1164 | |
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 | removeTag(attrSelector) {
|
1170 | this.removeTagElement(this.getTag(attrSelector));
|
1171 | }
|
1172 | |
1173 |
|
1174 |
|
1175 |
|
1176 | removeTagElement(meta) {
|
1177 | if (meta) {
|
1178 | this._dom.remove(meta);
|
1179 | }
|
1180 | }
|
1181 | _getOrCreateElement(meta, forceCreation = false) {
|
1182 | if (!forceCreation) {
|
1183 | const selector = this._parseSelector(meta);
|
1184 |
|
1185 |
|
1186 |
|
1187 | const elem = this.getTags(selector).filter(elem => this._containsAttributes(meta, elem))[0];
|
1188 | if (elem !== undefined)
|
1189 | return elem;
|
1190 | }
|
1191 | const element = this._dom.createElement('meta');
|
1192 | this._setMetaElementAttributes(meta, element);
|
1193 | const head = this._doc.getElementsByTagName('head')[0];
|
1194 | head.appendChild(element);
|
1195 | return element;
|
1196 | }
|
1197 | _setMetaElementAttributes(tag, el) {
|
1198 | Object.keys(tag).forEach((prop) => el.setAttribute(this._getMetaKeyMap(prop), tag[prop]));
|
1199 | return el;
|
1200 | }
|
1201 | _parseSelector(tag) {
|
1202 | const attr = tag.name ? 'name' : 'property';
|
1203 | return `${attr}="${tag[attr]}"`;
|
1204 | }
|
1205 | _containsAttributes(tag, elem) {
|
1206 | return Object.keys(tag).every((key) => elem.getAttribute(this._getMetaKeyMap(key)) === tag[key]);
|
1207 | }
|
1208 | _getMetaKeyMap(prop) {
|
1209 | return META_KEYS_MAP[prop] || prop;
|
1210 | }
|
1211 | }
|
1212 | Meta.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Meta, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
1213 | Meta.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Meta, providedIn: 'root', useFactory: createMeta, deps: [] });
|
1214 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Meta, decorators: [{
|
1215 | type: Injectable,
|
1216 | args: [{ providedIn: 'root', useFactory: createMeta, deps: [] }]
|
1217 | }], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
1218 | type: Inject,
|
1219 | args: [DOCUMENT]
|
1220 | }] }]; } });
|
1221 |
|
1222 |
|
1223 |
|
1224 | const META_KEYS_MAP = {
|
1225 | httpEquiv: 'http-equiv'
|
1226 | };
|
1227 |
|
1228 |
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 |
|
1237 |
|
1238 | function createTitle() {
|
1239 | return new Title(ɵɵinject(DOCUMENT));
|
1240 | }
|
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 | class Title {
|
1252 | constructor(_doc) {
|
1253 | this._doc = _doc;
|
1254 | }
|
1255 | |
1256 |
|
1257 |
|
1258 | getTitle() {
|
1259 | return this._doc.title;
|
1260 | }
|
1261 | |
1262 |
|
1263 |
|
1264 |
|
1265 | setTitle(newTitle) {
|
1266 | this._doc.title = newTitle || '';
|
1267 | }
|
1268 | }
|
1269 | Title.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Title, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
1270 | Title.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Title, providedIn: 'root', useFactory: createTitle, deps: [] });
|
1271 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: Title, decorators: [{
|
1272 | type: Injectable,
|
1273 | args: [{ providedIn: 'root', useFactory: createTitle, deps: [] }]
|
1274 | }], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
1275 | type: Inject,
|
1276 | args: [DOCUMENT]
|
1277 | }] }]; } });
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 | const CAMEL_CASE_REGEXP = /([A-Z])/g;
|
1287 | const DASH_CASE_REGEXP = /-([a-z])/g;
|
1288 | function camelCaseToDashCase(input) {
|
1289 | return input.replace(CAMEL_CASE_REGEXP, (...m) => '-' + m[1].toLowerCase());
|
1290 | }
|
1291 | function dashCaseToCamelCase(input) {
|
1292 | return input.replace(DASH_CASE_REGEXP, (...m) => m[1].toUpperCase());
|
1293 | }
|
1294 |
|
1295 |
|
1296 |
|
1297 |
|
1298 |
|
1299 |
|
1300 |
|
1301 | function exportNgVar(name, value) {
|
1302 | if (typeof COMPILED === 'undefined' || !COMPILED) {
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 | const ng = ɵglobal['ng'] = ɵglobal['ng'] || {};
|
1308 | ng[name] = value;
|
1309 | }
|
1310 | }
|
1311 |
|
1312 |
|
1313 |
|
1314 |
|
1315 |
|
1316 |
|
1317 |
|
1318 |
|
1319 | const win = typeof window !== 'undefined' && window || {};
|
1320 |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 | class ChangeDetectionPerfRecord {
|
1329 | constructor(msPerTick, numTicks) {
|
1330 | this.msPerTick = msPerTick;
|
1331 | this.numTicks = numTicks;
|
1332 | }
|
1333 | }
|
1334 |
|
1335 |
|
1336 |
|
1337 |
|
1338 | class AngularProfiler {
|
1339 | constructor(ref) {
|
1340 | this.appRef = ref.injector.get(ApplicationRef);
|
1341 | }
|
1342 |
|
1343 | |
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 |
|
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 |
|
1357 |
|
1358 |
|
1359 | timeChangeDetection(config) {
|
1360 | const record = config && config['record'];
|
1361 | const profileName = 'Change Detection';
|
1362 |
|
1363 | const isProfilerAvailable = win.console.profile != null;
|
1364 | if (record && isProfilerAvailable) {
|
1365 | win.console.profile(profileName);
|
1366 | }
|
1367 | const start = performanceNow();
|
1368 | let numTicks = 0;
|
1369 | while (numTicks < 5 || (performanceNow() - start) < 500) {
|
1370 | this.appRef.tick();
|
1371 | numTicks++;
|
1372 | }
|
1373 | const end = performanceNow();
|
1374 | if (record && isProfilerAvailable) {
|
1375 | win.console.profileEnd(profileName);
|
1376 | }
|
1377 | const msPerTick = (end - start) / numTicks;
|
1378 | win.console.log(`ran ${numTicks} change detection cycles`);
|
1379 | win.console.log(`${msPerTick.toFixed(2)} ms per check`);
|
1380 | return new ChangeDetectionPerfRecord(msPerTick, numTicks);
|
1381 | }
|
1382 | }
|
1383 | function performanceNow() {
|
1384 | return win.performance && win.performance.now ? win.performance.now() :
|
1385 | new Date().getTime();
|
1386 | }
|
1387 |
|
1388 |
|
1389 |
|
1390 |
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 | const PROFILER_GLOBAL_NAME = 'profiler';
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 |
|
1403 |
|
1404 |
|
1405 |
|
1406 |
|
1407 |
|
1408 |
|
1409 | function enableDebugTools(ref) {
|
1410 | exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
|
1411 | return ref;
|
1412 | }
|
1413 |
|
1414 |
|
1415 |
|
1416 |
|
1417 |
|
1418 | function disableDebugTools() {
|
1419 | exportNgVar(PROFILER_GLOBAL_NAME, null);
|
1420 | }
|
1421 |
|
1422 |
|
1423 |
|
1424 |
|
1425 |
|
1426 |
|
1427 |
|
1428 |
|
1429 | function escapeHtml(text) {
|
1430 | const escapedText = {
|
1431 | '&': '&a;',
|
1432 | '"': '&q;',
|
1433 | '\'': '&s;',
|
1434 | '<': '&l;',
|
1435 | '>': '&g;',
|
1436 | };
|
1437 | return text.replace(/[&"'<>]/g, s => escapedText[s]);
|
1438 | }
|
1439 | function unescapeHtml(text) {
|
1440 | const unescapedText = {
|
1441 | '&a;': '&',
|
1442 | '&q;': '"',
|
1443 | '&s;': '\'',
|
1444 | '&l;': '<',
|
1445 | '&g;': '>',
|
1446 | };
|
1447 | return text.replace(/&[^;]+;/g, s => unescapedText[s]);
|
1448 | }
|
1449 |
|
1450 |
|
1451 |
|
1452 |
|
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 |
|
1463 | function makeStateKey(key) {
|
1464 | return key;
|
1465 | }
|
1466 |
|
1467 |
|
1468 |
|
1469 |
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 | class TransferState {
|
1480 | constructor() {
|
1481 | this.store = {};
|
1482 | this.onSerializeCallbacks = {};
|
1483 | }
|
1484 |
|
1485 | static init(initState) {
|
1486 | const transferState = new TransferState();
|
1487 | transferState.store = initState;
|
1488 | return transferState;
|
1489 | }
|
1490 | |
1491 |
|
1492 |
|
1493 | get(key, defaultValue) {
|
1494 | return this.store[key] !== undefined ? this.store[key] : defaultValue;
|
1495 | }
|
1496 | |
1497 |
|
1498 |
|
1499 | set(key, value) {
|
1500 | this.store[key] = value;
|
1501 | }
|
1502 | |
1503 |
|
1504 |
|
1505 | remove(key) {
|
1506 | delete this.store[key];
|
1507 | }
|
1508 | |
1509 |
|
1510 |
|
1511 | hasKey(key) {
|
1512 | return this.store.hasOwnProperty(key);
|
1513 | }
|
1514 | |
1515 |
|
1516 |
|
1517 | onSerialize(key, callback) {
|
1518 | this.onSerializeCallbacks[key] = callback;
|
1519 | }
|
1520 | |
1521 |
|
1522 |
|
1523 | toJson() {
|
1524 |
|
1525 | for (const key in this.onSerializeCallbacks) {
|
1526 | if (this.onSerializeCallbacks.hasOwnProperty(key)) {
|
1527 | try {
|
1528 | this.store[key] = this.onSerializeCallbacks[key]();
|
1529 | }
|
1530 | catch (e) {
|
1531 | console.warn('Exception in onSerialize callback: ', e);
|
1532 | }
|
1533 | }
|
1534 | }
|
1535 | return JSON.stringify(this.store);
|
1536 | }
|
1537 | }
|
1538 | TransferState.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: TransferState, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1539 | TransferState.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: TransferState });
|
1540 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: TransferState, decorators: [{
|
1541 | type: Injectable
|
1542 | }] });
|
1543 | function initTransferState(doc, appId) {
|
1544 |
|
1545 |
|
1546 | const script = doc.getElementById(appId + '-state');
|
1547 | let initialState = {};
|
1548 | if (script && script.textContent) {
|
1549 | try {
|
1550 |
|
1551 | initialState = JSON.parse(unescapeHtml(script.textContent));
|
1552 | }
|
1553 | catch (e) {
|
1554 | console.warn('Exception while restoring TransferState for app ' + appId, e);
|
1555 | }
|
1556 | }
|
1557 | return TransferState.init(initialState);
|
1558 | }
|
1559 |
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 |
|
1565 | class BrowserTransferStateModule {
|
1566 | }
|
1567 | BrowserTransferStateModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserTransferStateModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1568 | BrowserTransferStateModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserTransferStateModule });
|
1569 | BrowserTransferStateModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserTransferStateModule, providers: [{ provide: TransferState, useFactory: initTransferState, deps: [DOCUMENT, APP_ID] }] });
|
1570 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: BrowserTransferStateModule, decorators: [{
|
1571 | type: NgModule,
|
1572 | args: [{
|
1573 | providers: [{ provide: TransferState, useFactory: initTransferState, deps: [DOCUMENT, APP_ID] }],
|
1574 | }]
|
1575 | }] });
|
1576 |
|
1577 |
|
1578 |
|
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 |
|
1584 |
|
1585 |
|
1586 |
|
1587 |
|
1588 |
|
1589 | class By {
|
1590 | |
1591 |
|
1592 |
|
1593 |
|
1594 |
|
1595 |
|
1596 |
|
1597 |
|
1598 | static all() {
|
1599 | return () => true;
|
1600 | }
|
1601 | |
1602 |
|
1603 |
|
1604 |
|
1605 |
|
1606 |
|
1607 |
|
1608 |
|
1609 | static css(selector) {
|
1610 | return (debugElement) => {
|
1611 | return debugElement.nativeElement != null ?
|
1612 | elementMatches(debugElement.nativeElement, selector) :
|
1613 | false;
|
1614 | };
|
1615 | }
|
1616 | |
1617 |
|
1618 |
|
1619 |
|
1620 |
|
1621 |
|
1622 |
|
1623 |
|
1624 | static directive(type) {
|
1625 | return (debugNode) => debugNode.providerTokens.indexOf(type) !== -1;
|
1626 | }
|
1627 | }
|
1628 | function elementMatches(n, selector) {
|
1629 | if (ɵgetDOM().isElementNode(n)) {
|
1630 | return n.matches && n.matches(selector) ||
|
1631 | n.msMatchesSelector && n.msMatchesSelector(selector) ||
|
1632 | n.webkitMatchesSelector && n.webkitMatchesSelector(selector);
|
1633 | }
|
1634 | return false;
|
1635 | }
|
1636 |
|
1637 |
|
1638 |
|
1639 |
|
1640 |
|
1641 |
|
1642 |
|
1643 |
|
1644 |
|
1645 |
|
1646 |
|
1647 | const EVENT_NAMES = {
|
1648 |
|
1649 | 'pan': true,
|
1650 | 'panstart': true,
|
1651 | 'panmove': true,
|
1652 | 'panend': true,
|
1653 | 'pancancel': true,
|
1654 | 'panleft': true,
|
1655 | 'panright': true,
|
1656 | 'panup': true,
|
1657 | 'pandown': true,
|
1658 |
|
1659 | 'pinch': true,
|
1660 | 'pinchstart': true,
|
1661 | 'pinchmove': true,
|
1662 | 'pinchend': true,
|
1663 | 'pinchcancel': true,
|
1664 | 'pinchin': true,
|
1665 | 'pinchout': true,
|
1666 |
|
1667 | 'press': true,
|
1668 | 'pressup': true,
|
1669 |
|
1670 | 'rotate': true,
|
1671 | 'rotatestart': true,
|
1672 | 'rotatemove': true,
|
1673 | 'rotateend': true,
|
1674 | 'rotatecancel': true,
|
1675 |
|
1676 | 'swipe': true,
|
1677 | 'swipeleft': true,
|
1678 | 'swiperight': true,
|
1679 | 'swipeup': true,
|
1680 | 'swipedown': true,
|
1681 |
|
1682 | 'tap': true,
|
1683 | 'doubletap': true
|
1684 | };
|
1685 |
|
1686 |
|
1687 |
|
1688 |
|
1689 |
|
1690 |
|
1691 |
|
1692 | const HAMMER_GESTURE_CONFIG = new InjectionToken('HammerGestureConfig');
|
1693 |
|
1694 |
|
1695 |
|
1696 |
|
1697 |
|
1698 | const HAMMER_LOADER = new InjectionToken('HammerLoader');
|
1699 |
|
1700 |
|
1701 |
|
1702 |
|
1703 |
|
1704 | class HammerGestureConfig {
|
1705 | constructor() {
|
1706 | |
1707 |
|
1708 |
|
1709 |
|
1710 |
|
1711 | this.events = [];
|
1712 | |
1713 |
|
1714 |
|
1715 |
|
1716 |
|
1717 |
|
1718 |
|
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 |
|
1727 |
|
1728 | this.overrides = {};
|
1729 | }
|
1730 | |
1731 |
|
1732 |
|
1733 |
|
1734 |
|
1735 |
|
1736 | buildHammer(element) {
|
1737 | const mc = new Hammer(element, this.options);
|
1738 | mc.get('pinch').set({ enable: true });
|
1739 | mc.get('rotate').set({ enable: true });
|
1740 | for (const eventName in this.overrides) {
|
1741 | mc.get(eventName).set(this.overrides[eventName]);
|
1742 | }
|
1743 | return mc;
|
1744 | }
|
1745 | }
|
1746 | HammerGestureConfig.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerGestureConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1747 | HammerGestureConfig.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerGestureConfig });
|
1748 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerGestureConfig, decorators: [{
|
1749 | type: Injectable
|
1750 | }] });
|
1751 |
|
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 | class HammerGesturesPlugin extends EventManagerPlugin {
|
1757 | constructor(doc, _config, console, loader) {
|
1758 | super(doc);
|
1759 | this._config = _config;
|
1760 | this.console = console;
|
1761 | this.loader = loader;
|
1762 | this._loaderPromise = null;
|
1763 | }
|
1764 | supports(eventName) {
|
1765 | if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
|
1766 | return false;
|
1767 | }
|
1768 | if (!window.Hammer && !this.loader) {
|
1769 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
1770 | this.console.warn(`The "${eventName}" event cannot be bound because Hammer.JS is not ` +
|
1771 | `loaded and no custom loader has been specified.`);
|
1772 | }
|
1773 | return false;
|
1774 | }
|
1775 | return true;
|
1776 | }
|
1777 | addEventListener(element, eventName, handler) {
|
1778 | const zone = this.manager.getZone();
|
1779 | eventName = eventName.toLowerCase();
|
1780 |
|
1781 |
|
1782 | if (!window.Hammer && this.loader) {
|
1783 | this._loaderPromise = this._loaderPromise || this.loader();
|
1784 |
|
1785 |
|
1786 |
|
1787 | let cancelRegistration = false;
|
1788 | let deregister = () => {
|
1789 | cancelRegistration = true;
|
1790 | };
|
1791 | this._loaderPromise
|
1792 | .then(() => {
|
1793 |
|
1794 | if (!window.Hammer) {
|
1795 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
1796 | this.console.warn(`The custom HAMMER_LOADER completed, but Hammer.JS is not present.`);
|
1797 | }
|
1798 | deregister = () => { };
|
1799 | return;
|
1800 | }
|
1801 | if (!cancelRegistration) {
|
1802 |
|
1803 |
|
1804 | deregister = this.addEventListener(element, eventName, handler);
|
1805 | }
|
1806 | })
|
1807 | .catch(() => {
|
1808 | if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
1809 | this.console.warn(`The "${eventName}" event cannot be bound because the custom ` +
|
1810 | `Hammer.JS loader failed.`);
|
1811 | }
|
1812 | deregister = () => { };
|
1813 | });
|
1814 |
|
1815 |
|
1816 |
|
1817 | return () => {
|
1818 | deregister();
|
1819 | };
|
1820 | }
|
1821 | return zone.runOutsideAngular(() => {
|
1822 |
|
1823 | const mc = this._config.buildHammer(element);
|
1824 | const callback = function (eventObj) {
|
1825 | zone.runGuarded(function () {
|
1826 | handler(eventObj);
|
1827 | });
|
1828 | };
|
1829 | mc.on(eventName, callback);
|
1830 | return () => {
|
1831 | mc.off(eventName, callback);
|
1832 |
|
1833 | if (typeof mc.destroy === 'function') {
|
1834 | mc.destroy();
|
1835 | }
|
1836 | };
|
1837 | });
|
1838 | }
|
1839 | isCustomEvent(eventName) {
|
1840 | return this._config.events.indexOf(eventName) > -1;
|
1841 | }
|
1842 | }
|
1843 | HammerGesturesPlugin.ɵ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 });
|
1844 | HammerGesturesPlugin.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerGesturesPlugin });
|
1845 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerGesturesPlugin, decorators: [{
|
1846 | type: Injectable
|
1847 | }], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
1848 | type: Inject,
|
1849 | args: [DOCUMENT]
|
1850 | }] }, { type: HammerGestureConfig, decorators: [{
|
1851 | type: Inject,
|
1852 | args: [HAMMER_GESTURE_CONFIG]
|
1853 | }] }, { type: i0.ɵConsole }, { type: undefined, decorators: [{
|
1854 | type: Optional
|
1855 | }, {
|
1856 | type: Inject,
|
1857 | args: [HAMMER_LOADER]
|
1858 | }] }]; } });
|
1859 |
|
1860 |
|
1861 |
|
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 |
|
1870 | class HammerModule {
|
1871 | }
|
1872 | HammerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1873 | HammerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerModule });
|
1874 | HammerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerModule, providers: [
|
1875 | {
|
1876 | provide: EVENT_MANAGER_PLUGINS,
|
1877 | useClass: HammerGesturesPlugin,
|
1878 | multi: true,
|
1879 | deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, ɵConsole, [new Optional(), HAMMER_LOADER]]
|
1880 | },
|
1881 | { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig, deps: [] },
|
1882 | ] });
|
1883 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: HammerModule, decorators: [{
|
1884 | type: NgModule,
|
1885 | args: [{
|
1886 | providers: [
|
1887 | {
|
1888 | provide: EVENT_MANAGER_PLUGINS,
|
1889 | useClass: HammerGesturesPlugin,
|
1890 | multi: true,
|
1891 | deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, ɵConsole, [new Optional(), HAMMER_LOADER]]
|
1892 | },
|
1893 | { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig, deps: [] },
|
1894 | ]
|
1895 | }]
|
1896 | }] });
|
1897 |
|
1898 |
|
1899 |
|
1900 |
|
1901 |
|
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 |
|
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 |
|
1919 |
|
1920 |
|
1921 |
|
1922 |
|
1923 |
|
1924 |
|
1925 |
|
1926 |
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 | class DomSanitizer {
|
1937 | }
|
1938 | DomSanitizer.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSanitizer, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1939 | DomSanitizer.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSanitizer, providedIn: 'root', useExisting: i0.forwardRef(function () { return DomSanitizerImpl; }) });
|
1940 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSanitizer, decorators: [{
|
1941 | type: Injectable,
|
1942 | args: [{ providedIn: 'root', useExisting: forwardRef(() => DomSanitizerImpl) }]
|
1943 | }] });
|
1944 | function domSanitizerImplFactory(injector) {
|
1945 | return new DomSanitizerImpl(injector.get(DOCUMENT));
|
1946 | }
|
1947 | class DomSanitizerImpl extends DomSanitizer {
|
1948 | constructor(_doc) {
|
1949 | super();
|
1950 | this._doc = _doc;
|
1951 | }
|
1952 | sanitize(ctx, value) {
|
1953 | if (value == null)
|
1954 | return null;
|
1955 | switch (ctx) {
|
1956 | case SecurityContext.NONE:
|
1957 | return value;
|
1958 | case SecurityContext.HTML:
|
1959 | if (ɵallowSanitizationBypassAndThrow(value, "HTML" )) {
|
1960 | return ɵunwrapSafeValue(value);
|
1961 | }
|
1962 | return ɵ_sanitizeHtml(this._doc, String(value)).toString();
|
1963 | case SecurityContext.STYLE:
|
1964 | if (ɵallowSanitizationBypassAndThrow(value, "Style" )) {
|
1965 | return ɵunwrapSafeValue(value);
|
1966 | }
|
1967 | return value;
|
1968 | case SecurityContext.SCRIPT:
|
1969 | if (ɵallowSanitizationBypassAndThrow(value, "Script" )) {
|
1970 | return ɵunwrapSafeValue(value);
|
1971 | }
|
1972 | throw new Error('unsafe value used in a script context');
|
1973 | case SecurityContext.URL:
|
1974 | const type = ɵgetSanitizationBypassType(value);
|
1975 | if (ɵallowSanitizationBypassAndThrow(value, "URL" )) {
|
1976 | return ɵunwrapSafeValue(value);
|
1977 | }
|
1978 | return ɵ_sanitizeUrl(String(value));
|
1979 | case SecurityContext.RESOURCE_URL:
|
1980 | if (ɵallowSanitizationBypassAndThrow(value, "ResourceURL" )) {
|
1981 | return ɵunwrapSafeValue(value);
|
1982 | }
|
1983 | throw new Error('unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
|
1984 | default:
|
1985 | throw new Error(`Unexpected SecurityContext ${ctx} (see https://g.co/ng/security#xss)`);
|
1986 | }
|
1987 | }
|
1988 | bypassSecurityTrustHtml(value) {
|
1989 | return ɵbypassSanitizationTrustHtml(value);
|
1990 | }
|
1991 | bypassSecurityTrustStyle(value) {
|
1992 | return ɵbypassSanitizationTrustStyle(value);
|
1993 | }
|
1994 | bypassSecurityTrustScript(value) {
|
1995 | return ɵbypassSanitizationTrustScript(value);
|
1996 | }
|
1997 | bypassSecurityTrustUrl(value) {
|
1998 | return ɵbypassSanitizationTrustUrl(value);
|
1999 | }
|
2000 | bypassSecurityTrustResourceUrl(value) {
|
2001 | return ɵbypassSanitizationTrustResourceUrl(value);
|
2002 | }
|
2003 | }
|
2004 | DomSanitizerImpl.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSanitizerImpl, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable });
|
2005 | DomSanitizerImpl.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSanitizerImpl, providedIn: 'root', useFactory: domSanitizerImplFactory, deps: [{ token: Injector }] });
|
2006 | i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.0.3", ngImport: i0, type: DomSanitizerImpl, decorators: [{
|
2007 | type: Injectable,
|
2008 | args: [{ providedIn: 'root', useFactory: domSanitizerImplFactory, deps: [Injector] }]
|
2009 | }], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
2010 | type: Inject,
|
2011 | args: [DOCUMENT]
|
2012 | }] }]; } });
|
2013 |
|
2014 |
|
2015 |
|
2016 |
|
2017 |
|
2018 |
|
2019 |
|
2020 |
|
2021 |
|
2022 |
|
2023 |
|
2024 |
|
2025 |
|
2026 |
|
2027 |
|
2028 |
|
2029 |
|
2030 |
|
2031 |
|
2032 | const VERSION = new Version('13.0.3');
|
2033 |
|
2034 |
|
2035 |
|
2036 |
|
2037 |
|
2038 |
|
2039 |
|
2040 |
|
2041 |
|
2042 |
|
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 |
|
2049 |
|
2050 |
|
2051 |
|
2052 |
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 |
|
2062 |
|
2063 | export { BrowserModule, BrowserTransferStateModule, By, DomSanitizer, EVENT_MANAGER_PLUGINS, EventManager, HAMMER_GESTURE_CONFIG, HAMMER_LOADER, HammerGestureConfig, HammerModule, Meta, Title, TransferState, VERSION, disableDebugTools, enableDebugTools, makeStateKey, platformBrowser, BrowserDomAdapter as ɵBrowserDomAdapter, BrowserGetTestability as ɵBrowserGetTestability, DomEventsPlugin as ɵDomEventsPlugin, DomRendererFactory2 as ɵDomRendererFactory2, DomSanitizerImpl as ɵDomSanitizerImpl, DomSharedStylesHost as ɵDomSharedStylesHost, HammerGesturesPlugin as ɵHammerGesturesPlugin, INTERNAL_BROWSER_PLATFORM_PROVIDERS as ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS, KeyEventsPlugin as ɵKeyEventsPlugin, NAMESPACE_URIS as ɵNAMESPACE_URIS, SharedStylesHost as ɵSharedStylesHost, TRANSITION_ID as ɵTRANSITION_ID, escapeHtml as ɵescapeHtml, flattenStyles as ɵflattenStyles, initDomAdapter as ɵinitDomAdapter, shimContentAttribute as ɵshimContentAttribute, shimHostAttribute as ɵshimHostAttribute };
|
2064 |
|