1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | import { __extends, __spread, __decorate, __param, __metadata, __assign } from 'tslib';
|
8 | import { ɵparseCookieValue, DOCUMENT, PlatformLocation, isPlatformServer, ɵPLATFORM_BROWSER_ID, CommonModule } from '@angular/common';
|
9 | import { ɵglobal, Injectable, Inject, InjectionToken, ApplicationInitStatus, APP_INITIALIZER, Injector, setTestabilityGetter, ApplicationRef, NgZone, getDebugNode, NgProbeToken, Optional, ViewEncapsulation, APP_ID, RendererStyleFlags2, PLATFORM_ID, ɵConsole, SecurityContext, ɵ_sanitizeHtml, ɵ_sanitizeStyle, ɵ_sanitizeUrl, PLATFORM_INITIALIZER, Sanitizer, createPlatformFactory, platformCore, ErrorHandler, ɵAPP_ROOT, RendererFactory2, Testability, NgModule, ApplicationModule, SkipSelf, ɵɵinject, ɵɵdefineInjectable, Version } from '@angular/core';
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | var _DOM = null;
|
19 | function getDOM() {
|
20 | return _DOM;
|
21 | }
|
22 | function setDOM(adapter) {
|
23 | _DOM = adapter;
|
24 | }
|
25 | function setRootDomAdapter(adapter) {
|
26 | if (!_DOM) {
|
27 | _DOM = adapter;
|
28 | }
|
29 | }
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | var DomAdapter = (function () {
|
38 | function DomAdapter() {
|
39 | this.resourceLoaderType = null;
|
40 | }
|
41 | Object.defineProperty(DomAdapter.prototype, "attrToPropMap", {
|
42 | |
43 |
|
44 |
|
45 |
|
46 | get: function () { return this._attrToPropMap; },
|
47 | set: function (value) { this._attrToPropMap = value; },
|
48 | enumerable: true,
|
49 | configurable: true
|
50 | });
|
51 | return DomAdapter;
|
52 | }());
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 |
|
67 | var GenericBrowserDomAdapter = (function (_super) {
|
68 | __extends(GenericBrowserDomAdapter, _super);
|
69 | function GenericBrowserDomAdapter() {
|
70 | var _this = _super.call(this) || this;
|
71 | _this._animationPrefix = null;
|
72 | _this._transitionEnd = null;
|
73 | try {
|
74 | var element_1 = _this.createElement('div', document);
|
75 | if (_this.getStyle(element_1, 'animationName') != null) {
|
76 | _this._animationPrefix = '';
|
77 | }
|
78 | else {
|
79 | var domPrefixes = ['Webkit', 'Moz', 'O', 'ms'];
|
80 | for (var i = 0; i < domPrefixes.length; i++) {
|
81 | if (_this.getStyle(element_1, domPrefixes[i] + 'AnimationName') != null) {
|
82 | _this._animationPrefix = '-' + domPrefixes[i].toLowerCase() + '-';
|
83 | break;
|
84 | }
|
85 | }
|
86 | }
|
87 | var transEndEventNames_1 = {
|
88 | WebkitTransition: 'webkitTransitionEnd',
|
89 | MozTransition: 'transitionend',
|
90 | OTransition: 'oTransitionEnd otransitionend',
|
91 | transition: 'transitionend'
|
92 | };
|
93 | Object.keys(transEndEventNames_1).forEach(function (key) {
|
94 | if (_this.getStyle(element_1, key) != null) {
|
95 | _this._transitionEnd = transEndEventNames_1[key];
|
96 | }
|
97 | });
|
98 | }
|
99 | catch (_a) {
|
100 | _this._animationPrefix = null;
|
101 | _this._transitionEnd = null;
|
102 | }
|
103 | return _this;
|
104 | }
|
105 | GenericBrowserDomAdapter.prototype.getDistributedNodes = function (el) { return el.getDistributedNodes(); };
|
106 | GenericBrowserDomAdapter.prototype.resolveAndSetHref = function (el, baseUrl, href) {
|
107 | el.href = href == null ? baseUrl : baseUrl + '/../' + href;
|
108 | };
|
109 | GenericBrowserDomAdapter.prototype.supportsDOMEvents = function () { return true; };
|
110 | GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = function () {
|
111 | return typeof document.body.createShadowRoot === 'function';
|
112 | };
|
113 | GenericBrowserDomAdapter.prototype.getAnimationPrefix = function () { return this._animationPrefix ? this._animationPrefix : ''; };
|
114 | GenericBrowserDomAdapter.prototype.getTransitionEnd = function () { return this._transitionEnd ? this._transitionEnd : ''; };
|
115 | GenericBrowserDomAdapter.prototype.supportsAnimation = function () {
|
116 | return this._animationPrefix != null && this._transitionEnd != null;
|
117 | };
|
118 | return GenericBrowserDomAdapter;
|
119 | }(DomAdapter));
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 | var _attrToPropMap = {
|
129 | 'class': 'className',
|
130 | 'innerHtml': 'innerHTML',
|
131 | 'readonly': 'readOnly',
|
132 | 'tabindex': 'tabIndex',
|
133 | };
|
134 | var DOM_KEY_LOCATION_NUMPAD = 3;
|
135 |
|
136 | var _keyMap = {
|
137 |
|
138 |
|
139 | '\b': 'Backspace',
|
140 | '\t': 'Tab',
|
141 | '\x7F': 'Delete',
|
142 | '\x1B': 'Escape',
|
143 | 'Del': 'Delete',
|
144 | 'Esc': 'Escape',
|
145 | 'Left': 'ArrowLeft',
|
146 | 'Right': 'ArrowRight',
|
147 | 'Up': 'ArrowUp',
|
148 | 'Down': 'ArrowDown',
|
149 | 'Menu': 'ContextMenu',
|
150 | 'Scroll': 'ScrollLock',
|
151 | 'Win': 'OS'
|
152 | };
|
153 |
|
154 |
|
155 |
|
156 | var _chromeNumKeyPadMap = {
|
157 | 'A': '1',
|
158 | 'B': '2',
|
159 | 'C': '3',
|
160 | 'D': '4',
|
161 | 'E': '5',
|
162 | 'F': '6',
|
163 | 'G': '7',
|
164 | 'H': '8',
|
165 | 'I': '9',
|
166 | 'J': '*',
|
167 | 'K': '+',
|
168 | 'M': '-',
|
169 | 'N': '.',
|
170 | 'O': '/',
|
171 | '\x60': '0',
|
172 | '\x90': 'NumLock'
|
173 | };
|
174 | var ɵ0 = function () {
|
175 | if (ɵglobal['Node']) {
|
176 | return ɵglobal['Node'].prototype.contains || function (node) {
|
177 | return !!(this.compareDocumentPosition(node) & 16);
|
178 | };
|
179 | }
|
180 | return undefined;
|
181 | };
|
182 | var nodeContains = (ɵ0)();
|
183 |
|
184 |
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 | var BrowserDomAdapter = (function (_super) {
|
191 | __extends(BrowserDomAdapter, _super);
|
192 | function BrowserDomAdapter() {
|
193 | return _super !== null && _super.apply(this, arguments) || this;
|
194 | }
|
195 | BrowserDomAdapter.prototype.parse = function (templateHtml) { throw new Error('parse not implemented'); };
|
196 | BrowserDomAdapter.makeCurrent = function () { setRootDomAdapter(new BrowserDomAdapter()); };
|
197 | BrowserDomAdapter.prototype.hasProperty = function (element, name) { return name in element; };
|
198 | BrowserDomAdapter.prototype.setProperty = function (el, name, value) { el[name] = value; };
|
199 | BrowserDomAdapter.prototype.getProperty = function (el, name) { return el[name]; };
|
200 | BrowserDomAdapter.prototype.invoke = function (el, methodName, args) {
|
201 | var _a;
|
202 | (_a = el)[methodName].apply(_a, __spread(args));
|
203 | };
|
204 |
|
205 | BrowserDomAdapter.prototype.logError = function (error) {
|
206 | if (window.console) {
|
207 | if (console.error) {
|
208 | console.error(error);
|
209 | }
|
210 | else {
|
211 | console.log(error);
|
212 | }
|
213 | }
|
214 | };
|
215 | BrowserDomAdapter.prototype.log = function (error) {
|
216 | if (window.console) {
|
217 | window.console.log && window.console.log(error);
|
218 | }
|
219 | };
|
220 | BrowserDomAdapter.prototype.logGroup = function (error) {
|
221 | if (window.console) {
|
222 | window.console.group && window.console.group(error);
|
223 | }
|
224 | };
|
225 | BrowserDomAdapter.prototype.logGroupEnd = function () {
|
226 | if (window.console) {
|
227 | window.console.groupEnd && window.console.groupEnd();
|
228 | }
|
229 | };
|
230 | Object.defineProperty(BrowserDomAdapter.prototype, "attrToPropMap", {
|
231 | get: function () { return _attrToPropMap; },
|
232 | enumerable: true,
|
233 | configurable: true
|
234 | });
|
235 | BrowserDomAdapter.prototype.contains = function (nodeA, nodeB) { return nodeContains.call(nodeA, nodeB); };
|
236 | BrowserDomAdapter.prototype.querySelector = function (el, selector) { return el.querySelector(selector); };
|
237 | BrowserDomAdapter.prototype.querySelectorAll = function (el, selector) { return el.querySelectorAll(selector); };
|
238 | BrowserDomAdapter.prototype.on = function (el, evt, listener) { el.addEventListener(evt, listener, false); };
|
239 | BrowserDomAdapter.prototype.onAndCancel = function (el, evt, listener) {
|
240 | el.addEventListener(evt, listener, false);
|
241 |
|
242 |
|
243 | return function () { el.removeEventListener(evt, listener, false); };
|
244 | };
|
245 | BrowserDomAdapter.prototype.dispatchEvent = function (el, evt) { el.dispatchEvent(evt); };
|
246 | BrowserDomAdapter.prototype.createMouseEvent = function (eventType) {
|
247 | var evt = this.getDefaultDocument().createEvent('MouseEvent');
|
248 | evt.initEvent(eventType, true, true);
|
249 | return evt;
|
250 | };
|
251 | BrowserDomAdapter.prototype.createEvent = function (eventType) {
|
252 | var evt = this.getDefaultDocument().createEvent('Event');
|
253 | evt.initEvent(eventType, true, true);
|
254 | return evt;
|
255 | };
|
256 | BrowserDomAdapter.prototype.preventDefault = function (evt) {
|
257 | evt.preventDefault();
|
258 | evt.returnValue = false;
|
259 | };
|
260 | BrowserDomAdapter.prototype.isPrevented = function (evt) {
|
261 | return evt.defaultPrevented || evt.returnValue != null && !evt.returnValue;
|
262 | };
|
263 | BrowserDomAdapter.prototype.getInnerHTML = function (el) { return el.innerHTML; };
|
264 | BrowserDomAdapter.prototype.getTemplateContent = function (el) {
|
265 | return 'content' in el && this.isTemplateElement(el) ? el.content : null;
|
266 | };
|
267 | BrowserDomAdapter.prototype.getOuterHTML = function (el) { return el.outerHTML; };
|
268 | BrowserDomAdapter.prototype.nodeName = function (node) { return node.nodeName; };
|
269 | BrowserDomAdapter.prototype.nodeValue = function (node) { return node.nodeValue; };
|
270 | BrowserDomAdapter.prototype.type = function (node) { return node.type; };
|
271 | BrowserDomAdapter.prototype.content = function (node) {
|
272 | if (this.hasProperty(node, 'content')) {
|
273 | return node.content;
|
274 | }
|
275 | else {
|
276 | return node;
|
277 | }
|
278 | };
|
279 | BrowserDomAdapter.prototype.firstChild = function (el) { return el.firstChild; };
|
280 | BrowserDomAdapter.prototype.nextSibling = function (el) { return el.nextSibling; };
|
281 | BrowserDomAdapter.prototype.parentElement = function (el) { return el.parentNode; };
|
282 | BrowserDomAdapter.prototype.childNodes = function (el) { return el.childNodes; };
|
283 | BrowserDomAdapter.prototype.childNodesAsList = function (el) {
|
284 | var childNodes = el.childNodes;
|
285 | var res = new Array(childNodes.length);
|
286 | for (var i = 0; i < childNodes.length; i++) {
|
287 | res[i] = childNodes[i];
|
288 | }
|
289 | return res;
|
290 | };
|
291 | BrowserDomAdapter.prototype.clearNodes = function (el) {
|
292 | while (el.firstChild) {
|
293 | el.removeChild(el.firstChild);
|
294 | }
|
295 | };
|
296 | BrowserDomAdapter.prototype.appendChild = function (el, node) { el.appendChild(node); };
|
297 | BrowserDomAdapter.prototype.removeChild = function (el, node) { el.removeChild(node); };
|
298 | BrowserDomAdapter.prototype.replaceChild = function (el, newChild, oldChild) { el.replaceChild(newChild, oldChild); };
|
299 | BrowserDomAdapter.prototype.remove = function (node) {
|
300 | if (node.parentNode) {
|
301 | node.parentNode.removeChild(node);
|
302 | }
|
303 | return node;
|
304 | };
|
305 | BrowserDomAdapter.prototype.insertBefore = function (parent, ref, node) { parent.insertBefore(node, ref); };
|
306 | BrowserDomAdapter.prototype.insertAllBefore = function (parent, ref, nodes) {
|
307 | nodes.forEach(function (n) { return parent.insertBefore(n, ref); });
|
308 | };
|
309 | BrowserDomAdapter.prototype.insertAfter = function (parent, ref, node) { parent.insertBefore(node, ref.nextSibling); };
|
310 | BrowserDomAdapter.prototype.setInnerHTML = function (el, value) { el.innerHTML = value; };
|
311 | BrowserDomAdapter.prototype.getText = function (el) { return el.textContent; };
|
312 | BrowserDomAdapter.prototype.setText = function (el, value) { el.textContent = value; };
|
313 | BrowserDomAdapter.prototype.getValue = function (el) { return el.value; };
|
314 | BrowserDomAdapter.prototype.setValue = function (el, value) { el.value = value; };
|
315 | BrowserDomAdapter.prototype.getChecked = function (el) { return el.checked; };
|
316 | BrowserDomAdapter.prototype.setChecked = function (el, value) { el.checked = value; };
|
317 | BrowserDomAdapter.prototype.createComment = function (text) { return this.getDefaultDocument().createComment(text); };
|
318 | BrowserDomAdapter.prototype.createTemplate = function (html) {
|
319 | var t = this.getDefaultDocument().createElement('template');
|
320 | t.innerHTML = html;
|
321 | return t;
|
322 | };
|
323 | BrowserDomAdapter.prototype.createElement = function (tagName, doc) {
|
324 | doc = doc || this.getDefaultDocument();
|
325 | return doc.createElement(tagName);
|
326 | };
|
327 | BrowserDomAdapter.prototype.createElementNS = function (ns, tagName, doc) {
|
328 | doc = doc || this.getDefaultDocument();
|
329 | return doc.createElementNS(ns, tagName);
|
330 | };
|
331 | BrowserDomAdapter.prototype.createTextNode = function (text, doc) {
|
332 | doc = doc || this.getDefaultDocument();
|
333 | return doc.createTextNode(text);
|
334 | };
|
335 | BrowserDomAdapter.prototype.createScriptTag = function (attrName, attrValue, doc) {
|
336 | doc = doc || this.getDefaultDocument();
|
337 | var el = doc.createElement('SCRIPT');
|
338 | el.setAttribute(attrName, attrValue);
|
339 | return el;
|
340 | };
|
341 | BrowserDomAdapter.prototype.createStyleElement = function (css, doc) {
|
342 | doc = doc || this.getDefaultDocument();
|
343 | var style = doc.createElement('style');
|
344 | this.appendChild(style, this.createTextNode(css, doc));
|
345 | return style;
|
346 | };
|
347 | BrowserDomAdapter.prototype.createShadowRoot = function (el) { return el.createShadowRoot(); };
|
348 | BrowserDomAdapter.prototype.getShadowRoot = function (el) { return el.shadowRoot; };
|
349 | BrowserDomAdapter.prototype.getHost = function (el) { return el.host; };
|
350 | BrowserDomAdapter.prototype.clone = function (node) { return node.cloneNode(true); };
|
351 | BrowserDomAdapter.prototype.getElementsByClassName = function (element, name) {
|
352 | return element.getElementsByClassName(name);
|
353 | };
|
354 | BrowserDomAdapter.prototype.getElementsByTagName = function (element, name) {
|
355 | return element.getElementsByTagName(name);
|
356 | };
|
357 | BrowserDomAdapter.prototype.classList = function (element) { return Array.prototype.slice.call(element.classList, 0); };
|
358 | BrowserDomAdapter.prototype.addClass = function (element, className) { element.classList.add(className); };
|
359 | BrowserDomAdapter.prototype.removeClass = function (element, className) { element.classList.remove(className); };
|
360 | BrowserDomAdapter.prototype.hasClass = function (element, className) {
|
361 | return element.classList.contains(className);
|
362 | };
|
363 | BrowserDomAdapter.prototype.setStyle = function (element, styleName, styleValue) {
|
364 | element.style[styleName] = styleValue;
|
365 | };
|
366 | BrowserDomAdapter.prototype.removeStyle = function (element, stylename) {
|
367 |
|
368 |
|
369 | element.style[stylename] = '';
|
370 | };
|
371 | BrowserDomAdapter.prototype.getStyle = function (element, stylename) { return element.style[stylename]; };
|
372 | BrowserDomAdapter.prototype.hasStyle = function (element, styleName, styleValue) {
|
373 | var value = this.getStyle(element, styleName) || '';
|
374 | return styleValue ? value == styleValue : value.length > 0;
|
375 | };
|
376 | BrowserDomAdapter.prototype.tagName = function (element) { return element.tagName; };
|
377 | BrowserDomAdapter.prototype.attributeMap = function (element) {
|
378 | var res = new Map();
|
379 | var elAttrs = element.attributes;
|
380 | for (var i = 0; i < elAttrs.length; i++) {
|
381 | var attrib = elAttrs.item(i);
|
382 | res.set(attrib.name, attrib.value);
|
383 | }
|
384 | return res;
|
385 | };
|
386 | BrowserDomAdapter.prototype.hasAttribute = function (element, attribute) {
|
387 | return element.hasAttribute(attribute);
|
388 | };
|
389 | BrowserDomAdapter.prototype.hasAttributeNS = function (element, ns, attribute) {
|
390 | return element.hasAttributeNS(ns, attribute);
|
391 | };
|
392 | BrowserDomAdapter.prototype.getAttribute = function (element, attribute) {
|
393 | return element.getAttribute(attribute);
|
394 | };
|
395 | BrowserDomAdapter.prototype.getAttributeNS = function (element, ns, name) {
|
396 | return element.getAttributeNS(ns, name);
|
397 | };
|
398 | BrowserDomAdapter.prototype.setAttribute = function (element, name, value) { element.setAttribute(name, value); };
|
399 | BrowserDomAdapter.prototype.setAttributeNS = function (element, ns, name, value) {
|
400 | element.setAttributeNS(ns, name, value);
|
401 | };
|
402 | BrowserDomAdapter.prototype.removeAttribute = function (element, attribute) { element.removeAttribute(attribute); };
|
403 | BrowserDomAdapter.prototype.removeAttributeNS = function (element, ns, name) {
|
404 | element.removeAttributeNS(ns, name);
|
405 | };
|
406 | BrowserDomAdapter.prototype.templateAwareRoot = function (el) { return this.isTemplateElement(el) ? this.content(el) : el; };
|
407 | BrowserDomAdapter.prototype.createHtmlDocument = function () {
|
408 | return document.implementation.createHTMLDocument('fakeTitle');
|
409 | };
|
410 | BrowserDomAdapter.prototype.getDefaultDocument = function () { return document; };
|
411 | BrowserDomAdapter.prototype.getBoundingClientRect = function (el) {
|
412 | try {
|
413 | return el.getBoundingClientRect();
|
414 | }
|
415 | catch (_a) {
|
416 | return { top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0 };
|
417 | }
|
418 | };
|
419 | BrowserDomAdapter.prototype.getTitle = function (doc) { return doc.title; };
|
420 | BrowserDomAdapter.prototype.setTitle = function (doc, newTitle) { doc.title = newTitle || ''; };
|
421 | BrowserDomAdapter.prototype.elementMatches = function (n, selector) {
|
422 | if (this.isElementNode(n)) {
|
423 | return n.matches && n.matches(selector) ||
|
424 | n.msMatchesSelector && n.msMatchesSelector(selector) ||
|
425 | n.webkitMatchesSelector && n.webkitMatchesSelector(selector);
|
426 | }
|
427 | return false;
|
428 | };
|
429 | BrowserDomAdapter.prototype.isTemplateElement = function (el) {
|
430 | return this.isElementNode(el) && el.nodeName === 'TEMPLATE';
|
431 | };
|
432 | BrowserDomAdapter.prototype.isTextNode = function (node) { return node.nodeType === Node.TEXT_NODE; };
|
433 | BrowserDomAdapter.prototype.isCommentNode = function (node) { return node.nodeType === Node.COMMENT_NODE; };
|
434 | BrowserDomAdapter.prototype.isElementNode = function (node) { return node.nodeType === Node.ELEMENT_NODE; };
|
435 | BrowserDomAdapter.prototype.hasShadowRoot = function (node) {
|
436 | return node.shadowRoot != null && node instanceof HTMLElement;
|
437 | };
|
438 | BrowserDomAdapter.prototype.isShadowRoot = function (node) { return node instanceof DocumentFragment; };
|
439 | BrowserDomAdapter.prototype.importIntoDoc = function (node) { return document.importNode(this.templateAwareRoot(node), true); };
|
440 | BrowserDomAdapter.prototype.adoptNode = function (node) { return document.adoptNode(node); };
|
441 | BrowserDomAdapter.prototype.getHref = function (el) { return el.getAttribute('href'); };
|
442 | BrowserDomAdapter.prototype.getEventKey = function (event) {
|
443 | var key = event.key;
|
444 | if (key == null) {
|
445 | key = event.keyIdentifier;
|
446 |
|
447 |
|
448 |
|
449 | if (key == null) {
|
450 | return 'Unidentified';
|
451 | }
|
452 | if (key.startsWith('U+')) {
|
453 | key = String.fromCharCode(parseInt(key.substring(2), 16));
|
454 | if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) {
|
455 |
|
456 |
|
457 |
|
458 | key = _chromeNumKeyPadMap[key];
|
459 | }
|
460 | }
|
461 | }
|
462 | return _keyMap[key] || key;
|
463 | };
|
464 | BrowserDomAdapter.prototype.getGlobalEventTarget = function (doc, target) {
|
465 | if (target === 'window') {
|
466 | return window;
|
467 | }
|
468 | if (target === 'document') {
|
469 | return doc;
|
470 | }
|
471 | if (target === 'body') {
|
472 | return doc.body;
|
473 | }
|
474 | return null;
|
475 | };
|
476 | BrowserDomAdapter.prototype.getHistory = function () { return window.history; };
|
477 | BrowserDomAdapter.prototype.getLocation = function () { return window.location; };
|
478 | BrowserDomAdapter.prototype.getBaseHref = function (doc) {
|
479 | var href = getBaseElementHref();
|
480 | return href == null ? null : relativePath(href);
|
481 | };
|
482 | BrowserDomAdapter.prototype.resetBaseElement = function () { baseElement = null; };
|
483 | BrowserDomAdapter.prototype.getUserAgent = function () { return window.navigator.userAgent; };
|
484 | BrowserDomAdapter.prototype.setData = function (element, name, value) {
|
485 | this.setAttribute(element, 'data-' + name, value);
|
486 | };
|
487 | BrowserDomAdapter.prototype.getData = function (element, name) {
|
488 | return this.getAttribute(element, 'data-' + name);
|
489 | };
|
490 | BrowserDomAdapter.prototype.getComputedStyle = function (element) { return getComputedStyle(element); };
|
491 |
|
492 | BrowserDomAdapter.prototype.supportsWebAnimation = function () {
|
493 | return typeof Element.prototype['animate'] === 'function';
|
494 | };
|
495 | BrowserDomAdapter.prototype.performanceNow = function () {
|
496 |
|
497 |
|
498 | return window.performance && window.performance.now ? window.performance.now() :
|
499 | new Date().getTime();
|
500 | };
|
501 | BrowserDomAdapter.prototype.supportsCookies = function () { return true; };
|
502 | BrowserDomAdapter.prototype.getCookie = function (name) { return ɵparseCookieValue(document.cookie, name); };
|
503 | BrowserDomAdapter.prototype.setCookie = function (name, value) {
|
504 |
|
505 |
|
506 | document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value);
|
507 | };
|
508 | return BrowserDomAdapter;
|
509 | }(GenericBrowserDomAdapter));
|
510 | var baseElement = null;
|
511 | function getBaseElementHref() {
|
512 | if (!baseElement) {
|
513 | baseElement = document.querySelector('base');
|
514 | if (!baseElement) {
|
515 | return null;
|
516 | }
|
517 | }
|
518 | return baseElement.getAttribute('href');
|
519 | }
|
520 |
|
521 | var urlParsingNode;
|
522 | function relativePath(url) {
|
523 | if (!urlParsingNode) {
|
524 | urlParsingNode = document.createElement('a');
|
525 | }
|
526 | urlParsingNode.setAttribute('href', url);
|
527 | return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname :
|
528 | '/' + urlParsingNode.pathname;
|
529 | }
|
530 |
|
531 |
|
532 |
|
533 |
|
534 |
|
535 |
|
536 |
|
537 |
|
538 | function supportsState() {
|
539 | return !!window.history.pushState;
|
540 | }
|
541 |
|
542 |
|
543 |
|
544 |
|
545 |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 | var BrowserPlatformLocation = (function (_super) {
|
555 | __extends(BrowserPlatformLocation, _super);
|
556 | function BrowserPlatformLocation(_doc) {
|
557 | var _this = _super.call(this) || this;
|
558 | _this._doc = _doc;
|
559 | _this._init();
|
560 | return _this;
|
561 | }
|
562 |
|
563 |
|
564 | BrowserPlatformLocation.prototype._init = function () {
|
565 | this.location = getDOM().getLocation();
|
566 | this._history = getDOM().getHistory();
|
567 | };
|
568 | BrowserPlatformLocation.prototype.getBaseHrefFromDOM = function () { return getDOM().getBaseHref(this._doc); };
|
569 | BrowserPlatformLocation.prototype.onPopState = function (fn) {
|
570 | getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('popstate', fn, false);
|
571 | };
|
572 | BrowserPlatformLocation.prototype.onHashChange = function (fn) {
|
573 | getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('hashchange', fn, false);
|
574 | };
|
575 | Object.defineProperty(BrowserPlatformLocation.prototype, "href", {
|
576 | get: function () { return this.location.href; },
|
577 | enumerable: true,
|
578 | configurable: true
|
579 | });
|
580 | Object.defineProperty(BrowserPlatformLocation.prototype, "protocol", {
|
581 | get: function () { return this.location.protocol; },
|
582 | enumerable: true,
|
583 | configurable: true
|
584 | });
|
585 | Object.defineProperty(BrowserPlatformLocation.prototype, "hostname", {
|
586 | get: function () { return this.location.hostname; },
|
587 | enumerable: true,
|
588 | configurable: true
|
589 | });
|
590 | Object.defineProperty(BrowserPlatformLocation.prototype, "port", {
|
591 | get: function () { return this.location.port; },
|
592 | enumerable: true,
|
593 | configurable: true
|
594 | });
|
595 | Object.defineProperty(BrowserPlatformLocation.prototype, "pathname", {
|
596 | get: function () { return this.location.pathname; },
|
597 | set: function (newPath) { this.location.pathname = newPath; },
|
598 | enumerable: true,
|
599 | configurable: true
|
600 | });
|
601 | Object.defineProperty(BrowserPlatformLocation.prototype, "search", {
|
602 | get: function () { return this.location.search; },
|
603 | enumerable: true,
|
604 | configurable: true
|
605 | });
|
606 | Object.defineProperty(BrowserPlatformLocation.prototype, "hash", {
|
607 | get: function () { return this.location.hash; },
|
608 | enumerable: true,
|
609 | configurable: true
|
610 | });
|
611 | BrowserPlatformLocation.prototype.pushState = function (state, title, url) {
|
612 | if (supportsState()) {
|
613 | this._history.pushState(state, title, url);
|
614 | }
|
615 | else {
|
616 | this.location.hash = url;
|
617 | }
|
618 | };
|
619 | BrowserPlatformLocation.prototype.replaceState = function (state, title, url) {
|
620 | if (supportsState()) {
|
621 | this._history.replaceState(state, title, url);
|
622 | }
|
623 | else {
|
624 | this.location.hash = url;
|
625 | }
|
626 | };
|
627 | BrowserPlatformLocation.prototype.forward = function () { this._history.forward(); };
|
628 | BrowserPlatformLocation.prototype.back = function () { this._history.back(); };
|
629 | BrowserPlatformLocation.prototype.getState = function () { return this._history.state; };
|
630 | BrowserPlatformLocation = __decorate([
|
631 | Injectable(),
|
632 | __param(0, Inject(DOCUMENT)),
|
633 | __metadata("design:paramtypes", [Object])
|
634 | ], BrowserPlatformLocation);
|
635 | return BrowserPlatformLocation;
|
636 | }(PlatformLocation));
|
637 |
|
638 |
|
639 |
|
640 |
|
641 |
|
642 |
|
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 |
|
649 | var TRANSITION_ID = new InjectionToken('TRANSITION_ID');
|
650 | function appInitializerFactory(transitionId, document, injector) {
|
651 | return function () {
|
652 |
|
653 |
|
654 | injector.get(ApplicationInitStatus).donePromise.then(function () {
|
655 | var dom = getDOM();
|
656 | var styles = Array.prototype.slice.apply(dom.querySelectorAll(document, "style[ng-transition]"));
|
657 | styles.filter(function (el) { return dom.getAttribute(el, 'ng-transition') === transitionId; })
|
658 | .forEach(function (el) { return dom.remove(el); });
|
659 | });
|
660 | };
|
661 | }
|
662 | var SERVER_TRANSITION_PROVIDERS = [
|
663 | {
|
664 | provide: APP_INITIALIZER,
|
665 | useFactory: appInitializerFactory,
|
666 | deps: [TRANSITION_ID, DOCUMENT, Injector],
|
667 | multi: true
|
668 | },
|
669 | ];
|
670 |
|
671 |
|
672 |
|
673 |
|
674 |
|
675 |
|
676 |
|
677 |
|
678 | var BrowserGetTestability = (function () {
|
679 | function BrowserGetTestability() {
|
680 | }
|
681 | BrowserGetTestability.init = function () { setTestabilityGetter(new BrowserGetTestability()); };
|
682 | BrowserGetTestability.prototype.addToWindow = function (registry) {
|
683 | ɵglobal['getAngularTestability'] = function (elem, findInAncestors) {
|
684 | if (findInAncestors === void 0) { findInAncestors = true; }
|
685 | var testability = registry.findTestabilityInTree(elem, findInAncestors);
|
686 | if (testability == null) {
|
687 | throw new Error('Could not find testability for element.');
|
688 | }
|
689 | return testability;
|
690 | };
|
691 | ɵglobal['getAllAngularTestabilities'] = function () { return registry.getAllTestabilities(); };
|
692 | ɵglobal['getAllAngularRootElements'] = function () { return registry.getAllRootElements(); };
|
693 | var whenAllStable = function (callback /** TODO #9100 */) {
|
694 | var testabilities = ɵglobal['getAllAngularTestabilities']();
|
695 | var count = testabilities.length;
|
696 | var didWork = false;
|
697 | var decrement = function (didWork_ /** TODO #9100 */) {
|
698 | didWork = didWork || didWork_;
|
699 | count--;
|
700 | if (count == 0) {
|
701 | callback(didWork);
|
702 | }
|
703 | };
|
704 | testabilities.forEach(function (testability /** TODO #9100 */) {
|
705 | testability.whenStable(decrement);
|
706 | });
|
707 | };
|
708 | if (!ɵglobal['frameworkStabilizers']) {
|
709 | ɵglobal['frameworkStabilizers'] = [];
|
710 | }
|
711 | ɵglobal['frameworkStabilizers'].push(whenAllStable);
|
712 | };
|
713 | BrowserGetTestability.prototype.findTestabilityInTree = function (registry, elem, findInAncestors) {
|
714 | if (elem == null) {
|
715 | return null;
|
716 | }
|
717 | var t = registry.getTestability(elem);
|
718 | if (t != null) {
|
719 | return t;
|
720 | }
|
721 | else if (!findInAncestors) {
|
722 | return null;
|
723 | }
|
724 | if (getDOM().isShadowRoot(elem)) {
|
725 | return this.findTestabilityInTree(registry, getDOM().getHost(elem), true);
|
726 | }
|
727 | return this.findTestabilityInTree(registry, getDOM().parentElement(elem), true);
|
728 | };
|
729 | return BrowserGetTestability;
|
730 | }());
|
731 |
|
732 |
|
733 |
|
734 |
|
735 |
|
736 |
|
737 |
|
738 |
|
739 | var CAMEL_CASE_REGEXP = /([A-Z])/g;
|
740 | var DASH_CASE_REGEXP = /-([a-z])/g;
|
741 | function camelCaseToDashCase(input) {
|
742 | return input.replace(CAMEL_CASE_REGEXP, function () {
|
743 | var m = [];
|
744 | for (var _i = 0; _i < arguments.length; _i++) {
|
745 | m[_i] = arguments[_i];
|
746 | }
|
747 | return '-' + m[1].toLowerCase();
|
748 | });
|
749 | }
|
750 | function dashCaseToCamelCase(input) {
|
751 | return input.replace(DASH_CASE_REGEXP, function () {
|
752 | var m = [];
|
753 | for (var _i = 0; _i < arguments.length; _i++) {
|
754 | m[_i] = arguments[_i];
|
755 | }
|
756 | return m[1].toUpperCase();
|
757 | });
|
758 | }
|
759 |
|
760 |
|
761 |
|
762 |
|
763 |
|
764 |
|
765 |
|
766 | function exportNgVar(name, value) {
|
767 | if (typeof COMPILED === 'undefined' || !COMPILED) {
|
768 |
|
769 |
|
770 |
|
771 |
|
772 | var ng = ɵglobal['ng'] = ɵglobal['ng'] || {};
|
773 | ng[name] = value;
|
774 | }
|
775 | }
|
776 |
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 |
|
784 | var ɵ0$1 = function () { return ({
|
785 | 'ApplicationRef': ApplicationRef,
|
786 | 'NgZone': NgZone,
|
787 | }); };
|
788 | var CORE_TOKENS = (ɵ0$1)();
|
789 | var INSPECT_GLOBAL_NAME = 'probe';
|
790 | var CORE_TOKENS_GLOBAL_NAME = 'coreTokens';
|
791 |
|
792 |
|
793 |
|
794 |
|
795 |
|
796 | function inspectNativeElement(element) {
|
797 | return getDebugNode(element);
|
798 | }
|
799 | function _createNgProbe(coreTokens) {
|
800 | exportNgVar(INSPECT_GLOBAL_NAME, inspectNativeElement);
|
801 | exportNgVar(CORE_TOKENS_GLOBAL_NAME, __assign({}, CORE_TOKENS, _ngProbeTokensToMap(coreTokens || [])));
|
802 | return function () { return inspectNativeElement; };
|
803 | }
|
804 | function _ngProbeTokensToMap(tokens) {
|
805 | return tokens.reduce(function (prev, t) { return (prev[t.name] = t.token, prev); }, {});
|
806 | }
|
807 |
|
808 |
|
809 |
|
810 |
|
811 |
|
812 |
|
813 |
|
814 | var ELEMENT_PROBE_PROVIDERS__POST_R3__ = [];
|
815 |
|
816 |
|
817 |
|
818 | var ELEMENT_PROBE_PROVIDERS__PRE_R3__ = [
|
819 | {
|
820 | provide: APP_INITIALIZER,
|
821 | useFactory: _createNgProbe,
|
822 | deps: [
|
823 | [NgProbeToken, new Optional()],
|
824 | ],
|
825 | multi: true,
|
826 | },
|
827 | ];
|
828 | var ELEMENT_PROBE_PROVIDERS = ELEMENT_PROBE_PROVIDERS__PRE_R3__;
|
829 |
|
830 |
|
831 |
|
832 |
|
833 |
|
834 |
|
835 |
|
836 |
|
837 |
|
838 |
|
839 |
|
840 |
|
841 |
|
842 | var EVENT_MANAGER_PLUGINS = new InjectionToken('EventManagerPlugins');
|
843 |
|
844 |
|
845 |
|
846 |
|
847 |
|
848 |
|
849 | var EventManager = (function () {
|
850 | |
851 |
|
852 |
|
853 | function EventManager(plugins, _zone) {
|
854 | var _this = this;
|
855 | this._zone = _zone;
|
856 | this._eventNameToPlugin = new Map();
|
857 | plugins.forEach(function (p) { return p.manager = _this; });
|
858 | this._plugins = plugins.slice().reverse();
|
859 | }
|
860 | |
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 |
|
867 |
|
868 |
|
869 | EventManager.prototype.addEventListener = function (element, eventName, handler) {
|
870 | var plugin = this._findPluginFor(eventName);
|
871 | return plugin.addEventListener(element, eventName, handler);
|
872 | };
|
873 | |
874 |
|
875 |
|
876 |
|
877 |
|
878 |
|
879 |
|
880 |
|
881 |
|
882 | EventManager.prototype.addGlobalEventListener = function (target, eventName, handler) {
|
883 | var plugin = this._findPluginFor(eventName);
|
884 | return plugin.addGlobalEventListener(target, eventName, handler);
|
885 | };
|
886 | |
887 |
|
888 |
|
889 | EventManager.prototype.getZone = function () { return this._zone; };
|
890 |
|
891 | EventManager.prototype._findPluginFor = function (eventName) {
|
892 | var plugin = this._eventNameToPlugin.get(eventName);
|
893 | if (plugin) {
|
894 | return plugin;
|
895 | }
|
896 | var plugins = this._plugins;
|
897 | for (var i = 0; i < plugins.length; i++) {
|
898 | var plugin_1 = plugins[i];
|
899 | if (plugin_1.supports(eventName)) {
|
900 | this._eventNameToPlugin.set(eventName, plugin_1);
|
901 | return plugin_1;
|
902 | }
|
903 | }
|
904 | throw new Error("No event manager plugin found for event " + eventName);
|
905 | };
|
906 | EventManager = __decorate([
|
907 | Injectable(),
|
908 | __param(0, Inject(EVENT_MANAGER_PLUGINS)),
|
909 | __metadata("design:paramtypes", [Array, NgZone])
|
910 | ], EventManager);
|
911 | return EventManager;
|
912 | }());
|
913 | var EventManagerPlugin = (function () {
|
914 | function EventManagerPlugin(_doc) {
|
915 | this._doc = _doc;
|
916 | }
|
917 | EventManagerPlugin.prototype.addGlobalEventListener = function (element, eventName, handler) {
|
918 | var target = getDOM().getGlobalEventTarget(this._doc, element);
|
919 | if (!target) {
|
920 | throw new Error("Unsupported event target " + target + " for event " + eventName);
|
921 | }
|
922 | return this.addEventListener(target, eventName, handler);
|
923 | };
|
924 | return EventManagerPlugin;
|
925 | }());
|
926 |
|
927 |
|
928 |
|
929 |
|
930 |
|
931 |
|
932 |
|
933 |
|
934 | var SharedStylesHost = (function () {
|
935 | function SharedStylesHost() {
|
936 |
|
937 | this._stylesSet = new Set();
|
938 | }
|
939 | SharedStylesHost.prototype.addStyles = function (styles) {
|
940 | var _this = this;
|
941 | var additions = new Set();
|
942 | styles.forEach(function (style) {
|
943 | if (!_this._stylesSet.has(style)) {
|
944 | _this._stylesSet.add(style);
|
945 | additions.add(style);
|
946 | }
|
947 | });
|
948 | this.onStylesAdded(additions);
|
949 | };
|
950 | SharedStylesHost.prototype.onStylesAdded = function (additions) { };
|
951 | SharedStylesHost.prototype.getAllStyles = function () { return Array.from(this._stylesSet); };
|
952 | SharedStylesHost = __decorate([
|
953 | Injectable()
|
954 | ], SharedStylesHost);
|
955 | return SharedStylesHost;
|
956 | }());
|
957 | var DomSharedStylesHost = (function (_super) {
|
958 | __extends(DomSharedStylesHost, _super);
|
959 | function DomSharedStylesHost(_doc) {
|
960 | var _this = _super.call(this) || this;
|
961 | _this._doc = _doc;
|
962 | _this._hostNodes = new Set();
|
963 | _this._styleNodes = new Set();
|
964 | _this._hostNodes.add(_doc.head);
|
965 | return _this;
|
966 | }
|
967 | DomSharedStylesHost.prototype._addStylesToHost = function (styles, host) {
|
968 | var _this = this;
|
969 | styles.forEach(function (style) {
|
970 | var styleEl = _this._doc.createElement('style');
|
971 | styleEl.textContent = style;
|
972 | _this._styleNodes.add(host.appendChild(styleEl));
|
973 | });
|
974 | };
|
975 | DomSharedStylesHost.prototype.addHost = function (hostNode) {
|
976 | this._addStylesToHost(this._stylesSet, hostNode);
|
977 | this._hostNodes.add(hostNode);
|
978 | };
|
979 | DomSharedStylesHost.prototype.removeHost = function (hostNode) { this._hostNodes.delete(hostNode); };
|
980 | DomSharedStylesHost.prototype.onStylesAdded = function (additions) {
|
981 | var _this = this;
|
982 | this._hostNodes.forEach(function (hostNode) { return _this._addStylesToHost(additions, hostNode); });
|
983 | };
|
984 | DomSharedStylesHost.prototype.ngOnDestroy = function () { this._styleNodes.forEach(function (styleNode) { return getDOM().remove(styleNode); }); };
|
985 | DomSharedStylesHost = __decorate([
|
986 | Injectable(),
|
987 | __param(0, Inject(DOCUMENT)),
|
988 | __metadata("design:paramtypes", [Object])
|
989 | ], DomSharedStylesHost);
|
990 | return DomSharedStylesHost;
|
991 | }(SharedStylesHost));
|
992 |
|
993 |
|
994 |
|
995 |
|
996 |
|
997 |
|
998 |
|
999 |
|
1000 | var NAMESPACE_URIS = {
|
1001 | 'svg': 'http://www.w3.org/2000/svg',
|
1002 | 'xhtml': 'http://www.w3.org/1999/xhtml',
|
1003 | 'xlink': 'http://www.w3.org/1999/xlink',
|
1004 | 'xml': 'http://www.w3.org/XML/1998/namespace',
|
1005 | 'xmlns': 'http://www.w3.org/2000/xmlns/',
|
1006 | };
|
1007 | var COMPONENT_REGEX = /%COMP%/g;
|
1008 | var COMPONENT_VARIABLE = '%COMP%';
|
1009 | var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE;
|
1010 | var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE;
|
1011 | function shimContentAttribute(componentShortId) {
|
1012 | return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
|
1013 | }
|
1014 | function shimHostAttribute(componentShortId) {
|
1015 | return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
|
1016 | }
|
1017 | function flattenStyles(compId, styles, target) {
|
1018 | for (var i = 0; i < styles.length; i++) {
|
1019 | var style = styles[i];
|
1020 | if (Array.isArray(style)) {
|
1021 | flattenStyles(compId, style, target);
|
1022 | }
|
1023 | else {
|
1024 | style = style.replace(COMPONENT_REGEX, compId);
|
1025 | target.push(style);
|
1026 | }
|
1027 | }
|
1028 | return target;
|
1029 | }
|
1030 | function decoratePreventDefault(eventHandler) {
|
1031 | return function (event) {
|
1032 | var allowDefaultBehavior = eventHandler(event);
|
1033 | if (allowDefaultBehavior === false) {
|
1034 |
|
1035 | event.preventDefault();
|
1036 | event.returnValue = false;
|
1037 | }
|
1038 | };
|
1039 | }
|
1040 | var DomRendererFactory2 = (function () {
|
1041 | function DomRendererFactory2(eventManager, sharedStylesHost, appId) {
|
1042 | this.eventManager = eventManager;
|
1043 | this.sharedStylesHost = sharedStylesHost;
|
1044 | this.appId = appId;
|
1045 | this.rendererByCompId = new Map();
|
1046 | this.defaultRenderer = new DefaultDomRenderer2(eventManager);
|
1047 | }
|
1048 | DomRendererFactory2.prototype.createRenderer = function (element, type) {
|
1049 | if (!element || !type) {
|
1050 | return this.defaultRenderer;
|
1051 | }
|
1052 | switch (type.encapsulation) {
|
1053 | case ViewEncapsulation.Emulated: {
|
1054 | var renderer = this.rendererByCompId.get(type.id);
|
1055 | if (!renderer) {
|
1056 | renderer = new EmulatedEncapsulationDomRenderer2(this.eventManager, this.sharedStylesHost, type, this.appId);
|
1057 | this.rendererByCompId.set(type.id, renderer);
|
1058 | }
|
1059 | renderer.applyToHost(element);
|
1060 | return renderer;
|
1061 | }
|
1062 | case ViewEncapsulation.Native:
|
1063 | case ViewEncapsulation.ShadowDom:
|
1064 | return new ShadowDomRenderer(this.eventManager, this.sharedStylesHost, element, type);
|
1065 | default: {
|
1066 | if (!this.rendererByCompId.has(type.id)) {
|
1067 | var styles = flattenStyles(type.id, type.styles, []);
|
1068 | this.sharedStylesHost.addStyles(styles);
|
1069 | this.rendererByCompId.set(type.id, this.defaultRenderer);
|
1070 | }
|
1071 | return this.defaultRenderer;
|
1072 | }
|
1073 | }
|
1074 | };
|
1075 | DomRendererFactory2.prototype.begin = function () { };
|
1076 | DomRendererFactory2.prototype.end = function () { };
|
1077 | DomRendererFactory2 = __decorate([
|
1078 | Injectable(),
|
1079 | __param(2, Inject(APP_ID)),
|
1080 | __metadata("design:paramtypes", [EventManager, DomSharedStylesHost, String])
|
1081 | ], DomRendererFactory2);
|
1082 | return DomRendererFactory2;
|
1083 | }());
|
1084 | var DefaultDomRenderer2 = (function () {
|
1085 | function DefaultDomRenderer2(eventManager) {
|
1086 | this.eventManager = eventManager;
|
1087 | this.data = Object.create(null);
|
1088 | }
|
1089 | DefaultDomRenderer2.prototype.destroy = function () { };
|
1090 | DefaultDomRenderer2.prototype.createElement = function (name, namespace) {
|
1091 | if (namespace) {
|
1092 |
|
1093 |
|
1094 | return document.createElementNS(NAMESPACE_URIS[namespace] || namespace, name);
|
1095 | }
|
1096 | return document.createElement(name);
|
1097 | };
|
1098 | DefaultDomRenderer2.prototype.createComment = function (value) { return document.createComment(value); };
|
1099 | DefaultDomRenderer2.prototype.createText = function (value) { return document.createTextNode(value); };
|
1100 | DefaultDomRenderer2.prototype.appendChild = function (parent, newChild) { parent.appendChild(newChild); };
|
1101 | DefaultDomRenderer2.prototype.insertBefore = function (parent, newChild, refChild) {
|
1102 | if (parent) {
|
1103 | parent.insertBefore(newChild, refChild);
|
1104 | }
|
1105 | };
|
1106 | DefaultDomRenderer2.prototype.removeChild = function (parent, oldChild) {
|
1107 | if (parent) {
|
1108 | parent.removeChild(oldChild);
|
1109 | }
|
1110 | };
|
1111 | DefaultDomRenderer2.prototype.selectRootElement = function (selectorOrNode, preserveContent) {
|
1112 | var el = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) :
|
1113 | selectorOrNode;
|
1114 | if (!el) {
|
1115 | throw new Error("The selector \"" + selectorOrNode + "\" did not match any elements");
|
1116 | }
|
1117 | if (!preserveContent) {
|
1118 | el.textContent = '';
|
1119 | }
|
1120 | return el;
|
1121 | };
|
1122 | DefaultDomRenderer2.prototype.parentNode = function (node) { return node.parentNode; };
|
1123 | DefaultDomRenderer2.prototype.nextSibling = function (node) { return node.nextSibling; };
|
1124 | DefaultDomRenderer2.prototype.setAttribute = function (el, name, value, namespace) {
|
1125 | if (namespace) {
|
1126 | name = namespace + ':' + name;
|
1127 |
|
1128 |
|
1129 | var namespaceUri = NAMESPACE_URIS[namespace];
|
1130 | if (namespaceUri) {
|
1131 | el.setAttributeNS(namespaceUri, name, value);
|
1132 | }
|
1133 | else {
|
1134 | el.setAttribute(name, value);
|
1135 | }
|
1136 | }
|
1137 | else {
|
1138 | el.setAttribute(name, value);
|
1139 | }
|
1140 | };
|
1141 | DefaultDomRenderer2.prototype.removeAttribute = function (el, name, namespace) {
|
1142 | if (namespace) {
|
1143 |
|
1144 |
|
1145 | var namespaceUri = NAMESPACE_URIS[namespace];
|
1146 | if (namespaceUri) {
|
1147 | el.removeAttributeNS(namespaceUri, name);
|
1148 | }
|
1149 | else {
|
1150 |
|
1151 |
|
1152 |
|
1153 | el.removeAttribute(namespace + ":" + name);
|
1154 | }
|
1155 | }
|
1156 | else {
|
1157 | el.removeAttribute(name);
|
1158 | }
|
1159 | };
|
1160 | DefaultDomRenderer2.prototype.addClass = function (el, name) { el.classList.add(name); };
|
1161 | DefaultDomRenderer2.prototype.removeClass = function (el, name) { el.classList.remove(name); };
|
1162 | DefaultDomRenderer2.prototype.setStyle = function (el, style, value, flags) {
|
1163 | if (flags & RendererStyleFlags2.DashCase) {
|
1164 | el.style.setProperty(style, value, !!(flags & RendererStyleFlags2.Important) ? 'important' : '');
|
1165 | }
|
1166 | else {
|
1167 | el.style[style] = value;
|
1168 | }
|
1169 | };
|
1170 | DefaultDomRenderer2.prototype.removeStyle = function (el, style, flags) {
|
1171 | if (flags & RendererStyleFlags2.DashCase) {
|
1172 | el.style.removeProperty(style);
|
1173 | }
|
1174 | else {
|
1175 |
|
1176 |
|
1177 | el.style[style] = '';
|
1178 | }
|
1179 | };
|
1180 | DefaultDomRenderer2.prototype.setProperty = function (el, name, value) {
|
1181 | checkNoSyntheticProp(name, 'property');
|
1182 | el[name] = value;
|
1183 | };
|
1184 | DefaultDomRenderer2.prototype.setValue = function (node, value) { node.nodeValue = value; };
|
1185 | DefaultDomRenderer2.prototype.listen = function (target, event, callback) {
|
1186 | checkNoSyntheticProp(event, 'listener');
|
1187 | if (typeof target === 'string') {
|
1188 | return this.eventManager.addGlobalEventListener(target, event, decoratePreventDefault(callback));
|
1189 | }
|
1190 | return this.eventManager.addEventListener(target, event, decoratePreventDefault(callback));
|
1191 | };
|
1192 | return DefaultDomRenderer2;
|
1193 | }());
|
1194 | var ɵ0$2 = function () { return '@'.charCodeAt(0); };
|
1195 | var AT_CHARCODE = (ɵ0$2)();
|
1196 | function checkNoSyntheticProp(name, nameKind) {
|
1197 | if (name.charCodeAt(0) === AT_CHARCODE) {
|
1198 | throw new Error("Found the synthetic " + nameKind + " " + name + ". Please include either \"BrowserAnimationsModule\" or \"NoopAnimationsModule\" in your application.");
|
1199 | }
|
1200 | }
|
1201 | var EmulatedEncapsulationDomRenderer2 = (function (_super) {
|
1202 | __extends(EmulatedEncapsulationDomRenderer2, _super);
|
1203 | function EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, component, appId) {
|
1204 | var _this = _super.call(this, eventManager) || this;
|
1205 | _this.component = component;
|
1206 | var styles = flattenStyles(appId + '-' + component.id, component.styles, []);
|
1207 | sharedStylesHost.addStyles(styles);
|
1208 | _this.contentAttr = shimContentAttribute(appId + '-' + component.id);
|
1209 | _this.hostAttr = shimHostAttribute(appId + '-' + component.id);
|
1210 | return _this;
|
1211 | }
|
1212 | EmulatedEncapsulationDomRenderer2.prototype.applyToHost = function (element) { _super.prototype.setAttribute.call(this, element, this.hostAttr, ''); };
|
1213 | EmulatedEncapsulationDomRenderer2.prototype.createElement = function (parent, name) {
|
1214 | var el = _super.prototype.createElement.call(this, parent, name);
|
1215 | _super.prototype.setAttribute.call(this, el, this.contentAttr, '');
|
1216 | return el;
|
1217 | };
|
1218 | return EmulatedEncapsulationDomRenderer2;
|
1219 | }(DefaultDomRenderer2));
|
1220 | var ShadowDomRenderer = (function (_super) {
|
1221 | __extends(ShadowDomRenderer, _super);
|
1222 | function ShadowDomRenderer(eventManager, sharedStylesHost, hostEl, component) {
|
1223 | var _this = _super.call(this, eventManager) || this;
|
1224 | _this.sharedStylesHost = sharedStylesHost;
|
1225 | _this.hostEl = hostEl;
|
1226 | _this.component = component;
|
1227 | if (component.encapsulation === ViewEncapsulation.ShadowDom) {
|
1228 | _this.shadowRoot = hostEl.attachShadow({ mode: 'open' });
|
1229 | }
|
1230 | else {
|
1231 | _this.shadowRoot = hostEl.createShadowRoot();
|
1232 | }
|
1233 | _this.sharedStylesHost.addHost(_this.shadowRoot);
|
1234 | var styles = flattenStyles(component.id, component.styles, []);
|
1235 | for (var i = 0; i < styles.length; i++) {
|
1236 | var styleEl = document.createElement('style');
|
1237 | styleEl.textContent = styles[i];
|
1238 | _this.shadowRoot.appendChild(styleEl);
|
1239 | }
|
1240 | return _this;
|
1241 | }
|
1242 | ShadowDomRenderer.prototype.nodeOrShadowRoot = function (node) { return node === this.hostEl ? this.shadowRoot : node; };
|
1243 | ShadowDomRenderer.prototype.destroy = function () { this.sharedStylesHost.removeHost(this.shadowRoot); };
|
1244 | ShadowDomRenderer.prototype.appendChild = function (parent, newChild) {
|
1245 | return _super.prototype.appendChild.call(this, this.nodeOrShadowRoot(parent), newChild);
|
1246 | };
|
1247 | ShadowDomRenderer.prototype.insertBefore = function (parent, newChild, refChild) {
|
1248 | return _super.prototype.insertBefore.call(this, this.nodeOrShadowRoot(parent), newChild, refChild);
|
1249 | };
|
1250 | ShadowDomRenderer.prototype.removeChild = function (parent, oldChild) {
|
1251 | return _super.prototype.removeChild.call(this, this.nodeOrShadowRoot(parent), oldChild);
|
1252 | };
|
1253 | ShadowDomRenderer.prototype.parentNode = function (node) {
|
1254 | return this.nodeOrShadowRoot(_super.prototype.parentNode.call(this, this.nodeOrShadowRoot(node)));
|
1255 | };
|
1256 | return ShadowDomRenderer;
|
1257 | }(DefaultDomRenderer2));
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 | var ɵ0$3 = function () { return (typeof Zone !== 'undefined') && Zone['__symbol__'] ||
|
1267 | function (v) { return '__zone_symbol__' + v; }; };
|
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 |
|
1274 | var __symbol__ = (ɵ0$3)();
|
1275 | var ADD_EVENT_LISTENER = __symbol__('addEventListener');
|
1276 | var REMOVE_EVENT_LISTENER = __symbol__('removeEventListener');
|
1277 | var symbolNames = {};
|
1278 | var FALSE = 'FALSE';
|
1279 | var ANGULAR = 'ANGULAR';
|
1280 | var NATIVE_ADD_LISTENER = 'addEventListener';
|
1281 | var NATIVE_REMOVE_LISTENER = 'removeEventListener';
|
1282 |
|
1283 | var stopSymbol = '__zone_symbol__propagationStopped';
|
1284 | var stopMethodSymbol = '__zone_symbol__stopImmediatePropagation';
|
1285 | var ɵ1 = function () {
|
1286 | var blackListedEvents = (typeof Zone !== 'undefined') && Zone[__symbol__('BLACK_LISTED_EVENTS')];
|
1287 | if (blackListedEvents) {
|
1288 | var res_1 = {};
|
1289 | blackListedEvents.forEach(function (eventName) { res_1[eventName] = eventName; });
|
1290 | return res_1;
|
1291 | }
|
1292 | return undefined;
|
1293 | };
|
1294 | var blackListedMap = (ɵ1)();
|
1295 | var isBlackListedEvent = function (eventName) {
|
1296 | if (!blackListedMap) {
|
1297 | return false;
|
1298 | }
|
1299 | return blackListedMap.hasOwnProperty(eventName);
|
1300 | };
|
1301 | var ɵ2 = isBlackListedEvent;
|
1302 |
|
1303 |
|
1304 | var globalListener = function (event) {
|
1305 | var symbolName = symbolNames[event.type];
|
1306 | if (!symbolName) {
|
1307 | return;
|
1308 | }
|
1309 | var taskDatas = this[symbolName];
|
1310 | if (!taskDatas) {
|
1311 | return;
|
1312 | }
|
1313 | var args = [event];
|
1314 | if (taskDatas.length === 1) {
|
1315 |
|
1316 | var taskData = taskDatas[0];
|
1317 | if (taskData.zone !== Zone.current) {
|
1318 |
|
1319 | return taskData.zone.run(taskData.handler, this, args);
|
1320 | }
|
1321 | else {
|
1322 | return taskData.handler.apply(this, args);
|
1323 | }
|
1324 | }
|
1325 | else {
|
1326 |
|
1327 |
|
1328 | var copiedTasks = taskDatas.slice();
|
1329 | for (var i = 0; i < copiedTasks.length; i++) {
|
1330 |
|
1331 |
|
1332 | if (event[stopSymbol] === true) {
|
1333 | break;
|
1334 | }
|
1335 | var taskData = copiedTasks[i];
|
1336 | if (taskData.zone !== Zone.current) {
|
1337 |
|
1338 | taskData.zone.run(taskData.handler, this, args);
|
1339 | }
|
1340 | else {
|
1341 | taskData.handler.apply(this, args);
|
1342 | }
|
1343 | }
|
1344 | }
|
1345 | };
|
1346 | var ɵ3 = globalListener;
|
1347 | var DomEventsPlugin = (function (_super) {
|
1348 | __extends(DomEventsPlugin, _super);
|
1349 | function DomEventsPlugin(doc, ngZone, platformId) {
|
1350 | var _this = _super.call(this, doc) || this;
|
1351 | _this.ngZone = ngZone;
|
1352 | if (!platformId || !isPlatformServer(platformId)) {
|
1353 | _this.patchEvent();
|
1354 | }
|
1355 | return _this;
|
1356 | }
|
1357 | DomEventsPlugin.prototype.patchEvent = function () {
|
1358 | if (typeof Event === 'undefined' || !Event || !Event.prototype) {
|
1359 | return;
|
1360 | }
|
1361 | if (Event.prototype[stopMethodSymbol]) {
|
1362 |
|
1363 | return;
|
1364 | }
|
1365 | var delegate = Event.prototype[stopMethodSymbol] =
|
1366 | Event.prototype.stopImmediatePropagation;
|
1367 | Event.prototype.stopImmediatePropagation = function () {
|
1368 | if (this) {
|
1369 | this[stopSymbol] = true;
|
1370 | }
|
1371 |
|
1372 |
|
1373 |
|
1374 |
|
1375 |
|
1376 | delegate && delegate.apply(this, arguments);
|
1377 | };
|
1378 | };
|
1379 |
|
1380 |
|
1381 | DomEventsPlugin.prototype.supports = function (eventName) { return true; };
|
1382 | DomEventsPlugin.prototype.addEventListener = function (element, eventName, handler) {
|
1383 | var _this = this;
|
1384 | |
1385 |
|
1386 |
|
1387 |
|
1388 |
|
1389 |
|
1390 |
|
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 | var self = this;
|
1398 | var zoneJsLoaded = element[ADD_EVENT_LISTENER];
|
1399 | var callback = handler;
|
1400 |
|
1401 |
|
1402 | if (zoneJsLoaded && (!NgZone.isInAngularZone() || isBlackListedEvent(eventName))) {
|
1403 | var symbolName = symbolNames[eventName];
|
1404 | if (!symbolName) {
|
1405 | symbolName = symbolNames[eventName] = __symbol__(ANGULAR + eventName + FALSE);
|
1406 | }
|
1407 | var taskDatas = element[symbolName];
|
1408 | var globalListenerRegistered = taskDatas && taskDatas.length > 0;
|
1409 | if (!taskDatas) {
|
1410 | taskDatas = element[symbolName] = [];
|
1411 | }
|
1412 | var zone = isBlackListedEvent(eventName) ? Zone.root : Zone.current;
|
1413 | if (taskDatas.length === 0) {
|
1414 | taskDatas.push({ zone: zone, handler: callback });
|
1415 | }
|
1416 | else {
|
1417 | var callbackRegistered = false;
|
1418 | for (var i = 0; i < taskDatas.length; i++) {
|
1419 | if (taskDatas[i].handler === callback) {
|
1420 | callbackRegistered = true;
|
1421 | break;
|
1422 | }
|
1423 | }
|
1424 | if (!callbackRegistered) {
|
1425 | taskDatas.push({ zone: zone, handler: callback });
|
1426 | }
|
1427 | }
|
1428 | if (!globalListenerRegistered) {
|
1429 | element[ADD_EVENT_LISTENER](eventName, globalListener, false);
|
1430 | }
|
1431 | }
|
1432 | else {
|
1433 | element[NATIVE_ADD_LISTENER](eventName, callback, false);
|
1434 | }
|
1435 | return function () { return _this.removeEventListener(element, eventName, callback); };
|
1436 | };
|
1437 | DomEventsPlugin.prototype.removeEventListener = function (target, eventName, callback) {
|
1438 | var underlyingRemove = target[REMOVE_EVENT_LISTENER];
|
1439 |
|
1440 | if (!underlyingRemove) {
|
1441 | return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
|
1442 | }
|
1443 | var symbolName = symbolNames[eventName];
|
1444 | var taskDatas = symbolName && target[symbolName];
|
1445 | if (!taskDatas) {
|
1446 |
|
1447 |
|
1448 | return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
|
1449 | }
|
1450 |
|
1451 |
|
1452 | var found = false;
|
1453 | for (var i = 0; i < taskDatas.length; i++) {
|
1454 |
|
1455 | if (taskDatas[i].handler === callback) {
|
1456 | found = true;
|
1457 | taskDatas.splice(i, 1);
|
1458 | break;
|
1459 | }
|
1460 | }
|
1461 | if (found) {
|
1462 | if (taskDatas.length === 0) {
|
1463 |
|
1464 | underlyingRemove.apply(target, [eventName, globalListener, false]);
|
1465 | }
|
1466 | }
|
1467 | else {
|
1468 |
|
1469 |
|
1470 | target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
|
1471 | }
|
1472 | };
|
1473 | DomEventsPlugin = __decorate([
|
1474 | Injectable(),
|
1475 | __param(0, Inject(DOCUMENT)),
|
1476 | __param(2, Optional()), __param(2, Inject(PLATFORM_ID)),
|
1477 | __metadata("design:paramtypes", [Object, NgZone, Object])
|
1478 | ], DomEventsPlugin);
|
1479 | return DomEventsPlugin;
|
1480 | }(EventManagerPlugin));
|
1481 |
|
1482 |
|
1483 |
|
1484 |
|
1485 |
|
1486 |
|
1487 |
|
1488 |
|
1489 |
|
1490 |
|
1491 |
|
1492 | var EVENT_NAMES = {
|
1493 |
|
1494 | 'pan': true,
|
1495 | 'panstart': true,
|
1496 | 'panmove': true,
|
1497 | 'panend': true,
|
1498 | 'pancancel': true,
|
1499 | 'panleft': true,
|
1500 | 'panright': true,
|
1501 | 'panup': true,
|
1502 | 'pandown': true,
|
1503 |
|
1504 | 'pinch': true,
|
1505 | 'pinchstart': true,
|
1506 | 'pinchmove': true,
|
1507 | 'pinchend': true,
|
1508 | 'pinchcancel': true,
|
1509 | 'pinchin': true,
|
1510 | 'pinchout': true,
|
1511 |
|
1512 | 'press': true,
|
1513 | 'pressup': true,
|
1514 |
|
1515 | 'rotate': true,
|
1516 | 'rotatestart': true,
|
1517 | 'rotatemove': true,
|
1518 | 'rotateend': true,
|
1519 | 'rotatecancel': true,
|
1520 |
|
1521 | 'swipe': true,
|
1522 | 'swipeleft': true,
|
1523 | 'swiperight': true,
|
1524 | 'swipeup': true,
|
1525 | 'swipedown': true,
|
1526 |
|
1527 | 'tap': true,
|
1528 | };
|
1529 |
|
1530 |
|
1531 |
|
1532 |
|
1533 |
|
1534 |
|
1535 | var HAMMER_GESTURE_CONFIG = new InjectionToken('HammerGestureConfig');
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 |
|
1541 | var HAMMER_LOADER = new InjectionToken('HammerLoader');
|
1542 |
|
1543 |
|
1544 |
|
1545 |
|
1546 |
|
1547 | var HammerGestureConfig = (function () {
|
1548 | function HammerGestureConfig() {
|
1549 | |
1550 |
|
1551 |
|
1552 |
|
1553 |
|
1554 | this.events = [];
|
1555 | |
1556 |
|
1557 |
|
1558 |
|
1559 |
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 |
|
1565 |
|
1566 |
|
1567 |
|
1568 |
|
1569 |
|
1570 |
|
1571 | this.overrides = {};
|
1572 | }
|
1573 | |
1574 |
|
1575 |
|
1576 |
|
1577 |
|
1578 |
|
1579 | HammerGestureConfig.prototype.buildHammer = function (element) {
|
1580 | var mc = new Hammer(element, this.options);
|
1581 | mc.get('pinch').set({ enable: true });
|
1582 | mc.get('rotate').set({ enable: true });
|
1583 | for (var eventName in this.overrides) {
|
1584 | mc.get(eventName).set(this.overrides[eventName]);
|
1585 | }
|
1586 | return mc;
|
1587 | };
|
1588 | HammerGestureConfig = __decorate([
|
1589 | Injectable()
|
1590 | ], HammerGestureConfig);
|
1591 | return HammerGestureConfig;
|
1592 | }());
|
1593 | var HammerGesturesPlugin = (function (_super) {
|
1594 | __extends(HammerGesturesPlugin, _super);
|
1595 | function HammerGesturesPlugin(doc, _config, console, loader) {
|
1596 | var _this = _super.call(this, doc) || this;
|
1597 | _this._config = _config;
|
1598 | _this.console = console;
|
1599 | _this.loader = loader;
|
1600 | return _this;
|
1601 | }
|
1602 | HammerGesturesPlugin.prototype.supports = function (eventName) {
|
1603 | if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
|
1604 | return false;
|
1605 | }
|
1606 | if (!window.Hammer && !this.loader) {
|
1607 | this.console.warn("The \"" + eventName + "\" event cannot be bound because Hammer.JS is not " +
|
1608 | "loaded and no custom loader has been specified.");
|
1609 | return false;
|
1610 | }
|
1611 | return true;
|
1612 | };
|
1613 | HammerGesturesPlugin.prototype.addEventListener = function (element, eventName, handler) {
|
1614 | var _this = this;
|
1615 | var zone = this.manager.getZone();
|
1616 | eventName = eventName.toLowerCase();
|
1617 |
|
1618 |
|
1619 | if (!window.Hammer && this.loader) {
|
1620 |
|
1621 |
|
1622 |
|
1623 | var cancelRegistration_1 = false;
|
1624 | var deregister_1 = function () { cancelRegistration_1 = true; };
|
1625 | this.loader()
|
1626 | .then(function () {
|
1627 |
|
1628 | if (!window.Hammer) {
|
1629 | _this.console.warn("The custom HAMMER_LOADER completed, but Hammer.JS is not present.");
|
1630 | deregister_1 = function () { };
|
1631 | return;
|
1632 | }
|
1633 | if (!cancelRegistration_1) {
|
1634 |
|
1635 |
|
1636 | deregister_1 = _this.addEventListener(element, eventName, handler);
|
1637 | }
|
1638 | })
|
1639 | .catch(function () {
|
1640 | _this.console.warn("The \"" + eventName + "\" event cannot be bound because the custom " +
|
1641 | "Hammer.JS loader failed.");
|
1642 | deregister_1 = function () { };
|
1643 | });
|
1644 |
|
1645 |
|
1646 |
|
1647 | return function () { deregister_1(); };
|
1648 | }
|
1649 | return zone.runOutsideAngular(function () {
|
1650 |
|
1651 | var mc = _this._config.buildHammer(element);
|
1652 | var callback = function (eventObj) {
|
1653 | zone.runGuarded(function () { handler(eventObj); });
|
1654 | };
|
1655 | mc.on(eventName, callback);
|
1656 | return function () {
|
1657 | mc.off(eventName, callback);
|
1658 |
|
1659 | if (typeof mc.destroy === 'function') {
|
1660 | mc.destroy();
|
1661 | }
|
1662 | };
|
1663 | });
|
1664 | };
|
1665 | HammerGesturesPlugin.prototype.isCustomEvent = function (eventName) { return this._config.events.indexOf(eventName) > -1; };
|
1666 | HammerGesturesPlugin = __decorate([
|
1667 | Injectable(),
|
1668 | __param(0, Inject(DOCUMENT)),
|
1669 | __param(1, Inject(HAMMER_GESTURE_CONFIG)),
|
1670 | __param(3, Optional()), __param(3, Inject(HAMMER_LOADER)),
|
1671 | __metadata("design:paramtypes", [Object, HammerGestureConfig, ɵConsole, Object])
|
1672 | ], HammerGesturesPlugin);
|
1673 | return HammerGesturesPlugin;
|
1674 | }(EventManagerPlugin));
|
1675 |
|
1676 |
|
1677 |
|
1678 |
|
1679 |
|
1680 |
|
1681 |
|
1682 |
|
1683 |
|
1684 |
|
1685 |
|
1686 | var MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];
|
1687 | var ɵ0$4 = function (event) { return event.altKey; }, ɵ1$1 = function (event) { return event.ctrlKey; }, ɵ2$1 = function (event) { return event.metaKey; }, ɵ3$1 = function (event) { return event.shiftKey; };
|
1688 |
|
1689 |
|
1690 |
|
1691 | var MODIFIER_KEY_GETTERS = {
|
1692 | 'alt': ɵ0$4,
|
1693 | 'control': ɵ1$1,
|
1694 | 'meta': ɵ2$1,
|
1695 | 'shift': ɵ3$1
|
1696 | };
|
1697 |
|
1698 |
|
1699 |
|
1700 |
|
1701 | var KeyEventsPlugin = (function (_super) {
|
1702 | __extends(KeyEventsPlugin, _super);
|
1703 | |
1704 |
|
1705 |
|
1706 |
|
1707 | function KeyEventsPlugin(doc) {
|
1708 | return _super.call(this, doc) || this;
|
1709 | }
|
1710 | KeyEventsPlugin_1 = KeyEventsPlugin;
|
1711 | |
1712 |
|
1713 |
|
1714 |
|
1715 |
|
1716 | KeyEventsPlugin.prototype.supports = function (eventName) { return KeyEventsPlugin_1.parseEventName(eventName) != null; };
|
1717 | |
1718 |
|
1719 |
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 | KeyEventsPlugin.prototype.addEventListener = function (element, eventName, handler) {
|
1726 | var parsedEvent = KeyEventsPlugin_1.parseEventName(eventName);
|
1727 | var outsideHandler = KeyEventsPlugin_1.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
|
1728 | return this.manager.getZone().runOutsideAngular(function () {
|
1729 | return getDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler);
|
1730 | });
|
1731 | };
|
1732 | KeyEventsPlugin.parseEventName = function (eventName) {
|
1733 | var parts = eventName.toLowerCase().split('.');
|
1734 | var domEventName = parts.shift();
|
1735 | if ((parts.length === 0) || !(domEventName === 'keydown' || domEventName === 'keyup')) {
|
1736 | return null;
|
1737 | }
|
1738 | var key = KeyEventsPlugin_1._normalizeKey(parts.pop());
|
1739 | var fullKey = '';
|
1740 | MODIFIER_KEYS.forEach(function (modifierName) {
|
1741 | var index = parts.indexOf(modifierName);
|
1742 | if (index > -1) {
|
1743 | parts.splice(index, 1);
|
1744 | fullKey += modifierName + '.';
|
1745 | }
|
1746 | });
|
1747 | fullKey += key;
|
1748 | if (parts.length != 0 || key.length === 0) {
|
1749 |
|
1750 | return null;
|
1751 | }
|
1752 | var result = {};
|
1753 | result['domEventName'] = domEventName;
|
1754 | result['fullKey'] = fullKey;
|
1755 | return result;
|
1756 | };
|
1757 | KeyEventsPlugin.getEventFullKey = function (event) {
|
1758 | var fullKey = '';
|
1759 | var key = getDOM().getEventKey(event);
|
1760 | key = key.toLowerCase();
|
1761 | if (key === ' ') {
|
1762 | key = 'space';
|
1763 | }
|
1764 | else if (key === '.') {
|
1765 | key = 'dot';
|
1766 | }
|
1767 | MODIFIER_KEYS.forEach(function (modifierName) {
|
1768 | if (modifierName != key) {
|
1769 | var modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
|
1770 | if (modifierGetter(event)) {
|
1771 | fullKey += modifierName + '.';
|
1772 | }
|
1773 | }
|
1774 | });
|
1775 | fullKey += key;
|
1776 | return fullKey;
|
1777 | };
|
1778 | |
1779 |
|
1780 |
|
1781 |
|
1782 |
|
1783 |
|
1784 |
|
1785 | KeyEventsPlugin.eventCallback = function (fullKey, handler, zone) {
|
1786 | return function (event /** TODO #9100 */) {
|
1787 | if (KeyEventsPlugin_1.getEventFullKey(event) === fullKey) {
|
1788 | zone.runGuarded(function () { return handler(event); });
|
1789 | }
|
1790 | };
|
1791 | };
|
1792 |
|
1793 | KeyEventsPlugin._normalizeKey = function (keyName) {
|
1794 |
|
1795 | switch (keyName) {
|
1796 | case 'esc':
|
1797 | return 'escape';
|
1798 | default:
|
1799 | return keyName;
|
1800 | }
|
1801 | };
|
1802 | var KeyEventsPlugin_1;
|
1803 | KeyEventsPlugin = KeyEventsPlugin_1 = __decorate([
|
1804 | Injectable(),
|
1805 | __param(0, Inject(DOCUMENT)),
|
1806 | __metadata("design:paramtypes", [Object])
|
1807 | ], KeyEventsPlugin);
|
1808 | return KeyEventsPlugin;
|
1809 | }(EventManagerPlugin));
|
1810 |
|
1811 |
|
1812 |
|
1813 |
|
1814 |
|
1815 |
|
1816 |
|
1817 |
|
1818 |
|
1819 |
|
1820 |
|
1821 |
|
1822 |
|
1823 |
|
1824 |
|
1825 |
|
1826 |
|
1827 |
|
1828 |
|
1829 |
|
1830 |
|
1831 |
|
1832 |
|
1833 |
|
1834 |
|
1835 |
|
1836 |
|
1837 |
|
1838 |
|
1839 |
|
1840 |
|
1841 |
|
1842 |
|
1843 |
|
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 |
|
1849 | var DomSanitizer = (function () {
|
1850 | function DomSanitizer() {
|
1851 | }
|
1852 | return DomSanitizer;
|
1853 | }());
|
1854 | var DomSanitizerImpl = (function (_super) {
|
1855 | __extends(DomSanitizerImpl, _super);
|
1856 | function DomSanitizerImpl(_doc) {
|
1857 | var _this = _super.call(this) || this;
|
1858 | _this._doc = _doc;
|
1859 | return _this;
|
1860 | }
|
1861 | DomSanitizerImpl.prototype.sanitize = function (ctx, value) {
|
1862 | if (value == null)
|
1863 | return null;
|
1864 | switch (ctx) {
|
1865 | case SecurityContext.NONE:
|
1866 | return value;
|
1867 | case SecurityContext.HTML:
|
1868 | if (value instanceof SafeHtmlImpl)
|
1869 | return value.changingThisBreaksApplicationSecurity;
|
1870 | this.checkNotSafeValue(value, 'HTML');
|
1871 | return ɵ_sanitizeHtml(this._doc, String(value));
|
1872 | case SecurityContext.STYLE:
|
1873 | if (value instanceof SafeStyleImpl)
|
1874 | return value.changingThisBreaksApplicationSecurity;
|
1875 | this.checkNotSafeValue(value, 'Style');
|
1876 | return ɵ_sanitizeStyle(value);
|
1877 | case SecurityContext.SCRIPT:
|
1878 | if (value instanceof SafeScriptImpl)
|
1879 | return value.changingThisBreaksApplicationSecurity;
|
1880 | this.checkNotSafeValue(value, 'Script');
|
1881 | throw new Error('unsafe value used in a script context');
|
1882 | case SecurityContext.URL:
|
1883 | if (value instanceof SafeResourceUrlImpl || value instanceof SafeUrlImpl) {
|
1884 |
|
1885 | return value.changingThisBreaksApplicationSecurity;
|
1886 | }
|
1887 | this.checkNotSafeValue(value, 'URL');
|
1888 | return ɵ_sanitizeUrl(String(value));
|
1889 | case SecurityContext.RESOURCE_URL:
|
1890 | if (value instanceof SafeResourceUrlImpl) {
|
1891 | return value.changingThisBreaksApplicationSecurity;
|
1892 | }
|
1893 | this.checkNotSafeValue(value, 'ResourceURL');
|
1894 | throw new Error('unsafe value used in a resource URL context (see http://g.co/ng/security#xss)');
|
1895 | default:
|
1896 | throw new Error("Unexpected SecurityContext " + ctx + " (see http://g.co/ng/security#xss)");
|
1897 | }
|
1898 | };
|
1899 | DomSanitizerImpl.prototype.checkNotSafeValue = function (value, expectedType) {
|
1900 | if (value instanceof SafeValueImpl) {
|
1901 | throw new Error("Required a safe " + expectedType + ", got a " + value.getTypeName() + " " +
|
1902 | "(see http://g.co/ng/security#xss)");
|
1903 | }
|
1904 | };
|
1905 | DomSanitizerImpl.prototype.bypassSecurityTrustHtml = function (value) { return new SafeHtmlImpl(value); };
|
1906 | DomSanitizerImpl.prototype.bypassSecurityTrustStyle = function (value) { return new SafeStyleImpl(value); };
|
1907 | DomSanitizerImpl.prototype.bypassSecurityTrustScript = function (value) { return new SafeScriptImpl(value); };
|
1908 | DomSanitizerImpl.prototype.bypassSecurityTrustUrl = function (value) { return new SafeUrlImpl(value); };
|
1909 | DomSanitizerImpl.prototype.bypassSecurityTrustResourceUrl = function (value) {
|
1910 | return new SafeResourceUrlImpl(value);
|
1911 | };
|
1912 | DomSanitizerImpl = __decorate([
|
1913 | Injectable(),
|
1914 | __param(0, Inject(DOCUMENT)),
|
1915 | __metadata("design:paramtypes", [Object])
|
1916 | ], DomSanitizerImpl);
|
1917 | return DomSanitizerImpl;
|
1918 | }(DomSanitizer));
|
1919 | var SafeValueImpl = (function () {
|
1920 | function SafeValueImpl(changingThisBreaksApplicationSecurity) {
|
1921 | this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity;
|
1922 |
|
1923 | }
|
1924 | SafeValueImpl.prototype.toString = function () {
|
1925 | return "SafeValue must use [property]=binding: " + this.changingThisBreaksApplicationSecurity +
|
1926 | " (see http://g.co/ng/security#xss)";
|
1927 | };
|
1928 | return SafeValueImpl;
|
1929 | }());
|
1930 | var SafeHtmlImpl = (function (_super) {
|
1931 | __extends(SafeHtmlImpl, _super);
|
1932 | function SafeHtmlImpl() {
|
1933 | return _super !== null && _super.apply(this, arguments) || this;
|
1934 | }
|
1935 | SafeHtmlImpl.prototype.getTypeName = function () { return 'HTML'; };
|
1936 | return SafeHtmlImpl;
|
1937 | }(SafeValueImpl));
|
1938 | var SafeStyleImpl = (function (_super) {
|
1939 | __extends(SafeStyleImpl, _super);
|
1940 | function SafeStyleImpl() {
|
1941 | return _super !== null && _super.apply(this, arguments) || this;
|
1942 | }
|
1943 | SafeStyleImpl.prototype.getTypeName = function () { return 'Style'; };
|
1944 | return SafeStyleImpl;
|
1945 | }(SafeValueImpl));
|
1946 | var SafeScriptImpl = (function (_super) {
|
1947 | __extends(SafeScriptImpl, _super);
|
1948 | function SafeScriptImpl() {
|
1949 | return _super !== null && _super.apply(this, arguments) || this;
|
1950 | }
|
1951 | SafeScriptImpl.prototype.getTypeName = function () { return 'Script'; };
|
1952 | return SafeScriptImpl;
|
1953 | }(SafeValueImpl));
|
1954 | var SafeUrlImpl = (function (_super) {
|
1955 | __extends(SafeUrlImpl, _super);
|
1956 | function SafeUrlImpl() {
|
1957 | return _super !== null && _super.apply(this, arguments) || this;
|
1958 | }
|
1959 | SafeUrlImpl.prototype.getTypeName = function () { return 'URL'; };
|
1960 | return SafeUrlImpl;
|
1961 | }(SafeValueImpl));
|
1962 | var SafeResourceUrlImpl = (function (_super) {
|
1963 | __extends(SafeResourceUrlImpl, _super);
|
1964 | function SafeResourceUrlImpl() {
|
1965 | return _super !== null && _super.apply(this, arguments) || this;
|
1966 | }
|
1967 | SafeResourceUrlImpl.prototype.getTypeName = function () { return 'ResourceURL'; };
|
1968 | return SafeResourceUrlImpl;
|
1969 | }(SafeValueImpl));
|
1970 |
|
1971 |
|
1972 |
|
1973 |
|
1974 |
|
1975 |
|
1976 |
|
1977 |
|
1978 | var ɵ0$5 = ɵPLATFORM_BROWSER_ID;
|
1979 | var INTERNAL_BROWSER_PLATFORM_PROVIDERS = [
|
1980 | { provide: PLATFORM_ID, useValue: ɵ0$5 },
|
1981 | { provide: PLATFORM_INITIALIZER, useValue: initDomAdapter, multi: true },
|
1982 | { provide: PlatformLocation, useClass: BrowserPlatformLocation, deps: [DOCUMENT] },
|
1983 | { provide: DOCUMENT, useFactory: _document, deps: [] },
|
1984 | ];
|
1985 |
|
1986 |
|
1987 |
|
1988 |
|
1989 |
|
1990 |
|
1991 | var BROWSER_SANITIZATION_PROVIDERS = [
|
1992 | { provide: Sanitizer, useExisting: DomSanitizer },
|
1993 | { provide: DomSanitizer, useClass: DomSanitizerImpl, deps: [DOCUMENT] },
|
1994 | ];
|
1995 |
|
1996 |
|
1997 |
|
1998 | var platformBrowser = createPlatformFactory(platformCore, 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
|
1999 | function initDomAdapter() {
|
2000 | BrowserDomAdapter.makeCurrent();
|
2001 | BrowserGetTestability.init();
|
2002 | }
|
2003 | function errorHandler() {
|
2004 | return new ErrorHandler();
|
2005 | }
|
2006 | function _document() {
|
2007 | return document;
|
2008 | }
|
2009 | var BROWSER_MODULE_PROVIDERS = [
|
2010 | BROWSER_SANITIZATION_PROVIDERS,
|
2011 | { provide: ɵAPP_ROOT, useValue: true },
|
2012 | { provide: ErrorHandler, useFactory: errorHandler, deps: [] },
|
2013 | {
|
2014 | provide: EVENT_MANAGER_PLUGINS,
|
2015 | useClass: DomEventsPlugin,
|
2016 | multi: true,
|
2017 | deps: [DOCUMENT, NgZone, PLATFORM_ID]
|
2018 | },
|
2019 | { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true, deps: [DOCUMENT] },
|
2020 | {
|
2021 | provide: EVENT_MANAGER_PLUGINS,
|
2022 | useClass: HammerGesturesPlugin,
|
2023 | multi: true,
|
2024 | deps: [DOCUMENT, HAMMER_GESTURE_CONFIG, ɵConsole, [new Optional(), HAMMER_LOADER]]
|
2025 | },
|
2026 | { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig, deps: [] },
|
2027 | {
|
2028 | provide: DomRendererFactory2,
|
2029 | useClass: DomRendererFactory2,
|
2030 | deps: [EventManager, DomSharedStylesHost, APP_ID]
|
2031 | },
|
2032 | { provide: RendererFactory2, useExisting: DomRendererFactory2 },
|
2033 | { provide: SharedStylesHost, useExisting: DomSharedStylesHost },
|
2034 | { provide: DomSharedStylesHost, useClass: DomSharedStylesHost, deps: [DOCUMENT] },
|
2035 | { provide: Testability, useClass: Testability, deps: [NgZone] },
|
2036 | { provide: EventManager, useClass: EventManager, deps: [EVENT_MANAGER_PLUGINS, NgZone] },
|
2037 | ELEMENT_PROBE_PROVIDERS,
|
2038 | ];
|
2039 |
|
2040 |
|
2041 |
|
2042 |
|
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 | var BrowserModule = (function () {
|
2049 | function BrowserModule(parentModule) {
|
2050 | if (parentModule) {
|
2051 | 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.");
|
2052 | }
|
2053 | }
|
2054 | BrowserModule_1 = BrowserModule;
|
2055 | |
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 |
|
2062 |
|
2063 | BrowserModule.withServerTransition = function (params) {
|
2064 | return {
|
2065 | ngModule: BrowserModule_1,
|
2066 | providers: [
|
2067 | { provide: APP_ID, useValue: params.appId },
|
2068 | { provide: TRANSITION_ID, useExisting: APP_ID },
|
2069 | SERVER_TRANSITION_PROVIDERS,
|
2070 | ],
|
2071 | };
|
2072 | };
|
2073 | var BrowserModule_1;
|
2074 | BrowserModule = BrowserModule_1 = __decorate([
|
2075 | NgModule({ providers: BROWSER_MODULE_PROVIDERS, exports: [CommonModule, ApplicationModule] }),
|
2076 | __param(0, Optional()), __param(0, SkipSelf()), __param(0, Inject(BrowserModule_1)),
|
2077 | __metadata("design:paramtypes", [Object])
|
2078 | ], BrowserModule);
|
2079 | return BrowserModule;
|
2080 | }());
|
2081 |
|
2082 |
|
2083 |
|
2084 |
|
2085 | function createMeta() {
|
2086 | return new Meta(ɵɵinject(DOCUMENT));
|
2087 | }
|
2088 |
|
2089 |
|
2090 |
|
2091 |
|
2092 |
|
2093 | var Meta = (function () {
|
2094 | function Meta(_doc) {
|
2095 | this._doc = _doc;
|
2096 | this._dom = getDOM();
|
2097 | }
|
2098 | Meta.prototype.addTag = function (tag, forceCreation) {
|
2099 | if (forceCreation === void 0) { forceCreation = false; }
|
2100 | if (!tag)
|
2101 | return null;
|
2102 | return this._getOrCreateElement(tag, forceCreation);
|
2103 | };
|
2104 | Meta.prototype.addTags = function (tags, forceCreation) {
|
2105 | var _this = this;
|
2106 | if (forceCreation === void 0) { forceCreation = false; }
|
2107 | if (!tags)
|
2108 | return [];
|
2109 | return tags.reduce(function (result, tag) {
|
2110 | if (tag) {
|
2111 | result.push(_this._getOrCreateElement(tag, forceCreation));
|
2112 | }
|
2113 | return result;
|
2114 | }, []);
|
2115 | };
|
2116 | Meta.prototype.getTag = function (attrSelector) {
|
2117 | if (!attrSelector)
|
2118 | return null;
|
2119 | return this._dom.querySelector(this._doc, "meta[" + attrSelector + "]") || null;
|
2120 | };
|
2121 | Meta.prototype.getTags = function (attrSelector) {
|
2122 | if (!attrSelector)
|
2123 | return [];
|
2124 | var list = this._dom.querySelectorAll(this._doc, "meta[" + attrSelector + "]");
|
2125 | return list ? [].slice.call(list) : [];
|
2126 | };
|
2127 | Meta.prototype.updateTag = function (tag, selector) {
|
2128 | if (!tag)
|
2129 | return null;
|
2130 | selector = selector || this._parseSelector(tag);
|
2131 | var meta = this.getTag(selector);
|
2132 | if (meta) {
|
2133 | return this._setMetaElementAttributes(tag, meta);
|
2134 | }
|
2135 | return this._getOrCreateElement(tag, true);
|
2136 | };
|
2137 | Meta.prototype.removeTag = function (attrSelector) { this.removeTagElement(this.getTag(attrSelector)); };
|
2138 | Meta.prototype.removeTagElement = function (meta) {
|
2139 | if (meta) {
|
2140 | this._dom.remove(meta);
|
2141 | }
|
2142 | };
|
2143 | Meta.prototype._getOrCreateElement = function (meta, forceCreation) {
|
2144 | if (forceCreation === void 0) { forceCreation = false; }
|
2145 | if (!forceCreation) {
|
2146 | var selector = this._parseSelector(meta);
|
2147 | var elem = this.getTag(selector);
|
2148 |
|
2149 |
|
2150 |
|
2151 | if (elem && this._containsAttributes(meta, elem))
|
2152 | return elem;
|
2153 | }
|
2154 | var element = this._dom.createElement('meta');
|
2155 | this._setMetaElementAttributes(meta, element);
|
2156 | var head = this._dom.getElementsByTagName(this._doc, 'head')[0];
|
2157 | this._dom.appendChild(head, element);
|
2158 | return element;
|
2159 | };
|
2160 | Meta.prototype._setMetaElementAttributes = function (tag, el) {
|
2161 | var _this = this;
|
2162 | Object.keys(tag).forEach(function (prop) { return _this._dom.setAttribute(el, prop, tag[prop]); });
|
2163 | return el;
|
2164 | };
|
2165 | Meta.prototype._parseSelector = function (tag) {
|
2166 | var attr = tag.name ? 'name' : 'property';
|
2167 | return attr + "=\"" + tag[attr] + "\"";
|
2168 | };
|
2169 | Meta.prototype._containsAttributes = function (tag, elem) {
|
2170 | var _this = this;
|
2171 | return Object.keys(tag).every(function (key) { return _this._dom.getAttribute(elem, key) === tag[key]; });
|
2172 | };
|
2173 | Meta.ngInjectableDef = ɵɵdefineInjectable({ factory: createMeta, token: Meta, providedIn: "root" });
|
2174 | Meta = __decorate([
|
2175 | Injectable({ providedIn: 'root', useFactory: createMeta, deps: [] }),
|
2176 | __param(0, Inject(DOCUMENT)),
|
2177 | __metadata("design:paramtypes", [Object])
|
2178 | ], Meta);
|
2179 | return Meta;
|
2180 | }());
|
2181 |
|
2182 |
|
2183 |
|
2184 |
|
2185 | function createTitle() {
|
2186 | return new Title(ɵɵinject(DOCUMENT));
|
2187 | }
|
2188 |
|
2189 |
|
2190 |
|
2191 |
|
2192 |
|
2193 |
|
2194 |
|
2195 |
|
2196 |
|
2197 |
|
2198 | var Title = (function () {
|
2199 | function Title(_doc) {
|
2200 | this._doc = _doc;
|
2201 | }
|
2202 | |
2203 |
|
2204 |
|
2205 | Title.prototype.getTitle = function () { return getDOM().getTitle(this._doc); };
|
2206 | |
2207 |
|
2208 |
|
2209 |
|
2210 | Title.prototype.setTitle = function (newTitle) { getDOM().setTitle(this._doc, newTitle); };
|
2211 | Title.ngInjectableDef = ɵɵdefineInjectable({ factory: createTitle, token: Title, providedIn: "root" });
|
2212 | Title = __decorate([
|
2213 | Injectable({ providedIn: 'root', useFactory: createTitle, deps: [] }),
|
2214 | __param(0, Inject(DOCUMENT)),
|
2215 | __metadata("design:paramtypes", [Object])
|
2216 | ], Title);
|
2217 | return Title;
|
2218 | }());
|
2219 |
|
2220 |
|
2221 |
|
2222 |
|
2223 |
|
2224 |
|
2225 |
|
2226 |
|
2227 | var win = typeof window !== 'undefined' && window || {};
|
2228 |
|
2229 |
|
2230 |
|
2231 |
|
2232 |
|
2233 |
|
2234 |
|
2235 |
|
2236 | var ChangeDetectionPerfRecord = (function () {
|
2237 | function ChangeDetectionPerfRecord(msPerTick, numTicks) {
|
2238 | this.msPerTick = msPerTick;
|
2239 | this.numTicks = numTicks;
|
2240 | }
|
2241 | return ChangeDetectionPerfRecord;
|
2242 | }());
|
2243 |
|
2244 |
|
2245 |
|
2246 |
|
2247 | var AngularProfiler = (function () {
|
2248 | function AngularProfiler(ref) {
|
2249 | this.appRef = ref.injector.get(ApplicationRef);
|
2250 | }
|
2251 |
|
2252 | |
2253 |
|
2254 |
|
2255 |
|
2256 |
|
2257 |
|
2258 |
|
2259 |
|
2260 |
|
2261 |
|
2262 |
|
2263 |
|
2264 |
|
2265 |
|
2266 |
|
2267 |
|
2268 | AngularProfiler.prototype.timeChangeDetection = function (config) {
|
2269 | var record = config && config['record'];
|
2270 | var profileName = 'Change Detection';
|
2271 |
|
2272 | var isProfilerAvailable = win.console.profile != null;
|
2273 | if (record && isProfilerAvailable) {
|
2274 | win.console.profile(profileName);
|
2275 | }
|
2276 | var start = getDOM().performanceNow();
|
2277 | var numTicks = 0;
|
2278 | while (numTicks < 5 || (getDOM().performanceNow() - start) < 500) {
|
2279 | this.appRef.tick();
|
2280 | numTicks++;
|
2281 | }
|
2282 | var end = getDOM().performanceNow();
|
2283 | if (record && isProfilerAvailable) {
|
2284 | win.console.profileEnd(profileName);
|
2285 | }
|
2286 | var msPerTick = (end - start) / numTicks;
|
2287 | win.console.log("ran " + numTicks + " change detection cycles");
|
2288 | win.console.log(msPerTick.toFixed(2) + " ms per check");
|
2289 | return new ChangeDetectionPerfRecord(msPerTick, numTicks);
|
2290 | };
|
2291 | return AngularProfiler;
|
2292 | }());
|
2293 |
|
2294 |
|
2295 |
|
2296 |
|
2297 |
|
2298 |
|
2299 |
|
2300 |
|
2301 | var PROFILER_GLOBAL_NAME = 'profiler';
|
2302 |
|
2303 |
|
2304 |
|
2305 |
|
2306 |
|
2307 |
|
2308 |
|
2309 |
|
2310 |
|
2311 |
|
2312 |
|
2313 |
|
2314 |
|
2315 | function enableDebugTools(ref) {
|
2316 | exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
|
2317 | return ref;
|
2318 | }
|
2319 |
|
2320 |
|
2321 |
|
2322 |
|
2323 |
|
2324 | function disableDebugTools() {
|
2325 | exportNgVar(PROFILER_GLOBAL_NAME, null);
|
2326 | }
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 |
|
2332 |
|
2333 |
|
2334 |
|
2335 | function escapeHtml(text) {
|
2336 | var escapedText = {
|
2337 | '&': '&a;',
|
2338 | '"': '&q;',
|
2339 | '\'': '&s;',
|
2340 | '<': '&l;',
|
2341 | '>': '&g;',
|
2342 | };
|
2343 | return text.replace(/[&"'<>]/g, function (s) { return escapedText[s]; });
|
2344 | }
|
2345 | function unescapeHtml(text) {
|
2346 | var unescapedText = {
|
2347 | '&a;': '&',
|
2348 | '&q;': '"',
|
2349 | '&s;': '\'',
|
2350 | '&l;': '<',
|
2351 | '&g;': '>',
|
2352 | };
|
2353 | return text.replace(/&[^;]+;/g, function (s) { return unescapedText[s]; });
|
2354 | }
|
2355 |
|
2356 |
|
2357 |
|
2358 |
|
2359 |
|
2360 |
|
2361 |
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 |
|
2367 |
|
2368 |
|
2369 | function makeStateKey(key) {
|
2370 | return key;
|
2371 | }
|
2372 |
|
2373 |
|
2374 |
|
2375 |
|
2376 |
|
2377 |
|
2378 |
|
2379 |
|
2380 |
|
2381 |
|
2382 |
|
2383 |
|
2384 |
|
2385 | var TransferState = (function () {
|
2386 | function TransferState() {
|
2387 | this.store = {};
|
2388 | this.onSerializeCallbacks = {};
|
2389 | }
|
2390 | TransferState_1 = TransferState;
|
2391 |
|
2392 | TransferState.init = function (initState) {
|
2393 | var transferState = new TransferState_1();
|
2394 | transferState.store = initState;
|
2395 | return transferState;
|
2396 | };
|
2397 | |
2398 |
|
2399 |
|
2400 | TransferState.prototype.get = function (key, defaultValue) {
|
2401 | return this.store[key] !== undefined ? this.store[key] : defaultValue;
|
2402 | };
|
2403 | |
2404 |
|
2405 |
|
2406 | TransferState.prototype.set = function (key, value) { this.store[key] = value; };
|
2407 | |
2408 |
|
2409 |
|
2410 | TransferState.prototype.remove = function (key) { delete this.store[key]; };
|
2411 | |
2412 |
|
2413 |
|
2414 | TransferState.prototype.hasKey = function (key) { return this.store.hasOwnProperty(key); };
|
2415 | |
2416 |
|
2417 |
|
2418 | TransferState.prototype.onSerialize = function (key, callback) {
|
2419 | this.onSerializeCallbacks[key] = callback;
|
2420 | };
|
2421 | |
2422 |
|
2423 |
|
2424 | TransferState.prototype.toJson = function () {
|
2425 |
|
2426 | for (var key in this.onSerializeCallbacks) {
|
2427 | if (this.onSerializeCallbacks.hasOwnProperty(key)) {
|
2428 | try {
|
2429 | this.store[key] = this.onSerializeCallbacks[key]();
|
2430 | }
|
2431 | catch (e) {
|
2432 | console.warn('Exception in onSerialize callback: ', e);
|
2433 | }
|
2434 | }
|
2435 | }
|
2436 | return JSON.stringify(this.store);
|
2437 | };
|
2438 | var TransferState_1;
|
2439 | TransferState = TransferState_1 = __decorate([
|
2440 | Injectable()
|
2441 | ], TransferState);
|
2442 | return TransferState;
|
2443 | }());
|
2444 | function initTransferState(doc, appId) {
|
2445 |
|
2446 |
|
2447 | var script = doc.getElementById(appId + '-state');
|
2448 | var initialState = {};
|
2449 | if (script && script.textContent) {
|
2450 | try {
|
2451 | initialState = JSON.parse(unescapeHtml(script.textContent));
|
2452 | }
|
2453 | catch (e) {
|
2454 | console.warn('Exception while restoring TransferState for app ' + appId, e);
|
2455 | }
|
2456 | }
|
2457 | return TransferState.init(initialState);
|
2458 | }
|
2459 |
|
2460 |
|
2461 |
|
2462 |
|
2463 |
|
2464 |
|
2465 | var BrowserTransferStateModule = (function () {
|
2466 | function BrowserTransferStateModule() {
|
2467 | }
|
2468 | BrowserTransferStateModule = __decorate([
|
2469 | NgModule({
|
2470 | providers: [{ provide: TransferState, useFactory: initTransferState, deps: [DOCUMENT, APP_ID] }],
|
2471 | })
|
2472 | ], BrowserTransferStateModule);
|
2473 | return BrowserTransferStateModule;
|
2474 | }());
|
2475 |
|
2476 |
|
2477 |
|
2478 |
|
2479 |
|
2480 |
|
2481 |
|
2482 |
|
2483 |
|
2484 |
|
2485 |
|
2486 |
|
2487 |
|
2488 | var By = (function () {
|
2489 | function By() {
|
2490 | }
|
2491 | |
2492 |
|
2493 |
|
2494 |
|
2495 |
|
2496 |
|
2497 |
|
2498 |
|
2499 | By.all = function () { return function () { return true; }; };
|
2500 | |
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 |
|
2506 |
|
2507 |
|
2508 | By.css = function (selector) {
|
2509 | return function (debugElement) {
|
2510 | return debugElement.nativeElement != null ?
|
2511 | getDOM().elementMatches(debugElement.nativeElement, selector) :
|
2512 | false;
|
2513 | };
|
2514 | };
|
2515 | |
2516 |
|
2517 |
|
2518 |
|
2519 |
|
2520 |
|
2521 |
|
2522 |
|
2523 | By.directive = function (type) {
|
2524 | return function (debugNode) { return debugNode.providerTokens.indexOf(type) !== -1; };
|
2525 | };
|
2526 | return By;
|
2527 | }());
|
2528 |
|
2529 |
|
2530 |
|
2531 |
|
2532 |
|
2533 |
|
2534 |
|
2535 |
|
2536 |
|
2537 |
|
2538 |
|
2539 |
|
2540 |
|
2541 |
|
2542 |
|
2543 |
|
2544 |
|
2545 |
|
2546 |
|
2547 | var VERSION = new Version('8.2.12');
|
2548 |
|
2549 |
|
2550 |
|
2551 |
|
2552 |
|
2553 |
|
2554 |
|
2555 |
|
2556 |
|
2557 |
|
2558 |
|
2559 |
|
2560 |
|
2561 |
|
2562 |
|
2563 |
|
2564 |
|
2565 |
|
2566 |
|
2567 |
|
2568 |
|
2569 |
|
2570 |
|
2571 |
|
2572 |
|
2573 |
|
2574 |
|
2575 |
|
2576 |
|
2577 |
|
2578 | export { BROWSER_MODULE_PROVIDERS as ɵangular_packages_platform_browser_platform_browser_c, _document as ɵangular_packages_platform_browser_platform_browser_b, errorHandler as ɵangular_packages_platform_browser_platform_browser_a, GenericBrowserDomAdapter as ɵangular_packages_platform_browser_platform_browser_l, createMeta as ɵangular_packages_platform_browser_platform_browser_d, SERVER_TRANSITION_PROVIDERS as ɵangular_packages_platform_browser_platform_browser_i, appInitializerFactory as ɵangular_packages_platform_browser_platform_browser_h, createTitle as ɵangular_packages_platform_browser_platform_browser_e, initTransferState as ɵangular_packages_platform_browser_platform_browser_f, ELEMENT_PROBE_PROVIDERS__PRE_R3__ as ɵangular_packages_platform_browser_platform_browser_k, _createNgProbe as ɵangular_packages_platform_browser_platform_browser_j, EventManagerPlugin as ɵangular_packages_platform_browser_platform_browser_g, BrowserModule, platformBrowser, Meta, Title, disableDebugTools, enableDebugTools, BrowserTransferStateModule, TransferState, makeStateKey, By, EVENT_MANAGER_PLUGINS, EventManager, HAMMER_GESTURE_CONFIG, HAMMER_LOADER, HammerGestureConfig, DomSanitizer, VERSION, ELEMENT_PROBE_PROVIDERS__POST_R3__ as ɵELEMENT_PROBE_PROVIDERS__POST_R3__, BROWSER_SANITIZATION_PROVIDERS as ɵBROWSER_SANITIZATION_PROVIDERS, INTERNAL_BROWSER_PLATFORM_PROVIDERS as ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS, initDomAdapter as ɵinitDomAdapter, BrowserDomAdapter as ɵBrowserDomAdapter, BrowserPlatformLocation as ɵBrowserPlatformLocation, TRANSITION_ID as ɵTRANSITION_ID, BrowserGetTestability as ɵBrowserGetTestability, escapeHtml as ɵescapeHtml, ELEMENT_PROBE_PROVIDERS as ɵELEMENT_PROBE_PROVIDERS, DomAdapter as ɵDomAdapter, getDOM as ɵgetDOM, setRootDomAdapter as ɵsetRootDomAdapter, DomRendererFactory2 as ɵDomRendererFactory2, NAMESPACE_URIS as ɵNAMESPACE_URIS, flattenStyles as ɵflattenStyles, shimContentAttribute as ɵshimContentAttribute, shimHostAttribute as ɵshimHostAttribute, DomEventsPlugin as ɵDomEventsPlugin, HammerGesturesPlugin as ɵHammerGesturesPlugin, KeyEventsPlugin as ɵKeyEventsPlugin, DomSharedStylesHost as ɵDomSharedStylesHost, SharedStylesHost as ɵSharedStylesHost, DomSanitizerImpl as ɵDomSanitizerImpl };
|
2579 |
|