/**
* @license Angular v5.2.11
* (c) 2010-2018 Google, Inc. https://angular.io/
* License: MIT
*/
import { CommonModule, DOCUMENT, PlatformLocation, ɵPLATFORM_BROWSER_ID, ɵparseCookieValue } from '@angular/common';
import { APP_ID, APP_INITIALIZER, ApplicationInitStatus, ApplicationModule, ApplicationRef, ErrorHandler, Inject, Injectable, InjectionToken, Injector, NgModule, NgProbeToken, NgZone, Optional, PLATFORM_ID, PLATFORM_INITIALIZER, RendererFactory2, RendererStyleFlags2, Sanitizer, SecurityContext, SkipSelf, Testability, Version, ViewEncapsulation, createPlatformFactory, getDebugNode, isDevMode, platformCore, setTestabilityGetter, ɵglobal } from '@angular/core';
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
let _DOM = /** @type {?} */ ((null));
/**
* @return {?}
*/
function getDOM() {
return _DOM;
}
/**
* @param {?} adapter
* @return {?}
*/
/**
* @param {?} adapter
* @return {?}
*/
function setRootDomAdapter(adapter) {
if (!_DOM) {
_DOM = adapter;
}
}
/**
* Provides DOM operations in an environment-agnostic way.
*
* \@security Tread carefully! Interacting with the DOM directly is dangerous and
* can introduce XSS risks.
* @abstract
*/
class DomAdapter {
constructor() {
this.resourceLoaderType = /** @type {?} */ ((null));
}
/**
* Maps attribute names to their corresponding property names for cases
* where attribute name doesn't match property name.
* @return {?}
*/
get attrToPropMap() { return this._attrToPropMap; }
/**
* @param {?} value
* @return {?}
*/
set attrToPropMap(value) { this._attrToPropMap = value; }
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* Provides DOM operations in any browser environment.
*
* \@security Tread carefully! Interacting with the DOM directly is dangerous and
* can introduce XSS risks.
* @abstract
*/
class GenericBrowserDomAdapter extends DomAdapter {
constructor() {
super();
this._animationPrefix = null;
this._transitionEnd = null;
try {
const /** @type {?} */ element = this.createElement('div', document);
if (this.getStyle(element, 'animationName') != null) {
this._animationPrefix = '';
}
else {
const /** @type {?} */ domPrefixes = ['Webkit', 'Moz', 'O', 'ms'];
for (let /** @type {?} */ i = 0; i < domPrefixes.length; i++) {
if (this.getStyle(element, domPrefixes[i] + 'AnimationName') != null) {
this._animationPrefix = '-' + domPrefixes[i].toLowerCase() + '-';
break;
}
}
}
const /** @type {?} */ transEndEventNames = {
WebkitTransition: 'webkitTransitionEnd',
MozTransition: 'transitionend',
OTransition: 'oTransitionEnd otransitionend',
transition: 'transitionend'
};
Object.keys(transEndEventNames).forEach((key) => {
if (this.getStyle(element, key) != null) {
this._transitionEnd = transEndEventNames[key];
}
});
}
catch (/** @type {?} */ e) {
this._animationPrefix = null;
this._transitionEnd = null;
}
}
/**
* @param {?} el
* @return {?}
*/
getDistributedNodes(el) { return (/** @type {?} */ (el)).getDistributedNodes(); }
/**
* @param {?} el
* @param {?} baseUrl
* @param {?} href
* @return {?}
*/
resolveAndSetHref(el, baseUrl, href) {
el.href = href == null ? baseUrl : baseUrl + '/../' + href;
}
/**
* @return {?}
*/
supportsDOMEvents() { return true; }
/**
* @return {?}
*/
supportsNativeShadowDOM() {
return typeof (/** @type {?} */ (document.body)).createShadowRoot === 'function';
}
/**
* @return {?}
*/
getAnimationPrefix() { return this._animationPrefix ? this._animationPrefix : ''; }
/**
* @return {?}
*/
getTransitionEnd() { return this._transitionEnd ? this._transitionEnd : ''; }
/**
* @return {?}
*/
supportsAnimation() {
return this._animationPrefix != null && this._transitionEnd != null;
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const _attrToPropMap = {
'class': 'className',
'innerHtml': 'innerHTML',
'readonly': 'readOnly',
'tabindex': 'tabIndex',
};
const DOM_KEY_LOCATION_NUMPAD = 3;
// Map to convert some key or keyIdentifier values to what will be returned by getEventKey
const _keyMap = {
// The following values are here for cross-browser compatibility and to match the W3C standard
// cf http://www.w3.org/TR/DOM-Level-3-Events-key/
'\b': 'Backspace',
'\t': 'Tab',
'\x7F': 'Delete',
'\x1B': 'Escape',
'Del': 'Delete',
'Esc': 'Escape',
'Left': 'ArrowLeft',
'Right': 'ArrowRight',
'Up': 'ArrowUp',
'Down': 'ArrowDown',
'Menu': 'ContextMenu',
'Scroll': 'ScrollLock',
'Win': 'OS'
};
// There is a bug in Chrome for numeric keypad keys:
// https://code.google.com/p/chromium/issues/detail?id=155654
// 1, 2, 3 ... are reported as A, B, C ...
const _chromeNumKeyPadMap = {
'A': '1',
'B': '2',
'C': '3',
'D': '4',
'E': '5',
'F': '6',
'G': '7',
'H': '8',
'I': '9',
'J': '*',
'K': '+',
'M': '-',
'N': '.',
'O': '/',
'\x60': '0',
'\x90': 'NumLock'
};
let nodeContains;
if (ɵglobal['Node']) {
nodeContains = ɵglobal['Node'].prototype.contains || function (node) {
return !!(this.compareDocumentPosition(node) & 16);
};
}
/**
* A `DomAdapter` powered by full browser DOM APIs.
*
* \@security Tread carefully! Interacting with the DOM directly is dangerous and
* can introduce XSS risks.
*/
class BrowserDomAdapter extends GenericBrowserDomAdapter {
/**
* @param {?} templateHtml
* @return {?}
*/
parse(templateHtml) { throw new Error('parse not implemented'); }
/**
* @return {?}
*/
static makeCurrent() { setRootDomAdapter(new BrowserDomAdapter()); }
/**
* @param {?} element
* @param {?} name
* @return {?}
*/
hasProperty(element, name) { return name in element; }
/**
* @param {?} el
* @param {?} name
* @param {?} value
* @return {?}
*/
setProperty(el, name, value) { (/** @type {?} */ (el))[name] = value; }
/**
* @param {?} el
* @param {?} name
* @return {?}
*/
getProperty(el, name) { return (/** @type {?} */ (el))[name]; }
/**
* @param {?} el
* @param {?} methodName
* @param {?} args
* @return {?}
*/
invoke(el, methodName, args) { (/** @type {?} */ (el))[methodName](...args); }
/**
* @param {?} error
* @return {?}
*/
logError(error) {
if (window.console) {
if (console.error) {
console.error(error);
}
else {
console.log(error);
}
}
}
/**
* @param {?} error
* @return {?}
*/
log(error) {
if (window.console) {
window.console.log && window.console.log(error);
}
}
/**
* @param {?} error
* @return {?}
*/
logGroup(error) {
if (window.console) {
window.console.group && window.console.group(error);
}
}
/**
* @return {?}
*/
logGroupEnd() {
if (window.console) {
window.console.groupEnd && window.console.groupEnd();
}
}
/**
* @return {?}
*/
get attrToPropMap() { return _attrToPropMap; }
/**
* @param {?} nodeA
* @param {?} nodeB
* @return {?}
*/
contains(nodeA, nodeB) { return nodeContains.call(nodeA, nodeB); }
/**
* @param {?} el
* @param {?} selector
* @return {?}
*/
querySelector(el, selector) { return el.querySelector(selector); }
/**
* @param {?} el
* @param {?} selector
* @return {?}
*/
querySelectorAll(el, selector) { return el.querySelectorAll(selector); }
/**
* @param {?} el
* @param {?} evt
* @param {?} listener
* @return {?}
*/
on(el, evt, listener) { el.addEventListener(evt, listener, false); }
/**
* @param {?} el
* @param {?} evt
* @param {?} listener
* @return {?}
*/
onAndCancel(el, evt, listener) {
el.addEventListener(evt, listener, false);
// Needed to follow Dart's subscription semantic, until fix of
// https://code.google.com/p/dart/issues/detail?id=17406
return () => { el.removeEventListener(evt, listener, false); };
}
/**
* @param {?} el
* @param {?} evt
* @return {?}
*/
dispatchEvent(el, evt) { el.dispatchEvent(evt); }
/**
* @param {?} eventType
* @return {?}
*/
createMouseEvent(eventType) {
const /** @type {?} */ evt = this.getDefaultDocument().createEvent('MouseEvent');
evt.initEvent(eventType, true, true);
return evt;
}
/**
* @param {?} eventType
* @return {?}
*/
createEvent(eventType) {
const /** @type {?} */ evt = this.getDefaultDocument().createEvent('Event');
evt.initEvent(eventType, true, true);
return evt;
}
/**
* @param {?} evt
* @return {?}
*/
preventDefault(evt) {
evt.preventDefault();
evt.returnValue = false;
}
/**
* @param {?} evt
* @return {?}
*/
isPrevented(evt) {
return evt.defaultPrevented || evt.returnValue != null && !evt.returnValue;
}
/**
* @param {?} el
* @return {?}
*/
getInnerHTML(el) { return el.innerHTML; }
/**
* @param {?} el
* @return {?}
*/
getTemplateContent(el) {
return 'content' in el && this.isTemplateElement(el) ? (/** @type {?} */ (el)).content : null;
}
/**
* @param {?} el
* @return {?}
*/
getOuterHTML(el) { return el.outerHTML; }
/**
* @param {?} node
* @return {?}
*/
nodeName(node) { return node.nodeName; }
/**
* @param {?} node
* @return {?}
*/
nodeValue(node) { return node.nodeValue; }
/**
* @param {?} node
* @return {?}
*/
type(node) { return node.type; }
/**
* @param {?} node
* @return {?}
*/
content(node) {
if (this.hasProperty(node, 'content')) {
return (/** @type {?} */ (node)).content;
}
else {
return node;
}
}
/**
* @param {?} el
* @return {?}
*/
firstChild(el) { return el.firstChild; }
/**
* @param {?} el
* @return {?}
*/
nextSibling(el) { return el.nextSibling; }
/**
* @param {?} el
* @return {?}
*/
parentElement(el) { return el.parentNode; }
/**
* @param {?} el
* @return {?}
*/
childNodes(el) { return el.childNodes; }
/**
* @param {?} el
* @return {?}
*/
childNodesAsList(el) {
const /** @type {?} */ childNodes = el.childNodes;
const /** @type {?} */ res = new Array(childNodes.length);
for (let /** @type {?} */ i = 0; i < childNodes.length; i++) {
res[i] = childNodes[i];
}
return res;
}
/**
* @param {?} el
* @return {?}
*/
clearNodes(el) {
while (el.firstChild) {
el.removeChild(el.firstChild);
}
}
/**
* @param {?} el
* @param {?} node
* @return {?}
*/
appendChild(el, node) { el.appendChild(node); }
/**
* @param {?} el
* @param {?} node
* @return {?}
*/
removeChild(el, node) { el.removeChild(node); }
/**
* @param {?} el
* @param {?} newChild
* @param {?} oldChild
* @return {?}
*/
replaceChild(el, newChild, oldChild) { el.replaceChild(newChild, oldChild); }
/**
* @param {?} node
* @return {?}
*/
remove(node) {
if (node.parentNode) {
node.parentNode.removeChild(node);
}
return node;
}
/**
* @param {?} parent
* @param {?} ref
* @param {?} node
* @return {?}
*/
insertBefore(parent, ref, node) { parent.insertBefore(node, ref); }
/**
* @param {?} parent
* @param {?} ref
* @param {?} nodes
* @return {?}
*/
insertAllBefore(parent, ref, nodes) {
nodes.forEach((n) => parent.insertBefore(n, ref));
}
/**
* @param {?} parent
* @param {?} ref
* @param {?} node
* @return {?}
*/
insertAfter(parent, ref, node) { parent.insertBefore(node, ref.nextSibling); }
/**
* @param {?} el
* @param {?} value
* @return {?}
*/
setInnerHTML(el, value) { el.innerHTML = value; }
/**
* @param {?} el
* @return {?}
*/
getText(el) { return el.textContent; }
/**
* @param {?} el
* @param {?} value
* @return {?}
*/
setText(el, value) { el.textContent = value; }
/**
* @param {?} el
* @return {?}
*/
getValue(el) { return el.value; }
/**
* @param {?} el
* @param {?} value
* @return {?}
*/
setValue(el, value) { el.value = value; }
/**
* @param {?} el
* @return {?}
*/
getChecked(el) { return el.checked; }
/**
* @param {?} el
* @param {?} value
* @return {?}
*/
setChecked(el, value) { el.checked = value; }
/**
* @param {?} text
* @return {?}
*/
createComment(text) { return this.getDefaultDocument().createComment(text); }
/**
* @param {?} html
* @return {?}
*/
createTemplate(html) {
const /** @type {?} */ t = this.getDefaultDocument().createElement('template');
t.innerHTML = html;
return t;
}
/**
* @param {?} tagName
* @param {?=} doc
* @return {?}
*/
createElement(tagName, doc) {
doc = doc || this.getDefaultDocument();
return doc.createElement(tagName);
}
/**
* @param {?} ns
* @param {?} tagName
* @param {?=} doc
* @return {?}
*/
createElementNS(ns, tagName, doc) {
doc = doc || this.getDefaultDocument();
return doc.createElementNS(ns, tagName);
}
/**
* @param {?} text
* @param {?=} doc
* @return {?}
*/
createTextNode(text, doc) {
doc = doc || this.getDefaultDocument();
return doc.createTextNode(text);
}
/**
* @param {?} attrName
* @param {?} attrValue
* @param {?=} doc
* @return {?}
*/
createScriptTag(attrName, attrValue, doc) {
doc = doc || this.getDefaultDocument();
const /** @type {?} */ el = /** @type {?} */ (doc.createElement('SCRIPT'));
el.setAttribute(attrName, attrValue);
return el;
}
/**
* @param {?} css
* @param {?=} doc
* @return {?}
*/
createStyleElement(css, doc) {
doc = doc || this.getDefaultDocument();
const /** @type {?} */ style = /** @type {?} */ (doc.createElement('style'));
this.appendChild(style, this.createTextNode(css, doc));
return style;
}
/**
* @param {?} el
* @return {?}
*/
createShadowRoot(el) { return (/** @type {?} */ (el)).createShadowRoot(); }
/**
* @param {?} el
* @return {?}
*/
getShadowRoot(el) { return (/** @type {?} */ (el)).shadowRoot; }
/**
* @param {?} el
* @return {?}
*/
getHost(el) { return (/** @type {?} */ (el)).host; }
/**
* @param {?} node
* @return {?}
*/
clone(node) { return node.cloneNode(true); }
/**
* @param {?} element
* @param {?} name
* @return {?}
*/
getElementsByClassName(element, name) {
return element.getElementsByClassName(name);
}
/**
* @param {?} element
* @param {?} name
* @return {?}
*/
getElementsByTagName(element, name) {
return element.getElementsByTagName(name);
}
/**
* @param {?} element
* @return {?}
*/
classList(element) { return Array.prototype.slice.call(element.classList, 0); }
/**
* @param {?} element
* @param {?} className
* @return {?}
*/
addClass(element, className) { element.classList.add(className); }
/**
* @param {?} element
* @param {?} className
* @return {?}
*/
removeClass(element, className) { element.classList.remove(className); }
/**
* @param {?} element
* @param {?} className
* @return {?}
*/
hasClass(element, className) {
return element.classList.contains(className);
}
/**
* @param {?} element
* @param {?} styleName
* @param {?} styleValue
* @return {?}
*/
setStyle(element, styleName, styleValue) {
element.style[styleName] = styleValue;
}
/**
* @param {?} element
* @param {?} stylename
* @return {?}
*/
removeStyle(element, stylename) {
// IE requires '' instead of null
// see https://github.com/angular/angular/issues/7916
element.style[stylename] = '';
}
/**
* @param {?} element
* @param {?} stylename
* @return {?}
*/
getStyle(element, stylename) { return element.style[stylename]; }
/**
* @param {?} element
* @param {?} styleName
* @param {?=} styleValue
* @return {?}
*/
hasStyle(element, styleName, styleValue) {
const /** @type {?} */ value = this.getStyle(element, styleName) || '';
return styleValue ? value == styleValue : value.length > 0;
}
/**
* @param {?} element
* @return {?}
*/
tagName(element) { return element.tagName; }
/**
* @param {?} element
* @return {?}
*/
attributeMap(element) {
const /** @type {?} */ res = new Map();
const /** @type {?} */ elAttrs = element.attributes;
for (let /** @type {?} */ i = 0; i < elAttrs.length; i++) {
const /** @type {?} */ attrib = elAttrs.item(i);
res.set(attrib.name, attrib.value);
}
return res;
}
/**
* @param {?} element
* @param {?} attribute
* @return {?}
*/
hasAttribute(element, attribute) {
return element.hasAttribute(attribute);
}
/**
* @param {?} element
* @param {?} ns
* @param {?} attribute
* @return {?}
*/
hasAttributeNS(element, ns, attribute) {
return element.hasAttributeNS(ns, attribute);
}
/**
* @param {?} element
* @param {?} attribute
* @return {?}
*/
getAttribute(element, attribute) {
return element.getAttribute(attribute);
}
/**
* @param {?} element
* @param {?} ns
* @param {?} name
* @return {?}
*/
getAttributeNS(element, ns, name) {
return element.getAttributeNS(ns, name);
}
/**
* @param {?} element
* @param {?} name
* @param {?} value
* @return {?}
*/
setAttribute(element, name, value) { element.setAttribute(name, value); }
/**
* @param {?} element
* @param {?} ns
* @param {?} name
* @param {?} value
* @return {?}
*/
setAttributeNS(element, ns, name, value) {
element.setAttributeNS(ns, name, value);
}
/**
* @param {?} element
* @param {?} attribute
* @return {?}
*/
removeAttribute(element, attribute) { element.removeAttribute(attribute); }
/**
* @param {?} element
* @param {?} ns
* @param {?} name
* @return {?}
*/
removeAttributeNS(element, ns, name) {
element.removeAttributeNS(ns, name);
}
/**
* @param {?} el
* @return {?}
*/
templateAwareRoot(el) { return this.isTemplateElement(el) ? this.content(el) : el; }
/**
* @return {?}
*/
createHtmlDocument() {
return document.implementation.createHTMLDocument('fakeTitle');
}
/**
* @return {?}
*/
getDefaultDocument() { return document; }
/**
* @param {?} el
* @return {?}
*/
getBoundingClientRect(el) {
try {
return el.getBoundingClientRect();
}
catch (/** @type {?} */ e) {
return { top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0 };
}
}
/**
* @param {?} doc
* @return {?}
*/
getTitle(doc) { return doc.title; }
/**
* @param {?} doc
* @param {?} newTitle
* @return {?}
*/
setTitle(doc, newTitle) { doc.title = newTitle || ''; }
/**
* @param {?} n
* @param {?} selector
* @return {?}
*/
elementMatches(n, selector) {
if (this.isElementNode(n)) {
return n.matches && n.matches(selector) ||
n.msMatchesSelector && n.msMatchesSelector(selector) ||
n.webkitMatchesSelector && n.webkitMatchesSelector(selector);
}
return false;
}
/**
* @param {?} el
* @return {?}
*/
isTemplateElement(el) {
return this.isElementNode(el) && el.nodeName === 'TEMPLATE';
}
/**
* @param {?} node
* @return {?}
*/
isTextNode(node) { return node.nodeType === Node.TEXT_NODE; }
/**
* @param {?} node
* @return {?}
*/
isCommentNode(node) { return node.nodeType === Node.COMMENT_NODE; }
/**
* @param {?} node
* @return {?}
*/
isElementNode(node) { return node.nodeType === Node.ELEMENT_NODE; }
/**
* @param {?} node
* @return {?}
*/
hasShadowRoot(node) {
return node.shadowRoot != null && node instanceof HTMLElement;
}
/**
* @param {?} node
* @return {?}
*/
isShadowRoot(node) { return node instanceof DocumentFragment; }
/**
* @param {?} node
* @return {?}
*/
importIntoDoc(node) { return document.importNode(this.templateAwareRoot(node), true); }
/**
* @param {?} node
* @return {?}
*/
adoptNode(node) { return document.adoptNode(node); }
/**
* @param {?} el
* @return {?}
*/
getHref(el) { return /** @type {?} */ ((el.getAttribute('href'))); }
/**
* @param {?} event
* @return {?}
*/
getEventKey(event) {
let /** @type {?} */ key = event.key;
if (key == null) {
key = event.keyIdentifier;
// keyIdentifier is defined in the old draft of DOM Level 3 Events implemented by Chrome and
// Safari cf
// http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/events.html#Events-KeyboardEvents-Interfaces
if (key == null) {
return 'Unidentified';
}
if (key.startsWith('U+')) {
key = String.fromCharCode(parseInt(key.substring(2), 16));
if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) {
// There is a bug in Chrome for numeric keypad keys:
// https://code.google.com/p/chromium/issues/detail?id=155654
// 1, 2, 3 ... are reported as A, B, C ...
key = (/** @type {?} */ (_chromeNumKeyPadMap))[key];
}
}
}
return _keyMap[key] || key;
}
/**
* @param {?} doc
* @param {?} target
* @return {?}
*/
getGlobalEventTarget(doc, target) {
if (target === 'window') {
return window;
}
if (target === 'document') {
return doc;
}
if (target === 'body') {
return doc.body;
}
return null;
}
/**
* @return {?}
*/
getHistory() { return window.history; }
/**
* @return {?}
*/
getLocation() { return window.location; }
/**
* @param {?} doc
* @return {?}
*/
getBaseHref(doc) {
const /** @type {?} */ href = getBaseElementHref();
return href == null ? null : relativePath(href);
}
/**
* @return {?}
*/
resetBaseElement() { baseElement = null; }
/**
* @return {?}
*/
getUserAgent() { return window.navigator.userAgent; }
/**
* @param {?} element
* @param {?} name
* @param {?} value
* @return {?}
*/
setData(element, name, value) {
this.setAttribute(element, 'data-' + name, value);
}
/**
* @param {?} element
* @param {?} name
* @return {?}
*/
getData(element, name) {
return this.getAttribute(element, 'data-' + name);
}
/**
* @param {?} element
* @return {?}
*/
getComputedStyle(element) { return getComputedStyle(element); }
/**
* @return {?}
*/
supportsWebAnimation() {
return typeof (/** @type {?} */ (Element)).prototype['animate'] === 'function';
}
/**
* @return {?}
*/
performanceNow() {
// performance.now() is not available in all browsers, see
// http://caniuse.com/#search=performance.now
return window.performance && window.performance.now ? window.performance.now() :
new Date().getTime();
}
/**
* @return {?}
*/
supportsCookies() { return true; }
/**
* @param {?} name
* @return {?}
*/
getCookie(name) { return ɵparseCookieValue(document.cookie, name); }
/**
* @param {?} name
* @param {?} value
* @return {?}
*/
setCookie(name, value) {
// document.cookie is magical, assigning into it assigns/overrides one cookie value, but does
// not clear other cookies.
document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value);
}
}
let baseElement = null;
/**
* @return {?}
*/
function getBaseElementHref() {
if (!baseElement) {
baseElement = /** @type {?} */ ((document.querySelector('base')));
if (!baseElement) {
return null;
}
}
return baseElement.getAttribute('href');
}
// based on urlUtils.js in AngularJS 1
let urlParsingNode;
/**
* @param {?} url
* @return {?}
*/
function relativePath(url) {
if (!urlParsingNode) {
urlParsingNode = document.createElement('a');
}
urlParsingNode.setAttribute('href', url);
return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname :
'/' + urlParsingNode.pathname;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A DI Token representing the main rendering context. In a browser this is the DOM Document.
*
* Note: Document might not be available in the Application Context when Application and Rendering
* Contexts are not the same (e.g. when running the application into a Web Worker).
*
* @deprecated import from `\@angular/common` instead.
*/
const DOCUMENT$1 = DOCUMENT;
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @return {?}
*/
function supportsState() {
return !!window.history.pushState;
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* `PlatformLocation` encapsulates all of the direct calls to platform APIs.
* This class should not be used directly by an application developer. Instead, use
* {\@link Location}.
*/
class BrowserPlatformLocation extends PlatformLocation {
/**
* @param {?} _doc
*/
constructor(_doc) {
super();
this._doc = _doc;
this._init();
}
/**
* \@internal
* @return {?}
*/
_init() {
(/** @type {?} */ (this)).location = getDOM().getLocation();
this._history = getDOM().getHistory();
}
/**
* @return {?}
*/
getBaseHrefFromDOM() { return /** @type {?} */ ((getDOM().getBaseHref(this._doc))); }
/**
* @param {?} fn
* @return {?}
*/
onPopState(fn) {
getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('popstate', fn, false);
}
/**
* @param {?} fn
* @return {?}
*/
onHashChange(fn) {
getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('hashchange', fn, false);
}
/**
* @return {?}
*/
get pathname() { return this.location.pathname; }
/**
* @return {?}
*/
get search() { return this.location.search; }
/**
* @return {?}
*/
get hash() { return this.location.hash; }
/**
* @param {?} newPath
* @return {?}
*/
set pathname(newPath) { this.location.pathname = newPath; }
/**
* @param {?} state
* @param {?} title
* @param {?} url
* @return {?}
*/
pushState(state, title, url) {
if (supportsState()) {
this._history.pushState(state, title, url);
}
else {
this.location.hash = url;
}
}
/**
* @param {?} state
* @param {?} title
* @param {?} url
* @return {?}
*/
replaceState(state, title, url) {
if (supportsState()) {
this._history.replaceState(state, title, url);
}
else {
this.location.hash = url;
}
}
/**
* @return {?}
*/
forward() { this._history.forward(); }
/**
* @return {?}
*/
back() { this._history.back(); }
}
BrowserPlatformLocation.decorators = [
{ type: Injectable },
];
/** @nocollapse */
BrowserPlatformLocation.ctorParameters = () => [
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT$1,] },] },
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A service that can be used to get and add meta tags.
*
* \@experimental
*/
class Meta {
/**
* @param {?} _doc
*/
constructor(_doc) {
this._doc = _doc;
this._dom = getDOM();
}
/**
* @param {?} tag
* @param {?=} forceCreation
* @return {?}
*/
addTag(tag, forceCreation = false) {
if (!tag)
return null;
return this._getOrCreateElement(tag, forceCreation);
}
/**
* @param {?} tags
* @param {?=} forceCreation
* @return {?}
*/
addTags(tags, forceCreation = false) {
if (!tags)
return [];
return tags.reduce((result, tag) => {
if (tag) {
result.push(this._getOrCreateElement(tag, forceCreation));
}
return result;
}, []);
}
/**
* @param {?} attrSelector
* @return {?}
*/
getTag(attrSelector) {
if (!attrSelector)
return null;
return this._dom.querySelector(this._doc, `meta[${attrSelector}]`) || null;
}
/**
* @param {?} attrSelector
* @return {?}
*/
getTags(attrSelector) {
if (!attrSelector)
return [];
const /** @type {?} */ list = this._dom.querySelectorAll(this._doc, `meta[${attrSelector}]`);
return list ? [].slice.call(list) : [];
}
/**
* @param {?} tag
* @param {?=} selector
* @return {?}
*/
updateTag(tag, selector) {
if (!tag)
return null;
selector = selector || this._parseSelector(tag);
const /** @type {?} */ meta = /** @type {?} */ ((this.getTag(selector)));
if (meta) {
return this._setMetaElementAttributes(tag, meta);
}
return this._getOrCreateElement(tag, true);
}
/**
* @param {?} attrSelector
* @return {?}
*/
removeTag(attrSelector) { this.removeTagElement(/** @type {?} */ ((this.getTag(attrSelector)))); }
/**
* @param {?} meta
* @return {?}
*/
removeTagElement(meta) {
if (meta) {
this._dom.remove(meta);
}
}
/**
* @param {?} meta
* @param {?=} forceCreation
* @return {?}
*/
_getOrCreateElement(meta, forceCreation = false) {
if (!forceCreation) {
const /** @type {?} */ selector = this._parseSelector(meta);
const /** @type {?} */ elem = /** @type {?} */ ((this.getTag(selector)));
// It's allowed to have multiple elements with the same name so it's not enough to
// just check that element with the same name already present on the page. We also need to
// check if element has tag attributes
if (elem && this._containsAttributes(meta, elem))
return elem;
}
const /** @type {?} */ element = /** @type {?} */ (this._dom.createElement('meta'));
this._setMetaElementAttributes(meta, element);
const /** @type {?} */ head = this._dom.getElementsByTagName(this._doc, 'head')[0];
this._dom.appendChild(head, element);
return element;
}
/**
* @param {?} tag
* @param {?} el
* @return {?}
*/
_setMetaElementAttributes(tag, el) {
Object.keys(tag).forEach((prop) => this._dom.setAttribute(el, prop, tag[prop]));
return el;
}
/**
* @param {?} tag
* @return {?}
*/
_parseSelector(tag) {
const /** @type {?} */ attr = tag.name ? 'name' : 'property';
return `${attr}="${tag[attr]}"`;
}
/**
* @param {?} tag
* @param {?} elem
* @return {?}
*/
_containsAttributes(tag, elem) {
return Object.keys(tag).every((key) => this._dom.getAttribute(elem, key) === tag[key]);
}
}
Meta.decorators = [
{ type: Injectable },
];
/** @nocollapse */
Meta.ctorParameters = () => [
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT$1,] },] },
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* An id that identifies a particular application being bootstrapped, that should
* match across the client/server boundary.
*/
const TRANSITION_ID = new InjectionToken('TRANSITION_ID');
/**
* @param {?} transitionId
* @param {?} document
* @param {?} injector
* @return {?}
*/
function appInitializerFactory(transitionId, document, injector) {
return () => {
// Wait for all application initializers to be completed before removing the styles set by
// the server.
injector.get(ApplicationInitStatus).donePromise.then(() => {
const /** @type {?} */ dom = getDOM();
const /** @type {?} */ styles = Array.prototype.slice.apply(dom.querySelectorAll(document, `style[ng-transition]`));
styles.filter(el => dom.getAttribute(el, 'ng-transition') === transitionId)
.forEach(el => dom.remove(el));
});
};
}
const SERVER_TRANSITION_PROVIDERS = [
{
provide: APP_INITIALIZER,
useFactory: appInitializerFactory,
deps: [TRANSITION_ID, DOCUMENT$1, Injector],
multi: true
},
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
class BrowserGetTestability {
/**
* @return {?}
*/
static init() { setTestabilityGetter(new BrowserGetTestability()); }
/**
* @param {?} registry
* @return {?}
*/
addToWindow(registry) {
ɵglobal['getAngularTestability'] = (elem, findInAncestors = true) => {
const /** @type {?} */ testability = registry.findTestabilityInTree(elem, findInAncestors);
if (testability == null) {
throw new Error('Could not find testability for element.');
}
return testability;
};
ɵglobal['getAllAngularTestabilities'] = () => registry.getAllTestabilities();
ɵglobal['getAllAngularRootElements'] = () => registry.getAllRootElements();
const /** @type {?} */ whenAllStable = (callback /** TODO #9100 */) => {
const /** @type {?} */ testabilities = ɵglobal['getAllAngularTestabilities']();
let /** @type {?} */ count = testabilities.length;
let /** @type {?} */ didWork = false;
const /** @type {?} */ decrement = function (didWork_ /** TODO #9100 */) {
didWork = didWork || didWork_;
count--;
if (count == 0) {
callback(didWork);
}
};
testabilities.forEach(function (testability /** TODO #9100 */) {
testability.whenStable(decrement);
});
};
if (!ɵglobal['frameworkStabilizers']) {
ɵglobal['frameworkStabilizers'] = [];
}
ɵglobal['frameworkStabilizers'].push(whenAllStable);
}
/**
* @param {?} registry
* @param {?} elem
* @param {?} findInAncestors
* @return {?}
*/
findTestabilityInTree(registry, elem, findInAncestors) {
if (elem == null) {
return null;
}
const /** @type {?} */ t = registry.getTestability(elem);
if (t != null) {
return t;
}
else if (!findInAncestors) {
return null;
}
if (getDOM().isShadowRoot(elem)) {
return this.findTestabilityInTree(registry, getDOM().getHost(elem), true);
}
return this.findTestabilityInTree(registry, getDOM().parentElement(elem), true);
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* A service that can be used to get and set the title of a current HTML document.
*
* Since an Angular application can't be bootstrapped on the entire HTML document (`` tag)
* it is not possible to bind to the `text` property of the `HTMLTitleElement` elements
* (representing the `
` tag). Instead, this service can be used to set and get the current
* title value.
*
* \@experimental
*/
class Title {
/**
* @param {?} _doc
*/
constructor(_doc) {
this._doc = _doc;
}
/**
* Get the title of the current HTML document.
* @return {?}
*/
getTitle() { return getDOM().getTitle(this._doc); }
/**
* Set the title of the current HTML document.
* @param {?} newTitle
* @return {?}
*/
setTitle(newTitle) { getDOM().setTitle(this._doc, newTitle); }
}
Title.decorators = [
{ type: Injectable },
];
/** @nocollapse */
Title.ctorParameters = () => [
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT$1,] },] },
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* @param {?} input
* @return {?}
*/
/**
* @param {?} input
* @return {?}
*/
/**
* Exports the value under a given `name` in the global property `ng`. For example `ng.probe` if
* `name` is `'probe'`.
* @param {?} name Name under which it will be exported. Keep in mind this will be a property of the
* global `ng` object.
* @param {?} value The value to export.
* @return {?}
*/
function exportNgVar(name, value) {
if (typeof COMPILED === 'undefined' || !COMPILED) {
// Note: we can't export `ng` when using closure enhanced optimization as:
// - closure declares globals itself for minified names, which sometimes clobber our `ng` global
// - we can't declare a closure extern as the namespace `ng` is already used within Google
// for typings for angularJS (via `goog.provide('ng....')`).
const /** @type {?} */ ng = ɵglobal['ng'] = (/** @type {?} */ (ɵglobal['ng'])) || {};
ng[name] = value;
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const CORE_TOKENS = {
'ApplicationRef': ApplicationRef,
'NgZone': NgZone,
};
const INSPECT_GLOBAL_NAME = 'probe';
const CORE_TOKENS_GLOBAL_NAME = 'coreTokens';
/**
* Returns a {\@link DebugElement} for the given native DOM element, or
* null if the given native element does not have an Angular view associated
* with it.
* @param {?} element
* @return {?}
*/
function inspectNativeElement(element) {
return getDebugNode(element);
}
/**
* @param {?} coreTokens
* @return {?}
*/
function _createNgProbe(coreTokens) {
exportNgVar(INSPECT_GLOBAL_NAME, inspectNativeElement);
exportNgVar(CORE_TOKENS_GLOBAL_NAME, Object.assign({}, CORE_TOKENS, _ngProbeTokensToMap(coreTokens || [])));
return () => inspectNativeElement;
}
/**
* @param {?} tokens
* @return {?}
*/
function _ngProbeTokensToMap(tokens) {
return tokens.reduce((prev, t) => (prev[t.name] = t.token, prev), {});
}
/**
* Providers which support debugging Angular applications (e.g. via `ng.probe`).
*/
const ELEMENT_PROBE_PROVIDERS = [
{
provide: APP_INITIALIZER,
useFactory: _createNgProbe,
deps: [
[NgProbeToken, new Optional()],
],
multi: true,
},
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* \@stable
*/
const EVENT_MANAGER_PLUGINS = new InjectionToken('EventManagerPlugins');
/**
* \@stable
*/
class EventManager {
/**
* @param {?} plugins
* @param {?} _zone
*/
constructor(plugins, _zone) {
this._zone = _zone;
this._eventNameToPlugin = new Map();
plugins.forEach(p => p.manager = this);
this._plugins = plugins.slice().reverse();
}
/**
* @param {?} element
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
addEventListener(element, eventName, handler) {
const /** @type {?} */ plugin = this._findPluginFor(eventName);
return plugin.addEventListener(element, eventName, handler);
}
/**
* @param {?} target
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
addGlobalEventListener(target, eventName, handler) {
const /** @type {?} */ plugin = this._findPluginFor(eventName);
return plugin.addGlobalEventListener(target, eventName, handler);
}
/**
* @return {?}
*/
getZone() { return this._zone; }
/**
* \@internal
* @param {?} eventName
* @return {?}
*/
_findPluginFor(eventName) {
const /** @type {?} */ plugin = this._eventNameToPlugin.get(eventName);
if (plugin) {
return plugin;
}
const /** @type {?} */ plugins = this._plugins;
for (let /** @type {?} */ i = 0; i < plugins.length; i++) {
const /** @type {?} */ plugin = plugins[i];
if (plugin.supports(eventName)) {
this._eventNameToPlugin.set(eventName, plugin);
return plugin;
}
}
throw new Error(`No event manager plugin found for event ${eventName}`);
}
}
EventManager.decorators = [
{ type: Injectable },
];
/** @nocollapse */
EventManager.ctorParameters = () => [
{ type: Array, decorators: [{ type: Inject, args: [EVENT_MANAGER_PLUGINS,] },] },
{ type: NgZone, },
];
/**
* @abstract
*/
class EventManagerPlugin {
/**
* @param {?} _doc
*/
constructor(_doc) {
this._doc = _doc;
}
/**
* @param {?} element
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
addGlobalEventListener(element, eventName, handler) {
const /** @type {?} */ target = getDOM().getGlobalEventTarget(this._doc, element);
if (!target) {
throw new Error(`Unsupported event target ${target} for event ${eventName}`);
}
return this.addEventListener(target, eventName, handler);
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
class SharedStylesHost {
constructor() {
/**
* \@internal
*/
this._stylesSet = new Set();
}
/**
* @param {?} styles
* @return {?}
*/
addStyles(styles) {
const /** @type {?} */ additions = new Set();
styles.forEach(style => {
if (!this._stylesSet.has(style)) {
this._stylesSet.add(style);
additions.add(style);
}
});
this.onStylesAdded(additions);
}
/**
* @param {?} additions
* @return {?}
*/
onStylesAdded(additions) { }
/**
* @return {?}
*/
getAllStyles() { return Array.from(this._stylesSet); }
}
SharedStylesHost.decorators = [
{ type: Injectable },
];
/** @nocollapse */
SharedStylesHost.ctorParameters = () => [];
class DomSharedStylesHost extends SharedStylesHost {
/**
* @param {?} _doc
*/
constructor(_doc) {
super();
this._doc = _doc;
this._hostNodes = new Set();
this._styleNodes = new Set();
this._hostNodes.add(_doc.head);
}
/**
* @param {?} styles
* @param {?} host
* @return {?}
*/
_addStylesToHost(styles, host) {
styles.forEach((style) => {
const /** @type {?} */ styleEl = this._doc.createElement('style');
styleEl.textContent = style;
this._styleNodes.add(host.appendChild(styleEl));
});
}
/**
* @param {?} hostNode
* @return {?}
*/
addHost(hostNode) {
this._addStylesToHost(this._stylesSet, hostNode);
this._hostNodes.add(hostNode);
}
/**
* @param {?} hostNode
* @return {?}
*/
removeHost(hostNode) { this._hostNodes.delete(hostNode); }
/**
* @param {?} additions
* @return {?}
*/
onStylesAdded(additions) {
this._hostNodes.forEach(hostNode => this._addStylesToHost(additions, hostNode));
}
/**
* @return {?}
*/
ngOnDestroy() { this._styleNodes.forEach(styleNode => getDOM().remove(styleNode)); }
}
DomSharedStylesHost.decorators = [
{ type: Injectable },
];
/** @nocollapse */
DomSharedStylesHost.ctorParameters = () => [
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT$1,] },] },
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const NAMESPACE_URIS = {
'svg': 'http://www.w3.org/2000/svg',
'xhtml': 'http://www.w3.org/1999/xhtml',
'xlink': 'http://www.w3.org/1999/xlink',
'xml': 'http://www.w3.org/XML/1998/namespace',
'xmlns': 'http://www.w3.org/2000/xmlns/',
};
const COMPONENT_REGEX = /%COMP%/g;
const COMPONENT_VARIABLE = '%COMP%';
const HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;
/**
* @param {?} componentShortId
* @return {?}
*/
function shimContentAttribute(componentShortId) {
return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
}
/**
* @param {?} componentShortId
* @return {?}
*/
function shimHostAttribute(componentShortId) {
return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
}
/**
* @param {?} compId
* @param {?} styles
* @param {?} target
* @return {?}
*/
function flattenStyles(compId, styles, target) {
for (let /** @type {?} */ i = 0; i < styles.length; i++) {
let /** @type {?} */ style = styles[i];
if (Array.isArray(style)) {
flattenStyles(compId, style, target);
}
else {
style = style.replace(COMPONENT_REGEX, compId);
target.push(style);
}
}
return target;
}
/**
* @param {?} eventHandler
* @return {?}
*/
function decoratePreventDefault(eventHandler) {
return (event) => {
const /** @type {?} */ allowDefaultBehavior = eventHandler(event);
if (allowDefaultBehavior === false) {
// TODO(tbosch): move preventDefault into event plugins...
event.preventDefault();
event.returnValue = false;
}
};
}
class DomRendererFactory2 {
/**
* @param {?} eventManager
* @param {?} sharedStylesHost
*/
constructor(eventManager, sharedStylesHost) {
this.eventManager = eventManager;
this.sharedStylesHost = sharedStylesHost;
this.rendererByCompId = new Map();
this.defaultRenderer = new DefaultDomRenderer2(eventManager);
}
/**
* @param {?} element
* @param {?} type
* @return {?}
*/
createRenderer(element, type) {
if (!element || !type) {
return this.defaultRenderer;
}
switch (type.encapsulation) {
case ViewEncapsulation.Emulated: {
let /** @type {?} */ renderer = this.rendererByCompId.get(type.id);
if (!renderer) {
renderer =
new EmulatedEncapsulationDomRenderer2(this.eventManager, this.sharedStylesHost, type);
this.rendererByCompId.set(type.id, renderer);
}
(/** @type {?} */ (renderer)).applyToHost(element);
return renderer;
}
case ViewEncapsulation.Native:
return new ShadowDomRenderer(this.eventManager, this.sharedStylesHost, element, type);
default: {
if (!this.rendererByCompId.has(type.id)) {
const /** @type {?} */ styles = flattenStyles(type.id, type.styles, []);
this.sharedStylesHost.addStyles(styles);
this.rendererByCompId.set(type.id, this.defaultRenderer);
}
return this.defaultRenderer;
}
}
}
/**
* @return {?}
*/
begin() { }
/**
* @return {?}
*/
end() { }
}
DomRendererFactory2.decorators = [
{ type: Injectable },
];
/** @nocollapse */
DomRendererFactory2.ctorParameters = () => [
{ type: EventManager, },
{ type: DomSharedStylesHost, },
];
class DefaultDomRenderer2 {
/**
* @param {?} eventManager
*/
constructor(eventManager) {
this.eventManager = eventManager;
this.data = Object.create(null);
}
/**
* @return {?}
*/
destroy() { }
/**
* @param {?} name
* @param {?=} namespace
* @return {?}
*/
createElement(name, namespace) {
if (namespace) {
return document.createElementNS(NAMESPACE_URIS[namespace], name);
}
return document.createElement(name);
}
/**
* @param {?} value
* @return {?}
*/
createComment(value) { return document.createComment(value); }
/**
* @param {?} value
* @return {?}
*/
createText(value) { return document.createTextNode(value); }
/**
* @param {?} parent
* @param {?} newChild
* @return {?}
*/
appendChild(parent, newChild) { parent.appendChild(newChild); }
/**
* @param {?} parent
* @param {?} newChild
* @param {?} refChild
* @return {?}
*/
insertBefore(parent, newChild, refChild) {
if (parent) {
parent.insertBefore(newChild, refChild);
}
}
/**
* @param {?} parent
* @param {?} oldChild
* @return {?}
*/
removeChild(parent, oldChild) {
if (parent) {
parent.removeChild(oldChild);
}
}
/**
* @param {?} selectorOrNode
* @return {?}
*/
selectRootElement(selectorOrNode) {
let /** @type {?} */ el = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) :
selectorOrNode;
if (!el) {
throw new Error(`The selector "${selectorOrNode}" did not match any elements`);
}
el.textContent = '';
return el;
}
/**
* @param {?} node
* @return {?}
*/
parentNode(node) { return node.parentNode; }
/**
* @param {?} node
* @return {?}
*/
nextSibling(node) { return node.nextSibling; }
/**
* @param {?} el
* @param {?} name
* @param {?} value
* @param {?=} namespace
* @return {?}
*/
setAttribute(el, name, value, namespace) {
if (namespace) {
name = `${namespace}:${name}`;
const /** @type {?} */ namespaceUri = NAMESPACE_URIS[namespace];
if (namespaceUri) {
el.setAttributeNS(namespaceUri, name, value);
}
else {
el.setAttribute(name, value);
}
}
else {
el.setAttribute(name, value);
}
}
/**
* @param {?} el
* @param {?} name
* @param {?=} namespace
* @return {?}
*/
removeAttribute(el, name, namespace) {
if (namespace) {
const /** @type {?} */ namespaceUri = NAMESPACE_URIS[namespace];
if (namespaceUri) {
el.removeAttributeNS(namespaceUri, name);
}
else {
el.removeAttribute(`${namespace}:${name}`);
}
}
else {
el.removeAttribute(name);
}
}
/**
* @param {?} el
* @param {?} name
* @return {?}
*/
addClass(el, name) { el.classList.add(name); }
/**
* @param {?} el
* @param {?} name
* @return {?}
*/
removeClass(el, name) { el.classList.remove(name); }
/**
* @param {?} el
* @param {?} style
* @param {?} value
* @param {?} flags
* @return {?}
*/
setStyle(el, style, value, flags) {
if (flags & RendererStyleFlags2.DashCase) {
el.style.setProperty(style, value, !!(flags & RendererStyleFlags2.Important) ? 'important' : '');
}
else {
el.style[style] = value;
}
}
/**
* @param {?} el
* @param {?} style
* @param {?} flags
* @return {?}
*/
removeStyle(el, style, flags) {
if (flags & RendererStyleFlags2.DashCase) {
el.style.removeProperty(style);
}
else {
// IE requires '' instead of null
// see https://github.com/angular/angular/issues/7916
el.style[style] = '';
}
}
/**
* @param {?} el
* @param {?} name
* @param {?} value
* @return {?}
*/
setProperty(el, name, value) {
checkNoSyntheticProp(name, 'property');
el[name] = value;
}
/**
* @param {?} node
* @param {?} value
* @return {?}
*/
setValue(node, value) { node.nodeValue = value; }
/**
* @param {?} target
* @param {?} event
* @param {?} callback
* @return {?}
*/
listen(target, event, callback) {
checkNoSyntheticProp(event, 'listener');
if (typeof target === 'string') {
return /** @type {?} */ (this.eventManager.addGlobalEventListener(target, event, decoratePreventDefault(callback)));
}
return /** @type {?} */ ((this.eventManager.addEventListener(target, event, decoratePreventDefault(callback))));
}
}
const AT_CHARCODE = '@'.charCodeAt(0);
/**
* @param {?} name
* @param {?} nameKind
* @return {?}
*/
function checkNoSyntheticProp(name, nameKind) {
if (name.charCodeAt(0) === AT_CHARCODE) {
throw new Error(`Found the synthetic ${nameKind} ${name}. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application.`);
}
}
class EmulatedEncapsulationDomRenderer2 extends DefaultDomRenderer2 {
/**
* @param {?} eventManager
* @param {?} sharedStylesHost
* @param {?} component
*/
constructor(eventManager, sharedStylesHost, component) {
super(eventManager);
this.component = component;
const /** @type {?} */ styles = flattenStyles(component.id, component.styles, []);
sharedStylesHost.addStyles(styles);
this.contentAttr = shimContentAttribute(component.id);
this.hostAttr = shimHostAttribute(component.id);
}
/**
* @param {?} element
* @return {?}
*/
applyToHost(element) { super.setAttribute(element, this.hostAttr, ''); }
/**
* @param {?} parent
* @param {?} name
* @return {?}
*/
createElement(parent, name) {
const /** @type {?} */ el = super.createElement(parent, name);
super.setAttribute(el, this.contentAttr, '');
return el;
}
}
class ShadowDomRenderer extends DefaultDomRenderer2 {
/**
* @param {?} eventManager
* @param {?} sharedStylesHost
* @param {?} hostEl
* @param {?} component
*/
constructor(eventManager, sharedStylesHost, hostEl, component) {
super(eventManager);
this.sharedStylesHost = sharedStylesHost;
this.hostEl = hostEl;
this.component = component;
this.shadowRoot = (/** @type {?} */ (hostEl)).createShadowRoot();
this.sharedStylesHost.addHost(this.shadowRoot);
const /** @type {?} */ styles = flattenStyles(component.id, component.styles, []);
for (let /** @type {?} */ i = 0; i < styles.length; i++) {
const /** @type {?} */ styleEl = document.createElement('style');
styleEl.textContent = styles[i];
this.shadowRoot.appendChild(styleEl);
}
}
/**
* @param {?} node
* @return {?}
*/
nodeOrShadowRoot(node) { return node === this.hostEl ? this.shadowRoot : node; }
/**
* @return {?}
*/
destroy() { this.sharedStylesHost.removeHost(this.shadowRoot); }
/**
* @param {?} parent
* @param {?} newChild
* @return {?}
*/
appendChild(parent, newChild) {
return super.appendChild(this.nodeOrShadowRoot(parent), newChild);
}
/**
* @param {?} parent
* @param {?} newChild
* @param {?} refChild
* @return {?}
*/
insertBefore(parent, newChild, refChild) {
return super.insertBefore(this.nodeOrShadowRoot(parent), newChild, refChild);
}
/**
* @param {?} parent
* @param {?} oldChild
* @return {?}
*/
removeChild(parent, oldChild) {
return super.removeChild(this.nodeOrShadowRoot(parent), oldChild);
}
/**
* @param {?} node
* @return {?}
*/
parentNode(node) {
return this.nodeOrShadowRoot(super.parentNode(this.nodeOrShadowRoot(node)));
}
}
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const ɵ0 = function (v) {
return '__zone_symbol__' + v;
};
/**
* Detect if Zone is present. If it is then use simple zone aware 'addEventListener'
* since Angular can do much more
* efficient bookkeeping than Zone can, because we have additional information. This speeds up
* addEventListener by 3x.
*/
const __symbol__ = (typeof Zone !== 'undefined') && (/** @type {?} */ (Zone))['__symbol__'] || ɵ0;
const ADD_EVENT_LISTENER = __symbol__('addEventListener');
const REMOVE_EVENT_LISTENER = __symbol__('removeEventListener');
const symbolNames = {};
const FALSE = 'FALSE';
const ANGULAR = 'ANGULAR';
const NATIVE_ADD_LISTENER = 'addEventListener';
const NATIVE_REMOVE_LISTENER = 'removeEventListener';
// use the same symbol string which is used in zone.js
const stopSymbol = '__zone_symbol__propagationStopped';
const stopMethodSymbol = '__zone_symbol__stopImmediatePropagation';
const blackListedEvents = (typeof Zone !== 'undefined') && (/** @type {?} */ (Zone))[__symbol__('BLACK_LISTED_EVENTS')];
let blackListedMap;
if (blackListedEvents) {
blackListedMap = {};
blackListedEvents.forEach(eventName => { blackListedMap[eventName] = eventName; });
}
const isBlackListedEvent = function (eventName) {
if (!blackListedMap) {
return false;
}
return blackListedMap.hasOwnProperty(eventName);
};
// a global listener to handle all dom event,
// so we do not need to create a closure everytime
const globalListener = function (event) {
const /** @type {?} */ symbolName = symbolNames[event.type];
if (!symbolName) {
return;
}
const /** @type {?} */ taskDatas = this[symbolName];
if (!taskDatas) {
return;
}
const /** @type {?} */ args = [event];
if (taskDatas.length === 1) {
// if taskDatas only have one element, just invoke it
const /** @type {?} */ taskData = taskDatas[0];
if (taskData.zone !== Zone.current) {
// only use Zone.run when Zone.current not equals to stored zone
return taskData.zone.run(taskData.handler, this, args);
}
else {
return taskData.handler.apply(this, args);
}
}
else {
// copy tasks as a snapshot to avoid event handlers remove
// itself or others
const /** @type {?} */ copiedTasks = taskDatas.slice();
for (let /** @type {?} */ i = 0; i < copiedTasks.length; i++) {
// if other listener call event.stopImmediatePropagation
// just break
if ((/** @type {?} */ (event))[stopSymbol] === true) {
break;
}
const /** @type {?} */ taskData = copiedTasks[i];
if (taskData.zone !== Zone.current) {
// only use Zone.run when Zone.current not equals to stored zone
taskData.zone.run(taskData.handler, this, args);
}
else {
taskData.handler.apply(this, args);
}
}
}
};
class DomEventsPlugin extends EventManagerPlugin {
/**
* @param {?} doc
* @param {?} ngZone
*/
constructor(doc, ngZone) {
super(doc);
this.ngZone = ngZone;
this.patchEvent();
}
/**
* @return {?}
*/
patchEvent() {
if (!Event || !Event.prototype) {
return;
}
if ((/** @type {?} */ (Event.prototype))[stopMethodSymbol]) {
// already patched by zone.js
return;
}
const /** @type {?} */ delegate = (/** @type {?} */ (Event.prototype))[stopMethodSymbol] =
Event.prototype.stopImmediatePropagation;
Event.prototype.stopImmediatePropagation = function () {
if (this) {
this[stopSymbol] = true;
}
// should call native delegate in case
// in some enviroment part of the application
// will not use the patched Event
delegate && delegate.apply(this, arguments);
};
}
/**
* @param {?} eventName
* @return {?}
*/
supports(eventName) { return true; }
/**
* @param {?} element
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
addEventListener(element, eventName, handler) {
/**
* This code is about to add a listener to the DOM. If Zone.js is present, than
* `addEventListener` has been patched. The patched code adds overhead in both
* memory and speed (3x slower) than native. For this reason if we detect that
* Zone.js is present we use a simple version of zone aware addEventListener instead.
* The result is faster registration and the zone will be restored.
* But ZoneSpec.onScheduleTask, ZoneSpec.onInvokeTask, ZoneSpec.onCancelTask
* will not be invoked
* We also do manual zone restoration in element.ts renderEventHandlerClosure method.
*
* NOTE: it is possible that the element is from different iframe, and so we
* have to check before we execute the method.
*/
const /** @type {?} */ self = this;
const /** @type {?} */ zoneJsLoaded = element[ADD_EVENT_LISTENER];
let /** @type {?} */ callback = /** @type {?} */ (handler);
// if zonejs is loaded and current zone is not ngZone
// we keep Zone.current on target for later restoration.
if (zoneJsLoaded && (!NgZone.isInAngularZone() || isBlackListedEvent(eventName))) {
let /** @type {?} */ symbolName = symbolNames[eventName];
if (!symbolName) {
symbolName = symbolNames[eventName] = __symbol__(ANGULAR + eventName + FALSE);
}
let /** @type {?} */ taskDatas = (/** @type {?} */ (element))[symbolName];
const /** @type {?} */ globalListenerRegistered = taskDatas && taskDatas.length > 0;
if (!taskDatas) {
taskDatas = (/** @type {?} */ (element))[symbolName] = [];
}
const /** @type {?} */ zone = isBlackListedEvent(eventName) ? Zone.root : Zone.current;
if (taskDatas.length === 0) {
taskDatas.push({ zone: zone, handler: callback });
}
else {
let /** @type {?} */ callbackRegistered = false;
for (let /** @type {?} */ i = 0; i < taskDatas.length; i++) {
if (taskDatas[i].handler === callback) {
callbackRegistered = true;
break;
}
}
if (!callbackRegistered) {
taskDatas.push({ zone: zone, handler: callback });
}
}
if (!globalListenerRegistered) {
element[ADD_EVENT_LISTENER](eventName, globalListener, false);
}
}
else {
element[NATIVE_ADD_LISTENER](eventName, callback, false);
}
return () => this.removeEventListener(element, eventName, callback);
}
/**
* @param {?} target
* @param {?} eventName
* @param {?} callback
* @return {?}
*/
removeEventListener(target, eventName, callback) {
let /** @type {?} */ underlyingRemove = target[REMOVE_EVENT_LISTENER];
// zone.js not loaded, use native removeEventListener
if (!underlyingRemove) {
return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
}
let /** @type {?} */ symbolName = symbolNames[eventName];
let /** @type {?} */ taskDatas = symbolName && target[symbolName];
if (!taskDatas) {
// addEventListener not using patched version
// just call native removeEventListener
return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
}
// fix issue 20532, should be able to remove
// listener which was added inside of ngZone
let /** @type {?} */ found = false;
for (let /** @type {?} */ i = 0; i < taskDatas.length; i++) {
// remove listener from taskDatas if the callback equals
if (taskDatas[i].handler === callback) {
found = true;
taskDatas.splice(i, 1);
break;
}
}
if (found) {
if (taskDatas.length === 0) {
// all listeners are removed, we can remove the globalListener from target
underlyingRemove.apply(target, [eventName, globalListener, false]);
}
}
else {
// not found in taskDatas, the callback may be added inside of ngZone
// use native remove listener to remove the calback
target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
}
}
}
DomEventsPlugin.decorators = [
{ type: Injectable },
];
/** @nocollapse */
DomEventsPlugin.ctorParameters = () => [
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT$1,] },] },
{ type: NgZone, },
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const EVENT_NAMES = {
// pan
'pan': true,
'panstart': true,
'panmove': true,
'panend': true,
'pancancel': true,
'panleft': true,
'panright': true,
'panup': true,
'pandown': true,
// pinch
'pinch': true,
'pinchstart': true,
'pinchmove': true,
'pinchend': true,
'pinchcancel': true,
'pinchin': true,
'pinchout': true,
// press
'press': true,
'pressup': true,
// rotate
'rotate': true,
'rotatestart': true,
'rotatemove': true,
'rotateend': true,
'rotatecancel': true,
// swipe
'swipe': true,
'swipeleft': true,
'swiperight': true,
'swipeup': true,
'swipedown': true,
// tap
'tap': true,
};
/**
* A DI token that you can use to provide{\@link HammerGestureConfig} to Angular. Use it to configure
* Hammer gestures.
*
* \@experimental
*/
const HAMMER_GESTURE_CONFIG = new InjectionToken('HammerGestureConfig');
/**
* @record
*/
/**
* \@experimental
*/
class HammerGestureConfig {
constructor() {
this.events = [];
this.overrides = {};
}
/**
* @param {?} element
* @return {?}
*/
buildHammer(element) {
const /** @type {?} */ mc = new Hammer(element);
mc.get('pinch').set({ enable: true });
mc.get('rotate').set({ enable: true });
for (const /** @type {?} */ eventName in this.overrides) {
mc.get(eventName).set(this.overrides[eventName]);
}
return mc;
}
}
HammerGestureConfig.decorators = [
{ type: Injectable },
];
/** @nocollapse */
HammerGestureConfig.ctorParameters = () => [];
class HammerGesturesPlugin extends EventManagerPlugin {
/**
* @param {?} doc
* @param {?} _config
*/
constructor(doc, _config) {
super(doc);
this._config = _config;
}
/**
* @param {?} eventName
* @return {?}
*/
supports(eventName) {
if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
return false;
}
if (!(/** @type {?} */ (window)).Hammer) {
throw new Error(`Hammer.js is not loaded, can not bind ${eventName} event`);
}
return true;
}
/**
* @param {?} element
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
addEventListener(element, eventName, handler) {
const /** @type {?} */ zone = this.manager.getZone();
eventName = eventName.toLowerCase();
return zone.runOutsideAngular(() => {
// Creating the manager bind events, must be done outside of angular
const /** @type {?} */ mc = this._config.buildHammer(element);
const /** @type {?} */ callback = function (eventObj) {
zone.runGuarded(function () { handler(eventObj); });
};
mc.on(eventName, callback);
return () => mc.off(eventName, callback);
});
}
/**
* @param {?} eventName
* @return {?}
*/
isCustomEvent(eventName) { return this._config.events.indexOf(eventName) > -1; }
}
HammerGesturesPlugin.decorators = [
{ type: Injectable },
];
/** @nocollapse */
HammerGesturesPlugin.ctorParameters = () => [
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT$1,] },] },
{ type: HammerGestureConfig, decorators: [{ type: Inject, args: [HAMMER_GESTURE_CONFIG,] },] },
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];
const ɵ0$1 = (event) => event.altKey;
const ɵ1$1 = (event) => event.ctrlKey;
const ɵ2$1 = (event) => event.metaKey;
const ɵ3 = (event) => event.shiftKey;
const MODIFIER_KEY_GETTERS = {
'alt': ɵ0$1,
'control': ɵ1$1,
'meta': ɵ2$1,
'shift': ɵ3
};
/**
* \@experimental
*/
class KeyEventsPlugin extends EventManagerPlugin {
/**
* @param {?} doc
*/
constructor(doc) { super(doc); }
/**
* @param {?} eventName
* @return {?}
*/
supports(eventName) { return KeyEventsPlugin.parseEventName(eventName) != null; }
/**
* @param {?} element
* @param {?} eventName
* @param {?} handler
* @return {?}
*/
addEventListener(element, eventName, handler) {
const /** @type {?} */ parsedEvent = /** @type {?} */ ((KeyEventsPlugin.parseEventName(eventName)));
const /** @type {?} */ outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
return this.manager.getZone().runOutsideAngular(() => {
return getDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler);
});
}
/**
* @param {?} eventName
* @return {?}
*/
static parseEventName(eventName) {
const /** @type {?} */ parts = eventName.toLowerCase().split('.');
const /** @type {?} */ domEventName = parts.shift();
if ((parts.length === 0) || !(domEventName === 'keydown' || domEventName === 'keyup')) {
return null;
}
const /** @type {?} */ key = KeyEventsPlugin._normalizeKey(/** @type {?} */ ((parts.pop())));
let /** @type {?} */ fullKey = '';
MODIFIER_KEYS.forEach(modifierName => {
const /** @type {?} */ index = parts.indexOf(modifierName);
if (index > -1) {
parts.splice(index, 1);
fullKey += modifierName + '.';
}
});
fullKey += key;
if (parts.length != 0 || key.length === 0) {
// returning null instead of throwing to let another plugin process the event
return null;
}
const /** @type {?} */ result = {};
result['domEventName'] = domEventName;
result['fullKey'] = fullKey;
return result;
}
/**
* @param {?} event
* @return {?}
*/
static getEventFullKey(event) {
let /** @type {?} */ fullKey = '';
let /** @type {?} */ key = getDOM().getEventKey(event);
key = key.toLowerCase();
if (key === ' ') {
key = 'space'; // for readability
}
else if (key === '.') {
key = 'dot'; // because '.' is used as a separator in event names
}
MODIFIER_KEYS.forEach(modifierName => {
if (modifierName != key) {
const /** @type {?} */ modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
if (modifierGetter(event)) {
fullKey += modifierName + '.';
}
}
});
fullKey += key;
return fullKey;
}
/**
* @param {?} fullKey
* @param {?} handler
* @param {?} zone
* @return {?}
*/
static eventCallback(fullKey, handler, zone) {
return (event /** TODO #9100 */) => {
if (KeyEventsPlugin.getEventFullKey(event) === fullKey) {
zone.runGuarded(() => handler(event));
}
};
}
/**
* \@internal
* @param {?} keyName
* @return {?}
*/
static _normalizeKey(keyName) {
// TODO: switch to a Map if the mapping grows too much
switch (keyName) {
case 'esc':
return 'escape';
default:
return keyName;
}
}
}
KeyEventsPlugin.decorators = [
{ type: Injectable },
];
/** @nocollapse */
KeyEventsPlugin.ctorParameters = () => [
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT$1,] },] },
];
/**
* @fileoverview added by tsickle
* @suppress {checkTypes} checked by tsc
*/
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
/**
* This helper class is used to get hold of an inert tree of DOM elements containing dirty HTML
* that needs sanitizing.
* Depending upon browser support we must use one of three strategies for doing this.
* Support: Safari 10.x -> XHR strategy
* Support: Firefox -> DomParser strategy
* Default: InertDocument strategy
*/
class InertBodyHelper {
/**
* @param {?} defaultDoc
* @param {?} DOM
*/
constructor(defaultDoc, DOM) {
this.defaultDoc = defaultDoc;
this.DOM = DOM;
const /** @type {?} */ inertDocument = this.DOM.createHtmlDocument();
this.inertBodyElement = inertDocument.body;
if (this.inertBodyElement == null) {
// usually there should be only one body element in the document, but IE doesn't have any, so
// we need to create one.
const /** @type {?} */ inertHtml = this.DOM.createElement('html', inertDocument);
this.inertBodyElement = this.DOM.createElement('body', inertDocument);
this.DOM.appendChild(inertHtml, this.inertBodyElement);
this.DOM.appendChild(inertDocument, inertHtml);
}
this.DOM.setInnerHTML(this.inertBodyElement, '');
if (this.inertBodyElement.querySelector && !this.inertBodyElement.querySelector('svg')) {
// We just hit the Safari 10.1 bug - which allows JS to run inside the SVG G element
// so use the XHR strategy.
this.getInertBodyElement = this.getInertBodyElement_XHR;
return;
}
this.DOM.setInnerHTML(this.inertBodyElement, '